efficient-web-builder 51.0.0 → 52.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (77) hide show
  1. package/CHANGELOG.md +33 -0
  2. package/dist/editor/components/PartTextBox.js +1 -1
  3. package/dist/editor/components/PreviewPartStyleContext.d.ts +2 -2
  4. package/dist/editor/components/SiteTextStylesField.d.ts +2 -1
  5. package/dist/editor/components/SiteTextStylesField.js +1 -1
  6. package/dist/editor/components/WebsiteSettingsPanel.js +1 -1
  7. package/dist/editor/components/storefront-editor.css +12 -44
  8. package/dist/editor/lib/document/ColourControl.d.ts +11 -8
  9. package/dist/editor/lib/document/ColourControl.js +1 -1
  10. package/dist/editor/lib/document/blocks/general/Flex/fields.js +1 -1
  11. package/dist/editor/lib/document/blocks/general/Series/fields.js +1 -1
  12. package/dist/editor/lib/document/blocks/general/StatsParagraph/fields.js +1 -1
  13. package/dist/editor/lib/document/blocks/general/index.d.ts +2 -2
  14. package/dist/editor/lib/document/controls.d.ts +14 -4
  15. package/dist/editor/lib/document/controls.js +1 -1
  16. package/dist/editor/lib/document/overrides.js +1 -1
  17. package/dist/editor/lib/document/passes/inspector.js +1 -1
  18. package/dist/format/lib/content/borders.d.ts +4 -2
  19. package/dist/format/lib/content/borders.js +1 -1
  20. package/dist/format/lib/content/button-icon.d.ts +1 -1
  21. package/dist/format/lib/content/button-icon.js +1 -1
  22. package/dist/format/lib/content/card-state.d.ts +8 -0
  23. package/dist/format/lib/content/card-state.js +1 -0
  24. package/dist/format/lib/content/section-background.d.ts +10 -3
  25. package/dist/format/lib/content/section-background.js +1 -1
  26. package/dist/format/lib/content/section-min-height.d.ts +17 -1
  27. package/dist/format/lib/content/section-min-height.js +1 -1
  28. package/dist/format/lib/content/section-sticky.d.ts +9 -0
  29. package/dist/format/lib/content/section-sticky.js +1 -1
  30. package/dist/format/lib/document/card-template-layers.d.ts +1 -1
  31. package/dist/format/lib/document/card-template-layers.js +1 -1
  32. package/dist/format/lib/document/part-inks.d.ts +5 -10
  33. package/dist/format/lib/document/part-inks.js +1 -1
  34. package/dist/format/lib/document/passes/types.d.ts +1 -0
  35. package/dist/format/lib/document/show-when-attach.d.ts +2 -1
  36. package/dist/format/lib/document/show-when-attach.js +1 -1
  37. package/dist/format/lib/editor-words-catalogue.d.ts +0 -3
  38. package/dist/format/lib/editor-words-catalogue.js +2 -2
  39. package/dist/format/lib/sections/hero-single-to-hero.js +1 -1
  40. package/dist/format/lib/source-rules/panel-rows-use-the-shared-row.d.ts +4 -0
  41. package/dist/format/lib/source-rules/panel-rows-use-the-shared-row.js +37 -20
  42. package/dist/format/lib/source-rules/support/part-slider-call-sites.d.ts +0 -1
  43. package/dist/format/lib/source-rules/support/part-slider-call-sites.js +6 -6
  44. package/dist/format/lib/text-styles/site-text-colours.d.ts +11 -0
  45. package/dist/format/lib/text-styles/site-text-colours.js +1 -0
  46. package/dist/format/lib/theme.d.ts +1 -0
  47. package/dist/format/lib/theme.js +3 -3
  48. package/dist/format/lib/word-styles.d.ts +0 -1
  49. package/dist/format/lib/word-styles.js +1 -1
  50. package/dist/render/components/ButtonBlock.d.ts +1 -0
  51. package/dist/render/components/ButtonBlock.js +1 -1
  52. package/dist/render/components/CardRowContext.d.ts +5 -2
  53. package/dist/render/components/CardRowContext.js +1 -1
  54. package/dist/render/components/Flex.d.ts +2 -1
  55. package/dist/render/components/Flex.js +1 -1
  56. package/dist/render/components/goldPhrases.js +2 -2
  57. package/dist/render/lib/content/block-size.d.ts +1 -0
  58. package/dist/render/lib/content/block-size.js +1 -1
  59. package/dist/render/lib/content/box-shared-columns.js +1 -1
  60. package/dist/render/lib/document/blocks/general/Cards/render.js +1 -1
  61. package/dist/render/lib/document/blocks/general/Flex/render.js +1 -1
  62. package/dist/render/lib/document/blocks/general/section-to-box-row-parts.d.ts +2 -0
  63. package/dist/render/lib/document/blocks/general/section-to-box-row-parts.js +1 -1
  64. package/dist/render/lib/document/blocks/general/section-to-box-rows-cards.js +1 -1
  65. package/dist/render/lib/document/blocks/general/section-to-box-rows-stats.js +1 -1
  66. package/dist/render/lib/document/blocks/general/section-to-box-rows-timeline.js +2 -2
  67. package/dist/render/lib/document/part-styles.js +2 -2
  68. package/dist/render/lib/document/passes/block-size.js +1 -1
  69. package/dist/render/lib/document/passes/borders.js +1 -1
  70. package/dist/render/lib/document/passes/section-height.js +1 -1
  71. package/dist/render/lib/document/passes/section-sticky.js +1 -1
  72. package/dist/render/lib/document/show-when.d.ts +1 -1
  73. package/dist/render/lib/document/show-when.js +1 -1
  74. package/dist/render/lib/text-styles/site-text-styles.js +2 -2
  75. package/package.json +1 -1
  76. package/dist/editor/components/PartInkControl.d.ts +0 -7
  77. package/dist/editor/components/PartInkControl.js +0 -1
