efficient-web-builder 55.2.0 → 55.3.1
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 +38 -0
- package/dist/editor/components/PartSettingsPanel.js +1 -1
- package/dist/editor/lib/document/block-source-fields.d.ts +1 -0
- package/dist/editor/lib/document/block-source-fields.js +1 -1
- package/dist/editor/lib/document/blocks/general/CardList/fields.js +1 -1
- package/dist/editor/lib/document/blocks/general/Cards/fields.js +1 -1
- package/dist/editor/lib/document/blocks/general/Flex/fields.js +1 -1
- package/dist/editor/lib/document/blocks/general/LogoBlock/fields.js +1 -1
- package/dist/editor/lib/document/blocks/general/Logos/fields.js +1 -1
- package/dist/editor/lib/document/blocks/general/ProcessSteps/fields.js +1 -1
- package/dist/editor/lib/document/blocks/general/Text/fields.js +1 -1
- package/dist/editor/lib/document/blocks/general/index.d.ts +2 -2
- package/dist/editor/lib/document/card-row-fields.d.ts +2 -1
- package/dist/editor/lib/document/card-row-fields.js +1 -1
- package/dist/editor/lib/document/choice-pictures.d.ts +2 -0
- package/dist/editor/lib/document/choice-pictures.js +1 -1
- package/dist/editor/lib/document/live-number-field.d.ts +5 -0
- package/dist/editor/lib/document/live-number-field.js +1 -1
- package/dist/editor/lib/document/mirror-cards-field.js +1 -1
- package/dist/editor/lib/document/part-panel-rows.js +1 -1
- package/dist/editor/lib/sections/text-layouts.js +1 -1
- package/dist/format/lib/content/block-sources.d.ts +12 -1
- package/dist/format/lib/content/block-sources.js +1 -1
- package/dist/format/lib/content/box-background.d.ts +3 -0
- package/dist/format/lib/content/box-background.js +1 -1
- package/dist/format/lib/content/card-template.d.ts +6 -1
- package/dist/format/lib/content/card-template.js +1 -1
- package/dist/format/lib/content/count-numbers.d.ts +1 -1
- package/dist/format/lib/content/count-numbers.js +1 -1
- package/dist/format/lib/content/footer.js +1 -1
- package/dist/format/lib/content/image-text-rows.d.ts +22 -0
- package/dist/format/lib/content/image-text-rows.js +1 -0
- package/dist/format/lib/content/mirror-cards.d.ts +17 -0
- package/dist/format/lib/content/mirror-cards.js +1 -1
- package/dist/format/lib/document/blocks/general/Footprint/card-seed.js +1 -1
- package/dist/format/lib/document/blocks/general/Logos/card-seed.d.ts +7 -0
- package/dist/format/lib/document/blocks/general/Logos/card-seed.js +1 -0
- package/dist/format/lib/document/blocks/general/Logos/meta.d.ts +4 -0
- package/dist/format/lib/document/blocks/general/Logos/meta.js +1 -1
- package/dist/format/lib/document/blocks/general/ProcessSteps/meta.d.ts +4 -0
- package/dist/format/lib/document/blocks/general/ProcessSteps/meta.js +1 -1
- package/dist/format/lib/document/blocks/general/ProcessSteps/row-seed.d.ts +11 -0
- package/dist/format/lib/document/blocks/general/ProcessSteps/row-seed.js +1 -0
- package/dist/format/lib/document/container-blocks.js +1 -1
- package/dist/format/lib/document/passes/document-position.d.ts +8 -0
- package/dist/format/lib/document/passes/document-position.js +1 -1
- package/dist/format/lib/document/row-hand.d.ts +5 -0
- package/dist/format/lib/document/row-hand.js +1 -0
- package/dist/format/lib/document/section-catalog.js +17 -3
- package/dist/format/lib/document/section-descriptions.js +1 -1
- package/dist/format/lib/document/seed-parts.d.ts +3 -0
- package/dist/format/lib/document/seed-parts.js +1 -1
- package/dist/format/lib/document/text-seeds.js +1 -1
- package/dist/format/lib/editor-words-catalogue.d.ts +38 -1
- package/dist/format/lib/editor-words-catalogue.js +6 -6
- package/dist/format/lib/editor-words-kept.js +1 -1
- package/dist/format/lib/sections/strip-shape.js +1 -1
- package/dist/format/lib/sections/ticker-join.d.ts +1 -0
- package/dist/format/lib/sections/ticker-join.js +1 -1
- package/dist/format/lib/source-rules/editor-words.js +2 -2
- package/dist/format/lib/theme.d.ts +1 -0
- package/dist/format/lib/theme.js +3 -3
- package/dist/render/components/CardRowContext.d.ts +5 -0
- package/dist/render/components/CardRowContext.js +1 -1
- package/dist/render/components/ClientRows.d.ts +8 -0
- package/dist/render/components/ClientRows.js +1 -0
- package/dist/render/components/Flex.d.ts +2 -1
- package/dist/render/components/Flex.js +1 -1
- package/dist/render/components/JoinBox.d.ts +4 -0
- package/dist/render/components/JoinBox.js +1 -0
- package/dist/render/components/LogoBlock.js +1 -1
- package/dist/render/components/Logos.d.ts +4 -2
- package/dist/render/components/Logos.js +1 -1
- package/dist/render/components/MirrorContext.d.ts +12 -0
- package/dist/render/components/MirrorContext.js +1 -1
- package/dist/render/components/PaymentBadges.js +1 -1
- package/dist/render/components/ProcessSteps.d.ts +5 -1
- package/dist/render/components/ProcessSteps.js +1 -1
- package/dist/render/components/TickerSection.js +1 -1
- package/dist/render/lib/document/blocks/general/ButtonBlock/render.js +1 -1
- package/dist/render/lib/document/blocks/general/CardList/render.js +1 -1
- package/dist/render/lib/document/blocks/general/Eyebrow/render.js +1 -1
- package/dist/render/lib/document/blocks/general/Flex/render.js +1 -1
- package/dist/render/lib/document/blocks/general/LogoBlock/render.js +1 -1
- package/dist/render/lib/document/blocks/general/Logos/render.js +1 -1
- package/dist/render/lib/document/blocks/general/ProcessSteps/render.d.ts +5 -0
- package/dist/render/lib/document/blocks/general/ProcessSteps/render.js +1 -1
- package/dist/render/lib/document/blocks/general/Split/render.js +1 -1
- package/dist/render/lib/document/blocks/general/Text/render.js +1 -1
- package/dist/render/lib/document/blocks/general/TitleWithButtons/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 +3 -0
- 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-cards.js +1 -1
- package/dist/render/lib/document/blocks/general/section-to-box-rows-docbody.js +2 -2
- package/dist/render/lib/document/blocks/general/section-to-box-rows-editorial.js +1 -1
- package/dist/render/lib/document/blocks/general/section-to-box-rows-locations.js +1 -1
- package/dist/render/lib/document/blocks/general/section-to-box-rows-logos.js +1 -1
- package/dist/render/lib/document/blocks/general/section-to-box-rows-pageheader.d.ts +1 -0
- package/dist/render/lib/document/blocks/general/section-to-box-rows-pageheader.js +1 -1
- package/dist/render/lib/document/blocks/general/section-to-box-rows-stats.d.ts +5 -0
- package/dist/render/lib/document/blocks/general/section-to-box-rows-stats.js +1 -1
- package/dist/render/lib/document/blocks/general/section-to-box-rows-strip.d.ts +1 -1
- package/dist/render/lib/document/blocks/general/section-to-box-rows-strip.js +1 -1
- package/dist/render/lib/document/blocks/general/section-to-box-rows-timeline.js +2 -2
- package/dist/render/lib/document/head-core-boxes.js +1 -1
- package/dist/render/lib/document/part-styles.d.ts +2 -0
- package/dist/render/lib/document/part-styles.js +2 -2
- package/dist/render/lib/document/passes/box-join.d.ts +2 -0
- package/dist/render/lib/document/passes/box-join.js +1 -0
- package/dist/render/lib/document/passes/index.js +1 -1
- package/dist/render/lib/document/passes/section-width.js +1 -1
- package/dist/render/lib/sections/card-list-style.d.ts +18 -0
- package/dist/render/lib/sections/card-list-style.js +1 -0
- package/dist/render/lib/sections/payment-rows.d.ts +16 -0
- package/dist/render/lib/sections/payment-rows.js +1 -0
- package/dist/render/lib/sections/section-to-box.d.ts +1 -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 Q,textStyleCaseOfCss as tt}from"efficient-easel/draw";import{FONT_OPTIONS as et,fontOption as nt,fontRoleOf as z,SIZE_STEP_OF_ROLE as $}from"../../../format/lib/fonts.js";import{encodePartKey as D}from"../../../format/lib/document/part-key.js";import{decodePartId as v,normalizePartText as w}from"./text-parts.js";import{partInkCss as ot}from"../../../format/lib/document/part-inks.js";import{regionStyle as rt}from"../../../format/lib/sections/text-regions.js";import{PHONE_MEDIA as it,TABLET_MEDIA as at,viewOverrides as st}from"../content/view-values.js";import{plainRecord as O,propsWithPartRecord as ft,readPartRecord as ct,readPartRecords as lt}from"../../../format/lib/document/part-records.js";const N="_partStyles",ut="data-sf-part-styled",C="data-sf-text-style",pt=/^(heading|body)-[1-7]$/;function S(t){return typeof t=="string"&&pt.test(t)}const W={heading:"heading-1",heading2:"heading-2",heading3:"heading-3",body:"body-1",label:"body-5"};function dt(t){if(!t)return null;for(const[e,n]of Object.entries(W))if(n===t)return e;return null}function be(t){if(S(t.textStyle))return t.textStyle;const e=z(t.role);return e?W[e]:void 0}const xt=[400,500,600,700],_=["left","center","right","justify"],y=5,k=1e3,ht=-5,St=10,mt=0,gt=64,bt=2,G={size:{min:y,max:k,step:1},sizeTablet:{min:y,max:k,step:1},sizePhone:{min:y,max:k,step:1},padding:{min:mt,max:gt,step:bt}},Pt=.05,Tt=.01,Rt=["line","letter"],zt=.5,_t=2.5,At=-1,Et=1,$t=0,wt=400,Ot=[...new Set(Object.values($))];function Pe(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 Te(t){return lt(t,N)}function B(t,e){return ct(t,N,e)}function Re(t,e){return Object.values(B(t,e)).filter(n=>n!==void 0).length}function K(t,e,n){return ft(t,N,e,Nt(n).length?n:null)}function Nt(t){return Object.entries(t).filter(([,e])=>e!==void 0)}function yt(t){return Rt.includes(t)}const T=(t,e,n)=>Math.min(n,Math.max(e,t));function kt(t,e){if(yt(t)){const n=Math.round(Number(e));return!Number.isFinite(n)||n===0?null:T(n,ht,St)}if(t==="lineHeight"){const n=Number(e);return Number.isFinite(n)?g(T(n,zt,_t),3):null}if(t==="letterSpacing"){const n=Number(e);return Number.isFinite(n)?g(T(n,At,Et),4):null}if(t==="paragraphSpacing"){const n=Math.round(Number(e));return!Number.isFinite(n)||n<=0?null:T(n,$t,wt)}if(Object.hasOwn(G,t)){const{min:n,max:o}=G[t],r=Math.round(Number(e));return Number.isFinite(r)?T(r,n,o):null}return t==="italic"?typeof e=="boolean"?e:null:t==="role"||t==="fontRole"?z(e)?e:null:t==="sizeToken"?I(e)?e:null:t==="textStyle"?S(e)?e:null:t==="alignPhone"?_.includes(e)?e:null:e}const It=["weight","size","sizeTablet","sizePhone","line","letter","lineHeight","letterSpacing","paragraphSpacing","padding"];function R(t){let e=null;const n=o=>{e??={...t},delete e[o]};for(const o of It){const r=t[o];r!==void 0&&!(typeof r=="number"&&Number.isFinite(r))&&n(o)}return t.align!==void 0&&!_.includes(t.align)&&n("align"),t.alignPhone!==void 0&&!_.includes(t.alignPhone)&&n("alignPhone"),t.textStyle!==void 0&&!S(t.textStyle)&&n("textStyle"),t.sizeToken!==void 0&&!I(t.sizeToken)&&n("sizeToken"),t.fontRole!==void 0&&!z(t.fontRole)&&n("fontRole"),e??t}function I(t){if(!t||typeof t!="object")return!1;const{step:e,px:n,stepPhone:o,pxPhone:r,fluid:i}=t,f=s=>typeof s=="number"&&Number.isFinite(s)&&s>0,u=s=>typeof s=="string"&&Ot.includes(s);return u(e)&&f(n)&&(o===void 0||u(o))&&(r===void 0||f(r))&&(i===void 0||Ft(i,n))}function Ft(t,e){if(!t||typeof t!="object"||Array.isArray(t))return!1;const{minPx:n,vw:o,...r}=t;return Object.keys(r).length===0&&typeof n=="number"&&Number.isFinite(n)&&n>0&&n<e&&typeof o=="number"&&Number.isFinite(o)&&o>0&&o<=100}function F(t){return t?.pxPhone&&I(t)?{step:t.stepPhone??t.step,px:t.pxPhone}:null}function X({step:t,px:e,fluid:n}){const o=n?`clamp(${n.minPx}px, ${n.vw}vw, ${e}px)`:`${e}px`,r=`var(--size-${t}, ${o})`;return t.startsWith("heading")?`min(${r}, var(--sf-heading-max,9999px))`:r}const Mt=[["font","role"],["font","fontRole"],["role","textStyle"],["line","lineHeight"],["letter","letterSpacing"]];function Lt(t){const e=[];for(const[n,o]of Mt)n===t?e.push(o):o===t&&e.push(n);return e}function ze(t,e,n,o){const r={...B(t,e)},i=o==null?null:kt(n,o);if(i===null)delete r[n];else{r[n]=i;for(const f of Lt(n))delete r[f]}return K(t,e,r)}function _e(t,e){return K(t,e,{})}function jt(t){return tt(t)??"none"}function Ht(t){return Q(t)??""}const U={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 Dt(t,e){const n=z(t.role);return n||(e?.blockDrawsStyle?null:dt(t.textStyle))}function Ae(t,e){return t==="Text"&&e==="text"}const vt={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 Ct(t){const e=$[t],n=vt[e];return n?`var(--size-${e}, ${n})`:`var(--size-${e})`}function Wt(t){const e={};return typeof t.lineHeight=="number"?e.lineHeight=t.lineHeight:t.line&&(e.lineHeight=g(Gt+t.line*Pt,3)),typeof t.letterSpacing=="number"?e.letterSpacingEm=t.letterSpacing:t.letter&&(e.letterSpacingEm=g(t.letter*Tt,4)),e}const Gt=1,m="--sf-part-para";function Bt(t){t=R(t);const e={};if(typeof t.sizePhone=="number"&&t.sizePhone>0)e.fontSize=`${t.sizePhone}px`;else{const n=F(t.sizeToken);if(n)e.fontSize=X(n);else{const o=A(t);o!==void 0&&(e.fontSize=`${o}px`)}}return t.alignPhone&&(e.textAlign=t.alignPhone),e}function A(t){const e=st("textSize",t.size,t.sizeTablet,void 0).tablet;return e&&e>0?e:void 0}function Kt(t){const e=A(R(t));return e===void 0?{}:{fontSize:`${e}px`}}function Xt(t,e){if(e==="desktop")return t;const n=R(t),o=A(n);if(e==="tablet")return o===void 0?t:{...t,size:o};let r=t;if(typeof n.sizePhone=="number"&&n.sizePhone>0)r={...r,size:n.sizePhone};else{const i=F(n.sizeToken);i?r={...r,size:void 0,sizeToken:i}:o!==void 0&&(r={...r,size:o})}return n.alignPhone&&(r={...r,align:n.alignPhone}),r}function M(t,e,n){return L(Xt(t,e),E,n)}function Ut(t){return t==="mobile"?"sizePhone":t==="tablet"?"sizeTablet":"size"}function Ee(t,e){if(e==="desktop")return null;const n=R(t);if(e==="mobile"){if(F(n.sizeToken))return null;const o=A(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 V(t,e){const n=Ut(e);if(!Object.hasOwn(t,n))return t;const o={...t};return delete o[n],o}function $e(t,e,n){const o=M(V(t,e),e,n);return{fontFamily:o.fontFamily,fontSize:o.fontSize}}function L(t,e,n){t=R(t);const o=Dt(t,n),r=Wt(t),i=t.size?`${t.size}px`:t.sizeToken?X(t.sizeToken):o?Ct(o):"";return{fontFamily:t.font?qt(t.font):t.fontRole?`var(${U[t.fontRole]})`:o?`var(${U[o]})`:"",fontWeight:t.weight?String(t.weight):"",fontSize:i,minWidth:i?"0":"",overflowWrap:i?"break-word":"",lineHeight:r.lineHeight!==void 0?String(r.lineHeight):"",letterSpacing:r.letterSpacingEm!==void 0?`${r.letterSpacingEm}em`:"",[m]:t.paragraphSpacing?`${t.paragraphSpacing}px`:"",textTransform:Ht(t.case),textAlign:t.align??"",paddingTop:Y(t.padding),paddingBottom:Y(t.padding),color:Vt(t.color),fontStyle:t.italic===!0?"italic":t.italic===!1?"normal":""}}const Vt=t=>ot(t),Y=t=>t===void 0?"":`${t}px`,g=(t,e)=>Number(t.toFixed(e));function we(t,e){const n=Number.parseFloat(t.fontSize)||16,o=Number.parseFloat(t.lineHeight),r=Number.parseFloat(t.letterSpacing),i=Number.parseFloat(t.paddingTop);return{fontKey:e,sizePx:n,weight:Yt(Number.parseInt(t.fontWeight,10)),lineRatio:Number.isFinite(o)?g(o/n,3):1.2,letterEm:Number.isFinite(r)?g(r/n,4):0,align:Zt(t.textAlign),case:jt(t.textTransform),paddingPx:Number.isFinite(i)?Math.round(i):0}}function Yt(t){return Number.isFinite(t)?xt.reduce((e,n)=>Math.abs(n-t)<Math.abs(e-t)?n:e):400}function Zt(t){for(const e of _)if(e===t)return e;return t==="end"?"right":"left"}function Oe(t,e){const n=Z(t);if(!n)return"";for(const o of et)if(Z(e(o.cssVar))===n)return o.key;return""}const Z=t=>(t.split(",")[0]??"").replace(/["']/g,"").replace(/\s+/g," ").trim().toLowerCase();function qt(t){const e=nt(t);return e?`var(${e.cssVar})`:""}function Ne(t,e,n,o){return!e||v(e)?.nodeId!==t?null:n.find(i=>o(i.getAttribute("class")))??n[0]??null}function Jt(t,e){return Object.hasOwn(t,e)?O(t[e])??{}:{}}function ye(t,e,n=()=>E,o=u=>u,r=ee,i="desktop",f=()=>!1){let u=0;for(const{element:s,partId:p}of t){const x=v(p)?.propKey;if(!x)continue;const a=Jt(e,o(x)),l=M(a,i,{blockDrawsStyle:f(x)});S(a.textStyle)?s.setAttribute?.(C,a.textStyle):s.removeAttribute?.(C);const d=H.some(h=>s.style[h]);let c=!1;for(const[h,P]of Object.entries(l))re(s,h,P),P&&(c=!0);if(d||H.some(h=>l[h]))for(const h of Qt(s,r))for(const P of H)h.style[P]=l[P]??"";c&&(u+=1)}return u}function Qt(t,e){const n=w(t.textContent??""),o=[];let r=t;for(let i=0;i<te&&e(r);i+=1){const f=r.parentElement;if(!f||w(f.textContent??"")!==n)break;o.push(f),r=f}return o}const te=8;function ee(t){const e=t;return typeof window>"u"||!e?.ownerDocument?!1:window.getComputedStyle(e).display==="inline"}const E={fontKey:"",sizePx:16,weight:400,lineRatio:1,letterEm:0,align:"left",case:"none",paddingPx:0};function ne(t){if(!t||typeof t!="object")return null;const e={};return S(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),Object.keys(e).length?e:null}function oe(t,e){const n=ne(t);if(!n)return{};const o=M(n,e);return{...o.fontFamily?{fontFamily:o.fontFamily}:{},...o.fontSize?{fontSize:o.fontSize}:{}}}function ke(t){return S(t?.textStyle)||!!t?.role||typeof t?.size=="number"&&t.size>0}function Ie(t,e,n){if(!t||typeof t!="object")return{};const o=rt(t.role,e,$)??{},r=e.sized?oe(V(t,n),n):{};return{...o,...r}}function Fe(t,e,n){n.fontFamily&&t.fontFamily===n.fontFamily&&(t.fontFamily=e.fontFamily),n.fontSize&&t.fontSize===n.fontSize&&(t.fontSize=e.fontSize)}function re(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 r=t;e===m&&(n?r.setAttribute?.(q,""):r.removeAttribute?.(q))}const q="data-sf-part-para",ie=Object.keys(L({},E)),j=new Set(["color","overflowWrap",m,"fontStyle"]),H=ie.filter(t=>!j.has(t));function Me(t,e,n,o=u=>u,r=()=>!1,i=()=>null,f=[]){const u=new Map;for(const a of t){const l=D(a.key,a.row);for(const d of a.texts){const c=u.get(d);c?(c.keys.add(a.key),c.partKeys.add(l)):u.set(d,{keys:new Set([a.key]),partKeys:new Set([l])})}}const s=new Map;for(const a of new Set([...Object.keys(e),...f])){if(!ae(a))continue;const l=J(n,a,O(e[a])??{},!1,i(a));l&&s.set(a,l)}const p=a=>{const l=o(a),d=i(l);if(!Object.hasOwn(e,l)&&!d)return null;const c=O(e[l])??{};return J(n,a,c,r(a),d)},x=new Map;for(const[a,{keys:l,partKeys:d}]of u){const c=d.size===1?[...d][0]:l.size===1?[...l][0]:null;if(!c)continue;const b=p(c);b&&x.set(a,b)}for(const a of t){if(!a.keyed)continue;const l=p(D(a.key,a.row));l&&s.set(a.key,l)}return x.size||s.size?{rules:x,kindRules:s,drawn:new Set(u.keys())}:null}function J(t,e,n,o,r){const i=L(n,E,{blockDrawsStyle:o}),f=Kt(n),u=Bt(n),s=S(n.textStyle)?n.textStyle:void 0;return!Object.values(i).some(Boolean)&&!Object.keys(f).length&&!Object.keys(u).length&&!s&&!r?null:{stamp:se(t,e),declarations:i,...Object.keys(f).length?{tablet:f}:{},...Object.keys(u).length?{phone:u}:{},...s?{textStyle:s}:{},...r?{motion:r}:{}}}function ae(t){return t.startsWith("@")}function Le(t,e){return t?.kindRules.get(e)??null}function se(t,e){const n=o=>o.replace(/[^A-Za-z0-9_-]+/g,"-");return`${n(t)}~${n(e)}`}function je(t){const e=[],n=new Set,o=r=>{const{stamp:i,declarations:f}=r;if(n.has(i))return;n.add(i);const u=Object.entries(f).filter(([,c])=>c!==""),s=c=>c.map(([b,h])=>`${ce(b)}: ${h}`).join("; "),p=`[${ut}="${i}"]`,x=u.filter(([c])=>!j.has(c)),a=u.filter(([c])=>j.has(c));x.length&&e.push(`${p}, *:has(> ${p}) { ${s(x)} }`),a.length&&e.push(`${p} { ${s(a)} }`),f[m]&&(e.push(`*:has(> ${p}) { ${m}: ${f[m]} }`),e.push(...fe(p,`*:has(> ${p})`)));const l=Object.entries(r.tablet??{}).filter(([,c])=>c!=="");l.length&&e.push(`@media ${at} { ${p}, *:has(> ${p}) { ${s(l)} } }`);const d=Object.entries(r.phone??{}).filter(([,c])=>c!=="");d.length&&e.push(`@media ${it} { ${p}, *:has(> ${p}) { ${s(d)} } }`)};for(const r of t.rules.values())o(r);for(const r of t.kindRules.values())o(r);return e.join(`
|
|
2
|
-
`)}function
|
|
1
|
+
import{textStyleCaseCss as tt,textStyleCaseOfCss as et}from"efficient-easel/draw";import{FONT_OPTIONS as nt,fontOption as ot,fontRoleOf as A,SIZE_STEP_OF_ROLE as w}from"../../../format/lib/fonts.js";import{encodePartKey as v}from"../../../format/lib/document/part-key.js";import{decodePartId as C,normalizePartText as O}from"./text-parts.js";import{partInkCss as rt}from"../../../format/lib/document/part-inks.js";import{regionStyle as it}from"../../../format/lib/sections/text-regions.js";import{PHONE_MEDIA as at,TABLET_MEDIA as st,viewOverrides as ft}from"../content/view-values.js";import{plainRecord as N,propsWithPartRecord as lt,readPartRecord as ct,readPartRecords as ut}from"../../../format/lib/document/part-records.js";const k="_partStyles",pt="data-sf-part-styled",W="data-sf-text-style",dt=/^(heading|body)-[1-7]$/;function h(t){return typeof t=="string"&&dt.test(t)}const G={heading:"heading-1",heading2:"heading-2",heading3:"heading-3",body:"body-1",label:"body-5"};function xt(t){if(!t)return null;for(const[e,n]of Object.entries(G))if(n===t)return e;return null}function Pe(t){if(h(t.textStyle))return t.textStyle;const e=A(t.role);return e?G[e]:void 0}const gt=[400,500,600,700],R=["left","center","right","justify"],y=5,F=1e3,ht=-5,St=10,mt=0,bt=64,Pt=2,B={size:{min:y,max:F,step:1},sizeTablet:{min:y,max:F,step:1},sizePhone:{min:y,max:F,step:1},padding:{min:mt,max:bt,step:Pt}},Tt=.05,Rt=.01,zt=["line","letter"],At=.5,_t=2.5,Et=-1,$t=1,wt=0,Ot=400,Nt=[...new Set(Object.values(w))];function Te(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 Re(t){return ut(t,k)}function K(t,e){return ct(t,k,e)}function ze(t,e){return Object.values(K(t,e)).filter(n=>n!==void 0).length}function X(t,e,n){return lt(t,k,e,kt(n).length?n:null)}function kt(t){return Object.entries(t).filter(([,e])=>e!==void 0)}function yt(t){return zt.includes(t)}const z=(t,e,n)=>Math.min(n,Math.max(e,t));function Ft(t,e){if(yt(t)){const n=Math.round(Number(e));return!Number.isFinite(n)||n===0?null:z(n,ht,St)}if(t==="lineHeight"){const n=Number(e);return Number.isFinite(n)?b(z(n,At,_t),3):null}if(t==="letterSpacing"){const n=Number(e);return Number.isFinite(n)?b(z(n,Et,$t),4):null}if(t==="paragraphSpacing"){const n=Math.round(Number(e));return!Number.isFinite(n)||n<=0?null:z(n,wt,Ot)}if(Object.hasOwn(B,t)){const{min:n,max:o}=B[t],r=Math.round(Number(e));return Number.isFinite(r)?z(r,n,o):null}return t==="italic"?typeof e=="boolean"?e:null:t==="role"||t==="fontRole"?A(e)?e:null:t==="sizeToken"?I(e)?e:null:t==="textStyle"?h(e)?e:null:t==="alignPhone"||t==="alignTablet"?R.includes(e)?e:null:e}const It=["weight","size","sizeTablet","sizePhone","line","letter","lineHeight","letterSpacing","paragraphSpacing","padding"];function m(t){let e=null;const n=o=>{e??={...t},delete e[o]};for(const o of It){const r=t[o];r!==void 0&&!(typeof r=="number"&&Number.isFinite(r))&&n(o)}return 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&&!h(t.textStyle)&&n("textStyle"),t.sizeToken!==void 0&&!I(t.sizeToken)&&n("sizeToken"),t.fontRole!==void 0&&!A(t.fontRole)&&n("fontRole"),e??t}function I(t){if(!t||typeof t!="object")return!1;const{step:e,px:n,stepPhone:o,pxPhone:r,fluid:i}=t,f=l=>typeof l=="number"&&Number.isFinite(l)&&l>0,a=l=>typeof l=="string"&&Nt.includes(l);return a(e)&&f(n)&&(o===void 0||a(o))&&(r===void 0||f(r))&&(i===void 0||Mt(i,n))}function Mt(t,e){if(!t||typeof t!="object"||Array.isArray(t))return!1;const{minPx:n,vw:o,...r}=t;return Object.keys(r).length===0&&typeof n=="number"&&Number.isFinite(n)&&n>0&&n<e&&typeof o=="number"&&Number.isFinite(o)&&o>0&&o<=100}function M(t){return t?.pxPhone&&I(t)?{step:t.stepPhone??t.step,px:t.pxPhone}:null}function U({step:t,px:e,fluid:n}){const o=n?`clamp(${n.minPx}px, ${n.vw}vw, ${e}px)`:`${e}px`,r=`var(--size-${t}, ${o})`;return t.startsWith("heading")?`min(${r}, var(--sf-heading-max,9999px))`:r}const Lt=[["font","role"],["font","fontRole"],["role","textStyle"],["line","lineHeight"],["letter","letterSpacing"]];function jt(t){const e=[];for(const[n,o]of Lt)n===t?e.push(o):o===t&&e.push(n);return e}function Ae(t,e,n,o){const r={...K(t,e)},i=o==null?null:Ft(n,o);if(i===null)delete r[n];else{r[n]=i;for(const f of jt(n))delete r[f]}return X(t,e,r)}function _e(t,e){return X(t,e,{})}function Ht(t){return et(t)??"none"}function Dt(t){return tt(t)??""}const V={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 vt(t,e){const n=A(t.role);return n||(e?.blockDrawsStyle?null:xt(t.textStyle))}function Ee(t,e){return t==="Text"&&e==="text"}const Ct={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 Wt(t){const e=w[t],n=Ct[e];return n?`var(--size-${e}, ${n})`:`var(--size-${e})`}function Gt(t){const e={};return typeof t.lineHeight=="number"?e.lineHeight=t.lineHeight:t.line&&(e.lineHeight=b(Bt+t.line*Tt,3)),typeof t.letterSpacing=="number"?e.letterSpacingEm=t.letterSpacing:t.letter&&(e.letterSpacingEm=b(t.letter*Rt,4)),e}const Bt=1,S="--sf-part-para";function Kt(t){t=m(t);const e={};if(typeof t.sizePhone=="number"&&t.sizePhone>0)e.fontSize=`${t.sizePhone}px`;else{const o=M(t.sizeToken);if(o)e.fontSize=U(o);else{const r=E(t);r!==void 0&&(e.fontSize=`${r}px`)}}const n=t.alignPhone??_(t);return n&&(e.textAlign=n),e}function _(t){return t.alignTablet&&t.alignTablet!==t.align?t.alignTablet:void 0}function E(t){const e=ft("textSize",t.size,t.sizeTablet,void 0).tablet;return e&&e>0?e:void 0}function Xt(t){const e=m(t),n={},o=E(e);o!==void 0&&(n.fontSize=`${o}px`);const r=_(e);return r&&(n.textAlign=r),n}function $e(t,e){if(e==="desktop")return;const n=m(t);return(e==="mobile"?_(n):void 0)??n.align}function Ut(t,e){if(e==="desktop")return t;const n=m(t),o=E(n),r=_(n);if(e==="tablet"){let a=t;return o!==void 0&&(a={...a,size:o}),r&&(a={...a,align:r}),a}let i=t;if(typeof n.sizePhone=="number"&&n.sizePhone>0)i={...i,size:n.sizePhone};else{const a=M(n.sizeToken);a?i={...i,size:void 0,sizeToken:a}:o!==void 0&&(i={...i,size:o})}const f=n.alignPhone??r;return f&&(i={...i,align:f}),i}function L(t,e,n){return j(Ut(t,e),$,n)}function Vt(t){return t==="mobile"?"sizePhone":t==="tablet"?"sizeTablet":"size"}function we(t,e){if(e==="desktop")return null;const n=m(t);if(e==="mobile"){if(M(n.sizeToken))return null;const o=E(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 Y(t,e){const n=Vt(e);if(!Object.hasOwn(t,n))return t;const o={...t};return delete o[n],o}function Oe(t,e,n){const o=L(Y(t,e),e,n);return{fontFamily:o.fontFamily,fontSize:o.fontSize}}function j(t,e,n){t=m(t);const o=vt(t,n),r=Gt(t),i=t.size?`${t.size}px`:t.sizeToken?U(t.sizeToken):o?Wt(o):"";return{fontFamily:t.font?Jt(t.font):t.fontRole?`var(${V[t.fontRole]})`:o?`var(${V[o]})`:"",fontWeight:t.weight?String(t.weight):"",fontSize:i,minWidth:i?"0":"",overflowWrap:i?"break-word":"",lineHeight:r.lineHeight!==void 0?String(r.lineHeight):"",letterSpacing:r.letterSpacingEm!==void 0?`${r.letterSpacingEm}em`:"",[S]:t.paragraphSpacing?`${t.paragraphSpacing}px`:"",textTransform:Dt(t.case),textAlign:t.align??"",paddingTop:Z(t.padding),paddingBottom:Z(t.padding),color:Yt(t.color),fontStyle:t.italic===!0?"italic":t.italic===!1?"normal":""}}const Yt=t=>rt(t),Z=t=>t===void 0?"":`${t}px`,b=(t,e)=>Number(t.toFixed(e));function Ne(t,e){const n=Number.parseFloat(t.fontSize)||16,o=Number.parseFloat(t.lineHeight),r=Number.parseFloat(t.letterSpacing),i=Number.parseFloat(t.paddingTop);return{fontKey:e,sizePx:n,weight:Zt(Number.parseInt(t.fontWeight,10)),lineRatio:Number.isFinite(o)?b(o/n,3):1.2,letterEm:Number.isFinite(r)?b(r/n,4):0,align:qt(t.textAlign),case:Ht(t.textTransform),paddingPx:Number.isFinite(i)?Math.round(i):0}}function Zt(t){return Number.isFinite(t)?gt.reduce((e,n)=>Math.abs(n-t)<Math.abs(e-t)?n:e):400}function qt(t){for(const e of R)if(e===t)return e;return t==="end"?"right":"left"}function ke(t,e){const n=q(t);if(!n)return"";for(const o of nt)if(q(e(o.cssVar))===n)return o.key;return""}const q=t=>(t.split(",")[0]??"").replace(/["']/g,"").replace(/\s+/g," ").trim().toLowerCase();function Jt(t){const e=ot(t);return e?`var(${e.cssVar})`:""}function ye(t,e,n,o){return!e||C(e)?.nodeId!==t?null:n.find(i=>o(i.getAttribute("class")))??n[0]??null}function Qt(t,e){return Object.hasOwn(t,e)?N(t[e])??{}:{}}function Fe(t,e,n=()=>$,o=a=>a,r=ne,i="desktop",f=()=>!1){let a=0;for(const{element:l,partId:p}of t){const x=C(p)?.propKey;if(!x)continue;const s=Qt(e,o(x)),u=L(s,i,{blockDrawsStyle:f(x)});h(s.textStyle)?l.setAttribute?.(W,s.textStyle):l.removeAttribute?.(W);const d=D.some(g=>l.style[g]);let c=!1;for(const[g,T]of Object.entries(u))ie(l,g,T),T&&(c=!0);if(d||D.some(g=>u[g]))for(const g of te(l,r))for(const T of D)g.style[T]=u[T]??"";c&&(a+=1)}return a}function te(t,e){const n=O(t.textContent??""),o=[];let r=t;for(let i=0;i<ee&&e(r);i+=1){const f=r.parentElement;if(!f||O(f.textContent??"")!==n)break;o.push(f),r=f}return o}const ee=8;function ne(t){const e=t;return typeof window>"u"||!e?.ownerDocument?!1:window.getComputedStyle(e).display==="inline"}const $={fontKey:"",sizePx:16,weight:400,lineRatio:1,letterEm:0,align:"left",case:"none",paddingPx:0};function oe(t){if(!t||typeof t!="object")return null;const e={};return h(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),Object.keys(e).length?e:null}function re(t,e){const n=oe(t);if(!n)return{};const o=L(n,e);return{...o.fontFamily?{fontFamily:o.fontFamily}:{},...o.fontSize?{fontSize:o.fontSize}:{}}}function Ie(t){return h(t?.textStyle)||!!t?.role||typeof t?.size=="number"&&t.size>0}function Me(t,e,n){if(!t||typeof t!="object")return{};const o=it(t.role,e,w)??{},r=e.sized?re(Y(t,n),n):{};return{...o,...r}}function Le(t,e,n){n.fontFamily&&t.fontFamily===n.fontFamily&&(t.fontFamily=e.fontFamily),n.fontSize&&t.fontSize===n.fontSize&&(t.fontSize=e.fontSize)}function ie(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 r=t;e===S&&(n?r.setAttribute?.(J,""):r.removeAttribute?.(J))}const J="data-sf-part-para",ae=Object.keys(j({},$)),H=new Set(["color","overflowWrap",S,"fontStyle"]),D=ae.filter(t=>!H.has(t));function je(t,e,n,o=a=>a,r=()=>!1,i=()=>null,f=[]){const a=new Map;for(const s of t){const u=v(s.key,s.row);for(const d of s.texts){const c=a.get(d);c?(c.keys.add(s.key),c.partKeys.add(u)):a.set(d,{keys:new Set([s.key]),partKeys:new Set([u])})}}const l=new Map;for(const s of new Set([...Object.keys(e),...f])){if(!se(s))continue;const u=Q(n,s,N(e[s])??{},!1,i(s));u&&l.set(s,u)}const p=s=>{const u=o(s),d=i(u);if(!Object.hasOwn(e,u)&&!d)return null;const c=N(e[u])??{};return Q(n,s,c,r(s),d)},x=new Map;for(const[s,{keys:u,partKeys:d}]of a){const c=d.size===1?[...d][0]:u.size===1?[...u][0]:null;if(!c)continue;const P=p(c);P&&x.set(s,P)}for(const s of t){if(!s.keyed)continue;const u=p(v(s.key,s.row));u&&l.set(s.key,u)}return x.size||l.size?{rules:x,kindRules:l,drawn:new Set(a.keys())}:null}function Q(t,e,n,o,r){const i=j(n,$,{blockDrawsStyle:o}),f=Xt(n),a=Kt(n),l=h(n.textStyle)?n.textStyle:void 0;return!Object.values(i).some(Boolean)&&!Object.keys(f).length&&!Object.keys(a).length&&!l&&!r?null:{stamp:fe(t,e),declarations:i,...Object.keys(f).length?{tablet:f}:{},...Object.keys(a).length?{phone:a}:{},...l?{textStyle:l}:{},...r?{motion:r}:{}}}function se(t){return t.startsWith("@")}function He(t,e){return t?.kindRules.get(e)??null}function fe(t,e){const n=o=>o.replace(/[^A-Za-z0-9_-]+/g,"-");return`${n(t)}~${n(e)}`}function De(t){const e=[],n=new Set,o=r=>{const{stamp:i,declarations:f}=r;if(n.has(i))return;n.add(i);const a=Object.entries(f).filter(([,c])=>c!==""),l=c=>c.map(([P,g])=>`${ce(P)}: ${g}`).join("; "),p=`[${pt}="${i}"]`,x=a.filter(([c])=>!H.has(c)),s=a.filter(([c])=>H.has(c));x.length&&e.push(`${p}, *:has(> ${p}) { ${l(x)} }`),s.length&&e.push(`${p} { ${l(s)} }`),f[S]&&(e.push(`*:has(> ${p}) { ${S}: ${f[S]} }`),e.push(...le(p,`*:has(> ${p})`)));const u=Object.entries(r.tablet??{}).filter(([,c])=>c!=="");u.length&&e.push(`@media ${st} { ${p}, *:has(> ${p}) { ${l(u)} } }`);const d=Object.entries(r.phone??{}).filter(([,c])=>c!=="");d.length&&e.push(`@media ${at} { ${p}, *:has(> ${p}) { ${l(d)} } }`)};for(const r of t.rules.values())o(r);for(const r of t.kindRules.values())o(r);return e.join(`
|
|
2
|
+
`)}function le(t,e){const n=`var(${S})`,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 ce=t=>t.replace(/[A-Z]/g,e=>`-${e.toLowerCase()}`);function ve(t,e){if(!t)return null;const n=O(e),o=t.rules.get(n);if(o)return o;if(n.length<ue||t.drawn.has(n))return null;let r=null;for(const[i,f]of t.rules)if(i.includes(n)){if(r&&r.stamp!==f.stamp)return null;r=f}return r}const ue=8;export{R as PART_ALIGNS,$t as PART_LETTER_EM_MAX,Et as PART_LETTER_EM_MIN,Rt as PART_LETTER_STEP,_t as PART_LINE_HEIGHT_MAX,At as PART_LINE_HEIGHT_MIN,Tt as PART_LINE_STEP,B as PART_MEASURED_TRACKS,St as PART_NUDGE_MAX,ht as PART_NUDGE_MIN,bt as PART_PADDING_MAX,mt as PART_PADDING_MIN,Pt as PART_PADDING_STEP,J as PART_PARAGRAPH_ATTR,Ot as PART_PARAGRAPH_MAX,wt as PART_PARAGRAPH_MIN,S as PART_PARAGRAPH_VAR,zt as PART_RELATIVE_PROPS,F as PART_SIZE_MAX,y as PART_SIZE_MIN,Nt as PART_SIZE_STEPS,pt as PART_STYLED_ATTR,k as PART_STYLES_PROP,ae as PART_STYLE_PROPERTIES,gt as PART_WEIGHTS,D as SHARED_PART_PROPERTIES,G as STYLE_ID_OF_ROLE,W as TEXT_STYLE_ATTR,Fe as applyPartStyles,Ee as blockDrawsTextStyle,Pe as followedStyleOf,se as isPartKindKey,h as isTextStyleId,le as paragraphRules,$e as partAlignFollowed,L as partCanvasDeclarations,Ht as partCaseOfTransform,Dt as partCaseTransform,ke as partFontKeyOf,Te as partLiftRules,Kt as partPhoneDeclarations,He as partRuleForKind,ve as partRuleForText,Oe as partShownDeclarations,Vt as partSizeBoxOf,we as partSizeFollowed,Gt as partSpacingOf,Ne as partStyleBase,ze as partStyleCount,De as partStyleCss,j as partStyleDeclarations,Ut as partStyleForScreen,ye as partStyleSource,Y as partStyleWithoutSizeBox,Xt as partTabletDeclarations,Ae as propsWithPartStyleValue,_e as propsWithoutPartStyle,je as publishedPartStyles,K as readPartStyle,Re as readPartStyles,re as regionCanvasDeclarations,Le as regionCanvasRestore,Ie as regionHasOwnLook,oe as regionSheetStyle,Me as regionShownDeclarations,Qt as storedPartStyle};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{Fragment as t,jsx as i}from"react/jsx-runtime";import{useSectionRoot as s}from"../../../components/SiteGutterFrame.js";import{BOX_TYPE as d}from"../../../../format/lib/document/container-blocks.js";import{JoinBox as m}from"../../../components/JoinBox.js";import{tickerJoinPinClass as a,tickerJoinSide as c}from"../../../../format/lib/sections/ticker-join.js";function f({side:n,children:r}){return s()?i(m,{children:i("div",{className:a(n),children:r})}):i(t,{children:r})}const h={name:"boxJoin",applies:(n,r,e)=>n===d&&!!e&&typeof e.render=="function",draw(n){const r=n.render;n.render=e=>{const o=c(e.join);return o?i(f,{side:o,children:r(e)}):r(e)}}};export{h as boxJoin};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{catalogueLabel as e}from"../../../../format/lib/document/passes/catalogue-labels.js";import{blockSize as n}from"./block-size.js";import{cardTemplateOnInsert as s}from"../../../../format/lib/document/passes/card-template-on-insert.js";import{cellWidth as
|
|
1
|
+
import{catalogueLabel as e}from"../../../../format/lib/document/passes/catalogue-labels.js";import{blockSize as n}from"./block-size.js";import{boxJoin as p}from"./box-join.js";import{cardTemplateOnInsert as s}from"../../../../format/lib/document/passes/card-template-on-insert.js";import{cellWidth as c}from"./cell-width.js";import{clickableParts as f}from"./clickable-parts.js";import{cardCorners as a,sectionCorners as l}from"./corners.js";import{emptyHeadings as d}from"../../../../format/lib/document/passes/empty-headings.js";import{showWhenRows as h}from"../../../../format/lib/document/passes/show-when-rows.js";import{headBox as u,headCore as S}from"./head-core.js";import{hiddenNodes as b}from"../../../../format/lib/document/passes/hidden-nodes.js";import{showFor as g}from"./show-for.js";import{mediaValues as w}from"../../../../format/lib/document/passes/media-values.js";import{sectionAnchor as A}from"./section-anchor.js";import{blockEntrance as P,sectionAnimation as k}from"./section-animation.js";import{sectionHeight as C}from"./section-height.js";import{cardSticky as B,sectionSticky as W}from"./section-sticky.js";import{sectionBorder as y}from"./borders.js";import{blockPadding as G,sectionPadding as T}from"./section-padding.js";import{sectionTheme as x,slideTheme as E}from"./section-theme.js";import{buttonAlignInRow as H,containedWidth as I,sectionWidth as L}from"./section-width.js";import{blockGroups as O,sectionGroups as R}from"../../../../format/lib/document/passes/settings-groups.js";import{slotsStartAfresh as z}from"./slots-start-afresh.js";import{openSlotDisallow as D,sectionGroupAllow as F}from"../../../../format/lib/document/passes/slot-rules.js";import{registryPassContext as ho}from"../../../../format/lib/document/passes/registry-context.js";const J=[z,w,S,F,D,T,l,y,a,G,P,c,L,I,H,C,A,x,k,W,B,p,E,n,R,O,h,d,f,u,g,b,e,s];function fo(r,m,o){const t=m;for(const i of J)i.applies(r,o,t)&&(o.inspector&&i.panel?.(t,r,o.inspector,o),i.draw?.(t,r,o));return m}export{J as BLOCK_PASSES,fo as applyBlockPasses,ho as registryPassContext};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{jsx as l}from"react/jsx-runtime";import{INTRO_EDGE_CLASS as
|
|
1
|
+
import{jsx as l}from"react/jsx-runtime";import{INTRO_EDGE_CLASS as V}from"../../../../format/lib/sections/intro-bleed-layout.js";import{resolveContainerDirection as U}from"../../../../format/lib/content/container-direction.js";import{HERO_BACKGROUND_VAR as $,HERO_CHROME_CAP_VAR as Y,HERO_CHROME_INSET_VAR as K,SITE_WIDTH_CAP as h,centredCap as b,heroBackgroundTokens as j}from"../../../../format/lib/content/page-width.js";import{SECTION_WIDTH_FAMILY as I,SECTION_WIDTH_KEYS as g,hasOwnSectionWidth as X,hasWidthFamily as q,resolveWidth as B,siteWidthsOf as z}from"../../../../format/lib/content/section-width.js";import{BOX_GUTTER_KEY as J,boxGutterOf as Q,boxPlaceOf as Z,boxRunsEdgeToEdge as tt,isFrameContainer as N,ownNodeWidth as nt,siteDrawsGutter as et}from"../../../../format/lib/content/site-gutter.js";import{getEditorSiteContentWidth as ot}from"../../../../format/lib/document/editor-site-widths.js";import{NestedBoxChoice as it,SectionGroupChoice as ct,SectionGroupWidthsProvider as rt,SectionRootChoice as lt,SplitBandAndColumn as G}from"../../../components/SiteGutterFrame.js";import{FRAME as D}from"../../../components/BlockFrame.js";import{sectionFillPassClass as F}from"../../../../format/lib/content/section-min-height.js";import{parentCapsWidth as dt}from"../../../../format/lib/sections/section-head-placement.js";import{addShowWhenFacts as w,withRowsShownWhen as E}from"../../../../format/lib/document/show-when-attach.js";import{findParentNode as ut,heldByANode as st,isNestedNode as at,NOT_HELD_BY_A_NODE as H}from"../../../../format/lib/document/passes/document-position.js";const O="--sf-sw-site",ft="--sf-sw-content",ht="--sf-bg-cap",_t="contents [--sf-site-width:var(--sf-sw-content)] max-view-wide:[--sf-site-width:var(--sf-sw-site)]",x=({own:t,content:n,siteContent:e})=>t===!0&&n==="full"&&e!=="full",M="contents view-wide:[--sf-site-width:100vw]",R=({held:t},n,e)=>t?e:l("div",{className:n,children:e}),Nt=`contents view-wide:[--sf-site-width:100vw] ${V} view-wide:[--sf-site-gutter:var(--intro-edge)]`,p=(t,n)=>n==="content"?`min(${t}px,var(${O}))`:`${t}px`;function C({content:t,contentMax:n},e){return t==="full"?e!=="content"?"100vw":null:n===null?null:p(n,e)}function T(t,n){return n===null?t:l("div",{className:"contents",style:{[O]:h},children:l("div",{className:_t,style:{[ft]:n},children:t})})}const wt="--sf-content-cap",Et="contents max-view-wide:[--sf-content-cap:none]";function Ot({content:t,contentMax:n},e){return t==="full"?null:n!==null?p(n,e):e==="content"?null:`var(${O})`}function Ct(t,n){return n===null?t:l("div",{className:"contents",style:{[O]:h},children:l("div",{className:Et,style:{[wt]:n},children:t})})}const s=(t,n,e="")=>t==="content"?l("div",{className:e||void 0,style:b(h),children:n}):n;function L(t,n,e,o,i){if(x(e))return s(o,R(e,M,l(G,{children:t({...n,contained:!0})})),i);if(e.content==="full")return s(o,t({...n,contained:!1}),i);const c=C(e,o);return o==="content"&&c===null&&!e.own?t({...n,contained:!0}):s(o,T(l(G,{children:t({...n,contained:!0})}),c),i)}function P(t,n,e,o){if(e==="hero"){const r=T(t(n),C(o,o.band));return o.band==="full"?l("div",{style:{[$]:"none",[K]:"initial",[Y]:"initial"},children:r}):o.band==="content"?l("div",{style:j(!0),children:r}):r}const i=o.band??"full",c=F(n);if(e==="rawMarkup"){if(o.content==="full")return s(i,t(n),c);const r=o.contentMax===null?h:p(o.contentMax,i);return l("div",{className:"contents",style:{[O]:h},children:s(i,l("div",{className:c||void 0,style:b(r),children:t(n)}),c)})}if(e==="scrollOver"){const r=o.content==="full",d=x(o)?R(o,Nt,t({...n,fullWidth:!1})):T(t({...n,fullWidth:r}),r?null:C(o,i));return i==="content"?l("div",{className:"contents",style:{[ht]:h},children:d}):d}switch(e){case"both":return s(i,Ct(t(n),Ot(o,i)),c);case"contained":return L(t,n,o,i,c);case"contentColumn":case"contentFull":case"productGrid":{const r=x(o),d=o.content==="full"&&!r?"full":"page",u=r?R(o,M,t({...n,widthMode:d})):T(t({...n,widthMode:d}),o.content==="full"?null:C(o,i));return e==="productGrid"&&!o.own?i==="content"?l("div",{className:c?`${D} ${c}`:D,children:u}):u:s(i,u,c)}default:return s(i,T(t(n),C(o,i)),c)}}function Tt(t,n){const e=I[n],o=t.render;t.render=i=>{const c=z(i),r={band:c.background,content:c.content??"content",contentMax:null},d=()=>e==="rawMarkup"?o(i):l(ct,{draw:f=>{const _=f?{...r,band:f.background==="content"?r.band:f.background??r.band,content:f.content??r.content,own:f.background==="full"||f.content!==null,held:!0,siteContent:r.content}:r,m=P(o,i,e,_);if(!N(n))return m;const A=Q(i),W=A===void 0?_.content:A?"content":"full";return W===_.content?m:l(it,{atTop:m,nested:L(o,i,{..._,content:W,own:!1},_.band??"full",F(i))})}}),u=nt(n,i);if(!X(u))return d();const a=e==="rawMarkup",S=u.background??(a?"full":c.background),y=u.content??(a?"full":r.content),v={band:S,content:S==="content"?"content":y,contentMax:u.contentMax,own:!a,siteContent:r.content};return l(lt,{own:()=>l(rt,{value:{background:v.band,content:v.content},children:P(o,i,e,v)}),followed:d})}}const St={all:[H,{not:{context:"runsEdgeToEdge",is:!0}}]},Vt={name:"sectionWidth",applies:(t,n,e)=>q(t)&&!!e&&typeof e.render=="function",panel(t,n,e){const o=e.sectionOwnWidthFields({drawsFullOnItsOwn:I[n]==="rawMarkup"}),i=N(n)?e.boxGutterFields():{},c={...t.fields,...i,...o},r=N(n)?k(n,t,c,[J]):c;w(t,{heldByANode:st}),N(n)&&w(t,{runsEdgeToEdge:d=>tt(d.props??{})}),t.fields=E(r,[g.background,g.content],N(n)?St:H)},draw(t,n){Tt(t,n)}};function vt(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 mt=new Set(["Heading","Text","ImageBlock","ButtonBlock"]),Ut={name:"containedWidth",applies:(t,n,e)=>mt.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,u=B(c?.props??{},"page"),a=S=>vt(S,u);return d&&typeof d.then=="function"?d.then(a):a(d)}},draw(t){const n=t.render;t.render=e=>{const{mode:o}=B(e,"page");return n({...e,contained:o!=="full"})}}},xt={not:{context:"inHeroGroupRow",is:!0}},$t={name:"buttonAlignInRow",applies:t=>t==="ButtonBlock",panel(t){const n=t;n.fields=E(n.fields??{},["align"],xt),w(n,{inHeroGroupRow:(e,o)=>{const i=ut(o.appState,e.props?.id);return!!i&&i.type==="HeroGroup"&&U("HeroGroup",i.props?.direction)==="row"}})}};function Rt(t){return Object.values(t).some(n=>!!n&&typeof n=="object"&&n.type==="slot")}const pt={any:[]},At={all:[{not:{context:"outsideBox",is:!0}},{not:{context:"insideSiteGutter",is:!0}}]},Wt={not:{context:"widthCappedByParent",is:!0}};function k(t,n,e,o=["widthMode"]){if(t==="ButtonBlock")return E(e,["_gWidth",...o],pt);if(Rt(e)){const i=(c,r)=>Z(r.appState?.data?.content,c.props?.id,et(ot()));return w(n,{outsideBox:(c,r)=>i(c,r)?.inBox!==!0,insideSiteGutter:(c,r)=>i(c,r)?.insideGutter}),E(e,o,At)}return w(n,{widthCappedByParent:(i,c)=>"parent"in c?dt(c.parent):at({props:i.props??{}},c)}),E(e,o,Wt)}export{ht as SECTION_BACKGROUND_VAR,Et as SECTION_CONTENT_CAP_CLASS,wt as SECTION_CONTENT_CAP_VAR,_t as SECTION_CONTENT_CLASS,ft as SECTION_CONTENT_VAR,O as SITE_CONTENT_VAR,$t as buttonAlignInRow,Ut as containedWidth,Vt as sectionWidth,vt as widthModeFields};
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
type Props = Record<string, unknown>;
|
|
2
|
+
export type CardStyle = "table" | "list";
|
|
3
|
+
export declare const CARD_STYLE_KEY = "cardStyle";
|
|
4
|
+
export interface CardStyleValues {
|
|
5
|
+
readonly items: Readonly<Props>;
|
|
6
|
+
readonly grid: Readonly<Props>;
|
|
7
|
+
readonly row: Readonly<Props>;
|
|
8
|
+
readonly card: Readonly<Props>;
|
|
9
|
+
readonly listCard: Readonly<Props>;
|
|
10
|
+
}
|
|
11
|
+
export declare const CARD_STYLES: Readonly<Record<CardStyle, CardStyleValues>>;
|
|
12
|
+
export declare const CARD_STYLE_POINTS: readonly {
|
|
13
|
+
label: string;
|
|
14
|
+
value: CardStyle;
|
|
15
|
+
}[];
|
|
16
|
+
export declare const isCardStyle: (v: unknown) => v is CardStyle;
|
|
17
|
+
export declare function applyCardStyle(props: Props, style: CardStyle, boxType: string, slot: string): Props;
|
|
18
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{phoneKey as S}from"efficient-easel/draw";import{isNode as d}from"efficient-easel/data";import{CARD_LIST_TYPE as m,CARD_TEMPLATE_SLOT as f}from"../../../format/lib/content/card-template.js";const u="cardStyle";function C(t){const{widthPhone:o,...r}=t;return t.widthFitPhone==="fixed"?{...r,widthFitPhone:"fill"}:{...t}}const h={table:{items:{gap:0,gapPhone:0,columnsTablet:2},grid:{gap:0},row:{gap:0,[S("share")]:"content"},card:{justify:"between",gap:12,gapPhone:12,sectionHeightMode:"fixed",sectionHeightValue:242,sectionHeightUnit:"px",widthFitPhone:"fixed",widthPhone:800,sectionPaddingTop:48,sectionPaddingBottom:48,sectionPaddingLeft:32,sectionPaddingRight:32,sectionBorder:{top:1,right:1,bottom:1,left:1}}},list:{items:{gap:32,gapPhone:32,phoneRow:2},grid:{gap:32,gapPhone:32},row:{gap:32,gapPhone:32},card:{justify:"start",gap:8,gapPhone:8,sectionPaddingTop:20,sectionPaddingBottom:0,sectionBorder:{top:1,right:0,bottom:0,left:0}}}},P={table:{...h.table,listCard:C(h.table.card)},list:{...h.list,listCard:C(h.list.card)}},w=[{label:"Table",value:"table"},{label:"List",value:"list"}],b=t=>t==="table"||t==="list",y=t=>[...new Set([...Object.keys(P.table[t]),...Object.keys(P.list[t])])];function g(t,o,r){const e={...t};for(const a of y(o))delete e[a];return{...e,...structuredClone(P[r][o])}}function A(t,o,r){const e=t.props??{},a=Array.isArray(e[f])?e[f]:[],s=a.findIndex(p=>d(p)&&p.type===r);if(s<0)return t;const n=a[s],i=a.map((p,l)=>l===s?{...n,props:g(n.props??{},"listCard",o)}:p);return{...t,props:{...e,[f]:i}}}function R(t,o,r,e){const a=Array.isArray(t[e])?t[e]:[];if(a.some(n=>d(n)&&n.type===m)){const n=a.map(i=>d(i)&&i.type===m?A(i,o,r):i);return{...g(t,"items",o),[u]:o,[e]:n}}const s=a.map(n=>{if(!d(n)||n.type!==r)return n;const i=n.props??{},l=(Array.isArray(i[e])?i[e]:[]).map(c=>d(c)&&c.type===r?{...c,props:g(c.props??{},"card",o)}:c);return{...n,props:{...g(i,"row",o),[e]:l}}});return{...g(t,"grid",o),[u]:o,[e]:s}}export{P as CARD_STYLES,u as CARD_STYLE_KEY,w as CARD_STYLE_POINTS,R as applyCardStyle,b as isCardStyle};
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { type PaymentMarkItem } from "efficient-shell/icons/payment";
|
|
2
|
+
export declare const PAYMENT_METHOD_SOURCES: readonly string[];
|
|
3
|
+
export declare const isPaymentMethodSource: (key: string) => boolean;
|
|
4
|
+
export type PaymentMethodRow = {
|
|
5
|
+
label?: string;
|
|
6
|
+
kind?: string;
|
|
7
|
+
};
|
|
8
|
+
export type PaymentChipRow = {
|
|
9
|
+
label: string;
|
|
10
|
+
kind: string;
|
|
11
|
+
};
|
|
12
|
+
export declare function paymentMarkRows(methods: readonly PaymentMethodRow[]): PaymentChipRow[];
|
|
13
|
+
export declare function paymentRowMark(row: {
|
|
14
|
+
label?: string;
|
|
15
|
+
kind?: string;
|
|
16
|
+
}): PaymentMarkItem | null;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{paymentMarkItems as o,paymentMarks as k}from"efficient-shell/icons/payment";import{LOCATION_PAYMENT_METHODS_SOURCE as l,SHOP_PAYMENT_METHODS_SOURCE as i}from"../../../format/lib/content/block-sources.js";const p=[l,i],O=n=>p.includes(n),a=n=>o({name:n.label,kind:n.kind}),s=(n,e)=>n.kind===e.kind&&n.label===e.label&&(n.kind==="brand"?n.mark===e.mark:n.glyph===e.glyph);function c(n){return k(n.map(t=>({name:t.label,kind:t.kind}))).map(t=>({label:t.label,kind:n.find(r=>a(r).some(m=>s(m,t)))?.kind??""}))}function E(n){return a(n)[0]??null}export{p as PAYMENT_METHOD_SOURCES,O as isPaymentMethodSource,c as paymentMarkRows,E as paymentRowMark};
|
|
@@ -149,6 +149,7 @@ type PartRowKind = {
|
|
|
149
149
|
kind: "core";
|
|
150
150
|
keep: readonly string[] | "rest";
|
|
151
151
|
as?: string;
|
|
152
|
+
headless?: true;
|
|
152
153
|
rename?: Readonly<Record<string, string>>;
|
|
153
154
|
props?: Props;
|
|
154
155
|
slots?: Readonly<Record<string, readonly SlotFill[]>> | ((node: Props, ctx: ConvertContext) => Readonly<Record<string, readonly SlotFill[]>>);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{readHidable as Z}from"efficient-easel/draw";import{BOX_TYPE as ee,CONTAINER_BLOCKS_SLOT as te}from"../../../format/lib/document/container-blocks.js";import{headingTextSeed as oe,labelTextSeed as ne}from"../../../format/lib/document/text-seeds.js";import{SPLITTABLE_SECTIONS as se}from"../../../format/lib/sections/section-head-placement.js";import{finiteNumber as R}from"../../../format/lib/finite-number.js";import{accentItalicRuns as ie}from"../../../format/lib/markup.js";import{seedNodes as re}from"../../../format/lib/document/seed-parts.js";import{bucketByGroup as ae}from"../../../format/lib/locations-grid.js";import{normalizeTheme as G}from"../../../format/lib/theme.js";const P=ee,v=te;function Se(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 ce(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 Te(t){for(const[o,i]of Object.entries(t)){if(o in A&&A[o]!==i)throw new Error(`lib/sections/section-to-box: "${o}" is already Box-native`);A[o]=i}}function _e(t){return A[t]}const V=new Set(["id"]),T={},F=[],fe=["Breadcrumb","DocBody","Form","SubmitBuild","Footprint","Logos","FitmentFinder"];function Ee(t){for(const[o,i]of Object.entries(t)){if(o in T&&T[o]!==i)throw new Error(`lib/sections/section-to-box: "${o}" already has a row`);T[o]=i}}function Pe(t){return T[t]}function ve(){return Object.keys(T)}function de(t){return t in T&&F.includes(t)}function je(t,o=fe){return t in T&&(o.includes(t)||de(t))}function Ne(t){const o=se[t];if(!o)throw new Error(`lib/sections/section-to-box: "${t}" has no head row in SPLITTABLE_SECTIONS`);const i=[{kind:"text",key:o.num,role:"eyebrow"},{kind:"text",key:o.title,role:"heading"}];return o.description&&i.push({kind:"text",key:o.description,role:"body"}),o.headRows.includes("linkText")&&o.headRows.includes("linkHref")&&i.push({kind:"button",key:"linkText",href:"linkHref"}),i}const H=t=>Z(t),Ie=t=>H(t).text.trim()!=="";function le(t){if(t.includes("=="))return t;const o=t.indexOf("/"),i=o===-1?t:t.slice(0,o),r=i.trim();if(!r)return t;const m=i.indexOf(r);return`${i.slice(0,m)}==${r}==${i.slice(m+r.length)}${o===-1?"":t.slice(o)}`}const pe=t=>t==="heading"?oe():t==="eyebrow"?ne():{};function ue(t,o,i,r){const a={...t._partStyles?.text??{},...o??{},...i??{}};return(r==="center"||r==="right")&&a.align===void 0&&(a.align=r),Object.keys(a).length?{_partStyles:{text:a}}:{}}function he(t,o){if(t===void 0)return{};if(typeof t=="string")return{variant:t};const i=o[t.key];return{variant:typeof i=="string"&&Object.hasOwn(t.map,i)?t.map[i]:t.fallback}}function Y(t,o,i,r,m={}){const a={...o};for(const h of t){const[k,S,j]=typeof h=="string"?[h,h,void 0]:h;if(i[k]===void 0)continue;const _=j?j(i[k],i,m):i[k];_===void 0?delete a[S]:a[S]=_,r(k,S,_===void 0)}return a}function ye(t){const o=new Set([...V,"headPlacement","_partStyles",...Object.keys(t.drop??{}),...Object.keys(t.reads??{})]),i=m=>{for(const a of m??[])o.add(typeof a=="string"?a:a[0])},r=m=>{for(const a of m)switch(a.kind){case"text":case"image":o.add(a.key),a.kind==="image"&&a.alt&&o.add(a.alt);break;case"button":o.add(a.key),o.add(a.href),typeof a.variant=="object"&&o.add(a.variant.key);break;case"list":o.add(a.key);break;case"group":case"block":i(a.box),r(a.parts??[]);break;case"core":if(a.keep!=="rest"&&a.keep.forEach(h=>o.add(h)),Object.keys(a.rename??{}).forEach(h=>o.add(h)),a.derive?.reads.forEach(h=>o.add(h)),typeof a.slots!="function")for(const h of Object.values(a.slots??{}))for(const k of h)"kind"in k&&o.add(k.key);break}};for(const m of[t,...t.also??[]])i(m.box),r(m.parts);return o}function q(t,o,i={}){const r=t.props,m=o.skip?.(r);if(m!==void 0)return{node:t,nodes:[t],carried:[],dropped:[],siteWrites:[],restyled:[],skipped:m};const a=String(r.id??t.type),h=[],k=[],S=[],j=new Set,_=(n,s)=>{h.push({key:n,home:s}),j.add(n)},X=r._partStyles??{},L=ye(o);let K=0;const $=(n,s)=>({type:n,props:{...s,id:`${a}~${n}-${++K}`}}),M=(n,s,b,y,g,d,w)=>{if(g){for(const c of n??[]){const p=typeof c=="string"?c:c[0];b[p]!==void 0&&w(p,`nothing — the ${y} has no parts, so it is not drawn`)}return}const e=typeof s=="function"?s(r,i):s??{};return Y(n??[],e,b,(c,p,f)=>w(c,f?`nothing — the old value draws nothing (${y}: no ${p})`:`${d}${y}: ${p}`),i)},J=n=>re(n,s=>`${a}~${s}-${++K}`),W=(n,s,b)=>{const y=n.of?n.of(s):Array.isArray(s[n.key])?s[n.key]:[],g=typeof n.props=="function"?n.props(r,i):n.props??{},d=y.map((f,x)=>{const l=f??{},u=n.item?.(l,x,r)??{},O=N(u.reverse?[...n.parts].reverse():n.parts,l,!1,`item ${x+1}: `);return n.flat?u.props?O.map(E=>({...E,props:{...E.props,...u.props,id:E.props.id}})):O:[$(P,{name:`${n.name} ${x+1}`,...g,...u.props??{},[v]:O})]});if(n.groups){const f=n.groups;return b(n.key,y.length?`one Box per item (${y.length}), in a Box per group`:"nothing — the list is empty"),ae(y.map(x=>x??{}),f.of,f.of).map((x,l)=>{const u=x.items.map(B=>B.item),O=f.parts?N(f.parts,f.head?.(u,r)??{},!1,`group ${l+1}: `):[],E=x.items.map(B=>d[B.index]),z=f.perRow?.(u.length,r),I=Number.isInteger(z)&&z>=1?z:1,C=[];if(f.perRow&&I<E.length)for(let B=0;B*I<E.length;B++)C.push(E.slice(B*I,(B+1)*I).flat());return $(P,{name:`${f.name} ${l+1}`,...f.props??{},[v]:[...O,$(P,{name:`${f.itemsName} ${l+1}`,...f.itemsProps?.(u.length,r)??{},[v]:C.length?C.map((B,U)=>$(P,{name:`${f.rowName??`${f.itemsName} row`} ${U+1}`,...f.rowProps??{},[v]:B})):E.flat()})]})})}const w=n.perRow?.(r),e=n.perRow?Number.isInteger(w)&&w>=1?w:1:0;if(b(n.key,(y.length?n.flat?`each item's parts (${y.length} items), in order`:`one Box per item (${y.length}), its parts inside`:"nothing — the list is empty")+(e&&y.length?`, in rows of ${e}`:"")),!e)return d.flat();const c=typeof n.rowProps=="function"?n.rowProps(r,i):n.rowProps??{},p=[];for(let f=0;f*e<d.length;f++){const x=d.slice(f*e,(f+1)*e).flat(),l=n.rowFiller?e-d.slice(f*e,(f+1)*e).length:0;p.push($(P,{name:`${n.rowName??`${n.name} row`} ${f+1}`,...c,[v]:[...x,...Array.from({length:l},(u,O)=>$(P,{name:`Empty ${O+1}`,...n.rowFiller,[v]:[]}))]}))}return p},N=(n,s,b,y)=>{const g=[],d=(e,c)=>b?_(e,c):void 0,w=e=>b?X[e]:void 0;for(const e of n)if(!(e.when&&!e.when(r,b?void 0:s)))switch(e.kind){case"text":{const c=H(s[e.key]);if(!c.text.trim()&&!(b&&i.press&&o.pressKeepsEmpty?.includes(e.key))){d(e.key,"nothing — empty words draw nothing, so no block");break}const p=pe(e.role??"body"),{_partStyles:f,...x}=p,l=ue(p,e.styleFrom?{...e.style,...e.styleFrom(r,i)}:e.style,w(e.key),e.props?.align);if(e.was&&b){const u=l._partStyles?.text??{};S.push({key:e.key,was:e.was,...typeof u.textStyle=="string"?{textStyle:u.textStyle}:{},...R(u.size)!==void 0?{size:R(u.size)}:{},...R(u.sizePhone)!==void 0?{sizePhone:R(u.sizePhone)}:{}})}g.push($("Text",{text:e.mark==="accentLead"?le(c.text):e.mark==="accentItalic"?ie(c.text):c.text,...x,...e.props??{},...l,...c.hidden?{_hidden:!0}:{}})),d(e.key,`${y}Text block: its words${c.hidden?", hidden":""}`);break}case"button":{const c=H(s[e.key]);if(!c.text.trim()){d(e.key,"nothing — no words, no button"),d(e.href,"nothing — no button to link"),typeof e.variant=="object"&&d(e.variant.key,"nothing — no button to style");break}const p=typeof s[e.href]=="string"&&s[e.href]?s[e.href]:"#",f={...e.style??{},...w(e.key)??{}};g.push($("ButtonBlock",{label:c.text,href:p,...typeof e.props=="function"?e.props(s,i):e.props??{},...he(e.variant,s),...Object.keys(f).length?{_partStyles:{label:f}}:{},...c.hidden?{_hidden:!0}:{}})),d(e.key,`${y}Button block: its words`),d(e.href,`${y}Button block: its link`),typeof e.variant=="object"&&d(e.variant.key,`${y}Button block: its Style`);break}case"image":{const c=s[e.key];if(typeof c!="string"||!c){d(e.key,"nothing — no picture, no block"),e.alt&&d(e.alt,"nothing — no picture to describe");break}const p=e.alt&&typeof s[e.alt]=="string"?s[e.alt]:"";g.push($("ImageBlock",{src:c,alt:p,...e.props??{}})),d(e.key,`${y}Image block: its picture`),e.alt&&d(e.alt,`${y}Image block: its alt text`);break}case"list":{g.push(...W(e,s,d));break}case"group":{const c=N(e.parts,s,b,y),p=M(e.box,e.props,s,`${e.name} Box`,!c.length&&!e.keepEmpty,y,d);p&&g.push($(P,{name:e.name,...p,[v]:c}));break}case"block":{const c=e.parts?N(e.parts,s,b,y):[],p=M(e.box,e.props,s,`${e.type} block`,!!e.parts&&!c.length&&!e.keepEmpty,y,d);p&&g.push($(e.type,{...p,...e.slot?{[e.slot]:c}:{}}));break}case"core":{const c=e.as??t.type,p={headPlacement:"own-box",...e.props??{}},f=e.keep==="rest"?Object.keys(s).filter(l=>!L.has(l)&&!(l in p)):e.keep;for(const l of f)s[l]!==void 0&&(p[l]=s[l],d(l,`the ${c} block inside the Box`));if(e.keep==="rest"){for(const u of Object.keys(e.props??{}))s[u]!==void 0&&!L.has(u)&&d(u,`nothing — the ${c} block inside the Box has the row's own value`);s.headPlacement!==void 0&&d("headPlacement",`the ${c} block inside the Box: own-box`);const l=Object.fromEntries(Object.entries(X).filter(([u])=>!L.has(u)));Object.keys(l).length&&(p._partStyles=l)}for(const[l,u]of Object.entries(e.rename??{}))s[l]!==void 0&&(p[u]=s[l],d(l,`the ${c} block inside the Box: ${u}`));if(e.derive){Object.assign(p,e.derive.props(s,i));for(const l of e.derive.reads)s[l]!==void 0&&d(l,`the ${c} block inside the Box`)}const x=typeof e.slots=="function"?e.slots(s,i):e.slots??{};for(const[l,u]of Object.entries(x))p[l]=u.flatMap(O=>"kind"in O?W(O,s,d):J([O]));g.push($(c,p));break}}return g},Q=(n,s)=>{const b=s===0?"Box":`${n.name} Box`,y=N(n.parts,r,!0,s===0?"":`${b}: `),g=typeof n.boxProps=="function"?n.boxProps(r,i):n.boxProps??{},d=Y(n.box??[],g,r,(w,e,c)=>_(w,c?`nothing — the old value draws nothing (${b}: no ${e})`:`${b}: ${e}`),i);return{type:P,props:{name:n.name,...d,[v]:y,id:ce(a,s)}}},D=[o,...o.also??[]].map(Q);r._partStyles!==void 0&&_("_partStyles","each old part's style moved to its new part");for(const[n,s]of Object.entries(o.reads??{}))r[n]!==void 0&&_(n,s);for(const[n,s]of Object.entries(o.drop??{}))n in r&&(k.push({key:n,why:s}),j.add(n));for(const n of Object.keys(r))V.has(n)||j.has(n)||k.push({key:n,why:"not in the row — not carried"});return{node:D[0],nodes:D,carried:h,dropped:k,siteWrites:[...o.site?.(t,i)??[]],restyled:S}}function Re(t,o=F,i={}){const r=t.content;if(!Array.isArray(r))return t;let m=!1;const a=r.flatMap(h=>{const k=h&&typeof h.type=="string"&&o.includes(h.type)?T[h.type]:void 0;if(!k)return[h];const S=q(h,k,i);return S.skipped!==void 0?[h]:(m=!0,S.nodes)});return m?{...t,content:a}:t}function Ae(t,o=F,i={}){if(!Array.isArray(t))return[];const r=[];return t.forEach((m,a)=>{const h=m&&typeof m.type=="string"&&o.includes(m.type)?T[m.type]:void 0;if(!h)return;const k=q(m,h,i);k.skipped===void 0&&r.push({index:a,node:k.node,nodes:k.nodes})}),r}export{v as SECTION_BOX_SLOT,P as SECTION_BOX_TYPE,F as SECTION_TO_BOX_ON,fe as SECTION_TO_BOX_PRESS,_e as boxNativeReason,q as convertSection,Re as convertSectionsInPage,Se as convertTheme,de as convertsToBox,Ie as hasWords,Ne as headParts,je as pressesAsBox,Te as registerBoxNativeSections,Ee as registerSectionToBox,ce as sectionBoxIdOf,Ae as sectionToBoxEdits,Pe as sectionToBoxRow,ve as sectionToBoxTypes};
|
|
1
|
+
import{readHidable as Z}from"efficient-easel/draw";import{BOX_TYPE as ee,CONTAINER_BLOCKS_SLOT as te}from"../../../format/lib/document/container-blocks.js";import{headingTextSeed as oe,labelTextSeed as ne}from"../../../format/lib/document/text-seeds.js";import{SPLITTABLE_SECTIONS as se}from"../../../format/lib/sections/section-head-placement.js";import{finiteNumber as R}from"../../../format/lib/finite-number.js";import{accentItalicRuns as ie}from"../../../format/lib/markup.js";import{seedNodes as re}from"../../../format/lib/document/seed-parts.js";import{bucketByGroup as ae}from"../../../format/lib/locations-grid.js";import{normalizeTheme as G}from"../../../format/lib/theme.js";const P=ee,v=te;function Be(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 ce(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 Te(t){for(const[o,i]of Object.entries(t)){if(o in A&&A[o]!==i)throw new Error(`lib/sections/section-to-box: "${o}" is already Box-native`);A[o]=i}}function _e(t){return A[t]}const V=new Set(["id"]),T={},F=[],fe=["Breadcrumb","DocBody","Form","SubmitBuild","Footprint","Stats","Logos","FitmentFinder","DocMasthead"];function Ee(t){for(const[o,i]of Object.entries(t)){if(o in T&&T[o]!==i)throw new Error(`lib/sections/section-to-box: "${o}" already has a row`);T[o]=i}}function Pe(t){return T[t]}function ve(){return Object.keys(T)}function de(t){return t in T&&F.includes(t)}function je(t,o=fe){return t in T&&(o.includes(t)||de(t))}function Ne(t){const o=se[t];if(!o)throw new Error(`lib/sections/section-to-box: "${t}" has no head row in SPLITTABLE_SECTIONS`);const i=[{kind:"text",key:o.num,role:"eyebrow"},{kind:"text",key:o.title,role:"heading"}];return o.description&&i.push({kind:"text",key:o.description,role:"body"}),o.headRows.includes("linkText")&&o.headRows.includes("linkHref")&&i.push({kind:"button",key:"linkText",href:"linkHref"}),i}const H=t=>Z(t),Ie=t=>H(t).text.trim()!=="";function le(t){if(t.includes("=="))return t;const o=t.indexOf("/"),i=o===-1?t:t.slice(0,o),r=i.trim();if(!r)return t;const m=i.indexOf(r);return`${i.slice(0,m)}==${r}==${i.slice(m+r.length)}${o===-1?"":t.slice(o)}`}const pe=t=>t==="heading"?oe():t==="eyebrow"?ne():{};function ue(t,o,i,r){const a={...t._partStyles?.text??{},...o??{},...i??{}};return(r==="center"||r==="right")&&a.align===void 0&&(a.align=r),Object.keys(a).length?{_partStyles:{text:a}}:{}}function he(t,o){if(t===void 0)return{};if(typeof t=="string")return{variant:t};const i=o[t.key];return{variant:typeof i=="string"&&Object.hasOwn(t.map,i)?t.map[i]:t.fallback}}function Y(t,o,i,r,m={}){const a={...o};for(const h of t){const[k,B,j]=typeof h=="string"?[h,h,void 0]:h;if(i[k]===void 0)continue;const _=j?j(i[k],i,m):i[k];_===void 0?delete a[B]:a[B]=_,r(k,B,_===void 0)}return a}function ye(t){const o=new Set([...V,"headPlacement","_partStyles",...Object.keys(t.drop??{}),...Object.keys(t.reads??{})]),i=m=>{for(const a of m??[])o.add(typeof a=="string"?a:a[0])},r=m=>{for(const a of m)switch(a.kind){case"text":case"image":o.add(a.key),a.kind==="image"&&a.alt&&o.add(a.alt);break;case"button":o.add(a.key),o.add(a.href),typeof a.variant=="object"&&o.add(a.variant.key);break;case"list":o.add(a.key);break;case"group":case"block":i(a.box),r(a.parts??[]);break;case"core":if(a.keep!=="rest"&&a.keep.forEach(h=>o.add(h)),Object.keys(a.rename??{}).forEach(h=>o.add(h)),a.derive?.reads.forEach(h=>o.add(h)),typeof a.slots!="function")for(const h of Object.values(a.slots??{}))for(const k of h)"kind"in k&&o.add(k.key);break}};for(const m of[t,...t.also??[]])i(m.box),r(m.parts);return o}function q(t,o,i={}){const r=t.props,m=o.skip?.(r);if(m!==void 0)return{node:t,nodes:[t],carried:[],dropped:[],siteWrites:[],restyled:[],skipped:m};const a=String(r.id??t.type),h=[],k=[],B=[],j=new Set,_=(n,s)=>{h.push({key:n,home:s}),j.add(n)},X=r._partStyles??{},L=ye(o);let K=0;const $=(n,s)=>({type:n,props:{...s,id:`${a}~${n}-${++K}`}}),M=(n,s,b,y,g,d,w)=>{if(g){for(const c of n??[]){const p=typeof c=="string"?c:c[0];b[p]!==void 0&&w(p,`nothing — the ${y} has no parts, so it is not drawn`)}return}const e=typeof s=="function"?s(r,i):s??{};return Y(n??[],e,b,(c,p,f)=>w(c,f?`nothing — the old value draws nothing (${y}: no ${p})`:`${d}${y}: ${p}`),i)},J=n=>re(n,s=>`${a}~${s}-${++K}`),W=(n,s,b)=>{const y=n.of?n.of(s):Array.isArray(s[n.key])?s[n.key]:[],g=typeof n.props=="function"?n.props(r,i):n.props??{},d=y.map((f,x)=>{const l=f??{},u=n.item?.(l,x,r)??{},O=N(u.reverse?[...n.parts].reverse():n.parts,l,!1,`item ${x+1}: `);return n.flat?u.props?O.map(E=>({...E,props:{...E.props,...u.props,id:E.props.id}})):O:[$(P,{name:`${n.name} ${x+1}`,...g,...u.props??{},[v]:O})]});if(n.groups){const f=n.groups;return b(n.key,y.length?`one Box per item (${y.length}), in a Box per group`:"nothing — the list is empty"),ae(y.map(x=>x??{}),f.of,f.of).map((x,l)=>{const u=x.items.map(S=>S.item),O=f.parts?N(f.parts,f.head?.(u,r)??{},!1,`group ${l+1}: `):[],E=x.items.map(S=>d[S.index]),z=f.perRow?.(u.length,r),I=Number.isInteger(z)&&z>=1?z:1,C=[];if(f.perRow&&I<E.length)for(let S=0;S*I<E.length;S++)C.push(E.slice(S*I,(S+1)*I).flat());return $(P,{name:`${f.name} ${l+1}`,...f.props??{},[v]:[...O,$(P,{name:`${f.itemsName} ${l+1}`,...f.itemsProps?.(u.length,r)??{},[v]:C.length?C.map((S,U)=>$(P,{name:`${f.rowName??`${f.itemsName} row`} ${U+1}`,...f.rowProps??{},[v]:S})):E.flat()})]})})}const w=n.perRow?.(r),e=n.perRow?Number.isInteger(w)&&w>=1?w:1:0;if(b(n.key,(y.length?n.flat?`each item's parts (${y.length} items), in order`:`one Box per item (${y.length}), its parts inside`:"nothing — the list is empty")+(e&&y.length?`, in rows of ${e}`:"")),!e)return d.flat();const c=typeof n.rowProps=="function"?n.rowProps(r,i):n.rowProps??{},p=[];for(let f=0;f*e<d.length;f++){const x=d.slice(f*e,(f+1)*e).flat(),l=n.rowFiller?e-d.slice(f*e,(f+1)*e).length:0;p.push($(P,{name:`${n.rowName??`${n.name} row`} ${f+1}`,...c,[v]:[...x,...Array.from({length:l},(u,O)=>$(P,{name:`Empty ${O+1}`,...n.rowFiller,[v]:[]}))]}))}return p},N=(n,s,b,y)=>{const g=[],d=(e,c)=>b?_(e,c):void 0,w=e=>b?X[e]:void 0;for(const e of n)if(!(e.when&&!e.when(r,b?void 0:s)))switch(e.kind){case"text":{const c=H(s[e.key]);if(!c.text.trim()&&!(b&&i.press&&o.pressKeepsEmpty?.includes(e.key))){d(e.key,"nothing — empty words draw nothing, so no block");break}const p=pe(e.role??"body"),{_partStyles:f,...x}=p,l=ue(p,e.styleFrom?{...e.style,...e.styleFrom(r,i)}:e.style,w(e.key),e.props?.align);if(e.was&&b){const u=l._partStyles?.text??{};B.push({key:e.key,was:e.was,...typeof u.textStyle=="string"?{textStyle:u.textStyle}:{},...R(u.size)!==void 0?{size:R(u.size)}:{},...R(u.sizePhone)!==void 0?{sizePhone:R(u.sizePhone)}:{}})}g.push($("Text",{text:e.mark==="accentLead"?le(c.text):e.mark==="accentItalic"?ie(c.text):c.text,...x,...e.props??{},...l,...c.hidden?{_hidden:!0}:{}})),d(e.key,`${y}Text block: its words${c.hidden?", hidden":""}`);break}case"button":{const c=H(s[e.key]);if(!c.text.trim()){d(e.key,"nothing — no words, no button"),d(e.href,"nothing — no button to link"),typeof e.variant=="object"&&d(e.variant.key,"nothing — no button to style");break}const p=typeof s[e.href]=="string"&&s[e.href]?s[e.href]:"#",f={...e.style??{},...w(e.key)??{}};g.push($("ButtonBlock",{label:c.text,href:p,...typeof e.props=="function"?e.props(s,i):e.props??{},...he(e.variant,s),...Object.keys(f).length?{_partStyles:{label:f}}:{},...c.hidden?{_hidden:!0}:{}})),d(e.key,`${y}Button block: its words`),d(e.href,`${y}Button block: its link`),typeof e.variant=="object"&&d(e.variant.key,`${y}Button block: its Style`);break}case"image":{const c=s[e.key];if(typeof c!="string"||!c){d(e.key,"nothing — no picture, no block"),e.alt&&d(e.alt,"nothing — no picture to describe");break}const p=e.alt&&typeof s[e.alt]=="string"?s[e.alt]:"";g.push($("ImageBlock",{src:c,alt:p,...e.props??{}})),d(e.key,`${y}Image block: its picture`),e.alt&&d(e.alt,`${y}Image block: its alt text`);break}case"list":{g.push(...W(e,s,d));break}case"group":{const c=N(e.parts,s,b,y),p=M(e.box,e.props,s,`${e.name} Box`,!c.length&&!e.keepEmpty,y,d);p&&g.push($(P,{name:e.name,...p,[v]:c}));break}case"block":{const c=e.parts?N(e.parts,s,b,y):[],p=M(e.box,e.props,s,`${e.type} block`,!!e.parts&&!c.length&&!e.keepEmpty,y,d);p&&g.push($(e.type,{...p,...e.slot?{[e.slot]:c}:{}}));break}case"core":{const c=e.as??t.type,p={...e.headless?{}:{headPlacement:"own-box"},...e.props??{}},f=e.keep==="rest"?Object.keys(s).filter(l=>!L.has(l)&&!(l in p)):e.keep;for(const l of f)s[l]!==void 0&&(p[l]=s[l],d(l,`the ${c} block inside the Box`));if(e.keep==="rest"){for(const u of Object.keys(e.props??{}))s[u]!==void 0&&!L.has(u)&&d(u,`nothing — the ${c} block inside the Box has the row's own value`);s.headPlacement!==void 0&&d("headPlacement",`the ${c} block inside the Box: own-box`);const l=Object.fromEntries(Object.entries(X).filter(([u])=>!L.has(u)));Object.keys(l).length&&(p._partStyles=l)}for(const[l,u]of Object.entries(e.rename??{}))s[l]!==void 0&&(p[u]=s[l],d(l,`the ${c} block inside the Box: ${u}`));if(e.derive){Object.assign(p,e.derive.props(s,i));for(const l of e.derive.reads)s[l]!==void 0&&d(l,`the ${c} block inside the Box`)}const x=typeof e.slots=="function"?e.slots(s,i):e.slots??{};for(const[l,u]of Object.entries(x))p[l]=u.flatMap(O=>"kind"in O?W(O,s,d):J([O]));g.push($(c,p));break}}return g},Q=(n,s)=>{const b=s===0?"Box":`${n.name} Box`,y=N(n.parts,r,!0,s===0?"":`${b}: `),g=typeof n.boxProps=="function"?n.boxProps(r,i):n.boxProps??{},d=Y(n.box??[],g,r,(w,e,c)=>_(w,c?`nothing — the old value draws nothing (${b}: no ${e})`:`${b}: ${e}`),i);return{type:P,props:{name:n.name,...d,[v]:y,id:ce(a,s)}}},D=[o,...o.also??[]].map(Q);r._partStyles!==void 0&&_("_partStyles","each old part's style moved to its new part");for(const[n,s]of Object.entries(o.reads??{}))r[n]!==void 0&&_(n,s);for(const[n,s]of Object.entries(o.drop??{}))n in r&&(k.push({key:n,why:s}),j.add(n));for(const n of Object.keys(r))V.has(n)||j.has(n)||k.push({key:n,why:"not in the row — not carried"});return{node:D[0],nodes:D,carried:h,dropped:k,siteWrites:[...o.site?.(t,i)??[]],restyled:B}}function Re(t,o=F,i={}){const r=t.content;if(!Array.isArray(r))return t;let m=!1;const a=r.flatMap(h=>{const k=h&&typeof h.type=="string"&&o.includes(h.type)?T[h.type]:void 0;if(!k)return[h];const B=q(h,k,i);return B.skipped!==void 0?[h]:(m=!0,B.nodes)});return m?{...t,content:a}:t}function Ae(t,o=F,i={}){if(!Array.isArray(t))return[];const r=[];return t.forEach((m,a)=>{const h=m&&typeof m.type=="string"&&o.includes(m.type)?T[m.type]:void 0;if(!h)return;const k=q(m,h,i);k.skipped===void 0&&r.push({index:a,node:k.node,nodes:k.nodes})}),r}export{v as SECTION_BOX_SLOT,P as SECTION_BOX_TYPE,F as SECTION_TO_BOX_ON,fe as SECTION_TO_BOX_PRESS,_e as boxNativeReason,q as convertSection,Re as convertSectionsInPage,Be as convertTheme,de as convertsToBox,Ie as hasWords,Ne as headParts,je as pressesAsBox,Te as registerBoxNativeSections,Ee as registerSectionToBox,ce as sectionBoxIdOf,Ae as sectionToBoxEdits,Pe as sectionToBoxRow,ve as sectionToBoxTypes};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "efficient-web-builder",
|
|
3
|
-
"version": "55.
|
|
3
|
+
"version": "55.3.1",
|
|
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",
|