efficient-easel 0.99.2 → 0.101.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.
Files changed (108) hide show
  1. package/README.md +233 -17
  2. package/dist/autosave/index.d.ts +11 -5
  3. package/dist/blocks/index.d.ts +1 -1
  4. package/dist/canvas/index.d.ts +2 -2
  5. package/dist/canvas/index.js +1 -1
  6. package/dist/chrome/chrome.css +96 -29
  7. package/dist/chrome/index.d.ts +67 -18
  8. package/dist/chrome/index.js +25 -21
  9. package/dist/{chunk-JYPOOHII.js → chunk-2FZJWH24.js} +3 -3
  10. package/dist/chunk-3EDSDPIP.js +1 -0
  11. package/dist/chunk-546BBOPE.js +1 -0
  12. package/dist/chunk-67GNT6PF.js +1 -0
  13. package/dist/chunk-EOJNJCMJ.js +16 -0
  14. package/dist/chunk-EWVJSRRY.js +6 -0
  15. package/dist/chunk-FPOKPNO4.js +1 -0
  16. package/dist/chunk-H24N5TMZ.js +11 -0
  17. package/dist/chunk-IG3U5NWJ.js +1 -0
  18. package/dist/chunk-JUQ6YJCG.js +1 -0
  19. package/dist/chunk-KTVH2ZRL.js +15 -0
  20. package/dist/{chunk-PI26YXYD.js → chunk-L5KW4HG5.js} +16 -8
  21. package/dist/chunk-M6F6LS3H.js +1 -0
  22. package/dist/chunk-P6O363EE.js +6 -0
  23. package/dist/chunk-PAELDYYS.js +1 -0
  24. package/dist/chunk-QTLAVDJE.js +1 -0
  25. package/dist/chunk-UH7IGZKF.js +1 -0
  26. package/dist/chunk-WZ7TGAAT.js +3 -0
  27. package/dist/chunk-ZFDCDJNZ.js +16 -0
  28. package/dist/chunk-ZJEBF4NB.js +1 -0
  29. package/dist/chunk-ZNS7727Y.js +12 -0
  30. package/dist/copy/copy.css +442 -5
  31. package/dist/copy/index.d.ts +302 -5
  32. package/dist/copy/index.js +32 -10
  33. package/dist/drag/drag.css +10 -1
  34. package/dist/drag/index.d.ts +99 -8
  35. package/dist/drag/index.js +18 -17
  36. package/dist/easel/easel.css +15 -0
  37. package/dist/easel/index.d.ts +104 -33
  38. package/dist/easel/index.js +9 -1
  39. package/dist/edit-lock/index.d.ts +1 -3
  40. package/dist/edit-lock/index.js +1 -1
  41. package/dist/fields/fields.css +270 -38
  42. package/dist/fields/index.d.ts +209 -26
  43. package/dist/fields/index.js +22 -53
  44. package/dist/gold/index.js +1 -1
  45. package/dist/icons/index.d.ts +13 -1
  46. package/dist/icons/index.js +1 -1
  47. package/dist/index.d.ts +2 -2
  48. package/dist/index.js +1 -1
  49. package/dist/markup/index.d.ts +111 -10
  50. package/dist/markup/index.js +1 -1
  51. package/dist/menu/index.d.ts +58 -5
  52. package/dist/menu/index.js +1 -15
  53. package/dist/menu/menu.css +17 -6
  54. package/dist/node-ops/index.d.ts +1 -1
  55. package/dist/node-ops/index.js +1 -1
  56. package/dist/panel/index.d.ts +83 -4
  57. package/dist/panel/index.js +18 -16
  58. package/dist/panel/panel.css +135 -62
  59. package/dist/pick/index.d.ts +78 -2
  60. package/dist/pick/index.js +7 -14
  61. package/dist/pick/pick.css +197 -10
  62. package/dist/rail/index.d.ts +3 -7
  63. package/dist/rail/index.js +1 -1
  64. package/dist/strings/catalogue.d.ts +13 -35
  65. package/dist/strings/catalogue.js +1 -1
  66. package/dist/strings/index.d.ts +12 -18
  67. package/dist/strings/index.js +2 -2
  68. package/dist/style-clipboard/index.d.ts +1 -1
  69. package/dist/style-clipboard/index.js +1 -1
  70. package/dist/text-styles/index.d.ts +328 -0
  71. package/dist/text-styles/index.js +38 -0
  72. package/dist/text-styles/text-styles.css +309 -0
  73. package/dist/tree/index.d.ts +43 -2
  74. package/dist/tree/index.js +1 -1
  75. package/dist/tree/tree.css +71 -0
  76. package/dist/{types-p9j2Fac7.d.ts → types-DGcCsxs8.d.ts} +72 -7
  77. package/dist/{types-Bs_gVkVI.d.ts → types-DWS-s9z-.d.ts} +1 -9
  78. package/dist/{types-DO-b0LNj.d.ts → types-Djdq6Xkd.d.ts} +9 -8
  79. package/dist/{types-BOSGNvil.d.ts → types-E3HrTPg2.d.ts} +7 -13
  80. package/dist/{types-C7HFvdtk.d.ts → types-VqL6t5HH.d.ts} +82 -5
  81. package/dist/{watch-B5RTR-WX.d.ts → watch-BTYOJpQU.d.ts} +18 -1
  82. package/dist/{words-DagJdwIA.d.ts → words-AHHfiaRY.d.ts} +31 -2
  83. package/dist/words-BGrHZAJJ.d.ts +46 -0
  84. package/dist/{words-c-3h9xQQ.d.ts → words-BMzV04b1.d.ts} +1 -1
  85. package/dist/words-CRYvAiHX.d.ts +105 -0
  86. package/dist/words-D8kf071T.d.ts +93 -0
  87. package/dist/{words-N4ebT88_.d.ts → words-DgHcY5qB.d.ts} +9 -3
  88. package/dist/{words-C74EUpFr.d.ts → words-XH0TvZPg.d.ts} +60 -4
  89. package/package.json +8 -8
  90. package/dist/chunk-66CKSTXP.js +0 -14
  91. package/dist/chunk-672FAEKU.js +0 -1
  92. package/dist/chunk-67VZRQLG.js +0 -13
  93. package/dist/chunk-6PS6STGA.js +0 -1
  94. package/dist/chunk-7A7O2JWQ.js +0 -1
  95. package/dist/chunk-7JTL3P6P.js +0 -1
  96. package/dist/chunk-F2PIG3AA.js +0 -10
  97. package/dist/chunk-H4B72XCJ.js +0 -1
  98. package/dist/chunk-KDIVA6WD.js +0 -1
  99. package/dist/chunk-MCLBHENY.js +0 -1
  100. package/dist/chunk-QB3BZIRA.js +0 -5
  101. package/dist/chunk-SJQG5ENJ.js +0 -1
  102. package/dist/chunk-SUO5627P.js +0 -1
  103. package/dist/chunk-XUE5O62R.js +0 -3
  104. package/dist/chunk-ZT7M24XD.js +0 -1
  105. package/dist/editor/index.d.ts +0 -10
  106. package/dist/editor/index.js +0 -1
  107. package/dist/words-CD3WADyb.d.ts +0 -51
  108. /package/dist/{chunk-2PHD4L6A.js → chunk-OWBO4WKA.js} +0 -0
