efficient-web-builder 48.3.0 → 49.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (142) hide show
  1. package/CHANGELOG.md +41 -0
  2. package/dist/editor/components/PartSettingsPanel.js +1 -1
  3. package/dist/editor/components/PreviewPartAnchors.d.ts +2 -2
  4. package/dist/editor/components/PreviewPartAnchors.js +1 -1
  5. package/dist/editor/components/SectionTextPartBridge.d.ts +3 -1
  6. package/dist/editor/components/SectionTextPartBridge.js +1 -1
  7. package/dist/editor/components/WebsiteScreenParts.js +1 -1
  8. package/dist/editor/lib/animation/hover-fields.js +1 -1
  9. package/dist/editor/lib/document/add-target.d.ts +1 -1
  10. package/dist/editor/lib/document/add-target.js +1 -1
  11. package/dist/editor/lib/document/blocks/general/Flex/fields.js +1 -1
  12. package/dist/editor/lib/document/blocks/general/Hero/fields.js +1 -1
  13. package/dist/editor/lib/document/blocks/general/HeroGroup/fields.js +1 -1
  14. package/dist/editor/lib/document/card-display-chips.d.ts +2 -1
  15. package/dist/editor/lib/document/card-display-chips.js +1 -1
  16. package/dist/editor/lib/document/mirror-cards-field.d.ts +20 -0
  17. package/dist/editor/lib/document/mirror-cards-field.js +1 -0
  18. package/dist/editor/lib/sections/hero-ticker-to-strip.d.ts +7 -0
  19. package/dist/editor/lib/sections/hero-ticker-to-strip.js +1 -0
  20. package/dist/editor/lib/sections/section-dry-run.d.ts +5 -0
  21. package/dist/editor/lib/sections/section-dry-run.js +2 -2
  22. package/dist/format/lib/content/block-align.js +1 -1
  23. package/dist/format/lib/content/box-layout.d.ts +2 -0
  24. package/dist/format/lib/content/box-layout.js +1 -1
  25. package/dist/format/lib/content/box-separator.js +1 -1
  26. package/dist/format/lib/content/box-shape.js +1 -1
  27. package/dist/format/lib/content/button-icon.js +1 -1
  28. package/dist/format/lib/content/card-template.d.ts +2 -0
  29. package/dist/format/lib/content/card-template.js +1 -1
  30. package/dist/format/lib/content/container-gap.d.ts +1 -1
  31. package/dist/format/lib/content/container-gap.js +1 -1
  32. package/dist/format/lib/content/mirror-cards.d.ts +32 -0
  33. package/dist/format/lib/content/mirror-cards.js +1 -0
  34. package/dist/format/lib/content/page-width.d.ts +3 -3
  35. package/dist/format/lib/content/page-width.js +1 -1
  36. package/dist/format/lib/content/part-display.js +1 -1
  37. package/dist/format/lib/content/section-min-height.d.ts +1 -1
  38. package/dist/format/lib/content/section-min-height.js +1 -1
  39. package/dist/format/lib/content/view-lines.d.ts +11 -0
  40. package/dist/format/lib/content/view-lines.js +1 -0
  41. package/dist/format/lib/document/blocks/general/Hero/meta.d.ts +4 -0
  42. package/dist/format/lib/document/blocks/general/Hero/meta.js +1 -1
  43. package/dist/format/lib/editor-words-catalogue.d.ts +8 -0
  44. package/dist/format/lib/editor-words-catalogue.js +4 -4
  45. package/dist/format/lib/hero-ticker.d.ts +6 -0
  46. package/dist/format/lib/hero-ticker.js +1 -1
  47. package/dist/format/lib/sections/collection-card-text-regions.d.ts +1 -1
  48. package/dist/format/lib/sections/collection-card-text-regions.js +1 -1
  49. package/dist/format/lib/sections/faq-text-regions.js +1 -1
  50. package/dist/format/lib/sections/hero-single-to-hero.d.ts +1 -0
  51. package/dist/format/lib/sections/hero-single-to-hero.js +1 -1
  52. package/dist/format/lib/sections/section-text-regions.d.ts +1 -0
  53. package/dist/format/lib/sections/section-text-regions.js +1 -1
  54. package/dist/format/lib/sections/text-regions.d.ts +2 -0
  55. package/dist/format/lib/sections/text-regions.js +1 -1
  56. package/dist/format/lib/sections/ticker-style.js +1 -1
  57. package/dist/format/lib/source-rules/heading-ceiling-sweep.js +7 -7
  58. package/dist/format/lib/source-rules/view-breakpoint-names.d.ts +6 -0
  59. package/dist/format/lib/source-rules/view-breakpoint-names.js +4 -0
  60. package/dist/render/components/Banner.js +1 -1
  61. package/dist/render/components/Breadcrumb.js +1 -1
  62. package/dist/render/components/CardRowContext.d.ts +1 -0
  63. package/dist/render/components/CardRowContext.js +1 -1
  64. package/dist/render/components/Cards.js +1 -1
  65. package/dist/render/components/CategoryBar.js +1 -1
  66. package/dist/render/components/ChartSection.js +1 -1
  67. package/dist/render/components/ContactLocations.js +1 -1
  68. package/dist/render/components/DealerFinder.js +1 -1
  69. package/dist/render/components/Divider.js +1 -1
  70. package/dist/render/components/FAQ.js +1 -1
  71. package/dist/render/components/FeaturedCover.js +1 -1
  72. package/dist/render/components/Flex.d.ts +6 -1
  73. package/dist/render/components/Flex.js +1 -1
  74. package/dist/render/components/Footprint.js +1 -1
  75. package/dist/render/components/Heading.js +1 -1
  76. package/dist/render/components/HeroPictures.js +1 -1
  77. package/dist/render/components/HeroSection.d.ts +2 -1
  78. package/dist/render/components/HeroSection.js +1 -1
  79. package/dist/render/components/HeroSingle.js +1 -1
  80. package/dist/render/components/HeroSlide.d.ts +1 -0
  81. package/dist/render/components/HeroSlide.js +1 -1
  82. package/dist/render/components/IntegrationsSection.js +1 -1
  83. package/dist/render/components/IntroBleed.js +1 -1
  84. package/dist/render/components/KeyFeatures.js +1 -1
  85. package/dist/render/components/LocationMap.d.ts +1 -1
  86. package/dist/render/components/LocationMap.js +1 -1
  87. package/dist/render/components/LongRead.js +1 -1
  88. package/dist/render/components/Manifesto.js +1 -1
  89. package/dist/render/components/Masthead.js +1 -1
  90. package/dist/render/components/MirrorContext.d.ts +3 -0
  91. package/dist/render/components/MirrorContext.js +1 -0
  92. package/dist/render/components/MockupSection.js +1 -1
  93. package/dist/render/components/OrderSummary.js +1 -1
  94. package/dist/render/components/ParagraphsA.js +1 -1
  95. package/dist/render/components/PostCard.js +1 -1
  96. package/dist/render/components/ProcessSteps.js +1 -1
  97. package/dist/render/components/Prose.js +1 -1
  98. package/dist/render/components/Reel.js +1 -1
  99. package/dist/render/components/SectionEyebrow.js +1 -1
  100. package/dist/render/components/SectionHeader.d.ts +4 -4
  101. package/dist/render/components/SectionHeader.js +1 -1
  102. package/dist/render/components/Series.js +1 -1
  103. package/dist/render/components/SiteGutterFrame.d.ts +1 -0
  104. package/dist/render/components/SiteGutterFrame.js +1 -1
  105. package/dist/render/components/SpecStrip.js +1 -1
  106. package/dist/render/components/Split.js +1 -1
  107. package/dist/render/components/Stats.js +1 -1
  108. package/dist/render/components/StatsParagraph.js +1 -1
  109. package/dist/render/components/Testimonials.js +1 -1
  110. package/dist/render/components/Text.d.ts +2 -1
  111. package/dist/render/components/Text.js +1 -1
  112. package/dist/render/components/TextRegionRun.d.ts +7 -0
  113. package/dist/render/components/TextRegionRun.js +1 -0
  114. package/dist/render/components/Ticker.js +1 -1
  115. package/dist/render/components/TickerSection.js +1 -1
  116. package/dist/render/components/Timeline.js +1 -1
  117. package/dist/render/components/TimelineRail.d.ts +4 -4
  118. package/dist/render/components/TimelineRail.js +1 -1
  119. package/dist/render/components/TimelineTrack.js +1 -1
  120. package/dist/render/components/TitleWithButtons.js +1 -1
  121. package/dist/render/lib/animation/LoopTrack.d.ts +2 -2
  122. package/dist/render/lib/animation/LoopTrack.js +1 -1
  123. package/dist/render/lib/content/block-size.js +1 -1
  124. package/dist/render/lib/content/box-shared-columns.d.ts +31 -0
  125. package/dist/render/lib/content/box-shared-columns.js +1 -0
  126. package/dist/render/lib/content/section-edge.js +1 -1
  127. package/dist/render/lib/content/view-values.d.ts +2 -1
  128. package/dist/render/lib/content/view-values.js +1 -1
  129. package/dist/render/lib/document/blocks/general/Flex/render.js +1 -1
  130. package/dist/render/lib/document/blocks/general/Hero/render.js +1 -1
  131. package/dist/render/lib/document/blocks/general/LocationMap/render.js +1 -1
  132. package/dist/render/lib/document/blocks/general/SectionHeader/render.js +1 -1
  133. package/dist/render/lib/document/blocks/general/Text/render.js +1 -1
  134. package/dist/render/lib/document/editing-bridges.d.ts +2 -0
  135. package/dist/render/lib/document/part-styles.d.ts +26 -0
  136. package/dist/render/lib/document/part-styles.js +2 -2
  137. package/dist/render/lib/document/passes/section-width.d.ts +2 -2
  138. package/dist/render/lib/document/passes/section-width.js +1 -1
  139. package/dist/render/lib/document/slot-specs.d.ts +3 -0
  140. package/dist/render/lib/document/slot-specs.js +1 -1
  141. package/dist/render/lib/sections/section-to-box.js +1 -1
  142. package/package.json +1 -1
