efficient-web-builder 49.1.0 → 51.0.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 (150) hide show
  1. package/CHANGELOG.md +43 -0
  2. package/README.md +1 -1
  3. package/dist/editor/components/BlogPostSource.js +1 -1
  4. package/dist/editor/components/EditorPagePathProvider.d.ts +4 -0
  5. package/dist/editor/components/EditorPagePathProvider.js +1 -0
  6. package/dist/editor/components/HeroPartPanel.js +1 -1
  7. package/dist/editor/components/MediaUploadField.js +1 -1
  8. package/dist/editor/components/PagesPanel.js +1 -1
  9. package/dist/editor/components/SectionEditor.js +1 -1
  10. package/dist/editor/components/SourceStatus.d.ts +3 -3
  11. package/dist/editor/components/SourceStatus.js +1 -1
  12. package/dist/editor/components/StorefrontEditor.js +1 -1
  13. package/dist/editor/components/ThemeCard.js +1 -1
  14. package/dist/editor/components/WebsiteScreenParts.js +1 -1
  15. package/dist/editor/components/storefront-editor.css +1 -1
  16. package/dist/editor/components/usePartMotion.d.ts +1 -1
  17. package/dist/editor/components/usePartTypingDeps.d.ts +2 -0
  18. package/dist/editor/components/usePartTypingDeps.js +1 -0
  19. package/dist/editor/lib/animation/entrance-fields.js +1 -1
  20. package/dist/editor/lib/animation/fields.d.ts +1 -1
  21. package/dist/editor/lib/animation/fields.js +1 -1
  22. package/dist/editor/lib/animation/hover-fields.d.ts +7 -1
  23. package/dist/editor/lib/animation/hover-fields.js +1 -1
  24. package/dist/editor/lib/document/add-target.js +1 -1
  25. package/dist/editor/lib/document/block-source-fields.d.ts +6 -0
  26. package/dist/editor/lib/document/block-source-fields.js +1 -1
  27. package/dist/editor/lib/document/blocks/general/Cards/fields.js +1 -1
  28. package/dist/editor/lib/document/blocks/general/ContactLocations/fields.js +1 -1
  29. package/dist/editor/lib/document/blocks/general/Flex/fields.js +1 -1
  30. package/dist/editor/lib/document/blocks/general/Hero/fields.js +1 -1
  31. package/dist/editor/lib/document/blocks/general/HeroSlide/fields.js +1 -1
  32. package/dist/editor/lib/document/blocks/general/ImageBlock/fields.js +1 -1
  33. package/dist/editor/lib/document/blocks/general/PaymentBadges/fields.js +1 -1
  34. package/dist/editor/lib/document/blocks/general/PostCard/fields.js +1 -1
  35. package/dist/editor/lib/document/blocks/general/Text/fields.js +1 -1
  36. package/dist/editor/lib/document/blocks/general/index.d.ts +2 -2
  37. package/dist/editor/lib/document/blocks/hero-shared-fields.d.ts +2 -0
  38. package/dist/editor/lib/document/blocks/hero-shared-fields.js +1 -1
  39. package/dist/editor/lib/document/canvas-typing.d.ts +1 -0
  40. package/dist/editor/lib/document/canvas-typing.js +1 -1
  41. package/dist/editor/lib/document/card-copy-rows.d.ts +12 -0
  42. package/dist/editor/lib/document/card-copy-rows.js +1 -0
  43. package/dist/editor/lib/document/card-display-chips.d.ts +7 -2
  44. package/dist/editor/lib/document/card-display-chips.js +1 -1
  45. package/dist/editor/lib/document/card-row-fields.js +1 -1
  46. package/dist/editor/lib/document/controls.d.ts +1 -0
  47. package/dist/editor/lib/document/controls.js +1 -1
  48. package/dist/editor/lib/document/darken-fields.d.ts +4 -0
  49. package/dist/editor/lib/document/darken-fields.js +1 -0
  50. package/dist/editor/lib/document/field-groups.js +1 -1
  51. package/dist/editor/lib/document/overrides.js +1 -1
  52. package/dist/editor/lib/document/slot-new-children.d.ts +2 -0
  53. package/dist/editor/lib/document/slot-new-children.js +1 -0
  54. package/dist/editor/lib/sections/hero-ticker-to-strip.js +1 -1
  55. package/dist/editor/lib/sections/new-section-node.js +1 -1
  56. package/dist/format/components/stored-pick-row.d.ts +8 -0
  57. package/dist/format/components/stored-pick-row.js +1 -0
  58. package/dist/format/lib/animation/hover.d.ts +32 -1
  59. package/dist/format/lib/animation/hover.js +1 -1
  60. package/dist/format/lib/content/block-sources.d.ts +11 -0
  61. package/dist/format/lib/content/block-sources.js +1 -1
  62. package/dist/format/lib/content/box-layout.d.ts +11 -0
  63. package/dist/format/lib/content/box-layout.js +1 -1
  64. package/dist/format/lib/content/box-shape.d.ts +2 -1
  65. package/dist/format/lib/content/box-shape.js +1 -1
  66. package/dist/format/lib/content/card-place.d.ts +8 -0
  67. package/dist/format/lib/content/card-place.js +1 -0
  68. package/dist/format/lib/content/card-template.d.ts +20 -2
  69. package/dist/format/lib/content/card-template.js +1 -1
  70. package/dist/format/lib/content/image-treatment.d.ts +23 -4
  71. package/dist/format/lib/content/image-treatment.js +1 -1
  72. package/dist/format/lib/document/blocks/general/Cards/card-seed.d.ts +15 -0
  73. package/dist/format/lib/document/blocks/general/Cards/card-seed.js +1 -0
  74. package/dist/format/lib/document/blocks/general/Cards/meta.d.ts +6 -0
  75. package/dist/format/lib/document/blocks/general/Cards/meta.js +1 -1
  76. package/dist/format/lib/document/blocks/general/Hero/meta.js +1 -1
  77. package/dist/format/lib/document/blocks/general/HeroSingle/meta.js +1 -1
  78. package/dist/format/lib/document/blocks/general/text-part-shapes.json +8 -0
  79. package/dist/format/lib/document/box-footer.js +1 -1
  80. package/dist/format/lib/document/cards-template-on-read.d.ts +4 -0
  81. package/dist/format/lib/document/cards-template-on-read.js +1 -0
  82. package/dist/format/lib/document/easel-row-words.d.ts +1 -0
  83. package/dist/format/lib/document/easel-row-words.js +1 -1
  84. package/dist/format/lib/document/editor-page-context.js +1 -1
  85. package/dist/format/lib/document/passes/card-template-on-insert.d.ts +2 -0
  86. package/dist/format/lib/document/passes/card-template-on-insert.js +1 -0
  87. package/dist/format/lib/document/passes/types.d.ts +6 -0
  88. package/dist/format/lib/document/renamed-props.js +1 -1
  89. package/dist/format/lib/document/section-catalog.js +22 -2
  90. package/dist/format/lib/document/seed-parts.d.ts +18 -0
  91. package/dist/format/lib/document/seed-parts.js +1 -0
  92. package/dist/format/lib/editor-page-rows.d.ts +2 -0
  93. package/dist/format/lib/editor-page-rows.js +1 -1
  94. package/dist/format/lib/editor-words-catalogue.d.ts +21 -6
  95. package/dist/format/lib/editor-words-catalogue.js +4 -4
  96. package/dist/format/lib/hero-ticker.d.ts +4 -0
  97. package/dist/format/lib/hero-ticker.js +1 -1
  98. package/dist/format/lib/page-at-own-slug.d.ts +9 -0
  99. package/dist/format/lib/page-at-own-slug.js +1 -0
  100. package/dist/format/lib/popup/new-popup.js +1 -1
  101. package/dist/format/lib/sections/hero-overlay.js +1 -1
  102. package/dist/render/components/ButtonBlock.d.ts +1 -1
  103. package/dist/render/components/ButtonBlock.js +1 -1
  104. package/dist/render/components/Cards.d.ts +4 -2
  105. package/dist/render/components/Cards.js +1 -1
  106. package/dist/render/components/ContactLocations.d.ts +3 -1
  107. package/dist/render/components/ContactLocations.js +2 -2
  108. package/dist/render/components/Flex.d.ts +5 -1
  109. package/dist/render/components/Flex.js +1 -1
  110. package/dist/render/components/HeroPictures.d.ts +10 -0
  111. package/dist/render/components/HeroPictures.js +1 -1
  112. package/dist/render/components/HeroSingle.js +1 -1
  113. package/dist/render/components/HeroSlide.js +1 -1
  114. package/dist/render/components/ImageBlock.d.ts +6 -1
  115. package/dist/render/components/ImageBlock.js +1 -1
  116. package/dist/render/components/Manifesto.d.ts +3 -1
  117. package/dist/render/components/Manifesto.js +1 -1
  118. package/dist/render/components/PhotoHoverSheet.d.ts +4 -0
  119. package/dist/render/components/PhotoHoverSheet.js +1 -0
  120. package/dist/render/components/PictureWash.d.ts +6 -0
  121. package/dist/render/components/PictureWash.js +1 -0
  122. package/dist/render/components/Placeholder.js +1 -1
  123. package/dist/render/components/PostCard.js +1 -1
  124. package/dist/render/components/Split.d.ts +3 -1
  125. package/dist/render/components/Split.js +1 -1
  126. package/dist/render/components/Text.d.ts +4 -3
  127. package/dist/render/components/Text.js +1 -1
  128. package/dist/render/lib/animation/part-motion.js +2 -2
  129. package/dist/render/lib/document/blocks/general/Cards/render.js +1 -1
  130. package/dist/render/lib/document/blocks/general/ContactLocations/render.js +1 -1
  131. package/dist/render/lib/document/blocks/general/Flex/render.js +1 -1
  132. package/dist/render/lib/document/blocks/general/ImageBlock/render.js +1 -1
  133. package/dist/render/lib/document/blocks/general/Manifesto/render.js +1 -1
  134. package/dist/render/lib/document/blocks/general/Split/render.js +1 -1
  135. package/dist/render/lib/document/blocks/general/Text/render.js +1 -1
  136. package/dist/render/lib/document/blocks/general/section-head-looks.d.ts +1 -2
  137. package/dist/render/lib/document/blocks/general/section-head-looks.js +2 -2
  138. package/dist/render/lib/document/blocks/general/section-to-box-row-parts.d.ts +1 -5
  139. package/dist/render/lib/document/blocks/general/section-to-box-row-parts.js +1 -1
  140. package/dist/render/lib/document/blocks/general/section-to-box-rows-cards.js +1 -1
  141. package/dist/render/lib/document/blocks/general/section-to-box-rows-locations.js +1 -1
  142. package/dist/render/lib/document/blocks/general/section-to-box-rows-timeline.js +2 -2
  143. package/dist/render/lib/document/blocks/general/section-to-box-rows.js +1 -1
  144. package/dist/render/lib/document/passes/index.js +1 -1
  145. package/dist/render/lib/document/passes/section-animation.js +1 -1
  146. package/dist/render/lib/sections/section-to-box.d.ts +7 -7
  147. package/dist/render/lib/sections/section-to-box.js +1 -1
  148. package/dist/render/lib/site-runtime.d.ts +2 -0
  149. package/dist/render/lib/site-runtime.js +1 -1
  150. package/package.json +4 -4