@@ -1,2 +1,2 @@
1
- import{textStyleCaseCss as J,textStyleCaseOfCss as Q}from"efficient-easel/draw";import{parseHexColor as tt}from"efficient-shell/format";import{FONT_OPTIONS as et,fontOption as nt,fontRoleOf as R,SIZE_STEP_OF_ROLE as z}from"../../../format/lib/fonts.js";import{encodePartKey as ot}from"../../../format/lib/document/part-key.js";import{decodePartId as L,normalizePartText as E}from"./text-parts.js";import{COLOUR_TOKEN as M}from"../../../format/lib/word-styles.js";import{regionStyle as rt}from"../../../format/lib/sections/text-regions.js";import{PHONE_MEDIA as it}from"../content/view-values.js";import{plainRecord as O,propsWithPartRecord as at,readPartRecord as st,readPartRecords as ft}from"../../../format/lib/document/part-records.js";const $="_partStyles",ct="data-sf-part-styled",H="data-sf-text-style",ut=/^(heading|body)-[1-7]$/;function g(t){return typeof t=="string"&&ut.test(t)}const j={heading:"heading-1",heading2:"heading-2",heading3:"heading-3",body:"body-1",label:"body-5"};function lt(t){if(!t)return null;for(const[e,n]of Object.entries(j))if(n===t)return e;return null}function Se(t){if(g(t.textStyle))return t.textStyle;const e=R(t.role);return e?j[e]:void 0}const pt=[400,500,600,700],_=["left","center","right","justify"],D=5,C=1e3,dt=-5,xt=10,ht=0,St=64,gt=2,W={size:{min:D,max:C,step:1},sizePhone:{min:D,max:C,step:1},padding:{min:ht,max:St,step:gt}},mt=.05,Pt=.01,Tt=["line","letter"],bt=.5,Rt=2.5,_t=-1,At=1,zt=0,Et=400,Ot=[...new Set(Object.values(z))];function ge(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 me(t){return ft(t,$)}function K(t,e){return st(t,$,e)}function Pe(t,e){return Object.values(K(t,e)).filter(n=>n!==void 0).length}function G(t,e,n){return at(t,$,e,$t(n).length?n:null)}function $t(t){return Object.entries(t).filter(([,e])=>e!==void 0)}function yt(t){return Tt.includes(t)}const b=(t,e,n)=>Math.min(n,Math.max(e,t));function wt(t,e){if(yt(t)){const n=Math.round(Number(e));return!Number.isFinite(n)||n===0?null:b(n,dt,xt)}if(t==="lineHeight"){const n=Number(e);return Number.isFinite(n)?P(b(n,bt,Rt),3):null}if(t==="letterSpacing"){const n=Number(e);return Number.isFinite(n)?P(b(n,_t,At),4):null}if(t==="paragraphSpacing"){const n=Math.round(Number(e));return!Number.isFinite(n)||n<=0?null:b(n,zt,Et)}if(Object.hasOwn(W,t)){const{min:n,max:o}=W[t],r=Math.round(Number(e));return Number.isFinite(r)?b(r,n,o):null}return t==="italic"?typeof e=="boolean"?e:null:t==="role"||t==="fontRole"?R(e)?e:null:t==="sizeToken"?w(e)?e:null:t==="textStyle"?g(e)?e:null:t==="alignPhone"?_.includes(e)?e:null:e}const Nt=["weight","size","sizePhone","line","letter","lineHeight","letterSpacing","paragraphSpacing","padding"];function y(t){let e=null;const n=o=>{e??={...t},delete e[o]};for(const o of Nt){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&&!g(t.textStyle)&&n("textStyle"),t.sizeToken!==void 0&&!w(t.sizeToken)&&n("sizeToken"),t.fontRole!==void 0&&!R(t.fontRole)&&n("fontRole"),e??t}function w(t){if(!t||typeof t!="object")return!1;const{step:e,px:n,stepPhone:o,pxPhone:r,fluid:i}=t,a=f=>typeof f=="number"&&Number.isFinite(f)&&f>0,s=f=>typeof f=="string"&&Ot.includes(f);return s(e)&&a(n)&&(o===void 0||s(o))&&(r===void 0||a(r))&&(i===void 0||It(i,n))}function It(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 v(t){return t?.pxPhone&&w(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 Ft=[["font","role"],["font","fontRole"],["role","textStyle"],["line","lineHeight"],["letter","letterSpacing"]];function kt(t){const e=[];for(const[n,o]of Ft)n===t?e.push(o):o===t&&e.push(n);return e}function Te(t,e,n,o){const r={...K(t,e)},i=o==null?null:wt(n,o);if(i===null)delete r[n];else{r[n]=i;for(const a of kt(n))delete r[a]}return G(t,e,r)}function be(t,e){return G(t,e,{})}function Lt(t){return Q(t)??"none"}function Mt(t){return J(t)??""}const B={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 Ht(t,e){const n=R(t.role);return n||(e?.blockDrawsStyle?null:lt(t.textStyle))}function Re(t,e){return t==="Text"&&e==="text"}const jt={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 Dt(t){const e=z[t],n=jt[e];return n?`var(--size-${e}, ${n})`:`var(--size-${e})`}function Ct(t){const e={};return typeof t.lineHeight=="number"?e.lineHeight=t.lineHeight:t.line&&(e.lineHeight=P(Wt+t.line*mt,3)),typeof t.letterSpacing=="number"?e.letterSpacingEm=t.letterSpacing:t.letter&&(e.letterSpacingEm=P(t.letter*Pt,4)),e}const Wt=1,m="--sf-part-para";function Kt(t){t=y(t);const e={};if(typeof t.sizePhone=="number"&&t.sizePhone>0)e.fontSize=`${t.sizePhone}px`;else{const n=v(t.sizeToken);n&&(e.fontSize=X(n))}return t.alignPhone&&(e.textAlign=t.alignPhone),e}function Gt(t,e){if(!e)return t;const n=y(t);let o=t;if(typeof n.sizePhone=="number"&&n.sizePhone>0)o={...o,size:n.sizePhone};else{const r=v(n.sizeToken);r&&(o={...o,size:void 0,sizeToken:r})}return n.alignPhone&&(o={...o,align:n.alignPhone}),o}function N(t,e,n){return I(Gt(t,e),A,n)}function U(t,e){const n=e?"sizePhone":"size";if(!Object.hasOwn(t,n))return t;const o={...t};return delete o[n],o}function _e(t,e,n){const o=N(U(t,e),e,n);return{fontFamily:o.fontFamily,fontSize:o.fontSize}}function I(t,e,n){t=y(t);const o=Ht(t,n),r=Ct(t),i=t.size?`${t.size}px`:t.sizeToken?X(t.sizeToken):o?Dt(o):"";return{fontFamily:t.font?Ut(t.font):t.fontRole?`var(${B[t.fontRole]})`:o?`var(${B[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:Mt(t.case),textAlign:t.align??"",paddingTop:V(t.padding),paddingBottom:V(t.padding),color:vt(t.color),fontStyle:t.italic===!0?"italic":t.italic===!1?"normal":""}}const vt=t=>t===void 0||t===""?"":Object.hasOwn(M,t)?M[t]:tt(t)===t.toLowerCase()?t:"",V=t=>t===void 0?"":`${t}px`,P=(t,e)=>Number(t.toFixed(e));function Ae(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:Xt(Number.parseInt(t.fontWeight,10)),lineRatio:Number.isFinite(o)?P(o/n,3):1.2,letterEm:Number.isFinite(r)?P(r/n,4):0,align:Bt(t.textAlign),case:Lt(t.textTransform),paddingPx:Number.isFinite(i)?Math.round(i):0}}function Xt(t){return Number.isFinite(t)?pt.reduce((e,n)=>Math.abs(n-t)<Math.abs(e-t)?n:e):400}function Bt(t){for(const e of _)if(e===t)return e;return t==="end"?"right":"left"}function ze(t,e){const n=Y(t);if(!n)return"";for(const o of et)if(Y(e(o.cssVar))===n)return o.key;return""}const Y=t=>(t.split(",")[0]??"").replace(/["']/g,"").replace(/\s+/g," ").trim().toLowerCase();function Ut(t){const e=nt(t);return e?`var(${e.cssVar})`:""}function Ee(t,e,n,o){return!e||L(e)?.nodeId!==t?null:n.find(i=>o(i.getAttribute("class")))??n[0]??null}function Vt(t,e){return Object.hasOwn(t,e)?O(t[e])??{}:{}}function Oe(t,e,n=()=>A,o=s=>s,r=qt,i=!1,a=()=>!1){let s=0;for(const{element:f,partId:p}of t){const c=L(p)?.propKey;if(!c)continue;const l=Vt(e,o(c)),d=N(l,i,{blockDrawsStyle:a(c)});g(l.textStyle)?f.setAttribute?.(H,l.textStyle):f.removeAttribute?.(H);const u=k.some(x=>f.style[x]);let h=!1;for(const[x,S]of Object.entries(d))te(f,x,S),S&&(h=!0);if(u||k.some(x=>d[x]))for(const x of Yt(f,r))for(const S of k)x.style[S]=d[S]??"";h&&(s+=1)}return s}function Yt(t,e){const n=E(t.textContent??""),o=[];let r=t;for(let i=0;i<Zt&&e(r);i+=1){const a=r.parentElement;if(!a||E(a.textContent??"")!==n)break;o.push(a),r=a}return o}const Zt=8;function qt(t){const e=t;return typeof window>"u"||!e?.ownerDocument?!1:window.getComputedStyle(e).display==="inline"}const A={fontKey:"",sizePx:16,weight:400,lineRatio:1,letterEm:0,align:"left",case:"none",paddingPx:0};function Jt(t){if(!t||typeof t!="object")return null;const e={};return g(t.textStyle)&&(e.textStyle=t.textStyle),typeof t.size=="number"&&t.size>0&&(e.size=t.size),typeof t.sizePhone=="number"&&t.sizePhone>0&&(e.sizePhone=t.sizePhone),Object.keys(e).length?e:null}function Qt(t,e){const n=Jt(t);if(!n)return{};const o=N(n,e);return{...o.fontFamily?{fontFamily:o.fontFamily}:{},...o.fontSize?{fontSize:o.fontSize}:{}}}function $e(t){return g(t?.textStyle)||!!t?.role||typeof t?.size=="number"&&t.size>0}function ye(t,e,n){if(!t||typeof t!="object")return{};const o=rt(t.role,e,z)??{},r=e.sized?Qt(U(t,n),n):{};return{...o,...r}}function we(t,e,n){n.fontFamily&&t.fontFamily===n.fontFamily&&(t.fontFamily=e.fontFamily),n.fontSize&&t.fontSize===n.fontSize&&(t.fontSize=e.fontSize)}function te(t,e,n){if(!e.startsWith("--")){t.style[e]=n;return}const o=t.style;typeof o.setProperty=="function"?n?o.setProperty(e,n):o.removeProperty?.(e):o[e]=n;const r=t;e===m&&(n?r.setAttribute?.(Z,""):r.removeAttribute?.(Z))}const Z="data-sf-part-para",ee=Object.keys(I({},A)),F=new Set(["color","overflowWrap",m,"fontStyle"]),k=ee.filter(t=>!F.has(t));function Ne(t,e,n,o=s=>s,r=()=>!1,i=()=>null,a=[]){const s=new Map;for(const c of t){const l=ot(c.key,c.row);for(const d of c.texts){const u=s.get(d);u?(u.keys.add(c.key),u.partKeys.add(l)):s.set(d,{keys:new Set([c.key]),partKeys:new Set([l])})}}const f=new Map;for(const c of new Set([...Object.keys(e),...a])){if(!ne(c))continue;const l=q(n,c,O(e[c])??{},!1,i(c));l&&f.set(c,l)}const p=new Map;for(const[c,{keys:l,partKeys:d}]of s){const u=d.size===1?[...d][0]:l.size===1?[...l][0]:null;if(!u)continue;const h=o(u),T=i(h);if(!Object.hasOwn(e,h)&&!T)continue;const x=O(e[h])??{},S=q(n,u,x,r(u),T);S&&p.set(c,S)}return p.size||f.size?{rules:p,kindRules:f,drawn:new Set(s.keys())}:null}function q(t,e,n,o,r){const i=I(n,A,{blockDrawsStyle:o}),a=Kt(n),s=g(n.textStyle)?n.textStyle:void 0;return!Object.values(i).some(Boolean)&&!Object.keys(a).length&&!s&&!r?null:{stamp:oe(t,e),declarations:i,...Object.keys(a).length?{phone:a}:{},...s?{textStyle:s}:{},...r?{motion:r}:{}}}function ne(t){return t.startsWith("@")}function Ie(t,e){return t?.kindRules.get(e)??null}function oe(t,e){const n=o=>o.replace(/[^A-Za-z0-9_-]+/g,"-");return`${n(t)}~${n(e)}`}function Fe(t){const e=[],n=new Set,o=r=>{const{stamp:i,declarations:a}=r;if(n.has(i))return;n.add(i);const s=Object.entries(a).filter(([,u])=>u!==""),f=u=>u.map(([h,T])=>`${ie(h)}: ${T}`).join("; "),p=`[${ct}="${i}"]`,c=s.filter(([u])=>!F.has(u)),l=s.filter(([u])=>F.has(u));c.length&&e.push(`${p}, *:has(> ${p}) { ${f(c)} }`),l.length&&e.push(`${p} { ${f(l)} }`),a[m]&&(e.push(`*:has(> ${p}) { ${m}: ${a[m]} }`),e.push(...re(p,`*:has(> ${p})`)));const d=Object.entries(r.phone??{}).filter(([,u])=>u!=="");d.length&&e.push(`@media ${it} { ${p}, *:has(> ${p}) { ${f(d)} } }`)};for(const r of t.rules.values())o(r);for(const r of t.kindRules.values())o(r);return e.join(`
2
- `)}function re(t,e){const n=`var(${m})`,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 ie=t=>t.replace(/[A-Z]/g,e=>`-${e.toLowerCase()}`);function ke(t,e){if(!t)return null;const n=E(e),o=t.rules.get(n);if(o)return o;if(n.length<ae||t.drawn.has(n))return null;let r=null;for(const[i,a]of t.rules)if(i.includes(n)){if(r&&r.stamp!==a.stamp)return null;r=a}return r}const ae=8;export{_ as PART_ALIGNS,At as PART_LETTER_EM_MAX,_t as PART_LETTER_EM_MIN,Pt as PART_LETTER_STEP,Rt as PART_LINE_HEIGHT_MAX,bt as PART_LINE_HEIGHT_MIN,mt as PART_LINE_STEP,W as PART_MEASURED_TRACKS,xt as PART_NUDGE_MAX,dt as PART_NUDGE_MIN,St as PART_PADDING_MAX,ht as PART_PADDING_MIN,gt as PART_PADDING_STEP,Z as PART_PARAGRAPH_ATTR,Et as PART_PARAGRAPH_MAX,zt as PART_PARAGRAPH_MIN,m as PART_PARAGRAPH_VAR,Tt as PART_RELATIVE_PROPS,C as PART_SIZE_MAX,D as PART_SIZE_MIN,Ot as PART_SIZE_STEPS,ct as PART_STYLED_ATTR,$ as PART_STYLES_PROP,ee as PART_STYLE_PROPERTIES,pt as PART_WEIGHTS,k as SHARED_PART_PROPERTIES,j as STYLE_ID_OF_ROLE,H as TEXT_STYLE_ATTR,Oe as applyPartStyles,Re as blockDrawsTextStyle,Se as followedStyleOf,ne as isPartKindKey,g as isTextStyleId,re as paragraphRules,N as partCanvasDeclarations,Lt as partCaseOfTransform,Mt as partCaseTransform,ze as partFontKeyOf,ge as partLiftRules,Kt as partPhoneDeclarations,Ie as partRuleForKind,ke as partRuleForText,_e as partShownDeclarations,Ct as partSpacingOf,Ae as partStyleBase,Pe as partStyleCount,Fe as partStyleCss,I as partStyleDeclarations,Gt as partStyleForScreen,Ee as partStyleSource,U as partStyleWithoutSizeBox,Te as propsWithPartStyleValue,be as propsWithoutPartStyle,Ne as publishedPartStyles,K as readPartStyle,me as readPartStyles,Qt as regionCanvasDeclarations,we as regionCanvasRestore,$e as regionHasOwnLook,Jt as regionSheetStyle,ye as regionShownDeclarations,Vt as storedPartStyle};
1
+ import{textStyleCaseCss as q,textStyleCaseOfCss as J}from"efficient-easel/draw";import{FONT_OPTIONS as Q,fontOption as tt,fontRoleOf as R,SIZE_STEP_OF_ROLE as z}from"../../../format/lib/fonts.js";import{encodePartKey as et}from"../../../format/lib/document/part-key.js";import{decodePartId as M,normalizePartText as E}from"./text-parts.js";import{partInkCss as nt}from"../../../format/lib/document/part-inks.js";import{regionStyle as ot}from"../../../format/lib/sections/text-regions.js";import{PHONE_MEDIA as rt}from"../content/view-values.js";import{plainRecord as $,propsWithPartRecord as it,readPartRecord as at,readPartRecords as st}from"../../../format/lib/document/part-records.js";const y="_partStyles",ft="data-sf-part-styled",L="data-sf-text-style",ct=/^(heading|body)-[1-7]$/;function g(t){return typeof t=="string"&&ct.test(t)}const H={heading:"heading-1",heading2:"heading-2",heading3:"heading-3",body:"body-1",label:"body-5"};function lt(t){if(!t)return null;for(const[e,n]of Object.entries(H))if(n===t)return e;return null}function xe(t){if(g(t.textStyle))return t.textStyle;const e=R(t.role);return e?H[e]:void 0}const ut=[400,500,600,700],_=["left","center","right","justify"],j=5,D=1e3,pt=-5,dt=10,xt=0,ht=64,St=2,C={size:{min:j,max:D,step:1},sizePhone:{min:j,max:D,step:1},padding:{min:xt,max:ht,step:St}},gt=.05,mt=.01,Pt=["line","letter"],Tt=.5,bt=2.5,Rt=-1,_t=1,At=0,zt=400,Et=[...new Set(Object.values(z))];function he(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 Se(t){return st(t,y)}function v(t,e){return at(t,y,e)}function ge(t,e){return Object.values(v(t,e)).filter(n=>n!==void 0).length}function W(t,e,n){return it(t,y,e,$t(n).length?n:null)}function $t(t){return Object.entries(t).filter(([,e])=>e!==void 0)}function yt(t){return Pt.includes(t)}const b=(t,e,n)=>Math.min(n,Math.max(e,t));function Nt(t,e){if(yt(t)){const n=Math.round(Number(e));return!Number.isFinite(n)||n===0?null:b(n,pt,dt)}if(t==="lineHeight"){const n=Number(e);return Number.isFinite(n)?P(b(n,Tt,bt),3):null}if(t==="letterSpacing"){const n=Number(e);return Number.isFinite(n)?P(b(n,Rt,_t),4):null}if(t==="paragraphSpacing"){const n=Math.round(Number(e));return!Number.isFinite(n)||n<=0?null:b(n,At,zt)}if(Object.hasOwn(C,t)){const{min:n,max:o}=C[t],r=Math.round(Number(e));return Number.isFinite(r)?b(r,n,o):null}return t==="italic"?typeof e=="boolean"?e:null:t==="role"||t==="fontRole"?R(e)?e:null:t==="sizeToken"?O(e)?e:null:t==="textStyle"?g(e)?e:null:t==="alignPhone"?_.includes(e)?e:null:e}const Ot=["weight","size","sizePhone","line","letter","lineHeight","letterSpacing","paragraphSpacing","padding"];function N(t){let e=null;const n=o=>{e??={...t},delete e[o]};for(const o of Ot){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&&!g(t.textStyle)&&n("textStyle"),t.sizeToken!==void 0&&!O(t.sizeToken)&&n("sizeToken"),t.fontRole!==void 0&&!R(t.fontRole)&&n("fontRole"),e??t}function O(t){if(!t||typeof t!="object")return!1;const{step:e,px:n,stepPhone:o,pxPhone:r,fluid:i}=t,a=f=>typeof f=="number"&&Number.isFinite(f)&&f>0,s=f=>typeof f=="string"&&Et.includes(f);return s(e)&&a(n)&&(o===void 0||s(o))&&(r===void 0||a(r))&&(i===void 0||wt(i,n))}function wt(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 G(t){return t?.pxPhone&&O(t)?{step:t.stepPhone??t.step,px:t.pxPhone}:null}function K({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 It=[["font","role"],["font","fontRole"],["role","textStyle"],["line","lineHeight"],["letter","letterSpacing"]];function Ft(t){const e=[];for(const[n,o]of It)n===t?e.push(o):o===t&&e.push(n);return e}function me(t,e,n,o){const r={...v(t,e)},i=o==null?null:Nt(n,o);if(i===null)delete r[n];else{r[n]=i;for(const a of Ft(n))delete r[a]}return W(t,e,r)}function Pe(t,e){return W(t,e,{})}function kt(t){return J(t)??"none"}function Mt(t){return q(t)??""}const X={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 Lt(t,e){const n=R(t.role);return n||(e?.blockDrawsStyle?null:lt(t.textStyle))}function Te(t,e){return t==="Text"&&e==="text"}const Ht={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 jt(t){const e=z[t],n=Ht[e];return n?`var(--size-${e}, ${n})`:`var(--size-${e})`}function Dt(t){const e={};return typeof t.lineHeight=="number"?e.lineHeight=t.lineHeight:t.line&&(e.lineHeight=P(Ct+t.line*gt,3)),typeof t.letterSpacing=="number"?e.letterSpacingEm=t.letterSpacing:t.letter&&(e.letterSpacingEm=P(t.letter*mt,4)),e}const Ct=1,m="--sf-part-para";function vt(t){t=N(t);const e={};if(typeof t.sizePhone=="number"&&t.sizePhone>0)e.fontSize=`${t.sizePhone}px`;else{const n=G(t.sizeToken);n&&(e.fontSize=K(n))}return t.alignPhone&&(e.textAlign=t.alignPhone),e}function Wt(t,e){if(!e)return t;const n=N(t);let o=t;if(typeof n.sizePhone=="number"&&n.sizePhone>0)o={...o,size:n.sizePhone};else{const r=G(n.sizeToken);r&&(o={...o,size:void 0,sizeToken:r})}return n.alignPhone&&(o={...o,align:n.alignPhone}),o}function w(t,e,n){return I(Wt(t,e),A,n)}function B(t,e){const n=e?"sizePhone":"size";if(!Object.hasOwn(t,n))return t;const o={...t};return delete o[n],o}function be(t,e,n){const o=w(B(t,e),e,n);return{fontFamily:o.fontFamily,fontSize:o.fontSize}}function I(t,e,n){t=N(t);const o=Lt(t,n),r=Dt(t),i=t.size?`${t.size}px`:t.sizeToken?K(t.sizeToken):o?jt(o):"";return{fontFamily:t.font?Bt(t.font):t.fontRole?`var(${X[t.fontRole]})`:o?`var(${X[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:Mt(t.case),textAlign:t.align??"",paddingTop:U(t.padding),paddingBottom:U(t.padding),color:Gt(t.color),fontStyle:t.italic===!0?"italic":t.italic===!1?"normal":""}}const Gt=t=>nt(t),U=t=>t===void 0?"":`${t}px`,P=(t,e)=>Number(t.toFixed(e));function Re(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:Kt(Number.parseInt(t.fontWeight,10)),lineRatio:Number.isFinite(o)?P(o/n,3):1.2,letterEm:Number.isFinite(r)?P(r/n,4):0,align:Xt(t.textAlign),case:kt(t.textTransform),paddingPx:Number.isFinite(i)?Math.round(i):0}}function Kt(t){return Number.isFinite(t)?ut.reduce((e,n)=>Math.abs(n-t)<Math.abs(e-t)?n:e):400}function Xt(t){for(const e of _)if(e===t)return e;return t==="end"?"right":"left"}function _e(t,e){const n=V(t);if(!n)return"";for(const o of Q)if(V(e(o.cssVar))===n)return o.key;return""}const V=t=>(t.split(",")[0]??"").replace(/["']/g,"").replace(/\s+/g," ").trim().toLowerCase();function Bt(t){const e=tt(t);return e?`var(${e.cssVar})`:""}function Ae(t,e,n,o){return!e||M(e)?.nodeId!==t?null:n.find(i=>o(i.getAttribute("class")))??n[0]??null}function Ut(t,e){return Object.hasOwn(t,e)?$(t[e])??{}:{}}function ze(t,e,n=()=>A,o=s=>s,r=Zt,i=!1,a=()=>!1){let s=0;for(const{element:f,partId:p}of t){const c=M(p)?.propKey;if(!c)continue;const u=Ut(e,o(c)),d=w(u,i,{blockDrawsStyle:a(c)});g(u.textStyle)?f.setAttribute?.(L,u.textStyle):f.removeAttribute?.(L);const l=k.some(x=>f.style[x]);let h=!1;for(const[x,S]of Object.entries(d))Qt(f,x,S),S&&(h=!0);if(l||k.some(x=>d[x]))for(const x of Vt(f,r))for(const S of k)x.style[S]=d[S]??"";h&&(s+=1)}return s}function Vt(t,e){const n=E(t.textContent??""),o=[];let r=t;for(let i=0;i<Yt&&e(r);i+=1){const a=r.parentElement;if(!a||E(a.textContent??"")!==n)break;o.push(a),r=a}return o}const Yt=8;function Zt(t){const e=t;return typeof window>"u"||!e?.ownerDocument?!1:window.getComputedStyle(e).display==="inline"}const A={fontKey:"",sizePx:16,weight:400,lineRatio:1,letterEm:0,align:"left",case:"none",paddingPx:0};function qt(t){if(!t||typeof t!="object")return null;const e={};return g(t.textStyle)&&(e.textStyle=t.textStyle),typeof t.size=="number"&&t.size>0&&(e.size=t.size),typeof t.sizePhone=="number"&&t.sizePhone>0&&(e.sizePhone=t.sizePhone),Object.keys(e).length?e:null}function Jt(t,e){const n=qt(t);if(!n)return{};const o=w(n,e);return{...o.fontFamily?{fontFamily:o.fontFamily}:{},...o.fontSize?{fontSize:o.fontSize}:{}}}function Ee(t){return g(t?.textStyle)||!!t?.role||typeof t?.size=="number"&&t.size>0}function $e(t,e,n){if(!t||typeof t!="object")return{};const o=ot(t.role,e,z)??{},r=e.sized?Jt(B(t,n),n):{};return{...o,...r}}function ye(t,e,n){n.fontFamily&&t.fontFamily===n.fontFamily&&(t.fontFamily=e.fontFamily),n.fontSize&&t.fontSize===n.fontSize&&(t.fontSize=e.fontSize)}function Qt(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?.(Y,""):r.removeAttribute?.(Y))}const Y="data-sf-part-para",te=Object.keys(I({},A)),F=new Set(["color","overflowWrap",m,"fontStyle"]),k=te.filter(t=>!F.has(t));function Ne(t,e,n,o=s=>s,r=()=>!1,i=()=>null,a=[]){const s=new Map;for(const c of t){const u=et(c.key,c.row);for(const d of c.texts){const l=s.get(d);l?(l.keys.add(c.key),l.partKeys.add(u)):s.set(d,{keys:new Set([c.key]),partKeys:new Set([u])})}}const f=new Map;for(const c of new Set([...Object.keys(e),...a])){if(!ee(c))continue;const u=Z(n,c,$(e[c])??{},!1,i(c));u&&f.set(c,u)}const p=new Map;for(const[c,{keys:u,partKeys:d}]of s){const l=d.size===1?[...d][0]:u.size===1?[...u][0]:null;if(!l)continue;const h=o(l),T=i(h);if(!Object.hasOwn(e,h)&&!T)continue;const x=$(e[h])??{},S=Z(n,l,x,r(l),T);S&&p.set(c,S)}return p.size||f.size?{rules:p,kindRules:f,drawn:new Set(s.keys())}:null}function Z(t,e,n,o,r){const i=I(n,A,{blockDrawsStyle:o}),a=vt(n),s=g(n.textStyle)?n.textStyle:void 0;return!Object.values(i).some(Boolean)&&!Object.keys(a).length&&!s&&!r?null:{stamp:ne(t,e),declarations:i,...Object.keys(a).length?{phone:a}:{},...s?{textStyle:s}:{},...r?{motion:r}:{}}}function ee(t){return t.startsWith("@")}function Oe(t,e){return t?.kindRules.get(e)??null}function ne(t,e){const n=o=>o.replace(/[^A-Za-z0-9_-]+/g,"-");return`${n(t)}~${n(e)}`}function we(t){const e=[],n=new Set,o=r=>{const{stamp:i,declarations:a}=r;if(n.has(i))return;n.add(i);const s=Object.entries(a).filter(([,l])=>l!==""),f=l=>l.map(([h,T])=>`${re(h)}: ${T}`).join("; "),p=`[${ft}="${i}"]`,c=s.filter(([l])=>!F.has(l)),u=s.filter(([l])=>F.has(l));c.length&&e.push(`${p}, *:has(> ${p}) { ${f(c)} }`),u.length&&e.push(`${p} { ${f(u)} }`),a[m]&&(e.push(`*:has(> ${p}) { ${m}: ${a[m]} }`),e.push(...oe(p,`*:has(> ${p})`)));const d=Object.entries(r.phone??{}).filter(([,l])=>l!=="");d.length&&e.push(`@media ${rt} { ${p}, *:has(> ${p}) { ${f(d)} } }`)};for(const r of t.rules.values())o(r);for(const r of t.kindRules.values())o(r);return e.join(`
2
+ `)}function oe(t,e){const n=`var(${m})`,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 re=t=>t.replace(/[A-Z]/g,e=>`-${e.toLowerCase()}`);function Ie(t,e){if(!t)return null;const n=E(e),o=t.rules.get(n);if(o)return o;if(n.length<ie||t.drawn.has(n))return null;let r=null;for(const[i,a]of t.rules)if(i.includes(n)){if(r&&r.stamp!==a.stamp)return null;r=a}return r}const ie=8;export{_ as PART_ALIGNS,_t as PART_LETTER_EM_MAX,Rt as PART_LETTER_EM_MIN,mt as PART_LETTER_STEP,bt as PART_LINE_HEIGHT_MAX,Tt as PART_LINE_HEIGHT_MIN,gt as PART_LINE_STEP,C as PART_MEASURED_TRACKS,dt as PART_NUDGE_MAX,pt as PART_NUDGE_MIN,ht as PART_PADDING_MAX,xt as PART_PADDING_MIN,St as PART_PADDING_STEP,Y as PART_PARAGRAPH_ATTR,zt as PART_PARAGRAPH_MAX,At as PART_PARAGRAPH_MIN,m as PART_PARAGRAPH_VAR,Pt as PART_RELATIVE_PROPS,D as PART_SIZE_MAX,j as PART_SIZE_MIN,Et as PART_SIZE_STEPS,ft as PART_STYLED_ATTR,y as PART_STYLES_PROP,te as PART_STYLE_PROPERTIES,ut as PART_WEIGHTS,k as SHARED_PART_PROPERTIES,H as STYLE_ID_OF_ROLE,L as TEXT_STYLE_ATTR,ze as applyPartStyles,Te as blockDrawsTextStyle,xe as followedStyleOf,ee as isPartKindKey,g as isTextStyleId,oe as paragraphRules,w as partCanvasDeclarations,kt as partCaseOfTransform,Mt as partCaseTransform,_e as partFontKeyOf,he as partLiftRules,vt as partPhoneDeclarations,Oe as partRuleForKind,Ie as partRuleForText,be as partShownDeclarations,Dt as partSpacingOf,Re as partStyleBase,ge as partStyleCount,we as partStyleCss,I as partStyleDeclarations,Wt as partStyleForScreen,Ae as partStyleSource,B as partStyleWithoutSizeBox,me as propsWithPartStyleValue,Pe as propsWithoutPartStyle,Ne as publishedPartStyles,v as readPartStyle,Se as readPartStyles,Jt as regionCanvasDeclarations,ye as regionCanvasRestore,Ee as regionHasOwnLook,qt as regionSheetStyle,$e as regionShownDeclarations,Ut as storedPartStyle};
@@ -1 +1 @@
1
- import{jsx as N}from"react/jsx-runtime";import{parseBlockWidthFit as R,phoneKey as o}from"efficient-easel/draw";import{blockSizeOf as z,blockSizeValuesOf as E}from"../../content/block-size.js";import{CellWrap as j}from"../../../components/InBoxContext.js";import{boxPhoneRowFits as D,boxRowColumnsClass as C,boxShareClasses as P}from"../../../../format/lib/content/box-layout.js";import{resolveContainerDirection as K}from"../../../../format/lib/content/container-direction.js";import{containerBlocksFor as A}from"../../../../format/lib/document/container-blocks.js";import{readPartStyle as L}from"../part-styles.js";import{addShowWhenFacts as G,withRowRules as h}from"../../../../format/lib/document/show-when-attach.js";import{BOX_BLOCK_KEYS as X}from"./cell-width.js";import{findParentNode as Z}from"../../../../format/lib/document/passes/document-position.js";const v=new Set(["Text","Heading"]),U=new Set(["h1","h2","h3","h4","h5","h6"]);function m(t,e){return t==="Heading"?!0:t!=="Text"?!1:typeof e.tag=="string"&&U.has(e.tag)?!0:L(e,"text").textStyle?.startsWith("heading-")===!0}const c={not:{context:"blockOutsideBox",is:!0}},_={all:[c,{not:{context:"boxSharesWidth",is:!0}}]},b={all:[c,{not:{context:"boxSharesWidthPhone",is:!0}}]};function g(t,e,n){return{any:[{field:o(t),is:e},{all:[{field:o(t),set:!1},n??{field:t,is:e}]}]}}const O={any:[{field:"textFit",is:"shrink"},{all:[{field:"textFit",set:!1},{not:{context:"textWrapsByDefault",is:!0}}]}]},M=[[["_gBlockSize","minWidth",o("minWidth"),"maxWidth",o("maxWidth")],c],[["widthFit"],_],[[o("widthFit")],b],[["width"],{all:[_,{field:"widthFit",is:"fixed"}]}],[[o("width")],{all:[b,g("widthFit","fixed")]}]],W=[[["_gText","textFit",o("textFit")],c],[["minFont"],{all:[c,O]}],[[o("minFont")],{all:[c,g("textFit","shrink",O)]}]],u=(t,e)=>Z(e.appState,t.props?.id),x=t=>!!t&&typeof t.type=="string"&&A(t.type)!==null,k=t=>(t.type==="Flex"||t.type==="HeroGroup")&&K(t.type,t.props?.direction)==="row",B=t=>{const e=R(t);return e!==void 0&&e!=="fit"},V={blockOutsideBox:(t,e)=>!x(u(t,e)),boxSharesWidth:(t,e)=>{const n=u(t,e);return!x(n)||!k(n)?!1:C({...n.props,direction:"row"})!==""?!0:P(n.props?.share)!==""&&!B(t.props?.widthFit)},boxSharesWidthPhone:(t,e)=>{const n=u(t,e);if(!x(n)||!k(n))return!1;const i=n.props?.phoneRow;return(Number(i)===2||Number(i)===3)&&!D(i,n.props?.[o("share")])&&!B(t.props?.[o("widthFit")]??t.props?.widthFit)}},Y=t=>/^_[gds][A-Z]/.test(t);function q(t,e,n){const i=Object.entries(t),r=i.findIndex(([l])=>l===e);if(r===-1)return null;let s=r+1;for(;s<i.length&&!Y(i[s][0]);)s++;return Object.fromEntries([...i.slice(0,s),...Object.entries(n),...i.slice(s)])}function T(t,e,n){const i=Object.entries(t);return Object.fromEntries([...i.slice(0,e),...Object.entries(n),...i.slice(e)])}function J(t,e,n){const i=Object.keys(e);if(i.includes("_dSize")){const{_gBlockSize:r,...s}=n;return T(e,i.indexOf("_dSize")+1,s)}return Q.has(t)&&i.includes("_gSpacing")?T(e,i.indexOf("_gSpacing"),n):{...e,...n}}const Q=new Set(["Text","Heading"]);function $(t,e){const{_gText:n,...i}=e;return q(t,"_gText",i)??{...t,...e}}function tt(t){const e=new WeakMap;return n=>{if(!n||!("textFit"in n))return n;let i=e.get(n);if(!i){i={...n};for(const r of["textFit",o("textFit")])r in i&&(i[r]=t[r]);e.set(n,i)}return i}}const ut={name:"blockSize",applies:(t,e,n)=>X.includes(t)&&!!n&&typeof n.render=="function",panel(t,e,n){const i=v.has(e),{size:r,text:s}=n.blockSizeFields(i?{textFit:e==="Heading"?"shrink":"wrap"}:{});let l=J(e,t.fields??{},h(r,M));if(i){const a=h(s,W);if(l=$(l,a),e==="Text"){const y=h(n.blockSizeFields({textFit:"shrink"}).text,W),H=tt(y),p=t.resolveFields,I=(S,f)=>{const d=p?p(S,f):f.fields,w=F=>m(e,S?.props??{})?H(F??f.fields):F;return d instanceof Promise?d.then(w):w(d)};t.resolveFields=I}}t.fields=l,G(t,{...V,textWrapsByDefault:a=>!m(e,a.props??{})})},draw(t){et(t)}};function et(t){const e=t.render;t.render=n=>{const i=z(E(n)),r=e(n);return i===null?r:N(j,{className:i.className,...Object.keys(i.style).length?{style:i.style}:{},attrs:i.attrs,children:r})}}export{ut as blockSize,m as textShrinksByDefault};
1
+ import{jsx as C}from"react/jsx-runtime";import{parseBlockWidthFit as D,phoneKey as s,tabletKey as l}from"efficient-easel/draw";import{blockSizeOf as j,blockSizeValuesOf as K}from"../../content/block-size.js";import{CellWrap as P}from"../../../components/InBoxContext.js";import{boxPhoneRowFits as A,boxRowColumnsClass as W,boxShareClasses as g,boxShareTabletOf as L,boxTabletColumnsClass as G}from"../../../../format/lib/content/box-layout.js";import{resolveContainerDirection as X}from"../../../../format/lib/content/container-direction.js";import{containerBlocksFor as Z}from"../../../../format/lib/document/container-blocks.js";import{readPartStyle as v}from"../part-styles.js";import{addShowWhenFacts as U,withRowRules as x}from"../../../../format/lib/document/show-when-attach.js";import{BOX_BLOCK_KEYS as M}from"./cell-width.js";import{findParentNode as V}from"../../../../format/lib/document/passes/document-position.js";const Y=new Set(["Text","Heading"]),q=new Set(["h1","h2","h3","h4","h5","h6"]);function O(t,e){return t==="Heading"?!0:t!=="Text"?!1:typeof e.tag=="string"&&q.has(e.tag)?!0:v(e,"text").textStyle?.startsWith("heading-")===!0}const c={not:{context:"blockOutsideBox",is:!0}},T={all:[c,{not:{context:"boxSharesWidth",is:!0}}]},B={all:[c,{not:{context:"boxSharesWidthPhone",is:!0}}]},k={all:[c,{not:{context:"boxSharesWidthTablet",is:!0}}]};function J(t,e){return{any:[{field:l(t),is:e},{all:[{field:l(t),set:!1},{field:t,is:e}]}]}}function y(t,e,i){return{any:[{field:s(t),is:e},{all:[{field:s(t),set:!1},i??{field:t,is:e}]}]}}const H={any:[{field:"textFit",is:"shrink"},{all:[{field:"textFit",set:!1},{not:{context:"textWrapsByDefault",is:!0}}]}]},Q=[[["_gBlockSize","minWidth",l("minWidth"),s("minWidth"),"maxWidth",l("maxWidth"),s("maxWidth")],c],[["widthFit"],T],[[l("widthFit")],k],[[s("widthFit")],B],[["width"],{all:[T,{field:"widthFit",is:"fixed"}]}],[[l("width")],{all:[k,J("widthFit","fixed")]}],[[s("width")],{all:[B,y("widthFit","fixed")]}]],I=[[["_gText","textFit",s("textFit")],c],[["minFont"],{all:[c,H]}],[[s("minFont")],{all:[c,y("textFit","shrink",H)]}]],f=(t,e)=>V(e.appState,t.props?.id),h=t=>!!t&&typeof t.type=="string"&&Z(t.type)!==null,S=t=>(t.type==="Flex"||t.type==="HeroGroup")&&X(t.type,t.props?.direction)==="row",w=t=>{const e=D(t);return e!==void 0&&e!=="fit"},$={blockOutsideBox:(t,e)=>!h(f(t,e)),boxSharesWidth:(t,e)=>{const i=f(t,e);return!h(i)||!S(i)?!1:W({...i.props,direction:"row"})!==""?!0:g(i.props?.share)!==""&&!w(t.props?.widthFit)},boxSharesWidthTablet:(t,e)=>{const i=f(t,e);if(!h(i)||!S(i))return!1;if(G(i.props?.[l("columns")])!==""||W({...i.props,direction:"row"})!=="")return!0;const n=L(i.props?.[l("share")])??i.props?.share;return g(n)!==""&&!w(t.props?.[l("widthFit")]??t.props?.widthFit)},boxSharesWidthPhone:(t,e)=>{const i=f(t,e);if(!h(i)||!S(i))return!1;const n=i.props?.phoneRow;return(Number(n)===2||Number(n)===3)&&!A(n,i.props?.[s("share")])&&!w(t.props?.[s("widthFit")]??t.props?.widthFit)}},tt=t=>/^_[gds][A-Z]/.test(t);function et(t,e,i){const n=Object.entries(t),r=n.findIndex(([a])=>a===e);if(r===-1)return null;let o=r+1;for(;o<n.length&&!tt(n[o][0]);)o++;return Object.fromEntries([...n.slice(0,o),...Object.entries(i),...n.slice(o)])}function N(t,e,i){const n=Object.entries(t);return Object.fromEntries([...n.slice(0,e),...Object.entries(i),...n.slice(e)])}function it(t,e,i){const n=Object.keys(e);if(n.includes("_dSize")){const{_gBlockSize:r,...o}=i;return N(e,n.indexOf("_dSize")+1,o)}return nt.has(t)&&n.includes("_gSpacing")?N(e,n.indexOf("_gSpacing"),i):{...e,...i}}const nt=new Set(["Text","Heading"]);function rt(t,e){const{_gText:i,...n}=e;return et(t,"_gText",n)??{...t,...e}}function st(t){const e=new WeakMap;return i=>{if(!i||!("textFit"in i))return i;let n=e.get(i);if(!n){n={...i};for(const r of["textFit",s("textFit")])r in n&&(n[r]=t[r]);e.set(i,n)}return n}}const bt={name:"blockSize",applies:(t,e,i)=>M.includes(t)&&!!i&&typeof i.render=="function",panel(t,e,i){const n=Y.has(e),{text:r}=i.blockSizeFields(n?{textFit:e==="Heading"?"shrink":"wrap"}:{}),{size:o}=i.blockSizeFields({tablet:!0});let a=it(e,t.fields??{},x(o,Q));if(n){const d=x(r,I);if(a=rt(a,d),e==="Text"){const z=x(i.blockSizeFields({textFit:"shrink"}).text,I),E=st(z),b=t.resolveFields,R=(F,u)=>{const p=b?b(F,u):u.fields,m=_=>O(e,F?.props??{})?E(_??u.fields):_;return p instanceof Promise?p.then(m):m(p)};t.resolveFields=R}}t.fields=a,U(t,{...$,textWrapsByDefault:d=>!O(e,d.props??{})})},draw(t){ot(t)}};function ot(t){const e=t.render;t.render=i=>{const n=j(K(i)),r=e(i);return n===null?r:C(P,{className:n.className,...Object.keys(n.style).length?{style:n.style}:{},attrs:n.attrs,children:r})}}export{bt as blockSize,O as textShrinksByDefault};
@@ -1 +1 @@
1
- import{jsx as i}from"react/jsx-runtime";import{SECTION_BORDER_CLASS as d,sectionBorderStyle as c}from"../../../../format/lib/content/borders.js";import{PAD_ON_ROOT as a}from"./section-padding.js";const m={name:"sectionBorder",applies:(e,n,r)=>n.isSection(e)&&!!r&&typeof r.render=="function",draw(e,n){if(a.has(n))return;const r=e.render;e.render=o=>{const t=c(o.sectionBorder,o.sectionBorderPhone),s=r(o);return t?i("div",{className:d,style:{display:"contents",...t},children:s}):s}}};export{m as sectionBorder};
1
+ import{jsx as i}from"react/jsx-runtime";import{SECTION_BORDER_CLASS as d,sectionBorderStyle as c}from"../../../../format/lib/content/borders.js";import{PAD_ON_ROOT as a}from"./section-padding.js";const m={name:"sectionBorder",applies:(e,o,r)=>o.isSection(e)&&!!r&&typeof r.render=="function",draw(e,o){if(a.has(o))return;const r=e.render;e.render=n=>{const t=c(n.sectionBorder,n.sectionBorderPhone,n.sectionBorderTablet),s=r(n);return t?i("div",{className:d,style:{display:"contents",...t},children:s}):s}}};export{m as sectionBorder};
@@ -1 +1 @@
1
- import{jsx as M}from"react/jsx-runtime";import{SECTION_HEIGHT_MODES as s,SECTION_MIN_HEIGHT_EXCLUDED as P,hasPhoneHeight as x,resolvePhoneHeight as E,resolveSectionMinHeight as _,sectionMinHeightAttrs as F}from"../../../../format/lib/content/section-min-height.js";import{CellWrap as m}from"../../../components/InBoxContext.js";import{shownForOption as r,withRowRules as p}from"../../../../format/lib/document/show-when-attach.js";const v=[[["sectionHeightValue"],r("sectionHeightMode",s,"auto",["fixed","screen"])],[["sectionHeightUnit"],r("sectionHeightMode",s,"auto",["fixed"])],[["sectionHeightValuePhone"],r("sectionHeightModePhone",s,"auto",["fixed","screen"])],[["sectionHeightUnitPhone"],r("sectionHeightModePhone",s,"auto",["fixed"])]],O={name:"sectionHeight",applies:(e,n,t)=>n.isSection(e)&&!P.has(e)&&!!t&&typeof t.render=="function",panel(e,n,t){const i=t.heightFields;e.fields={...e.fields,...p(i(),v)};const c=e.resolveFields;e.resolveFields=(u,H)=>{const o=c?c(u,H):H.fields,h=u?.props??{},l=_(h),g=x(h)?E(h):null;return o&&typeof o.then=="function"?o.then(f=>d(a(f,l),g)):d(a(o,l),g)}},draw(e){const n=e.render;e.render=t=>{const i=F(t);return i?M(m,{className:i.className,style:i.style,children:n(t)}):n(t)}}};function a(e,n){if(!e||!("sectionHeightMode"in e)||n.mode==="auto")return e;const t={...e},i=t.sectionHeightValue;return i&&(t.sectionHeightValue={...i,unit:n.unit}),t}function d(e,n){if(!e||!("sectionHeightModePhone"in e)||!n||n.mode==="auto")return e;const t={...e},i=t.sectionHeightValuePhone;return i&&(t.sectionHeightValuePhone={...i,unit:n.unit}),t}export{O as sectionHeight};
1
+ import{jsx as v}from"react/jsx-runtime";import{SECTION_HEIGHT_MODES as u,SECTION_MIN_HEIGHT_EXCLUDED as E,hasPhoneHeight as _,hasTabletHeight as F,resolvePhoneHeight as T,resolveTabletHeight as w,resolveSectionMinHeight as x,sectionMinHeightAttrs as I}from"../../../../format/lib/content/section-min-height.js";import{CellWrap as M}from"../../../components/InBoxContext.js";import{phoneKey as S,tabletKey as a}from"efficient-easel/draw";import{shownByUsedValue as H,shownForOption as V,withRowRules as b}from"../../../../format/lib/document/show-when-attach.js";const N=(()=>{const e=n=>[[n],[a(n),n],[S(n),a(n),n]],i=n=>({field:n,in:u}),t=n=>r=>V(r,u,"auto",n),[o,s]=[e("sectionHeightValue"),e("sectionHeightUnit")];return e("sectionHeightMode").flatMap((n,r)=>[[[o[r][0]],H(n,i,t(["fixed","screen"]))],[[s[r][0]],H(n,i,t(["fixed"]))]])})(),P={name:"sectionHeight",applies:(e,i,t)=>i.isSection(e)&&!E.has(e)&&!!t&&typeof t.render=="function",panel(e,i,t){const o=t.heightFields;e.fields={...e.fields,...b(o(),N)};const s=e.resolveFields;e.resolveFields=(n,r)=>{const h=s?s(n,r):r.fields,c=n?.props??{},f=x(c),d=F(c)?w(c):null,p=_(c)?T(c):null,l=m=>g(g(O(m,f),"sectionHeightValueTablet",d),"sectionHeightValuePhone",p);return h&&typeof h.then=="function"?h.then(l):l(h)}},draw(e){const i=e.render;e.render=t=>{const o=I(t);return o?v(M,{className:o.className,style:o.style,children:i(t)}):i(t)}}};function O(e,i){if(!e||!("sectionHeightMode"in e)||i.mode==="auto")return e;const t={...e},o=t.sectionHeightValue;return o&&(t.sectionHeightValue={...o,unit:i.unit}),t}function g(e,i,t){if(!e||!(i in e)||!t||t.mode==="auto")return e;const o={...e},s=o[i];return s&&(o[i]={...s,unit:t.unit}),o}export{P as sectionHeight};
@@ -1 +1 @@
1
- import{jsx as o}from"react/jsx-runtime";import{SECTION_STICK_EXCLUDED as a,sectionStickAttrs as l}from"../../../../format/lib/content/section-sticky.js";import{withRowRules as d}from"../../../../format/lib/document/show-when-attach.js";import{SlotsStartAfresh as f}from"../../../components/InBoxContext.js";import{CARD_BLOCK_KEYS as S}from"./corners.js";const T=c("sectionSticky",(e,s,t)=>s.isSection(e)&&!a.has(e)&&!!t&&typeof t.render=="function"),p=c("cardSticky",(e,s,t)=>S.includes(e)&&!!t&&typeof t.render=="function");function c(e,s){return{name:e,applies:s,panel(t,r,i){t.fields={...t.fields,...d(i.stickFields(),k)}},draw(t){const r=t.render;t.render=i=>{const n=l(i);return n?o("div",{className:n.className,style:n.style,children:o(f,{children:r(i)})}):r(i)}}}}const k=[[["stickTopDistance"],{field:"stickTop",is:!0}],[["stickTopDistancePhone"],{field:"stickTopPhone",is:!0}]];export{p as cardSticky,T as sectionSticky};
1
+ import{jsx as r}from"react/jsx-runtime";import{SECTION_STICK_EXCLUDED as l,sectionStickAttrs as d}from"../../../../format/lib/content/section-sticky.js";import{shownByUsedValue as c,withRowRules as f}from"../../../../format/lib/document/show-when-attach.js";import{SlotsStartAfresh as k}from"../../../components/InBoxContext.js";import{CARD_BLOCK_KEYS as T}from"./corners.js";const m=a("sectionSticky",(e,s,t)=>s.isSection(e)&&!l.has(e)&&!!t&&typeof t.render=="function"),C=a("cardSticky",(e,s,t)=>T.includes(e)&&!!t&&typeof t.render=="function");function a(e,s){return{name:e,applies:s,panel(t,o,i){t.fields={...t.fields,...f(i.stickFields(),S)}},draw(t){const o=t.render;t.render=i=>{const n=d(i);return n?r("div",{className:n.className,style:n.style,children:r(k,{children:o(i)})}):o(i)}}}}const S=(()=>{const e=t=>({field:t,in:[!0,!1]}),s=t=>({field:t,is:!0});return[[["stickTopDistance"],s("stickTop")],[["stickTopDistanceTablet"],c(["stickTopTablet","stickTop"],e,s)],[["stickTopDistancePhone"],c(["stickTopPhone","stickTopTablet","stickTop"],e,s)]]})();export{C as cardSticky,m as sectionSticky};
@@ -1,7 +1,7 @@
1
1
  import { type ShowWhenContext, type ShowWhenRule } from "efficient-shell/format";
2
2
  import type { SlotConfigView, TreeItem } from "efficient-easel/draw";
3
3
  export type { ShowWhenRule, ShowWhenContext };
4
- export { showWhenOf, shownForOption, truthy, withRowRules, withRowsShownWhen, withShowWhen, type RowRule, type WithShowWhen } from "../../../format/lib/document/show-when-attach.js";
4
+ export { showWhenOf, shownByUsedValue, shownForOption, truthy, withRowRules, withRowsShownWhen, withShowWhen, type RowRule, type WithShowWhen } from "../../../format/lib/document/show-when-attach.js";
5
5
  export declare function visibleFields<T extends Record<string, unknown>>(fields: T, values: Readonly<Record<string, unknown>> | null | undefined, context: ShowWhenContext): T;
6
6
  export type ShowWhenSelector = {
7
7
  index: number;
@@ -1 +1 @@
1
- import{isShown as s,lazyShowWhenContext as a}from"efficient-shell/format";import{isEditorOnDynamicPage as h}from"../../../format/lib/document/editor-page-context.js";import{parentOfSelection as u}from"./selection-parent.js";import{showWhenOf as C,shownForOption as b,truthy as g,withRowRules as R,withRowsShownWhen as j,withShowWhen as v}from"../../../format/lib/document/show-when-attach.js";import{showWhenOf as c}from"../../../format/lib/document/show-when-attach.js";function d(t,o,e){let r=!1;const n={};for(const[f,i]of Object.entries(t))s(c(i),o??{},e)?n[f]=i:r=!0;return r?n:t}function m(t,o,e,r){const n=u(o,e,r);return{device:t,parentType:n?.item.type,parent:n?.item.props}}function p(t,o){if(!t||typeof t!="object")return!1;const e=t;if(typeof e.context=="string"&&(e.context===o||e.context.startsWith(`${o}.`)))return!0;if("not"in e)return p(e.not,o);for(const r of[e.all,e.any])if(Array.isArray(r)&&r.some(n=>p(n,o)))return!0;return!1}function W(t,o={}){return a({parentType:()=>t.parent?.type??void 0,parent:()=>t.parent?.props??void 0,dynamicPage:()=>h(),root:()=>t.appState?.data?.root?.props,...o})}export{p as readsContext,W as resolverContext,m as showWhenContext,C as showWhenOf,b as shownForOption,g as truthy,d as visibleFields,R as withRowRules,j as withRowsShownWhen,v as withShowWhen};
1
+ import{isShown as f,lazyShowWhenContext as a}from"efficient-shell/format";import{isEditorOnDynamicPage as h}from"../../../format/lib/document/editor-page-context.js";import{parentOfSelection as u}from"./selection-parent.js";import{showWhenOf as C,shownByUsedValue as b,shownForOption as g,truthy as R,withRowRules as j,withRowsShownWhen as v,withShowWhen as A}from"../../../format/lib/document/show-when-attach.js";import{showWhenOf as c}from"../../../format/lib/document/show-when-attach.js";function x(t,o,e){let r=!1;const n={};for(const[s,i]of Object.entries(t))f(c(i),o??{},e)?n[s]=i:r=!0;return r?n:t}function m(t,o,e,r){const n=u(o,e,r);return{device:t,parentType:n?.item.type,parent:n?.item.props}}function p(t,o){if(!t||typeof t!="object")return!1;const e=t;if(typeof e.context=="string"&&(e.context===o||e.context.startsWith(`${o}.`)))return!0;if("not"in e)return p(e.not,o);for(const r of[e.all,e.any])if(Array.isArray(r)&&r.some(n=>p(n,o)))return!0;return!1}function W(t,o={}){return a({parentType:()=>t.parent?.type??void 0,parent:()=>t.parent?.props??void 0,dynamicPage:()=>h(),root:()=>t.appState?.data?.root?.props,...o})}export{p as readsContext,W as resolverContext,m as showWhenContext,C as showWhenOf,b as shownByUsedValue,g as shownForOption,R as truthy,x as visibleFields,j as withRowRules,v as withRowsShownWhen,A as withShowWhen};
@@ -1,2 +1,2 @@
1
- import{defaultTextStyles as Y,textStyleCaseCss as re,textStyleViewKey as le}from"efficient-easel/text-styles/model";import{phoneKey as ce,resolveViewValue as B,tabletKey as de}from"efficient-easel/draw";import{parseHexColor as pe}from"efficient-shell/format";import{FONT_OPTIONS as fe,normalizeFonts as U}from"../../../format/lib/fonts.js";import{PHONE_MEDIA as ue,TABLET_MEDIA as ge,viewOverrides as H,viewRules as X}from"../content/view-values.js";import{STYLE_ID_OF_ROLE as he,TEXT_STYLE_ATTR as me,paragraphRules as Z,partSpacingOf as Se}from"../document/part-styles.js";import{faceClassOf as q}from"../../../format/lib/text-style-face.js";import{compressionMetrics as ye,headingTypographyFromRow as be,normalizeHeadingCompression as E,normalizeSizes as Q}from"../../../format/lib/theme.js";import{finiteNumber as v}from"../../../format/lib/finite-number.js";import{nonEmptyString as O}from"../../../format/lib/non-empty-string.js";const N=e=>e==="sentence"?"none":void 0,ee=["font","color","size","sizeTablet","sizePhone","weight","italic","lineHeight","lineHeightTablet","lineHeightPhone","letterSpacing","letterSpacingTablet","letterSpacingPhone","paragraphSpacing","paragraphSpacingTablet","paragraphSpacingPhone","letterCase","largestSize","largestSizeTablet","largestSizePhone"],T=["desktop","tablet","phone"],C=(e,t)=>t==="desktop"?e:t==="tablet"?de(e):ce(e),k=(e,t)=>t==="desktop"?e:le(e,t);function j(e,t,i,n=X()){return B("textSize",t,e.sizeTablet,e.sizePhone,n)[i]}const xe=[["lineSpacing","lineHeight","line"],["letterSpacing","letterSpacing","letter"]];function V(e){for(const[t,i,n]of xe)for(const o of T)if(e===k(t,o))return{key:C(i,o),view:o,spacing:n};return{key:e,view:"desktop",spacing:null}}function b(e){const t={};for(const i of ee)e[i]!==void 0&&(t[i]=e[i]);return t}function M(e,t){const{auto:i,...n}=e,o=new Set(t??[]),r=ee.filter(s=>o.has(s)&&e.values[s]===void 0);return r.length?{...n,auto:r}:n}function ne(e){const t=e.fonts,i=e.sizes,n=e.typography,o=ye(e.compression),r={"heading-1":{font:O(t.heading),size:v(i.headingLarge),weight:v(n.weight),lineHeight:o.lineHeight,letterSpacing:o.letterSpacing,letterCase:N(n.case),largestSize:v(n.maxPx)},"heading-2":{font:O(t.heading2),size:v(i.headingMedium),weight:v(n.weight2),lineHeight:o.lineHeight,letterSpacing:o.letterSpacing,letterCase:N(n.case2)},"heading-3":{font:O(t.heading3),size:v(i.headingSmall),weight:v(n.weight3),lineHeight:o.lineHeight,letterSpacing:o.letterSpacing,letterCase:N(n.case3)},"body-1":{font:O(t.body),size:v(i.body)},"body-5":{font:O(t.label),size:v(i.label)}};return Y().map(({id:s,kind:l,name:d})=>({id:s,kind:l,name:d,values:b(r[s]??{})}))}function I(e){return Array.isArray(e)&&e.every(i=>i&&typeof i=="object"&&typeof i.id=="string"&&(i.kind==="heading"||i.kind==="body")&&typeof i.name=="string")?e.map(i=>M({...i,values:b(i.values??{})},Array.isArray(i.auto)?i.auto:void 0)):null}function je(e){return I(e)??[]}function te(e){return I(e)??Y().map(({id:t,kind:i,name:n})=>({id:t,kind:i,name:n,values:{}}))}function R(e,t){const i=ne(t),n=I(e);return n?n.map(o=>{const r={...F(i,o.id)};for(const s of o.auto??[])delete r[s];return{...o,values:b({...r,...o.values})}}):i}const F=(e,t)=>e.find(i=>i.id===t)?.values??{},ie=["heading-1","heading-2","heading-3"];function Ve({saved:e,old:t,cur:i,next:n,sizeOf:o,panelView:r="desktop"}){const s=ne(t),l=te(e),d=R(l,t),c=[],f=n.map(a=>{const S=i.find(m=>m.id===a.id),g=l.find(m=>m.id===a.id);if(!S||!g)return ze([a],o,r)[0];const p={...g.values},x=new Set(g.auto??[]),y=a.values,_=S.values,z=[...new Set([...Object.keys(y),...Object.keys(_)])].filter(m=>JSON.stringify(y[m])!==JSON.stringify(_[m])),D=m=>V(m).spacing==="letter";z.sort((m,L)=>Number(D(m))-Number(D(L)));for(const m of z){const{key:L,view:ae,spacing:K}=V(m),$=L,P=y[m];if(P===void 0){delete p[$],F(s,a.id)[$]!==void 0&&(c.push([a.id,$]),x.add($));continue}if(x.delete($),K==="line")p[$]=w(P/100,3);else if(K==="letter"){const W={...d.find(A=>A.id===a.id)?.values??{}};for(const A of z)y[A]===void 0&&delete W[V(A).key];const G=b({...W,...p}),J=j(G,o({...a,values:G}),ae);p[$]=J?w(P/J,4):0}else p[$]=P}return M({id:a.id,kind:a.kind,name:a.name,values:b(p)},x)});let u=t.compression;if(c.some(([a,S])=>(S==="lineHeight"||S==="letterSpacing")&&ie.includes(a))&&E(u)!=="normal"){for(const a of ie){const S=f.find(p=>p.id===a);if(!S)continue;const g={...S.values};for(const p of["lineHeight","letterSpacing"])c.some(([x,y])=>x===a&&y===p)||g[p]===void 0&&!(S.auto??[]).includes(p)&&(g[p]=F(s,a)[p]);S.values=b(g)}u="normal"}return{saved:f,old:{...t,compression:u}}}function Me(e,t){const i={text_styles:e.saved};return e.old.compression!==t.compression&&(i.heading_compression=E(e.old.compression)),i}const w=(e,t)=>Number(e.toFixed(t)),oe=(e,t)=>T.indexOf(e)<T.indexOf(t)?t:e;function Re(e,t,i="desktop"){return e.map(n=>{const o={...n.values},r=t(n);for(const s of T){const l=C("lineHeight",s),d=n.values[l],c=n.values[C("letterSpacing",s)];delete o[l],d!==void 0&&(o[k("lineSpacing",s)]=w(d*100,1));const f=oe(s,i);c!==void 0&&(o[k("letterSpacing",s)]=w(c*j(n.values,r,f),f===s?2:4))}return{id:n.id,kind:n.kind,name:n.name,values:o}})}function ze(e,t,i="desktop"){return e.map(n=>{const o=n.values,r={...o};for(const c of T)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=t({...s,values:{...s.values}});for(const c of T){const f=o[k("lineSpacing",c)],u=o[k("letterSpacing",c)];if(typeof f=="number"&&(l[C("lineHeight",c)]=w(f/100,3)),typeof u=="number"){const h=j(s.values,d,oe(c,i));l[C("letterSpacing",c)]=h?w(u/h,4):0}}return{...s,values:b(l)}})}function Fe(e){const t={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:Q({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:E(e.heading_compression),typography:be(e)},i=e.text_styles??null,n=Array.isArray(i)?se(R(i,t),t):t;return{fonts:U(n.fonts),sizes:Q(n.sizes),compression:E(n.compression),typography:n.typography,textStyles:i}}function se(e,t){const i=h=>e.find(a=>a.id===h)?.values??{},n=i("heading-1"),o=i("heading-2"),r=i("heading-3"),s=i("body-1"),l=i("body-5"),d=t.fonts,c=t.sizes,f=t.typography,u=h=>h==="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:t.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 De(e){const t=I(e.textStyles);if(!t||t.every(o=>Object.keys(o.values).length===0&&!o.auto))return e;const i={fonts:e.fonts??{},sizes:e.sizes??{},compression:String(e.headingCompression??"normal"),typography:e.headingTypography??{}},n=se(R(t,i),i);return{...e,fonts:n.fonts,sizes:n.sizes,headingCompression:n.compression,headingTypography:n.typography}}function ve(e){return e==="accent"?"var(--accent)":e==="text"?"var(--fg)":e==="labels"?"var(--fg-dim)":pe(e)===e.toLowerCase()?e:null}function Ke(e){const t=[];for(const i of e){const n=i.values,o=`.${q(i)}`,r=`[${me}="${i.id}"]`,s=`${o}, ${r}`,l=[],d=n.font!==void 0?fe.find(h=>h.key===n.font)?.cssVar:void 0;if(d&&l.push(`font-family: var(${d})`),n.size!==void 0){const h=n.largestSize!==void 0?Math.min(n.size,n.largestSize):n.size;l.push(`font-size: ${h}px`)}const c=n.color!==void 0?ve(n.color):null;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`),i.kind==="body"&&l.push(...f);const u=re(n.letterCase);u&&i.kind==="body"&&l.push(`text-transform: ${u}`),n.paragraphSpacing&&l.push(`--sf-part-para: ${n.paragraphSpacing}px`),l.length&&t.push(`${s} { ${l.join("; ")} }`),i.kind==="heading"&&f.length&&t.push(`${s}, ${o}:is(h1, h2, h3, h4), ${r}:is(h1, h2, h3, h4) { ${f.join("; ")} }`),i.kind==="heading"&&u&&t.push(`${r}, ${o}:is(h1, h2, h3, h4) { text-transform: ${u} }`),n.paragraphSpacing&&(t.push(`*:has(> ${r}) { --sf-part-para: ${n.paragraphSpacing}px }`),t.push(...Z(`:is(${s})`,`*:has(> ${r})`))),t.push(...$e(i,s,o,r))}return t.join(`
2
- `)}function $e(e,t,i,n){const o=e.values,r=H("textSize",o.size,o.sizeTablet,o.sizePhone),s=H("textSize",o.largestSize,o.largestSizeTablet,o.largestSizePhone),l=H("same",o.lineHeight,o.lineHeightTablet,o.lineHeightPhone),d=H("same",o.letterSpacing,o.letterSpacingTablet,o.letterSpacingPhone),c=H("spacing",o.paragraphSpacing,o.paragraphSpacingTablet,o.paragraphSpacingPhone),f=B("textSize",o.size,o.sizeTablet,o.sizePhone,X()),u=_e[e.id],h=[];for(const[a,S]of[["tablet",ge],["phone",ue]]){const g=[],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&&g.push(`${t} { ${p.join("; ")} }`),e.kind==="heading"&&z.length&&g.push(`${t}, ${i}:is(h1, h2, h3, h4), ${n}:is(h1, h2, h3, h4) { ${z.join("; ")} }`),c[a]!==void 0&&g.push(`*:has(> ${n}) { --sf-part-para: ${c[a]}px }`),c[a]!==void 0&&!o.paragraphSpacing&&g.push(...Z(`:is(${t})`,`*:has(> ${n})`)),_!==void 0&&u&&g.push(`.sf-themed-content { --size-${u}: ${_}px !important }`),g.length&&h.push(`@media ${S} { ${g.join(" ")} }`)}return h}const _e={"heading-1":"headingLarge","heading-2":"headingMedium","heading-3":"headingSmall","body-1":"body","body-5":"label"};function We(e){return e!==!0&&e!==!1?"":`em.text-accent { font-style: ${e?"italic":"normal"} }`}function Ge(e){return e?he[e]:void 0}function ke(e){const t=Se(e);return b({font:e.font,color:e.color,size:e.size,weight:e.weight,italic:e.italic,lineHeight:t.lineHeight,letterSpacing:t.letterSpacingEm,paragraphSpacing:e.paragraphSpacing,letterCase:e.case})}function Je(e){return Object.keys(ke(e)).length>0}function Ye({saved:e,old:t,styleId:i,values:n}){const o=te(e);return{saved:Te(o,i,n),old:t}}function Te(e,t,i){return e.map(n=>n.id===t?M({...n,values:b({...n.values,...i})},n.auto):n)}function Be(e){const t=e.filter(i=>i.kind==="body").map(i=>Number(/^body-(\d+)$/.exec(i.id)?.[1])).filter(i=>Number.isInteger(i)&&i>0);return t.length?`body-${Math.max(...t)}`:"body-1"}export{We as accentItalicCss,Ve as applyListChange,Be as eyebrowStyleId,q as faceClassOf,ze as fromPanelStyles,Je as hasStyleChange,Me as listChangePatch,te as listToWrite,ke as partStyleToTextStyleValues,Ye as pushIntoStyle,R as resolveTextStyles,Te as setStyleValues,Fe as siteTextFromRow,je as storedTextStyles,Ge as styleIdOfRole,Ke as textStylesCss,ne as textStylesFromOld,se as textStylesToOld,De as themeWithTextStyles,Re as toPanelStyles,j as viewSizeOf};
1
+ import{defaultTextStyles as Y,textStyleCaseCss as re,textStyleViewKey as le}from"efficient-easel/text-styles/model";import{phoneKey as ce,resolveViewValue as B,tabletKey as de}from"efficient-easel/draw";import{FONT_OPTIONS as pe,normalizeFonts as U}from"../../../format/lib/fonts.js";import{PHONE_MEDIA as fe,TABLET_MEDIA as ue,viewOverrides as H,viewRules as X}from"../content/view-values.js";import{STYLE_ID_OF_ROLE as ge,TEXT_STYLE_ATTR as he,paragraphRules as Z,partSpacingOf as me}from"../document/part-styles.js";import{faceClassOf as q}from"../../../format/lib/text-style-face.js";import{partColourName as Se,partInkCss as ye}from"../../../format/lib/document/part-inks.js";import{compressionMetrics as be,headingTypographyFromRow as xe,normalizeHeadingCompression as A,normalizeSizes as Q}from"../../../format/lib/theme.js";import{finiteNumber as v}from"../../../format/lib/finite-number.js";import{nonEmptyString as O}from"../../../format/lib/non-empty-string.js";const L=e=>e==="sentence"?"none":void 0,ee=["font","color","size","sizeTablet","sizePhone","weight","italic","lineHeight","lineHeightTablet","lineHeightPhone","letterSpacing","letterSpacingTablet","letterSpacingPhone","paragraphSpacing","paragraphSpacingTablet","paragraphSpacingPhone","letterCase","largestSize","largestSizeTablet","largestSizePhone"],T=["desktop","tablet","phone"],C=(e,t)=>t==="desktop"?e:t==="tablet"?de(e):ce(e),k=(e,t)=>t==="desktop"?e:le(e,t);function j(e,t,i,n=X()){return B("textSize",t,e.sizeTablet,e.sizePhone,n)[i]}const ze=[["lineSpacing","lineHeight","line"],["letterSpacing","letterSpacing","letter"]];function M(e){for(const[t,i,n]of ze)for(const o of T)if(e===k(t,o))return{key:C(i,o),view:o,spacing:n};return{key:e,view:"desktop",spacing:null}}function b(e){const t={};for(const i of ee)e[i]!==void 0&&(t[i]=e[i]);return t}function R(e,t){const{auto:i,...n}=e,o=new Set(t??[]),r=ee.filter(s=>o.has(s)&&e.values[s]===void 0);return r.length?{...n,auto:r}:n}function ne(e){const t=e.fonts,i=e.sizes,n=e.typography,o=be(e.compression),r={"heading-1":{font:O(t.heading),size:v(i.headingLarge),weight:v(n.weight),lineHeight:o.lineHeight,letterSpacing:o.letterSpacing,letterCase:L(n.case),largestSize:v(n.maxPx)},"heading-2":{font:O(t.heading2),size:v(i.headingMedium),weight:v(n.weight2),lineHeight:o.lineHeight,letterSpacing:o.letterSpacing,letterCase:L(n.case2)},"heading-3":{font:O(t.heading3),size:v(i.headingSmall),weight:v(n.weight3),lineHeight:o.lineHeight,letterSpacing:o.letterSpacing,letterCase:L(n.case3)},"body-1":{font:O(t.body),size:v(i.body)},"body-5":{font:O(t.label),size:v(i.label)}};return Y().map(({id:s,kind:l,name:d})=>({id:s,kind:l,name:d,values:b(r[s]??{})}))}function E(e){return Array.isArray(e)&&e.every(i=>i&&typeof i=="object"&&typeof i.id=="string"&&(i.kind==="heading"||i.kind==="body")&&typeof i.name=="string")?e.map(i=>R({...i,values:b(i.values??{})},Array.isArray(i.auto)?i.auto:void 0)):null}function je(e){return E(e)??[]}function te(e){return E(e)??Y().map(({id:t,kind:i,name:n})=>({id:t,kind:i,name:n,values:{}}))}function V(e,t){const i=ne(t),n=E(e);return n?n.map(o=>{const r={...F(i,o.id)};for(const s of o.auto??[])delete r[s];return{...o,values:b({...r,...o.values})}}):i}const F=(e,t)=>e.find(i=>i.id===t)?.values??{},ie=["heading-1","heading-2","heading-3"];function Me({saved:e,old:t,cur:i,next:n,sizeOf:o,panelView:r="desktop"}){const s=ne(t),l=te(e),d=V(l,t),c=[],f=n.map(a=>{const S=i.find(m=>m.id===a.id),g=l.find(m=>m.id===a.id);if(!S||!g)return ve([a],o,r)[0];const p={...g.values},x=new Set(g.auto??[]),y=a.values,_=S.values,z=[...new Set([...Object.keys(y),...Object.keys(_)])].filter(m=>JSON.stringify(y[m])!==JSON.stringify(_[m])),D=m=>M(m).spacing==="letter";z.sort((m,N)=>Number(D(m))-Number(D(N)));for(const m of z){const{key:N,view:ae,spacing:K}=M(m),$=N,P=y[m];if(P===void 0){delete p[$],F(s,a.id)[$]!==void 0&&(c.push([a.id,$]),x.add($));continue}if(x.delete($),K==="line")p[$]=w(P/100,3);else if(K==="letter"){const W={...d.find(I=>I.id===a.id)?.values??{}};for(const I of z)y[I]===void 0&&delete W[M(I).key];const G=b({...W,...p}),J=j(G,o({...a,values:G}),ae);p[$]=J?w(P/J,4):0}else p[$]=P}return R({id:a.id,kind:a.kind,name:a.name,values:b(p)},x)});let u=t.compression;if(c.some(([a,S])=>(S==="lineHeight"||S==="letterSpacing")&&ie.includes(a))&&A(u)!=="normal"){for(const a of ie){const S=f.find(p=>p.id===a);if(!S)continue;const g={...S.values};for(const p of["lineHeight","letterSpacing"])c.some(([x,y])=>x===a&&y===p)||g[p]===void 0&&!(S.auto??[]).includes(p)&&(g[p]=F(s,a)[p]);S.values=b(g)}u="normal"}return{saved:f,old:{...t,compression:u}}}function Re(e,t){const i={text_styles:e.saved};return e.old.compression!==t.compression&&(i.heading_compression=A(e.old.compression)),i}const w=(e,t)=>Number(e.toFixed(t)),oe=(e,t)=>T.indexOf(e)<T.indexOf(t)?t:e;function Ve(e,t,i="desktop"){return e.map(n=>{const o={...n.values},r=t(n);for(const s of T){const l=C("lineHeight",s),d=n.values[l],c=n.values[C("letterSpacing",s)];delete o[l],d!==void 0&&(o[k("lineSpacing",s)]=w(d*100,1));const f=oe(s,i);c!==void 0&&(o[k("letterSpacing",s)]=w(c*j(n.values,r,f),f===s?2:4))}return typeof n.values.color=="string"&&(o.color=Se(n.values.color)),{id:n.id,kind:n.kind,name:n.name,values:o}})}function ve(e,t,i="desktop"){return e.map(n=>{const o=n.values,r={...o};for(const c of T)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=t({...s,values:{...s.values}});for(const c of T){const f=o[k("lineSpacing",c)],u=o[k("letterSpacing",c)];if(typeof f=="number"&&(l[C("lineHeight",c)]=w(f/100,3)),typeof u=="number"){const h=j(s.values,d,oe(c,i));l[C("letterSpacing",c)]=h?w(u/h,4):0}}return{...s,values:b(l)}})}function Fe(e){const t={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:Q({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:A(e.heading_compression),typography:xe(e)},i=e.text_styles??null,n=Array.isArray(i)?se(V(i,t),t):t;return{fonts:U(n.fonts),sizes:Q(n.sizes),compression:A(n.compression),typography:n.typography,textStyles:i}}function se(e,t){const i=h=>e.find(a=>a.id===h)?.values??{},n=i("heading-1"),o=i("heading-2"),r=i("heading-3"),s=i("body-1"),l=i("body-5"),d=t.fonts,c=t.sizes,f=t.typography,u=h=>h==="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:t.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 De(e){const t=E(e.textStyles);if(!t||t.every(o=>Object.keys(o.values).length===0&&!o.auto))return e;const i={fonts:e.fonts??{},sizes:e.sizes??{},compression:String(e.headingCompression??"normal"),typography:e.headingTypography??{}},n=se(V(t,i),i);return{...e,fonts:n.fonts,sizes:n.sizes,headingCompression:n.compression,headingTypography:n.typography}}function Ke(e){const t=[];for(const i of e){const n=i.values,o=`.${q(i)}`,r=`[${he}="${i.id}"]`,s=`${o}, ${r}`,l=[],d=n.font!==void 0?pe.find(h=>h.key===n.font)?.cssVar:void 0;if(d&&l.push(`font-family: var(${d})`),n.size!==void 0){const h=n.largestSize!==void 0?Math.min(n.size,n.largestSize):n.size;l.push(`font-size: ${h}px`)}const c=ye(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`),i.kind==="body"&&l.push(...f);const u=re(n.letterCase);u&&i.kind==="body"&&l.push(`text-transform: ${u}`),n.paragraphSpacing&&l.push(`--sf-part-para: ${n.paragraphSpacing}px`),l.length&&t.push(`${s} { ${l.join("; ")} }`),i.kind==="heading"&&f.length&&t.push(`${s}, ${o}:is(h1, h2, h3, h4), ${r}:is(h1, h2, h3, h4) { ${f.join("; ")} }`),i.kind==="heading"&&u&&t.push(`${r}, ${o}:is(h1, h2, h3, h4) { text-transform: ${u} }`),n.paragraphSpacing&&(t.push(`*:has(> ${r}) { --sf-part-para: ${n.paragraphSpacing}px }`),t.push(...Z(`:is(${s})`,`*:has(> ${r})`))),t.push(...$e(i,s,o,r))}return t.join(`
2
+ `)}function $e(e,t,i,n){const o=e.values,r=H("textSize",o.size,o.sizeTablet,o.sizePhone),s=H("textSize",o.largestSize,o.largestSizeTablet,o.largestSizePhone),l=H("same",o.lineHeight,o.lineHeightTablet,o.lineHeightPhone),d=H("same",o.letterSpacing,o.letterSpacingTablet,o.letterSpacingPhone),c=H("spacing",o.paragraphSpacing,o.paragraphSpacingTablet,o.paragraphSpacingPhone),f=B("textSize",o.size,o.sizeTablet,o.sizePhone,X()),u=_e[e.id],h=[];for(const[a,S]of[["tablet",ue],["phone",fe]]){const g=[],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&&g.push(`${t} { ${p.join("; ")} }`),e.kind==="heading"&&z.length&&g.push(`${t}, ${i}:is(h1, h2, h3, h4), ${n}:is(h1, h2, h3, h4) { ${z.join("; ")} }`),c[a]!==void 0&&g.push(`*:has(> ${n}) { --sf-part-para: ${c[a]}px }`),c[a]!==void 0&&!o.paragraphSpacing&&g.push(...Z(`:is(${t})`,`*:has(> ${n})`)),_!==void 0&&u&&g.push(`.sf-themed-content { --size-${u}: ${_}px !important }`),g.length&&h.push(`@media ${S} { ${g.join(" ")} }`)}return h}const _e={"heading-1":"headingLarge","heading-2":"headingMedium","heading-3":"headingSmall","body-1":"body","body-5":"label"};function We(e){return e!==!0&&e!==!1?"":`em.text-accent { font-style: ${e?"italic":"normal"} }`}function Ge(e){return e?ge[e]:void 0}function ke(e){const t=me(e);return b({font:e.font,color:e.color,size:e.size,weight:e.weight,italic:e.italic,lineHeight:t.lineHeight,letterSpacing:t.letterSpacingEm,paragraphSpacing:e.paragraphSpacing,letterCase:e.case})}function Je(e){return Object.keys(ke(e)).length>0}function Ye({saved:e,old:t,styleId:i,values:n}){const o=te(e);return{saved:Te(o,i,n),old:t}}function Te(e,t,i){return e.map(n=>n.id===t?R({...n,values:b({...n.values,...i})},n.auto):n)}function Be(e){const t=e.filter(i=>i.kind==="body").map(i=>Number(/^body-(\d+)$/.exec(i.id)?.[1])).filter(i=>Number.isInteger(i)&&i>0);return t.length?`body-${Math.max(...t)}`:"body-1"}export{We as accentItalicCss,Me as applyListChange,Be as eyebrowStyleId,q as faceClassOf,ve as fromPanelStyles,Je as hasStyleChange,Re as listChangePatch,te as listToWrite,ke as partStyleToTextStyleValues,Ye as pushIntoStyle,V as resolveTextStyles,Te as setStyleValues,Fe as siteTextFromRow,je as storedTextStyles,Ge as styleIdOfRole,Ke as textStylesCss,ne as textStylesFromOld,se as textStylesToOld,De as themeWithTextStyles,Ve as toPanelStyles,j as viewSizeOf};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "efficient-web-builder",
3
- "version": "51.0.0",
3
+ "version": "52.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",
@@ -1,7 +0,0 @@
1
- import type { PartInk } from "../../format/lib/document/part-inks.js";
2
- export declare function PartInkControl({ value, label, colors, onChange, }: {
3
- value: string | null;
4
- label: string;
5
- colors: readonly PartInk[];
6
- onChange: (next: string | null) => void;
7
- }): import("react").JSX.Element;
@@ -1 +0,0 @@
1
- "use client";import{jsx as o,jsxs as n}from"react/jsx-runtime";import{parseHexColor as c}from"efficient-shell/format";import{ColorSwatch as f,Tooltip as k}from"efficient-shell/ui";import{say as s}from"../../format/lib/editor-words.js";import{AnyColourSwatch as u}from"../lib/document/ColourControl.js";function v({value:t,label:i,colors:p,onChange:m}){const d=t===null,a=t||void 0,r=p.find(e=>e.key===a),l=r?r.value:a&&c(a)===a.toLowerCase()?a:void 0;return n("div",{className:"sf-part-ink",children:[n("div",{className:"sf-part-ink-top",children:[o("span",{className:"sf-part-ink-label",children:s(i)}),o("span",{className:"sf-part-ink-read",children:l?l.toUpperCase():d?s("Mixed"):s("Follows the style")})]}),n("div",{className:"sf-part-ink-swatches",role:"group","aria-label":s(i),children:[p.map(e=>o(k,{content:`${s(e.name)} · ${e.value.toUpperCase()}`,children:o(f,{color:e.value,"aria-label":s(e.name),size:"sm",selected:a===e.key,onClick:()=>m(a===e.key?null:e.key)})},e.key)),u({value:r?"":(l??"").toLowerCase(),label:"Any color",onChange:m})]})]})}export{v as PartInkControl};