efficient-easel 27.0.0 → 27.1.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/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-TYTMUHUK.js → chunk-3FANFZ4D.js} +1 -1
- package/dist/{chunk-CWELHADJ.js → chunk-3OOYGEJY.js} +1 -1
- package/dist/{chunk-JIP5JNRB.js → chunk-5HYVOOH3.js} +1 -1
- 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-DTEYSPJE.js +64 -0
- package/dist/{chunk-YYD257TD.js → chunk-G7J6SGMF.js} +1 -1
- package/dist/chunk-GJ427TZL.js +8 -0
- package/dist/chunk-J5VPNHOW.js +1 -0
- package/dist/{chunk-QZJKWKGH.js → chunk-JUJEVGLY.js} +1 -1
- package/dist/chunk-L36E2WCO.js +19 -0
- package/dist/chunk-LAJYMOY3.js +1 -0
- package/dist/{chunk-K53PQAMP.js → chunk-LDHUPZBK.js} +1 -1
- package/dist/{chunk-SBVIW3KJ.js → chunk-MTWQYLJE.js} +1 -1
- package/dist/chunk-OB4KI2AN.js +2 -0
- package/dist/{chunk-W3UZNKGS.js → chunk-P3HXHLES.js} +4 -4
- package/dist/{chunk-3XECMGXX.js → chunk-QEEW4X64.js} +1 -1
- package/dist/{chunk-AAZIMKLQ.js → chunk-QPNNWQ24.js} +1 -1
- package/dist/{chunk-BFJAEQZ6.js → chunk-RTMDZJNE.js} +1 -1
- package/dist/chunk-SDSBXW3V.js +26 -0
- package/dist/chunk-SEC6NV6Y.js +18 -0
- package/dist/{chunk-5JNVMCCB.js → chunk-SEH3Q3EL.js} +1 -1
- package/dist/{chunk-QTHQPJWA.js → chunk-TF6NAIV7.js} +1 -1
- package/dist/{chunk-6EDVZBUO.js → chunk-TQUEVJOO.js} +1 -1
- package/dist/{chunk-2262JGFV.js → chunk-TUIBPB77.js} +5 -5
- 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-76MUJIZE.js → chunk-WL57KM5C.js} +17 -17
- package/dist/{chunk-NTG5ODKZ.js → chunk-WW24O7HT.js} +1 -1
- package/dist/{chunk-ZFEAWEFS.js → chunk-XESNAMI3.js} +3 -3
- package/dist/chunk-XT75WETI.js +1 -0
- package/dist/{chunk-YES5F7OS.js → chunk-XV5D4V2T.js} +1 -1
- package/dist/chunk-YDTEYXQW.js +1 -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 +1 -1
- package/dist/screen/components/AddSidePanel.js +1 -1
- package/dist/screen/components/NodeContextMenu.d.ts +1 -1
- package/dist/screen/components/NodeContextMenu.js +1 -1
- package/dist/screen/components/PageEditGuardNotices.js +1 -1
- package/dist/screen/components/SaveControls.d.ts +1 -1
- package/dist/screen/components/SaveControls.js +1 -1
- package/dist/screen/components/ScreenChrome.js +1 -1
- package/dist/screen/components/ScreenDocumentContext.d.ts +1 -1
- package/dist/screen/components/ScreenDocumentContext.js +1 -1
- package/dist/screen/components/ScreenMount.d.ts +1 -1
- package/dist/screen/components/ScreenMount.js +1 -1
- package/dist/screen/components/ScreenStoreProvider.d.ts +1 -1
- 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 +1 -1
- package/dist/screen/components/usePartBridge.js +1 -1
- package/dist/screen/index.d.ts +1 -1
- package/dist/screen/index.js +1 -1
- package/dist/screen/lib/admin-bridge.d.ts +1 -1
- package/dist/screen/lib/document/block-set-host.js +1 -1
- package/dist/screen/lib/document/block-size-fields.d.ts +1 -1
- 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 +1 -1
- package/dist/screen/lib/document/box-fields.js +1 -1
- package/dist/screen/lib/document/button-fields.d.ts +1 -1
- package/dist/screen/lib/document/button-fields.js +1 -1
- package/dist/screen/lib/document/image-fields.d.ts +1 -1
- package/dist/screen/lib/document/image-fields.js +5 -5
- package/dist/screen/lib/document/palette-sections.d.ts +1 -1
- 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 +1 -1
- package/dist/screen/lib/document/shadow-fields.js +2 -2
- package/dist/screen/lib/document/style-clipboard.d.ts +1 -1
- package/dist/screen/lib/document/style-clipboard.js +1 -1
- package/dist/screen/lib/document/style-fields.d.ts +1 -1
- 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 +1 -1
- 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 +1 -1
- package/dist/screen/lib/key-scope.js +1 -1
- package/dist/screen/lib/media-panel.d.ts +1 -1
- package/dist/screen/lib/media-picker.d.ts +1 -1
- 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 +1 -1
- 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 +1 -1
- package/dist/chunk-3W2O22DZ.js +0 -19
- package/dist/chunk-5OWAV3MH.js +0 -1
- 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-JQQFB7EZ.js +0 -1
- package/dist/chunk-L2WK5JYB.js +0 -2
- package/dist/chunk-L7PSERQH.js +0 -8
- package/dist/chunk-O4OWODU2.js +0 -64
- package/dist/chunk-SQTVXE5D.js +0 -18
- package/dist/chunk-TOKMFZPB.js +0 -1
- package/dist/resolve-Bz4mszpL.d.ts +0 -57
package/dist/chunk-EUFDQ4KL.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
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,w=function(t,n){return t.type&&"root"!==t.type?n.components[t.type]:n.root}(i,c);let b={...i};const v=Boolean(w?.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 w.resolveData(i,{changed:n,lastData:t?.item??null,metadata:{...d,...w.metadata??{}},trigger:h})??{};b.props={...i.props,...o.props??{}},o.readOnly&&Object.keys(o.readOnly).length&&(b.readOnly=o.readOnly)}const $=n(i.type&&"root"!==i.type?o(c,i.type):c.root);if(w)for(const t of e($))void 0===b.props[t]&&(b={...b,props:{...b.props,[t]:[]}});for(const t of r(b.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));b={...b,props:s(b.props,t.segments,n)}}return v&&m?.(b),y.lastChange[j]={item:i,resolved:b},{node:b,didChange:!a(i,b)}}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 w(t,n){return t&&m(t,n)?t[n]:void 0}var b=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=w(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=w(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 z(t,n){const o=t.split("."),e=[],r=[];let s,i=n,c=0;for(;c<o.length;){const t=w(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 I(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??z(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=F(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 F(t,n){let o=0;for(;o<t.length&&o<n.length&&t[o]===n[o];)o+=1;return o}function M(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 E(t,n){const o=/* @__PURE__ */new Map;return M(t,n,(t,n,e)=>(o.has(t)||o.set(t,{type:n,props:e}),e)),o}function N(t,n,o){return o&&b(o)?M(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 M(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=w(e,r)}}return t(e)?{held:!0,value:w(e,String(o[o.length-1]))}:{held:!1,value:void 0}}function R(n,e,r,s){const c=E(e,r),p={},f=/* @__PURE__ */new Set;if(M(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 b(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;M(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),b(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)||!b(s))return s;const c=E(e,r),p=/* @__PURE__ */new Map;if(M(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?b(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=w(n,f),h=w(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&&b(r)&&"string"==typeof s&&(o[s]={...r})}return o}var Y="root",q="default-zone",H={parentId:Y,slot:q},L=({parentId:t,slot:n})=>`${t}:${n}`;function Q(t){const n=t.indexOf(":");if(-1===n)throw new W("no-slot",`"${t}" is not a zone key`);return{parentId:t.slice(0,n),slot:t.slice(n+1)}}var V=t=>t.parentId===Y&&t.slot===q,W=class extends Error{code;constructor(t,n){super(n),this.name="DataError",this.code=t}};function Z(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 _(t,n){return r(t.props,i(n,t.type)).map(({slot:t,content:n})=>({slot:t,content:n}))}function tt(t,o){return r(nt(t),n(o.root))}function nt(n){return t(n.root?.props)?n.root.props:{}}function ot(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 W("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,H,[],null,0);a!==t.content&&(f={...f,content:a});let l=nt(f);for(const t of tt(f,n)){if(!t.present)continue;const n=e(t.content,{parentId:Y,slot:t.slot},[],null,0);n!==t.content&&(l=s(l,t.segments,n))}l!==nt(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=et(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 et(t){const n=t.indexOf(":");return-1===n?null:{parentId:t.slice(0,n),slot:t.slice(n+1)}}function rt(t,n,o){let e=null;const r={};try{ot(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 st(t,n,o){if(V(o))return Array.isArray(t.content)?t.content:[];const e=t.zones?.[L(o)];if(o.parentId===Y){const r=tt(t,n).find(t=>t.slot===o.slot);return r?r.content:e??null}const s=rt(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 it(t,n){const o=/* @__PURE__ */new Set;return ot(t,n,t=>{o.add(t.props.id)}),o}function ct(t,n){const o=/* @__PURE__ */new Set([t.props.id]),e=t=>{for(const{content:r}of _(t,n))for(const t of r)c(t)&&(o.add(t.props.id),e(t))};return e(t),o}function pt(t,n,o,e){if(V(o)){const n=Array.isArray(t.content)?t.content:[];return{...t,content:e(n)}}const c=L(o),p=!!t.zones&&Array.isArray(t.zones[c]);if(o.parentId===Y){const r=tt(t,n).find(t=>t.slot===o.slot);if(r){const n=s(nt(t),r.segments,e(r.content));return{...t,root:{...t.root,props:n}}}}else{const c=rt(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 ft(t,n,c,t=>({...t,props:s(t.props,p.segments,e(p.content))}))}else if(!p)throw new W("not-found",`no node ${o.parentId}`)}if(p)return{...t,zones:{...t.zones,[c]:e(t.zones[c])}};throw new W("no-slot",`no slot "${o.slot}" on ${o.parentId}`)}function ft(t,n,o,e){return pt(t,n,o.place,t=>{const n=[...t];return n[o.place.index]=e(t[o.place.index]),n})}function at(t,n,o){const e=rt(t,n,o);if(!e)throw new W("not-found",`no node ${o}`);return e}function lt(t,n,o){const e=st(t,n,o);if(e)return e;if(o.parentId!==Y&&!rt(t,n,o.parentId))throw new W("not-found",`no node ${o.parentId}`);throw new W("no-slot",`no slot "${o.slot}" on ${o.parentId}`)}function ut(t,n,o){if(!Number.isInteger(t)||t<0||t>n)throw new W("bad-index",`${o}: index ${t} is outside 0…${n}`)}function dt(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=ht(t.content,i);n!==t.content&&(f=s(f,t.segments,n))}return f===t.props?t:{...t,props:f}}function ht(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:Z(i.type),...n}}}}else i={...i,props:{id:Z(i.type)}};const c=dt(i,o);c!==r&&(e??=[...n],e[s]=c)}),e??n}function yt(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=ht(t.content,o);n!==t.content&&(c=s(c,t.segments,n))}return c===t.props?t:{...t,props:c}}function gt(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:{...wt(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=bt(wt(s,t));e={...e,root:{...e.root,props:{...e.root.props,...n}}}}}const i=yt(e.root,o);i!==e.root&&(e={...e,root:i}),Array.isArray(e.content)||(e={...e,content:[]});const c=ht(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=et(e);if(!r||V(r))continue;const s=mt(o,n,r);if(!s||s.content.length>0)continue;const{[e]:i,...c}=o.zones;o=pt({...o,zones:c},n,r,()=>ht(t,n))}const e=o.zones;let r=e;for(const t of Object.keys(e)){if(!Array.isArray(e[t]))continue;const o=ht(e[t],n);o!==e[t]&&(r={...r,[t]:o})}return r===e?o:{...o,zones:r}}(e,o):{...e,zones:{}},e}function mt(t,n,o){if(o.parentId===Y)return tt(t,n).find(t=>t.slot===o.slot);const e=rt(t,n,o.parentId);return e?r(e.node.props,i(n,e.node.type)).find(t=>t.slot===o.slot):void 0}function wt(t,n){const o={};for(const e of n)o[e]=t[e];return o}function bt(t){return void 0===t?t:JSON.parse(JSON.stringify(t))}function vt(t,n,o={},e={}){const r=t.components[n];if(!r)throw new W("unknown-type",`no block type "${n}" in the config`);return dt({type:n,props:{...bt(p(r)??{}),...bt(o),id:e.id??Z(n)}},t)}function jt(n,o,e,r){if(!c(r))throw new W("unknown-type","insert: not a node");const s=lt(n,o,e);ut(e.index,s.length,"insert");const i=dt(t(r.props)&&"string"==typeof r.props.id&&r.props.id?r:{...r,props:{...r.props,id:Z(r.type)}},o),p=it(n,o);for(const t of ct(i,o))if(p.has(t))throw new W("duplicate-id",`insert: ${t} is already in the document`);return pt(n,o,e,t=>[...t.slice(0,e.index),i,...t.slice(e.index)])}function $t(t,n,o){const e=at(t,n,o);let r=pt(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=ct(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:wt(r.zones,o)})}return r}function Ot(t,n,o,e){const r=at(t,n,o);if(ct(r.node,n).has(e.parentId))throw new W("cycle",`move: ${o} cannot go inside itself`);if(r.place.parentId===e.parentId&&r.place.slot===e.slot){const o=lt(t,n,e);return ut(e.index,o.length-1,"move"),e.index===r.place.index?t:pt(t,n,e,t=>{const n=[...t],[o]=n.splice(r.place.index,1);return n.splice(e.index,0,o),n})}ut(e.index,lt(t,n,e).length,"move");const s=pt(t,n,r.place,t=>[...t.slice(0,r.place.index),...t.slice(r.place.index+1)]);return pt(s,n,e,t=>[...t.slice(0,e.index),r.node,...t.slice(e.index)])}function kt(t,n,o,e={}){const r=at(t,n,o),s=xt(bt(r.node),n,e.strip,e.id);return pt(t,n,r.place,t=>[...t.slice(0,r.place.index+1),s,...t.slice(r.place.index+1)])}function At(t,n,o={}){return xt(bt(t),n,o.strip,o.id)}function xt(t,n,o,e){let p={...t,props:{...t.props,id:e??Z(t.type)}};if(o){const t=o(p);if(t.props.id!==p.props.id)throw new W("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)?xt(t,n,o):t);f=s(f,t.segments,e)}return dt({...p,props:f},n)}function zt(t,n,o,e){if("id"in e&&e.id!==o)throw new W("id-change",`setProps: ${o} cannot become ${String(e.id)}`);const r=at(t,n,o);return Ft(r.node.props,e)?ft(t,n,r,t=>dt({...t,props:{...t.props,...e,id:o}},n)):t}function It(t,n,o,e){if(!c(e))throw new W("unknown-type","replaceNode: not a node");if(e.props.id!==o)throw new W("id-change",`replaceNode: ${o} cannot become ${String(e.props.id)}`);const r=at(t,n,o),s=dt(e,n),i=it(t,n);for(const t of ct(r.node,n))i.delete(t);for(const t of ct(s,n))if(i.has(t))throw new W("duplicate-id",`replaceNode: ${t} is already in the document`);return ft(t,n,r,()=>s)}function St(t,n,o){const e=nt(t);if(!Ft(e,o))return t;const r=yt({...t.root,props:{...e,...o}},n);return{...t,root:r}}function Ft(t,n){return Object.keys(n).some(o=>!(o in t)||!Object.is(t[o],n[o]))}export{W as DataError,Y as ROOT_ID,H as ROOT_LIST,q as ROOT_SLOT,N as applyTranslation,l as changedProps,bt as clone,At as copyNode,X as copyTranslation,vt as createNode,f as createResolveCache,a as deepEqual,kt as duplicate,R as extractTranslation,rt as find,st as getList,jt as insert,T as mapIds,Ot as move,Z as newId,gt as normalizeData,Q as parseZoneKey,P as pruneTranslation,B as rebaseTranslation,$t as remove,It as replaceNode,u as resolveNodeData,zt as setProps,St as setRoot,_ as slotsOf,I as translatablePaths,h as translationFingerprint,D as translationStatus,ot as walk,L as zoneKey};
|
package/dist/chunk-FW35PCK7.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
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-CWELHADJ.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"]),g=[l,m,h];function v(t){return`site:${t??""}`}function A(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 D(t){const o=t,n=e(t);return g.some(t=>t in o||n&&t in n)}function L(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)||D(o)||"slot"!==o.type&&s.push({path:[t],kind:A(o),counted:"mobile"!==y(o)?.tier&&"tablet"!==y(o)?.tier}));return s}function O(t,o,n,e,r){i({scope:n,type:e.type,label:r,rows:t(o,e),props:e.props})}function d(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 P(t,o,n,e){O(L,t,o,n,e)}function Q(t,o,n,e,r){return d(L,t,o,n,e,r)}var X={scope:t=>v(t.siteId),rows:(t,o)=>L(t,o),copy:(t,o,n,e)=>P(e,t,o,n),plan:(t,o,n,e)=>Q(e,t,o,n)};function Z(t,o){if(!t&&!o)return X;const n=t?.rows,e=n?(t,o)=>n(t,o):L;return{scope:t?.scope??X.scope,rows:(t,o)=>e(t,o),copy:t?.copy??((t,o,n,r)=>O(e,r,t,o,n)),plan:t?.plan??((t,n,r,s)=>d(e,s,t,n,r,o))}}export{P as copyNodeStyle,L as nodeStyleRows,Q as planNodePaste,A as shopFieldKind,v as siteStyleScope,Z as styleClipboardOf};
|
package/dist/chunk-HG65R6IN.js
DELETED
|
@@ -1,20 +0,0 @@
|
|
|
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-Y2T3JX7K.js";import{FieldSelect as u}from"./chunk-KFWNGPW3.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-JACEEVVF.js";import{useWords as f}from"./chunk-MFIRYGHW.js";import{useTreeDrag as b,gapToMoveIndex as g}from"./chunk-3XECMGXX.js";import{withTip as v}from"./chunk-P2VEMZH5.js";import{clone as y}from"./chunk-EUFDQ4KL.js";import{Textarea as w,Input as k,ItemCount as x,SortableList as C,ListRow as O,IconButton as j,ContextMenu as N,tabPanelId as D,Tabs as $,tabButtonId as I}from"efficient-shell/ui";export{LinkPicker}from"efficient-shell/ui";import{useRef as S,useState as P,useLayoutEffect as F,useId as L}from"react";import{jsx as E,jsxs as T,Fragment as M}from"react/jsx-runtime";import{LockIcon as R,CloseIcon as z,MoveUpIcon as W,MoveDownIcon as A,DuplicateIcon as B,TrashIcon as H}from"efficient-shell/icons/efficient";function K({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__ */E(w,{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__ */E(k,{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 X(e,n,t){const l=e.slice();return l.splice(Math.max(0,Math.min(n,l.length)),0,t),l}function V(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 Y(e,n){return e.filter((e,t)=>t!==n)}var Q='input, textarea, select, button, [contenteditable]:not([contenteditable="false"]), [tabindex]',Z={parentId:"list",slot:"items"};function G({label:e,icon:n,noun:t,items:l,onChange:o,newItem:a,summary:s,itemName:d,thumb:u,min:m=0,max:h,readOnly:w=!1,open:k,onOpen:D,renderItem:$,renderRow:I,canRemove:L,lockedReason:K,fixed:G=!1,removeOnRow:U=!0,canDuplicate:q,above:J,head:_=!0}){const ee=f("fields",p).list,ne=f("tree",i),te=t??ee.item,le=!w&&!G&&("number"!=typeof h||l.length<h),re=l.length<=m,oe=e=>!!L&&!L(l[e],e),ae=e=>!w&&!G&&U&&!re&&!oe(e),ie=e=>le&&(!q||q(l[e],e)),se=(e,n)=>d?d(e,n):ee.itemName({noun:te,n:n+1}),ce=S([]),de=S(null),[ue,me]=P(null),he=S(null),[pe,fe]=P(null),[be,ge]=P("");F(()=>{const e=de.current;if(!e)return;de.current=null;const n=ce.current[e.index]?.querySelectorAll(Q)[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 ve=(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(Q)].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(V(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&&D(a),ge(ee.moved({n:n+1,total:l.length}))},ye=e=>{le&&(o(X(l,e,a())),I?(de.current={index:e,nth:0,start:null,end:null},null!==k&&k>=e&&D(k+1)):D(e))},we=e=>{ae(e)&&(o(Y(l,e)),k===e?D(null):null!==k&&k>e&&D(k-1))},ke=b({keyOf:e=>String(e),canDrop:(e,n)=>n.parentId===Z.parentId&&n.slot===Z.slot,onDrop:(e,n)=>{const t=g({...Z,index:e},n);t!==e&&ve(e,t)},onStep:(e,n)=>ve(e,e+n),canStep:(e,n)=>e+n>=0&&e+n<l.length,readOnly:w}),xe=e=>{const n=[];return e>0&&n.push({label:ee.moveUp,icon:/* @__PURE__ */E(W,{size:14}),shortcut:"⌥↑",onClick:()=>ve(e,e-1)}),e<l.length-1&&n.push({label:ee.moveDown,icon:/* @__PURE__ */E(A,{size:14}),shortcut:"⌥↓",onClick:()=>ve(e,e+1)}),ie(e)&&n.push({label:ee.duplicate,icon:/* @__PURE__ */E(B,{size:14}),onClick:()=>(e=>{ie(e)&&(o(X(l,e+1,y(l[e]))),null!==k&&k>e&&D(k+1))})(e)}),ae(e)&&n.push({label:ee.delete,icon:/* @__PURE__ */E(H,{size:14}),danger:!0,onClick:()=>we(e)}),n},Ce=(e,n,t,l)=>{w||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 T("div",{className:"es-list",children:[_?/* @__PURE__ */T("div",{className:"es-list-head",children:[
|
|
3
|
-
/* @__PURE__ */T("span",{className:"es-list-label",children:[n?/* @__PURE__ */E("span",{className:"es-field-icon","aria-hidden":"true",children:n}):null,e]}),
|
|
4
|
-
/* @__PURE__ */E(x,{count:l.length,label:ee.count({noun:te,n:l.length}),showZero:!0})]}):null,J?/* @__PURE__ */E("div",{className:"es-list-above",children:J}):null,l.length?/* @__PURE__ */T(C,{"aria-label":e,spacing:"comfortable",className:"es-list-rows",rootProps:ke.rootProps(),children:[l.map((e,n)=>{const t=ke.row({item:n,place:{...Z,index:n}}),l=t.draggable&&ue!==n,o=!I&&k===n,a=!w&&!G&&U&&oe(n),i=["es-list-row",I?"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__ */E(r,{...ke.seam({place:{...Z,index:n}}),onAdd:le?()=>ye(n):void 0,label:ee.addHere({noun:te})},`seam-${n}`):null,
|
|
5
|
-
/* @__PURE__ */E(O,{className:i,flat:!!I,active:o,title:I?void 0:/* @__PURE__ */T(M,{children:[
|
|
6
|
-
/* @__PURE__ */E("span",{className:"es-list-row-name",children:se(e,n)}),s?/* @__PURE__ */E("span",{className:"es-list-row-summary",children:s(e,n)}):null]}),thumb:!I&&u?u(e,n):void 0,expanded:I?void 0:o,onToggle:I?void 0:()=>D(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=>ve(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=>{w||(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:w||G||!U?void 0:a?v(K?K(e,n):ee.locked,/* @__PURE__ */E("span",{className:"es-list-lock",role:"img","aria-label":K?K(e,n):ee.locked,children:/* @__PURE__ */E(R,{size:13})})):v(ee.deleteItem({noun:te}),/* @__PURE__ */E(j,{size:"sm",className:"es-list-x","aria-label":ee.deleteItem({noun:te}),disabled:!ae(n),onClick:()=>we(n),children:/* @__PURE__ */E(z,{size:14,"aria-hidden":"true"})})),below:o?/* @__PURE__ */E("div",{className:"es-list-item",children:$(e,n,Oe(n))}):void 0,children:I?/* @__PURE__ */E("div",{className:"es-list-row-main",children:I(e,n,Oe(n))}):null},n)]}),
|
|
7
|
-
/* @__PURE__ */E(r,{...ke.seam({place:{...Z,index:l.length}})})]}):null,w||G?null:/* @__PURE__ */E("button",{type:"button",className:"es-list-add",disabled:!le,onClick:()=>ye(l.length),children:ee.add({noun:te})}),
|
|
8
|
-
/* @__PURE__ */E("span",{className:"es-list-said","aria-live":"polite",children:be}),pe&&pe.index<l.length?
|
|
9
|
-
/* @__PURE__ */E(N,{at:{x:pe.x,y:pe.y},owner:pe.owner,onClose:()=>fe(null),items:c(xe(pe.index))}):null]})}var U=e=>e<6?e+1:6,q=(e,n)=>"string"==typeof e.label&&e.label?e.label:n;function J({field:e,name:t,id:l,value:r,onChange:o,readOnly:i,context:s,showWhenContext:c,renderers:d,headingLevel:u=3}){const[m,h]=P(!0),p=r&&"object"==typeof r?r:{};/* @__PURE__ */
|
|
10
|
-
return E(a,{id:`${l}-group`,title:q(e,t),open:m,onToggle:h,level:u,children:Object.entries(n(e.objectFields,{values:p,context:c})).map(([e,n])=>/* @__PURE__ */E(ee,{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:U(u)},e))})}function _({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]=P(null),f=u?d??null:h,b=u??p,g=Array.isArray(r)?r:[],v=e.getItemSummary;/* @__PURE__ */
|
|
11
|
-
return E(G,{label:q(e,t),icon:e.icon,noun:"string"==typeof e.noun?e.noun:void 0,items:g,onChange:o,newItem:()=>y({...e.defaultItemProps??{}}),summary:v?(e,n)=>v(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__ */E(ee,{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 ee(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 E(h,{label:q(n,t),htmlFor:l,icon:n.icon,hint:n.hint,children:/* @__PURE__ */E(K,{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 E(h,{label:q(n,t),htmlFor:l,icon:n.icon,hint:n.hint,children:/* @__PURE__ */E(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 E(h,{label:q(n,t),labelId:e,htmlFor:l,icon:n.icon,hint:n.hint,children:/* @__PURE__ */E(u,{id:l,value:r,options:n.options,onChange:o,readOnly:a,ariaLabelledBy:e})})}case"radio":/* @__PURE__ */
|
|
15
|
-
return E(h,{label:q(n,t),icon:n.icon,hint:n.hint,children:/* @__PURE__ */E(m,{ariaLabel:q(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 E(J,{...e,field:n});case"array":/* @__PURE__ */
|
|
17
|
-
return E(_,{...e,field:n});case"slot":return null}}function ne(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&&ne(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 te={},le=e=>o.includes(e);function re(n,t){let l,r=o[0];const a=[],i=/* @__PURE__ */new Set;for(const[o,s]of Object.entries(n))s&&(le(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&&!ae(s,n,t)||t&&!ne(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 oe(e){return new Map(re(e).rows.map(e=>[e.name,e.bucket]))}function ae(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 ie(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 se({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:g,lead:v,children:y,leadFold:w,closedFolds:k,onFold:x,headingLevel:C=3}){const O=f("panel",s),j=L(),N=b??`es-insp${j.replace(/:/g,"")}`,S=re(e,{values:n,context:i}),[F,M]=P(void 0),R=F&&(F.panel===N||S.buckets.includes(F.tab))?F.tab:void 0,z=c??R,W=m?o:S.buckets,A=z&&W.includes(z)?z:S.buckets[0]??W[0],[B,H]=P(null),K=B&&B.panel===N&&S.rows.some(e=>e.name===B.name)?B:null,X=u&&W.length>1,V=X&&A?D(N,A):`${N}-rows`,[Y,Q]=P(()=>/* @__PURE__ */new Set),Z=k??Y,G=(e,n)=>{/* @__PURE__ */return E(a,{title:e.title,open:!Z.has(e.key),onToggle:n=>((e,n)=>{void 0===k&&Q(t=>{const l=new Set(t);return n?l.delete(e):l.add(e),l}),x?.(e,n)})(e.key,n),id:`${N}-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},q=e=>X&&e!==A,J=({name:e,field:o,bucket:a,fold:s})=>/* @__PURE__ */E("div",{className:"es-insp-row","data-field":e,"data-bucket":a,hidden:!!q(a)||void 0,children:/* @__PURE__ */E(ee,{field:o,name:e,id:`${N}-${e}`,value:n[e],onChange:n=>t(e,n),readOnly:l,context:r,showWhenContext:i,renderers:p,openItem:K&&K.name===e?K.index:null,onOpenItem:n=>H(null===n?null:{panel:N,name:e,index:n}),headingLevel:s?U(C):C})},e);/* @__PURE__ */
|
|
18
|
-
return T("div",{className:"es-insp",children:[X?/* @__PURE__ */E("div",{className:"es-insp-tabs",children:/* @__PURE__ */E($,{variant:"underline",block:!0,"aria-label":g??O.settings,idPrefix:N,value:A,onChange:e=>{const n=e;void 0===c&&M({panel:N,tab:n}),d?.(n)},items:W.map(e=>{const n=O.buckets[e],t=h?.[e];return t?{id:e,icon:t,label:/* @__PURE__ */E("span",{className:"sr-only",children:n}),tooltip:n}:{id:e,label:n}})})}):null,
|
|
19
|
-
/* @__PURE__ */T("div",{className:"es-insp-rows",id:V,role:X?"tabpanel":void 0,"aria-labelledby":X&&A?I(N,A):void 0,children:[v&&ne(te,i?.device)?w?/* @__PURE__ */E("div",{className:"es-insp-band","data-fold":w.key,children:G(w,v)}):v:null,ie(S.rows).map((e,n)=>{if(!e.fold)return e.rows.map(J);const t=e.rows[0].bucket,l=e.rows.every(e=>"slot"===e.field.type);/* @__PURE__ */
|
|
20
|
-
return E("div",{className:"es-insp-band","data-fold":e.fold.key,"data-bucket":t,hidden:!(!q(t)&&!l)||void 0,children:G(e.fold,e.rows.map(J))},`fold-${e.fold.key}-${n}`)}),y]})]})}function ce(e,n,l=ne){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 de(e){const{arrayFields:n,objectFields:t}=e;return Object.values(n??t??{}).reduce((e,n)=>e+1+de(n),0)}var ue=/\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 me(e){return e.match(ue)??[]}export{K as FieldText,se as Inspector,ee as InspectorField,G as ListField,oe as bucketsOf,ne as fieldShownInView,de as innerRowCount,X as insertAt,q as labelOf,V as moveTo,re as planFields,Y as removeAt,ce as rowViewState,me as viewReadsIn};
|
package/dist/chunk-JACEEVVF.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
var e={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:e,n:o})=>`${o} ${1===o?e:(e=>/(s|x|z|ch|sh)$/i.test(e)?`${e}es`:/[^aeiou]y$/i.test(e)?`${e.slice(0,-1)}ies`:`${e}s`)(e)}`,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}`}};export{e as DEFAULT_FIELDS_WORDS};
|
package/dist/chunk-JQQFB7EZ.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{repeatWrapperAt as t,REPEAT_ATTRIBUTE as e,REPEAT_INDEX_ATTRIBUTE as r}from"./chunk-7UFKEX72.js";import{parseZoneKey as n}from"./chunk-EUFDQ4KL.js";var o=`[${e}][${r}]`;function l(l){const c=t(l);if(!c)return null;let i;try{i=n(c.zone)}catch{return null}if(!i.parentId||!i.slot)return null;const{wrapper:a,zone:p,index:f}=c;let s=a.parentElement;for(let t=a.parentElement;t;t=t.parentElement)if(t.getAttribute("data-easel-block")===i.parentId){s=t;break}const d=/* @__PURE__ */new Set;for(const t of Array.from(s?.querySelectorAll(o)??[]))t.getAttribute(e)===p&&d.add(t.getAttribute(r)??"");const m={ownerId:i.parentId,slot:i.slot,index:f,count:Math.max(d.size,f+1)},y=a.parentElement?u(a.parentElement):null;return y&&(m.outer=y),{copy:m,wrapper:a}}function u(t){return l(t)?.copy??null}function c(t,e){return t&&e?t.ownerId===e.ownerId&&t.slot===e.slot&&t.index===e.index&&c(t.outer,e.outer):t===e}function i(t,e){for(const n of Array.from(t.querySelectorAll(o))){if(n.getAttribute(r)!==String(e.index))continue;const t=l(n);if(t?.wrapper===n&&c(t.copy,e))return n}return null}export{i as findCopy,u as repeatCopyAt,l as repeatCopyWithWrapper};
|
package/dist/chunk-L2WK5JYB.js
DELETED
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
import{routeSharedHostMessage as e}from"./chunk-QZJKWKGH.js";import{describeLoadFailure as r,hostLoadRefusal as n}from"./chunk-ERR437B5.js";import{editLockOf as t}from"./chunk-GR3XRILS.js";import{NO_DOCUMENT_ADDRESSING as o}from"./chunk-RLBXE4EU.js";import{saveStatusOf as u,resetForDocumentSwitch as a}from"./chunk-6ATIYLUL.js";import{isExpiredSession as s,readEaselFailure as i}from"./chunk-KO47WAWR.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 I}from"./chunk-YYD257TD.js";import{useWords as P}from"./chunk-MFIRYGHW.js";import{createContext as j,useContext as R,useState as E,useMemo as T,useCallback as B,useEffect as A,useRef as C}from"react";import{jsx as H}from"react/jsx-runtime";var D={content:[],root:{},zones:{}};var L=j(null);function N(){const e=R(L);if(!e)throw new Error("useStorefrontDocument must be used within StorefrontDocumentProvider");return e}function O({target:j,addressing:R=o,onHostMessage:N,children:O}){const Y=R,{homeSlug:F,entryMayBounce:M,entryBounce:W,onSwitch:V,tellsHost:G,adapterFor:K,migrateRenamedProps:U,describeMissing:X,onLoadFailed:x}=Y,[Q,Z]=E(j),z=k(),J=d(),_=T(()=>f(J),[J]),q=T(()=>t(J),[J]),$="template"===Q.kind,ee="template"===Q.kind?Q.id:null,re="template"===Q.kind?Q.pageSlug??F??"":"document"===Q.kind?Q.slug??"":Q.slug,ne="page"===Q.kind?Q.siteId??null:null,te=J.blocks,oe=T(()=>K(Q,_,te),[K,_,te,Q.kind,"template"===Q.kind?Q.id:"document"===Q.kind?Q.record:Q.siteId]),ue=oe.capabilities,ae=B(e=>J.documentHooks?.stored?.(e)??e,[J]);A(()=>{m(J,ne)},[J,ne]);const se=C(Q);A(()=>{se.current=Q},[Q]);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&&Er(e.target)}}}),de=!J.usesBridgedToken||null!==ie,fe=oe.lock,me=Boolean(_.lock),[ke,ve]=E(null),[ge,pe]=E(null),[he,ye]=E(null),[we,be]=E(null),Se=P("screen",v),Ie=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,[Pe,je]=E(null),Re=C(null),Ee=C(null),[Te,Be]=E(!1),Ae=C(null),[Ce,He]=E(null),De=C(null),[Le,Ne]=E(null),[Oe,Ye]=E(!1),Fe=C(null);A(()=>{Fe.current=Le},[Le]);const[Me,We]=E(ue.hasEditLock?{kind:"checking"}:{kind:"editing"}),Ve=C(Me);A(()=>{Ve.current=Me},[Me]);const Ge=C(()=>Promise.resolve(!1)),Ke=B(e=>{Ee.current=e,Be(!0)},[]),Ue=g({save:async({id:e,data:r})=>{if(p(Ve.current)){if(!await Ge.current(e,r)){if(!p(Ve.current))return void Ke({id:e,data:r});throw new Error("page save did not land")}}else Ke({id:e,data:r})},onFailure:(e,r)=>{0===r&&z.send("storefront-editor:save-failed")}}),{state:Xe,push:xe,flush:Qe,pause:Ze,resume:ze,stop:Je,reset:_e,retryNow:qe,hasPending:$e}=Ue,er=C(Xe);A(()=>{er.current=Xe},[Xe]);const rr=u(Xe),nr=B(()=>{const e=Ee.current;e&&(Ee.current=null,Be(!1),xe(e))},[xe]),tr=C("");tr.current||(tr.current=h());const[or,ur]=E(0),ar=C(!1),[sr,ir]=E(M(j)),lr=C(!1);A(()=>{if(lr.current)return;lr.current=!0;const e=z.address.search(),r=W(j,e);r?z.address.load(r):M(j)&&ir(!1)},[j,z]);const cr=z.send;A(()=>{if(!de)return;let e=!1;const t=se.current,o=oe.resolve(re),u=J.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 z.address.load({kind:"page",slug:F,siteId:ne??void 0}):(be({target:t,slug:re,missing:!0,sentence:X?.(t)??null}),void x?.(t,null));const n=r.readOnlyReason?r.readOnlyReason:null;Re.current=n,je(n),ve(r.id),pe(r.kind??null),De.current=r.version??null;const o=r.layout,a=o&&Object.keys(o).length?o:D,s=U(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},J),cause:r(o,J)}),x?.(t,o))}),()=>{e=!0}},[de,ie,$,oe,re]);const dr=B(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=B(async e=>{const r=le.current;if(!r&&J.usesBridgedToken)return{ok:!1,error:new Error("no editor token")};try{return{ok:!0,value:await e(r??"")}}catch(n){if(s(n,J)){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,J]),mr=B(async e=>{const r=le.current?await fr(e):{ok:!1};return r.ok||cr("storefront-editor:save-failed"),r.ok},[cr,fr]),kr=B(async(e,r,n=!1)=>{if(null!==Re.current)return!1;if(!p(Ve.current))return!1;if(Fe.current)return!1;const t=await fr(()=>oe.saveLayout(e,r,De.current,tr.current));if(t.ok)return De.current=t.value.version??De.current,Ye(!1),!0;const o=q.readLockTaken(t.error);if(o){const e={kind:"takenover",holder:o};return Ve.current=e,We(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 De.current=n.value,Ge.current(e,r,!0)}Je(),Fe.current=u,Ne(u)}return Ye(i(t.error,J)?.status===c),!1},[oe,fr,Je,J]);A(()=>{Ge.current=kr},[kr]);const vr=B(e=>{if(null!==Re.current)return;if(cr("storefront-editor:dirty"),!ke)return;const r=ae(e);Ae.current=r,p(Ve.current)?xe({id:ke,data:r}):Ke({id:ke,data:r})},[ke,cr,Ke,xe,ae]),gr=B(async()=>{p(Ve.current)&&nr();return await Qe()&&null==Ee.current},[nr,Qe]),pr=C(gr);A(()=>{pr.current=gr},[gr]);const hr=C(fr);A(()=>{hr.current=fr},[fr]);const yr=B(()=>{z.address.reload()},[z]),wr=C(()=>Promise.resolve(!1));A(()=>{wr.current=()=>{const e=oe.rereadVersion;return ke&&e?y({ours:De.current,stored:async()=>{const r=await hr.current(()=>e(ke));return r.ok?r.value:null},hasPending:()=>null!=Ee.current||$e(),reload:yr}):Promise.resolve(!1)}},[oe,ke,$e,yr]);const br=null!==Pe;A(()=>{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:()=>Ve.current,heldWrite:()=>({pending:null!=Ee.current||$e(),autoSaveEnabled:!er.current.paused,saveConflict:null!=Fe.current}),setAccess:e=>{Ve.current=e,We(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||(We({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=B(()=>{fe&&ke&&(ar.current=!0,ur(e=>e+1))},[ke,fe]),Ir=B(()=>{We(e=>{const r="blocked"===e.kind||"takenover"===e.kind?e.holder:null;return r?{kind:"readonly",holder:r}:e})},[]),Pr=B(()=>{er.current.paused?(p(Ve.current)&&nr(),ze()):Ze()},[nr,Ze,ze]),jr=B(()=>{qe()},[qe]),Rr=B(e=>{Ae.current=null,a("template"!==e.kind&&me,{resetAutosave:()=>{_e(),Ee.current=null,Be(!1)},setVersion:e=>{De.current=e},setSaveConflict:Ne,setAccess:We}),V(e),Z(e),Re.current=null,je(null),ve(null),pe(null),ye(null),be(null),z.address.show(e),"document"!==e.kind&&G(e)&&z.send("storefront-editor:navigated",{target:e})},[_e,z,me,V,G]),Er=B(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!=Ee.current;if(!r&&!$e())return void Rr(e);const n=er.current;r||n.paused||n.failed||n.stopped?He(e):Qe().then(r=>{r?Rr(e):He(e)})},[Rr,$e,Qe,F]),Tr=B(()=>He(null),[]),Br=B(()=>{He(e=>(e&&Rr(e),null))},[Rr]),Ar=B(async()=>{const e=Ce;if(!e)return;await gr()&&(He(null),Rr(e))},[Ce,gr,Rr]),Cr=B(async e=>{if(null!==Re.current)return;if(!ke)return;if(!p(Ve.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,De.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})}De.current=t.value.version??De.current,cr("storefront-editor:published")},[ke,oe,ue.canPublish,cr,kr,fr,ae]);/* @__PURE__ */
|
|
2
|
-
return H(L.Provider,{value:{target:Q,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:()=>Ae.current??he,error:Ie,redirecting:sr,saveStatus:rr,saveState:Xe,autoSaveEnabled:!Xe.paused,autoSaveStoppedByConflict:Xe.stopped,hasUnsavedEdits:Xe.pending||Te,toggleAutoSave:Pr,retrySave:jr,onChange:vr,flushSave:gr,onPublish:Cr,access:Me,readOnly:null!==I(Me)||null!==Pe||null!==Le,readOnlyReason:Pe,takeOverEditing:Sr,viewReadOnly:Ir,saveConflict:Le,saveUnreachable:Oe,reloadFromServer:yr,navigate:Er,pendingNav:Ce,cancelPendingNav:Tr,discardAndNavigate:Br,saveAndNavigate:Ar},children:O})}export{L as ScreenDocumentContext,O as ScreenDocumentProvider,N as useScreenDocument};
|
package/dist/chunk-L7PSERQH.js
DELETED
|
@@ -1,8 +0,0 @@
|
|
|
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-SBVIW3KJ.js";import{blockRuns as c}from"./chunk-RUQOIQWI.js";import{useScreenBlockLook as a,useScreenBlockRules as p,useScreenPinned as d}from"./chunk-2262JGFV.js";import{useEaselSession as m}from"./chunk-YM4UEGBV.js";import{DEFAULT_SCREEN_WORDS as f}from"./chunk-G2VZ4DET.js";import{useEasel as u}from"./chunk-3W2O22DZ.js";import{easelMenuEntries as y}from"./chunk-FIVU2COQ.js";import{useWords as h}from"./chunk-MFIRYGHW.js";import{AddPanel as k}from"./chunk-SQTVXE5D.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 O}from"efficient-shell/icons/efficient";import{ContextMenu as E,toast as I,Dialog as $,Button as F}from"efficient-shell/ui";import{jsx as G,jsxs as T,Fragment as x}from"react/jsx-runtime";function D({name:e,pages:t,onDelete:n,onCancel:o}){const r=h("screen",f).shared,[l,i]=b(!1),s=w(null);/* @__PURE__ */
|
|
2
|
-
return G($,{open:!0,role:"alertdialog",size:"sm",title:r.deleteTitle({name:e}),onClose:o,initialFocus:s,footer:/* @__PURE__ */T(x,{children:[
|
|
3
|
-
/* @__PURE__ */G(F,{ref:s,variant:"secondary",onClick:o,children:r.cancel}),
|
|
4
|
-
/* @__PURE__ */G(F,{variant:"danger",loading:l,onClick:()=>{(async()=>{i(!0);try{await n()}finally{i(!1)}})()},children:r.deleteShared})]}),children:r.deleteMessage({count:t})})}var S=e=>`section:${e}`,W=e=>`block:${e}`,M=e=>`template:${e}`,Q=e=>`shared:${e}`,V=e=>`preset:${e}`;function B({at:w,placeBlocks:$,canTake:F,onPick:B,itemFor:H,session:J,siteWide:z,onClose:A,onHide:L,readOnly:N}){const U=u(e=>e.config),R=a(),{labelAtLevel:Y,categoryLabel:Z,firstSection:P,Icon:X,Thumbnail:_}=R,{blockIsOffered:K,canAddTo:q}=p(),ee=h("screen",f).add,te=h("drag",g).add,ne=m(),[oe,re]=b([]);v(()=>{let e=!1;const t=e=>K(e,ne);return r(ne).list().then(n=>{if(e)return;const r=U.components;re(n.filter(e=>e.node?.type&&r[e.node.type]&&o(e.node).every(t)))}).catch(()=>{}),()=>{e=!0}},[U,ne]);const le=d().shared,ie=h("screen",f).shared,[se,ce]=b([]),[ae,pe]=b(0);v(()=>{if(!le)return;let e=!1;const t=e=>K(e,ne);return l(ne).list().then(n=>{if(e)return;const r=U.components;ce(n.filter(e=>e.node?.type&&r[e.node.type]&&o(e.node).every(t)))}).catch(()=>{}),()=>{e=!0}},[U,ne,ae]);const[de,me]=b(null),[fe,ue]=b(null),ye=j(()=>e(U,R),[U]),he=e=>Y(e,"section",U.components[e]?.label??e),ke=e=>({type:e.preset?V(e.preset.key):S(e.type),label:e.name,cover:/* @__PURE__ */G(_,{type:e.type}),title:e.desc?`${e.name} — ${e.desc}`:ee.tile({name:e.name}),keywords:[e.alias??"",e.desc,e.type,e.catLabel].filter(Boolean)}),ge=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=oe.find(e=>e.id===o);return e?{kind:"template",template:e}:null}if("shared"===n){const e=se.find(e=>e.id===o);return e?{kind:"shared",section:e}:null}if("preset"===n){const e=ye.find(e=>e.preset?.key===o)?.preset;return e?{kind:"preset",preset:e}:null}return null},be=e=>/* @__PURE__ */G("span",{className:"es-add-glyph-cover",children:/* @__PURE__ */G(X,{type:e,size:26})}),ve=j(()=>{const e=t(ye,P),o=/* @__PURE__ */new Map,r=e=>{e.retired||o.has(e.type)||!K(e.type,ne)||o.set(e.type,e)};for(const t of e?[e]:ye.filter(e=>!e.preset)){const e=q(t.type)?.choices??[];e.forEach(r),e.forEach(e=>q(e.type,1)?.choices?.forEach(r))}$?.forEach(r);const l=new Set(ye.filter(e=>!e.preset).map(e=>e.type)),i=[...o.values()].filter(e=>!l.has(e.type)),s=e=>({type:W(e.type),label:e.label,cover:be(e.type),title:ee.tile({name:e.label}),keywords:[e.group??"",e.type].filter(Boolean)}),a=e=>!e.preset&&o.has(e.type)?{...ke(e),cover:be(e.type)}:ke(e),p=[];se.length>0&&p.push({key:"shared",title:ie.group,tiles:se.map(e=>({type:Q(e.id),label:e.title,cover:/* @__PURE__ */G(_,{type:e.node.type}),mark:/* @__PURE__ */G(C,{size:12}),title:ie.onPages({count:e.used_on.length}),keywords:[he(e.node.type),e.node.type]}))}),oe.length>0&&p.push({key:"templates",title:ee.templates,tiles:oe.map(e=>({type:M(e.id),label:e.name,cover:/* @__PURE__ */G(_,{type:e.node.type}),keywords:[he(e.node.type),e.node.type]}))});const d=i.filter(e=>!e.group);let m=!1;for(const t of Object.keys(U.categories??{})){const o=ye.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(a);r&&!m&&(l.splice(1,0,...d.map(s)),m=!0),p.push({key:`category:${t}`,title:n(U,t,Z),tiles:l})}const f=p.find(e=>e.key?.startsWith("category:"));if(!m&&f&&d.length>0&&(f.tiles=[...f.tiles,...d.map(s)],m=!0),c(i.filter(e=>e.group||!m)).forEach((e,t)=>{p.push({key:`blocks:${t}`,title:e.group??"",tiles:e.items.map(s)})}),!F)return p;const u=p.map(e=>({...e,tiles:e.tiles.map(e=>{const t=ge(e.type),n=t?F(t):null;return n?{...e,disabled:!0,disabledReason:n}:e})})),y=e=>e.tiles.some(e=>!e.disabled);return[...u.filter(y),...u.filter(e=>!y(e))]},[oe,se,ie,ye,U,ee,F,$,ne]);/* @__PURE__ */
|
|
5
|
-
return T(x,{children:[
|
|
6
|
-
/* @__PURE__ */G(i,{icon:/* @__PURE__ */G(O,{size:15}),title:ee.title,context:ee.contextAll,actions:/* @__PURE__ */G(s,{label:ee.done,description:ee.doneDescription,onClick:A}),onHide:L}),
|
|
7
|
-
/* @__PURE__ */T("div",{className:"sf-addside sf-scroll",children:[
|
|
8
|
-
/* @__PURE__ */G(k,{groups:ve,session:J,itemFor:e=>H(ge(e)??{kind:"section",type:e}),onInsert:B?e=>{const t=ge(e);t&&B(t)}:void 0,onTileMenu:(e,t)=>{const n=ge(e);return"shared"===n?.kind&&!N&&(me({section:n.section,...t}),!0)},at:w,hint:ee.hint,searchLabel:ee.search,readOnly:N,words:te}),z??null]}),de?/* @__PURE__ */G(E,{at:{x:de.x,y:de.y},owner:de.owner,onClose:()=>me(null),"aria-label":de.section.title,items:y([{label:ie.deleteShared,danger:!0,onClick:()=>{ue(de.section),me(null)}}])}):null,fe?/* @__PURE__ */G(D,{name:fe.title,pages:fe.used_on.length,onDelete:()=>(async e=>{try{await l(ne).remove(e.id)}catch{return void I.error(ie.deleteFailed)}ue(null),le?.removed?.(e),ce(t=>t.filter(t=>t.id!==e.id)),pe(e=>e+1)})(fe),onCancel:()=>ue(null)}):null]})}export{B as AddSidePanel,W as blockKey,V as presetKey,S as sectionKey,Q as sharedKey,M as templateKey};
|
package/dist/chunk-O4OWODU2.js
DELETED
|
@@ -1,64 +0,0 @@
|
|
|
1
|
-
import{markedTreeNodeId as e,revealSelectedTreeRow as n,sameSelector as t}from"./chunk-UMBNBCL4.js";import{cloneNodeWithFreshIds as o}from"./chunk-OXZDSOZV.js";import{dedupeSlotChildren as r}from"./chunk-7OCEPOEJ.js";import{styleClipboardOf as i}from"./chunk-FW35PCK7.js";import{scrollPreviewToSection as l,gotoPreviewSlide as s}from"./chunk-LUOY3A3Q.js";import{useEaselKeyTarget as d,useEaselUndoKeys as a,useEaselSaveKey as c,editorRootFocus as p}from"./chunk-BFJAEQZ6.js";import{SlotChildActionsProvider as u}from"./chunk-KCBEE2MC.js";import{screenStorageKeys as f,DEFAULT_PANEL_W as h,clampPanelWidth as m}from"./chunk-6EDVZBUO.js";import{usePartBridge as g}from"./chunk-5OWAV3MH.js";import{useSectionOps as y}from"./chunk-TYTMUHUK.js";import{PageEditGuardNotices as b}from"./chunk-YES5F7OS.js";import{ScreenSaveIcon as v,ScreenMainButton as k}from"./chunk-PVBDKBJB.js";import{useBrowserOffline as S}from"./chunk-RKTF5XLP.js";import{useScreenDocument as w}from"./chunk-L2WK5JYB.js";import{requestMediaPick as x}from"./chunk-JIP5JNRB.js";import{AddChildRow as z}from"./chunk-5545A3PC.js";import{AddSidePanel as C}from"./chunk-L7PSERQH.js";import{keepsSharedSections as O,sharedSectionsOf as B}from"./chunk-N3MJOHAG.js";import{PanelHideButton as N,SidePanelHead as I,PanelShowStrip as P}from"./chunk-SBVIW3KJ.js";import{offeredChoices as $}from"./chunk-RUQOIQWI.js";import{useScreenSaveSwitch as M,useScreenNodeKeys as T,useScreenPinned as j,useScreenDocumentLabel as E,useScreenCanvasFrame as L,useScreenInspectorPanel as A,useScreenDevices as R,useScreenPickFollowsSelection as F,useScreenLeftView as D,SELECTION_MODE as V,isSelectionMode as W,sameInspectorMode as H,useScreenBridges as U,useScreenBlockRules as J,useScreenBlockLook as Y,useScreenStorageNamespace as K,useScreenNotify as X,useScreenCanvasHead as G,isSlotMode as Q,useScreenStyleClipboard as Z,useScreenDocumentPass as _,useScreenCanvasDrag as q,ScreenCanvasTargetProvider as ee,isPinnedFirst as ne,isPinnedLast as te,screenSlotsOf as oe,shownChildSlotsOf as re}from"./chunk-2262JGFV.js";import{MediaPopup as ie}from"./chunk-T2RINM7R.js";import{useMediaPanel as le,usePanelPick as se,useMediaBrowsing as de,useOpenMediaBrowse as ae,useMediaPlace as ce}from"./chunk-NCXYC7WI.js";import{useNodeClipboard as pe,useNodeContextMenu as ue}from"./chunk-NTG5ODKZ.js";import{useEaselSession as fe}from"./chunk-YM4UEGBV.js";import{useEaselHost as he,useHostEscape as me}from"./chunk-LX23TCTP.js";import{LayersIcon as ge,MediaIcon as ye}from"./chunk-XFYFKITX.js";import{DEFAULT_SCREEN_WORDS as be}from"./chunk-G2VZ4DET.js";import{heldStyle as ve,styleShortcut as ke}from"./chunk-CWELHADJ.js";import{DEFAULT_STYLE_CLIPBOARD_WORDS as Se}from"./chunk-6WY6ZXJG.js";import{rootRowName as we,slotChildRowName as xe,slotChildRenameProp as ze,sectionRenameProp as Ce}from"./chunk-5NHQ452C.js";import{ROOT_ZONE as Oe,blockNodeActions as Be,TREE_MAX_DEPTH as Ne,childSlotsOf as Ie,slotFieldsOf as Pe,newNodeId as $e,slotChildrenIn as Me,nestsInTree as Te}from"./chunk-TCAAOYQY.js";import{useEasel as je,useEaselApi as Ee,useSettledAction as Le,subscribeLateWrites as Ae,CanvasPartsContext as Re,partHasOwnBox as Fe,CanvasPassThroughContext as De,CanvasSharedContext as Ve}from"./chunk-3W2O22DZ.js";import{TreeRow as We,Subtree as He,LayersTree as Ue,TreeGroupLabel as Je,TreeRowAction as Ye,TreeSeam as Ke}from"./chunk-WHS6Y55E.js";import{DEFAULT_TREE_WORDS as Xe}from"./chunk-K56YDHYQ.js";import{DEFAULT_NODE_MENU_WORDS as Ge}from"./chunk-WK3AFPXY.js";import{toItemSelector as Qe,useNodeOps as Ze,clickPick as _e}from"./chunk-QTHQPJWA.js";import{EaselTopBar as qe,EaselIconButton as en,TopBarCluster as nn,DeviceSwitch as tn,InspectorIconButton as on,PanelResizeHandle as rn,MAX_PANEL_W as ln,MIN_PANEL_W_BY_SIDE as sn,panelWidthVars as dn}from"./chunk-VBEVZZTV.js";import{DEFAULT_NOTICE_WORDS as an,DEFAULT_CHROME_WORDS as cn}from"./chunk-AJSDWWJW.js";import{holderOf as pn,nameOrSomeone as un}from"./chunk-YYD257TD.js";import{DEFAULT_LOCK_WORDS as fn}from"./chunk-RE4LP46F.js";import{useWords as hn}from"./chunk-MFIRYGHW.js";import{insertSeams as mn,CanvasDragLayer as gn,CanvasInsert as yn}from"./chunk-SQTVXE5D.js";import{DEFAULT_DRAG_WORDS as bn}from"./chunk-TQ5Y6S2X.js";import{createDragSession as vn,useTreeDrag as kn,gapToMoveIndex as Sn}from"./chunk-3XECMGXX.js";import{useCanvasFrame as wn,LIST_SELECTOR as xn,BLOCK_SELECTOR as zn,useCanvasTyping as Cn,useCanvasEvent as On}from"./chunk-TOKMFZPB.js";import{nodeIdAt as Bn,frameRectToHost as Nn,BLOCK_ATTRIBUTE as In,drawnBox as Pn}from"./chunk-FR7EEKFF.js";import{queryMainCopy as $n}from"./chunk-7UFKEX72.js";import{ROOT_ID as Mn,ROOT_SLOT as Tn,zoneKey as jn,parseZoneKey as En,find as Ln,DataError as An}from"./chunk-EUFDQ4KL.js";import{useRef as Rn,useMemo as Fn,useState as Dn,useEffect as Vn,useCallback as Wn,useLayoutEffect as Hn,useContext as Un,Fragment as Jn,useId as Yn}from"react";import{ColoredBadge as Kn,Button as Xn,Tabs as Gn,toast as Qn,readMediaFileDrag as Zn,Tooltip as _n,groupColors as qn,Dialog as et,FormField as nt,Input as tt,MEDIA_FILE_DRAG_TYPE as ot}from"efficient-shell/ui";import{UndoIcon as rt,RedoIcon as it,RefreshIcon as lt,AddIcon as st,TrashIcon as dt,EyeOffIcon as at,EyeIcon as ct,SharedIcon as pt,DuplicateIcon as ut}from"efficient-shell/icons/efficient";import{jsx as ft,jsxs as ht,Fragment as mt}from"react/jsx-runtime";var gt="media-file";function yt({name:e,onMake:n,onCancel:t}){const o=hn("screen",be).shared,[r,i]=Dn(e),[l,s]=Dn(!1),d=Yn(),a=Rn(null),c=async()=>{const e=r.trim();if(e&&!l){s(!0);try{await n(e)}finally{s(!1)}}};/* @__PURE__ */
|
|
2
|
-
return ft(et,{open:!0,size:"sm",title:o.makeShared,description:o.makeSharedHint,onClose:t,initialFocus:a,footer:/* @__PURE__ */ht(mt,{children:[
|
|
3
|
-
/* @__PURE__ */ft(Xn,{variant:"secondary",onClick:t,children:o.cancel}),
|
|
4
|
-
/* @__PURE__ */ft(Xn,{variant:"primary",loading:l,disabled:!r.trim(),onClick:()=>{c()},children:o.makeShared})]}),children:/* @__PURE__ */ft("form",{onSubmit:e=>{e.preventDefault(),c()},children:/* @__PURE__ */ft(nt,{label:o.name,htmlFor:d,children:/* @__PURE__ */ft(tt,{id:d,ref:a,value:r,onChange:e=>i(e.target.value)})})})})}var bt=/* @__PURE__ */new WeakSet;function vt(e,n,t){const o=Ln(e,n,t);if(!o)return null;const r=o.path.find(e=>"root"!==e.parentId);return r?r.parentId:t}function kt(e,n,t){const o=o=>o>=t.left&&o+e.width<=t.left+t.width&&n.every(n=>n.right<=o||n.left>=o+e.width||n.bottom<=e.top||n.top>=e.top+e.height);if(n.every(n=>n.right<=e.left||n.left>=e.left+e.width||n.bottom<=e.top||n.top>=e.top+e.height))return e.left;const r=n.map(e=>e.right+4).filter(n=>n>e.left&&o(n));if(r.length)return Math.min(...r);const i=n.map(n=>n.left-4-e.width).filter(n=>n<e.left&&o(n));return i.length?Math.max(...i):e.left}function St({canvas:e,tabs:n,onSelect:t,onPointer:o}){const r=Rn(null),[i,l]=Dn({}),s=Rn({id:null,places:{},measure:null});s.current.places=i;const d=!(null===s.current.id||n.some(e=>e.id===s.current.id)&&i[s.current.id]);Vn(()=>{d&&(s.current.id=null,o(null))},[d,o]),Vn(()=>()=>{null!==s.current.id&&o(null)},[o]);const a=n.map(e=>`${e.id}:${e.below?1:0}:${e.label}:${e.reach??""}`).join("|");return Hn(()=>{const t=e?.document,o=e?.window,i=e?.frame;if(!t||!o||!i||0===n.length)return void l(e=>0===Object.keys(e).length?e:{});let d=0;const a=()=>{d=0;const e=r.current;if(!e)return;const a=Nn(i,{left:0,top:0,width:o.innerWidth,height:o.innerHeight},e),p={};let u=!1;const f=e.getBoundingClientRect(),h=[...e.parentElement?.querySelectorAll(".es-canvas-handle.is-shown:not(.is-dragging), .es-canvas-tag, .es-canvas-hint")??[]].map(e=>{const n=e.getBoundingClientRect();return{left:n.left-f.left,top:n.top-f.top,right:n.right-f.left,bottom:n.bottom-f.top}});for(const r of n){const n=o.CSS?.escape?o.CSS.escape(r.id):JSON.stringify(r.id).slice(1,-1),l=$n(t,`[${In}="${n}"]`),d=l?Pn(l):null;if(!d||0===d.height){p[r.id]=null;continue}const c=Nn(i,{left:d.left,top:d.top,width:d.width,height:d.height},e),f=c.top+c.height;if(f<a.top||c.top>a.top+a.height){p[r.id]=null;continue}const m=r.below?f+4:Math.max(c.top,a.top)+6,g=e.querySelector(`[data-band-tab="${n}"]`);g||(u=!0);const y=Math.max(c.left,a.left)+6,b=g?.offsetHeight??0,v=g?.offsetWidth??0,k=s.current.id===r.id?s.current.places[r.id]:null,S=k?k.left:kt({left:y,top:m,width:v,height:b},h,a);v>0&&b>0&&h.push({left:S,top:m,right:S+v,bottom:m+b}),p[r.id]={left:S,top:m}}l(e=>function(e,n){const t=Object.keys(e);return t.length===Object.keys(n).length&&t.every(t=>{const o=e[t],r=n[t];return o===r||!!o&&!!r&&o.left===r.left&&o.top===r.top})}(e,p)?e:p),u&&c()},c=()=>{d||(d=o.requestAnimationFrame(a))};s.current.measure=c,a(),o.addEventListener("scroll",c,!0),o.addEventListener("resize",c);const p=new o.MutationObserver(c);p.observe(t.body,{childList:!0,subtree:!0,attributes:!0});const u=r.current?.parentElement,f=u?.ownerDocument.defaultView?.MutationObserver,h=f?new f(c):null;return u&&h?.observe(u,{childList:!0,subtree:!0,attributes:!0,attributeFilter:["class","style"]}),()=>{d&&o.cancelAnimationFrame(d),o.removeEventListener("scroll",c,!0),o.removeEventListener("resize",c),p.disconnect(),h?.disconnect(),s.current.measure=null}},[e,a]),/* @__PURE__ */ft("div",{ref:r,className:"es-band-tabs","aria-hidden":"true",children:n.map(e=>{const n=i[e.id];return n?/* @__PURE__ */ft("span",{className:"es-band-tab","data-band-tab":e.id,style:{left:n.left,top:n.top},onMouseEnter:()=>{s.current.id=e.id,o(e.id)},onMouseLeave:()=>{s.current.id=null,o(null),s.current.measure?.()},onClick:n=>{n.stopPropagation(),t(e.id)},children:e.reach?
|
|
5
|
-
/* @__PURE__ */ft(_n,{content:e.reach,children:/* @__PURE__ */ht(Kn,{colorClass:qn("success","solid"),size:"sm",children:[
|
|
6
|
-
/* @__PURE__ */ft("span",{className:"es-band-tab-mark",children:/* @__PURE__ */ft(pt,{size:12})}),e.label]})}):/* @__PURE__ */ft(Kn,{colorClass:qn("info","solid"),size:"sm",children:e.label})},e.id):null})})}function wt({expand:e}){/* @__PURE__ */
|
|
7
|
-
return ft("svg",{width:"15",height:"15",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:1.9,strokeLinecap:"round",strokeLinejoin:"round",children:/* @__PURE__ */ht(mt,e?{children:[
|
|
8
|
-
/* @__PURE__ */ft("path",{d:"M8 9l4-4 4 4"}),
|
|
9
|
-
/* @__PURE__ */ft("path",{d:"M8 15l4 4 4-4"})]}:{children:[
|
|
10
|
-
/* @__PURE__ */ft("path",{d:"M8 4l4 4 4-4"}),
|
|
11
|
-
/* @__PURE__ */ft("path",{d:"M8 20l4-4 4 4"}),
|
|
12
|
-
/* @__PURE__ */ft("path",{d:"M5 12h14"})]})})}var xt=`${xn}, ${zn}`;function zt(e,n,t){const o=t-n;if(o<6)return null;if(o<24)return{top:Math.round((n+t)/2),height:Math.round(o)};return{top:Math.round(Math.min(Math.max(e,n+12),t-12))}}var Ct="__rungs",Ot=e=>"template"===e.kind?e.template.id:"shared"===e.kind?e.section.id:"preset"===e.kind?e.preset.key:e.type;var Bt="screen:band",Nt={duplicate:!0,delete:!0},It=()=>null;function Pt(){const xn=he(),Nn=xn.panels?.Toolbar,In=(xn.panels?.useRight??It)(),{target:Pn,docId:Yn,capabilities:_n,currentSlug:qn,siteId:et,onPublish:nt,saveState:tt,saveConflict:pt,retrySave:kt,toggleAutoSave:Pt,flushSave:$t,access:Mt,saveUnreachable:Tt=!1,readOnly:jt,readOnlyReason:Et=null}=w(),Lt=M(),At=T(),{mediaEditing:Rt,hasEditGuard:Ft,hasPinnedChrome:Dt}=_n,{appState:Vt,dispatch:Wt,history:Ht,selectedItem:Ut,getSelectorForId:Jt,config:Yt}=je(e=>e),Kt=j(),{first:Xt,firstGroup:Gt,lastGroup:Qt,isSectionGroup:Zt,sectionGroupZone:_t,panelOf:qt}=Kt,eo=qt(Xt),no=e=>ne(Kt,e),to=e=>te(Kt,e),oo="node"===Kt.firstRow,ro=Kt.band??null,io=hn("screen",be),lo=hn("tree",Xe),so=hn("drag",bn),ao=hn("notice",an),co=hn("lock",fn),po=hn("menu",Ge),uo=hn("styleClipboard",Se),fo=hn("chrome",cn),ho=E()??`/${qn}`,mo=L(),go=A(),yo=y({readOnly:jt}),bo=y({readOnly:jt,foldIntoHistory:!0}),vo=Rn(null),ko=Ee(),So=Fn(()=>({...yo,select:e=>{vo.current=e,yo.select(e)},commitDocument:(e,n)=>{if(void 0!==n){const t=ko.config;vo.current=Qe(e,t,n)}yo.commitDocument(e,n)}}),[yo,ko]),wo=Vt.ui,xo=wo.leftSideBarVisible,zo=wo.rightSideBarVisible,{options:Co,widths:Oo,initial:Bo,fluid:No,fit:Io}=R(),[Po,$o]=Dn(Bo),Mo=le(),To=Rt&&null!==Mo;se(),de();const jo=ae();F(Ut?.props.id);const{read:Eo,write:Lo,forSelection:Ao}=D(),[Ro,Fo]=Dn(Eo);Vn(()=>{Lo(Ro)},[Ro]);const[Do,Vo]=Dn(0),Wo=Rn(null),Ho=Rn(null),Uo=wn(Ho,{readySelector:xt}),Jo=Cn(Uo),Yo=d(Ho);a(Ho,Uo);const Ko=S(),Xo=pn(Mt),Go={state:tt,offline:Ko||tt.failed&&Tt,readOnlyReason:Et,editing:Xo?ao.editing({name:un(Xo.name,co),noun:io.noun}):null,conflict:null!=pt,notSaving:io.bar.notSaving},Qo=Le({onPress:()=>{jt||(tt.failed?kt():$t())}}).onPress;c(Ho,Uo,Qo);const[Zo,_o]=Dn(!1),qo=Rn(!1),[er,nr]=Dn(null),[tr,or]=Dn([]),[rr,ir]=Dn(V);W(rr);const lr=e(rr,Ut?.props.id),[sr,dr]=Dn(null);Vn(()=>{sr&&(n(),dr(null))},[sr]);const ar=Rn(Jt);ar.current=Jt;const cr=Wn((e,{scroll:n})=>{Fo(n=>Ao(e,n)),n&&dr(e);const t=[];let o=e;for(let e=0;e<4;e++){const e=ar.current(o)?.zone;if(!e||!e.includes(":"))break;const n=e.split(":")[0];t.push(n),t.push(e),o=n}0!==t.length&&Dr(e=>{if(t.every(n=>!e.has(n)))return e;const n=new Set(e);return t.forEach(e=>n.delete(e)),n})},[]),pr=Rn(null);Vn(()=>{const e=pr.current;pr.current=null;const n=null==Ut?.props.id?null:String(Ut.props.id);ir(t=>e&&e.id===n?e.mode:"part"===t.kind&&"nodeId"in t&&t.nodeId===n?t:qt(Ut?.type)??V);const o=Ut?.props.id,r=vo.current;if(vo.current=null,!o)return;const i=Jt(o);cr(String(o),{scroll:!t(r,i??null,Oe)})},[Ut?.props.id,cr]);const ur=Wn(e=>{ir(n=>H(n,e)?n:e),Wt({type:"setUi",ui:{rightSideBarVisible:!0}})},[Wt]),fr=Rn(()=>{});fr.current=(e,n)=>{const t=e?Ai(e.zone??Oe)[e.index]?.props.id:null,o=null==t?null:String(t),r=null==Ut?.props.id?null:String(Ut.props.id);ir(e=>H(e,n)?e:n),o!==r&&(pr.current={id:o,mode:n},So.select(e))};const hr=Wn((e,n)=>fr.current(e,n),[]),mr={kind:rr.kind,mode:rr,open:ur,show:e=>ir(e),reveal:()=>{zo||Wt({type:"setUi",ui:{rightSideBarVisible:!0}})},select:hr},gr=U(mr,{data:Vt.data,selected:Ut??null,zoneOf:e=>Jt(e)?.zone,readOnly:Boolean(jt),select:e=>{ir(V),So.select({index:e})},replace:(e,n)=>So.replaceComponent(Oe,e,n),scrollTo:e=>l(e)},{device:Po,refreshes:Do},{setView:Fo,reveal:()=>{xo||Wt({type:"setUi",ui:{leftSideBarVisible:!0}})}}),yr=gr.resolveLeftView?gr.resolveLeftView(Ro):"sections",br=J(),{isLockedBlock:vr,duplicateBlocked:kr,nestDepth:Sr,newSectionNode:wr,canAddTo:xr,blockIsOffered:zr}=br,Cr=e=>({id:String(e.props.id??""),data:Vt?.data}),Or=Y(),{labelAtLevel:Br,Icon:Nr,useProducts:Ir}=Or,Pr=Or.rowName?(e,n,t)=>Or.rowName(e,n,t):void 0,$r=Wn(e=>{Wt({type:"setUi",ui:{rightSideBarVisible:!0}}),l(e),cr(e,{scroll:!0})},[Wt,cr]),{selectNode:Mr,openPartId:Tr}=g({mode:rr,setMode:ir,onOpenPart:$r}),[jr,Er]=Dn(null);me(null!==jr,()=>Er(null));const Lr=f(K()),Ar=Lr.collapsed,Rr=Lr.panelWidths,[Fr,Dr]=Dn(()=>{if("undefined"==typeof window)/* @__PURE__ */return new Set;try{const e=window.localStorage.getItem(Ar);return new Set(e?JSON.parse(e):[])}catch{/* @__PURE__ */
|
|
13
|
-
return new Set}});Vn(()=>{try{window.localStorage.setItem(Ar,JSON.stringify([...Fr]))}catch{}},[Fr]);const[Vr,Wr]=Dn(()=>{if("undefined"==typeof window)return{...h};try{const e=window.localStorage.getItem(Rr);if(!e)return{...h};const n=JSON.parse(e);return{left:m(Number(n.left)||h.left,"left"),right:m(Number(n.right)||h.right,"right")}}catch{return{...h}}});Vn(()=>{const e=setTimeout(()=>{try{window.localStorage.setItem(Rr,JSON.stringify(Vr))}catch{}},300);return()=>clearTimeout(e)},[Vr]);const Hr=Wn((e,n)=>Wr(t=>{const o="function"==typeof n?n(t[e]):n;return t[e]===o?t:{...t,[e]:o}}),[]),Ur=Wn(e=>Hr("left",e),[Hr]),Jr=Wn(e=>Hr("right",e),[Hr]),Yr=e=>Fr.has(e),Kr=e=>Dr(n=>{const t=new Set(n);return t.has(e)?t.delete(e):t.add(e),t}),Xr=Rn(!1),Gr=Rn(null);Vn(()=>{if(Xr.current&&!Zo){const e=Gr.current,n=e&&e.isConnected&&!e.closest('[aria-hidden="true"]')?e:null;(n??Ho.current?.querySelector(`button[aria-label="${CSS.escape(io.add.title)}"]`))?.focus(),Gr.current=null}Xr.current=Zo},[Zo]),Vn(()=>{if(!Zo||!Yo)return;const e=e=>{"Escape"===e.key&&gl()};return Yo.addEventListener("keydown",e),()=>Yo.removeEventListener("keydown",e)},[Zo,Yo]),me(Zo,()=>gl()),Vn(()=>{!xo&&Zo&&(_o(!1),nr(null),qo.current=!1)},[xo]);const Qr=X(),Zr=(e,n="success",t)=>{if(Qr)return void(t?Qr(e,"error"===n?"error":"info",t):Qr(e,"error"===n?"error":"info"));const o={sound:!1,action:t?.action,onClose:t?.onClose};"error"===n?Qn.error(e,{...o,duration:t?.duration??3200}):Qn.success(e,{...o,duration:t?.duration??1900})},_r=Le(gr.mainAction??{label:io.done,onPress:()=>{nt(ko.getState().appState.data)}}),qr=Rn(Zr);qr.current=Zr,Vn(()=>Ae(ko,()=>qr.current(io.writeLate,"error")),[ko,io]);const ei=Rn(null),[ni,ti]=Dn(0),[oi,ri]=Dn(0),ii=G(),li=Rn(null),si=e=>Math.max(0,e.clientHeight-(li.current?.offsetHeight??0));Vn(()=>{const e=ei.current;if(!e)return;const n=()=>{ti(e.clientWidth),ri(si(e))};n();const t=new ResizeObserver(n);return t.observe(e),li.current&&t.observe(li.current),()=>t.disconnect()},[]),Hn(()=>{ei.current&&(ti(ei.current.clientWidth),ri(si(ei.current)))},[Vr,xo,zo]);const di=Po===No?ni>0?ni:Oo[No]:Oo[Po],ai=ni>0?Math.min(ni/di,"shrink"===Io?1:2):1,ci=di*ai,pi=ni>0&&ci>ni+1,ui={width:ci,height:oi||"100%",flex:"none",position:"relative"},fi={width:di,height:oi?oi/ai:"100%",maxHeight:"none",transform:1!==ai?`scale(${ai})`:void 0,transformOrigin:"top left"},hi=()=>Wt({type:"setUi",ui:{leftSideBarVisible:!xo}}),mi=()=>Wt({type:"setUi",ui:{rightSideBarVisible:!zo}}),gi=e=>{Zo&&(_o(!1),nr(null),qo.current=!1,xo&&Ro===e)||(Fo(e),xo||Wt({type:"setUi",ui:{leftSideBarVisible:!0}}))},yi=()=>{ir(eo??V),zo||Wt({type:"setUi",ui:{rightSideBarVisible:!0}})},bi=Vt.data.content??[],vi=()=>{const e=bi.findIndex(no),n=bi.findIndex(to);return{floor:e>=0?e+1:0,cap:n>=0?n:bi.length}},ki=Yt,Si=br.stripCopy,wi=e=>o(e,Si),xi=pe(),zi=Ze({data:Vt.data,config:ki,readOnly:Boolean(jt),clipboard:xi,strip:Si?e=>Si(e):void 0,afterRemove:"none",stepBounds:(e,n)=>{if(e.parentId!==Mn||e.slot!==Tn)return{min:0,max:n-1};const{floor:t,cap:o}=vi();return{min:t,max:o-1}},commit:(e,{select:n})=>{void 0!==n&&ir(V);const t=void 0===n||"node"===n?.kind?n:null;So.commitDocument(e,t)}}),Ci=fe(),[Oi,Bi]=Dn(null),Ni=e=>{const n=bi.find(n=>String(n.props.id)===e),t=Kt.shared;n&&t&&zi.swap(e,t.detach(n))},Ii=e=>{const n=Ln(Vt.data,Yt,e);if(!n)return!1;const t=jn(n.place),o=n.node,r=t===Oe?ji(o):Gi(o),i=t===Oe?Kt.shared?.usedOn(o):null;return!!zi.remove(e)&&(Zr(i?io.shared.removed({count:Math.max(0,i.length-1)}):io.deleted({name:r}),"success",{duration:8e3,action:{label:io.bar.undo,onClick:()=>{zi.restore(n.node,n.place)}}}),!0)},Pi={...zi,remove:Ii},$i=e=>Br(e,"block",Yt.components[e]?.label??e),Mi=Wn(e=>Yt.components[e]?.defaultProps??{},[Yt]),Ti=e=>Br(e,"section",$i(e)),ji=e=>we({type:e.type,props:e.props??{}},Ti(e.type),Pr),{nodeAddresses:Ei,zoneItems:Li}=Fn(()=>{const e=/* @__PURE__ */new Map,n=/* @__PURE__ */new Map,t=(o,r,i)=>{n.set(r,o),o.forEach((n,o)=>{const l=String(n.props?.id??"");if(l&&e.set(l,{zone:r,index:o}),i>=Ne)return;const s=/* @__PURE__ */new Map;for(const{child:e,zone:t}of Ie(Yt,n))s.set(t,[...s.get(t)??[],e]);for(const[e,n]of s)t(n,e,i+1)})};return t(bi,Oe,0),{nodeAddresses:e,zoneItems:n}},[bi,Yt]),Ai=Wn(e=>Li.get(e)??[],[Li]),Ri=e=>{const n=Ei.get(e);return n?Ai(n.zone)[n.index]:void 0},Fi=e=>oe(br,Yt,e),Di=e=>{if(!br.slotsOf||e===Oe)return null;const n=e.lastIndexOf(":");if(n<=0)return null;const t=Ri(e.slice(0,n));if(!t)return null;const o=Fi(t).filter(e=>e.rung),r=o.findIndex(t=>t.slot===e.slice(n+1));return r<0?null:{node:t,slot:o[r],position:r}},Vi=(()=>{if(!Q(rr))return null;const e=`${rr.nodeId}:${rr.slot}`;return Di(e)?.slot.panel===rr.kind?e:null})(),Wi=Rn(null);Vn(()=>{const e=Wi.current;if(Wi.current=null,!Vi||!Q(rr))return;const n=rr.nodeId;cr(n,{scroll:e!==Vi}),Dr(e=>{if(!e.has(n))return e;const t=new Set(e);return t.delete(n),t})},[rr]);const Hi=e=>{const n=Ei.get(e);n&&(n.zone===Oe?al(n.index):Ll(n.zone,n.index,e,Ri(n.zone.slice(0,n.zone.lastIndexOf(":")))?.type??""))},Ui=(e,n,t)=>{const o=String(e.props.id);if(!n.panel)return void Hi(o);const r={kind:n.panel,nodeId:o,slot:n.slot},i=`${o}:${n.slot}`;t&&Vi!==i&&(Wi.current=i),hr(null,r),zo||Wt({type:"setUi",ui:{rightSideBarVisible:!0}}),l(o)},Ji=(e,n,t)=>{const o=`${e}:${n}`;if(Dr(n=>{if(!n.has(o)&&!n.has(e))return n;const t=new Set(n);return t.delete(o),t.delete(e),t}),!t)return;Vi!==o&&(Wi.current=o);hr(null,{kind:t,nodeId:e,slot:n})},Yi=(e,n,t)=>{if(jt||!br.moveSlot)return;const o=Ri(e),r=o?Fi(o).filter(e=>e.rung):[],i=r[n];if(!i)return;const l={parentId:e,slot:Ct,index:n},s=Sn(l,{...l,index:Math.min(Math.max(t,0),r.length)});if(s===n)return;const d=br.moveSlot(e,n,s);"string"==typeof d&&Ji(e,d,i.panel)},Ki=Ir(),Xi=Fn(()=>{const e=/* @__PURE__ */new Map;for(const n of Ki??[])e.set(n.slug,n.name);return e},[Ki]),Gi=e=>xe(e,$i,Or.plainText,e=>Xi.get(e),Or.rowName),Qi=(e,n)=>{const t=Yt.components[e.type]?.fields,o=n===Oe||ds(n)?"section":"block",r=n===Oe&&(no(e)||to(e)||Zt(e.type)),i="block"===o?ze(t):r?null:Ce(t);return Or.renamePropOf?Or.renamePropOf(e,o,i):i},Zi=(e,n,t,o)=>{if(!(!jt&&jr?.zone===e&&jr.index===n))return;const r=(t,o)=>{Er(null),o&&((e,n,t)=>{const o=Ai(e)[n];if(!o)return;const r=Qi(o,e);r&&So.replaceComponent(e,n,{...o,props:{...o.props,[r]:t.trim()}})})(e,n,t)};/* @__PURE__ */
|
|
14
|
-
return ft("input",{className:"es-tree-rename",defaultValue:o,autoFocus:!0,"aria-label":io.rename,onClick:e=>e.stopPropagation(),onBlur:e=>r(e.currentTarget.value,!0),onKeyDown:e=>{"Enter"===e.key?(e.preventDefault(),r(e.currentTarget.value,!0)):"Escape"===e.key&&(e.preventDefault(),r("",!1))}},t)},_i=i(Z(),uo),qi=_i.scope({target:Pn,siteId:et,docId:Yn}),el=Yt,nl=(e,n)=>n===Oe?Ti(e):$i(e),tl=(e,n,t)=>{const o=_i.plan(qi,t,nl(t.type,e),el);o&&(o.changed&&So.replaceComponent(e,n,{...t,props:{...o.props,id:t.props.id}}),Zr(o.message))},ol=ue({nodesIn:Ai,nodeAt:(e,n)=>Ai(e)[n]??null,labelOf:(e,n)=>n===Oe?Ti(e):$i(e),renamePropOf:Qi,beginRename:(e,n)=>Er({zone:e,index:n}),history:{hasPast:Ht.hasPast,hasFuture:Ht.hasFuture,back:()=>Ht.back(),forward:()=>Ht.forward()},openPageStyles:gr.openPageStyles,pageStylesLabel:io.pageStyles,words:{menu:po,styleClipboard:uo,screen:io.menu},readOnly:Boolean(jt),collapseAll:()=>Dr(new Set(Ai(Oe).map(e=>String(e.props.id)))),onPasteRefused:e=>Zr(e?io.pasteRefused({name:e.label}):io.menu.clipboardRefused,"error"),canPasteAt:(e,n)=>ps(e,n),copyItem:gr.onCopyItem,menuRows:(e,n,t)=>{const o=gr.menuRows?.(e,n,t)??null,r=((e,n)=>{const t=Kt.shared;if(!t||n!==Oe)return null;const o=t.usedOn(e);if(o){const n={pick:[{label:io.shared.onPages({count:o.length}),onClick:()=>{},children:o.map(e=>({label:e.title,onClick:()=>t.openPage(e)}))}]};return jt||vr(e.type,e)?n:{...n,change:[{label:io.shared.detach,onClick:()=>Ni(e.props.id)}],remove:[{label:io.shared.removeFromPage,danger:!0,onClick:()=>{Ii(e.props.id)}}]}}return jt||no(e)||to(e)||Zt(e.type)?null:O(Ci)?{change:[{label:io.shared.makeShared,onClick:()=>Bi({id:e.props.id,name:ji(e)})}]}:null})(e,n);if(!r)return o;return Object.fromEntries(["pick","make","change","remove"].map(e=>[e,[...o?.[e]??[],...r[e]??[]]]).filter(([,e])=>e.length>0))},isLocked:e=>vr(e.type,e),duplicateBlocked:e=>kr(Vt.data,e),permits:e=>{const n=Be(Yt,e.type);return Kt.shared?.usedOn(e)?{...n,delete:!1}:n},nodeOps:Pi,isPinned:(e,n)=>n===Oe&&(no(e)||to(e)),sectionBand:vi,locate:e=>Ei.get(e)??null,rowNameOf:(e,n)=>n===Oe?ji(e):Gi(e),selectAt:(e,n,t,o)=>{e===Oe?al(n):Ll(e,n,t,o??"")},slotRung:e=>{const n=Di(e);return n?.slot.panel?{label:n.slot.label,select:()=>Ui(n.node,n.slot,!1)}:null},style:{held:()=>ve(qi),canCopy:e=>_i.rows(el,e).some(e=>!1!==e.counted),copy:(e,n)=>_i.copy(qi,e,nl(e.type,n),el),paste:(e,n,t)=>tl(e,n,t)},keys:At?{target:Yo,selected:()=>{const e=Vt.ui.itemSelector;return e?{zone:e.zone??Oe,index:e.index}:null},held:()=>xi.get(),readOnly:Boolean(jt),onDone:({done:e,name:n})=>{"copied"===e&&Zr(io.copied({name:n}))}}:void 0},Uo),rl=Rn({copy:(e,n)=>{},paste:(e,n,t)=>{},at:()=>null,readOnly:!1});Vn(()=>{rl.current={copy:(e,n)=>_i.copy(qi,e,nl(e.type,n),el),paste:tl,at:()=>{const e=Vt.ui.itemSelector;if(!e)return null;const n=e.zone??Oe,t=Ai(n)[e.index];return t?{zone:n,index:e.index,node:t}:null},readOnly:Boolean(jt)}});const il=Wn(e=>{const n=ke(e);if(!n)return;const t=rl.current,o=t.at();o&&(e.preventDefault(),"copy"===n?t.copy(o.node,o.zone):t.readOnly||t.paste(o.zone,o.index,o.node))},[]);Vn(()=>{if(!Yo)return;const e=e=>il(e);return Yo.addEventListener("keydown",e),()=>Yo.removeEventListener("keydown",e)},[il,Yo]),On(Uo,"keydown",il);const ll=bi.map(e=>e.props.id).join("|");Vn(()=>{const e=Uo?.document??null,n=Uo?.window??null;let t=0;const o=[],r=()=>{if(!e)return void or(e=>e.length?[]:e);const n=bi.findIndex(to),t=n>=0?n:bi.length,o=n=>{const t=bi[n]?.props?.id;return null==t?null:$n(e,`[data-easel-block="${CSS.escape(String(t))}"]`)},r=e=>e?[...e.querySelectorAll(zn)].map(e=>e.getBoundingClientRect()).filter(e=>e.width>0||e.height>0):[],i=[];for(let e=bi.length>0&&!no(bi[0])?0:1;e<=t;e++){const n=o(e),t=o(e-1),l=n?.getBoundingClientRect()??null,s=t?.getBoundingClientRect()??null;if(!l&&!s)continue;const d=zt(l&&s?(s.bottom+l.top)/2:l?0===e?l.top+12:l.top:s.bottom,Math.max(0===e?0:-1/0,...r(t).map(e=>e.bottom)),Math.min(1/0,...r(n).map(e=>e.top)));d&&i.push({...d,index:e})}or(e=>function(e,n){if(e.length!==n.length)return!1;for(let t=0;t<e.length;t++)if(e[t].top!==n[t].top||e[t].index!==n[t].index||e[t].height!==n[t].height)return!1;return!0}(e,i)?e:i)},i=()=>{cancelAnimationFrame(t),t=requestAnimationFrame(r)};if(!e||!n)return void r();n.addEventListener("scroll",i,{passive:!0});const l=new ResizeObserver(i);return l.observe(e.documentElement),r(),o.push(setTimeout(r,150),setTimeout(r,450)),()=>{cancelAnimationFrame(t),o.forEach(clearTimeout),n.removeEventListener("scroll",i),l.disconnect()}},[Uo,ll,Po,ai,xo,zo,Ut?.props.id]);const sl=Uo?.document??null,dl=Uo?.window??null;Vn(()=>{const e=Wo.current;if(!e||!sl||!dl)return;const n=[],t=()=>{const n=$n(sl,`[data-easel-block="${CSS.escape(e.id)}"]`);if(!n)return!1;const t=n.getBoundingClientRect().top-e.offset;return Math.abs(t)>1&&dl.scrollTo({left:dl.scrollX,top:dl.scrollY+t,behavior:"instant"}),!0};return Wo.current=null,t()&&n.push(setTimeout(t,150),setTimeout(t,450)),()=>n.forEach(clearTimeout)},[sl,dl]);const al=e=>{ir(V),So.select({index:e}),gr.sectionPressed?.(bi[e]);const n=bi[e]?.props?.id;n&&l(n)},cl=e=>{const{floor:n,cap:t}=vi(),o=e=>Math.min(Math.max(n,e),t);if("number"==typeof e)return o(e);const r=Ut&&rr.kind!==eo?.kind?bi.findIndex(e=>e.props.id===Ut.props.id):-1;return o(r>=0?r+1:t)},pl=(e,n)=>{const{floor:t,cap:o}=vi(),r=Math.min(Math.max(n,t),o),i=e<r?r-1:r;return i===e?{moved:!1,dest:e}:(So.reorderComponent(Oe,e,i),So.select({index:i}),{moved:!0,dest:i})},ul=(e,n,t,o)=>{ir(V),So.select(o?{index:o.index,zone:o.zone}:{index:e}),l(n),Zr(io.sectionAdded({name:t}))},fl=(e,n)=>{const t=cl(n),o=wr(e,{nodeDefaults:Mi,newNodeId:$e,sectionLabel:Ti,blockIsOffered:zr}),r=o?So.insertNode(Oe,t,o):So.insertSection(e,t);return ul(t,r,Ti(e),o?((e,n,t)=>{if(e.type===t)return null;const o={at:null},r=(e,n,i)=>{const l=i.filter(n=>n===e.type).length;for(const{child:s,zone:d,index:a}of Ie(Yt,e)){if(s.type===t&&(!o.at||n>o.at.depth)){const r=xr(e.type,l,d.slice(d.lastIndexOf(":")+1),Cr(e)),i=r?.choices??(r?.spec?[{type:r.spec.childType,label:r.spec.childType}]:[]);null!==r&&"footer"!==r.source&&`${e.props.id}:${r.slot}`===d&&i.some(e=>e.type===t)&&(o.at={zone:d,index:a,depth:n})}r(s,n+1,[...i,e.type])}};return r({type:e.type,props:{...e.props,id:n}},1,[]),o.at?{zone:o.at.zone,index:o.at.index}:null})(o,r,e):null),t},hl=e=>ml(Oe,e),ml=(e,n)=>{Gr.current=document.activeElement??null,nr(null===n?null:{zone:e,index:n}),_o(!0),xo||(qo.current=!0,Wt({type:"setUi",ui:{leftSideBarVisible:!0}}))},gl=()=>{_o(!1),nr(null),qo.current&&Wt({type:"setUi",ui:{leftSideBarVisible:!1}}),qo.current=!1},yl=(e,n)=>Or.rowName?n?no(e)?Or.rowName(e,"section",io.header):to(e)?Or.rowName(e,"section",io.footer):Zt(e.type)?Or.rowName(e,"section",$i(e.type)):ji(e):Gi(e):n?Ti(e.type):$i(e.type),bl=e=>n=>{e()},vl=(e,n,t)=>{if(jt)return null;const o=Ai(e)[n];return o&&!Be(Yt,o.type).delete||o&&vr(o.type,o)?null:/* @__PURE__ */ft(Ye,{kind:"delete",label:e===Oe&&o&&Kt.shared?.usedOn(o)?io.shared.removeFromPage:io.deleteNamed({name:t}),onClick:()=>((e,n)=>{const t=Ai(e)[n]?.props?.id;null!=t&&Ii(String(t))})(e,n),children:/* @__PURE__ */ft(dt,{size:15})})},kl=e=>Or.rowPreview?.(e)||void 0,Sl=e=>Or.rowMarks?.(e)??void 0,wl=(e,n,t)=>Or.rowActions?.(e,n,t)??null,xl=(e,n,t,o)=>{if(jt)return null;if(vr(t.type,t))return null;const r=Boolean(t.props._hidden);/* @__PURE__ */
|
|
15
|
-
return ft(Ye,{kind:"eye",label:r?io.showNamed({name:o}):io.hideNamed({name:o}),onClick:()=>Cl(e,n,t),children:/* @__PURE__ */ft(r?at:ct,{size:14,strokeWidth:1.8,strokeLinecap:void 0,strokeLinejoin:void 0})})},zl=e=>rd(Oe,e),Cl=(e,n,t)=>{So.replaceComponent(e,n,{...t,props:{...t.props,_hidden:!t.props._hidden}})},Ol=e=>Pe(Yt,e),Bl=e=>Ie(Yt,e),Nl=e=>br.slotsOf?Fi(e).map(n=>({slot:n.slot,rung:n.rung?n:null,kids:Me(e,n.slot)})):[{slot:null,rung:null,kids:re(Yt,e)}],Il=e=>br.slotsOf?Nl(e).flatMap(e=>e.kids):re(Yt,e),Pl=e=>Boolean(br.slotsOf)&&Fi(e).some(e=>e.rung),$l=(e,n,t)=>xr(e.type,n,t??void 0,Cr(e)),Ml=(e,n,t)=>{const o=Te(Yt,e.type,n)&&(t||Il(e).length>0||Pl(e));return{collapsible:o,folded:o&&Yr(String(e.props.id))}},Tl=(e,n,t)=>Nl(e).flatMap(o=>{const r=o.rung?n+1:n,i=o.kids.flatMap(({child:e})=>Ml(e,r,t(e.type)).collapsible?[String(e.props.id),...Tl(e,r+1,t)]:[]);return o.rung?[`${e.props.id}:${o.rung.slot}`,...i]:i}),jl=e=>Il(e).length>0||Pl(e)||Boolean(xr(e.type)),El=e=>Boolean(xr(e)),Ll=(e,n,t,o)=>{if(ir(V),xr(o)?.spec?.slider){const t=e.split(":")[0];s(t,n),So.select({index:n,zone:e}),l(t)}else So.select({index:n,zone:e}),l(t)},Al=(e,n,t,o,r)=>{const i=`${e}:${n}`;So.insertComponent(i,t,o),xr(r)?.spec?.slider?requestAnimationFrame(()=>{s(e,o),So.select({index:o,zone:i})}):So.select({index:o,zone:i})},Rl=Rn(/* @__PURE__ */new Set);Vn(()=>{bi.forEach(e=>{const n=xr(e.type)?.spec;if(!n)return;const t=e.props.id;if(Rl.current.has(t))return;Rl.current.add(t);if((Array.isArray(e.props[n.slot])?e.props[n.slot]:[]).length>0)return;if(n.skipSeed?.(e.props))return;const o=`${t}:${n.slot}`,r=n.legacy?.(e.props)??[];(r.length?r:n.seeds(Mi)).forEach((e,t)=>bo.seedChild(o,t,n.childType,e))})},[bi,bo,Mi]);const Fl=Rn(/* @__PURE__ */new Set);Vn(()=>{bi.forEach((e,n)=>{const t=e.props.id;if(Fl.current.has(t))return;const o=r(e,Ol(e.type));Fl.current.add(t),o&&bo.replaceComponent(Oe,n,{...e,props:o})})},[bi,bo]),_(bo,Yt);const Dl=bi.findIndex(to),Vl=Dl>=0?bi[Dl]:null,Wl=oo?bi.findIndex(no):-1,Hl=Wl>=0?bi[Wl]:null,Ul=Kt.groupTab,Jl=Fn(()=>Ul?e=>Zt(e.type):void 0,[Ul]),Yl=Boolean(Kt.groupBadge),Kl=Kt.sharedReach,Xl=e=>Kl?.(e)??void 0,Gl=Fn(()=>Kl?new Set(bi.filter(e=>Xl(e)).map(e=>String(e.props.id))):null,[bi,Kl]),Ql=Fn(()=>Gl?e=>Gl.has(e):void 0,[Gl]),Zl=Kt.first?Kl?.({type:Kt.first,props:{id:""}})??void 0:void 0,_l=Kt.groupBadge?/* @__PURE__ */ft("span",{className:"es-tree-group-badge",children:/* @__PURE__ */ft(Kn,{tone:"info",size:"xs",children:Kt.groupBadge})}):void 0,ql=bi.find(e=>e.type===Gt)??null,es=bi.find(e=>e.type===Qt)??null,ns=Dl>=0?Dl:bi.length,ts=[];bi.forEach(e=>{to(e)||(jl(e)&&ts.push(String(e.props.id)),ts.push(...Tl(e,1,El)))}),Vl&&(ts.push(String(Vl.props.id)),ts.push(...Tl(Vl,1,El)));const os=ts.length>0&&ts.every(e=>Fr.has(e)),rs=e=>{const n=Or.blockRowName(e,$i);return Or.rowName?Or.rowName(e,"block",n):n},is=(e,n,t,o)=>{const r=Ai(e)[t];if(!r)return;const i={...En(e),index:t},l={...En(n),index:Math.min(Math.max(o,0),Ai(n).length)},s=Sn(i,l);if(e!==n||s!==t)try{zi.move(String(r.props.id),{...l,index:s})}catch(e){if(!(e instanceof An))throw e}},ls=e=>{const n=/* @__PURE__ */new Set,t=e=>{for(const{child:o,zone:r}of Bl(e))n.add(r),t(o)};for(const t of Ol(e.type))n.add(`${e.props.id}:${t}`);return t(e),n},ss=e=>{let n=e.slice(0,e.indexOf(":"));for(let e=0;e<64;e++){const e=Ei.get(n);if(!e)return null;if(e.zone===Oe)return n;n=e.zone.slice(0,e.zone.indexOf(":"))}return null},ds=e=>{const n=e.slice(0,e.indexOf(":")),t=bi.find(e=>Zt(e.type)&&String(e.props.id)===n);return t&&_t(n)===e?t:null},as=(e,n)=>{const t=ds(e);return!t||(!Kt.groupAccepts||Kt.groupAccepts(t.type,n,Ai(e).length))},cs=(e,n,t)=>{if(e.rung){const t=Ri(e.rung.nodeId),o=t?Fi(t).filter(e=>e.rung).length:0;return n.parentId===e.rung.nodeId&&n.slot===Ct&&n.index>=0&&n.index<=o}if(n.slot===Ct)return!1;if(e.add)return hs(e.add,n);const o=jn(n);if(Zt(e.type))return!1;const r=ds(o),i=ds(e.zone);if(r||i)return!(!r||!i)&&(!(r!==i&&!as(o,e.type))&&(n.index>=0&&n.index<=Ai(o).length));if(e.zone===Oe||o===Oe){if(e.zone!==o)return!1;const{floor:t,cap:r}=vi();return n.index>=t&&n.index<=r}if(n.index<0||n.index>Ai(o).length)return!1;if(e.zone===o)return!0;const l=Vl&&!Kt.lastIsOpen?String(Vl.props.id):null;return(!l||ss(e.zone)!==l&&ss(o)!==l)&&((e,n,t,o)=>{if(e===n)return!0;const r=o??Ai(e)[t];if(!r)return!1;const i=n.split(":")[0],l=Ei.get(i),s=l?Ai(l.zone)[l.index]:void 0;if(!s)return!1;if(!o&&ls(r).has(n))return!1;const d=xr(s.type,Sr(Vt?.data,s.type,i),n.slice(n.lastIndexOf(":")+1),Cr(s));return!!d&&(!!(d.choices?d.choices.some(e=>e.type===r.type):d.spec?.childType===r.type)&&!d.spec?.addBlocked?.(Ai(n),r))})(e.zone,o,e.index,t)},ps=(e,n)=>{const t=jn(e.from),o=e.node;return t===jn(n)?as(t,o.type):cs({id:String(o.props?.id??""),zone:t,index:-1,type:o.type},n,o)},us=e=>{const n=e.slice(0,e.indexOf(":")),t=Ei.get(n),o=t?Ai(t.zone)[t.index]:void 0;if(!t||!o)return null;const r=xr(o.type,Sr(Vt?.data,o.type,n),e.slice(e.lastIndexOf(":")+1),Cr(o));if(!r||`${n}:${r.slot}`!==e)return null;if("footer"===r.source)return null;const i=$(r.choices??(r.spec?[{type:r.spec.childType,label:$i(r.spec.childType)}]:[])),l=Di(e);return{parent:o,parentId:n,target:r,choices:i,parentName:l?l.slot.label:yl(o,t.zone===Oe)}},fs=(e,n)=>{if("section"!==e.kind)return e;const t=jn(n);return t===Oe||ds(t)?e:us(t)?.choices.some(n=>n.type===e.type)?{kind:"block",type:e.type}:e},hs=(e,n)=>{const t=fs(e,n),o=jn(n);if("shared"===t.kind){if(o!==Oe||!Kt.shared?.nodeOf(t.section))return!1;const{floor:e,cap:r}=vi();return n.index>=e&&n.index<=r}if("block"!==t.kind){if(ds(o)){if("preset"===t.kind)return!1;const e="section"===t.kind?t.type:t.template.node.type;return as(o,e)&&n.index>=0&&n.index<=Ai(o).length}if(o!==Oe)return!1;const{floor:e,cap:r}=vi();return n.index>=e&&n.index<=r}if(o===Oe)return!1;const r=us(o);return!(!r||!r.choices.some(e=>e.type===t.type))&&!r.target.spec?.addBlocked?.(Ai(o))},ms=(e,n)=>{const t=fs(e,n);if("block"!==t.kind&&ds(jn(n)))return void((e,n,t)=>{const o="section"===e.kind?e.type:"template"===e.kind?e.template.node.type:null;if(o&&as(n,o)){if("section"===e.kind)So.insertComponent(n,e.type,t);else{if("template"!==e.kind)return;So.insertNode(n,t,wi(e.template.node))}ir(V),So.select({index:t,zone:n})}})(t,jn(n),n.index);if("section"===t.kind)return void fl(t.type,n.index);if("template"===t.kind)return void((e,n,t)=>{const o=cl(t),r=So.insertNode(Oe,o,n);ul(o,r,e)})(t.template.name,wi(t.template.node),n.index);if("preset"===t.kind)return void((e,n,t)=>{const o=n({nodeDefaults:Mi,newNodeId:$e,sectionLabel:Ti,blockIsOffered:zr});if(!o)return;const r=cl(t),i=So.insertNode(Oe,r,o);ul(r,i,e)})(t.preset.label,t.preset.insert,n.index);if("shared"===t.kind){const e=Kt.shared?.nodeOf(t.section);if(!e)return;const o=cl(n.index);return void(zi.restore(e,{parentId:Mn,slot:Tn,index:o})&&ul(o,e.props.id,t.section.title))}const o=jn(n),r=us(o);r&&(r.target.spec?Al(r.parentId,r.target.slot,t.type,n.index,r.parent.type):((e,n,t)=>{So.insertComponent(e,n,t),ir(V),So.select({index:t,zone:e})})(o,t.type,n.index))},gs=(e,n)=>{e.media?function(e){const n=qs();if(!n||!Qs)return;nd(n).then(n=>{n&&function(e,n){if(!Qs)return;const t=Qs.create(e,{nodeDefaults:Mi,newNodeId:$e,sectionLabel:Ti,blockIsOffered:zr}),o=jn(n);if(o===Oe){const e=cl(n.index),o=So.insertNode(Oe,e,t);return void ul(e,o,Ti(t.type))}So.insertNode(o,n.index,t),ir(V),So.select({index:n.index,zone:o})}(n,e)})}(n):e.rung?Yi(e.rung.nodeId,e.index,n.index):e.add?ms(e.add,n):e.zone===Oe?pl(e.index,n.index):is(e.zone,jn(n),e.index,n.index)},[ys]=Dn(()=>vn()),bs=kn({keyOf:e=>e.id,readOnly:Boolean(jt),session:ys,canDrop:cs,onDrop:gs,onStep:(e,n)=>{e.rung?Yi(e.rung.nodeId,e.index,n<0?e.index-1:e.index+2):e.zone===Oe?((e,n)=>{const t=Ti(bi[e]?.type??""),o=pl(e,n<0?e-1:e+2);if(!o.moved)return void Zr(n<0?io.sectionFirst({name:t}):io.sectionLast({name:t}));const{floor:r,cap:i}=vi();Zr(io.sectionMoved({name:t,n:o.dest-r+1,total:i-r}))})(e.index,n):is(e.zone,e.zone,e.index,n<0?e.index-1:e.index+2)}}),vs=Wn(e=>{const{floor:n,cap:t}=vi(),o=[];for(const r of e.nodes){const e=jn(r.place),i=Ai(e)[r.place.index];if(!i||String(i.props.id)!==r.id)continue;if(no(i)||to(i)||vr(i.type,i))continue;if(Zt(i.type))continue;const l=Boolean(ds(e)),s=e===Oe||l;e===Oe&&t-n<2||o.push({key:r.id,item:{id:r.id,zone:e,index:r.place.index,type:i.type},box:r.box,label:s?Ti(i.type):Gi(i),from:r.place})}const r=e.zones.flatMap(e=>{const n=jn(e.list);if(n===Oe&&0===e.children.length)return[{...e,addLabel:io.addSection,addAlways:!0}];const t=us(n),o=t?.target.spec?.addLabel;return e.children.length>0||Boolean(t?.choices.length)||Boolean(ds(n))?[o?{...e,addLabel:o}:e]:[]}),i=r.flatMap(e=>{const n=jn(e.list),t=n===Oe||ds(n)?null:us(n);return t?.choices.length?mn(e,t.target.spec?.addLabel??io.addBlockHere):[]});return{sources:o,zones:r,seams:i}},[Vt.data]),ks=null==Ut?.props.id?null:String(Ut.props.id),Ss=Un(Re),ws=Ss?.selected()&&Uo?.document&&ks?Ss.selectedPart?.(Uo.document)??null:null,xs=ws&&ks&&Fe(Vt.data,Yt,ks,ws)?ws:null,zs=xs?.label?{element:xs.element,label:xs.label}:null,Cs=null!==xs,Os=Wn(e=>{const n=Yt,t=e=>!e.item.rung&&null!==Ln(Vt.data,n,e.item.id),o=e[e.length-1];if(!t(o))return o;const r=n=>e.find(e=>t(e)&&e.item.id===n),i=r(ks);return i?Cs?null:i:r(_e(Vt.data,n,o.item.id,ks,Jl))??o},[Vt.data,Yt,ks,Jl,Cs]),[Bs,Ns]=Dn(null),[Is,Ps]=Dn(null),$s=Boolean(Ul||Kl);On(Uo,"mouseover",e=>{if(!$s)return;const n=Bn(e.target),t=n?vt(Vt.data,Yt,n):null;t!==Bs&&Ns(t)}),On(Uo,"mouseout",e=>{$s&&!e.relatedTarget&&Ns(null)});const Ms=e=>no(e)||to(e)||Zt(e.type),Ts=e=>{const n=Zt(e.type)?$i(e.type):no(e)?io.header:to(e)?io.footer:null;return null===n?ji(e):Or.rowName?Or.rowName(e,"section",n):n},js=[];if($s){const e=ks?vt(Vt.data,Yt,ks):null;for(const n of/* @__PURE__ */new Set([e,Bs,Is])){const e=n?bi.find(e=>String(e.props.id)===n):void 0;if(!e)continue;const t=no(e)||e.type===Gt,o=Xl(e);if(o){js.push({id:String(e.props.id),label:Ts(e),below:t,reach:o});continue}if(!Ul||!Ms(e))continue;const r=Ul(e);r&&js.push({id:String(e.props.id),label:r,below:t})}}const Es=fe(),Ls=Rn(null);Vn(()=>{const e=Kt.changeNotice;if(!e)return;const n=JSON.stringify(bi.filter(Ms)),t=Ls.current;if(Ls.current={doc:Yn,bands:n,index:Ht.index},!t||t.doc!==Yn||t.bands===n)return;Ht.hasPast&&Ht.index>=t.index&&!bt.has(Es)&&(bt.add(Es),Zr(e,"success",{action:{label:io.bar.undo,onClick:()=>Ht.back()},duration:8e3}))},[bi]);const As=e=>{ir(V),So.select(e.zone===Oe?{index:e.index}:{index:e.index,zone:e.zone})},Rs=q(),Fs=()=>({data:Vt.data,device:Po,ops:So,inspector:mr}),Ds=Rs?.model,Vs=Fn(()=>Ds?e=>Ds(e,vs(e),Fs()):vs,[Ds,vs,Po]),Ws=Rs?.measure,Hs=Ws?(e,n)=>Ws(e,n,Fs()):void 0,Us=Rs?.canDrop,Js=Us?(e,n)=>Us(e,n,cs,Fs()):cs,Ys=Rs?.drop,Ks=Ys?(e,n)=>Ys(e,n,gs,Fs()):gs,Xs=Rs?.pick,Gs=Xs?e=>Xs(e,As,Fs()):As,Qs=Rs?.media??null,Zs=Rn(null),_s=Fn(()=>Qs?{id:gt,zone:"",index:-1,type:Qs.adds.type,add:{kind:Qs.adds.kind,type:Qs.adds.type},media:!0}:null,[Qs]);Vn(()=>{if(!_s||jt||"undefined"==typeof document)return;const e=e=>{(e=>Array.from(e.dataTransfer?.types??[]).includes(ot))(e)&&(Zs.current=null,ys.start({key:gt,item:_s}))},n=e=>{ys.get()?.item.media&&(Zs.current=Zn(e.dataTransfer))},t=()=>{ys.get()?.item.media&&ys.end()};return document.addEventListener("dragstart",e),document.addEventListener("drop",n,!0),document.addEventListener("dragend",t,!0),()=>{document.removeEventListener("dragstart",e),document.removeEventListener("drop",n,!0),document.removeEventListener("dragend",t,!0)}},[_s,jt,ys]);const qs=()=>{const e=Zs.current;return Zs.current=null,e},ed=ce(),nd=async e=>{if(!ed)return e;const n=await ed(e);return n?{...e,id:n.id,url:n.url}:null};const td=(e,n)=>{if(!Qs)return;const t=Ln(ko.getState().appState.data,ki,n);if(!t)return;const o=t.node;So.replaceComponent(jn(t.place),t.place.index,{...o,props:{...Qs.replace(o,e),id:o.props.id}})},od=e=>{const n=jn(e),t=Di(n);t&&Ui(t.node,t.slot,!1),ml(n,e.index)},rd=(e,n)=>/* @__PURE__ */ft(Ke,{...jt?{}:bs.seam({place:{...En(e),index:n}})},`seam:${e}:${n}`),id={rowClick:bl,isCollapsed:Yr,toggleCollapse:Kr},ld=e=>{const n=String(e.props.id),t=bi.findIndex(e=>String(e.props.id)===n),o=_t(n),r=Ai(o),i=Yr(n),l=$i(e.type),s=Or.rowName?Or.rowName(e,"section",l):l,d=e=>rd(o,e);/* @__PURE__ */
|
|
16
|
-
return ht(mt,{children:[
|
|
17
|
-
/* @__PURE__ */ft(We,{words:lo,icon:/* @__PURE__ */ft(Nr,{type:e.type,size:13}),name:s,preview:kl(e),marks:Sl(e),onSelect:()=>al(t),nameSlot:Zi(Oe,t,n,s),selected:lr===n,badge:Xl(e)?void 0:_l,shared:Xl(e),actions:wl(e,Oe,t)??void 0,rowProps:{"data-node-id":n,onClick:bl(()=>al(t))},fold:{open:!i,label:"section",onToggle:()=>Kr(n)}}),!i&&/* @__PURE__ */ht(He,{children:[r.map((n,t)=>{const r=String(n.props.id),i=ji(n),l=jl(n),s=l&&Yr(r),a=()=>Ll(o,t,r,e.type),{rowProps:c,...p}=bs.row({item:{id:r,zone:o,index:t,type:n.type},place:{...En(o),index:t}},{"data-node-id":r,onClick:bl(a)});/* @__PURE__ */
|
|
18
|
-
return ht(Jn,{children:[d(t),
|
|
19
|
-
/* @__PURE__ */ft(We,{words:lo,icon:/* @__PURE__ */ft(Nr,{type:n.type,size:13}),name:i,preview:kl(n),marks:Sl(n),onSelect:a,nameSlot:Zi(o,t,r,i),selected:lr===r,hidden:Boolean(n.props._hidden),...p,fold:l?{open:!s,label:"section",onToggle:()=>Kr(r)}:void 0,actions:/* @__PURE__ */ht(mt,{children:[vl(o,t,i),wl(n,o,t),xl(o,t,n,i)]}),rowProps:c}),l&&!s&&/* @__PURE__ */ft(He,{children:ad(n,2)})]},r)}),d(r.length)]})]})},sd=(e,n,t,o,r)=>{const i=String(e.props.id),l=`${i}:${n.slot}`,s=bs.dragging,d=!Yr(l)&&s?.rung?.nodeId!==i,a={...En(l),index:0},c=s&&!s.rung&&cs(s,a)?a:void 0,p=()=>Ui(e,n,!0),{rowProps:u,...f}=bs.row({item:{id:`rung:${l}`,zone:`${i}:${Ct}`,index:t,type:e.type,rung:{nodeId:i,slot:n.slot}},place:{parentId:i,slot:Ct,index:t},into:c,canDrag:Boolean(br.moveSlot)&&!1!==n.movable&&o>1},{"data-slot-zone":l,onClick:bl(p)}),h=jt?null:br.slotActions?.(e,n.slot);/* @__PURE__ */
|
|
20
|
-
return ht(Jn,{children:[n.heading,
|
|
21
|
-
/* @__PURE__ */ft(We,{words:lo,icon:n.glyph??null,name:n.label,badge:n.badge,onSelect:p,selected:Vi===l,...f,dragHint:n.dragHint,fold:{open:d,label:n.label,onToggle:()=>Kr(l)},actions:h&&h.length>0?/* @__PURE__ */ft(mt,{children:h.map((t,o)=>/* @__PURE__ */ft(Ye,{kind:"delete"===t.kind?"delete":"plain",label:t.label,disabled:t.disabled,onClick:()=>((e,n,t)=>{if(jt||t.disabled)return;const o=String(e.props.id),r=e=>{"string"==typeof e&&Ji(o,e,n.panel)},i=t.run();i&&"function"==typeof i.then?i.then(r):r(i)})(e,n,t),children:"delete"===t.kind?/* @__PURE__ */ft(dt,{size:15}):/* @__PURE__ */ft(ut,{size:15})},`${o}:${t.kind}`))}):void 0,rowProps:u}),d&&/* @__PURE__ */ft(He,{children:r})]},l)},dd=(e,n)=>{const t=Nl(e),o=t.filter(e=>e.rung).length;let r=0;/* @__PURE__ */
|
|
22
|
-
return ft(mt,{children:t.map(t=>{const i=t.kids,l=t.rung?n+1:n,s=$l(e,void 0,t.slot),d=s?`${e.props.id}:${s.slot}`:null,a=null===t.slot?null:`${e.props.id}:${t.slot}`,c=(e,n)=>rd(e,n),p=/* @__PURE__ */ht(mt,{children:[i.map(({child:n,zone:t,index:o})=>{const r=lr===String(n.props.id),{collapsible:i,folded:s}=Ml(n,l,El(n.type)),d=String(n.props.id),a=rs(n),p=()=>Ll(t,o,d,e.type),{rowProps:u,...f}=bs.row({item:{id:d,zone:t,index:o,type:n.type},place:{...En(t),index:o}},{"data-node-id":d,onClick:bl(p)});/* @__PURE__ */
|
|
23
|
-
return ht(Jn,{children:[0===o&&c(t,0),
|
|
24
|
-
/* @__PURE__ */ft(We,{words:lo,icon:/* @__PURE__ */ft(Nr,{type:n.type,size:13}),name:a,preview:kl(n),marks:Sl(n),onSelect:p,nameSlot:Zi(t,o,d,a),selected:r,hidden:Boolean(n.props._hidden),...f,fold:i?{open:!s,label:"group",onToggle:()=>Kr(d)}:void 0,actions:/* @__PURE__ */ht(mt,{children:[vl(t,o,a),wl(n,t,o),xl(t,o,n,a)]}),rowProps:u}),i&&!s&&/* @__PURE__ */ft(He,{children:dd(n,l+1)}),c(t,o+1)]},String(n.props.id??`${t}-${o}`))}),null===a?d&&!i.some(e=>e.zone===d)?c(d,0):null:0!==i.length||!t.rung&&d!==a?null:c(a,0)]});return t.rung?sd(e,t.rung,r++,o,p):/* @__PURE__ */ft(Jn,{children:p},t.slot??"")})})},ad=(e,n)=>{const t=Sr(Vt?.data,e.type,String(e.props.id)),o=Nl(e),r=o.filter(e=>e.rung).length;let i=0;/* @__PURE__ */
|
|
25
|
-
return ft(mt,{children:o.map(o=>{const l=o.kids,s=o.rung?n+1:n,d=$l(e,t,o.slot),a=d?.spec??null,c=a&&Array.isArray(e.props[a.slot])?e.props[a.slot]:[],p=d&&d.choices?{slot:d.slot,choices:d.choices}:null,u=String(e.props.id),f=a&&!a.fixed?`${u}:${a.slot}`:null,h=p?`${u}:${p.slot}`:null,m=(e,n)=>rd(e,n),g=null===o.slot?null:`${u}:${o.slot}`,y=Boolean(a&&!a.fixed&&(null===g||g===f)),b=/* @__PURE__ */ht(mt,{children:[l.map(({child:n,zone:t,index:o})=>{const r=lr===String(n.props.id),i=Gi(n),l=String(n.props.id),{collapsible:d,folded:a}=Ml(n,s,El(n.type)),c=Ol(n.type),p=1===c.length?`${l}:${c[0]}`:null,u=p?{...En(p),index:Ai(p).length}:void 0,f=bs.dragging,h=u&&f&&cs(f,u)?u:void 0,g=()=>Ll(t,o,l,e.type),{rowProps:y,...b}=bs.row({item:{id:l,zone:t,index:o,type:n.type},place:{...En(t),index:o},into:h,canDrag:!vr(n.type,n)},{"data-node-id":l,onClick:bl(g)});/* @__PURE__ */
|
|
26
|
-
return ht(Jn,{children:[0===o&&m(t,0),
|
|
27
|
-
/* @__PURE__ */ft(We,{words:lo,icon:/* @__PURE__ */ft(Nr,{type:n.type,size:13}),name:i,preview:kl(n),marks:Sl(n),onSelect:g,nameSlot:Zi(t,o,l,i),selected:r,hidden:Boolean(n.props._hidden),...b,fold:d?{open:!a,label:"group",onToggle:()=>Kr(l)}:void 0,actions:vr(n.type,n)?wl(n,t,o)??void 0:/* @__PURE__ */ht(mt,{children:[vl(t,o,i),wl(n,t,o),xl(t,o,n,i)]}),rowProps:y}),d&&!a&&/* @__PURE__ */ft(He,{children:ad(n,s+1)}),m(t,o+1)]},String(n.props.id??`${t}-${o}`))}),y&&a&&
|
|
28
|
-
/* @__PURE__ */ft(z,{small:!0,label:a.addLabel,blocked:a.addBlocked?.(c)??null,onAdd:()=>Al(e.props.id,a.slot,a.childType,c.length,e.type)}),null===g?h&&!l.some(e=>e.zone===h)?m(h,0):null:0!==l.length||(o.rung?y:g!==h)?null:m(g,0)]});return o.rung?sd(e,o.rung,i++,r,b):/* @__PURE__ */ft(Jn,{children:b},o.slot??"")})})},cd=Zo,pd=e=>"panel"in e?{id:e.id,label:e.label,icon:e.icon,active:xo&&!cd&&yr===e.id,onSelect:()=>gi(e.id)}:e,ud=[...(gr.railLead??[]).map(pd),{id:"sections",label:io.layers,icon:/* @__PURE__ */ft(ge,{}),active:xo&&!cd&&"sections"===yr,onSelect:()=>gi("sections")},...(gr.railTrail??[]).map(pd)],fd=To?{onPress:jo}:Rt?{onPress:()=>{x(xn,{accept:"image/*",title:fo.mediaLibrary})}}:null,hd={value:ud.find(e=>!0===e.active)?.id??"",press:e=>{const n=ud.find(n=>n.id===e);n&&!n.disabled&&!0!==n.active&&n.onSelect?.()},items:ud.map(e=>({id:e.id,icon:e.icon,label:/* @__PURE__ */ft("span",{className:"sr-only",children:e.label}),tooltip:e.label,disabled:e.disabled}))},md=[...gr.railLead??[],...gr.railTrail??[]].find(e=>"panel"in e&&e.id===yr),gd=Boolean(ro?.foldable),yd=ro?.label??(Ft?io.pageSections:io.templateSections),bd=gd&&Yr(Bt),vd=/* @__PURE__ */ht(mt,{children:[bi.map((e,n)=>{if(no(e)||to(e)||Zt(e.type))return null;const t=lr===String(e.props.id),o=Boolean(e.props._hidden);Bl(e);const r=String(e.props.id),i=gr.hasOwnRows?.(e)??!1,l=jl(e)||i,s=l&&Yr(r),d=Ol(e.type),a=1===d.length?`${r}:${d[0]}`:null,c=a?{...En(a),index:Ai(a).length}:void 0,p=bs.dragging,u=c&&p&&cs(p,c)?c:void 0,{rowProps:f,...h}=bs.row({item:{id:r,zone:Oe,index:n,type:e.type},place:{...En(Oe),index:n},into:u,canDrag:!vr(e.type,e)},{"data-node-id":r,onClick:bl(()=>al(n))});/* @__PURE__ */
|
|
29
|
-
return ht(Jn,{children:[n>0&&zl(n),
|
|
30
|
-
/* @__PURE__ */ft(We,{words:lo,icon:/* @__PURE__ */ft(Nr,{type:e.type,size:13}),name:ji(e),preview:kl(e),marks:Sl(e),shared:Xl(e),onSelect:()=>al(n),nameSlot:Zi(Oe,n,r,ji(e)),selected:t,hidden:o,...h,fold:l?{open:!s,label:"section",onToggle:()=>Kr(r)}:void 0,actions:/* @__PURE__ */ht(mt,{children:[vl(Oe,n,ji(e)),wl(e,Oe,n),xl(Oe,n,e,ji(e))]}),rowProps:f}),jl(e)&&!s&&/* @__PURE__ */ht(He,{children:[ad(e,1),gr.partRows?.(e,id)]}),i&&!s&&/* @__PURE__ */ft(He,{children:gr.ownRows?.(e,n,id)})]},String(e.props.id??n))}),ns>0&&zl(ns)]}),kd=(e,n,t)=>{const o=String(e.props.id),r=Il(e).length>0||Pl(e)||Boolean(xr(e.type)),i=r&&Yr(o),l="header"===t?io.header:io.footer,s=Or.rowName?Or.rowName(e,"section",l):l;/* @__PURE__ */
|
|
31
|
-
return ht(mt,{children:[
|
|
32
|
-
/* @__PURE__ */ft(We,{words:lo,icon:/* @__PURE__ */ft(Nr,{type:t,size:13}),name:s,preview:kl(e),marks:Sl(e),badge:Xl(e)?void 0:_l,shared:Xl(e),onSelect:()=>al(n),nameSlot:Zi(Oe,n,o,s),selected:lr===String(e.props.id),fold:r?{open:!i,label:"section",onToggle:()=>Kr(o)}:void 0,actions:wl(e,Oe,n)??void 0,rowProps:{"data-node-id":o,onClick:bl(()=>al(n))}}),r&&!i&&/* @__PURE__ */ft(He,{children:dd(e,1)})]})};return(gr.wrap??(e=>e))(
|
|
33
|
-
/* @__PURE__ */ft(ee,{target:Uo,children:/* @__PURE__ */ht("div",{ref:Ho,className:"sf-editor es-editor",style:dn(Vr),onContextMenu:ol.onEditorContextMenu,...p(xn),children:[
|
|
34
|
-
/* @__PURE__ */ht(qe,{children:[
|
|
35
|
-
/* @__PURE__ */ht("div",{className:"es-cluster es-cluster--left",children:[fd?/* @__PURE__ */ft(Xn,{variant:"secondary",className:"es-barbtn",leftIcon:/* @__PURE__ */ft(ye,{}),onClick:fd.onPress,children:io.railMedia}):null,
|
|
36
|
-
/* @__PURE__ */ft(en,{label:io.bar.undo,disabled:Boolean(jt)||!Ht.hasPast,onClick:()=>Ht.back(),children:/* @__PURE__ */ft(rt,{})}),
|
|
37
|
-
/* @__PURE__ */ft(en,{label:io.bar.redo,disabled:Boolean(jt)||!Ht.hasFuture,onClick:()=>Ht.forward(),children:/* @__PURE__ */ft(it,{})})]}),
|
|
38
|
-
/* @__PURE__ */ht(nn,{children:[
|
|
39
|
-
/* @__PURE__ */ft(tn,{devices:Co,value:Po,onChange:$o}),
|
|
40
|
-
/* @__PURE__ */ft(en,{label:io.bar.refresh,tip:io.bar.refreshTip,onClick:()=>{Wo.current=(()=>{const e=Uo?.document;if(!e)return null;const n=bi.findIndex(to),t=n>=0?n:bi.length;let o=null;for(let n=0;n<t;n++){const t=bi[n]?.props?.id;if(null==t)continue;const r=$n(e,`[data-easel-block="${CSS.escape(String(t))}"]`);if(!r)continue;const i=r.getBoundingClientRect().top;i<=4&&(null===o||i>o.offset)&&(o={id:String(t),offset:i})}if(!o){const e=Ut?.props?.id??bi[0]?.props?.id;null!=e&&(o={id:String(e),offset:0})}return o})(),Vo(e=>e+1)},children:/* @__PURE__ */ft(lt,{})}),gr.barView?.()]}),
|
|
41
|
-
/* @__PURE__ */ht(nn,{kind:"right",style:{minWidth:300},children:[
|
|
42
|
-
/* @__PURE__ */ft(v,{input:Go,words:io.saveStatus}),Nn?/* @__PURE__ */ft(Nn,{}):null,gr.barLead?.(),gr.barTrail?.(),gr.mainAction||!gr.barMain?/* @__PURE__ */ft(k,{input:Go,action:_r,readOnly:Boolean(jt),saveSwitch:Lt,onToggleAutoSave:Pt,onSaveNow:Qo,bar:io.bar,words:io.saveStatus}):gr.barMain()]})]}),
|
|
43
|
-
/* @__PURE__ */ft(b,{}),
|
|
44
|
-
/* @__PURE__ */ht("div",{className:"sf-body",children:[xo?/* @__PURE__ */ht(mt,{children:[
|
|
45
|
-
/* @__PURE__ */ht("aside",{className:"es-sidepanel es-sidepanel--left sf-panel sf-panel--left","aria-label":io.leftPanel,children:[
|
|
46
|
-
/* @__PURE__ */ht("div",{className:"es-paneltabs es-paneltabs--with-hide",children:[
|
|
47
|
-
/* @__PURE__ */ft(N,{side:"left",onHide:hi}),
|
|
48
|
-
/* @__PURE__ */ft("span",{className:"es-paneltabs-divider","aria-hidden":"true"}),
|
|
49
|
-
/* @__PURE__ */ft(Gn,{variant:"underline",block:!0,"aria-label":io.bar.views,value:hd.value,onChange:hd.press,items:hd.items})]}),Zo?/* @__PURE__ */ft(C,{at:er?{label:(e=>{const n=ds(e.zone);if(n)return io.add.addingTo({name:Or.rowName?yl(n,!0):$i(n.type)});if(e.zone===Oe){const n=bi[e.index];return n&&!to(n)?io.add.addingBefore({name:yl(n,!0)}):io.add.addingAtEnd}const t=us(e.zone);return t?io.add.addingTo({name:t.parentName}):io.add.addingHere})(er),onClear:()=>nr(null)}:void 0,placeBlocks:er&&er.zone!==Oe?us(er.zone)?.choices:void 0,canTake:er?e=>{if(!er)return null;const n={...En(er.zone),index:er.index};if(hs(e,n))return null;if("shared"===e.kind&&er.zone===Oe&&!Kt.shared?.nodeOf(e.section))return io.shared.alreadyHere;const t=ds(er.zone);if(t)return io.add.notInside({name:yl(t,!0)});if(er.zone===Oe)return io.add.onlySections;const o=us(er.zone);return o?io.add.notInside({name:o.parentName}):io.add.onlySections}:void 0,onPick:er?e=>{if(!er)return;const n={...En(er.zone),index:er.index};hs(e,n)&&(ms(e,n),gl())}:void 0,itemFor:e=>({id:`new:${e.kind}:${Ot(e)}`,zone:"",index:-1,type:"template"===e.kind?e.template.node.type:"shared"===e.kind?e.section.node.type:Ot(e),add:e}),session:ys,siteWide:gr.addPanelRow?.(gl),onClose:gl,readOnly:Boolean(jt)}):md?md.panel({onHide:hi,notify:Zr}):/* @__PURE__ */ht(mt,{children:[
|
|
50
|
-
/* @__PURE__ */ft(I,{icon:/* @__PURE__ */ft(ge,{}),title:io.layers,context:ho,actions:/* @__PURE__ */ht(mt,{children:[!jt&&/* @__PURE__ */ft(on,{label:io.add.title,onClick:()=>hl(null),children:/* @__PURE__ */ft(st,{size:15})}),
|
|
51
|
-
/* @__PURE__ */ft(on,{label:os?io.expandAll:io.collapseAll,title:0===ts.length?io.nothingToFold:void 0,disabled:0===ts.length,onClick:()=>Dr(e=>{const n=new Set(ts);return os?new Set([...e].filter(e=>!n.has(e))):/* @__PURE__ */new Set([...e,...ts])}),children:/* @__PURE__ */ft(wt,{expand:os})})]})}),
|
|
52
|
-
/* @__PURE__ */ht(Ue,{className:"sf-tree sf-scroll",words:lo,children:[ql&&/* @__PURE__ */ht(mt,{children:[!Yl&&/* @__PURE__ */ft(Je,{children:io.header}),ld(ql)]}),Dt&&!(Yl&&ql)&&/* @__PURE__ */ht(mt,{children:[!Yl&&/* @__PURE__ */ft(Je,{children:io.header}),!oo&&/* @__PURE__ */ft(We,{words:lo,icon:/* @__PURE__ */ft(Nr,{type:"header",size:13}),name:io.header,badge:Zl?void 0:_l,shared:Zl,onSelect:yi,selected:rr.kind===eo?.kind,rowProps:{onClick:bl(yi)}})]}),Hl&&!(Yl&&ql)&&kd(Hl,Wl,"header"),!gd&&/* @__PURE__ */ft(Je,{children:yd}),gd?/* @__PURE__ */ht(mt,{children:[
|
|
53
|
-
/* @__PURE__ */ft(We,{words:lo,icon:null,name:yd,fold:{open:!bd,label:yd,onToggle:()=>Kr(Bt)}}),!bd&&/* @__PURE__ */ft(He,{children:vd})]}):vd,Dt&&!Yl&&/* @__PURE__ */ft(Je,{children:io.footer}),Vl&&!(Yl&&es)&&kd(Vl,Dl,"footer"),es&&ld(es),gr.treeFoot?.()]})]})]}),
|
|
54
|
-
/* @__PURE__ */ft(rn,{side:"left",width:Vr.left,min:sn.left,max:ln,defaultWidth:h.left,label:io.resizeLeftPanel,onResize:Ur})]}):/* @__PURE__ */ft(P,{side:"left",onShow:hi}),
|
|
55
|
-
/* @__PURE__ */ht("div",{ref:ei,className:"sf-center sf-scroll","data-sf-canvas-head":ii?"":void 0,style:{overflowX:pi?"auto":"hidden",overflowY:"hidden"},children:[ii&&/* @__PURE__ */ft("div",{ref:li,className:"sf-canvas-head",children:/* @__PURE__ */ft(ii,{device:Po})}),
|
|
56
|
-
/* @__PURE__ */ht("div",{className:"sf-frame-scaler",style:ui,children:[
|
|
57
|
-
/* @__PURE__ */ft("div",{className:"sf-frame "+(Po===No?"":`sf-frame--${Po}`),style:fi,children:/* @__PURE__ */ht("div",{className:"sf-preview-host",children:[
|
|
58
|
-
/* @__PURE__ */ft(De.Provider,{value:Jl,children:/* @__PURE__ */ft(Ve.Provider,{value:Ql,children:/* @__PURE__ */ft(mo,{},Do)})}),
|
|
59
|
-
/* @__PURE__ */ft(gn,{canvas:Uo,session:ys,model:Vs,measure:Hs,canDrop:Js,onDrop:Ks,choose:Os,tag:zs,onPick:Gs,dropOn:Qs?{accepts:(e,n)=>{if(!e.media||!Qs||n.item.rung)return!1;const t=Ln(Vt.data,ki,n.item.id);return null!==t&&Qs.takes(t.node)},onDrop:(e,n)=>(e=>{const n=qs();n&&Qs&&nd(n).then(n=>{n&&td(n,e.item.id)})})(n),label:()=>io.canvasReplaceImage}:void 0,onZoneAdd:od,onSeamAdd:od,zoneAddLabel:io.canvasAddBlock,words:so.canvas,readOnly:Boolean(jt),revision:Vt.data}),tr.length>0&&!Jo&&/* @__PURE__ */ft("div",{className:"sf-preview-gaps",children:tr.map(e=>
|
|
60
|
-
/* @__PURE__ */ft(yn,{index:e.index,label:io.addSectionHere,onInsert:()=>hl(e.index),className:void 0===e.height?"sf-preview-gap":"sf-preview-gap sf-preview-gap--tight",style:void 0===e.height?{top:e.top}:{top:e.top,height:e.height}},e.index))})]})}),$s?/* @__PURE__ */ft(St,{canvas:Uo,tabs:js,onSelect:Hi,onPointer:Ps}):null]})]}),zo?/* @__PURE__ */ht(mt,{children:[In?
|
|
61
|
-
/* @__PURE__ */ft("div",{className:"es-sidepanel es-sidepanel--right","data-es-host-panel":"",children:In}):/* @__PURE__ */ft(mt,{children:/* @__PURE__ */ft(u,{value:{selectChild:Ll,addChild:Al,childRowName:Gi,blockRowName:rs},children:/* @__PURE__ */ft(go,{mode:rr,onOpenWebsiteSettings:gr.openSettings??(()=>{}),onOpenSiteStyles:gr.openStyles,onOpenPageStyles:gr.openPageStyles,onSelectNode:Mr,onNotify:Zr,onHidePanel:mi,nodeActions:Ut?Be(Yt,Ut.type):Nt})})}),
|
|
62
|
-
/* @__PURE__ */ft(rn,{side:"right",width:Vr.right,min:sn.right,max:ln,defaultWidth:h.right,label:io.resizeSettingsPanel,onResize:Jr})]}):
|
|
63
|
-
/* @__PURE__ */ft(P,{side:"right",onShow:mi})]}),ol.menu,
|
|
64
|
-
/* @__PURE__ */ft(ie,{}),Oi?/* @__PURE__ */ft(yt,{name:Oi.name,onMake:e=>(async(e,n)=>{const t=bi.find(n=>String(n.props.id)===e),o=Kt.shared;if(!t||!o)return;let r;try{r=await B(Ci).create(n,t)}catch{return void Zr(io.shared.makeFailed,"error")}o.adopt(t,r),Bi(null)})(Oi.id,e),onCancel:()=>Bi(null)}):null]})}))}export{Pt as ScreenChrome};
|
package/dist/chunk-SQTVXE5D.js
DELETED
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
import{DEFAULT_DRAG_WORDS as e}from"./chunk-TQ5Y6S2X.js";import{dropEffectFor as t,scrollBoxOf as n,frameScrollBox as l,startAutoScroll as r,isNoOpDrop as a}from"./chunk-3XECMGXX.js";import{withTip as s}from"./chunk-P2VEMZH5.js";import{useCanvasLayout as o,useCanvasTyping as i,useCanvasEvent as c,CANVAS_TYPABLE_EVENT as d}from"./chunk-TOKMFZPB.js";import{framePointToHost as u,elementScale as h,related as f,WORDS_CLEAR as p,frameRectToLayer as m,clientPointToLayer as g}from"./chunk-FR7EEKFF.js";import{isRepeatCopy as b}from"./chunk-7UFKEX72.js";import{parseZoneKey as y,ROOT_ID as x}from"./chunk-EUFDQ4KL.js";import{useRef as v,useEffect as w,useState as k,useCallback as N,useMemo as D,useSyncExternalStore as A,useId as T,useLayoutEffect as M}from"react";import{Tooltip as z,IconButton as E,solidSurfaceStyle as C,Input as $,ItemCount as S}from"efficient-shell/ui";import{AddIcon as j,CloseIcon as L,SearchIcon as B}from"efficient-shell/icons/efficient";import{jsxs as K,jsx as O}from"react/jsx-runtime";function X({label:e,onInsert:t,style:n,axis:l="y",className:r,index:a}){const s=["es-canvas-insert","x"===l?"is-x":"",r??""].filter(Boolean).join(" ");/* @__PURE__ */
|
|
2
|
-
return K("div",{className:s,style:n,"data-index":a,children:[
|
|
3
|
-
/* @__PURE__ */O("span",{className:"es-canvas-insert-line","aria-hidden":"true"}),
|
|
4
|
-
/* @__PURE__ */O("span",{className:"es-canvas-insert-chip",children:/* @__PURE__ */O(z,{content:e,children:/* @__PURE__ */O(E,{variant:"ghost",size:"sm","aria-label":e,onClick:t,children:/* @__PURE__ */O(j,{})})})})]})}var F=(e,t,n)=>t>=e.left&&t<=e.left+e.width&&n>=e.top&&n<=e.top+e.height,I=e=>e.width*e.height;function q(e,t,n){return e.map((e,t)=>({s:e,at:t})).filter(({s:e})=>F(e.box,t,n)).sort((e,t)=>I(t.s.box)-I(e.s.box)||e.at-t.at).map(({s:e})=>e)}function Y(e,t,n){return q(e,t,n).at(-1)??null}function P(e,t,n){const l="x"===e.axis?t:n;let r=0;for(const t of e.children){l>("x"===e.axis?t.left+t.width/2:t.top+t.height/2)&&(r+=1)}return r}function Z(e,t){const n=e.children;if("x"===e.axis){const l=n[t-1],r=n[t],a=l&&r?(l.left+l.width+r.left)/2:l?l.left+l.width:r?r.left:e.box.left,s=r??l??e.box;return{left:a-1,top:s.top,width:2,height:s.height}}const l=n[t-1],r=n[t],a=l&&r?(l.top+l.height+r.top)/2:l?l.top+l.height:r?r.top:e.box.top;return{left:e.box.left,top:a-1,width:e.box.width,height:2}}function R(e,t,n,l,r=()=>!1,a=()=>!0){const s=e.filter(e=>F(e.box,t,n)).sort((e,t)=>I(e.box)-I(t.box));for(const e of s){const s=P(e,t,n),o={...e.list,index:s};if(r(o))return null;if(l(o))return{zone:e,to:o,line:Z(e,s)};if(!a(o))return null}return null}function H(e,t,n=12){const l=e.children;if(0===l.length)return[];const r=e.box,a="x"===e.axis,s=a?r.left:r.top,o=s+(a?r.width:r.height),i=e=>a?e.left:e.top,c=e=>a?e.left+e.width:e.top+e.height,d=[];for(let r=0;r<=l.length;r++){const u=l[r-1],h=l[r];let f,p;if(u&&h)f=c(u),p=Math.max(i(h)-f,0);else{const e=u?(c(u)+o)/2:(s+i(h))/2,t=Math.min(Math.max(e,s+n),o-n);f=u?Math.max(t,c(u)):Math.min(t,i(h)),p=0}const m=[u,h].filter(e=>Boolean(e)),g=Math.min(...m.map(e=>a?e.top:e.left)),b=Math.max(...m.map(e=>a?e.top+e.height:e.left+e.width)),y=a?{left:f,top:g,width:p,height:b-g}:{left:g,top:f,width:b-g,height:p};d.push({key:`${e.key}:+${r}`,place:{...e.list,index:r},box:y,axis:e.axis,label:t})}return d}function Q(e,t=e.key){const n=[];for(let l=1;l<e.children.length;l++){const r=e.children[l-1],a=e.children[l],s=r.top+r.height;n.push({key:`${t}:${l}`,place:{...e.list,index:l},box:{left:e.box.left,top:s,width:e.box.width,height:Math.max(a.top-s,0)}})}return n}var U={nodes:[],zones:[]},V="data-easel-dropzone",G="data-easel-block";function W(e){const t=e.getBoundingClientRect();return{left:t.left,top:t.top,width:t.width,height:t.height}}function J(e,t){if(e.length>=2){const[t,n]=e;return Math.abs(n.top-t.top)<Math.min(t.height,n.height)/2&&n.left>t.left?"x":"y"}const n=t.ownerDocument.defaultView?.getComputedStyle(t);return n&&n.display.includes("flex")&&n.flexDirection.startsWith("row")?"x":"y"}function _(e,t,n){return m(e.frame,W(n),t)}function ee(e,t){const{frame:n,document:l}=e,r=e=>m(n,W(e),t),a=[],s=[];for(const e of l.querySelectorAll(`[${V}]`)){if(b(e))continue;const t=e.getAttribute(V)??"";let n;try{n=y(t)}catch{continue}const l=[...e.querySelectorAll(`[${G}]`)].filter(t=>t.parentElement?.closest(`[${V}]`)===e&&!b(t)),o=l.map(r);s.push({key:t,list:n,box:r(e),axis:J(o,e),children:o}),l.forEach((e,t)=>{const l=e.getAttribute(G);l&&a.push({id:l,place:{...n,index:t},box:o[t]})})}return{nodes:a,zones:s}}var te="data-es-empty-cell",ne="data-easel-dropzone",le=140;var re=e=>({left:e.left,top:e.top,width:e.width,height:e.height}),ae=e=>({left:e.left+2,top:Math.max(e.top-11,0)});function se(s){const{canvas:m,session:b,readOnly:y,words:T=e.canvas}=s,E=v(s);w(()=>{E.current=s});const $=v(null),S=o(m),[j,L]=k(0),B=N(()=>L(e=>e+1),[]),[F,I]=k(U);w(()=>{const e=$.current;m&&e&&I((E.current.measure??ee)(m,e))},[m,S,s.revision,j]);const Y=s.model,P=D(()=>Y(F),[Y,F]),Z=A(b.subscribe,b.shown,b.shown),H=s.choose,Q=(e,t)=>{const n=q(P.sources,e,t);return 0===n.length?null:H?H(n):n[n.length-1]},[V,G]=k(null),[W,J]=k(null),[le,se]=k(null),oe=v(null),ie=()=>{oe.current&&clearTimeout(oe.current),oe.current=null},ce=()=>{ie(),oe.current=setTimeout(()=>{b.get()||G(null)},140)};w(()=>ie,[]);const de=v(null),ue=i(m),he=v(!1);he.current=ue;const[fe,pe]=k(null),me=v(null),ge=v(V);ge.current=V,w(()=>{ue?(pe(ge.current?.key??me.current?.id??null),ie(),G(null)):pe(null)},[ue]);const[be,ye]=k(null);c(m,d,e=>{const t=e.detail?.id??null,n=t?{id:t,words:e.detail?.words??null}:null;ye(n),n&&(me.current=n)});const xe=e=>{if(!(e&&e.isConnected&&m&&$.current))return null;const t=_(m,$.current,e);return{left:t.left-p,top:t.top-p,width:t.width+2*p,height:t.height+2*p}},ve=!be||ue||y||Z?null:xe(be.words)??F.nodes.find(e=>e.id===be.id)?.box??null;c(m,"mousemove",e=>{const t=$.current;if(!m||!t)return;const n=u(m.frame,e.clientX,e.clientY,t),l=h(t),r={x:n.x/l,y:n.y/l};if(de.current=r,E.current.readOnly||b.get()||he.current)return;ie();const a=Q(r.x,r.y);G(e=>e?.key===a?.key&&e?.box===a?.box?e:a)}),c(m,"mouseout",e=>{e.relatedTarget||(de.current=null,ce())}),c(m,"mouseover",e=>{e.relatedTarget||B()});const we=v(null),ke=N(()=>{we.current?.(),we.current=null,J(null),se(null)},[]);w(()=>b.subscribe(()=>{b.get()?B():ke()}),[b,ke,B]),w(()=>ke,[ke]),("undefined"==typeof document?w:M)(()=>{if(b.get())return;const e=de.current;G(t=>y||he.current?null:e?Q(e.x,e.y):t?P.sources.find(e=>e.key===t.key)??null:null)},[P,Z,b,y,H]);const Ne=e=>{const t=b.get(),n=$.current,l=E.current.dropOn;if(!t||!n||!l)return null;const r=g(n,e.clientX,e.clientY);de.current=r;const a=q(P.sources,r.x,r.y);for(let e=a.length-1;e>=0;e-=1)if(l.accepts(t.item,a[e]))return{h:t,source:a[e]};return null},De=e=>{const t=b.get(),n=$.current;if(!t||!n)return null;const l=g(n,e.clientX,e.clientY);de.current=l;const r=R(P.zones,l.x,l.y,e=>E.current.canDrop(t.item,e),e=>!!t.from&&a(t.from,e),e=>E.current.fallThrough?.(t.item,e,t.from)??!0);return r?{h:t,t:r}:null},Ae={onDragEnter:e=>{if(we.current)return;const t=n(e.currentTarget.parentElement?.parentElement??null),a=m?l(m.document):null,s=[];t&&s.push(r(t)),a&&m&&s.push(r(a,m.frame)),we.current=s.length?()=>s.forEach(e=>e()):null},onDragOver:e=>{const n=Ne(e);if(n)return e.preventDefault(),e.dataTransfer.dropEffect=t(e.dataTransfer.effectAllowed),J(null),void se(e=>e&&e.key===n.source.key&&e.box===n.source.box?e:n.source);se(null);const l=De(e);if(!l)return void J(null);e.preventDefault(),e.dataTransfer.dropEffect=t(e.dataTransfer.effectAllowed);const r={zoneKey:l.t.zone.key,line:l.t.line,axis:l.t.zone.axis};J(e=>e&&e.zoneKey===r.zoneKey&&e.line.left===r.line.left&&e.line.top===r.line.top?e:r)},onDragLeave:e=>{const t=e.relatedTarget;t&&e.currentTarget.contains(t)||(de.current=null,J(null),se(null))},onDrop:e=>{const t=Ne(e);if(t)return e.preventDefault(),b.end(),ke(),void E.current.dropOn.onDrop(t.h.item,t.source);const n=De(e);n&&(e.preventDefault(),b.end(),ke(),E.current.onDrop(n.h.item,n.t.to))}},Te={draggable:!y&&!!V,onMouseEnter:ie,onMouseLeave:()=>!b.get()&&ce(),onDragStart:e=>{if(V&&!y){b.start({key:V.key,item:V.item,from:V.from}),e.dataTransfer.effectAllowed="move";try{e.dataTransfer.setData("text/plain",V.key)}catch{}}else e.preventDefault()},onDragEnd:()=>{b.end(),ke()},onClick:()=>{V&&!y&&E.current.onPick?.(V.item)}},{seams:Me=[]}=P,ze=be?.words??(ue?me.current?.words??null:null),Ee=s.tag&&m&&$.current&&!Z?(ze&&f(s.tag.element,ze)?xe(ze):null)??_(m,$.current,s.tag.element):null,Ce=V?(be&&be.id===V.key?xe(be.words):null)??V.box:null,$e=ue&&fe&&!s.tag?P.sources.find(e=>e.key===fe)??null:null,Se=$e?xe(ze)??$e.box:null,je=P.zones.filter(e=>0===e.children.length),Le=!s.onZoneAdd||y||ue?[]:je,Be=Le.map(e=>e.key).join("\n");return w(()=>{const e=m?.document;if(!e)return;const t=new Set(Be?Be.split("\n"):[]);for(const n of e.querySelectorAll(`[${ne}]`))n.toggleAttribute(te,t.has(n.getAttribute(ne)??""));return()=>{for(const t of e.querySelectorAll(`[${te}]`))t.removeAttribute(te)}},[m,Be,F,S,j]),/* @__PURE__ */K("div",{ref:$,className:"es-canvas-layer",children:[Z||!s.onSeamAdd||y||ue?null:Me.map(e=>
|
|
5
|
-
/* @__PURE__ */O(X,{className:"es-canvas-seam",axis:e.axis,index:e.place.index,label:e.label??s.seamLabel??T.addSection,onInsert:()=>s.onSeamAdd?.(e.place),style:"x"===e.axis?{left:e.box.left+e.box.width/2-12,top:e.box.top,width:24,height:e.box.height}:{left:e.box.left,top:e.box.top+e.box.height/2-12,width:e.box.width,height:24}},e.key)),Le.length?Le.map(e=>/* @__PURE__ */O("button",{type:"button",className:["es-canvas-empty",e.addAlways?"is-always":"",W?.zoneKey===e.key?"is-over":""].filter(Boolean).join(" "),style:re(e.box),"data-node-id":e.list.parentId===x?void 0:e.list.parentId,onClick:()=>s.onZoneAdd?.({...e.list,index:0}),children:/* @__PURE__ */O("span",{className:"es-canvas-empty-add",children:T.addButton({label:e.addLabel??s.zoneAddLabel??T.addBlock})})},e.key)):null,Z?/* @__PURE__ */O("div",{className:"es-canvas-catch",...Ae}):null,le&&Z?/* @__PURE__ */O("div",{className:"es-canvas-target",style:re(le.box),children:s.dropOn?.label?/* @__PURE__ */O("span",{className:"es-canvas-target-label",style:C(),children:s.dropOn.label(Z.item,le)}):null}):null,W&&!je.some(e=>e.key===W.zoneKey)?/* @__PURE__ */O("div",{className:`es-canvas-line is-${W.axis}`,style:re(W.line)}):null,ve?/* @__PURE__ */O("span",{className:"es-canvas-hint"+(ve.width<200?" is-below":""),style:{...C(),left:ve.left+ve.width,top:ve.width<200?ve.top+ve.height:ve.top},children:T.typeHint}):null,Ee&&s.tag?/* @__PURE__ */O("span",{className:"es-canvas-tag",style:ae(Ee),children:s.tag.label}):$e&&Se?/* @__PURE__ */O("span",{className:"es-canvas-tag",style:ae(Se),children:$e.label}):null,
|
|
6
|
-
/* @__PURE__ */O("div",{className:"es-canvas-handle-spot",style:Ce?{"--es-handle-x":`${ae(Ce).left}px`,"--es-handle-y":`${ae(Ce).top}px`}:void 0,children:/* @__PURE__ */O(z,{className:"es-canvas-handle-tip",side:"top",content:!V||y||Z?null:V.title??T.handle({label:V.label}),children:/* @__PURE__ */K("div",{className:["es-canvas-handle",V&&!y?"is-shown":"",Z?"is-dragging":""].filter(Boolean).join(" "),...Te,children:[
|
|
7
|
-
/* @__PURE__ */O("span",{className:"es-canvas-grip","aria-hidden":"true",children:"⋮⋮"}),V?.label]})})})]})}var oe=e=>e.tiles.length>0&&e.tiles.every(e=>null!=e.cover);function ie({groups:t,session:n,itemFor:l,onInsert:r,onTileMenu:a,at:o,hint:i,searchLabel:c,readOnly:d,words:u=e.add}){const h=i??u.hint,f=c??u.search,[p,m]=k(""),g=T(),b=p.trim().toLowerCase(),y=function(e){const t=/* @__PURE__ */new Map;return e.map(e=>{const n=e.key??e.title,l=t.get(n)??0;return t.set(n,l+1),0===l?n:`${n}\0${l}`})}(t),x=t.map((e,t)=>({...e,key:y[t],tiles:b?e.tiles.filter(e=>((e,t)=>e.label.toLowerCase().includes(t)||(e.keywords??[]).some(e=>e.toLowerCase().includes(t)))(e,b)):e.tiles})).filter(e=>e.tiles.length>0),v=(e,t)=>r=>{if(t)r.preventDefault();else{n.start({key:`new:${e}`,item:l(e)}),r.dataTransfer.effectAllowed="copy";try{r.dataTransfer.setData("text/plain",e)}catch{}}};/* @__PURE__ */
|
|
8
|
-
return K("div",{className:"es-add",children:[o?/* @__PURE__ */K("div",{className:"es-add-at",role:"status",children:[
|
|
9
|
-
/* @__PURE__ */O("span",{children:o.label}),s(u.stop,/* @__PURE__ */O("button",{type:"button",className:"es-add-at-clear","aria-label":u.stop,onClick:o.onClear,children:/* @__PURE__ */O(L,{size:12,"aria-hidden":"true"})}))]}):null,
|
|
10
|
-
/* @__PURE__ */O("p",{className:"es-add-hint",children:h}),
|
|
11
|
-
/* @__PURE__ */O("div",{className:"es-add-find",children:/* @__PURE__ */O($,{id:g,type:"search","aria-label":f,placeholder:u.searchPlaceholder({label:f}),value:p,onChange:e=>m(e.target.value),leftIcon:/* @__PURE__ */O(B,{size:16,"aria-hidden":"true"}),endAction:p?{label:u.clearSearch,icon:/* @__PURE__ */O(L,{"aria-hidden":"true"}),onClick:()=>m("")}:void 0})}),0===x.length?/* @__PURE__ */K("div",{className:"es-add-empty",role:"status",children:[
|
|
12
|
-
/* @__PURE__ */O("div",{className:"es-add-empty-title",children:u.nothing({query:p.trim()})}),
|
|
13
|
-
/* @__PURE__ */O("div",{className:"es-add-empty-sub",children:u.tryAnother})]}):x.map(e=>/* @__PURE__ */K("section",{className:"es-add-group","aria-label":e.title,children:[
|
|
14
|
-
/* @__PURE__ */K("div",{className:"es-add-group-head",children:[
|
|
15
|
-
/* @__PURE__ */O("span",{className:"es-add-group-title",children:e.title}),
|
|
16
|
-
/* @__PURE__ */O(S,{count:e.tiles.length,label:u.count({count:e.tiles.length,sections:oe(e)}),className:"ml-auto"})]}),
|
|
17
|
-
/* @__PURE__ */O("div",{className:oe(e)?"es-add-grid is-cards":"es-add-grid",children:e.tiles.map(e=>{const t=Boolean(d||e.disabled),l=d?void 0:e.disabled?e.disabledReason:e.title??u.tile({label:e.label});return s(l,/* @__PURE__ */K("button",{type:"button",className:null!=e.cover?"es-add-tile has-cover":"es-add-tile",draggable:!t,"aria-disabled":t||void 0,"aria-label":u.tile({label:e.label}),onDragStart:v(e.type,t),onDragEnd:()=>n.end(),onClick:()=>!t&&r?.(e.type),onContextMenu:a?t=>{a(e.type,{x:t.clientX,y:t.clientY,owner:t.currentTarget})&&t.preventDefault()}:void 0,children:[null!=e.cover?/* @__PURE__ */O("span",{className:"es-add-tile-cover","aria-hidden":"true",children:e.cover}):e.icon?/* @__PURE__ */O("span",{className:"es-add-tile-glyph","aria-hidden":"true",children:e.icon}):null,
|
|
18
|
-
/* @__PURE__ */K("span",{className:"es-add-tile-label",children:[e.label,null!=e.mark?/* @__PURE__ */O("span",{className:"es-add-tile-mark","aria-hidden":"true",children:e.mark}):null]})]},e.type))})})]},e.key))]})}export{ie as AddPanel,se as CanvasDragLayer,X as CanvasInsert,U as EMPTY_MEASURE,le as HANDLE_GRACE_MS,R as canvasTarget,F as contains,P as gapInZone,Z as gapLine,H as insertSeams,ee as measureCanvas,Y as pickSource,Q as seamsBetween,q as sourcesAt};
|
package/dist/chunk-TOKMFZPB.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{removeCanvasStyle as e,upsertCanvasStyle as n}from"./chunk-FR7EEKFF.js";import{useState as t,useEffect as o,useRef as r}from"react";var c="[data-easel-block]",s="[data-easel-dropzone]",u="iframe#preview-frame";function i(e){const n=e.contentDocument;if(!n||!e.contentWindow||"loading"===n.readyState||!n.body)return!1;if(e.hasAttribute("srcdoc"))return"about:srcdoc"===n.URL;const t=e.getAttribute("src");return!t||"about:blank"===t||"about:blank"!==n.URL}function l(e,n,{selector:t=u,readySelector:o}={}){let r=null,c=null,s=!1,l=!1,a=null;const d=()=>{a?.observer.disconnect(),a=null},m=()=>{if(l)return;let e=null;if(r&&i(r)){const n=r.contentDocument;(e=>{if(!o||e.querySelector(o))return d(),!0;if(a?.doc!==e){d();const n=e.defaultView?.MutationObserver;if(n){const t=new n(()=>m());t.observe(e,{childList:!0,subtree:!0}),a={doc:e,observer:t}}}return!1})(n)&&(e={frame:r,document:n,window:r.contentWindow})}else d();(e===c||!!e&&!!c&&e.frame===c.frame&&e.document===c.document)&&s||(s=!0,c=e,n(c))},f=()=>m(),v=()=>{const n=e.querySelector?.(t);n!==r?(r?.removeEventListener("load",f),r=n,r?.addEventListener("load",f),m()):m()},b=e.ownerDocument?.defaultView??e.defaultView,w=b?.MutationObserver,E=w?new w(e=>(e=>null!==r&&!r.isConnected||e.some(e=>[...e.addedNodes,...e.removedNodes].some(e=>"IFRAME"===e.nodeName||!!e.querySelector?.("iframe"))))(e)&&v()):null;return E?.observe(e,{childList:!0,subtree:!0}),v(),()=>{l=!0,E?.disconnect(),d(),r?.removeEventListener("load",f),r=null}}function a(e,{selector:n,readySelector:r}={}){const[c,s]=t(null);return o(()=>{const t=e.current;if(!t)return;const o=l(t,s,{selector:n,readySelector:r});return()=>{o(),s(null)}},[e,n,r]),c}var d="easel:canvas-typing",m="easel:canvas-typable";function f(e,n,t,{on:c="document",capture:s=!1}={}){const u=r(t);u.current=t;const i=e?.document??null,l=e?.window??null;o(()=>{const e="window"===c?l:i;if(!e)return;const t=e=>u.current(e);return e.addEventListener(n,t,s),()=>e.removeEventListener(n,t,s)},[i,l,n,c,s])}function v(e){const[n,o]=t(!1);return f(e,d,e=>o(Boolean(e.detail?.typing))),n}function b(t,r,c){const s=t?.document??null;o(()=>{if(!s)return;if(!c)return void e(s,r);const t=n(s,r,c),o=s.defaultView?.MutationObserver,u=o?new o(()=>{t.isConnected||n(s,r,c)}):null;return u?.observe(s.head??s.documentElement,{childList:!0}),()=>{u?.disconnect(),e(s,r)}},[s,r,c])}function w(e,{settle:n=[150,450]}={}){const[r,c]=t(0),s=e?.frame??null,u=e?.document??null,i=e?.window??null,l=n.join(",");return o(()=>{if(!s||!u||!i)return;const e=s.ownerDocument.defaultView;let t=!1,o=0;const r=()=>{if(t)return;t=!0;const n=()=>{t=!1,c(e=>e+1)};e?.requestAnimationFrame?o=e.requestAnimationFrame(n):n()},l=[],a=(e,n)=>{e.addEventListener(n,r,!0),l.push(()=>e.removeEventListener(n,r,!0))};a(u,"scroll"),a(i,"resize"),e&&(a(e,"scroll"),a(e,"resize"));const d=e?.ResizeObserver;if(d){const e=new d(r);e.observe(s),u.documentElement&&e.observe(u.documentElement),l.push(()=>e.disconnect())}const m=u.defaultView?.MutationObserver,f=u.body??u.documentElement;if(m&&f){const e=new m(r);e.observe(u===s.ownerDocument?s:f,{childList:!0,subtree:!0}),l.push(()=>e.disconnect())}const v=u.fonts;v&&a(v,"loadingdone");const b=n.map(e=>setTimeout(r,e));return r(),()=>{for(const e of l)e();for(const e of b)clearTimeout(e);o&&e?.cancelAnimationFrame&&e.cancelAnimationFrame(o)}},[s,u,i,l]),r}export{c as BLOCK_SELECTOR,u as CANVAS_SELECTOR,m as CANVAS_TYPABLE_EVENT,d as CANVAS_TYPING_EVENT,s as LIST_SELECTOR,i as isFrameReady,f as useCanvasEvent,a as useCanvasFrame,w as useCanvasLayout,b as useCanvasStyle,v as useCanvasTyping,l as watchCanvasFrame};
|
|
@@ -1,57 +0,0 @@
|
|
|
1
|
-
import { a as DataConfig } from './types-Dq180WRV.js';
|
|
2
|
-
|
|
3
|
-
/**
|
|
4
|
-
* A BLOCK'S `resolveData`, RUN AS THE OLD LIBRARY RAN IT — `resolveComponentData` in the old library
|
|
5
|
-
* 0.20 (`lib/resolve-component-data.ts`), because the documents both editors
|
|
6
|
-
* hold were resolved by it and must go on resolving the same way.
|
|
7
|
-
*
|
|
8
|
-
* - It runs only when the item differs from the last one resolved for that id
|
|
9
|
-
* (deep-equal), unless the trigger is "force"; the last answer is reused.
|
|
10
|
-
* - `changed` names every prop of the new item with whether it differs from
|
|
11
|
-
* the last one resolved (`changedProps`, the old library's `getChanged`).
|
|
12
|
-
* - The block's own `metadata` is spread over the host's.
|
|
13
|
-
* - The answer's `props` are spread OVER the item's, and its `readOnly` kept
|
|
14
|
-
* when it has any key.
|
|
15
|
-
* - Then every slot's children are resolved the same way, in order.
|
|
16
|
-
*
|
|
17
|
-
* What differs from the old library is only where the memory lives: the old library kept the last
|
|
18
|
-
* change per id in a module-level object shared by every editor on the page;
|
|
19
|
-
* here the host hands in its own (`createResolveCache`), one per editor.
|
|
20
|
-
*
|
|
21
|
-
* Pure apart from the resolvers it calls: no React, no browser global.
|
|
22
|
-
*/
|
|
23
|
-
type ResolveTrigger = 'insert' | 'replace' | 'load' | 'force' | 'move';
|
|
24
|
-
/** An item to resolve: a node, or the root (`{ props }`, no type). */
|
|
25
|
-
interface ResolvableItem {
|
|
26
|
-
type?: string;
|
|
27
|
-
props: Record<string, unknown>;
|
|
28
|
-
readOnly?: Record<string, boolean>;
|
|
29
|
-
}
|
|
30
|
-
interface ResolveCache {
|
|
31
|
-
lastChange: Record<string, {
|
|
32
|
-
item: ResolvableItem;
|
|
33
|
-
resolved: ResolvableItem;
|
|
34
|
-
}>;
|
|
35
|
-
}
|
|
36
|
-
declare const createResolveCache: () => ResolveCache;
|
|
37
|
-
interface ResolveOptions {
|
|
38
|
-
metadata?: Record<string, unknown>;
|
|
39
|
-
trigger?: ResolveTrigger;
|
|
40
|
-
cache?: ResolveCache;
|
|
41
|
-
onResolveStart?: (item: ResolvableItem) => void;
|
|
42
|
-
onResolveEnd?: (item: ResolvableItem) => void;
|
|
43
|
-
}
|
|
44
|
-
/** Deep equality of JSON-shaped values, as `fast-deep-equal` answers it for them. */
|
|
45
|
-
declare function deepEqual(a: unknown, b: unknown): boolean;
|
|
46
|
-
/** Every prop of `next`, and whether it differs from `last` (the old library's `getChanged`). */
|
|
47
|
-
declare function changedProps(next: ResolvableItem | null | undefined, last: ResolvableItem | null | undefined): Record<string, boolean>;
|
|
48
|
-
/**
|
|
49
|
-
* Resolve one item and everything in its slots. `didChange` says whether the
|
|
50
|
-
* answer differs from the item handed in.
|
|
51
|
-
*/
|
|
52
|
-
declare function resolveNodeData<T extends ResolvableItem>(item: T, config: DataConfig, options?: ResolveOptions): Promise<{
|
|
53
|
-
node: T;
|
|
54
|
-
didChange: boolean;
|
|
55
|
-
}>;
|
|
56
|
-
|
|
57
|
-
export { type ResolvableItem as R, type ResolveCache as a, type ResolveOptions as b, type ResolveTrigger as c, changedProps as d, createResolveCache as e, deepEqual as f, resolveNodeData as r };
|