@@ -1 +1 @@
1
- import{readHidable as Z}from"efficient-easel/draw";import{BOX_TYPE as ee,CONTAINER_BLOCKS_SLOT as te}from"../../../format/lib/document/container-blocks.js";import{headingTextSeed as oe,labelTextSeed as ne}from"../../../format/lib/document/text-seeds.js";import{SPLITTABLE_SECTIONS as se}from"../../../format/lib/sections/section-head-placement.js";import{finiteNumber as R}from"../../../format/lib/finite-number.js";import{bucketByGroup as re}from"../../../format/lib/locations-grid.js";import{normalizeTheme as V}from"../../../format/lib/theme.js";const P=ee,E=te;function $e(t){if(t.theme)return V(t.theme);const o=t.site?.themePresets;return o?V({selected:t.site?.selectedPreset??0,themes:[...o]}):void 0}function ie(t,o){return o===0?`${t}~box`:`${t}~box-${o+1}`}const A={Flex:"the Box itself",Hero:"its slides hold Boxes of real blocks (Hero › Slide › Box), and its Scrolling Bar is a Box in its strip slot (Hero › Box)",Divider:"one block with no text, picture or button",CustomHTML:"the HTML box is the whole section; it has no parts"};function Oe(t){for(const[o,r]of Object.entries(t)){if(o in A&&A[o]!==r)throw new Error(`lib/sections/section-to-box: "${o}" is already Box-native`);A[o]=r}}function Se(t){return A[t]}const Y=new Set(["id"]),B={},H=[],ce=[];function Be(t){for(const[o,r]of Object.entries(t)){if(o in B&&B[o]!==r)throw new Error(`lib/sections/section-to-box: "${o}" already has a row`);B[o]=r}}function Te(t){return B[t]}function _e(){return Object.keys(B)}function ae(t){return t in B&&H.includes(t)}function Pe(t,o=ce){return t in B&&(o.includes(t)||ae(t))}function Ee(t){const o=se[t];if(!o)throw new Error(`lib/sections/section-to-box: "${t}" has no head row in SPLITTABLE_SECTIONS`);const r=[{kind:"text",key:o.num,role:"eyebrow"},{kind:"text",key:o.title,role:"heading"}];return o.description&&r.push({kind:"text",key:o.description,role:"body"}),o.headRows.includes("linkText")&&o.headRows.includes("linkHref")&&r.push({kind:"button",key:"linkText",href:"linkHref"}),r}const W=t=>Z(t),je=t=>W(t).text.trim()!=="";function fe(t){return t.replace(/==(.+?)==/g,(o,r)=>r.startsWith("_")&&r.endsWith("_")?o:`==_${r}_==`)}function le(t){if(t.includes("=="))return t;const o=t.indexOf("/"),r=o===-1?t:t.slice(0,o),i=r.trim();if(!i)return t;const h=r.indexOf(i);return`${r.slice(0,h)}==${i}==${r.slice(h+i.length)}${o===-1?"":t.slice(o)}`}const de=t=>t==="heading"?oe():t==="eyebrow"?ne():{};function pe(t,o,r,i){const a={...t._partStyles?.text??{},...o??{},...r??{}};return(i==="center"||i==="right")&&a.align===void 0&&(a.align=i),Object.keys(a).length?{_partStyles:{text:a}}:{}}function ue(t,o){if(t===void 0)return{};if(typeof t=="string")return{variant:t};const r=o[t.key];return{variant:typeof r=="string"&&Object.hasOwn(t.map,r)?t.map[r]:t.fallback}}function D(t,o,r,i,h={}){const a={...o};for(const y of t){const[x,S,v]=typeof y=="string"?[y,y,void 0]:y;if(r[x]===void 0)continue;const T=v?v(r[x],r,h):r[x];T===void 0?delete a[S]:a[S]=T,i(x,S,T===void 0)}return a}function he(t){const o=new Set([...Y,"headPlacement","_partStyles",...Object.keys(t.drop??{}),...Object.keys(t.reads??{})]),r=h=>{for(const a of h??[])o.add(typeof a=="string"?a:a[0])},i=h=>{for(const a of h)switch(a.kind){case"text":case"image":o.add(a.key),a.kind==="image"&&a.alt&&o.add(a.alt);break;case"button":o.add(a.key),o.add(a.href),typeof a.variant=="object"&&o.add(a.variant.key);break;case"list":o.add(a.key);break;case"group":case"block":r(a.box),i(a.parts??[]);break;case"core":a.keep!=="rest"&&a.keep.forEach(y=>o.add(y)),Object.keys(a.rename??{}).forEach(y=>o.add(y));for(const y of Object.values(a.slots??{}))for(const x of y)"kind"in x&&o.add(x.key);break}};for(const h of[t,...t.also??[]])r(h.box),i(h.parts);return o}function q(t,o,r={}){const i=t.props,h=o.skip?.(i);if(h!==void 0)return{node:t,nodes:[t],carried:[],dropped:[],siteWrites:[],restyled:[],skipped:h};const a=String(i.id??t.type),y=[],x=[],S=[],v=new Set,T=(n,s)=>{y.push({key:n,home:s}),v.add(n)},X=i._partStyles??{},L=he(o);let J=0;const w=(n,s)=>({type:n,props:{...s,id:`${a}~${n}-${++J}`}}),F=(n,s,b,u,g,l,$)=>{if(g){for(const c of n??[]){const p=typeof c=="string"?c:c[0];b[p]!==void 0&&$(p,`nothing — the ${u} has no parts, so it is not drawn`)}return}const e=typeof s=="function"?s(i,r):s??{};return D(n??[],e,b,(c,p,f)=>$(c,f?`nothing — the old value draws nothing (${u}: no ${p})`:`${l}${u}: ${p}`),r)},K=n=>n.map(s=>{const b={...s.props??{}};for(const[u,g]of Object.entries(s.slots??{}))b[u]=K(g);return w(s.type,b)}),M=(n,s,b)=>{const u=n.of?n.of(s):Array.isArray(s[n.key])?s[n.key]:[],g=typeof n.props=="function"?n.props(i,r):n.props??{},l=u.map((f,d)=>{const k=f??{},m=n.item?.(k,d,i)??{},j=I(m.reverse?[...n.parts].reverse():n.parts,k,!1,`item ${d+1}: `);return n.flat?m.props?j.map(_=>({..._,props:{..._.props,...m.props,id:_.props.id}})):j:[w(P,{name:`${n.name} ${d+1}`,...g,...m.props??{},[E]:j})]});if(n.groups){const f=n.groups;return b(n.key,u.length?`one Box per item (${u.length}), in a Box per group`:"nothing — the list is empty"),re(u.map(d=>d??{}),f.of,f.of).map((d,k)=>{const m=d.items.map(O=>O.item),j=f.parts?I(f.parts,f.head?.(m,i)??{},!1,`group ${k+1}: `):[],_=d.items.map(O=>l[O.index]),z=f.perRow?.(m.length,i),N=Number.isInteger(z)&&z>=1?z:1,C=[];if(f.perRow&&N<_.length)for(let O=0;O*N<_.length;O++)C.push(_.slice(O*N,(O+1)*N).flat());return w(P,{name:`${f.name} ${k+1}`,...f.props??{},[E]:[...j,w(P,{name:`${f.itemsName} ${k+1}`,...f.itemsProps?.(m.length,i)??{},[E]:C.length?C.map((O,U)=>w(P,{name:`${f.rowName??`${f.itemsName} row`} ${U+1}`,...f.rowProps??{},[E]:O})):_.flat()})]})})}const $=n.perRow?.(i),e=n.perRow?Number.isInteger($)&&$>=1?$:1:0;if(b(n.key,(u.length?n.flat?`each item's parts (${u.length} items), in order`:`one Box per item (${u.length}), its parts inside`:"nothing — the list is empty")+(e&&u.length?`, in rows of ${e}`:"")),!e)return l.flat();const c=typeof n.rowProps=="function"?n.rowProps(i,r):n.rowProps??{},p=[];for(let f=0;f*e<l.length;f++){const d=l.slice(f*e,(f+1)*e).flat(),k=n.rowFiller?e-l.slice(f*e,(f+1)*e).length:0;p.push(w(P,{name:`${n.rowName??`${n.name} row`} ${f+1}`,...c,[E]:[...d,...Array.from({length:k},(m,j)=>w(P,{name:`Empty ${j+1}`,...n.rowFiller,[E]:[]}))]}))}return p},I=(n,s,b,u)=>{const g=[],l=(e,c)=>b?T(e,c):void 0,$=e=>b?X[e]:void 0;for(const e of n)if(!(e.when&&!e.when(i,b?void 0:s)))switch(e.kind){case"text":{const c=W(s[e.key]);if(!c.text.trim()){l(e.key,"nothing — empty words draw nothing, so no block");break}const p=de(e.role??"body"),{_partStyles:f,...d}=p,k=pe(p,e.styleFrom?{...e.style,...e.styleFrom(i,r)}:e.style,$(e.key),e.props?.align);if(e.was&&b){const m=k._partStyles?.text??{};S.push({key:e.key,was:e.was,...typeof m.textStyle=="string"?{textStyle:m.textStyle}:{},...R(m.size)!==void 0?{size:R(m.size)}:{},...R(m.sizePhone)!==void 0?{sizePhone:R(m.sizePhone)}:{}})}g.push(w("Text",{text:e.mark==="accentLead"?le(c.text):e.mark==="accentItalic"?fe(c.text):c.text,...d,...e.props??{},...k,...c.hidden?{_hidden:!0}:{}})),l(e.key,`${u}Text block: its words${c.hidden?", hidden":""}`);break}case"button":{const c=W(s[e.key]);if(!c.text.trim()){l(e.key,"nothing — no words, no button"),l(e.href,"nothing — no button to link"),typeof e.variant=="object"&&l(e.variant.key,"nothing — no button to style");break}const p=typeof s[e.href]=="string"&&s[e.href]?s[e.href]:"#",f={...e.style??{},...$(e.key)??{}};g.push(w("ButtonBlock",{label:c.text,href:p,...typeof e.props=="function"?e.props(s,r):e.props??{},...ue(e.variant,s),...Object.keys(f).length?{_partStyles:{label:f}}:{},...c.hidden?{_hidden:!0}:{}})),l(e.key,`${u}Button block: its words`),l(e.href,`${u}Button block: its link`),typeof e.variant=="object"&&l(e.variant.key,`${u}Button block: its Style`);break}case"image":{const c=s[e.key];if(typeof c!="string"||!c){l(e.key,"nothing — no picture, no block"),e.alt&&l(e.alt,"nothing — no picture to describe");break}const p=e.alt&&typeof s[e.alt]=="string"?s[e.alt]:"";g.push(w("ImageBlock",{src:c,alt:p,...e.props??{}})),l(e.key,`${u}Image block: its picture`),e.alt&&l(e.alt,`${u}Image block: its alt text`);break}case"list":{g.push(...M(e,s,l));break}case"group":{const c=I(e.parts,s,b,u),p=F(e.box,e.props,s,`${e.name} Box`,!c.length&&!e.keepEmpty,u,l);p&&g.push(w(P,{name:e.name,...p,[E]:c}));break}case"block":{const c=e.parts?I(e.parts,s,b,u):[],p=F(e.box,e.props,s,`${e.type} block`,!!e.parts&&!c.length&&!e.keepEmpty,u,l);p&&g.push(w(e.type,{...p,...e.slot?{[e.slot]:c}:{}}));break}case"core":{const c=e.as??t.type,p={headPlacement:"own-box",...e.props??{}},f=e.keep==="rest"?Object.keys(s).filter(d=>!L.has(d)&&!(d in p)):e.keep;for(const d of f)s[d]!==void 0&&(p[d]=s[d],l(d,`the ${c} block inside the Box`));if(e.keep==="rest"){for(const k of Object.keys(e.props??{}))s[k]!==void 0&&!L.has(k)&&l(k,`nothing — the ${c} block inside the Box has the row's own value`);s.headPlacement!==void 0&&l("headPlacement",`the ${c} block inside the Box: own-box`);const d=Object.fromEntries(Object.entries(X).filter(([k])=>!L.has(k)));Object.keys(d).length&&(p._partStyles=d)}for(const[d,k]of Object.entries(e.rename??{}))s[d]!==void 0&&(p[k]=s[d],l(d,`the ${c} block inside the Box: ${k}`));for(const[d,k]of Object.entries(e.slots??{}))p[d]=k.flatMap(m=>"kind"in m?M(m,s,l):K([m]));g.push(w(c,p));break}}return g},Q=(n,s)=>{const b=s===0?"Box":`${n.name} Box`,u=I(n.parts,i,!0,s===0?"":`${b}: `),g=typeof n.boxProps=="function"?n.boxProps(i,r):n.boxProps??{},l=D(n.box??[],g,i,($,e,c)=>T($,c?`nothing — the old value draws nothing (${b}: no ${e})`:`${b}: ${e}`),r);return{type:P,props:{name:n.name,...l,[E]:u,id:ie(a,s)}}},G=[o,...o.also??[]].map(Q);i._partStyles!==void 0&&T("_partStyles","each old part's style moved to its new part");for(const[n,s]of Object.entries(o.reads??{}))i[n]!==void 0&&T(n,s);for(const[n,s]of Object.entries(o.drop??{}))n in i&&(x.push({key:n,why:s}),v.add(n));for(const n of Object.keys(i))Y.has(n)||v.has(n)||x.push({key:n,why:"not in the row — not carried"});return{node:G[0],nodes:G,carried:y,dropped:x,siteWrites:[...o.site?.(t,r)??[]],restyled:S}}function ve(t,o=H,r={}){const i=t.content;if(!Array.isArray(i))return t;let h=!1;const a=i.flatMap(y=>{const x=y&&typeof y.type=="string"&&o.includes(y.type)?B[y.type]:void 0;if(!x)return[y];const S=q(y,x,r);return S.skipped!==void 0?[y]:(h=!0,S.nodes)});return h?{...t,content:a}:t}function Ie(t,o=H,r={}){if(!Array.isArray(t))return[];const i=[];return t.forEach((h,a)=>{const y=h&&typeof h.type=="string"&&o.includes(h.type)?B[h.type]:void 0;if(!y)return;const x=q(h,y,r);x.skipped===void 0&&i.push({index:a,node:x.node,nodes:x.nodes})}),i}export{E as SECTION_BOX_SLOT,P as SECTION_BOX_TYPE,H as SECTION_TO_BOX_ON,ce as SECTION_TO_BOX_PRESS,Se as boxNativeReason,q as convertSection,ve as convertSectionsInPage,$e as convertTheme,ae as convertsToBox,je as hasWords,Ee as headParts,Pe as pressesAsBox,Oe as registerBoxNativeSections,Be as registerSectionToBox,ie as sectionBoxIdOf,Ie as sectionToBoxEdits,Te as sectionToBoxRow,_e as sectionToBoxTypes};
1
+ import{readHidable as Z}from"efficient-easel/draw";import{BOX_TYPE as ee,CONTAINER_BLOCKS_SLOT as te}from"../../../format/lib/document/container-blocks.js";import{headingTextSeed as oe,labelTextSeed as ne}from"../../../format/lib/document/text-seeds.js";import{SPLITTABLE_SECTIONS as se}from"../../../format/lib/sections/section-head-placement.js";import{finiteNumber as R}from"../../../format/lib/finite-number.js";import{seedNodes as ie}from"../../../format/lib/document/seed-parts.js";import{bucketByGroup as re}from"../../../format/lib/locations-grid.js";import{normalizeTheme as V}from"../../../format/lib/theme.js";const P=ee,v=te;function Se(t){if(t.theme)return V(t.theme);const o=t.site?.themePresets;return o?V({selected:t.site?.selectedPreset??0,themes:[...o]}):void 0}function ae(t,o){return o===0?`${t}~box`:`${t}~box-${o+1}`}const A={Flex:"the Box itself",Hero:"its slides hold Boxes of real blocks (Hero › Slide › Box), and its Scrolling Bar is a Box in its strip slot (Hero › Box)",Divider:"one block with no text, picture or button",CustomHTML:"the HTML box is the whole section; it has no parts"};function Be(t){for(const[o,i]of Object.entries(t)){if(o in A&&A[o]!==i)throw new Error(`lib/sections/section-to-box: "${o}" is already Box-native`);A[o]=i}}function Te(t){return A[t]}const Y=new Set(["id"]),T={},H=[],ce=[];function _e(t){for(const[o,i]of Object.entries(t)){if(o in T&&T[o]!==i)throw new Error(`lib/sections/section-to-box: "${o}" already has a row`);T[o]=i}}function Ee(t){return T[t]}function Pe(){return Object.keys(T)}function fe(t){return t in T&&H.includes(t)}function ve(t,o=ce){return t in T&&(o.includes(t)||fe(t))}function je(t){const o=se[t];if(!o)throw new Error(`lib/sections/section-to-box: "${t}" has no head row in SPLITTABLE_SECTIONS`);const i=[{kind:"text",key:o.num,role:"eyebrow"},{kind:"text",key:o.title,role:"heading"}];return o.description&&i.push({kind:"text",key:o.description,role:"body"}),o.headRows.includes("linkText")&&o.headRows.includes("linkHref")&&i.push({kind:"button",key:"linkText",href:"linkHref"}),i}const W=t=>Z(t),Ne=t=>W(t).text.trim()!=="";function de(t){return t.replace(/==(.+?)==/g,(o,i)=>i.startsWith("_")&&i.endsWith("_")?o:`==_${i}_==`)}function le(t){if(t.includes("=="))return t;const o=t.indexOf("/"),i=o===-1?t:t.slice(0,o),r=i.trim();if(!r)return t;const k=i.indexOf(r);return`${i.slice(0,k)}==${r}==${i.slice(k+r.length)}${o===-1?"":t.slice(o)}`}const pe=t=>t==="heading"?oe():t==="eyebrow"?ne():{};function ue(t,o,i,r){const a={...t._partStyles?.text??{},...o??{},...i??{}};return(r==="center"||r==="right")&&a.align===void 0&&(a.align=r),Object.keys(a).length?{_partStyles:{text:a}}:{}}function he(t,o){if(t===void 0)return{};if(typeof t=="string")return{variant:t};const i=o[t.key];return{variant:typeof i=="string"&&Object.hasOwn(t.map,i)?t.map[i]:t.fallback}}function D(t,o,i,r,k={}){const a={...o};for(const h of t){const[m,B,j]=typeof h=="string"?[h,h,void 0]:h;if(i[m]===void 0)continue;const _=j?j(i[m],i,k):i[m];_===void 0?delete a[B]:a[B]=_,r(m,B,_===void 0)}return a}function ye(t){const o=new Set([...Y,"headPlacement","_partStyles",...Object.keys(t.drop??{}),...Object.keys(t.reads??{})]),i=k=>{for(const a of k??[])o.add(typeof a=="string"?a:a[0])},r=k=>{for(const a of k)switch(a.kind){case"text":case"image":o.add(a.key),a.kind==="image"&&a.alt&&o.add(a.alt);break;case"button":o.add(a.key),o.add(a.href),typeof a.variant=="object"&&o.add(a.variant.key);break;case"list":o.add(a.key);break;case"group":case"block":i(a.box),r(a.parts??[]);break;case"core":if(a.keep!=="rest"&&a.keep.forEach(h=>o.add(h)),Object.keys(a.rename??{}).forEach(h=>o.add(h)),a.derive?.reads.forEach(h=>o.add(h)),typeof a.slots!="function")for(const h of Object.values(a.slots??{}))for(const m of h)"kind"in m&&o.add(m.key);break}};for(const k of[t,...t.also??[]])i(k.box),r(k.parts);return o}function q(t,o,i={}){const r=t.props,k=o.skip?.(r);if(k!==void 0)return{node:t,nodes:[t],carried:[],dropped:[],siteWrites:[],restyled:[],skipped:k};const a=String(r.id??t.type),h=[],m=[],B=[],j=new Set,_=(n,s)=>{h.push({key:n,home:s}),j.add(n)},X=r._partStyles??{},L=ye(o);let F=0;const $=(n,s)=>({type:n,props:{...s,id:`${a}~${n}-${++F}`}}),K=(n,s,b,y,x,d,w)=>{if(x){for(const c of n??[]){const p=typeof c=="string"?c:c[0];b[p]!==void 0&&w(p,`nothing — the ${y} has no parts, so it is not drawn`)}return}const e=typeof s=="function"?s(r,i):s??{};return D(n??[],e,b,(c,p,f)=>w(c,f?`nothing — the old value draws nothing (${y}: no ${p})`:`${d}${y}: ${p}`),i)},J=n=>ie(n,s=>`${a}~${s}-${++F}`),M=(n,s,b)=>{const y=n.of?n.of(s):Array.isArray(s[n.key])?s[n.key]:[],x=typeof n.props=="function"?n.props(r,i):n.props??{},d=y.map((f,g)=>{const l=f??{},u=n.item?.(l,g,r)??{},O=N(u.reverse?[...n.parts].reverse():n.parts,l,!1,`item ${g+1}: `);return n.flat?u.props?O.map(E=>({...E,props:{...E.props,...u.props,id:E.props.id}})):O:[$(P,{name:`${n.name} ${g+1}`,...x,...u.props??{},[v]:O})]});if(n.groups){const f=n.groups;return b(n.key,y.length?`one Box per item (${y.length}), in a Box per group`:"nothing — the list is empty"),re(y.map(g=>g??{}),f.of,f.of).map((g,l)=>{const u=g.items.map(S=>S.item),O=f.parts?N(f.parts,f.head?.(u,r)??{},!1,`group ${l+1}: `):[],E=g.items.map(S=>d[S.index]),z=f.perRow?.(u.length,r),I=Number.isInteger(z)&&z>=1?z:1,C=[];if(f.perRow&&I<E.length)for(let S=0;S*I<E.length;S++)C.push(E.slice(S*I,(S+1)*I).flat());return $(P,{name:`${f.name} ${l+1}`,...f.props??{},[v]:[...O,$(P,{name:`${f.itemsName} ${l+1}`,...f.itemsProps?.(u.length,r)??{},[v]:C.length?C.map((S,U)=>$(P,{name:`${f.rowName??`${f.itemsName} row`} ${U+1}`,...f.rowProps??{},[v]:S})):E.flat()})]})})}const w=n.perRow?.(r),e=n.perRow?Number.isInteger(w)&&w>=1?w:1:0;if(b(n.key,(y.length?n.flat?`each item's parts (${y.length} items), in order`:`one Box per item (${y.length}), its parts inside`:"nothing — the list is empty")+(e&&y.length?`, in rows of ${e}`:"")),!e)return d.flat();const c=typeof n.rowProps=="function"?n.rowProps(r,i):n.rowProps??{},p=[];for(let f=0;f*e<d.length;f++){const g=d.slice(f*e,(f+1)*e).flat(),l=n.rowFiller?e-d.slice(f*e,(f+1)*e).length:0;p.push($(P,{name:`${n.rowName??`${n.name} row`} ${f+1}`,...c,[v]:[...g,...Array.from({length:l},(u,O)=>$(P,{name:`Empty ${O+1}`,...n.rowFiller,[v]:[]}))]}))}return p},N=(n,s,b,y)=>{const x=[],d=(e,c)=>b?_(e,c):void 0,w=e=>b?X[e]:void 0;for(const e of n)if(!(e.when&&!e.when(r,b?void 0:s)))switch(e.kind){case"text":{const c=W(s[e.key]);if(!c.text.trim()){d(e.key,"nothing — empty words draw nothing, so no block");break}const p=pe(e.role??"body"),{_partStyles:f,...g}=p,l=ue(p,e.styleFrom?{...e.style,...e.styleFrom(r,i)}:e.style,w(e.key),e.props?.align);if(e.was&&b){const u=l._partStyles?.text??{};B.push({key:e.key,was:e.was,...typeof u.textStyle=="string"?{textStyle:u.textStyle}:{},...R(u.size)!==void 0?{size:R(u.size)}:{},...R(u.sizePhone)!==void 0?{sizePhone:R(u.sizePhone)}:{}})}x.push($("Text",{text:e.mark==="accentLead"?le(c.text):e.mark==="accentItalic"?de(c.text):c.text,...g,...e.props??{},...l,...c.hidden?{_hidden:!0}:{}})),d(e.key,`${y}Text block: its words${c.hidden?", hidden":""}`);break}case"button":{const c=W(s[e.key]);if(!c.text.trim()){d(e.key,"nothing — no words, no button"),d(e.href,"nothing — no button to link"),typeof e.variant=="object"&&d(e.variant.key,"nothing — no button to style");break}const p=typeof s[e.href]=="string"&&s[e.href]?s[e.href]:"#",f={...e.style??{},...w(e.key)??{}};x.push($("ButtonBlock",{label:c.text,href:p,...typeof e.props=="function"?e.props(s,i):e.props??{},...he(e.variant,s),...Object.keys(f).length?{_partStyles:{label:f}}:{},...c.hidden?{_hidden:!0}:{}})),d(e.key,`${y}Button block: its words`),d(e.href,`${y}Button block: its link`),typeof e.variant=="object"&&d(e.variant.key,`${y}Button block: its Style`);break}case"image":{const c=s[e.key];if(typeof c!="string"||!c){d(e.key,"nothing — no picture, no block"),e.alt&&d(e.alt,"nothing — no picture to describe");break}const p=e.alt&&typeof s[e.alt]=="string"?s[e.alt]:"";x.push($("ImageBlock",{src:c,alt:p,...e.props??{}})),d(e.key,`${y}Image block: its picture`),e.alt&&d(e.alt,`${y}Image block: its alt text`);break}case"list":{x.push(...M(e,s,d));break}case"group":{const c=N(e.parts,s,b,y),p=K(e.box,e.props,s,`${e.name} Box`,!c.length&&!e.keepEmpty,y,d);p&&x.push($(P,{name:e.name,...p,[v]:c}));break}case"block":{const c=e.parts?N(e.parts,s,b,y):[],p=K(e.box,e.props,s,`${e.type} block`,!!e.parts&&!c.length&&!e.keepEmpty,y,d);p&&x.push($(e.type,{...p,...e.slot?{[e.slot]:c}:{}}));break}case"core":{const c=e.as??t.type,p={headPlacement:"own-box",...e.props??{}},f=e.keep==="rest"?Object.keys(s).filter(l=>!L.has(l)&&!(l in p)):e.keep;for(const l of f)s[l]!==void 0&&(p[l]=s[l],d(l,`the ${c} block inside the Box`));if(e.keep==="rest"){for(const u of Object.keys(e.props??{}))s[u]!==void 0&&!L.has(u)&&d(u,`nothing — the ${c} block inside the Box has the row's own value`);s.headPlacement!==void 0&&d("headPlacement",`the ${c} block inside the Box: own-box`);const l=Object.fromEntries(Object.entries(X).filter(([u])=>!L.has(u)));Object.keys(l).length&&(p._partStyles=l)}for(const[l,u]of Object.entries(e.rename??{}))s[l]!==void 0&&(p[u]=s[l],d(l,`the ${c} block inside the Box: ${u}`));if(e.derive){Object.assign(p,e.derive.props(s,i));for(const l of e.derive.reads)s[l]!==void 0&&d(l,`the ${c} block inside the Box`)}const g=typeof e.slots=="function"?e.slots(s,i):e.slots??{};for(const[l,u]of Object.entries(g))p[l]=u.flatMap(O=>"kind"in O?M(O,s,d):J([O]));x.push($(c,p));break}}return x},Q=(n,s)=>{const b=s===0?"Box":`${n.name} Box`,y=N(n.parts,r,!0,s===0?"":`${b}: `),x=typeof n.boxProps=="function"?n.boxProps(r,i):n.boxProps??{},d=D(n.box??[],x,r,(w,e,c)=>_(w,c?`nothing — the old value draws nothing (${b}: no ${e})`:`${b}: ${e}`),i);return{type:P,props:{name:n.name,...d,[v]:y,id:ae(a,s)}}},G=[o,...o.also??[]].map(Q);r._partStyles!==void 0&&_("_partStyles","each old part's style moved to its new part");for(const[n,s]of Object.entries(o.reads??{}))r[n]!==void 0&&_(n,s);for(const[n,s]of Object.entries(o.drop??{}))n in r&&(m.push({key:n,why:s}),j.add(n));for(const n of Object.keys(r))Y.has(n)||j.has(n)||m.push({key:n,why:"not in the row — not carried"});return{node:G[0],nodes:G,carried:h,dropped:m,siteWrites:[...o.site?.(t,i)??[]],restyled:B}}function Ie(t,o=H,i={}){const r=t.content;if(!Array.isArray(r))return t;let k=!1;const a=r.flatMap(h=>{const m=h&&typeof h.type=="string"&&o.includes(h.type)?T[h.type]:void 0;if(!m)return[h];const B=q(h,m,i);return B.skipped!==void 0?[h]:(k=!0,B.nodes)});return k?{...t,content:a}:t}function Re(t,o=H,i={}){if(!Array.isArray(t))return[];const r=[];return t.forEach((k,a)=>{const h=k&&typeof k.type=="string"&&o.includes(k.type)?T[k.type]:void 0;if(!h)return;const m=q(k,h,i);m.skipped===void 0&&r.push({index:a,node:m.node,nodes:m.nodes})}),r}export{v as SECTION_BOX_SLOT,P as SECTION_BOX_TYPE,H as SECTION_TO_BOX_ON,ce as SECTION_TO_BOX_PRESS,Te as boxNativeReason,q as convertSection,Ie as convertSectionsInPage,Se as convertTheme,fe as convertsToBox,Ne as hasWords,je as headParts,ve as pressesAsBox,Be as registerBoxNativeSections,_e as registerSectionToBox,ae as sectionBoxIdOf,Re as sectionToBoxEdits,Ee as sectionToBoxRow,Pe as sectionToBoxTypes};
@@ -15,12 +15,14 @@ export interface SiteImageProps {
15
15
  export interface SiteRuntime {
16
16
  Link: ComponentType<SiteLinkProps>;
17
17
  Image: ComponentType<SiteImageProps>;
18
+ pagePath?: string | null;
18
19
  }
19
20
  export declare function SiteRuntimeProvider({ runtime, children }: {
20
21
  runtime: SiteRuntime;
21
22
  children: ReactNode;
22
23
  }): import("react").JSX.Element;
23
24
  export declare function useSiteRuntime(): SiteRuntime;
25
+ export declare function useCurrentPagePath(): string | null;
24
26
  export declare function SiteLink({ hrefRewrite, ...props }: SiteLinkProps & {
25
27
  hrefRewrite?: string;
26
28
  }): import("react").JSX.Element;
@@ -1 +1 @@
1
- "use client";import{jsx as i}from"react/jsx-runtime";import s from"next/image";import c from"next/link";import{Component as l,createContext as u,lazy as m,Suspense as h,useContext as d}from"react";import{linkHrefRewrite as k}from"../../format/lib/links/link-href-rewrites.js";import{isSafeLinkHref as p}from"../../format/lib/markup.js";import{nonEmptyString as x}from"../../format/lib/non-empty-string.js";const S={Link:c,Image:s},o=u(S);function E({runtime:t,children:e}){return i(o.Provider,{value:t,children:e})}function f(){return d(o)}function N({hrefRewrite:t,...e}){const{Link:r}=f(),n=k(t);return n?i(L,{name:n.name,href:e.href,fallback:i(r,{...e}),children:i(w,{Link:r,rewrite:n.rewrite,...e})},n.key):i(r,{...e})}function w({Link:t,rewrite:e,...r}){const n=x(e(r.href)),a=n&&p(n)?n:r.href;return i(t,{...r,href:a})}class L extends l{state={failed:!1,href:this.props.href};static getDerivedStateFromProps(e,r){return e.href===r.href?null:{failed:!1,href:e.href}}static getDerivedStateFromError(){return{failed:!0}}componentDidCatch(e){console.error(`The link href rewrite ${this.props.name} failed; the link goes where it was typed.`,e)}render(){return this.state.failed?this.props.fallback:this.props.children}}function b(t){const{Image:e}=f();return i(e,{...t})}function B(t){const e=m(t);return function(n){return i(h,{fallback:null,children:i(e,{...n})})}}export{b as SiteImage,N as SiteLink,E as SiteRuntimeProvider,B as lazyInBrowser,f as useSiteRuntime};
1
+ "use client";import{jsx as i}from"react/jsx-runtime";import s from"next/image";import u from"next/link";import{Component as l,createContext as c,lazy as m,Suspense as h,useContext as d}from"react";import{linkHrefRewrite as p}from"../../format/lib/links/link-href-rewrites.js";import{isSafeLinkHref as k}from"../../format/lib/markup.js";import{nonEmptyString as x}from"../../format/lib/non-empty-string.js";const g={Link:u,Image:s},a=c(g);function z({runtime:t,children:e}){return i(a.Provider,{value:t,children:e})}function o(){return d(a)}function E(){return o().pagePath??null}function N({hrefRewrite:t,...e}){const{Link:r}=o(),n=p(t);return n?i(w,{name:n.name,href:e.href,fallback:i(r,{...e}),children:i(S,{Link:r,rewrite:n.rewrite,...e})},n.key):i(r,{...e})}function S({Link:t,rewrite:e,...r}){const n=x(e(r.href)),f=n&&k(n)?n:r.href;return i(t,{...r,href:f})}class w extends l{state={failed:!1,href:this.props.href};static getDerivedStateFromProps(e,r){return e.href===r.href?null:{failed:!1,href:e.href}}static getDerivedStateFromError(){return{failed:!0}}componentDidCatch(e){console.error(`The link href rewrite ${this.props.name} failed; the link goes where it was typed.`,e)}render(){return this.state.failed?this.props.fallback:this.props.children}}function b(t){const{Image:e}=o();return i(e,{...t})}function B(t){const e=m(t);return function(n){return i(h,{fallback:null,children:i(e,{...n})})}}export{b as SiteImage,N as SiteLink,z as SiteRuntimeProvider,B as lazyInBrowser,E as useCurrentPagePath,o as useSiteRuntime};
package/package.json CHANGED
@@ -1,12 +1,12 @@
1
1
  {
2
2
  "name": "efficient-web-builder",
3
- "version": "49.1.0",
3
+ "version": "51.0.0",
4
4
  "description": "The EFFICIENT website builder: the website editor, the general sections and the renderer that draws them, compiled. Hostable by any EFFICIENT product; nothing here imports a host.",
5
5
  "license": "UNLICENSED",
6
6
  "author": "Efficient Pty Ltd",
7
7
  "repository": {
8
8
  "type": "git",
9
- "url": "git+https://github.com/Efficient-Pty-Ltd/efficient-web-builder.git"
9
+ "url": "git+https://github.com/eff-erp/efficient-web-builder.git"
10
10
  },
11
11
  "publishConfig": {
12
12
  "access": "public"
@@ -53,7 +53,7 @@
53
53
  },
54
54
  "peerDependencies": {
55
55
  "@tabler/icons-react": "^3.46.0",
56
- "efficient-easel": "^27.0.0",
56
+ "efficient-easel": "^27.3.0",
57
57
  "efficient-shell": "^11.8.0",
58
58
  "isomorphic-dompurify": "^3.18.0",
59
59
  "next": ">=16",
@@ -72,7 +72,7 @@
72
72
  "@types/node": "^20",
73
73
  "@types/react": "^19",
74
74
  "@types/react-dom": "^19",
75
- "efficient-easel": "^27.0.0",
75
+ "efficient-easel": "^27.3.0",
76
76
  "efficient-shell": "^11.8.0",
77
77
  "esbuild": "^0.28.0",
78
78
  "happy-dom": "^20.14.5",