efficient-easel 0.101.1 → 0.103.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 (234) hide show
  1. package/README.md +51 -0
  2. package/dist/LinkPicker-W2Rtxetz.d.ts +111 -0
  3. package/dist/autosave/index.d.ts +6 -3
  4. package/dist/autosave/index.js +1 -1
  5. package/dist/chrome/index.d.ts +3 -2
  6. package/dist/chrome/index.js +1 -25
  7. package/dist/chunk-26OOWIJJ.js +1 -0
  8. package/dist/chunk-2LK54I4E.js +1 -0
  9. package/dist/chunk-3M3A3DN2.js +4 -0
  10. package/dist/chunk-3QVB4AG2.js +3 -0
  11. package/dist/chunk-3WSPDAK2.js +1 -0
  12. package/dist/chunk-4ES5JGGX.js +1 -0
  13. package/dist/chunk-4MXFKJUY.js +1 -0
  14. package/dist/chunk-57DJOKXT.js +1 -0
  15. package/dist/chunk-5MZ3RNQQ.js +13 -0
  16. package/dist/chunk-5ZBY24K7.js +1 -0
  17. package/dist/chunk-66ICOE3I.js +8 -0
  18. package/dist/chunk-6DJHRLCU.js +25 -0
  19. package/dist/chunk-6FY3PZS3.js +1 -0
  20. package/dist/chunk-6TZTKAB5.js +1 -0
  21. package/dist/chunk-6UJ3Y6FC.js +1 -0
  22. package/dist/chunk-6W7WLPZH.js +1 -0
  23. package/dist/chunk-7F52SZOI.js +2 -0
  24. package/dist/chunk-7MU3RJ6S.js +1 -0
  25. package/dist/chunk-A7ZJII7O.js +1 -0
  26. package/dist/chunk-AJBJ74ME.js +1 -0
  27. package/dist/chunk-AKFJK65Z.js +1 -0
  28. package/dist/chunk-AKZWUV5Z.js +1 -0
  29. package/dist/chunk-BDTITTMW.js +1 -0
  30. package/dist/chunk-BSPCSC45.js +1 -0
  31. package/dist/chunk-BXZ6WLHC.js +22 -0
  32. package/dist/chunk-DUVRZ456.js +1 -0
  33. package/dist/chunk-F6CCTEIX.js +1 -0
  34. package/dist/chunk-FGNR22NY.js +1 -0
  35. package/dist/chunk-FUDHI5I4.js +1 -0
  36. package/dist/chunk-GENAF3P6.js +1 -0
  37. package/dist/chunk-GOTN2KY4.js +2 -0
  38. package/dist/chunk-GXN65JMA.js +1 -0
  39. package/dist/chunk-GXQCZJOP.js +1 -0
  40. package/dist/chunk-GZO72N3Q.js +0 -0
  41. package/dist/chunk-HDKTR5TZ.js +62 -0
  42. package/dist/chunk-HMX55DYT.js +1 -0
  43. package/dist/chunk-HQ4VVRIC.js +1 -0
  44. package/dist/chunk-HWW4XJOH.js +1 -0
  45. package/dist/chunk-I54UCYOU.js +1 -0
  46. package/dist/chunk-IQ5TA7AM.js +1 -0
  47. package/dist/chunk-IWAPPEL4.js +6 -0
  48. package/dist/chunk-IYT6NN2J.js +1 -0
  49. package/dist/chunk-KCBEE2MC.js +2 -0
  50. package/dist/chunk-KDYIMJTZ.js +1 -0
  51. package/dist/chunk-KQMML6JM.js +4 -0
  52. package/dist/chunk-LG436UTD.js +1 -0
  53. package/dist/chunk-MSBF7IW3.js +2 -0
  54. package/dist/chunk-NBJ2YY6Y.js +4 -0
  55. package/dist/chunk-OM67AJQC.js +1 -0
  56. package/dist/chunk-OORDMLL4.js +5 -0
  57. package/dist/chunk-OYX47SL7.js +1 -0
  58. package/dist/chunk-P67FP7PG.js +9 -0
  59. package/dist/chunk-PWZOS45R.js +2 -0
  60. package/dist/chunk-Q2HPBMG5.js +1 -0
  61. package/dist/chunk-Q3SQBNJB.js +1 -0
  62. package/dist/chunk-R2HLPNQF.js +1 -0
  63. package/dist/chunk-R5L2E7JX.js +1 -0
  64. package/dist/chunk-R5ZVNJLJ.js +2 -0
  65. package/dist/chunk-RLBXE4EU.js +1 -0
  66. package/dist/chunk-RW4XBUUW.js +1 -0
  67. package/dist/chunk-SERF2FAU.js +1 -0
  68. package/dist/chunk-TTJ54QGG.js +18 -0
  69. package/dist/chunk-VV5ADNBR.js +1 -0
  70. package/dist/chunk-YJXEHK6I.js +2 -0
  71. package/dist/chunk-Z3KBLIEH.js +10 -0
  72. package/dist/chunk-ZE7I3PLX.js +1 -0
  73. package/dist/chunk-ZWK3CBRU.js +1 -0
  74. package/dist/chunk-ZZ7VLIHQ.js +1 -0
  75. package/dist/drag/index.d.ts +3 -41
  76. package/dist/drag/index.js +1 -18
  77. package/dist/easel/index.js +1 -9
  78. package/dist/{words-BMzV04b1.d.ts → engine-DBxp_v6B.d.ts} +1 -58
  79. package/dist/fields/index.d.ts +2 -109
  80. package/dist/fields/index.js +1 -22
  81. package/dist/gold/index.d.ts +4 -2
  82. package/dist/host-DJ8Gzsx7.d.ts +552 -0
  83. package/dist/menu/index.js +1 -1
  84. package/dist/node-ops/index.js +1 -1
  85. package/dist/panelWidths-D9hTLR25.d.ts +66 -0
  86. package/dist/screen/components/AddBlockRow.d.ts +14 -0
  87. package/dist/screen/components/AddBlockRow.js +1 -0
  88. package/dist/screen/components/AddChildRow.d.ts +39 -0
  89. package/dist/screen/components/AddChildRow.js +1 -0
  90. package/dist/screen/components/AddSidePanel.d.ts +54 -0
  91. package/dist/screen/components/AddSidePanel.js +1 -0
  92. package/dist/screen/components/MediaSidePanel.d.ts +47 -0
  93. package/dist/screen/components/MediaSidePanel.js +1 -0
  94. package/dist/screen/components/NodeContextMenu.d.ts +364 -0
  95. package/dist/screen/components/NodeContextMenu.js +1 -0
  96. package/dist/screen/components/PageEditGuardNotices.d.ts +5 -0
  97. package/dist/screen/components/PageEditGuardNotices.js +1 -0
  98. package/dist/screen/components/PanelToggleIcon.d.ts +14 -0
  99. package/dist/screen/components/PanelToggleIcon.js +1 -0
  100. package/dist/screen/components/PreviewDeviceContext.d.ts +28 -0
  101. package/dist/screen/components/PreviewDeviceContext.js +1 -0
  102. package/dist/screen/components/PreviewPartsContext.d.ts +33 -0
  103. package/dist/screen/components/PreviewPartsContext.js +1 -0
  104. package/dist/screen/components/ScreenChrome.d.ts +5 -0
  105. package/dist/screen/components/ScreenChrome.js +1 -0
  106. package/dist/screen/components/ScreenDocumentContext.d.ts +20 -0
  107. package/dist/screen/components/ScreenDocumentContext.js +1 -0
  108. package/dist/screen/components/ScreenMount.d.ts +76 -0
  109. package/dist/screen/components/ScreenMount.js +1 -0
  110. package/dist/screen/components/ScreenStoreProvider.d.ts +63 -0
  111. package/dist/screen/components/ScreenStoreProvider.js +1 -0
  112. package/dist/screen/components/SectionScreenShell.d.ts +5 -0
  113. package/dist/screen/components/SectionScreenShell.js +16 -0
  114. package/dist/screen/components/SidePanelHead.d.ts +81 -0
  115. package/dist/screen/components/SidePanelHead.js +1 -0
  116. package/dist/screen/components/SlotChildActionsContext.d.ts +41 -0
  117. package/dist/screen/components/SlotChildActionsContext.js +1 -0
  118. package/dist/screen/components/UiIcon.d.ts +52 -0
  119. package/dist/screen/components/UiIcon.js +1 -0
  120. package/dist/screen/components/panel-widths.d.ts +37 -0
  121. package/dist/screen/components/panel-widths.js +1 -0
  122. package/dist/screen/components/usePartBridge.d.ts +66 -0
  123. package/dist/screen/components/usePartBridge.js +1 -0
  124. package/dist/screen/index.d.ts +31 -0
  125. package/dist/screen/index.js +1 -0
  126. package/dist/screen/lib/admin-bridge.d.ts +105 -0
  127. package/dist/screen/lib/admin-bridge.js +1 -0
  128. package/dist/screen/lib/backend-error.d.ts +106 -0
  129. package/dist/screen/lib/backend-error.js +1 -0
  130. package/dist/screen/lib/chrome-theme.d.ts +21 -0
  131. package/dist/screen/lib/chrome-theme.js +1 -0
  132. package/dist/screen/lib/client-only.d.ts +24 -0
  133. package/dist/screen/lib/client-only.js +1 -0
  134. package/dist/screen/lib/content/view-tiers.d.ts +25 -0
  135. package/dist/screen/lib/content/view-tiers.js +1 -0
  136. package/dist/screen/lib/document-addressing.d.ts +20 -0
  137. package/dist/screen/lib/document-addressing.js +1 -0
  138. package/dist/screen/lib/document-contract.d.ts +237 -0
  139. package/dist/screen/lib/document-contract.js +1 -0
  140. package/dist/screen/lib/document-hooks.d.ts +71 -0
  141. package/dist/screen/lib/document-hooks.js +0 -0
  142. package/dist/screen/lib/document-switch.d.ts +74 -0
  143. package/dist/screen/lib/document-switch.js +1 -0
  144. package/dist/screen/lib/failure.d.ts +54 -0
  145. package/dist/screen/lib/failure.js +1 -0
  146. package/dist/screen/lib/host-chrome.d.ts +181 -0
  147. package/dist/screen/lib/host-chrome.js +1 -0
  148. package/dist/screen/lib/host-inbound.d.ts +20 -0
  149. package/dist/screen/lib/host-inbound.js +1 -0
  150. package/dist/screen/lib/host.d.ts +20 -0
  151. package/dist/screen/lib/host.js +1 -0
  152. package/dist/screen/lib/key-scope.d.ts +23 -0
  153. package/dist/screen/lib/key-scope.js +1 -0
  154. package/dist/screen/lib/links/link-filters.d.ts +41 -0
  155. package/dist/screen/lib/links/link-filters.js +0 -0
  156. package/dist/screen/lib/load-error.d.ts +29 -0
  157. package/dist/screen/lib/load-error.js +1 -0
  158. package/dist/screen/lib/media-panel.d.ts +94 -0
  159. package/dist/screen/lib/media-panel.js +1 -0
  160. package/dist/screen/lib/media-picker.d.ts +68 -0
  161. package/dist/screen/lib/media-picker.js +1 -0
  162. package/dist/screen/lib/page-lock.d.ts +5 -0
  163. package/dist/screen/lib/page-lock.js +1 -0
  164. package/dist/screen/lib/puck/add-target-types.d.ts +55 -0
  165. package/dist/screen/lib/puck/add-target-types.js +0 -0
  166. package/dist/screen/lib/puck/block-choice.d.ts +52 -0
  167. package/dist/screen/lib/puck/block-choice.js +1 -0
  168. package/dist/screen/lib/puck/block-types-in.d.ts +39 -0
  169. package/dist/screen/lib/puck/block-types-in.js +1 -0
  170. package/dist/screen/lib/puck/content-tree.d.ts +196 -0
  171. package/dist/screen/lib/puck/content-tree.js +1 -0
  172. package/dist/screen/lib/puck/device-fields.d.ts +128 -0
  173. package/dist/screen/lib/puck/device-fields.js +1 -0
  174. package/dist/screen/lib/puck/field-buckets.d.ts +22 -0
  175. package/dist/screen/lib/puck/field-buckets.js +1 -0
  176. package/dist/screen/lib/puck/field-markers.d.ts +205 -0
  177. package/dist/screen/lib/puck/field-markers.js +1 -0
  178. package/dist/screen/lib/puck/hidable.d.ts +44 -0
  179. package/dist/screen/lib/puck/hidable.js +1 -0
  180. package/dist/screen/lib/puck/palette-sections.d.ts +96 -0
  181. package/dist/screen/lib/puck/palette-sections.js +1 -0
  182. package/dist/screen/lib/puck/panel-fields.d.ts +47 -0
  183. package/dist/screen/lib/puck/panel-fields.js +1 -0
  184. package/dist/screen/lib/puck/panel-no-control-mark.d.ts +74 -0
  185. package/dist/screen/lib/puck/panel-no-control-mark.js +1 -0
  186. package/dist/screen/lib/puck/part-id.d.ts +23 -0
  187. package/dist/screen/lib/puck/part-id.js +1 -0
  188. package/dist/screen/lib/puck/preview-click.d.ts +49 -0
  189. package/dist/screen/lib/puck/preview-click.js +1 -0
  190. package/dist/screen/lib/puck/preview-dom.d.ts +8 -0
  191. package/dist/screen/lib/puck/preview-dom.js +1 -0
  192. package/dist/screen/lib/puck/preview-events.d.ts +25 -0
  193. package/dist/screen/lib/puck/preview-events.js +1 -0
  194. package/dist/screen/lib/puck/preview-selection-context.d.ts +72 -0
  195. package/dist/screen/lib/puck/preview-selection-context.js +1 -0
  196. package/dist/screen/lib/puck/section-doc.d.ts +20 -0
  197. package/dist/screen/lib/puck/section-doc.js +1 -0
  198. package/dist/screen/lib/puck/slot-child-name.d.ts +186 -0
  199. package/dist/screen/lib/puck/slot-child-name.js +1 -0
  200. package/dist/screen/lib/puck/slot-heal.d.ts +5 -0
  201. package/dist/screen/lib/puck/slot-heal.js +1 -0
  202. package/dist/screen/lib/puck/slot-section-spec.d.ts +96 -0
  203. package/dist/screen/lib/puck/slot-section-spec.js +0 -0
  204. package/dist/screen/lib/puck/style-clipboard.d.ts +78 -0
  205. package/dist/screen/lib/puck/style-clipboard.js +1 -0
  206. package/dist/screen/lib/puck/text-control-kinds.d.ts +71 -0
  207. package/dist/screen/lib/puck/text-control-kinds.js +1 -0
  208. package/dist/screen/lib/puck/tree-reveal.d.ts +62 -0
  209. package/dist/screen/lib/puck/tree-reveal.js +1 -0
  210. package/dist/screen/lib/puck/use-section-ops.d.ts +86 -0
  211. package/dist/screen/lib/puck/use-section-ops.js +1 -0
  212. package/dist/screen/lib/screen-parts.d.ts +748 -0
  213. package/dist/screen/lib/screen-parts.js +1 -0
  214. package/dist/screen/lib/section-template-types.d.ts +49 -0
  215. package/dist/screen/lib/section-template-types.js +0 -0
  216. package/dist/screen/lib/section-templates.d.ts +23 -0
  217. package/dist/screen/lib/section-templates.js +1 -0
  218. package/dist/screen/lib/session-context.d.ts +30 -0
  219. package/dist/screen/lib/session-context.js +1 -0
  220. package/dist/screen/lib/session.d.ts +255 -0
  221. package/dist/screen/lib/session.js +1 -0
  222. package/dist/screen/screen.css +1102 -0
  223. package/dist/screen/words.d.ts +42 -0
  224. package/dist/screen/words.js +1 -0
  225. package/dist/session-DSQFmIvx.d.ts +43 -0
  226. package/dist/strings/catalogue.d.ts +13 -4
  227. package/dist/strings/catalogue.js +1 -1
  228. package/dist/strings/index.d.ts +5 -2
  229. package/dist/strings/index.js +1 -1
  230. package/dist/style-clipboard/index.js +1 -1
  231. package/dist/{types-DGcCsxs8.d.ts → types-CqY85foL.d.ts} +3 -65
  232. package/dist/words-D_Lnw1Gr.d.ts +59 -0
  233. package/package.json +348 -2
  234. package/dist/chunk-IG3U5NWJ.js +0 -1
