efficient-web-builder 67.1.0 → 67.3.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.
- package/CHANGELOG.md +43 -0
- package/dist/editor/components/StorefrontEditor.js +1 -1
- package/dist/editor/components/storefront-editor.css +131 -0
- package/dist/editor/components/useSectionToBoxPass.d.ts +4 -0
- package/dist/editor/components/useSectionToBoxPass.js +1 -1
- package/dist/editor/lib/animation/fields.js +1 -1
- package/dist/editor/lib/animation/hover-fields.d.ts +8 -0
- package/dist/editor/lib/animation/hover-fields.js +1 -1
- package/dist/editor/lib/document/add-palette.js +1 -1
- package/dist/editor/lib/document/add-target.js +1 -1
- package/dist/editor/lib/document/block-offer.js +1 -1
- package/dist/editor/lib/document/blocks/general/Flex/fields.js +1 -1
- package/dist/editor/lib/document/blocks/shared-fields.js +1 -1
- package/dist/editor/lib/document/box-fields.d.ts +1 -1
- package/dist/editor/lib/document/card-display-chips.d.ts +1 -0
- package/dist/editor/lib/document/card-display-chips.js +1 -1
- package/dist/editor/lib/document/controls.js +1 -1
- package/dist/editor/lib/document/field-groups.js +1 -1
- package/dist/editor/lib/document/heading-outline.js +1 -1
- package/dist/editor/lib/document/page-root.js +2 -2
- package/dist/editor/lib/document/slot-new-children.js +1 -1
- package/dist/editor/lib/host-document-bridge.js +1 -1
- package/dist/editor/lib/sections/city-presets.js +1 -1
- package/dist/editor/lib/sections/new-section-node.js +1 -1
- package/dist/editor/lib/sections/section-dry-run.js +2 -2
- package/dist/editor/lib/sections/text-layouts.js +1 -1
- package/dist/format/lib/animation/hover.d.ts +3 -0
- package/dist/format/lib/animation/hover.js +1 -1
- package/dist/format/lib/content/box-layout.js +1 -1
- package/dist/format/lib/content/box-shape.d.ts +1 -1
- package/dist/format/lib/content/container-gap.d.ts +2 -2
- package/dist/format/lib/content/container-gap.js +1 -1
- package/dist/format/lib/content/css-length.d.ts +17 -1
- package/dist/format/lib/content/css-length.js +1 -1
- package/dist/format/lib/content/hover-media.d.ts +6 -1
- package/dist/format/lib/content/hover-media.js +1 -1
- package/dist/format/lib/content/image-treatment.d.ts +3 -0
- package/dist/format/lib/content/image-treatment.js +1 -1
- package/dist/format/lib/content/mirror-cards.js +1 -1
- package/dist/format/lib/content/page-width.d.ts +3 -3
- package/dist/format/lib/content/page-width.js +1 -1
- package/dist/format/lib/content/section-width.js +1 -1
- package/dist/format/lib/document/box-footer.js +1 -1
- package/dist/format/lib/document/container-blocks.js +1 -1
- package/dist/format/lib/document/media-drop.js +1 -1
- package/dist/format/lib/document/part-inks.js +1 -1
- package/dist/format/lib/document/part-records.js +1 -1
- package/dist/format/lib/document/passes/catalogue-labels.js +1 -1
- package/dist/format/lib/document/passes/media-values.js +1 -1
- package/dist/format/lib/document/row-hand.js +1 -1
- package/dist/format/lib/document/section-catalog.js +3 -3
- package/dist/format/lib/document/source-bound-parts.js +1 -1
- package/dist/format/lib/document/templateFields.js +1 -1
- package/dist/format/lib/document/theme-slots.js +1 -1
- package/dist/format/lib/editor-words-catalogue.d.ts +4 -0
- package/dist/format/lib/editor-words-catalogue.js +3 -3
- package/dist/format/lib/editor-words.js +1 -1
- package/dist/format/lib/logo/logo-size.d.ts +5 -0
- package/dist/format/lib/logo/logo-size.js +1 -1
- package/dist/format/lib/own-entry.d.ts +2 -0
- package/dist/format/lib/own-entry.js +1 -0
- package/dist/format/lib/preview-header-settings.d.ts +3 -0
- package/dist/format/lib/sections/active-press-context.js +1 -1
- package/dist/format/lib/sections/hero-single-to-hero.js +1 -1
- package/dist/format/lib/sections/section-eyebrow-look.js +1 -1
- package/dist/format/lib/sections/section-head-placement.js +1 -1
- package/dist/format/lib/sections/section-presets.d.ts +2 -0
- package/dist/format/lib/sections/section-presets.js +1 -1
- package/dist/format/lib/sections/section-text-kinds.js +1 -1
- package/dist/format/lib/sections/section-text-regions.js +1 -1
- package/dist/format/lib/site-theme-row.d.ts +6 -0
- package/dist/format/lib/source-rules/editor-words.js +3 -3
- package/dist/format/lib/source-rules/import-time-work.js +4 -4
- package/dist/format/lib/source-rules/no-hard-coded-option-rows.d.ts +1 -1
- package/dist/format/lib/source-rules/no-hard-coded-option-rows.js +1 -1
- package/dist/format/lib/source-rules/own-key-reads.d.ts +26 -0
- package/dist/format/lib/source-rules/own-key-reads.js +7 -0
- package/dist/format/lib/source-rules/site-square-by-default.js +1 -1
- package/dist/format/lib/theme.d.ts +1 -1
- package/dist/format/lib/theme.js +4 -4
- package/dist/render/components/CardRowContext.d.ts +3 -1
- package/dist/render/components/CardRowContext.js +1 -1
- package/dist/render/components/Flex.d.ts +2 -1
- package/dist/render/components/Flex.js +1 -1
- package/dist/render/components/HoverMediaLayer.d.ts +16 -1
- package/dist/render/components/HoverMediaLayer.js +1 -1
- package/dist/render/components/ImageBlock.d.ts +1 -1
- package/dist/render/components/ImageBlock.js +1 -1
- package/dist/render/components/Logo.d.ts +2 -1
- package/dist/render/components/Logo.js +1 -1
- package/dist/render/components/PictureHoverMove.d.ts +1 -0
- package/dist/render/components/PictureHoverMove.js +1 -1
- package/dist/render/components/PreviewHeaderContext.d.ts +4 -1
- package/dist/render/components/PreviewHeaderContext.js +1 -1
- package/dist/render/lib/content/block-size.d.ts +6 -0
- package/dist/render/lib/content/block-size.js +1 -1
- package/dist/render/lib/document/blocks/general/Flex/render.js +1 -1
- package/dist/render/lib/document/blocks/general/ImageBlock/render.js +1 -1
- package/dist/render/lib/document/blocks/general/section-head-looks.js +2 -2
- package/dist/render/lib/document/blocks/general/section-to-box-row-parts.d.ts +6 -1
- package/dist/render/lib/document/blocks/general/section-to-box-row-parts.js +1 -1
- package/dist/render/lib/document/blocks/general/section-to-box-rows-head.js +1 -1
- package/dist/render/lib/document/blocks/general/section-to-box-rows.js +1 -1
- package/dist/render/lib/document/head-core-boxes.js +1 -1
- package/dist/render/lib/document/migrate-legacy.js +1 -1
- package/dist/render/lib/document/part-styles.js +2 -2
- package/dist/render/lib/document/passes/block-size.js +1 -1
- package/dist/render/lib/document/passes/section-animation.js +1 -1
- package/dist/render/lib/document/passes/section-padding.js +1 -1
- package/dist/render/lib/document/passes/section-width.js +1 -1
- package/dist/render/lib/document/slot-counts.js +1 -1
- package/dist/render/lib/document/slot-specs.js +1 -1
- package/dist/render/lib/sections/section-to-box.d.ts +2 -0
- package/dist/render/lib/sections/section-to-box.js +1 -1
- package/package.json +1 -1
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{textStyleCaseCss as ce,textStyleCaseOfCss as le,viewKeyAt as K}from"efficient-easel/draw";import{FONT_OPTIONS as ue,fontOption as pe,fontRoleOf as w,SIZE_STEP_OF_ROLE as k}from"../../../format/lib/fonts.js";import{encodePartKey as B}from"../../../format/lib/document/part-key.js";import{decodePartId as X,normalizePartText as I}from"./text-parts.js";import{partInkCss as de}from"../../../format/lib/document/part-inks.js";import{regionStyle as ge}from"../../../format/lib/sections/text-regions.js";import{EDGE_PHONE_MEDIA as xe,EDGE_TABLET_MEDIA as he,PHONE_MEDIA as be,TABLET_MEDIA as Se,viewOverrides as me}from"../content/view-values.js";import{plainRecord as F,propsWithPartRecord as Te,readPartRecord as Pe,readPartRecords as ze}from"../../../format/lib/document/part-records.js";import{isLengthUnit as M}from"efficient-easel/screen/lib/content/length-units";import{cssLengthOf as _,storedUnit as _e}from"../../../format/lib/content/css-length.js";const y="_partStyles",Ae="data-sf-part-styled",Y="data-sf-text-style",Re=/^(heading|body)-[1-7]$/;function S(e){return typeof e=="string"&&Re.test(e)}const V={heading:"heading-1",heading2:"heading-2",heading3:"heading-3",body:"body-1",label:"body-5"};function Ee(e){if(!e)return null;for(const[t,n]of Object.entries(V))if(n===e)return t;return null}function Lt(e){if(S(e.textStyle))return e.textStyle;const t=w(e.role);return t?V[t]:void 0}const we=[400,500,600,700],R=["left","center","right","justify"],L=5,D=1e3,Oe=-5,Ne=10,$e=0,ke=64,Ie=2,Z={size:{min:L,max:D,step:1},sizeTablet:{min:L,max:D,step:1},sizePhone:{min:L,max:D,step:1},padding:{min:$e,max:ke,step:Ie}},Fe=.05,Me=.01,ye=["line","letter"],Le=.5,De=2.5,je=-1,He=1,Ue=0,Ce=400,ve=[...new Set(Object.values(k))];function Dt(e){return[`${e} { transition: translate var(--page-motion-hover-duration) var(--page-ease-media) var(--page-motion-hover-delay) }`,`${e}:hover, ${e}:active { translate: 0 calc(-1 * var(--page-hover-lift)) }`]}function jt(e){return ze(e,y)}function q(e,t){return Pe(e,y,t)}function Ht(e,t){return Object.values(q(e,t)).filter(n=>n!==void 0).length}function J(e,t,n){return Te(e,y,t,We(n).length?n:null)}function We(e){return Object.entries(e).filter(([,t])=>t!==void 0)}function Ge(e){return ye.includes(e)}const E=(e,t,n)=>Math.min(n,Math.max(t,e)),Ke=["sizeUnit","sizeUnitTablet","sizeUnitPhone"];function j(e){const t=K("sizeUnit",e),n=Ke.find(o=>o===t);if(!n)throw new Error(`a part stores no unit key ${t}`);return n}const m={size:j("desktop"),sizeTablet:j("tablet"),sizePhone:j("mobile"),paragraphSpacing:"paragraphSpacingUnit",padding:"paddingUnit"},Q=Object.values(m);function h(e,t){return _e(e[m[t]])}function Be(e,t,n={}){if(Q.includes(e))return M(t)&&t!=="px"?t:null;if(Object.hasOwn(m,e)&&h(n,e)!=="px"){const o=P(Number(t),2);return!Number.isFinite(o)||o<0||o===0&&e!=="padding"?null:o}if(Ge(e)){const o=Math.round(Number(t));return!Number.isFinite(o)||o===0?null:E(o,Oe,Ne)}if(e==="lineHeight"){const o=Number(t);return Number.isFinite(o)?P(E(o,Le,De),3):null}if(e==="letterSpacing"){const o=Number(t);return Number.isFinite(o)?P(E(o,je,He),4):null}if(e==="paragraphSpacing"){const o=Math.round(Number(t));return!Number.isFinite(o)||o<=0?null:E(o,Ue,Ce)}if(Object.hasOwn(Z,e)){const{min:o,max:i}=Z[e],r=Math.round(Number(t));return Number.isFinite(r)?E(r,o,i):null}return e==="italic"?typeof t=="boolean"?t:null:e==="role"||e==="fontRole"?w(t)?t:null:e==="sizeToken"?H(t)?t:null:e==="textStyle"?S(t)?t:null:e==="alignPhone"||e==="alignTablet"?R.includes(t)?t:null:t}const Xe=["weight","size","sizeTablet","sizePhone","line","letter","lineHeight","letterSpacing","paragraphSpacing","padding"];function A(e){let t=null;const n=o=>{t??={...e},delete t[o]};for(const o of Xe){const i=e[o];i!==void 0&&!(typeof i=="number"&&Number.isFinite(i))&&n(o)}e.align!==void 0&&!R.includes(e.align)&&n("align"),e.alignTablet!==void 0&&!R.includes(e.alignTablet)&&n("alignTablet"),e.alignPhone!==void 0&&!R.includes(e.alignPhone)&&n("alignPhone"),e.textStyle!==void 0&&!S(e.textStyle)&&n("textStyle"),e.sizeToken!==void 0&&!H(e.sizeToken)&&n("sizeToken"),e.fontRole!==void 0&&!w(e.fontRole)&&n("fontRole");for(const o of Q)e[o]!==void 0&&!M(e[o])&&n(o);return t??e}function H(e){if(!e||typeof e!="object")return!1;const{step:t,px:n,stepPhone:o,pxPhone:i,fluid:r}=e,c=l=>typeof l=="number"&&Number.isFinite(l)&&l>0,a=l=>typeof l=="string"&&ve.includes(l);return a(t)&&c(n)&&(o===void 0||a(o))&&(i===void 0||c(i))&&(r===void 0||Ye(r,n))}function Ye(e,t){if(!e||typeof e!="object"||Array.isArray(e))return!1;const{minPx:n,vw:o,...i}=e;return Object.keys(i).length===0&&typeof n=="number"&&Number.isFinite(n)&&n>0&&n<t&&typeof o=="number"&&Number.isFinite(o)&&o>0&&o<=100}function U(e){return e?.pxPhone&&H(e)?{step:e.stepPhone??e.step,px:e.pxPhone}:null}function ee({step:e,px:t,fluid:n}){const o=n?`clamp(${n.minPx}px, ${n.vw}vw, ${t}px)`:`${t}px`,i=`var(--size-${e}, ${o})`;return e.startsWith("heading")?`min(${i}, var(--sf-heading-max,9999px))`:i}const Ve=[["font","role"],["font","fontRole"],["role","textStyle"],["line","lineHeight"],["letter","letterSpacing"]];function Ze(e){const t=[];for(const[n,o]of Ve)n===e?t.push(o):o===e&&t.push(n);return t}function Ut(e,t,n,o){const i={...q(e,t)},r=o==null?null:Be(n,o,i);if(r===null)delete i[n];else{i[n]=r;for(const c of Ze(n))delete i[c]}return J(e,t,i)}function Ct(e,t){return J(e,t,{})}function qe(e){return le(e)??"none"}function Je(e){return ce(e)??""}const te={heading:"--font-role-heading",heading2:"--font-role-heading2",heading3:"--font-role-heading3",body:"--font-role-body",accent:"--font-role-accent",label:"--font-role-label"};function Qe(e,t){const n=w(e.role);return n||(t?.blockDrawsStyle?null:Ee(e.textStyle))}function vt(e,t){return e==="Text"&&t==="text"}const et={headingLarge:"min(clamp(64px,9vw,144px), var(--sf-heading-max,9999px))",headingMedium:"min(32px, var(--sf-heading-max,9999px))",headingSmall:"min(24px, var(--sf-heading-max,9999px))",accent:"32px",body:"14px",label:"12px"};function tt(e){const t=k[e],n=et[t];return n?`var(--size-${t}, ${n})`:`var(--size-${t})`}function nt(e){const t={};return typeof e.lineHeight=="number"?t.lineHeight=e.lineHeight:e.line&&(t.lineHeight=P(ot+e.line*Fe,3)),typeof e.letterSpacing=="number"?t.letterSpacingEm=e.letterSpacing:e.letter&&(t.letterSpacingEm=P(e.letter*Me,4)),t}const ot=1,T="--sf-part-para";function it(e){e=A(e);const t={};if(typeof e.sizePhone=="number"&&e.sizePhone>0)t.fontSize=_(e.sizePhone,h(e,"sizePhone"));else{const o=U(e.sizeToken);if(o)t.fontSize=ee(o);else{const i=N(e);i!==void 0&&(t.fontSize=_(i,h(e,"sizeTablet")))}}const n=e.alignPhone??O(e);return n&&(t.textAlign=n),t}function O(e){return e.alignTablet&&e.alignTablet!==e.align?e.alignTablet:void 0}function N(e){const n=e.sizeTablet!==void 0&&h(e,"sizeTablet")!==h(e,"size")?e.sizeTablet:me("textSize",e.size,e.sizeTablet,void 0).tablet;return n&&n>0?n:void 0}function rt(e){const t=A(e),n={},o=N(t);o!==void 0&&(n.fontSize=_(o,h(t,"sizeTablet")));const i=O(t);return i&&(n.textAlign=i),n}function Wt(e,t){if(t==="desktop")return;const n=A(e);return(t==="mobile"?O(n):void 0)??n.align}function at(e,t){if(t==="desktop")return e;const n=A(e),o=N(n),i=O(n);if(t==="tablet"){let a=e;return o!==void 0&&(a={...a,size:o,sizeUnit:n[m.sizeTablet]}),i&&(a={...a,align:i}),a}let r=e;if(typeof n.sizePhone=="number"&&n.sizePhone>0)r={...r,size:n.sizePhone,sizeUnit:n[m.sizePhone]};else{const a=U(n.sizeToken);a?r={...r,size:void 0,sizeToken:a}:o!==void 0&&(r={...r,size:o,sizeUnit:n[m.sizeTablet]})}const c=n.alignPhone??i;return c&&(r={...r,align:c}),r}function C(e,t,n){return v(at(e,t),$,n)}function st(e){return K("size",e)}function Gt(e,t){if(t==="desktop")return null;const n=A(e);if(t==="mobile"){if(U(n.sizeToken))return null;const o=N(n);if(o!==void 0)return{px:o,view:"tablet"}}return typeof n.size=="number"&&n.size>0?{px:n.size,view:"desktop"}:null}function ne(e,t){const n=st(t);if(!Object.hasOwn(e,n))return e;const o={...e};return delete o[n],o}function Kt(e,t,n){const o=C(ne(e,t),t,n);return{fontFamily:o.fontFamily,fontSize:o.fontSize}}function v(e,t,n){e=A(e);const o=Qe(e,n),i=nt(e),r=e.size?_(e.size,h(e,"size")):e.sizeToken?ee(e.sizeToken):o?tt(o):"";return{fontFamily:e.font?ut(e.font):e.fontRole?`var(${te[e.fontRole]})`:o?`var(${te[o]})`:"",fontWeight:e.weight?String(e.weight):"",fontSize:r,minWidth:r?"0":"",overflowWrap:r?"break-word":"",lineHeight:i.lineHeight!==void 0?String(i.lineHeight):"",letterSpacing:i.letterSpacingEm!==void 0?`${i.letterSpacingEm}em`:"",[T]:e.paragraphSpacing?_(e.paragraphSpacing,h(e,"paragraphSpacing")):"",textTransform:Je(e.case),textAlign:e.align??"",paddingTop:oe(e.padding,h(e,"padding")),paddingBottom:oe(e.padding,h(e,"padding")),color:ft(e.color),fontStyle:e.italic===!0?"italic":e.italic===!1?"normal":""}}const ft=e=>de(e),oe=(e,t)=>e===void 0?"":_(e,t),P=(e,t)=>Number(e.toFixed(t));function Bt(e,t){const n=Number.parseFloat(e.fontSize)||16,o=Number.parseFloat(e.lineHeight),i=Number.parseFloat(e.letterSpacing),r=Number.parseFloat(e.paddingTop);return{fontKey:t,sizePx:n,weight:ct(Number.parseInt(e.fontWeight,10)),lineRatio:Number.isFinite(o)?P(o/n,3):1.2,letterEm:Number.isFinite(i)?P(i/n,4):0,align:lt(e.textAlign),case:qe(e.textTransform),paddingPx:Number.isFinite(r)?Math.round(r):0}}function ct(e){return Number.isFinite(e)?we.reduce((t,n)=>Math.abs(n-e)<Math.abs(t-e)?n:t):400}function lt(e){for(const t of R)if(t===e)return t;return e==="end"?"right":"left"}function Xt(e,t){const n=ie(e);if(!n)return"";for(const o of ue)if(ie(t(o.cssVar))===n)return o.key;return""}const ie=e=>(e.split(",")[0]??"").replace(/["']/g,"").replace(/\s+/g," ").trim().toLowerCase();function ut(e){const t=pe(e);return t?`var(${t.cssVar})`:""}function Yt(e,t,n,o){return!t||X(t)?.nodeId!==e?null:n.find(r=>o(r.getAttribute("class")))??n[0]??null}function pt(e,t){return Object.hasOwn(e,t)?F(e[t])??{}:{}}function Vt(e,t,n=()=>$,o=a=>a,i=xt,r="desktop",c=()=>!1){let a=0;for(const{element:l,partId:b}of e){const g=X(b)?.propKey;if(!g)continue;const s=pt(t,o(g)),f=C(s,r,{blockDrawsStyle:c(g)});S(s.textStyle)?l.setAttribute?.(Y,s.textStyle):l.removeAttribute?.(Y);const d=G.some(x=>l.style[x]);let p=!1;for(const[x,u]of Object.entries(f))St(l,x,u),u&&(p=!0);if(d||G.some(x=>f[x]))for(const x of dt(l,i))for(const u of G)x.style[u]=f[u]??"";p&&(a+=1)}return a}function dt(e,t){const n=I(e.textContent??""),o=[];let i=e;for(let r=0;r<gt&&t(i);r+=1){const c=i.parentElement;if(!c||I(c.textContent??"")!==n)break;o.push(c),i=c}return o}const gt=8;function xt(e){const t=e;return typeof window>"u"||!t?.ownerDocument?!1:window.getComputedStyle(t).display==="inline"}const $={fontKey:"",sizePx:16,weight:400,lineRatio:1,letterEm:0,align:"left",case:"none",paddingPx:0};function ht(e){if(!e||typeof e!="object")return null;const t={};S(e.textStyle)&&(t.textStyle=e.textStyle),typeof e.size=="number"&&e.size>0&&(t.size=e.size),typeof e.sizeTablet=="number"&&e.sizeTablet>0&&(t.sizeTablet=e.sizeTablet),typeof e.sizePhone=="number"&&e.sizePhone>0&&(t.sizePhone=e.sizePhone);for(const n of["size","sizeTablet","sizePhone"]){const o=m[n];t[n]!==void 0&&M(e[o])&&(t[o]=e[o])}return Object.keys(t).length?t:null}function bt(e,t){const n=ht(e);if(!n)return{};const o=C(n,t);return{...o.fontFamily?{fontFamily:o.fontFamily}:{},...o.fontSize?{fontSize:o.fontSize}:{}}}function Zt(e){return S(e?.textStyle)||!!e?.role||typeof e?.size=="number"&&e.size>0}function qt(e,t,n){if(!e||typeof e!="object")return{};const o=ge(e.role,t,k)??{},i=t.sized?bt(ne(e,n),n):{};return{...o,...i}}function Jt(e,t,n){n.fontFamily&&e.fontFamily===n.fontFamily&&(e.fontFamily=t.fontFamily),n.fontSize&&e.fontSize===n.fontSize&&(e.fontSize=t.fontSize)}function St(e,t,n){if(!t.startsWith("--")){e.style[t]=n;return}const o=e.style;typeof o.setProperty=="function"?n?o.setProperty(t,n):o.removeProperty?.(t):o[t]=n;const i=e;t===T&&(n?i.setAttribute?.(re,""):i.removeAttribute?.(re))}const re="data-sf-part-para",mt=Object.keys(v({},$)),W=new Set(["color","overflowWrap",T,"fontStyle"]),G=mt.filter(e=>!W.has(e));function Qt(e,t,n,o=a=>a,i=()=>!1,r=()=>null,c=[]){const a=new Map;for(const s of e){const f=B(s.key,s.row);for(const d of s.texts){const p=a.get(d);p?(p.keys.add(s.key),p.partKeys.add(f)):a.set(d,{keys:new Set([s.key]),partKeys:new Set([f])})}}const l=new Map;for(const s of new Set([...Object.keys(t),...c])){if(!Tt(s))continue;const f=ae(n,s,F(t[s])??{},!1,r(s));f&&l.set(s,f)}const b=s=>{const f=o(s),d=r(f);if(!Object.hasOwn(t,f)&&!d)return null;const p=F(t[f])??{};return ae(n,s,p,i(s),d)},g=new Map;for(const[s,{keys:f,partKeys:d}]of a){const p=d.size===1?[...d][0]:f.size===1?[...f][0]:null;if(!p)continue;const z=b(p);z&&g.set(s,z)}for(const s of e){if(!s.keyed)continue;const f=b(B(s.key,s.row));f&&l.set(s.key,f)}return g.size||l.size?{rules:g,kindRules:l,drawn:new Set(a.keys())}:null}function ae(e,t,n,o,i){const r=v(n,$,{blockDrawsStyle:o}),c=rt(n),a=it(n),l=S(n.textStyle)?n.textStyle:void 0;return!Object.values(r).some(Boolean)&&!Object.keys(c).length&&!Object.keys(a).length&&!l&&!i?null:{stamp:Pt(e,t),declarations:r,...Object.keys(c).length?{tablet:c}:{},...Object.keys(a).length?{phone:a}:{},...l?{textStyle:l}:{},...i?{motion:i}:{}}}function Tt(e){return e.startsWith("@")}function en(e,t){return e?.kindRules.get(t)??null}function Pt(e,t){const n=o=>o.replace(/[^A-Za-z0-9_-]+/g,"-");return`${n(e)}~${n(t)}`}function zt(e){return e?{tablet:he,phone:xe}:{tablet:Se,phone:be}}function tn(e,{inBox:t=!1}={}){const{tablet:n,phone:o}=zt(t),i=[],r=new Set,c=a=>{const{stamp:l,declarations:b}=a;if(r.has(l))return;r.add(l);const g=Object.entries(b).filter(([,u])=>u!==""),s=u=>u.map(([se,fe])=>`${At(se)}: ${fe}`).join("; "),f=`[${Ae}="${l}"]`,d=g.filter(([u])=>!W.has(u)),p=g.filter(([u])=>W.has(u));d.length&&i.push(`${f}, *:has(> ${f}) { ${s(d)} }`),p.length&&i.push(`${f} { ${s(p)} }`),b[T]&&(i.push(`*:has(> ${f}) { ${T}: ${b[T]} }`),i.push(..._t(f,`*:has(> ${f})`)));const z=Object.entries(a.tablet??{}).filter(([,u])=>u!=="");z.length&&i.push(`@media ${n} { ${f}, *:has(> ${f}) { ${s(z)} } }`);const x=Object.entries(a.phone??{}).filter(([,u])=>u!=="");x.length&&i.push(`@media ${o} { ${f}, *:has(> ${f}) { ${s(x)} } }`)};for(const a of e.rules.values())c(a);for(const a of e.kindRules.values())c(a);return i.join(`
|
|
2
|
-
`)}function
|
|
1
|
+
import{textStyleCaseCss as ut,textStyleCaseOfCss as pt,viewKeyAt as B}from"efficient-easel/draw";import{FONT_OPTIONS as dt,fontOption as gt,fontRoleOf as w,SIZE_STEP_OF_ROLE as I}from"../../../format/lib/fonts.js";import{encodePartKey as X}from"../../../format/lib/document/part-key.js";import{decodePartId as Y,normalizePartText as F}from"./text-parts.js";import{partInkCss as xt}from"../../../format/lib/document/part-inks.js";import{regionStyle as ht}from"../../../format/lib/sections/text-regions.js";import{EDGE_PHONE_MEDIA as St,EDGE_TABLET_MEDIA as bt,PHONE_MEDIA as mt,TABLET_MEDIA as Tt,viewOverrides as Pt}from"../content/view-values.js";import{plainRecord as y,propsWithPartRecord as zt,readPartRecord as _t,readPartRecords as At}from"../../../format/lib/document/part-records.js";import{isLengthUnit as M}from"efficient-easel/screen/lib/content/length-units";import{cssLengthOf as _,storedUnit as Rt}from"../../../format/lib/content/css-length.js";import{hasOwnEntry as N,ownEntry as V}from"../../../format/lib/own-entry.js";const L="_partStyles",Et="data-sf-part-styled",Z="data-sf-text-style",wt=/^(heading|body)-[1-7]$/;function b(t){return typeof t=="string"&&wt.test(t)}const q={heading:"heading-1",heading2:"heading-2",heading3:"heading-3",body:"body-1",label:"body-5"};function Nt(t){if(!t)return null;for(const[e,n]of Object.entries(q))if(n===t)return e;return null}function Ue(t){if(b(t.textStyle))return t.textStyle;const e=w(t.role);return e?q[e]:void 0}const Ot=[400,500,600,700],R=["left","center","right","justify"],D=5,H=1e3,$t=-5,kt=10,It=0,Ft=64,yt=2,J={size:{min:D,max:H,step:1},sizeTablet:{min:D,max:H,step:1},sizePhone:{min:D,max:H,step:1},padding:{min:It,max:Ft,step:yt}},Mt=.05,Lt=.01,Dt=["line","letter"],Ht=.5,Ut=2.5,jt=-1,Ct=1,vt=0,Kt=400,Wt=[...new Set(Object.values(I))];function je(t){return[`${t} { transition: translate var(--page-motion-hover-duration) var(--page-ease-media) var(--page-motion-hover-delay) }`,`${t}:hover, ${t}:active { translate: 0 calc(-1 * var(--page-hover-lift)) }`]}function Ce(t){return At(t,L)}function Q(t,e){return _t(t,L,e)}function ve(t,e){return Object.values(Q(t,e)).filter(n=>n!==void 0).length}function tt(t,e,n){return zt(t,L,e,Gt(n).length?n:null)}function Gt(t){return Object.entries(t).filter(([,e])=>e!==void 0)}function Bt(t){return Dt.includes(t)}const E=(t,e,n)=>Math.min(n,Math.max(e,t)),Xt=["sizeUnit","sizeUnitTablet","sizeUnitPhone"];function U(t){const e=B("sizeUnit",t),n=Xt.find(o=>o===e);if(!n)throw new Error(`a part stores no unit key ${e}`);return n}const m={size:U("desktop"),sizeTablet:U("tablet"),sizePhone:U("mobile"),paragraphSpacing:"paragraphSpacingUnit",padding:"paddingUnit"},et=Object.values(m);function h(t,e){return Rt(t[m[e]])}function Yt(t,e,n={}){if(et.includes(t))return M(e)&&e!=="px"?e:null;if(N(m,t)&&h(n,t)!=="px"){const o=P(Number(e),2);return!Number.isFinite(o)||o<0||o===0&&t!=="padding"?null:o}if(Bt(t)){const o=Math.round(Number(e));return!Number.isFinite(o)||o===0?null:E(o,$t,kt)}if(t==="lineHeight"){const o=Number(e);return Number.isFinite(o)?P(E(o,Ht,Ut),3):null}if(t==="letterSpacing"){const o=Number(e);return Number.isFinite(o)?P(E(o,jt,Ct),4):null}if(t==="paragraphSpacing"){const o=Math.round(Number(e));return!Number.isFinite(o)||o<=0?null:E(o,vt,Kt)}if(N(J,t)){const{min:o,max:i}=J[t],r=Math.round(Number(e));return Number.isFinite(r)?E(r,o,i):null}return t==="italic"?typeof e=="boolean"?e:null:t==="role"||t==="fontRole"?w(e)?e:null:t==="sizeToken"?j(e)?e:null:t==="textStyle"?b(e)?e:null:t==="alignPhone"||t==="alignTablet"?R.includes(e)?e:null:e}const Vt=["weight","size","sizeTablet","sizePhone","line","letter","lineHeight","letterSpacing","paragraphSpacing","padding"];function A(t){let e=null;const n=o=>{e??={...t},delete e[o]};for(const o of Vt){const i=t[o];i!==void 0&&!(typeof i=="number"&&Number.isFinite(i))&&n(o)}t.align!==void 0&&!R.includes(t.align)&&n("align"),t.alignTablet!==void 0&&!R.includes(t.alignTablet)&&n("alignTablet"),t.alignPhone!==void 0&&!R.includes(t.alignPhone)&&n("alignPhone"),t.textStyle!==void 0&&!b(t.textStyle)&&n("textStyle"),t.sizeToken!==void 0&&!j(t.sizeToken)&&n("sizeToken"),t.fontRole!==void 0&&!w(t.fontRole)&&n("fontRole");for(const o of et)t[o]!==void 0&&!M(t[o])&&n(o);return e??t}function j(t){if(!t||typeof t!="object")return!1;const{step:e,px:n,stepPhone:o,pxPhone:i,fluid:r}=t,c=l=>typeof l=="number"&&Number.isFinite(l)&&l>0,a=l=>typeof l=="string"&&Wt.includes(l);return a(e)&&c(n)&&(o===void 0||a(o))&&(i===void 0||c(i))&&(r===void 0||Zt(r,n))}function Zt(t,e){if(!t||typeof t!="object"||Array.isArray(t))return!1;const{minPx:n,vw:o,...i}=t;return Object.keys(i).length===0&&typeof n=="number"&&Number.isFinite(n)&&n>0&&n<e&&typeof o=="number"&&Number.isFinite(o)&&o>0&&o<=100}function C(t){return t?.pxPhone&&j(t)?{step:t.stepPhone??t.step,px:t.pxPhone}:null}function nt({step:t,px:e,fluid:n}){const o=n?`clamp(${n.minPx}px, ${n.vw}vw, ${e}px)`:`${e}px`,i=`var(--size-${t}, ${o})`;return t.startsWith("heading")?`min(${i}, var(--sf-heading-max,9999px))`:i}const qt=[["font","role"],["font","fontRole"],["role","textStyle"],["line","lineHeight"],["letter","letterSpacing"]];function Jt(t){const e=[];for(const[n,o]of qt)n===t?e.push(o):o===t&&e.push(n);return e}function Ke(t,e,n,o){const i={...Q(t,e)},r=o==null?null:Yt(n,o,i);if(r===null)delete i[n];else{i[n]=r;for(const c of Jt(n))delete i[c]}return tt(t,e,i)}function We(t,e){return tt(t,e,{})}function Qt(t){return pt(t)??"none"}function te(t){return ut(t)??""}const ot={heading:"--font-role-heading",heading2:"--font-role-heading2",heading3:"--font-role-heading3",body:"--font-role-body",accent:"--font-role-accent",label:"--font-role-label"};function ee(t,e){const n=w(t.role);return n||(e?.blockDrawsStyle?null:Nt(t.textStyle))}function Ge(t,e){return t==="Text"&&e==="text"}const ne={headingLarge:"min(clamp(64px,9vw,144px), var(--sf-heading-max,9999px))",headingMedium:"min(32px, var(--sf-heading-max,9999px))",headingSmall:"min(24px, var(--sf-heading-max,9999px))",accent:"32px",body:"14px",label:"12px"};function oe(t){const e=I[t],n=V(ne,e);return n?`var(--size-${e}, ${n})`:`var(--size-${e})`}function ie(t){const e={};return typeof t.lineHeight=="number"?e.lineHeight=t.lineHeight:t.line&&(e.lineHeight=P(re+t.line*Mt,3)),typeof t.letterSpacing=="number"?e.letterSpacingEm=t.letterSpacing:t.letter&&(e.letterSpacingEm=P(t.letter*Lt,4)),e}const re=1,T="--sf-part-para";function ae(t){t=A(t);const e={};if(typeof t.sizePhone=="number"&&t.sizePhone>0)e.fontSize=_(t.sizePhone,h(t,"sizePhone"));else{const o=C(t.sizeToken);if(o)e.fontSize=nt(o);else{const i=$(t);i!==void 0&&(e.fontSize=_(i,h(t,"sizeTablet")))}}const n=t.alignPhone??O(t);return n&&(e.textAlign=n),e}function O(t){return t.alignTablet&&t.alignTablet!==t.align?t.alignTablet:void 0}function $(t){const n=t.sizeTablet!==void 0&&h(t,"sizeTablet")!==h(t,"size")?t.sizeTablet:Pt("textSize",t.size,t.sizeTablet,void 0).tablet;return n&&n>0?n:void 0}function se(t){const e=A(t),n={},o=$(e);o!==void 0&&(n.fontSize=_(o,h(e,"sizeTablet")));const i=O(e);return i&&(n.textAlign=i),n}function Be(t,e){if(e==="desktop")return;const n=A(t);return(e==="mobile"?O(n):void 0)??n.align}function fe(t,e){if(e==="desktop")return t;const n=A(t),o=$(n),i=O(n);if(e==="tablet"){let a=t;return o!==void 0&&(a={...a,size:o,sizeUnit:n[m.sizeTablet]}),i&&(a={...a,align:i}),a}let r=t;if(typeof n.sizePhone=="number"&&n.sizePhone>0)r={...r,size:n.sizePhone,sizeUnit:n[m.sizePhone]};else{const a=C(n.sizeToken);a?r={...r,size:void 0,sizeToken:a}:o!==void 0&&(r={...r,size:o,sizeUnit:n[m.sizeTablet]})}const c=n.alignPhone??i;return c&&(r={...r,align:c}),r}function v(t,e,n){return K(fe(t,e),k,n)}function ce(t){return B("size",t)}function Xe(t,e){if(e==="desktop")return null;const n=A(t);if(e==="mobile"){if(C(n.sizeToken))return null;const o=$(n);if(o!==void 0)return{px:o,view:"tablet"}}return typeof n.size=="number"&&n.size>0?{px:n.size,view:"desktop"}:null}function it(t,e){const n=ce(e);if(!N(t,n))return t;const o={...t};return delete o[n],o}function Ye(t,e,n){const o=v(it(t,e),e,n);return{fontFamily:o.fontFamily,fontSize:o.fontSize}}function K(t,e,n){t=A(t);const o=ee(t,n),i=ie(t),r=t.size?_(t.size,h(t,"size")):t.sizeToken?nt(t.sizeToken):o?oe(o):"";return{fontFamily:t.font?de(t.font):t.fontRole?`var(${ot[t.fontRole]})`:o?`var(${ot[o]})`:"",fontWeight:t.weight?String(t.weight):"",fontSize:r,minWidth:r?"0":"",overflowWrap:r?"break-word":"",lineHeight:i.lineHeight!==void 0?String(i.lineHeight):"",letterSpacing:i.letterSpacingEm!==void 0?`${i.letterSpacingEm}em`:"",[T]:t.paragraphSpacing?_(t.paragraphSpacing,h(t,"paragraphSpacing")):"",textTransform:te(t.case),textAlign:t.align??"",paddingTop:rt(t.padding,h(t,"padding")),paddingBottom:rt(t.padding,h(t,"padding")),color:le(t.color),fontStyle:t.italic===!0?"italic":t.italic===!1?"normal":""}}const le=t=>xt(t),rt=(t,e)=>t===void 0?"":_(t,e),P=(t,e)=>Number(t.toFixed(e));function Ve(t,e){const n=Number.parseFloat(t.fontSize)||16,o=Number.parseFloat(t.lineHeight),i=Number.parseFloat(t.letterSpacing),r=Number.parseFloat(t.paddingTop);return{fontKey:e,sizePx:n,weight:ue(Number.parseInt(t.fontWeight,10)),lineRatio:Number.isFinite(o)?P(o/n,3):1.2,letterEm:Number.isFinite(i)?P(i/n,4):0,align:pe(t.textAlign),case:Qt(t.textTransform),paddingPx:Number.isFinite(r)?Math.round(r):0}}function ue(t){return Number.isFinite(t)?Ot.reduce((e,n)=>Math.abs(n-t)<Math.abs(e-t)?n:e):400}function pe(t){for(const e of R)if(e===t)return e;return t==="end"?"right":"left"}function Ze(t,e){const n=at(t);if(!n)return"";for(const o of dt)if(at(e(o.cssVar))===n)return o.key;return""}const at=t=>(t.split(",")[0]??"").replace(/["']/g,"").replace(/\s+/g," ").trim().toLowerCase();function de(t){const e=gt(t);return e?`var(${e.cssVar})`:""}function qe(t,e,n,o){return!e||Y(e)?.nodeId!==t?null:n.find(r=>o(r.getAttribute("class")))??n[0]??null}function ge(t,e){return y(V(t,e))??{}}function Je(t,e,n=()=>k,o=a=>a,i=Se,r="desktop",c=()=>!1){let a=0;for(const{element:l,partId:S}of t){const g=Y(S)?.propKey;if(!g)continue;const s=ge(e,o(g)),f=v(s,r,{blockDrawsStyle:c(g)});b(s.textStyle)?l.setAttribute?.(Z,s.textStyle):l.removeAttribute?.(Z);const d=G.some(x=>l.style[x]);let p=!1;for(const[x,u]of Object.entries(f))Te(l,x,u),u&&(p=!0);if(d||G.some(x=>f[x]))for(const x of xe(l,i))for(const u of G)x.style[u]=f[u]??"";p&&(a+=1)}return a}function xe(t,e){const n=F(t.textContent??""),o=[];let i=t;for(let r=0;r<he&&e(i);r+=1){const c=i.parentElement;if(!c||F(c.textContent??"")!==n)break;o.push(c),i=c}return o}const he=8;function Se(t){const e=t;return typeof window>"u"||!e?.ownerDocument?!1:window.getComputedStyle(e).display==="inline"}const k={fontKey:"",sizePx:16,weight:400,lineRatio:1,letterEm:0,align:"left",case:"none",paddingPx:0};function be(t){if(!t||typeof t!="object")return null;const e={};b(t.textStyle)&&(e.textStyle=t.textStyle),typeof t.size=="number"&&t.size>0&&(e.size=t.size),typeof t.sizeTablet=="number"&&t.sizeTablet>0&&(e.sizeTablet=t.sizeTablet),typeof t.sizePhone=="number"&&t.sizePhone>0&&(e.sizePhone=t.sizePhone);for(const n of["size","sizeTablet","sizePhone"]){const o=m[n];e[n]!==void 0&&M(t[o])&&(e[o]=t[o])}return Object.keys(e).length?e:null}function me(t,e){const n=be(t);if(!n)return{};const o=v(n,e);return{...o.fontFamily?{fontFamily:o.fontFamily}:{},...o.fontSize?{fontSize:o.fontSize}:{}}}function Qe(t){return b(t?.textStyle)||!!t?.role||typeof t?.size=="number"&&t.size>0}function tn(t,e,n){if(!t||typeof t!="object")return{};const o=ht(t.role,e,I)??{},i=e.sized?me(it(t,n),n):{};return{...o,...i}}function en(t,e,n){n.fontFamily&&t.fontFamily===n.fontFamily&&(t.fontFamily=e.fontFamily),n.fontSize&&t.fontSize===n.fontSize&&(t.fontSize=e.fontSize)}function Te(t,e,n){if(!e.startsWith("--")){t.style[e]=n;return}const o=t.style;typeof o.setProperty=="function"?n?o.setProperty(e,n):o.removeProperty?.(e):o[e]=n;const i=t;e===T&&(n?i.setAttribute?.(st,""):i.removeAttribute?.(st))}const st="data-sf-part-para",Pe=Object.keys(K({},k)),W=new Set(["color","overflowWrap",T,"fontStyle"]),G=Pe.filter(t=>!W.has(t));function nn(t,e,n,o=a=>a,i=()=>!1,r=()=>null,c=[]){const a=new Map;for(const s of t){const f=X(s.key,s.row);for(const d of s.texts){const p=a.get(d);p?(p.keys.add(s.key),p.partKeys.add(f)):a.set(d,{keys:new Set([s.key]),partKeys:new Set([f])})}}const l=new Map;for(const s of new Set([...Object.keys(e),...c])){if(!ze(s))continue;const f=ft(n,s,y(e[s])??{},!1,r(s));f&&l.set(s,f)}const S=s=>{const f=o(s),d=r(f);if(!N(e,f)&&!d)return null;const p=y(e[f])??{};return ft(n,s,p,i(s),d)},g=new Map;for(const[s,{keys:f,partKeys:d}]of a){const p=d.size===1?[...d][0]:f.size===1?[...f][0]:null;if(!p)continue;const z=S(p);z&&g.set(s,z)}for(const s of t){if(!s.keyed)continue;const f=S(X(s.key,s.row));f&&l.set(s.key,f)}return g.size||l.size?{rules:g,kindRules:l,drawn:new Set(a.keys())}:null}function ft(t,e,n,o,i){const r=K(n,k,{blockDrawsStyle:o}),c=se(n),a=ae(n),l=b(n.textStyle)?n.textStyle:void 0;return!Object.values(r).some(Boolean)&&!Object.keys(c).length&&!Object.keys(a).length&&!l&&!i?null:{stamp:_e(t,e),declarations:r,...Object.keys(c).length?{tablet:c}:{},...Object.keys(a).length?{phone:a}:{},...l?{textStyle:l}:{},...i?{motion:i}:{}}}function ze(t){return t.startsWith("@")}function on(t,e){return t?.kindRules.get(e)??null}function _e(t,e){const n=o=>o.replace(/[^A-Za-z0-9_-]+/g,"-");return`${n(t)}~${n(e)}`}function Ae(t){return t?{tablet:bt,phone:St}:{tablet:Tt,phone:mt}}function rn(t,{inBox:e=!1}={}){const{tablet:n,phone:o}=Ae(e),i=[],r=new Set,c=a=>{const{stamp:l,declarations:S}=a;if(r.has(l))return;r.add(l);const g=Object.entries(S).filter(([,u])=>u!==""),s=u=>u.map(([ct,lt])=>`${Ee(ct)}: ${lt}`).join("; "),f=`[${Et}="${l}"]`,d=g.filter(([u])=>!W.has(u)),p=g.filter(([u])=>W.has(u));d.length&&i.push(`${f}, *:has(> ${f}) { ${s(d)} }`),p.length&&i.push(`${f} { ${s(p)} }`),S[T]&&(i.push(`*:has(> ${f}) { ${T}: ${S[T]} }`),i.push(...Re(f,`*:has(> ${f})`)));const z=Object.entries(a.tablet??{}).filter(([,u])=>u!=="");z.length&&i.push(`@media ${n} { ${f}, *:has(> ${f}) { ${s(z)} } }`);const x=Object.entries(a.phone??{}).filter(([,u])=>u!=="");x.length&&i.push(`@media ${o} { ${f}, *:has(> ${f}) { ${s(x)} } }`)};for(const a of t.rules.values())c(a);for(const a of t.kindRules.values())c(a);return i.join(`
|
|
2
|
+
`)}function Re(t,e){const n=`var(${T})`,o=":is([data-sf-bullet], [data-sf-number])";return[`${t} br:not(br + br) { display: block; content: ""; margin-top: ${n} }`,`${t} ${o}:not(:first-child) { margin-top: ${n} }`,`${t} ${o}:not(:last-child) { margin-bottom: ${n} }`,`:is(${e}) + :is(${e}) { margin-top: ${n} }`]}const Ee=t=>t.replace(/[A-Z]/g,e=>`-${e.toLowerCase()}`);function an(t,e){if(!t)return null;const n=F(e),o=t.rules.get(n);if(o)return o;if(n.length<we||t.drawn.has(n))return null;let i=null;for(const[r,c]of t.rules)if(r.includes(n)){if(i&&i.stamp!==c.stamp)return null;i=c}return i}const we=8;export{R as PART_ALIGNS,Ct as PART_LETTER_EM_MAX,jt as PART_LETTER_EM_MIN,Lt as PART_LETTER_STEP,Ut as PART_LINE_HEIGHT_MAX,Ht as PART_LINE_HEIGHT_MIN,Mt as PART_LINE_STEP,J as PART_MEASURED_TRACKS,kt as PART_NUDGE_MAX,$t as PART_NUDGE_MIN,Ft as PART_PADDING_MAX,It as PART_PADDING_MIN,yt as PART_PADDING_STEP,st as PART_PARAGRAPH_ATTR,Kt as PART_PARAGRAPH_MAX,vt as PART_PARAGRAPH_MIN,T as PART_PARAGRAPH_VAR,Dt as PART_RELATIVE_PROPS,H as PART_SIZE_MAX,D as PART_SIZE_MIN,Wt as PART_SIZE_STEPS,Et as PART_STYLED_ATTR,L as PART_STYLES_PROP,Pe as PART_STYLE_PROPERTIES,m as PART_UNIT_KEY_OF,Ot as PART_WEIGHTS,G as SHARED_PART_PROPERTIES,q as STYLE_ID_OF_ROLE,Z as TEXT_STYLE_ATTR,Je as applyPartStyles,Ge as blockDrawsTextStyle,Ue as followedStyleOf,ze as isPartKindKey,b as isTextStyleId,Re as paragraphRules,Be as partAlignFollowed,v as partCanvasDeclarations,Qt as partCaseOfTransform,te as partCaseTransform,Ze as partFontKeyOf,je as partLiftRules,ae as partPhoneDeclarations,on as partRuleForKind,an as partRuleForText,Ye as partShownDeclarations,ce as partSizeBoxOf,Xe as partSizeFollowed,ie as partSpacingOf,Ve as partStyleBase,ve as partStyleCount,rn as partStyleCss,K as partStyleDeclarations,fe as partStyleForScreen,qe as partStyleSource,it as partStyleWithoutSizeBox,se as partTabletDeclarations,Ke as propsWithPartStyleValue,We as propsWithoutPartStyle,nn as publishedPartStyles,Q as readPartStyle,Ce as readPartStyles,me as regionCanvasDeclarations,en as regionCanvasRestore,Qe as regionHasOwnLook,be as regionSheetStyle,tn as regionShownDeclarations,ge as storedPartStyle,Ae as viewMediaOf};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{jsx as
|
|
1
|
+
import{jsx as m}from"react/jsx-runtime";import{parseBlockWidthFit as K,phoneKey as c,tabletKey as r}from"efficient-easel/draw";import{blockCanWidenPastCell as L,blockFillInCellClass as X,blockSizeOf as B,blockSizeValuesOf as v,blockCanvasWidthAttrs as G}from"../../content/block-size.js";import{NoCellBound as Z}from"../../../components/BoxCellContext.js";import{CellWrap as U,useBoxCell as Y}from"../../../components/InBoxContext.js";import{boxPhoneRowFits as $,boxRowColumnsClass as k,boxShareClasses as C,boxShareTabletOf as M,boxTabletColumnsClass as V}from"../../../../format/lib/content/box-layout.js";import{resolveContainerDirection as q}from"../../../../format/lib/content/container-direction.js";import{BOX_TYPE as J,containerBlocksFor as Q}from"../../../../format/lib/document/container-blocks.js";import{readPartStyle as tt}from"../part-styles.js";import{addShowWhenFacts as et,withRowRules as _}from"../../../../format/lib/document/show-when-attach.js";import{BOX_BLOCK_KEYS as it}from"./cell-width.js";import{findParentNode as nt}from"../../../../format/lib/document/passes/document-position.js";const st=new Set(["Text","Heading"]),ot=new Set(["h1","h2","h3","h4","h5","h6"]);function z(t,e){return t==="Heading"?!0:t!=="Text"?!1:typeof e.tag=="string"&&ot.has(e.tag)?!0:tt(e,"text").textStyle?.startsWith("heading-")===!0}const d={not:{context:"blockOutsideBox",is:!0}},E={all:[d,{not:{context:"boxSharesWidth",is:!0}}]},N={all:[d,{not:{context:"boxSharesWidthPhone",is:!0}}]},I={all:[d,{not:{context:"boxSharesWidthTablet",is:!0}}]};function y(t,e,i){return{any:[{field:r(t),is:e},{all:[{field:r(t),set:!1},i??{field:t,is:e}]}]}}function H(t,e,i){return{any:[{field:c(t),is:e},{all:[{field:c(t),set:!1},i??{field:t,is:e}]}]}}const R={any:[{field:"textFit",is:"shrink"},{all:[{field:"textFit",set:!1},{not:{context:"textWrapsByDefault",is:!0}}]}]},rt=[[["_gBlockSize","minWidth",r("minWidth"),c("minWidth"),"maxWidth",r("maxWidth"),c("maxWidth")],d],[["widthFit"],E],[[r("widthFit")],I],[[c("widthFit")],N],[["width"],{all:[E,{field:"widthFit",is:"fixed"}]}],[[r("width")],{all:[I,y("widthFit","fixed")]}],[[c("width")],{all:[N,H("widthFit","fixed")]}]],D=y("textFit","shrink",R),j=[[["_gText","textFit",r("textFit"),c("textFit")],d],[["minFont"],{all:[d,R]}],[[r("minFont")],{all:[d,D]}],[[c("minFont")],{all:[d,H("textFit","shrink",D)]}]],p=(t,e)=>nt(e.appState,t.props?.id),S=t=>!!t&&typeof t.type=="string"&&Q(t.type)!==null,T=t=>(t.type==="Flex"||t.type==="HeroGroup")&&q(t.type,t.props?.direction)==="row",W=t=>{const e=K(t);return e!==void 0&&e!=="fit"},lt={blockOutsideBox:(t,e)=>!S(p(t,e)),boxSharesWidth:(t,e)=>{const i=p(t,e);return!S(i)||!T(i)?!1:k({...i.props,direction:"row"})!==""?!0:C(i.props?.share)!==""&&!W(t.props?.widthFit)},boxSharesWidthTablet:(t,e)=>{const i=p(t,e);if(!S(i)||!T(i))return!1;if(V(i.props?.[r("columns")])!==""||k({...i.props,direction:"row"})!=="")return!0;const n=M(i.props?.[r("share")])??i.props?.share;return C(n)!==""&&!W(t.props?.[r("widthFit")]??t.props?.widthFit)},boxSharesWidthPhone:(t,e)=>{const i=p(t,e);if(!S(i)||!T(i))return!1;const n=i.props?.phoneRow;return(Number(n)===2||Number(n)===3)&&!$(n,i.props?.[c("share")])&&!W(t.props?.[c("widthFit")]??t.props?.widthFit)}},ct=t=>/^_[gds][A-Z]/.test(t);function at(t,e,i){const n=Object.entries(t),s=n.findIndex(([l])=>l===e);if(s===-1)return null;let o=s+1;for(;o<n.length&&!ct(n[o][0]);)o++;return Object.fromEntries([...n.slice(0,o),...Object.entries(i),...n.slice(o)])}function A(t,e,i){const n=Object.entries(t);return Object.fromEntries([...n.slice(0,e),...Object.entries(i),...n.slice(e)])}function dt(t,e,i){const n=Object.keys(e);if(n.includes("_dSize")){const{_gBlockSize:s,...o}=i;return A(e,n.indexOf("_dSize")+1,o)}return ht.has(t)&&n.includes("_gSpacing")?A(e,n.indexOf("_gSpacing"),i):{...e,...i}}const ht=new Set(["Text","Heading"]);function ut(t,e){const{_gText:i,...n}=e;return at(t,"_gText",n)??{...t,...e}}function ft(t){const e=new WeakMap;return i=>{if(!i||!("textFit"in i))return i;let n=e.get(i);if(!n){n={...i};for(const s of["textFit",r("textFit"),c("textFit")])s in n&&(n[s]=t[s]);e.set(i,n)}return n}}const Ct={name:"blockSize",applies:(t,e,i)=>it.includes(t)&&!!i&&typeof i.render=="function",panel(t,e,i){const n=st.has(e),{text:s}=i.blockSizeFields(n?{tablet:!0,textFit:e==="Heading"?"shrink":"wrap"}:{}),{size:o}=i.blockSizeFields({tablet:!0});let l=dt(e,t.fields??{},_(o,rt));if(n){const a=_(s,j);if(l=ut(l,a),e==="Text"){const f=_(i.blockSizeFields({tablet:!0,textFit:"shrink"}).text,j),h=ft(f),u=t.resolveFields,b=(x,w)=>{const F=u?u(x,w):w.fields,g=O=>z(e,x?.props??{})?h(O??w.fields):O;return F instanceof Promise?F.then(g):g(F)};t.resolveFields=b}}t.fields=l,et(t,{...lt,textWrapsByDefault:a=>!z(e,a.props??{})})},draw(t,e){xt(t,e)}};function xt(t,e){const i=t.render;t.render=n=>{const s=v(n),o=B(s),l=i(n),a=o&&B(s,{atSectionLine:!0});return o===null?l:m(pt,{size:o,sectionSize:a??o,atEdge:e===J,canvasAttrs:n.editor?.isEditing?G(s):P,inCell:X(s),widens:L(s),children:l})}}const P={};function pt({size:t,sectionSize:e,atEdge:i,canvasAttrs:n,inCell:s,widens:o,children:l}){const a=Y(),f=!!a||i,h=f?t:e,u=h.className,b=a?.phoneCells===!0,x=o?m(Z,{children:l}):l;return m(U,{className:b&&s?`${u} ${s}`:u,...Object.keys(h.style).length?{style:h.style}:{},attrs:f&&n!==P?{...h.attrs,...n}:h.attrs,children:x})}export{Ct as blockSize,z as textShrinksByDefault};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{jsx as
|
|
1
|
+
import{jsx as f}from"react/jsx-runtime";import{SectionAnimation as l}from"../../../components/SectionAnimation.js";import{ENTRANCE_EXCLUDED as p,entranceDrawn as w}from"../../animation/entrance.js";import{CARD_HOVER_SECTIONS as T,PICTURE_HOVER_BLOCKS as _}from"../../../../format/lib/animation/hover.js";import{BOX_TYPE as a}from"../../../../format/lib/document/container-blocks.js";import{drawsCopiesInTheBox as b}from"../../../../format/lib/content/copies-in-box.js";import{ownEntry as c}from"../../../../format/lib/own-entry.js";const s=Object.fromEntries(_.map(n=>[n,"picture"])),u={[a]:"box",Ticker:"marquee",...Object.fromEntries(T.map(n=>[n,"cards"])),...s},m=(n,e)=>!p.has(n)&&!!e&&typeof e.render=="function";function d(n,e,t,o){n.fields={...n.fields,...t.animationTabFields(e,o)}}function E(n,e){const t=n,o=t.render;t.render=i=>{const r=w(i);return!r||b(e,i)?o(i):f(l,{views:r,editing:!!i.editor?.isEditing,takesViewHide:!0,atEdge:e===a,children:o(i)})}}const D={name:"sectionAnimation",applies:(n,e,t)=>e.isSection(n)&&m(n,t),panel:(n,e,t)=>d(n,c(u,e)??"section",t,e),draw:(n,e)=>E(n,e)},S={name:"blockEntrance",applies:(n,e,t)=>!e.isSection(n)&&m(n,t),panel:(n,e,t)=>d(n,c(s,e)??"block",t,e),draw:(n,e)=>E(n,e)};export{S as blockEntrance,D as sectionAnimation};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{jsx as S}from"react/jsx-runtime";import{HideTaker as
|
|
1
|
+
import{jsx as S}from"react/jsx-runtime";import{HideTaker as m}from"../../../components/ViewHideRoot.js";import{isBackgroundBox as _}from"../../../../format/lib/content/box-background.js";import{boxSideSpaceOf as u}from"../../../../format/lib/content/box-side-space.js";import{SECTION_PAD_KEYS as p,padValuesOf as T,resolveSectionPadding as g,sectionPadAttrs as I}from"../../content/section-padding.js";import{sectionFillPassClass as E}from"../../../../format/lib/content/section-min-height.js";import{COPIES_IN_THE_BOX as b,drawsCopiesInTheBox as O}from"../../../../format/lib/content/copies-in-box.js";import{ownEntry as x}from"../../../../format/lib/own-entry.js";const l={ParagraphsA:{top:60,bottom:80},StatsParagraph:{top:120,bottom:120},Timeline:{top:120,bottom:120},Footprint:{top:120,bottom:120},TimelineTrack:{top:120,bottom:120},TitleWithButtons:{top:140,bottom:140},ProcessSteps:{top:120,bottom:120},DetailRows:{top:100,bottom:100}},c=new Set(Object.keys(l)),f=new Set(["Flex","Text","Heading","ImageBlock"]),N=new Set(["Divider"]),h=new Set(["Hero","HeroSingle","IntroBleed","CategoryBar","DocTabs"]),P=new Set(["ProductGrid"]);function s(e,t,o=!1){const i=e.render;e.render=n=>{if(t?.(n))return i(n);const r=I({...T(n,p,o),sideSpace:u(n.sideSpace)}),a=i(n),d=E(n);return r?S(m,{className:d?`${r.className} ${d}`:r.className,style:r.style,children:a}):a}}const j={name:"sectionPadding",applies:(e,t,o)=>t.isSection(e)&&!h.has(e)&&!!o&&typeof o.render=="function",panel(e,t,o){c.has(t)||P.has(t)||(e.fields={...e.fields,...o.sidesPaddingFields({tablet:!0,siteSide:!0})})},draw(e,t){if(c.has(t)){const o=e.render,i=x(l,t);e.render=n=>{const r=g(n,i);return o({...n,padTop:r.top,padBottom:r.bottom})};return}if(P.has(t)){s(e);return}f.has(t)||N.has(t)||s(e,t==="Flex"?o=>_(o.bgImage):b.has(t)?o=>O(t,o):void 0,!0)}},A=["Heading","Text","ImageBlock"],B=["LogoBlock"],K={name:"blockPadding",applies:(e,t,o)=>(A.includes(e)||B.includes(e))&&!!o&&typeof o.render=="function",panel(e,t,o){e.fields={...e.fields,...o.sidesPaddingFields({tablet:!0,siteSide:!0})}},draw(e,t){f.has(t)||s(e,void 0,!0)}};export{N as PADS_ITS_OWN_SPACE,f as PAD_ON_ROOT,c as SECTION_PAD_INNER,l as SECTION_PAD_INNER_DEFAULTS,K as blockPadding,j as sectionPadding};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{jsx as l}from"react/jsx-runtime";import{HideTaker as u}from"../../../components/ViewHideRoot.js";import{INTRO_EDGE_CLASS as
|
|
1
|
+
import{jsx as l}from"react/jsx-runtime";import{HideTaker as u}from"../../../components/ViewHideRoot.js";import{INTRO_EDGE_CLASS as X}from"../../../../format/lib/sections/intro-bleed-layout.js";import{cssLengthOf as B}from"../../../../format/lib/content/css-length.js";import{resolveContainerDirection as q}from"../../../../format/lib/content/container-direction.js";import{HERO_BACKGROUND_VAR as z,HERO_CHROME_CAP_VAR as J,HERO_CHROME_INSET_VAR as Q,FULL_SECTION_WIDTH as Z,SITE_WIDTH_CAP as _,centredCap as G,heroBackgroundTokens as tt}from"../../../../format/lib/content/page-width.js";import{SECTION_WIDTH_FAMILY as v,SECTION_WIDTH_KEYS as D,hasOwnSectionWidth as nt,hasWidthFamily as et,resolveWidth as F,siteWidthsOf as ot}from"../../../../format/lib/content/section-width.js";import{boxCardProps as it}from"../../../../format/lib/content/box-background.js";import{cardCopyPlace as ct}from"../../../../format/lib/content/card-template.js";import{BOX_GUTTER_KEY as rt,boxGutterOf as lt,boxPlaceOf as dt,boxRunsEdgeToEdge as ut,isFrameContainer as C,ownNodeWidth as st,sectionGroundAnswer as at,siteDrawsGutter as ft}from"../../../../format/lib/content/site-gutter.js";import{getEditorSiteContentWidth as ht}from"../../../../format/lib/document/editor-site-widths.js";import{GroundStopsAt as H,NestedBoxChoice as _t,SectionGroupChoice as Nt,SectionGroupWidthsProvider as wt,SectionRootChoice as Ct,SplitBandAndColumn as M}from"../../../components/SiteGutterFrame.js";import{FRAME as L}from"../../../components/BlockFrame.js";import{sectionFillPassClass as P}from"../../../../format/lib/content/section-min-height.js";import{parentCapsWidth as Et}from"../../../../format/lib/sections/section-head-placement.js";import{addShowWhenFacts as E,withRowsShownWhen as O}from"../../../../format/lib/document/show-when-attach.js";import{findParentNode as Ot,heldByANode as Tt,isNestedNode as St,NOT_HELD_BY_A_NODE as y}from"../../../../format/lib/document/passes/document-position.js";import{ownEntry as k}from"../../../../format/lib/own-entry.js";const N="--sf-sw-site",mt="--sf-sw-content",pt="--sf-bg-cap",xt="contents [--sf-site-width:var(--sf-sw-content)] max-view-wide:[--sf-site-width:var(--sf-sw-site)]",R=({own:t,content:n,siteContent:e})=>t===!0&&n==="full"&&e!=="full",U="contents view-wide:[--sf-site-width:100vw]",A=({held:t},n,e)=>t?e:l(u,{className:n,children:e}),Rt=`contents view-wide:[--sf-site-width:100vw] ${X} view-wide:[--sf-site-gutter:var(--intro-edge)]`,W=(t,n,e)=>n==="content"?`min(${B(t,e)},var(${N}))`:B(t,e);function T({content:t,contentMax:n,contentMaxUnit:e},o){return t==="full"?o!=="content"?Z:null:n===null?null:W(n,o,e)}function S(t,n){return n===null?t:l(u,{className:"contents",style:{[N]:_},children:l(u,{className:xt,style:{[mt]:n},children:t})})}const At="--sf-content-cap",Wt="contents max-view-wide:[--sf-content-cap:none]";function It({content:t,contentMax:n,contentMaxUnit:e},o){return t==="full"?null:n!==null?W(n,o,e):o==="content"?null:`var(${N})`}function bt(t,n){return n===null?t:l(u,{className:"contents",style:{[N]:_},children:l(u,{className:Wt,style:{[At]:n},children:t})})}const V=`var(${N},${_})`,f=(t,n,e="")=>t==="content"?l(u,{className:e||void 0,style:G(_),children:l(H,{ground:V,children:n})}):n;function $(t,n,e,o,i){if(R(e))return f(o,A(e,U,l(M,{children:t({...n,contained:!0})})),i);if(e.content==="full")return f(o,t({...n,contained:!1}),i);const c=T(e,o);return o==="content"&&c===null&&!e.own?t({...n,contained:!0}):f(o,S(l(M,{children:t({...n,contained:!0})}),c),i)}function Y(t,n,e,o){if(e==="hero"){const r=S(t(n),T(o,o.band));return o.band==="full"?l(u,{style:{[z]:"none",[Q]:"initial",[J]:"initial"},children:r}):o.band==="content"?l(u,{style:tt(!0),children:r}):r}const i=o.band??"full",c=P(n);if(e==="rawMarkup"){if(o.content==="full")return f(i,t(n),c);const r=o.contentMax===null?_:W(o.contentMax,i,o.contentMaxUnit);return l(u,{className:"contents",style:{[N]:_},children:f(i,l(u,{className:c||void 0,style:G(r),children:t(n)}),c)})}if(e==="scrollOver"){const r=o.content==="full",d=R(o)?A(o,Rt,t({...n,fullWidth:!1})):S(t({...n,fullWidth:r}),r?null:T(o,i));return i==="content"?l(u,{className:"contents",style:{[pt]:_},children:d}):d}switch(e){case"both":return f(i,bt(t(n),It(o,i)),c);case"contained":return $(t,n,o,i,c);case"contentColumn":case"contentFull":case"productGrid":{const r=R(o),d=o.content==="full"&&!r?"full":"page",s=r?A(o,U,t({...n,widthMode:d})):S(t({...n,widthMode:d}),o.content==="full"?null:T(o,i));return e==="productGrid"&&!o.own?i==="content"?l(u,{className:c?`${L} ${c}`:L,children:s}):s:f(i,s,c)}default:return f(i,S(t(n),T(o,i)),c)}}function gt(t,n){const e=k(v,n);if(!e)return;const o=t.render;t.render=i=>{const c=ot(i),r={band:c.background,content:c.content??"content",contentMax:null},d=()=>e==="rawMarkup"?o(i):l(Nt,{draw:a=>a?.background==="content"?l(H,{ground:V,children:s(a)}):s(a)}),s=a=>{const w=a?{...r,band:a.background==="content"?r.band:a.background??r.band,content:a.content??r.content,own:a.background==="full"||a.content!==null,held:!0,siteContent:r.content}:r,x=Y(o,i,e,w);if(!C(n))return x;const b=lt(i),g=b===void 0?w.content:b?"content":"full";return g===w.content?x:l(_t,{atTop:x,nested:$(o,i,{...w,content:g,own:!1},w.band??"full",P(i))})},h=st(n,i);if(!nt(h))return d();const m=e==="rawMarkup",I=at(n,i),j=h.content??(m?"full":r.content),p={band:I,content:I==="content"?"content":j,contentMax:h.contentMax,contentMaxUnit:h.contentMaxUnit,own:!m,siteContent:r.content};return l(Ct,{own:()=>l(wt,{value:{background:p.band,content:p.content},children:Y(o,i,e,p)}),followed:d})}}const Bt={all:[y,{not:{context:"runsEdgeToEdge",is:!0}}]},on={name:"sectionWidth",applies:(t,n,e)=>et(t)&&!!e&&typeof e.render=="function",panel(t,n,e){const o=e.sectionOwnWidthFields({drawsFullOnItsOwn:k(v,n)==="rawMarkup"}),i=C(n)?e.boxGutterFields():{},c={...t.fields,...i,...o},r=C(n)?K(n,t,c,[rt]):c;E(t,{heldByANode:Tt}),C(n)&&E(t,{runsEdgeToEdge:(d,s)=>ut(it(d.props??{},ct(s.appState,d.props?.id)?.inCopy!==!1))}),t.fields=O(r,[D.background,D.content],C(n)?Bt:y)},draw(t,n){gt(t,n)}};function Gt(t,n){if(!t||!("widthMode"in t))return t;const e={...t},o=e.widthMode;return o&&(e.widthMode={...o,currentValue:n.mode,inherited:n.inherited}),e}const vt=new Set(["Heading","Text","ImageBlock","ButtonBlock"]),cn={name:"containedWidth",applies:(t,n,e)=>vt.has(t)&&!!e&&typeof e.render=="function",panel(t,n,e){const o=e.widthField;t.fields=K(n,t,{...t.fields,...o("page")});const i=t.resolveFields;t.resolveFields=(c,r)=>{const d=i?i(c,r):r.fields,s=F(c?.props??{},"page"),h=m=>Gt(m,s);return d&&typeof d.then=="function"?d.then(h):h(d)}},draw(t){const n=t.render;t.render=e=>{const{mode:o}=F(e,"page");return n({...e,contained:o!=="full"})}}},Dt={not:{context:"inHeroGroupRow",is:!0}},rn={name:"buttonAlignInRow",applies:t=>t==="ButtonBlock",panel(t){const n=t;n.fields=O(n.fields??{},["align"],Dt),E(n,{inHeroGroupRow:(e,o)=>{const i=Ot(o.appState,e.props?.id);return!!i&&i.type==="HeroGroup"&&q("HeroGroup",i.props?.direction)==="row"}})}};function Ft(t){return Object.values(t).some(n=>!!n&&typeof n=="object"&&n.type==="slot")}const Ht={any:[]},Mt={all:[{not:{context:"outsideBox",is:!0}},{not:{context:"insideSiteGutter",is:!0}}]},Lt={not:{context:"widthCappedByParent",is:!0}};function K(t,n,e,o=["widthMode"]){if(t==="ButtonBlock")return O(e,["_gWidth",...o],Ht);if(Ft(e)){const i=(c,r)=>dt(r.appState?.data?.content,c.props?.id,ft(ht()));return E(n,{outsideBox:(c,r)=>i(c,r)?.inBox!==!0,insideSiteGutter:(c,r)=>i(c,r)?.insideGutter}),O(e,o,Mt)}return E(n,{widthCappedByParent:(i,c)=>"parent"in c?Et(c.parent):St({props:i.props??{}},c)}),O(e,o,Lt)}export{pt as SECTION_BACKGROUND_VAR,Wt as SECTION_CONTENT_CAP_CLASS,At as SECTION_CONTENT_CAP_VAR,xt as SECTION_CONTENT_CLASS,mt as SECTION_CONTENT_VAR,N as SITE_CONTENT_VAR,rn as buttonAlignInRow,cn as containedWidth,on as sectionWidth,Gt as widthModeFields};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{isNode as
|
|
1
|
+
import{isNode as w,isNodeList as y}from"efficient-easel/data";import{hidableText as S,readHidable as _}from"efficient-easel/draw";import{blockSizeValuesOf as h}from"../content/block-size.js";import{nodeHiddenEverywhere as R,nodeViewHideClass as b}from"../../../format/lib/content/view-hide-class.js";import{CARD_ROW_FIELD_PROP as x,isCardTemplateSlot as g,namedRowField as C,ROW_BOUND_PROPS as E}from"../../../format/lib/content/card-template.js";import{SHOW_FOR_PROP as P}from"../../../format/lib/content/box-show-for-choices.js";import{ownEntry as p}from"../../../format/lib/own-entry.js";const O="slotCounts",d=t=>!_(t).hidden&&S(t).trim()!=="",F=t=>typeof t=="string"&&t.trim()!=="",N={Flex:()=>!0,PostCard:()=>!0,ImageBlock:t=>F(t.src),Text:t=>d(t.text),Heading:t=>d(t.text),Eyebrow:t=>d(t.eyebrow)},W=["widthFit","width","minWidth"],u=t=>y(t);function A(t){if(Array.isArray(t.content))return u(t.content)?t.content:null;const e=Object.values(t).filter(u);return e.length===1?e[0]:null}function I(t,e){return[...new Set([x,...Object.values(p(E,t)??{})])].some(o=>C(e,o)!=="")}function D(t){const e=t.props??{},n=p(N,t.type);if(!n||!n(e)||I(t.type,e)||b(e))return!1;const o=e[P];if(o!=null&&o!=="")return!1;const r=h(e);return!W.some(s=>r[s]!==void 0)}function H(t){let e=0;for(const n of t)if(!R(n.props??{})){if(!D(n))return;e+=1}return e>0?e:void 0}function j(t){const e={},n=new Set,o=new Set,r=(s,a)=>{if(Array.isArray(s))for(const i of s){if(!w(i))continue;const f=i.props.id;typeof f=="string"&&(n.has(f)?o:n).add(f);const l=a?null:A(i.props);if(typeof f=="string"&&l){const c=H(l);c!==void 0&&(e[f]=c)}for(const[c,m]of Object.entries(i.props))u(m)&&r(m,a||g(i.type,c))}};r(t,!1);for(const s of o)delete e[s];return e}function K(t,e){return{...t??{},[O]:j(e)}}function V(t){const n=t.editor?.metadata?.[O],o=t.id,r=typeof o=="string"&&n&&typeof n=="object"?n[o]:void 0;return typeof r=="number"&&Number.isInteger(r)&&r>0?r:void 0}export{N as DRAWS_FOR_SURE,O as SLOT_COUNTS_KEY,V as slotCountOf,j as slotCountsOf,K as withSlotCounts};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{HERO_SLIDE_SEEDS as
|
|
1
|
+
import{HERO_SLIDE_SEEDS as E}from"../../components/HeroSlide.js";import{heroGroupAddBlocked as p,heroGroupOverCapNotice as i}from"../../../format/lib/hero-group-placement.js";import{newNodeId as n}from"efficient-easel/draw";import{BOX_TYPE as c}from"../../../format/lib/document/container-blocks.js";import{BOX_LABEL as s}from"../../../format/lib/document/section-catalog.js";import{seedNodes as T}from"../../../format/lib/document/seed-parts.js";import{isNodeList as O}from"efficient-easel/data";import{PROCESS_COLUMNS_SLOT as _,PROCESS_STEPS_SEED_COUNT as u,processColumnSeed as y}from"../../../format/lib/document/blocks/general/ProcessSteps/column-seed.js";import{HERO_STRIP_SLOT as S}from"../../../format/lib/hero-ticker.js";import{ownEntry as a,hasOwnEntry as f}from"../../../format/lib/own-entry.js";const m=(e,o)=>({type:e.type,props:{...o?.(e.type)??{},...Object.fromEntries(Object.entries(e.props).map(([r,t])=>[r,O(t)?t.map(l=>m(l,o)):t]))}}),C=e=>{const[o]=T([y()],l=>n(l)),{id:r,...t}=m(o,e).props;return t},d={Hero:{slot:"slides",childType:"HeroSlide",addLabel:"Add slide",slider:!0,seeds:()=>E.map(e=>({...e}))},HeroSlide:{slot:"groups",childType:"HeroGroup",addLabel:`Add ${s.toLowerCase()}`,seeds:()=>[],addBlocked:p,notice:i},HeroSingle:{slot:"boxes",childType:"HeroGroup",addLabel:`Add ${s.toLowerCase()}`,seeds:()=>[],addBlocked:p,notice:i},ProcessSteps:{slot:_,childType:c,addLabel:`Add ${s.toLowerCase()}`,seeds:e=>Array.from({length:u},()=>C(e)),skipSeed:e=>Array.isArray(e.steps)&&e.steps.length>0}},h=1,L={slot:S,childType:c,addLabel:`Add ${s.toLowerCase()}`,seeds:()=>[],addBlocked:e=>e.length>=h?"This Hero has its Scrolling Bar already. Delete it to add another.":null,notice:e=>e.length>h?`This Hero holds ${e.length} Scrolling Bars. Keep one and delete the others.`:null},I={Hero:{[S]:L}};function $(e){for(const[o,r]of Object.entries(e)){if(f(d,o)&&a(d,o)!==r)throw new Error(`lib/document/slot-specs: "${o}" already has a slot spec`);d[o]=r}}function k(e,o){const r=a(d,e);return r?{slot:r.slot,children:r.seeds(o).map(t=>({type:r.childType,props:{id:n(r.childType),...t}}))}:null}export{h as HERO_STRIP_CAP,L as HERO_STRIP_SPEC,I as SLOT_SECTION_EXTRA_SPECS,d as SLOT_SECTION_SPECS,k as buildSlotSeedChildren,$ as registerSlotSectionSpecs};
|
|
@@ -36,6 +36,8 @@ export type SiteFacts = {
|
|
|
36
36
|
selectedPreset?: number | null;
|
|
37
37
|
siteGutter?: number | null;
|
|
38
38
|
siteGutterPhone?: number | null;
|
|
39
|
+
siteGutterUnit?: string | null;
|
|
40
|
+
siteGutterPhoneUnit?: string | null;
|
|
39
41
|
};
|
|
40
42
|
export type ConvertContext = {
|
|
41
43
|
site?: SiteFacts;
|
|
@@ -1 +1 @@
|
|
|
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};
|
|
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 re}from"../../../format/lib/sections/section-head-placement.js";import{accentItalicRuns as ie}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 z}from"../../../format/lib/theme.js";import{hasOwnEntry as R,ownEntry as v}from"../../../format/lib/own-entry.js";const E=ee,_=te;function Ie(t){if(t.theme)return z(t.theme);const o=t.site?.themePresets;return o?z({selected:t.site?.selectedPreset??0,themes:[...o]}):void 0}function de(t,o){return o===0?`${t}~box`:`${t}~box-${o+1}`}const C={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(R(C,o)&&v(C,o)!==s)throw new Error(`lib/sections/section-to-box: "${o}" is already Box-native`);C[o]=s}}function Ae(t){return v(C,t)}const Y=new Set(["id"]),T={},M=[],fe=["ProductGrid","Events","Collections","GalleryB","ContactRouting","ReviewForm","AppointmentBooking","Reviews","CheckoutCTA","AlloyWheelsListing","SpecTable"],le=["Breadcrumb","DocBody","Form","SubmitBuild","Footprint","FAQ","ProcessSteps",...fe,"Stats","Logos","PaymentBadges","PaymentLogosBlock","FitmentFinder","DocMasthead","DocTabs","Timeline","TimelineTrack","OrderSummary","Chart","Mockup","Countdown","FeaturedCover","SectionHeader","TitleWithButtons","Prose","ParagraphsA","Banner","Cards"];function Re(t){for(const[o,s]of Object.entries(t)){if(R(T,o)&&v(T,o)!==s)throw new Error(`lib/sections/section-to-box: "${o}" already has a row`);T[o]=s}}function Ce(t){return v(T,t)}function He(){return Object.keys(T)}function pe(t){return R(T,t)&&M.includes(t)}function Le(t,o=le){return R(T,t)&&(o.includes(t)||pe(t))}function Fe(t){const o=v(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 W=t=>Z(t),Me=t=>W(t).text.trim()!=="";function ue(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 he=t=>t==="heading"?oe():t==="eyebrow"?ne():{};function ye(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 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"?v(t.map,s):void 0)??t.fallback}}function V(t,o,s,r,c={}){const a={...o};for(const u of t){const[m,S,j]=typeof u=="string"?[u,u,void 0]:u;if(s[m]===void 0)continue;const I=j?j(s[m],s,c):s[m];I===void 0?delete a[S]:a[S]=I,r(m,S,I===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])},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 be=t=>re(t.headPlacement)==="own-box";function ge(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 xe(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=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 $e(t,o,s){if(!s.press)for(const r of we(t)){const c=xe(o,r);if(c!==void 0)return c}}function Q(t,o,s={}){const r=t.props,c=(o.ownBoxConverts?void 0:ge(r))??$e(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,j=(n,i)=>{u.push({key:n,home:i}),S.add(n)},I=r._partStyles??{},H=ke(o);let X=0;const w=(n,i)=>({type:n,props:{...i,id:`${a}~${n}-${++X}`}}),K=(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 V(n??[],e,b,(d,h,f)=>$(d,f?`nothing — the old value draws nothing (${y}: no ${h})`:`${l}${y}: ${h}`),s)},q=n=>ae(n,i=>`${a}~${i}-${++X}`),D=(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=N(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(E,{name:`${n.name} ${x+1}`,...g,...k.props??{},[_]: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"),ce(y.map(x=>x??{}),f.of,f.of).map((x,p)=>{const k=x.items.map(O=>O.item),B=f.parts?N(f.parts,f.head?.(k,r)??{},!1,`group ${p+1}: `):[],P=x.items.map(O=>l[O.index]),L=f.perRow?.(k.length,r),A=Number.isInteger(L)&&L>=1?L:1,F=[];if(f.perRow&&A<P.length)for(let O=0;O*A<P.length;O++)F.push(P.slice(O*A,(O+1)*A).flat());return w(E,{name:`${f.name} ${p+1}`,...f.props??{},[_]:[...B,w(E,{name:`${f.itemsName} ${p+1}`,...f.itemsProps?.(k.length,r)??{},[_]:F.length?F.map((O,U)=>w(E,{name:`${f.rowName??`${f.itemsName} row`} ${U+1}`,...f.rowProps??{},[_]: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(E,{name:`${n.rowName??`${n.name} row`} ${f+1}`,...d,[_]:[...x,...Array.from({length:p},(k,B)=>w(E,{name:`Empty ${B+1}`,...n.rowFiller,[_]:[]}))]}))}return h},N=(n,i,b,y)=>{const g=[],l=(e,d)=>b?j(e,d):void 0,$=e=>b?I[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=W(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=he(e.role??"body"),{_partStyles:f,...x}=h,p=ye(h,e.styleFrom?{...e.style,...e.styleFrom(r,s)}:e.style,$(e.key),e.props?.align);g.push(w("Text",{text:e.mark==="accentLead"?ue(d.text):e.mark==="accentItalic"?ie(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=W(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??{},...me(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(...D(e,i,l));break}case"group":{const d=N(e.parts,i,b,y),h=K(e.box,e.props,i,`${e.name} Box`,!d.length&&!e.keepEmpty,y,l);h&&g.push(w(E,{name:e.name,...h,[_]:d}));break}case"block":{const d=e.parts?N(e.parts,i,b,y):[],h=K(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=>!H.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&&!H.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(I).filter(([k])=>!H.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?D(B,i,l):q([B]));g.push(w(d,h));break}}return g},J=(n,i)=>{const b=i===0?"Box":`${n.name} Box`,y=N(n.parts,r,!0,i===0?"":`${b}: `),g=typeof n.boxProps=="function"?n.boxProps(r,s):n.boxProps??{},l=V(n.box??[],g,r,($,e,d)=>j($,d?`nothing — the old value draws nothing (${b}: no ${e})`:`${b}: ${e}`),s);return{type:E,props:{name:n.name,...l,[_]:y,id:de(a,i)}}},G=[o,...o.also??[]].map(J);r._partStyles!==void 0&&j("_partStyles","each old part's style moved to its new part");for(const[n,i]of Object.entries(o.reads??{}))r[n]!==void 0&&j(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))Y.has(n)||S.has(n)||m.push({key:n,why:"not in the row — not carried"});return{node:G[0],nodes:G,carried:u,dropped:m,siteWrites:[...o.site?.(t,s)??[]]}}function We(t,o=M,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)?v(T,u.type):void 0;if(!m)return[u];const S=Q(u,m,s);return S.skipped!==void 0?[u]:(c=!0,S.nodes)});return c?{...t,content:a}:t}function Xe(t,o=M,s={}){if(!Array.isArray(t))return[];const r=[];return t.forEach((c,a)=>{const u=c&&typeof c.type=="string"&&o.includes(c.type)?v(T,c.type):void 0;if(!u)return;const m=Q(c,u,s);m.skipped===void 0&&r.push({index:a,node:m.node,nodes:m.nodes})}),r}export{fe as HOST_PRESS_TYPES,_ as SECTION_BOX_SLOT,E as SECTION_BOX_TYPE,M as SECTION_TO_BOX_ON,le as SECTION_TO_BOX_PRESS,Ae as boxNativeReason,Q as convertSection,We as convertSectionsInPage,Ie as convertTheme,pe as convertsToBox,xe as filledTemplateHold,Me as hasWords,be as headInOwnBox,Fe as headParts,ge as ownBoxHold,Le as pressesAsBox,Ne as registerBoxNativeSections,Re as registerSectionToBox,de as sectionBoxIdOf,Xe as sectionToBoxEdits,Ce as sectionToBoxRow,He as sectionToBoxTypes};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "efficient-web-builder",
|
|
3
|
-
"version": "67.
|
|
3
|
+
"version": "67.3.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",
|