Update data import
This commit is contained in:
parent
c5c32be397
commit
99320b77e2
|
@ -1 +1 @@
|
||||||
import{y as a,m as s,z as e,D as t,e as l}from"./index.be3c5d52.js";/* empty css */import"./vendor.9babb3f5.js";var d=a({name:"sb-image-display",model:s,props:{data:{type:null,default:e}},setup:a=>()=>t("figure",{class:"sb-image"},[t("img",{class:"sb-image__content",src:a.data.src,alt:a.data.alt},null),t(l,{block:a.data.description},null)])});export default d;
|
import{y as a,m as s,z as e,D as t,e as l}from"./index.7f5b9510.js";/* empty css */import"./vendor.9babb3f5.js";var i=a({name:"sb-image-display",model:s,props:{data:{type:null,default:e}},setup:a=>()=>t("figure",{class:"sb-image"},[t("img",{class:"sb-image__content",src:a.data.src,alt:a.data.alt},null),t(l,{block:a.data.description},null)])});export default i;
|
1
docs/assets/display.59646631.js
Normal file
1
docs/assets/display.59646631.js
Normal file
|
@ -0,0 +1 @@
|
||||||
|
import{j as a,m as s,k as r,q as p,s as e,x as t}from"./index.7f5b9510.js";/* empty css */import"./vendor.9babb3f5.js";var l=a({name:"sb-paragraph-display",model:s,props:{data:{type:Object,default:r}},setup(a){const s=p((()=>({"sb-paragraph":!0,[`sb-paragraph_align-${a.data.align}`]:!0})));return()=>e("p",t({class:s.value},{innerHTML:a.data.value}),null)}});export default l;
|
|
@ -1 +1 @@
|
||||||
import{d as a,m as s,g as t,c as e,a as l,e as o}from"./index.be3c5d52.js";/* empty css */import"./vendor.9babb3f5.js";var d=a({name:"sb-layout-display",model:s,props:{data:{type:null,default:t}},setup(a){const s=e((()=>({"sb-layout":!0,[`sb-layout_${a.data.orientation}`]:!0})));return()=>l("div",{class:s.value},[...a.data.children.map((a=>l(o,{key:a.id,block:a},null)))])}});export default d;
|
import{d as a,m as s,g as t,c as e,a as l,e as o}from"./index.7f5b9510.js";/* empty css */import"./vendor.9babb3f5.js";var d=a({name:"sb-layout-display",model:s,props:{data:{type:null,default:t}},setup(a){const s=e((()=>({"sb-layout":!0,[`sb-layout_${a.data.orientation}`]:!0})));return()=>l("div",{class:s.value},[...a.data.children.map((a=>l(o,{key:a.id,block:a},null)))])}});export default d;
|
|
@ -1 +1 @@
|
||||||
var e=Object.assign;import{G as t,m as n,H as a,I as s,J as l}from"./index.be3c5d52.js";import"./vendor.9babb3f5.js";var o=t({name:"sb-missing-block",model:n,props:e(e({},a),{name:String,data:{type:null,default:null},eventUpdate:{type:Function,default:()=>{}},eventAppendBlock:{type:Function,default:()=>{}},eventRemoveBlock:{type:Function,default:()=>{}}}),setup:e=>()=>s("div",{class:"sb-missing-block"},[l("Missing block: "),e.name])});export default o;
|
var e=Object.assign;import{G as t,m as n,H as a,I as s,J as l}from"./index.7f5b9510.js";import"./vendor.9babb3f5.js";var o=t({name:"sb-missing-block",model:n,props:e(e({},a),{name:String,data:{type:null,default:null},eventUpdate:{type:Function,default:()=>{}},eventAppendBlock:{type:Function,default:()=>{}},eventRemoveBlock:{type:Function,default:()=>{}}}),setup:e=>()=>s("div",{class:"sb-missing-block"},[l("Missing block: "),e.name])});export default o;
|
|
@ -1 +0,0 @@
|
||||||
import{j as a,m as s,k as r,q as e,s as p,x as t}from"./index.be3c5d52.js";/* empty css */import"./vendor.9babb3f5.js";var l=a({name:"sb-paragraph-display",model:s,props:{data:{type:Object,default:r}},setup(a){const s=e((()=>({"sb-paragraph":!0,[`sb-paragraph_align-${a.data.align}`]:!0})));return()=>p("p",t({class:s.value},{innerHTML:a.data.value}),null)}});export default l;
|
|
|
@ -1 +1 @@
|
||||||
var a=Object.assign;import{y as e,m as t,z as l,A as s,B as n,C as i,D as d,S as r,b as o,E as c,F as u,e as p}from"./index.be3c5d52.js";/* empty css */import"./vendor.9babb3f5.js";var v=e({name:"sb-image-edit",model:t,props:{onUpdate:{type:Function,default:()=>{}},data:{type:null,default:l}},setup(e){const t=s({src:e.data.src,alt:e.data.alt,description:e.data.description}),l=n(null);i((()=>e.data),(()=>{t.src=e.data.src,t.alt=e.data.alt,t.description=e.data.description}));const v=()=>{l.value&&l.value.click()},f=()=>{if(l.value&&l.value.files&&l.value.files.length){const a=new FileReader;a.addEventListener("load",(()=>{var t;const l=null==(t=null==a?void 0:a.result)?void 0:t.toString();if(!l)throw new Error("Couldn't load image src");e.onUpdate({src:l,alt:e.data.alt,description:e.data.description})})),a.readAsDataURL(l.value.files[0])}};return()=>d("figure",{class:"sb-image"},[d(r,null,{default:()=>[t.src?d(o,{"onClick:value":v},{default:()=>[c("Select Image")]}):null,d("input",{type:"file",ref:l,style:"display: none;",onInput:f},null)]}),t.src?d(u,null,[d("img",{src:t.src,alt:t.alt,class:"sb-image__content"},null),d(p,{block:t.description,onUpdate:t=>{return l=t,void e.onUpdate(a(a({},e.data),{description:l}));var l}},null)]):d(o,{"onClick:value":v},{default:()=>[c("Select Image")]})])}});export default v;
|
var a=Object.assign;import{y as e,m as t,z as l,A as s,B as n,C as i,D as d,S as r,b as o,E as c,F as u,e as p}from"./index.7f5b9510.js";/* empty css */import"./vendor.9babb3f5.js";var f=e({name:"sb-image-edit",model:t,props:{onUpdate:{type:Function,default:()=>{}},data:{type:null,default:l}},setup(e){const t=s({src:e.data.src,alt:e.data.alt,description:e.data.description}),l=n(null);i((()=>e.data),(()=>{t.src=e.data.src,t.alt=e.data.alt,t.description=e.data.description}));const f=()=>{l.value&&l.value.click()},v=()=>{if(l.value&&l.value.files&&l.value.files.length){const a=new FileReader;a.addEventListener("load",(()=>{var t;const l=null==(t=null==a?void 0:a.result)?void 0:t.toString();if(!l)throw new Error("Couldn't load image src");e.onUpdate({src:l,alt:e.data.alt,description:e.data.description})})),a.readAsDataURL(l.value.files[0])}};return()=>d("figure",{class:"sb-image"},[d(r,null,{default:()=>[t.src?d(o,{"onClick:value":f},{default:()=>[c("Select Image")]}):null,d("input",{type:"file",ref:l,style:"display: none;",onInput:v},null)]}),t.src?d(u,null,[d("img",{src:t.src,alt:t.alt,class:"sb-image__content"},null),d(p,{block:t.description,onUpdate:t=>{return l=t,void e.onUpdate(a(a({},e.data),{description:l}));var l}},null)]):d(o,{"onClick:value":f},{default:()=>[c("Select Image")]})])}});export default f;
|
|
@ -1 +1 @@
|
||||||
import{j as a,m as e,k as n,l as t,n as l,u as o,o as u,p as i,q as s,s as r,S as d,t as p,v}from"./index.be3c5d52.js";/* empty css */import"./vendor.9babb3f5.js";var c=a({name:"sb-paragraph-edit",model:e,props:{blockId:{type:String,required:!0},data:{type:null,default:n},onUpdate:{type:Function,default:()=>{}},onAppendBlock:{type:Function,default:()=>{}},onRemoveSelf:{type:Function,default:()=>{}},onActivateNext:{type:Function,default:()=>{}},onActivatePrevious:{type:Function,default:()=>{}}},setup(a){const e=t({value:a.data.value,align:a.data.align,focused:!1}),c=l(null),{isActive:f,activate:g}=o(a.blockId),b=()=>{c.value&&f.value&&c.value.focus()};u((()=>{b(),c.value&&(c.value.innerHTML=e.value)})),i(f,b),i((()=>a.data),(()=>{e.value=a.data.value,e.align=a.data.align,c.value&&(c.value.innerHTML=e.value)}));const y=a=>{e.value=a.target.innerHTML},h=s((()=>({"sb-paragraph":!0,"sb-paragraph_focused":e.focused,[`sb-paragraph_align-${e.align}`]:!0}))),m=n=>{a.onUpdate({value:e.value,align:n.target.value})},k=()=>{e.focused=!0,g()},A=()=>{e.focused=!1,a.onUpdate({value:e.value,align:e.align})},w=e=>{if("Enter"===e.key&&!e.shiftKey){const t=""+ +new Date;a.onAppendBlock({id:t,name:"sb-paragraph",data:n()}),g(t),e.preventDefault()}},F=n=>{var t;"Backspace"===n.key&&""===e.value&&a.onRemoveSelf();const l=window.getSelection(),o=null==l?void 0:l.focusNode,u=Array.from((null==(t=null==c?void 0:c.value)?void 0:t.childNodes)||[]),i=o?u.indexOf(o):-1;if(o===c.value||0===i||i===u.length-1)switch(n.key){case"ArrowDown":a.onActivateNext();break;case"ArrowUp":a.onActivatePrevious()}};return()=>r("div",{class:h.value},[r(d,null,{default:()=>[r(p,{value:e.align,onChange:m},{default:()=>[r("option",null,[v("left")]),r("option",null,[v("center")]),r("option",null,[v("right")])]})]}),r("p",{class:"sb-paragraph__input",ref:c,contenteditable:!0,onInput:y,onFocus:k,onBlur:A,onKeydown:w,onKeyup:F},null)])}});export default c;
|
import{j as a,m as e,k as n,l as t,n as l,u as o,o as u,p as i,q as s,s as r,S as d,t as p,v}from"./index.7f5b9510.js";/* empty css */import"./vendor.9babb3f5.js";var c=a({name:"sb-paragraph-edit",model:e,props:{blockId:{type:String,required:!0},data:{type:null,default:n},onUpdate:{type:Function,default:()=>{}},onAppendBlock:{type:Function,default:()=>{}},onRemoveSelf:{type:Function,default:()=>{}},onActivateNext:{type:Function,default:()=>{}},onActivatePrevious:{type:Function,default:()=>{}}},setup(a){const e=t({value:a.data.value,align:a.data.align,focused:!1}),c=l(null),{isActive:f,activate:g}=o(a.blockId),b=()=>{c.value&&f.value&&c.value.focus()};u((()=>{b(),c.value&&(c.value.innerHTML=e.value)})),i(f,b),i((()=>a.data),(()=>{e.value=a.data.value,e.align=a.data.align,c.value&&(c.value.innerHTML=e.value)}));const y=a=>{e.value=a.target.innerHTML},h=s((()=>({"sb-paragraph":!0,"sb-paragraph_focused":e.focused,[`sb-paragraph_align-${e.align}`]:!0}))),m=n=>{a.onUpdate({value:e.value,align:n.target.value})},k=()=>{e.focused=!0,g()},A=()=>{e.focused=!1,a.onUpdate({value:e.value,align:e.align})},w=e=>{if("Enter"===e.key&&!e.shiftKey){const t=""+ +new Date;a.onAppendBlock({id:t,name:"sb-paragraph",data:n()}),g(t),e.preventDefault()}},F=n=>{var t;"Backspace"===n.key&&""===e.value&&a.onRemoveSelf();const l=window.getSelection(),o=null==l?void 0:l.focusNode,u=Array.from((null==(t=null==c?void 0:c.value)?void 0:t.childNodes)||[]),i=o?u.indexOf(o):-1;if(o===c.value||0===i||i===u.length-1)switch(n.key){case"ArrowDown":a.onActivateNext();break;case"ArrowUp":a.onActivatePrevious()}};return()=>r("div",{class:h.value},[r(d,null,{default:()=>[r(p,{value:e.align,onChange:m},{default:()=>[r("option",null,[v("left")]),r("option",null,[v("center")]),r("option",null,[v("right")])]})]}),r("p",{class:"sb-paragraph__input",ref:c,contenteditable:!0,onInput:y,onFocus:k,onBlur:A,onKeydown:w,onKeyup:F},null)])}});export default c;
|
|
@ -1 +1 @@
|
||||||
var e=Object.assign;import{d as n,m as i,g as t,u as l,r as a,w as d,c as r,a as c,S as o,b as h,e as s,f as p,h as u,i as v}from"./index.be3c5d52.js";/* empty css */import"./vendor.9babb3f5.js";var f=n({name:"sb-layout-edit",model:i,props:{onUpdate:{type:Function,default:()=>{}},data:{type:null,default:t}},setup(n){const{activate:i}=l(),t=a({orientation:n.data.orientation,children:[...n.data.children]});d((()=>n.data),(()=>{t.orientation=n.data.orientation,t.children=[...n.data.children]}));const f=r((()=>({"sb-layout":!0,[`sb-layout_${t.orientation}`]:!0}))),m=()=>{n.onUpdate({orientation:"vertical"===t.orientation?"horizontal":"vertical"})},b=e=>{t.children=[...t.children,e],n.onUpdate({children:[...t.children]}),i(e.id)},U=(e,l)=>{t.children=[...t.children.slice(0,e+1),l,...t.children.slice(e+1)],n.onUpdate({children:[...t.children]}),i(l.id)},y=e=>{t.children=[...t.children.slice(0,e),...t.children.slice(e+1)],n.onUpdate({children:[...t.children]});const l=Math.max(e-1,0);i(t.children[l].id)},k=e=>{const n=Math.max(Math.min(t.children.length-1,e),0);i(t.children[n].id)};return()=>c("div",{class:f.value},[c(o,null,{default:()=>[c(h,{type:"button",onClick:m},{default:()=>[t.orientation]})]}),...t.children.map(((i,l)=>c(s,p({key:i.id},{"data-order":l,block:i,onUpdate:l=>((i,l)=>{const a=t.children.indexOf(i);-1!==a&&n.onUpdate({children:[...t.children.slice(0,a),e(e({},i),l),...t.children.slice(a+1)]})})(i,l),onRemoveSelf:()=>y(l),onPrependBlock:e=>U(l-1,e),onAppendBlock:e=>U(l,e),onActivatePrevious:()=>k(l-1),onActivateNext:()=>k(l+1)}),{"context-toolbar":()=>c(u,{onMoveBackward:()=>(e=>{if(0===e)return;const i=t.children[e],l=t.children[e-1];t.children=[...t.children.slice(0,e-1),i,l,...t.children.slice(e+1)],n.onUpdate({children:[...t.children]})})(l),onMoveForward:()=>(e=>{if(e===t.children.length-1)return;const i=t.children[e],l=t.children[e+1];t.children=[...t.children.slice(0,e),l,i,...t.children.slice(e+2)],n.onUpdate({children:[...t.children]})})(l),onRemove:()=>y(l),orientation:t.orientation},null)}))),c(v,{onInsertBlock:b},null)])}});export default f;
|
var e=Object.assign;import{d as n,m as i,g as t,u as l,r as a,w as d,c as r,a as o,S as c,b as h,e as s,f as p,h as u,i as v}from"./index.7f5b9510.js";/* empty css */import"./vendor.9babb3f5.js";var f=n({name:"sb-layout-edit",model:i,props:{onUpdate:{type:Function,default:()=>{}},data:{type:null,default:t}},setup(n){const{activate:i}=l(),t=a({orientation:n.data.orientation,children:[...n.data.children]});d((()=>n.data),(()=>{t.orientation=n.data.orientation,t.children=[...n.data.children]}));const f=r((()=>({"sb-layout":!0,[`sb-layout_${t.orientation}`]:!0}))),m=()=>{n.onUpdate({orientation:"vertical"===t.orientation?"horizontal":"vertical"})},b=e=>{t.children=[...t.children,e],n.onUpdate({children:[...t.children]}),i(e.id)},U=(e,l)=>{t.children=[...t.children.slice(0,e+1),l,...t.children.slice(e+1)],n.onUpdate({children:[...t.children]}),i(l.id)},y=e=>{t.children=[...t.children.slice(0,e),...t.children.slice(e+1)],n.onUpdate({children:[...t.children]});const l=Math.max(e-1,0);i(t.children[l].id)},k=e=>{const n=Math.max(Math.min(t.children.length-1,e),0);i(t.children[n].id)};return()=>o("div",{class:f.value},[o(c,null,{default:()=>[o(h,{type:"button",onClick:m},{default:()=>[t.orientation]})]}),...t.children.map(((i,l)=>o(s,p({key:i.id},{"data-order":l,block:i,onUpdate:l=>((i,l)=>{const a=t.children.indexOf(i);-1!==a&&n.onUpdate({children:[...t.children.slice(0,a),e(e({},i),l),...t.children.slice(a+1)]})})(i,l),onRemoveSelf:()=>y(l),onPrependBlock:e=>U(l-1,e),onAppendBlock:e=>U(l,e),onActivatePrevious:()=>k(l-1),onActivateNext:()=>k(l+1)}),{"context-toolbar":()=>o(u,{onMoveBackward:()=>(e=>{if(0===e)return;const i=t.children[e],l=t.children[e-1];t.children=[...t.children.slice(0,e-1),i,l,...t.children.slice(e+1)],n.onUpdate({children:[...t.children]})})(l),onMoveForward:()=>(e=>{if(e===t.children.length-1)return;const i=t.children[e],l=t.children[e+1];t.children=[...t.children.slice(0,e),l,i,...t.children.slice(e+2)],n.onUpdate({children:[...t.children]})})(l),onRemove:()=>y(l),orientation:t.orientation},null)}))),o(v,{onInsertBlock:b},null)])}});export default f;
|
File diff suppressed because one or more lines are too long
|
@ -5,7 +5,7 @@
|
||||||
<link rel="icon" href="./favicon.ico" />
|
<link rel="icon" href="./favicon.ico" />
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||||
<title>Vite App</title>
|
<title>Vite App</title>
|
||||||
<script type="module" crossorigin src="./assets/index.be3c5d52.js"></script>
|
<script type="module" crossorigin src="./assets/index.7f5b9510.js"></script>
|
||||||
<link rel="modulepreload" href="./assets/vendor.9babb3f5.js">
|
<link rel="modulepreload" href="./assets/vendor.9babb3f5.js">
|
||||||
<link rel="stylesheet" href="./assets/index.62d1366f.css">
|
<link rel="stylesheet" href="./assets/index.62d1366f.css">
|
||||||
</head>
|
</head>
|
||||||
|
|
|
@ -27,7 +27,7 @@ export default defineComponent({
|
||||||
});
|
});
|
||||||
|
|
||||||
onBeforeMount(async () => {
|
onBeforeMount(async () => {
|
||||||
const res = await fetch('/initial-data.json');
|
const res = await fetch('./initial-data.json');
|
||||||
const data = await res.json();
|
const data = await res.json();
|
||||||
block.name = data.name;
|
block.name = data.name;
|
||||||
block.id = data.id;
|
block.id = data.id;
|
||||||
|
|
Loading…
Reference in a new issue