efficient-web-builder 17.1.1 → 18.1.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 (57) hide show
  1. package/CHANGELOG.md +78 -24
  2. package/dist/components/Banner.js +1 -1
  3. package/dist/components/FAQ.js +1 -1
  4. package/dist/components/Flex.js +1 -1
  5. package/dist/components/HeroPoster.js +1 -1
  6. package/dist/components/ImageBlock.js +1 -1
  7. package/dist/components/Logos.js +1 -1
  8. package/dist/components/PartSettingsPanel.js +1 -1
  9. package/dist/components/PaymentBadges.js +1 -1
  10. package/dist/components/Placeholder.js +1 -1
  11. package/dist/components/RMark.js +1 -1
  12. package/dist/components/SectionHeader.js +1 -1
  13. package/dist/components/SiteAccentField.d.ts +28 -0
  14. package/dist/components/SiteAccentField.js +1 -0
  15. package/dist/components/SiteTextStylesField.d.ts +17 -0
  16. package/dist/components/SiteTextStylesField.js +1 -0
  17. package/dist/components/SlotChildRows.js +1 -1
  18. package/dist/components/StorefrontEditor.js +1 -1
  19. package/dist/components/UpdateStyleDialog.d.ts +5 -0
  20. package/dist/components/UpdateStyleDialog.js +1 -0
  21. package/dist/components/WebsiteSettingsPanel.js +1 -1
  22. package/dist/components/storefront-editor.css +13 -3
  23. package/dist/lib/content/section-sticky.d.ts +34 -0
  24. package/dist/lib/content/section-sticky.js +1 -0
  25. package/dist/lib/editor-words-catalogue.d.ts +6 -28
  26. package/dist/lib/editor-words-catalogue.js +5 -5
  27. package/dist/lib/fit-words.js +6 -1
  28. package/dist/lib/puck/blocks/general/CategoryBar/fields.js +1 -1
  29. package/dist/lib/puck/blocks/general/IntroBleed/fields.js +1 -1
  30. package/dist/lib/puck/controls.d.ts +1 -0
  31. package/dist/lib/puck/controls.js +1 -1
  32. package/dist/lib/puck/field-groups.js +1 -1
  33. package/dist/lib/puck/overrides.js +1 -1
  34. package/dist/lib/puck/page-root.js +2 -1
  35. package/dist/lib/puck/part-inks.d.ts +2 -0
  36. package/dist/lib/puck/part-inks.js +1 -1
  37. package/dist/lib/puck/passes/corners.d.ts +1 -0
  38. package/dist/lib/puck/passes/corners.js +1 -1
  39. package/dist/lib/puck/passes/index.js +1 -1
  40. package/dist/lib/puck/passes/inspector.js +1 -1
  41. package/dist/lib/puck/passes/section-sticky.d.ts +3 -0
  42. package/dist/lib/puck/passes/section-sticky.js +1 -0
  43. package/dist/lib/puck/passes/types.d.ts +1 -0
  44. package/dist/lib/site-text-styles-writer.d.ts +21 -0
  45. package/dist/lib/site-text-styles-writer.js +1 -0
  46. package/dist/lib/site-text-styles.d.ts +43 -3
  47. package/dist/lib/site-text-styles.js +2 -2
  48. package/dist/lib/site-theme-row.d.ts +4 -0
  49. package/dist/lib/sized-image.d.ts +11 -0
  50. package/dist/lib/sized-image.js +1 -0
  51. package/dist/lib/source-rules/label-vocabulary.d.ts +3 -1
  52. package/dist/lib/source-rules/label-vocabulary.js +5 -4
  53. package/dist/lib/theme.d.ts +3 -0
  54. package/dist/lib/theme.js +1 -1
  55. package/package.json +5 -5
  56. package/dist/components/TextStylesField.d.ts +0 -17
  57. package/dist/components/TextStylesField.js +0 -1
