efficient-easel 27.0.0 → 27.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/AddSidePanel-DoCx-ZrM.d.ts +1994 -0
- package/dist/{ScreenDocumentContext-DPW_6gOC.d.ts → ScreenDocumentContext-JQr4hTeP.d.ts} +7 -5
- package/dist/blocks/index.d.ts +1 -1
- package/dist/canvas/index.d.ts +2 -1
- package/dist/canvas/index.js +1 -1
- package/dist/chrome/index.js +1 -1
- package/dist/{chunk-PVBDKBJB.js → chunk-2EEYFRQM.js} +1 -1
- package/dist/{chunk-W3UZNKGS.js → chunk-2Y4CAWZQ.js} +4 -4
- package/dist/{chunk-CWELHADJ.js → chunk-3OOYGEJY.js} +1 -1
- package/dist/{chunk-BFJAEQZ6.js → chunk-3RGHXL5V.js} +1 -1
- package/dist/{chunk-JIP5JNRB.js → chunk-5HYVOOH3.js} +1 -1
- package/dist/chunk-64NREOML.js +1 -0
- package/dist/chunk-6GJEOER4.js +1 -0
- package/dist/{chunk-6ATIYLUL.js → chunk-6V6LC7QV.js} +1 -1
- package/dist/{chunk-KO47WAWR.js → chunk-7YXWWMBM.js} +1 -1
- package/dist/{chunk-GR3XRILS.js → chunk-A5USZ6Z6.js} +1 -1
- package/dist/{chunk-Y2T3JX7K.js → chunk-ANBPE45L.js} +1 -1
- package/dist/{chunk-KFWNGPW3.js → chunk-C63IB4VW.js} +5 -5
- package/dist/chunk-DCBUJ36Q.js +5 -0
- package/dist/{chunk-SQTVXE5D.js → chunk-DQSRGKSM.js} +18 -18
- package/dist/{chunk-YYD257TD.js → chunk-G7J6SGMF.js} +1 -1
- package/dist/chunk-HGTDDSFJ.js +19 -0
- package/dist/chunk-I4Z75MCX.js +1 -0
- package/dist/{chunk-AAZIMKLQ.js → chunk-JI7GUM3C.js} +1 -1
- package/dist/{chunk-QZJKWKGH.js → chunk-JUJEVGLY.js} +1 -1
- package/dist/{chunk-K53PQAMP.js → chunk-LDHUPZBK.js} +1 -1
- package/dist/{chunk-JQQFB7EZ.js → chunk-LK56FUFT.js} +1 -1
- package/dist/chunk-M5UCPD66.js +1 -0
- package/dist/{chunk-ZFEAWEFS.js → chunk-MMHYTIUY.js} +3 -3
- package/dist/{chunk-SBVIW3KJ.js → chunk-MTWQYLJE.js} +1 -1
- package/dist/chunk-OB4KI2AN.js +2 -0
- package/dist/{chunk-5OWAV3MH.js → chunk-OSF2H3LO.js} +1 -1
- package/dist/{chunk-TYTMUHUK.js → chunk-PTTQWCD7.js} +1 -1
- package/dist/{chunk-3XECMGXX.js → chunk-QEEW4X64.js} +1 -1
- package/dist/chunk-SDSBXW3V.js +26 -0
- package/dist/{chunk-76MUJIZE.js → chunk-SR2535CN.js} +17 -17
- package/dist/{chunk-QTHQPJWA.js → chunk-TF6NAIV7.js} +1 -1
- package/dist/{chunk-6EDVZBUO.js → chunk-TQUEVJOO.js} +1 -1
- package/dist/chunk-UMTUKSE6.js +1 -0
- package/dist/chunk-VNUXFD4X.js +1 -0
- package/dist/{chunk-VBEVZZTV.js → chunk-VTY7OQB5.js} +11 -11
- package/dist/{chunk-5JNVMCCB.js → chunk-XGTO4LHI.js} +1 -1
- package/dist/{chunk-YES5F7OS.js → chunk-XV5D4V2T.js} +1 -1
- package/dist/chunk-YCYGY54I.js +8 -0
- package/dist/chunk-YDTEYXQW.js +1 -0
- package/dist/chunk-ZSP4ZAQ2.js +64 -0
- package/dist/copy/index.js +11 -11
- package/dist/data/index.d.ts +2 -1
- package/dist/data/index.js +1 -1
- package/dist/drag/index.js +1 -1
- package/dist/easel/index.d.ts +1 -1
- package/dist/easel/index.js +1 -1
- package/dist/edit-lock/index.js +1 -1
- package/dist/fields/fields.css +8 -0
- package/dist/fields/index.d.ts +47 -3
- package/dist/fields/index.js +1 -1
- package/dist/node-ops/index.js +1 -1
- package/dist/phone-order-CRKvsTsz.d.ts +141 -0
- package/dist/screen/components/AddBlockRow.js +1 -1
- package/dist/screen/components/AddSidePanel.d.ts +3 -5
- package/dist/screen/components/AddSidePanel.js +1 -1
- package/dist/screen/components/NodeContextMenu.d.ts +3 -5
- package/dist/screen/components/NodeContextMenu.js +1 -1
- package/dist/screen/components/PageEditGuardNotices.js +1 -1
- package/dist/screen/components/SaveControls.d.ts +3 -5
- package/dist/screen/components/SaveControls.js +1 -1
- package/dist/screen/components/ScreenChrome.js +1 -1
- package/dist/screen/components/ScreenDocumentContext.d.ts +2 -2
- package/dist/screen/components/ScreenDocumentContext.js +1 -1
- package/dist/screen/components/ScreenMount.d.ts +3 -5
- package/dist/screen/components/ScreenMount.js +1 -1
- package/dist/screen/components/ScreenStoreProvider.d.ts +3 -5
- package/dist/screen/components/ScreenStoreProvider.js +1 -1
- package/dist/screen/components/SectionScreenShell.js +17 -17
- package/dist/screen/components/SidePanelHead.js +1 -1
- package/dist/screen/components/panel-widths.js +1 -1
- package/dist/screen/components/usePartBridge.d.ts +3 -5
- package/dist/screen/components/usePartBridge.js +1 -1
- package/dist/screen/index.d.ts +3 -5
- package/dist/screen/index.js +1 -1
- package/dist/screen/lib/admin-bridge.d.ts +1 -1
- package/dist/screen/lib/document/add-target-types.d.ts +37 -55
- package/dist/screen/lib/document/block-set-host.js +1 -1
- package/dist/screen/lib/document/block-size-fields.d.ts +2 -2
- package/dist/screen/lib/document/block-size-fields.js +1 -1
- package/dist/screen/lib/document/block-types-in.js +1 -1
- package/dist/screen/lib/document/box-fields.d.ts +2 -2
- package/dist/screen/lib/document/box-fields.js +1 -1
- package/dist/screen/lib/document/button-fields.d.ts +2 -2
- package/dist/screen/lib/document/button-fields.js +1 -1
- package/dist/screen/lib/document/image-fields.d.ts +2 -2
- package/dist/screen/lib/document/image-fields.js +5 -5
- package/dist/screen/lib/document/new-child.d.ts +58 -0
- package/dist/screen/lib/document/new-child.js +1 -0
- package/dist/screen/lib/document/palette-sections.d.ts +3 -5
- package/dist/screen/lib/document/section-doc.d.ts +1 -1
- package/dist/screen/lib/document/section-doc.js +1 -1
- package/dist/screen/lib/document/shadow-fields.d.ts +2 -2
- package/dist/screen/lib/document/shadow-fields.js +2 -2
- package/dist/screen/lib/document/slot-section-spec.d.ts +37 -96
- package/dist/screen/lib/document/style-clipboard.d.ts +3 -5
- package/dist/screen/lib/document/style-clipboard.js +1 -1
- package/dist/screen/lib/document/style-fields.d.ts +2 -2
- package/dist/screen/lib/document/style-fields.js +1 -1
- package/dist/screen/lib/document/use-section-ops.d.ts +1 -1
- package/dist/screen/lib/document/use-section-ops.js +1 -1
- package/dist/screen/lib/document-addressing.d.ts +2 -2
- package/dist/screen/lib/document-hooks.d.ts +1 -1
- package/dist/screen/lib/document-switch.js +1 -1
- package/dist/screen/lib/failure.js +1 -1
- package/dist/screen/lib/host-inbound.js +1 -1
- package/dist/screen/lib/host.d.ts +2 -2
- package/dist/screen/lib/key-scope.js +1 -1
- package/dist/screen/lib/media-panel.d.ts +2 -2
- package/dist/screen/lib/media-picker.d.ts +2 -2
- package/dist/screen/lib/media-picker.js +1 -1
- package/dist/screen/lib/page-lock.d.ts +1 -1
- package/dist/screen/lib/page-lock.js +1 -1
- package/dist/screen/lib/screen-parts.d.ts +21 -1828
- package/dist/screen/lib/screen-parts.js +1 -1
- package/dist/screen/lib/section-templates.d.ts +1 -1
- package/dist/screen/lib/session-context.d.ts +1 -1
- package/dist/screen/lib/session.d.ts +1 -1
- package/dist/screen/lib/shared-sections.d.ts +1 -1
- package/dist/strings/index.d.ts +1 -1
- package/dist/strings/index.js +2 -2
- package/dist/style-clipboard/index.js +1 -1
- package/dist/text-styles/index.js +27 -27
- package/dist/{words-CFkb8XtN.d.ts → words-dNm6REMa.d.ts} +21 -0
- package/package.json +7 -1
- package/dist/chunk-2262JGFV.js +0 -5
- package/dist/chunk-3W2O22DZ.js +0 -19
- package/dist/chunk-DAKKPW2Z.js +0 -1
- package/dist/chunk-EUFDQ4KL.js +0 -1
- package/dist/chunk-FW35PCK7.js +0 -1
- package/dist/chunk-HG65R6IN.js +0 -20
- package/dist/chunk-JACEEVVF.js +0 -1
- package/dist/chunk-L2WK5JYB.js +0 -2
- package/dist/chunk-L7PSERQH.js +0 -8
- package/dist/chunk-NTG5ODKZ.js +0 -1
- package/dist/chunk-O4OWODU2.js +0 -64
- package/dist/chunk-TOKMFZPB.js +0 -1
- package/dist/resolve-Bz4mszpL.d.ts +0 -57
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{PanelToggleIcon as e}from"./chunk-UMDQ6CLQ.js";import{InspectorHead as n}from"./chunk-
|
|
1
|
+
import{PanelToggleIcon as e}from"./chunk-UMDQ6CLQ.js";import{InspectorHead as n}from"./chunk-VTY7OQB5.js";import{DEFAULT_CHROME_WORDS as i}from"./chunk-AJSDWWJW.js";import{useWords as o}from"./chunk-MFIRYGHW.js";import{Tooltip as s,IconButton as t,Button as c}from"efficient-shell/ui";import{jsx as r,jsxs as l,Fragment as d}from"react/jsx-runtime";function a({icon:e,title:i,context:o,actions:s,side:t="left",onHide:c}){/* @__PURE__ */
|
|
2
2
|
return r(n,{icon:e,name:i,kind:o,actions:s||c?/* @__PURE__ */l(d,{children:[s,c?/* @__PURE__ */r(m,{side:t,onHide:c,divider:Boolean(s)}):null]}):void 0})}function m({side:n,onHide:c,divider:a=!1}){const m=o("chrome",i);/* @__PURE__ */
|
|
3
3
|
return l(d,{children:[a?/* @__PURE__ */r("span",{className:"sf-head-divider","aria-hidden":"true"}):null,
|
|
4
4
|
/* @__PURE__ */r(s,{content:m.hidePanel,side:"bottom",children:/* @__PURE__ */r(t,{className:"es-insp-iconbtn","aria-label":m.hidePanelLabel({side:n}),onClick:c,children:/* @__PURE__ */r(e,{side:n})})})]})}function h({side:n,onShow:c}){const l=o("chrome",i);/* @__PURE__ */
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{routeSharedHostMessage as e}from"./chunk-JUJEVGLY.js";import{describeLoadFailure as r,hostLoadRefusal as n}from"./chunk-ERR437B5.js";import{editLockOf as t}from"./chunk-A5USZ6Z6.js";import{NO_DOCUMENT_ADDRESSING as o}from"./chunk-RLBXE4EU.js";import{saveStatusOf as u,resetForDocumentSwitch as a}from"./chunk-6V6LC7QV.js";import{isExpiredSession as s,readEaselFailure as i}from"./chunk-7YXWWMBM.js";import{useAdminBridge as l}from"./chunk-NQW6XCAY.js";import{STATUS_UNREACHABLE as c}from"./chunk-KCOBHPN6.js";import{useEaselSession as d}from"./chunk-YM4UEGBV.js";import{backendOf as f,setSessionDocumentSite as m}from"./chunk-SNF5764Q.js";import{useEaselHost as k}from"./chunk-LX23TCTP.js";import{DEFAULT_SCREEN_WORDS as v}from"./chunk-G2VZ4DET.js";import{useAutosave as g}from"./chunk-NDRZP6YR.js";import{canWriteDocument as p,newEaselClientId as h,reloadIfVersionMoved as y,openUnansweredClaim as w,FAIL_OPEN_RETRY_MS as b,CLAIM_FAIL_OPEN_MS as S,holderOf as P}from"./chunk-G7J6SGMF.js";import{useWords as j}from"./chunk-MFIRYGHW.js";import{createContext as I,useContext as E,useState as B,useMemo as R,useCallback as C,useEffect as T,useRef as A}from"react";import{jsx as H}from"react/jsx-runtime";var M={content:[],root:{},zones:{}};var L=I(null);function N(){const e=E(L);if(!e)throw new Error("useStorefrontDocument must be used within StorefrontDocumentProvider");return e}function V({target:I,addressing:E=o,onHostMessage:N,children:V}){const D=E,{homeSlug:F,entryMayBounce:O,entryBounce:Y,onSwitch:G,tellsHost:U,adapterFor:W,migrateRenamedProps:X,describeMissing:Z,onLoadFailed:x}=D,[J,Q]=B(I),K=k(),z=d(),_=R(()=>f(z),[z]),q=R(()=>t(z),[z]),$="template"===J.kind,ee="template"===J.kind?J.id:null,re="template"===J.kind?J.pageSlug??F??"":"document"===J.kind?J.slug??"":J.slug,ne="page"===J.kind?J.siteId??null:null,te=z.blocks,oe=R(()=>W(J,_,te),[W,_,te,J.kind,"template"===J.kind?J.id:"document"===J.kind?J.record:J.siteId]),ue=oe.capabilities,ae=C(e=>z.documentHooks?.stored?.(e)??e,[z]);T(()=>{m(z,ne)},[z,ne]);const se=A(J);T(()=>{se.current=J},[J]);const{token:ie,tokenRef:le,capabilities:ce}=l({onMessage:r=>{if(N?.(r)||e(r))return;const n=r;if("storefront-editor:navigate"===n?.type){const e=r;e?.target&&Br(e.target)}}}),de=!z.usesBridgedToken||null!==ie,fe=oe.lock,me=Boolean(_.lock),[ke,ve]=B(null),[ge,pe]=B(null),[he,ye]=B(null),[we,be]=B(null),Se=j("screen",v),Pe=we?function(e,r){if(null!==e.sentence)return e.sentence;if(!e.missing)return r.loadFailed({cause:e.cause});switch(e.target.kind){case"template":return r.missingTemplatePage;case"document":return r.missingDocument;default:return r.missingPage({slug:e.slug})}}(we,Se):null,[je,Ie]=B(null),Ee=A(null),Be=A(null),[Re,Ce]=B(!1),Te=A(null),[Ae,He]=B(null),Me=A(null),[Le,Ne]=B(null),[Ve,De]=B(!1),Fe=A(null);T(()=>{Fe.current=Le},[Le]);const[Oe,Ye]=B(ue.hasEditLock?{kind:"checking"}:{kind:"editing"}),Ge=A(Oe);T(()=>{Ge.current=Oe},[Oe]);const Ue=A(()=>Promise.resolve(!1)),We=C(e=>{Be.current=e,Ce(!0)},[]),Xe=g({save:async({id:e,data:r})=>{if(p(Ge.current)){if(!await Ue.current(e,r)){if(!p(Ge.current))return void We({id:e,data:r});throw new Error("page save did not land")}}else We({id:e,data:r})},onFailure:(e,r)=>{0===r&&K.send("storefront-editor:save-failed")}}),{state:Ze,push:xe,flush:Je,pause:Qe,resume:Ke,stop:ze,reset:_e,retryNow:qe,hasPending:$e}=Xe,er=A(Ze);T(()=>{er.current=Ze},[Ze]);const rr=u(Ze),nr=C(()=>{const e=Be.current;e&&(Be.current=null,Ce(!1),xe(e))},[xe]),tr=A("");tr.current||(tr.current=h());const[or,ur]=B(0),ar=A(!1),[sr,ir]=B(O(I)),lr=A(!1);T(()=>{if(lr.current)return;lr.current=!0;const e=K.address.search(),r=Y(I,e);r?K.address.load(r):O(I)&&ir(!1)},[I,K]);const cr=K.send;T(()=>{if(!de)return;let e=!1;const t=se.current,o=oe.resolve(re),u=z.documentHooks?.opening?.({slug:re,isTemplate:$,capabilities:ue});return o.then(async r=>{if(e)return;if(!r)return"page"===t.kind&&null!==F&&re!==F?void K.address.load({kind:"page",slug:F,siteId:ne??void 0}):(be({target:t,slug:re,missing:!0,sentence:Z?.(t)??null}),void x?.(t,null));const n=r.readOnlyReason?r.readOnlyReason:null;Ee.current=n,Ie(n),ve(r.id),pe(r.kind??null),Me.current=r.version??null;const o=r.layout,a=o&&Object.keys(o).length?o:M,s=X(a),i=u?await u(s):s;e||ye(i)}).catch(o=>{e||(console.error("[storefront-editor] document load failed",o),be({target:t,slug:re,missing:!1,sentence:n(o,{slug:re},z),cause:r(o,z)}),x?.(t,o))}),()=>{e=!0}},[de,ie,$,oe,re]);const dr=C(e=>new Promise(r=>{const n=Date.now(),t=setInterval(()=>{const o=le.current;o&&o!==e?(clearInterval(t),r(o)):Date.now()-n>6e3&&(clearInterval(t),r(null))},200)}),[]),fr=C(async e=>{const r=le.current;if(!r&&z.usesBridgedToken)return{ok:!1,error:new Error("no editor token")};try{return{ok:!0,value:await e(r??"")}}catch(n){if(s(n,z)){cr("storefront-editor:auth-expired");const n=r?await dr(r):null;if(n)try{return{ok:!0,value:await e(n)}}catch(e){return{ok:!1,error:e}}}return{ok:!1,error:n}}},[cr,dr,z]),mr=C(async e=>{const r=le.current?await fr(e):{ok:!1};return r.ok||cr("storefront-editor:save-failed"),r.ok},[cr,fr]),kr=C(async(e,r,n=!1)=>{if(null!==Ee.current)return!1;if(!p(Ge.current))return!1;if(Fe.current)return!1;const t=await fr(()=>oe.saveLayout(e,r,Me.current,tr.current));if(t.ok)return Me.current=t.value.version??Me.current,De(!1),!0;const o=q.readLockTaken(t.error);if(o){const e={kind:"takenover",holder:o};return Ge.current=e,Ye(e),!1}const u=q.readSaveConflict(t.error);if(u){if(u.savedByYou&&!n&&oe.rereadVersion){const n=await fr(()=>oe.rereadVersion(e));if(n.ok&&n.value)return Me.current=n.value,Ue.current(e,r,!0)}ze(),Fe.current=u,Ne(u)}return De(i(t.error,z)?.status===c),!1},[oe,fr,ze,z]);T(()=>{Ue.current=kr},[kr]);const vr=C(e=>{if(null!==Ee.current)return;if(cr("storefront-editor:dirty"),!ke)return;const r=ae(e);Te.current=r,p(Ge.current)?xe({id:ke,data:r}):We({id:ke,data:r})},[ke,cr,We,xe,ae]),gr=C(async()=>{p(Ge.current)&&nr();return await Je()&&null==Be.current},[nr,Je]),pr=A(gr);T(()=>{pr.current=gr},[gr]);const hr=A(fr);T(()=>{hr.current=fr},[fr]);const yr=C(()=>{K.address.reload()},[K]),wr=A(()=>Promise.resolve(!1));T(()=>{wr.current=()=>{const e=oe.rereadVersion;return ke&&e?y({ours:Me.current,stored:async()=>{const r=await hr.current(()=>e(ke));return r.ok?r.value:null},hasPending:()=>null!=Be.current||$e(),reload:yr}):Promise.resolve(!1)}},[oe,ke,$e,yr]);const br=null!==je;T(()=>{if(!fe||!ke||!de||br)return;let e=!1,r=null,n=null;const t=tr.current,o={claim:async e=>{const r=await hr.current(()=>fe.claim(ke,t,e));if(r.ok)return{heartbeat_seconds:r.value.heartbeatSeconds};throw r.error},cancelled:()=>e,currentAccess:()=>Ge.current,heldWrite:()=>({pending:null!=Be.current||$e(),autoSaveEnabled:!er.current.paused,saveConflict:null!=Fe.current}),setAccess:e=>{Ge.current=e,Ye(e)},releaseHeldWrite:()=>{pr.current()},startHeartbeat:e=>{r&&clearInterval(r),r=setInterval(()=>{u(!1)},e)},stopHeartbeat:()=>{r&&(clearInterval(r),r=null)},reloadIfMoved:()=>{wr.current()}},u=q.makeClaimBeat(o),a=ar.current;return ar.current=!1,a||(Ye({kind:"checking"}),n=setTimeout(()=>{n=null,w(o)&&o.startHeartbeat(b)},S)),u(a).finally(()=>{n&&clearTimeout(n),n=null}),()=>{e=!0,n&&clearTimeout(n),r&&clearInterval(r),fe.release(ke,t).catch(()=>{})}},[ke,fe,de,ie,or,br]);const Sr=C(()=>{fe&&ke&&(ar.current=!0,ur(e=>e+1))},[ke,fe]),Pr=C(()=>{Ye(e=>{const r="blocked"===e.kind||"takenover"===e.kind?e.holder:null;return r?{kind:"readonly",holder:r}:e})},[]),jr=C(()=>{er.current.paused?(p(Ge.current)&&nr(),Ke()):Qe()},[nr,Qe,Ke]),Ir=C(()=>{qe()},[qe]),Er=C(e=>{Te.current=null,a("template"!==e.kind&&me,{resetAutosave:()=>{_e(),Be.current=null,Ce(!1)},setVersion:e=>{Me.current=e},setSaveConflict:Ne,setAccess:Ye}),G(e),Q(e),Ee.current=null,Ie(null),ve(null),pe(null),ye(null),be(null),K.address.show(e),"document"!==e.kind&&U(e)&&K.send("storefront-editor:navigated",{target:e})},[_e,K,me,G,U]),Br=C(e=>{if(function(e,r,n){if(e.kind!==r.kind)return!1;if("template"===e.kind){const t=r;return e.id===t.id&&(e.pageSlug??n)===(t.pageSlug??n)}if("document"===e.kind){const n=r;return e.record===n.record&&(e.slug??"")===(n.slug??"")}const t=r;return e.slug===t.slug&&e.siteId===t.siteId}(e,se.current,F))return;const r=null!=Be.current;if(!r&&!$e())return void Er(e);const n=er.current;r||n.paused||n.failed||n.stopped?He(e):Je().then(r=>{r?Er(e):He(e)})},[Er,$e,Je,F]),Rr=C(()=>He(null),[]),Cr=C(()=>{He(e=>(e&&Er(e),null))},[Er]),Tr=C(async()=>{const e=Ae;if(!e)return;await gr()&&(He(null),Er(e))},[Ae,gr,Er]),Ar=C(async e=>{if(null!==Ee.current)return;if(!ke)return;if(!p(Ge.current)||Fe.current)return;const r=ae(e);if(!await kr(ke,r))return void(Fe.current||cr("storefront-editor:save-failed"));const n=oe.publish;if(!ue.canPublish||!n)return void cr("storefront-editor:saved");const t=await fr(()=>n(ke,Me.current??void 0));if(!t.ok){const{error:e}=t;return void cr("storefront-editor:publish-failed",{reason:e instanceof Error&&e.message?e.message:null})}Me.current=t.value.version??Me.current,cr("storefront-editor:published")},[ke,oe,ue.canPublish,cr,kr,fr,ae]);/* @__PURE__ */
|
|
2
|
+
return H(L.Provider,{value:{target:J,adapter:oe,capabilities:ue,templateId:ee,currentSlug:re,currentKind:ge,siteId:ne,ready:de,token:ie,tokenRef:le,notifyParent:cr,bridgeCapabilities:ce,runAuthed:mr,docId:ke,data:he,getLiveData:()=>Te.current??he,error:Pe,redirecting:sr,saveStatus:rr,saveState:Ze,autoSaveEnabled:!Ze.paused,autoSaveStoppedByConflict:Ze.stopped,hasUnsavedEdits:Ze.pending||Re,toggleAutoSave:jr,retrySave:Ir,onChange:vr,flushSave:gr,onPublish:Ar,access:Oe,readOnly:null!==P(Oe)||null!==je||null!==Le,readOnlyReason:je,takeOverEditing:Sr,viewReadOnly:Pr,saveConflict:Le,saveUnreachable:Ve,reloadFromServer:yr,navigate:Br,pendingNav:Ae,cancelPendingNav:Rr,discardAndNavigate:Cr,saveAndNavigate:Tr},children:V})}export{L as ScreenDocumentContext,V as ScreenDocumentProvider,N as useScreenDocument};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{useSectionOps as o}from"./chunk-
|
|
1
|
+
import{useSectionOps as o}from"./chunk-PTTQWCD7.js";import{SELECTION_MODE as e}from"./chunk-DCBUJ36Q.js";import{decodePartId as r,encodePartId as t}from"./chunk-R4AUZVA3.js";import{useEasel as n}from"./chunk-HGTDDSFJ.js";import{usePreviewParts as p}from"./chunk-467WWV4I.js";import{useCallback as d,useEffect as c}from"react";var s=o=>"part"===o.kind;function m({mode:m,setMode:i,onOpenPart:a}){const{getSelectorForId:u}=n(o=>o),f=o(),{setSelectedPartId:k,setSelectHandler:l}=p(),I=d(o=>{const t=r(o);if(!t)return;const{nodeId:n,propKey:p}=t;p?(i(o=>s(o)&&o.nodeId===n&&o.propKey===p?o:{kind:"part",nodeId:n,propKey:p}),a?.(n)):i(o=>"part"===o.kind?e:o)},[i,a]);c(()=>{l(I)},[l,I]);const h=s(m)?t(m.nodeId,m.propKey):null;c(()=>{k(h)},[h,k]);return{selectNode:d(o=>{i(()=>e);const r=u(o);r&&f.select(r)},[i,u,f]),openPartId:h}}export{m as usePartBridge};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{useScreenBlockRules as e}from"./chunk-
|
|
1
|
+
import{useScreenBlockRules as e}from"./chunk-DCBUJ36Q.js";import{newNodeId as t,ROOT_ZONE as n}from"./chunk-TCAAOYQY.js";import{useEasel as o,useEaselApi as r}from"./chunk-HGTDDSFJ.js";import{useMemo as s}from"react";function i(i={}){const{dispatch:p}=o(e=>e),d=r(),c=!0===i.readOnly,a=e().resolveOnInsert,l=!0===(i.resolveOnInsert??a),m=!0===i.foldIntoHistory;return s(()=>{const e=m?e=>p({...e,recordHistory:!1}):p,o=(n,o,r)=>{const s=t(o);return c||e({type:"insert",componentType:o,destinationZone:n,destinationIndex:r,id:s}),s},r=e=>(l&&!c&&d.resolveNode(e,{trigger:"insert"}),e),s=(t,n,o)=>{c||e({type:"replace",destinationZone:t,destinationIndex:n,data:o})},i=(e,t,n)=>r(o(e,t,n));return{insertComponent:i,insertSection:(e,t)=>i(n,e,t),replaceComponent:s,seedChild:(e,t,n,i)=>{const p=o(e,n,t);s(e,t,{type:n,props:{id:p,...i}}),r(p)},insertNode:(e,t,n)=>{const i=o(e,n.type,t);return s(e,t,{type:n.type,props:{...n.props,id:i}}),r(i)},removeComponent:(t,n)=>{c||e({type:"remove",index:n,zone:t})},reorderComponent:(t,n,o)=>{c||e({type:"reorder",sourceIndex:n,destinationIndex:o,destinationZone:t})},duplicateComponent:(t,n)=>{c||e({type:"duplicate",sourceIndex:n,sourceZone:t})},select:e=>p({type:"setUi",ui:{itemSelector:e}}),setDocument:t=>{c||e({type:"setData",data:t})},commitDocument:(t,n)=>{c||(m?d.batch(()=>{e({type:"setData",data:t}),void 0!==n&&("slot"===n?.kind?d.selectSlot({parentId:n.parentId,slot:n.slot}):d.select(n?n.id:null))}):d.run({data:t,select:n}))}}},[p,c,l,d,m])}export{i as useSectionOps};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{zoneKey as e}from"./chunk-
|
|
1
|
+
import{zoneKey as e}from"./chunk-YDTEYXQW.js";import{useRef as t,useEffect as n,useState as r,useSyncExternalStore as o,useCallback as i}from"react";var l=56,c=16;function a(e){const t=Math.max(e,0);return t>=l?0:Math.ceil(16*(1-t/l))}function u(e,t,n){if(e<t-l||e>n+l)return 0;const r=e-t,o=n-e;return r<l&&r<=o?-a(r):o<l?a(o):0}function s(e){const t=e?.ownerDocument?.defaultView;for(let n=e?.parentElement??null;n;n=n.parentElement){const e=t?.getComputedStyle(n).overflowY;if(("auto"===e||"scroll"===e)&&n.scrollHeight>n.clientHeight)return n}return null}function f(e){const t=e?.ownerDocument?.defaultView?.getComputedStyle(e).overflowY;return e&&("auto"===t||"scroll"===t)&&e.scrollHeight>e.clientHeight?e:s(e)}function d(e){const t=e.scrollingElement??e.documentElement;return t&&t.scrollHeight>t.clientHeight?t:null}function g(e,t=e){const n=t.ownerDocument,r=n.defaultView;if(!r)return()=>{};let o=null,i=0;const l=e=>{o=e.clientY},c=()=>{if(null!==o){const n=t.getBoundingClientRect(),r=u(o,n.top,n.bottom);r&&(e.scrollTop+=r)}i=r.requestAnimationFrame(c)};return n.addEventListener("dragover",l,!0),i=r.requestAnimationFrame(c),()=>{n.removeEventListener("dragover",l,!0),r.cancelAnimationFrame(i)}}function p(e){return/move|all|uninitialized/i.test(e)?"move":"copy"}function m(){let e=null,t=null;const n=/* @__PURE__ */new Set,r=()=>{if(t!==e){t=e;for(const e of[...n])e()}};return{get:()=>e,shown:()=>t,start(t){e=t,globalThis.setTimeout(r,0)},end(){null===e&&null===t||(e=null,r())},subscribe:e=>(n.add(e),()=>{n.delete(e)})}}function v(e,t,n,r){if(e.into)return{side:"into",to:e.into};return"first"===e.pinned||"last"!==e.pinned&&t>n+r/2?{side:"after",to:{...e.place,index:e.place.index+1}}:{side:"before",to:{...e.place,index:e.place.index}}}var D=(t,n)=>e(t)===e(n);function w(e,t){return D(e,t)&&(t.index===e.index||t.index===e.index+1)}function y(e,t){return D(e,t)&&e.index<t.index?t.index-1:t.index}function x(e,t){return{...e,index:t<0?e.index-1:e.index+2}}function h(e,t){if(!t)return e;const n={...t,...e};for(const[r,o]of Object.entries(e)){const e=t[r];"function"==typeof o&&"function"==typeof e&&(n[r]=t=>{o(t),e(t)})}return n}function T(l){const c=t(l);n(()=>{c.current=l});const[a]=r(()=>m()),u=l.session??a,d=o(u.subscribe,u.shown,u.shown),[D,y]=r(null),x=t(null),T=i(()=>{x.current?.(),x.current=null},[]),b=i(()=>{T(),u.end(),y(null)},[u,T]);n(()=>u.subscribe(()=>{u.get()||(T(),y(null))}),[u,T]),n(()=>T,[T]);const k=i((e,t)=>{y(n=>n&&n.key===e&&n.side===t?n:{key:e,side:t})},[]),E=i(e=>{y(t=>t&&t.key===e?null:t)},[]),A=(e,t,n,r)=>!("into"===n?r===e.key:void 0!==e.from&&w(e.from,t))&&c.current.canDrop(e.item,t);return{dragging:d?.item??null,row:(e,t)=>{const{keyOf:n,readOnly:r}=c.current,o=n(e.item),i=!r&&!e.pinned&&!1!==e.canDrag,l=t=>{const n=t.currentTarget.getBoundingClientRect();return v(e,t.clientY,n.top,n.height)},a={draggable:i||void 0,onDragStart:i?t=>{const n=t.currentTarget;u.start({key:o,item:e.item,from:e.place}),t.dataTransfer.effectAllowed="move";try{t.dataTransfer.setData("text/plain",o)}catch{}n.classList.add("is-lifting");const r=n.getBoundingClientRect();t.dataTransfer.setDragImage?.(n,t.clientX-r.left,t.clientY-r.top),n.ownerDocument.defaultView?.setTimeout(()=>n.classList.remove("is-lifting"),0);const i=s(n);T(),x.current=i?g(i):null}:void 0,onDragEnd:i?()=>b():void 0,onDragOver:e=>{const t=u.get();if(!t)return;const n=l(e);A(t,n.to,n.side,o)?(e.preventDefault(),e.dataTransfer.dropEffect=p(e.dataTransfer.effectAllowed),k(o,n.side)):E(o)},onDrop:e=>{const t=u.get();if(!t)return;const n=l(e);A(t,n.to,n.side,o)&&(e.preventDefault(),b(),c.current.onDrop(t.item,n.to))},onKeyDown:t=>{if("ArrowUp"!==t.key&&"ArrowDown"!==t.key)return;if(!t.altKey||t.ctrlKey||t.metaKey||t.shiftKey)return;if(t.preventDefault(),t.repeat||!i)return;const{onStep:n,canStep:r}=c.current,o="ArrowUp"===t.key?-1:1;n&&!1!==r?.(e.item,o)&&n(e.item,o)}};return{draggable:i,dragging:d?.key===o,drop:D?.key===o?D.side:void 0,rowProps:h(a,t)}},seam:(t,n)=>{const r=(o=t.place,`seam:${e(o)}:${o.index}`);var o;const i={onDragOver:e=>{const n=u.get();n&&(A(n,t.place,"before",r)?(e.preventDefault(),e.dataTransfer.dropEffect=p(e.dataTransfer.effectAllowed),k(r,"before")):E(r))},onDrop:e=>{const n=u.get();n&&A(n,t.place,"before",r)&&(e.preventDefault(),b(),c.current.onDrop(n.item,t.place))}};return{drop:D?.key===r,seamProps:h(i,n)}},rootProps:e=>h({onDragEnter:e=>{if(!u.get()||x.current)return;const t=f(e.currentTarget);x.current=t?g(t):null},onDragLeave:e=>{const t=e.relatedTarget;t&&e.currentTarget.contains(t)||y(null)}},e)}}export{l as AUTO_SCROLL_EDGE,c as AUTO_SCROLL_MAX_SPEED,u as autoScrollDelta,a as autoScrollSpeed,m as createDragSession,p as dropEffectFor,v as dropOnRow,d as frameScrollBox,y as gapToMoveIndex,w as isNoOpDrop,f as scrollBoxOf,s as scrollParent,g as startAutoScroll,x as stepGap,T as useTreeDrag};
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import{fieldIsShown as e,shownFields as n}from"./chunk-BPXEFVSQ.js";import{deviceMetaOf as t,noControlMetaOf as l}from"./chunk-YCSZAP7T.js";import{TreeSeam as r}from"./chunk-WHS6Y55E.js";import{SETTINGS_BUCKETS as o,SettingsGroup as a}from"./chunk-D4TH4QQR.js";import{DEFAULT_TREE_WORDS as i}from"./chunk-K56YDHYQ.js";import{DEFAULT_PANEL_WORDS as s}from"./chunk-56ID6FKZ.js";import{easelMenuEntries as c}from"./chunk-FIVU2COQ.js";import{FieldNumber as d}from"./chunk-ANBPE45L.js";import{FieldSelect as u}from"./chunk-C63IB4VW.js";import{SettingsSegmented as m}from"./chunk-DX3VILZ3.js";import{SettingsField as h}from"./chunk-MIX7EGRG.js";import{DEFAULT_FIELDS_WORDS as p}from"./chunk-UMTUKSE6.js";import{useWords as f}from"./chunk-MFIRYGHW.js";import{useTreeDrag as b,gapToMoveIndex as v}from"./chunk-QEEW4X64.js";import{withTip as g}from"./chunk-P2VEMZH5.js";import{normalizePhoneOrder as y,isCustomPhoneOrder as k,settlePhoneOrder as w,clone as x}from"./chunk-YDTEYXQW.js";import{Textarea as C,Input as O,ItemCount as N,SortableList as D,ListRow as j,IconButton as I,ContextMenu as S,tabPanelId as $,Tabs as P,tabButtonId as L,Button as E}from"efficient-shell/ui";export{LinkPicker}from"efficient-shell/ui";import{useRef as T,useState as F,useLayoutEffect as M,useId as R}from"react";import{jsx as z,jsxs as W,Fragment as B}from"react/jsx-runtime";import{LockIcon as A,CloseIcon as H,ListIcon as Y,MoveUpIcon as K,MoveDownIcon as Q,DuplicateIcon as V,TrashIcon as X}from"efficient-shell/icons/efficient";function Z({id:e,value:n,onChange:t,placeholder:l,multiline:r=!1,rows:o=3,readOnly:a=!1,ariaLabel:i,ariaLabelledBy:s}){const c=n??"";return r?/* @__PURE__ */z(C,{id:e,size:"sm",className:"es-fin",value:c,rows:o,placeholder:l,readOnly:a,"aria-label":i,"aria-labelledby":s,onChange:e=>t(e.target.value)}):/* @__PURE__ */z(O,{id:e,size:"md",className:"es-fin",type:"text",value:c,placeholder:l,readOnly:a,"aria-label":i,"aria-labelledby":s,onChange:e=>t(e.target.value)})}function U(e,n,t){const l=e.slice();return l.splice(Math.max(0,Math.min(n,l.length)),0,t),l}function G(e,n,t){const l=e.slice(),[r]=l.splice(n,1);return l.splice(Math.max(0,Math.min(t,l.length)),0,r),l}function q(e,n){return e.filter((e,t)=>t!==n)}var _='input, textarea, select, button, [contenteditable]:not([contenteditable="false"]), [tabindex]',J={parentId:"list",slot:"items"};function ee({label:e,icon:n,noun:t,items:l,onChange:o,newItem:a,summary:s,itemName:d,thumb:u,min:m=0,max:h,readOnly:y=!1,open:k,onOpen:w,renderItem:C,renderRow:O,canRemove:$,lockedReason:P,fixed:L=!1,removeOnRow:E=!0,canDuplicate:R,above:Y,head:Z=!0}){const ee=f("fields",p).list,ne=f("tree",i),te=t??ee.item,le=!y&&!L&&("number"!=typeof h||l.length<h),re=l.length<=m,oe=e=>!!$&&!$(l[e],e),ae=e=>!y&&!L&&E&&!re&&!oe(e),ie=e=>le&&(!R||R(l[e],e)),se=(e,n)=>d?d(e,n):ee.itemName({noun:te,n:n+1}),ce=T([]),de=T(null),[ue,me]=F(null),he=T(null),[pe,fe]=F(null),[be,ve]=F("");M(()=>{const e=de.current;if(!e)return;de.current=null;const n=ce.current[e.index]?.querySelectorAll(_)[e.nth]??ce.current[e.index];if(n?.focus(),n&&null!==e.start&&"setSelectionRange"in n)try{n.setSelectionRange(e.start,e.end)}catch{}});const ge=(e,n)=>{if(n<0||n>=l.length||n===e)return;const t=ce.current[e],r=t?.ownerDocument.activeElement;if(t&&r&&t.contains(r)){const e=[...t.querySelectorAll(_)].indexOf(r),l=r;de.current={index:n,nth:e,start:"number"==typeof l.selectionStart?l.selectionStart:null,end:"number"==typeof l.selectionEnd?l.selectionEnd:null}}o(G(l,e,n));const a=function(e,n,t){return null===e?null:e===n?t:n<e&&t>=e?e-1:n>e&&t<=e?e+1:e}(k,e,n);a!==k&&w(a),ve(ee.moved({n:n+1,total:l.length}))},ye=e=>{le&&(o(U(l,e,a())),O?(de.current={index:e,nth:0,start:null,end:null},null!==k&&k>=e&&w(k+1)):w(e))},ke=e=>{ae(e)&&(o(q(l,e)),k===e?w(null):null!==k&&k>e&&w(k-1))},we=b({keyOf:e=>String(e),canDrop:(e,n)=>n.parentId===J.parentId&&n.slot===J.slot,onDrop:(e,n)=>{const t=v({...J,index:e},n);t!==e&&ge(e,t)},onStep:(e,n)=>ge(e,e+n),canStep:(e,n)=>e+n>=0&&e+n<l.length,readOnly:y}),xe=e=>{const n=[];return e>0&&n.push({label:ee.moveUp,icon:/* @__PURE__ */z(K,{size:14}),shortcut:"⌥↑",onClick:()=>ge(e,e-1)}),e<l.length-1&&n.push({label:ee.moveDown,icon:/* @__PURE__ */z(Q,{size:14}),shortcut:"⌥↓",onClick:()=>ge(e,e+1)}),ie(e)&&n.push({label:ee.duplicate,icon:/* @__PURE__ */z(V,{size:14}),onClick:()=>(e=>{ie(e)&&(o(U(l,e+1,x(l[e]))),null!==k&&k>e&&w(k+1))})(e)}),ae(e)&&n.push({label:ee.delete,icon:/* @__PURE__ */z(X,{size:14}),danger:!0,onClick:()=>ke(e)}),n},Ce=(e,n,t,l)=>{y||0===xe(e).length||fe({index:e,x:n,y:t,owner:l})},Oe=e=>n=>{const t=l.slice();t[e]=n,o(t)};/* @__PURE__ */
|
|
2
|
+
return W("div",{className:"es-list",children:[Z?/* @__PURE__ */W("div",{className:"es-list-head",children:[
|
|
3
|
+
/* @__PURE__ */W("span",{className:"es-list-label",children:[n?/* @__PURE__ */z("span",{className:"es-field-icon","aria-hidden":"true",children:n}):null,e]}),
|
|
4
|
+
/* @__PURE__ */z(N,{count:l.length,label:ee.count({noun:te,n:l.length}),showZero:!0})]}):null,Y?/* @__PURE__ */z("div",{className:"es-list-above",children:Y}):null,l.length?/* @__PURE__ */W(D,{"aria-label":e,spacing:"comfortable",className:"es-list-rows",rootProps:we.rootProps(),children:[l.map((e,n)=>{const t=we.row({item:n,place:{...J,index:n}}),l=t.draggable&&ue!==n,o=!O&&k===n,a=!y&&!L&&E&&oe(n),i=["es-list-row",O?"is-inline":"is-item",o?"is-open":"",l?"is-draggable":"",t.dragging?"is-dragging":"",t.drop?`is-drop-${t.drop}`:""].filter(Boolean).join(" ");return[n>0?/* @__PURE__ */z(r,{...we.seam({place:{...J,index:n}}),onAdd:le?()=>ye(n):void 0,label:ee.addHere({noun:te})},`seam-${n}`):null,
|
|
5
|
+
/* @__PURE__ */z(j,{className:i,flat:!!O,active:o,title:O?void 0:/* @__PURE__ */W(B,{children:[
|
|
6
|
+
/* @__PURE__ */z("span",{className:"es-list-row-name",children:se(e,n)}),s?/* @__PURE__ */z("span",{className:"es-list-row-summary",children:s(e,n)}):null]}),thumb:!O&&u?u(e,n):void 0,expanded:O?void 0:o,onToggle:O?void 0:()=>w(o?null:n),draggable:t.draggable,dragHint:ne.dragHint,dragging:t.dragging,drop:"before"===t.drop||"after"===t.drop?t.drop:void 0,onMove:t.draggable?e=>ge(n,"up"===e?n-1:n+1):void 0,rowRef:e=>{ce.current[n]=e},rowProps:{...t.rowProps,draggable:l||void 0,onPointerDown:e=>{const l=e.target.closest?.('input, textarea, select, [contenteditable]:not([contenteditable="false"])'),r=!!l&&l===l.ownerDocument.activeElement;e.currentTarget.draggable=t.draggable&&!r,he.current=l&&!r?l:null,me(r?n:null)},onDragStart:e=>{const n=he.current;he.current=null,n&&n.ownerDocument.activeElement===n&&n.blur(),t.rowProps.onDragStart?.(e)},onContextMenu:e=>{y||(e.preventDefault(),e.stopPropagation(),Ce(n,e.clientX,e.clientY,e.currentTarget))},onKeyDown:e=>{if("ContextMenu"===e.key||e.shiftKey&&"F10"===e.key){e.preventDefault();const t=e.currentTarget.ownerDocument,l=e=>e.preventDefault();t.addEventListener("contextmenu",l,{capture:!0,once:!0}),t.defaultView?.setTimeout(()=>t.removeEventListener("contextmenu",l,{capture:!0}),500);const r=e.currentTarget.getBoundingClientRect();return void Ce(n,r.left+24,r.bottom,e.currentTarget)}t.rowProps.onKeyDown?.(e)}},actions:y||L||!E?void 0:a?g(P?P(e,n):ee.locked,/* @__PURE__ */z("span",{className:"es-list-lock",role:"img","aria-label":P?P(e,n):ee.locked,children:/* @__PURE__ */z(A,{size:13})})):g(ee.deleteItem({noun:te}),/* @__PURE__ */z(I,{size:"sm",className:"es-list-x","aria-label":ee.deleteItem({noun:te}),disabled:!ae(n),onClick:()=>ke(n),children:/* @__PURE__ */z(H,{size:14,"aria-hidden":"true"})})),below:o?/* @__PURE__ */z("div",{className:"es-list-item",children:C(e,n,Oe(n))}):void 0,children:O?/* @__PURE__ */z("div",{className:"es-list-row-main",children:O(e,n,Oe(n))}):null},n)]}),
|
|
7
|
+
/* @__PURE__ */z(r,{...we.seam({place:{...J,index:l.length}})})]}):null,y||L?null:/* @__PURE__ */z("button",{type:"button",className:"es-list-add",disabled:!le,onClick:()=>ye(l.length),children:ee.add({noun:te})}),
|
|
8
|
+
/* @__PURE__ */z("span",{className:"es-list-said","aria-live":"polite",children:be}),pe&&pe.index<l.length?
|
|
9
|
+
/* @__PURE__ */z(S,{at:{x:pe.x,y:pe.y},owner:pe.owner,onClose:()=>fe(null),items:c(xe(pe.index))}):null]})}var ne=e=>e<6?e+1:6,te=(e,n)=>"string"==typeof e.label&&e.label?e.label:n;function le({field:e,name:t,id:l,value:r,onChange:o,readOnly:i,context:s,showWhenContext:c,renderers:d,headingLevel:u=3}){const[m,h]=F(!0),p=r&&"object"==typeof r?r:{};/* @__PURE__ */
|
|
10
|
+
return z(a,{id:`${l}-group`,title:te(e,t),open:m,onToggle:h,level:u,children:Object.entries(n(e.objectFields,{values:p,context:c})).map(([e,n])=>/* @__PURE__ */z(oe,{field:n,name:`${t}.${e}`,id:`${l}-${e}`,value:p[e],onChange:n=>o({...p,[e]:n}),readOnly:i,context:s,showWhenContext:c,renderers:d,headingLevel:ne(u)},e))})}function re({field:e,name:t,id:l,value:r,onChange:o,readOnly:a,context:i,showWhenContext:s,renderers:c,openItem:d,onOpenItem:u,headingLevel:m}){const[h,p]=F(null),f=u?d??null:h,b=u??p,v=Array.isArray(r)?r:[],g=e.getItemSummary;/* @__PURE__ */
|
|
11
|
+
return z(ee,{label:te(e,t),icon:e.icon,noun:"string"==typeof e.noun?e.noun:void 0,items:v,onChange:o,newItem:()=>x({...e.defaultItemProps??{}}),summary:g?(e,n)=>g(e,n):void 0,min:e.min,max:e.max,readOnly:a,open:f,onOpen:b,renderItem:(r,o,d)=>Object.entries(n(e.arrayFields,{values:r,context:s})).map(([e,n])=>/* @__PURE__ */z(oe,{field:n,name:`${t}[${o}].${e}`,id:`${l}-${o}-${e}`,value:r?.[e],onChange:n=>d({...r,[e]:n}),readOnly:a,context:i,showWhenContext:s,renderers:c,headingLevel:m},e))})}function oe(e){const{field:n,name:t,id:l,value:r,onChange:o,readOnly:a,context:i,renderers:s}=e;if(!n||n.marker||!1===n.visible)return null;const c=s?.[n.type];if(c)return c({field:n,name:t,id:l,value:r,onChange:o,readOnly:a});switch(n.type){case"custom":{const e={...i,field:n,name:t,id:l,value:r,onChange:o,readOnly:a};return n.render(e)}case"text":case"textarea":/* @__PURE__ */
|
|
12
|
+
return z(h,{label:te(n,t),htmlFor:l,icon:n.icon,hint:n.hint,children:/* @__PURE__ */z(Z,{id:l,value:"string"==typeof r?r:null==r?"":String(r),onChange:o,placeholder:n.placeholder,multiline:"textarea"===n.type,readOnly:a})});case"number":/* @__PURE__ */
|
|
13
|
+
return z(h,{label:te(n,t),htmlFor:l,icon:n.icon,hint:n.hint,children:/* @__PURE__ */z(d,{id:l,value:"number"==typeof r?r:void 0,onChange:o,min:n.min,max:n.max,step:n.step,placeholder:n.placeholder,readOnly:a})});case"select":{const e=`${l}-label`;/* @__PURE__ */
|
|
14
|
+
return z(h,{label:te(n,t),labelId:e,htmlFor:l,icon:n.icon,hint:n.hint,children:/* @__PURE__ */z(u,{id:l,value:r,options:n.options,onChange:o,readOnly:a,ariaLabelledBy:e})})}case"radio":/* @__PURE__ */
|
|
15
|
+
return z(h,{label:te(n,t),icon:n.icon,hint:n.hint,children:/* @__PURE__ */z(m,{ariaLabel:te(n,t),value:r,options:n.options.map(e=>({id:e.value,label:e.label,icon:e.icon,disabled:e.disabled||a})),onChange:e=>{a||o(e)}})});case"object":/* @__PURE__ */
|
|
16
|
+
return z(le,{...e,field:n});case"array":/* @__PURE__ */
|
|
17
|
+
return z(re,{...e,field:n});case"slot":return null}}function ae(e,n,r){if("mobile"!==n&&"tablet"!==n)return!0;const o=e;if(o&&"string"==typeof o.reachedBy){const t=r?.[o.reachedBy];return void 0!==t&&t!==e&&ae(t,n)}if(!o||o.marker||"slot"===o.type)return!0;const a=t(e)?.tier;return a?a===n||"each"===a:"always"===l(e)}var ie={},se=e=>o.includes(e);function ce(n,t){let l,r=o[0];const a=[],i=/* @__PURE__ */new Set;for(const[o,s]of Object.entries(n))s&&(se(s.bucket)&&((s.marker||s.bucket!==r)&&(l=void 0),r=s.bucket),s.marker&&"string"==typeof s.fold?l={key:o,title:s.fold}:s.marker&&!1===s.fold&&(l=void 0),s.marker||!1===s.visible||t&&!e(s,t)||t&&!ue(s,n,t)||t&&!ae(s,t.context?.device,n)||(a.push(l?{name:o,field:s,bucket:r,fold:l}:{name:o,field:s,bucket:r}),"slot"!==s.type&&i.add(r)));return{rows:a,buckets:o.filter(e=>i.has(e))}}function de(e){return new Map(ce(e).rows.map(e=>[e.name,e.bucket]))}function ue(n,t,l){const r=n.reachedBy;if("string"!=typeof r)return!0;const o=t[r];return!!o&&!1!==o.visible&&e(o,l)}function me(e){const n=[];for(const t of e){const e=n[n.length-1];e&&e.fold?.key===t.fold?.key?e.rows.push(t):n.push({fold:t.fold,rows:[t]})}return n}function he({fields:e,values:n,onChange:t,readOnly:l=!1,context:r,showWhenContext:i,tab:c,onTab:d,tabs:u=!0,allTabs:m=!1,tabIcons:h,renderers:p,idPrefix:b,ariaLabel:v,lead:g,children:y,leadFold:k,closedFolds:w,onFold:x,headingLevel:C=3}){const O=f("panel",s),N=R(),D=b??`es-insp${N.replace(/:/g,"")}`,j=ce(e,{values:n,context:i}),[I,S]=F(void 0),E=I&&(I.panel===D||j.buckets.includes(I.tab))?I.tab:void 0,T=c??E,M=m?o:j.buckets,B=T&&M.includes(T)?T:j.buckets[0]??M[0],[A,H]=F(null),Y=A&&A.panel===D&&j.rows.some(e=>e.name===A.name)?A:null,K=u&&M.length>1,Q=K&&B?$(D,B):`${D}-rows`,[V,X]=F(()=>/* @__PURE__ */new Set),Z=w??V,U=(e,n)=>{/* @__PURE__ */return z(a,{title:e.title,open:!Z.has(e.key),onToggle:n=>((e,n)=>{void 0===w&&X(t=>{const l=new Set(t);return n?l.delete(e):l.add(e),l}),x?.(e,n)})(e.key,n),id:`${D}-fold-${t=e.key,[...t].map(e=>/[A-Za-z0-9_-]/.test(e)?e:`-u${e.codePointAt(0).toString(16)}-`).join("")}`,level:C,children:n});var t},G=e=>K&&e!==B,q=({name:e,field:o,bucket:a,fold:s})=>/* @__PURE__ */z("div",{className:"es-insp-row","data-field":e,"data-bucket":a,hidden:!!G(a)||void 0,children:/* @__PURE__ */z(oe,{field:o,name:e,id:`${D}-${e}`,value:n[e],onChange:n=>t(e,n),readOnly:l,context:r,showWhenContext:i,renderers:p,openItem:Y&&Y.name===e?Y.index:null,onOpenItem:n=>H(null===n?null:{panel:D,name:e,index:n}),headingLevel:s?ne(C):C})},e);/* @__PURE__ */
|
|
18
|
+
return W("div",{className:"es-insp",children:[K?/* @__PURE__ */z("div",{className:"es-insp-tabs",children:/* @__PURE__ */z(P,{variant:"underline",block:!0,"aria-label":v??O.settings,idPrefix:D,value:B,onChange:e=>{const n=e;void 0===c&&S({panel:D,tab:n}),d?.(n)},items:M.map(e=>{const n=O.buckets[e],t=h?.[e];return t?{id:e,icon:t,label:/* @__PURE__ */z("span",{className:"sr-only",children:n}),tooltip:n}:{id:e,label:n}})})}):null,
|
|
19
|
+
/* @__PURE__ */W("div",{className:"es-insp-rows",id:Q,role:K?"tabpanel":void 0,"aria-labelledby":K&&B?L(D,B):void 0,children:[g&&ae(ie,i?.device)?k?/* @__PURE__ */z("div",{className:"es-insp-band","data-fold":k.key,children:U(k,g)}):g:null,me(j.rows).map((e,n)=>{if(!e.fold)return e.rows.map(q);const t=e.rows[0].bucket,l=e.rows.every(e=>"slot"===e.field.type);/* @__PURE__ */
|
|
20
|
+
return z("div",{className:"es-insp-band","data-fold":e.fold.key,"data-bucket":t,hidden:!(!G(t)&&!l)||void 0,children:U(e.fold,e.rows.map(q))},`fold-${e.fold.key}-${n}`)}),y]})]})}function pe(e,n,l=ae){const r=t(e)?.tier,o=t=>l(e,t,n)&&r!==t&&"each"!==r?1:0;return{phoneShared:o("mobile"),tabletShared:o("tablet")}}function fe(e){const{arrayFields:n,objectFields:t}=e;return Object.values(n??t??{}).reduce((e,n)=>e+1+fe(n),0)}var be=/\buse(?:PreviewDevice\(\)|(?:Context)?\(PreviewDeviceContext\))|\b(?:previewD|d)evice\s*(?:[!=]==?|\?)|(?:[!=]==?)\s*(?:previewD|d)evice\b|switch\s*\(\s*(?:previewD|d)evice\b|shownTier\(\w+\)\s*[!=]==|\btier\s*[!=]==\s*"(?:mobile|tablet|desktop|each)"|context:\s*"device"/g;function ve(e){return e.match(be)??[]}function ge({value:e,count:n,onChange:t,readOnly:l,noun:r,itemLabel:o,hint:a,children:i}){const s=f("fields",p).phoneOrder??p.phoneOrder;if(!(n>=2))return null;const c=y(e,n),d=k(c);/* @__PURE__ */
|
|
21
|
+
return z(h,{label:s.label,icon:/* @__PURE__ */z(Y,{}),hint:a??s.hint({noun:r}),value:n,children:/* @__PURE__ */W("div",{className:"es-phone-order",children:[
|
|
22
|
+
/* @__PURE__ */z(ee,{label:s.label,head:!1,noun:r,items:c,onChange:e=>t(w(e,n)),newItem:()=>0,fixed:!0,readOnly:l,open:null,onOpen:()=>{},renderItem:()=>null,itemName:e=>o(e),renderRow:(e,n)=>/* @__PURE__ */W("span",{className:"es-phone-order-row",children:[
|
|
23
|
+
/* @__PURE__ */z("span",{className:"es-phone-order-pos","aria-hidden":"true",children:n+1}),
|
|
24
|
+
/* @__PURE__ */z("span",{className:"es-phone-order-name",children:o(e)})]})}),
|
|
25
|
+
/* @__PURE__ */z("p",{className:"es-phone-order-note",children:d?s.desktopKept:s.followsDesktop({noun:r})}),d&&i,d&&!l&&
|
|
26
|
+
/* @__PURE__ */z(E,{variant:"secondary",size:"md",block:!0,onClick:()=>t(void 0),children:s.matchDesktop})]})})}export{Z as FieldText,he as Inspector,oe as InspectorField,ee as ListField,ge as PhoneOrderField,de as bucketsOf,ae as fieldShownInView,fe as innerRowCount,U as insertAt,te as labelOf,G as moveTo,ce as planFields,q as removeAt,pe as rowViewState,ve as viewReadsIn};
|
|
@@ -1,17 +1,17 @@
|
|
|
1
|
-
import{sidesStartEach as e,SidesInput as n,SidesEachToggle as t}from"./chunk-XWTQTANN.js";import{SettingsDefaultReset as l}from"./chunk-2T22IY3J.js";import{deviceField as o}from"./chunk-ZNLODQD4.js";import{noControlField as a,NoControlMark as i}from"./chunk-22I55W37.js";import{describedAs as r}from"./chunk-LX23TCTP.js";import{withStyleKind as s}from"./chunk-
|
|
2
|
-
return
|
|
3
|
-
return
|
|
4
|
-
return
|
|
5
|
-
return
|
|
6
|
-
return
|
|
7
|
-
return
|
|
8
|
-
/* @__PURE__ */
|
|
9
|
-
/* @__PURE__ */
|
|
10
|
-
return
|
|
11
|
-
return
|
|
12
|
-
return
|
|
13
|
-
return
|
|
14
|
-
return
|
|
15
|
-
return
|
|
16
|
-
/* @__PURE__ */
|
|
17
|
-
return
|
|
1
|
+
import{sidesStartEach as e,SidesInput as n,SidesEachToggle as t}from"./chunk-XWTQTANN.js";import{SettingsDefaultReset as l}from"./chunk-2T22IY3J.js";import{deviceField as o}from"./chunk-ZNLODQD4.js";import{noControlField as a,NoControlMark as i}from"./chunk-22I55W37.js";import{describedAs as r}from"./chunk-LX23TCTP.js";import{withStyleKind as s}from"./chunk-3OOYGEJY.js";import{foldMetaOf as u,FOLD_FIELD_MARKER as c}from"./chunk-ANPOR6EY.js";import{useSelectedHost as d,useEasel as p}from"./chunk-HGTDDSFJ.js";import{DEFAULT_PANEL_WORDS as f}from"./chunk-56ID6FKZ.js";import{SettingsSwitch as b}from"./chunk-OECWLNKJ.js";import{phoneKey as m,tabletKey as h,viewFollows as v,isAuto as g}from"./chunk-DIOTWSCO.js";import{FieldSelect as y}from"./chunk-C63IB4VW.js";import{SettingsSegmented as w}from"./chunk-DX3VILZ3.js";import{SettingsField as k}from"./chunk-MIX7EGRG.js";import{useWords as x}from"./chunk-MFIRYGHW.js";import{useState as C}from"react";import{AlignmentIcon as j,BoxJustifyIcon as F,WrapIcon as O,ArrowRightIcon as L,GapIcon as S,WidthIcon as K,PlacementIcon as V,NudgeIcon as E,DesktopIcon as P,BoxXEndIcon as R,BoxXCenterIcon as A,BoxXStartIcon as I,PaddingAllIcon as M,BoxYBetweenIcon as T,BoxYStretchIcon as B,BoxYEndIcon as W,BoxYCenterIcon as N,BoxYStartIcon as $,BoxXBetweenIcon as G,BoxXStretchIcon as D,BoxItemAlignmentIcon as J}from"efficient-shell/icons/efficient";import{textAlignOptions as Y,AlignmentGrid as H,PositionInput as X,Slider as _}from"efficient-shell/ui";import{jsx as z,Fragment as Z,jsxs as Q}from"react/jsx-runtime";var U=e=>e;function q(e,n,t="desktop"){return e("tablet"===t?"{value} on tablet":"{value} on desktop").replace("{value}",n)}var ee=()=>{};function ne(){return null}function te(e){if(!e.trim())throw new Error("noGlyph() needs a reason naming the ruling that decided it.");/* @__PURE__ */
|
|
2
|
+
return z(ne,{},e)}function le(e){return e.type===ne}function oe(e){return le(e)?void 0:e}function ae(e){for(const[n,t]of Object.entries(e))t&&"object"==typeof t&&!u(t)&&s(t,`section:${n}`);return e}function ie(e,n){return{type:"custom",[c]:{label:e,level:n},marker:!0,fold:e,render:()=>/* @__PURE__ */z(Z,{})}}function re(e){return ie(e,2)}function se(e){return ie(e,1)}var ue=[{label:"Start",value:"start"},{label:"Center",value:"center"},{label:"Space between",value:"between"},{label:"End",value:"end"}],ce=[{label:"Start",value:"start"},{label:"Center",value:"center"},{label:"End",value:"end"},{label:"Stretch",value:"stretch"}],de="Wrap",pe=[{label:"Wrap",value:"wrap"},{label:"No wrap",value:"nowrap"}],fe="Direction",be=[{label:"Stacked",value:"column"},{label:"One row",value:"row"}],me={min:-32,max:64,step:2,builtIn:0},he={min:30,max:100,step:5,fallback:60},ve=["top-left","top-center","top-right","left","center","right","bottom-left","bottom-center","bottom-right"],ge="bottom-left",ye={"top-left":"Top left","top-center":"Top center","top-right":"Top right",left:"Left",center:"Center",right:"Right","bottom-left":"Bottom left","bottom-center":"Bottom center","bottom-right":"Bottom right"},we=ve.map(e=>({value:e,label:ye[e]}));function ke(e,n=ge){return ve.includes(e)?e:n}var xe=40,Ce=e=>"number"==typeof e?e:null;function je(e,n,t){const l={};for(const o of["x","y"])t[o]!==n[o]&&(l[e[o]]=t[o]??void 0);return l}var Fe=["top","right","bottom","left"],Oe={top:"sectionPaddingTop",right:"sectionPaddingRight",bottom:"sectionPaddingBottom",left:"sectionPaddingLeft"},Le=e=>"number"==typeof e?e:null;function Se(e,n,t){const l={};for(const o of Fe)t[o]!==n[o]&&(l[e[o]]=t[o]??void 0);return l}function Ke(e){if("number"==typeof e)return{top:e,right:e,bottom:e,left:e};const n=e&&"object"==typeof e?e:{};return Object.fromEntries(Fe.map(e=>[e,Le(n[e])]))}function Ve(e){const n={};for(const t of Fe)"number"==typeof e[t]&&(n[t]=e[t]);return Object.keys(n).length?n:void 0}function Ee(e,n={}){const t=n=>{const t=n[e];return t&&"object"==typeof t?t:{}},l=e=>Object.hasOwn(n,e)?n[e]:e;return{read:(e,n)=>t(e)[l(n)],write:(n,o,a)=>{const i={...t(n)};return void 0===a?delete i[l(o)]:i[l(o)]=a,{[e]:Object.keys(i).length?i:void 0}}}}function Pe(e,n,t){const l=Re(e),o=d();if(t)return[t.value,t.onChange];const a=o?.values??{};return[e.read(a,n),e=>l([[n,e]])]}function Re(e){const n=d();return t=>{n&&n.onChangeMany(n=>{let l={};for(const[o,a]of t)l={...l,...e.write({...n,...l},o,a)};return l})}}var Ae={read:(e,n)=>e[n],write:(e,n,t)=>({[n]:t})},Ie={fieldKey:m,ownField:!0,read:(e,n)=>e[m(n)],write:(e,n,t)=>({[m(n)]:t})},Me={fieldKey:h,ownField:!0,read:(e,n)=>e[h(n)],write:(e,n,t)=>({[h(n)]:t})},Te={...Ie,tablet:Me};function Be(e){return{...Ee(e),fieldKey:n=>`_${e}_${n}`}}function We({row:e,desktopKey:n,access:t,wider:l,props:o}){const a=d(),i=a?.values??{},r=l?.read(i,n),s=v(i[n],r),u=g(r)?"desktop":"tablet",[c,p]=Pe(t,n);return t.ownField?e.render({...o,follows:s,followsView:u,twinAccess:t,widerAccess:l}):e.render({...o,value:c,storedValue:c,follows:s,followsView:u,twinAccess:t,widerAccess:l,onChange:p})}function Ne(e,n,t=Ie,l={}){const a=l.phoneRow??n,i=(n,t)=>({...a,render:l=>/* @__PURE__ */z(We,{row:a,desktopKey:e,access:n,wider:t,props:l})}),r=t.tablet;return{[e]:o("desktop",n),...r?{[r.fieldKey(e)]:o("tablet",i(r))}:{},[t.fieldKey(e)]:o("mobile",i(t,r))}}var $e=["left","center","right"];function Ge(e,{options:n,value:t,onChange:l,ariaLabel:o,disabled:a=!1}){/* @__PURE__ */
|
|
3
|
+
return z(w,{options:n.map(n=>n.picture?{id:n.value,label:n.picture,title:e(n.title??n.label)}:{id:n.value,label:e(n.label),title:void 0===n.title?void 0:e(n.title)}),value:t,onChange:l,ariaLabel:e(o),disabled:a})}function De(e,{label:n,value:t,onChange:l,points:o}){const a=o.find(e=>e.disabled),i=o.map(n=>({...n,label:e(n.label),...n.title?{title:e(n.title)}:null}));/* @__PURE__ */
|
|
4
|
+
return z(k,{label:e(n),icon:/* @__PURE__ */z(V,{}),hint:a?.title?e(a.title):void 0,children:/* @__PURE__ */z(H,{label:e(n),value:t,points:i,onChange:l})})}function Je({say:e,label:n,value:t,onChange:l,pointsFor:o}){const{appState:a,selectedItem:i}=p(e=>e),r=i?.props?.id?String(i.props.id):void 0;return De(e,{label:n,value:t,onChange:l,points:o(a?.data,r)})}function Ye({say:e,o:n}){const t=d(),o=x("panel",f),a=t?.values??{},i={x:Ce(a[n.keys.x]),y:Ce(a[n.keys.y])},r=e(n.label??"Position"),s=Boolean(i.x||i.y),u=e=>{const l=je(n.keys,i,e);Object.keys(l).length&&t?.onChangeMany(l)},c=/* @__PURE__ */z(X,{label:r,value:i,onChange:u,words:{x:e("Left and right"),y:e("Up and down"),unit:"px"},placeholder:{x:"0",y:"0"},min:n.min,max:n.max,step:n.step??1}),p=/* @__PURE__ */z(l,{words:o,label:r,changed:s,detail:"0 px, 0 px",onReset:()=>u({x:null,y:null})});return null===n.label?/* @__PURE__ */Q("div",{className:"sf-position-line",children:[c,p]}):/* @__PURE__ */z(k,{label:r,icon:/* @__PURE__ */z(E,{}),changed:s,action:p,children:c})}var He={x:{start:/* @__PURE__ */z(I,{}),center:/* @__PURE__ */z(A,{}),end:/* @__PURE__ */z(R,{}),stretch:/* @__PURE__ */z(D,{}),between:/* @__PURE__ */z(G,{})},y:{start:/* @__PURE__ */z($,{}),center:/* @__PURE__ */z(N,{}),end:/* @__PURE__ */z(W,{}),stretch:/* @__PURE__ */z(B,{}),between:/* @__PURE__ */z(T,{})}},Xe=e=>"row"===e?"row":"column";function _e({say:e,kind:n,label:t,options:l,value:o,onChange:a,o:i}){const r=d(),s="justify"===n==("row"===(i.runs??Xe)(r?.values?.[i.directionKey??"direction"]))?"x":"y";return Ge(e,{options:l.map(e=>({label:e.label,value:e.value,picture:He[s][e.value]})),value:o,onChange:a,ariaLabel:t})}function ze(e,n){const t=(e.useFallback??ee)(n);return Object.fromEntries(Fe.map(n=>[n,t?.[n]??e.fallback[n]]))}function Ze({say:e,tier:n,o:t,props:l}){const o=ze(t,l),a=d(),i=a?.values??{},r="mobile"===n?t.phoneKeys:"tablet"===n?t.tabletKeys:t.keys,s=Object.fromEntries(Fe.map(e=>[e,Le(i[r[e]])])),u="desktop"===n?null:Object.fromEntries(Fe.map(e=>[e,v(Le(i[t.keys[e]]),"mobile"===n?Le(i[t.tabletKeys[e]]):null)]));/* @__PURE__ */
|
|
5
|
+
return z(Ue,{say:e,o:t,fallback:o,value:s,follows:u,followsView:"mobile"===n&&Fe.some(e=>null!==Le(i[t.tabletKeys[e]]))?"tablet":"desktop",readOnly:l.readOnly,onChange:e=>{const n=Se(r,s,e);Object.keys(n).length&&a?.onChangeMany(n)}})}function Qe({say:e,o:n,props:t}){const l=ze(n,t);/* @__PURE__ */
|
|
6
|
+
return z(Ue,{say:e,o:n,fallback:l,value:Ke(t.value),follows:"follows"in t?Ke(t.follows):null,followsView:t.followsView,readOnly:t.readOnly,onChange:e=>t.onChange(Ve(e))})}function Ue({say:o,o:a,fallback:i,value:r,follows:s,followsView:u,readOnly:c,onChange:d}){const p=Object.fromEntries(Fe.map(e=>[e,String(s?.[e]??i[e])])),[b,m]=C(()=>e(r,p)),h=x("panel",f),v=Fe.map(e=>p[e]),g=`${1===new Set(v).size?v[0]:v.join(" / ")}px`;/* @__PURE__ */
|
|
7
|
+
return z(k,{label:o(a.label),icon:a.icon??/* @__PURE__ */z(M,{}),action:/* @__PURE__ */Q(Z,{children:[
|
|
8
|
+
/* @__PURE__ */z(t,{each:b,label:o("Each side"),onChange:m,disabled:c}),
|
|
9
|
+
/* @__PURE__ */z(l,{words:h,label:o(a.label),changed:Fe.some(e=>"number"==typeof r[e]),detail:s?q(o,g,u):g,disabled:c,onReset:()=>d({top:null,right:null,bottom:null,left:null})})]}),children:/* @__PURE__ */z(n,{label:o(a.label),each:b,value:r,placeholder:p,min:a.min,max:a.max,step:a.step,readOnly:c,onChange:d,words:{sides:{top:o("Padding top"),right:o("Padding right"),bottom:o("Padding bottom"),left:o("Padding left")},vertical:o("Top and bottom"),horizontal:o("Left and right"),unit:"px"}})})}var qe=e=>""===e||"px"===e?e:` ${e}`;function en({label:e,value:n,onChange:t,min:o,max:a,step:i=1,unit:r="",hint:s,emptyLabel:u,inputMax:c,readOnly:d=!1,clears:p,detail:f,resetWords:b}){const m="number"==typeof n,h=p?/* @__PURE__ */z(l,{label:e,changed:m,detail:f??u??(void 0===s?void 0:`${s}${qe(r)}`),disabled:d,onReset:()=>t(void 0),...b?{words:b}:{}}):void 0;return{track:/* @__PURE__ */z("div",{className:"sf-slider",children:/* @__PURE__ */z(_,{min:o,max:a,step:i,value:n,suffix:r||void 0,showInput:!0,label:e,disabled:d,...p&&void 0!==s?{placeholderValue:s}:{},...u?{emptyLabel:u}:{},...void 0!==c?{inputMax:c}:{},size:"sm",boxSize:"md",className:"sf-slider-track",onChange:e=>{null===e?p&&m&&t(void 0):e!==n&&t(e)}})}),reset:h}}function nn({caption:e,label:n,value:t,hint:l,emptyLabel:o,...a}){const i=void 0!==l||void 0!==o,r="number"==typeof t,{track:s,reset:u}=en({...a,label:n,value:r?t:i?null:a.min,hint:l,emptyLabel:o,clears:i});/* @__PURE__ */
|
|
10
|
+
return z(k,{label:e??n,action:u,children:s})}function tn({draw:e,props:n,useMax:t,useHint:l}){return e(n,{max:(t??ee)(n),hint:(l??ee)(n)})}function ln(e=U){function n(n,t,l,o,a,i,s="",u){const c="function"==typeof u?{action:u}:u??{},{action:d,clear:p}=c,f=(r,u)=>{const f="storedValue"in r?r.storedValue:r.value,b="follows"in r,m=b&&!1!==p?.phoneFollows,h=b||void 0!==p,v="number"==typeof r.value,g=void 0===p?i:u.hint??("function"==typeof p.hint?p.hint(r):p.hint)??i,y=m&&"number"==typeof r.follows?r.follows:g,w=qe(s),x=!p?.emptyLabel||m&&"number"==typeof r.follows?void 0:p.emptyLabel,C=x??`${y}${w}`,j="function"==typeof c.hint?c.hint(r):c.hint,{track:F,reset:O}=en({label:e(n),value:v?r.value:h?null:i,onChange:e=>r.onChange(e),min:l,max:u.max??o,step:a,unit:s,hint:h?y:void 0,emptyLabel:x,inputMax:c.inputMax,readOnly:!0===r.readOnly,clears:h,detail:m?q(e,C,r.followsView):C});/* @__PURE__ */
|
|
11
|
+
return z(k,{label:e(n),icon:oe(t),hint:void 0===j?void 0:e(j),action:h?O:d?d(f,r.onChange):void 0,children:F})},b=c.useMax,m=p?.useHint;return{type:"custom",...r({},{type:"number",label:n}),render:b||m?e=>/* @__PURE__ */z(tn,{draw:f,props:e,useMax:b,useHint:m}):e=>f(e,{})}}function t(n){return Ge(e,n)}function s(n,o,a,i,s={}){const u=a.map(e=>"string"==typeof e?{label:e,value:e}:e);return{type:"custom",...r({},{type:"radio",label:n,options:u.map(e=>({value:e.value,label:e.label}))}),render:a=>{const{value:r,onChange:c,field:d}=a,p=u.some(e=>e.value===r),f=!0===a.readOnly;if("follows"in a&&!u.some(e=>""===e.value)){const d=s.phoneRest?s.phoneRest(a.follows):a.follows,b=u.find(e=>e.value===d)??u.find(e=>e.value===i);/* @__PURE__ */
|
|
12
|
+
return z(k,{label:e(n),icon:oe(o),action:/* @__PURE__ */z(l,{label:e(n),changed:p,detail:q(e,e(b?.label??""),a.followsView),disabled:f,onReset:()=>c(void 0)}),children:t({options:u,value:p?r:b?.value??i,onChange:c,ariaLabel:n,disabled:f})})}const b="follows"in a&&s.followsLabel?s.followsLabel(a.follows):void 0;/* @__PURE__ */
|
|
13
|
+
return z(k,{label:e(n),icon:oe(o),action:"follows"in a&&s.followsLabel?/* @__PURE__ */z(l,{label:e(n),changed:null!=r&&""!==r,detail:void 0===b?void 0:q(e,e(b),a.followsView),disabled:f,onReset:()=>c(void 0)}):void 0,children:t({options:u,value:p?r:r||d?.currentValue||i,onChange:c,ariaLabel:n,disabled:f})})}}}function u(e,n){return n.phone?e.unshift({label:"Match desktop",value:"",picture:/* @__PURE__ */z(P,{})}):n.inherit&&e.unshift({label:n.inherit,value:""}),e}function c(e,n){return n.inherit||n.phone?{...e,render:n=>e.render({...n,onChange:e=>n.onChange(""===e?void 0:e)})}:e}function d(e,n,t,l){if(l.access){const o=l.inherit?"":l.fallback??"left",a=t({...l,phone:!1}),i=e=>{const n="string"==typeof e&&""!==e&&a.some(n=>n.value===e)?e:o;return a.find(e=>e.value===n)?.label};return Ne(e,n(l,o),l.access,{phoneRow:n({...l,phone:!0},"",i)})}return{[e]:o("desktop",n(l)),[m(e)]:o("mobile",n({...l,phone:!0},""))}}function p(e){return u(Y(e.allow??$e).map(e=>({label:e.label,value:e.value,picture:e.icon})),e)}function f(e,n=e.fallback??"left",t){return c(s(e.label??"Text alignment",/* @__PURE__ */z(j,{}),p(e),n,t?{followsLabel:t}:{}),e)}function v(e){const n={left:He.x.start,center:He.x.center,right:He.x.end};return u(Y((e.allow??$e).filter(e=>e in n)).map(e=>({label:e.label,value:e.value,picture:n[e.value]})),e)}function g(e,n=e.fallback??"left",t){return c(s(e.label??"Block alignment",/* @__PURE__ */z(F,{}),v(e),n,t?{followsLabel:t}:{}),e)}function w(n,t,l,o,a,i){return{type:"custom",options:o,fallback:a,...r({},{type:"radio",label:t,options:o.map(e=>({value:e.value,label:e.label}))}),render:({value:r,onChange:s,field:u})=>{const c=u.options??o,d=u.fallback??a,p=c.some(e=>e.value===r)?r:d;/* @__PURE__ */
|
|
14
|
+
return z(k,{label:e(t),icon:oe(l),children:/* @__PURE__ */z(_e,{say:e,kind:n,label:t,options:c,value:p,onChange:s,o:i})})}}}function x(e={}){return w("justify","Justify",/* @__PURE__ */z(F,{}),ue,ue[0].value,e)}function C(e={}){return w("align","Item alignment",/* @__PURE__ */z(J,{}),ce,"stretch",e)}function V(){const n=de;return{type:"custom",options:pe,fallback:pe[1].value,...r({},{type:"radio",label:n,options:pe.map(e=>({value:e.value,label:e.label}))}),render:({value:t,onChange:l,id:o,name:a})=>{const i=`${o??a??n}-label`;/* @__PURE__ */
|
|
15
|
+
return z(k,{label:e(n),labelId:i,icon:/* @__PURE__ */z(O,{}),action:/* @__PURE__ */z(b,{checked:(r=t,!0===r||"wrap"===r),onChange:e=>l(e?pe[0].value:pe[1].value),ariaLabelledBy:i})});var r}}}function E({offered:e,fallback:n,resolve:t}){const l=t??(t=>e.some(e=>e.value===t)?t:n),o=s(fe,
|
|
16
|
+
/* @__PURE__ */z(L,{}),e.map(e=>({label:e.label,value:e.value})),l(void 0));return{type:"custom",render:e=>o.render({...e,value:l(e.value),onChange:n=>e.onChange(n)})}}function R({min:e,max:t,step:l,builtIn:o,resolve:a,action:i,mark:r}){const s=n("Gap",/* @__PURE__ */z(S,{}),e,t,l,o,"px",i),u=a??(e=>"number"==typeof e?e:o);return{...r,type:"custom",render:e=>s.render({...e,value:u(e.value,e.field),storedValue:e.value,onChange:n=>e.onChange(n)})}}function A(n,{fallback:t=ge,pointsFor:l}={}){return{type:"custom",render:({value:o,onChange:a})=>{const i=ke(o,t);return l?/* @__PURE__ */z(Je,{say:e,label:n,value:i,onChange:a,pointsFor:l}):De(e,{label:n,value:i,onChange:a,points:we})}}}function I(n){return{[n.keys.x]:{type:"custom",render:()=>/* @__PURE__ */z(Ye,{say:e,o:n})},[n.keys.y]:{...a({type:"custom",render:()=>/* @__PURE__ */z(i,{})},"always"),reachedBy:n.keys.x}}}function M(n={}){const t={...Oe,...n.keys},l={keys:t,tabletKeys:Object.fromEntries(Fe.map(e=>[e,h(t[e])])),phoneKeys:Object.fromEntries(Fe.map(e=>[e,m(t[e])])),fallback:{top:0,right:0,bottom:0,left:0,...n.fallback},useFallback:n.useFallback,label:n.label??"Padding",icon:n.icon,min:n.min??0,max:n.max??200,step:n.step??4},r=!1!==n.phone,s=!1===n.group?{}:{_gSpacing:re("Padding")};if(n.object){const t={type:"custom",render:n=>/* @__PURE__ */z(Qe,{say:e,o:l,props:n})};return ae({...s,...r?Ne(n.object.key,t,n.object.phone):{[n.object.key]:t}})}const u=r&&!0===n.tablet,c=n=>{const t={type:"custom",render:t=>/* @__PURE__ */z(Ze,{say:e,tier:n,o:l,props:t})};return r?o(n,t):t},d=()=>a({type:"custom",render:()=>/* @__PURE__ */z(i,{})},"always"),p=Fe.filter(e=>"top"!==e);return ae({...s,[l.keys.top]:c("desktop"),...u?{[l.tabletKeys.top]:c("tablet")}:{},...r?{[l.phoneKeys.top]:c("mobile")}:{},...Object.fromEntries(p.map(e=>[l.keys[e],{...d(),reachedBy:l.keys.top}])),...u?Object.fromEntries(p.map(e=>[l.tabletKeys[e],o("tablet",d())])):{},...r?Object.fromEntries(p.map(e=>[l.phoneKeys[e],o("mobile",d())])):{}})}return{slider:n,select:function(n,t,o,a,i){const{note:s,phoneRest:u}="string"==typeof i?{note:i,phoneRest:void 0}:i??{};return{type:"custom",options:o,fallback:a,...s?{note:s}:{},...r({},{type:"select",label:n}),render:i=>{const{value:r,onChange:c,field:d}=i,p=d.options??o,f=d.fallback??a,b=p.some(e=>e.value===r),m="follows"in i,h=m?u?u(i.follows):i.follows:void 0,v=m?p.find(e=>e.value===h)??p.find(e=>e.value===f):void 0,g=b?r:v?.value??f,w=!0===i.readOnly;/* @__PURE__ */
|
|
17
|
+
return z(k,{label:e(n),icon:oe(t),action:m?/* @__PURE__ */z(l,{label:e(n),changed:null!=r&&""!==r,detail:v?q(e,e(v.label),i.followsView):void 0,disabled:w,onReset:()=>c(void 0)}):void 0,children:/* @__PURE__ */z(y,{value:g,ariaLabel:e(n),readOnly:w,onChange:c,options:[...s?[{label:e(s),value:"\0note",disabled:!0}]:[],...p.map(n=>({label:e(n.label),value:n.value}))]})})}}},Segmented:t,segmented:s,boxJustifyField:x,boxAlignField:C,boxWrapField:V,directionField:E,gapField:R,placementField:A,PlacementGridView:function(n){return De(e,n)},positionFields:I,sidesPaddingFields:M,alignmentField:function(e={},n=e.fallback??"left"){return f(e,n)},alignmentFields:function(e="align",n={}){return d(e,f,p,n)},AlignmentStrip:function({opts:e={},value:n,onChange:l,ariaLabel:o,disabled:a=!1}){return t({options:p(e),value:n,onChange:l,ariaLabel:o,disabled:a})},blockAlignmentField:function(e={},n=e.fallback??"left"){return g(e,n)},blockAlignmentFields:function(e="align",n={}){return d(e,g,v,n)},BlockAlignmentStrip:function({opts:e={},value:n,onChange:l,ariaLabel:o,disabled:a=!1}){return t({options:v(e),value:n,onChange:l,ariaLabel:o,disabled:a})},boxFieldSet:function(e={}){const t=e.width??he,l=e.nudge?.limit??40,o=e.direction??{offered:be,fallback:"column"},a=o.resolve??(e=>o.offered.some(n=>n.value===e)?e:o.fallback),i={runs:e=>"row"===a(e)?"row":"column"};return{_gLayout:re("Layout"),placement:A("Placement",e.placement),width:n("Width",/* @__PURE__ */z(K,{}),t.min,t.max,t.step,t.fallback,"%"),direction:E(o),gap:R(e.gap??me),justify:x(i),align:C(i),wrap:V(),_gNudge:re("Nudge"),...I({keys:e.nudge?.keys??{x:"nudgeX",y:"nudgeY"},min:-l,max:l,label:null}),...M(e.padding)}}}}var{slider:on,select:an,Segmented:rn,segmented:sn,boxJustifyField:un,boxAlignField:cn,boxWrapField:dn,directionField:pn,gapField:fn,placementField:bn,PlacementGridView:mn,positionFields:hn,sidesPaddingFields:vn,alignmentField:gn,alignmentFields:yn,AlignmentStrip:wn,blockAlignmentField:kn,blockAlignmentFields:xn,BlockAlignmentStrip:Cn,boxFieldSet:jn}=ln();export{ye as ANCHOR_LABELS,wn as AlignmentStrip,ce as BOX_ALIGN_POINTS,be as BOX_DIRECTIONS,fe as BOX_DIRECTION_LABEL,me as BOX_GAP,ue as BOX_JUSTIFY_POINTS,xe as BOX_NUDGE_LIMIT,ve as BOX_PLACEMENTS,ge as BOX_PLACEMENT_DEFAULT,he as BOX_WIDTH,de as BOX_WRAP_LABEL,pe as BOX_WRAP_POINTS,Cn as BlockAlignmentStrip,Ae as FLAT_ACCESS,we as OPEN_PLACEMENT_POINTS,Ie as PHONE_KEY_ACCESS,mn as PlacementGridView,Oe as SIDE_PAD_KEYS,rn as Segmented,nn as SliderControl,Te as VIEW_KEY_ACCESS,gn as alignmentField,yn as alignmentFields,kn as blockAlignmentField,xn as blockAlignmentFields,cn as boxAlignField,ln as boxFieldBuilders,jn as boxFieldSet,un as boxJustifyField,dn as boxWrapField,pn as directionField,fn as gapField,re as group,oe as iconOf,le as isNoGlyph,te as noGlyph,ke as normaliseBoxPlacement,Ee as objectAccess,q as onDesktopWords,Be as phoneObjectAccess,Ne as phoneTwinFields,bn as placementField,hn as positionFields,je as positionPatch,se as section,sn as segmented,an as select,ae as sharedStyleKinds,Ke as sidesFromObject,vn as sidesPaddingFields,Se as sidesPaddingPatch,Ve as sidesToObject,on as slider,Re as useAccessPatch,Pe as useAccessValue};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{find as n,remove as t,getList as e,newId as r,duplicate as o,move as l,copyNode as a,insert as c,setProps as i,slotsOf as d}from"./chunk-
|
|
1
|
+
import{find as n,remove as t,getList as e,newId as r,duplicate as o,move as l,copyNode as a,insert as c,setProps as i,slotsOf as d}from"./chunk-YDTEYXQW.js";import{useRef as s,useSyncExternalStore as p,useCallback as u,useMemo as f}from"react";var m=n=>({kind:"node",id:n});function x(r,o,l,a="none"){const c=n(r,o,l),i=t(r,o,l);if("none"===a||!c)return{data:i,select:null};const d=e(r,o,c.place)??[],s=d[c.place.index+1]??d[c.place.index-1];return s?.props?.id?{data:i,select:m(s.props.id)}:"root"!==c.place.parentId?{data:i,select:m(c.place.parentId)}:{data:i,select:null}}function g(t,e,l,a={}){const c=n(t,e,l)?.node,i=a.id??r(c?.type??"Node");return{data:o(t,e,l,{strip:a.strip,id:i}),select:m(i)}}function I(n,t,e,r){return{data:l(n,t,e,r),select:m(e)}}var h=(n,t)=>({min:0,max:t-1});function v(t,r,o,l,a=h){const c=n(t,r,o);if(!c)return!1;const i=e(t,r,c.place)?.length??0,{min:d,max:s}=a(c.place,i),p=c.place.index+l;return c.place.index>=d&&c.place.index<=s&&p>=d&&p<=s}function b(t,e,r,o,l=h){if(!v(t,e,r,o,l))return null;const a=n(t,e,r);return I(t,e,r,{...a.place,index:a.place.index+o})}function k(n,t,e,r,o={}){const l=a(e,t,{strip:o.strip});return{data:c(n,t,r,l),select:m(l.props.id)}}function y(t,r,o,l){if(n(t,r,o.props.id))return null;const a=e(t,r,l)??[],i={...l,index:Math.max(0,Math.min(l.index,a.length))};return{data:c(t,r,i,o),select:m(o.props.id)}}function O(e,r,o,l){const a=n(e,r,o);return a?l.props.id!==o&&n(e,r,l.props.id)?null:{data:c(t(e,r,o),r,a.place,l),select:m(l.props.id)}:null}function z(n,t,e,r){return{data:i(n,t,e,r),select:void 0}}function M(t,e,r,o=()=>!1){if(!r)return null;if("slot"===r.kind)return n(t,e,r.parentId)?m(r.parentId):null;const l=n(t,e,r.id);if(!l||"root"===l.place.parentId)return null;const a=n(t,e,l.place.parentId);return a?o(a.node,l.place.slot)?{kind:"slot",parentId:a.node.props.id,slot:l.place.slot}:m(a.node.props.id):null}function B(t,e,r,o){const l=n(t,e,r);if(!l)return[];const a=l.path.filter(n=>"root"!==n.parentId).map(n=>n.parentId);return o?[...a.filter(r=>{const l=n(t,e,r);return!l||!o(l.node)}),r]:[...a,r]}function R(n,t){if(0===n.length)return null;const e=null===t?-1:n.indexOf(t);return-1===e?n[0]:n[Math.min(e+1,n.length-1)]}function Y(t,e,r,o,l){const a=n(t,e,r);return a?0===d(a.node,e).length?r:R(B(t,e,r,l),o):null}function $(t,e,r,o,l,a,c){const i=n(t,e,r);if(!i)return null;if(0===d(i.node,e).length)return{node:r,part:o};const s="\0part:"+o,p=R([...B(t,e,r,c),s],l===r&&a===o?s:l);return p===s?{node:r,part:o}:{node:p??r,part:null}}function j(t,e,r){if(!r||"node"!==r.kind)return null;const o=n(t,e,r.id);return o?{zone:`${o.place.parentId}:${o.place.slot}`,index:o.place.index}:null}function w(n,t,r){if(!r)return null;const[o,l]=(r.zone??"root:default-zone").split(/:(.*)/s),a={parentId:o,slot:l},c=e(n,t,a)?.[r.index];return c?.props?.id?m(c.props.id):null}var D={get:()=>null,set:()=>{},subscribe:()=>()=>{}};function E(t){const e=s(t);e.current=t;const r=t.clipboard??D,o=p(r.subscribe,r.get,r.get),l=u(n=>{const t=e.current;if(t.readOnly)return!1;const r=n(t.data,t.config);return!!r&&((r.data!==t.data||void 0!==r.select)&&(t.commit(r.data,{select:r.select}),e.current={...t,data:r.data},!0))},[]);return f(()=>{const t=()=>e.current,r=(e,r)=>{const o=n(t().data,t().config,e);return o?{node:o.node,label:r,from:{parentId:o.place.parentId,slot:o.place.slot}}:null};return{held:o,remove:n=>l((e,r)=>x(e,r,n,t().afterRemove)),duplicate:n=>l((e,r)=>g(e,r,n,{strip:t().strip})),move:(n,t)=>l((e,r)=>I(e,r,n,t)),step:(n,e)=>l((r,o)=>b(r,o,n,e,t().stepBounds)),canStep:(n,e)=>v(t().data,t().config,n,e,t().stepBounds),setProps:(n,t)=>l((e,r)=>z(e,r,n,t)),copy:(n,e)=>{const o=r(n,e);return o&&(t().clipboard??D).set(o),!!o},cut:(n,e)=>{if(t().readOnly)return!1;const o=r(n,e);return!!o&&((t().clipboard??D).set(o),l((e,r)=>x(e,r,n,t().afterRemove)))},paste:n=>{const e=(t().clipboard??D).get();return!!e&&l((r,o)=>k(r,o,e.node,n,{strip:t().strip}))},restore:(n,t)=>l((e,r)=>y(e,r,n,t)),swap:(n,t)=>l((e,r)=>O(e,r,n,t)),parentOf:n=>M(t().data,t().config,n,t().slotIsLevel)}},[o,l])}export{v as canStep,Y as clickPick,$ as clickPickPart,w as fromItemSelector,R as nextInChain,B as nodeChain,M as parentStep,g as planDuplicate,I as planMove,k as planPaste,x as planRemove,y as planRestore,z as planSetProps,b as planStep,O as planSwap,j as toItemSelector,E as useNodeOps};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{DEFAULT_PANEL_W as s,clampPanelWidth as e}from"./chunk-
|
|
1
|
+
import{DEFAULT_PANEL_W as s,clampPanelWidth as e}from"./chunk-VTY7OQB5.js";var a="sf-editor-panel-widths",l="sf-editor-collapsed-sections";function t(s){return s?{panelWidths:`${s}-panel-widths`,collapsed:`${s}-collapsed-sections`}:{panelWidths:a,collapsed:l}}var o={...s},d=(s,a)=>e(s,a);export{l as COLLAPSED_SECTIONS_KEY,o as DEFAULT_PANEL_W,a as PANEL_WIDTHS_KEY,d as clampPanelWidth,t as screenStorageKeys};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
var e=e=>/(s|x|z|ch|sh)$/i.test(e)?`${e}es`:/[^aeiou]y$/i.test(e)?`${e.slice(0,-1)}ies`:`${e}s`,o={less:"Less",more:"More",choose:"Choose",search:"Search",noMatches:"No matches",list:{item:"item",itemName:({noun:e,n:o})=>{return`${t=e,t?t[0].toUpperCase()+t.slice(1):t} ${o}`;var t},count:({noun:o,n:t})=>`${t} ${1===t?o:e(o)}`,position:({n:e,total:o})=>`${e} of ${o}`,duplicate:"Duplicate",duplicateItem:({noun:e})=>`Duplicate ${e}`,deleteItem:({noun:e})=>`Delete ${e}`,add:({noun:e})=>`+ Add ${e}`,addHere:({noun:e})=>`Add ${e} here`,moveUp:"Move up",moveDown:"Move down",delete:"Delete",locked:"This one cannot be removed",moved:({n:e,total:o})=>`Moved to ${e} of ${o}`},phoneOrder:{label:"Phone order",hint:({noun:o})=>`The order the ${e(o)} stack in on a phone.`,followsDesktop:({noun:o})=>`On a phone these ${e(o)} stack in the desktop order. Drag one to change the phone order only.`,desktopKept:"Your desktop layout doesn’t change.",matchDesktop:"Match desktop order"}};export{o as DEFAULT_FIELDS_WORDS};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{panelFieldsOf as t}from"./chunk-5XL2RXFU.js";import{DESIGN_GROUP_KEY as o,BUCKET_KEY as n}from"./chunk-3QB2ZQXK.js";import{withoutDeviceGate as e}from"./chunk-ZNLODQD4.js";import{STYLE_KIND as r,fieldKind as s,copyStyle as i,heldStyle as c,planPaste as p,pasteMessage as u}from"./chunk-3OOYGEJY.js";import{ANCHOR_FIELD_KEYS as a,foldMetaOf as f,MEDIA_FIELD_MARKER as l,TEXT_FIELD_MARKER as m,LINK_FIELD_MARKER as h}from"./chunk-ANPOR6EY.js";import{deviceMetaOf as y}from"./chunk-YCSZAP7T.js";var j=/* @__PURE__ */new Set([o.Size,o.Design,o.Layout,o.Position]),w=new Set(Object.values(o)),b=new Set(Object.values(n)),S=new Set(a),k=/* @__PURE__ */new Set(["focal","imageFocal"]),O=[l,m,h];function g(t){return`site:${t??""}`}function v(t){if(!t||"object"!=typeof t)return null;const o=t,n=e(t)??t,i=o[r]??n[r];if("string"==typeof i)return i;const c=o.options??n.options;if(Array.isArray(c)){return`choice:${c.map(t=>String(t?.value)).sort().join("|")}`}return s(n)}function A(t){const o=t,n=e(t);return O.some(t=>t in o||n&&t in n)}function D(o,e){const r=t(o,e)??{},s=[];let i=!0,c=!1;for(const[t,o]of Object.entries(r))b.has(t)?(i=t===n.Design,c=!1):w.has(t)?i&&(c=j.has(t)):c&&o&&"object"==typeof o&&!t.startsWith("_")&&(f(o)||S.has(t)||k.has(t)||A(o)||"slot"!==o.type&&s.push({path:[t],kind:v(o),counted:"mobile"!==y(o)?.tier&&"tablet"!==y(o)?.tier}));return s}function L(t,o,n,e,r){i({scope:n,type:e.type,label:r,rows:t(o,e),props:e.props})}function Y(t,o,n,e,r,s){const i=c(n);if(!i)return null;const a=p(i,{type:e.type,rows:t(o,e),props:e.props});return{...a,message:u(a,i.sourceLabel,r,s)}}function d(t,o,n,e){L(D,t,o,n,e)}function P(t,o,n,e,r){return Y(D,t,o,n,e,r)}var Q={scope:t=>g(t.siteId),rows:(t,o)=>D(t,o),copy:(t,o,n,e)=>d(e,t,o,n),plan:(t,o,n,e)=>P(e,t,o,n)};function X(t,o){if(!t&&!o)return Q;const n=t?.rows,e=n?(t,o)=>n(t,o):D;return{scope:t?.scope??Q.scope,rows:(t,o)=>e(t,o),copy:t?.copy??((t,o,n,r)=>L(e,r,t,o,n)),plan:t?.plan??((t,n,r,s)=>Y(e,s,t,n,r,o))}}export{d as copyNodeStyle,D as nodeStyleRows,P as planNodePaste,v as shopFieldKind,g as siteStyleScope,X as styleClipboardOf};
|
|
@@ -1,20 +1,20 @@
|
|
|
1
|
-
import{EaselRail as e}from"./chunk-MJM6SFD3.js";import{DEFAULT_NOTICE_WORDS as n,DEFAULT_CHROME_WORDS as i}from"./chunk-AJSDWWJW.js";import{DEFAULT_RAIL_WORDS as a}from"./chunk-2OAZYSWJ.js";import{holderOf as t,describeAge as s,nameOrSomeone as l}from"./chunk-
|
|
1
|
+
import{EaselRail as e}from"./chunk-MJM6SFD3.js";import{DEFAULT_NOTICE_WORDS as n,DEFAULT_CHROME_WORDS as i}from"./chunk-AJSDWWJW.js";import{DEFAULT_RAIL_WORDS as a}from"./chunk-2OAZYSWJ.js";import{holderOf as t,describeAge as s,nameOrSomeone as l}from"./chunk-G7J6SGMF.js";import{DEFAULT_LOCK_WORDS as r}from"./chunk-RE4LP46F.js";import{useWords as o}from"./chunk-MFIRYGHW.js";import{jsx as c,jsxs as d}from"react/jsx-runtime";import{Tooltip as h,IconButton as u,Segmented as m,Switch as p,SpinnerRing as v,ResizeHandle as f,Button as k,Text as b,Banner as g}from"efficient-shell/ui";import{useState as y,useEffect as N}from"react";import{LockIcon as w,CloudPauseIcon as O,CloudSlashIcon as x,CloudAlertIcon as z,CloudArrowUpIcon as B,CloudCheckIcon as C}from"efficient-shell/icons/efficient";function R({children:e}){/* @__PURE__ */
|
|
2
2
|
return c("div",{className:"es-topbar",children:e})}function S({kind:e,style:n,children:i}){/* @__PURE__ */
|
|
3
3
|
return c("div",{className:e?`es-cluster es-cluster--${e}`:"es-cluster",style:n,children:i})}function W(){/* @__PURE__ */
|
|
4
4
|
return c("div",{className:"es-divider-v","aria-hidden":"true"})}function $({items:n,ariaLabel:i,onWords:t}){const s=o("rail",a);/* @__PURE__ */
|
|
5
|
-
return c("div",{className:"es-cluster es-cluster--rail es-rail-fit",children:/* @__PURE__ */c(e,{items:n,ariaLabel:i??s.label,orientation:"row",onLabelsShown:t})})}function
|
|
6
|
-
return c(h,{content:n??e,side:"bottom",children:/* @__PURE__ */c(u,{ref:s,"aria-label":e,"aria-pressed":t?"active"===t:void 0,className:"es-iconbtn",disabled:a,onClick:i,children:l})})}function
|
|
7
|
-
return c(m,{className:"es-devseg",size:"sm",label:t??s.device,value:n,onChange:e=>{e!==n&&a(e)},options:e.map(e=>({value:e.id,icon:/* @__PURE__ */c(h,{content:e.label,side:"bottom",children:/* @__PURE__ */c("span",{className:"es-devseg-glyph","aria-hidden":"true",children:e.icon})}),label:/* @__PURE__ */c("span",{className:"es-vh",children:e.label})}))})}var
|
|
8
|
-
return d("span",{className:`es-savestate ${
|
|
9
|
-
return c("span",{className:"es-savestate-toggle",children:/* @__PURE__ */c(h,{content:n,side:"bottom",children:/* @__PURE__ */c(p,{size:"sm",checked:!e,"aria-label":n,label:a,onChange:()=>i()})})})}var
|
|
5
|
+
return c("div",{className:"es-cluster es-cluster--rail es-rail-fit",children:/* @__PURE__ */c(e,{items:n,ariaLabel:i??s.label,orientation:"row",onLabelsShown:t})})}function M({label:e,tip:n,onClick:i,disabled:a,state:t,buttonRef:s,children:l}){/* @__PURE__ */
|
|
6
|
+
return c(h,{content:n??e,side:"bottom",children:/* @__PURE__ */c(u,{ref:s,"aria-label":e,"aria-pressed":t?"active"===t:void 0,className:"es-iconbtn",disabled:a,onClick:i,children:l})})}function j({devices:e,value:n,onChange:a,ariaLabel:t}){const s=o("chrome",i);/* @__PURE__ */
|
|
7
|
+
return c(m,{className:"es-devseg",size:"sm",label:t??s.device,value:n,onChange:e=>{e!==n&&a(e)},options:e.map(e=>({value:e.id,icon:/* @__PURE__ */c(h,{content:e.label,side:"bottom",children:/* @__PURE__ */c("span",{className:"es-devseg-glyph","aria-hidden":"true",children:e.icon})}),label:/* @__PURE__ */c("span",{className:"es-vh",children:e.label})}))})}var L={idle:"is-quiet",saved:"is-quiet is-saved",saving:"is-saving",error:"is-error",off:"is-off","off-unsaved":"is-off is-unsaved"};function J({tone:e,label:n,counting:i,waitMs:a,ringRef:t,role:s}){/* @__PURE__ */
|
|
8
|
+
return d("span",{className:`es-savestate ${L[e]}`,role:s,"aria-live":"polite",children:[/* @__PURE__ */c("span",i?{ref:t,className:"es-savestate-ring is-counting",style:void 0!==a?{"--es-savewait":`${a}ms`}:void 0,"aria-hidden":"true"}:{className:"es-savestate-dot","aria-hidden":"true"}),n]})}function F({pressed:e,title:n,onToggle:i,children:a}){/* @__PURE__ */
|
|
9
|
+
return c("span",{className:"es-savestate-toggle",children:/* @__PURE__ */c(h,{content:n,side:"bottom",children:/* @__PURE__ */c(p,{size:"sm",checked:!e,"aria-label":n,label:a,onChange:()=>i()})})})}var P={saved:{glyph:()=>/* @__PURE__ */c(C,{}),tone:"muted"},saving:{glyph:()=>/* @__PURE__ */c(v,{className:"",ink:"",style:{width:20,height:20}}),tone:"muted"},pending:{glyph:()=>/* @__PURE__ */c(B,{}),tone:"muted"},failed:{glyph:()=>/* @__PURE__ */c(z,{}),tone:"danger"},offline:{glyph:()=>/* @__PURE__ */c(x,{}),tone:"warning"},paused:{glyph:()=>/* @__PURE__ */c(O,{}),tone:"warning"},locked:{glyph:()=>/* @__PURE__ */c(w,{}),tone:"warning"}},T=e=>P[e].tone;function Y({state:e,label:n}){const i=P[e],[a,t]=y(n);return N(()=>t(n),[e]),/* @__PURE__ */d("span",{className:"es-saveicon-wrap",children:[
|
|
10
10
|
/* @__PURE__ */c(h,{content:n,side:"bottom",describe:!1,children:/* @__PURE__ */c("span",{className:"es-saveicon",role:"img","aria-label":n,tabIndex:0,"data-save-state":e,"data-tone":i.tone,children:i.glyph()})}),
|
|
11
11
|
/* @__PURE__ */c("span",{className:"es-vh",role:"status","aria-live":"polite",children:a})]})}function A({side:e,width:n,min:a,max:t,defaultWidth:s,label:l,onResize:r}){const d=o("chrome",i);/* @__PURE__ */
|
|
12
|
-
return c(f,{side:e,width:n,min:a,max:t,defaultWidth:s,label:l,hint:d.resize,onResize:e=>r(e),className:`es-resizer es-resizer--${e}`})}function
|
|
12
|
+
return c(f,{side:e,width:n,min:a,max:t,defaultWidth:s,label:l,hint:d.resize,onResize:e=>r(e),className:`es-resizer es-resizer--${e}`})}function D({icon:e,name:n,kind:i,actions:a}){/* @__PURE__ */
|
|
13
13
|
return d("div",{className:"es-insp-head",children:[
|
|
14
14
|
/* @__PURE__ */c("span",{className:"es-insp-chip","aria-hidden":"true",children:e}),
|
|
15
15
|
/* @__PURE__ */d("div",{className:"es-insp-titles",children:[
|
|
16
16
|
/* @__PURE__ */c(h,{content:n,describe:!1,side:"bottom",className:"es-insp-name-tip",children:/* @__PURE__ */c("h2",{className:"es-insp-name",children:n})}),
|
|
17
|
-
/* @__PURE__ */c("div",{className:"es-insp-kind",children:i})]}),a?/* @__PURE__ */c("div",{className:"es-insp-actions",children:a}):null]})}function
|
|
18
|
-
return c(h,{content:n??e,side:"bottom",children:/* @__PURE__ */c(u,{ref:r,variant:s?"ghost-danger":"ghost",className:"es-insp-iconbtn","aria-label":e,"aria-haspopup":i,"aria-expanded":l,disabled:t,onClick:a,children:o})})}function
|
|
19
|
-
/* @__PURE__ */c(b,{as:"h3",size:"sm",weight:"medium",tone:"inherit",className:"es-insp-level-title",children:s})]}):t?u:/* @__PURE__ */c("div",{className:"es-insp-up",children:u})}function
|
|
20
|
-
return c("div",{className:`es-notice is-${d.tone}`,role:d.urgent?"alert":"status",children:/* @__PURE__ */c(g,{tone:"warning"===d.tone?"warning":"info",title:d.lead,action:/* @__PURE__ */c("span",{className:"es-notice-actions",children:m}),children:d.body})})}var Z={left:288,right:320},K={left:240,right:220},Q=K.right,U=560;function X(e,n){const i=n?K[n]:Q;return Math.min(560,Math.max(i,Math.round(e)))}function _(e){return{"--es-left-w":`${e.left}px`,"--es-right-w":`${e.right}px`}}function ee(e,n){e.style.setProperty("--es-left-w",`${n.left}px`),e.style.setProperty("--es-right-w",`${n.right}px`)}export{Z as DEFAULT_PANEL_W,
|
|
17
|
+
/* @__PURE__ */c("div",{className:"es-insp-kind",children:i})]}),a?/* @__PURE__ */c("div",{className:"es-insp-actions",children:a}):null]})}function G({label:e,title:n,hasPopup:i,onClick:a,disabled:t,danger:s,expanded:l,buttonRef:r,children:o}){/* @__PURE__ */
|
|
18
|
+
return c(h,{content:n??e,side:"bottom",children:/* @__PURE__ */c(u,{ref:r,variant:s?"ghost-danger":"ghost",className:"es-insp-iconbtn","aria-label":e,"aria-haspopup":i,"aria-expanded":l,disabled:t,onClick:a,children:o})})}function I({name:e,onSelect:n,label:a,inline:t,title:s}){const l=o("chrome",i),r=a??l.upLevel,u=/* @__PURE__ */c(h,{content:r,side:"bottom",children:/* @__PURE__ */c(k,{variant:"link",size:"sm",className:"es-insp-up-btn","aria-label":l.upLevelTo({label:r,name:e}),leftIcon:/* @__PURE__ */c("span",{className:"es-insp-up-arrow","aria-hidden":"true",children:"←"}),onClick:n,children:/* @__PURE__ */c("span",{className:"es-insp-up-name",children:e})})});return s?/* @__PURE__ */d("div",{className:t?"es-insp-level":"es-insp-up es-insp-level",children:[u,
|
|
19
|
+
/* @__PURE__ */c(b,{as:"h3",size:"sm",weight:"medium",tone:"inherit",className:"es-insp-level-title",children:s})]}):t?u:/* @__PURE__ */c("div",{className:"es-insp-up",children:u})}function q({name:e,tier:n,of:a},t){const s={...i,...t};return{name:e,kind:"section"===n?s.tierSection:"block"===n?s.tierBlock:a?s.partOf({name:a}):s.tierBlock}}var H={notice:n,lock:r};function E(e,n,i,a=H){const r=a.notice,o=t(e),c={kind:"reload",label:r.reload};if(n){const e=s(n.secondsAgo,a.lock);return{tone:"warning",urgent:!0,lead:n.savedByYou?r.savedByYou({noun:i,when:e}):r.savedByOther({name:l(n.savedBy,a.lock),noun:i,when:e}),body:r.conflictBody,actions:o?[c,{kind:"take-over",label:r.takeOver,title:r.takeOverWhileDeciding}]:[c]}}if(!o)return null;const d=l(o.name,a.lock),h=s(o.secondsSinceSeen,a.lock);switch(e.kind){case"takenover":return{tone:"warning",urgent:!0,lead:r.tookOver({name:d,noun:i,when:s(o.secondsSinceHeld,a.lock)}),body:r.tookOverBody,actions:[{kind:"take-back",label:r.takeBack},c]};case"readonly":return{tone:"neutral",urgent:!1,lead:r.viewingOnly,body:r.viewingOnlyBody({name:d,noun:i,seen:h}),actions:[{kind:"take-over",label:r.takeOver}]};default:return{tone:"warning",urgent:!1,lead:r.editing({name:d,noun:i}),body:r.editingBody({seen:h}),actions:[{kind:"view-read-only",label:r.viewReadOnly},{kind:"take-over",label:r.takeOver,title:r.takeOverTold}]}}}function V({access:e,conflict:i,noun:a,onTakeOver:t,onViewReadOnly:s,onReload:l}){const d=E(e,i,a,{notice:o("notice",n),lock:o("lock",r)});if(!d)return null;const u={reload:l,"take-over":t,"take-back":t,"view-read-only":s},m=d.actions.map(e=>e.title?/* @__PURE__ */c(h,{content:e.title,side:"bottom",children:/* @__PURE__ */c(k,{variant:"secondary",size:"sm",onClick:u[e.kind],children:e.label})},e.kind):/* @__PURE__ */c(k,{variant:"secondary",size:"sm",onClick:u[e.kind],children:e.label},e.kind));/* @__PURE__ */
|
|
20
|
+
return c("div",{className:`es-notice is-${d.tone}`,role:d.urgent?"alert":"status",children:/* @__PURE__ */c(g,{tone:"warning"===d.tone?"warning":"info",title:d.lead,action:/* @__PURE__ */c("span",{className:"es-notice-actions",children:m}),children:d.body})})}var Z={left:288,right:320},K={left:240,right:220},Q=K.right,U=560;function X(e,n){const i=n?K[n]:Q;return Math.min(560,Math.max(i,Math.round(e)))}function _(e){return{"--es-left-w":`${e.left}px`,"--es-right-w":`${e.right}px`}}function ee(e,n){e.style.setProperty("--es-left-w",`${n.left}px`),e.style.setProperty("--es-right-w",`${n.right}px`)}export{Z as DEFAULT_PANEL_W,j as DeviceSwitch,M as EaselIconButton,R as EaselTopBar,V as EditNotice,D as InspectorHead,G as InspectorIconButton,I as InspectorUpLevel,U as MAX_PANEL_W,Q as MIN_PANEL_W,K as MIN_PANEL_W_BY_SIDE,A as PanelResizeHandle,Y as SaveIcon,J as SaveState,F as SaveStateToggle,S as TopBarCluster,W as TopBarDivider,$ as TopBarRail,X as clampPanelWidth,E as editNotice,q as headWords,_ as panelWidthVars,T as saveIconTone,ee as setPanelWidthVars};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{blockRuns as e,offeredChoices as s}from"./chunk-RUQOIQWI.js";import{useScreenBlockLook as t}from"./chunk-
|
|
1
|
+
import{blockRuns as e,offeredChoices as s}from"./chunk-RUQOIQWI.js";import{useScreenBlockLook as t}from"./chunk-DCBUJ36Q.js";import{DEFAULT_SCREEN_WORDS as l}from"./chunk-G2VZ4DET.js";import{useWords as r}from"./chunk-MFIRYGHW.js";import{ItemCount as n,DropdownMenu as c}from"efficient-shell/ui";import{jsxs as a,jsx as o,Fragment as i}from"react/jsx-runtime";function m({choices:m,onPick:p}){const{Icon:u}=t(),f=r("screen",l),h=e(s(m)).flatMap(e=>[...e.group?[{type:"label",key:`group:${e.group}`,label:/* @__PURE__ */a("span",{className:"flex w-full items-center gap-2",children:[
|
|
2
2
|
/* @__PURE__ */o("span",{children:e.group}),
|
|
3
3
|
/* @__PURE__ */o(n,{count:e.items.length,label:f.blockCount({count:e.items.length}),className:"ml-auto"})]})}]:[],...e.items.map(e=>({key:e.type,label:e.label,icon:/* @__PURE__ */o("span",{className:"sf-chip",children:/* @__PURE__ */o(u,{type:e.type,size:13})}),onSelect:()=>p(e.type)}))]);/* @__PURE__ */
|
|
4
4
|
return o(c,{align:"start",triggerClassName:"sf-add-card",items:h,trigger:/* @__PURE__ */a(i,{children:[
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{useScreenDocument as n}from"./chunk-
|
|
1
|
+
import{useScreenDocument as n}from"./chunk-OB4KI2AN.js";import{DEFAULT_SCREEN_WORDS as o}from"./chunk-G2VZ4DET.js";import{EditNotice as r}from"./chunk-VTY7OQB5.js";import{useWords as e}from"./chunk-MFIRYGHW.js";import{jsx as i}from"react/jsx-runtime";function t(){const{capabilities:t,access:c,takeOverEditing:a,viewReadOnly:s,saveConflict:m,reloadFromServer:u}=n(),{noun:l}=e("screen",o);return t.hasEditGuard?/* @__PURE__ */i(r,{access:c,conflict:m,noun:l,onTakeOver:a,onViewReadOnly:s,onReload:u}):null}export{t as PageEditGuardNotices};
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import{buildPaletteSections as e,pinnedSection as t,categoryLabel as n}from"./chunk-GDO4QJ4G.js";import{blockTypesIn as o}from"./chunk-IZGFJWH4.js";import{sectionTemplatesOf as r}from"./chunk-N7E6264U.js";import{sharedSectionsOf as l}from"./chunk-N3MJOHAG.js";import{SidePanelHead as i,PanelModeExit as s}from"./chunk-MTWQYLJE.js";import{blockRuns as c}from"./chunk-RUQOIQWI.js";import{useScreenBlockLook as a,useScreenBlockRules as p,useScreenPinned as d}from"./chunk-DCBUJ36Q.js";import{useEaselSession as m}from"./chunk-YM4UEGBV.js";import{DEFAULT_SCREEN_WORDS as f}from"./chunk-G2VZ4DET.js";import{useEasel as y}from"./chunk-HGTDDSFJ.js";import{easelMenuEntries as u}from"./chunk-FIVU2COQ.js";import{useWords as h}from"./chunk-MFIRYGHW.js";import{AddPanel as k}from"./chunk-DQSRGKSM.js";import{DEFAULT_DRAG_WORDS as g}from"./chunk-TQ5Y6S2X.js";import{useState as b,useEffect as v,useMemo as j,useRef as w}from"react";import{SharedIcon as C,AddIcon as D}from"efficient-shell/icons/efficient";import{ContextMenu as E,toast as G,Dialog as O,Button as T}from"efficient-shell/ui";import{jsx as $,jsxs as F,Fragment as I}from"react/jsx-runtime";function M({name:e,pages:t,onDelete:n,onCancel:o}){const r=h("screen",f).shared,[l,i]=b(!1),s=w(null);/* @__PURE__ */
|
|
2
|
+
return $(O,{open:!0,role:"alertdialog",size:"sm",title:r.deleteTitle({name:e}),onClose:o,initialFocus:s,footer:/* @__PURE__ */F(I,{children:[
|
|
3
|
+
/* @__PURE__ */$(T,{ref:s,variant:"secondary",onClick:o,children:r.cancel}),
|
|
4
|
+
/* @__PURE__ */$(T,{variant:"danger",loading:l,onClick:()=>{(async()=>{i(!0);try{await n()}finally{i(!1)}})()},children:r.deleteShared})]}),children:r.deleteMessage({count:t})})}var Q=e=>`section:${e}`,S=e=>`block:${e}`,x=e=>`template:${e}`,H=e=>`shared:${e}`,J=e=>`preset:${e}`;function W({at:w,placeBlocks:O,placeNames:T,canTake:W,onPick:B,itemFor:L,session:N,siteWide:U,onClose:z,onHide:A,readOnly:R}){const Y=y(e=>e.config),V=a(),{labelAtLevel:P,categoryLabel:Z,firstSection:_,Icon:K,Thumbnail:X}=V,{blockIsOffered:q,canAddTo:ee}=p(),te=h("screen",f).add,ne=h("drag",g).add,oe=m(),[re,le]=b([]);v(()=>{let e=!1;const t=e=>q(e,oe);return r(oe).list().then(n=>{if(e)return;const r=Y.components;le(n.filter(e=>e.node?.type&&r[e.node.type]&&o(e.node).every(t)))}).catch(()=>{}),()=>{e=!0}},[Y,oe]);const ie=d().shared,se=h("screen",f).shared,[ce,ae]=b([]),[pe,de]=b(0);v(()=>{if(!ie)return;let e=!1;const t=e=>q(e,oe);return l(oe).list().then(n=>{if(e)return;const r=Y.components;ae(n.filter(e=>e.node?.type&&r[e.node.type]&&o(e.node).every(t)))}).catch(()=>{}),()=>{e=!0}},[Y,oe,pe]);const[me,fe]=b(null),[ye,ue]=b(null),he=j(()=>e(Y,V),[Y]),ke=e=>P(e,"section",Y.components[e]?.label??e),ge=e=>({type:e.preset?J(e.preset.key):Q(e.type),label:e.name,cover:/* @__PURE__ */$(X,{type:e.type}),title:e.desc?`${e.name} — ${e.desc}`:te.tile({name:e.name}),keywords:[e.alias??"",e.desc,e.type,e.catLabel].filter(Boolean)}),be=e=>{const t=e.indexOf(":"),n=e.slice(0,t),o=e.slice(t+1);if("section"===n)return{kind:"section",type:o};if("block"===n)return{kind:"block",type:o};if("template"===n){const e=re.find(e=>e.id===o);return e?{kind:"template",template:e}:null}if("shared"===n){const e=ce.find(e=>e.id===o);return e?{kind:"shared",section:e}:null}if("preset"===n){const e=he.find(e=>e.preset?.key===o)?.preset;return e?{kind:"preset",preset:e}:null}return null},ve=e=>/* @__PURE__ */$("span",{className:"es-add-glyph-cover",children:/* @__PURE__ */$(K,{type:e,size:26})}),je=j(()=>{const e=t(he,_),o=/* @__PURE__ */new Map,r=e=>{e.retired||o.has(e.type)||!q(e.type,oe)||o.set(e.type,e)};for(const t of e?[e]:he.filter(e=>!e.preset)){const e=ee(t.type)?.choices??[];e.forEach(r),e.forEach(e=>ee(e.type,1)?.choices?.forEach(r))}O?.forEach(r);const l=new Set(he.filter(e=>!e.preset).map(e=>e.type)),i=[...o.values()].filter(e=>!l.has(e.type)),s=(e,t,n)=>{const o=T?.get(t);return o&&o!==n?{...e,label:o,title:te.tile({name:o}),keywords:[n,...e.keywords??[]]}:e},a=e=>s({type:S(e.type),label:e.label,cover:ve(e.type),title:te.tile({name:e.label}),keywords:[e.group??"",e.type].filter(Boolean)},e.type,e.label),p=e=>!e.preset&&o.has(e.type)?s({...ge(e),cover:ve(e.type)},e.type,e.name):ge(e),d=[];ce.length>0&&d.push({key:"shared",title:se.group,tiles:ce.map(e=>({type:H(e.id),label:e.title,cover:/* @__PURE__ */$(X,{type:e.node.type}),mark:/* @__PURE__ */$(C,{size:12}),title:se.onPages({count:e.used_on.length}),keywords:[ke(e.node.type),e.node.type]}))}),re.length>0&&d.push({key:"templates",title:te.templates,tiles:re.map(e=>({type:x(e.id),label:e.name,cover:/* @__PURE__ */$(X,{type:e.node.type}),keywords:[ke(e.node.type),e.node.type]}))});const m=i.filter(e=>!e.group);let f=!1;for(const t of Object.keys(Y.categories??{})){const o=he.filter(e=>e.cat===t);if(0===o.length)continue;const r=e&&o.some(t=>t.type===e.type)?e:null,l=(r?[r,...o.filter(e=>e.type!==r.type)]:o).map(p);r&&!f&&(l.splice(1,0,...m.map(a)),f=!0),d.push({key:`category:${t}`,title:n(Y,t,Z),tiles:l})}const y=d.find(e=>e.key?.startsWith("category:"));if(!f&&y&&m.length>0&&(y.tiles=[...y.tiles,...m.map(a)],f=!0),c(i.filter(e=>e.group||!f)).forEach((e,t)=>{d.push({key:`blocks:${t}`,title:e.group??"",tiles:e.items.map(a)})}),!W)return d;const u=d.map(e=>({...e,tiles:e.tiles.map(e=>{const t=be(e.type),n=t?W(t):null;return n?{...e,disabled:!0,disabledReason:n}:e})})),h=e=>e.tiles.some(e=>!e.disabled);return[...u.filter(h),...u.filter(e=>!h(e))]},[re,ce,se,he,Y,te,W,O,T,oe]);/* @__PURE__ */
|
|
5
|
+
return F(I,{children:[
|
|
6
|
+
/* @__PURE__ */$(i,{icon:/* @__PURE__ */$(D,{size:15}),title:te.title,context:te.contextAll,actions:/* @__PURE__ */$(s,{label:te.done,description:te.doneDescription,onClick:z}),onHide:A}),
|
|
7
|
+
/* @__PURE__ */F("div",{className:"sf-addside sf-scroll",children:[
|
|
8
|
+
/* @__PURE__ */$(k,{groups:je,session:N,itemFor:e=>L(be(e)??{kind:"section",type:e}),onInsert:B?e=>{const t=be(e);t&&B(t)}:void 0,onTileMenu:(e,t)=>{const n=be(e);return"shared"===n?.kind&&!R&&(fe({section:n.section,...t}),!0)},at:w,hint:te.hint,searchLabel:te.search,readOnly:R,words:ne}),U??null]}),me?/* @__PURE__ */$(E,{at:{x:me.x,y:me.y},owner:me.owner,onClose:()=>fe(null),"aria-label":me.section.title,items:u([{label:se.deleteShared,danger:!0,onClick:()=>{ue(me.section),fe(null)}}])}):null,ye?/* @__PURE__ */$(M,{name:ye.title,pages:ye.used_on.length,onDelete:()=>(async e=>{try{await l(oe).remove(e.id)}catch{return void G.error(se.deleteFailed)}ue(null),ie?.removed?.(e),ae(t=>t.filter(t=>t.id!==e.id)),de(e=>e+1)})(ye),onCancel:()=>ue(null)}):null]})}export{W as AddSidePanel,S as blockKey,J as presetKey,Q as sectionKey,H as sharedKey,x as templateKey};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{isRecord as t,fieldsFrom as n,blockOf as o,topLevelSlotKeys as e,slotLocations as r,setIn as s,fieldsOf as i,isNode as c,defaultsFrom as p}from"./chunk-KXM6YRG2.js";var f=()=>({lastChange:{}});function a(t,n){if(t===n)return!0;if(!t||!n||"object"!=typeof t||"object"!=typeof n)return t!=t&&n!=n;if(Array.isArray(t)!==Array.isArray(n))return!1;if(Array.isArray(t)){const o=n;if(t.length!==o.length)return!1;for(let n=0;n<t.length;n++)if(!a(t[n],o[n]))return!1;return!0}const o=Object.keys(t),e=Object.keys(n);if(o.length!==e.length)return!1;for(const e of o){if(!Object.prototype.hasOwnProperty.call(n,e))return!1;if(!a(t[e],n[e]))return!1}return!0}function l(t,n){if(!t)return{};const o=t.props??{},e=n?.props??{},r={};for(const t of Object.keys(o))r[t]=!a(e[t],o[t]);return r}async function u(i,c,p={}){const{metadata:d={},trigger:h="replace",cache:y=f(),onResolveStart:g,onResolveEnd:m}=p,b=function(t,n){return t.type&&"root"!==t.type?n.components[t.type]:n.root}(i,c);let w={...i};const v=Boolean(b?.resolveData&&i.props),j=t(i.props)&&"id"in i.props?String(i.props.id):"root";if(v){const t=y.lastChange[j];if("force"!==h&&t&&a(i,t.item))return{node:t.resolved,didChange:!1};const n=l(i,t?.item??null);g?.(i);const o=await b.resolveData(i,{changed:n,lastData:t?.item??null,metadata:{...d,...b.metadata??{}},trigger:h})??{};w.props={...i.props,...o.props??{}},o.readOnly&&Object.keys(o.readOnly).length&&(w.readOnly=o.readOnly)}const $=n(i.type&&"root"!==i.type?o(c,i.type):c.root);if(b)for(const t of e($))void 0===w.props[t]&&(w={...w,props:{...w.props,[t]:[]}});for(const t of r(w.props,$)){if(!t.present)continue;const n=await Promise.all(t.content.map(async t=>(await u(t,c,{metadata:d,trigger:h,cache:y,onResolveStart:g,onResolveEnd:m})).node));w={...w,props:s(w.props,t.segments,n)}}return v&&m?.(w),y.lastChange[j]={item:i,resolved:w},{node:w,didChange:!a(i,w)}}var d="root";function h(t){if(void 0===t)return"u";if("string"==typeof t)return`s${t.length.toString(36)}.${y(t)}`;const n=g(t);return`j${n.length.toString(36)}.${y(n)}`}function y(t){let n=2166136261;for(let o=0;o<t.length;o++)n^=t.charCodeAt(o),n=Math.imul(n,16777619);return(n>>>0).toString(36)}function g(t){if(null===t||"object"!=typeof t)return JSON.stringify(t)??"null";if(Array.isArray(t))return`[${t.map(g).join(",")}]`;const n=t;return`{${Object.keys(n).filter(t=>void 0!==n[t]).sort().map(t=>`${JSON.stringify(t)}:${g(n[t])}`).join(",")}}`}var m=(t,n)=>Object.prototype.hasOwnProperty.call(t,n);function b(t,n){return t&&m(t,n)?t[n]:void 0}var w=t=>Object.keys(t).length>0,v=n=>t(n)&&"string"==typeof n.src&&void 0!==n.v,j=t=>null==t||"string"==typeof t&&""===t.trim(),$=t=>"text"===t||"textarea"===t,O=(t,n)=>"boolean"==typeof t.translatable?t.translatable:n;function k(n,o){const e=b(n,o);return t(e)?e:void 0}function A(t,n){const o=[];return x(t,n,[],[],[],void 0,o),o}function x(n,o,e,r,s,i,c){for(const p of Object.keys(o)){const f=o[p];if(!f||"slot"===f.type)continue;if(0===e.length&&"id"===p)continue;const a=[...e,p],l=[...r,p],u=b(n,p),d=O(f,i);if("object"===f.type&&f.objectFields)null==u?x({},f.objectFields,a,l,s,d,c):t(u)&&x(u,f.objectFields,a,l,s,d,c);else if("array"===f.type&&f.arrayFields){if(!Array.isArray(u))continue;const n=f.arrayFields;u.forEach((o,e)=>{t(o)&&x(o,n,[...a,e],[...l,"*"],[...s,e],d,c)})}else(d??$(f.type))&&c.push({path:a.join("."),segments:a,pattern:l.join("."),indices:s,value:u})}}function I(t,n){const o=t.split("."),e=[],r=[];let s,i=n,c=0;for(;c<o.length;){const t=b(i,o[c]);if(!t||"slot"===t.type)return null;if(0===c&&"id"===o[c])return null;e.push(o[c]),c+=1;const n=O(t,s);if("object"===t.type&&t.objectFields)i=t.objectFields,s=n;else{if("array"!==t.type||!t.arrayFields)return c!==o.length?null:n??$(t.type)?{pattern:e.join("."),indices:r}:null;{const p=o[c];if(void 0===p||!/^(0|[1-9]\d*)$/.test(p))return null;r.push(Number(p)),e.push("*"),c+=1,i=t.arrayFields,s=n}}}return null}function z(n,o){return A(t(n?.props)?n.props:{},i(o,n?.type??d)).map(({path:t,value:n})=>({path:t,value:n}))}function S(t,n,o){const e=A(t,n),r=/* @__PURE__ */new Map,s=[],i=[];if(!o)return{positions:e,hits:r,orphans:s,beaten:i};const c=/* @__PURE__ */new Map;for(const t of e)c.set(t.path,t);const p=/* @__PURE__ */new Map,f=t=>{let n=p.get(t);return void 0===n&&(n=h(t.value),p.set(t,n)),n},a=[];for(const t of Object.keys(o)){const e=o[t],p=c.get(t);if(!v(e)){(p?i:s).push(t);continue}if(p&&f(p)===e.src){r.set(t,{position:p,entry:e,from:t,stale:!1,applied:!0});continue}const l=p??I(t,n);l?l.indices.length>0?a.push({path:t,entry:e,own:p,pattern:l.pattern,indices:l.indices}):p?r.set(t,{position:p,entry:e,from:t,stale:!0,applied:!0}):s.push(t):s.push(t)}a.sort((t,n)=>function(t,n){const o=Math.min(t.length,n.length);for(let e=0;e<o;e++)if(t[e]!==n[e])return t[e]-n[e];return t.length-n.length}(t.indices,n.indices)||(t.path<n.path?-1:t.path>n.path?1:0));const l=[];for(const t of a){let n,o=-1;for(const s of e){if(s.pattern!==t.pattern||r.has(s.path))continue;if(f(s)!==t.entry.src)continue;const e=N(s.indices,t.indices);e>o&&(n=s,o=e)}n?r.set(n.path,{position:n,entry:t.entry,from:t.path,stale:!1,applied:!0}):l.push(t)}for(const t of l)t.own?r.has(t.path)?i.push(t.path):r.set(t.path,{position:t.own,entry:t.entry,from:t.path,stale:!0,applied:!1}):s.push(t.path);return{positions:e,hits:r,orphans:s,beaten:i}}function N(t,n){let o=0;for(;o<t.length&&o<n.length&&t[o]===n[o];)o+=1;return o}function F(n,o,e){const p=t=>{if(!Array.isArray(t))return t;let n=null;return t.forEach((o,r)=>{if(!c(o))return;const s=f(e(o.props.id,o.type,o.props),o.type);s!==o.props&&(n??=[...t],n[r]={...o,props:s})}),n??t},f=(t,n)=>{let e=t;for(const c of r(t,i(o,n))){if(!c.present)continue;const t=p(c.content);t!==c.content&&(e=s(e,c.segments,t))}return e};let a=n;const l=t(n.root?.props)?n.root.props:{},u=e(d,d,l),h=p(n.content);h!==n.content&&(a={...a,content:h});const y=f(u,d);y!==l&&(a={...a,root:{...a.root,props:y}});const g=n.zones;if(t(g)){let t=g;for(const n of Object.keys(g)){if(-1===n.indexOf(":"))continue;const o=p(g[n]);o!==g[n]&&(t={...t,[n]:o})}t!==g&&(a={...a,zones:t})}return a}function M(t,n){const o=/* @__PURE__ */new Map;return F(t,n,(t,n,e)=>(o.has(t)||o.set(t,{type:n,props:e}),e)),o}function E(t,n,o){return o&&w(o)?F(t,n,(t,e,r)=>{const c=k(o,t);if(!c)return r;const p=S(r,i(n,e),c);let f=r;for(const t of p.positions){const n=p.hits.get(t.path);n&&n.applied&&!a(t.value,n.entry.v)&&(f=s(f,t.segments,n.entry.v))}return f}):t}function D(t,n,o){const e={total:0,missing:[],stale:[]};return F(t,n,(t,r,s)=>{const c=S(s,i(n,r),k(o,t));for(const n of c.positions){const o=c.hits.get(n.path);!o&&j(n.value)||(e.total+=1,o?o.stale&&e.stale.push({id:t,path:n.path}):e.missing.push({id:t,path:n.path}))}return s}),e}function C(n,o){let e=n;for(let n=0;n<o.length-1;n++){const r=o[n];if("number"==typeof r){if(!Array.isArray(e)||r>=e.length)return{held:!1,value:void 0};e=e[r]}else{if(!t(e))return{held:!1,value:void 0};e=b(e,r)}}return t(e)?{held:!0,value:b(e,String(o[o.length-1]))}:{held:!1,value:void 0}}function R(n,e,r,s){const c=M(e,r),p={},f=/* @__PURE__ */new Set;if(F(n,r,(t,n,e)=>{if(f.has(t))return e;f.add(t);const l=k(s,t),u=c.get(t);if(!u||u.type!==n||!o(r,n))return l&&(p[t]=l),e;const d=S(e,i(r,n),l),y={};for(const t of d.positions){const n=d.hits.get(t.path),{held:o,value:e}=C(u.props,t.segments),r=n&&n.applied?n.entry.v:t.value;!o||void 0!==e&&a(e,r)?n&&(y[t.path]=n.entry):void 0===e||a(e,t.value)||(y[t.path]={v:e,src:h(t.value)})}if(l)for(const t of d.orphans)m(y,t)||(y[t]=l[t]);return w(y)&&(p[t]=l&&J(y,l)?l:y),e}),!s)return p;for(const n of Object.keys(s))f.has(n)||m(p,n)||!t(s[n])||(p[n]=s[n]);return J(p,s)?s:p}function J(t,n){const o=Object.keys(t);return o.length===Object.keys(n).length&&o.every(o=>m(n,o)&&t[o]===n[o])}function P(t,n,e){const r={},s=/* @__PURE__ */new Set;let c=!1;F(t,n,(t,p,f)=>{if(m(r,t))return f;const a=k(e,t);if(!o(n,p))return U(f,s),a&&(r[t]=a),f;if(!a)return f;const l=function(t,n){let o=0===t.orphans.length&&0===t.beaten.length;const e={};for(const n of t.positions){const r=t.hits.get(n.path);r&&(e[n.path]=r.entry,r.from!==n.path&&(o=!1))}return o?n:e}(S(f,i(n,p),a),a);return l!==a&&(c=!0),w(l)&&(r[t]=l),f});for(const t of s){const n=k(e,t);n&&!m(r,t)&&(r[t]=n)}return c||Object.keys(r).length!==Object.keys(e).length?r:e}function U(n,o){if(Array.isArray(n))for(const t of n)U(t,o);else if(t(n)){c(n)&&"string"==typeof n.props.id&&o.add(n.props.id);for(const t of Object.keys(n))U(n[t],o)}}function B(n,e,r,s){if(!t(s)||!w(s))return s;const c=M(e,r),p=/* @__PURE__ */new Map;if(F(n,r,(t,n,e)=>{if(p.has(t))return e;const f=k(s,t),a=c.get(t);if(!f||!a||a.type!==n||!o(r,n))return e;const l=function(t,n,o,e){const r=S(t,o,e),s=/* @__PURE__ */new Map,i=/* @__PURE__ */new Map;G(t,n,o,"","",void 0,s,i);const c={};let p=0===r.beaten.length;for(const t of r.positions){const n=r.hits.get(t.path);if(!n)continue;const o=s.get(t.path)?.[0];void 0!==o?(c[o]=n.entry,o!==n.from&&(p=!1)):p=!1}for(const t of r.positions){const n=r.hits.get(t.path);if(n)for(const o of i.get(t.path)??[])m(c,o)||(c[o]=n.entry,p=!1)}for(const t of[...r.orphans].sort())m(c,t)?p=!1:c[t]=e[t];return p?e:c}(e,a.props,i(r,n),f);return l!==f&&p.set(t,l),e}),0===p.size)return s;const f={};for(const t of Object.keys(s)){const n=p.get(t);n?w(n)&&(f[t]=n):f[t]=s[t]}return f}function G(n,o,e,r,s,i,c,p){for(const f of Object.keys(e)){const a=e[f];if(!a||"slot"===a.type)continue;if(""===r&&"id"===f)continue;const l=""===r?f:`${r}.${f}`,u=""===s?f:`${s}.${f}`,d=b(n,f),h=b(o,f),y=O(a,i);if("object"===a.type&&a.objectFields){if(null!=d&&!t(d))continue;G(t(d)?d:{},t(h)?h:{},a.objectFields,l,u,y,c,p)}else if("array"===a.type&&a.arrayFields){if(!Array.isArray(d))continue;const n=Array.isArray(h)?h:[];for(const o of K(d,n)){const e=d[o.from];if(!t(e))continue;const r="edited"===o.kind?n[o.to]:e;G(e,t(r)?r:{},a.arrayFields,`${l}.${o.from}`,`${u}.${o.to}`,y,"copy"===o.kind?p:c,p)}}else if(y??$(a.type)){const t=c.get(l);t?t.push(u):c.set(l,[u])}}}function K(t,n){const o=t.map(g),e=n.map(g),r=o.map(()=>!1),s=e.map(()=>!1),i=[],c=Math.min(o.length,e.length);for(let t=0;t<c;t++)o[t]===e[t]&&(i.push({from:t,to:t,kind:"same"}),r[t]=s[t]=!0);for(let t=0;t<e.length;t++){if(s[t])continue;const n=o.findIndex((n,o)=>!r[o]&&n===e[t]);-1!==n&&(i.push({from:n,to:t,kind:"same"}),r[n]=s[t]=!0)}for(let t=0;t<c;t++)r[t]||s[t]||(i.push({from:t,to:t,kind:"edited"}),r[t]=s[t]=!0);for(let t=0;t<e.length;t++){if(s[t])continue;const n=o.indexOf(e[t]);-1!==n&&i.push({from:n,to:t,kind:"copy"})}return i}function T(t,n,o){const e={},s=(t,n)=>{if(t.type!==n.type)return;e[t.props.id]=n.props.id;const p=r(n.props,i(o,n.type));for(const n of r(t.props,i(o,t.type))){const t=p.find(t=>t.slot===n.slot);t&&n.content.forEach((n,o)=>{const e=t.content[o];c(n)&&c(e)&&s(n,e)})}};return c(t)&&c(n)&&s(t,n),e}function X(t,n){const o={};if(!t)return o;for(const e of Object.keys(n)){const r=k(t,e),s=n[e];r&&w(r)&&"string"==typeof s&&(o[s]={...r})}return o}var Y=t=>Number.isFinite(t)&&t>0?Math.floor(t):0;function q(t,n){const o=Y(n),e=/* @__PURE__ */new Set,r=[];if(Array.isArray(t))for(const n of t){const t="number"==typeof n?n:Number.NaN;!Number.isInteger(t)||t<0||t>=o||e.has(t)||(e.add(t),r.push(t))}for(let t=0;t<o;t++)e.has(t)||r.push(t);return r}var H=t=>t.some((t,n)=>t!==n);function L(t,n){const o=q([...t],n);return H(o)?o:void 0}function Q(t,n,o,e){const r=Y(n);if(o===e)return null;if(!Number.isInteger(o)||!Number.isInteger(e))return null;if(o<0||o>=r||e<0||e>=r)return null;const s=q(t,r);return s.splice(e,0,...s.splice(o,1)),L(s,r)}function V(t,n,o,e,r){const s=q(t,n),i=[];for(const t of s){const n=e(t);n>=0&&i.push(n),r&&t===r.after&&i.push(r.at)}return L(i,o)}var W="root",Z="default-zone",_={parentId:W,slot:Z},tt=({parentId:t,slot:n})=>`${t}:${n}`;function nt(t){const n=t.indexOf(":");if(-1===n)throw new et("no-slot",`"${t}" is not a zone key`);return{parentId:t.slice(0,n),slot:t.slice(n+1)}}var ot=t=>t.parentId===W&&t.slot===Z,et=class extends Error{code;constructor(t,n){super(n),this.name="DataError",this.code=t}};function rt(t){try{const n=globalThis.crypto;if(n&&"function"==typeof n.randomUUID)return`${t}-${n.randomUUID()}`}catch{}return`${t}-${Date.now().toString(36)}-${Math.random().toString(36).slice(2,10)}`}function st(t,n){return r(t.props,i(n,t.type)).map(({slot:t,content:n})=>({slot:t,content:n}))}function it(t,o){return r(ct(t),n(o.root))}function ct(n){return t(n.root?.props)?n.root.props:{}}function pt(t,n,o){const e=(t,n,e,r,s)=>{if(!Array.isArray(t))return t;const i=[...e,n];let f=null;return t.forEach((e,a)=>{if(!c(e))return;const l={place:{...n,index:a},path:i,parent:r,depth:s};let u=o(e,l)??e;if(u!==e&&u.props.id!==e.props.id)throw new et("id-change",`walk: ${e.props.id} came back as ${u.props.id}`);u=p(u,i,s+1),u!==e&&(f??=[...t],f[a]=u)}),f??t},p=(t,o,c)=>{let p=t.props;for(const f of r(t.props,i(n,t.type))){if(!f.present)continue;const n=e(f.content,{parentId:t.props.id,slot:f.slot},o,t,c);n!==f.content&&(p=s(p,f.segments,n))}return p===t.props?t:{...t,props:p}};let f=t;const a=e(t.content,_,[],null,0);a!==t.content&&(f={...f,content:a});let l=ct(f);for(const t of it(f,n)){if(!t.present)continue;const n=e(t.content,{parentId:W,slot:t.slot},[],null,0);n!==t.content&&(l=s(l,t.segments,n))}l!==ct(f)&&(f={...f,root:{...f.root,props:l}});const u=f.zones;if(u){let t=u;for(const n of Object.keys(u)){const o=ft(n);if(!o)continue;const r=e(u[n],o,[],null,0);r!==u[n]&&(t={...t,[n]:r})}t!==u&&(f={...f,zones:t})}return f}function ft(t){const n=t.indexOf(":");return-1===n?null:{parentId:t.slice(0,n),slot:t.slice(n+1)}}function at(t,n,o){let e=null;const r={};try{pt(t,n,(t,n)=>{if(t.props.id===o)throw e={node:t,place:n.place,path:n.path},r})}catch(t){if(t!==r)throw t}return e}function lt(t,n,o){if(ot(o))return Array.isArray(t.content)?t.content:[];const e=t.zones?.[tt(o)];if(o.parentId===W){const r=it(t,n).find(t=>t.slot===o.slot);return r?r.content:e??null}const s=at(t,n,o.parentId);if(s){const t=r(s.node.props,i(n,s.node.type)).find(t=>t.slot===o.slot);if(t)return t.content}return e??null}function ut(t,n){const o=/* @__PURE__ */new Set;return pt(t,n,t=>{o.add(t.props.id)}),o}function dt(t,n){const o=/* @__PURE__ */new Set([t.props.id]),e=t=>{for(const{content:r}of st(t,n))for(const t of r)c(t)&&(o.add(t.props.id),e(t))};return e(t),o}function ht(t,n,o,e){if(ot(o)){const n=Array.isArray(t.content)?t.content:[];return{...t,content:e(n)}}const c=tt(o),p=!!t.zones&&Array.isArray(t.zones[c]);if(o.parentId===W){const r=it(t,n).find(t=>t.slot===o.slot);if(r){const n=s(ct(t),r.segments,e(r.content));return{...t,root:{...t.root,props:n}}}}else{const c=at(t,n,o.parentId);if(c){const p=r(c.node.props,i(n,c.node.type)).find(t=>t.slot===o.slot);if(p)return yt(t,n,c,t=>({...t,props:s(t.props,p.segments,e(p.content))}))}else if(!p)throw new et("not-found",`no node ${o.parentId}`)}if(p)return{...t,zones:{...t.zones,[c]:e(t.zones[c])}};throw new et("no-slot",`no slot "${o.slot}" on ${o.parentId}`)}function yt(t,n,o,e){return ht(t,n,o.place,t=>{const n=[...t];return n[o.place.index]=e(t[o.place.index]),n})}function gt(t,n,o){const e=at(t,n,o);if(!e)throw new et("not-found",`no node ${o}`);return e}function mt(t,n,o){const e=lt(t,n,o);if(e)return e;if(o.parentId!==W&&!at(t,n,o.parentId))throw new et("not-found",`no node ${o.parentId}`);throw new et("no-slot",`no slot "${o.slot}" on ${o.parentId}`)}function bt(t,n,o){if(!Number.isInteger(t)||t<0||t>n)throw new et("bad-index",`${o}: index ${t} is outside 0…${n}`)}function wt(t,i){const c=o(i,t.type);if(!c)return t;const p=n(c);let f=t.props;for(const t of e(p))null==f[t]&&(f={...f,[t]:[]});for(const t of r(f,p)){if(!t.present)continue;const n=vt(t.content,i);n!==t.content&&(f=s(f,t.segments,n))}return f===t.props?t:{...t,props:f}}function vt(n,o){let e=null;return n.forEach((r,s)=>{if(!t(r)||"string"!=typeof r.type)return;let i=r;if(t(i.props)){if("string"!=typeof i.props.id||""===i.props.id){const{id:t,...n}=i.props;i={...i,props:{id:rt(i.type),...n}}}}else i={...i,props:{id:rt(i.type)}};const c=wt(i,o);c!==r&&(e??=[...n],e[s]=c)}),e??n}function jt(t,o){const i=n(o.root);let c=t.props;for(const t of e(i))null==c[t]&&(c={...c,[t]:[]});for(const t of r(c,i)){if(!t.present)continue;const n=vt(t.content,o);n!==t.content&&(c=s(c,t.segments,n))}return c===t.props?t:{...t,props:c}}function $t(n,o){let e=t(n)?n:{};const r=e.root;if(t(r)){if(!t(r.props)){const t=Object.keys(r).filter(t=>"props"!==t);e={...e,root:t.length?{props:{...kt(r,t)}}:{props:{}}}}}else e={...e,root:{props:{}}};const s=p(o.root);if(s){const t=Object.keys(s).filter(t=>!(t in e.root.props));if(t.length){const n=At(kt(s,t));e={...e,root:{...e.root,props:{...e.root.props,...n}}}}}const i=jt(e.root,o);i!==e.root&&(e={...e,root:i}),Array.isArray(e.content)||(e={...e,content:[]});const c=vt(e.content,o);return c!==e.content&&(e={...e,content:c}),e=t(e.zones)?function(t,n){let o=t;for(const e of Object.keys(t.zones??{})){const t=o.zones[e];if(!Array.isArray(t)||0===t.length)continue;const r=ft(e);if(!r||ot(r))continue;const s=Ot(o,n,r);if(!s||s.content.length>0)continue;const{[e]:i,...c}=o.zones;o=ht({...o,zones:c},n,r,()=>vt(t,n))}const e=o.zones;let r=e;for(const t of Object.keys(e)){if(!Array.isArray(e[t]))continue;const o=vt(e[t],n);o!==e[t]&&(r={...r,[t]:o})}return r===e?o:{...o,zones:r}}(e,o):{...e,zones:{}},e}function Ot(t,n,o){if(o.parentId===W)return it(t,n).find(t=>t.slot===o.slot);const e=at(t,n,o.parentId);return e?r(e.node.props,i(n,e.node.type)).find(t=>t.slot===o.slot):void 0}function kt(t,n){const o={};for(const e of n)o[e]=t[e];return o}function At(t){return void 0===t?t:JSON.parse(JSON.stringify(t))}function xt(t,n,o={},e={}){const r=t.components[n];if(!r)throw new et("unknown-type",`no block type "${n}" in the config`);return wt({type:n,props:{...At(p(r)??{}),...At(o),id:e.id??rt(n)}},t)}function It(n,o,e,r){if(!c(r))throw new et("unknown-type","insert: not a node");const s=mt(n,o,e);bt(e.index,s.length,"insert");const i=wt(t(r.props)&&"string"==typeof r.props.id&&r.props.id?r:{...r,props:{...r.props,id:rt(r.type)}},o),p=ut(n,o);for(const t of dt(i,o))if(p.has(t))throw new et("duplicate-id",`insert: ${t} is already in the document`);return ht(n,o,e,t=>[...t.slice(0,e.index),i,...t.slice(e.index)])}function zt(t,n,o){const e=gt(t,n,o);let r=ht(t,n,e.place,t=>[...t.slice(0,e.place.index),...t.slice(e.place.index+1)]);if(r.zones&&Object.keys(r.zones).length){const t=dt(e.node,n),o=Object.keys(r.zones).filter(n=>!t.has(n.split(":")[0]));o.length!==Object.keys(r.zones).length&&(r={...r,zones:kt(r.zones,o)})}return r}function St(t,n,o,e){const r=gt(t,n,o);if(dt(r.node,n).has(e.parentId))throw new et("cycle",`move: ${o} cannot go inside itself`);if(r.place.parentId===e.parentId&&r.place.slot===e.slot){const o=mt(t,n,e);return bt(e.index,o.length-1,"move"),e.index===r.place.index?t:ht(t,n,e,t=>{const n=[...t],[o]=n.splice(r.place.index,1);return n.splice(e.index,0,o),n})}bt(e.index,mt(t,n,e).length,"move");const s=ht(t,n,r.place,t=>[...t.slice(0,r.place.index),...t.slice(r.place.index+1)]);return ht(s,n,e,t=>[...t.slice(0,e.index),r.node,...t.slice(e.index)])}function Nt(t,n,o,e={}){const r=gt(t,n,o),s=Mt(At(r.node),n,e.strip,e.id);return ht(t,n,r.place,t=>[...t.slice(0,r.place.index+1),s,...t.slice(r.place.index+1)])}function Ft(t,n,o={}){return Mt(At(t),n,o.strip,o.id)}function Mt(t,n,o,e){let p={...t,props:{...t.props,id:e??rt(t.type)}};if(o){const t=o(p);if(t.props.id!==p.props.id)throw new et("id-change","duplicate: strip must not change the id");p=t}let f=p.props;for(const t of r(f,i(n,p.type))){if(!t.present)continue;const e=t.content.map(t=>c(t)?Mt(t,n,o):t);f=s(f,t.segments,e)}return wt({...p,props:f},n)}function Et(t,n,o,e){if("id"in e&&e.id!==o)throw new et("id-change",`setProps: ${o} cannot become ${String(e.id)}`);const r=gt(t,n,o);return Rt(r.node.props,e)?yt(t,n,r,t=>wt({...t,props:{...t.props,...e,id:o}},n)):t}function Dt(t,n,o,e){if(!c(e))throw new et("unknown-type","replaceNode: not a node");if(e.props.id!==o)throw new et("id-change",`replaceNode: ${o} cannot become ${String(e.props.id)}`);const r=gt(t,n,o),s=wt(e,n),i=ut(t,n);for(const t of dt(r.node,n))i.delete(t);for(const t of dt(s,n))if(i.has(t))throw new et("duplicate-id",`replaceNode: ${t} is already in the document`);return yt(t,n,r,()=>s)}function Ct(t,n,o){const e=ct(t);if(!Rt(e,o))return t;const r=jt({...t.root,props:{...e,...o}},n);return{...t,root:r}}function Rt(t,n){return Object.keys(n).some(o=>!(o in t)||!Object.is(t[o],n[o]))}export{et as DataError,W as ROOT_ID,_ as ROOT_LIST,Z as ROOT_SLOT,E as applyTranslation,V as carryPhoneOrder,l as changedProps,At as clone,Ft as copyNode,X as copyTranslation,xt as createNode,f as createResolveCache,a as deepEqual,Nt as duplicate,R as extractTranslation,at as find,lt as getList,It as insert,H as isCustomPhoneOrder,T as mapIds,St as move,Q as movePhoneOrder,rt as newId,$t as normalizeData,q as normalizePhoneOrder,nt as parseZoneKey,P as pruneTranslation,B as rebaseTranslation,zt as remove,Dt as replaceNode,u as resolveNodeData,Et as setProps,Ct as setRoot,L as settlePhoneOrder,st as slotsOf,z as translatablePaths,h as translationFingerprint,D as translationStatus,pt as walk,tt as zoneKey};
|