efficient-easel 26.2.0 → 26.3.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/README.md +17 -3
- package/dist/{chunk-I3KB7LH7.js → chunk-2C2IUWBH.js} +4 -4
- package/dist/chunk-6F6OAL3C.js +13 -0
- package/dist/chunk-BTQ3FJKT.js +1 -0
- package/dist/chunk-C4HXU4HJ.js +1 -0
- package/dist/{chunk-R76XMEKT.js → chunk-C7IFWSUA.js} +6 -6
- package/dist/chunk-FWPKYUGM.js +5 -0
- package/dist/chunk-JQQFB7EZ.js +1 -0
- package/dist/{chunk-2S7PJZWH.js → chunk-LKP5V3GT.js} +1 -1
- package/dist/{chunk-FYV6GZXP.js → chunk-OKJ6KH24.js} +1 -1
- package/dist/{chunk-YDJZX2XS.js → chunk-R76RCEEC.js} +1 -1
- package/dist/chunk-RKLDSLU6.js +4 -0
- package/dist/{chunk-MBEUSPIN.js → chunk-SQTVXE5D.js} +4 -4
- package/dist/{chunk-CP6KQP5A.js → chunk-STQDOTHF.js} +1 -1
- package/dist/{chunk-LDXYMHYW.js → chunk-UQAN4BIP.js} +1 -1
- package/dist/{chunk-ZIEINXSZ.js → chunk-XC4PINYS.js} +7 -7
- package/dist/{chunk-IHXQZDDW.js → chunk-XVQNVPIK.js} +39 -39
- package/dist/{chunk-WQXAAVCE.js → chunk-Y5M64LEB.js} +1 -1
- package/dist/chunk-YAFMYW4J.js +16 -0
- package/dist/drag/index.js +1 -1
- package/dist/draw/index.d.ts +1 -0
- package/dist/draw/index.js +1 -1
- package/dist/easel/index.d.ts +16 -1
- package/dist/easel/index.js +1 -1
- package/dist/fields/index.d.ts +5 -1
- package/dist/fields/index.js +1 -1
- package/dist/screen/components/AddBlockRow.js +1 -1
- package/dist/screen/components/AddSidePanel.js +1 -1
- package/dist/screen/components/NodeContextMenu.js +1 -1
- package/dist/screen/components/ScreenChrome.js +1 -1
- package/dist/screen/components/ScreenMount.js +1 -1
- package/dist/screen/components/ScreenStoreProvider.js +1 -1
- package/dist/screen/components/SectionScreenShell.js +15 -15
- package/dist/screen/components/usePartBridge.js +1 -1
- package/dist/screen/index.js +1 -1
- package/dist/screen/lib/content/style-keys.d.ts +35 -0
- package/dist/screen/lib/content/style-keys.js +1 -0
- package/dist/screen/lib/document/block-set-host.js +1 -1
- package/dist/screen/lib/document/block-size-fields.js +1 -1
- package/dist/screen/lib/document/box-fields.d.ts +9 -0
- package/dist/screen/lib/document/box-fields.js +1 -1
- package/dist/screen/lib/document/button-fields.d.ts +6 -18
- package/dist/screen/lib/document/button-fields.js +1 -1
- package/dist/screen/lib/document/image-fields.js +4 -4
- package/dist/screen/lib/document/style-fields.d.ts +3 -3
- package/dist/screen/lib/document/style-fields.js +1 -1
- package/dist/screen/lib/document/use-section-ops.js +1 -1
- package/dist/screen/lib/key-scope.js +1 -1
- package/dist/screen/lib/screen-parts.js +1 -1
- package/package.json +7 -1
- package/dist/chunk-53ME3GAI.js +0 -16
- package/dist/chunk-FIH23CB7.js +0 -1
- package/dist/chunk-FT3O7X6U.js +0 -5
- package/dist/chunk-LUG22U5L.js +0 -1
- package/dist/chunk-M5IKANJ5.js +0 -13
- package/dist/chunk-ZJRMB5KN.js +0 -4
package/dist/chunk-53ME3GAI.js
DELETED
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
import{findCopy as e,repeatCopyWithWrapper as t}from"./chunk-LUG22U5L.js";import{DEFAULT_CANVAS_WORDS as n}from"./chunk-TBY3DFKS.js";import{useResolvedFields as o}from"./chunk-K53PQAMP.js";import{toItemSelector as r,fromItemSelector as l,useNodeOps as i,parentStep as s,clickPickPart as a,clickPick as c}from"./chunk-QTHQPJWA.js";import{selectionBox as u,placeWindow as d,offsetOrigin as p,colorRunOf as f,ColorWindow as h,startCanvasTyping as m,textMap as g,richLayout as v}from"./chunk-HZSZT3BE.js";import{DEFAULT_COPY_WORDS as y}from"./chunk-PMRN5Z3T.js";import{useWords as w}from"./chunk-MFIRYGHW.js";import{find as b,ROOT_ID as k,getList as S,remove as C,parseZoneKey as E,move as x,duplicate as I,replaceNode as D,createNode as A,insert as O,normalizeData as M,createResolveCache as $,slotsOf as P,resolveNodeData as R,ROOT_SLOT as z}from"./chunk-EUFDQ4KL.js";import{topLevelSlotKeys as L,fieldsFrom as N,drawnBlockCount as j,defaultsFrom as V}from"./chunk-KXM6YRG2.js";import{CANVAS_TYPABLE_EVENT as K,CANVAS_TYPING_EVENT as B}from"./chunk-TOKMFZPB.js";import{setCanvasNonce as T,related as Z,isTypingTarget as F,upsertCanvasStyle as H,removeCanvasStyle as W,WORDS_CLEAR as q,frameRectToHost as U,drawnBox as Y}from"./chunk-FR7EEKFF.js";import{queryAllCopies as Q}from"./chunk-7UFKEX72.js";import{createContext as G,useEffect as X,useContext as J,useRef as _,useSyncExternalStore as ee,useState as te,useReducer as ne,useMemo as oe,useCallback as re,useLayoutEffect as le}from"react";import{jsx as ie,jsxs as se,Fragment as ae}from"react/jsx-runtime";import{createPortal as ce}from"react-dom";import{registerModalEscapeInterceptor as ue,FloatingBar as de,TextToolbar as pe,LinkPicker as fe}from"efficient-shell/ui";function he(e){return!["setData","setUi","set"].includes(e.type)}var me=(e,t,n,o)=>{const r=S(e,t,E(n));return r?.[o]??null},ge=(e,t,n,o,r)=>{const l=me(e,t,n,o);if(!l)throw new Error(`${r}: nothing at ${n}[${o}]`);return l};function ve(e,t){const{selection:n}=e;return{...e.ui,itemSelector:r(e.data,t,n),selectedSlot:n&&"slot"===n.kind?{parentId:n.parentId,slot:n.slot}:null}}function ye(e,t,n){return n?"node"===n.kind?b(e,t,n.id)?n:null:n.parentId===k?S(e,t,n)?n:null:b(e,t,n.parentId)&&S(e,t,n)?n:null:null}function we(e,t,n,o=!1){const{itemSelector:r,selectedSlot:i,...s}=n;let a=e.selection;var c;return"itemSelector"in n&&(a=l(e.data,t,r??null)),"selectedSlot"in n&&(i?a=(c=i)?{kind:"slot",parentId:c.parentId,slot:c.slot}:null:"slot"===a?.kind&&(a=null)),{...e,selection:a,ui:o?s:{...e.ui,...s}}}function be(e,t,n){const o=ke(e,t,n);if(o===e)return e;const r=ye(o.data,n,o.selection);return r===o.selection?o:{...o,selection:r}}function ke(e,t,n){const{data:o}=e;switch(t.type){case"setData":{const n="function"==typeof t.data?t.data(o):t.data;return{...e,data:{...o,...n}}}case"setUi":return we(e,n,"function"==typeof t.ui?t.ui(ve(e,n)):t.ui);case"set":{const r={data:o,ui:ve(e,n)},l="function"==typeof t.state?t.state(r):t.state;let i=l.data?{...e,data:l.data}:e;return l.ui&&(i=we(i,n,l.ui,!0)),i}case"insert":{const r={...E(t.destinationZone),index:t.destinationIndex},l=A(n,t.componentType,{},t.id?{id:t.id}:{});return{...e,data:O(o,n,r,l)}}case"replace":{const r=ge(o,n,t.destinationZone,t.destinationIndex,"replace");if(r.props.id!==t.data.props.id)throw new Error("Can't change the id during a replace action. Use remove and insert for a new node.");return{...e,data:D(o,n,r.props.id,t.data)}}case"replaceRoot":{const n={...o.root,props:{...o.root.props,...t.root.props},readOnly:t.root.readOnly};return{...e,data:{...o,root:n}}}case"duplicate":{const r=ge(o,n,t.sourceZone,t.sourceIndex,"duplicate"),l=I(o,n,r.props.id),i=me(l,n,t.sourceZone,t.sourceIndex+1);return{...e,data:l,selection:i?{kind:"node",id:i.props.id}:e.selection}}case"reorder":return ke(e,{...t,type:"move",sourceZone:t.destinationZone},n);case"move":{if(t.sourceZone===t.destinationZone&&t.sourceIndex===t.destinationIndex)return e;const r=me(o,n,t.sourceZone,t.sourceIndex);if(!r)return e;const l={...E(t.destinationZone),index:t.destinationIndex};return{...e,data:x(o,n,r.props.id,l)}}case"remove":{const r=ge(o,n,t.zone,t.index,"remove");return{...e,data:C(o,n,r.props.id)}}default:return e}}var Se={drag:!0,duplicate:!0,delete:!0,edit:!0,insert:!0},Ce={leftSideBarVisible:!0,rightSideBarVisible:!0,arrayState:{},componentList:{},isDragging:!1,previewMode:"edit",viewports:{current:{width:360,height:"auto"},options:[],controlsVisible:!0},field:{focus:null}},Ee=0,xe=()=>`history-${Ee+=1}`;function Ie(e){let t=e.config;const n=e.now??(()=>Date.now()),o=e.historyCoalesceMs??250;let i=e.permissions??{};const s=M(e.data,t);let a=s,c={data:s,selection:null,ui:{...Ce}};if(e.ui){const{itemSelector:n,selectedSlot:o,...r}=e.ui;c={data:s,selection:o?{kind:"slot",...o}:l(s,t,n??null),ui:{...Ce,...r}}}let u=[{core:c,at:-1/0,sealed:!0,id:xe()}],d=0;const p=e=>{const t=u[d],r=n();!e&&d===u.length-1&&d>0&&!t.sealed&&r-t.at<o?u=[...u.slice(0,d),{...t,core:c,at:r}]:(u=[...u.slice(0,d+1),{core:c,at:r,sealed:e,id:xe()}],d=u.length-1)},f=/* @__PURE__ */new Set;let h=null,m=null,g=0,v=null,y=!1;const w=()=>{for(const e of[...f])e()},k=()=>{u=[...u.slice(0,d),{...u[d],core:c},...u.slice(d+1)]},C=(t,n)=>{g>0?y=y||n:(n?p(!1):c!==t&&k(),c.data!==t.data&&e.onChange?.(c.data),c!==t&&w())},E=e=>{const n=c;if(c=be(c,e,t),c===n)return;const o=e.recordHistory??he(e);C(n,o&&c.data!==n.data)},x=t=>{0===g&&(v=c,y=!1),g+=1;try{t()}catch(e){throw g-=1,0===g&&v&&(c=v,v=null),e}if(g-=1,g>0||!v)return;const n=v;v=null,y&&c.data!==n.data?p(!0):c!==n&&k(),c.data!==n.data&&e.onChange?.(c.data),c!==n&&w()},I=e=>{const n=c,o=ye(c.data,t,e);var r,l;(r=o,l=c.selection,r===l||r&&l&&r.kind===l.kind&&("node"===r.kind&&"node"===l.kind?r.id===l.id:"slot"===r.kind&&"slot"===l.kind&&r.parentId===l.parentId&&r.slot===l.slot))||(c={...c,selection:o},C(n,!1))},A=t=>{const n=c;d=t,c=u[d].core,c.data!==n.data&&e.onChange?.(c.data),c!==n&&w()},O=()=>(e={})=>{const n=e.root?t.root?.permissions:t.components[e.item?.type??e.type??""]?.permissions;return{...Se,...i,...n}};let P=O();const z=$(),L={resolveCache:z,async resolveAll({trigger:e="load",metadata:n}={}){const o=c.data,r={type:"root",props:{...o.root.props??{}}},l=[...o.content,...Object.values(o.zones??{}).flat()],[i,...s]=await Promise.all([R(r,t,{cache:z,trigger:e,metadata:n}),...l.map(o=>R(o,t,{cache:z,trigger:e,metadata:n}))]);x(()=>{const n=c;let r=c.data;s.forEach((e,n)=>{if(!e.didChange)return;const i=l[n].props.id,s=b(r,t,i)?.node;s&&s===b(o,t,i)?.node&&(r=D(r,t,i,e.node))}),i.didChange&&r.root===o.root&&(r={...r,root:{...r.root,props:i.node.props,readOnly:i.node.readOnly??r.root.readOnly}}),r!==c.data&&("load"===e&&c.data===a&&(a=r),c={...c,data:r,selection:ye(r,t,c.selection)},C(n,!1))})},async resolveNode(e,{trigger:n="replace",metadata:o}={}){const r=b(c.data,t,e)?.node;if(!r)return!1;const l=await R(r,t,{cache:z,trigger:n,metadata:o});if(!l.didChange)return!1;let i=!1;return x(()=>{const n=c;if(b(c.data,t,e)?.node!==r)return;const o=D(c.data,t,e,l.node);o!==c.data&&(c={...c,data:o,selection:ye(o,t,c.selection)},C(n,!1),i=!0)}),i},get config(){return t},get loaded(){return a},getState(){if(h&&m===c)return h;const e=c,n={data:e.data,ui:ve(e,t)},o="node"===e.selection?.kind?b(e.data,t,e.selection.id)?.node??null:null;return h={appState:n,selection:e.selection,selectedItem:o,config:t,dispatch:E,history:{back:()=>L.undo(),forward:()=>L.redo(),hasPast:d>0,hasFuture:d<u.length-1,histories:u.map(e=>({id:e.id,state:{data:e.core.data,ui:ve(e.core,t)}})),index:d,setHistoryIndex:e=>{e>=0&&e<u.length&&e!==d&&A(e)}},getPermissions:P,getItemById:n=>b(e.data,t,n)?.node,getItemBySelector:n=>function(e,t,n){const[o,r]=(n.zone??"root:default-zone").split(/:(.*)/s);return S(e,t,{parentId:o,slot:r})?.[n.index]}(e.data,t,n),getSelectorForId:n=>{const o=r(e.data,t,{kind:"node",id:n});return o?{index:o.index,zone:o.zone??"root:default-zone"}:void 0}},m=e,h},subscribe:e=>(f.add(e),()=>{f.delete(e)}),dispatch:E,batch:x,group:()=>{const e=d,t=u[e].id;let n=!0;return{close:()=>{if(!n)return;if(n=!1,u[e]?.id!==t)return;if(d<=e+1)return void(d===e+1&&(u=[...u.slice(0,d),{...u[d],sealed:!0},...u.slice(d+1)]));const o=u[d];u=[...u.slice(0,e+1),{...o,sealed:!0},...u.slice(d+1)],d=e+1}}},select:e=>I(e?{kind:"node",id:e}:null),selectSlot:e=>I(e?{kind:"slot",parentId:e.parentId,slot:e.slot}:null),run(e){x(()=>{const n=c,o=void 0===e.select?c.selection:e.select;c={...c,data:e.data,selection:ye(e.data,t,o)},C(n,e.data!==n.data)})},load(e,n={}){const o=c,r=M(e,t);c={...c,data:r,selection:ye(r,t,n.selection??c.selection)},a=r,n.keepHistory||(u=[{core:c,at:-1/0,sealed:!0,id:xe()}],d=0),c!==o&&w()},undo(){d>0&&A(d-1)},redo(){d<u.length-1&&A(d+1)},setPermissions(e){(function(e,t){if(e===t)return!0;const n=Object.keys(e);return n.length===Object.keys(t).length&&n.every(n=>e[n]===t[n])})(e,i)||(i=e,P=O(),h=null,w())},setConfig(e){e!==t&&(t=e,P=O(),h=null,w())}};return L}function De(e,t,n={}){const o=e=>{if(e.altKey)return;if(!(e.metaKey!==e.ctrlKey))return;const o="KeyZ"===e.code,r="KeyY"===e.code&&!e.shiftKey;(o||r)&&(n.leaveTyping&&F(e.target)||!1!==t.getState?.().getPermissions().edit&&(e.preventDefault(),r||e.shiftKey?t.redo():t.undo()))};return e.addEventListener("keydown",o),()=>e.removeEventListener("keydown",o)}var Ae=G(null),Oe=G(!0);function Me({easel:e,hotkeys:t=!0,resolveOnMount:n=!0,children:o}){return X(()=>{n&&e.resolveAll()},[e,n]),X(()=>{if(t&&"undefined"!=typeof document)return De(document,e)},[e,t]),/* @__PURE__ */ie(Ae.Provider,{value:e,children:/* @__PURE__ */ie(Oe.Provider,{value:t,children:o})})}function $e(){const e=J(Ae);if(!e)throw new Error("useEasel: no <EaselProvider> above this component");return e}function Pe(e){const t=$e(),n=_({view:null,selector:null,value:void 0,has:!1}),o=()=>{const o=t.getState(),r=n.current;if(r.has&&r.view===o&&r.selector===e)return r.value;const l=e(o);return r.has&&Object.is(r.value,l)?(n.current={view:o,selector:e,value:r.value,has:!0},r.value):(n.current={view:o,selector:e,value:l,has:!0},l)};return ee(t.subscribe,o,o)}function Re(){return function(e){return Pe(e)}}var ze=["--es-accent","--es-accent-tint","--es-accent-tint-strong","--es-accent-line","--es-accent-text","--es-accent-ring","--es-accent-shadow","--es-on-accent","--status-success-solid","--elevation-panel"],Le="host-tokens";function Ne(e,t){const n=function(e){const t=e.ownerDocument.defaultView;if(!t)return"";const n=t.getComputedStyle(e),o=[];for(const e of ze){const t=n.getPropertyValue(e).trim();t&&o.push(`${e}: ${t};`)}return o.length?`:root { ${o.join(" ")} }`:""}(e);n?H(t,Le,n):W(t,Le)}var je="data-easel-block",Ve="data-easel-dropzone",Ke={},Be="data-es-mirror",Te="undefined"==typeof window?X:le;function Ze(e,t,n){for(const e of Array.from(t.head.querySelectorAll(`[${Be}]`)))e.remove();for(const o of Array.from(e.head.querySelectorAll('style, link[rel="stylesheet"]'))){const e=o.cloneNode(!0);e.setAttribute(Be,""),n&&e.setAttribute("nonce",n),t.head.appendChild(e)}}function Fe({children:e,id:t="preview-frame",title:o,className:r,style:l,mirrorStyles:i=!0,onDocument:s,height:a="auto",nonce:c}){const u=w("canvas",n),d=_(null),[p,f]=te(null);return Te(()=>{const e=d.current,t=p?.ownerDocument.defaultView;if("auto"!==a||!e||!p||!t)return;const n=()=>{e.style.height=`${Math.ceil(p.getBoundingClientRect().height)}px`};n();const o=t.ResizeObserver,r=o?new o(n):null;return r?.observe(p),()=>r?.disconnect()},[p,a]),Te(()=>{let e=d.current?.contentDocument;if(!e)return;"CSS1Compat"!==e.compatMode&&(e.open(),e.write("<!DOCTYPE html><html><head></head><body></body></html>"),e.close(),e=d.current?.contentDocument??e),e.body||e.documentElement.appendChild(e.createElement("body")),e.body.style.margin="0";const t=e.createElement("div");t.setAttribute("data-easel-entry",""),t.id="frame-root","fill"===a&&t.classList.add("es-frame-fill"),e.body.appendChild(t),T(e,c),f(t),s?.(e);let n=null;const o=d.current?.ownerDocument;if(i&&o){Ze(o,e,c);const t=o.defaultView;t&&"MutationObserver"in t&&(n=new t.MutationObserver(()=>Ze(o,e,c)),n.observe(o.head,{childList:!0,subtree:!0,characterData:!0}))}let r=null;const l=d.current;if(l&&o){Ne(l,e);const t=o.defaultView;if(t&&"MutationObserver"in t){r=new t.MutationObserver(()=>Ne(l,e)),r.observe(o.head,{childList:!0,subtree:!0,characterData:!0});const n={attributes:!0,attributeFilter:["class","style","data-theme"]};for(const e of[o.documentElement,o.body,l.closest(".es-editor")])e&&r.observe(e,n)}}return()=>{n?.disconnect(),r?.disconnect(),t.remove(),f(null),s?.(null)}},[]),/* @__PURE__ */ie("iframe",{ref:d,id:t,title:o??u.frame,className:["es-canvas-frame","fill"===a?"is-fill":"",r??""].filter(Boolean).join(" "),style:l,children:p?ce(e,p):null})}var He=G(null),We=G(Ke),qe=[];function Ue({parentId:e,slot:t,className:n,style:o,minEmptyHeight:r=128,minEmptyWidth:l=120}){const i=$e(),s=Pe(n=>S(n.appState.data,i.config,{parentId:e,slot:t})??qe),a=Pe(t=>"node"===t.selection?.kind&&t.selection.id===e&&e!==k),c=Pe(n=>"slot"===n.selection?.kind&&n.selection.parentId===e&&n.selection.slot===t),u=J(He),d=["es-zone"];return s.length&&d.push("has-children"),e===k&&d.push("is-root"),(a||c)&&d.push("is-area-selected"),null!==u&&u===e&&e!==k&&d.push("is-hovering-area"),n&&d.push(n),/* @__PURE__ */ie("div",{className:d.join(" "),[Ve]:`${e}:${t}`,style:{...o,"--min-empty-height":`${r}px`,"--min-empty-width":`${l}px`},children:s.map(e=>/* @__PURE__ */ie(tt,{node:e},e.props.id))})}function Ye(e,t,n,o){const r=oe(()=>{const n={};for(const o of L(N(e)))n[o]=Object.assign(function(e={}){/* @__PURE__ */
|
|
2
|
-
return ie(Ue,{parentId:t,slot:o,...e})},{blockCount:0});return n},[e,t]);for(const e of Object.keys(r))r[e].blockCount=j(n[e],o);return r}function Qe(e){return oe(()=>function({zone:t,...n}){/* @__PURE__ */
|
|
3
|
-
return ie(Ue,{parentId:e,slot:t,...n})},[e])}var Ge=["top","bottom","zIndex"];function Xe(e,t,n){e.style[t]!==n&&(e.style[t]=n)}function Je(e){const t=function(e){const t=e?.ownerDocument.defaultView?.getComputedStyle(e);if(!t||"sticky"!==t.position)return null;const n=e=>"auto"===e?"":e;return{top:n(t.top),bottom:n(t.bottom),zIndex:n(t.zIndex)}}(function(e){const t=e.ownerDocument.defaultView;let n=null;for(const o of Array.from(e.children))if("none"!==t?.getComputedStyle(o).display){if(n)return null;n=o}return n}(e));Xe(e,"position",t?"sticky":"relative");for(const n of Ge)Xe(e,n,t?.[n]??"");return!!t}var _e="data-es-canvas-relative";function et(e){e.hasAttribute(_e)&&("relative"===e.style.position&&(e.style.position=""),e.removeAttribute(_e));const t=e.ownerDocument.defaultView?.getComputedStyle(e).position;return t&&"static"!==t?"sticky"===t:(e.style.position||(e.style.position="relative",e.setAttribute(_e,"")),!1)}function tt({node:e}){const t=$e().config,n=t.components[e.type],o=e.props.id,r=_(null),l=function(e,t){return oe(()=>n=>{const o=t.current;o&&o!==n&&(o.removeAttribute(je),o.removeAttribute("data-easel-dnd")),t.current=n,n&&(n.setAttribute(je,e),n.setAttribute("data-easel-dnd",e),et(n))},[e,t])}(o,r),i=_(null),s=!!n?.inline;!function(e,t){const n=_(!1),o=_(()=>{});o.current=()=>{const o=e(),l=n.current;n.current=!!o&&t(o),l!==n.current&&r.current()};const r=_(()=>{});Te(()=>o.current()),Te(()=>{const t=e(),l=t?.ownerDocument.defaultView;if(!t||!l)return;const i=()=>o.current();l.addEventListener("resize",i);const s=l.ResizeObserver,a=s?new s(i):null;a?.observe(t);let c=null;return r.current=()=>{c?.disconnect(),c=null;const e=t.ownerDocument.documentElement;n.current&&e&&l.MutationObserver&&(c=new l.MutationObserver(i),c.observe(e,{attributes:!0}))},r.current(),()=>{l.removeEventListener("resize",i),a?.disconnect(),c?.disconnect(),r.current=()=>{}}},[])}(()=>s?r.current:i.current,e=>s?et(e):Je(e));const a=J(We),c=Ye(n,o,e.props,t.components),u=Qe(o);if(!n?.render)return null;const d=n.render,p={...V(n),...e.props,...c},f={renderDropZone:u,isEditing:!0,dragRef:n.inline?l:null,metadata:{...a,...n.metadata}};return n.inline?/* @__PURE__ */ie(d,{...p,editor:f,editMode:!0}):
|
|
4
|
-
/* @__PURE__ */ie("div",{ref:i,[je]:o,"data-easel-dnd":o,style:{position:"relative"},children:/* @__PURE__ */ie(d,{...p,editor:f,editMode:!0})})}function nt({metadata:e}){const t=Pe(e=>e.config),n=Pe(e=>e.appState.data.root).props??{},o=t.root?.render,r=Ye(t.root,k,n,t.components),l=Qe(k),i=/* @__PURE__ */ie(Ue,{parentId:k,slot:z}),s=o?/* @__PURE__ */ie(o,{id:"page-root",...n,...r,editor:{renderDropZone:l,isEditing:!0,dragRef:null,metadata:e??{}},editMode:!0,children:i}):i;/* @__PURE__ */
|
|
5
|
-
return ie(We.Provider,{value:e??Ke,children:s})}var ot=G(void 0),rt=G(void 0);function lt(e,t,n,o){const r=b(e,t,n);return!!r&&(P(r.node,t).length>0||!1===o.whole)}var it=G(void 0),st="data-es-chrome",at=G(void 0);function ct(e){const t=e?.closest?.(`[${st}]`)??null,n=t?.getAttribute(st);return t&&n?{id:n,element:t}:null}function ut({element:e}){const t=_(null),n=ft(t,e?()=>e:null,e);/* @__PURE__ */
|
|
6
|
-
return ie("div",{ref:t,"aria-hidden":"true",className:"es-canvas-outline is-hover is-hover-part",style:n?{position:"absolute",top:n.top,left:n.left,width:n.width,height:n.height}:{display:"none"}})}var dt={"--es-words-clear":`${q}px`};function pt({element:e,words:t=!1}){const n=_(null),o=ft(n,e?()=>e:null,e);/* @__PURE__ */
|
|
7
|
-
return ie("div",{ref:n,"aria-hidden":"true",className:"es-canvas-outline is-selected is-selected-part"+(t?" is-words":""),style:o?{position:"absolute",top:o.top,left:o.left,width:o.width,height:o.height,...dt}:{display:"none"}})}function ft(e,t,n){return mt(e,t?e=>{const n=t(e);return n?[n]:[]}:null,n)[0]??null}var ht=[];function mt(e,t,n){const[o,r]=te(ht),l=_(t);return l.current=t,Te(()=>{const t=e.current?.ownerDocument,n=t?.defaultView;if(!t||!n||!l.current)return void r(ht);let o=0;const i=()=>{o=0;const n=e.current?.parentElement??null,i=(l.current?l.current(t):[]).map(e=>function(e,t){if(!e||!t)return null;const n=Y(e),o=t.getBoundingClientRect();return{top:n.top-o.top,left:n.left-o.left,width:n.width,height:n.height}}(e,n)).filter(e=>null!==e);r(e=>{return(t=e)===(n=i)||t.length===n.length&&t.every((e,t)=>function(e,t){return e===t||!!e&&!!t&&e.top===t.top&&e.left===t.left&&e.width===t.width&&e.height===t.height}(e,n[t]))?e:i.length?i:ht;var t,n})},s=()=>{o||(o=(n.requestAnimationFrame??(e=>n.setTimeout(e,16)))(i))};i();const a="MutationObserver"in n?new n.MutationObserver(s):null;a?.observe(t.body,{childList:!0,subtree:!0,attributes:!0,characterData:!0});const c="ResizeObserver"in n?new n.ResizeObserver(s):null;return c?.observe(t.documentElement),n.addEventListener("resize",s),n.addEventListener("scroll",s,{capture:!0,passive:!0}),()=>{a?.disconnect(),c?.disconnect(),n.removeEventListener("resize",s),n.removeEventListener("scroll",s,{capture:!0}),o&&(n.cancelAnimationFrame??n.clearTimeout)(o)}},[n]),o}function gt({id:e,kind:t,overlay:n}){const o=_(null),r=J(rt),l=null!==e&&!0===r?.(e),i=mt(o,e?t=>Q(t,`[${je}="${t.defaultView?.CSS?.escape?t.defaultView.CSS.escape(e):e}"]`):null,e),[s,...a]=i,c=`es-canvas-outline is-${t}${l?" is-shared":""}`,u=e=>({position:"absolute",top:e.top,left:e.left,width:e.width,height:e.height}),d=/* @__PURE__ */se(ae,{children:[
|
|
8
|
-
/* @__PURE__ */ie("div",{ref:o,"aria-hidden":"true",className:c,style:s?u(s):{display:"none"}}),a.map((e,t)=>/* @__PURE__ */ie("div",{"aria-hidden":"true",className:c,style:u(e)},t))]});return n&&e?/* @__PURE__ */ie(n,{componentId:e,kind:t,children:d}):d}function vt(e,n){return Array.from(e.querySelectorAll(`[${je}]`)).find(o=>o.getAttribute(je)===n&&t(o)?.wrapper===e)??null}function yt(e,t,n){const o=g(e,n),r=o.text.length,l=e.ownerDocument;if(!t)return[r,r];let i=null;const s=l.caretPositionFromPoint?.(t.x,t.y);if(s&&e.contains(s.offsetNode))i=o.at(s.offsetNode,s.offset);else{const n=l.caretRangeFromPoint?.(t.x,t.y);n&&e.contains(n.startContainer)&&(i=o.at(n.startContainer,n.startOffset))}if(null===i)return[r,r];const a=o.text;let c=i,u=i;for(;c>0&&!/\s/.test(a[c-1]);)c-=1;for(;u<a.length&&!/\s/.test(a[u]);)u+=1;return[c,u]}function wt({s:e,element:t,toolbar:n,label:o,keys:r}){const l=w("copy",y),i=e.pressed(),s=new Set(n.offered),a=n.colors&&n.colors.length>0?n.colors:null,c=_(null),[m,g]=te(!1),[v,b]=te(null),k=m||null!==v,S=()=>{e.hold(),g(!1),b({href:e.pressed().href})},C=()=>{g(!1),b(null),e.resume()};le(()=>{r.current={escape:()=>!!k&&(C(),!0),link:()=>!!s.has("link")&&(S(),!0)}}),le(()=>()=>{r.current=null},[r]);const E=_(C);E.current=C,X(()=>{if(m)return ue(e=>{const t=c.current;return!!("Escape"===e.key&&t&&e.target instanceof Node&&t.contains(e.target))&&(E.current(),!0)},()=>c.current?.querySelector(".es-copy-colors"))},[m]),X(()=>{const n=c.current;if(!k||!n)return;const o=/* @__PURE__ */new Set([n.ownerDocument]),r=t();r&&o.add(r.ownerDocument);const l=o=>{const r=o.target;if(r&&n.contains(r))return;g(!1),b(null);const l=t();r&&l&&l.contains(r)?e.release():e.stop("outside")};for(const e of o)e.addEventListener("pointerdown",l,!0);return()=>{for(const e of o)e.removeEventListener("pointerdown",l,!0)}},[k,e,t]),le(()=>{const e=c.current,n=e?.querySelector(".rosh-tb-wrap > .es-copy-pop"),o=t();if(!(k&&e&&n&&o))return;const r=o.ownerDocument.defaultView?.getSelection()??null,l=r&&r.rangeCount>0&&o.contains(r.getRangeAt(0).startContainer)?r.getRangeAt(0):null,i=(l?u(l,o):null)??(()=>{const e=o.getBoundingClientRect();return{left:e.left,top:e.top,right:e.right,bottom:e.bottom}})(),s=o.ownerDocument.defaultView?.frameElement,a=s?U(s,{left:i.left,top:i.top,width:i.right-i.left,height:i.bottom-i.top}):{left:i.left,top:i.top,width:i.right-i.left,height:i.bottom-i.top},f=o.getBoundingClientRect(),h=s?U(s,{left:f.left,top:f.top,width:f.width,height:f.height}):{left:f.left,top:f.top,width:f.width,height:f.height},m=(e.closest("[data-floating-bar]")??e).getBoundingClientRect(),g={left:a.left,right:a.left+a.width,top:Math.min(a.top,h.top-6,m.top),bottom:Math.max(a.top+a.height,h.top+h.height+6,m.bottom)},v=e.ownerDocument.documentElement,y=(s??o.closest(".es-canvas")??o).getBoundingClientRect(),w={left:Math.max(0,y.left),top:Math.max(0,y.top),right:Math.min(v.clientWidth||y.right,y.right),bottom:Math.min(v.clientHeight||y.bottom,y.bottom)};if(w.right<=w.left||w.bottom<=w.top||0===n.offsetWidth)return;const b=d({anchor:g,size:{width:n.offsetWidth,height:n.offsetHeight},within:{left:y.left,top:y.top,right:y.right,bottom:y.bottom},clip:w,parent:p(n)});n.style.top=`${b.top}px`,n.style.left=`${b.left}px`,n.style.setProperty("--es-pop-point",`${b.point}px`),n.dataset.side=b.above?"above":"below"});const x=a?{run:f(i.color,a),open:m,onToggle:()=>{b(null),m?C():(e.hold(),g(!0))}}:void 0;/* @__PURE__ */
|
|
9
|
-
return ie(de,{anchor:()=>{const e=t();if(!e)return null;const n=e.getBoundingClientRect(),o=e.ownerDocument.defaultView?.frameElement,r=o?U(o,{left:n.left,top:n.top,width:n.width,height:n.height}):{left:n.left,top:n.top,width:n.width,height:n.height};return{left:r.left-6,top:r.top-6,right:r.left+r.width+6,bottom:r.top+r.height+6}},bounds:()=>{const e=t(),n=e?.ownerDocument.defaultView?.frameElement,o=(n??e?.closest(".es-canvas")??e)?.getBoundingClientRect();return o?{left:o.left,top:o.top,right:o.right,bottom:o.bottom}:{left:0,top:0,right:window.innerWidth,bottom:window.innerHeight}},"aria-label":o,children:/* @__PURE__ */ie("div",{ref:c,children:/* @__PURE__ */ie(pe,{layout:"row",offered:s,pressed:i.marks,onMark:t=>{"link"===t?S():e.press(t)},color:x,linkOpen:null!==v,list:{pressed:i.list,onList:t=>e.list(t)},clear:i.clearable?{onClear:()=>e.clear()}:void 0,alignment:n.alignment,letterCase:n.letterCase,last:n.lastTool?.({className:"rosh-tb-btn",disabled:!1,selected:i.selected,keepCaret:t=>{t.preventDefault(),e.hold()},insert:t=>e.insert(t)}),windows:/* @__PURE__ */se(ae,{children:[m&&a?/* @__PURE__ */ie(h,{colors:a,current:i.color,words:l.colors??y.colors,onPick:t=>e.color(t)}):null,v?
|
|
10
|
-
/* @__PURE__ */ie(fe,{className:"es-copy-link es-copy-pop",value:v.href??"",onApply:t=>{b(null),e.link(t)},onRemove:null!==v.href?()=>{b(null),e.link(null)}:void 0,onCancel:C}):null]})})})})}function bt({element:e,which:t}){const n=_(null),o=ft(n,()=>e(),t);/* @__PURE__ */
|
|
11
|
-
return ie("div",{ref:n,"aria-hidden":"true",className:"es-canvas-outline is-typing",style:o?{position:"absolute",top:o.top,left:o.left,width:o.width,height:o.height,...dt}:{display:"none"}})}function kt({frame:o=!0,className:r,style:l,metadata:i,mirrorStyles:u,onDocument:d,height:p,title:f,nonce:h,hotkeys:y,frameWrapper:k,overlay:S,children:C,typing:E,passThrough:x}){const I=$e(),D=J(ot),A=x??D,O=J(Oe),M=w("canvas",n),$=y??O,[R,z]=te(void 0),L=Pe(e=>"node"===e.selection?.kind?e.selection.id:null),[N,j]=te(null),[V,T]=te(null),F=J(it),H=J(at),[W,q]=te(null),[,U]=ne(e=>e+1,0),[,Y]=ne(e=>e+1,0),Q=e=>{F?.select(e),Y()},[G,ee]=te(null),oe=_(null),re=_(null),[,le]=te(0),ae=_(E);ae.current=E;const ce=_(null),ue=_(null),de=()=>{if(!L)return null;const e=ae.current?.atSelection?.()?.element()??null;if(!e)return null;const t=ue.current?.ownerDocument;if(F){const n=F.selected()&&t?F.selectedPart?.(t)??null:null;return n&&Z(n.element,e)?n.element:null}const n=b(I.getState().appState.data,I.config,L);return n&&0===P(n.node,I.config).length?e:null},pe=Pe(e=>e.appState.data),fe=F?.selected()??null;X(()=>{const e=ue.current?.ownerDocument,t=e?.defaultView?.CustomEvent;if(!e||!t)return;const n=L&&!G&&ae.current?.atSelection?.()?L:null,o=n?de():null;e.dispatchEvent(new t(K,{detail:o?{id:n,words:o}:{id:n}}))},[L,G,pe,fe]);const he=e=>{const t=ue.current?.ownerDocument,n=t?.defaultView?.CustomEvent;t&&n&&t.dispatchEvent(new n(B,{detail:{typing:e}}))},me=(e,t)=>{oe.current?.s.stop("stop");const n=e.element();if(!n)return!1;const o=ge(e,n),r=I.group(),l=e.element,i=m({element:l,value:o?.value??e.value,rules:e.rules,multiline:e.multiline,skip:e.skip,caret:yt(n,t,e.skip),write:o?.write??e.write,remount:e.remount,onSelect:()=>le(e=>e+1),onEscape:()=>ce.current?.escape()??!1,onLinkKey:()=>ce.current?.link()??!1,end:e=>{r.close(),oe.current?.element===l&&(oe.current=null),ee(null),he(!1),ae.current?.onChange?.({typing:!1,why:e})}});if(!i)return r.close(),!1;const s=n.closest?.(`[${je}]`)?.getAttribute(je);return s&&I.select(s),oe.current={s:i,element:l,target:e},ee(()=>l),j(null),he(!0),ae.current?.onChange?.({typing:!0,element:n}),!0},ge=(e,n)=>{const o=e.key;if(!o||!ae.current?.onCopyText)return null;const r=t(n),l=n.closest?.(`[${je}]`),i=l?.getAttribute(je);if(!r||!i||!r.wrapper.contains(l))return null;const{copy:s}=r,a=ae.current.copyValue?.({...s,nodeId:i,key:o}),c=g(n,e.skip).text,u=a??(v(e.value,e.rules).text===c?e.value:c),d={ownerId:s.ownerId,slot:s.slot,index:s.index,...s.outer?{outer:s.outer}:{},nodeId:i,key:o};return{value:u,write:t=>{const n=ae.current?.onCopyText;n&&!1!==n({...d,text:t})||e.write(t)}}};X(()=>()=>oe.current?.s.stop("stop"),[]);const ve=e=>{const t=oe.current?.element();return Boolean(t&&t.contains(e))},ye=(e,t)=>lt(I.getState().appState.data,I.config,e,t),we=e=>{const t=e.closest?.(`[${je}]`)?.getAttribute(je);if(!t)return;const n=I.getState(),o="node"===n.selection?.kind?n.selection.id:null,r=F?.partAt(e,t)??null;if(r){const e=a(n.appState.data,I.config,t,r.id,o,F?.selected()??null,A);if(e)return{node:e.node,part:e.part?r:null}}return{node:c(n.appState.data,I.config,t,o,A)??t,part:null}},be=e=>{if("Enter"!==e.key||e.defaultPrevented||e.shiftKey||e.metaKey||e.ctrlKey||e.altKey)return;if(oe.current)return;const t=e.target;if(t?.isContentEditable||t?.closest?.("input, textarea, select, button"))return;const n=ke(),o=void 0===n?ae.current?.atSelection?.():n;o&&me(o,null)&&e.preventDefault()},ke=()=>{const t=ae.current,n=re.current;if(!t?.onCopyText||!n?.copy||n.node!==L)return;const o=ue.current,r=o?e(o,n.copy):null,l=r?vt(r,n.node):null;if(!l)return null;const i=t.atSelection?.()??null,s=i?.element()??null;if(!i||!s)return null;if(l.contains(s))return i;const a=function(e,t){const n=e.closest(`[${je}]`);if(!n||n.getAttribute(je)!==t.getAttribute(je))return null;const o=[];for(let t=e;t!==n;t=t.parentElement)o.unshift(Array.prototype.indexOf.call(t.parentElement.children,t));let r=t;for(const e of o)r=r?.children[e];return r&&r.tagName===e.tagName?r:null}(s,l);return a?t.at(a):null},Se=(e,n)=>{if(!ae.current?.onCopyText)return null;const o=t(e);return o&&vt(o.wrapper,n)?o.copy:null},Ce=ue.current?.ownerDocument??null,Ee=F?.selected()&&Ce&&L?F.selectedPart?.(Ce)??null:null,xe=Ee&&L&&ye(L,Ee)?Ee.element:null,Ie=H?.selected()??null,Ae=Ie&&Ce?Array.from(Ce.querySelectorAll(`[${st}]`)).find(e=>e.getAttribute(st)===Ie)??null:null,Me=G?null:de(),Re=/* @__PURE__ */se("div",{ref:ue,className:"es-canvas-content",style:{position:"relative"},onClick:e=>{const t=e.target;if(t.closest?.("a[href]")&&e.preventDefault(),oe.current){if(ve(t))return;oe.current.s.stop("outside")}const n=t.ownerDocument?.getSelection?.();n&&n.rangeCount>0&&n.isCollapsed&&n.removeAllRanges();const o=H?ct(t):null;if(H&&o)return H.select(o.id),q(null),void U();const r=we(t);if(re.current=void 0!==r?{node:r.node,copy:Se(t,r.node)}:null,void 0!==r)return I.select(r.node),void(F&&(r.part?.id??null)!==F.selected()&&Q(r.part?.id??null));t.hasAttribute?.(Ve)||(I.select(null),F?.selected()&&Q(null))},onDoubleClick:e=>{const t=ae.current;if(!t||ve(e.target))return;const n=t.at(e.target);n&&me(n,{x:e.clientX,y:e.clientY})&&e.preventDefault()},onKeyDown:e=>be(e),onMouseOver:e=>{if(oe.current)return;const t=H?ct(e.target):null;if(t?.element!==W?.element&&q(t),t)return null!==N&&j(null),void(null!==V&&T(null));const n=we(e.target),o=!!n?.part&&ye(n.node,n.part),r=n?.part&&o&&n.part.id!==F?.selected()?n.part:null,l=!n||n.part&&o?null:n.node;l!==N&&j(l),r?.id===V?.id&&r?.element===V?.element||T(r)},onMouseLeave:()=>{j(null),T(null),q(null)},children:[
|
|
12
|
-
/* @__PURE__ */ie(He.Provider,{value:N,children:/* @__PURE__ */ie(nt,{metadata:i})}),
|
|
13
|
-
/* @__PURE__ */se("div",{className:"es-canvas-outlines",style:{position:"absolute",top:0,left:0,pointerEvents:"none"},children:[
|
|
14
|
-
/* @__PURE__ */ie(gt,{id:!G&&N&&N!==L?N:null,kind:"hover",overlay:S}),F?/* @__PURE__ */ie(ut,{element:G||!V||V.id===F.selected()?null:V.element}):null,Me||xe?/* @__PURE__ */ie(pt,{element:G?null:Me??xe,words:null!==Me}):null,H?/* @__PURE__ */ie(ut,{element:G||!W||W.element===Ae?null:W.element}):null,Ae?/* @__PURE__ */ie(pt,{element:G?null:Ae}):null,
|
|
15
|
-
/* @__PURE__ */ie(gt,{id:G||xe||Me||Ae?null:L,kind:"selected",overlay:S}),G?/* @__PURE__ */ie(bt,{element:()=>{const e=G?.()??null;return e?Ee&&Z(Ee.element,e)?Ee.element:e:null},which:Ee?.element??G}):null]}),C]}),ze=k?/* @__PURE__ */ie(k,{document:R,children:Re}):Re;X(()=>{if(R&&$)return De(R,I)},[R,$,I]),X(()=>{if(!R)return;const e=e=>{if("Enter"===e.key)return void be(e);if("Escape"!==e.key||e.defaultPrevented)return;const t=e.target;if(t?.isContentEditable||t?.closest?.("input, textarea, select"))return;const n=I.getState();if("node"!==n.selection?.kind)return;if(F?.selected())return void Q(null);const o=s(n.appState.data,I.config,n.selection);"node"===o?.kind&&I.select(o.id)};return R.addEventListener("keydown",e),()=>R.removeEventListener("keydown",e)},[R,I,F]);/* @__PURE__ */
|
|
16
|
-
return se("div",{className:"es-canvas"+(r?` ${r}`:""),style:l,"data-easel-preview":"","data-es-typing":G?"":void 0,children:[G&&oe.current?.target.toolbar?/* @__PURE__ */ie(wt,{s:oe.current.s,element:oe.current.element,toolbar:oe.current.target.toolbar,label:M.textTools,keys:ce}):null,o?/* @__PURE__ */ie(Fe,{mirrorStyles:u,onDocument:e=>{z(e??void 0),d?.(e)},height:p,title:f,nonce:h,children:ze}):/* @__PURE__ */ie("div",{id:"preview-frame","data-easel-entry":"",children:ze})]})}function St(e={}){const t=$e(),n=Pe(e=>e.appState.data);return i({...e,data:n,config:t.config,commit:(e,{select:n})=>t.run({data:e,select:n})})}function Ct(){return It(Pe(e=>e.selectedItem))}function Et(){try{return Ct()}catch{return null}}function xt(){return It(null)}function It(e){const t=$e(),n=Pe(e=>e.config),r=t.resolveCache,l=Pe(e=>e.appState.data.root),i=e?e.props.id:"root",s=l.props??{},a=oe(()=>e||{type:"root",props:s},[e,s]),c=e?n.components[e.type]:n.root,u=t.getState(),d=e?b(u.appState.data,n,i):null,p=d&&"root"!==d.place.parentId?d.place.parentId:null,f=p?u.getItemById(p)??null:null,{fields:h}=o({id:i,node:a,block:c,parent:f,appState:u.appState}),m=Pe(t=>!1===t.getPermissions(e?{item:e}:{root:!0}).edit),g=re(e=>{(async()=>{const o=t.getState();if("root"!==i){const l=o.getItemById(i),s=o.getSelectorForId(i);if(!l||!s)return;const a={...l,props:{...l.props,...e}},{node:c}=await R(a,n,{cache:r,trigger:"replace"}),u=t.getState().getSelectorForId(i);if(!u)return;return void t.dispatch({type:"replace",destinationZone:u.zone??"root:default-zone",destinationIndex:u.index,data:c})}const l=o.appState.data.root.props??{},{node:s}=await R({type:"root",props:{...l,...e}},n,{cache:r,trigger:"replace"});t.dispatch({type:"replaceRoot",root:{props:s.props,readOnly:s.readOnly},recordHistory:!0})})()},[t,n,r,i]),v=re((e,t)=>g({[e]:t}),[g]);return{id:i,node:a,fields:h,values:a.props,readOnly:m,onChange:v,onChangeMany:g}}export{st as CHROME_ATTR,at as CanvasChromeContext,Fe as CanvasFrame,it as CanvasPartsContext,ot as CanvasPassThroughContext,rt as CanvasSharedContext,Ce as DEFAULT_UI,kt as EaselCanvas,Me as EaselProvider,nt as EditDocument,De as bindUndoKeys,Ie as createEasel,Re as createUseEasel,lt as partHasOwnBox,he as recordsByDefault,be as reduce,ve as uiView,Pe as useEasel,$e as useEaselApi,St as useEaselNodeOps,xt as useRootFields,Ct as useSelectedFields,Et as useSelectedHost,ye as validSelection};
|
package/dist/chunk-FIH23CB7.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{styleFieldBuilders as e,keptByRow as o}from"./chunk-ZJRMB5KN.js";import{boxFieldBuilders as s,PHONE_KEY_ACCESS as t,phoneTwinFields as l,section as r}from"./chunk-M5IKANJ5.js";import{deviceField as i}from"./chunk-7GGNFLHT.js";import{TextColorIcon as n,GroundIcon as c}from"efficient-shell/icons/efficient";import{jsx as d}from"react/jsx-runtime";var u={fill:"buttonColor",fillOpacity:"buttonFillOpacity",border:"buttonBorder",text:"buttonTextColor",corners:"buttonCorners",cornerSides:"buttonCornerSides"},a={top:"buttonPaddingTop",right:"buttonPaddingRight",bottom:"buttonPaddingBottom",left:"buttonPaddingLeft"};function f(f){const b=s(f.say),p=e(f.say),y=u,F=f.style,g=f.phone??t;return{_dSize:r("Size"),...b.sidesPaddingFields({keys:a,group:!1,...f.padding}),_dDesign:r("Design"),[y.fill]:p.colourField({key:y.fill,access:F,label:"Fill color",icon:/* @__PURE__ */d(c,{}),useFollows:f.follows.useFill,usePresets:f.usePresets,resetTo:f.resetTo,opacity:{key:y.fillOpacity,useUnset:f.follows.useFillOpacity}}),[y.fillOpacity]:o(y.fill),[y.border]:p.borderField({key:y.border,access:F,useFollows:f.follows.useBorder}),[y.text]:p.colourField({key:y.text,access:F,label:"Text color",icon:/* @__PURE__ */d(n,{}),useFollows:f.follows.useText,usePresets:f.usePresets,resetTo:f.resetTo}),[y.corners]:p.cornersField({key:y.corners,access:F,sidesKey:y.cornerSides,useFollows:f.follows.useCorners}),[y.cornerSides]:o(y.corners),_dLayout:r("Layout"),...l("align",b.blockAlignmentField({phone:!0},""),g),align:i("desktop",b.blockAlignmentField())}}export{a as BUTTON_PAD_KEYS,u as BUTTON_STYLE_KEYS,f as buttonFieldSet};
|
package/dist/chunk-FT3O7X6U.js
DELETED
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
import{usePickFollowsSelection as n}from"./chunk-NCXYC7WI.js";import{slotFieldsOf as e,slotChildrenIn as t}from"./chunk-TCAAOYQY.js";import{EaselCanvas as r,useSelectedFields as o}from"./chunk-53ME3GAI.js";import{Inspector as i}from"./chunk-R76XMEKT.js";import{fieldIsShown as u}from"./chunk-BPXEFVSQ.js";import{createContext as l,useContext as s}from"react";import{DesktopIcon as c}from"efficient-shell/icons/efficient";import{jsx as f}from"react/jsx-runtime";var a={kind:"selection"};function d(n){return"selection"===n.kind}function p(n,e){if(d(n)&&d(e))return!0;const t=n,r=e,o=Object.keys(t);return o.length===Object.keys(r).length&&o.every(n=>Object.is(t[n],r[n]))}function m(n){const e=n;return"string"==typeof e.nodeId&&"string"==typeof e.slot}function k(n,t){const r=n.components?.[t.type]?.fields??{};return e(n,t.type).filter(n=>u(r[n],{values:t.props}))}function h(n,e){return k(n,e).flatMap(n=>t(e,n))}function v(n,e,t){const r=n.slotsOf?.(t);return r||k(e,t).map(n=>({slot:n,label:n,rung:!1}))}function y(n,e){return n.isFirst?n.isFirst(e):e.type===n.first}function g(n,e){return n.isLast?n.isLast(e):e.type===n.last}var b={},O=()=>b,j=()=>"",w=()=>null,C=()=>{},S={isLockedBlock:()=>!1,duplicateBlocked:()=>null,nestDepth:()=>0,newSectionNode:()=>null,canAddTo:()=>null,blockIsOffered:()=>!0},L={labelAtLevel:(n,e,t)=>t,descriptions:{},categoryLabel:()=>{},firstSection:null,blockRowName:(n,e)=>e(n.type),plainText:n=>n,Icon:()=>null,Thumbnail:()=>null,useProducts:()=>null},I={options:[{id:"desktop",label:"Desktop",icon:/* @__PURE__ */f(c,{})}],initial:"desktop",fluid:"desktop",widths:{desktop:2e3}},N={read:()=>"sections",write:()=>{},forSelection:(n,e)=>n?"sections":e},P={first:null,last:null,firstGroup:null,lastGroup:null,isSectionGroup:()=>!1,sectionGroupZone:()=>"",panelOf:()=>null};function A(){/* @__PURE__ */
|
|
2
|
-
return f(r,{height:"fill"})}function B(){const{id:n,fields:e,values:t,readOnly:r,onChange:u}=o();/* @__PURE__ */
|
|
3
|
-
return f("div",{className:"es-sidepanel es-sidepanel--right",children:/* @__PURE__ */f(i,{fields:e,values:t,onChange:u,readOnly:r,idPrefix:n})})}var D=l({});function G({parts:n,children:e}){/* @__PURE__ */
|
|
4
|
-
return f(D.Provider,{value:n,children:e})}function T(){return s(D)}function x(){return(T().useOwnerName??j)()}function F(){return(T().useDocumentLabel??w)()}function E(n,e,t,r){return(T().useBridges??O)(n,e,t,r)}function M(n){return(T().useStandaloneBridges??O)(n)}function R(n,e){(T().useDocumentPass??C)(n,e)}function X(){return T().blockRules??S}function Y(){return T().blockLook??L}function K(){return T().devices??I}function Q(){return T().leftView??N}function V(){return T().pinned??P}function H(){return T().saveSwitch??!0}function W(e){n(!0===T().pickFollowsSelection,e)}function Z(){return T().storageNamespace||void 0}function q(){return T().styleClipboard??null}function z(){return T().nodeKeys??!0}function J(){return T().notify??null}function U(){return T().Canvas??A}function $(){return T().CanvasHead??null}function _(){return T().canvasDrag??null}var nn=l(null);function en({target:n,children:e}){/* @__PURE__ */
|
|
5
|
-
return f(nn.Provider,{value:n,children:e})}function tn(){return s(nn)}function rn(){return T().Inspector??B}export{a as SELECTION_MODE,en as ScreenCanvasTargetProvider,G as ScreenPartsProvider,y as isPinnedFirst,g as isPinnedLast,d as isSelectionMode,m as isSlotMode,p as sameInspectorMode,v as screenSlotsOf,h as shownChildSlotsOf,k as shownSlotFieldsOf,Y as useScreenBlockLook,X as useScreenBlockRules,E as useScreenBridges,_ as useScreenCanvasDrag,U as useScreenCanvasFrame,$ as useScreenCanvasHead,tn as useScreenCanvasTarget,K as useScreenDevices,F as useScreenDocumentLabel,R as useScreenDocumentPass,rn as useScreenInspectorPanel,Q as useScreenLeftView,z as useScreenNodeKeys,J as useScreenNotify,x as useScreenOwnerName,T as useScreenParts,W as useScreenPickFollowsSelection,V as useScreenPinned,H as useScreenSaveSwitch,Z as useScreenStorageNamespace,q as useScreenStyleClipboard,M as useStandaloneScreenBridges};
|
package/dist/chunk-LUG22U5L.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{parseZoneKey as t}from"./chunk-EUFDQ4KL.js";import{repeatWrapperAt as e,REPEAT_ATTRIBUTE as r,REPEAT_INDEX_ATTRIBUTE as n}from"./chunk-7UFKEX72.js";var o=`[${r}][${n}]`;function l(l){const c=e(l);if(!c)return null;let i;try{i=t(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(r)===p&&d.add(t.getAttribute(n)??"");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 r of Array.from(t.querySelectorAll(o))){if(r.getAttribute(n)!==String(e.index))continue;const t=l(r);if(t?.wrapper===r&&c(t.copy,e))return r}return null}export{i as findCopy,u as repeatCopyAt,l as repeatCopyWithWrapper};
|
package/dist/chunk-M5IKANJ5.js
DELETED
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
import{sidesStartEach as e,SidesInput as n,SidesEachToggle as t}from"./chunk-CLAADE4J.js";import{SettingsDefaultReset as o}from"./chunk-2T22IY3J.js";import{deviceField as l}from"./chunk-7GGNFLHT.js";import{noControlField as a,NoControlMark as i}from"./chunk-22I55W37.js";import{describedAs as r}from"./chunk-LX23TCTP.js";import{withStyleKind as u}from"./chunk-CWELHADJ.js";import{phoneKey as s}from"./chunk-E52W3M5I.js";import{foldMetaOf as c,FOLD_FIELD_MARKER as d}from"./chunk-ANPOR6EY.js";import{useSelectedHost as p,useEaselApi as f,useEasel as m}from"./chunk-53ME3GAI.js";import{DEFAULT_PANEL_WORDS as b}from"./chunk-56ID6FKZ.js";import{SettingsSwitch as h}from"./chunk-OECWLNKJ.js";import{FieldSelect as g}from"./chunk-KFWNGPW3.js";import{SettingsField as v}from"./chunk-MIX7EGRG.js";import{SettingsSegmented as y}from"./chunk-DX3VILZ3.js";import{useWords as k}from"./chunk-MFIRYGHW.js";import{useState as w}from"react";import{AlignmentIcon as C,BoxJustifyIcon as x,WrapIcon as j,GapIcon as F,WidthIcon as L,PlacementIcon as O,NudgeIcon as S,DesktopIcon as E,BoxXEndIcon as P,BoxXCenterIcon as I,BoxXStartIcon as A,PaddingAllIcon as K,BoxYBetweenIcon as R,BoxYStretchIcon as B,BoxYEndIcon as G,BoxYCenterIcon as M,BoxYStartIcon as W,BoxXBetweenIcon as N,BoxXStretchIcon as T,BoxItemAlignmentIcon as V}from"efficient-shell/icons/efficient";import{Slider as D,textAlignOptions as J,AlignmentGrid as $,PositionInput as _}from"efficient-shell/ui";import{jsx as X,Fragment as Y,jsxs as z}from"react/jsx-runtime";var H=e=>e;function Z(){return null}function U(e){if(!e.trim())throw new Error("noGlyph() needs a reason naming the ruling that decided it.");/* @__PURE__ */
|
|
2
|
-
return X(Z,{},e)}function q(e){return e.type===Z}function Q(e){return q(e)?void 0:e}function ee(e){for(const[n,t]of Object.entries(e))t&&"object"==typeof t&&!c(t)&&u(t,`section:${n}`);return e}function ne(e,n){return{type:"custom",[d]:{label:e,level:n},marker:!0,fold:e,render:()=>/* @__PURE__ */X(Y,{})}}function te(e){return ne(e,2)}function oe(e){return ne(e,1)}var le=[{label:"Start",value:"start"},{label:"Center",value:"center"},{label:"Space between",value:"between"},{label:"End",value:"end"}],ae=[{label:"Start",value:"start"},{label:"Center",value:"center"},{label:"End",value:"end"},{label:"Stretch",value:"stretch"}],ie="Wrap",re=[{label:"Wrap",value:"wrap"},{label:"No wrap",value:"nowrap"}],ue="Direction",se=[{label:"Stacked",value:"column"},{label:"One row",value:"row"}],ce={min:-32,max:64,step:2,builtIn:0},de={min:30,max:100,step:5,fallback:60},pe=["top-left","top-center","top-right","left","center","right","bottom-left","bottom-center","bottom-right"],fe="bottom-left",me={"top-left":"Top left","top-center":"Top center","top-right":"Top right",left:"Left",center:"Center",right:"Right","bottom-left":"Bottom left","bottom-center":"Bottom center","bottom-right":"Bottom right"},be=pe.map(e=>({value:e,label:me[e]}));function he(e,n=fe){return pe.includes(e)?e:n}var ge=40,ve=e=>"number"==typeof e?e:null;function ye(e,n,t){const o={};for(const l of["x","y"])t[l]!==n[l]&&(o[e[l]]=t[l]??void 0);return o}var ke=["top","right","bottom","left"],we={top:"sectionPaddingTop",right:"sectionPaddingRight",bottom:"sectionPaddingBottom",left:"sectionPaddingLeft"},Ce=e=>"number"==typeof e?e:null;function xe(e,n,t){const o={};for(const l of ke)t[l]!==n[l]&&(o[e[l]]=t[l]??void 0);return o}function je(e){if("number"==typeof e)return{top:e,right:e,bottom:e,left:e};const n=e&&"object"==typeof e?e:{};return Object.fromEntries(ke.map(e=>[e,Ce(n[e])]))}function Fe(e){const n={};for(const t of ke)"number"==typeof e[t]&&(n[t]=e[t]);return Object.keys(n).length?n:void 0}function Le(e,n={}){const t=n=>{const t=n[e];return t&&"object"==typeof t?t:{}},o=e=>Object.hasOwn(n,e)?n[e]:e;return{read:(e,n)=>t(e)[o(n)],write:(n,l,a)=>{const i={...t(n)};return void 0===a?delete i[o(l)]:i[o(l)]=a,{[e]:Object.keys(i).length?i:void 0}}}}function Oe(e,n,t){const o=Se(e),l=p();if(t)return[t.value,t.onChange];const a=l?.values??{};return[e.read(a,n),e=>o([[n,e]])]}function Se(e){const n=p(),t=function(){try{return f()}catch{return null}}();return o=>{if(!n)return;const l=t?.getState(),a=(l?"root"===n.id?l.appState.data.root.props:l.getItemById(n.id)?.props:void 0)??n.values??{};let i={};for(const[n,t]of o)i={...i,...e.write({...a,...i},n,t)};n.onChangeMany(i)}}var Ee={read:(e,n)=>e[n],write:(e,n,t)=>({[n]:t})},Pe={fieldKey:s,ownField:!0,read:(e,n)=>e[s(n)],write:(e,n,t)=>({[s(n)]:t})};function Ie(e){return{...Le(e),fieldKey:n=>`_${e}_${n}`}}function Ae({row:e,desktopKey:n,access:t,props:o}){const l=p(),a=l?.values?.[n],[i,r]=Oe(t,n);return t.ownField?e.render({...o,follows:a}):e.render({...o,value:i,storedValue:i,follows:a,onChange:r})}function Ke(e,n,t=Pe){const o={...n,render:o=>/* @__PURE__ */X(Ae,{row:n,desktopKey:e,access:t,props:o})};return{[e]:l("desktop",n),[t.fieldKey(e)]:l("mobile",o)}}var Re=["left","center","right"];function Be(e,{options:n,value:t,onChange:o,ariaLabel:l,disabled:a=!1}){/* @__PURE__ */
|
|
3
|
-
return X(y,{options:n.map(n=>n.picture?{id:n.value,label:n.picture,title:e(n.title??n.label)}:{id:n.value,label:e(n.label),title:void 0===n.title?void 0:e(n.title)}),value:t,onChange:o,ariaLabel:e(l),disabled:a})}function Ge(e,{label:n,value:t,onChange:o,points:l}){const a=l.find(e=>e.disabled),i=l.map(n=>({...n,label:e(n.label),...n.title?{title:e(n.title)}:null}));/* @__PURE__ */
|
|
4
|
-
return X(v,{label:e(n),icon:/* @__PURE__ */X(O,{}),hint:a?.title?e(a.title):void 0,children:/* @__PURE__ */X($,{label:e(n),value:t,points:i,onChange:o})})}function Me({say:e,label:n,value:t,onChange:o,pointsFor:l}){const{appState:a,selectedItem:i}=m(e=>e),r=i?.props?.id?String(i.props.id):void 0;return Ge(e,{label:n,value:t,onChange:o,points:l(a?.data,r)})}function We({say:e,o:n}){const t=p(),l=k("panel",b),a=t?.values??{},i={x:ve(a[n.keys.x]),y:ve(a[n.keys.y])},r=e(n.label??"Position"),u=Boolean(i.x||i.y),s=e=>{const o=ye(n.keys,i,e);Object.keys(o).length&&t?.onChangeMany(o)},c=/* @__PURE__ */X(_,{label:r,value:i,onChange:s,words:{x:e("Left and right"),y:e("Up and down"),unit:"px"},placeholder:{x:"0",y:"0"},min:n.min,max:n.max,step:n.step??1}),d=/* @__PURE__ */X(o,{words:l,label:r,changed:u,detail:"0 px, 0 px",onReset:()=>s({x:null,y:null})});return null===n.label?/* @__PURE__ */z("div",{className:"sf-position-line",children:[c,d]}):/* @__PURE__ */X(v,{label:r,icon:/* @__PURE__ */X(S,{}),changed:u,action:d,children:c})}var Ne={x:{start:/* @__PURE__ */X(A,{}),center:/* @__PURE__ */X(I,{}),end:/* @__PURE__ */X(P,{}),stretch:/* @__PURE__ */X(T,{}),between:/* @__PURE__ */X(N,{})},y:{start:/* @__PURE__ */X(W,{}),center:/* @__PURE__ */X(M,{}),end:/* @__PURE__ */X(G,{}),stretch:/* @__PURE__ */X(B,{}),between:/* @__PURE__ */X(R,{})}},Te=e=>"row"===e?"row":"column";function Ve({say:e,kind:n,label:t,options:o,value:l,onChange:a,o:i}){const r=p(),u="justify"===n==("row"===(i.runs??Te)(r?.values?.[i.directionKey??"direction"]))?"x":"y";return Be(e,{options:o.map(e=>({label:e.label,value:e.value,picture:Ne[u][e.value]})),value:l,onChange:a,ariaLabel:t})}function De({say:e,tier:n,o:t}){const o=p(),l=o?.values??{},a="mobile"===n?t.phoneKeys:t.keys,i=Object.fromEntries(ke.map(e=>[e,Ce(l[a[e]])])),r="mobile"===n?Object.fromEntries(ke.map(e=>[e,Ce(l[t.keys[e]])])):null;/* @__PURE__ */
|
|
5
|
-
return X($e,{say:e,o:t,value:i,follows:r,onChange:e=>{const n=xe(a,i,e);Object.keys(n).length&&o?.onChangeMany(n)}})}function Je({say:e,o:n,props:t}){/* @__PURE__ */
|
|
6
|
-
return X($e,{say:e,o:n,value:je(t.value),follows:"follows"in t?je(t.follows):null,readOnly:t.readOnly,onChange:e=>t.onChange(Fe(e))})}function $e({say:o,o:l,value:a,follows:i,readOnly:r,onChange:u}){const s=Object.fromEntries(ke.map(e=>[e,String(i?.[e]??l.fallback[e])])),[c,d]=w(()=>e(a,s));/* @__PURE__ */
|
|
7
|
-
return X(v,{label:o("Padding"),icon:/* @__PURE__ */X(K,{}),action:/* @__PURE__ */X(t,{each:c,label:o("Each side"),onChange:d,disabled:r}),children:/* @__PURE__ */X(n,{label:o("Padding"),each:c,value:a,placeholder:s,min:l.min,max:l.max,step:l.step,readOnly:r,onChange:u,words:{sides:{top:o("Padding top"),right:o("Padding right"),bottom:o("Padding bottom"),left:o("Padding left")},vertical:o("Top and bottom"),horizontal:o("Left and right"),unit:"px"}})})}function _e(e=H){function n(n,t,l,a,i,u,s="",c){const d="function"==typeof c?{action:c}:c??{},{action:p,clear:f}=d;return{type:"custom",...r({},{type:"number",label:n}),render:r=>{const c="storedValue"in r?r.storedValue:r.value,m="follows"in r,b=m||void 0!==f,h="number"==typeof r.value,g=m&&"number"==typeof r.follows?r.follows:void 0===f?u:"function"==typeof f.hint?f.hint(r):f.hint,y=h?r.value:b?null:u,k=""===s||"px"===s?s:` ${s}`,w=!f?.emptyLabel||m&&"number"==typeof r.follows?void 0:f.emptyLabel,C=w??`${g}${k}`,x=m?e("{value} on desktop").replace("{value}",C):C,j=!0===r.readOnly;/* @__PURE__ */
|
|
8
|
-
return X(v,{label:e(n),icon:Q(t),action:b?/* @__PURE__ */X(o,{label:e(n),changed:h,detail:x,disabled:j,onReset:()=>r.onChange(void 0)}):p?p(c,r.onChange):void 0,children:/* @__PURE__ */X("div",{className:"sf-slider",children:/* @__PURE__ */X(D,{min:l,max:a,step:i,value:y,suffix:s||void 0,showInput:!0,label:e(n),disabled:j,...b?{placeholderValue:g}:{},...w?{emptyLabel:w}:{},...void 0!==d.inputMax?{inputMax:d.inputMax}:{},size:"sm",boxSize:"md",className:"sf-slider-track",onChange:e=>{null===e?b&&h&&r.onChange(void 0):e!==y&&r.onChange(e)}})})})}}}function t(n){return Be(e,n)}function u(n,l,a,i,u={}){const s=a.map(e=>"string"==typeof e?{label:e,value:e}:e);return{type:"custom",...r({},{type:"radio",label:n,options:s.map(e=>({value:e.value,label:e.label}))}),render:a=>{const{value:r,onChange:c,field:d}=a,p=s.some(e=>e.value===r),f=!0===a.readOnly;if("follows"in a&&!s.some(e=>""===e.value)){const d=u.phoneRest?u.phoneRest(a.follows):a.follows,m=s.find(e=>e.value===d)??s.find(e=>e.value===i);/* @__PURE__ */
|
|
9
|
-
return X(v,{label:e(n),icon:Q(l),action:/* @__PURE__ */X(o,{label:e(n),changed:p,detail:e("{value} on desktop").replace("{value}",e(m?.label??"")),disabled:f,onReset:()=>c(void 0)}),children:t({options:s,value:p?r:m?.value??i,onChange:c,ariaLabel:n,disabled:f})})}/* @__PURE__ */
|
|
10
|
-
return X(v,{label:e(n),icon:Q(l),children:t({options:s,value:p?r:r||d?.currentValue||i,onChange:c,ariaLabel:n,disabled:f})})}}}function c(e,n){return n.phone?e.unshift({label:"Match desktop",value:"",picture:/* @__PURE__ */X(E,{})}):n.inherit&&e.unshift({label:n.inherit,value:""}),e}function d(e,n){return n.inherit||n.phone?{...e,render:n=>e.render({...n,onChange:e=>n.onChange(""===e?void 0:e)})}:e}function p(e,n,t){return{[e]:l("desktop",n(t)),[s(e)]:l("mobile",n({...t,phone:!0},""))}}function f(e){return c(J(e.allow??Re).map(e=>({label:e.label,value:e.value,picture:e.icon})),e)}function m(e={},n=e.fallback??"left"){return d(u(e.label??"Text alignment",/* @__PURE__ */X(C,{}),f(e),n),e)}function b(e){const n={left:Ne.x.start,center:Ne.x.center,right:Ne.x.end};return c(J((e.allow??Re).filter(e=>e in n)).map(e=>({label:e.label,value:e.value,picture:n[e.value]})),e)}function y(e={},n=e.fallback??"left"){return d(u(e.label??"Block alignment",/* @__PURE__ */X(x,{}),b(e),n),e)}function k(n,t,o,l,a,i){return{type:"custom",options:l,fallback:a,...r({},{type:"radio",label:t,options:l.map(e=>({value:e.value,label:e.label}))}),render:({value:r,onChange:u,field:s})=>{const c=s.options??l,d=s.fallback??a,p=c.some(e=>e.value===r)?r:d;/* @__PURE__ */
|
|
11
|
-
return X(v,{label:e(t),icon:Q(o),children:/* @__PURE__ */X(Ve,{say:e,kind:n,label:t,options:c,value:p,onChange:u,o:i})})}}}function w(e={}){return k("justify","Justify",/* @__PURE__ */X(x,{}),le,le[0].value,e)}function O(e={}){return k("align","Item alignment",/* @__PURE__ */X(V,{}),ae,"stretch",e)}function S(){const n=ie;return{type:"custom",options:re,fallback:re[1].value,...r({},{type:"radio",label:n,options:re.map(e=>({value:e.value,label:e.label}))}),render:({value:t,onChange:o,id:l,name:a})=>{const i=`${l??a??n}-label`;/* @__PURE__ */
|
|
12
|
-
return X(v,{label:e(n),labelId:i,icon:/* @__PURE__ */X(j,{}),action:/* @__PURE__ */X(h,{checked:(r=t,!0===r||"wrap"===r),onChange:e=>o(e?re[0].value:re[1].value),ariaLabelledBy:i})});var r}}}function P({offered:e,fallback:n,resolve:t}){const o=t??(t=>e.some(e=>e.value===t)?t:n),l=u(ue,U("`Direction` names how a container’s children run — a MODIFIER, not a thing. doc/naming.md N10.1 gives the idea a dash in its Glyph column; the shell’s own `direction` meaning says the bare row is CORRECT and not an omission (SS seat, 2026-09-11)."),e.map(e=>({label:e.label,value:e.value})),o(void 0));return{type:"custom",render:e=>l.render({...e,value:o(e.value),onChange:n=>e.onChange(n)})}}function I({min:e,max:t,step:o,builtIn:l,resolve:a,action:i,mark:r}){const u=n("Gap",/* @__PURE__ */X(F,{}),e,t,o,l,"px",i),s=a??(e=>"number"==typeof e?e:l);return{...r,type:"custom",render:e=>u.render({...e,value:s(e.value,e.field),storedValue:e.value,onChange:n=>e.onChange(n)})}}function A(n,{fallback:t=fe,pointsFor:o}={}){return{type:"custom",render:({value:l,onChange:a})=>{const i=he(l,t);return o?/* @__PURE__ */X(Me,{say:e,label:n,value:i,onChange:a,pointsFor:o}):Ge(e,{label:n,value:i,onChange:a,points:be})}}}function K(n){return{[n.keys.x]:{type:"custom",render:()=>/* @__PURE__ */X(We,{say:e,o:n})},[n.keys.y]:{...a({type:"custom",render:()=>/* @__PURE__ */X(i,{})},"always"),reachedBy:n.keys.x}}}function R(n={}){const t={...we,...n.keys},o={keys:t,phoneKeys:Object.fromEntries(ke.map(e=>[e,s(t[e])])),fallback:{top:0,right:0,bottom:0,left:0,...n.fallback},min:n.min??0,max:n.max??200,step:n.step??4},r=!1!==n.phone,u=!1===n.group?{}:{_gSpacing:te("Padding")};if(n.object){const t={type:"custom",render:n=>/* @__PURE__ */X(Je,{say:e,o:o,props:n})};return ee({...u,...r?Ke(n.object.key,t,n.object.phone):{[n.object.key]:t}})}const c=n=>{const t={type:"custom",render:()=>/* @__PURE__ */X(De,{say:e,tier:n,o:o})};return r?l(n,t):t},d=()=>a({type:"custom",render:()=>/* @__PURE__ */X(i,{})},"always"),p=ke.filter(e=>"top"!==e);return ee({...u,[o.keys.top]:c("desktop"),...r?{[o.phoneKeys.top]:c("mobile")}:{},...Object.fromEntries(p.map(e=>[o.keys[e],{...d(),reachedBy:o.keys.top}])),...r?Object.fromEntries(p.map(e=>[o.phoneKeys[e],l("mobile",d())])):{}})}return{slider:n,select:function(n,t,o,l,a){return{type:"custom",options:o,fallback:l,...a?{note:a}:{},...r({},{type:"select",label:n}),render:({value:i,onChange:r,field:u})=>{const s=u.options??o,c=u.fallback??l,d=s.some(e=>e.value===i)?i:c;/* @__PURE__ */
|
|
13
|
-
return X(v,{label:e(n),icon:Q(t),children:/* @__PURE__ */X(g,{value:d,ariaLabel:e(n),onChange:r,options:[...a?[{label:e(a),value:"\0note",disabled:!0}]:[],...s.map(n=>({label:e(n.label),value:n.value}))]})})}}},Segmented:t,segmented:u,boxJustifyField:w,boxAlignField:O,boxWrapField:S,directionField:P,gapField:I,placementField:A,PlacementGridView:function(n){return Ge(e,n)},positionFields:K,sidesPaddingFields:R,alignmentField:m,alignmentFields:function(e="align",n={}){return p(e,m,n)},AlignmentStrip:function({opts:e={},value:n,onChange:o,ariaLabel:l,disabled:a=!1}){return t({options:f(e),value:n,onChange:o,ariaLabel:l,disabled:a})},blockAlignmentField:y,blockAlignmentFields:function(e="align",n={}){return p(e,y,n)},BlockAlignmentStrip:function({opts:e={},value:n,onChange:o,ariaLabel:l,disabled:a=!1}){return t({options:b(e),value:n,onChange:o,ariaLabel:l,disabled:a})},boxFieldSet:function(e={}){const t=e.width??de,o=e.nudge?.limit??40,l=e.direction??{offered:se,fallback:"column"},a=l.resolve??(e=>l.offered.some(n=>n.value===e)?e:l.fallback),i={runs:e=>"row"===a(e)?"row":"column"};return{_gLayout:te("Layout"),placement:A("Placement",e.placement),width:n("Width",/* @__PURE__ */X(L,{}),t.min,t.max,t.step,t.fallback,"%"),direction:P(l),gap:I(e.gap??ce),justify:w(i),align:O(i),wrap:S(),_gNudge:te("Nudge"),...K({keys:e.nudge?.keys??{x:"nudgeX",y:"nudgeY"},min:-o,max:o,label:null}),...R(e.padding)}}}}var{slider:Xe,select:Ye,Segmented:ze,segmented:He,boxJustifyField:Ze,boxAlignField:Ue,boxWrapField:qe,directionField:Qe,gapField:en,placementField:nn,PlacementGridView:tn,positionFields:on,sidesPaddingFields:ln,alignmentField:an,alignmentFields:rn,AlignmentStrip:un,blockAlignmentField:sn,blockAlignmentFields:cn,BlockAlignmentStrip:dn,boxFieldSet:pn}=_e();export{me as ANCHOR_LABELS,un as AlignmentStrip,ae as BOX_ALIGN_POINTS,se as BOX_DIRECTIONS,ue as BOX_DIRECTION_LABEL,ce as BOX_GAP,le as BOX_JUSTIFY_POINTS,ge as BOX_NUDGE_LIMIT,pe as BOX_PLACEMENTS,fe as BOX_PLACEMENT_DEFAULT,de as BOX_WIDTH,ie as BOX_WRAP_LABEL,re as BOX_WRAP_POINTS,dn as BlockAlignmentStrip,Ee as FLAT_ACCESS,be as OPEN_PLACEMENT_POINTS,Pe as PHONE_KEY_ACCESS,tn as PlacementGridView,we as SIDE_PAD_KEYS,ze as Segmented,an as alignmentField,rn as alignmentFields,sn as blockAlignmentField,cn as blockAlignmentFields,Ue as boxAlignField,_e as boxFieldBuilders,pn as boxFieldSet,Ze as boxJustifyField,qe as boxWrapField,Qe as directionField,en as gapField,te as group,Q as iconOf,q as isNoGlyph,U as noGlyph,he as normaliseBoxPlacement,Le as objectAccess,Ie as phoneObjectAccess,Ke as phoneTwinFields,nn as placementField,on as positionFields,ye as positionPatch,oe as section,He as segmented,Ye as select,ee as sharedStyleKinds,je as sidesFromObject,ln as sidesPaddingFields,xe as sidesPaddingPatch,Fe as sidesToObject,Xe as slider,Se as useAccessPatch,Oe as useAccessValue};
|
package/dist/chunk-ZJRMB5KN.js
DELETED
|
@@ -1,4 +0,0 @@
|
|
|
1
|
-
import{useAccessPatch as e,FLAT_ACCESS as r,useAccessValue as o}from"./chunk-M5IKANJ5.js";import{CornersInput as t,BorderInput as s,SettingsColour as l}from"./chunk-CLAADE4J.js";import{SettingsDefaultReset as n}from"./chunk-2T22IY3J.js";import{noControlField as i,NoControlMark as a}from"./chunk-22I55W37.js";import{DEFAULT_PANEL_WORDS as c,DEFAULT_COLOUR_ROW_WORDS as d}from"./chunk-56ID6FKZ.js";import{SettingsField as u}from"./chunk-MIX7EGRG.js";import{useWords as p}from"./chunk-MFIRYGHW.js";import{CornerIcon as y,BorderAllIcon as h}from"efficient-shell/icons/efficient";import{jsx as f}from"react/jsx-runtime";var m=e=>e;function b(e,t){const s=e.access?void 0:{value:t.value,onChange:t.onChange};return o(e.access??r,e.key,s)}function g(e,t){return o(e.access??r,t??"")}function v(e){return{...i({type:"custom",render:()=>/* @__PURE__ */f(a,{})},"always"),reachedBy:e}}function w({o:o,say:t,props:s}){const n=p("colourRow",d),i=p("panel",c),a=o.useFollows(),u=o.usePresets?.(),y=o.opacity?.useUnset?.()??100,[h,m]=b(o,s),[v,w]=g(o,o.opacity?.key),k=e(o.access??r),C="string"==typeof h?h:"",j="number"==typeof v,B=o.access?void 0:"";/* @__PURE__ */
|
|
2
|
-
return f(l,{label:t(o.label),icon:o.icon,value:C,onChange:e=>m(""===e?B:e),inherited:a,presets:u,changed:""!==C||j,onReset:()=>{j&&o.opacity?k([[o.key,B],[o.opacity.key,void 0]]):m(B)},resetTo:o.resetTo?o.resetTo(a.toUpperCase()):a.toUpperCase(),...o.opacity?{opacity:j?v:y,onOpacityChange:e=>w(e)}:{},readOnly:s.readOnly,words:n,resetWords:i})}var k=20;function C({o:e,say:r,props:o}){const t=e.useFollows(),[l,n]=b(e,o),i=l&&"object"==typeof l?l:{},a=t.width,c={width:r("Border width"),sides:{top:r("Border top"),right:r("Border right"),bottom:r("Border bottom"),left:r("Border left")},style:r("Border style"),styles:{solid:r("Solid"),dashed:r("Dashed"),dotted:r("Dotted")},color:r("Border color"),unit:"px"};/* @__PURE__ */
|
|
3
|
-
return f(u,{label:r("Border"),icon:/* @__PURE__ */f(h,{}),children:/* @__PURE__ */f(s,{label:r("Border"),value:i,each:!1,onChange:r=>n(function(e){const r=Object.fromEntries(Object.entries(e).filter(([,e])=>null!=e&&""!==e));return Object.keys(r).length?r:void 0}(e.styles?{width:r.width,color:r.color,style:r.style}:{width:r.width,color:r.color})),placeholder:{sides:{top:a,right:a,bottom:a,left:a},style:"solid",color:t.color},presets:[t.color],words:c,styles:e.styles??!1,max:20,readOnly:o.readOnly})})}var j=["tl","tr","br","bl"],B=40;function F({o:o,say:s,props:l}){const i=p("panel",c),a=o.useFollows(),[d,h]=b(o,l),[m,v]=g(o,o.sidesKey),w=e(o.access??r),k=o.access?void 0:null,C="number"==typeof d&&Number.isFinite(d)?d:null,B=Array.isArray(m)?j.filter(e=>m.includes(e)):[...j],F=[{value:"tl",label:s("Top left")},{value:"tr",label:s("Top right")},{value:"bl",label:s("Bottom left")},{value:"br",label:s("Bottom right")}];/* @__PURE__ */
|
|
4
|
-
return f(u,{label:s("Corners"),icon:/* @__PURE__ */f(y,{}),changed:null!==C||Array.isArray(m),action:/* @__PURE__ */f(n,{label:s("Corners"),changed:null!==C||Array.isArray(m),detail:`${a}px`,onReset:()=>Array.isArray(m)?w([[o.key,k],[o.sidesKey,k]]):h(k),words:i}),children:/* @__PURE__ */f(t,{label:s("Corners"),value:B,corners:F,onChange:e=>{const r=j.filter(r=>e.includes(r));v(r.length===j.length?k:r)},radius:C,onRadiusChange:e=>h(e??k),radiusMin:0,radiusMax:40,radiusStep:o.step??1,radiusPlaceholder:String(a),disabled:l.readOnly})})}function A(e=m){return{colourField:r=>({type:"custom",render:o=>/* @__PURE__ */f(w,{o:r,say:e,props:o})}),borderField:r=>({type:"custom",render:o=>/* @__PURE__ */f(C,{o:r,say:e,props:o})}),cornersField:r=>({type:"custom",render:o=>/* @__PURE__ */f(F,{o:r,say:e,props:o})})}}var{colourField:O,borderField:x,cornersField:I}=A();export{k as BORDER_WIDTH_MAX,B as CORNER_RADIUS_MAX,j as CORNER_SIDES,x as borderField,O as colourField,I as cornersField,v as keptByRow,A as styleFieldBuilders};
|