@@ -1,2 +1,2 @@
1
- import{FONT_OPTIONS as S}from"./fonts.js";import{compressionMetrics as z}from"./theme.js";const h=e=>e==="sentence"?"none":void 0,d=e=>typeof e=="number"&&Number.isFinite(e)?e:void 0,g=e=>typeof e=="string"&&e?e:void 0,$=["font","color","size","weight","italic","lineHeight","letterSpacing","paragraphSpacing","letterCase","largestSize"];function c(e){const i={};for(const t of $)e[t]!==void 0&&(i[t]=e[t]);return i}function x(e){const i=e.fonts,t=e.sizes,n=e.typography,o=z(e.compression),s=(l,a)=>({id:`heading-${l}`,kind:"heading",name:`Heading ${l}`,values:c(a)}),r=(l,a={})=>({id:`body-${l}`,kind:"body",name:`Body ${l}`,values:c(a)});return[s(1,{font:g(i.heading),size:d(t.headingLarge),weight:d(n.weight),lineHeight:o.lineHeight,letterSpacing:o.letterSpacing,letterCase:h(n.case),largestSize:d(n.maxPx)}),s(2,{font:g(i.heading2),size:d(t.headingMedium),weight:d(n.weight2),lineHeight:o.lineHeight,letterSpacing:o.letterSpacing,letterCase:h(n.case2)}),s(3,{font:g(i.heading3),size:d(t.headingSmall),weight:d(n.weight3),lineHeight:o.lineHeight,letterSpacing:o.letterSpacing,letterCase:h(n.case3)}),r(1,{font:g(i.body),size:d(t.body)}),r(2),r(3),r(4),r(5,{font:g(i.label),size:d(t.label)})]}function y(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=>({...t,values:c(t.values??{})})):null}function M(e){return y(e)??[]}function w(e,i){const t=x(i),n=y(e);return n?n.map(o=>({...o,values:c({...C(t,o.id),...o.values})})):t}const C=(e,i)=>e.find(t=>t.id===i)?.values??{};function k(e,i){const t=p=>e.find(m=>m.id===p)?.values??{},n=t("heading-1"),o=t("heading-2"),s=t("heading-3"),r=t("body-1"),l=t("body-5"),a=i.fonts,f=i.sizes,b=i.typography,u=p=>p==="none"?"sentence":"authored";return{fonts:{...a,heading:n.font??a.heading,heading2:o.font??n.font??a.heading2,heading3:s.font??n.font??a.heading3,body:r.font??a.body,label:l.font??a.label},sizes:{...f,headingLarge:n.size??null,headingMedium:o.size??null,headingSmall:s.size??null,body:r.size??null,label:l.size??null},compression:i.compression,typography:{...b,case:u(n.letterCase),weight:n.weight??null,maxPx:n.largestSize??null,weight2:o.weight??null,weight3:s.weight??null,case2:u(o.letterCase),case3:u(s.letterCase)}}}function N(e){const i=y(e.textStyles);if(!i||i.every(o=>Object.keys(o.values).length===0))return e;const t={fonts:e.fonts??{},sizes:e.sizes??{},compression:String(e.headingCompression??"normal"),typography:e.headingTypography??{}},n=k(w(i,t),t);return{...e,fonts:n.fonts,sizes:n.sizes,headingCompression:n.compression,headingTypography:n.typography}}function v(e){switch(e.id){case"heading-1":return"font-display";case"heading-2":return"font-heading2";case"heading-3":return"font-heading3";case"body-1":return"font-body";case"body-5":return"font-mono";default:return`font-${e.id}`}}function H(e){return e==="accent"?"var(--accent)":e==="text"?"var(--fg)":e==="labels"?"var(--fg-dim)":/^#[0-9a-f]{6}$/i.test(e)?e:null}function O(e){const i=":is([data-sf-bullet], [data-sf-number])";return[`${e} br:not(br + br) { display: block; content: ""; margin-top: var(--sf-part-para) }`,`${e} ${i}:not(:first-child) { margin-top: var(--sf-part-para) }`,`${e} ${i}:not(:last-child) { margin-bottom: var(--sf-part-para) }`]}function F(e){const i=[];for(const t of e){const n=t.values,o=`.${v(t)}`,s=[],r=n.font!==void 0?S.find(f=>f.key===n.font)?.cssVar:void 0;if(r&&s.push(`font-family: var(${r})`),n.size!==void 0){const f=n.largestSize!==void 0?Math.min(n.size,n.largestSize):n.size;s.push(`font-size: ${f}px`)}const l=n.color!==void 0?H(n.color):null;l&&s.push(`color: ${l}`),n.italic===!0&&s.push("font-style: italic"),n.weight!==void 0&&s.push(`font-weight: ${n.weight}`);const a=[];n.lineHeight!==void 0&&a.push(`line-height: ${n.lineHeight}`),n.letterSpacing!==void 0&&a.push(`letter-spacing: ${n.letterSpacing}em`),t.kind==="body"&&s.push(...a),n.letterCase!==void 0&&s.push(`text-transform: ${n.letterCase==="upper"?"uppercase":n.letterCase==="lower"?"lowercase":"none"}`),n.paragraphSpacing&&s.push(`--sf-part-para: ${n.paragraphSpacing}px`),s.length&&i.push(`${o} { ${s.join("; ")} }`),t.kind==="heading"&&a.length&&i.push(`${o}, ${o}:is(h1, h2, h3, h4) { ${a.join("; ")} }`),n.paragraphSpacing&&i.push(...O(o))}return i.join(`
2
- `)}function L(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{L as eyebrowStyleId,v as faceClassOf,w as resolveTextStyles,M as storedTextStyles,F as textStylesCss,x as textStylesFromOld,k as textStylesToOld,N as themeWithTextStyles};
1
+ import{FONT_OPTIONS as D,normalizeFonts as I}from"./fonts.js";import{partSpacingOf as J}from"./puck/part-styles.js";import{compressionMetrics as B,headingTypographyFromRow as G,normalizeHeadingCompression as C,normalizeSizes as L}from"./theme.js";const H=e=>e==="sentence"?"none":void 0,p=e=>typeof e=="number"&&Number.isFinite(e)?e:void 0,z=e=>typeof e=="string"&&e?e:void 0,M=["font","color","size","weight","italic","lineHeight","letterSpacing","paragraphSpacing","letterCase","largestSize"];function g(e){const i={};for(const n of M)e[n]!==void 0&&(i[n]=e[n]);return i}function w(e,i){const{auto:n,...t}=e,a=new Set(i??[]),s=M.filter(o=>a.has(o)&&e.values[o]===void 0);return s.length?{...t,auto:s}:t}function O(e){const i=e.fonts,n=e.sizes,t=e.typography,a=B(e.compression),s=(l,r)=>({id:`heading-${l}`,kind:"heading",name:`Heading ${l}`,values:g(r)}),o=(l,r={})=>({id:`body-${l}`,kind:"body",name:`Body ${l}`,values:g(r)});return[s(1,{font:z(i.heading),size:p(n.headingLarge),weight:p(t.weight),lineHeight:a.lineHeight,letterSpacing:a.letterSpacing,letterCase:H(t.case),largestSize:p(t.maxPx)}),s(2,{font:z(i.heading2),size:p(n.headingMedium),weight:p(t.weight2),lineHeight:a.lineHeight,letterSpacing:a.letterSpacing,letterCase:H(t.case2)}),s(3,{font:z(i.heading3),size:p(n.headingSmall),weight:p(t.weight3),lineHeight:a.lineHeight,letterSpacing:a.letterSpacing,letterCase:H(t.case3)}),o(1,{font:z(i.body),size:p(n.body)}),o(2),o(3),o(4),o(5,{font:z(i.label),size:p(n.label)})]}function _(e){return Array.isArray(e)&&e.every(n=>n&&typeof n=="object"&&typeof n.id=="string"&&(n.kind==="heading"||n.kind==="body")&&typeof n.name=="string")?e.map(n=>w({...n,values:g(n.values??{})},Array.isArray(n.auto)?n.auto:void 0)):null}function ne(e){return _(e)??[]}function T(e,i){const n=O(i),t=_(e);return t?t.map(a=>{const s={...N(n,a.id)};for(const o of a.auto??[])delete s[o];return{...a,values:g({...s,...a.values})}}):n}const N=(e,i)=>e.find(n=>n.id===i)?.values??{},P=["heading-1","heading-2","heading-3"];function te({saved:e,old:i,cur:n,next:t,sizeOf:a}){const s=O(i),o=_(e)??s.map(d=>({...d,values:{}})),l=T(o,i),r=[],h=t.map(d=>{const f=n.find(u=>u.id===d.id),m=o.find(u=>u.id===d.id);if(!f||!m)return U([d],a)[0];const c={...m.values},x=new Set(m.auto??[]),v=d.values,A=f.values,j=[...new Set([...Object.keys(v),...Object.keys(A)])].filter(u=>JSON.stringify(v[u])!==JSON.stringify(A[u]));j.sort((u,y)=>+(u==="letterSpacing")-+(y==="letterSpacing"));for(const u of j){const y=u==="lineSpacing"?"lineHeight":u,k=v[u];if(k===void 0){delete c[y],N(s,d.id)[y]!==void 0&&(r.push([d.id,y]),x.add(y));continue}if(x.delete(y),u==="lineSpacing")c.lineHeight=S(k/100,3);else if(u==="letterSpacing"){const E=l.find(V=>V.id===d.id),F=a({...d,values:g({...E?.values??{},...c})});c.letterSpacing=F?S(k/F,4):0}else c[y]=k}return w({id:d.id,kind:d.kind,name:d.name,values:g(c)},x)});let b=i.compression;if(r.some(([d,f])=>(f==="lineHeight"||f==="letterSpacing")&&P.includes(d))&&C(b)!=="normal"){for(const d of P){const f=h.find(c=>c.id===d);if(!f)continue;const m={...f.values};for(const c of["lineHeight","letterSpacing"])r.some(([x,v])=>x===d&&v===c)||m[c]===void 0&&!(f.auto??[]).includes(c)&&(m[c]=N(s,d)[c]);f.values=g(m)}b="normal"}return{saved:h,old:{...i,compression:b}}}function ie(e,i){const n={text_styles:e.saved};return e.old.compression!==i.compression&&(n.heading_compression=C(e.old.compression)),n}const S=(e,i)=>Number(e.toFixed(i));function ae(e,i){return e.map(n=>{const{lineHeight:t,letterSpacing:a,...s}=n.values,o={...s};return t!==void 0&&(o.lineSpacing=S(t*100,1)),a!==void 0&&(o.letterSpacing=S(a*i(n),2)),{id:n.id,kind:n.kind,name:n.name,values:o}})}function U(e,i){return e.map(n=>{const{lineSpacing:t,letterSpacing:a,...s}=n.values,o={id:n.id,kind:n.kind,name:n.name,values:g({...s})},l={...o.values};if(t!==void 0&&(l.lineHeight=S(t/100,3)),a!==void 0){const r=i({...o,values:{...o.values}});l.letterSpacing=r?S(a/r,4):0}return{...o,values:g(l)}})}function oe(e){const i={fonts:I({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:L({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:C(e.heading_compression),typography:G(e)},n=e.text_styles??null,t=Array.isArray(n)?R(T(n,i),i):i;return{fonts:I(t.fonts),sizes:L(t.sizes),compression:C(t.compression),typography:t.typography,textStyles:n}}function R(e,i){const n=d=>e.find(f=>f.id===d)?.values??{},t=n("heading-1"),a=n("heading-2"),s=n("heading-3"),o=n("body-1"),l=n("body-5"),r=i.fonts,h=i.sizes,b=i.typography,$=d=>d==="none"?"sentence":"authored";return{fonts:{...r,heading:t.font??r.heading,heading2:a.font??t.font??r.heading2,heading3:s.font??t.font??r.heading3,body:o.font??r.body,label:l.font??r.label},sizes:{...h,headingLarge:t.size??null,headingMedium:a.size??null,headingSmall:s.size??null,body:o.size??null,label:l.size??null},compression:i.compression,typography:{...b,case:$(t.letterCase),weight:t.weight??null,maxPx:t.largestSize??null,weight2:a.weight??null,weight3:s.weight??null,case2:$(a.letterCase),case3:$(s.letterCase)}}}function se(e){const i=_(e.textStyles);if(!i||i.every(a=>Object.keys(a.values).length===0&&!a.auto))return e;const n={fonts:e.fonts??{},sizes:e.sizes??{},compression:String(e.headingCompression??"normal"),typography:e.headingTypography??{}},t=R(T(i,n),n);return{...e,fonts:t.fonts,sizes:t.sizes,headingCompression:t.compression,headingTypography:t.typography}}function W(e){switch(e.id){case"heading-1":return"font-display";case"heading-2":return"font-heading2";case"heading-3":return"font-heading3";case"body-1":return"font-body";case"body-5":return"font-mono";default:return`font-${e.id}`}}const q={none:"none",upper:"uppercase",capitalize:"capitalize",lower:"lowercase"};function K(e){return e==="accent"?"var(--accent)":e==="text"?"var(--fg)":e==="labels"?"var(--fg-dim)":/^#[0-9a-f]{6}$/i.test(e)?e:null}function Q(e){const i=":is([data-sf-bullet], [data-sf-number])";return[`${e} br:not(br + br) { display: block; content: ""; margin-top: var(--sf-part-para) }`,`${e} ${i}:not(:first-child) { margin-top: var(--sf-part-para) }`,`${e} ${i}:not(:last-child) { margin-bottom: var(--sf-part-para) }`]}function re(e){const i=[];for(const n of e){const t=n.values,a=`.${W(n)}`,s=[],o=t.font!==void 0?D.find(h=>h.key===t.font)?.cssVar:void 0;if(o&&s.push(`font-family: var(${o})`),t.size!==void 0){const h=t.largestSize!==void 0?Math.min(t.size,t.largestSize):t.size;s.push(`font-size: ${h}px`)}const l=t.color!==void 0?K(t.color):null;l&&s.push(`color: ${l}`),t.italic===!0&&s.push("font-style: italic"),t.weight!==void 0&&s.push(`font-weight: ${t.weight}`);const r=[];t.lineHeight!==void 0&&r.push(`line-height: ${t.lineHeight}`),t.letterSpacing!==void 0&&r.push(`letter-spacing: ${t.letterSpacing}em`),n.kind==="body"&&s.push(...r),t.letterCase!==void 0&&s.push(`text-transform: ${q[t.letterCase]}`),t.paragraphSpacing&&s.push(`--sf-part-para: ${t.paragraphSpacing}px`),s.length&&i.push(`${a} { ${s.join("; ")} }`),n.kind==="heading"&&r.length&&i.push(`${a}, ${a}:is(h1, h2, h3, h4) { ${r.join("; ")} }`),t.paragraphSpacing&&i.push(...Q(a))}return i.join(`
2
+ `)}function de(e){return e!==!0&&e!==!1?"":`em.text-accent { font-style: ${e?"italic":"normal"} }`}function le(e){switch(e){case"heading":return"heading-1";case"heading2":return"heading-2";case"heading3":return"heading-3";case"body":return"body-1";case"label":return"body-5";default:return}}function X(e){const i=J(e);return g({font:e.font,color:e.color,size:e.size,weight:e.weight,italic:e.italic,lineHeight:i.lineHeight,letterSpacing:i.letterSpacingEm,paragraphSpacing:e.paragraphSpacing,letterCase:e.case})}function ce(e){return Object.keys(X(e)).length>0}function ue({saved:e,old:i,styleId:n,values:t}){return{saved:(_(e)??O(i).map(o=>({...o,values:{}}))).map(o=>o.id===n?w({...o,values:g({...o.values,...t})},o.auto):o),old:i}}function fe(e){const i=e.filter(n=>n.kind==="body").map(n=>Number(/^body-(\d+)$/.exec(n.id)?.[1])).filter(n=>Number.isInteger(n)&&n>0);return i.length?`body-${Math.max(...i)}`:"body-1"}export{de as accentItalicCss,te as applyListChange,fe as eyebrowStyleId,W as faceClassOf,U as fromPanelStyles,ce as hasStyleChange,ie as listChangePatch,X as partStyleToTextStyleValues,ue as pushIntoStyle,T as resolveTextStyles,oe as siteTextFromRow,ne as storedTextStyles,le as styleIdOfRole,re as textStylesCss,O as textStylesFromOld,R as textStylesToOld,se as themeWithTextStyles,ae as toPanelStyles};
@@ -13,6 +13,8 @@ export interface SiteThemeRow {
13
13
  }[];
14
14
  accent_color?: string | null;
15
15
  heading_font: string;
16
+ heading_2_font?: string | null;
17
+ heading_3_font?: string | null;
16
18
  body_font: string;
17
19
  accent_font: string;
18
20
  label_font: string;
@@ -37,6 +39,7 @@ export interface SiteThemeRow {
37
39
  heading_case?: "authored" | "sentence" | null;
38
40
  heading_weight?: number | null;
39
41
  heading_weight_strong?: number | null;
42
+ accent_italic?: boolean | null;
40
43
  heading_2_weight?: number | null;
41
44
  heading_3_weight?: number | null;
42
45
  heading_2_case?: "authored" | "sentence" | null;
@@ -53,6 +56,7 @@ export interface SiteThemeRow {
53
56
  kind: "heading" | "body";
54
57
  name: string;
55
58
  values: Record<string, unknown>;
59
+ auto?: string[];
56
60
  }[] | null;
57
61
  }
58
62
  export type SiteThemeRowPatch = Partial<Omit<SiteThemeRow, "id">>;
@@ -0,0 +1,11 @@
1
+ export declare function __setImageCopiesHostForTests(host: string | null | undefined): void;
2
+ export interface SizedImage {
3
+ src: string;
4
+ srcSet?: string;
5
+ }
6
+ export declare const CONTENT_SIZES = "(max-width: 800px) 100vw, min(100vw, 1600px)";
7
+ export declare function sizedImage(src: string, { fallbackWidth, maxWidth }?: {
8
+ fallbackWidth?: number;
9
+ maxWidth?: number;
10
+ }): SizedImage;
11
+ export declare function sizedBackground(src: string): string;
@@ -0,0 +1 @@
1
+ import{imageCopyUrl as s,imageSrcSet as u}from"efficient-shell/image-copies";let o;function c(t){o=t}function n(){return o===void 0?{}:{host:o}}const f="(max-width: 800px) 100vw, min(100vw, 1600px)";function d(t,{fallbackWidth:e=1280,maxWidth:r}={}){const i=u(t,{...n(),...r===void 0?{}:{maxWidth:r}});return i?{src:s(t,e,n()),srcSet:i}:{src:t}}function m(t){const e=s(t,1920,n());return e===t?`url(${t})`:`url("${e}")`}export{f as CONTENT_SIZES,c as __setImageCopiesHostForTests,m as sizedBackground,d as sizedImage};
@@ -10,5 +10,7 @@ export type LabelVocabularyOptions = {
10
10
  readonly minRegistryLabels: number;
11
11
  readonly parked: readonly ParkedLabel[];
12
12
  };
13
- export declare function vocabularyBreaches(label: string, item: boolean): string[];
13
+ export type LabelLevel = "section" | "item" | "slot child";
14
+ export declare function slotChildTypes(files: readonly SourceFile[]): Set<string>;
15
+ export declare function vocabularyBreaches(label: string, level: LabelLevel): string[];
14
16
  export declare function labelVocabulary(files: readonly SourceFile[], options: LabelVocabularyOptions): RuleReport;
@@ -1,5 +1,6 @@
1
- import{failedChecks as $,ruleChecks as x}from"./rule.js";import{isPanelFile as v,readLabels as w,readPanelLabels as C}from"./support/label-extraction.js";import{registryFiles as T}from"./support/registry-source.js";const p=["kicker","tagline","headline","blurb","description","copy","paragraph","photo","picture","cta","kind","class","grayscale","greyscale","colour","align","align items","text alignment","centre","catalogue","behaviour","labelled","stylised","stack","container","gutter","margin","site width","max width","contained","boxed","header offset","clearance","typeface","font family","leading","character spacing","kerning","text transform"],j=a=>a.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),R=p.map(a=>({word:a,pattern:new RegExp(`\\b${j(a)}s?\\b`)}));function H(a){return a.split(/\(| — /)[0].trim()}function k(a,c){const t=H(a).toLowerCase(),o=[];for(const{word:d,pattern:l}of R)l.test(t)&&o.push(`N10.1 "${d}"`);/^title\b/.test(t)&&!c&&o.push("N10.2 Title at section level"),/^heading\b/.test(t)&&c&&o.push("N10.2 Heading at item level");const e=/\b(button|link)\s+(text|label|href|url)$/.exec(t);return e&&o.push(`N10.3 "${e[1]} ${e[2]}"`),t==="text"&&o.push("N10.4 bare Text"),o}function N(a,c,t){const o=T(a),e=a.filter(v),d=new Map,l=[],h=(n,s)=>{for(const f of n){const y=s(f.text);d.set(f.path,y.length);for(const m of y)l.push({...m,file:f.path,why:k(m.label,m.item)})}};h(o,w),h(e,C);for(const[n,s]of Object.entries(c.floors)){const f=d.get(n);t(`${n} yields >= ${s} labels (found ${f??"none: not read"})`,f!==void 0&&f>=s,f===void 0?"it has a floor but was not read — it dropped out of the panels and the registry":"the reader is broken, not the panel")}const r=o.reduce((n,s)=>n+(d.get(s.path)??0),0);t(`the block registry yields >= ${c.minRegistryLabels} labels across ${o.length} files (found ${r})`,r>=c.minRegistryLabels,"the reader is broken, not the panel");const g=l.filter(n=>n.why.length>0),u=n=>c.parked.some(s=>s.file===n.file&&s.label===n.label),i=g.filter(n=>!u(n)),b=l.filter(n=>n.item).length;t(`every field label obeys N10.1–N10.4 (${l.length} read across ${o.length+e.length} files: ${l.length-b} section-level, ${b} item-level)`,i.length===0,`${i.length} break doc/naming.md N10:
2
- `+i.map(n=>` ${n.file}:${n.line} ${n.item?"[item] ":"[section]"} ${JSON.stringify(n.label)} — ${n.why.join(", ")}`).join(`
3
- `));for(const n of c.parked)t(`PARKED ${n.file} ${JSON.stringify(n.label)} still breaks N10 — ${n.why}`,g.some(s=>s.file===n.file&&s.label===n.label),"it no longer breaks N10 (renamed, or its row deleted) — take it out of the list");return{read:l,live:i}}function L(a,c){const{check:t,report:o}=x("label vocabulary");t(`N10.1 forbids ${p.length} words, each written once, lower-case and trimmed: ${[...p].sort().join(", ")}`,p.length>0&&new Set(p).size===p.length&&p.every(e=>e===e.trim().toLowerCase()&&e.length>0),JSON.stringify(p));{const e=(l,h=!1)=>k(l,h),d=p.filter(l=>{const h=`N10.1 "${l}"`,r=l[0].toUpperCase()+l.slice(1);return!e(r).includes(h)||!e(`Card ${l}s`).includes(h)});t("N10.1 catches every word on the list, alone and as a qualified plural",d.length===0,d.join(", ")),t("N10.1 …but not inside a longer word",e("Copyright").length===0&&e("Classic layout").length===0&&e("Stacking order").length===0,JSON.stringify([e("Copyright"),e("Classic layout"),e("Stacking order")])),t("N10.2 a section's label may not start Title, an item's may not start Heading",e("Title").includes("N10.2 Title at section level")&&e("Heading",!0).includes("N10.2 Heading at item level")),t("N10.2 …and each is right at its own level",e("Heading").length===0&&e("Title",!0).length===0&&e("Card title").length===0&&e("Section heading",!0).length===0),t("N10.3 nothing follows `button` or `link`",e("Button text").includes('N10.3 "button text"')&&e("Submit button label").includes('N10.3 "button label"')&&e("Link href").includes('N10.3 "link href"')&&e("Archive link URL").includes('N10.3 "link url"')),t("N10.3 …and the pair itself passes",e("Button").length===0&&e("Button link").length===0&&e("Archive link").length===0),t("N10.4 a bare Text fails; Alt text is a name",e("Text").includes("N10.4 bare Text")&&e("Alt text").length===0),t("the name is cut at a hint tail, so a hint cannot corrupt the verdict",e("Body (blank line = new paragraph)").length===0&&e("Copy — the words under it").includes('N10.1 "copy"'))}{const e=[{path:"lib/puck/config.tsx",text:['heading: plainText("Heading"),','eyebrow: plainText("Kicker"),','title: plainText("Title"),','cards: { type: "array", label: "Cards",'," arrayFields: {",' heading: plainText("Heading"),',' title: plainText("Card title"),'," },","},",'layout: { type: "select", label: "Layout",',' options: [{ label: "Centre", value: "center" }] },'].join(`
1
+ import{failedChecks as C,ruleChecks as w}from"./rule.js";import{isPanelFile as j,readLabels as H,readPanelLabels as R}from"./support/label-extraction.js";import{registryFiles as $}from"./support/registry-source.js";const g=["kicker","tagline","headline","blurb","description","copy","paragraph","photo","picture","cta","kind","class","grayscale","greyscale","colour","align","align items","text alignment","centre","catalogue","behaviour","labelled","stylised","stack","container","gutter","margin","site width","max width","contained","boxed","header offset","clearance","typeface","font family","leading","character spacing","kerning","text transform"],S=o=>o.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),B=g.map(o=>({word:o,pattern:new RegExp(`\\b${S(o)}s?\\b`)}));function P(o){return o.split(/\(| — /)[0].trim()}function F(o){const s=new Set;for(const l of $(o))for(const a of l.text.matchAll(/\{[^{}]*\btype:\s*"slot"[^{}]*\}/g)){const t=/\ballow:\s*\[([^\]]*)\]/.exec(a[0]);for(const r of t?.[1].matchAll(/"([A-Za-z0-9_]+)"/g)??[])s.add(r[1])}return s}const A=o=>/^lib\/puck\/blocks\/[^/]+\/([^/]+)\//.exec(o)?.[1]??null;function m(o,s){const l=P(o).toLowerCase(),a=[];for(const{word:r,pattern:n}of B)n.test(l)&&a.push(`N10.1 "${r}"`);/^title\b/.test(l)&&s==="section"&&a.push("N10.2 Title at section level"),/^heading\b/.test(l)&&s==="item"&&a.push("N10.2 Heading at item level");const t=/\b(button|link)\s+(text|label|href|url)$/.exec(l);return t&&a.push(`N10.3 "${t[1]} ${t[2]}"`),l==="text"&&a.push("N10.4 bare Text"),a}function v(o,s,l){const a=$(o),t=o.filter(j),r=F(o),n=new Map,c=[],f=(e,i)=>{for(const p of e){const k=i(p.text);n.set(p.path,k.length);const T=r.has(A(p.path)??"");for(const x of k){const N=x.item?"item":T?"slot child":"section";c.push({...x,file:p.path,level:N,why:m(x.label,N)})}}};f(a,H),f(t,R);for(const[e,i]of Object.entries(s.floors)){const p=n.get(e);l(`${e} yields >= ${i} labels (found ${p??"none: not read"})`,p!==void 0&&p>=i,p===void 0?"it has a floor but was not read — it dropped out of the panels and the registry":"the reader is broken, not the panel")}const d=a.reduce((e,i)=>e+(n.get(i.path)??0),0);l(`the block registry yields >= ${s.minRegistryLabels} labels across ${a.length} files (found ${d})`,d>=s.minRegistryLabels,"the reader is broken, not the panel");const h=c.filter(e=>e.why.length>0),y=e=>s.parked.some(i=>i.file===e.file&&i.label===e.label),b=h.filter(e=>!y(e)),u=e=>c.filter(i=>i.level===e).length;l(`every field label obeys N10.1–N10.4 (${c.length} read across ${a.length+t.length} files: ${u("section")} section-level, ${u("item")} item-level, ${u("slot child")} in a slot child of ${[...r].sort().join(", ")||"none"})`,b.length===0,`${b.length} break doc/naming.md N10:
2
+ `+b.map(e=>` ${e.file}:${e.line} [${e.level}] ${JSON.stringify(e.label)} — ${e.why.join(", ")}`).join(`
3
+ `));for(const e of s.parked)l(`PARKED ${e.file} ${JSON.stringify(e.label)} still breaks N10 — ${e.why}`,h.some(i=>i.file===e.file&&i.label===e.label),"it no longer breaks N10 (renamed, or its row deleted) — take it out of the list");return{read:c,live:b,slotChildren:r}}function E(o,s){const{check:l,report:a}=w("label vocabulary");l(`N10.1 forbids ${g.length} words, each written once, lower-case and trimmed: ${[...g].sort().join(", ")}`,g.length>0&&new Set(g).size===g.length&&g.every(t=>t===t.trim().toLowerCase()&&t.length>0),JSON.stringify(g));{const t=(n,c=!1)=>m(n,c?"item":"section"),r=g.filter(n=>{const c=`N10.1 "${n}"`,f=n[0].toUpperCase()+n.slice(1);return!t(f).includes(c)||!t(`Card ${n}s`).includes(c)});l("N10.1 catches every word on the list, alone and as a qualified plural",r.length===0,r.join(", ")),l("N10.1 …but not inside a longer word",t("Copyright").length===0&&t("Classic layout").length===0&&t("Stacking order").length===0,JSON.stringify([t("Copyright"),t("Classic layout"),t("Stacking order")])),l("N10.2 a section's label may not start Title, an item's may not start Heading",t("Title").includes("N10.2 Title at section level")&&t("Heading",!0).includes("N10.2 Heading at item level")),l("N10.2 …and each is right at its own level",t("Heading").length===0&&t("Title",!0).length===0&&t("Card title").length===0&&t("Section heading",!0).length===0),l("N10.2 a slot child's label may start with either word, and N10.1 still holds there",m("Title","slot child").length===0&&m("Heading","slot child").length===0&&m("Headline","slot child").includes('N10.1 "headline"')),l("N10.3 nothing follows `button` or `link`",t("Button text").includes('N10.3 "button text"')&&t("Submit button label").includes('N10.3 "button label"')&&t("Link href").includes('N10.3 "link href"')&&t("Archive link URL").includes('N10.3 "link url"')),l("N10.3 …and the pair itself passes",t("Button").length===0&&t("Button link").length===0&&t("Archive link").length===0),l("N10.4 a bare Text fails; Alt text is a name",t("Text").includes("N10.4 bare Text")&&t("Alt text").length===0),l("the name is cut at a hint tail, so a hint cannot corrupt the verdict",t("Body (blank line = new paragraph)").length===0&&t("Copy — the words under it").includes('N10.1 "copy"'))}{const t=[{path:"lib/puck/config.tsx",text:['heading: plainText("Heading"),','eyebrow: plainText("Kicker"),','title: plainText("Title"),','cards: { type: "array", label: "Cards",'," arrayFields: {",' heading: plainText("Heading"),',' title: plainText("Card title"),'," },","},",'layout: { type: "select", label: "Layout",',' options: [{ label: "Centre", value: "center" }] },'].join(`
4
4
  `)},{path:"components/FixturePanel.tsx",text:['import { SettingsField } from "efficient-easel/panel";',"const items = [",' { label: "Copy", onClick: () => copy() },',"];","const rows = [",' { key: "photo", label: "Photo", group: "media" },',"];","const tabs: SettingsTabItem[] = [",' { id: "text", label: "Text" },',"];",'<SettingsField label="Colour" />'].join(`