@@ -1,9 +1 @@
1
- import{DEFAULT_CANVAS_WORDS as e}from"../chunk-AELNNAFM.js";import{useResolvedFields as t}from"../chunk-YRLPFZW3.js";import{toItemSelector as n,fromItemSelector as o,useNodeOps as r}from"../chunk-D2BCHTQR.js";import{useWords as a}from"../chunk-MFIRYGHW.js";import{setCanvasNonce as i}from"../chunk-ZNCEOSXO.js";import{find as s,ROOT_ID as d,getList as l,remove as c,parseZoneKey as u,move as p,duplicate as f,replaceNode as h,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 O,useContext as x,useRef as E,useSyncExternalStore as A,useState as D,useMemo as z,useCallback as M,useLayoutEffect as Z}from"react";import{jsx as N,jsxs as $}from"react/jsx-runtime";import{createPortal as j}from"react-dom";function R(e){return!["setData","setUi","set"].includes(e.type)}var B=(e,t,n,o)=>{const r=l(e,t,u(n));return r?.[o]??null},P=(e,t,n,o,r)=>{const a=B(e,t,n,o);if(!a)throw new Error(`${r}: nothing at ${n}[${o}]`);return a};function L(e,t){const{selection:o}=e;return{...e.ui,itemSelector:n(e.data,t,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===d?l(e,t,n)?n:null:s(e,t,n.parentId)&&l(e,t,n)?n:null:null}function F(e,t,n,r=!1){const{itemSelector:a,selectedSlot:i,...s}=n;let d=e.selection;var l;return"itemSelector"in n&&(d=o(e.data,t,a??null)),"selectedSlot"in n&&(i?d=(l=i)?{kind:"slot",parentId:l.parentId,slot:l.slot}:null:"slot"===d?.kind&&(d=null)),{...e,selection:d,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(L(e,n)):t.ui);case"set":{const r={data:o,ui:L(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=P(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:h(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=P(o,n,t.sourceZone,t.sourceIndex,"duplicate"),a=f(o,n,r.props.id),i=B(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=B(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=P(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(e){let t=e.config;const r=e.now??(()=>Date.now()),a=e.historyCoalesceMs??250;let i=e.permissions??{};const d=y(e.data,t);let c={data:d,selection:null,ui:{...q}};if(e.ui){const{itemSelector:n,selectedSlot:r,...a}=e.ui;c={data:d,selection:r?{kind:"slot",...r}:o(d,t,n??null),ui:{...q,...a}}}let u=[{core:c,at:-1/0,sealed:!0,id:U()}],p=0;const f=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()},O=()=>{u=[...u.slice(0,p),{...u[p],core:c},...u.slice(p+1)]},x=(t,n)=>{w>0?I=I||n:(n?f(!1):c!==t&&O(),c.data!==t.data&&e.onChange?.(c.data),c!==t&&C())},E=e=>{const n=c;if(c=H(c,e,t),c===n)return;const o=e.recordHistory??R(e);x(n,o&&c.data!==n.data)},A=t=>{0===w&&(S=c,I=!1),w+=1;try{t()}catch(e){throw w-=1,0===w&&S&&(c=S,S=null),e}if(w-=1,w>0||!S)return;const n=S;S=null,I&&c.data!==n.data?f(!0):c!==n&&O(),c.data!==n.data&&e.onChange?.(c.data),c!==n&&C()},D=e=>{const n=c,o=K(c.data,t,e);var r,a;(r=o,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:o},x(n,!1))},z=t=>{const n=c;p=t,c=u[p].core,c.data!==n.data&&e.onChange?.(c.data),c!==n&&C()},M=()=>(e={})=>{const n=e.root?t.root?.permissions:t.components[e.item?.type??e.type??""]?.permissions;return{...T,...i,...n}};let Z=M();const N=g(),$={resolveCache:N,async resolveAll({trigger:e="load",metadata:n}={}){const o=c.data,r={type:"root",props:{...o.root.props??{}}},a=[...o.content,...Object.values(o.zones??{}).flat()],[i,...d]=await Promise.all([k(r,t,{cache:N,trigger:e,metadata:n}),...a.map(o=>k(o,t,{cache:N,trigger:e,metadata:n}))]);A(()=>{const e=c;let n=c.data;d.forEach((e,r)=>{if(!e.didChange)return;const i=a[r].props.id,d=s(n,t,i)?.node;d&&d===s(o,t,i)?.node&&(n=h(n,t,i,e.node))}),i.didChange&&n.root===o.root&&(n={...n,root:{...n.root,props:i.node.props,readOnly:i.node.readOnly??n.root.readOnly}}),n!==c.data&&(c={...c,data:n,selection:K(n,t,c.selection)},x(e,!1))})},async resolveNode(e,{trigger:n="replace",metadata:o}={}){const r=s(c.data,t,e)?.node;if(!r)return!1;const a=await k(r,t,{cache:N,trigger:n,metadata:o});if(!a.didChange)return!1;let i=!1;return A(()=>{const n=c;if(s(c.data,t,e)?.node!==r)return;const o=h(c.data,t,e,a.node);o!==c.data&&(c={...c,data:o,selection:K(o,t,c.selection)},x(n,!1),i=!0)}),i},get config(){return t},getState(){if(v&&b===c)return v;const e=c,o={data:e.data,ui:L(e,t)},r="node"===e.selection?.kind?s(e.data,t,e.selection.id)?.node??null:null;return v={appState:o,selection:e.selection,selectedItem:r,config:t,dispatch:E,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:L(e.core,t)}})),index:p,setHistoryIndex:e=>{e>=0&&e<u.length&&e!==p&&z(e)}},getPermissions:Z,getItemById:n=>s(e.data,t,n)?.node,getItemBySelector:n=>function(e,t,n){const[o,r]=(n.zone??"root:default-zone").split(/:(.*)/s);return l(e,t,{parentId:o,slot:r})?.[n.index]}(e.data,t,n),getSelectorForId:o=>{const r=n(e.data,t,{kind:"node",id:o});return r?{index:r.index,zone:r.zone??"root:default-zone"}:void 0}},b=e,v},subscribe:e=>(m.add(e),()=>{m.delete(e)}),dispatch:E,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 n=c,o=void 0===e.select?c.selection:e.select;c={...c,data:e.data,selection:K(e.data,t,o)},x(n,e.data!==n.data)})},load(e,n={}){const o=c,r=y(e,t);c={...c,data:r,selection:K(r,t,n.selection??c.selection)},n.keepHistory||(u=[{core:c,at:-1/0,sealed:!0,id:U()}],p=0),c!==o&&C()},undo(){p>0&&z(p-1)},redo(){p<u.length-1&&z(p+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,Z=M(),v=null,C())},setConfig(e){e!==t&&(t=e,Z=M(),v=null,C())}};return $}function X(e,t){const n=e=>{if(e.altKey)return;if(!(e.metaKey!==e.ctrlKey))return;const n="KeyZ"===e.code,o="KeyY"===e.code&&!e.shiftKey;(n||o)&&!1!==t.getState?.().getPermissions().edit&&(e.preventDefault(),o||e.shiftKey?t.redo():t.undo())};return e.addEventListener("keydown",n),()=>e.removeEventListener("keydown",n)}var Q=C(null),G=C(!0);function J({easel:e,hotkeys:t=!0,resolveOnMount:n=!0,children:o}){return O(()=>{n&&e.resolveAll()},[e,n]),O(()=>{if(t&&"undefined"!=typeof document)return X(document,e)},[e,t]),/* @__PURE__ */N(Q.Provider,{value:e,children:/* @__PURE__ */N(G.Provider,{value:t,children:o})})}function _(){const e=x(Q);if(!e)throw new Error("useEasel: no <EaselProvider> above this component");return e}function ee(e){const t=_(),n=E({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)}}var ne="data-puck-component",oe="data-puck-dropzone",re={},ae="data-es-mirror",ie="undefined"==typeof window?O:Z;function se(e,t,n){for(const e of Array.from(t.head.querySelectorAll(`[${ae}]`)))e.remove();for(const o of Array.from(e.head.querySelectorAll('style, link[rel="stylesheet"]'))){const e=o.cloneNode(!0);e.setAttribute(ae,""),n&&e.setAttribute("nonce",n),t.head.appendChild(e)}}function de({children:t,id:n="preview-frame",title:o,className:r,style:s,mirrorStyles:d=!0,onDocument:l,height:c="auto",nonce:u}){const p=a("canvas",e),f=E(null),[h,m]=D(null);return ie(()=>{const e=f.current,t=h?.ownerDocument.defaultView;if("auto"!==c||!e||!h||!t)return;const n=()=>{e.style.height=`${Math.ceil(h.getBoundingClientRect().height)}px`};n();const o=t.ResizeObserver,r=o?new o(n):null;return r?.observe(h),()=>r?.disconnect()},[h,c]),ie(()=>{let e=f.current?.contentDocument;if(!e)return;"CSS1Compat"!==e.compatMode&&(e.open(),e.write("<!DOCTYPE html><html><head></head><body></body></html>"),e.close(),e=f.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),l?.(e);let n=null;const o=f.current?.ownerDocument;if(d&&o){se(o,e,u);const t=o.defaultView;t&&"MutationObserver"in t&&(n=new t.MutationObserver(()=>se(o,e,u)),n.observe(o.head,{childList:!0,subtree:!0,characterData:!0}))}return()=>{n?.disconnect(),t.remove(),m(null),l?.(null)}},[]),/* @__PURE__ */N("iframe",{ref:f,id:n,title:o??p.frame,className:["es-canvas-frame","fill"===c?"is-fill":"",r??""].filter(Boolean).join(" "),style:s,children:h?j(t,h):null})}var le=C(null),ce=C(re),ue=[];function pe({parentId:e,slot:t,className:n,style:o,minEmptyHeight:r=128}){const a=_(),i=ee(n=>l(n.appState.data,a.config,{parentId:e,slot:t})??ue),s=ee(t=>"node"===t.selection?.kind&&t.selection.id===e&&e!==d),c=ee(n=>"slot"===n.selection?.kind&&n.selection.parentId===e&&n.selection.slot===t),u=x(le),p=["es-zone"];return i.length&&p.push("has-children"),e===d&&p.push("is-root"),(s||c)&&p.push("is-area-selected"),null!==u&&u===e&&e!==d&&p.push("is-hovering-area"),n&&p.push(n),/* @__PURE__ */N("div",{className:p.join(" "),[oe]:`${e}:${t}`,style:{...o,"--min-empty-height":`${r}px`},children:i.map(e=>/* @__PURE__ */N(me,{node:e},e.props.id))})}function fe(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__ */
2
- return N(pe,{parentId:n,slot:e,...t})};return a}function he(e){return function({zone:t,...n}){/* @__PURE__ */
3
- return N(pe,{parentId:e,slot:t,...n})}}function me({node:e}){const t=_().config,n=t.components[e.type],o=e.props.id,r=function(e){const t=E(null);return z(()=>n=>{const o=t.current;o&&o!==n&&(o.removeAttribute(ne),o.removeAttribute("data-puck-dnd")),t.current=n,n&&(n.setAttribute(ne,e),n.setAttribute("data-puck-dnd",e),n.style.position="relative")},[e])}(o),a=x(ce);if(!n?.render)return null;const i=n.render,s=fe(t,e.type,o,{...I(n),...e.props}),d={renderDropZone:he(o),isEditing:!0,dragRef:n.inline?r:null,metadata:{...a,...n.metadata}};return n.inline?/* @__PURE__ */N(i,{...s,puck:d,editMode:!0}):/* @__PURE__ */N("div",{[ne]:o,"data-puck-dnd":o,style:{position:"relative"},children:/* @__PURE__ */N(i,{...s,puck:d,editMode:!0})})}function ve({metadata:e}){const t=ee(e=>e.config),n=ee(e=>e.appState.data.root).props??{},o=t.root?.render,r=/* @__PURE__ */N(pe,{parentId:d,slot:b}),a=o?/* @__PURE__ */N(o,{id:"puck-root",...fe(t,"root",d,n),puck:{renderDropZone:he(d),isEditing:!0,dragRef:null,metadata:e??{}},editMode:!0,children:r}):r;/* @__PURE__ */
4
- return N(ce.Provider,{value:e??re,children:a})}function ye({id:e,kind:t,overlay:n}){const o=E(null),[r,a]=D(null);ie(()=>{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(`[${ne}="${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 d="MutationObserver"in n?new n.MutationObserver(s):null;d?.observe(t.body,{childList:!0,subtree:!0,attributes:!0,characterData:!0});const l="ResizeObserver"in n?new n.ResizeObserver(s):null;return l?.observe(t.documentElement),n.addEventListener("resize",s),()=>{d?.disconnect(),l?.disconnect(),n.removeEventListener("resize",s),r&&(n.cancelAnimationFrame??n.clearTimeout)(r)}},[e]);const i=/* @__PURE__ */N("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(n,{componentId:e,kind:t,children:i}):i}function ge({frame:e=!0,className:t,style:n,metadata:o,mirrorStyles:r,onDocument:a,height:i,title:s,nonce:d,hotkeys:l,frameWrapper:c,overlay:u,children:p}){const f=_(),h=x(G),m=l??h,[v,y]=D(void 0),g=ee(e=>"node"===e.selection?.kind?e.selection.id:null),[k,b]=D(null),w=/* @__PURE__ */$("div",{className:"es-canvas-content",style:{position:"relative"},onClick:e=>{const t=e.target;t.closest?.("a[href]")&&e.preventDefault();const n=t.closest?.(`[${ne}]`);n?f.select(n.getAttribute(ne)):t.hasAttribute?.(oe)||f.select(null)},onMouseOver:e=>{const t=e.target.closest?.(`[${ne}]`),n=t?.getAttribute(ne)??null;n!==k&&b(n)},onMouseLeave:()=>b(null),children:[
5
- /* @__PURE__ */N(le.Provider,{value:k,children:/* @__PURE__ */N(ve,{metadata:o})}),
6
- /* @__PURE__ */$("div",{className:"es-canvas-outlines",style:{position:"absolute",top:0,left:0,pointerEvents:"none"},children:[
7
- /* @__PURE__ */N(ye,{id:k&&k!==g?k:null,kind:"hover",overlay:u}),
8
- /* @__PURE__ */N(ye,{id:g,kind:"selected",overlay:u})]}),p]}),S=c?/* @__PURE__ */N(c,{document:v,children:w}):w;O(()=>{if(v&&m)return X(v,f)},[v,m,f]);/* @__PURE__ */
9
- return N("div",{className:"es-canvas"+(t?` ${t}`:""),style:n,"data-puck-preview":"",children:e?/* @__PURE__ */N(de,{mirrorStyles:r,onDocument:e=>{y(e??void 0),a?.(e)},height:i,title:s,nonce:d,children:S}):/* @__PURE__ */N("div",{id:"preview-frame","data-puck-entry":"",children:S})})}function ke(e={}){const t=_(),n=ee(e=>e.appState.data);return r({...e,data:n,config:t.config,commit:(e,{select:n})=>t.run({data:e,select:n})})}function be(){const e=_(),n=ee(e=>e.config),o=e.resolveCache,r=ee(e=>e.selectedItem),a=ee(e=>e.appState.data.root),i=r?r.props.id:"root",d=a.props??{},l=z(()=>r||{type:"root",props:d},[r,d]),c=r?n.components[r.type]:n.root,u=e.getState(),p=r?s(u.appState.data,n,i):null,f=p&&"root"!==p.place.parentId?p.place.parentId:null,h=f?u.getItemById(f)??null:null,{fields:m}=t({id:i,node:l,block:c,parent:h,appState:u.appState}),v=ee(e=>!1===e.getPermissions(r?{item:r}:{root:!0}).edit),y=M((t,r)=>{(async()=>{const a=e.getState();if("root"!==i){const s=a.getItemById(i),d=a.getSelectorForId(i);if(!s||!d)return;const l={...s,props:{...s.props,[t]:r}},{node:c}=await k(l,n,{cache:o,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:d}=await k({type:"root",props:{...s,[t]:r}},n,{cache:o,trigger:"replace"});e.dispatch({type:"replaceRoot",root:{props:d.props,readOnly:d.readOnly},recordHistory:!0})})()},[e,n,o,i]);return{id:i,node:l,fields:m,values:l.props,readOnly:v,onChange:y}}export{de as CanvasFrame,q as DEFAULT_UI,ge as EaselCanvas,J as EaselProvider,ve as EditDocument,X as bindUndoKeys,W as createEasel,te as createUseEasel,R as recordsByDefault,H as reduce,L as uiView,ee as useEasel,_ as useEaselApi,ke as useEaselNodeOps,be as useSelectedFields,K as validSelection};
1
+ export{CanvasFrame,DEFAULT_UI,EaselCanvas,EaselProvider,EditDocument,bindUndoKeys,createEasel,createUseEasel,recordsByDefault,reduce,uiView,useEasel,useEaselApi,useEaselNodeOps,useSelectedFields,validSelection}from"../chunk-P67FP7PG.js";import"../chunk-AELNNAFM.js";import"../chunk-YRLPFZW3.js";import"../chunk-D2BCHTQR.js";import"../chunk-MFIRYGHW.js";import"../chunk-ZNCEOSXO.js";import"../chunk-KRXQM65X.js";import"../chunk-NKB3KVAB.js";
@@ -1,5 +1,3 @@
1
- import { S as SaveTone } from './types-DGcCsxs8.js';
2
-
3
1
  /** Time and timers, passed in so a test can run minutes in a millisecond. */
4
2
  type AutosaveClock = {
5
3
  now: () => number;
@@ -71,59 +69,4 @@ type Autosave<T> = {
71
69
  };
72
70
  declare function createAutosave<T>(options?: AutosaveOptions<T>): Autosave<T>;
73
71
 
74
- /**
75
- * What the save pill says, for both editors — ONE copy.
76
- *
77
- * There were three: the campaign designer's `saveStatusLabel`
78
- * (efficient-admin-portal `src/components/email/autosaveStatus.ts`), the
79
- * website editor's `autosaveStatusLabel` (efficient-storefront
80
- * `lib/editor/autosave-status.ts`, which said of the first "a MIRRORED copy …
81
- * whether that pair should collapse into `efficient-easel` is called out
82
- * rather than decided here") and the website chrome's own words for its
83
- * autosave switch. This decides it.
84
- *
85
- * The rule they all kept, and keep here (card 66103): **the pill speaks only
86
- * when it has something to say.** A save that lands is silence — the dot goes
87
- * green, no word. An edit younger than five seconds is silence too: with a
88
- * one-second save it is about to land, and saying "unsaved" at every keystroke
89
- * would blink the bar once a second. What is left is worth a word each:
90
- *
91
- * - the work has been off the server for five seconds — "Unsaved changes";
92
- * - a save failed and is being retried — "Save failed" (with "Retry now");
93
- * - the operator paused autosave — "Auto-save off", and whether that is
94
- * holding anything;
95
- * - a save was refused — "Auto-save stopped", which must never read as a
96
- * switch somebody flicked themselves.
97
- *
98
- * The tones are `efficient-easel/chrome`'s `SaveState` tones, so the result
99
- * goes straight onto the pill: `<SaveState {...saveIndicator(state)} />`.
100
- */
101
-
102
- type SaveIndicator = {
103
- tone: SaveTone;
104
- label: string;
105
- };
106
- /**
107
- * The pill's five things to say (`efficient-easel/strings`, 0.95.0). Kept in
108
- * autosave's own folder, with no import: autosave may reach nothing else
109
- * (`tests/autosave-leaf-safety.test.ts`).
110
- */
111
- type SaveWords = {
112
- /** A save was refused: nothing will be written. */
113
- stopped: string;
114
- /** The operator paused autosave, and an edit is waiting. */
115
- pausedUnsaved: string;
116
- /** The operator paused autosave. */
117
- paused: string;
118
- /** A save failed and is being retried. */
119
- failed: string;
120
- /** The work has been off the server for five seconds. */
121
- unsaved: string;
122
- };
123
- /**
124
- * `words` is the host's language (`useEaselStrings().save`); left out, the
125
- * pill speaks English as it always has.
126
- */
127
- declare function saveIndicator(state: AutosaveSnapshot, words?: SaveWords): SaveIndicator;
128
-
129
- export { type Autosave as A, type SaveWords as S, type AutosaveSnapshot as a, type SaveIndicator as b, type AutosaveOptions as c, type AutosaveClock as d, createAutosave as e, saveIndicator as s };
72
+ export { type AutosaveSnapshot as A, type Autosave as a, type AutosaveOptions as b, type AutosaveClock as c, createAutosave as d };
@@ -5,6 +5,7 @@ import { I as InspectorFields, a as InspectorFieldDef, F as FieldRenderer, b as
5
5
  export { A as ArrayFieldDef, C as CustomFieldDef, h as CustomFieldRenderProps, i as FieldSelectProps, N as NumberFieldDef, O as ObjectFieldDef, R as RadioFieldDef, S as SelectFieldDef, j as SlotFieldDef, T as TextFieldDef, k as TextareaFieldDef } from '../types-VqL6t5HH.js';
6
6
  import { R as ResolvableItem } from '../resolve-D68pb3Bx.js';
7
7
  export { F as FieldsWords } from '../words-D8kf071T.js';
8
+ export { b as LinkFilter, a as LinkFilterField, c as LinkKindChoice, L as LinkOption, d as LinkOptionGroup, e as LinkPicker, f as LinkPickerProps, g as LinkRules, h as LinkTarget } from '../LinkPicker-W2Rtxetz.js';
8
9
  import '../types-41704JE4.js';
9
10
 
10
11
  interface InspectorProps {
@@ -393,112 +394,4 @@ declare function optionFor<V>(options: readonly FieldOption<V>[], value: V | und
393
394
  declare function FieldSelect<V>(props: FieldSelectManyProps<V>): ReactNode;
394
395
  declare function FieldSelect<V>(props: FieldSelectOneProps<V>): ReactNode;
395
396
 
396
- /** One thing a link can point at: the URL it writes and the name it shows. */
397
- type LinkOption = {
398
- value: string;
399
- label: string;
400
- };
401
- /** Options under one heading — the anchors of one page. */
402
- type LinkOptionGroup = {
403
- label: string;
404
- options: readonly LinkOption[];
405
- };
406
- /** One filter on a link onto the product listing, or none. */
407
- type LinkFilter = {
408
- param: string;
409
- value: string;
410
- } | null;
411
- /** A filter a listing link may offer, with the values it may take. */
412
- type LinkFilterField = {
413
- param: string;
414
- label: string;
415
- values: readonly LinkOption[];
416
- };
417
- /** What a kind's target box is: a list, a list in groups, or a typed address. */
418
- type LinkTarget = {
419
- type: 'select';
420
- options: readonly LinkOption[];
421
- placeholder: string;
422
- } | {
423
- type: 'groups';
424
- groups: readonly LinkOptionGroup[];
425
- placeholder: string;
426
- } | {
427
- type: 'text';
428
- };
429
- /** One entry of the Link type list, with everything its target box offers. */
430
- type LinkKindChoice = {
431
- /** The kind's key — what `rules.kindOf` answers. */
432
- value: string;
433
- /** Its name in the list ("Page", "Blog post"), and its target box's name. */
434
- label: string;
435
- target: LinkTarget;
436
- /** A quiet line under the boxes while this kind is chosen. */
437
- hint?: string;
438
- /** Left out of the list while its target has nothing to pick — unless the
439
- * saved link is this kind, so a link is never shown as something it is not. */
440
- hideWhenEmpty?: boolean;
441
- };
442
- /**
443
- * Everything the picker needs to know about a URL — and it knows nothing else.
444
- * A host hands in its own rules (the storefront's come from
445
- * `efficient-web-builder/links`), so a new kind or a new filter never changes
446
- * this file.
447
- */
448
- type LinkRules = {
449
- /** Which kind a saved URL is. */
450
- kindOf: (url: string) => string;
451
- /** The target a URL points at, with any listing filter taken off. */
452
- targetOf: (url: string) => string;
453
- /** The filter a URL carries onto the listing, or null. */
454
- readFilter: (url: string) => LinkFilter;
455
- /** The URL of a target with this filter written on (or cleared). */
456
- withFilter: (url: string, filter: LinkFilter) => string;
457
- /** May this typed address be saved? */
458
- isSafe: (url: string) => boolean;
459
- };
460
- type LinkPickerProps = {
461
- /** The saved link, or `''`. */
462
- value: string;
463
- /**
464
- * The new link, and — when a thing was PICKED — its name, so a host can fill
465
- * its own label with it (the admin's menu item does). No name when the link
466
- * was typed or cleared.
467
- */
468
- onChange: (url: string, name?: string) => void;
469
- /** The Link type list, in order, each with what its target box offers. */
470
- kinds: readonly LinkKindChoice[];
471
- rules: LinkRules;
472
- /**
473
- * The filters a link onto this target may carry, or null when the target is
474
- * not the product listing. Asked only for a kind whose target is a list.
475
- */
476
- filtersFor?: (target: string) => readonly LinkFilterField[] | null;
477
- /** The whole control's accessible name — "Button link", "Where “Wheels” goes". */
478
- label?: string;
479
- readOnly?: boolean;
480
- };
481
- /**
482
- * ONE LINK PICKER ([MERGE] One Link Picker For Both Editors, owner
483
- * 2026-10-06; mockup https://claude.ai/artifact/6mVmY5787gnXdSWP3syqhu v4): a
484
- * type — Page / Anchor / Blog post / Product / Custom URL — then which one; on
485
- * the product listing a Filter and then a Value. The website editor's Link
486
- * field and the admin's menu item draw this same control.
487
- *
488
- * IT HOLDS NO URL RULE. Which kind a link is, which page it points at, what
489
- * filter it carries and how one is written, which typed address is unsafe —
490
- * all of it is `rules`, and every option and every name is the host's. Only
491
- * the order of the boxes and how they answer each other is decided here.
492
- *
493
- * It never writes on its own. Opening a saved link writes nothing; a target,
494
- * filter or value the host no longer offers is shown as "(unavailable)" and
495
- * kept, never silently replaced.
496
- *
497
- * Every list is `FieldSelect`, the editor's one pop-up list — the anchors
498
- * under one heading per page (`FieldOption.group`), a long list with a search
499
- * box — never the browser's `<select>`. The boxes stack, one under the next,
500
- * at every panel width.
501
- */
502
- declare function LinkPicker({ value, onChange, kinds, rules, filtersFor, label, readOnly }: LinkPickerProps): react.JSX.Element | null;
503
-
504
- export { FieldNumber, FieldNumberProps, FieldOption, type FieldPlan, FieldRenderer, FieldSelect, FieldSelectManyProps, FieldSelectOneProps, FieldSlider, FieldSliderProps, FieldText, FieldTextProps, type FieldsBlock, Inspector, InspectorField, InspectorFieldDef, type InspectorFieldProps, InspectorFields, type InspectorProps, type LinkFilter, type LinkFilterField, type LinkKindChoice, type LinkOption, type LinkOptionGroup, LinkPicker, type LinkPickerProps, type LinkRules, type LinkTarget, ListField, type ListFieldProps, type NumberEntryOptions, type PlannedRow, type ResolvedFieldsInput, SettingsBucket, bucketsOf, clampNumber, copyItem, insertAt, labelOf, moveTo, optionFor, parseTyped, planFields, removeAt, useNumberEntry, useResolvedFields };
397
+ export { FieldNumber, FieldNumberProps, FieldOption, type FieldPlan, FieldRenderer, FieldSelect, FieldSelectManyProps, FieldSelectOneProps, FieldSlider, FieldSliderProps, FieldText, FieldTextProps, type FieldsBlock, Inspector, InspectorField, InspectorFieldDef, type InspectorFieldProps, InspectorFields, type InspectorProps, ListField, type ListFieldProps, type NumberEntryOptions, type PlannedRow, type ResolvedFieldsInput, SettingsBucket, bucketsOf, clampNumber, copyItem, insertAt, labelOf, moveTo, optionFor, parseTyped, planFields, removeAt, useNumberEntry, useResolvedFields };
@@ -1,22 +1 @@
1
- import{FieldSelect as e}from"../chunk-EOJNJCMJ.js";export{FieldSelect,FieldSlider,optionFor}from"../chunk-EOJNJCMJ.js";import{TreeSeam as n}from"../chunk-ZFDCDJNZ.js";import{SettingsField as l,SETTINGS_BUCKETS as t,SettingsTabs as a,SettingsGroup as r}from"../chunk-ZNS7727Y.js";import{DEFAULT_TREE_WORDS as i}from"../chunk-3EDSDPIP.js";import{DEFAULT_PANEL_WORDS as o}from"../chunk-QTLAVDJE.js";export{useResolvedFields}from"../chunk-YRLPFZW3.js";import{EaselContextMenu as s}from"../chunk-KTVH2ZRL.js";import{FieldNumber as c}from"../chunk-EWVJSRRY.js";export{FieldNumber,clampNumber,parseTyped,useNumberEntry}from"../chunk-EWVJSRRY.js";import{SettingsSegmented as u}from"../chunk-P6O363EE.js";import{DEFAULT_FIELDS_WORDS as d}from"../chunk-FPOKPNO4.js";import{useWords as m}from"../chunk-MFIRYGHW.js";import"../chunk-BZ5ASXOL.js";import{useTreeDrag as p,gapToMoveIndex as h}from"../chunk-67GNT6PF.js";import{ChevronIcon as b,LockIcon as f,MoveUpIcon as v,MoveDownIcon as g,DuplicateIcon as y,TrashIcon as x}from"../chunk-L5KW4HG5.js";import"../chunk-KRXQM65X.js";import"../chunk-NKB3KVAB.js";import{useRef as k,useState as N,useLayoutEffect as O,useId as w}from"react";import{jsx as C,jsxs as j}from"react/jsx-runtime";function S({id:e,value:n,onChange:l,placeholder:t,multiline:a=!1,rows:r=3,readOnly:i=!1,ariaLabel:o,ariaLabelledBy:s}){const c=n??"";return a?/* @__PURE__ */C("textarea",{id:e,className:"es-fin es-fin--area",value:c,rows:r,placeholder:t,readOnly:i,"aria-label":o,"aria-labelledby":s,onChange:e=>l(e.target.value)}):/* @__PURE__ */C("input",{id:e,type:"text",className:"es-fin",value:c,placeholder:t,readOnly:i,"aria-label":o,"aria-labelledby":s,onChange:e=>l(e.target.value)})}function I(e,n,l){const t=e.slice();return t.splice(Math.max(0,Math.min(n,t.length)),0,l),t}function D(e,n,l){const t=e.slice(),[a]=t.splice(n,1);return t.splice(Math.max(0,Math.min(l,t.length)),0,a),t}function F(e,n){return e.filter((e,l)=>l!==n)}function $(e){return null===e||"object"!=typeof e?e:JSON.parse(JSON.stringify(e))}var L='input, textarea, select, button, [contenteditable]:not([contenteditable="false"]), [tabindex]',E={parentId:"list",slot:"items"};function P({label:e,icon:l,noun:t,items:a,onChange:r,newItem:o,summary:c,itemName:u,thumb:w,min:S=0,max:P,readOnly:R=!1,open:A,onOpen:M,renderItem:J,renderRow:T,canRemove:K,lockedReason:B,fixed:z=!1,removeOnRow:H=!0,canDuplicate:V,above:W,head:Y=!0}){const Z=m("fields",d).list,X=m("tree",i),q=t??Z.item,G=!R&&!z&&("number"!=typeof P||a.length<P),Q=a.length<=S,U=e=>!!K&&!K(a[e],e),_=e=>!R&&!z&&H&&!Q&&!U(e),ee=e=>G&&(!V||V(a[e],e)),ne=(e,n)=>u?u(e,n):Z.itemName({noun:q,n:n+1}),le=k([]),te=k(null),[ae,re]=N(null),ie=k(null),[oe,se]=N(null),[ce,ue]=N("");O(()=>{for(const e of le.current){if(!e)continue;null!==e.querySelector(L)||R?e.removeAttribute("tabindex"):e.tabIndex=0}}),O(()=>{const e=te.current;if(!e)return;te.current=null;const n=le.current[e.index]?.querySelectorAll(L)[e.nth]??le.current[e.index];if(n?.focus(),n&&null!==e.start&&"setSelectionRange"in n)try{n.setSelectionRange(e.start,e.end)}catch{}});const de=(e,n)=>{if(n<0||n>=a.length||n===e)return;const l=le.current[e],t=l?.ownerDocument.activeElement;if(l&&t&&l.contains(t)){const e=[...l.querySelectorAll(L)].indexOf(t),a=t;te.current={index:n,nth:e,start:"number"==typeof a.selectionStart?a.selectionStart:null,end:"number"==typeof a.selectionEnd?a.selectionEnd:null}}r(D(a,e,n));const i=function(e,n,l){return null===e?null:e===n?l:n<e&&l>=e?e-1:n>e&&l<=e?e+1:e}(A,e,n);i!==A&&M(i),ue(Z.moved({n:n+1,total:a.length}))},me=e=>{G&&(r(I(a,e,o())),T?(te.current={index:e,nth:0,start:null,end:null},null!==A&&A>=e&&M(A+1)):M(e))},pe=e=>{_(e)&&(r(F(a,e)),A===e?M(null):null!==A&&A>e&&M(A-1))},he=p({keyOf:e=>String(e),canDrop:(e,n)=>n.parentId===E.parentId&&n.slot===E.slot,onDrop:(e,n)=>{const l=h({...E,index:e},n);l!==e&&de(e,l)},onStep:(e,n)=>de(e,e+n),canStep:(e,n)=>e+n>=0&&e+n<a.length,readOnly:R}),be=e=>{const n=[];return e>0&&n.push({label:Z.moveUp,icon:/* @__PURE__ */C(v,{size:14}),shortcut:"⌥↑",onClick:()=>de(e,e-1)}),e<a.length-1&&n.push({label:Z.moveDown,icon:/* @__PURE__ */C(g,{size:14}),shortcut:"⌥↓",onClick:()=>de(e,e+1)}),ee(e)&&n.push({label:Z.duplicate,icon:/* @__PURE__ */C(y,{size:14}),onClick:()=>(e=>{ee(e)&&(r(I(a,e+1,$(a[e]))),null!==A&&A>e&&M(A+1))})(e)}),_(e)&&n.push({label:Z.delete,icon:/* @__PURE__ */C(x,{size:14}),danger:!0,onClick:()=>pe(e)}),n},fe=(e,n,l)=>{R||0===be(e).length||se({index:e,x:n,y:l})},ve=e=>n=>{const l=a.slice();l[e]=n,r(l)};/* @__PURE__ */
2
- return j("div",{className:"es-list",children:[Y?/* @__PURE__ */j("div",{className:"es-list-head",children:[
3
- /* @__PURE__ */j("span",{className:"es-list-label",children:[l?/* @__PURE__ */C("span",{className:"es-field-icon","aria-hidden":"true",children:l}):null,e]}),
4
- /* @__PURE__ */C("span",{className:"es-list-count",children:a.length})]}):null,W?/* @__PURE__ */C("div",{className:"es-list-above",children:W}):null,a.length?/* @__PURE__ */j("div",{className:"es-list-rows",...he.rootProps(),children:[a.map((e,l)=>{const t=he.row({item:l,place:{...E,index:l}}),a=t.draggable&&ae!==l,r=!T&&A===l,i=!R&&!z&&H&&U(l),o=["es-list-row",T?"is-inline":"is-item",r?"is-open":"",a?"is-draggable":"",t.dragging?"is-dragging":"",t.drop?`is-drop-${t.drop}`:""].filter(Boolean).join(" ");/* @__PURE__ */
5
- return j("div",{className:"es-list-entry",children:[l>0?/* @__PURE__ */C(n,{...he.seam({place:{...E,index:l}}),onAdd:G?()=>me(l):void 0,label:Z.addHere({noun:q})}):null,
6
- /* @__PURE__ */j("div",{...t.rowProps,ref:e=>{le.current[l]=e},className:o,draggable:a||void 0,"aria-keyshortcuts":t.draggable?"Alt+ArrowUp Alt+ArrowDown":void 0,onPointerDown:e=>{const n=e.target.closest?.('input, textarea, select, [contenteditable]:not([contenteditable="false"])'),a=!!n&&n===n.ownerDocument.activeElement;e.currentTarget.draggable=t.draggable&&!a,ie.current=n&&!a?n:null,re(a?l:null)},onDragStart:e=>{const n=ie.current;ie.current=null,n&&n.ownerDocument.activeElement===n&&n.blur(),t.rowProps.onDragStart?.(e)},onContextMenu:e=>{R||(e.preventDefault(),e.stopPropagation(),fe(l,e.clientX,e.clientY))},onKeyDown:e=>{if("ContextMenu"===e.key||e.shiftKey&&"F10"===e.key){e.preventDefault();const n=e.currentTarget.ownerDocument,t=e=>e.preventDefault();n.addEventListener("contextmenu",t,{capture:!0,once:!0}),n.defaultView?.setTimeout(()=>n.removeEventListener("contextmenu",t,{capture:!0}),500);const a=e.currentTarget.getBoundingClientRect();return void fe(l,a.left+24,a.bottom)}t.rowProps.onKeyDown?.(e)},children:[a?/* @__PURE__ */C("span",{className:"es-list-hint","aria-hidden":"true",children:X.dragHint}):null,T?/* @__PURE__ */C("div",{className:"es-list-row-main",children:T(e,l,ve(l))}):/* @__PURE__ */j("button",{type:"button",className:"es-list-open","aria-expanded":r,onClick:()=>M(r?null:l),children:[w?/* @__PURE__ */C("span",{className:"es-list-thumb","aria-hidden":"true",children:w(e,l)}):null,
7
- /* @__PURE__ */C("span",{className:"es-list-row-name",children:ne(e,l)}),/* @__PURE__ */C("span",c?{className:"es-list-row-summary",children:c(e,l)}:{className:"es-list-row-summary"}),
8
- /* @__PURE__ */C(b,{size:14,className:"es-list-chev","aria-hidden":"true"})]}),R||z||!H?null:i?/* @__PURE__ */C("span",{className:"es-list-lock",role:"img","aria-label":B?B(e,l):Z.locked,title:B?B(e,l):Z.locked,children:/* @__PURE__ */C(f,{size:13})}):/* @__PURE__ */C("button",{type:"button",className:"es-list-x","aria-label":Z.deleteItem({noun:q}),title:Z.deleteItem({noun:q}),disabled:!_(l),onClick:()=>pe(l),children:"×"})]}),r?/* @__PURE__ */C("div",{className:"es-list-item",children:J(e,l,ve(l))}):null]},l)}),
9
- /* @__PURE__ */C(n,{...he.seam({place:{...E,index:a.length}})})]}):null,R||z?null:/* @__PURE__ */C("button",{type:"button",className:"es-list-add",disabled:!G,onClick:()=>me(a.length),children:Z.add({noun:q})}),
10
- /* @__PURE__ */C("span",{className:"es-list-said","aria-live":"polite",children:ce}),oe&&oe.index<a.length?/* @__PURE__ */C(s,{x:oe.x,y:oe.y,items:be(oe.index),onClose:()=>se(null)}):null]})}var R=(e,n)=>"string"==typeof e.label&&e.label?e.label:n;function A({field:e,name:n,id:l,value:t,onChange:a,readOnly:i,context:o,renderers:s}){const[c,u]=N(!0),d=t&&"object"==typeof t?t:{};/* @__PURE__ */
11
- return C(r,{id:`${l}-group`,title:R(e,n),open:c,onToggle:u,children:Object.entries(e.objectFields).map(([e,t])=>/* @__PURE__ */C(J,{field:t,name:`${n}.${e}`,id:`${l}-${e}`,value:d[e],onChange:n=>a({...d,[e]:n}),readOnly:i,context:o,renderers:s},e))})}function M({field:e,name:n,id:l,value:t,onChange:a,readOnly:r,context:i,renderers:o,openItem:s,onOpenItem:c}){const[u,d]=N(null),m=c?s??null:u,p=c??d,h=Array.isArray(t)?t:[],b=e.getItemSummary;/* @__PURE__ */
12
- return C(P,{label:R(e,n),icon:e.icon,noun:"string"==typeof e.noun?e.noun:void 0,items:h,onChange:a,newItem:()=>$({...e.defaultItemProps??{}}),summary:b?(e,n)=>b(e,n):void 0,min:e.min,max:e.max,readOnly:r,open:m,onOpen:p,renderItem:(t,a,s)=>Object.entries(e.arrayFields).map(([e,c])=>/* @__PURE__ */C(J,{field:c,name:`${n}[${a}].${e}`,id:`${l}-${a}-${e}`,value:t?.[e],onChange:n=>s({...t,[e]:n}),readOnly:r,context:i,renderers:o},e))})}function J(n){const{field:t,name:a,id:r,value:i,onChange:o,readOnly:s,context:d,renderers:m}=n;if(!t||t.marker||!1===t.visible)return null;const p=m?.[t.type];if(p)return p({field:t,name:a,id:r,value:i,onChange:o,readOnly:s});switch(t.type){case"custom":{const e={...d,field:t,name:a,id:r,value:i,onChange:o,readOnly:s};return t.render(e)}case"text":case"textarea":/* @__PURE__ */
13
- return C(l,{label:R(t,a),htmlFor:r,icon:t.icon,hint:t.hint,children:/* @__PURE__ */C(S,{id:r,value:"string"==typeof i?i:null==i?"":String(i),onChange:o,placeholder:t.placeholder,multiline:"textarea"===t.type,readOnly:s})});case"number":/* @__PURE__ */
14
- return C(l,{label:R(t,a),htmlFor:r,icon:t.icon,hint:t.hint,children:/* @__PURE__ */C(c,{id:r,value:"number"==typeof i?i:void 0,onChange:o,min:t.min,max:t.max,step:t.step,placeholder:t.placeholder,readOnly:s})});case"select":{const n=`${r}-label`;/* @__PURE__ */
15
- return C(l,{label:R(t,a),labelId:n,htmlFor:r,icon:t.icon,hint:t.hint,children:/* @__PURE__ */C(e,{id:r,value:i,options:t.options,onChange:o,readOnly:s,ariaLabelledBy:n})})}case"radio":/* @__PURE__ */
16
- return C(l,{label:R(t,a),icon:t.icon,hint:t.hint,children:/* @__PURE__ */C(u,{ariaLabel:R(t,a),value:i,options:t.options.map(e=>({id:e.value,label:e.label,icon:e.icon,disabled:e.disabled||s})),onChange:e=>{s||o(e)}})});case"object":/* @__PURE__ */
17
- return C(A,{...n,field:t});case"array":/* @__PURE__ */
18
- return C(M,{...n,field:t});case"slot":return null}}var T=e=>t.includes(e);function K(e){let n=t[0];const l=[],a=/* @__PURE__ */new Set;for(const[t,r]of Object.entries(e))r&&(T(r.bucket)&&(n=r.bucket),r.marker||!1===r.visible||(l.push({name:t,field:r,bucket:n}),"slot"!==r.type&&a.add(n)));return{rows:l,buckets:t.filter(e=>a.has(e))}}function B(e){return new Map(K(e).rows.map(e=>[e.name,e.bucket]))}function z({fields:e,values:n,onChange:l,readOnly:t=!1,context:r,tab:i,onTab:s,tabs:c=!0,tabIcons:u,renderers:d,idPrefix:p,ariaLabel:h,children:b}){const f=m("panel",o),v=w(),g=p??`es-insp${v.replace(/:/g,"")}`,y=K(e),[x,k]=N(void 0),O=i??x,S=O&&y.buckets.includes(O)?O:y.buckets[0],[I,D]=N(null),F=I&&I.panel===g&&y.rows.some(e=>e.name===I.name)?I:null,$=c&&y.buckets.length>1,L=`${g}-rows`,E=e=>`${g}-tab-${e.toLowerCase()}`;/* @__PURE__ */
19
- return j("div",{className:"es-insp",children:[$?/* @__PURE__ */C("div",{className:"es-insp-tabs",children:/* @__PURE__ */C(a,{ariaLabel:h??f.settings,activeId:S,onSelect:e=>{const n=e;void 0===i&&k(n),s?.(n)},items:y.buckets.map(e=>({id:e,label:f.buckets[e],icon:u?.[e],htmlId:E(e),panelId:L}))})}):null,
20
- /* @__PURE__ */j("div",{className:"es-insp-rows",id:L,role:$?"tabpanel":void 0,"aria-labelledby":$&&S?E(S):void 0,children:[y.rows.map(({name:e,field:a,bucket:i})=>/* @__PURE__ */C("div",{className:"es-insp-row","data-field":e,"data-bucket":i,hidden:!(!$||i===S)||void 0,children:/* @__PURE__ */C(J,{field:a,name:e,id:`${g}-${e}`,value:n[e],onChange:n=>l(e,n),readOnly:t,context:r,renderers:d,openItem:F&&F.name===e?F.index:null,onOpenItem:n=>D(null===n?null:{panel:g,name:e,index:n})})},e)),b]})]})}function H(e){return"select"===e.type?e.options:"groups"===e.type?e.groups.flatMap(e=>e.options):[]}function V({value:n,onChange:l,kinds:t,rules:a,filtersFor:r,label:i,readOnly:o}){const s=m("fields",d).link??d.link,[c,u]=N(null),[p,h]=N(null),b=c??a.kindOf(n),f=t.filter(e=>!e.hideWhenEmpty||H(e.target).length>0||e.value===b),v=f.find(e=>"text"===e.target.type),g=f.find(e=>e.value===b)??v??f[0];if(!g)return null;const y="text"!==g.target.type,x=y?a.targetOf(n):n,k=H(g.target),O=k.find(e=>e.value===x),w=e=>({value:e,label:s.unavailable({value:e})}),S="select"===g.target.type&&x&&r?r(x):null,I=S?a.readFilter(n):null,D=I?S?.find(e=>e.param===I.param):void 0,F=p&&p.against===n?p.text:n,$=!y&&""!==F.trim()&&!a.isSafe(F),L=e=>{if(!e)return l("");const n=k.find(n=>n.value===e);l(e,n?.label)},E=(e,n)=>n&&!e.some(e=>e.value===n)?[w(n),...e]:[...e];let P;if("text"===g.target.type)P=/* @__PURE__ */C("input",{type:"text",className:"es-fin","aria-label":s.address,"aria-invalid":$||void 0,placeholder:s.addressPlaceholder,value:F,readOnly:o,onChange:e=>(e=>{const t=e.trim();t?a.isSafe(e)?(h({text:e,against:t}),l(t)):h({text:e,against:n}):(h({text:e,against:""}),l(""))})(e.target.value)});else{const n="groups"===g.target.type?g.target.groups.flatMap(e=>e.options.map(n=>({value:n.value,label:n.label,group:e.label}))):g.target.options.map(e=>({value:e.value,label:e.label}));P=/* @__PURE__ */C(e,{ariaLabel:g.label,value:x,options:[{value:"",label:g.target.placeholder},...E(n,x)],searchable:n.length>10,readOnly:o,onChange:L})}/* @__PURE__ */
21
- return j("div",{className:"es-flink",role:i?"group":void 0,"aria-label":i,children:[
22
- /* @__PURE__ */C(e,{ariaLabel:s.linkType,value:g.value,options:f.map(e=>({value:e.value,label:e.label})),readOnly:o,onChange:e=>{u(e),h(null);const n=f.find(n=>n.value===e);if(!n||"text"===n.target.type)return;const t=H(n.target)[0];t?l(t.value,t.label):l("")}}),P,S&&/* @__PURE__ */C(e,{ariaLabel:s.filter,value:I?.param??"",options:[{value:"",label:s.noFilter},...I&&!D?[w(I.param)]:[],...S.map(e=>({value:e.param,label:e.label}))],readOnly:o,onChange:e=>{if(!e)return l(x,O?.label);const n=S?.find(n=>n.param===e),t=n?.values[0];t&&l(a.withFilter(x,{param:e,value:t.value}),t.label)}}),S&&I&&/* @__PURE__ */C(e,{ariaLabel:s.value,value:I.value,options:E((D?.values??[]).map(e=>({value:e.value,label:e.label})),I.value),searchable:(D?.values.length??0)>10,readOnly:o,onChange:e=>{if(!I)return;const n=D?.values.find(n=>n.value===e);l(a.withFilter(x,{param:I.param,value:e}),n?.label)}}),$&&/* @__PURE__ */C("p",{className:"es-flink-error",role:"alert",children:s.unsafe}),g.hint&&/* @__PURE__ */C("p",{className:"es-flink-hint",children:g.hint}),S&&/* @__PURE__ */C("p",{className:"es-flink-hint",children:s.filterHint})]})}export{S as FieldText,z as Inspector,J as InspectorField,V as LinkPicker,P as ListField,B as bucketsOf,$ as copyItem,I as insertAt,R as labelOf,D as moveTo,K as planFields,F as removeAt};
1
+ export{FieldText,Inspector,InspectorField,LinkPicker,ListField,bucketsOf,copyItem,insertAt,labelOf,moveTo,planFields,removeAt}from"../chunk-BXZ6WLHC.js";export{FieldSelect,FieldSlider,optionFor}from"../chunk-EOJNJCMJ.js";import"../chunk-ZFDCDJNZ.js";import"../chunk-ZNS7727Y.js";import"../chunk-3EDSDPIP.js";import"../chunk-QTLAVDJE.js";export{useResolvedFields}from"../chunk-YRLPFZW3.js";import"../chunk-KTVH2ZRL.js";export{FieldNumber,clampNumber,parseTyped,useNumberEntry}from"../chunk-EWVJSRRY.js";import"../chunk-P6O363EE.js";import"../chunk-FPOKPNO4.js";import"../chunk-MFIRYGHW.js";import"../chunk-BZ5ASXOL.js";import"../chunk-67GNT6PF.js";import"../chunk-L5KW4HG5.js";import"../chunk-KRXQM65X.js";import"../chunk-NKB3KVAB.js";
@@ -138,7 +138,8 @@ declare function GoldTextInput({ value, onInput, onCommit, onCancel, multiline,
138
138
  * text-decoration, a shadow. A merchant sees WHERE the formatting starts and
139
139
  * ends and in which colour it will land; the real weight and slant appear on the
140
140
  * page the moment they click away. Full WYSIWYG (asterisks gone, real faces) is
141
- * a second text engine and is deliberately out of scope — see CLAUDE.md.
141
+ * a second text engine and is deliberately out of scope — see
142
+ * docs/agents/text-and-grammar.md, gold rule 2.
142
143
  *
143
144
  * The elements mirror the storefront's own renderer (`goldPhrases.tsx`):
144
145
  * `<strong>` for bold, `<em>` for italic and for the gold accent, `<s>` for
@@ -193,7 +194,8 @@ declare function goldSegments(value: string, rules: readonly InlineRule[]): Gold
193
194
  * (see `GoldTextInput`). So there is no type here to tokenise; what is left is
194
195
  * the paint, and only the paint that cannot move a glyph.
195
196
  *
196
- * NOTHING HERE IS INVENTED (CLAUDE.md — "the tokens are not ours to invent"):
197
+ * NOTHING HERE IS INVENTED (docs/agents/leaves-and-tokens.md, "the tokens are
198
+ * not ours to invent"):
197
199
  * - the gold defers to the page's own `--gold`, falling back to the
198
200
  * storefront's light-theme value (`efficient-storefront/app/globals.css` → `--gold:
199
201
  * #c9a461`), so the mark in the box matches the mark on the page;