@@ -1,6 +1,9 @@
1
1
  import { type TreeItem } from "efficient-easel/draw";
2
2
  import type { NodeDefaults, SlotSectionSpec } from "efficient-easel/screen/lib/document/slot-section-spec";
3
3
  export declare const SLOT_SECTION_SPECS: Record<string, SlotSectionSpec>;
4
+ export declare const HERO_STRIP_CAP = 1;
5
+ export declare const HERO_STRIP_SPEC: SlotSectionSpec;
6
+ export declare const SLOT_SECTION_EXTRA_SPECS: Record<string, Record<string, SlotSectionSpec>>;
4
7
  export declare function registerSlotSectionSpecs(specs: Record<string, SlotSectionSpec>): void;
5
8
  export declare function buildSlotSeedChildren(type: string, defaultsFor?: NodeDefaults): {
6
9
  slot: string;
@@ -1 +1 @@
1
- import{HERO_SLIDE_SEEDS as a}from"../../components/HeroSlide.js";import{heroGroupAddBlocked as l,heroGroupOverCapNotice as c}from"../../../format/lib/hero-group-placement.js";import{newNodeId as p}from"efficient-easel/draw";import{BOX_TYPE as t,CONTAINER_BLOCKS_SLOT as n}from"../../../format/lib/document/container-blocks.js";import{BOX_LABEL as i}from"../../../format/lib/document/section-catalog.js";import{headingTextSeed as m}from"../../../format/lib/document/text-seeds.js";const T="ImageBlock",E=3,d=(e,r,o={})=>({type:e,props:{...r?.(e)??{},id:p(e),...o}}),h=e=>({...e?.(t)??{},direction:"column",[n]:[d(T,e),d(t,e,{direction:"column",[n]:[d("Text",e,m()),d("Text",e)]})]}),s={Hero:{slot:"slides",childType:"HeroSlide",addLabel:"Add slide",slider:!0,seeds:()=>a.map(e=>({...e}))},HeroSlide:{slot:"groups",childType:"HeroGroup",addLabel:`Add ${i.toLowerCase()}`,seeds:()=>[],addBlocked:l,notice:c},HeroSingle:{slot:"boxes",childType:"HeroGroup",addLabel:`Add ${i.toLowerCase()}`,seeds:()=>[],addBlocked:l,notice:c},ProcessSteps:{slot:"boxes",childType:t,addLabel:`Add ${i.toLowerCase()}`,seeds:e=>Array.from({length:E},()=>h(e)),skipSeed:e=>Array.isArray(e.steps)&&e.steps.length>0}};function b(e){for(const[r,o]of Object.entries(e)){if(r in s&&s[r]!==o)throw new Error(`lib/document/slot-specs: "${r}" already has a slot spec`);s[r]=o}}function y(e,r){const o=s[e];return o?{slot:o.slot,children:o.seeds(r).map(S=>({type:o.childType,props:{id:p(o.childType),...S}}))}:null}export{s as SLOT_SECTION_SPECS,y as buildSlotSeedChildren,b as registerSlotSectionSpecs};
1
+ import{HERO_SLIDE_SEEDS as h}from"../../components/HeroSlide.js";import{heroGroupAddBlocked as i,heroGroupOverCapNotice as n}from"../../../format/lib/hero-group-placement.js";import{newNodeId as c}from"efficient-easel/draw";import{BOX_TYPE as t,CONTAINER_BLOCKS_SLOT as p}from"../../../format/lib/document/container-blocks.js";import{BOX_LABEL as d}from"../../../format/lib/document/section-catalog.js";import{headingTextSeed as E}from"../../../format/lib/document/text-seeds.js";import{HERO_STRIP_SLOT as S}from"../../../format/lib/hero-ticker.js";const m="ImageBlock",_=3,s=(e,r,o={})=>({type:e,props:{...r?.(e)??{},id:c(e),...o}}),O=e=>({...e?.(t)??{},direction:"column",[p]:[s(m,e),s(t,e,{direction:"column",[p]:[s("Text",e,E()),s("Text",e)]})]}),l={Hero:{slot:"slides",childType:"HeroSlide",addLabel:"Add slide",slider:!0,seeds:()=>h.map(e=>({...e}))},HeroSlide:{slot:"groups",childType:"HeroGroup",addLabel:`Add ${d.toLowerCase()}`,seeds:()=>[],addBlocked:i,notice:n},HeroSingle:{slot:"boxes",childType:"HeroGroup",addLabel:`Add ${d.toLowerCase()}`,seeds:()=>[],addBlocked:i,notice:n},ProcessSteps:{slot:"boxes",childType:t,addLabel:`Add ${d.toLowerCase()}`,seeds:e=>Array.from({length:_},()=>O(e)),skipSeed:e=>Array.isArray(e.steps)&&e.steps.length>0}},a=1,C={slot:S,childType:t,addLabel:`Add ${d.toLowerCase()}`,seeds:()=>[],addBlocked:e=>e.length>=a?"This Hero has its Scrolling Bar already. Delete it to add another.":null,notice:e=>e.length>a?`This Hero holds ${e.length} Scrolling Bars. Keep one and delete the others.`:null},B={Hero:{[S]:C}};function P(e){for(const[r,o]of Object.entries(e)){if(r in l&&l[r]!==o)throw new Error(`lib/document/slot-specs: "${r}" already has a slot spec`);l[r]=o}}function b(e,r){const o=l[e];return o?{slot:o.slot,children:o.seeds(r).map(T=>({type:o.childType,props:{id:c(o.childType),...T}}))}:null}export{a as HERO_STRIP_CAP,C as HERO_STRIP_SPEC,B as SLOT_SECTION_EXTRA_SPECS,l as SLOT_SECTION_SPECS,b as buildSlotSeedChildren,P as registerSlotSectionSpecs};
@@ -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)",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{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};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "efficient-web-builder",
3
- "version": "48.3.0",
3
+ "version": "49.1.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",