efficient-web-builder 65.0.0 → 67.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 (241) hide show
  1. package/CHANGELOG.md +82 -0
  2. package/dist/editor/components/AnchorField.js +1 -1
  3. package/dist/editor/components/CardShadowField.js +1 -1
  4. package/dist/editor/components/MediaUploadField.js +1 -1
  5. package/dist/editor/components/PagesPanel.js +1 -1
  6. package/dist/editor/components/PartSettingsPanel.js +1 -1
  7. package/dist/editor/components/PartTextBox.js +1 -1
  8. package/dist/editor/components/PreviewPartAnchors.js +1 -1
  9. package/dist/editor/components/SectionEditor.js +1 -1
  10. package/dist/editor/components/SectionWidthRows.d.ts +3 -1
  11. package/dist/editor/components/SectionWidthRows.js +1 -1
  12. package/dist/editor/components/SiteTextStylesField.js +1 -1
  13. package/dist/editor/components/WebsitePreviewButton.js +1 -1
  14. package/dist/editor/components/storefront-editor.css +16 -24
  15. package/dist/editor/components/usePreviewHref.js +1 -1
  16. package/dist/editor/lib/animation/hover-fields.d.ts +1 -1
  17. package/dist/editor/lib/animation/hover-fields.js +1 -1
  18. package/dist/editor/lib/document/blocks/general/Banner/fields.js +1 -1
  19. package/dist/editor/lib/document/blocks/general/ButtonBlock/fields.js +1 -1
  20. package/dist/editor/lib/document/blocks/general/Divider/fields.js +1 -1
  21. package/dist/editor/lib/document/blocks/general/Flex/fields.js +1 -1
  22. package/dist/editor/lib/document/blocks/general/Footprint/fields.d.ts +0 -1
  23. package/dist/editor/lib/document/blocks/general/Footprint/fields.js +1 -1
  24. package/dist/editor/lib/document/blocks/general/HeroGroup/fields.js +1 -1
  25. package/dist/editor/lib/document/blocks/general/ImageBlock/fields.js +1 -1
  26. package/dist/editor/lib/document/blocks/general/IntroBleed/fields.js +1 -1
  27. package/dist/editor/lib/document/blocks/general/LogoBlock/fields.js +1 -1
  28. package/dist/editor/lib/document/blocks/general/PostCard/fields.js +1 -1
  29. package/dist/editor/lib/document/blocks/general/ProcessSteps/fields.js +1 -1
  30. package/dist/editor/lib/document/blocks/general/SectionHeader/fields.js +1 -1
  31. package/dist/editor/lib/document/blocks/general/Text/fields.js +1 -1
  32. package/dist/editor/lib/document/blocks/general/index.d.ts +2 -2
  33. package/dist/editor/lib/document/blocks/hero-shared-fields.js +1 -1
  34. package/dist/editor/lib/document/box-fields.d.ts +2 -1
  35. package/dist/editor/lib/document/box-fields.js +1 -1
  36. package/dist/editor/lib/document/card-row-fields.d.ts +3 -0
  37. package/dist/editor/lib/document/card-row-fields.js +1 -1
  38. package/dist/editor/lib/document/controls.d.ts +31 -12
  39. package/dist/editor/lib/document/controls.js +1 -1
  40. package/dist/editor/lib/document/field-groups.d.ts +0 -3
  41. package/dist/editor/lib/document/field-groups.js +1 -1
  42. package/dist/editor/lib/document/passes/inspector.js +1 -1
  43. package/dist/editor/lib/document/section-own-width-fields.js +1 -1
  44. package/dist/editor/lib/sections/section-dry-run.d.ts +1 -20
  45. package/dist/editor/lib/sections/section-dry-run.js +2 -2
  46. package/dist/editor/lib/sections/text-layouts.js +1 -1
  47. package/dist/format/lib/animation/views.js +1 -1
  48. package/dist/format/lib/content/block-sources.d.ts +3 -0
  49. package/dist/format/lib/content/block-sources.js +1 -1
  50. package/dist/format/lib/content/borders.d.ts +12 -2
  51. package/dist/format/lib/content/borders.js +1 -1
  52. package/dist/format/lib/content/box-background.d.ts +1 -0
  53. package/dist/format/lib/content/box-background.js +1 -1
  54. package/dist/format/lib/content/box-link.d.ts +11 -0
  55. package/dist/format/lib/content/box-link.js +8 -8
  56. package/dist/format/lib/content/box-phone-place.d.ts +0 -2
  57. package/dist/format/lib/content/box-phone-place.js +1 -1
  58. package/dist/format/lib/content/box-side-space.js +1 -1
  59. package/dist/format/lib/content/card-corners.d.ts +3 -1
  60. package/dist/format/lib/content/card-corners.js +1 -1
  61. package/dist/format/lib/content/card-image-shape.d.ts +5 -1
  62. package/dist/format/lib/content/card-image-shape.js +1 -1
  63. package/dist/format/lib/content/card-template.d.ts +1 -0
  64. package/dist/format/lib/content/card-template.js +1 -1
  65. package/dist/format/lib/content/contact.d.ts +0 -1
  66. package/dist/format/lib/content/contact.js +2 -2
  67. package/dist/format/lib/content/css-length.d.ts +7 -0
  68. package/dist/format/lib/content/css-length.js +1 -0
  69. package/dist/format/lib/content/image-corners.d.ts +3 -1
  70. package/dist/format/lib/content/image-corners.js +1 -1
  71. package/dist/format/lib/content/page-width.d.ts +17 -1
  72. package/dist/format/lib/content/page-width.js +1 -1
  73. package/dist/format/lib/content/section-corners.d.ts +3 -1
  74. package/dist/format/lib/content/section-corners.js +1 -1
  75. package/dist/format/lib/content/section-sticky.d.ts +5 -0
  76. package/dist/format/lib/content/section-sticky.js +1 -1
  77. package/dist/format/lib/content/section-type-size.d.ts +12 -1
  78. package/dist/format/lib/content/section-type-size.js +1 -1
  79. package/dist/format/lib/content/section-width.d.ts +8 -0
  80. package/dist/format/lib/content/section-width.js +1 -1
  81. package/dist/format/lib/content/view-tier.d.ts +10 -0
  82. package/dist/format/lib/content/view-tier.js +1 -0
  83. package/dist/format/lib/document/blocks/general/Banner/meta.d.ts +5 -0
  84. package/dist/format/lib/document/blocks/general/Banner/meta.js +1 -1
  85. package/dist/format/lib/document/blocks/general/Footprint/card-seed.d.ts +2 -0
  86. package/dist/format/lib/document/blocks/general/Footprint/card-seed.js +1 -1
  87. package/dist/format/lib/document/blocks/general/Footprint/meta.js +2 -2
  88. package/dist/format/lib/document/blocks/general/ProcessSteps/column-seed.d.ts +5 -0
  89. package/dist/format/lib/document/blocks/general/ProcessSteps/column-seed.js +1 -0
  90. package/dist/format/lib/document/blocks/general/ProcessSteps/meta.js +1 -1
  91. package/dist/format/lib/document/blocks/general/SectionHeader/meta.d.ts +6 -0
  92. package/dist/format/lib/document/blocks/general/SectionHeader/meta.js +1 -1
  93. package/dist/format/lib/document/blocks/general/TitleWithButtons/meta.d.ts +2 -0
  94. package/dist/format/lib/document/blocks/general/TitleWithButtons/meta.js +2 -2
  95. package/dist/format/lib/document/media-drop.js +1 -1
  96. package/dist/format/lib/document/one-h1.d.ts +2 -0
  97. package/dist/format/lib/document/one-h1.js +1 -1
  98. package/dist/format/lib/document/passes/types.d.ts +1 -0
  99. package/dist/format/lib/document/renamed-props.d.ts +1 -0
  100. package/dist/format/lib/document/renamed-props.js +1 -1
  101. package/dist/format/lib/document/section-catalog.js +10 -2
  102. package/dist/format/lib/document/section-descriptions.js +1 -1
  103. package/dist/format/lib/editor-words-catalogue.d.ts +10 -0
  104. package/dist/format/lib/editor-words-catalogue.js +3 -3
  105. package/dist/format/lib/editor-words-kept.js +1 -1
  106. package/dist/format/lib/fit-words.js +4 -1
  107. package/dist/format/lib/links/page-link-rules.d.ts +0 -1
  108. package/dist/format/lib/links/page-link-rules.js +1 -1
  109. package/dist/format/lib/markup.d.ts +1 -0
  110. package/dist/format/lib/markup.js +2 -2
  111. package/dist/format/lib/post-card-layout.d.ts +3 -0
  112. package/dist/format/lib/post-card-layout.js +1 -1
  113. package/dist/format/lib/sections/divider-style.d.ts +9 -0
  114. package/dist/format/lib/sections/divider-style.js +1 -1
  115. package/dist/format/lib/sections/hero-single-to-hero.js +1 -1
  116. package/dist/format/lib/sections/section-presets.js +1 -1
  117. package/dist/format/lib/sections/timeline-year-shape.js +1 -1
  118. package/dist/format/lib/source-rules/editor-words.js +1 -1
  119. package/dist/format/lib/source-rules/one-length-control.d.ts +18 -0
  120. package/dist/format/lib/source-rules/one-length-control.js +16 -0
  121. package/dist/format/lib/source-rules/support/label-extraction.js +3 -3
  122. package/dist/format/lib/theme.d.ts +1 -2
  123. package/dist/format/lib/theme.js +4 -4
  124. package/dist/format/lib/web-runtime.d.ts +2 -0
  125. package/dist/format/lib/web-runtime.js +1 -1
  126. package/dist/render/components/BlockFrame.d.ts +3 -3
  127. package/dist/render/components/BlockFrame.js +1 -1
  128. package/dist/render/components/Breadcrumb.js +1 -1
  129. package/dist/render/components/Btn.js +1 -1
  130. package/dist/render/components/CardRowContext.d.ts +7 -1
  131. package/dist/render/components/CardRowContext.js +1 -1
  132. package/dist/render/components/CategoryBar.js +1 -1
  133. package/dist/render/components/ContactLocations.js +2 -2
  134. package/dist/render/components/DealerFinder.d.ts +4 -1
  135. package/dist/render/components/DealerFinder.js +1 -1
  136. package/dist/render/components/Divider.d.ts +3 -1
  137. package/dist/render/components/Divider.js +1 -1
  138. package/dist/render/components/DocMasthead.js +1 -1
  139. package/dist/render/components/DocTabs.js +1 -1
  140. package/dist/render/components/FeaturedCover.js +1 -1
  141. package/dist/render/components/Flex.d.ts +3 -1
  142. package/dist/render/components/Flex.js +1 -1
  143. package/dist/render/components/Footprint.d.ts +5 -3
  144. package/dist/render/components/Footprint.js +1 -1
  145. package/dist/render/components/Heading.d.ts +0 -1
  146. package/dist/render/components/Heading.js +1 -1
  147. package/dist/render/components/HeroGroup.d.ts +3 -1
  148. package/dist/render/components/HeroGroup.js +1 -1
  149. package/dist/render/components/ImageBlock.d.ts +2 -1
  150. package/dist/render/components/ImageBlock.js +1 -1
  151. package/dist/render/components/IntroBleed.d.ts +3 -2
  152. package/dist/render/components/IntroBleed.js +1 -1
  153. package/dist/render/components/KeyFeatures.js +1 -1
  154. package/dist/render/components/LocationMap.js +1 -1
  155. package/dist/render/components/LogoBlock.js +1 -1
  156. package/dist/render/components/Logos.d.ts +1 -2
  157. package/dist/render/components/Logos.js +1 -1
  158. package/dist/render/components/LongRead.js +1 -1
  159. package/dist/render/components/PictureHoverMove.d.ts +18 -0
  160. package/dist/render/components/PictureHoverMove.js +1 -0
  161. package/dist/render/components/PictureWash.d.ts +2 -1
  162. package/dist/render/components/PictureWash.js +1 -1
  163. package/dist/render/components/PostCard.js +1 -1
  164. package/dist/render/components/ProcessSteps.d.ts +2 -1
  165. package/dist/render/components/ProcessSteps.js +1 -1
  166. package/dist/render/components/SectionHeader.js +1 -1
  167. package/dist/render/components/SideListLayout.d.ts +4 -1
  168. package/dist/render/components/SideListLayout.js +1 -1
  169. package/dist/render/components/Split.js +1 -1
  170. package/dist/render/components/Text.d.ts +2 -1
  171. package/dist/render/components/Text.js +1 -1
  172. package/dist/render/components/Timeline.js +1 -1
  173. package/dist/render/components/TimelineRail.d.ts +11 -3
  174. package/dist/render/components/TimelineRail.js +1 -1
  175. package/dist/render/components/TimelineTrack.js +1 -1
  176. package/dist/render/components/TitleWithButtons.js +1 -1
  177. package/dist/render/components/goldPhrases.js +3 -3
  178. package/dist/render/lib/content/block-size.d.ts +5 -1
  179. package/dist/render/lib/content/block-size.js +1 -1
  180. package/dist/render/lib/content/box-stack-line.d.ts +1 -1
  181. package/dist/render/lib/content/box-stack-line.js +1 -1
  182. package/dist/render/lib/content/button-look.d.ts +2 -0
  183. package/dist/render/lib/content/button-look.js +1 -1
  184. package/dist/render/lib/content/section-edge.js +1 -1
  185. package/dist/render/lib/content/section-padding.d.ts +5 -2
  186. package/dist/render/lib/content/section-padding.js +1 -1
  187. package/dist/render/lib/dealer-source.d.ts +6 -2
  188. package/dist/render/lib/dealer-source.js +1 -1
  189. package/dist/render/lib/document/blocks/general/Banner/render.js +1 -1
  190. package/dist/render/lib/document/blocks/general/CardList/render.js +1 -1
  191. package/dist/render/lib/document/blocks/general/Divider/render.js +1 -1
  192. package/dist/render/lib/document/blocks/general/Flex/render.js +1 -1
  193. package/dist/render/lib/document/blocks/general/Footprint/render.js +1 -1
  194. package/dist/render/lib/document/blocks/general/HeroGroup/render.js +1 -1
  195. package/dist/render/lib/document/blocks/general/ImageBlock/render.js +1 -1
  196. package/dist/render/lib/document/blocks/general/IntroBleed/render.js +1 -1
  197. package/dist/render/lib/document/blocks/general/SectionHeader/render.js +1 -1
  198. package/dist/render/lib/document/blocks/general/Text/render.js +1 -1
  199. package/dist/render/lib/document/blocks/general/TitleWithButtons/render.js +1 -1
  200. package/dist/render/lib/document/blocks/general/section-head-looks.d.ts +2 -0
  201. package/dist/render/lib/document/blocks/general/section-head-looks.js +2 -2
  202. package/dist/render/lib/document/blocks/general/section-to-box-row-parts.js +1 -1
  203. package/dist/render/lib/document/blocks/general/section-to-box-rows-cards.js +1 -1
  204. package/dist/render/lib/document/blocks/general/section-to-box-rows-editorial.js +1 -1
  205. package/dist/render/lib/document/blocks/general/section-to-box-rows-head.d.ts +2 -2
  206. package/dist/render/lib/document/blocks/general/section-to-box-rows-head.js +1 -1
  207. package/dist/render/lib/document/blocks/general/section-to-box-rows-locations.js +1 -1
  208. package/dist/render/lib/document/blocks/general/section-to-box-rows-pageheader.js +1 -1
  209. package/dist/render/lib/document/blocks/general/section-to-box-rows-stats.js +1 -1
  210. package/dist/render/lib/document/blocks/general/section-to-box-rows-tabbar.d.ts +3 -0
  211. package/dist/render/lib/document/blocks/general/section-to-box-rows-tabbar.js +1 -0
  212. package/dist/render/lib/document/blocks/general/section-to-box-rows-timeline.js +2 -2
  213. package/dist/render/lib/document/blocks/general/section-to-box-rows.d.ts +3 -0
  214. package/dist/render/lib/document/blocks/general/section-to-box-rows.js +1 -1
  215. package/dist/render/lib/document/card-press-titles.d.ts +10 -0
  216. package/dist/render/lib/document/card-press-titles.js +1 -0
  217. package/dist/render/lib/document/part-styles.d.ts +13 -0
  218. package/dist/render/lib/document/part-styles.js +2 -2
  219. package/dist/render/lib/document/passes/borders.js +1 -1
  220. package/dist/render/lib/document/passes/corners.js +1 -1
  221. package/dist/render/lib/document/passes/section-height.js +1 -1
  222. package/dist/render/lib/document/passes/section-padding.js +1 -1
  223. package/dist/render/lib/document/passes/section-width.js +1 -1
  224. package/dist/render/lib/document/published-passes.js +1 -1
  225. package/dist/render/lib/document/slot-specs.js +1 -1
  226. package/dist/render/lib/sections/section-to-box.d.ts +0 -15
  227. package/dist/render/lib/sections/section-to-box.js +1 -1
  228. package/dist/render/lib/site-runtime.d.ts +4 -1
  229. package/dist/render/lib/site-runtime.js +1 -1
  230. package/dist/render/lib/text-styles/site-text-styles.js +2 -2
  231. package/package.json +5 -5
  232. package/dist/editor/components/TemplateFieldRow.d.ts +0 -11
  233. package/dist/editor/components/TemplateFieldRow.js +0 -1
  234. package/dist/editor/lib/document/panel-heading-scope.d.ts +0 -8
  235. package/dist/editor/lib/document/panel-heading-scope.js +0 -1
  236. package/dist/editor/lib/document/template-field.d.ts +0 -13
  237. package/dist/editor/lib/document/template-field.js +0 -1
  238. package/dist/format/lib/canvas-accent.d.ts +0 -1
  239. package/dist/format/lib/canvas-accent.js +0 -1
  240. package/dist/format/lib/source-rules/padding-units-declared.d.ts +0 -2
  241. package/dist/format/lib/source-rules/padding-units-declared.js +0 -6