@@ -1 +0,0 @@
1
- import{zoneKey as e}from"./chunk-KRXQM65X.js";import{useRef as t,useEffect as n,useState as r,useSyncExternalStore as o,useCallback as i}from"react";var c=56,l=16;function u(e){const t=Math.max(e,0);return t>=c?0:Math.ceil(16*(1-t/c))}function a(e,t,n){if(e<t-c||e>n+c)return 0;const r=e-t,o=n-e;return r<c&&r<=o?-u(r):o<c?u(o):0}function s(e){const t=e?.ownerDocument?.defaultView;for(let n=e?.parentElement??null;n;n=n.parentElement){const e=t?.getComputedStyle(n).overflowY;if(("auto"===e||"scroll"===e)&&n.scrollHeight>n.clientHeight)return n}return null}function f(e){const t=e?.ownerDocument?.defaultView?.getComputedStyle(e).overflowY;return e&&("auto"===t||"scroll"===t)&&e.scrollHeight>e.clientHeight?e:s(e)}function d(e){const t=e.ownerDocument,n=t.defaultView;if(!n)return()=>{};let r=null,o=0;const i=e=>{r=e.clientY},c=()=>{if(null!==r){const t=e.getBoundingClientRect(),n=a(r,t.top,t.bottom);n&&(e.scrollTop+=n)}o=n.requestAnimationFrame(c)};return t.addEventListener("dragover",i,!0),o=n.requestAnimationFrame(c),()=>{t.removeEventListener("dragover",i,!0),n.cancelAnimationFrame(o)}}function g(){let e=null,t=null;const n=/* @__PURE__ */new Set,r=()=>{if(t!==e){t=e;for(const e of[...n])e()}};return{get:()=>e,shown:()=>t,start(t){e=t,globalThis.setTimeout(r,0)},end(){null===e&&null===t||(e=null,r())},subscribe:e=>(n.add(e),()=>{n.delete(e)})}}function p(e,t,n,r){if(e.into)return{side:"into",to:e.into};return"first"===e.pinned||"last"!==e.pinned&&t>n+r/2?{side:"after",to:{...e.place,index:e.place.index+1}}:{side:"before",to:{...e.place,index:e.place.index}}}var m=(t,n)=>e(t)===e(n);function v(e,t){return m(e,t)&&(t.index===e.index||t.index===e.index+1)}function D(e,t){return m(e,t)&&e.index<t.index?t.index-1:t.index}function y(e,t){return{...e,index:t<0?e.index-1:e.index+2}}function w(e,t){if(!t)return e;const n={...t,...e};for(const[r,o]of Object.entries(e)){const e=t[r];"function"==typeof o&&"function"==typeof e&&(n[r]=t=>{o(t),e(t)})}return n}function x(c){const l=t(c);n(()=>{l.current=c});const[u]=r(()=>g()),a=c.session??u,m=o(a.subscribe,a.shown,a.shown),[D,y]=r(null),x=t(null),b=i(()=>{x.current?.(),x.current=null},[]),h=i(()=>{b(),a.end(),y(null)},[a,b]);n(()=>a.subscribe(()=>{a.get()||(b(),y(null))}),[a,b]),n(()=>b,[b]);const T=i((e,t)=>{y(n=>n&&n.key===e&&n.side===t?n:{key:e,side:t})},[]),k=i(e=>{y(t=>t&&t.key===e?null:t)},[]),E=(e,t,n,r)=>!("into"===n?r===e.key:void 0!==e.from&&v(e.from,t))&&l.current.canDrop(e.item,t);return{dragging:m?.item??null,row:(e,t)=>{const{keyOf:n,readOnly:r}=l.current,o=n(e.item),i=!r&&!e.pinned&&!1!==e.canDrag,c=t=>{const n=t.currentTarget.getBoundingClientRect();return p(e,t.clientY,n.top,n.height)},u={draggable:i||void 0,onDragStart:i?t=>{const n=t.currentTarget;a.start({key:o,item:e.item,from:e.place}),t.dataTransfer.effectAllowed="move";try{t.dataTransfer.setData("text/plain",o)}catch{}n.classList.add("is-lifting");const r=n.getBoundingClientRect();t.dataTransfer.setDragImage?.(n,t.clientX-r.left,t.clientY-r.top),n.ownerDocument.defaultView?.setTimeout(()=>n.classList.remove("is-lifting"),0);const i=s(n);b(),x.current=i?d(i):null}:void 0,onDragEnd:i?()=>h():void 0,onDragOver:e=>{const t=a.get();if(!t)return;const n=c(e);E(t,n.to,n.side,o)?(e.preventDefault(),e.dataTransfer.dropEffect="move",T(o,n.side)):k(o)},onDrop:e=>{const t=a.get();if(!t)return;const n=c(e);E(t,n.to,n.side,o)&&(e.preventDefault(),h(),l.current.onDrop(t.item,n.to))},onKeyDown:t=>{if("ArrowUp"!==t.key&&"ArrowDown"!==t.key)return;if(!t.altKey||t.ctrlKey||t.metaKey||t.shiftKey)return;if(t.preventDefault(),t.repeat||!i)return;const{onStep:n,canStep:r}=l.current,o="ArrowUp"===t.key?-1:1;n&&!1!==r?.(e.item,o)&&n(e.item,o)}};return{draggable:i,dragging:m?.key===o,drop:D?.key===o?D.side:void 0,rowProps:w(u,t)}},seam:(t,n)=>{const r=(o=t.place,`seam:${e(o)}:${o.index}`);var o;const i={onDragOver:e=>{const n=a.get();n&&(E(n,t.place,"before",r)?(e.preventDefault(),e.dataTransfer.dropEffect="move",T(r,"before")):k(r))},onDrop:e=>{const n=a.get();n&&E(n,t.place,"before",r)&&(e.preventDefault(),h(),l.current.onDrop(n.item,t.place))}};return{drop:D?.key===r,seamProps:w(i,n)}},rootProps:e=>w({onDragEnter:e=>{if(!a.get()||x.current)return;const t=f(e.currentTarget);x.current=t?d(t):null},onDragLeave:e=>{const t=e.relatedTarget;t&&e.currentTarget.contains(t)||y(null)}},e)}}export{c as AUTO_SCROLL_EDGE,l as AUTO_SCROLL_MAX_SPEED,a as autoScrollDelta,u as autoScrollSpeed,g as createDragSession,p as dropOnRow,D as gapToMoveIndex,v as isNoOpDrop,f as scrollBoxOf,s as scrollParent,d as startAutoScroll,y as stepGap,x as useTreeDrag};
@@ -1 +0,0 @@
1
- var t={settings:"Settings",buckets:{Content:"Content",Style:"Style",Layout:"Layout",Animation:"Animation"}};export{t as DEFAULT_PANEL_WORDS};
@@ -1 +0,0 @@
1
- import{DEFAULT_STYLE_CLIPBOARD_WORDS as o}from"./chunk-6WY6ZXJG.js";import{DEFAULT_NODE_MENU_WORDS as r}from"./chunk-WK3AFPXY.js";import{DEFAULT_PICK_WORDS as t}from"./chunk-ZAOM6PFH.js";import{DEFAULT_CANVAS_WORDS as m}from"./chunk-AELNNAFM.js";import{DEFAULT_FIELDS_WORDS as n}from"./chunk-SUO5627P.js";import{DEFAULT_TREE_WORDS as c}from"./chunk-H4B72XCJ.js";import{DEFAULT_PANEL_WORDS as f}from"./chunk-7A7O2JWQ.js";import{DEFAULT_SAVE_WORDS as p}from"./chunk-H6DDIBQ4.js";import{DEFAULT_CHROME_WORDS as s,DEFAULT_NOTICE_WORDS as i}from"./chunk-KDIVA6WD.js";import{DEFAULT_LOCK_WORDS as u}from"./chunk-RE4LP46F.js";import{DEFAULT_RAIL_WORDS as e}from"./chunk-2OAZYSWJ.js";import{DEFAULT_COPY_WORDS as k}from"./chunk-ZT7M24XD.js";import{DEFAULT_DRAG_WORDS as j}from"./chunk-O2NLQBFX.js";var h={notice:i,lock:u,save:p,chrome:s,rail:e,tree:c,panel:f,fields:n,pick:t,drag:j,menu:r,styleClipboard:o,copy:k,canvas:m},l=o=>"object"==typeof o&&null!==o;function a(o,r){const t={};for(const m of Object.keys(o)){const n=o[m],c=r[m];null==c?t[m]=n:l(n)?t[m]=l(c)?a(n,c):n:t[m]=typeof c==typeof n?c:n}return t}function A(o,r){return r?a(o,r):o}var y=h,O=A;export{h as DEFAULT_EASEL_STRINGS,y as DEFAULT_EDITOR_STRINGS,A as mergeEaselStrings,O as mergeEditorStrings};
@@ -1,10 +0,0 @@
1
- import{toItemSelector as e,fromItemSelector as t,useNodeOps as n}from"./chunk-D2BCHTQR.js";import{DEFAULT_CANVAS_WORDS as o}from"./chunk-AELNNAFM.js";import{useResolvedFields as r}from"./chunk-YRLPFZW3.js";import{useWords as a}from"./chunk-MFIRYGHW.js";import{setCanvasNonce as i}from"./chunk-ZNCEOSXO.js";import{find as s,ROOT_ID as l,getList as d,remove as c,parseZoneKey as u,move as p,duplicate as h,replaceNode as f,createNode as m,insert as v,normalizeData as y,createResolveCache as g,resolveNodeData as k,ROOT_SLOT as b}from"./chunk-KRXQM65X.js";import{topLevelSlotKeys as w,fieldsFrom as S,defaultsFrom as I}from"./chunk-NKB3KVAB.js";import{createContext as C,useEffect as x,useContext as E,useRef as O,useSyncExternalStore as A,useState as D,useLayoutEffect as z,useMemo as M,useCallback as Z}from"react";import{jsx as $,jsxs as N}from"react/jsx-runtime";import{createPortal as R}from"react-dom";function B(e){return!["setData","setUi","set"].includes(e.type)}var j=(e,t,n,o)=>{const r=d(e,t,u(n));return r?.[o]??null},L=(e,t,n,o,r)=>{const a=j(e,t,n,o);if(!a)throw new Error(`${r}: nothing at ${n}[${o}]`);return a};function P(t,n){const{selection:o}=t;return{...t.ui,itemSelector:e(t.data,n,o),selectedSlot:o&&"slot"===o.kind?{parentId:o.parentId,slot:o.slot}:null}}function K(e,t,n){return n?"node"===n.kind?s(e,t,n.id)?n:null:n.parentId===l?d(e,t,n)?n:null:s(e,t,n.parentId)&&d(e,t,n)?n:null:null}function F(e,n,o,r=!1){const{itemSelector:a,selectedSlot:i,...s}=o;let l=e.selection;var d;return"itemSelector"in o&&(l=t(e.data,n,a??null)),"selectedSlot"in o&&(i?l=(d=i)?{kind:"slot",parentId:d.parentId,slot:d.slot}:null:"slot"===l?.kind&&(l=null)),{...e,selection:l,ui:r?s:{...e.ui,...s}}}function H(e,t,n){const o=V(e,t,n);if(o===e)return e;const r=K(o.data,n,o.selection);return r===o.selection?o:{...o,selection:r}}function V(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 F(e,n,"function"==typeof t.ui?t.ui(P(e,n)):t.ui);case"set":{const r={data:o,ui:P(e,n)},a="function"==typeof t.state?t.state(r):t.state;let i=a.data?{...e,data:a.data}:e;return a.ui&&(i=F(i,n,a.ui,!0)),i}case"insert":{const r={...u(t.destinationZone),index:t.destinationIndex},a=m(n,t.componentType,{},t.id?{id:t.id}:{});return{...e,data:v(o,n,r,a)}}case"replace":{const r=L(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:f(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=L(o,n,t.sourceZone,t.sourceIndex,"duplicate"),a=h(o,n,r.props.id),i=j(a,n,t.sourceZone,t.sourceIndex+1);return{...e,data:a,selection:i?{kind:"node",id:i.props.id}:e.selection}}case"reorder":return V(e,{...t,type:"move",sourceZone:t.destinationZone},n);case"move":{if(t.sourceZone===t.destinationZone&&t.sourceIndex===t.destinationIndex)return e;const r=j(o,n,t.sourceZone,t.sourceIndex);if(!r)return e;const a={...u(t.destinationZone),index:t.destinationIndex};return{...e,data:p(o,n,r.props.id,a)}}case"remove":{const r=L(o,n,t.zone,t.index,"remove");return{...e,data:c(o,n,r.props.id)}}default:return e}}var T={drag:!0,duplicate:!0,delete:!0,edit:!0,insert:!0},q={leftSideBarVisible:!0,rightSideBarVisible:!0,arrayState:{},componentList:{},isDragging:!1,previewMode:"edit",viewports:{current:{width:360,height:"auto"},options:[],controlsVisible:!0},field:{focus:null}},Y=0,U=()=>`history-${Y+=1}`;function W(n){let o=n.config;const r=n.now??(()=>Date.now()),a=n.historyCoalesceMs??250;let i=n.permissions??{};const l=y(n.data,o);let c={data:l,selection:null,ui:{...q}};if(n.ui){const{itemSelector:e,selectedSlot:r,...a}=n.ui;c={data:l,selection:r?{kind:"slot",...r}:t(l,o,e??null),ui:{...q,...a}}}let u=[{core:c,at:-1/0,sealed:!0,id:U()}],p=0;const h=e=>{const t=u[p],n=r();!e&&p===u.length-1&&p>0&&!t.sealed&&n-t.at<a?u=[...u.slice(0,p),{...t,core:c,at:n}]:(u=[...u.slice(0,p+1),{core:c,at:n,sealed:e,id:U()}],p=u.length-1)},m=/* @__PURE__ */new Set;let v=null,b=null,w=0,S=null,I=!1;const C=()=>{for(const e of[...m])e()},x=()=>{u=[...u.slice(0,p),{...u[p],core:c},...u.slice(p+1)]},E=(e,t)=>{w>0?I=I||t:(t?h(!1):c!==e&&x(),c.data!==e.data&&n.onChange?.(c.data),c!==e&&C())},O=e=>{const t=c;if(c=H(c,e,o),c===t)return;const n=e.recordHistory??B(e);E(t,n&&c.data!==t.data)},A=e=>{0===w&&(S=c,I=!1),w+=1;try{e()}catch(e){throw w-=1,0===w&&S&&(c=S,S=null),e}if(w-=1,w>0||!S)return;const t=S;S=null,I&&c.data!==t.data?h(!0):c!==t&&x(),c.data!==t.data&&n.onChange?.(c.data),c!==t&&C()},D=e=>{const t=c,n=K(c.data,o,e);var r,a;(r=n,a=c.selection,r===a||r&&a&&r.kind===a.kind&&("node"===r.kind&&"node"===a.kind?r.id===a.id:"slot"===r.kind&&"slot"===a.kind&&r.parentId===a.parentId&&r.slot===a.slot))||(c={...c,selection:n},E(t,!1))},z=e=>{const t=c;p=e,c=u[p].core,c.data!==t.data&&n.onChange?.(c.data),c!==t&&C()},M=(e={})=>{const t=e.root?o.root?.permissions:o.components[e.item?.type??e.type??""]?.permissions;return{...T,...i,...t}},Z=g(),$={resolveCache:Z,async resolveAll({trigger:e="load",metadata:t}={}){const n=c.data,r={type:"root",props:{...n.root.props??{}}},a=[...n.content,...Object.values(n.zones??{}).flat()],[i,...l]=await Promise.all([k(r,o,{cache:Z,trigger:e,metadata:t}),...a.map(n=>k(n,o,{cache:Z,trigger:e,metadata:t}))]);A(()=>{const e=c;let t=c.data;l.forEach((e,r)=>{if(!e.didChange)return;const i=a[r].props.id,l=s(t,o,i)?.node;l&&l===s(n,o,i)?.node&&(t=f(t,o,i,e.node))}),i.didChange&&t.root===n.root&&(t={...t,root:{...t.root,props:i.node.props,readOnly:i.node.readOnly??t.root.readOnly}}),t!==c.data&&(c={...c,data:t,selection:K(t,o,c.selection)},E(e,!1))})},get config(){return o},getState(){if(v&&b===c)return v;const t=c,n={data:t.data,ui:P(t,o)},r="node"===t.selection?.kind?s(t.data,o,t.selection.id)?.node??null:null;return v={appState:n,selection:t.selection,selectedItem:r,config:o,dispatch:O,history:{back:()=>$.undo(),forward:()=>$.redo(),hasPast:p>0,hasFuture:p<u.length-1,histories:u.map(e=>({id:e.id,state:{data:e.core.data,ui:P(e.core,o)}})),index:p,setHistoryIndex:e=>{e>=0&&e<u.length&&e!==p&&z(e)}},getPermissions:M,getItemById:e=>s(t.data,o,e)?.node,getItemBySelector:e=>function(e,t,n){const[o,r]=(n.zone??"root:default-zone").split(/:(.*)/s);return d(e,t,{parentId:o,slot:r})?.[n.index]}(t.data,o,e),getSelectorForId:n=>{const r=e(t.data,o,{kind:"node",id:n});return r?{index:r.index,zone:r.zone??"root:default-zone"}:void 0}},b=t,v},subscribe:e=>(m.add(e),()=>{m.delete(e)}),dispatch:O,batch:A,select:e=>D(e?{kind:"node",id:e}:null),selectSlot:e=>D(e?{kind:"slot",parentId:e.parentId,slot:e.slot}:null),run(e){A(()=>{const t=c,n=void 0===e.select?c.selection:e.select;c={...c,data:e.data,selection:K(e.data,o,n)},E(t,e.data!==t.data)})},load(e,t={}){const n=c,r=y(e,o);c={...c,data:r,selection:K(r,o,t.selection??c.selection)},t.keepHistory||(u=[{core:c,at:-1/0,sealed:!0,id:U()}],p=0),c!==n&&C()},undo(){p>0&&z(p-1)},redo(){p<u.length-1&&z(p+1)},setPermissions(e){i=e,v=null,C()},setConfig(e){e!==o&&(o=e,v=null,C())}};return $}var X=W;function Q(e,t){const n=e=>{if(e.altKey)return;e.metaKey!==e.ctrlKey&&("KeyZ"===e.code?(e.preventDefault(),e.shiftKey?t.redo():t.undo()):"KeyY"!==e.code||e.shiftKey||(e.preventDefault(),t.redo()))};return e.addEventListener("keydown",n),()=>e.removeEventListener("keydown",n)}var G=C(null);function J({easel:e,hotkeys:t=!0,resolveOnMount:n=!0,children:o}){return x(()=>{n&&e.resolveAll()},[e,n]),x(()=>{if(t&&"undefined"!=typeof document)return Q(document,e)},[e,t]),/* @__PURE__ */$(G.Provider,{value:e,children:o})}function _(){const e=E(G);if(!e)throw new Error("useEasel: no <EaselProvider> above this component");return e}function ee(e){const t=_(),n=O({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 a=e(o);return r.has&&Object.is(r.value,a)?(n.current={view:o,selector:e,value:r.value,has:!0},r.value):(n.current={view:o,selector:e,value:a,has:!0},a)};return A(t.subscribe,o,o)}function te(){return function(e){return ee(e)}}function ne({editor:e,...t}){/* @__PURE__ */
2
- return $(J,{easel:e,...t})}var oe=_,re=ee,ae=te,ie="data-puck-component",se="data-puck-dropzone",le={},de="data-es-mirror";function ce(e,t,n){for(const e of Array.from(t.head.querySelectorAll(`[${de}]`)))e.remove();for(const o of Array.from(e.head.querySelectorAll('style, link[rel="stylesheet"]'))){const e=o.cloneNode(!0);e.setAttribute(de,""),n&&e.setAttribute("nonce",n),t.head.appendChild(e)}}function ue({children:e,id:t="preview-frame",title:n,className:r,style:s,mirrorStyles:l=!0,onDocument:d,height:c="auto",nonce:u}){const p=a("canvas",o),h=O(null),[f,m]=D(null);return z(()=>{const e=h.current,t=f?.ownerDocument.defaultView;if("auto"!==c||!e||!f||!t)return;const n=()=>{e.style.height=`${Math.ceil(f.getBoundingClientRect().height)}px`};n();const o=t.ResizeObserver,r=o?new o(n):null;return r?.observe(f),()=>r?.disconnect()},[f,c]),z(()=>{let e=h.current?.contentDocument;if(!e)return;"CSS1Compat"!==e.compatMode&&(e.open(),e.write("<!DOCTYPE html><html><head></head><body></body></html>"),e.close(),e=h.current?.contentDocument??e),e.body||e.documentElement.appendChild(e.createElement("body")),e.body.style.margin="0";const t=e.createElement("div");t.setAttribute("data-puck-entry",""),t.id="frame-root","fill"===c&&t.classList.add("es-frame-fill"),e.body.appendChild(t),i(e,u),m(t),d?.(e);let n=null;const o=h.current?.ownerDocument;if(l&&o){ce(o,e,u);const t=o.defaultView;t&&"MutationObserver"in t&&(n=new t.MutationObserver(()=>ce(o,e,u)),n.observe(o.head,{childList:!0,subtree:!0,characterData:!0}))}return()=>{n?.disconnect(),t.remove(),m(null),d?.(null)}},[]),/* @__PURE__ */$("iframe",{ref:h,id:t,title:n??p.frame,className:r,style:{border:0,width:"100%",display:"block",..."fill"===c?{height:"100%"}:null,...s},children:f?R(e,f):null})}var pe=C(null),he=C(le),fe=[];function me({parentId:e,slot:t,className:n,style:o,minEmptyHeight:r=128}){const a=_(),i=ee(n=>d(n.appState.data,a.config,{parentId:e,slot:t})??fe),s=ee(t=>"node"===t.selection?.kind&&t.selection.id===e&&e!==l),c=ee(n=>"slot"===n.selection?.kind&&n.selection.parentId===e&&n.selection.slot===t),u=E(pe),p=["es-zone"];return i.length&&p.push("has-children"),e===l&&p.push("is-root"),(s||c)&&p.push("is-area-selected"),null!==u&&u===e&&e!==l&&p.push("is-hovering-area"),n&&p.push(n),/* @__PURE__ */$("div",{className:p.join(" "),[se]:`${e}:${t}`,style:{...o,"--min-empty-height":`${r}px`},children:i.map(e=>/* @__PURE__ */$(ge,{node:e},e.props.id))})}function ve(e,t,n,o){const r="root"===t?e.root:e.components[t],a={...o};for(const e of w(S(r)))a[e]=function(t={}){/* @__PURE__ */
3
- return $(me,{parentId:n,slot:e,...t})};return a}function ye(e){return function({zone:t,...n}){/* @__PURE__ */
4
- return $(me,{parentId:e,slot:t,...n})}}function ge({node:e}){const t=_().config,n=t.components[e.type],o=e.props.id,r=function(e){const t=O(null);return M(()=>n=>{const o=t.current;o&&o!==n&&(o.removeAttribute(ie),o.removeAttribute("data-puck-dnd")),t.current=n,n&&(n.setAttribute(ie,e),n.setAttribute("data-puck-dnd",e),n.style.position="relative")},[e])}(o),a=E(he);if(!n?.render)return null;const i=n.render,s=ve(t,e.type,o,{...I(n),...e.props}),l={renderDropZone:ye(o),isEditing:!0,dragRef:n.inline?r:null,metadata:{...a,...n.metadata}};return n.inline?/* @__PURE__ */$(i,{...s,puck:l,editMode:!0}):/* @__PURE__ */$("div",{[ie]:o,"data-puck-dnd":o,style:{position:"relative"},children:/* @__PURE__ */$(i,{...s,puck:l,editMode:!0})})}function ke({metadata:e}){const t=ee(e=>e.config),n=ee(e=>e.appState.data.root).props??{},o=t.root?.render,r=/* @__PURE__ */$(me,{parentId:l,slot:b}),a=o?/* @__PURE__ */$(o,{id:"puck-root",...ve(t,"root",l,n),puck:{renderDropZone:ye(l),isEditing:!0,dragRef:null,metadata:e??{}},editMode:!0,children:r}):r;/* @__PURE__ */
5
- return $(he.Provider,{value:e??le,children:a})}function be({id:e,kind:t,overlay:n}){const o=O(null),[r,a]=D(null);z(()=>{const t=o.current?.ownerDocument,n=t?.defaultView;if(!t||!n||!e)return void a(null);let r=0;const i=()=>{r=0;const i=function(e,t){if(!e||!t)return null;const n=e.getBoundingClientRect(),o=t.getBoundingClientRect();return{top:n.top-o.top,left:n.left-o.left,width:n.width,height:n.height}}(t.querySelector(`[${ie}="${n.CSS?.escape?n.CSS.escape(e):e}"]`),o.current?.parentElement??null);a(e=>{return(t=e)===(n=i)||t&&n&&t.top===n.top&&t.left===n.left&&t.width===n.width&&t.height===n.height?e:i;var t,n})},s=()=>{r||(r=(n.requestAnimationFrame??(e=>n.setTimeout(e,16)))(i))};i();const l="MutationObserver"in n?new n.MutationObserver(s):null;l?.observe(t.body,{childList:!0,subtree:!0,attributes:!0,characterData:!0});const d="ResizeObserver"in n?new n.ResizeObserver(s):null;return d?.observe(t.documentElement),n.addEventListener("resize",s),()=>{l?.disconnect(),d?.disconnect(),n.removeEventListener("resize",s),r&&(n.cancelAnimationFrame??n.clearTimeout)(r)}},[e]);const i=/* @__PURE__ */$("div",{ref:o,"aria-hidden":"true",className:`es-canvas-outline is-${t}`,style:r?{position:"absolute",top:r.top,left:r.left,width:r.width,height:r.height}:{display:"none"}});return n&&e?/* @__PURE__ */$(n,{componentId:e,kind:t,children:i}):i}function we({frame:e=!0,className:t,style:n,metadata:o,mirrorStyles:r,onDocument:a,height:i,title:s,nonce:l,frameWrapper:d,overlay:c,children:u}){const p=_(),[h,f]=D(void 0),m=ee(e=>"node"===e.selection?.kind?e.selection.id:null),[v,y]=D(null),g=/* @__PURE__ */N("div",{className:"es-canvas-content",style:{position:"relative"},onClick:e=>{const t=e.target;t.closest?.("a[href]")&&e.preventDefault();const n=t.closest?.(`[${ie}]`);n?p.select(n.getAttribute(ie)):t.hasAttribute?.(se)||p.select(null)},onMouseOver:e=>{const t=e.target.closest?.(`[${ie}]`),n=t?.getAttribute(ie)??null;n!==v&&y(n)},onMouseLeave:()=>y(null),children:[
6
- /* @__PURE__ */$(pe.Provider,{value:v,children:/* @__PURE__ */$(ke,{metadata:o})}),
7
- /* @__PURE__ */N("div",{className:"es-canvas-outlines",style:{position:"absolute",top:0,left:0,pointerEvents:"none"},children:[
8
- /* @__PURE__ */$(be,{id:v&&v!==m?v:null,kind:"hover",overlay:c}),
9
- /* @__PURE__ */$(be,{id:m,kind:"selected",overlay:c})]}),u]}),k=d?/* @__PURE__ */$(d,{document:h,children:g}):g,b=O(null);/* @__PURE__ */
10
- return $("div",{className:"es-canvas"+(t?` ${t}`:""),style:n,"data-puck-preview":"",children:e?/* @__PURE__ */$(ue,{mirrorStyles:r,onDocument:e=>{b.current?.(),b.current=e?Q(e,p):null,f(e??void 0),a?.(e)},height:i,title:s,nonce:l,children:k}):/* @__PURE__ */$("div",{id:"preview-frame","data-puck-entry":"",children:k})})}var Se=we;function Ie(e={}){const t=_(),o=ee(e=>e.appState.data);return n({...e,data:o,config:t.config,commit:(e,{select:n})=>t.run({data:e,select:n})})}function Ce(){const e=_(),t=ee(e=>e.config),n=e.resolveCache,o=ee(e=>e.selectedItem),a=ee(e=>e.appState.data.root),i=o?o.props.id:"root",l=a.props??{},d=M(()=>o||{type:"root",props:l},[o,l]),c=o?t.components[o.type]:t.root,u=e.getState(),p=o?s(u.appState.data,t,i):null,h=p&&"root"!==p.place.parentId?p.place.parentId:null,f=h?u.getItemById(h)??null:null,{fields:m}=r({id:i,node:d,block:c,parent:f,appState:u.appState}),v=u.getPermissions(o?{item:o}:{root:!0}),y=Z((o,r)=>{(async()=>{const a=e.getState();if("root"!==i){const s=a.getItemById(i),l=a.getSelectorForId(i);if(!s||!l)return;const d={...s,props:{...s.props,[o]:r}},{node:c}=await k(d,t,{cache:n,trigger:"replace"}),u=e.getState().getSelectorForId(i);if(!u)return;return void e.dispatch({type:"replace",destinationZone:u.zone??"root:default-zone",destinationIndex:u.index,data:c})}const s=a.appState.data.root.props??{},{node:l}=await k({type:"root",props:{...s,[o]:r}},t,{cache:n,trigger:"replace"});e.dispatch({type:"replaceRoot",root:{props:l.props,readOnly:l.readOnly},recordHistory:!0})})()},[e,t,n,i]);return{id:i,node:d,fields:m,values:d.props,readOnly:!1===v.edit,onChange:y}}var xe=Ie;export{ue as CanvasFrame,q as DEFAULT_UI,we as EaselCanvas,J as EaselProvider,ke as EditDocument,Se as EditorCanvas,ne as EditorProvider,Q as bindUndoKeys,W as createEasel,X as createEditor,te as createUseEasel,ae as createUseEditor,B as recordsByDefault,H as reduce,P as uiView,ee as useEasel,_ as useEaselApi,Ie as useEaselNodeOps,re as useEditor,oe as useEditorApi,xe as useEditorNodeOps,Ce as useSelectedFields,K as validSelection};
@@ -1 +0,0 @@
1
- var a={dragHint:"Drag to move · ⌥↑ ⌥↓",collapse:"Collapse",expand:"Expand",collapseNamed:({label:a})=>`Collapse ${a}`,expandNamed:({label:a})=>`Expand ${a}`};export{a as DEFAULT_TREE_WORDS};
@@ -1 +0,0 @@
1
- var e={reload:"Reload the saved version",takeOver:"Take over editing",takeBack:"Take it back",viewReadOnly:"View read-only",savedByYou:({noun:e,when:n})=>`You saved this ${e} in another tab or window ${n}.`,savedByOther:({name:e,noun:n,when:o})=>`${e} saved this ${n} ${o}.`,conflictBody:"Your last change was not saved. It is still on screen here, but this copy is out of date — copy anything you need, then reload to carry on from the saved version.",takeOverWhileDeciding:"Nobody else can save while you decide. Nothing on your screen is lost.",tookOver:({name:e,noun:n,when:o})=>`${e} took over this ${n} ${o}.`,tookOverBody:"Your changes since then are still on screen but are no longer being saved.",viewingOnly:"Viewing only.",viewingOnlyBody:({name:e,noun:n,seen:o})=>`${e} is editing this ${n} (last seen ${o}). Nothing you change here is saved.`,editing:({name:e,noun:n})=>`${e} is editing this ${n}`,editingBody:({seen:e})=>`(last seen ${e}). Nothing you change here will be saved while they are in it.`,takeOverTold:"They are told straight away and stop being able to save."},n={device:"Preview device",upLevel:"Go up one level",upLevelTo:({label:e,name:n})=>`${e} to ${n}`,resize:"Drag to resize · double-click to reset"};export{n as DEFAULT_CHROME_WORDS,e as DEFAULT_NOTICE_WORDS};
@@ -1 +0,0 @@
1
- import{removeCanvasStyle as e,upsertCanvasStyle as n}from"./chunk-ZNCEOSXO.js";import{useState as t,useEffect as o,useRef as r}from"react";var c="[data-puck-component]",u="iframe#preview-frame";function s(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 i(e,n,{selector:t=u,readySelector:o}={}){let r=null,c=null,i=!1,l=!1,d=null;const a=()=>{d?.observer.disconnect(),d=null},m=()=>{if(l)return;let e=null;if(r&&s(r)){const n=r.contentDocument;(e=>{if(!o||e.querySelector(o))return a(),!0;if(d?.doc!==e){a();const n=e.defaultView?.MutationObserver;if(n){const t=new n(()=>m());t.observe(e,{childList:!0,subtree:!0}),d={doc:e,observer:t}}}return!1})(n)&&(e={frame:r,document:n,window:r.contentWindow})}else a();(e===c||!!e&&!!c&&e.frame===c.frame&&e.document===c.document)&&i||(i=!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(),a(),r?.removeEventListener("load",f),r=null}}function l(e,{selector:n,readySelector:r}={}){const[c,u]=t(null);return o(()=>{const t=e.current;if(!t)return;const o=i(t,u,{selector:n,readySelector:r});return()=>{o(),u(null)}},[e,n,r]),c}function d(e,n,t,{on:c="document",capture:u=!1}={}){const s=r(t);s.current=t;const i=e?.document??null,l=e?.window??null;o(()=>{const e="window"===c?l:i;if(!e)return;const t=e=>s.current(e);return e.addEventListener(n,t,u),()=>e.removeEventListener(n,t,u)},[i,l,n,c,u])}function a(t,r,c){const u=t?.document??null;o(()=>{if(!u)return;if(!c)return void e(u,r);const t=n(u,r,c),o=u.defaultView?.MutationObserver,s=o?new o(()=>{t.isConnected||n(u,r,c)}):null;return s?.observe(u.head??u.documentElement,{childList:!0}),()=>{s?.disconnect(),e(u,r)}},[u,r,c])}function m(e,{settle:n=[150,450]}={}){const[r,c]=t(0),u=e?.frame??null,s=e?.document??null,i=e?.window??null,l=n.join(",");return o(()=>{if(!u||!s||!i)return;const e=u.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=[],d=(e,n)=>{e.addEventListener(n,r,!0),l.push(()=>e.removeEventListener(n,r,!0))};d(s,"scroll"),d(i,"resize"),e&&(d(e,"scroll"),d(e,"resize"));const a=e?.ResizeObserver;if(a){const e=new a(r);e.observe(u),s.documentElement&&e.observe(s.documentElement),l.push(()=>e.disconnect())}const m=s.defaultView?.MutationObserver,f=s.body??s.documentElement;if(m&&f){const e=new m(r);e.observe(s===u.ownerDocument?u:f,{childList:!0,subtree:!0}),l.push(()=>e.disconnect())}const v=s.fonts;v&&d(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)}},[u,s,i,l]),r}export{c as BLOCK_SELECTOR,u as CANVAS_SELECTOR,s as isFrameReady,d as useCanvasEvent,l as useCanvasFrame,m as useCanvasLayout,a as useCanvasStyle,i as watchCanvasFrame};
@@ -1,5 +0,0 @@
1
- import{wordFitVars as e}from"./chunk-BZ5ASXOL.js";import{jsx as a,jsxs as s}from"react/jsx-runtime";function i({options:i,value:l,onChange:n,ariaLabel:t,fit:r,disabled:d=!1,className:o}){const c=r&&e(i.length,r);
2
- /* @__PURE__ */
3
- return a("div",{className:"es-segs-fit",children:/* @__PURE__ */a("div",{role:"group","aria-label":t,"data-disabled":d||void 0,className:`es-segs${c?" is-measured":""}${o?` ${o}`:""}`,style:c,children:i.map(e=>{const i=e.id===l,t=e.title??("string"==typeof e.label?e.label:void 0),r=d||!0===e.disabled,o=`es-seg${e.icon?" has-icon":""}${i?" is-active":""}`;/* @__PURE__ */
4
- return s("button",{type:"button",title:t,"aria-label":t,"aria-pressed":i,disabled:r,className:o,onClick:()=>n(e.id),children:[e.icon?/* @__PURE__ */a("span",{className:"es-seg-icon","aria-hidden":"true",children:e.icon}):null,
5
- /* @__PURE__ */a("span",{className:"es-seg-word",children:e.label})]},String(e.id))})})})}export{i as SettingsSegmented};
@@ -1 +0,0 @@
1
- var e={bold:{open:"**",close:"**",placeholder:"bold text"},italic:{open:"_",close:"_",placeholder:"italic text"},strike:{open:"~~",close:"~~",placeholder:"struck out"},code:{open:"`",close:"`",placeholder:"code"},highlight:{open:"==",close:"==",placeholder:"highlighted text"},quiet:{open:"^^",close:"^^",placeholder:"quiet text"},underline:{open:"[",close:"]{underline}",placeholder:"underlined text"},sup:{open:"[",close:"]{sup}",placeholder:"superscript"},sub:{open:"[",close:"]{sub}",placeholder:"subscript"}};function t(e){return/^[a-z][a-z0-9-]*$/.test(e)}function n(e,t){const n=/^\{(underline|sup|sub|color=([a-z][a-z0-9-]*))\}/.exec(e.slice(t,t+64));return n?void 0===n[2]?{kind:n[1],length:n[0].length}:{kind:"color",color:n[2],length:n[0].length}:null}var l={bold:e.bold.placeholder,italic:e.italic.placeholder,strike:e.strike.placeholder,code:e.code.placeholder,highlight:e.highlight.placeholder,quiet:e.quiet.placeholder,link:"link text",underline:e.underline.placeholder,sup:e.sup.placeholder,sub:e.sub.placeholder,color:"colored text"},o={bullet:()=>"- ",number:e=>`${e+1}. `,quote:()=>"> "};function r(t,n,r,i,c=p,u=l){if("clear"===i)return M(t,n,r,c);const a=t.slice(n,r);if("link"===i){const e=a||u.link,l=`[${e}](https://)`;return{text:t.slice(0,n)+l+t.slice(r),selectionStart:n+e.length+3,selectionEnd:n+l.length-1}}const d=o[i];if(d){const e=t.lastIndexOf("\n",Math.max(n-1,0))+1,l=t.indexOf("\n",r),o=-1===l?t.length:l,i=t.slice(e,o).split("\n"),s=i.every((e,t)=>e.startsWith(d(t))),c=i.map((e,t)=>s?e.slice(d(t).length):d(t)+e).join("\n");return{text:t.slice(0,e)+c+t.slice(o),selectionStart:e,selectionEnd:e+c.length}}const{open:h,close:f}=e[i],k=i,g=u[k]??l[k];if(s(t,n,r,i))return{text:t.slice(0,n-h.length)+a+t.slice(r+f.length),selectionStart:n-h.length,selectionEnd:n-h.length+a.length};const m=a||g;return{text:t.slice(0,n)+h+m+f+t.slice(r),selectionStart:n+h.length,selectionEnd:n+h.length+m.length}}function i(e,o,r,i,s=l){const c={text:e,selectionStart:o,selectionEnd:r};if(null!==i&&!t(i))return c;const u=e.slice(o,r),a=o>=1&&"["===e[o-1]&&"]"===e[r]?n(e,r+1):null;if("color"===a?.kind){const t=o-1,n=e.slice(r+1+a.length);return null===i?{text:e.slice(0,t)+u+n,selectionStart:t,selectionEnd:t+u.length}:{text:`${e.slice(0,r)}]{color=${i}}${n}`,selectionStart:o,selectionEnd:r}}if(null===i)return c;const d=u||(s.color??l.color);return{text:`${e.slice(0,o)}[${d}]{color=${i}}${e.slice(r)}`,selectionStart:o+1,selectionEnd:o+1+d.length}}function s(t,n,l,o){const r=e[o];if(!r)return!1;const{open:i,close:s}=r;return n>=i.length&&t.slice(n-i.length,n)===i&&t.slice(l,l+s.length)===s}function c(e,t,n){const l=0===t?0:e.lastIndexOf("\n",t-1)+1;for(let o=e.lastIndexOf("[",t);o>=l;o=0===o?-1:e.lastIndexOf("[",o-1)){const t=$(e,o);if(t&&n<=t.end)return{start:o,end:t.end,label:t.label,href:t.href}}return null}function u(e,t,n,l){const o=c(e,t,n),r=o?o.start:t,i=o?o.end:n,s=`[${o?o.label:e.slice(t,n)||l}](${l})`,u=r+s.length;return{text:e.slice(0,r)+s+e.slice(i),selectionStart:u,selectionEnd:u}}function a(e,t){return{text:e.slice(0,t.start)+t.label+e.slice(t.end),selectionStart:t.start,selectionEnd:t.start+t.label.length}}var d=[{style:"bold",label:"B",name:"Strong",title:"Strong · **words** · ⌘B",shortcut:"b"},{style:"italic",label:"I",name:"Italic",title:"Italic · _words_ · ⌘I",shortcut:"i"},{style:"strike",label:"S",name:"Strikethrough",title:"Strikethrough · ~~words~~"},{style:"highlight",label:"◆",name:"Emphasis",title:"Emphasis · ==words=="},{style:"quiet",label:"a",name:"Quiet",title:"Quiet · ^^words^^"},{style:"code",label:"‹›",name:"Code",title:"Code"},{style:"link",label:"🔗",name:"Link",title:"Link · [words](https://…) · ⌘K",shortcut:"k"},{style:"bullet",label:"•",name:"Bulleted list",title:"Bulleted list"},{style:"number",label:"1.",name:"Numbered list",title:"Numbered list"},{style:"quote",label:"❝",name:"Quote",title:"Quote"},{style:"clear",label:"T×",name:"Clear marks",title:"Clear marks · ⌘⇧X",shortcut:"shift+x"}],h={bold:"Strong",highlight:"Emphasis",quiet:"Quiet"};function f(e){return d.filter(t=>e.includes(t.style))}var p=[{open:"**",close:"**",kind:"bold"},{open:"==",close:"==",kind:"highlight"},{open:"~~",close:"~~",kind:"strike"},{open:"_",close:"_",kind:"italic",wordBoundary:!0},{open:"^^",close:"^^",kind:"quiet"},{open:"@@",close:"@@",kind:"highlight"},{open:"++",close:"++",kind:"bold"}],k=d.map(e=>e.style).filter(e=>p.some(t=>t.kind===e)),g=[...p,{open:"*",close:"*",kind:"accent"}],m=[...p,{open:"*",close:"*",kind:"accent"},{open:"#",close:"#",kind:"bold",notBefore:"0123456789"},{open:"[",close:"]",kind:"italic",notBefore:"(",notBeforeBlock:!0}];function b(e){return!/\s/.test(e)&&!/[!-\/:-@[-`{-~]/.test(e)}function x(e,t){const n=[];let l="",o=0;for(;o<e.length;){const r=S(e,o,t);r?(n.push({kind:"text",text:l}),l="",n.push({kind:r.rule.kind,text:r.inner}),o=r.end):(l+=e[o],o+=1)}return n.push({kind:"text",text:l}),n}function S(e,t,l){for(const o of l){if(!e.startsWith(o.open,t))continue;if(o.wordBoundary&&t>0&&b(e[t-1]))continue;const l=t+o.open.length,r=e.indexOf(o.close,l);if(r<l+1)continue;const i=e.slice(l,r);if(i.includes(o.close[0]))continue;if(i.includes("\n"))continue;const s=r+o.close.length,c=e[s];if((!o.notBefore||void 0===c||!o.notBefore.includes(c))&&!(o.notBeforeBlock&&n(e,s)||o.wordBoundary&&void 0!==c&&b(c)))return{rule:o,inner:i,end:s}}return null}function y(e,t){return x(e,t).map(e=>e.text).join("")}var v=["http","https","mailto","tel"];function E(e){if(""===e||/[\s\u0000-\u001f\u007f]/.test(e))return!1;const t=/^([a-zA-Z][a-zA-Z0-9+.-]*):/.exec(e);return!t||v.includes(t[1].toLowerCase())}function $(e,t){if("["!==e[t])return null;const n=e.indexOf("]",t+1);if(n<t+2||"("!==e[n+1])return null;const l=e.slice(t+1,n);if(l.includes("["))return null;const o=e.indexOf(")",n+2);if(-1===o)return null;const r=e.slice(n+2,o);return E(r)?{label:l,href:r,end:o+1}:null}function B(e,t){if("["!==e[t])return null;let l=0;for(let o=t;o<e.length;o+=1){const r=e[o];if("\n"===r)return null;if("["===r)l+=1;else if("]"===r){if(l-=1,l>0)continue;if(o===t+1)return null;const r=n(e,o+1);return r?{kind:r.kind,color:r.color,label:e.slice(t+1,o),close:e.slice(o,o+1+r.length),end:o+1+r.length}:null}}return null}var w=4;function q(e,t,n){const l=[];let o="";const r=()=>{o&&l.push({kind:"text",text:o}),o=""},i=e=>n+1<w?q(e,t,n+1):[{kind:"text",text:e}];let s=0;for(;s<e.length;){const n=$(e,s);if(n){r(),l.push({kind:"link",href:n.href,children:i(n.label)}),s=n.end;continue}const c=B(e,s);if(c){r(),l.push({kind:c.kind,open:"[",close:c.close,...void 0===c.color?{}:{color:c.color},children:i(c.label)}),s=c.end;continue}const u=S(e,s,t);u?(r(),l.push({kind:u.rule.kind,open:u.rule.open,close:u.rule.close,children:i(u.inner)}),s=u.end):(o+=e[s],s+=1)}return r(),l}function O(e,t){return e.split("\n").map(e=>{const{bullet:n,number:l,rest:o}=function(e){if(e.startsWith("- ")&&""!==e.slice(2).trim())return{bullet:!0,number:null,rest:e.slice(2)};const t=/^([0-9]{1,3})\. /.exec(e);return t&&""!==e.slice(t[0].length).trim()?{bullet:!1,number:t[1],rest:e.slice(t[0].length)}:{bullet:!1,number:null,rest:e}}(e);return{bullet:n,number:l,children:q(o,t,0)}})}function I(e){return null!=e.number?`${e.number}. `:e.bullet?"- ":""}function z(e){return e.map(e=>"text"===e.kind?e.text:"link"===e.kind?`[${z(e.children)}](${e.href})`:e.open+z(e.children)+e.close).join("")}function _(e){return e.map(e=>I(e)+z(e.children)).join("\n")}function C(n,l,o){if("link"===l)return void 0===o?null:{id:n,kind:"link",open:"[",close:`](${o})`,href:o};if("color"===l)return void 0!==o&&t(o)?{id:n,kind:"color",open:"[",close:`]{color=${o}}`,color:o}:null;const r=e[l];return r&&"code"!==l?{id:n,kind:l,open:r.open,close:r.close}:null}function Q(e,t){let n=0,l=0;return e.split("\n").map(e=>{const[o]=O(e,t);let r=l+I(o).length;l+=e.length+1;const i=[],s=(e,t)=>{for(const l of e){if("text"===l.kind){for(const e of l.text)i.push({ch:e,marks:t,at:r}),r+=e.length;continue}const e="link"===l.kind?C(++n,"link",l.href):{id:++n,kind:l.kind,open:l.open,close:l.close,...void 0===l.color?{}:{color:l.color}};r+=e.open.length,s(l.children,[...t,e]),r+=e.close.length}};return s(o.children,[]),{bullet:o.bullet,number:o.number??null,chars:i}})}function j(e){let t="";const n=[];return e.forEach((e,l)=>{l>0&&(t+="\n"),t+=I(e);const o=[],r=[];for(const n of e.chars){let e=0;for(;e<o.length&&e<n.marks.length&&o[e].id===n.marks[e].id;)e+=1;for(;o.length>e;)t+=o.pop().close;for(let l=e;l<n.marks.length;l+=1)t+=n.marks[l].open,o.push(n.marks[l]);r.push(t.length),t+=n.ch}for(;o.length>0;)t+=o.pop().close;n.push(r)}),{text:t,at:n}}function L(e,t){return e.length===t.length&&e.every((e,n)=>{const l=t[n];return e.bullet===l.bullet&&(e.number??null)===(l.number??null)&&(e.chars.length===l.chars.length&&e.chars.every((e,t)=>{const n=l.chars[t];return e.ch===n.ch&&e.marks.length===n.marks.length&&e.marks.every((e,t)=>e.kind===n.marks[t].kind&&e.href===n.marks[t].href&&e.color===n.marks[t].color)}))})}function M(e,t,n,l=p){const o=Q(e,l),r=o.flatMap(e=>e.chars),i={text:e,selectionStart:t,selectionEnd:n},s=e=>o.map(t=>({bullet:t.bullet,number:t.number,chars:t.chars.map(t=>({...t,marks:t.marks.filter(n=>"link"===n.kind||!e(t,n))}))})),c=e=>{const t=j(e);return L(e,Q(t.text,l))?t:null},u=(e,t)=>{let n=r.indexOf(t);for(let t=0;t<e.at.length;t+=1){if(n<e.at[t].length)return e.at[t][n];n-=e.at[t].length}return 0};if(t===n){const e=[...r].reverse().find(e=>e.at<t),n=r.find(e=>e.at>=t),l=new Set([...e?.marks??[],...n?.marks??[]].map(e=>e.id));if(![...l].some(e=>r.some(t=>t.marks.some(t=>t.id===e&&"link"!==t.kind))))return i;const o=c(s((e,t)=>l.has(t.id)));if(!o)return i;const a=n?u(o,n):e?u(o,e)+e.ch.length:0;return{text:o.text,selectionStart:a,selectionEnd:a}}const a=new Set(r.filter(e=>e.at>=t&&e.at<n));if(0===a.size)return i;const d=new Set([...a].flatMap(e=>e.marks.map(e=>e.id))),h=c(s(e=>a.has(e)))??c(s((e,t)=>d.has(t.id)));if(!h)return i;const f=r.find(e=>a.has(e)),k=[...r].reverse().find(e=>a.has(e));return{text:h.text,selectionStart:u(h,f),selectionEnd:u(h,k)+k.ch.length}}export{m as CAMPAIGN_MARKUP,k as COPY_FIELD_TOOLS,d as MARKUP_TOOLS,h as MARK_NAMES,l as MARK_PLACEHOLDERS,p as STANDARD_MARKUP,g as STOREFRONT_MARKUP,i as applyColor,r as applyMark,M as clearMarks,c as findLink,t as isColorName,E as isSafeLinkHref,s as markedAt,Q as markedLines,f as markupTools,O as parseMarkup,a as removeLink,L as sameMarks,_ as serializeMarkup,C as spanFor,y as stripInline,x as tokenizeInline,u as writeLink,j as writeMarkedLines};
@@ -1 +0,0 @@
1
- var e={less:"Less",more:"More",choose:"Choose…",list:{item:"item",itemName:({noun:e,n:t})=>{return`${o=e,o?o[0].toUpperCase()+o.slice(1):o} ${t}`;var o},position:({n:e,total:t})=>`${e} of ${t}`,duplicate:"Duplicate",duplicateItem:({noun:e})=>`Duplicate ${e}`,deleteItem:({noun:e})=>`Delete ${e}`,add:({noun:e})=>`+ Add ${e}`,addHere:({noun:e})=>`Add ${e} here`}};export{e as DEFAULT_FIELDS_WORDS};
@@ -1,3 +0,0 @@
1
- import{DEFAULT_RAIL_WORDS as a}from"./chunk-2OAZYSWJ.js";import{wordFitVars as i}from"./chunk-BZ5ASXOL.js";import{jsxs as e,jsx as r}from"react/jsx-runtime";function o({label:a,worded:i,icon:o,active:l,disabled:t,onSelect:n,className:d}){const s=["es-rail-btn",l?"is-active":"",d??""].filter(Boolean).join(" ");/* @__PURE__ */
2
- return e("button",{type:"button",className:s,title:a,"aria-label":a,"aria-pressed":"boolean"==typeof l?l:void 0,disabled:t,onClick:t?void 0:n,children:[o,i?/* @__PURE__ */r("span",{className:"es-rail-word","aria-hidden":"true",children:a}):null]})}var l=o;function t({items:e,ariaLabel:l=a.label,className:t,orientation:n="column",wordFit:d}){const s="row"===n,c=s&&d?d:void 0;/* @__PURE__ */
3
- return r("div",{className:["es-rail",s?"es-rail-row":"",c?"is-measured":"",t??""].filter(Boolean).join(" "),role:"toolbar","aria-orientation":s?"horizontal":"vertical","aria-label":l,style:c&&i(e.length,c),children:e.map(a=>/* @__PURE__ */r(o,{label:a.label,worded:Boolean(c),icon:a.icon,active:a.active,disabled:a.disabled,onSelect:a.onSelect},a.id))})}var n=t,d={railWidth:46,railPaddingY:8,railGap:4,railRadius:12,buttonSize:34,buttonRadius:9,iconSize:18,wordPaddingX:8,wordGap:8,wordFontSize:12,wordFontWeight:500,transition:"background 0.12s, color 0.12s",disabledOpacity:.35,color:{background:"#ffffff",shadow:"0 1px 2px rgba(0, 0, 0, 0.05), 0 10px 30px rgba(0, 0, 0, 0.06)",idle:"#6b7280",hoverBg:"#f3f4f6",hoverFg:"#111827",accent:"#2563eb",accentTint:"#eff6ff"}},s={railWidth:"--es-rail-w",railPaddingY:"--es-rail-pad-y",railGap:"--es-rail-gap",railRadius:"--es-rail-radius",buttonSize:"--es-rail-btn-size",buttonRadius:"--es-rail-btn-radius",iconSize:"--es-rail-icon-size",wordPaddingX:"--es-rail-word-pad-x",wordGap:"--es-rail-word-gap",wordFontSize:"--es-rail-word-size",wordFontWeight:"--es-rail-word-weight",background:"--es-rail-bg",shadow:"--es-rail-shadow",idle:"--es-rail-fg",hoverBg:"--es-rail-hover-bg",hoverFg:"--es-rail-hover-fg",accent:"--es-rail-accent",accentTint:"--es-rail-accent-tint"};export{t as EaselRail,o as EaselRailButton,n as EditorRail,l as EditorRailButton,s as railCssVars,d as railTokens};
@@ -1 +0,0 @@
1
- import{MARKUP_TOOLS as e,MARK_PLACEHOLDERS as t}from"./chunk-SJQG5ENJ.js";var i={formatting:"Formatting",alignment:"Alignment",align:{left:"Left",center:"Center",right:"Right",justify:"Justify"},link:{title:"Link",label:"Link to",placeholder:"https://… or /page",refused:"Use a web address (https://…), a page on this site (/…), mailto: or tel:.",remove:"Remove link",apply:"Apply"},marks:Object.fromEntries(e.map(e=>[e.style,{name:e.name??e.title,title:e.title}])),placeholders:t};export{i as DEFAULT_COPY_WORDS};
@@ -1,10 +0,0 @@
1
- export { CanvasFrame, CanvasFrameProps, CanvasOverlay, CanvasSlotProps, DEFAULT_UI, Easel, EaselCanvas, EaselCanvasProps, EaselOptions, EaselProvider, EaselProviderProps, EditDocument, Editor, EditorCanvas, EditorCanvasProps, EditorOptions, EditorProvider, SelectedFields, bindUndoKeys, createEasel, createEditor, createUseEasel, createUseEditor, recordsByDefault, reduce, uiView, useEasel, useEaselApi, useEaselNodeOps, useEditor, useEditorApi, useEditorNodeOps, useSelectedFields, validSelection } from '../easel/index.js';
2
- export { A as AppState, b as EaselAction, E as EaselConfig, c as EaselCore, e as EaselHistory, d as EaselUi, a as EaselView, f as EditorAction, g as EditorConfig, h as EditorCore, i as EditorHistory, j as EditorUi, k as EditorView, H as HistoryEntry, P as Permissions, S as SetDataPatch } from '../types-BOSGNvil.js';
3
- export { I as ItemSelector, N as NodeSelection } from '../plan-DChbUXdS.js';
4
- import '../data/index.js';
5
- import '../types-41704JE4.js';
6
- import '../resolve-D68pb3Bx.js';
7
- import 'react';
8
- import '../useNodeOps-BF0fQsif.js';
9
- import '../types-C7HFvdtk.js';
10
- import '../buckets-CuLM47h9.js';
@@ -1 +0,0 @@
1
- export{CanvasFrame,DEFAULT_UI,EaselCanvas,EaselProvider,EditDocument,EditorCanvas,EditorProvider,bindUndoKeys,createEasel,createEditor,createUseEasel,createUseEditor,recordsByDefault,reduce,uiView,useEasel,useEaselApi,useEaselNodeOps,useEditor,useEditorApi,useEditorNodeOps,useSelectedFields,validSelection}from"../chunk-F2PIG3AA.js";import"../chunk-D2BCHTQR.js";import"../chunk-AELNNAFM.js";import"../chunk-YRLPFZW3.js";import"../chunk-MFIRYGHW.js";import"../chunk-ZNCEOSXO.js";import"../chunk-KRXQM65X.js";import"../chunk-NKB3KVAB.js";
@@ -1,51 +0,0 @@
1
- /**
2
- * The settings rows' own words (`efficient-easel/strings`, 0.95.0): the number
3
- * box's two buttons, the dropdown's empty state and everything a list field
4
- * says. A row's label, its options and its hint are the block's.
5
- *
6
- * A plain module with no import. `noun` is one item's word, lower case — the
7
- * field's own (`noun: 'slide'`) or `list.item`.
8
- */
9
- type FieldsWords = {
10
- /** `FieldNumber`: the − button. */
11
- less: string;
12
- /** `FieldNumber`: the + button. */
13
- more: string;
14
- /** `FieldSelect`: what the box says while nothing is chosen. */
15
- choose: string;
16
- /** `ListField` — an array field drawn as rows. */
17
- list: {
18
- /** One item's word when the field names none. */
19
- item: string;
20
- /** An item's name when it has none of its own: "Slide 2". `n` counts from 1. */
21
- itemName: (v: {
22
- noun: string;
23
- n: number;
24
- }) => string;
25
- /** Where the open item sits: "2 of 5". */
26
- position: (v: {
27
- n: number;
28
- total: number;
29
- }) => string;
30
- /** The open item's copy button. */
31
- duplicate: string;
32
- /** A row's copy action. */
33
- duplicateItem: (v: {
34
- noun: string;
35
- }) => string;
36
- /** A row's delete action, and the open item's delete button. */
37
- deleteItem: (v: {
38
- noun: string;
39
- }) => string;
40
- /** The button under the list. */
41
- add: (v: {
42
- noun: string;
43
- }) => string;
44
- /** The "+" between two rows. */
45
- addHere: (v: {
46
- noun: string;
47
- }) => string;
48
- };
49
- };
50
-
51
- export type { FieldsWords as F };
File without changes