efficient-web-builder 66.0.0 → 67.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +16 -0
- package/dist/editor/components/MediaUploadField.js +1 -1
- package/dist/editor/components/PartSettingsPanel.js +1 -1
- package/dist/editor/components/PartTextBox.js +1 -1
- package/dist/editor/components/PreviewPartAnchors.js +1 -1
- package/dist/editor/components/SectionWidthRows.d.ts +3 -1
- package/dist/editor/components/SectionWidthRows.js +1 -1
- package/dist/editor/components/SiteTextStylesField.js +1 -1
- package/dist/editor/lib/animation/hover-fields.d.ts +1 -1
- package/dist/editor/lib/animation/hover-fields.js +1 -1
- package/dist/editor/lib/document/blocks/general/Divider/fields.js +1 -1
- package/dist/editor/lib/document/blocks/general/Flex/fields.js +1 -1
- package/dist/editor/lib/document/blocks/general/HeroGroup/fields.js +1 -1
- package/dist/editor/lib/document/blocks/general/ImageBlock/fields.js +1 -1
- package/dist/editor/lib/document/blocks/general/IntroBleed/fields.js +1 -1
- package/dist/editor/lib/document/blocks/general/PostCard/fields.js +1 -1
- package/dist/editor/lib/document/blocks/hero-shared-fields.js +1 -1
- package/dist/editor/lib/document/box-fields.d.ts +1 -1
- package/dist/editor/lib/document/controls.d.ts +20 -2
- package/dist/editor/lib/document/controls.js +1 -1
- package/dist/editor/lib/document/section-own-width-fields.js +1 -1
- package/dist/format/lib/animation/views.js +1 -1
- package/dist/format/lib/content/borders.d.ts +12 -2
- package/dist/format/lib/content/borders.js +1 -1
- package/dist/format/lib/content/card-corners.d.ts +3 -1
- package/dist/format/lib/content/card-corners.js +1 -1
- package/dist/format/lib/content/css-length.d.ts +6 -0
- package/dist/format/lib/content/css-length.js +1 -1
- package/dist/format/lib/content/image-corners.d.ts +3 -1
- package/dist/format/lib/content/image-corners.js +1 -1
- package/dist/format/lib/content/section-corners.d.ts +3 -1
- package/dist/format/lib/content/section-corners.js +1 -1
- package/dist/format/lib/content/section-sticky.d.ts +5 -0
- package/dist/format/lib/content/section-sticky.js +1 -1
- package/dist/format/lib/content/section-type-size.d.ts +12 -1
- package/dist/format/lib/content/section-type-size.js +1 -1
- package/dist/format/lib/content/section-width.d.ts +8 -0
- package/dist/format/lib/content/section-width.js +1 -1
- package/dist/format/lib/content/view-tier.d.ts +10 -0
- package/dist/format/lib/content/view-tier.js +1 -0
- package/dist/format/lib/post-card-layout.d.ts +3 -0
- package/dist/format/lib/post-card-layout.js +1 -1
- package/dist/format/lib/sections/divider-style.d.ts +9 -0
- package/dist/format/lib/sections/divider-style.js +1 -1
- package/dist/format/lib/sections/hero-single-to-hero.js +1 -1
- package/dist/format/lib/source-rules/one-length-control.js +3 -3
- package/dist/format/lib/theme.d.ts +1 -1
- package/dist/format/lib/theme.js +4 -4
- package/dist/render/components/Divider.d.ts +3 -1
- package/dist/render/components/Divider.js +1 -1
- package/dist/render/components/Flex.d.ts +3 -1
- package/dist/render/components/Flex.js +1 -1
- package/dist/render/components/HeroGroup.d.ts +3 -1
- package/dist/render/components/HeroGroup.js +1 -1
- package/dist/render/components/ImageBlock.d.ts +2 -1
- package/dist/render/components/ImageBlock.js +1 -1
- package/dist/render/components/IntroBleed.d.ts +3 -2
- package/dist/render/components/IntroBleed.js +1 -1
- package/dist/render/components/PictureHoverMove.d.ts +18 -0
- package/dist/render/components/PictureHoverMove.js +1 -0
- package/dist/render/components/PictureWash.d.ts +2 -1
- package/dist/render/components/PictureWash.js +1 -1
- package/dist/render/lib/content/block-size.js +1 -1
- package/dist/render/lib/content/button-look.js +1 -1
- package/dist/render/lib/content/section-padding.js +1 -1
- package/dist/render/lib/document/blocks/general/Divider/render.js +1 -1
- package/dist/render/lib/document/blocks/general/Flex/render.js +1 -1
- package/dist/render/lib/document/blocks/general/HeroGroup/render.js +1 -1
- package/dist/render/lib/document/blocks/general/ImageBlock/render.js +1 -1
- package/dist/render/lib/document/blocks/general/IntroBleed/render.js +1 -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-editorial.js +1 -1
- package/dist/render/lib/document/blocks/general/section-to-box-rows-head.js +1 -1
- package/dist/render/lib/document/part-styles.d.ts +13 -0
- package/dist/render/lib/document/part-styles.js +2 -2
- package/dist/render/lib/document/passes/borders.js +1 -1
- package/dist/render/lib/document/passes/corners.js +1 -1
- package/dist/render/lib/document/passes/section-width.js +1 -1
- package/dist/render/lib/sections/section-to-box.js +1 -1
- package/dist/render/lib/text-styles/site-text-styles.js +2 -2
- package/package.json +5 -5
|
@@ -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 z=new Set(["id"]),T={},L=[],ce=["ProductGrid","Events","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 G(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([...z,"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 G(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=G(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))z.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 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,2 +1,2 @@
|
|
|
1
|
-
import{defaultTextStyles as Y,textStyleCaseCss as le
|
|
2
|
-
`)}function
|
|
1
|
+
import{defaultTextStyles as Y,textStyleCaseCss as le}from"efficient-easel/text-styles/model";import{resolveViewValue as B}from"efficient-easel/draw";import{viewKey as w}from"../../../format/lib/animation/views.js";import{FONT_OPTIONS as ce,normalizeFonts as U}from"../../../format/lib/fonts.js";import{PHONE_MEDIA as de,TABLET_MEDIA as pe,viewOverrides as C,viewRules as X}from"../content/view-values.js";import{STYLE_ID_OF_ROLE as fe,TEXT_STYLE_ATTR as ue,paragraphRules as Z,partSpacingOf as ge}from"../document/part-styles.js";import{faceClassOf as q}from"../../../format/lib/text-style-face.js";import{partColourName as Q,partInkCss as he}from"../../../format/lib/document/part-inks.js";import{compressionMetrics as me,headingTypographyFromRow as Se,normalizeHeadingCompression as I,normalizeSizes as ee}from"../../../format/lib/theme.js";import{finiteNumber as v}from"../../../format/lib/finite-number.js";import{nonEmptyString as P}from"../../../format/lib/non-empty-string.js";const L=e=>e==="sentence"?"none":void 0,ne=["font","color","size","sizeTablet","sizePhone","weight","italic","lineHeight","lineHeightTablet","lineHeightPhone","letterSpacing","letterSpacingTablet","letterSpacingPhone","paragraphSpacing","paragraphSpacingTablet","paragraphSpacingPhone","letterCase","largestSize","largestSizeTablet","largestSizePhone"],H=["desktop","tablet","phone"],k=(e,i)=>w(e,i);function j(e,i,t,n=X()){return B("textSize",i,e.sizeTablet,e.sizePhone,n)[t]}const ye=[["lineSpacing","lineHeight","line"],["letterSpacing","letterSpacing","letter"]];function M(e){for(const[i,t,n]of ye)for(const o of H)if(e===k(i,o))return{key:w(t,o),view:o,spacing:n};return{key:e,view:"desktop",spacing:null}}function b(e){const i={};for(const t of ne)e[t]!==void 0&&(i[t]=e[t]);return i}function R(e,i){const{auto:t,...n}=e,o=new Set(i??[]),r=ne.filter(s=>o.has(s)&&e.values[s]===void 0);return r.length?{...n,auto:r}:n}function te(e){const i=e.fonts,t=e.sizes,n=e.typography,o=me(e.compression),r={"heading-1":{font:P(i.heading),size:v(t.headingLarge),weight:v(n.weight),lineHeight:o.lineHeight,letterSpacing:o.letterSpacing,letterCase:L(n.case),largestSize:v(n.maxPx)},"heading-2":{font:P(i.heading2),size:v(t.headingMedium),weight:v(n.weight2),lineHeight:o.lineHeight,letterSpacing:o.letterSpacing,letterCase:L(n.case2)},"heading-3":{font:P(i.heading3),size:v(t.headingSmall),weight:v(n.weight3),lineHeight:o.lineHeight,letterSpacing:o.letterSpacing,letterCase:L(n.case3)},"body-1":{font:P(i.body),size:v(t.body)},"body-5":{font:P(i.label),size:v(t.label)}};return Y().map(({id:s,kind:l,name:d})=>({id:s,kind:l,name:d,values:b(r[s]??{})}))}function N(e){return Array.isArray(e)&&e.every(t=>t&&typeof t=="object"&&typeof t.id=="string"&&(t.kind==="heading"||t.kind==="body")&&typeof t.name=="string")?e.map(t=>R({...t,values:b(t.values??{})},Array.isArray(t.auto)?t.auto:void 0)):null}function Ne(e){return N(e)??[]}function ie(e){return N(e)??Y().map(({id:i,kind:t,name:n})=>({id:i,kind:t,name:n,values:{}}))}function V(e,i){const t=te(i),n=N(e);return n?n.map(o=>{const r={...F(t,o.id)};for(const s of o.auto??[])delete r[s];return{...o,values:b({...r,...o.values})}}):t}const F=(e,i)=>e.find(t=>t.id===i)?.values??{},oe=["heading-1","heading-2","heading-3"];function Le({saved:e,old:i,cur:t,next:n,sizeOf:o,panelView:r="desktop"}){const s=te(i),l=ie(e),d=V(l,i),c=[],f=n.map(a=>{const S=t.find(g=>g.id===a.id),h=l.find(g=>g.id===a.id);if(!S||!h){const g=be([a],o,r)[0],T=g.values.color;return T===void 0?g:{...g,values:{...g.values,color:Q(T)}}}const p={...h.values},x=new Set(h.auto??[]),y=a.values,_=S.values,z=[...new Set([...Object.keys(y),...Object.keys(_)])].filter(g=>JSON.stringify(y[g])!==JSON.stringify(_[g])),D=g=>M(g).spacing==="letter";z.sort((g,T)=>Number(D(g))-Number(D(T)));for(const g of z){const{key:T,view:re,spacing:K}=M(g),$=T,A=y[g];if(A===void 0){delete p[$],F(s,a.id)[$]!==void 0&&(c.push([a.id,$]),x.add($));continue}if(x.delete($),K==="line")p[$]=O(A/100,3);else if(K==="letter"){const W={...d.find(E=>E.id===a.id)?.values??{}};for(const E of z)y[E]===void 0&&delete W[M(E).key];const G=b({...W,...p}),J=j(G,o({...a,values:G}),re);p[$]=J?O(A/J,4):0}else p[$]=A}return R({id:a.id,kind:a.kind,name:a.name,values:b(p)},x)});let u=i.compression;if(c.some(([a,S])=>(S==="lineHeight"||S==="letterSpacing")&&oe.includes(a))&&I(u)!=="normal"){for(const a of oe){const S=f.find(p=>p.id===a);if(!S)continue;const h={...S.values};for(const p of["lineHeight","letterSpacing"])c.some(([x,y])=>x===a&&y===p)||h[p]===void 0&&!(S.auto??[]).includes(p)&&(h[p]=F(s,a)[p]);S.values=b(h)}u="normal"}return{saved:f,old:{...i,compression:u}}}function je(e,i){const t={text_styles:e.saved};return e.old.compression!==i.compression&&(t.heading_compression=I(e.old.compression)),t}const O=(e,i)=>Number(e.toFixed(i)),se=(e,i)=>H.indexOf(e)<H.indexOf(i)?i:e;function Me(e,i,t="desktop"){return e.map(n=>{const o={...n.values},r=i(n);for(const s of H){const l=w("lineHeight",s),d=n.values[l],c=n.values[w("letterSpacing",s)];delete o[l],d!==void 0&&(o[k("lineSpacing",s)]=O(d*100,1));const f=se(s,t);c!==void 0&&(o[k("letterSpacing",s)]=O(c*j(n.values,r,f),f===s?2:4))}return{id:n.id,kind:n.kind,name:n.name,values:o}})}function be(e,i,t="desktop"){return e.map(n=>{const o=n.values,r={...o};for(const c of H)delete r[k("lineSpacing",c)],delete r[k("letterSpacing",c)];const s={id:n.id,kind:n.kind,name:n.name,values:b(r)},l={...s.values},d=i({...s,values:{...s.values}});for(const c of H){const f=o[k("lineSpacing",c)],u=o[k("letterSpacing",c)];if(typeof f=="number"&&(l[w("lineHeight",c)]=O(f/100,3)),typeof u=="number"){const m=j(s.values,d,se(c,t));l[w("letterSpacing",c)]=m?O(u/m,4):0}}return{...s,values:b(l)}})}function Re(e){const i={fonts:U({heading:e.heading_font??void 0,heading2:e.heading_2_font??void 0,heading3:e.heading_3_font??void 0,body:e.body_font??void 0,accent:e.accent_font??void 0,label:e.label_font??void 0}),sizes:ee({headingLarge:e.heading_size_large_px,headingMedium:e.heading_size_medium_px,headingSmall:e.heading_size_small_px,accent:e.accent_size_px,body:e.body_size_px,label:e.label_size_px}),compression:I(e.heading_compression),typography:Se(e)},t=e.text_styles??null,n=Array.isArray(t)?ae(V(t,i),i):i;return{fonts:U(n.fonts),sizes:ee(n.sizes),compression:I(n.compression),typography:n.typography,textStyles:t}}function ae(e,i){const t=m=>e.find(a=>a.id===m)?.values??{},n=t("heading-1"),o=t("heading-2"),r=t("heading-3"),s=t("body-1"),l=t("body-5"),d=i.fonts,c=i.sizes,f=i.typography,u=m=>m==="none"?"sentence":"authored";return{fonts:{...d,heading:n.font??d.heading,heading2:o.font??n.font??d.heading2,heading3:r.font??n.font??d.heading3,body:s.font??d.body,label:l.font??d.label},sizes:{...c,headingLarge:n.size??null,headingMedium:o.size??null,headingSmall:r.size??null,body:s.size??null,label:l.size??null},compression:i.compression,typography:{...f,case:u(n.letterCase),weight:n.weight??null,maxPx:n.largestSize??null,weight2:o.weight??null,weight3:r.weight??null,case2:u(o.letterCase),case3:u(r.letterCase)}}}function Ve(e){const i=N(e.textStyles);if(!i||i.every(o=>Object.keys(o.values).length===0&&!o.auto))return e;const t={fonts:e.fonts??{},sizes:e.sizes??{},compression:String(e.headingCompression??"normal"),typography:e.headingTypography??{}},n=ae(V(i,t),t);return{...e,fonts:n.fonts,sizes:n.sizes,headingCompression:n.compression,headingTypography:n.typography}}function Fe(e){const i=[];for(const t of e){const n=t.values,o=`.${q(t)}`,r=`[${ue}="${t.id}"]`,s=`${o}, ${r}`,l=[],d=n.font!==void 0?ce.find(m=>m.key===n.font)?.cssVar:void 0;if(d&&l.push(`font-family: var(${d})`),n.size!==void 0){const m=n.largestSize!==void 0?Math.min(n.size,n.largestSize):n.size;l.push(`font-size: ${m}px`)}const c=he(n.color);c&&l.push(`color: ${c}`),n.italic===!0&&l.push("font-style: italic"),n.weight!==void 0&&l.push(`font-weight: ${n.weight}`);const f=[];n.lineHeight!==void 0&&f.push(`line-height: ${n.lineHeight}`),n.letterSpacing!==void 0&&f.push(`letter-spacing: ${n.letterSpacing}em`),t.kind==="body"&&l.push(...f);const u=le(n.letterCase);u&&t.kind==="body"&&l.push(`text-transform: ${u}`),n.paragraphSpacing&&l.push(`--sf-part-para: ${n.paragraphSpacing}px`),l.length&&i.push(`${s} { ${l.join("; ")} }`),t.kind==="heading"&&f.length&&i.push(`${s}, ${o}:is(h1, h2, h3, h4), ${r}:is(h1, h2, h3, h4) { ${f.join("; ")} }`),t.kind==="heading"&&u&&i.push(`${r}, ${o}:is(h1, h2, h3, h4) { text-transform: ${u} }`),n.paragraphSpacing&&(i.push(`*:has(> ${r}) { --sf-part-para: ${n.paragraphSpacing}px }`),i.push(...Z(`:is(${s})`,`*:has(> ${r})`))),i.push(...xe(t,s,o,r))}return i.join(`
|
|
2
|
+
`)}function xe(e,i,t,n){const o=e.values,r=C("textSize",o.size,o.sizeTablet,o.sizePhone),s=C("textSize",o.largestSize,o.largestSizeTablet,o.largestSizePhone),l=C("same",o.lineHeight,o.lineHeightTablet,o.lineHeightPhone),d=C("same",o.letterSpacing,o.letterSpacingTablet,o.letterSpacingPhone),c=C("spacing",o.paragraphSpacing,o.paragraphSpacingTablet,o.paragraphSpacingPhone),f=B("textSize",o.size,o.sizeTablet,o.sizePhone,X()),u=ze[e.id],m=[];for(const[a,S]of[["tablet",pe],["phone",de]]){const h=[],p=[],x=f[a],y=s[a],_=r[a]===void 0&&y===void 0||x===void 0?void 0:y===void 0?x:Math.min(x,y);_!==void 0&&p.push(`font-size: ${_}px`);const z=[];l[a]!==void 0&&z.push(`line-height: ${l[a]}`),d[a]!==void 0&&z.push(`letter-spacing: ${d[a]}em`),e.kind==="body"&&p.push(...z),c[a]!==void 0&&p.push(`--sf-part-para: ${c[a]}px`),p.length&&h.push(`${i} { ${p.join("; ")} }`),e.kind==="heading"&&z.length&&h.push(`${i}, ${t}:is(h1, h2, h3, h4), ${n}:is(h1, h2, h3, h4) { ${z.join("; ")} }`),c[a]!==void 0&&h.push(`*:has(> ${n}) { --sf-part-para: ${c[a]}px }`),c[a]!==void 0&&!o.paragraphSpacing&&h.push(...Z(`:is(${i})`,`*:has(> ${n})`)),_!==void 0&&u&&h.push(`.sf-themed-content { --size-${u}: ${_}px !important }`),h.length&&m.push(`@media ${S} { ${h.join(" ")} }`)}return m}const ze={"heading-1":"headingLarge","heading-2":"headingMedium","heading-3":"headingSmall","body-1":"body","body-5":"label"};function De(e){return e!==!0&&e!==!1?"":`em.text-accent { font-style: ${e?"italic":"normal"} }`}function Ke(e){return e?fe[e]:void 0}function ve(e){const i=ge(e);return b({font:e.font,color:e.color===void 0?void 0:Q(e.color),size:e.size,weight:e.weight,italic:e.italic,lineHeight:i.lineHeight,letterSpacing:i.letterSpacingEm,paragraphSpacing:e.paragraphSpacing,letterCase:e.case})}function We(e){return Object.keys(ve(e)).length>0}function Ge({saved:e,old:i,styleId:t,values:n}){const o=ie(e);return{saved:$e(o,t,n),old:i}}function $e(e,i,t){return e.map(n=>n.id===i?R({...n,values:b({...n.values,...t})},n.auto):n)}function Je(e){const i=e.filter(t=>t.kind==="body").map(t=>Number(/^body-(\d+)$/.exec(t.id)?.[1])).filter(t=>Number.isInteger(t)&&t>0);return i.length?`body-${Math.max(...i)}`:"body-1"}export{De as accentItalicCss,Le as applyListChange,Je as eyebrowStyleId,q as faceClassOf,be as fromPanelStyles,We as hasStyleChange,je as listChangePatch,ie as listToWrite,ve as partStyleToTextStyleValues,Ge as pushIntoStyle,V as resolveTextStyles,$e as setStyleValues,Re as siteTextFromRow,Ne as storedTextStyles,Ke as styleIdOfRole,Fe as textStylesCss,te as textStylesFromOld,ae as textStylesToOld,Ve as themeWithTextStyles,Me as toPanelStyles,j as viewSizeOf};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "efficient-web-builder",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "67.0.0",
|
|
4
4
|
"description": "The EFFICIENT website builder: the website editor, the general sections and the renderer that draws them, compiled. Hostable by any EFFICIENT product; nothing here imports a host.",
|
|
5
5
|
"license": "UNLICENSED",
|
|
6
6
|
"author": "Efficient Pty Ltd",
|
|
@@ -53,8 +53,8 @@
|
|
|
53
53
|
},
|
|
54
54
|
"peerDependencies": {
|
|
55
55
|
"@tabler/icons-react": "^3.46.0",
|
|
56
|
-
"efficient-easel": "^
|
|
57
|
-
"efficient-shell": "^12.
|
|
56
|
+
"efficient-easel": "^34.1.0",
|
|
57
|
+
"efficient-shell": "^12.33.0",
|
|
58
58
|
"isomorphic-dompurify": "^3.18.0",
|
|
59
59
|
"next": ">=16",
|
|
60
60
|
"react": ">=19",
|
|
@@ -72,8 +72,8 @@
|
|
|
72
72
|
"@types/node": "^20",
|
|
73
73
|
"@types/react": "^19",
|
|
74
74
|
"@types/react-dom": "^19",
|
|
75
|
-
"efficient-easel": "^
|
|
76
|
-
"efficient-shell": "^12.
|
|
75
|
+
"efficient-easel": "^34.1.0",
|
|
76
|
+
"efficient-shell": "^12.33.0",
|
|
77
77
|
"esbuild": "^0.28.0",
|
|
78
78
|
"happy-dom": "^20.14.5",
|
|
79
79
|
"isomorphic-dompurify": "^3.18.0",
|