@@ -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,parseSectionHeadPlacement as ie}from"../../../format/lib/sections/section-head-placement.js";import{finiteNumber as R}from"../../../format/lib/finite-number.js";import{accentItalicRuns as re}from"../../../format/lib/markup.js";import{seedNodes as ae}from"../../../format/lib/document/seed-parts.js";import{bucketByGroup as ce}from"../../../format/lib/locations-grid.js";import{normalizeTheme as G}from"../../../format/lib/theme.js";const _=ee,E=te;function Ie(t){if(t.theme)return G(t.theme);const o=t.site?.themePresets;return o?G({selected:t.site?.selectedPreset??0,themes:[...o]}):void 0}function fe(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 Ne(t){for(const[o,s]of Object.entries(t)){if(o in A&&A[o]!==s)throw new Error(`lib/sections/section-to-box: "${o}" is already Box-native`);A[o]=s}}function Re(t){return A[t]}const Y=new Set(["id"]),T={},F=[],de=["ProductGrid","Events","ContactRouting","ReviewForm","AppointmentBooking","Reviews","CheckoutCTA"],le=["Breadcrumb","DocBody","Form","SubmitBuild","Footprint","FAQ",...de,"Stats","Logos","PaymentBadges","PaymentLogosBlock","FitmentFinder","DocMasthead","Timeline","TimelineTrack","OrderSummary","Chart","Mockup","Countdown","FeaturedCover","Cards"];function Ae(t){for(const[o,s]of Object.entries(t)){if(o in T&&T[o]!==s)throw new Error(`lib/sections/section-to-box: "${o}" already has a row`);T[o]=s}}function Ce(t){return T[t]}function He(){return Object.keys(T)}function pe(t){return t in T&&F.includes(t)}function Le(t,o=le){return t in T&&(o.includes(t)||pe(t))}function Fe(t){const o=se[t];if(!o)throw new Error(`lib/sections/section-to-box: "${t}" has no head row in SPLITTABLE_SECTIONS`);const s=[{kind:"text",key:o.num,role:"eyebrow"},{kind:"text",key:o.title,role:"heading"}];return o.description&&s.push({kind:"text",key:o.description,role:"body"}),o.headRows.includes("linkText")&&o.headRows.includes("linkHref")&&s.push({kind:"button",key:"linkText",href:"linkHref"}),s}const z=t=>Z(t),ze=t=>z(t).text.trim()!=="";function ue(t){if(t.includes("=="))return t;const o=t.indexOf("/"),s=o===-1?t:t.slice(0,o),i=s.trim();if(!i)return t;const c=s.indexOf(i);return`${s.slice(0,c)}==${i}==${s.slice(c+i.length)}${o===-1?"":t.slice(o)}`}const he=t=>t==="heading"?oe():t==="eyebrow"?ne():{};function ye(t,o,s,i){const a={...t._partStyles?.text??{},...o??{},...s??{}};return(i==="center"||i==="right")&&a.align===void 0&&(a.align=i),Object.keys(a).length?{_partStyles:{text:a}}:{}}function me(t,o){if(t===void 0)return{};if(typeof t=="string")return{variant:t};const s=o[t.key];return{variant:typeof s=="string"&&Object.hasOwn(t.map,s)?t.map[s]:t.fallback}}function V(t,o,s,i,c={}){const a={...o};for(const u of t){const[k,O,j]=typeof u=="string"?[u,u,void 0]:u;if(s[k]===void 0)continue;const P=j?j(s[k],s,c):s[k];P===void 0?delete a[O]:a[O]=P,i(k,O,P===void 0)}return a}function ke(t){const o=new Set([...Y,"headPlacement","_partStyles",...Object.keys(t.drop??{}),...Object.keys(t.reads??{})]),s=c=>{for(const a of c??[])o.add(typeof a=="string"?a:a[0])},i=c=>{for(const a of c)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":s(a.box),i(a.parts??[]);break;case"core":if(a.keep!=="rest"&&a.keep.forEach(u=>o.add(u)),Object.keys(a.rename??{}).forEach(u=>o.add(u)),a.derive?.reads.forEach(u=>o.add(u)),typeof a.slots!="function")for(const u of Object.values(a.slots??{}))for(const k of u)"kind"in k&&o.add(k.key);break}};for(const c of[t,...t.also??[]])s(c.box),i(c.parts);return o}const be=t=>ie(t.headPlacement)==="own-box";function xe(t){return be(t)?"its head sits in a Box of its own above it (own-box): the row draws the head inline":void 0}function ge(t,o){const s=t[o];return Array.isArray(s)&&s.some(c=>!!c&&typeof c=="object"&&typeof c.type=="string")?"already on the Box path: its items draw from a filled card template":void 0}function we(t){const o=new Set,s=i=>{for(const c of i)if(c.kind==="group"||c.kind==="block")s(c.parts??[]);else if(c.kind==="core"&&c.slots&&typeof c.slots!="function")for(const[a,u]of Object.entries(c.slots))u.length>0&&u.every(k=>!("kind"in k))&&o.add(a)};for(const i of[t,...t.also??[]])s(i.parts);return[...o]}function $e(t,o,s){if(!s.press)for(const i of we(t)){const c=ge(o,i);if(c!==void 0)return c}}function Q(t,o,s={}){const i=t.props,c=(o.ownBoxConverts?void 0:xe(i))??$e(o,i,s)??o.skip?.(i);if(c!==void 0)return{node:t,nodes:[t],carried:[],dropped:[],siteWrites:[],restyled:[],skipped:c};const a=String(i.id??t.type),u=[],k=[],O=[],j=new Set,P=(n,r)=>{u.push({key:n,home:r}),j.add(n)},M=i._partStyles??{},C=ke(o);let X=0;const w=(n,r)=>({type:n,props:{...r,id:`${a}~${n}-${++X}`}}),K=(n,r,b,m,x,l,$)=>{if(x){for(const f of n??[]){const h=typeof f=="string"?f:f[0];b[h]!==void 0&&$(h,`nothing — the ${m} has no parts, so it is not drawn`)}return}const e=typeof r=="function"?r(i,s):r??{};return V(n??[],e,b,(f,h,d)=>$(f,d?`nothing — the old value draws nothing (${m}: no ${h})`:`${l}${m}: ${h}`),s)},q=n=>ae(n,r=>`${a}~${r}-${++X}`),W=(n,r,b)=>{const m=n.of?n.of(r):Array.isArray(r[n.key])?r[n.key]:[],x=typeof n.props=="function"?n.props(i,s):n.props??{},l=m.map((d,g)=>{const p=d??{},y=n.item?.(p,g,i)??{},S=I(y.reverse?[...n.parts].reverse():n.parts,p,!1,`item ${g+1}: `);return n.flat?y.props?S.map(v=>({...v,props:{...v.props,...y.props,id:v.props.id}})):S:[w(_,{name:`${n.name} ${g+1}`,...x,...y.props??{},[E]:S})]});if(n.groups){const d=n.groups;return b(n.key,m.length?`one Box per item (${m.length}), in a Box per group`:"nothing — the list is empty"),ce(m.map(g=>g??{}),d.of,d.of).map((g,p)=>{const y=g.items.map(B=>B.item),S=d.parts?I(d.parts,d.head?.(y,i)??{},!1,`group ${p+1}: `):[],v=g.items.map(B=>l[B.index]),H=d.perRow?.(y.length,i),N=Number.isInteger(H)&&H>=1?H:1,L=[];if(d.perRow&&N<v.length)for(let B=0;B*N<v.length;B++)L.push(v.slice(B*N,(B+1)*N).flat());return w(_,{name:`${d.name} ${p+1}`,...d.props??{},[E]:[...S,w(_,{name:`${d.itemsName} ${p+1}`,...d.itemsProps?.(y.length,i)??{},[E]:L.length?L.map((B,U)=>w(_,{name:`${d.rowName??`${d.itemsName} row`} ${U+1}`,...d.rowProps??{},[E]:B})):v.flat()})]})})}const $=n.perRow?.(i),e=n.perRow?Number.isInteger($)&&$>=1?$:1:0;if(b(n.key,(m.length?n.flat?`each item's parts (${m.length} items), in order`:`one Box per item (${m.length}), its parts inside`:"nothing — the list is empty")+(e&&m.length?`, in rows of ${e}`:"")),!e)return l.flat();const f=typeof n.rowProps=="function"?n.rowProps(i,s):n.rowProps??{},h=[];for(let d=0;d*e<l.length;d++){const g=l.slice(d*e,(d+1)*e).flat(),p=n.rowFiller?e-l.slice(d*e,(d+1)*e).length:0;h.push(w(_,{name:`${n.rowName??`${n.name} row`} ${d+1}`,...f,[E]:[...g,...Array.from({length:p},(y,S)=>w(_,{name:`Empty ${S+1}`,...n.rowFiller,[E]:[]}))]}))}return h},I=(n,r,b,m)=>{const x=[],l=(e,f)=>b?P(e,f):void 0,$=e=>b?M[e]:void 0;for(const e of n)if(!(e.when&&!e.when(i,b?void 0:r)))switch(e.kind){case"text":{const f=z(r[e.key]);if(!f.text.trim()&&!(b&&s.press&&o.pressKeepsEmpty?.includes(e.key))){l(e.key,"nothing — empty words draw nothing, so no block");break}const h=he(e.role??"body"),{_partStyles:d,...g}=h,p=ye(h,e.styleFrom?{...e.style,...e.styleFrom(i,s)}:e.style,$(e.key),e.props?.align);if(e.was&&b){const y=p._partStyles?.text??{};O.push({key:e.key,was:e.was,...typeof y.textStyle=="string"?{textStyle:y.textStyle}:{},...R(y.size)!==void 0?{size:R(y.size)}:{},...R(y.sizePhone)!==void 0?{sizePhone:R(y.sizePhone)}:{}})}x.push(w("Text",{text:e.mark==="accentLead"?ue(f.text):e.mark==="accentItalic"?re(f.text):f.text,...g,...e.props??{},...p,...f.hidden?{_hidden:!0}:{}})),l(e.key,`${m}Text block: its words${f.hidden?", hidden":""}`);break}case"button":{const f=z(r[e.key]);if(!f.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 h=typeof r[e.href]=="string"&&r[e.href]?r[e.href]:"#",d={...e.style??{},...$(e.key)??{}};x.push(w("ButtonBlock",{label:f.text,href:h,...typeof e.props=="function"?e.props(r,s):e.props??{},...me(e.variant,r),...Object.keys(d).length?{_partStyles:{label:d}}:{},...f.hidden?{_hidden:!0}:{}})),l(e.key,`${m}Button block: its words`),l(e.href,`${m}Button block: its link`),typeof e.variant=="object"&&l(e.variant.key,`${m}Button block: its Style`);break}case"image":{const f=r[e.key];if(typeof f!="string"||!f){l(e.key,"nothing — no picture, no block"),e.alt&&l(e.alt,"nothing — no picture to describe");break}const h=e.alt&&typeof r[e.alt]=="string"?r[e.alt]:"";x.push(w("ImageBlock",{src:f,alt:h,...e.props??{}})),l(e.key,`${m}Image block: its picture`),e.alt&&l(e.alt,`${m}Image block: its alt text`);break}case"list":{x.push(...W(e,r,l));break}case"group":{const f=I(e.parts,r,b,m),h=K(e.box,e.props,r,`${e.name} Box`,!f.length&&!e.keepEmpty,m,l);h&&x.push(w(_,{name:e.name,...h,[E]:f}));break}case"block":{const f=e.parts?I(e.parts,r,b,m):[],h=K(e.box,e.props,r,`${e.type} block`,!!e.parts&&!f.length&&!e.keepEmpty,m,l);h&&x.push(w(e.type,{...h,...e.slot?{[e.slot]:f}:{}}));break}case"core":{const f=e.as??t.type,h={...e.headless?{}:{headPlacement:"own-box"},...e.props??{}},d=e.keep==="rest"?Object.keys(r).filter(p=>!C.has(p)&&!(p in h)):e.keep;for(const p of d)r[p]!==void 0&&(h[p]=r[p],l(p,`the ${f} block inside the Box`));if(e.keep==="rest"){for(const y of Object.keys(e.props??{}))r[y]!==void 0&&!C.has(y)&&l(y,`nothing — the ${f} block inside the Box has the row's own value`);r.headPlacement!==void 0&&l("headPlacement",`the ${f} block inside the Box: own-box`);const p=Object.fromEntries(Object.entries(M).filter(([y])=>!C.has(y)));Object.keys(p).length&&(h._partStyles=p)}for(const[p,y]of Object.entries(e.rename??{}))r[p]!==void 0&&(h[y]=r[p],l(p,`the ${f} block inside the Box: ${y}`));if(e.derive){Object.assign(h,e.derive.props(r,s));for(const p of e.derive.reads)r[p]!==void 0&&l(p,`the ${f} block inside the Box`)}const g=typeof e.slots=="function"?e.slots(r,s):e.slots??{};for(const[p,y]of Object.entries(g))h[p]=y.flatMap(S=>"kind"in S?W(S,r,l):q([S]));x.push(w(f,h));break}}return x},J=(n,r)=>{const b=r===0?"Box":`${n.name} Box`,m=I(n.parts,i,!0,r===0?"":`${b}: `),x=typeof n.boxProps=="function"?n.boxProps(i,s):n.boxProps??{},l=V(n.box??[],x,i,($,e,f)=>P($,f?`nothing — the old value draws nothing (${b}: no ${e})`:`${b}: ${e}`),s);return{type:_,props:{name:n.name,...l,[E]:m,id:fe(a,r)}}},D=[o,...o.also??[]].map(J);i._partStyles!==void 0&&P("_partStyles","each old part's style moved to its new part");for(const[n,r]of Object.entries(o.reads??{}))i[n]!==void 0&&P(n,r);for(const[n,r]of Object.entries(o.drop??{}))n in i&&(k.push({key:n,why:r}),j.add(n));for(const n of Object.keys(i))Y.has(n)||j.has(n)||k.push({key:n,why:"not in the row — not carried"});return{node:D[0],nodes:D,carried:u,dropped:k,siteWrites:[...o.site?.(t,s)??[]],restyled:O}}function Me(t,o=F,s={}){const i=t.content;if(!Array.isArray(i))return t;let c=!1;const a=i.flatMap(u=>{const k=u&&typeof u.type=="string"&&o.includes(u.type)?T[u.type]:void 0;if(!k)return[u];const O=Q(u,k,s);return O.skipped!==void 0?[u]:(c=!0,O.nodes)});return c?{...t,content:a}:t}function Xe(t,o=F,s={}){if(!Array.isArray(t))return[];const i=[];return t.forEach((c,a)=>{const u=c&&typeof c.type=="string"&&o.includes(c.type)?T[c.type]:void 0;if(!u)return;const k=Q(c,u,s);k.skipped===void 0&&i.push({index:a,node:k.node,nodes:k.nodes})}),i}export{de as HOST_PRESS_TYPES,E as SECTION_BOX_SLOT,_ as SECTION_BOX_TYPE,F as SECTION_TO_BOX_ON,le as SECTION_TO_BOX_PRESS,Re as boxNativeReason,Q as convertSection,Me as convertSectionsInPage,Ie as convertTheme,pe as convertsToBox,ge as filledTemplateHold,ze as hasWords,be as headInOwnBox,Fe as headParts,xe as ownBoxHold,Le as pressesAsBox,Ne as registerBoxNativeSections,Ae as registerSectionToBox,fe as sectionBoxIdOf,Xe as sectionToBoxEdits,Ce as sectionToBoxRow,He as sectionToBoxTypes};
1
+ import{readHidable as J}from"efficient-easel/draw";import{BOX_TYPE as U,CONTAINER_BLOCKS_SLOT as Z}from"../../../format/lib/document/container-blocks.js";import{headingTextSeed as ee,labelTextSeed as te}from"../../../format/lib/document/text-seeds.js";import{SPLITTABLE_SECTIONS as oe,parseSectionHeadPlacement as ne}from"../../../format/lib/sections/section-head-placement.js";import{accentItalicRuns as se}from"../../../format/lib/markup.js";import{seedNodes as re}from"../../../format/lib/document/seed-parts.js";import{bucketByGroup as ie}from"../../../format/lib/locations-grid.js";import{normalizeTheme as D}from"../../../format/lib/theme.js";const v=U,E=Z;function Ee(t){if(t.theme)return D(t.theme);const o=t.site?.themePresets;return o?D({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 _e(t){for(const[o,s]of Object.entries(t)){if(o in A&&A[o]!==s)throw new Error(`lib/sections/section-to-box: "${o}" is already Box-native`);A[o]=s}}function je(t){return A[t]}const G=new Set(["id"]),T={},L=[],ce=["ProductGrid","Events","Collections","GalleryB","ContactRouting","ReviewForm","AppointmentBooking","Reviews","CheckoutCTA","AlloyWheelsListing"],de=["Breadcrumb","DocBody","Form","SubmitBuild","Footprint","FAQ","ProcessSteps",...ce,"Stats","Logos","PaymentBadges","PaymentLogosBlock","FitmentFinder","DocMasthead","DocTabs","Timeline","TimelineTrack","OrderSummary","Chart","Mockup","Countdown","FeaturedCover","SectionHeader","TitleWithButtons","Prose","ParagraphsA","Banner","Cards"];function Ie(t){for(const[o,s]of Object.entries(t)){if(o in T&&T[o]!==s)throw new Error(`lib/sections/section-to-box: "${o}" already has a row`);T[o]=s}}function Ne(t){return T[t]}function Ae(){return Object.keys(T)}function fe(t){return t in T&&L.includes(t)}function Re(t,o=de){return t in T&&(o.includes(t)||fe(t))}function Ce(t){const o=oe[t];if(!o)throw new Error(`lib/sections/section-to-box: "${t}" has no head row in SPLITTABLE_SECTIONS`);const s=[{kind:"text",key:o.num,role:"eyebrow"},{kind:"text",key:o.title,role:"heading"}];return o.description&&s.push({kind:"text",key:o.description,role:"body"}),o.headRows.includes("linkText")&&o.headRows.includes("linkHref")&&s.push({kind:"button",key:"linkText",href:"linkHref"}),s}const F=t=>J(t),He=t=>F(t).text.trim()!=="";function le(t){if(t.includes("=="))return t;const o=t.indexOf("/"),s=o===-1?t:t.slice(0,o),r=s.trim();if(!r)return t;const c=s.indexOf(r);return`${s.slice(0,c)}==${r}==${s.slice(c+r.length)}${o===-1?"":t.slice(o)}`}const pe=t=>t==="heading"?ee():t==="eyebrow"?te():{};function ue(t,o,s,r){const a={...t._partStyles?.text??{},...o??{},...s??{}};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 s=o[t.key];return{variant:typeof s=="string"&&Object.hasOwn(t.map,s)?t.map[s]:t.fallback}}function z(t,o,s,r,c={}){const a={...o};for(const u of t){const[m,S,_]=typeof u=="string"?[u,u,void 0]:u;if(s[m]===void 0)continue;const j=_?_(s[m],s,c):s[m];j===void 0?delete a[S]:a[S]=j,r(m,S,j===void 0)}return a}function ye(t){const o=new Set([...G,"headPlacement","_partStyles",...Object.keys(t.drop??{}),...Object.keys(t.reads??{})]),s=c=>{for(const a of c??[])o.add(typeof a=="string"?a:a[0])},r=c=>{for(const a of c)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":s(a.box),r(a.parts??[]);break;case"core":if(a.keep!=="rest"&&a.keep.forEach(u=>o.add(u)),Object.keys(a.rename??{}).forEach(u=>o.add(u)),a.derive?.reads.forEach(u=>o.add(u)),typeof a.slots!="function")for(const u of Object.values(a.slots??{}))for(const m of u)"kind"in m&&o.add(m.key);break}};for(const c of[t,...t.also??[]])s(c.box),r(c.parts);return o}const me=t=>ne(t.headPlacement)==="own-box";function ke(t){return me(t)?"its head sits in a Box of its own above it (own-box): the row draws the head inline":void 0}function be(t,o){const s=t[o];return Array.isArray(s)&&s.some(c=>!!c&&typeof c=="object"&&typeof c.type=="string")?"already on the Box path: its items draw from a filled card template":void 0}function ge(t){const o=new Set,s=r=>{for(const c of r)if(c.kind==="group"||c.kind==="block")s(c.parts??[]);else if(c.kind==="core"&&c.slots&&typeof c.slots!="function")for(const[a,u]of Object.entries(c.slots))u.length>0&&u.every(m=>!("kind"in m))&&o.add(a)};for(const r of[t,...t.also??[]])s(r.parts);return[...o]}function xe(t,o,s){if(!s.press)for(const r of ge(t)){const c=be(o,r);if(c!==void 0)return c}}function Y(t,o,s={}){const r=t.props,c=(o.ownBoxConverts?void 0:ke(r))??xe(o,r,s)??o.skip?.(r);if(c!==void 0)return{node:t,nodes:[t],carried:[],dropped:[],siteWrites:[],skipped:c};const a=String(r.id??t.type),u=[],m=[],S=new Set,_=(n,i)=>{u.push({key:n,home:i}),S.add(n)},j=r._partStyles??{},R=ye(o);let M=0;const w=(n,i)=>({type:n,props:{...i,id:`${a}~${n}-${++M}`}}),W=(n,i,b,y,g,l,$)=>{if(g){for(const d of n??[]){const h=typeof d=="string"?d:d[0];b[h]!==void 0&&$(h,`nothing — the ${y} has no parts, so it is not drawn`)}return}const e=typeof i=="function"?i(r,s):i??{};return z(n??[],e,b,(d,h,f)=>$(d,f?`nothing — the old value draws nothing (${y}: no ${h})`:`${l}${y}: ${h}`),s)},V=n=>re(n,i=>`${a}~${i}-${++M}`),X=(n,i,b)=>{const y=n.of?n.of(i):Array.isArray(i[n.key])?i[n.key]:[],g=typeof n.props=="function"?n.props(r,s):n.props??{},l=y.map((f,x)=>{const p=f??{},k=n.item?.(p,x,r)??{},B=I(k.reverse?[...n.parts].reverse():n.parts,p,!1,`item ${x+1}: `);return n.flat?k.props?B.map(P=>({...P,props:{...P.props,...k.props,id:P.props.id}})):B:[w(v,{name:`${n.name} ${x+1}`,...g,...k.props??{},[E]:B})]});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"),ie(y.map(x=>x??{}),f.of,f.of).map((x,p)=>{const k=x.items.map(O=>O.item),B=f.parts?I(f.parts,f.head?.(k,r)??{},!1,`group ${p+1}: `):[],P=x.items.map(O=>l[O.index]),C=f.perRow?.(k.length,r),N=Number.isInteger(C)&&C>=1?C:1,H=[];if(f.perRow&&N<P.length)for(let O=0;O*N<P.length;O++)H.push(P.slice(O*N,(O+1)*N).flat());return w(v,{name:`${f.name} ${p+1}`,...f.props??{},[E]:[...B,w(v,{name:`${f.itemsName} ${p+1}`,...f.itemsProps?.(k.length,r)??{},[E]:H.length?H.map((O,q)=>w(v,{name:`${f.rowName??`${f.itemsName} row`} ${q+1}`,...f.rowProps??{},[E]:O})):P.flat()})]})})}const $=n.perRow?.(r),e=n.perRow?Number.isInteger($)&&$>=1?$: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 l.flat();const d=typeof n.rowProps=="function"?n.rowProps(r,s):n.rowProps??{},h=[];for(let f=0;f*e<l.length;f++){const x=l.slice(f*e,(f+1)*e).flat(),p=n.rowFiller?e-l.slice(f*e,(f+1)*e).length:0;h.push(w(v,{name:`${n.rowName??`${n.name} row`} ${f+1}`,...d,[E]:[...x,...Array.from({length:p},(k,B)=>w(v,{name:`Empty ${B+1}`,...n.rowFiller,[E]:[]}))]}))}return h},I=(n,i,b,y)=>{const g=[],l=(e,d)=>b?_(e,d):void 0,$=e=>b?j[e]:void 0;for(const e of n)if(!(e.when&&!e.when(r,b?void 0:i)))switch(e.kind){case"text":{const d=F(i[e.key]);if(!d.text.trim()&&!(b&&s.press&&o.pressKeepsEmpty?.includes(e.key))){l(e.key,"nothing — empty words draw nothing, so no block");break}const h=pe(e.role??"body"),{_partStyles:f,...x}=h,p=ue(h,e.styleFrom?{...e.style,...e.styleFrom(r,s)}:e.style,$(e.key),e.props?.align);g.push(w("Text",{text:e.mark==="accentLead"?le(d.text):e.mark==="accentItalic"?se(d.text):d.text,...x,...e.props??{},...p,...d.hidden?{_hidden:!0}:{}})),l(e.key,`${y}Text block: its words${d.hidden?", hidden":""}`);break}case"button":{const d=F(i[e.key]);if(!d.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 h=typeof i[e.href]=="string"&&i[e.href]?i[e.href]:"#",f={...e.style??{},...$(e.key)??{}};g.push(w("ButtonBlock",{label:d.text,href:h,...typeof e.props=="function"?e.props(i,s):e.props??{},...he(e.variant,i),...Object.keys(f).length?{_partStyles:{label:f}}:{},...d.hidden?{_hidden:!0}:{}})),l(e.key,`${y}Button block: its words`),l(e.href,`${y}Button block: its link`),typeof e.variant=="object"&&l(e.variant.key,`${y}Button block: its Style`);break}case"image":{const d=i[e.key];if(typeof d!="string"||!d){l(e.key,"nothing — no picture, no block"),e.alt&&l(e.alt,"nothing — no picture to describe");break}const h=e.alt&&typeof i[e.alt]=="string"?i[e.alt]:"";g.push(w("ImageBlock",{src:d,alt:h,...e.props??{}})),l(e.key,`${y}Image block: its picture`),e.alt&&l(e.alt,`${y}Image block: its alt text`);break}case"list":{g.push(...X(e,i,l));break}case"group":{const d=I(e.parts,i,b,y),h=W(e.box,e.props,i,`${e.name} Box`,!d.length&&!e.keepEmpty,y,l);h&&g.push(w(v,{name:e.name,...h,[E]:d}));break}case"block":{const d=e.parts?I(e.parts,i,b,y):[],h=W(e.box,e.props,i,`${e.type} block`,!!e.parts&&!d.length&&!e.keepEmpty,y,l);h&&g.push(w(e.type,{...h,...e.slot?{[e.slot]:d}:{}}));break}case"core":{const d=e.as??t.type,h={...e.headless?{}:{headPlacement:"own-box"},...e.props??{}},f=e.keep==="rest"?Object.keys(i).filter(p=>!R.has(p)&&!(p in h)):e.keep;for(const p of f)i[p]!==void 0&&(h[p]=i[p],l(p,`the ${d} block inside the Box`));if(e.keep==="rest"){for(const k of Object.keys(e.props??{}))i[k]!==void 0&&!R.has(k)&&l(k,`nothing — the ${d} block inside the Box has the row's own value`);i.headPlacement!==void 0&&l("headPlacement",`the ${d} block inside the Box: own-box`);const p=Object.fromEntries(Object.entries(j).filter(([k])=>!R.has(k)));Object.keys(p).length&&(h._partStyles=p)}for(const[p,k]of Object.entries(e.rename??{}))i[p]!==void 0&&(h[k]=i[p],l(p,`the ${d} block inside the Box: ${k}`));if(e.derive){Object.assign(h,e.derive.props(i,s));for(const p of e.derive.reads)i[p]!==void 0&&l(p,`the ${d} block inside the Box`)}const x=typeof e.slots=="function"?e.slots(i,s):e.slots??{};for(const[p,k]of Object.entries(x))h[p]=k.flatMap(B=>"kind"in B?X(B,i,l):V([B]));g.push(w(d,h));break}}return g},Q=(n,i)=>{const b=i===0?"Box":`${n.name} Box`,y=I(n.parts,r,!0,i===0?"":`${b}: `),g=typeof n.boxProps=="function"?n.boxProps(r,s):n.boxProps??{},l=z(n.box??[],g,r,($,e,d)=>_($,d?`nothing — the old value draws nothing (${b}: no ${e})`:`${b}: ${e}`),s);return{type:v,props:{name:n.name,...l,[E]:y,id:ae(a,i)}}},K=[o,...o.also??[]].map(Q);r._partStyles!==void 0&&_("_partStyles","each old part's style moved to its new part");for(const[n,i]of Object.entries(o.reads??{}))r[n]!==void 0&&_(n,i);for(const[n,i]of Object.entries(o.drop??{}))n in r&&(m.push({key:n,why:i}),S.add(n));for(const n of Object.keys(r))G.has(n)||S.has(n)||m.push({key:n,why:"not in the row — not carried"});return{node:K[0],nodes:K,carried:u,dropped:m,siteWrites:[...o.site?.(t,s)??[]]}}function Le(t,o=L,s={}){const r=t.content;if(!Array.isArray(r))return t;let c=!1;const a=r.flatMap(u=>{const m=u&&typeof u.type=="string"&&o.includes(u.type)?T[u.type]:void 0;if(!m)return[u];const S=Y(u,m,s);return S.skipped!==void 0?[u]:(c=!0,S.nodes)});return c?{...t,content:a}:t}function Fe(t,o=L,s={}){if(!Array.isArray(t))return[];const r=[];return t.forEach((c,a)=>{const u=c&&typeof c.type=="string"&&o.includes(c.type)?T[c.type]:void 0;if(!u)return;const m=Y(c,u,s);m.skipped===void 0&&r.push({index:a,node:m.node,nodes:m.nodes})}),r}export{ce as HOST_PRESS_TYPES,E as SECTION_BOX_SLOT,v as SECTION_BOX_TYPE,L as SECTION_TO_BOX_ON,de as SECTION_TO_BOX_PRESS,je as boxNativeReason,Y as convertSection,Le as convertSectionsInPage,Ee as convertTheme,fe as convertsToBox,be as filledTemplateHold,He as hasWords,me as headInOwnBox,Ce as headParts,ke as ownBoxHold,Re as pressesAsBox,_e as registerBoxNativeSections,Ie as registerSectionToBox,ae as sectionBoxIdOf,Fe as sectionToBoxEdits,Ne as sectionToBoxRow,Ae as sectionToBoxTypes};
@@ -24,8 +24,11 @@ export declare function SiteRuntimeProvider({ runtime, children }: {
24
24
  }): import("react").JSX.Element;
25
25
  export declare function useSiteRuntime(): SiteRuntime;
26
26
  export declare function useCurrentPagePath(): string | null;
27
- export declare function SiteLink({ hrefRewrite, ...props }: SiteLinkProps & {
27
+ export declare function useSiteHost(): string | null;
28
+ export type SiteLinkNewTab = "auto" | true;
29
+ export declare function SiteLink({ hrefRewrite, newTab, ...rest }: SiteLinkProps & {
28
30
  hrefRewrite?: string;
31
+ newTab?: SiteLinkNewTab;
29
32
  }): import("react").JSX.Element;
30
33
  export declare function SiteImage(props: SiteImageProps): import("react").JSX.Element;
31
34
  export declare function lazyInBrowser<P extends object>(loader: () => Promise<{
@@ -1 +1 @@
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};
1
+ "use client";import{jsx as o}from"react/jsx-runtime";import c from"next/image";import l from"next/link";import{Component as m,createContext as h,lazy as p,Suspense as d,useContext as x,useSyncExternalStore as k}from"react";import{linkTargetAttrs as S,NEW_TAB_ATTRS as g}from"../../format/lib/content/box-link.js";import{linkHrefRewrite as w}from"../../format/lib/links/link-href-rewrites.js";import{shopHost as L}from"../../format/lib/web-runtime.js";import{isSafeLinkHref as y}from"../../format/lib/markup.js";import{nonEmptyString as R}from"../../format/lib/non-empty-string.js";const C={Link:l,Image:c},u=h(C);function M({runtime:r,children:e}){return o(u.Provider,{value:r,children:e})}function a(){return x(u)}function U(){return a().pagePath??null}const H=()=>()=>{},I=()=>L()||null,v=()=>null;function E(){return k(H,I,v)}function W({hrefRewrite:r,newTab:e,...t}){const{Link:n}=a(),f=E(),i=e===!0?{...t,...g}:e==="auto"?{...t,...S(t.href,f)}:t,s=w(r);return s?o(T,{name:s.name,href:i.href,fallback:o(n,{...i}),children:o(P,{Link:n,rewrite:s.rewrite,...i})},s.key):o(n,{...i})}function P({Link:r,rewrite:e,...t}){const n=R(e(t.href)),f=n&&y(n)?n:t.href;return o(r,{...t,href:f})}class T extends m{state={failed:!1,href:this.props.href};static getDerivedStateFromProps(e,t){return e.href===t.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 X(r){const{Image:e}=a();return o(e,{...r})}function $(r){const e=p(r);return function(n){return o(d,{fallback:null,children:o(e,{...n})})}}export{X as SiteImage,W as SiteLink,M as SiteRuntimeProvider,$ as lazyInBrowser,U as useCurrentPagePath,E as useSiteHost,a as useSiteRuntime};
@@ -1,2 +1,2 @@
1
- import{defaultTextStyles as Y,textStyleCaseCss as le,textStyleViewKey as ce}from"efficient-easel/text-styles/model";import{resolveViewValue as B}from"efficient-easel/draw";import{viewKey as O}from"../../../format/lib/animation/views.js";import{FONT_OPTIONS as de,normalizeFonts as U}from"../../../format/lib/fonts.js";import{PHONE_MEDIA as pe,TABLET_MEDIA as fe,viewOverrides as C,viewRules as X}from"../content/view-values.js";import{STYLE_ID_OF_ROLE as ue,TEXT_STYLE_ATTR as ge,paragraphRules as Z,partSpacingOf as he}from"../document/part-styles.js";import{faceClassOf as q}from"../../../format/lib/text-style-face.js";import{partColourName as Q,partInkCss as me}from"../../../format/lib/document/part-inks.js";import{compressionMetrics as Se,headingTypographyFromRow as ye,normalizeHeadingCompression as I,normalizeSizes as ee}from"../../../format/lib/theme.js";import{finiteNumber as v}from"../../../format/lib/finite-number.js";import{nonEmptyString as P}from"../../../format/lib/non-empty-string.js";const L=e=>e==="sentence"?"none":void 0,ne=["font","color","size","sizeTablet","sizePhone","weight","italic","lineHeight","lineHeightTablet","lineHeightPhone","letterSpacing","letterSpacingTablet","letterSpacingPhone","paragraphSpacing","paragraphSpacingTablet","paragraphSpacingPhone","letterCase","largestSize","largestSizeTablet","largestSizePhone"],w=["desktop","tablet","phone"],k=(e,i)=>i==="desktop"?e:ce(e,i);function j(e,i,t,n=X()){return B("textSize",i,e.sizeTablet,e.sizePhone,n)[t]}const be=[["lineSpacing","lineHeight","line"],["letterSpacing","letterSpacing","letter"]];function M(e){for(const[i,t,n]of be)for(const o of w)if(e===k(i,o))return{key:O(t,o),view:o,spacing:n};return{key:e,view:"desktop",spacing:null}}function b(e){const i={};for(const t of ne)e[t]!==void 0&&(i[t]=e[t]);return i}function R(e,i){const{auto:t,...n}=e,o=new Set(i??[]),r=ne.filter(s=>o.has(s)&&e.values[s]===void 0);return r.length?{...n,auto:r}:n}function te(e){const i=e.fonts,t=e.sizes,n=e.typography,o=Se(e.compression),r={"heading-1":{font:P(i.heading),size:v(t.headingLarge),weight:v(n.weight),lineHeight:o.lineHeight,letterSpacing:o.letterSpacing,letterCase:L(n.case),largestSize:v(n.maxPx)},"heading-2":{font:P(i.heading2),size:v(t.headingMedium),weight:v(n.weight2),lineHeight:o.lineHeight,letterSpacing:o.letterSpacing,letterCase:L(n.case2)},"heading-3":{font:P(i.heading3),size:v(t.headingSmall),weight:v(n.weight3),lineHeight:o.lineHeight,letterSpacing:o.letterSpacing,letterCase:L(n.case3)},"body-1":{font:P(i.body),size:v(t.body)},"body-5":{font:P(i.label),size:v(t.label)}};return Y().map(({id:s,kind:l,name:d})=>({id:s,kind:l,name:d,values:b(r[s]??{})}))}function N(e){return Array.isArray(e)&&e.every(t=>t&&typeof t=="object"&&typeof t.id=="string"&&(t.kind==="heading"||t.kind==="body")&&typeof t.name=="string")?e.map(t=>R({...t,values:b(t.values??{})},Array.isArray(t.auto)?t.auto:void 0)):null}function Le(e){return N(e)??[]}function ie(e){return N(e)??Y().map(({id:i,kind:t,name:n})=>({id:i,kind:t,name:n,values:{}}))}function V(e,i){const t=te(i),n=N(e);return n?n.map(o=>{const r={...F(t,o.id)};for(const s of o.auto??[])delete r[s];return{...o,values:b({...r,...o.values})}}):t}const F=(e,i)=>e.find(t=>t.id===i)?.values??{},oe=["heading-1","heading-2","heading-3"];function je({saved:e,old:i,cur:t,next:n,sizeOf:o,panelView:r="desktop"}){const s=te(i),l=ie(e),d=V(l,i),c=[],f=n.map(a=>{const S=t.find(g=>g.id===a.id),h=l.find(g=>g.id===a.id);if(!S||!h){const g=xe([a],o,r)[0],T=g.values.color;return T===void 0?g:{...g,values:{...g.values,color:Q(T)}}}const p={...h.values},x=new Set(h.auto??[]),y=a.values,_=S.values,z=[...new Set([...Object.keys(y),...Object.keys(_)])].filter(g=>JSON.stringify(y[g])!==JSON.stringify(_[g])),D=g=>M(g).spacing==="letter";z.sort((g,T)=>Number(D(g))-Number(D(T)));for(const g of z){const{key:T,view:re,spacing:K}=M(g),$=T,A=y[g];if(A===void 0){delete p[$],F(s,a.id)[$]!==void 0&&(c.push([a.id,$]),x.add($));continue}if(x.delete($),K==="line")p[$]=H(A/100,3);else if(K==="letter"){const W={...d.find(E=>E.id===a.id)?.values??{}};for(const E of z)y[E]===void 0&&delete W[M(E).key];const G=b({...W,...p}),J=j(G,o({...a,values:G}),re);p[$]=J?H(A/J,4):0}else p[$]=A}return R({id:a.id,kind:a.kind,name:a.name,values:b(p)},x)});let u=i.compression;if(c.some(([a,S])=>(S==="lineHeight"||S==="letterSpacing")&&oe.includes(a))&&I(u)!=="normal"){for(const a of oe){const S=f.find(p=>p.id===a);if(!S)continue;const h={...S.values};for(const p of["lineHeight","letterSpacing"])c.some(([x,y])=>x===a&&y===p)||h[p]===void 0&&!(S.auto??[]).includes(p)&&(h[p]=F(s,a)[p]);S.values=b(h)}u="normal"}return{saved:f,old:{...i,compression:u}}}function Me(e,i){const t={text_styles:e.saved};return e.old.compression!==i.compression&&(t.heading_compression=I(e.old.compression)),t}const H=(e,i)=>Number(e.toFixed(i)),se=(e,i)=>w.indexOf(e)<w.indexOf(i)?i:e;function Re(e,i,t="desktop"){return e.map(n=>{const o={...n.values},r=i(n);for(const s of w){const l=O("lineHeight",s),d=n.values[l],c=n.values[O("letterSpacing",s)];delete o[l],d!==void 0&&(o[k("lineSpacing",s)]=H(d*100,1));const f=se(s,t);c!==void 0&&(o[k("letterSpacing",s)]=H(c*j(n.values,r,f),f===s?2:4))}return{id:n.id,kind:n.kind,name:n.name,values:o}})}function xe(e,i,t="desktop"){return e.map(n=>{const o=n.values,r={...o};for(const c of w)delete r[k("lineSpacing",c)],delete r[k("letterSpacing",c)];const s={id:n.id,kind:n.kind,name:n.name,values:b(r)},l={...s.values},d=i({...s,values:{...s.values}});for(const c of w){const f=o[k("lineSpacing",c)],u=o[k("letterSpacing",c)];if(typeof f=="number"&&(l[O("lineHeight",c)]=H(f/100,3)),typeof u=="number"){const m=j(s.values,d,se(c,t));l[O("letterSpacing",c)]=m?H(u/m,4):0}}return{...s,values:b(l)}})}function Ve(e){const i={fonts:U({heading:e.heading_font??void 0,heading2:e.heading_2_font??void 0,heading3:e.heading_3_font??void 0,body:e.body_font??void 0,accent:e.accent_font??void 0,label:e.label_font??void 0}),sizes:ee({headingLarge:e.heading_size_large_px,headingMedium:e.heading_size_medium_px,headingSmall:e.heading_size_small_px,accent:e.accent_size_px,body:e.body_size_px,label:e.label_size_px}),compression:I(e.heading_compression),typography:ye(e)},t=e.text_styles??null,n=Array.isArray(t)?ae(V(t,i),i):i;return{fonts:U(n.fonts),sizes:ee(n.sizes),compression:I(n.compression),typography:n.typography,textStyles:t}}function ae(e,i){const t=m=>e.find(a=>a.id===m)?.values??{},n=t("heading-1"),o=t("heading-2"),r=t("heading-3"),s=t("body-1"),l=t("body-5"),d=i.fonts,c=i.sizes,f=i.typography,u=m=>m==="none"?"sentence":"authored";return{fonts:{...d,heading:n.font??d.heading,heading2:o.font??n.font??d.heading2,heading3:r.font??n.font??d.heading3,body:s.font??d.body,label:l.font??d.label},sizes:{...c,headingLarge:n.size??null,headingMedium:o.size??null,headingSmall:r.size??null,body:s.size??null,label:l.size??null},compression:i.compression,typography:{...f,case:u(n.letterCase),weight:n.weight??null,maxPx:n.largestSize??null,weight2:o.weight??null,weight3:r.weight??null,case2:u(o.letterCase),case3:u(r.letterCase)}}}function Fe(e){const i=N(e.textStyles);if(!i||i.every(o=>Object.keys(o.values).length===0&&!o.auto))return e;const t={fonts:e.fonts??{},sizes:e.sizes??{},compression:String(e.headingCompression??"normal"),typography:e.headingTypography??{}},n=ae(V(i,t),t);return{...e,fonts:n.fonts,sizes:n.sizes,headingCompression:n.compression,headingTypography:n.typography}}function De(e){const i=[];for(const t of e){const n=t.values,o=`.${q(t)}`,r=`[${ge}="${t.id}"]`,s=`${o}, ${r}`,l=[],d=n.font!==void 0?de.find(m=>m.key===n.font)?.cssVar:void 0;if(d&&l.push(`font-family: var(${d})`),n.size!==void 0){const m=n.largestSize!==void 0?Math.min(n.size,n.largestSize):n.size;l.push(`font-size: ${m}px`)}const c=me(n.color);c&&l.push(`color: ${c}`),n.italic===!0&&l.push("font-style: italic"),n.weight!==void 0&&l.push(`font-weight: ${n.weight}`);const f=[];n.lineHeight!==void 0&&f.push(`line-height: ${n.lineHeight}`),n.letterSpacing!==void 0&&f.push(`letter-spacing: ${n.letterSpacing}em`),t.kind==="body"&&l.push(...f);const u=le(n.letterCase);u&&t.kind==="body"&&l.push(`text-transform: ${u}`),n.paragraphSpacing&&l.push(`--sf-part-para: ${n.paragraphSpacing}px`),l.length&&i.push(`${s} { ${l.join("; ")} }`),t.kind==="heading"&&f.length&&i.push(`${s}, ${o}:is(h1, h2, h3, h4), ${r}:is(h1, h2, h3, h4) { ${f.join("; ")} }`),t.kind==="heading"&&u&&i.push(`${r}, ${o}:is(h1, h2, h3, h4) { text-transform: ${u} }`),n.paragraphSpacing&&(i.push(`*:has(> ${r}) { --sf-part-para: ${n.paragraphSpacing}px }`),i.push(...Z(`:is(${s})`,`*:has(> ${r})`))),i.push(...ze(t,s,o,r))}return i.join(`
2
- `)}function ze(e,i,t,n){const o=e.values,r=C("textSize",o.size,o.sizeTablet,o.sizePhone),s=C("textSize",o.largestSize,o.largestSizeTablet,o.largestSizePhone),l=C("same",o.lineHeight,o.lineHeightTablet,o.lineHeightPhone),d=C("same",o.letterSpacing,o.letterSpacingTablet,o.letterSpacingPhone),c=C("spacing",o.paragraphSpacing,o.paragraphSpacingTablet,o.paragraphSpacingPhone),f=B("textSize",o.size,o.sizeTablet,o.sizePhone,X()),u=ve[e.id],m=[];for(const[a,S]of[["tablet",fe],["phone",pe]]){const h=[],p=[],x=f[a],y=s[a],_=r[a]===void 0&&y===void 0||x===void 0?void 0:y===void 0?x:Math.min(x,y);_!==void 0&&p.push(`font-size: ${_}px`);const z=[];l[a]!==void 0&&z.push(`line-height: ${l[a]}`),d[a]!==void 0&&z.push(`letter-spacing: ${d[a]}em`),e.kind==="body"&&p.push(...z),c[a]!==void 0&&p.push(`--sf-part-para: ${c[a]}px`),p.length&&h.push(`${i} { ${p.join("; ")} }`),e.kind==="heading"&&z.length&&h.push(`${i}, ${t}:is(h1, h2, h3, h4), ${n}:is(h1, h2, h3, h4) { ${z.join("; ")} }`),c[a]!==void 0&&h.push(`*:has(> ${n}) { --sf-part-para: ${c[a]}px }`),c[a]!==void 0&&!o.paragraphSpacing&&h.push(...Z(`:is(${i})`,`*:has(> ${n})`)),_!==void 0&&u&&h.push(`.sf-themed-content { --size-${u}: ${_}px !important }`),h.length&&m.push(`@media ${S} { ${h.join(" ")} }`)}return m}const ve={"heading-1":"headingLarge","heading-2":"headingMedium","heading-3":"headingSmall","body-1":"body","body-5":"label"};function Ke(e){return e!==!0&&e!==!1?"":`em.text-accent { font-style: ${e?"italic":"normal"} }`}function We(e){return e?ue[e]:void 0}function $e(e){const i=he(e);return b({font:e.font,color:e.color===void 0?void 0:Q(e.color),size:e.size,weight:e.weight,italic:e.italic,lineHeight:i.lineHeight,letterSpacing:i.letterSpacingEm,paragraphSpacing:e.paragraphSpacing,letterCase:e.case})}function Ge(e){return Object.keys($e(e)).length>0}function Je({saved:e,old:i,styleId:t,values:n}){const o=ie(e);return{saved:_e(o,t,n),old:i}}function _e(e,i,t){return e.map(n=>n.id===i?R({...n,values:b({...n.values,...t})},n.auto):n)}function Ye(e){const i=e.filter(t=>t.kind==="body").map(t=>Number(/^body-(\d+)$/.exec(t.id)?.[1])).filter(t=>Number.isInteger(t)&&t>0);return i.length?`body-${Math.max(...i)}`:"body-1"}export{Ke as accentItalicCss,je as applyListChange,Ye as eyebrowStyleId,q as faceClassOf,xe as fromPanelStyles,Ge as hasStyleChange,Me as listChangePatch,ie as listToWrite,$e as partStyleToTextStyleValues,Je as pushIntoStyle,V as resolveTextStyles,_e as setStyleValues,Ve as siteTextFromRow,Le as storedTextStyles,We as styleIdOfRole,De as textStylesCss,te as textStylesFromOld,ae as textStylesToOld,Fe as themeWithTextStyles,Re as toPanelStyles,j as viewSizeOf};
1
+ import{defaultTextStyles as Y,textStyleCaseCss as le}from"efficient-easel/text-styles/model";import{resolveViewValue as B}from"efficient-easel/draw";import{viewKey as w}from"../../../format/lib/animation/views.js";import{FONT_OPTIONS as ce,normalizeFonts as U}from"../../../format/lib/fonts.js";import{PHONE_MEDIA as de,TABLET_MEDIA as pe,viewOverrides as C,viewRules as X}from"../content/view-values.js";import{STYLE_ID_OF_ROLE as fe,TEXT_STYLE_ATTR as ue,paragraphRules as Z,partSpacingOf as ge}from"../document/part-styles.js";import{faceClassOf as q}from"../../../format/lib/text-style-face.js";import{partColourName as Q,partInkCss as he}from"../../../format/lib/document/part-inks.js";import{compressionMetrics as me,headingTypographyFromRow as Se,normalizeHeadingCompression as I,normalizeSizes as ee}from"../../../format/lib/theme.js";import{finiteNumber as v}from"../../../format/lib/finite-number.js";import{nonEmptyString as P}from"../../../format/lib/non-empty-string.js";const L=e=>e==="sentence"?"none":void 0,ne=["font","color","size","sizeTablet","sizePhone","weight","italic","lineHeight","lineHeightTablet","lineHeightPhone","letterSpacing","letterSpacingTablet","letterSpacingPhone","paragraphSpacing","paragraphSpacingTablet","paragraphSpacingPhone","letterCase","largestSize","largestSizeTablet","largestSizePhone"],H=["desktop","tablet","phone"],k=(e,i)=>w(e,i);function j(e,i,t,n=X()){return B("textSize",i,e.sizeTablet,e.sizePhone,n)[t]}const ye=[["lineSpacing","lineHeight","line"],["letterSpacing","letterSpacing","letter"]];function M(e){for(const[i,t,n]of ye)for(const o of H)if(e===k(i,o))return{key:w(t,o),view:o,spacing:n};return{key:e,view:"desktop",spacing:null}}function b(e){const i={};for(const t of ne)e[t]!==void 0&&(i[t]=e[t]);return i}function R(e,i){const{auto:t,...n}=e,o=new Set(i??[]),r=ne.filter(s=>o.has(s)&&e.values[s]===void 0);return r.length?{...n,auto:r}:n}function te(e){const i=e.fonts,t=e.sizes,n=e.typography,o=me(e.compression),r={"heading-1":{font:P(i.heading),size:v(t.headingLarge),weight:v(n.weight),lineHeight:o.lineHeight,letterSpacing:o.letterSpacing,letterCase:L(n.case),largestSize:v(n.maxPx)},"heading-2":{font:P(i.heading2),size:v(t.headingMedium),weight:v(n.weight2),lineHeight:o.lineHeight,letterSpacing:o.letterSpacing,letterCase:L(n.case2)},"heading-3":{font:P(i.heading3),size:v(t.headingSmall),weight:v(n.weight3),lineHeight:o.lineHeight,letterSpacing:o.letterSpacing,letterCase:L(n.case3)},"body-1":{font:P(i.body),size:v(t.body)},"body-5":{font:P(i.label),size:v(t.label)}};return Y().map(({id:s,kind:l,name:d})=>({id:s,kind:l,name:d,values:b(r[s]??{})}))}function N(e){return Array.isArray(e)&&e.every(t=>t&&typeof t=="object"&&typeof t.id=="string"&&(t.kind==="heading"||t.kind==="body")&&typeof t.name=="string")?e.map(t=>R({...t,values:b(t.values??{})},Array.isArray(t.auto)?t.auto:void 0)):null}function Ne(e){return N(e)??[]}function ie(e){return N(e)??Y().map(({id:i,kind:t,name:n})=>({id:i,kind:t,name:n,values:{}}))}function V(e,i){const t=te(i),n=N(e);return n?n.map(o=>{const r={...F(t,o.id)};for(const s of o.auto??[])delete r[s];return{...o,values:b({...r,...o.values})}}):t}const F=(e,i)=>e.find(t=>t.id===i)?.values??{},oe=["heading-1","heading-2","heading-3"];function Le({saved:e,old:i,cur:t,next:n,sizeOf:o,panelView:r="desktop"}){const s=te(i),l=ie(e),d=V(l,i),c=[],f=n.map(a=>{const S=t.find(g=>g.id===a.id),h=l.find(g=>g.id===a.id);if(!S||!h){const g=be([a],o,r)[0],T=g.values.color;return T===void 0?g:{...g,values:{...g.values,color:Q(T)}}}const p={...h.values},x=new Set(h.auto??[]),y=a.values,_=S.values,z=[...new Set([...Object.keys(y),...Object.keys(_)])].filter(g=>JSON.stringify(y[g])!==JSON.stringify(_[g])),D=g=>M(g).spacing==="letter";z.sort((g,T)=>Number(D(g))-Number(D(T)));for(const g of z){const{key:T,view:re,spacing:K}=M(g),$=T,A=y[g];if(A===void 0){delete p[$],F(s,a.id)[$]!==void 0&&(c.push([a.id,$]),x.add($));continue}if(x.delete($),K==="line")p[$]=O(A/100,3);else if(K==="letter"){const W={...d.find(E=>E.id===a.id)?.values??{}};for(const E of z)y[E]===void 0&&delete W[M(E).key];const G=b({...W,...p}),J=j(G,o({...a,values:G}),re);p[$]=J?O(A/J,4):0}else p[$]=A}return R({id:a.id,kind:a.kind,name:a.name,values:b(p)},x)});let u=i.compression;if(c.some(([a,S])=>(S==="lineHeight"||S==="letterSpacing")&&oe.includes(a))&&I(u)!=="normal"){for(const a of oe){const S=f.find(p=>p.id===a);if(!S)continue;const h={...S.values};for(const p of["lineHeight","letterSpacing"])c.some(([x,y])=>x===a&&y===p)||h[p]===void 0&&!(S.auto??[]).includes(p)&&(h[p]=F(s,a)[p]);S.values=b(h)}u="normal"}return{saved:f,old:{...i,compression:u}}}function je(e,i){const t={text_styles:e.saved};return e.old.compression!==i.compression&&(t.heading_compression=I(e.old.compression)),t}const O=(e,i)=>Number(e.toFixed(i)),se=(e,i)=>H.indexOf(e)<H.indexOf(i)?i:e;function Me(e,i,t="desktop"){return e.map(n=>{const o={...n.values},r=i(n);for(const s of H){const l=w("lineHeight",s),d=n.values[l],c=n.values[w("letterSpacing",s)];delete o[l],d!==void 0&&(o[k("lineSpacing",s)]=O(d*100,1));const f=se(s,t);c!==void 0&&(o[k("letterSpacing",s)]=O(c*j(n.values,r,f),f===s?2:4))}return{id:n.id,kind:n.kind,name:n.name,values:o}})}function be(e,i,t="desktop"){return e.map(n=>{const o=n.values,r={...o};for(const c of H)delete r[k("lineSpacing",c)],delete r[k("letterSpacing",c)];const s={id:n.id,kind:n.kind,name:n.name,values:b(r)},l={...s.values},d=i({...s,values:{...s.values}});for(const c of H){const f=o[k("lineSpacing",c)],u=o[k("letterSpacing",c)];if(typeof f=="number"&&(l[w("lineHeight",c)]=O(f/100,3)),typeof u=="number"){const m=j(s.values,d,se(c,t));l[w("letterSpacing",c)]=m?O(u/m,4):0}}return{...s,values:b(l)}})}function Re(e){const i={fonts:U({heading:e.heading_font??void 0,heading2:e.heading_2_font??void 0,heading3:e.heading_3_font??void 0,body:e.body_font??void 0,accent:e.accent_font??void 0,label:e.label_font??void 0}),sizes:ee({headingLarge:e.heading_size_large_px,headingMedium:e.heading_size_medium_px,headingSmall:e.heading_size_small_px,accent:e.accent_size_px,body:e.body_size_px,label:e.label_size_px}),compression:I(e.heading_compression),typography:Se(e)},t=e.text_styles??null,n=Array.isArray(t)?ae(V(t,i),i):i;return{fonts:U(n.fonts),sizes:ee(n.sizes),compression:I(n.compression),typography:n.typography,textStyles:t}}function ae(e,i){const t=m=>e.find(a=>a.id===m)?.values??{},n=t("heading-1"),o=t("heading-2"),r=t("heading-3"),s=t("body-1"),l=t("body-5"),d=i.fonts,c=i.sizes,f=i.typography,u=m=>m==="none"?"sentence":"authored";return{fonts:{...d,heading:n.font??d.heading,heading2:o.font??n.font??d.heading2,heading3:r.font??n.font??d.heading3,body:s.font??d.body,label:l.font??d.label},sizes:{...c,headingLarge:n.size??null,headingMedium:o.size??null,headingSmall:r.size??null,body:s.size??null,label:l.size??null},compression:i.compression,typography:{...f,case:u(n.letterCase),weight:n.weight??null,maxPx:n.largestSize??null,weight2:o.weight??null,weight3:r.weight??null,case2:u(o.letterCase),case3:u(r.letterCase)}}}function Ve(e){const i=N(e.textStyles);if(!i||i.every(o=>Object.keys(o.values).length===0&&!o.auto))return e;const t={fonts:e.fonts??{},sizes:e.sizes??{},compression:String(e.headingCompression??"normal"),typography:e.headingTypography??{}},n=ae(V(i,t),t);return{...e,fonts:n.fonts,sizes:n.sizes,headingCompression:n.compression,headingTypography:n.typography}}function Fe(e){const i=[];for(const t of e){const n=t.values,o=`.${q(t)}`,r=`[${ue}="${t.id}"]`,s=`${o}, ${r}`,l=[],d=n.font!==void 0?ce.find(m=>m.key===n.font)?.cssVar:void 0;if(d&&l.push(`font-family: var(${d})`),n.size!==void 0){const m=n.largestSize!==void 0?Math.min(n.size,n.largestSize):n.size;l.push(`font-size: ${m}px`)}const c=he(n.color);c&&l.push(`color: ${c}`),n.italic===!0&&l.push("font-style: italic"),n.weight!==void 0&&l.push(`font-weight: ${n.weight}`);const f=[];n.lineHeight!==void 0&&f.push(`line-height: ${n.lineHeight}`),n.letterSpacing!==void 0&&f.push(`letter-spacing: ${n.letterSpacing}em`),t.kind==="body"&&l.push(...f);const u=le(n.letterCase);u&&t.kind==="body"&&l.push(`text-transform: ${u}`),n.paragraphSpacing&&l.push(`--sf-part-para: ${n.paragraphSpacing}px`),l.length&&i.push(`${s} { ${l.join("; ")} }`),t.kind==="heading"&&f.length&&i.push(`${s}, ${o}:is(h1, h2, h3, h4), ${r}:is(h1, h2, h3, h4) { ${f.join("; ")} }`),t.kind==="heading"&&u&&i.push(`${r}, ${o}:is(h1, h2, h3, h4) { text-transform: ${u} }`),n.paragraphSpacing&&(i.push(`*:has(> ${r}) { --sf-part-para: ${n.paragraphSpacing}px }`),i.push(...Z(`:is(${s})`,`*:has(> ${r})`))),i.push(...xe(t,s,o,r))}return i.join(`
2
+ `)}function xe(e,i,t,n){const o=e.values,r=C("textSize",o.size,o.sizeTablet,o.sizePhone),s=C("textSize",o.largestSize,o.largestSizeTablet,o.largestSizePhone),l=C("same",o.lineHeight,o.lineHeightTablet,o.lineHeightPhone),d=C("same",o.letterSpacing,o.letterSpacingTablet,o.letterSpacingPhone),c=C("spacing",o.paragraphSpacing,o.paragraphSpacingTablet,o.paragraphSpacingPhone),f=B("textSize",o.size,o.sizeTablet,o.sizePhone,X()),u=ze[e.id],m=[];for(const[a,S]of[["tablet",pe],["phone",de]]){const h=[],p=[],x=f[a],y=s[a],_=r[a]===void 0&&y===void 0||x===void 0?void 0:y===void 0?x:Math.min(x,y);_!==void 0&&p.push(`font-size: ${_}px`);const z=[];l[a]!==void 0&&z.push(`line-height: ${l[a]}`),d[a]!==void 0&&z.push(`letter-spacing: ${d[a]}em`),e.kind==="body"&&p.push(...z),c[a]!==void 0&&p.push(`--sf-part-para: ${c[a]}px`),p.length&&h.push(`${i} { ${p.join("; ")} }`),e.kind==="heading"&&z.length&&h.push(`${i}, ${t}:is(h1, h2, h3, h4), ${n}:is(h1, h2, h3, h4) { ${z.join("; ")} }`),c[a]!==void 0&&h.push(`*:has(> ${n}) { --sf-part-para: ${c[a]}px }`),c[a]!==void 0&&!o.paragraphSpacing&&h.push(...Z(`:is(${i})`,`*:has(> ${n})`)),_!==void 0&&u&&h.push(`.sf-themed-content { --size-${u}: ${_}px !important }`),h.length&&m.push(`@media ${S} { ${h.join(" ")} }`)}return m}const ze={"heading-1":"headingLarge","heading-2":"headingMedium","heading-3":"headingSmall","body-1":"body","body-5":"label"};function De(e){return e!==!0&&e!==!1?"":`em.text-accent { font-style: ${e?"italic":"normal"} }`}function Ke(e){return e?fe[e]:void 0}function ve(e){const i=ge(e);return b({font:e.font,color:e.color===void 0?void 0:Q(e.color),size:e.size,weight:e.weight,italic:e.italic,lineHeight:i.lineHeight,letterSpacing:i.letterSpacingEm,paragraphSpacing:e.paragraphSpacing,letterCase:e.case})}function We(e){return Object.keys(ve(e)).length>0}function Ge({saved:e,old:i,styleId:t,values:n}){const o=ie(e);return{saved:$e(o,t,n),old:i}}function $e(e,i,t){return e.map(n=>n.id===i?R({...n,values:b({...n.values,...t})},n.auto):n)}function Je(e){const i=e.filter(t=>t.kind==="body").map(t=>Number(/^body-(\d+)$/.exec(t.id)?.[1])).filter(t=>Number.isInteger(t)&&t>0);return i.length?`body-${Math.max(...i)}`:"body-1"}export{De as accentItalicCss,Le as applyListChange,Je as eyebrowStyleId,q as faceClassOf,be as fromPanelStyles,We as hasStyleChange,je as listChangePatch,ie as listToWrite,ve as partStyleToTextStyleValues,Ge as pushIntoStyle,V as resolveTextStyles,$e as setStyleValues,Re as siteTextFromRow,Ne as storedTextStyles,Ke as styleIdOfRole,Fe as textStylesCss,te as textStylesFromOld,ae as textStylesToOld,Ve as themeWithTextStyles,Me as toPanelStyles,j as viewSizeOf};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "efficient-web-builder",
3
- "version": "65.0.0",
3
+ "version": "67.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",
@@ -53,8 +53,8 @@
53
53
  },
54
54
  "peerDependencies": {
55
55
  "@tabler/icons-react": "^3.46.0",
56
- "efficient-easel": "^30.1.0",
57
- "efficient-shell": "^12.22.0",
56
+ "efficient-easel": "^34.1.0",
57
+ "efficient-shell": "^12.33.0",
58
58
  "isomorphic-dompurify": "^3.18.0",
59
59
  "next": ">=16",
60
60
  "react": ">=19",
@@ -72,8 +72,8 @@
72
72
  "@types/node": "^20",
73
73
  "@types/react": "^19",
74
74
  "@types/react-dom": "^19",
75
- "efficient-easel": "^30.1.0",
76
- "efficient-shell": "^12.22.0",
75
+ "efficient-easel": "^34.1.0",
76
+ "efficient-shell": "^12.33.0",
77
77
  "esbuild": "^0.28.0",
78
78
  "happy-dom": "^20.14.5",
79
79
  "isomorphic-dompurify": "^3.18.0",
@@ -1,11 +0,0 @@
1
- import type { ReactElement } from "react";
2
- export type TemplateRender = (props: {
3
- value: unknown;
4
- onChange: (v: unknown) => void;
5
- name?: string;
6
- [key: string]: unknown;
7
- }) => ReactElement;
8
- export default function TemplateFieldRow({ render, props }: {
9
- render: TemplateRender;
10
- props: Parameters<TemplateRender>[0];
11
- }): ReactElement<unknown, string | import("react").JSXElementConstructor<any>>;
@@ -1 +0,0 @@
1
- "use client";import{useEasel as c}from"efficient-easel/easel";import{planTemplateRow as p,templateWrite as u}from"../lib/document/template-field.js";import{useSectionOps as r}from"efficient-easel/screen/lib/document/use-section-ops";function s({render:a,props:t}){const{appState:l,config:m}=c(o=>o),i=r(),e=t.name,n=e?p(m,l.data.content??[],l.ui.itemSelector,e):null;return a(!n||!e?t:{...t,value:n.value,onChange:o=>u(n,e,o,i.replaceComponent)})}export{s as default};
@@ -1,8 +0,0 @@
1
- import { type ReactNode } from "react";
2
- export declare const PANEL_NAME_LEVEL = 2;
3
- export declare const FOLD_TOP_LEVEL: number;
4
- export declare function FoldHeadingScope({ tier, children }: {
5
- tier: 1 | 2;
6
- children: ReactNode;
7
- }): import("react").JSX.Element;
8
- export declare function useFoldHeadingLevel(level: 1 | 2): 3 | 4;
@@ -1 +0,0 @@
1
- "use client";import{jsx as n}from"react/jsx-runtime";import{createContext as r,useContext as c}from"react";const i=2,s=i+1,t=r(2);function u({tier:e,children:o}){return n(t.Provider,{value:e,children:o})}function a(e){const o=c(t);return s+Math.max(0,e-o)}export{s as FOLD_TOP_LEVEL,u as FoldHeadingScope,i as PANEL_NAME_LEVEL,a as useFoldHeadingLevel};
@@ -1,13 +0,0 @@
1
- import type { SlotConfigView, TreeItem } from "efficient-easel/draw";
2
- export type TemplateSelector = {
3
- index: number;
4
- zone?: string;
5
- } | null | undefined;
6
- export type TemplatePlan = {
7
- owner: TreeItem;
8
- zone: string;
9
- index: number;
10
- value: unknown;
11
- };
12
- export declare function planTemplateRow(config: SlotConfigView, content: ReadonlyArray<TreeItem>, selector: TemplateSelector, key: string): TemplatePlan | null;
13
- export declare function templateWrite(plan: TemplatePlan, key: string, value: unknown, replaceComponent: (zone: string, index: number, item: TreeItem) => void): void;
@@ -1 +0,0 @@
1
- import{parentOfSelection as i}from"../../../render/lib/document/selection-parent.js";function m(e,o,r,t){const n=i(e,o,r);return n?{owner:n.item,zone:n.zone,index:n.index,value:n.item.props[t]}:null}function u(e,o,r,t){t(e.zone,e.index,{...e.owner,props:{...e.owner.props,[o]:r}})}export{m as planTemplateRow,u as templateWrite};
@@ -1 +0,0 @@
1
- export declare const CANVAS_ACCENT = "var(--es-accent, #2563eb)";
@@ -1 +0,0 @@
1
- const e="var(--es-accent, #2563eb)";export{e as CANVAS_ACCENT};
@@ -1,2 +0,0 @@
1
- import { type RuleReport, type SourceFile } from "./rule.js";
2
- export declare function paddingUnitsDeclared(files: readonly SourceFile[]): RuleReport;
@@ -1,6 +0,0 @@
1
- import{ruleChecks as d}from"./rule.js";const c=/\bboxFieldBuilders\(([^)]*)\)/,l=/\bbuttonFieldSet\(\{([\s\S]*?)\n\}\)/,a=/["']px["']\s*,\s*["']%["']\s*,\s*["']vw["']/;function o(i){const t={binder:!1,button:!1,lists:[]};for(const n of i){if(!/\.tsx?$/.test(n.path))continue;const e=n.text.match(c);e&&/\bpaddingUnits\b/.test(e[1])&&(t.binder=!0);const s=n.text.match(l);s&&/\bpaddingUnits\b/.test(s[1])&&(t.button=!0),a.test(n.text)&&!n.path.includes("source-rules/")&&t.lists.push(n.path)}return t}const u=[{path:"lib/document/box-fields.ts",text:"const rows = boxFieldBuilders(rowSay);"},{path:"lib/document/ButtonBlock.tsx",text:`const b = buttonFieldSet({
2
- say,
3
- })`},{path:"lib/document/row.tsx",text:'const UNITS = ["px", "%", "vw"];'}],r=[{path:"lib/document/box-fields.ts",text:"const rows = boxFieldBuilders(rowSay, { paddingUnits: PADDING_UNITS });"},{path:"lib/document/ButtonBlock.tsx",text:`const b = buttonFieldSet({
4
- paddingUnits: PADDING_UNITS,
5
- say,
6
- })`}];function h(i){const t=d("padding-units-declared: one declaration of the Padding units, and no second list"),n=o(u),e=o(r);t.check("fixture: a binding, a Button set and a list with no declaration are flagged",!n.binder&&!n.button&&n.lists.length===1),t.check("fixture: both declarations pass",e.binder&&e.button&&e.lists.length===0);const s=o(i);return t.check("R1: the builder binding passes paddingUnits",s.binder),t.check("R2: the Button set passes paddingUnits",s.button),t.check(`R3: no file writes the unit list itself${s.lists.length?`: ${s.lists.join(", ")}`:""}`,s.lists.length===0),t.report()}export{h as paddingUnitsDeclared};