5
- `)},{path:"components/HandRolled.tsx",text:'<div className="sf-field"><Row label="Gutter" /></div>'},{path:"components/ShopperForm.tsx",text:'<Field label="Description" />'}],d=x("fixture"),{read:l,live:h}=N(e,{floors:{"components/FixturePanel.tsx":5,"components/HandRolled.tsx":1,"components/Moved.tsx":1},minRegistryLabels:8,parked:[{file:"components/FixturePanel.tsx",label:"Colour",why:"fixture: still breaks"},{file:"lib/puck/config.tsx",label:"Headline",why:"fixture: renamed long ago"}]},d.check),r=$(d.report()).map(i=>i.name),g=i=>r.some(b=>b.startsWith(i)),u=l.map(i=>i.label);t("the fixture reads the registry's fields and the panels' rows, and no option, action, tab or shopper's form",u.join(" · ")==="Heading · Kicker · Title · Cards · Heading · Card title · Layout · Photo · Colour · Gutter",u.join(" · ")),t("…and the breaches are the ones it wrote, the parked one waived",h.map(i=>`${i.label}=${i.why.join("+")}`).join(" · ")==='Kicker=N10.1 "kicker" · Title=N10.2 Title at section level · Heading=N10.2 Heading at item level · Photo=N10.1 "photo" · Gutter=N10.1 "gutter"',JSON.stringify(h.map(i=>[i.label,i.why]))),t("a file under its floor goes red",g("components/FixturePanel.tsx yields")&&!g("components/HandRolled.tsx yields"),r.join(" | ")),t("a floored file that is not read goes red",g("components/Moved.tsx yields"),r.join(" | ")),t("a registry under its floor goes red",g("the block registry yields"),r.join(" | ")),t("a PARKED label that no longer breaks N10 goes red, and one that still does is waived",g('PARKED lib/puck/config.tsx "Headline"')&&!g('PARKED components/FixturePanel.tsx "Colour"'),r.join(" | ")),t("the verdict goes red on a live breach",g("every field label obeys"),r.join(" | ")),t("…and nothing else did",r.length===5,r.join(" | "))}return N(a,c,t),o()}export{p as NEVER_WORDS,L as labelVocabulary,k as vocabularyBreaches};
5
+ `)},{path:"lib/puck/blocks/commerce/GalleryB/render.tsx",text:'export const GalleryBSlots = { items: { type: "slot", allow: ["GalleryItem"] } };'},{path:"lib/puck/blocks/commerce/GalleryItem/fields.tsx",text:['name: text("Title"),','photo: upload("Photo"),'].join(`
6
+ `)},{path:"lib/puck/blocks/service/AppointmentBooking/render.tsx",text:'export const Slots = { boxes: { type: "slot", allow: ["BookingBox"] } };'},{path:"lib/puck/blocks/service/BookingBox/fields.tsx",text:'heading: plainTextarea("Heading"),'},{path:"components/HandRolled.tsx",text:'<div className="sf-field"><Row label="Gutter" /></div>'},{path:"components/ShopperForm.tsx",text:'<Field label="Description" />'}],r=w("fixture"),{read:n,live:c,slotChildren:f}=v(t,{floors:{"components/FixturePanel.tsx":5,"components/HandRolled.tsx":1,"components/Moved.tsx":1},minRegistryLabels:11,parked:[{file:"components/FixturePanel.tsx",label:"Colour",why:"fixture: still breaks"},{file:"lib/puck/config.tsx",label:"Headline",why:"fixture: renamed long ago"}]},r.check),d=C(r.report()).map(e=>e.name),h=e=>d.some(i=>i.startsWith(e)),y=n.map(e=>e.label);l("the fixture reads the registry's fields and the panels' rows, and no option, action, tab or shopper's form",y.join(" · ")==="Heading · Kicker · Title · Cards · Heading · Card title · Layout · Title · Photo · Heading · Photo · Colour · Gutter",y.join(" · ")),l("…and the breaches are the ones it wrote, the parked one waived",c.map(e=>`${e.label}=${e.why.join("+")}`).join(" · ")==='Kicker=N10.1 "kicker" · Title=N10.2 Title at section level · Heading=N10.2 Heading at item level · Photo=N10.1 "photo" · Photo=N10.1 "photo" · Gutter=N10.1 "gutter"',JSON.stringify(c.map(e=>[e.label,e.why])));const b=n.filter(e=>e.level==="slot child").map(e=>`${e.file.split("/")[4]} ${e.label}=${e.why.join("+")||"ok"}`),u=n.filter(e=>e.file==="lib/puck/config.tsx"&&e.label==="Title").map(e=>`${e.level}:${e.why.join("+")}`);l("a block in a literal slot `allow` is a slot child: GalleryItem `Title` and BookingBox `Heading` both pass, N10.1 still bites, and a section's own `Title` still fails N10.2",[...f].sort().join()==="BookingBox,GalleryItem"&&b.join(" · ")==='GalleryItem Title=ok · GalleryItem Photo=N10.1 "photo" · BookingBox Heading=ok'&&u.join()==="section:N10.2 Title at section level",JSON.stringify([[...f],b,u])),l("a file under its floor goes red",h("components/FixturePanel.tsx yields")&&!h("components/HandRolled.tsx yields"),d.join(" | ")),l("a floored file that is not read goes red",h("components/Moved.tsx yields"),d.join(" | ")),l("a registry under its floor goes red",h("the block registry yields"),d.join(" | ")),l("a PARKED label that no longer breaks N10 goes red, and one that still does is waived",h('PARKED lib/puck/config.tsx "Headline"')&&!h('PARKED components/FixturePanel.tsx "Colour"'),d.join(" | ")),l("the verdict goes red on a live breach",h("every field label obeys"),d.join(" | ")),l("…and nothing else did",d.length===5,d.join(" | "))}return v(o,s,l),a()}export{g as NEVER_WORDS,E as labelVocabulary,F as slotChildTypes,m as vocabularyBreaches};
@@ -130,6 +130,7 @@ export interface HeadingTypographyValue {
130
130
  case?: HeadingCase | null;
131
131
  weight?: number | null;
132
132
  weightStrong?: number | null;
133
+ italicStrong?: boolean | null;
133
134
  maxPx?: number | null;
134
135
  weight2?: number | null;
135
136
  weight3?: number | null;
@@ -140,6 +141,7 @@ export interface ResolvedHeadingTypography {
140
141
  case: HeadingCase;
141
142
  weight: number | null;
142
143
  weightStrong: number | null;
144
+ italicStrong: boolean | null;
143
145
  maxPx: number | null;
144
146
  weight2: number | null;
145
147
  weight3: number | null;
@@ -157,6 +159,7 @@ export interface HeadingTypographyRow {
157
159
  heading_case?: string | null;
158
160
  heading_weight?: number | null;
159
161
  heading_weight_strong?: number | null;
162
+ accent_italic?: boolean | null;
160
163
  heading_max_px?: number | null;
161
164
  heading_2_weight?: number | null;
162
165
  heading_3_weight?: number | null;
package/dist/lib/theme.js CHANGED
@@ -15,4 +15,4 @@ const L="storefront-theme",me="sf:theme-mode",pe="sf:theme-switch",xe="hide",_e=
15
15
  if (theme === 'light') document.documentElement.setAttribute('data-theme', 'light');
16
16
  else document.documentElement.removeAttribute('data-theme');
17
17
  } catch (e) {}
18
- `}const a={background:"#0a0a0a",surface:"#131313",line:"#2a2a2a",muted:"#9a9388"},P=[{text:"#2e2e2e",accent:"#2e2e2e",background:"#ffffff",surface:"#f7f7f7",line:"#e0e0e0",muted:"#5c5c5c"},{text:"#f7f7f7",accent:"#f7f7f7",background:"#0a0a0a",surface:"#1b1b1b",line:"#363636",muted:"#a3a3a3"},{text:"#ffffff",accent:"#ffffff",background:"#2e2e2e",surface:"#3d3d3d",line:"#545454",muted:"#b0b0b0"},{text:"#0a0a0a",accent:"#0a0a0a",background:"#f7f7f7",surface:"#ffffff",line:"#d9d9d9",muted:"#5c5c5c"}],$={selected:0,themes:P};function S(e){return!e||!Array.isArray(e.themes)||e.themes.length===0?{...$}:{selected:Math.min(Math.max(0,e.selected??0),e.themes.length-1),themes:e.themes}}function f(e,t,n){const r=u(e),o=u(t);if(r===null||o===null)return e;const i=c=>Math.max(0,Math.min(255,Math.round(c))).toString(16).padStart(2,"0");return`#${r.map((c,O)=>i(c+(o[O]-c)*n)).join("")}`}const F={light:"#ffffff",dark:"#0a0a0a"},Re=["light","dark"];function we(e,t){const n=F[t],r=t==="light"?"#ffffff":"#000000";return{text:n,accent:n,background:e,surface:f(e,r,.1),line:f(e,r,.22),muted:f(n,e,.35),brandInk:t}}function s(e){const t=S(e);return t.themes[t.selected]}function d(e){return{text:e.text,accent:e.accent,background:e.background||a.background,surface:e.surface||a.surface,line:e.line||a.line,muted:e.muted||a.muted}}function Ce(e){return{fill:d(e).background,accent:e.accent}}function u(e){const t=/^#([0-9a-f]{3}|[0-9a-f]{6})$/i.exec(e.trim());if(!t)return null;const n=t[1].length===3?[...t[1]].map(c=>c+c).join(""):t[1],[r,o,i]=[0,2,4].map(c=>parseInt(n.slice(c,c+2),16));return[r,o,i]}function g(e){const t=u(e);if(t===null)return null;const[n,r,o]=t.map(i=>{const c=i/255;return c<=.04045?c/12.92:((c+.055)/1.055)**2.4});return .2126*n+.7152*r+.0722*o}const U=.4,G=4.5,Y=3;function z(e,t){const n=g(e),r=g(t);if(n===null||r===null)return null;const[o,i]=n>=r?[n,r]:[r,n];return(o+.05)/(i+.05)}const De={good:"Good","large-only":"Large text only",hard:"Hard to read"};function He(e){return e>=G?"good":e>=Y?"large-only":"hard"}const m=["#000000","#ffffff"];function l(e){let t=m[0],n=-1;for(const r of m){const o=z(e,r);if(o===null)return m[0];o>n&&(n=o,t=r)}return t}const X=[.25,.4,.55];function Ie(e){const t=u(e);return t===null?[]:X.map(n=>"#"+t.map(r=>Math.round(r*(1-n)).toString(16).padStart(2,"0")).join(""))}function Me(e){const t=s(e),n={"--theme-fg":t.text},r=g(t.text);return(r===null||r>=U)&&(n["--overlay-fg"]=t.text),n}const B=82;function p(e){return`color-mix(in srgb, ${e} ${B}%, #000)`}function ye(e){const t=s(e);return{"--theme-accent":t.accent,"--theme-accent-2":p(t.accent),"--theme-accent-ink":l(t.accent)}}function A(e){const t=e?.button;return/^#[0-9a-fA-F]{6}$/.test(t??"")?t.toLowerCase():null}function Ne(e){const t=s(e),n=A(t),r=T(t);if(n===null&&r===null)return{};const o={};return n!==null&&(o["--theme-btn"]=n,o["--theme-btn-2"]=p(n)),o["--theme-btn-ink"]=r??l(n),o}function T(e){const t=e?.buttonInk;return/^#[0-9a-fA-F]{6}$/.test(t??"")?t.toLowerCase():null}function Oe(e,t){return T(e)??l(A(e)??t)}function Le(e){const t={};return S(e).themes.forEach((n,r)=>{const o=d(n);t[`--theme-preset-${r}-accent`]=o.accent,t[`--theme-preset-${r}-accent-2`]=p(o.accent),t[`--theme-preset-${r}-accent-ink`]=l(o.accent),t[`--theme-preset-${r}-bg`]=o.background,t[`--theme-preset-${r}-fg`]=o.text,t[`--theme-preset-${r}-surface`]=o.surface,t[`--theme-preset-${r}-surface-2`]=`color-mix(in srgb, ${o.surface} 60%, ${o.line})`,t[`--theme-preset-${r}-line`]=o.line,t[`--theme-preset-${r}-muted`]=o.muted}),t}const ke=["--theme-bg","--theme-surface","--theme-surface-2","--theme-line","--theme-muted"];function Pe(e){const t=d(s(e)),n=`color-mix(in srgb, ${t.surface} 60%, ${t.line})`,r={"--theme-bg":t.background,"--theme-surface":t.surface,"--theme-line":t.line,"--theme-muted":t.muted};return(t.surface!==a.surface||t.line!==a.line)&&(r["--theme-surface-2"]=n),r}const W=["heading","body","label"],$e={heading:"Headings",body:"Body",label:"Labels"},Fe="body";function Ue(e){if(!e)return null;for(const t of W)if(e.includes(`--size-${t}`))return t;return/--size-heading(Large|Medium|Small)/.test(e)?"heading":null}const b=["headingLarge","headingMedium","headingSmall","accent","body","label"],Ge={headingLarge:"heading",headingMedium:"heading",headingSmall:"heading",accent:"heading",body:"body",label:"label"},Ye={headingLarge:"Large",headingMedium:"Medium",headingSmall:"Small",accent:"Size",body:"Size",label:"Size"},ze={headingLarge:null,headingMedium:null,headingSmall:null,accent:null,body:null,label:null},K=8,V=200,Xe=1;function Z(e){if(typeof e!="number"||!Number.isFinite(e))return null;const t=Math.round(e);return t>=K&&t<=V?t:null}function j(e){const t={};for(const n of b)t[n]=Z(e?.[n]);return t}function Be(e){const t=j(e),n={};for(const r of b){const o=t[r];o!==null&&(n[`--size-${r}`]=`${o}px`)}return n}const q=["square","small","large"],J="small";function Q(e){return q.includes(e??"")?e:J}function We(e){return C(ee[Q(e)])}const R=0,v=40,ee={square:0,small:null,large:16},te={"--sf-card-radius":1,"--sf-button-radius":.5,"--site-radius":.5,"--site-radius-xs":.25,"--site-radius-sm":.5,"--site-radius-md":.75,"--site-radius-lg":1,"--site-radius-xl":1.25,"--site-radius-2xl":1.5,"--site-radius-3xl":2,"--site-radius-4xl":2.5};function w(e){if(e==null||typeof e=="string"&&e.trim()==="")return null;const t=typeof e=="string"?Number(e):e;return Number.isFinite(t)?Math.min(v,Math.max(R,Math.round(t))):null}function C(e){const t=w(e);return t===null?{}:Object.fromEntries(Object.entries(te).map(([n,r])=>{const o=t*r/16;return[n,o===0?"0":`${o}rem`]}))}function Ke(e){return C(w(e)??R)}const ne=["none","soft","lifted"],re="soft",D="none",oe=["tight","normal","roomy"],ie="normal",ce="normal",ae=["none","lift","highlight"],se="lift",ue="highlight",H="#141416";function I(e){return ne.includes(e??"")?e:re}function le(e){return oe.includes(e??"")?e:ie}function M(e){return ae.includes(e??"")?e:se}function he(e){return/^#[0-9a-fA-F]{6}$/.test(e??"")?e.toLowerCase():H}function Ve(e){const t=I(e);return t===D?void 0:t}function Ze(e){const t=le(e);return t===ce?void 0:t}function je(e){const t=M(e);return t===ue?void 0:t}function qe(e,t,n){const r=he(t);return r===H?{}:I(e)!==D||M(n)==="lift"?{"--sf-shadow-color":r}:{}}const fe=["normal","tight","compressed"],y="normal";function N(e){return fe.includes(e??"")?e:y}function Je(e){const t=N(e);return t===y?void 0:t}function Qe(e){switch(N(e)){case"tight":return{lineHeight:.95,letterSpacing:-.01};case"compressed":return{lineHeight:.86,letterSpacing:-.01};default:return{}}}const ve=["authored","sentence"],et={case:"authored",weight:null,weightStrong:null,maxPx:null,weight2:null,weight3:null,case2:"authored",case3:"authored"},x=100,_=900,de=24,ge=200;function h(e,t,n){return typeof e!="number"||!Number.isFinite(e)?null:Math.round(Math.min(Math.max(e,t),n))}function E(e){const t=h(e?.weight,x,_),n=e?.case==="sentence"?"sentence":"authored",r=i=>i==null?t:h(i,x,_),o=i=>i==="sentence"?"sentence":i==="authored"?"authored":n;return{case:n,weight:t,weightStrong:h(e?.weightStrong,x,_),maxPx:h(e?.maxPx,de,ge),weight2:r(e?.weight2),weight3:r(e?.weight3),case2:o(e?.case2),case3:o(e?.case3)}}function tt(e){const t=E(e),n={};return t.case==="sentence"&&(n["--sf-heading-case"]="none"),t.weight!==null&&(n["--sf-heading-weight"]=String(t.weight)),t.weightStrong!==null&&(n["--sf-heading-weight-strong"]=String(t.weightStrong)),t.maxPx!==null&&(n["--sf-heading-max"]=`${t.maxPx}px`),t.weight2!==null&&t.weight2!==t.weight&&(n["--sf-heading-2-weight"]=String(t.weight2)),t.weight3!==null&&t.weight3!==t.weight&&(n["--sf-heading-3-weight"]=String(t.weight3)),t.case2!==t.case&&(n["--sf-heading-2-case"]=t.case2==="sentence"?"none":"uppercase"),t.case3!==t.case&&(n["--sf-heading-3-case"]=t.case3==="sentence"?"none":"uppercase"),n}function nt(e){return E({case:e?.heading_case??void 0,weight:e?.heading_weight,weightStrong:e?.heading_weight_strong,maxPx:e?.heading_max_px,weight2:e?.heading_2_weight??void 0,weight3:e?.heading_3_weight??void 0,case2:e?.heading_2_case??void 0,case3:e?.heading_3_case??void 0})}function rt(e){const t=E(e);return{heading_case:t.case,heading_weight:t.weight,heading_weight_strong:t.weightStrong,heading_max_px:t.maxPx,heading_2_weight:t.weight2,heading_3_weight:t.weight3,heading_2_case:t.case2,heading_3_case:t.case3}}export{X as ACCENT_DARKEN_STEPS,Re as BRAND_INKS,oe as CARD_GAPS,ne as CARD_SHADOWS,v as CORNER_RADIUS_MAX,R as CORNER_RADIUS_MIN,q as CORNER_STYLES,ee as CORNER_STYLE_TO_PX,ie as DEFAULT_CARD_GAP,re as DEFAULT_CARD_SHADOW,J as DEFAULT_CORNER_STYLE,y as DEFAULT_HEADING_COMPRESSION,et as DEFAULT_HEADING_TYPOGRAPHY,se as DEFAULT_HOVER_EFFECT,H as DEFAULT_SHADOW_COLOR,ze as DEFAULT_SIZES,a as DEFAULT_SURFACES,Ee as DEFAULT_SWITCH_SHOWN,P as DEFAULT_THEMES,_e as DEFAULT_THEME_MODE,$ as DEFAULT_THEME_VALUE,De as GRADE_LABEL,ve as HEADING_CASES,fe as HEADING_COMPRESSIONS,ge as HEADING_MAX_PX_MAX,de as HEADING_MAX_PX_MIN,_ as HEADING_WEIGHT_MAX,x as HEADING_WEIGHT_MIN,ae as HOVER_EFFECTS,ce as IDENTITY_CARD_GAP,D as IDENTITY_CARD_SHADOW,ue as IDENTITY_HOVER_EFFECT,Fe as NEUTRAL_TYPE_GROUP,G as READABILITY_AA,Y as READABILITY_AA_LARGE,Ge as SCALE_OF_STEP,b as SIZE_STEPS,Ye as SIZE_STEP_LABELS,V as TEXT_SIZE_MAX,K as TEXT_SIZE_MIN,Xe as TEXT_SIZE_STEP,Ae as THEME_DAY_END_HOUR,Se as THEME_DAY_START_HOUR,me as THEME_MODE_KEY,L as THEME_STORAGE_KEY,ke as THEME_SURFACE_KEYS,xe as THEME_SWITCH_HIDE,pe as THEME_SWITCH_KEY,W as TYPE_GROUPS,$e as TYPE_GROUP_LABELS,l as accentInk,we as brandTheme,be as buildThemeBootScript,Ze as cardGapAttr,Ve as cardShadowAttr,Qe as compressionMetrics,z as contrastRatio,C as cornerRadiusTokens,We as cornerStyleTokens,Ie as darkerAccents,He as gradeContrast,Je as headingCompressionAttr,nt as headingTypographyFromRow,tt as headingTypographyStyle,rt as headingTypographyToRow,je as hoverEffectAttr,k as isDayHour,le as normalizeCardGap,I as normalizeCardShadow,w as normalizeCornerRadius,Q as normalizeCornerStyle,N as normalizeHeadingCompression,E as normalizeHeadingTypography,M as normalizeHoverEffect,he as normalizeShadowColor,Z as normalizeSize,j as normalizeSizes,S as normalizeTheme,d as normalizeThemeColors,Te as resolveTheme,Oe as resolvedButtonInk,s as selectedThemeColors,qe as shadowColorTokens,Ke as siteCornerRadiusTokens,ye as themeAccentStyle,A as themeButtonColour,T as themeButtonInk,Ne as themeButtonStyle,Me as themeColorStyle,Le as themePresetAccentVars,Pe as themeSurfaceStyle,Ce as themeSwatchColors,Ue as typeScaleGroupOfClassName,Be as typeSizesStyle};
18
+ `}const a={background:"#0a0a0a",surface:"#131313",line:"#2a2a2a",muted:"#9a9388"},P=[{text:"#2e2e2e",accent:"#2e2e2e",background:"#ffffff",surface:"#f7f7f7",line:"#e0e0e0",muted:"#5c5c5c"},{text:"#f7f7f7",accent:"#f7f7f7",background:"#0a0a0a",surface:"#1b1b1b",line:"#363636",muted:"#a3a3a3"},{text:"#ffffff",accent:"#ffffff",background:"#2e2e2e",surface:"#3d3d3d",line:"#545454",muted:"#b0b0b0"},{text:"#0a0a0a",accent:"#0a0a0a",background:"#f7f7f7",surface:"#ffffff",line:"#d9d9d9",muted:"#5c5c5c"}],$={selected:0,themes:P};function S(e){return!e||!Array.isArray(e.themes)||e.themes.length===0?{...$}:{selected:Math.min(Math.max(0,e.selected??0),e.themes.length-1),themes:e.themes}}function f(e,t,n){const r=u(e),o=u(t);if(r===null||o===null)return e;const i=c=>Math.max(0,Math.min(255,Math.round(c))).toString(16).padStart(2,"0");return`#${r.map((c,O)=>i(c+(o[O]-c)*n)).join("")}`}const F={light:"#ffffff",dark:"#0a0a0a"},Re=["light","dark"];function Ce(e,t){const n=F[t],r=t==="light"?"#ffffff":"#000000";return{text:n,accent:n,background:e,surface:f(e,r,.1),line:f(e,r,.22),muted:f(n,e,.35),brandInk:t}}function s(e){const t=S(e);return t.themes[t.selected]}function d(e){return{text:e.text,accent:e.accent,background:e.background||a.background,surface:e.surface||a.surface,line:e.line||a.line,muted:e.muted||a.muted}}function De(e){return{fill:d(e).background,accent:e.accent}}function u(e){const t=/^#([0-9a-f]{3}|[0-9a-f]{6})$/i.exec(e.trim());if(!t)return null;const n=t[1].length===3?[...t[1]].map(c=>c+c).join(""):t[1],[r,o,i]=[0,2,4].map(c=>parseInt(n.slice(c,c+2),16));return[r,o,i]}function g(e){const t=u(e);if(t===null)return null;const[n,r,o]=t.map(i=>{const c=i/255;return c<=.04045?c/12.92:((c+.055)/1.055)**2.4});return .2126*n+.7152*r+.0722*o}const U=.4,G=4.5,Y=3;function z(e,t){const n=g(e),r=g(t);if(n===null||r===null)return null;const[o,i]=n>=r?[n,r]:[r,n];return(o+.05)/(i+.05)}const we={good:"Good","large-only":"Large text only",hard:"Hard to read"};function He(e){return e>=G?"good":e>=Y?"large-only":"hard"}const m=["#000000","#ffffff"];function l(e){let t=m[0],n=-1;for(const r of m){const o=z(e,r);if(o===null)return m[0];o>n&&(n=o,t=r)}return t}const X=[.25,.4,.55];function Ie(e){const t=u(e);return t===null?[]:X.map(n=>"#"+t.map(r=>Math.round(r*(1-n)).toString(16).padStart(2,"0")).join(""))}function Me(e){const t=s(e),n={"--theme-fg":t.text},r=g(t.text);return(r===null||r>=U)&&(n["--overlay-fg"]=t.text),n}const B=82;function p(e){return`color-mix(in srgb, ${e} ${B}%, #000)`}function ye(e){const t=s(e);return{"--theme-accent":t.accent,"--theme-accent-2":p(t.accent),"--theme-accent-ink":l(t.accent)}}function A(e){const t=e?.button;return/^#[0-9a-fA-F]{6}$/.test(t??"")?t.toLowerCase():null}function Ne(e){const t=s(e),n=A(t),r=T(t);if(n===null&&r===null)return{};const o={};return n!==null&&(o["--theme-btn"]=n,o["--theme-btn-2"]=p(n)),o["--theme-btn-ink"]=r??l(n),o}function T(e){const t=e?.buttonInk;return/^#[0-9a-fA-F]{6}$/.test(t??"")?t.toLowerCase():null}function Oe(e,t){return T(e)??l(A(e)??t)}function Le(e){const t={};return S(e).themes.forEach((n,r)=>{const o=d(n);t[`--theme-preset-${r}-accent`]=o.accent,t[`--theme-preset-${r}-accent-2`]=p(o.accent),t[`--theme-preset-${r}-accent-ink`]=l(o.accent),t[`--theme-preset-${r}-bg`]=o.background,t[`--theme-preset-${r}-fg`]=o.text,t[`--theme-preset-${r}-surface`]=o.surface,t[`--theme-preset-${r}-surface-2`]=`color-mix(in srgb, ${o.surface} 60%, ${o.line})`,t[`--theme-preset-${r}-line`]=o.line,t[`--theme-preset-${r}-muted`]=o.muted}),t}const ke=["--theme-bg","--theme-surface","--theme-surface-2","--theme-line","--theme-muted"];function Pe(e){const t=d(s(e)),n=`color-mix(in srgb, ${t.surface} 60%, ${t.line})`,r={"--theme-bg":t.background,"--theme-surface":t.surface,"--theme-line":t.line,"--theme-muted":t.muted};return(t.surface!==a.surface||t.line!==a.line)&&(r["--theme-surface-2"]=n),r}const W=["heading","body","label"],$e={heading:"Headings",body:"Body",label:"Labels"},Fe="body";function Ue(e){if(!e)return null;for(const t of W)if(e.includes(`--size-${t}`))return t;return/--size-heading(Large|Medium|Small)/.test(e)?"heading":null}const b=["headingLarge","headingMedium","headingSmall","accent","body","label"],Ge={headingLarge:"heading",headingMedium:"heading",headingSmall:"heading",accent:"heading",body:"body",label:"label"},Ye={headingLarge:"Large",headingMedium:"Medium",headingSmall:"Small",accent:"Size",body:"Size",label:"Size"},ze={headingLarge:null,headingMedium:null,headingSmall:null,accent:null,body:null,label:null},K=8,V=200,Xe=1;function Z(e){if(typeof e!="number"||!Number.isFinite(e))return null;const t=Math.round(e);return t>=K&&t<=V?t:null}function j(e){const t={};for(const n of b)t[n]=Z(e?.[n]);return t}function Be(e){const t=j(e),n={};for(const r of b){const o=t[r];o!==null&&(n[`--size-${r}`]=`${o}px`)}return n}const q=["square","small","large"],J="small";function Q(e){return q.includes(e??"")?e:J}function We(e){return D(ee[Q(e)])}const R=0,v=40,ee={square:0,small:null,large:16},te={"--sf-card-radius":1,"--sf-button-radius":.5,"--site-radius":.5,"--site-radius-xs":.25,"--site-radius-sm":.5,"--site-radius-md":.75,"--site-radius-lg":1,"--site-radius-xl":1.25,"--site-radius-2xl":1.5,"--site-radius-3xl":2,"--site-radius-4xl":2.5};function C(e){if(e==null||typeof e=="string"&&e.trim()==="")return null;const t=typeof e=="string"?Number(e):e;return Number.isFinite(t)?Math.min(v,Math.max(R,Math.round(t))):null}function D(e){const t=C(e);return t===null?{}:Object.fromEntries(Object.entries(te).map(([n,r])=>{const o=t*r/16;return[n,o===0?"0":`${o}rem`]}))}function Ke(e){return D(C(e)??R)}const ne=["none","soft","lifted"],re="soft",w="none",oe=["tight","normal","roomy"],ie="normal",ce="normal",ae=["none","lift","highlight"],se="lift",ue="highlight",H="#141416";function I(e){return ne.includes(e??"")?e:re}function le(e){return oe.includes(e??"")?e:ie}function M(e){return ae.includes(e??"")?e:se}function he(e){return/^#[0-9a-fA-F]{6}$/.test(e??"")?e.toLowerCase():H}function Ve(e){const t=I(e);return t===w?void 0:t}function Ze(e){const t=le(e);return t===ce?void 0:t}function je(e){const t=M(e);return t===ue?void 0:t}function qe(e,t,n){const r=he(t);return r===H?{}:I(e)!==w||M(n)==="lift"?{"--sf-shadow-color":r}:{}}const fe=["normal","tight","compressed"],y="normal";function N(e){return fe.includes(e??"")?e:y}function Je(e){const t=N(e);return t===y?void 0:t}function Qe(e){switch(N(e)){case"tight":return{lineHeight:.95,letterSpacing:-.01};case"compressed":return{lineHeight:.86,letterSpacing:-.01};default:return{}}}const ve=["authored","sentence"],et={case:"authored",weight:null,weightStrong:null,italicStrong:null,maxPx:null,weight2:null,weight3:null,case2:"authored",case3:"authored"},x=100,_=900,de=24,ge=200;function h(e,t,n){return typeof e!="number"||!Number.isFinite(e)?null:Math.round(Math.min(Math.max(e,t),n))}function E(e){const t=h(e?.weight,x,_),n=e?.case==="sentence"?"sentence":"authored",r=i=>i==null?t:h(i,x,_),o=i=>i==="sentence"?"sentence":i==="authored"?"authored":n;return{case:n,weight:t,weightStrong:h(e?.weightStrong,x,_),italicStrong:typeof e?.italicStrong=="boolean"?e.italicStrong:null,maxPx:h(e?.maxPx,de,ge),weight2:r(e?.weight2),weight3:r(e?.weight3),case2:o(e?.case2),case3:o(e?.case3)}}function tt(e){const t=E(e),n={};return t.case==="sentence"&&(n["--sf-heading-case"]="none"),t.weight!==null&&(n["--sf-heading-weight"]=String(t.weight)),t.weightStrong!==null&&(n["--sf-heading-weight-strong"]=String(t.weightStrong)),t.maxPx!==null&&(n["--sf-heading-max"]=`${t.maxPx}px`),t.weight2!==null&&t.weight2!==t.weight&&(n["--sf-heading-2-weight"]=String(t.weight2)),t.weight3!==null&&t.weight3!==t.weight&&(n["--sf-heading-3-weight"]=String(t.weight3)),t.case2!==t.case&&(n["--sf-heading-2-case"]=t.case2==="sentence"?"none":"uppercase"),t.case3!==t.case&&(n["--sf-heading-3-case"]=t.case3==="sentence"?"none":"uppercase"),n}function nt(e){return E({case:e?.heading_case??void 0,weight:e?.heading_weight,weightStrong:e?.heading_weight_strong,italicStrong:e?.accent_italic,maxPx:e?.heading_max_px,weight2:e?.heading_2_weight??void 0,weight3:e?.heading_3_weight??void 0,case2:e?.heading_2_case??void 0,case3:e?.heading_3_case??void 0})}function rt(e){const t=E(e);return{heading_case:t.case,heading_weight:t.weight,heading_weight_strong:t.weightStrong,heading_max_px:t.maxPx,heading_2_weight:t.weight2,heading_3_weight:t.weight3,heading_2_case:t.case2,heading_3_case:t.case3}}export{X as ACCENT_DARKEN_STEPS,Re as BRAND_INKS,oe as CARD_GAPS,ne as CARD_SHADOWS,v as CORNER_RADIUS_MAX,R as CORNER_RADIUS_MIN,q as CORNER_STYLES,ee as CORNER_STYLE_TO_PX,ie as DEFAULT_CARD_GAP,re as DEFAULT_CARD_SHADOW,J as DEFAULT_CORNER_STYLE,y as DEFAULT_HEADING_COMPRESSION,et as DEFAULT_HEADING_TYPOGRAPHY,se as DEFAULT_HOVER_EFFECT,H as DEFAULT_SHADOW_COLOR,ze as DEFAULT_SIZES,a as DEFAULT_SURFACES,Ee as DEFAULT_SWITCH_SHOWN,P as DEFAULT_THEMES,_e as DEFAULT_THEME_MODE,$ as DEFAULT_THEME_VALUE,we as GRADE_LABEL,ve as HEADING_CASES,fe as HEADING_COMPRESSIONS,ge as HEADING_MAX_PX_MAX,de as HEADING_MAX_PX_MIN,_ as HEADING_WEIGHT_MAX,x as HEADING_WEIGHT_MIN,ae as HOVER_EFFECTS,ce as IDENTITY_CARD_GAP,w as IDENTITY_CARD_SHADOW,ue as IDENTITY_HOVER_EFFECT,Fe as NEUTRAL_TYPE_GROUP,G as READABILITY_AA,Y as READABILITY_AA_LARGE,Ge as SCALE_OF_STEP,b as SIZE_STEPS,Ye as SIZE_STEP_LABELS,V as TEXT_SIZE_MAX,K as TEXT_SIZE_MIN,Xe as TEXT_SIZE_STEP,Ae as THEME_DAY_END_HOUR,Se as THEME_DAY_START_HOUR,me as THEME_MODE_KEY,L as THEME_STORAGE_KEY,ke as THEME_SURFACE_KEYS,xe as THEME_SWITCH_HIDE,pe as THEME_SWITCH_KEY,W as TYPE_GROUPS,$e as TYPE_GROUP_LABELS,l as accentInk,Ce as brandTheme,be as buildThemeBootScript,Ze as cardGapAttr,Ve as cardShadowAttr,Qe as compressionMetrics,z as contrastRatio,D as cornerRadiusTokens,We as cornerStyleTokens,Ie as darkerAccents,He as gradeContrast,Je as headingCompressionAttr,nt as headingTypographyFromRow,tt as headingTypographyStyle,rt as headingTypographyToRow,je as hoverEffectAttr,k as isDayHour,le as normalizeCardGap,I as normalizeCardShadow,C as normalizeCornerRadius,Q as normalizeCornerStyle,N as normalizeHeadingCompression,E as normalizeHeadingTypography,M as normalizeHoverEffect,he as normalizeShadowColor,Z as normalizeSize,j as normalizeSizes,S as normalizeTheme,d as normalizeThemeColors,Te as resolveTheme,Oe as resolvedButtonInk,s as selectedThemeColors,qe as shadowColorTokens,Ke as siteCornerRadiusTokens,ye as themeAccentStyle,A as themeButtonColour,T as themeButtonInk,Ne as themeButtonStyle,Me as themeColorStyle,Le as themePresetAccentVars,Pe as themeSurfaceStyle,De as themeSwatchColors,Ue as typeScaleGroupOfClassName,Be as typeSizesStyle};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "efficient-web-builder",
3
- "version": "17.1.1",
3
+ "version": "18.1.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",
@@ -40,8 +40,8 @@
40
40
  },
41
41
  "peerDependencies": {
42
42
  "@tabler/icons-react": "^3.46.0",
43
- "efficient-easel": "^10.1.0",
44
- "efficient-shell": "^7.47.0",
43
+ "efficient-easel": "^11.2.0",
44
+ "efficient-shell": "^7.48.0",
45
45
  "isomorphic-dompurify": "^3.18.0",
46
46
  "next": ">=16",
47
47
  "react": ">=19",
@@ -59,8 +59,8 @@
59
59
  "@types/node": "^20",
60
60
  "@types/react": "^19",
61
61
  "@types/react-dom": "^19",
62
- "efficient-easel": "^10.1.0",
63
- "efficient-shell": "^7.47.0",
62
+ "efficient-easel": "^11.2.0",
63
+ "efficient-shell": "^7.48.0",
64
64
  "esbuild": "^0.28.0",
65
65
  "happy-dom": "^20.14.5",
66
66
  "isomorphic-dompurify": "^3.18.0",
@@ -1,17 +0,0 @@
1
- import { type FontRole, type FontsValue } from "../lib/fonts.js";
2
- import { type SizeStep, type HeadingCompression, type ResolvedHeadingTypography, type SizesValue } from "../lib/theme.js";
3
- export interface TextStylesFieldProps {
4
- fonts: FontsValue;
5
- sizes: SizesValue;
6
- compression: HeadingCompression;
7
- headingTypography: ResolvedHeadingTypography;
8
- openRole: string | null;
9
- onOpenRole: (key: string | null) => void;
10
- onFontChange: (role: FontRole, key: string) => void;
11
- onSizeChange?: (step: SizeStep, v: number | null) => void;
12
- onCompressionChange: (v: HeadingCompression) => void;
13
- onHeadingTypographyChange: (v: ResolvedHeadingTypography) => void;
14
- livePx?: (role: FontRole) => number | null;
15
- savedRole?: string | null;
16
- }
17
- export default function TextStylesField({ fonts, compression, headingTypography, openRole, onOpenRole, onFontChange, sizes, onSizeChange, onCompressionChange, onHeadingTypographyChange, livePx, savedRole, }: TextStylesFieldProps): import("react").JSX.Element;
@@ -1 +0,0 @@
1
- "use client";import{jsx as t,jsxs as v,Fragment as y}from"react/jsx-runtime";import{FieldSelect as D}from"efficient-easel/fields";import{SettingsField as x}from"efficient-easel/panel";import{Tooltip as L}from"efficient-shell/ui";import{AccentIcon as X,CaseIcon as B,StylesIcon as W,TextLinesIcon as O,TextSizeIcon as p,TextSmallIcon as k,TypeIcon as R,WeightIcon as $}from"efficient-easel/icons";import{PartResetDot as E}from"./PartSettingsPanel.js";import{say as i}from"../lib/editor-words.js";import{Slider as z}from"../lib/puck/controls.js";import K from"./TextStyleRow.js";import{DEFAULT_FONTS as F,FONT_CATEGORY_LABELS as j,fontItalicIsUsable as Z,fontOption as N,fontsByCategory as U,isHeadingRole as b}from"../lib/fonts.js";import{compressionMetrics as V,DEFAULT_HEADING_COMPRESSION as H,HEADING_MAX_PX_MAX as Y,HEADING_MAX_PX_MIN as q,HEADING_WEIGHT_MAX as J,HEADING_WEIGHT_MIN as Q,TEXT_SIZE_MAX as w,TEXT_SIZE_MIN as ee,SIZE_STEPS as P,TEXT_SIZE_STEP as te}from"../lib/theme.js";const le=[{role:"heading",title:"Heading 1",group:"heading",step:"headingLarge",base:17,icon:t(p,{})},{role:"heading2",title:"Heading 2",group:"heading",step:"headingMedium",base:15,icon:t(p,{})},{role:"heading3",title:"Heading 3",group:"heading",step:"headingSmall",base:13,icon:t(p,{})},{role:"accent",title:"Accent",step:"accent",base:15,icon:t(X,{})},{role:"body",title:"Body",group:"body",step:"body",base:14,icon:t(O,{})},{role:"label",title:"Labels",group:"label",step:"label",base:11,icon:t(k,{})}];function Oe(n){return n==="heading"?P.filter(s=>s.startsWith("heading")):P.filter(s=>s===n)}const ne=9,f=500,ae=100,ie=80,se=4,oe=600,ce=700,re=400,ue="0.18em";function de({id:n,value:s,onChange:a}){const c=U().flatMap(([l,r])=>r.map(o=>({label:o.label,value:o.key,group:i(j[l])}))),u=(l,r)=>t("span",{style:{fontFamily:`var(${N(l)?.cssVar??"--font-body"})`},children:r});return t(D,{id:n,value:s,onChange:a,options:c,renderOption:l=>u(l.value,l.label),renderValue:l=>l?u(l.value,l.label):null})}function he({label:n,icon:s,readout:a,min:c,max:u,step:l,value:r,onChange:o,action:h,hint:g}){return t(x,{label:i(n),icon:s,value:a,action:h,hint:g,children:t(z,{min:c,max:u,step:l,value:r,readout:!1,ariaLabel:i(n),onChange:o})})}function C({label:n,icon:s,value:a,fallback:c,min:u,max:l,step:r,suffix:o="",hint:h,onChange:g}){const S=a===null;return t(he,{label:n,icon:s,readout:S?i("Auto"):`${a}${o}`,min:u,max:l,step:r,value:S?c:a,onChange:g,action:S?null:t(E,{label:n,what:"change",onClear:()=>g(null)}),hint:h})}function M({label:n,icon:s,options:a,value:c,onChange:u,hint:l,action:r}){return t(x,{label:i(n),icon:s,value:ge(a.find(o=>o.value===c)?.label),hint:l,action:r,children:t("div",{className:"sf-rungs",children:a.map(o=>t("button",{type:"button","aria-pressed":o.value===c,onClick:()=>u(o.value),className:`sf-rung${o.value===c?" is-active":""}`,children:i(o.label)},o.value))})})}const ge=n=>n===void 0?void 0:i(n),fe=[{value:"authored",label:"As designed"},{value:"sentence",label:"As typed"}],me=[{value:"normal",label:"Normal"},{value:"tight",label:"Tight"},{value:"compressed",label:"Compressed"}];function pe({fontKey:n,weight:s,fallbackWeight:a,onWeight:c}){const l=(s??a)>=oe,r=Z(n),o=N(n)?.label??i("This face");return t(x,{label:i("Style"),icon:t(W,{}),value:l?i("Bold"):i("Normal"),hint:i("Bold is the weight above — one value, two ways to set it."),children:v("div",{className:"sf-rungs",children:[t(L,{content:i("Bold"),className:"sf-rung-tip",children:t("button",{type:"button","aria-pressed":l,"aria-label":i("Bold"),onClick:()=>c(l?re:ce),className:`sf-rung sf-rung--glyph${l?" is-active":""}`,style:{fontWeight:700},children:"B"})}),t(L,{className:"sf-rung-tip",content:r?i("Italic is not saved yet — the theme row has no column for it (card 66162.b)."):i("{face} is loaded without an italic, so it cannot be set in italic. Slanting it would deform the letters rather than style them.",{face:o}),children:t("span",{className:"sf-tip-disabled",tabIndex:0,children:t("button",{type:"button","aria-pressed":!1,"aria-label":i("Italic"),disabled:!0,className:"sf-rung sf-rung--glyph",style:{fontStyle:"italic"},children:"I"})})})]})})}function be({fonts:n,compression:s,headingTypography:a,openRole:c,onOpenRole:u,onFontChange:l,sizes:r,onSizeChange:o,onCompressionChange:h,onHeadingTypographyChange:g,livePx:S,savedRole:G=null}){const m=e=>g({...a,...e}),_=e=>e==="accent"?"weightStrong":e==="heading2"?"weight2":e==="heading3"?"weight3":"weight",I=e=>e==="heading2"?"case2":e==="heading3"?"case3":"case",A=V(s);return t("div",{className:"sf-style-list",children:le.map(e=>{const T=c===e.role;return t(K,{styleKey:e.role,label:e.title,icon:e.icon,value:N(n[e.role])?.label??n[e.role],sampleStyle:Se(e,n,a,A),open:T,onToggle:()=>u(T?null:e.role),saved:G===e.role,children:T&&v(y,{children:[t(x,{label:i("Font"),icon:t(R,{}),htmlFor:`sf-font-${e.role}`,action:n[e.role]===F[e.role]?null:t(E,{label:"Font",what:"change",onClear:()=>l(e.role,F[e.role])}),children:t(de,{id:`sf-font-${e.role}`,value:n[e.role],onChange:d=>l(e.role,d)})}),e.step&&o&&t(C,{label:"Size",icon:t(p,{}),value:r[e.step],fallback:e.base*2,min:ee,max:w,step:te,suffix:"px",hint:r[e.step]===null?i("Auto = this style states no size, and text following it keeps the size its section drew."):i("The size a text takes when you set it to follow this style. Sections keep their own sizes."),onChange:d=>o(e.step,d)}),(b(e.role)||e.role==="accent")&&v(y,{children:[t(C,{label:"Weight",icon:t($,{}),value:a[_(e.role)],fallback:b(e.role)?f:a.weight??f,min:Q,max:J,step:ae,hint:e.role==="accent"?i("Auto = the accent phrase takes the heading's own weight."):void 0,onChange:d=>m({[_(e.role)]:d})}),t(pe,{fontKey:n[e.role],weight:a[_(e.role)],fallbackWeight:b(e.role)?f:a.weight??f,onWeight:d=>m({[_(e.role)]:d})})]}),b(e.role)&&v(y,{children:[t(M,{label:"Line & text gap",icon:t(O,{}),options:me,value:s,onChange:h,hint:A.lineHeight===void 0?i("The built-in spacing."):i("Line gap {line} · text gap {letter}em.",{line:A.lineHeight,letter:String(A.letterSpacing)}),action:s===H?null:t(E,{label:"Line & text gap",what:"change",onClear:()=>h(H)})}),t(M,{label:"Capitals",icon:t(B,{}),options:fe,value:a[I(e.role)],onChange:d=>m({[I(e.role)]:d}),hint:i("The only setting that changes a heading's capitals."),action:a[I(e.role)]==="authored"?null:t(E,{label:"Capitals",what:"change",onClear:()=>m({[I(e.role)]:"authored"})})}),t(C,{label:"Largest size",icon:t(p,{}),value:a.maxPx,fallback:ie,min:q,max:Y,step:se,suffix:"px",hint:i("Caps the biggest heading on the site. Auto = each section's own."),onChange:d=>m({maxPx:d})})]})]})},e.role)})})}function Se(n,s,a,c){const u=Math.max(ne,n.base),l={fontFamily:`var(${N(s[n.role])?.cssVar??"--font-body"})`,fontSize:`${u.toFixed(1)}px`,lineHeight:1.15};return b(n.role)?(l.fontWeight=a.weight??f,l.textTransform=a.case==="sentence"?"none":"uppercase",c.letterSpacing!==void 0&&(l.letterSpacing=`${c.letterSpacing}em`)):n.role==="accent"?(l.fontWeight=a.weightStrong??a.weight??f,c.letterSpacing!==void 0&&(l.letterSpacing=`${c.letterSpacing}em`)):n.role==="label"&&(l.textTransform="uppercase",l.letterSpacing=ue),l}export{be as default};