efficient-web-builder 67.1.0 → 67.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (115) hide show
  1. package/CHANGELOG.md +43 -0
  2. package/dist/editor/components/StorefrontEditor.js +1 -1
  3. package/dist/editor/components/storefront-editor.css +131 -0
  4. package/dist/editor/components/useSectionToBoxPass.d.ts +4 -0
  5. package/dist/editor/components/useSectionToBoxPass.js +1 -1
  6. package/dist/editor/lib/animation/fields.js +1 -1
  7. package/dist/editor/lib/animation/hover-fields.d.ts +8 -0
  8. package/dist/editor/lib/animation/hover-fields.js +1 -1
  9. package/dist/editor/lib/document/add-palette.js +1 -1
  10. package/dist/editor/lib/document/add-target.js +1 -1
  11. package/dist/editor/lib/document/block-offer.js +1 -1
  12. package/dist/editor/lib/document/blocks/general/Flex/fields.js +1 -1
  13. package/dist/editor/lib/document/blocks/shared-fields.js +1 -1
  14. package/dist/editor/lib/document/box-fields.d.ts +1 -1
  15. package/dist/editor/lib/document/card-display-chips.d.ts +1 -0
  16. package/dist/editor/lib/document/card-display-chips.js +1 -1
  17. package/dist/editor/lib/document/controls.js +1 -1
  18. package/dist/editor/lib/document/field-groups.js +1 -1
  19. package/dist/editor/lib/document/heading-outline.js +1 -1
  20. package/dist/editor/lib/document/page-root.js +2 -2
  21. package/dist/editor/lib/document/slot-new-children.js +1 -1
  22. package/dist/editor/lib/host-document-bridge.js +1 -1
  23. package/dist/editor/lib/sections/city-presets.js +1 -1
  24. package/dist/editor/lib/sections/new-section-node.js +1 -1
  25. package/dist/editor/lib/sections/section-dry-run.js +2 -2
  26. package/dist/editor/lib/sections/text-layouts.js +1 -1
  27. package/dist/format/lib/animation/hover.d.ts +3 -0
  28. package/dist/format/lib/animation/hover.js +1 -1
  29. package/dist/format/lib/content/box-layout.js +1 -1
  30. package/dist/format/lib/content/box-shape.d.ts +1 -1
  31. package/dist/format/lib/content/container-gap.d.ts +2 -2
  32. package/dist/format/lib/content/container-gap.js +1 -1
  33. package/dist/format/lib/content/css-length.d.ts +17 -1
  34. package/dist/format/lib/content/css-length.js +1 -1
  35. package/dist/format/lib/content/hover-media.d.ts +6 -1
  36. package/dist/format/lib/content/hover-media.js +1 -1
  37. package/dist/format/lib/content/image-treatment.d.ts +3 -0
  38. package/dist/format/lib/content/image-treatment.js +1 -1
  39. package/dist/format/lib/content/mirror-cards.js +1 -1
  40. package/dist/format/lib/content/page-width.d.ts +3 -3
  41. package/dist/format/lib/content/page-width.js +1 -1
  42. package/dist/format/lib/content/section-width.js +1 -1
  43. package/dist/format/lib/document/box-footer.js +1 -1
  44. package/dist/format/lib/document/container-blocks.js +1 -1
  45. package/dist/format/lib/document/media-drop.js +1 -1
  46. package/dist/format/lib/document/part-inks.js +1 -1
  47. package/dist/format/lib/document/part-records.js +1 -1
  48. package/dist/format/lib/document/passes/catalogue-labels.js +1 -1
  49. package/dist/format/lib/document/passes/media-values.js +1 -1
  50. package/dist/format/lib/document/row-hand.js +1 -1
  51. package/dist/format/lib/document/section-catalog.js +3 -3
  52. package/dist/format/lib/document/source-bound-parts.js +1 -1
  53. package/dist/format/lib/document/templateFields.js +1 -1
  54. package/dist/format/lib/document/theme-slots.js +1 -1
  55. package/dist/format/lib/editor-words-catalogue.d.ts +4 -0
  56. package/dist/format/lib/editor-words-catalogue.js +3 -3
  57. package/dist/format/lib/editor-words.js +1 -1
  58. package/dist/format/lib/logo/logo-size.d.ts +5 -0
  59. package/dist/format/lib/logo/logo-size.js +1 -1
  60. package/dist/format/lib/own-entry.d.ts +2 -0
  61. package/dist/format/lib/own-entry.js +1 -0
  62. package/dist/format/lib/preview-header-settings.d.ts +3 -0
  63. package/dist/format/lib/sections/active-press-context.js +1 -1
  64. package/dist/format/lib/sections/hero-single-to-hero.js +1 -1
  65. package/dist/format/lib/sections/section-eyebrow-look.js +1 -1
  66. package/dist/format/lib/sections/section-head-placement.js +1 -1
  67. package/dist/format/lib/sections/section-presets.d.ts +2 -0
  68. package/dist/format/lib/sections/section-presets.js +1 -1
  69. package/dist/format/lib/sections/section-text-kinds.js +1 -1
  70. package/dist/format/lib/sections/section-text-regions.js +1 -1
  71. package/dist/format/lib/site-theme-row.d.ts +6 -0
  72. package/dist/format/lib/source-rules/editor-words.js +3 -3
  73. package/dist/format/lib/source-rules/import-time-work.js +4 -4
  74. package/dist/format/lib/source-rules/no-hard-coded-option-rows.d.ts +1 -1
  75. package/dist/format/lib/source-rules/no-hard-coded-option-rows.js +1 -1
  76. package/dist/format/lib/source-rules/own-key-reads.d.ts +26 -0
  77. package/dist/format/lib/source-rules/own-key-reads.js +7 -0
  78. package/dist/format/lib/source-rules/site-square-by-default.js +1 -1
  79. package/dist/format/lib/theme.d.ts +1 -1
  80. package/dist/format/lib/theme.js +4 -4
  81. package/dist/render/components/CardRowContext.d.ts +3 -1
  82. package/dist/render/components/CardRowContext.js +1 -1
  83. package/dist/render/components/Flex.d.ts +2 -1
  84. package/dist/render/components/Flex.js +1 -1
  85. package/dist/render/components/HoverMediaLayer.d.ts +16 -1
  86. package/dist/render/components/HoverMediaLayer.js +1 -1
  87. package/dist/render/components/ImageBlock.d.ts +1 -1
  88. package/dist/render/components/ImageBlock.js +1 -1
  89. package/dist/render/components/Logo.d.ts +2 -1
  90. package/dist/render/components/Logo.js +1 -1
  91. package/dist/render/components/PictureHoverMove.d.ts +1 -0
  92. package/dist/render/components/PictureHoverMove.js +1 -1
  93. package/dist/render/components/PreviewHeaderContext.d.ts +4 -1
  94. package/dist/render/components/PreviewHeaderContext.js +1 -1
  95. package/dist/render/lib/content/block-size.d.ts +6 -0
  96. package/dist/render/lib/content/block-size.js +1 -1
  97. package/dist/render/lib/document/blocks/general/Flex/render.js +1 -1
  98. package/dist/render/lib/document/blocks/general/ImageBlock/render.js +1 -1
  99. package/dist/render/lib/document/blocks/general/section-head-looks.js +2 -2
  100. package/dist/render/lib/document/blocks/general/section-to-box-row-parts.d.ts +6 -1
  101. package/dist/render/lib/document/blocks/general/section-to-box-row-parts.js +1 -1
  102. package/dist/render/lib/document/blocks/general/section-to-box-rows-head.js +1 -1
  103. package/dist/render/lib/document/blocks/general/section-to-box-rows.js +1 -1
  104. package/dist/render/lib/document/head-core-boxes.js +1 -1
  105. package/dist/render/lib/document/migrate-legacy.js +1 -1
  106. package/dist/render/lib/document/part-styles.js +2 -2
  107. package/dist/render/lib/document/passes/block-size.js +1 -1
  108. package/dist/render/lib/document/passes/section-animation.js +1 -1
  109. package/dist/render/lib/document/passes/section-padding.js +1 -1
  110. package/dist/render/lib/document/passes/section-width.js +1 -1
  111. package/dist/render/lib/document/slot-counts.js +1 -1
  112. package/dist/render/lib/document/slot-specs.js +1 -1
  113. package/dist/render/lib/sections/section-to-box.d.ts +2 -0
  114. package/dist/render/lib/sections/section-to-box.js +1 -1
  115. package/package.json +1 -1
@@ -1 +1 @@
1
- import{globalRegistry as c}from"../global-registry.js";import{COLLECTION_CARD_TEXT_REGIONS as l}from"./collection-card-text-regions.js";import{FAQ_TEXT_REGIONS as f}from"./faq-text-regions.js";import{CONTENTS_REGIONS as a}from"./contents-text-regions.js";import{SPEC_REGIONS as E}from"./spec-table-regions.js";const o={SpecTable:E,FAQ:f,Collections:l,Contents:a};function s(){return c("efficient.section-text-regions",()=>new Map)}function S(t){const r=s();for(const[e,n]of Object.entries(t)){if(Object.hasOwn(o,e))throw new Error(`lib/sections/section-text-regions: "${e}" is a builder section; its table is the builder's`);const i=r.get(e);if(i&&i!==n)throw new Error(`lib/sections/section-text-regions: "${e}" already has a table`);r.set(e,n)}}function m(t){return t?Object.hasOwn(o,t)?o[t]:s().get(t)??null:null}export{o as SECTION_TEXT_REGIONS,m as regionsForSection,S as registerSectionTextRegions};
1
+ import{globalRegistry as c}from"../global-registry.js";import{COLLECTION_CARD_TEXT_REGIONS as l}from"./collection-card-text-regions.js";import{FAQ_TEXT_REGIONS as f}from"./faq-text-regions.js";import{CONTENTS_REGIONS as E}from"./contents-text-regions.js";import{SPEC_REGIONS as a}from"./spec-table-regions.js";import{hasOwnEntry as T,ownEntry as m}from"../own-entry.js";const i={SpecTable:a,FAQ:f,Collections:l,Contents:E};function s(){return c("efficient.section-text-regions",()=>new Map)}function N(t){const o=s();for(const[e,r]of Object.entries(t)){if(T(i,e))throw new Error(`lib/sections/section-text-regions: "${e}" is a builder section; its table is the builder's`);const n=o.get(e);if(n&&n!==r)throw new Error(`lib/sections/section-text-regions: "${e}" already has a table`);o.set(e,r)}}function _(t){return t?m(i,t)??s().get(t)??null:null}export{i as SECTION_TEXT_REGIONS,_ as regionsForSection,N as registerSectionTextRegions};
@@ -50,6 +50,12 @@ export interface SiteThemeRow {
50
50
  site_gutter_phone?: number | null;
51
51
  block_gap?: number | null;
52
52
  block_gap_phone?: number | null;
53
+ corner_radius_unit?: string | null;
54
+ site_width_unit?: string | null;
55
+ site_gutter_unit?: string | null;
56
+ site_gutter_phone_unit?: string | null;
57
+ block_gap_unit?: string | null;
58
+ block_gap_phone_unit?: string | null;
53
59
  hero_background_follows_width?: boolean | null;
54
60
  section_background_width?: "full" | "content" | null;
55
61
  section_content_width?: "full" | "content" | null;
@@ -1,3 +1,3 @@
1
- import{ruleChecks as A}from"./rule.js";const E={text:[0,1,2],textarea:[0,1,2],plainText:[0,1,2],copyText:[0,1,2],plainTextarea:[0,1,2],linkField:[0],textList:[0,2],upload:[0,2],toggle:[0,3],select:[0,4],searchSelect:[0,3],segmented:[0],iconPickerRow:[0],shapePickerRow:[0],multiSelect:[0,2],slider:[0],colorInput:[0],focalPicker:[0],sizeField:[0],backgroundField:[0],cardImageBackgroundField:[0],placementField:[0],pxField:[0],dateTime:[0,2],edgePad:[0,3],blockSourceField:[0,1],cardRowField:[0],phPrev:[1],phHide:[1],phHideDefault:[1],group:[0],section:[0],panelNote:[0]},b=new Set(["value","render","defaultProps","fields","type","arrayFields","icon","shape"]),N=/(^|_)(PH|LABELS?|HINTS?|NOTES?|TITLES?|SWATCH_NAMES|GROUP|REASON|ROWS|PANELS|TABS|LINES)$/,O=new Set(["key","value","id","type","href","slug","kind","cell","set","icon","token","unit","path","url","src","className","variant","mode","side","align","role"]),$=new Set(["hint","coverHint","unsetLabel","emptyLabel","addLabel"]),P=new Set(["say","sayCount"]);function R(t){return/\p{L}/u.test(t)&&t.trim()===t&&t.length>0&&!/^[a-z0-9]+(?:-[a-z0-9]+)+$/.test(t)}const _=/(?:Key|Id|Slug|Href|Url|ClassName)$/;function w(t,p,s={}){const a=new Map,k=new Set(s.skip??[]),d=new Map((s.dataFiles??[]).map(e=>[e.path,e.keys])),u=(e,l)=>{if(!R(e))return;let S=a.get(e);S||a.set(e,S=new Set),S.add(l)},f=e=>e&&(t.isStringLiteral(e)||t.isNoSubstitutionTemplateLiteral(e))?e.text:null,o=e=>{if(!e)return[];const l=f(e);return l!==null?[l]:t.isParenthesizedExpression(e)?o(e.expression):t.isConditionalExpression(e)?[...o(e.whenTrue),...o(e.whenFalse)]:t.isBinaryExpression(e)&&(e.operatorToken.kind===t.SyntaxKind.QuestionQuestionToken||e.operatorToken.kind===t.SyntaxKind.BarBarToken)?[...o(e.left),...o(e.right)]:[]},y=e=>{const l=e.expression;return t.isIdentifier(l)?l.text:t.isPropertyAccessExpression(l)?l.name.text:null},g=e=>e.name&&(t.isIdentifier(e.name)||t.isStringLiteral(e.name))?e.name.text:null;for(const e of p){if(!/\.tsx?$/.test(e.path)||k.has(e.path))continue;const l=d.get(e.path),S=t.createSourceFile(e.path,e.text,t.ScriptTarget.Latest,!0,e.path.endsWith(".tsx")?t.ScriptKind.TSX:t.ScriptKind.TS),T=n=>{if(t.isCallExpression(n)){const r=y(n);if(r&&P.has(r))for(const c of n.arguments){const i=f(c);i!==null&&u(i,e.path)}else if(r&&t.isIdentifier(n.expression)&&Object.prototype.hasOwnProperty.call(E,r)){for(const c of E[r])for(const i of o(n.arguments[c]))u(i,e.path);if(r==="segmented"){const c=n.arguments[2];if(c&&t.isArrayLiteralExpression(c))for(const i of c.elements){const h=f(i);h!==null&&u(h,e.path)}}}}else if(t.isJsxAttribute(n)&&n.name.getText(S)==="label"&&n.initializer&&t.isStringLiteral(n.initializer)&&/^[A-Z]/.test(n.parent.parent.tagName.getText(S).split(".").pop()??""))u(n.initializer.text,e.path);else if(t.isObjectLiteralExpression(n)){const r=n.properties.filter(t.isPropertyAssignment),c=r.find(i=>g(i)==="label");if(c&&r.some(i=>b.has(g(i)??""))){const i=f(c.initializer);i!==null&&u(i,e.path)}for(const i of r){const h=g(i);if(h!==null&&$.has(h))for(const x of o(i.initializer))u(x,e.path)}if(l)for(const i of r){const h=g(i);if(h!==null&&(l==="*"||l.includes(h))){const x=f(i.initializer);x!==null&&u(x,e.path)}}}else if(t.isVariableDeclaration(n)&&t.isIdentifier(n.name)&&N.test(n.name.text)&&n.initializer&&!/CSSProperties|Style\b/.test(n.type?.getText(S)??"")){const r=f(n.initializer);r!==null&&!/^[a-z0-9_]+$/.test(r)&&u(r,e.path);const c=i=>{const h=t.isPropertyAssignment(i)?g(i)??"":"";if(t.isPropertyAssignment(i)&&!O.has(h)&&!_.test(h)){const x=f(i.initializer);x!==null&&u(x,e.path)}t.forEachChild(i,c)};c(n.initializer)}t.forEachChild(n,T)};T(S)}const m=new Map;for(const e of[...a.keys()].sort(L))s.known?.has(e)||m.set(e,[...a.get(e)].sort());return m}function L(t,p){return t<p?-1:t>p?1:0}function C(t,p){return["/**",...p.header.map(a=>a?` * ${a}`:" *")," */",`export const ${p.constant} = {`,...[...t].map(a=>` ${JSON.stringify(a)}: ${JSON.stringify(a)},`),"} as const;","",`/** Every phrase of {@link ${p.constant}}: what a host's words are keyed by. */`,`export type ${p.phraseType} = keyof typeof ${p.constant};`,""].join(`
2
- `)}function I(t,p,s){const{check:a,report:k}=A("editor words");{const f=[{path:"fixture.tsx",text:['const a = say("Delete {name}", { name });','const b = sayCount("{n} page", "{n} pages", n);','const c = text("Heading", "Main heading", "A hint");','const d = select("Align", icon, [{ label: "Left", value: "left" }], "left", "A note");','const e = segmented("Size", icon, ["Small", "Large"], "Small");','const SERIES_PH = { headTitle: "Section heading", link: "#" };','export const CORNER_SIDES_LABEL = "Corner sides";','const VIEW_TIER_LABEL = { desktop: "Desktop" };',"const DEFAULT_LABEL_KEY = 12;",'const FOCUS_HINT: CSSProperties = { display: "flex" };','const LAYOUT_TABS = "tabs";','const TEMPLATE_GROUP = { group: "Template pages", groupKey: "template" };','const a4 = <MenuLink label="text-fg" />;','const THEME_COLOUR_ROWS = [{ key: "fg", label: "Text color" }, { group: "Borders" }];','const a1 = <GroupLabel label="Wording" />;','const a2 = <input label="raw" />;','const a3 = say("Already listed");','const f = toggle("Show", false, "not-a-word");','const i = pxField("Corners", { min: 0, unsetLabel: on ? "Square" : "Round", hint: opts?.hint ?? "Rounds it." });','const g = { label: "Content", href: "/" };',"const h = say(`${x} colour`);"].join(`
3
- `)},{path:"names.ts",text:'export const N = [{ key: "openers", title: "Hero & intros", sections: [{ type: "Hero", label: "Hero Slideshow" }] }];'},{path:"block.tsx",text:'export const B = { label: "Banner", fields: {}, defaultProps: { cta: { label: "Shop now", href: "/" } } };'}],o=[...w(t,f,{dataFiles:[{path:"names.ts",keys:["title"]}],known:new Set(["Already listed"])}).keys()],y=["A hint","A note","Align","Banner","Borders","Corner sides","Corners","Round","Rounds it.","Square","Template pages","Text color","Wording","Desktop","Delete {name}","Heading","Hero & intros","Hero Slideshow","Large","Left","Main heading","Section heading","Show","Size","Small","{n} page","{n} pages"].sort(L);a("the reader reads every shape on a fixture, and no value, link or built phrase",JSON.stringify(o)===JSON.stringify(y),`read ${JSON.stringify(o)}`)}const d=w(t,p,s);a(`the source says at least ${s.floor} phrases`,d.size>=s.floor,`read ${d.size}: the reader broke, or the editor stopped saying its words through it`);const u=C(d.keys(),s.shape);if(!s.catalogue)a("the catalogue exists",!1,`run ${s.write}`);else{const f=s.catalogue.text===u;let o;if(!f){const y=new Set([...s.catalogue.text.matchAll(/^ {2}("(?:[^"\\]|\\.)*"): /gm)].map(e=>JSON.parse(e[1]))),g=[...d.keys()].filter(e=>!y.has(e)),m=[...y].filter(e=>!d.has(e));o=`${s.catalogue.path} is not what the source says — run ${s.write}. Missing ${g.length}${g.length?` (${g.slice(0,5).map(e=>JSON.stringify(e)).join(", ")}…)`:""}; no longer said ${m.length}${m.length?` (${m.slice(0,5).map(e=>JSON.stringify(e)).join(", ")}…)`:""}.`}a(`${s.catalogue.path} lists exactly the ${d.size} phrases the source says`,f,o)}return k()}export{E as BUILDER_WORDS,w as editorPhrases,I as editorWordsCatalogue,C as editorWordsCatalogueText,R as isPhrase};
1
+ import{ruleChecks as A}from"./rule.js";import{hasOwnEntry as b}from"../own-entry.js";const E={text:[0,1,2],textarea:[0,1,2],plainText:[0,1,2],copyText:[0,1,2],plainTextarea:[0,1,2],linkField:[0],textList:[0,2],upload:[0,2],toggle:[0,3],select:[0,4],searchSelect:[0,3],segmented:[0],iconPickerRow:[0],shapePickerRow:[0],multiSelect:[0,2],slider:[0],colorInput:[0],focalPicker:[0],sizeField:[0],backgroundField:[0],cardImageBackgroundField:[0],placementField:[0],pxField:[0],dateTime:[0,2],edgePad:[0,3],blockSourceField:[0,1],cardRowField:[0],phPrev:[1],phHide:[1],phHideDefault:[1],group:[0],section:[0],panelNote:[0]},N=new Set(["value","render","defaultProps","fields","type","arrayFields","icon","shape"]),O=/(^|_)(PH|LABELS?|HINTS?|NOTES?|TITLES?|SWATCH_NAMES|GROUP|REASON|ROWS|PANELS|TABS|LINES)$/,$=new Set(["key","value","id","type","href","slug","kind","cell","set","icon","token","unit","path","url","src","className","variant","mode","side","align","role"]),R=new Set(["hint","coverHint","unsetLabel","emptyLabel","addLabel"]),_=new Set(["say","sayCount"]);function C(t){return/\p{L}/u.test(t)&&t.trim()===t&&t.length>0&&!/^[a-z0-9]+(?:-[a-z0-9]+)+$/.test(t)}const P=/(?:Key|Id|Slug|Href|Url|ClassName)$/;function w(t,p,s={}){const a=new Map,k=new Set(s.skip??[]),d=new Map((s.dataFiles??[]).map(e=>[e.path,e.keys])),u=(e,l)=>{if(!C(e))return;let S=a.get(e);S||a.set(e,S=new Set),S.add(l)},f=e=>e&&(t.isStringLiteral(e)||t.isNoSubstitutionTemplateLiteral(e))?e.text:null,o=e=>{if(!e)return[];const l=f(e);return l!==null?[l]:t.isParenthesizedExpression(e)?o(e.expression):t.isConditionalExpression(e)?[...o(e.whenTrue),...o(e.whenFalse)]:t.isBinaryExpression(e)&&(e.operatorToken.kind===t.SyntaxKind.QuestionQuestionToken||e.operatorToken.kind===t.SyntaxKind.BarBarToken)?[...o(e.left),...o(e.right)]:[]},y=e=>{const l=e.expression;return t.isIdentifier(l)?l.text:t.isPropertyAccessExpression(l)?l.name.text:null},g=e=>e.name&&(t.isIdentifier(e.name)||t.isStringLiteral(e.name))?e.name.text:null;for(const e of p){if(!/\.tsx?$/.test(e.path)||k.has(e.path))continue;const l=d.get(e.path),S=t.createSourceFile(e.path,e.text,t.ScriptTarget.Latest,!0,e.path.endsWith(".tsx")?t.ScriptKind.TSX:t.ScriptKind.TS),T=n=>{if(t.isCallExpression(n)){const r=y(n);if(r&&_.has(r))for(const c of n.arguments){const i=f(c);i!==null&&u(i,e.path)}else if(r&&t.isIdentifier(n.expression)&&b(E,r)){for(const c of E[r])for(const i of o(n.arguments[c]))u(i,e.path);if(r==="segmented"){const c=n.arguments[2];if(c&&t.isArrayLiteralExpression(c))for(const i of c.elements){const h=f(i);h!==null&&u(h,e.path)}}}}else if(t.isJsxAttribute(n)&&n.name.getText(S)==="label"&&n.initializer&&t.isStringLiteral(n.initializer)&&/^[A-Z]/.test(n.parent.parent.tagName.getText(S).split(".").pop()??""))u(n.initializer.text,e.path);else if(t.isObjectLiteralExpression(n)){const r=n.properties.filter(t.isPropertyAssignment),c=r.find(i=>g(i)==="label");if(c&&r.some(i=>N.has(g(i)??""))){const i=f(c.initializer);i!==null&&u(i,e.path)}for(const i of r){const h=g(i);if(h!==null&&R.has(h))for(const x of o(i.initializer))u(x,e.path)}if(l)for(const i of r){const h=g(i);if(h!==null&&(l==="*"||l.includes(h))){const x=f(i.initializer);x!==null&&u(x,e.path)}}}else if(t.isVariableDeclaration(n)&&t.isIdentifier(n.name)&&O.test(n.name.text)&&n.initializer&&!/CSSProperties|Style\b/.test(n.type?.getText(S)??"")){const r=f(n.initializer);r!==null&&!/^[a-z0-9_]+$/.test(r)&&u(r,e.path);const c=i=>{const h=t.isPropertyAssignment(i)?g(i)??"":"";if(t.isPropertyAssignment(i)&&!$.has(h)&&!P.test(h)){const x=f(i.initializer);x!==null&&u(x,e.path)}t.forEachChild(i,c)};c(n.initializer)}t.forEachChild(n,T)};T(S)}const m=new Map;for(const e of[...a.keys()].sort(L))s.known?.has(e)||m.set(e,[...a.get(e)].sort());return m}function L(t,p){return t<p?-1:t>p?1:0}function z(t,p){return["/**",...p.header.map(a=>a?` * ${a}`:" *")," */",`export const ${p.constant} = {`,...[...t].map(a=>` ${JSON.stringify(a)}: ${JSON.stringify(a)},`),"} as const;","",`/** Every phrase of {@link ${p.constant}}: what a host's words are keyed by. */`,`export type ${p.phraseType} = keyof typeof ${p.constant};`,""].join(`
2
+ `)}function F(t,p,s){const{check:a,report:k}=A("editor words");{const f=[{path:"fixture.tsx",text:['const a = say("Delete {name}", { name });','const b = sayCount("{n} page", "{n} pages", n);','const c = text("Heading", "Main heading", "A hint");','const d = select("Align", icon, [{ label: "Left", value: "left" }], "left", "A note");','const e = segmented("Size", icon, ["Small", "Large"], "Small");','const SERIES_PH = { headTitle: "Section heading", link: "#" };','export const CORNER_SIDES_LABEL = "Corner sides";','const VIEW_TIER_LABEL = { desktop: "Desktop" };',"const DEFAULT_LABEL_KEY = 12;",'const FOCUS_HINT: CSSProperties = { display: "flex" };','const LAYOUT_TABS = "tabs";','const TEMPLATE_GROUP = { group: "Template pages", groupKey: "template" };','const a4 = <MenuLink label="text-fg" />;','const THEME_COLOUR_ROWS = [{ key: "fg", label: "Text color" }, { group: "Borders" }];','const a1 = <GroupLabel label="Wording" />;','const a2 = <input label="raw" />;','const a3 = say("Already listed");','const f = toggle("Show", false, "not-a-word");','const i = pxField("Corners", { min: 0, unsetLabel: on ? "Square" : "Round", hint: opts?.hint ?? "Rounds it." });','const g = { label: "Content", href: "/" };',"const h = say(`${x} colour`);"].join(`
3
+ `)},{path:"names.ts",text:'export const N = [{ key: "openers", title: "Hero & intros", sections: [{ type: "Hero", label: "Hero Slideshow" }] }];'},{path:"block.tsx",text:'export const B = { label: "Banner", fields: {}, defaultProps: { cta: { label: "Shop now", href: "/" } } };'}],o=[...w(t,f,{dataFiles:[{path:"names.ts",keys:["title"]}],known:new Set(["Already listed"])}).keys()],y=["A hint","A note","Align","Banner","Borders","Corner sides","Corners","Round","Rounds it.","Square","Template pages","Text color","Wording","Desktop","Delete {name}","Heading","Hero & intros","Hero Slideshow","Large","Left","Main heading","Section heading","Show","Size","Small","{n} page","{n} pages"].sort(L);a("the reader reads every shape on a fixture, and no value, link or built phrase",JSON.stringify(o)===JSON.stringify(y),`read ${JSON.stringify(o)}`)}const d=w(t,p,s);a(`the source says at least ${s.floor} phrases`,d.size>=s.floor,`read ${d.size}: the reader broke, or the editor stopped saying its words through it`);const u=z(d.keys(),s.shape);if(!s.catalogue)a("the catalogue exists",!1,`run ${s.write}`);else{const f=s.catalogue.text===u;let o;if(!f){const y=new Set([...s.catalogue.text.matchAll(/^ {2}("(?:[^"\\]|\\.)*"): /gm)].map(e=>JSON.parse(e[1]))),g=[...d.keys()].filter(e=>!y.has(e)),m=[...y].filter(e=>!d.has(e));o=`${s.catalogue.path} is not what the source says — run ${s.write}. Missing ${g.length}${g.length?` (${g.slice(0,5).map(e=>JSON.stringify(e)).join(", ")}…)`:""}; no longer said ${m.length}${m.length?` (${m.slice(0,5).map(e=>JSON.stringify(e)).join(", ")}…)`:""}.`}a(`${s.catalogue.path} lists exactly the ${d.size} phrases the source says`,f,o)}return k()}export{E as BUILDER_WORDS,w as editorPhrases,F as editorWordsCatalogue,z as editorWordsCatalogueText,C as isPhrase};
@@ -1,5 +1,5 @@
1
- import{ruleChecks as u}from"./rule.js";const p=e=>/\.(ts|tsx|mts|cts)$/.test(e)&&!e.endsWith(".d.ts");function h(e,t){const n=new Set,l=o=>{if(e.isIdentifier(o))n.add(o.text);else for(const r of o.elements)e.isOmittedExpression(r)||l(r.name)};for(const o of t.statements)if(e.isVariableStatement(o))for(const r of o.declarationList.declarations)l(r.name);else(e.isFunctionDeclaration(o)||e.isClassDeclaration(o)||e.isEnumDeclaration(o))&&o.name&&n.add(o.name.text);return n}function g(e,t){let n=t;for(;;)if(e.isParenthesizedExpression(n)||e.isNonNullExpression(n)||e.isAsExpression(n))n=n.expression;else if(e.isPropertyAccessExpression(n)||e.isElementAccessExpression(n))n=n.expression;else if(e.isCallExpression(n))n=n.expression;else break;return e.isIdentifier(n)?n.text:null}function x(e,t){return e.isBinaryExpression(t)&&t.operatorToken.kind>=e.SyntaxKind.FirstAssignment&&t.operatorToken.kind<=e.SyntaxKind.LastAssignment?t.left:e.isPrefixUnaryExpression(t)||e.isPostfixUnaryExpression(t)?t.operand:e.isVoidExpression(t)||e.isAwaitExpression(t)?t.expression:t}function f(e,t){const n=e.createSourceFile(t.path,t.text,e.ScriptTarget.Latest,!0,t.path.endsWith("x")?e.ScriptKind.TSX:e.ScriptKind.TS),l=h(e,n),o=[],r=(i,a)=>o.push({file:t.path,line:n.getLineAndCharacterOfPosition(i.getStart(n)).line+1,what:a});for(const i of n.statements){if(e.isImportDeclaration(i)){const a=i.moduleSpecifier.text;!i.importClause&&!a.endsWith(".css")&&r(i,`imports "${a}" for what it does`);continue}if(e.isExpressionStatement(i)){if(e.isStringLiteral(i.expression))continue;const a=g(e,x(e,i.expression));(!a||!l.has(a))&&r(i,`${i.getText(n).split(`
2
- `)[0].slice(0,80)}`);continue}e.isVariableStatement(i)||e.isFunctionDeclaration(i)||e.isClassDeclaration(i)||e.isInterfaceDeclaration(i)||e.isTypeAliasDeclaration(i)||e.isEnumDeclaration(i)||e.isModuleDeclaration(i)||e.isExportDeclaration(i)||e.isExportAssignment(i)||e.isImportEqualsDeclaration(i)||e.isEmptyStatement(i)||r(i,`a top-level ${e.SyntaxKind[i.kind]}`)}return o}function S(e,t,n){const{check:l,report:o}=u("no work at import"),r=f(e,{path:"fixture.ts",text:['"use client";','import "./polyfill";','import "./look.css";','import { register, lib } from "./lib";',"const CACHE = new Map<string, number>();",'CACHE.set("a", 1);',"export const TABLE: Record<string, number> = {};","TABLE.b = 2;",'register("x");',"lib.hook(() => 0);","window.ready = true;",'if (typeof window !== "undefined") CACHE.clear();'].join(`
3
- `)});l("the reader finds a side-effect import, a call and a write through imported or global names, and a top-level if — and nothing else",JSON.stringify(r.map(s=>s.line))===JSON.stringify([2,9,10,11,12]),JSON.stringify(r));const i=t.filter(s=>p(s.path));l(`read the modules (${i.length})`,i.length>0,"found no module to read — this rule is not measuring anything");const a=i.flatMap(s=>f(e,s)),c=a.filter(s=>!Object.hasOwn(n,s.file));l(`no module does work at import that reaches past itself, outside the ${Object.keys(n).length} named (${i.length} modules)`,c.length===0,`${c.length} statement(s) a bundler may drop with their module once it is unused. Make it a function its user calls, or name the file with its reason:
1
+ import{ruleChecks as p}from"./rule.js";import{hasOwnEntry as u}from"../own-entry.js";const h=e=>/\.(ts|tsx|mts|cts)$/.test(e)&&!e.endsWith(".d.ts");function g(e,t){const n=new Set,l=o=>{if(e.isIdentifier(o))n.add(o.text);else for(const r of o.elements)e.isOmittedExpression(r)||l(r.name)};for(const o of t.statements)if(e.isVariableStatement(o))for(const r of o.declarationList.declarations)l(r.name);else(e.isFunctionDeclaration(o)||e.isClassDeclaration(o)||e.isEnumDeclaration(o))&&o.name&&n.add(o.name.text);return n}function x(e,t){let n=t;for(;;)if(e.isParenthesizedExpression(n)||e.isNonNullExpression(n)||e.isAsExpression(n))n=n.expression;else if(e.isPropertyAccessExpression(n)||e.isElementAccessExpression(n))n=n.expression;else if(e.isCallExpression(n))n=n.expression;else break;return e.isIdentifier(n)?n.text:null}function E(e,t){return e.isBinaryExpression(t)&&t.operatorToken.kind>=e.SyntaxKind.FirstAssignment&&t.operatorToken.kind<=e.SyntaxKind.LastAssignment?t.left:e.isPrefixUnaryExpression(t)||e.isPostfixUnaryExpression(t)?t.operand:e.isVoidExpression(t)||e.isAwaitExpression(t)?t.expression:t}function f(e,t){const n=e.createSourceFile(t.path,t.text,e.ScriptTarget.Latest,!0,t.path.endsWith("x")?e.ScriptKind.TSX:e.ScriptKind.TS),l=g(e,n),o=[],r=(i,a)=>o.push({file:t.path,line:n.getLineAndCharacterOfPosition(i.getStart(n)).line+1,what:a});for(const i of n.statements){if(e.isImportDeclaration(i)){const a=i.moduleSpecifier.text;!i.importClause&&!a.endsWith(".css")&&r(i,`imports "${a}" for what it does`);continue}if(e.isExpressionStatement(i)){if(e.isStringLiteral(i.expression))continue;const a=x(e,E(e,i.expression));(!a||!l.has(a))&&r(i,`${i.getText(n).split(`
2
+ `)[0].slice(0,80)}`);continue}e.isVariableStatement(i)||e.isFunctionDeclaration(i)||e.isClassDeclaration(i)||e.isInterfaceDeclaration(i)||e.isTypeAliasDeclaration(i)||e.isEnumDeclaration(i)||e.isModuleDeclaration(i)||e.isExportDeclaration(i)||e.isExportAssignment(i)||e.isImportEqualsDeclaration(i)||e.isEmptyStatement(i)||r(i,`a top-level ${e.SyntaxKind[i.kind]}`)}return o}function k(e,t,n){const{check:l,report:o}=p("no work at import"),r=f(e,{path:"fixture.ts",text:['"use client";','import "./polyfill";','import "./look.css";','import { register, lib } from "./lib";',"const CACHE = new Map<string, number>();",'CACHE.set("a", 1);',"export const TABLE: Record<string, number> = {};","TABLE.b = 2;",'register("x");',"lib.hook(() => 0);","window.ready = true;",'if (typeof window !== "undefined") CACHE.clear();'].join(`
3
+ `)});l("the reader finds a side-effect import, a call and a write through imported or global names, and a top-level if — and nothing else",JSON.stringify(r.map(s=>s.line))===JSON.stringify([2,9,10,11,12]),JSON.stringify(r));const i=t.filter(s=>h(s.path));l(`read the modules (${i.length})`,i.length>0,"found no module to read — this rule is not measuring anything");const a=i.flatMap(s=>f(e,s)),c=a.filter(s=>!u(n,s.file));l(`no module does work at import that reaches past itself, outside the ${Object.keys(n).length} named (${i.length} modules)`,c.length===0,`${c.length} statement(s) a bundler may drop with their module once it is unused. Make it a function its user calls, or name the file with its reason:
4
4
  `+c.map(s=>` ${s.file}:${s.line} ${s.what}`).join(`
5
- `));const m=new Set(a.map(s=>s.file)),d=Object.keys(n).filter(s=>!m.has(s));return l("every named file still does the work it is named for",d.length===0,`named, but doing no work at import now: ${d.join(", ")} — take the line out`),o()}export{f as importTimeWork,S as noImportTimeWork};
5
+ `));const m=new Set(a.map(s=>s.file)),d=Object.keys(n).filter(s=>!m.has(s));return l("every named file still does the work it is named for",d.length===0,`named, but doing no work at import now: ${d.join(", ")} — take the line out`),o()}export{f as importTimeWork,k as noImportTimeWork};
@@ -1,6 +1,6 @@
1
1
  import type * as TS from "typescript";
2
2
  import { type RuleReport, type SourceFile } from "./rule.js";
3
- export type OptionRowShape = "a" | "b" | "c";
3
+ export type OptionRowShape = "a" | "b" | "c" | "d" | "e";
4
4
  export interface OptionRowPlace {
5
5
  readonly file: string;
6
6
  readonly job: string;
@@ -1 +1 @@
1
- import{ruleChecks as R}from"./rule.js";import{programOf as T}from"./support/ts-program.js";const j="system page, not a merchant section",k="previous and next arrows, not a choice among rows",N=[j,k],_=["aria-expanded"],F=new Set(["tab","radio","option","checkbox","switch"]),P="CardTemplateRows",w=(e,t)=>!!t&&(e.isArrowFunction(t)||e.isFunctionExpression(t));function A(e,t){return e.isParenthesizedExpression(t)||e.isAsExpression(t)||e.isNonNullExpression(t)||e.isSatisfiesExpression(t)?A(e,t.expression):t}function b(e,t){const n=A(e,t);if(w(e,n))return n;if(e.isCallExpression(n)){const i=n.expression.getText().replace(/^React\./,"");if((i==="memo"||i==="forwardRef")&&n.arguments[0])return b(e,n.arguments[0])}return null}function $(e,t,n){let i=t.getSymbolAtLocation(n);i&&i.flags&e.SymbolFlags.Alias&&(i=t.getAliasedSymbol(i));const r=i?.declarations?.[0];if(!r)return null;if(e.isFunctionDeclaration(r)&&r.body)return{fn:r,name:r.name?.text??i.name};if(e.isVariableDeclaration(r)&&r.initializer){const l=b(e,r.initializer);if(l)return{fn:l,name:r.name.getText()}}return null}function C(e,t,n){if(!e.isCallExpression(n)||!e.isPropertyAccessExpression(n.expression))return null;const i=n.expression.name.text,r=i==="map"||i==="flatMap"?n.arguments[0]:i==="from"&&n.expression.expression.getText()==="Array"?n.arguments[1]:void 0;if(!r)return null;const l=b(e,r);if(l)return{fn:l,via:""};if(e.isIdentifier(r)){const c=$(e,t,r);if(c)return{fn:c.fn,via:c.name}}return null}function L(e,t){const n=t?.initializer;return n?e.isStringLiteral(n)?n.text:e.isJsxExpression(n)&&n.expression&&e.isStringLiteralLike(n.expression)?n.expression.text:null:null}function v(e,t){const n=new Map;for(const s of t.attributes.properties)e.isJsxAttribute(s)&&n.set(s.name.getText(),s);const i=t.tagName.getText(),r=L(e,n.get("role")),l=r!==null&&F.has(r);return!(i==="button"||i.endsWith(".button"))&&!l||_.some(s=>n.has(s))?null:n.has("aria-pressed")?"a":l||n.has("aria-checked")||n.has("aria-selected")?"b":"c"}function z(e,t){for(let n=t.parent;n;n=n.parent){if(e.isFunctionDeclaration(n)&&n.name)return n.name.text;if(w(e,n)){let i=n.parent;for(;e.isCallExpression(i)||e.isParenthesizedExpression(i);)i=i.parent;if(e.isVariableDeclaration(i)&&e.isIdentifier(i.name))return i.name.text}}return"(file)"}function I(e,t,n){const i=T(e,t),r=i.getTypeChecker(),l=[];for(const s of t){if(!n(s.path))continue;const u=i.getSourceFile(`/${s.path}`);if(!u)continue;const x=d=>{const p=C(e,r,d);if(p?.fn.body){const o=z(e,d),m=new Set([p.fn]),E=a=>{const f=$(e,r,a);!f?.fn.body||m.has(f.fn)||(m.add(f.fn),g(f.fn.body,f.name))},g=(a,f)=>{if(!(a!==p.fn.body&&C(e,r,a))){if(e.isJsxOpeningElement(a)||e.isJsxSelfClosingElement(a)){const h=a.tagName.getText(),S=v(e,a);if(S){const y=a.getSourceFile();l.push({file:s.path,job:f?`${o} → ${f}`:o,line:y.getLineAndCharacterOfPosition(a.getStart(y)).line+1,shape:S})}else/^[A-Z]/.test(h)&&h!==P&&E(a.tagName)}e.isCallExpression(a)&&e.isIdentifier(a.expression)&&E(a.expression),a.forEachChild(h=>g(h,f))}};g(p.fn.body,p.via)}d.forEachChild(x)};x(u)}const c=new Set;return l.filter(s=>{const u=`${s.file}:${s.line}:${s.job}:${s.shape}`;return c.has(u)?!1:(c.add(u),!0)})}function O(e,t){return t.some(n=>n.file===e.file&&n.job===e.job&&n.shape===e.shape)}function M(e,t,n){const i=I(e,t,n.parts),{check:r,report:l}=R("no hard-coded option rows"),c=o=>`${o.file} ${o.job} (${o.shape})`,s=i.filter(o=>!O(o,n.exempt));r("every hard-coded option row in the storefront parts is in the exemption list",s.length===0,s.map(o=>`${o.file}:${o.line} ${o.job} (${o.shape})`).join(", "));const u=n.exempt.filter(o=>!i.some(m=>O(m,[o])));r("every exemption names a place still found (delete-only)",u.length===0,u.map(c).join(", "));const x=n.exempt.filter(o=>!o.reason.trim()||!o.owner.trim()||!(o.until==="none"?N.includes(o.reason):/^\d{4}-\d{2}-\d{2}$/.test(o.until)));r("every exemption has a reason, an owner and a date",x.length===0,x.map(c).join(", "));const d=n.exempt.filter(o=>o.until!=="none"&&o.until<n.today);r(`no exemption is past its date (today ${n.today})`,d.length===0,d.map(o=>`${c(o)} until ${o.until}`).join(", "));const p=n.exempt.map(c);return r("no exemption is listed twice",new Set(p).size===p.length),{report:l(),places:i}}export{_ as NOT_A_PICKER,k as STEP_ARROWS_REASON,j as SYSTEM_PAGE_REASON,I as hardCodedOptionRows,M as noHardCodedOptionRows,O as optionRowExempt};
1
+ import{ruleChecks as B}from"./rule.js";import{programOf as G}from"./support/ts-program.js";const V="system page, not a merchant section",Y="previous and next arrows, not a choice among rows",Z=[V,Y],_=["aria-expanded"],P=new Set(["tab","radio","option","checkbox","switch","menuitemradio"]),j=["onClick","onMouseDown","onPointerDown"],F=["aria-selected","aria-current"],K="aria-hidden",y="aria-pressed",b="aria-checked",D=["checkbox","radio"],L="checked",I="a",q="CardTemplateRows",J=(e,t)=>!!t&&(e.isArrowFunction(t)||e.isFunctionExpression(t));function w(e,t){return e.isParenthesizedExpression(t)||e.isAsExpression(t)||e.isNonNullExpression(t)||e.isSatisfiesExpression(t)?w(e,t.expression):t}function C(e,t){const n=w(e,t);if(J(e,n))return n;if(e.isCallExpression(n)){const i=n.expression.getText().replace(/^React\./,"");if((i==="memo"||i==="forwardRef")&&n.arguments[0])return C(e,n.arguments[0])}return null}function M(e,t,n){let i=t.getSymbolAtLocation(n);i&&i.flags&e.SymbolFlags.Alias&&(i=t.getAliasedSymbol(i));const r=i?.declarations?.[0];if(!r)return null;if(e.isFunctionDeclaration(r)&&r.body)return{fn:r,name:r.name?.text??i.name};if(e.isVariableDeclaration(r)&&r.initializer){const s=C(e,r.initializer);if(s)return{fn:s,name:r.name.getText()}}return null}function z(e,t,n){if(!e.isCallExpression(n)||!e.isPropertyAccessExpression(n.expression))return null;const i=n.expression.name.text,r=i==="map"||i==="flatMap"?n.arguments[0]:i==="from"&&n.expression.expression.getText()==="Array"?n.arguments[1]:void 0;if(!r)return null;const s=C(e,r);if(s)return{fn:s,via:""};if(e.isIdentifier(r)){const l=M(e,t,r);if(l)return{fn:l.fn,via:l.name}}return null}function k(e,t){const n=t?.initializer;return n?e.isStringLiteral(n)?n.text:e.isJsxExpression(n)&&n.expression&&e.isStringLiteralLike(n.expression)?n.expression.text:null:null}function H(e,t){return new Map([...e??[],...t])}const Q=e=>`${e.getSourceFile().fileName}:${e.pos}`;function U(e,t,n){return t==="role"?P.has(k(e,n)??"")?"role:choice":"role:other":t==="type"?D.includes(k(e,n)??"")?"type:tick":null:t==="className"?v(e,n)?"className:picked":null:_.includes(t)?"not-a-picker":F.includes(t)?"pick":j.includes(t)?"press":t===y||t===b||t===L?t:t.startsWith("aria-")&&t!==K?"aria:other":null}function X(e,t,n){const i=new Set([...n??[]].map(([r,s])=>U(e,r,s)).filter(r=>r!==null));return[Q(t),...[...i].sort()].join("|")}const ee=new Set;function A(e,t){const n=new Map;for(const i of t.attributes.properties)e.isJsxAttribute(i)&&n.set(i.name.getText(),i);return n}function ne(e,t,n,i,r){const s=H(i,A(e,t)),l=t.tagName.getText();if(_.some(o=>s.has(o)))return null;const a=k(e,s.get("role")),c=a!==null&&P.has(a),h=l==="button"||l.endsWith(".button");let p=!1;if(!h&&!c){if(!n||!/^[a-z]/.test(l))return null;if(l==="input"&&ie(e,s))return r?"e":null;if(p=!(l===I||l.endsWith(`.${I}`))&&j.some(E=>s.has(E)),!p&&!s.has(y)&&!s.has(b))return null}return s.has(y)?"a":c||s.has(b)||F.some(o=>s.has(o))?"b":!p||![...s.keys()].some(o=>o==="role"||o.startsWith("aria-")&&o!==K)?"c":v(e,s.get("className"))?"d":null}function te(e,t){const n=new Set,i=l=>{if(!l)return;const a=w(e,l);e.isJsxElement(a)?n.add(a.openingElement):e.isJsxSelfClosingElement(a)?n.add(a):e.isJsxFragment(a)?a.children.forEach(c=>e.isJsxElement(c)?n.add(c.openingElement):e.isJsxSelfClosingElement(c)&&n.add(c)):e.isConditionalExpression(a)?(i(a.whenTrue),i(a.whenFalse)):e.isBinaryExpression(a)&&a.operatorToken.kind===e.SyntaxKind.AmpersandAmpersandToken&&i(a.right)},r=t.body;if(!r)return n;if(!e.isBlock(r))return i(r),n;const s=l=>{e.isReturnStatement(l)&&i(l.expression),!e.isFunctionLike(l)&&l.forEachChild(s)};return r.forEachChild(s),n}function ie(e,t){return D.includes(k(e,t.get("type"))??"")&&t.has(L)}function v(e,t){const n=t?.initializer;if(!n||!e.isJsxExpression(n)||!n.expression)return!1;let i=!1;const r=s=>{if(!(i||e.isFunctionLike(s))){if(e.isConditionalExpression(s)||e.isBinaryExpression(s)&&s.operatorToken.kind===e.SyntaxKind.AmpersandAmpersandToken){i=!0;return}s.forEachChild(r)}};return r(n.expression),i}function re(e,t){for(let n=t.parent;n;n=n.parent){if(e.isFunctionDeclaration(n)&&n.name)return n.name.text;if(J(e,n)){let i=n.parent;for(;e.isCallExpression(i)||e.isParenthesizedExpression(i);)i=i.parent;if(e.isVariableDeclaration(i)&&e.isIdentifier(i.name))return i.name.text}}return"(file)"}function oe(e,t,n){const i=G(e,t),r=i.getTypeChecker(),s=[];for(const a of t){if(!n(a.path))continue;const c=i.getSourceFile(`/${a.path}`);if(!c)continue;const h=p=>{const x=z(e,r,p);if(x?.fn.body){const o=re(e,p),E=new Set([x.fn]),O=new Set,R=(f,g,d)=>{const u=M(e,r,f);if(!u?.fn.body||u.fn===x.fn)return;if(!g){if(E.has(u.fn))return;E.add(u.fn),S(u.fn.body,u.name,{roots:ee,call:d});return}const m=X(e,u.fn,d);O.has(m)||(O.add(m),S(u.fn.body,u.name,{roots:te(e,u.fn),call:d}))},S=(f,g,d)=>{if(f!==x.fn.body&&z(e,r,f))return;const u=d===null||d.roots.has(f);if(e.isJsxOpeningElement(f)||e.isJsxSelfClosingElement(f)){const m=f.tagName.getText(),T=d!==null&&d.roots.has(f),$=ne(e,f,u,T?d.call:void 0,d===null);if($){const N=f.getSourceFile();s.push({file:a.path,job:g?`${o} → ${g}`:o,line:N.getLineAndCharacterOfPosition(f.getStart(N)).line+1,shape:$})}else/^[A-Z]/.test(m)&&m!==q&&R(f.tagName,u,T?H(d.call,A(e,f)):A(e,f))}e.isCallExpression(f)&&e.isIdentifier(f.expression)&&R(f.expression,u),f.forEachChild(m=>S(m,g,d))};S(x.fn.body,x.via,null)}p.forEachChild(h)};h(c)}const l=new Set;return s.filter(a=>{const c=`${a.file}:${a.line}:${a.job}:${a.shape}`;return l.has(c)?!1:(l.add(c),!0)})}function W(e,t){return t.some(n=>n.file===e.file&&n.job===e.job&&n.shape===e.shape)}function le(e,t,n){const i=oe(e,t,n.parts),{check:r,report:s}=B("no hard-coded option rows"),l=o=>`${o.file} ${o.job} (${o.shape})`,a=i.filter(o=>!W(o,n.exempt));r("every hard-coded option row in the storefront parts is in the exemption list",a.length===0,a.map(o=>`${o.file}:${o.line} ${o.job} (${o.shape})`).join(", "));const c=n.exempt.filter(o=>!i.some(E=>W(E,[o])));r("every exemption names a place still found (delete-only)",c.length===0,c.map(l).join(", "));const h=n.exempt.filter(o=>!o.reason.trim()||!o.owner.trim()||!(o.until==="none"?Z.includes(o.reason):/^\d{4}-\d{2}-\d{2}$/.test(o.until)));r("every exemption has a reason, an owner and a date",h.length===0,h.map(l).join(", "));const p=n.exempt.filter(o=>o.until!=="none"&&o.until<n.today);r(`no exemption is past its date (today ${n.today})`,p.length===0,p.map(o=>`${l(o)} until ${o.until}`).join(", "));const x=n.exempt.map(l);return r("no exemption is listed twice",new Set(x).size===x.length),{report:s(),places:i}}export{_ as NOT_A_PICKER,Y as STEP_ARROWS_REASON,V as SYSTEM_PAGE_REASON,oe as hardCodedOptionRows,le as noHardCodedOptionRows,W as optionRowExempt};
@@ -0,0 +1,26 @@
1
+ import type * as TS from "typescript";
2
+ import { type RuleReport, type SourceFile } from "./rule.js";
3
+ export type OwnKeyPlace = {
4
+ readonly file: string;
5
+ readonly line: number;
6
+ readonly map: string;
7
+ readonly kind: "[]" | "in" | "{}";
8
+ };
9
+ export type OwnKeyExemption = {
10
+ readonly file: string;
11
+ readonly map: string;
12
+ readonly lines: readonly number[];
13
+ readonly reason: string;
14
+ readonly owner: string;
15
+ readonly until: string;
16
+ };
17
+ export declare function repositoryProgram(ts: typeof TS, root: string, files: readonly SourceFile[]): TS.Program;
18
+ export declare function bareRegistryReads(ts: typeof TS, root: string, files: readonly SourceFile[], scan: (path: string) => boolean): OwnKeyPlace[];
19
+ export declare function ownKeyReads(ts: typeof TS, root: string, files: readonly SourceFile[], opts: {
20
+ readonly scan: (path: string) => boolean;
21
+ readonly exempt: readonly OwnKeyExemption[];
22
+ readonly today: string;
23
+ }): {
24
+ report: RuleReport;
25
+ places: OwnKeyPlace[];
26
+ };
@@ -0,0 +1,7 @@
1
+ import{ruleChecks as C}from"./rule.js";const E=new Map;function j(e,r,t){const a=n=>`${r}/src/${n}`,l=new Map(t.filter(n=>/\.(tsx?|mts)$/.test(n.path)&&!n.path.endsWith(".d.ts")).map(n=>[a(n.path),n.text])),o=e.getParsedCommandLineOfConfigFile(`${r}/tsconfig.json`,{},{...e.sys,onUnRecoverableConfigFileDiagnostic:n=>{throw new Error(`own-key reads: ${r}/tsconfig.json: ${e.flattenDiagnosticMessageText(n.messageText,`
2
+ `)}`)}});if(!o)throw new Error(`own-key reads: cannot read ${r}/tsconfig.json`);const i={...o.options,noEmit:!0},c=e.createCompilerHost(i,!0),d=c.fileExists.bind(c),y=c.readFile.bind(c),m=c.getSourceFile.bind(c);c.fileExists=n=>l.has(n)||d(n),c.readFile=n=>l.get(n)??y(n),c.getSourceFile=(n,f,g)=>{const h=l.get(n);return h!==void 0?e.createSourceFile(n,h,f,!0):(E.has(n)||E.set(n,m(n,f,g,!1)),E.get(n))};const u=o.errors.filter(n=>n.code!==18003);if(u.length)throw new Error(`own-key reads: ${r}/tsconfig.json: ${u.map(n=>e.flattenDiagnosticMessageText(n.messageText,`
3
+ `)).join("; ")}`);if(i.noLib)throw new Error(`own-key reads: ${r}/tsconfig.json sets noLib: the rule needs the lib to type a key (no lib)`);const s=e.createProgram({rootNames:[...l.keys()],options:i,host:c}),p=s.getSourceFiles().filter(n=>s.isSourceFileDefaultLibrary(n));if(p.length===0)throw new Error(`own-key reads: the program at ${r} loaded no lib file (no lib)`);if(!p.some(n=>/lib\.es(next|\d{4}|5)\b/.test(n.fileName)))throw new Error(`own-key reads: the program at ${r} loaded no ES lib (no ES lib): an array, a string or a lib call would have no type`);return s}const N=/\.(css|scss|svg|png|jpe?g|gif|webp|woff2?)$/;function A(e,r,t,a){const l=[],o=i=>{(e.isImportDeclaration(i)||e.isExportDeclaration(i))&&i.moduleSpecifier&&e.isStringLiteral(i.moduleSpecifier)?l.push(i.moduleSpecifier):e.isExternalModuleReference(i)&&e.isStringLiteral(i.expression)?l.push(i.expression):e.isCallExpression(i)&&i.expression.kind===e.SyntaxKind.ImportKeyword&&i.arguments[0]&&e.isStringLiteral(i.arguments[0])?l.push(i.arguments[0]):e.isImportTypeNode(i)&&e.isLiteralTypeNode(i.argument)&&e.isStringLiteral(i.argument.literal)&&l.push(i.argument.literal),e.forEachChild(i,o)};o(t);for(const i of l)if(!N.test(i.text)&&!r.getSymbolAtLocation(i))throw new Error(`own-key reads: ${a}: import "${i.text}" does not resolve`)}function L(e,r){return(r.isUnion()?r.types:[r]).some(a=>(a.flags&(e.TypeFlags.Undefined|e.TypeFlags.Null))===0&&a.getStringIndexType()!==void 0)}function b(e,r){let t=r;for(;e.isParenthesizedExpression(t);)t=t.expression;return t}function D(e,r,t){let a=null;if(e.isIdentifier(t)?a=t:e.isPropertyAccessExpression(t)&&e.isIdentifier(t.expression)&&r.getSymbolAtLocation(t.expression)?.declarations?.some(e.isNamespaceImport)&&(a=t.name),!a)return null;let l=r.getSymbolAtLocation(a);l&&l.flags&e.SymbolFlags.Alias&&(l=r.getAliasedSymbol(l));const o=l?.valueDeclaration;if(o&&e.isEnumDeclaration(o))return e.isSourceFile(o.parent)?o:null;if(!o||!e.isVariableDeclaration(o)||!e.isVariableDeclarationList(o.parent))return null;const i=o.parent.parent;return e.isVariableStatement(i)&&e.isSourceFile(i.parent)?o:null}function S(e,r,t){let a=t,l=!1;for(;e.isParenthesizedExpression(a)||e.isAsExpression(a)||e.isNonNullExpression(a)||e.isSatisfiesExpression(a);)e.isAsExpression(a)&&L(e,r.getTypeFromTypeNode(a.type))&&(l=!0),a=a.expression;const o=D(e,r,a);return o?{d:o,indexed:l||e.isVariableDeclaration(o)&&L(e,r.getTypeAtLocation(o.name))}:null}function T(e,r,t){if(e.isTemplateExpression(b(e,t)))return!0;const a=e.TypeFlags.String|e.TypeFlags.TemplateLiteral|e.TypeFlags.StringMapping|e.TypeFlags.Any,l=new Set,o=i=>{if(l.has(i))return!1;if(l.add(i),(i.flags&a)!==0)return!0;if(i.isUnion()||i.isIntersection())return i.types.some(o);if((i.flags&(e.TypeFlags.TypeParameter|e.TypeFlags.Index|e.TypeFlags.IndexedAccess|e.TypeFlags.Conditional|e.TypeFlags.Substitution))!==0){const c=r.getBaseConstraintOfType(i);return!!c&&c!==i&&o(c)}return!1};return o(r.getTypeAtLocation(t))}function P(e,r){const t=r.parent;return e.isDeleteExpression(t)?!0:e.isBinaryExpression(t)&&t.left===r&&t.operatorToken.kind===e.SyntaxKind.EqualsToken}function I(e,r){return e.isObjectBindingPattern(r)?r.elements.flatMap(t=>t.propertyName&&e.isComputedPropertyName(t.propertyName)?[t.propertyName.expression]:[]):e.isObjectLiteralExpression(r)?r.properties.flatMap(t=>t.name&&e.isComputedPropertyName(t.name)?[t.name.expression]:[]):[]}function M(e,r,t,a){const l=j(e,r,t),o=l.getTypeChecker(),i=[];for(const c of t){if(!a(c.path))continue;const d=l.getSourceFile(`${r}/src/${c.path}`);if(!d)throw new Error(`own-key reads: ${c.path} is not in the program`);A(e,o,d,c.path);const y=(s,p,n)=>i.push({file:c.path,line:d.getLineAndCharacterOfPosition(s.getStart()).line+1,map:p.name.getText(),kind:n}),m=(s,p)=>{const n=S(e,o,p);if(n?.indexed)for(const f of I(e,s))T(e,o,f)&&y(f,n.d,"{}")},u=s=>{if(e.isElementAccessExpression(s)&&!P(e,s)){const p=S(e,o,s.expression);p?.indexed&&T(e,o,s.argumentExpression)&&y(s,p.d,"[]")}else if(e.isBinaryExpression(s)&&s.operatorToken.kind===e.SyntaxKind.InKeyword){const p=S(e,o,s.right);p&&T(e,o,s.left)&&y(s,p.d,"in")}else(e.isVariableDeclaration(s)||e.isParameter(s))&&s.initializer&&e.isObjectBindingPattern(s.name)?m(s.name,s.initializer):e.isBinaryExpression(s)&&s.operatorToken.kind===e.SyntaxKind.EqualsToken&&e.isObjectLiteralExpression(b(e,s.left))&&m(b(e,s.left),s.right);e.forEachChild(s,u)};u(d)}return i}function B(e,r,t,a){const l=M(e,r,t,a.scan),o=C("own-key reads"),i=n=>{const f=new Map;for(const g of n)f.set(g,(f.get(g)??0)+1);return f},c=new Map;for(const n of l)c.set(`${n.file}|${n.map}`,[...c.get(`${n.file}|${n.map}`)??[],n.line]);const d=new Map;for(const n of a.exempt)d.set(`${n.file}|${n.map}`,[...d.get(`${n.file}|${n.map}`)??[],...n.lines]);const y=new Map(l.map(n=>[`${n.file}|${n.map}|${n.line}`,n.kind])),m=[],u=[];for(const n of new Set([...c.keys(),...d.keys()])){const[f,g]=n.split("|"),h=i(c.get(n)??[]),k=i(d.get(n)??[]);for(const[x,w]of h){const $=w-(k.get(x)??0),F=y.get(`${n}|${x}`),v=F==="in"?`k in ${g}`:F==="{}"?`{ [k]: v } = ${g}`:`${g}[k]`;$>0&&m.push(`${f}:${x} ${v}${$>1?` (${$} reads)`:""}: read it with ownEntry / hasOwnEntry (lib/own-entry)`)}for(const[x,w]of k)w-(h.get(x)??0)>0&&u.push(`${f}:${x} ${g}: listed ${w}, found ${h.get(x)??0}`)}o.check("every bare string-keyed registry read goes through lib/own-entry or is a read the exemption list names",m.length===0,m.join(`
4
+ `)),o.check("every read the exemption list names is still there (delete-only: remove a line when its read moves)",u.length===0,u.join(`
5
+ `));const s=a.exempt.filter(n=>!(n.until>a.today));o.check("every exemption is before its date",s.length===0,s.map(n=>`${n.file} ${n.map}: until ${n.until}`).join(`
6
+ `));const p=a.exempt.filter(n=>!n.reason.trim()||!n.owner.trim()||!/^\d{4}-\d{2}-\d{2}$/.test(n.until));return o.check("every exemption gives a reason, an owner and a date",p.length===0,p.map(n=>`${n.file} ${n.map}`).join(`
7
+ `)),{report:o.report(),places:l}}export{M as bareRegistryReads,B as ownKeyReads,j as repositoryProgram};
@@ -1,3 +1,3 @@
1
1
  import{ruleChecks as f}from"./rule.js";const c=["--site-radius","--site-radius-xs","--site-radius-sm","--site-radius-md","--site-radius-lg","--site-radius-xl","--site-radius-2xl","--site-radius-3xl","--site-radius-4xl"],a=(i,n)=>JSON.stringify(i)===JSON.stringify(n);function h(i){const n=[];return i.text.split(`
2
- `).forEach((t,u)=>{for(const o of t.matchAll(/["'`]([^"'`]*\brounded-full\b[^"'`]*)["'`]/g))/(^|\s)px-(?!0\b|0\.5\b|1\b|px\b)[\d[]/.test(o[1])&&n.push(`${i.path}:${u+1}`)}),n}function g(i,n){const{check:t,report:u}=f("site square by default"),o=e=>i.find(r=>r.path===e),s=n.corners;if(s){const e=s.siteCornerRadiusTokens(null);t("a website that has chosen no corners publishes every step of the radius scale a `rounded-*` utility reads",c.every(r=>r in e),`missing: ${c.filter(r=>!(r in e)).join(", ")}`),t("…and the card's and the button's own properties","--sf-card-radius"in e&&"--sf-button-radius"in e),t("…every one of them 0 — square",Object.values(e).every(r=>r==="0"),JSON.stringify(e)),t("…exactly what a site that chose 0 publishes",a(e,s.cornerRadiusTokens(0))),t("an absent value and a blank one are the same statement",a(s.siteCornerRadiusTokens(void 0),e)&&a(s.siteCornerRadiusTokens(""),e)&&a(s.siteCornerRadiusTokens(" "),e)),t("a website that has chosen keeps its number",a(s.siteCornerRadiusTokens(16),s.cornerRadiusTokens(16))&&s.siteCornerRadiusTokens(16)["--site-radius-lg"]==="1rem"),t('the retired `large` word is still 16, and `small` is still "not set"',s.cornerStyleToPx[s.normalizeCornerStyle("large")]===16&&s.cornerStyleToPx[s.normalizeCornerStyle("small")]===null),t('`cornerRadiusTokens(null)` publishes NOTHING — not set there means "follow the site"',a(s.cornerRadiusTokens(null),{})),t("…so an untouched section declares no radius of its own",s.sectionCornerStyle(null)===void 0,JSON.stringify(s.sectionCornerStyle(null)))}if(n.livePage!==void 0){const e=o(n.livePage);if(t(`read the live page's layout ${n.livePage}`,!!e)){const r=e.text;t("the live page publishes the site's corners through siteCornerRadiusTokens",/const siteCornerTokens = siteCornerRadiusTokens\(/.test(r)&&/\.\.\.siteCornerTokens,/.test(r)),t("…and never through the two that publish nothing for an untouched site",!/\bcornerRadiusTokens\(|\bcornerStyleTokens\(/.test(r))}}if(n.canvas!==void 0){const e=o(n.canvas);if(t(`read the editor canvas ${n.canvas}`,!!e)){const r=e.text;t("the editor canvas publishes them through the same function",/\.\.\.siteCornerRadiusTokens\(cornerRadiusPx\),/.test(r)),t("…and nowhere through the bare one",!/(?<![A-Za-z])cornerRadiusTokens\(/.test(r))}}{const e=h({path:"fixture.tsx",text:['<button className="rounded-full px-4 py-2">Sign in</button>','<span className="rounded-full px-1 text-xs">3</span>','<span className="h-2 w-2 rounded-full bg-fg" />',"<i className={`rounded-full px-[10px]`} />"].join(`
2
+ `).forEach((t,u)=>{for(const o of t.matchAll(/["'`]([^"'`]*\brounded-full\b[^"'`]*)["'`]/g))/(^|\s)px-(?!0\b|0\.5\b|1\b|px\b)[\d[]/.test(o[1])&&n.push(`${i.path}:${u+1}`)}),n}function g(i,n){const{check:t,report:u}=f("site square by default"),o=e=>i.find(r=>r.path===e),s=n.corners;if(s){const e=s.siteCornerRadiusTokens(null);t("a website that has chosen no corners publishes every step of the radius scale a `rounded-*` utility reads",c.every(r=>r in e),`missing: ${c.filter(r=>!(r in e)).join(", ")}`),t("…and the card's and the button's own properties","--sf-card-radius"in e&&"--sf-button-radius"in e),t("…every one of them 0 — square",Object.values(e).every(r=>r==="0"),JSON.stringify(e)),t("…exactly what a site that chose 0 publishes",a(e,s.cornerRadiusTokens(0))),t("an absent value and a blank one are the same statement",a(s.siteCornerRadiusTokens(void 0),e)&&a(s.siteCornerRadiusTokens(""),e)&&a(s.siteCornerRadiusTokens(" "),e)),t("a website that has chosen keeps its number",a(s.siteCornerRadiusTokens(16),s.cornerRadiusTokens(16))&&s.siteCornerRadiusTokens(16)["--site-radius-lg"]==="1rem"),t('the retired `large` word is still 16, and `small` is still "not set"',s.cornerStyleToPx[s.normalizeCornerStyle("large")]===16&&s.cornerStyleToPx[s.normalizeCornerStyle("small")]===null),t('`cornerRadiusTokens(null)` publishes NOTHING — not set there means "follow the site"',a(s.cornerRadiusTokens(null),{})),t("…so an untouched section declares no radius of its own",s.sectionCornerStyle(null)===void 0,JSON.stringify(s.sectionCornerStyle(null)))}if(n.livePage!==void 0){const e=o(n.livePage);if(t(`read the live page's layout ${n.livePage}`,!!e)){const r=e.text;t("the live page publishes the site's corners through siteCornerRadiusTokens",/const siteCornerTokens = siteCornerRadiusTokens\(/.test(r)&&/\.\.\.siteCornerTokens,/.test(r)),t("…and never through the two that publish nothing for an untouched site",!/\bcornerRadiusTokens\(|\bcornerStyleTokens\(/.test(r))}}if(n.canvas!==void 0){const e=o(n.canvas);if(t(`read the editor canvas ${n.canvas}`,!!e)){const r=e.text;t("the editor canvas publishes them through the same function",/\.\.\.siteCornerRadiusTokens\(cornerRadiusPx(?:, [\w.]+)?\),/.test(r)),t("…and nowhere through the bare one",!/(?<![A-Za-z])cornerRadiusTokens\(/.test(r))}}{const e=h({path:"fixture.tsx",text:['<button className="rounded-full px-4 py-2">Sign in</button>','<span className="rounded-full px-1 text-xs">3</span>','<span className="h-2 w-2 rounded-full bg-fg" />',"<i className={`rounded-full px-[10px]`} />"].join(`
3
3
  `)});t("the pill sweep flags a padded circle, and neither a count badge nor a dot",a(e,["fixture.tsx:1","fixture.tsx:4"]),JSON.stringify(e))}const l=i.filter(e=>e.path.endsWith(".tsx"));t(`the pill sweep read the .tsx files (${l.length}, at least ${n.minFiles})`,l.length>=n.minFiles&&l.length>0);const d=l.flatMap(h);return t("no control with horizontal padding wears the circle utility",d.length===0,d.join(", ")),u()}export{g as siteSquareByDefault};
@@ -107,7 +107,7 @@ export declare const CORNER_STYLE_TO_PX: Record<CornerStyle, number | null>;
107
107
  export declare function normalizeCornerRadius(v?: number | string | null): number | null;
108
108
  export declare function cornerRadiusTokens(v?: number | string | null, unit?: unknown): Record<string, string>;
109
109
  export declare function siteButtonRadiusPx(v?: number | string | null): number;
110
- export declare function siteCornerRadiusTokens(v?: number | string | null): Record<string, string>;
110
+ export declare function siteCornerRadiusTokens(v?: number | string | null, unit?: unknown): Record<string, string>;
111
111
  export declare const CARD_SHADOWS: readonly ["none", "soft", "lifted"];
112
112
  export type CardShadow = (typeof CARD_SHADOWS)[number];
113
113
  export declare const DEFAULT_CARD_SHADOW: CardShadow;
@@ -1,18 +1,18 @@
1
- import{contrastRatio as q,hexToRgb as d,parseHexColor as s,readableInk as O,relativeLuminance as g}from"efficient-shell/format";import{DEFAULT_SHADOW_COLOR as J,pictureShadowColor as Q}from"efficient-easel/screen/lib/document/shadow-values";import{isLengthUnit as v}from"efficient-easel/screen/lib/content/length-units";import{cssLengthOf as ee}from"./content/css-length.js";const te="storefront-theme",Ke="sf:theme-mode",We="sf:theme-switch",je="hide",Ve="light",Ze=!1,H=7,L=18;function ne(e){return e>=H&&e<L}function qe(e){const{mode:t,override:n,switchShown:r,hour:o}=e;return r&&(n==="light"||n==="dark")?n:t==="auto"?ne(o)?"light":"dark":t==="light"?"light":"dark"}function Je(e){const{mode:t,switchShown:n}=e;return`
1
+ import{contrastRatio as J,hexToRgb as d,parseHexColor as s,readableInk as H,relativeLuminance as g}from"efficient-shell/format";import{DEFAULT_SHADOW_COLOR as Q,pictureShadowColor as v}from"efficient-easel/screen/lib/document/shadow-values";import{isLengthUnit as ee}from"efficient-easel/screen/lib/content/length-units";import{cssLengthOf as te,siteLengthHeld as ne}from"./content/css-length.js";const re="storefront-theme",je="sf:theme-mode",Ve="sf:theme-switch",Ze="hide",qe="light",Je=!1,L=7,N=18;function oe(e){return e>=L&&e<N}function Qe(e){const{mode:t,override:n,switchShown:r,hour:o}=e;return r&&(n==="light"||n==="dark")?n:t==="auto"?oe(o)?"light":"dark":t==="light"?"light":"dark"}function ve(e){const{mode:t,switchShown:n}=e;return`
2
2
  try {
3
3
  var mode = ${JSON.stringify(t)};
4
4
  var shown = ${n?"true":"false"};
5
- var override = localStorage.getItem(${JSON.stringify(te)});
5
+ var override = localStorage.getItem(${JSON.stringify(re)});
6
6
  var theme;
7
7
  if (shown && (override === 'light' || override === 'dark')) {
8
8
  theme = override;
9
9
  } else if (mode === 'auto') {
10
10
  var h = new Date().getHours();
11
- theme = (h >= ${H} && h < ${L}) ? 'light' : 'dark';
11
+ theme = (h >= ${L} && h < ${N}) ? 'light' : 'dark';
12
12
  } else {
13
13
  theme = mode === 'light' ? 'light' : 'dark';
14
14
  }
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 l={background:"#0a0a0a",surface:"#131313",line:"#2a2a2a",muted:"#9a9388"},re=[{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"}],oe={selected:0,themes:re};function N(e){return!e||!Array.isArray(e.themes)||e.themes.length===0?{...oe}:{selected:Math.min(Math.max(0,e.selected??0),e.themes.length-1),themes:e.themes}}function _(e,t,n){const r=d(e),o=d(t);if(r===null||o===null)return e;const c=(i,a)=>Math.max(0,Math.min(255,Math.round(i+(a-i)*n))).toString(16).padStart(2,"0");return`#${c(r.r,o.r)}${c(r.g,o.g)}${c(r.b,o.b)}`}const ce={light:"#ffffff",dark:"#0a0a0a"},Qe=["light","dark"];function ve(e,t){const n=ce[t],r=t==="light"?"#ffffff":"#000000";return{text:n,accent:n,background:e,surface:_(e,r,.1),line:_(e,r,.22),muted:_(n,e,.35),brandInk:t}}function f(e){const t=N(e);return t.themes[t.selected]}function u(e){return{text:e.text,accent:e.accent,background:e.background||l.background,surface:e.surface||l.surface,line:e.line||l.line,muted:e.muted||l.muted}}function et(e){return{fill:u(e).background,accent:e.accent}}const ie=.4,se="#f5f1e8",k="#0a0a0a";function ae(e){const t=f(e).text,n=g(t);return n===null||n>=ie?t:null}const ue=4.5,le=3,tt={good:"Good","large-only":"Large text only",hard:"Hard to read"};function nt(e){return e>=ue?"good":e>=le?"large-only":"hard"}const fe=["#000000","#ffffff"];function m(e){return O(e,fe)}function rt(e,t){const n=t!==void 0&&g(t)!==null?t:se;return O(e,[k,n])===n&&n!==k}const he=[.25,.4,.55];function ot(e){const t=d(e);return t===null?[]:he.map(n=>"#"+[t.r,t.g,t.b].map(r=>Math.round(r*(1-n)).toString(16).padStart(2,"0")).join(""))}function ct(e){const n={"--theme-fg":f(e).text},r=ae(e);return r!==null&&(n["--overlay-fg"]=r),n}const de=82;function E(e){return`color-mix(in srgb, ${e} ${de}%, #000)`}function it(e){const t=f(e);return{"--theme-accent":t.accent,"--theme-accent-2":E(t.accent),"--theme-accent-ink":m(t.accent)}}function S(e){const t=e?.button;return t&&s(t)===t.toLowerCase()?t.toLowerCase():null}function st(e){const t=f(e),n=S(t),r=P(t);if(n===null&&r===null)return{};const o={};return n!==null&&(o["--theme-btn"]=n,o["--theme-btn-2"]=E(n)),o["--theme-btn-ink"]=r??m(n),o}function P(e){const t=e?.buttonInk;return t&&s(t)===t.toLowerCase()?t.toLowerCase():null}function ge(e,t){return P(e)??m(S(e)??t)}function at(e){const t=f(e);return{fill:S(t)??t.accent.toLowerCase(),ink:ge(t,t.accent)}}function ut(e){const t={};return N(e).themes.forEach((n,r)=>{const o=u(n);t[`--theme-preset-${r}-accent`]=o.accent,t[`--theme-preset-${r}-accent-2`]=E(o.accent),t[`--theme-preset-${r}-accent-ink`]=m(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 A=e=>{const t=e/255;return t<=.04045?t/12.92:((t+.055)/1.055)**2.4},T=e=>255*(e<=.0031308?12.92*e:1.055*e**(1/2.4)-.055);function F([e,t,n]){const[r,o,c]=[A(e),A(t),A(n)],i=Math.cbrt(.4122214708*r+.5363325363*o+.0514459929*c),a=Math.cbrt(.2119034982*r+.6806995451*o+.1073969566*c),h=Math.cbrt(.0883024619*r+.2817188376*o+.6299787005*c);return[.2104542553*i+.793617785*a-.0040720468*h,1.9779984951*i-2.428592205*a+.4505937099*h,.0259040371*i+.7827717662*a-.808675766*h]}function me([e,t,n]){const r=(e+.3963377774*t+.2158037573*n)**3,o=(e-.1055613458*t-.0638541728*n)**3,c=(e-.0894841775*t-1.291485548*n)**3;return[T(4.0767416621*r-3.3077115913*o+.2309699292*c),T(-1.2684380046*r+2.6097574011*o-.3413193965*c),T(-.0041960863*r-.7034186147*o+1.707614701*c)]}const b=e=>{const t=d(e);return t===null?[0,0,0]:[t.r,t.g,t.b]},$=(e,t,n)=>[e[0]*n+t[0]*(1-n),e[1]*n+t[1]*(1-n),e[2]*n+t[2]*(1-n)],U=e=>`#${e.map(t=>Math.max(0,Math.min(255,Math.round(t))).toString(16).padStart(2,"0")).join("")}`,G=e=>$(b(e.surface),b(e.line),.6);function lt(e){return U(G(u(e)))}function Y(e){const t=u(e);return U(me($(F(G(t)),F(b(t.text)),.92)))}function ft(e){return{...e,background:Y(e)}}function z(e,t,n,r){const o=e[t];if(!o)return-1;const c=n(o);if(!c)return-1;const i=u(o);return e.findIndex((a,h)=>{if(h===t)return!1;const p=u(a);return s(p.background)!==c?!1:!r||s(p.text??"")===s(i.text??"")&&s(p.accent??"")===s(i.accent??"")})}function ht(e,t){return z(e,t,Y,!1)}function dt(e,t){return z(e,t,n=>s(n.surface??""),!0)}const xe=1;function pe(e,t){const n=(e??[]).flatMap((r,o)=>{const c=g(r.background??""),i=g(r.text??"");return c!==null&&i!==null&&c<i?[o]:[]});return n.find(r=>r!==t)??n[0]??xe}function gt(e){return pe(e?.themes,e?.selected)}const mt=["--theme-bg","--theme-surface","--theme-surface-2","--theme-line","--theme-muted"];function xt(e){const t=u(f(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!==l.surface||t.line!==l.line)&&(r["--theme-surface-2"]=n),r}const _e=["heading","body","label"],pt={heading:"Headings",body:"Body",label:"Labels"};function _t(e){if(!e)return null;for(const t of _e)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"],Et={headingLarge:"heading",headingMedium:"heading",headingSmall:"heading",accent:"heading",body:"body",label:"label"},St={headingLarge:null,headingMedium:null,headingSmall:null,accent:null,body:null,label:null},Ee=8,Se=200;function Ae(e){if(typeof e!="number"||!Number.isFinite(e))return null;const t=Math.round(e);return t>=Ee&&t<=Se?t:null}function Te(e){const t={};for(const n of B)t[n]=Ae(e?.[n]);return t}function At(e){const t=Te(e),n={};for(const r of B){const o=t[r];o!==null&&(n[`--size-${r}`]=`${o}px`)}return n}const be=["square","small","large"],Ie="small";function Ce(e){return be.includes(e??"")?e:Ie}function Tt(e){return X(Me[Ce(e)])}const I=0,Re=40,Me={square:0,small:null,large:16},C={"--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 R(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(Re,Math.max(I,Math.round(t))):null}function X(e,t){if(v(t)&&t!=="px"){if(typeof e!="number"||!Number.isFinite(e))return{};const r=Math.max(0,e);return Object.fromEntries(Object.entries(C).map(([o,c])=>{const i=Math.round(r*c*1e4)/1e4;return[o,i===0?"0":ee(i,t)]}))}const n=R(e);return n===null?{}:Object.fromEntries(Object.entries(C).map(([r,o])=>{const c=n*o/16;return[r,c===0?"0":`${c}rem`]}))}function bt(e){return(R(e)??I)*C["--sf-button-radius"]}function It(e){return X(R(e)??I)}const De=["none","soft","lifted"],ye="soft",K="none",we=["tight","normal","roomy"],Oe="normal",He="normal",Le=["none","lift","highlight"],Ne="lift",ke="highlight";import{DEFAULT_SHADOW_COLOR as Ut}from"efficient-easel/screen/lib/document/shadow-values";function W(e){return De.includes(e??"")?e:ye}function Pe(e){return we.includes(e??"")?e:Oe}function j(e){return Le.includes(e??"")?e:Ne}function Ct(e){const t=W(e);return t===K?void 0:t}function Rt(e){const t=Pe(e);return t===He?void 0:t}function Mt(e){const t=j(e);return t===ke?void 0:t}function Dt(e,t,n){const r=Q(t);return r===J?{}:W(e)!==K||j(n)==="lift"?{"--sf-shadow-color":r}:{}}const Fe=["normal","tight","compressed"],V="normal";function Z(e){return Fe.includes(e??"")?e:V}function yt(e){const t=Z(e);return t===V?void 0:t}function wt(e){switch(Z(e)){case"tight":return{lineHeight:.95,letterSpacing:-.01};case"compressed":return{lineHeight:.86,letterSpacing:-.01};default:return{}}}const Ot=["authored","sentence"],Ht={case:"authored",weight:null,weightStrong:null,italicStrong:null,maxPx:null,weight2:null,weight3:null,case2:"authored",case3:"authored"},M=100,D=900,$e=24,Ue=200;function x(e,t,n){return typeof e!="number"||!Number.isFinite(e)?null:Math.round(Math.min(Math.max(e,t),n))}function y(e){const t=x(e?.weight,M,D),n=e?.case==="sentence"?"sentence":"authored",r=c=>c==null?t:x(c,M,D),o=c=>c==="sentence"?"sentence":c==="authored"?"authored":n;return{case:n,weight:t,weightStrong:x(e?.weightStrong,M,D),italicStrong:typeof e?.italicStrong=="boolean"?e.italicStrong:null,maxPx:x(e?.maxPx,$e,Ue),weight2:r(e?.weight2),weight3:r(e?.weight3),case2:o(e?.case2),case3:o(e?.case3)}}function Lt(e){const t=y(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 y({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 kt(e){const t=y(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}}const w="siteTheme";function Ge(e){const t=e;if(!t||typeof t!="object"||!Array.isArray(t.themes)||!t.themes.every(r=>!!r&&typeof r=="object"))return{};const n=typeof t.selected=="number"&&Number.isInteger(t.selected)&&t.selected>=0?t.selected:0;return{[w]:{selected:n,themes:t.themes}}}function Pt(e){return Ge(e?.[w])[w]}export{he as ACCENT_DARKEN_STEPS,Qe as BRAND_INKS,we as CARD_GAPS,De as CARD_SHADOWS,Re as CORNER_RADIUS_MAX,I as CORNER_RADIUS_MIN,be as CORNER_STYLES,Me as CORNER_STYLE_TO_PX,Oe as DEFAULT_CARD_GAP,ye as DEFAULT_CARD_SHADOW,Ie as DEFAULT_CORNER_STYLE,V as DEFAULT_HEADING_COMPRESSION,Ht as DEFAULT_HEADING_TYPOGRAPHY,Ne as DEFAULT_HOVER_EFFECT,Ut as DEFAULT_SHADOW_COLOR,St as DEFAULT_SIZES,l as DEFAULT_SURFACES,Ze as DEFAULT_SWITCH_SHOWN,re as DEFAULT_THEMES,Ve as DEFAULT_THEME_MODE,oe as DEFAULT_THEME_VALUE,tt as GRADE_LABEL,Ot as HEADING_CASES,Fe as HEADING_COMPRESSIONS,Ue as HEADING_MAX_PX_MAX,$e as HEADING_MAX_PX_MIN,D as HEADING_WEIGHT_MAX,M as HEADING_WEIGHT_MIN,Le as HOVER_EFFECTS,He as IDENTITY_CARD_GAP,K as IDENTITY_CARD_SHADOW,ke as IDENTITY_HOVER_EFFECT,k as OVERLAY_INK_DARK,se as OVERLAY_INK_LIGHT,ue as READABILITY_AA,le as READABILITY_AA_LARGE,Et as SCALE_OF_STEP,w as SITE_THEME_KEY,B as SIZE_STEPS,Se as TEXT_SIZE_MAX,Ee as TEXT_SIZE_MIN,L as THEME_DAY_END_HOUR,H as THEME_DAY_START_HOUR,Ke as THEME_MODE_KEY,te as THEME_STORAGE_KEY,mt as THEME_SURFACE_KEYS,je as THEME_SWITCH_HIDE,We as THEME_SWITCH_KEY,_e as TYPE_GROUPS,pt as TYPE_GROUP_LABELS,m as accentInk,ft as bandPresetFor,ht as bandPresetIndex,ve as brandTheme,Je as buildThemeBootScript,Rt as cardGapAttr,Ct as cardShadowAttr,wt as compressionMetrics,q as contrastRatio,X as cornerRadiusTokens,Tt as cornerStyleTokens,gt as darkBandIndex,pe as darkPresetIndex,ot as darkerAccents,rt as fillIsDark,nt as gradeContrast,yt as headingCompressionAttr,Nt as headingTypographyFromRow,Lt as headingTypographyStyle,kt as headingTypographyToRow,Mt as hoverEffectAttr,ne as isDayHour,Pe as normalizeCardGap,W as normalizeCardShadow,R as normalizeCornerRadius,Ce as normalizeCornerStyle,Z as normalizeHeadingCompression,y as normalizeHeadingTypography,j as normalizeHoverEffect,Ae as normalizeSize,Te as normalizeSizes,N as normalizeTheme,u as normalizeThemeColors,qe as resolveTheme,ge as resolvedButtonInk,Y as sectionBandTone,f as selectedThemeColors,Dt as shadowColorTokens,at as siteButtonPaint,bt as siteButtonRadiusPx,It as siteCornerRadiusTokens,Ge as siteThemeMetadata,Pt as siteThemeOf,dt as surfacePresetIndex,lt as surfaceTwoTone,it as themeAccentStyle,S as themeButtonColour,P as themeButtonInk,st as themeButtonStyle,ct as themeColorStyle,ae as themeLightInk,ut as themePresetAccentVars,xt as themeSurfaceStyle,et as themeSwatchColors,_t as typeScaleGroupOfClassName,At as typeSizesStyle};
18
+ `}const l={background:"#0a0a0a",surface:"#131313",line:"#2a2a2a",muted:"#9a9388"},ce=[{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"}],ie={selected:0,themes:ce};function k(e){return!e||!Array.isArray(e.themes)||e.themes.length===0?{...ie}:{selected:Math.min(Math.max(0,e.selected??0),e.themes.length-1),themes:e.themes}}function E(e,t,n){const r=d(e),o=d(t);if(r===null||o===null)return e;const c=(i,a)=>Math.max(0,Math.min(255,Math.round(i+(a-i)*n))).toString(16).padStart(2,"0");return`#${c(r.r,o.r)}${c(r.g,o.g)}${c(r.b,o.b)}`}const se={light:"#ffffff",dark:"#0a0a0a"},et=["light","dark"];function tt(e,t){const n=se[t],r=t==="light"?"#ffffff":"#000000";return{text:n,accent:n,background:e,surface:E(e,r,.1),line:E(e,r,.22),muted:E(n,e,.35),brandInk:t}}function f(e){const t=k(e);return t.themes[t.selected]}function u(e){return{text:e.text,accent:e.accent,background:e.background||l.background,surface:e.surface||l.surface,line:e.line||l.line,muted:e.muted||l.muted}}function nt(e){return{fill:u(e).background,accent:e.accent}}const ae=.4,ue="#f5f1e8",P="#0a0a0a";function le(e){const t=f(e).text,n=g(t);return n===null||n>=ae?t:null}const fe=4.5,he=3,rt={good:"Good","large-only":"Large text only",hard:"Hard to read"};function ot(e){return e>=fe?"good":e>=he?"large-only":"hard"}const de=["#000000","#ffffff"];function m(e){return H(e,de)}function ct(e,t){const n=t!==void 0&&g(t)!==null?t:ue;return H(e,[P,n])===n&&n!==P}const ge=[.25,.4,.55];function it(e){const t=d(e);return t===null?[]:ge.map(n=>"#"+[t.r,t.g,t.b].map(r=>Math.round(r*(1-n)).toString(16).padStart(2,"0")).join(""))}function st(e){const n={"--theme-fg":f(e).text},r=le(e);return r!==null&&(n["--overlay-fg"]=r),n}const me=82;function S(e){return`color-mix(in srgb, ${e} ${me}%, #000)`}function at(e){const t=f(e);return{"--theme-accent":t.accent,"--theme-accent-2":S(t.accent),"--theme-accent-ink":m(t.accent)}}function A(e){const t=e?.button;return t&&s(t)===t.toLowerCase()?t.toLowerCase():null}function ut(e){const t=f(e),n=A(t),r=F(t);if(n===null&&r===null)return{};const o={};return n!==null&&(o["--theme-btn"]=n,o["--theme-btn-2"]=S(n)),o["--theme-btn-ink"]=r??m(n),o}function F(e){const t=e?.buttonInk;return t&&s(t)===t.toLowerCase()?t.toLowerCase():null}function xe(e,t){return F(e)??m(A(e)??t)}function lt(e){const t=f(e);return{fill:A(t)??t.accent.toLowerCase(),ink:xe(t,t.accent)}}function ft(e){const t={};return k(e).themes.forEach((n,r)=>{const o=u(n);t[`--theme-preset-${r}-accent`]=o.accent,t[`--theme-preset-${r}-accent-2`]=S(o.accent),t[`--theme-preset-${r}-accent-ink`]=m(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 T=e=>{const t=e/255;return t<=.04045?t/12.92:((t+.055)/1.055)**2.4},b=e=>255*(e<=.0031308?12.92*e:1.055*e**(1/2.4)-.055);function $([e,t,n]){const[r,o,c]=[T(e),T(t),T(n)],i=Math.cbrt(.4122214708*r+.5363325363*o+.0514459929*c),a=Math.cbrt(.2119034982*r+.6806995451*o+.1073969566*c),h=Math.cbrt(.0883024619*r+.2817188376*o+.6299787005*c);return[.2104542553*i+.793617785*a-.0040720468*h,1.9779984951*i-2.428592205*a+.4505937099*h,.0259040371*i+.7827717662*a-.808675766*h]}function pe([e,t,n]){const r=(e+.3963377774*t+.2158037573*n)**3,o=(e-.1055613458*t-.0638541728*n)**3,c=(e-.0894841775*t-1.291485548*n)**3;return[b(4.0767416621*r-3.3077115913*o+.2309699292*c),b(-1.2684380046*r+2.6097574011*o-.3413193965*c),b(-.0041960863*r-.7034186147*o+1.707614701*c)]}const I=e=>{const t=d(e);return t===null?[0,0,0]:[t.r,t.g,t.b]},U=(e,t,n)=>[e[0]*n+t[0]*(1-n),e[1]*n+t[1]*(1-n),e[2]*n+t[2]*(1-n)],G=e=>`#${e.map(t=>Math.max(0,Math.min(255,Math.round(t))).toString(16).padStart(2,"0")).join("")}`,Y=e=>U(I(e.surface),I(e.line),.6);function ht(e){return G(Y(u(e)))}function z(e){const t=u(e);return G(pe(U($(Y(t)),$(I(t.text)),.92)))}function dt(e){return{...e,background:z(e)}}function B(e,t,n,r){const o=e[t];if(!o)return-1;const c=n(o);if(!c)return-1;const i=u(o);return e.findIndex((a,h)=>{if(h===t)return!1;const _=u(a);return s(_.background)!==c?!1:!r||s(_.text??"")===s(i.text??"")&&s(_.accent??"")===s(i.accent??"")})}function gt(e,t){return B(e,t,z,!1)}function mt(e,t){return B(e,t,n=>s(n.surface??""),!0)}const _e=1;function Ee(e,t){const n=(e??[]).flatMap((r,o)=>{const c=g(r.background??""),i=g(r.text??"");return c!==null&&i!==null&&c<i?[o]:[]});return n.find(r=>r!==t)??n[0]??_e}function xt(e){return Ee(e?.themes,e?.selected)}const pt=["--theme-bg","--theme-surface","--theme-surface-2","--theme-line","--theme-muted"];function _t(e){const t=u(f(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!==l.surface||t.line!==l.line)&&(r["--theme-surface-2"]=n),r}const Se=["heading","body","label"],Et={heading:"Headings",body:"Body",label:"Labels"};function St(e){if(!e)return null;for(const t of Se)if(e.includes(`--size-${t}`))return t;return/--size-heading(Large|Medium|Small)/.test(e)?"heading":null}const X=["headingLarge","headingMedium","headingSmall","accent","body","label"],At={headingLarge:"heading",headingMedium:"heading",headingSmall:"heading",accent:"heading",body:"body",label:"label"},Tt={headingLarge:null,headingMedium:null,headingSmall:null,accent:null,body:null,label:null},Ae=8,Te=200;function be(e){if(typeof e!="number"||!Number.isFinite(e))return null;const t=Math.round(e);return t>=Ae&&t<=Te?t:null}function Ie(e){const t={};for(const n of X)t[n]=be(e?.[n]);return t}function bt(e){const t=Ie(e),n={};for(const r of X){const o=t[r];o!==null&&(n[`--size-${r}`]=`${o}px`)}return n}const Re=["square","small","large"],Ce="small";function De(e){return Re.includes(e??"")?e:Ce}function It(e){return D(ye[De(e)])}const x=0,K=40,Me={min:x,max:K,step:1},ye={square:0,small:null,large:16},R={"--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(K,Math.max(x,Math.round(t))):null}function D(e,t){if(ee(t)&&t!=="px"){if(typeof e!="number"||!Number.isFinite(e))return{};const r=Math.max(0,e);return Object.fromEntries(Object.entries(R).map(([o,c])=>{const i=Math.round(r*c*1e4)/1e4;return[o,i===0?"0":te(i,t)]}))}const n=C(e);return n===null?{}:Object.fromEntries(Object.entries(R).map(([r,o])=>{const c=n*o/16;return[r,c===0?"0":`${c}rem`]}))}function Rt(e){return(C(e)??x)*R["--sf-button-radius"]}function Ct(e,t){const n=ne(e,t,"radius",Me);return n!==null?D(n,t):D(C(e)??x)}const Oe=["none","soft","lifted"],we="soft",W="none",He=["tight","normal","roomy"],Le="normal",Ne="normal",ke=["none","lift","highlight"],Pe="lift",Fe="highlight";import{DEFAULT_SHADOW_COLOR as Yt}from"efficient-easel/screen/lib/document/shadow-values";function j(e){return Oe.includes(e??"")?e:we}function $e(e){return He.includes(e??"")?e:Le}function V(e){return ke.includes(e??"")?e:Pe}function Dt(e){const t=j(e);return t===W?void 0:t}function Mt(e){const t=$e(e);return t===Ne?void 0:t}function yt(e){const t=V(e);return t===Fe?void 0:t}function Ot(e,t,n){const r=v(t);return r===Q?{}:j(e)!==W||V(n)==="lift"?{"--sf-shadow-color":r}:{}}const Ue=["normal","tight","compressed"],Z="normal";function q(e){return Ue.includes(e??"")?e:Z}function wt(e){const t=q(e);return t===Z?void 0:t}function Ht(e){switch(q(e)){case"tight":return{lineHeight:.95,letterSpacing:-.01};case"compressed":return{lineHeight:.86,letterSpacing:-.01};default:return{}}}const Lt=["authored","sentence"],Nt={case:"authored",weight:null,weightStrong:null,italicStrong:null,maxPx:null,weight2:null,weight3:null,case2:"authored",case3:"authored"},M=100,y=900,Ge=24,Ye=200;function p(e,t,n){return typeof e!="number"||!Number.isFinite(e)?null:Math.round(Math.min(Math.max(e,t),n))}function O(e){const t=p(e?.weight,M,y),n=e?.case==="sentence"?"sentence":"authored",r=c=>c==null?t:p(c,M,y),o=c=>c==="sentence"?"sentence":c==="authored"?"authored":n;return{case:n,weight:t,weightStrong:p(e?.weightStrong,M,y),italicStrong:typeof e?.italicStrong=="boolean"?e.italicStrong:null,maxPx:p(e?.maxPx,Ge,Ye),weight2:r(e?.weight2),weight3:r(e?.weight3),case2:o(e?.case2),case3:o(e?.case3)}}function kt(e){const t=O(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 Pt(e){return O({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 Ft(e){const t=O(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}}const w="siteTheme";function ze(e){const t=e;if(!t||typeof t!="object"||!Array.isArray(t.themes)||!t.themes.every(r=>!!r&&typeof r=="object"))return{};const n=typeof t.selected=="number"&&Number.isInteger(t.selected)&&t.selected>=0?t.selected:0;return{[w]:{selected:n,themes:t.themes}}}function $t(e){return ze(e?.[w])[w]}export{ge as ACCENT_DARKEN_STEPS,et as BRAND_INKS,He as CARD_GAPS,Oe as CARD_SHADOWS,K as CORNER_RADIUS_MAX,x as CORNER_RADIUS_MIN,Re as CORNER_STYLES,ye as CORNER_STYLE_TO_PX,Le as DEFAULT_CARD_GAP,we as DEFAULT_CARD_SHADOW,Ce as DEFAULT_CORNER_STYLE,Z as DEFAULT_HEADING_COMPRESSION,Nt as DEFAULT_HEADING_TYPOGRAPHY,Pe as DEFAULT_HOVER_EFFECT,Yt as DEFAULT_SHADOW_COLOR,Tt as DEFAULT_SIZES,l as DEFAULT_SURFACES,Je as DEFAULT_SWITCH_SHOWN,ce as DEFAULT_THEMES,qe as DEFAULT_THEME_MODE,ie as DEFAULT_THEME_VALUE,rt as GRADE_LABEL,Lt as HEADING_CASES,Ue as HEADING_COMPRESSIONS,Ye as HEADING_MAX_PX_MAX,Ge as HEADING_MAX_PX_MIN,y as HEADING_WEIGHT_MAX,M as HEADING_WEIGHT_MIN,ke as HOVER_EFFECTS,Ne as IDENTITY_CARD_GAP,W as IDENTITY_CARD_SHADOW,Fe as IDENTITY_HOVER_EFFECT,P as OVERLAY_INK_DARK,ue as OVERLAY_INK_LIGHT,fe as READABILITY_AA,he as READABILITY_AA_LARGE,At as SCALE_OF_STEP,w as SITE_THEME_KEY,X as SIZE_STEPS,Te as TEXT_SIZE_MAX,Ae as TEXT_SIZE_MIN,N as THEME_DAY_END_HOUR,L as THEME_DAY_START_HOUR,je as THEME_MODE_KEY,re as THEME_STORAGE_KEY,pt as THEME_SURFACE_KEYS,Ze as THEME_SWITCH_HIDE,Ve as THEME_SWITCH_KEY,Se as TYPE_GROUPS,Et as TYPE_GROUP_LABELS,m as accentInk,dt as bandPresetFor,gt as bandPresetIndex,tt as brandTheme,ve as buildThemeBootScript,Mt as cardGapAttr,Dt as cardShadowAttr,Ht as compressionMetrics,J as contrastRatio,D as cornerRadiusTokens,It as cornerStyleTokens,xt as darkBandIndex,Ee as darkPresetIndex,it as darkerAccents,ct as fillIsDark,ot as gradeContrast,wt as headingCompressionAttr,Pt as headingTypographyFromRow,kt as headingTypographyStyle,Ft as headingTypographyToRow,yt as hoverEffectAttr,oe as isDayHour,$e as normalizeCardGap,j as normalizeCardShadow,C as normalizeCornerRadius,De as normalizeCornerStyle,q as normalizeHeadingCompression,O as normalizeHeadingTypography,V as normalizeHoverEffect,be as normalizeSize,Ie as normalizeSizes,k as normalizeTheme,u as normalizeThemeColors,Qe as resolveTheme,xe as resolvedButtonInk,z as sectionBandTone,f as selectedThemeColors,Ot as shadowColorTokens,lt as siteButtonPaint,Rt as siteButtonRadiusPx,Ct as siteCornerRadiusTokens,ze as siteThemeMetadata,$t as siteThemeOf,mt as surfacePresetIndex,ht as surfaceTwoTone,at as themeAccentStyle,A as themeButtonColour,F as themeButtonInk,ut as themeButtonStyle,st as themeColorStyle,le as themeLightInk,ft as themePresetAccentVars,_t as themeSurfaceStyle,nt as themeSwatchColors,St as typeScaleGroupOfClassName,bt as typeSizesStyle};
@@ -14,6 +14,7 @@ export type CardRow = {
14
14
  item?: unknown;
15
15
  finish?: string;
16
16
  nested?: boolean;
17
+ previewHover?: boolean;
17
18
  state?: CardRowState;
18
19
  linesBetween?: boolean;
19
20
  };
@@ -45,9 +46,10 @@ type CardTemplateRowsProps = {
45
46
  stateLine?: CardStateLine;
46
47
  actions?: readonly (CardItemAction | undefined)[];
47
48
  pressTitles?: readonly CardPressTitle[];
49
+ previewHover?: boolean;
48
50
  fallback: ReactNode;
49
51
  copyAttrs?: Readonly<Record<string, string>> | ((row: CardRow) => Readonly<Record<string, string>>);
50
52
  wrapCopy?: (copy: ReactNode, row: CardRow) => ReactNode;
51
53
  children: (cards: ReactNode) => ReactNode;
52
54
  };
53
- export declare function CardTemplateRows({ ownerId, ownerType, slot, Template, rows, items, fields, states, stateLine, actions, pressTitles, fallback, copyAttrs, wrapCopy, children }: CardTemplateRowsProps): import("react").JSX.Element;
55
+ export declare function CardTemplateRows({ ownerId, ownerType, slot, Template, rows, items, fields, states, stateLine, actions, pressTitles, previewHover, fallback, copyAttrs, wrapCopy, children }: CardTemplateRowsProps): import("react").JSX.Element;
@@ -1 +1 @@
1
- "use client";import{Fragment as u,jsx as t,jsxs as I}from"react/jsx-runtime";import{createContext as x,useContext as C,useId as j}from"react";import{REPEAT_ATTRIBUTE as H,REPEAT_INDEX_ATTRIBUTE as K}from"efficient-easel/draw";import{BOX_LINKED_CLASS as O}from"../../format/lib/content/box-link.js";import{BOX_HIDE_WHEN_ROW_EMPTY as U,CARD_TEMPLATE_SLOT as W,cardTemplateLinesBetween as X,rowFilledProps as M,templateBoxIsEmpty as v}from"../../format/lib/content/card-template.js";import{CARD_ACTION_ATTR as V,CARD_ACTION_CLASS as G,CARD_ACTION_HOVER_CLASS as Y,CARD_ACTION_OFF_CLASS as q,CARD_STATE_LINE_CLASS as z,CARD_STATE_PICKED_BAR_CLASS as J,CARD_STATE_PICKED_CLASS as Q,CARD_STATE_PICKED_WASH_CLASS as Z,CARD_STATE_UNDER_LINE_CLASS as ee,cardStateAttrs as te,cardStatePicked as re,cardStateValue as ne}from"../../format/lib/content/card-state.js";import{usePageRecordRow as oe}from"./CurrentRecord.js";import{CardCopyCell as se}from"./InBoxContext.js";import{SECTION_FILL_CLASS as ae}from"../../format/lib/content/section-min-height.js";function pe({props:o,editing:r,children:n}){const e=C(A);return!r&&v(o,e?.row)?null:t(u,{children:n})}const S=x(null);function Ee({field:o,children:r}){const n=C(S);return t(u,{children:r(n&&n.field===o?n.id:void 0)})}function le(o,r){return o?.find(e=>!!r[e.field]?.trim()&&!e.gates.some(s=>v({[U]:s},r)))?.field??""}const A=x(null);function Re(){return C(A)}function fe({type:o,props:r,children:n}){const e=C(A),s=oe(),l=e?.row??s;return t(u,{children:n(M(o,r,l,e?.ownerType,e?.fields,e?.slot),e,l)})}function ie({attrs:o,selected:r,hover:n,action:e,titleField:s,children:l}){const i=j(),{press:T,disabled:a}=e,_=e.label?.trim(),m=!_&&s?{id:`${i}-title`,field:s}:null;return I("div",{...o,id:i,className:n&&!a?`${O} ${Y}`:O,children:[t("button",{type:"button",[V]:"",className:a?q:G,"aria-pressed":r,..._?{"aria-label":_}:{"aria-labelledby":m?.id??i},...a?{"aria-disabled":!0,tabIndex:-1}:null,onClick:a?void 0:T}),t(S.Provider,{value:m,children:l})]})}function he({ownerId:o,ownerType:r,slot:n=W,Template:e,rows:s,items:l,fields:i,states:T,stateLine:a,actions:_,pressTitles:m,fallback:B,copyAttrs:p,wrapCopy:N,children:F}){const g=C(A),k=C(S);if(!e||(e.blockCount??0)<=0)return t(u,{children:B});const y=g!==null,D=X(r),L=e.blockCount===1?t(se,{children:t(e,{className:ae})}):t(e,{}),$=s.map((P,c)=>{const d=T?.[c],E={row:P,index:c,ownerType:r,slot:n,item:l?.[c],nested:y,...i?{fields:i}:null,...d?{state:d}:null,...D?{linesBetween:D}:null},R=ne(d)?I(u,{children:[L,a==="under"?t("span",{"aria-hidden":"true",className:ee}):re(d)?I("span",{"aria-hidden":"true",className:Q,children:[t("span",{className:J}),t("span",{className:Z})]}):t("span",{"aria-hidden":"true",className:z})]}):L,f={[H]:`${o}:${n}`,[K]:c,...typeof p=="function"?p(E):p},b=_?.[c],h=te(d,a),w=b?t(ie,{attrs:{...f,...h},selected:d?.selected===!0,hover:a!=="under",action:b,titleField:le(m,P),children:R}):k?t("div",{...f,...h,children:t(S.Provider,{value:null,children:R})}):t("div",{...f,...h,children:R});return t(A.Provider,{value:E,children:N?N(w,E):w},c)});return t(u,{children:F($)})}export{Ee as CardPressTitled,A as CardRowContext,fe as CardRowDrawn,he as CardTemplateRows,pe as RowEmptyGate,Re as useCardRow};
1
+ "use client";import{Fragment as u,jsx as t,jsxs as I}from"react/jsx-runtime";import{createContext as O,useContext as C,useId as K}from"react";import{REPEAT_ATTRIBUTE as U,REPEAT_INDEX_ATTRIBUTE as W}from"efficient-easel/draw";import{BOX_LINKED_CLASS as B}from"../../format/lib/content/box-link.js";import{BOX_HIDE_WHEN_ROW_EMPTY as X,CARD_TEMPLATE_SLOT as M,cardTemplateLinesBetween as V,rowFilledProps as G,templateBoxIsEmpty as F}from"../../format/lib/content/card-template.js";import{CARD_ACTION_ATTR as Y,CARD_ACTION_CLASS as q,CARD_ACTION_HOVER_CLASS as z,CARD_ACTION_OFF_CLASS as J,CARD_STATE_LINE_CLASS as Q,CARD_STATE_PICKED_BAR_CLASS as Z,CARD_STATE_PICKED_CLASS as ee,CARD_STATE_PICKED_WASH_CLASS as te,CARD_STATE_UNDER_LINE_CLASS as re,cardStateAttrs as ne,cardStatePicked as oe,cardStateValue as se}from"../../format/lib/content/card-state.js";import{usePageRecordRow as le}from"./CurrentRecord.js";import{CardCopyCell as ae}from"./InBoxContext.js";import{SECTION_FILL_CLASS as ie}from"../../format/lib/content/section-min-height.js";function Re({props:o,editing:r,children:n}){const e=C(A);return!r&&F(o,e?.row)?null:t(u,{children:n})}const S=O(null);function fe({field:o,children:r}){const n=C(S);return t(u,{children:r(n&&n.field===o?n.id:void 0)})}function ce(o,r){return o?.find(e=>!!r[e.field]?.trim()&&!e.gates.some(s=>F({[X]:s},r)))?.field??""}const A=O(null);function he(){return C(A)}function Ie({type:o,props:r,children:n}){const e=C(A),s=le(),a=e?.row??s;return t(u,{children:n(G(o,r,a,e?.ownerType,e?.fields,e?.slot),e,a)})}function de({attrs:o,selected:r,hover:n,action:e,titleField:s,children:a}){const i=K(),{press:T,disabled:l}=e,_=e.label?.trim(),m=!_&&s?{id:`${i}-title`,field:s}:null;return I("div",{...o,id:i,className:n&&!l?`${B} ${z}`:B,children:[t("button",{type:"button",[Y]:"",className:l?J:q,"aria-pressed":r,..._?{"aria-label":_}:{"aria-labelledby":m?.id??i},...l?{"aria-disabled":!0,tabIndex:-1}:null,onClick:l?void 0:T}),t(S.Provider,{value:m,children:a})]})}function Ne({ownerId:o,ownerType:r,slot:n=M,Template:e,rows:s,items:a,fields:i,states:T,stateLine:l,actions:_,pressTitles:m,previewHover:g,fallback:H,copyAttrs:p,wrapCopy:N,children:k}){const D=C(A),y=C(S);if(!e||(e.blockCount??0)<=0)return t(u,{children:H});const $=D!==null,L=V(r),P=g??D?.previewHover,v=e.blockCount===1?t(ae,{children:t(e,{className:ie})}):t(e,{}),j=s.map((w,c)=>{const d=T?.[c],E={row:w,index:c,ownerType:r,slot:n,item:a?.[c],nested:$,...i?{fields:i}:null,...d?{state:d}:null,...L?{linesBetween:L}:null,...P?{previewHover:P}:null},R=se(d)?I(u,{children:[v,l==="under"?t("span",{"aria-hidden":"true",className:re}):oe(d)?I("span",{"aria-hidden":"true",className:ee,children:[t("span",{className:Z}),t("span",{className:te})]}):t("span",{"aria-hidden":"true",className:Q})]}):v,f={[U]:`${o}:${n}`,[W]:c,...typeof p=="function"?p(E):p},b=_?.[c],h=ne(d,l),x=b?t(de,{attrs:{...f,...h},selected:d?.selected===!0,hover:l!=="under",action:b,titleField:ce(m,w),children:R}):y?t("div",{...f,...h,children:t(S.Provider,{value:null,children:R})}):t("div",{...f,...h,children:R});return t(A.Provider,{value:E,children:N?N(x,E):x},c)});return t(u,{children:k(j)})}export{fe as CardPressTitled,A as CardRowContext,Ie as CardRowDrawn,Ne as CardTemplateRows,Re as RowEmptyGate,he as useCardRow};
@@ -70,6 +70,7 @@ interface FlexProps {
70
70
  link?: unknown;
71
71
  rowLink?: string;
72
72
  rowImage?: string;
73
+ hoverShow?: unknown;
73
74
  highlight?: Record<string, string> | null;
74
75
  boxShape?: unknown;
75
76
  boxShapePhone?: unknown;
@@ -91,5 +92,5 @@ interface FlexProps {
91
92
  rowStyle?: unknown;
92
93
  sideSpace?: unknown;
93
94
  }
94
- export default function Flex({ direction: storedDirection, label, tabShape, gap, gapPhone, gapTablet, justify, align, wrap, share: storedShare, sharePhone, shareTablet, wrapPhone, orderPhone: storedOrderPhone, phoneRow, columns, columnsTablet, separator, stackBelow, blockSpacing, bgImage: storedBgImage, bgImagePhone: storedBgImagePhone, rowImage: storedRowImage, pictureHover, darken, darkenStyle, darkenTablet, darkenPhone, darkenStyleTablet, darkenStylePhone, placement, padV2, border: storedBorder, borderTablet: storedBorderTablet, borderPhone: storedBorderPhone, borderUnits, pad, contained, fillHeight, shadow, shadowTablet, shadowPhone, justifyTablet, justifyPhone, alignTablet, alignPhone, wrapTablet, blockSpacingTablet, blockSpacingPhone, loop, scrollDirection, loopSeconds, loopDelay, editing, fillColor, fillColorTablet, fillColorPhone, swatch, line, upcoming, link, rowLink, highlight, boxShape, boxShapePhone, boxShapeTablet, angle, jumpHighlight, anchor, sharedSides: storedSharedSides, sharedRows: storedSharedRows, boxId, slotCount, mirrorCards, content: Content, rowTitle: RowTitle, startsOpen, rowStyle, sideSpace, }: FlexProps): string | number | bigint | boolean | Iterable<ReactNode> | Promise<string | number | bigint | boolean | import("react").ReactPortal | import("react").ReactElement<unknown, string | import("react").JSXElementConstructor<any>> | Iterable<ReactNode> | null | undefined> | import("react").JSX.Element | null | undefined;
95
+ export default function Flex({ direction: storedDirection, label, tabShape, gap, gapPhone, gapTablet, justify, align, wrap, share: storedShare, sharePhone, shareTablet, wrapPhone, orderPhone: storedOrderPhone, phoneRow, columns, columnsTablet, separator, stackBelow, blockSpacing, bgImage: storedBgImage, bgImagePhone: storedBgImagePhone, rowImage: storedRowImage, hoverShow, pictureHover, darken, darkenStyle, darkenTablet, darkenPhone, darkenStyleTablet, darkenStylePhone, placement, padV2, border: storedBorder, borderTablet: storedBorderTablet, borderPhone: storedBorderPhone, borderUnits, pad, contained, fillHeight, shadow, shadowTablet, shadowPhone, justifyTablet, justifyPhone, alignTablet, alignPhone, wrapTablet, blockSpacingTablet, blockSpacingPhone, loop, scrollDirection, loopSeconds, loopDelay, editing, fillColor, fillColorTablet, fillColorPhone, swatch, line, upcoming, link, rowLink, highlight, boxShape, boxShapePhone, boxShapeTablet, angle, jumpHighlight, anchor, sharedSides: storedSharedSides, sharedRows: storedSharedRows, boxId, slotCount, mirrorCards, content: Content, rowTitle: RowTitle, startsOpen, rowStyle, sideSpace, }: FlexProps): string | number | bigint | boolean | Iterable<ReactNode> | Promise<string | number | bigint | boolean | import("react").ReactPortal | import("react").ReactElement<unknown, string | import("react").JSXElementConstructor<any>> | Iterable<ReactNode> | null | undefined> | import("react").JSX.Element | null | undefined;
95
96
  export {};
@@ -1 +1 @@
1
- import{Fragment as ee,jsx as e,jsxs as be}from"react/jsx-runtime";import{useContext as zn,useId as Jn}from"react";import Yn from"./BoxTabs.js";import{AccordionRowStyleContext as Ge,BoxTabPaneContext as We,useAccordionRowStyle as Zn,useBoxPaneKind as qn,useFirstCopyOpens as Qn,useIsTabPane as et}from"./BoxTabPaneContext.js";import ot,{ACCORDION_COUNTER_RESET as st}from"./BoxAccordionRow.js";import{ACCORDION_MARK_SHEET as nt}from"./AccordionMark.js";import{accordionRowStyleOf as tt}from"../../format/lib/content/accordion-row-style.js";import{boxPhoneCell as rt,boxPhoneOrder as lt}from"../../format/lib/content/box-phone-place.js";import{CellFillContext as as,InBoxContext as ds,useCellOfStretchedRow as it,useFillsCell as ct}from"./InBoxContext.js";import at,{InsideSiteColumn as us,useInsideSiteGutter as dt,useSectionRoot as ut}from"./SiteGutterFrame.js";import{BoxSurfaceProvider as mt}from"./BoxSurfaceContext.js";import ft from"./PictureWash.js";import{BoxCellContext as ms,NoCellBound as ht}from"./BoxCellContext.js";import{boxCellFractions as Ct}from"../lib/content/box-cell-bound.js";import{boundOf as bt}from"../../format/lib/content/cell-picture-sizes.js";import{useInSiteHeader as St}from"./PhoneMenuTools.js";import{useCardRow as wt}from"./CardRowContext.js";import{cardLineBetween as Xe,framesItsCards as pt}from"../../format/lib/content/card-place.js";import{rowLinkText as xt}from"../../format/lib/content/card-template.js";import{HandedMirrorContext as Pt,MirrorContext as _t,RowHandContext as fs,boxPlace as $t,useHandedMirrorAbove as vt,useHandedRows as Rt,useMirroredCopy as Ot,useUnderCardBox as yt}from"./MirrorContext.js";import{boxChildrenHand as Lt,isMirroredCopy as At,mirrorCardsActs as hs,mirrorCardsOf as Nt,mirroredBoxClass as kt,MIRROR_ROW_CLASS as It,ownsCard as gt}from"../../format/lib/content/mirror-cards.js";import{FRAME_BASE as je,frameGutterOf as Bt}from"./BlockFrame.js";import{BOX_SIDE_SPACE_SITE as Et,boxSideSpaceOf as Tt}from"../../format/lib/content/box-side-space.js";import{containerGapProps as Cs}from"../../format/lib/content/container-gap.js";import{boxLayoutClasses as Ft,boxAlignViewClasses as Dt,boxBlockSpacingClass as Ht,boxBlockSpacingViewClasses as Mt,boxJustifyViewClasses as Vt,boxWrapTabletClass as Gt,boxFitContentClass as Wt,boxAccordionColumnsClass as bs,boxRowColumnsClass as Xt,boxRowTabletColumnsClass as jt,boxRowTabletShareClass as Kt,boxPhoneCellsShareLine as Ut,boxPhoneRowClasses as oe,boxPhoneRowFits as zt,boxShareClasses as W,boxShareVars as Jt,boxWrapClass as Yt,BOX_GAP_ONLY_CLASS as Zt}from"../../format/lib/content/box-layout.js";import{boxSeparatorClasses as qt,boxSeparatorSeamClass as Qt,boxSeparatorStyle as er,isStripBox as or}from"../../format/lib/content/box-separator.js";import{DEFAULT_LOOP_DELAY as sr,DEFAULT_LOOP_DIRECTION as nr,DEFAULT_LOOP_SECONDS as tr,isVerticalLoop as rr}from"../../format/lib/animation/index.js";import{LoopTrack as lr}from"../lib/animation/LoopTrack.js";import{BOX_CARD_PAD as R,BOX_OWNS_SIDES_CLASS as ir,boxDarkenStyle as cr,boxPaintOf as ar,boxFillViews as dr,boxPlacementClasses as ur,boxCardProps as mr,boxIsCard as Ss,boxRowPicture as fr,boxSwatchFill as hr,boxWashViews as Cr,CARD_SHADOW_CLASS as br,isBackgroundBox as ws}from"../../format/lib/content/box-background.js";import{BOX_ROW_IMAGE_PROP as S}from"../../format/lib/content/box-card-rule.js";import{boxShadowAttrs as Sr,boxShadowOnAnyView as wr,boxShadowViewAttrs as pr}from"../../format/lib/content/box-shadow.js";import{boxRunsEdgeToEdge as xr,drawsSiteGutter as Pr}from"../../format/lib/content/site-gutter.js";import{boxShapeClass as _r,boxShapeClasses as $r}from"../../format/lib/content/box-shape.js";import{boxAngleStyle as vr}from"../../format/lib/content/box-angle.js";import{BOX_JUMP_ATTR as Rr,BOX_LINK_ATTR as ps,BOX_LINK_CLASS as xs,BOX_LINKED_CLASS as Or,boxJumpBlocksClass as yr,boxJumpCss as Lr,boxJumpSlug as Ar,boxLinkOf as Nr,siteLinkDraws as kr}from"../../format/lib/content/box-link.js";import{SiteLink as Ir}from"../lib/site-runtime.js";import{sectionBorderStyle as Ps}from"../../format/lib/content/borders.js";import{finiteNumber as Se}from"../../format/lib/finite-number.js";import{padDefaultIn as O,padSideValue as we,sectionPadAttrs as gr}from"../lib/content/section-padding.js";import{SECTION_FILL_CLASS as pe}from"../../format/lib/content/section-min-height.js";import{ON_MEDIA_INK_STYLE as Br,rowFillInkStyle as Er}from"../../format/lib/content/ink.js";import{useThemeLightInk as Tr}from"./ThemeLightInkContext.js";import{sizedBackground as Ke}from"../../format/lib/sized-image.js";import{PHOTO_HOST_ATTR as Fr,resolveImageTreatment as Dr}from"../../format/lib/content/image-treatment.js";import{BOX_HIGHLIGHT_CLASS as Hr,BOX_HIGHLIGHT_OVER_ROW_INK_CLASS as Mr}from"../../format/lib/animation/hover.js";import{BoxRail as Vr,BoxRailStop as Gr,RAIL_STOPS_CLASS as Wr,useTimelineRail as Xr}from"./TimelineRail.js";import{SHARED_PLAIN_ATTR as jr,sharedColumnsClasses as Kr,sharedColumnsCss as Ur,sharedRowsClasses as zr,sharedRowsCss as Jr}from"../lib/content/box-shared-columns.js";import Yr from"./PhotoHoverSheet.js";import{PictureHoverMoveSheet as Zr,PictureHoverZoom as qr,pictureHoverMoveOf as Qr}from"./PictureHoverMove.js";import{BOX_DESKTOP_LINE as el,stackGutterClass as ol,stackLineCss as sl,stackOuterClass as nl,stackRowClass as tl,storedStackLine as Ue}from"../lib/content/box-stack-line.js";const ze={"--sf-site-gutter":"0px"},rl={overflowX:"clip",overflowY:"visible"},ll={stretchedRow:!1,fillingColumn:!1,columnsRow:!1},_s={desktop:!1,phone:!1},$s="bg-cover bg-center bg-[image:var(--sf-box-bg)] max-view-wide:bg-[image:var(--sf-box-bg-p)]",Je=u=>u==null||u==="",Ye=u=>!Je(u)&&Number(u)===0;function il({children:u}){return e(ee,{children:u(Jn())})}function cl({direction:u,label:vs,tabShape:Rs,gap:Ze,gapPhone:Os,gapTablet:xe,justify:X,align:y,wrap:se,share:ys,sharePhone:j,shareTablet:I,wrapPhone:Ls,orderPhone:As,phoneRow:w,columns:m,columnsTablet:g,separator:f,stackBelow:ne,blockSpacing:qe,bgImage:Ns,bgImagePhone:ks,rowImage:Is,pictureHover:Qe,darken:eo,darkenStyle:Pe,darkenTablet:gs,darkenPhone:Bs,darkenStyleTablet:Es,darkenStylePhone:Ts,placement:Fs,padV2:oo=!1,border:Ds,borderTablet:Hs,borderPhone:Ms,borderUnits:so,pad:t={},contained:_e=!0,fillHeight:L=!1,shadow:$e,shadowTablet:no,shadowPhone:to,justifyTablet:ro,justifyPhone:Vs,alignTablet:Gs,alignPhone:Ws,wrapTablet:lo,blockSpacingTablet:Xs,blockSpacingPhone:js,loop:h,scrollDirection:ve=nr,loopSeconds:Ks=tr,loopDelay:Us=sr,editing:B=!1,fillColor:io,fillColorTablet:zs,fillColorPhone:Js,swatch:Ys,line:p,upcoming:Zs,link:qs,rowLink:co,highlight:Qs,boxShape:ao,boxShapePhone:en,boxShapeTablet:on,angle:sn,jumpHighlight:nn,anchor:tn,sharedSides:rn=_s,sharedRows:ln=!1,boxId:E,slotCount:cn,mirrorCards:uo,content:i,rowTitle:Re,startsOpen:an,rowStyle:dn,sideSpace:un}){const n=wt(),A=mr({[S]:Is},n!==null)[S],mo=Ss({[S]:A}),c=mo?_s:rn,mn=mo?!1:ln,fo=fr({[S]:A},n?.row),x=fo??Ns,ho=fo===null?ks:void 0,Co=zn(ms),fn=vt(),bo=yt()&&!(fn&&n!==null),P=Rt(),_=gt({inCopy:n!==null,nestedCopy:n?.nested===!0,underBox:bo}),So=Xe(Ds,n,_),wo=Xe(Hs,n,_),po=Xe(Ms,n,_),xo=n===null&&!bo&&P?.ids&&E?P.ids.indexOf(E):-1,te=xo>=0&&P&&E?$t(P,E,xo):-1,C=te>=0?P?.hand??null:_&&P?.copies===!0?P.hand:null,o=C?.row?"row":u,d=C?.row?C.row.share:ys,hn=C?.row?C.row.phoneReverse?[...i.blockIds??[]].reverse():void 0:As,re=mn&&!C?.row,T=B?"":co&&n?xt(n.row,co)??"":Nr(qs),$=L?"":$r(ao,en,on),Cn=!L&&_r(ao)!=="",N=Ar(nn,tn),Oe=hr({swatch:Ys},n?.row),le=Oe??ar(io),F=Oe?{className:"",style:{}}:dr(io,zs,Js),bn=Tr(),Po=Er(Oe,bn??void 0),_o=le||F.className?{...le?{backgroundColor:le}:{},...F.style,...Po}:void 0,$o=Xr(),K=p===!0&&o!=="tabs"&&o!=="accordion",r=Ss({bgImage:x,[S]:A}),vo=vr(sn),Ro=r?void 0:_o,ie=r?null:Qs??null,Sn=vo||ie?{...Ro,...vo,...ie}:Ro,ce=St(),wn=ut(),pn=et(),Oo=qn(),xn=Zn(),Pn=Qn(),l=o==="accordion",yo=tt(dn),U=l&&yo==="numbered",ye=ct(),_n=it(),D=or(o,f),a=h==="scroll"&&o!=="tabs"&&!l,$n=Ot(),ae=_||te>=0&&C!==null,Lo=C?C.mirror:uo,vn=te>=0?te:n?.index,de=_&&pt(n?.ownerType),Ao=hs({direction:o,separator:f,loop:h,line:p,bgImage:x,[S]:A,columns:m,columnsTablet:g,share:d,wrap:se},ae,c.desktop)&&At(Lo,vn),Rn=hs({direction:o,separator:f,loop:h,line:p,bgImage:x,[S]:A,columns:m,columnsTablet:g,share:d,wrap:se},ae,c.desktop)&&Nt(Lo)!==null,H=Xt({direction:o,separator:f,loop:h,line:p,columns:m}),k=jt({direction:o,separator:f,loop:h,line:p,columnsTablet:g}),z=Kt({direction:o,separator:f,loop:h,line:p,columns:m,columnsTablet:g,share:d,shareTablet:I}),J=Tt(un)===Et,Le=Bt(J),No=K&&Ue(ne)===el,M=o==="row"&&!r&&!D&&!a&&(!K||No)&&k===""&&z===""?Ue(ne):void 0,V=M??(o==="column"&&!r?Ue(ne):void 0),On=dt(),ue=Kr(c,i.blockCount??0,M),yn=(ue&&(!n||n.index===0)?Ur(c,i.blockCount??0,M):"")+(re&&(!n||n.index===0)?Jr(re,i.blockCount??0):""),ko=zr(re,i.blockCount??0),Io=k!==""?Number(g)>=2:z===""||W(I)!=="",go=k!==""||z!=="",Bo=o==="row"&&!D&&!a&&p!==!0,Ae=Bo&&!c.phone&&!c.desktop?rt(lt(hn,i.blockIds??[]),{editing:B}):void 0,Eo=Ae!==void 0&&!B,Ln=H!==""?Number(m)>=2:W(d)!=="",To=!r&&!l&&!Rn&&!c.desktop&&!c.phone,me=To&&!a?Vt(X,ro,Vs):"",Ne=r||ae?"":kt($n,o,a?void 0:X,y,me?ro:void 0),An=/view-wide:max-view-desktop:justify-/.test(Ne)?me.split(" ").filter(s=>!s.startsWith("view-wide:max-view-desktop:justify-")).join(" "):me,Nn=To&&o==="row"?Dt(y,Gs,Ws):"",kn=!a&&!l&&H===""&&k===""&&!c.desktop?Gt(se,lo):"",Fo=[l?"":W(d),o==="row"?Wt(d):"",H,k,z,Ht(l?"gap":qe),qt(o,f),l&&!U?"border-t border-line":"",An,Nn,kn,l?"":Mt(qe,Xs,js),l?bs(m,w,U):"",U?st:""].filter(Boolean).join(" "),In=Fo?` ${Fo}`:"",Do=["flex",o==="row"?D||a?"flex-row":`flex-row ${oe(w,j,Ls,lo)}`:"flex-col",Yt(a||l?!1:se),r?ur(Fs??"center",o):Ft(a||l?void 0:X,l?void 0:y)+(Ne?` ${Ne}`:"")].join(" ")+In,Y=L||r||$||ye?` ${pe}`:"",ke=Cn?` ${$}`:$?`${Y} ${$}`:Y,Ho=_n&&o==="column"&&!r&&!a&&W(d)===""&&(typeof X=="string"&&X!=="start"||me!==""),Mo=Y||(Ho?` ${pe}`:""),Ie=T?` ${Or}`:"",ge=r||ce||oo?"":" py-6",gn=M===void 0?"":` ${tl(M)}`,Vo=V===void 0||J?"":` ${ol(V)}`,Be=V===void 0?"":` ${nl(V)}`,Bn=`${je}${ge} ${Le}${ke}${Ie}${Vo}${Be}`,En=ce?`${ke}${Ie}${Be}`.trim():`w-full${ge}${ke}${Ie}${Be}`,Z=U&&bs(m,w)===""?Cs("Flex",0,"block"):Cs("Flex",Ze,o==="row"?"inline":"block",Os,D||a?void 0:xe),Go=Jt(d,I,o==="row"?i.blockCount??0:0),Wo=D?{...Z.style,...er(o,f)}:Z.style,Tn=Go?{...Wo,...Go}:Wo,Ee=(s="")=>e(i,{className:`${Do}${Ao?` ${It}`:""}${Z.className}${Mo}${gn}${s?` ${s}`:""}${K?` ${Wr}`:""}${N?` ${yr(N)}`:""}${ue}${ko}`,style:Tn,minEmptyHeight:120,...Ae?{cell:Ae}:null}),Xo=rr(ve)?"":Qt(o,f),jo=a?e(lr,{direction:ve,seconds:Ks,delay:Us,editing:B,copy:s=>Ee(s&&Xo?`${s} ${Xo}`:s)}):U?be(ee,{children:[e("style",{children:nt}),Ee()]}):Ee(),Te=o==="tabs"?e(Yn,{className:`${Do}${Z.className}${ye&&!L&&!r&&!$?"":Y}`,style:Z.style,shape:Rs,children:jo}):jo,Fe=l?e(We.Provider,{value:"accordion",children:e(Ge.Provider,{value:yo,children:Te})}):Oo?e(We.Provider,{value:!1,children:e(Ge.Provider,{value:"plain",children:Te})}):Te,Ko=o==="row"&&!r&&(y===void 0||y==="stretch"),Fn={stretchedRow:Ko,fillingColumn:o==="column"&&(ye||Ho),columnsRow:H!==""||k!==""||ue!==""||ko!==""||o==="row"&&(Array.isArray(d)||Array.isArray(I))||Eo,...Eo?{phoneCells:!0}:null,...Ko&&Bo&&(i.blockCount??0)>=2&&Ln?{picturesFillRow:!0}:null,...go&&!Io?{fillFrom:"desktop"}:null,...Ut(w,j)&&(!go||Io)?{phoneRowFills:!0}:null,...E?{id:E}:null},Uo=n===null?Lt({direction:o,loop:h,bgImage:x,[S]:A,columns:m,mirrorCards:uo},!1):null,zo=Uo?e(fs.Provider,{value:{hand:Uo,ids:i.blockIds??[],boxes:[]},children:Fe}):P?e(fs.Provider,{value:null,children:Fe}):Fe,Jo=e(ds.Provider,{value:Fn,children:e(as.Provider,{value:!1,children:ae?e(_t.Provider,{value:Ao,children:e(Pt.Provider,{value:!_,children:zo})}):zo})}),Dn=Re?.blockCount??0,Yo=Oo==="accordion"&&!!Re&&(B||Dn>0)?e(ot,{startsOpen:an===!0||Pn&&_&&n?.index===0,editing:B,numbered:xn==="numbered",title:e(ds.Provider,{value:ll,children:e(as.Provider,{value:!1,children:e(We.Provider,{value:!1,children:e(Ge.Provider,{value:"plain",children:e(Re,{className:`min-w-0 flex-1 ${Zt}`,minEmptyHeight:24})})})})}),children:Jo}):Jo,De=K?e(Vr,{row:o==="row",stops:i.blockCount??0,desktopLine:M!==void 0&&No,children:Yo}):Yo,Hn=vs?.trim()||(pn?"":void 0),Mn={values:t,frame:ge?24:0},Vn=s=>$o?e(Gr,{on:$o,future:Zs===!0,children:s}):s,Gn=s=>kr(T)?e(Ir,{href:T,newTab:"auto",className:xs,"aria-labelledby":s,[ps]:""}):e("a",{href:T,className:xs,"aria-labelledby":s,[ps]:""}),Zo=(N?Lr(N):"")+yn+(V===void 0||n&&n.index!==0?"":sl(V,{gutter:!J})),qo=Zo?e("style",{dangerouslySetInnerHTML:{__html:Zo}}):null,q=xr({loop:h,direction:o,scrollDirection:ve,bgImage:x,[S]:A}),Wn=c.desktop&&ue!==""&&!le&&!F.className&&!Ps(So,po,wo,so)&&!wr($e,no,to)&&!T&&!$&&!L&&!N&&!Pr(_e&&!q,On)&&Ye(Ze)&&(Je(xe)||Ye(xe))&&oo&&Object.values(t).every(s=>Je(s)||Ye(s)),Xn=s=>({...Wn?{[jr]:""}:null,...r?null:{...Sr($e),...pr($e,no,to)},...N?{[Rr]:N}:null,...s?{id:s}:null}),Qo=H!==""?Number(m):0,jn=oe(w,j)===oe(void 0),Kn=(o==="column"||o==="row"&&!D&&!a&&(Qo===1&&jn||Qo===0&&i.blockCount===1))&&!r&&!K&&!ce,es=r&&wn&&!ce,os=(s,v)=>Vn(e(at,{contained:_e&&!q,style:q?ze:void 0,framedClass:Bn,fillClass:En,columnClass:`${je} ${Le}${Mo}${Vo}`,tabLabel:Hn,pad:r?void 0:Mn,border:Ps(So,po,wo,so),outerAttrs:Xn(v),box:!0,edge:Kn,outerStyle:Sn,outerClass:r?void 0:[F.className,ie?Hr:"",ie&&Po?Mr:""].filter(Boolean).join(" ")||void 0,bleed:es,siteSide:J,children:qo||v?be(ee,{children:[qo,v?Gn(v):null,q?e(us,{children:s}):s]}):q?e(us,{children:s}):s})),He=s=>T?e(il,{children:v=>os(s,v)}):os(s),ss=s=>Co.bound?e(ht,{children:s}):s;if(!r){const s=y===void 0||y==="stretch",v=(W(d)!==""||H!==""||k!=="")&&!zt(w,j)&&!(z!==""&&W(I)==="")&&(s||oe(w)!==oe(void 0));if(!(o==="row"?v:o==="column"&&s))return He(ss(De));const cs=Ct({direction:o,separator:f,loop:h,line:p,share:d,shareTablet:I,sharePhone:j,phoneRow:w,columns:m,columnsTablet:g,stackBelow:ne,shared:c.desktop||c.phone||re,count:cn}),Un={hasWidth:!0,...cs?{bound:bt(cs,Co.bound)}:null};return He(e(ms.Provider,{value:Un,children:De}))}const fe=ws(x),Q=fe?cr(eo,Pe):null,he=fe?Cr({darken:eo,darkenStyle:Pe,darkenTablet:gs,darkenStyleTablet:Es,darkenPhone:Bs,darkenStylePhone:Ts}):{className:"",style:{}},Me=ws(ho),ns=fe?Me?{"--sf-box-bg":Ke(x??""),"--sf-box-bg-p":Ke(ho??"")}:{backgroundImage:Ke(x??""),backgroundSize:"cover",backgroundPosition:"center"}:{},ts=Dr(void 0,void 0,Qe),G=ts.className?ts:null,b=fe?Qr(Qe,Pe):null,Ce=G!==null||!!b?.zoom,rs=Ce?e("div",{"aria-hidden":!0,className:`absolute inset-0${de?" rounded-[inherit]":""}${Me?` ${$s}`:""}${G?` ${G.className}`:""}`,style:{...ns,...G?.style??{}}}):null,Ve=gr({...t,top:Se(t.top)??O(R.desktop,t.unit,"desktop"),bottom:Se(t.bottom)??O(R.desktop,t.unit,"desktop"),topPhone:Se(t.topPhone)??O(R.phone,t.unitPhone,"mobile"),bottomPhone:Se(t.bottomPhone)??O(R.phone,t.unitPhone,"mobile"),left:we(t.left)??O(R.side,t.unit,"desktop"),right:we(t.right)??O(R.side,t.unit,"desktop"),leftPhone:we(t.leftPhone)??O(R.sidePhone,t.unitPhone,"mobile"),rightPhone:we(t.rightPhone)??O(R.sidePhone,t.unitPhone,"mobile"),sideSpace:J?"site":"box"}),ls=e("div",{className:`relative z-[1] ${ir} ${Ve?.className??""}${L||$?` ${pe}`:""}`.trimEnd(),style:Q?{...Ve?.style,...ze,...Br}:{...Ve?.style,...ze},children:ss(De)}),is=es&&_e?e("div",{className:`${je} ${Le}${L||$?` ${pe}`:""}`,children:ls}):ls;return He(e(ee,{children:be("div",{className:`relative isolate overflow-hidden ${br}${Y}${Me&&!Ce?` ${$s}`:""}${F.className?` ${F.className}`:""}${b?` ${b.className}`:""}`,style:{...de?rl:{},..._o,...Ce?{}:ns,...b?b.style:{}},...G?{[Fr]:""}:{},children:[e(Zr,{move:b}),Ce&&be(ee,{children:[e(Yr,{sheet:G?.sheet}),b?.zoom?e("div",{className:`absolute inset-0 overflow-hidden${de?" rounded-[inherit]":""}`,children:e(qr,{move:b,className:"absolute inset-0",children:rs})}):rs]}),e(ft,{wash:Q&&he.className?{...Q,...he.style}:Q,hover:b?.washHover,...de?{className:"rounded-[inherit]"}:{},...he.className?{restClassName:he.className}:{}}),Q?e(mt,{children:is}):is]})}))}export{cl as default};
1
+ import{Fragment as O,jsx as e,jsxs as A}from"react/jsx-runtime";import{useContext as ir,useId as ar,useState as cr}from"react";import dr from"./BoxTabs.js";import{AccordionRowStyleContext as ze,BoxTabPaneContext as Ye,useAccordionRowStyle as ur,useBoxPaneKind as mr,useFirstCopyOpens as fr,useIsTabPane as hr}from"./BoxTabPaneContext.js";import Cr,{ACCORDION_COUNTER_RESET as br}from"./BoxAccordionRow.js";import{ACCORDION_MARK_SHEET as Sr}from"./AccordionMark.js";import{accordionRowStyleOf as wr}from"../../format/lib/content/accordion-row-style.js";import{boxPhoneCell as xr,boxPhoneOrder as pr}from"../../format/lib/content/box-phone-place.js";import{CellFillContext as ws,InBoxContext as xs,useCellOfStretchedRow as _r,useFillsCell as vr}from"./InBoxContext.js";import Rr,{InsideSiteColumn as ps,useInsideSiteGutter as Pr,useSectionRoot as Or}from"./SiteGutterFrame.js";import{BoxSurfaceProvider as Ar}from"./BoxSurfaceContext.js";import $r from"./PictureWash.js";import{BoxCellContext as _s,NoCellBound as Lr}from"./BoxCellContext.js";import{boxCellFractions as yr}from"../lib/content/box-cell-bound.js";import{boundOf as Nr}from"../../format/lib/content/cell-picture-sizes.js";import{useInSiteHeader as Er}from"./PhoneMenuTools.js";import{useCardRow as kr}from"./CardRowContext.js";import{cardLineBetween as Je,framesItsCards as Ir}from"../../format/lib/content/card-place.js";import{rowLinkText as Br}from"../../format/lib/content/card-template.js";import{HandedMirrorContext as gr,MirrorContext as Tr,RowHandContext as vs,boxPlace as Hr,useHandedMirrorAbove as Fr,useHandedRows as Dr,useMirroredCopy as Vr,useUnderCardBox as Mr}from"./MirrorContext.js";import{boxChildrenHand as Wr,isMirroredCopy as Xr,mirrorCardsActs as Rs,mirrorCardsOf as Gr,mirroredBoxClass as jr,MIRROR_ROW_CLASS as Kr,ownsCard as Ur}from"../../format/lib/content/mirror-cards.js";import{FRAME_BASE as Ze,frameGutterOf as zr}from"./BlockFrame.js";import{BOX_SIDE_SPACE_SITE as Yr,boxSideSpaceOf as Jr}from"../../format/lib/content/box-side-space.js";import{containerGapProps as Ps}from"../../format/lib/content/container-gap.js";import{boxLayoutClasses as Zr,boxAlignViewClasses as qr,boxBlockSpacingClass as Qr,boxBlockSpacingViewClasses as et,boxJustifyViewClasses as ot,boxWrapTabletClass as st,boxFitContentClass as nt,boxAccordionColumnsClass as Os,boxRowColumnsClass as rt,boxRowTabletColumnsClass as tt,boxRowTabletShareClass as lt,boxPhoneCellsShareLine as it,boxPhoneRowClasses as ie,boxPhoneRowFits as at,boxShareClasses as K,boxShareVars as ct,boxWrapClass as dt,BOX_GAP_ONLY_CLASS as ut}from"../../format/lib/content/box-layout.js";import{boxSeparatorClasses as mt,boxSeparatorSeamClass as ft,boxSeparatorStyle as ht,isStripBox as Ct}from"../../format/lib/content/box-separator.js";import{DEFAULT_LOOP_DELAY as bt,DEFAULT_LOOP_DIRECTION as St,DEFAULT_LOOP_SECONDS as wt,isVerticalLoop as xt}from"../../format/lib/animation/index.js";import{LoopTrack as pt}from"../lib/animation/LoopTrack.js";import{BOX_CARD_PAD as $,BOX_OWNS_SIDES_CLASS as _t,boxDarkenStyle as As,boxPaintOf as vt,boxFillViews as Rt,boxPlacementClasses as Pt,boxCardProps as Ot,boxIsCard as $s,boxRowPicture as At,boxSwatchFill as $t,boxWashViews as Lt,CARD_SHADOW_CLASS as yt,isBackgroundBox as Ls}from"../../format/lib/content/box-background.js";import{BOX_ROW_IMAGE_PROP as w}from"../../format/lib/content/box-card-rule.js";import{boxShadowAttrs as Nt,boxShadowOnAnyView as Et,boxShadowViewAttrs as kt}from"../../format/lib/content/box-shadow.js";import{boxRunsEdgeToEdge as It,drawsSiteGutter as Bt}from"../../format/lib/content/site-gutter.js";import{boxShapeClass as gt,boxShapeClasses as Tt}from"../../format/lib/content/box-shape.js";import{boxAngleStyle as Ht}from"../../format/lib/content/box-angle.js";import{BOX_JUMP_ATTR as Ft,BOX_LINK_ATTR as ys,BOX_LINK_CLASS as Ns,BOX_LINKED_CLASS as Dt,boxJumpBlocksClass as Vt,boxJumpCss as Mt,boxJumpSlug as Wt,boxLinkOf as Xt,siteLinkDraws as Gt}from"../../format/lib/content/box-link.js";import{SiteLink as jt}from"../lib/site-runtime.js";import{sectionBorderStyle as Es}from"../../format/lib/content/borders.js";import{finiteNumber as _e}from"../../format/lib/finite-number.js";import{padDefaultIn as L,padSideValue as ve,sectionPadAttrs as Kt}from"../lib/content/section-padding.js";import{SECTION_FILL_CLASS as Re}from"../../format/lib/content/section-min-height.js";import{ON_MEDIA_INK_STYLE as Ut,rowFillInkStyle as zt}from"../../format/lib/content/ink.js";import{useThemeLightInk as Yt}from"./ThemeLightInkContext.js";import{sizedBackground as qe}from"../../format/lib/sized-image.js";import{BOX_REVEAL_CLASS as Jt,BOX_REVEAL_CSS as Zt,BOX_REVEAL_SHEET as qt,PHOTO_HOST_ATTR as Qt,resolveImageTreatment as el}from"../../format/lib/content/image-treatment.js";import ol,{HoverArrowsSlot as sl,HoverMediaArrows as nl}from"./HoverMediaLayer.js";import{HOVER_ARROWS_HOST_ATTR as rl,HOVER_ARROWS_HOST_CLASS as tl,HOVER_LAYER_GROUND as ll,cardRowHoverMedia as il,hoverLayerName as al}from"../../format/lib/content/hover-media.js";import{BOX_HIGHLIGHT_CLASS as cl,BOX_HIGHLIGHT_OVER_ROW_INK_CLASS as dl,BOX_SHOW_ON_CARD_HOVER as ul}from"../../format/lib/animation/hover.js";import{BoxRail as ml,BoxRailStop as fl,RAIL_STOPS_CLASS as hl,useTimelineRail as Cl}from"./TimelineRail.js";import{SHARED_PLAIN_ATTR as bl,sharedColumnsClasses as Sl,sharedColumnsCss as wl,sharedRowsClasses as xl,sharedRowsCss as pl}from"../lib/content/box-shared-columns.js";import ks from"./PhotoHoverSheet.js";import{PICTURE_FRAME_ONLY as _l,PictureHoverMoveSheet as vl,PictureHoverZoom as Rl,pictureHoverMoveOf as Pl}from"./PictureHoverMove.js";import{BOX_DESKTOP_LINE as Ol,stackGutterClass as Al,stackLineCss as $l,stackOuterClass as Ll,stackRowClass as yl,storedStackLine as Qe}from"../lib/content/box-stack-line.js";const eo={"--sf-site-gutter":"0px"},Nl={overflowX:"clip",overflowY:"visible"},El={stretchedRow:!1,fillingColumn:!1,columnsRow:!1},Is={desktop:!1,phone:!1},Bs="bg-cover bg-center bg-[image:var(--sf-box-bg)] max-view-wide:bg-[image:var(--sf-box-bg-p)]",oo=u=>u==null||u==="",so=u=>!oo(u)&&Number(u)===0;function kl({children:u}){return e(O,{children:u(ar())})}function Il({direction:u,label:gs,tabShape:Ts,gap:no,gapPhone:Hs,gapTablet:Pe,justify:U,align:y,wrap:ae,share:Fs,sharePhone:z,shareTablet:g,wrapPhone:Ds,orderPhone:Vs,phoneRow:x,columns:m,columnsTablet:T,separator:f,stackBelow:ce,blockSpacing:ro,bgImage:Ms,bgImagePhone:Ws,rowImage:Xs,hoverShow:Gs,pictureHover:H,darken:Oe,darkenStyle:de,darkenTablet:js,darkenPhone:Ks,darkenStyleTablet:Us,darkenStylePhone:zs,placement:Ys,padV2:to=!1,border:Js,borderTablet:Zs,borderPhone:qs,borderUnits:lo,pad:r={},contained:Ae=!0,fillHeight:N=!1,shadow:$e,shadowTablet:io,shadowPhone:ao,justifyTablet:co,justifyPhone:Qs,alignTablet:en,alignPhone:on,wrapTablet:uo,blockSpacingTablet:sn,blockSpacingPhone:nn,loop:h,scrollDirection:Le=St,loopSeconds:rn=wt,loopDelay:tn=bt,editing:E=!1,fillColor:mo,fillColorTablet:ln,fillColorPhone:an,swatch:cn,line:p,upcoming:dn,link:un,rowLink:fo,highlight:mn,boxShape:ho,boxShapePhone:fn,boxShapeTablet:hn,angle:Cn,jumpHighlight:bn,anchor:Sn,sharedSides:wn=Is,sharedRows:xn=!1,boxId:F,slotCount:pn,mirrorCards:Co,content:i,rowTitle:ye,startsOpen:_n,rowStyle:vn,sideSpace:Rn}){const n=kr(),k=Ot({[w]:Xs},n!==null)[w],bo=$s({[w]:k}),a=bo?Is:wn,Pn=bo?!1:xn,So=At({[w]:k},n?.row),_=So??Ms,wo=So===null?Ws:void 0,xo=ir(_s),[po,On]=cr(null),An=Fr(),_o=Mr()&&!(An&&n!==null),v=Dr(),C=Ur({inCopy:n!==null,nestedCopy:n?.nested===!0,underBox:_o}),Ne=Gs===ul&&n!==null&&!C&&!(E&&n.previewHover===!0),vo=Je(Js,n,C),Ro=Je(Zs,n,C),Po=Je(qs,n,C),Oo=n===null&&!_o&&v?.ids&&F?v.ids.indexOf(F):-1,ue=Oo>=0&&v&&F?Hr(v,F,Oo):-1,b=ue>=0?v?.hand??null:C&&v?.copies===!0?v.hand:null,s=b?.row?"row":u,d=b?.row?b.row.share:Fs,$n=b?.row?b.row.phoneReverse?[...i.blockIds??[]].reverse():void 0:Vs,me=Pn&&!b?.row,D=E?"":fo&&n?Br(n.row,fo)??"":Xt(un),R=N?"":Tt(ho,fn,hn),Ln=!N&&gt(ho)!=="",I=Wt(bn,Sn),Ee=$t({swatch:cn},n?.row),fe=Ee??vt(mo),V=Ee?{className:"",style:{}}:Rt(mo,ln,an),yn=Yt(),Ao=zt(Ee,yn??void 0),$o=fe||V.className?{...fe?{backgroundColor:fe}:{},...V.style,...Ao}:void 0,Lo=Cl(),Y=p===!0&&s!=="tabs"&&s!=="accordion",t=$s({bgImage:_,[w]:k}),yo=Ht(Cn),No=t?void 0:$o,he=t?null:mn??null,Nn=yo||he?{...No,...yo,...he}:No,Ce=Er(),En=Or(),kn=hr(),Eo=mr(),In=ur(),Bn=fr(),l=s==="accordion",ko=wr(vn),J=l&&ko==="numbered",ke=vr(),gn=_r(),M=Ct(s,f),c=h==="scroll"&&s!=="tabs"&&!l,Tn=Vr(),be=C||ue>=0&&b!==null,Io=b?b.mirror:Co,Hn=ue>=0?ue:n?.index,Z=C&&Ir(n?.ownerType),Bo=Rs({direction:s,separator:f,loop:h,line:p,bgImage:_,[w]:k,columns:m,columnsTablet:T,share:d,wrap:ae},be,a.desktop)&&Xr(Io,Hn),Fn=Rs({direction:s,separator:f,loop:h,line:p,bgImage:_,[w]:k,columns:m,columnsTablet:T,share:d,wrap:ae},be,a.desktop)&&Gr(Io)!==null,W=rt({direction:s,separator:f,loop:h,line:p,columns:m}),B=tt({direction:s,separator:f,loop:h,line:p,columnsTablet:T}),q=lt({direction:s,separator:f,loop:h,line:p,columns:m,columnsTablet:T,share:d,shareTablet:g}),Q=Jr(Rn)===Yr,Ie=zr(Q),go=Y&&Qe(ce)===Ol,X=s==="row"&&!t&&!M&&!c&&(!Y||go)&&B===""&&q===""?Qe(ce):void 0,G=X??(s==="column"&&!t?Qe(ce):void 0),Dn=Pr(),Se=Sl(a,i.blockCount??0,X),Vn=(Se&&(!n||n.index===0)?wl(a,i.blockCount??0,X):"")+(me&&(!n||n.index===0)?pl(me,i.blockCount??0):""),To=xl(me,i.blockCount??0),Ho=B!==""?Number(T)>=2:q===""||K(g)!=="",Fo=B!==""||q!=="",Do=s==="row"&&!M&&!c&&p!==!0,Be=Do&&!a.phone&&!a.desktop?xr(pr($n,i.blockIds??[]),{editing:E}):void 0,Vo=Be!==void 0&&!E,Mn=W!==""?Number(m)>=2:K(d)!=="",Mo=!t&&!l&&!Fn&&!a.desktop&&!a.phone,we=Mo&&!c?ot(U,co,Qs):"",ge=t||be?"":jr(Tn,s,c?void 0:U,y,we?co:void 0),Wn=/view-wide:max-view-desktop:justify-/.test(ge)?we.split(" ").filter(o=>!o.startsWith("view-wide:max-view-desktop:justify-")).join(" "):we,Xn=Mo&&s==="row"?qr(y,en,on):"",Gn=!c&&!l&&W===""&&B===""&&!a.desktop?st(ae,uo):"",Wo=[l?"":K(d),s==="row"?nt(d):"",W,B,q,Qr(l?"gap":ro),mt(s,f),l&&!J?"border-t border-line":"",Wn,Xn,Gn,l?"":et(ro,sn,nn),l?Os(m,x,J):"",J?br:""].filter(Boolean).join(" "),jn=Wo?` ${Wo}`:"",Xo=["flex",s==="row"?M||c?"flex-row":`flex-row ${ie(x,z,Ds,uo)}`:"flex-col",dt(c||l?!1:ae),t?Pt(Ys??"center",s):Zr(c||l?void 0:U,l?void 0:y)+(ge?` ${ge}`:"")].join(" ")+jn,ee=N||t||R||ke?` ${Re}`:"",Te=Ln?` ${R}`:R?`${ee} ${R}`:ee,Go=gn&&s==="column"&&!t&&!c&&K(d)===""&&(typeof U=="string"&&U!=="start"||we!==""),jo=ee||(Go?` ${Re}`:""),He=D?` ${Dt}`:"",Fe=t||Ce||to?"":" py-6",Kn=X===void 0?"":` ${yl(X)}`,Ko=G===void 0||Q?"":` ${Al(G)}`,De=G===void 0?"":` ${Ll(G)}`,Un=`${Ze}${Fe} ${Ie}${Te}${He}${Ko}${De}`,zn=Ce?`${Te}${He}${De}`.trim():`w-full${Fe}${Te}${He}${De}`,oe=J&&Os(m,x)===""?Ps("Flex",0,"block"):Ps("Flex",no,s==="row"?"inline":"block",Hs,M||c?void 0:Pe),Uo=ct(d,g,s==="row"?i.blockCount??0:0),zo=M?{...oe.style,...ht(s,f)}:oe.style,Yn=Uo?{...zo,...Uo}:zo,Ve=(o="")=>e(i,{className:`${Xo}${Bo?` ${Kr}`:""}${oe.className}${jo}${Kn}${o?` ${o}`:""}${Y?` ${hl}`:""}${I?` ${Vt(I)}`:""}${Se}${To}`,style:Yn,minEmptyHeight:120,...Be?{cell:Be}:null}),Yo=xt(Le)?"":ft(s,f),Jo=c?e(pt,{direction:Le,seconds:rn,delay:tn,editing:E,copy:o=>Ve(o&&Yo?`${o} ${Yo}`:o)}):J?A(O,{children:[e("style",{children:Sr}),Ve()]}):Ve(),Me=s==="tabs"?e(dr,{className:`${Xo}${oe.className}${ke&&!N&&!t&&!R?"":ee}`,style:oe.style,shape:Ts,children:Jo}):Jo,We=l?e(Ye.Provider,{value:"accordion",children:e(ze.Provider,{value:ko,children:Me})}):Eo?e(Ye.Provider,{value:!1,children:e(ze.Provider,{value:"plain",children:Me})}):Me,Zo=s==="row"&&!t&&(y===void 0||y==="stretch"),Jn={stretchedRow:Zo,fillingColumn:s==="column"&&(ke||Go),columnsRow:W!==""||B!==""||Se!==""||To!==""||s==="row"&&(Array.isArray(d)||Array.isArray(g))||Vo,...Vo?{phoneCells:!0}:null,...Zo&&Do&&(i.blockCount??0)>=2&&Mn?{picturesFillRow:!0}:null,...Fo&&!Ho?{fillFrom:"desktop"}:null,...it(x,z)&&(!Fo||Ho)?{phoneRowFills:!0}:null,...F?{id:F}:null},qo=n===null?Wr({direction:s,loop:h,bgImage:_,[w]:k,columns:m,mirrorCards:Co},!1):null,Qo=qo?e(vs.Provider,{value:{hand:qo,ids:i.blockIds??[],boxes:[]},children:We}):v?e(vs.Provider,{value:null,children:We}):We,es=e(xs.Provider,{value:Jn,children:e(ws.Provider,{value:!1,children:be?e(Tr.Provider,{value:Bo,children:e(gr.Provider,{value:!C,children:Qo})}):Qo})}),Zn=ye?.blockCount??0,os=Eo==="accordion"&&!!ye&&(E||Zn>0)?e(Cr,{startsOpen:_n===!0||Bn&&C&&n?.index===0,editing:E,numbered:In==="numbered",title:e(xs.Provider,{value:El,children:e(ws.Provider,{value:!1,children:e(Ye.Provider,{value:!1,children:e(ze.Provider,{value:"plain",children:e(ye,{className:`min-w-0 flex-1 ${ut}`,minEmptyHeight:24})})})})}),children:es}):es,Xe=Y?e(ml,{row:s==="row",stops:i.blockCount??0,desktopLine:X!==void 0&&go,children:os}):os,qn=gs?.trim()||(kn?"":void 0),Qn={values:r,frame:Fe?24:0},er=o=>Lo?e(fl,{on:Lo,future:dn===!0,children:o}):o,or=o=>Gt(D)?e(jt,{href:D,newTab:"auto",className:Ns,"aria-labelledby":o,[ys]:""}):e("a",{href:D,className:Ns,"aria-labelledby":o,[ys]:""}),ss=(I?Mt(I):"")+Vn+(G===void 0||n&&n.index!==0?"":$l(G,{gutter:!Q})),ns=ss?e("style",{dangerouslySetInnerHTML:{__html:ss}}):null,se=It({loop:h,direction:s,scrollDirection:Le,bgImage:_,[w]:k}),sr=a.desktop&&Se!==""&&!fe&&!V.className&&!Es(vo,Po,Ro,lo)&&!Et($e,io,ao)&&!D&&!R&&!N&&!I&&!Bt(Ae&&!se,Dn)&&so(no)&&(oo(Pe)||so(Pe))&&to&&Object.values(r).every(o=>oo(o)||so(o)),nr=o=>({...sr?{[bl]:""}:null,...t?null:{...Nt($e),...kt($e,io,ao)},...I?{[Ft]:I}:null,...o?{id:o}:null}),rs=W!==""?Number(m):0,rr=ie(x,z)===ie(void 0),tr=(s==="column"||s==="row"&&!M&&!c&&(rs===1&&rr||rs===0&&i.blockCount===1))&&!t&&!Y&&!Ce,ts=t&&En&&!Ce,xe=!t&&n!==null?As(Oe,de):null,ls=Ne||xe?A(O,{children:[Ne?e(ks,{sheet:Zt,name:qt}):null,xe?e("div",{"aria-hidden":!0,className:"pointer-events-none absolute inset-0 -z-10 rounded-[inherit]",style:xe}):null]}):null,is=[Ne?Jt:"",xe?"relative isolate":""].filter(Boolean).join(" "),as=o=>ls?A(O,{children:[ls,o]}):o,cs=(o,P)=>er(e(Rr,{contained:Ae&&!se,style:se?eo:void 0,framedClass:Un,fillClass:zn,columnClass:`${Ze} ${Ie}${jo}${Ko}`,tabLabel:qn,pad:t?void 0:Qn,border:Es(vo,Po,Ro,lo),outerAttrs:nr(P),box:!0,edge:tr,outerStyle:Nn,outerClass:t?is||void 0:[V.className,he?cl:"",he&&Ao?dl:"",is].filter(Boolean).join(" ")||void 0,bleed:ts,siteSide:Q,children:ns||P?A(O,{children:[ns,P?or(P):null,se?e(ps,{children:o}):o]}):se?e(ps,{children:o}):o})),Ge=o=>D?e(kl,{children:P=>cs(as(o),P)}):cs(as(o)),ds=o=>xo.bound?e(Lr,{children:o}):o;if(!t){const o=y===void 0||y==="stretch",P=(K(d)!==""||W!==""||B!=="")&&!at(x,z)&&!(q!==""&&K(g)==="")&&(o||ie(x)!==ie(void 0));if(!(s==="row"?P:s==="column"&&o))return Ge(ds(Xe));const Ss=yr({direction:s,separator:f,loop:h,line:p,share:d,shareTablet:g,sharePhone:z,phoneRow:x,columns:m,columnsTablet:T,stackBelow:ce,shared:a.desktop||a.phone||me,count:pn}),lr={hasWidth:!0,...Ss?{bound:Nr(Ss,xo.bound)}:null};return Ge(e(_s.Provider,{value:lr,children:Xe}))}const ne=Ls(_),re=ne?As(Oe,de):null,pe=ne?Lt({darken:Oe,darkenStyle:de,darkenTablet:js,darkenStyleTablet:Us,darkenPhone:Ks,darkenStylePhone:zs}):{className:"",style:{}},je=Ls(wo),us=ne?je?{"--sf-box-bg":qe(_??""),"--sf-box-bg-p":qe(wo??"")}:{backgroundImage:qe(_??""),backgroundSize:"cover",backgroundPosition:"center"}:{},ms=el(void 0,void 0,H),j=ms.className?ms:null,te=ne&&n&&H?.kind==="nextImage"&&H.media?il(n,H.media):null,S=ne?Pl(H,de)??(te?_l:null):null,fs=H?.media?.cover??"picture",Ke=te?e("div",{className:`absolute inset-0 isolate${Z?" rounded-[inherit]":""}`,children:e(sl.Provider,{value:On,children:e(ol,{media:te,name:al(n?.row),cover:fs,ground:ll[fs],arrowsAbove:!0})})}):null,le=j!==null||!!S?.zoom,hs=le?e("div",{"aria-hidden":!0,className:`absolute inset-0${Z?" rounded-[inherit]":""}${je?` ${Bs}`:""}${j?` ${j.className}`:""}`,style:{...us,...j?.style??{}}}):null,Ue=Kt({...r,top:_e(r.top)??L($.desktop,r.unit,"desktop"),bottom:_e(r.bottom)??L($.desktop,r.unit,"desktop"),topPhone:_e(r.topPhone)??L($.phone,r.unitPhone,"mobile"),bottomPhone:_e(r.bottomPhone)??L($.phone,r.unitPhone,"mobile"),left:ve(r.left)??L($.side,r.unit,"desktop"),right:ve(r.right)??L($.side,r.unit,"desktop"),leftPhone:ve(r.leftPhone)??L($.sidePhone,r.unitPhone,"mobile"),rightPhone:ve(r.rightPhone)??L($.sidePhone,r.unitPhone,"mobile"),sideSpace:Q?"site":"box"}),Cs=e("div",{className:`relative z-[1] ${_t} ${Ue?.className??""}${N||R?` ${Re}`:""}`.trimEnd(),style:re?{...Ue?.style,...eo,...Ut}:{...Ue?.style,...eo},children:ds(Xe)}),bs=ts&&Ae?e("div",{className:`${Ze} ${Ie}${N||R?` ${Re}`:""}`,children:Cs}):Cs;return Ge(e(O,{children:A("div",{className:`relative isolate overflow-hidden ${yt}${ee}${je&&!le?` ${Bs}`:""}${V.className?` ${V.className}`:""}${S?` ${S.className}`:""}`,style:{...Z?Nl:{},...$o,...le?{}:us,...S?S.style:{}},...j||te?{[Qt]:""}:{},children:[e(vl,{move:S}),le&&A(O,{children:[e(ks,{sheet:j?.sheet}),S?.zoom?e("div",{className:`absolute inset-0 overflow-hidden${Z?" rounded-[inherit]":""}`,children:A(Rl,{move:S,className:"absolute inset-0",children:[hs,Ke]})}):A(O,{children:[hs,Ke]})]}),!le&&Ke,e($r,{wash:re&&pe.className?{...re,...pe.style}:re,hover:S?.washHover,...Z?{className:"rounded-[inherit]"}:{},...pe.className?{restClassName:pe.className}:{}}),re?e(Ar,{children:bs}):bs,te?e("div",{[rl]:"",className:tl,children:po?e(nl,{state:po}):null}):null]})}))}export{Il as default};
@@ -1,9 +1,24 @@
1
1
  import type { HoverMediaCover } from "../../format/lib/animation/hover.js";
2
+ import { type HeroArrowDirection } from "../../format/lib/hero-arrows.js";
2
3
  import { type HoverMediaPick } from "../../format/lib/content/hover-media.js";
3
4
  export interface HoverMediaLayerProps {
4
5
  media: HoverMediaPick | null;
5
6
  name: string;
6
7
  cover?: HoverMediaCover;
7
8
  ground?: string;
9
+ arrowsAbove?: boolean;
8
10
  }
9
- export default function HoverMediaLayer({ media, name, cover, ground }: HoverMediaLayerProps): import("react").JSX.Element | null;
11
+ export interface HoverArrowsState {
12
+ name: string;
13
+ count: number;
14
+ shown: boolean;
15
+ press: (direction: HeroArrowDirection, e: {
16
+ preventDefault(): void;
17
+ stopPropagation(): void;
18
+ }) => void;
19
+ }
20
+ export declare const HoverArrowsSlot: import("react").Context<((state: HoverArrowsState | null) => void) | null>;
21
+ export declare function HoverMediaArrows({ state }: {
22
+ state: HoverArrowsState;
23
+ }): import("react").JSX.Element;
24
+ export default function HoverMediaLayer({ media, name, cover, ground, arrowsAbove }: HoverMediaLayerProps): import("react").JSX.Element | null;
@@ -1 +1 @@
1
- "use client";import{jsx as A,jsxs as I,Fragment as k}from"react/jsx-runtime";import{useEffect as T,useRef as W,useState as p}from"react";import $ from"./HeroArrows.js";import{arrowStep as z,HERO_ARROW_DIRECTIONS as Y}from"../../format/lib/hero-arrows.js";import{hoverArrowLabel as q,hoverMediaCount as V}from"../../format/lib/content/hover-media.js";import{CARD_COPY_ATTR as B,PHOTO_HOST_ATTR as G}from"../../format/lib/content/image-treatment.js";import{useDeferredPicture as J}from"../lib/first-screen.js";import{sizedImage as j}from"../../format/lib/sized-image.js";const K=200,H="data-hover-media-anchor";function Q(r){const i=r.closest(`[${B}]`);for(let o=r.parentElement;o;o=o.parentElement){const u=!i?.contains(o)&&[...o.children].some(h=>h.matches("a[href]"));if(o.hasAttribute(G)||u)return o.querySelectorAll(`[${H}]`).length===1?o:null}return null}const U={card:"pointer-events-none absolute inset-0 z-20 overflow-hidden rounded-[inherit] transition-opacity duration-200 motion-reduce:transition-none",picture:"pointer-events-none absolute inset-0 z-20 overflow-hidden transition-opacity duration-200 motion-reduce:transition-none"},X={cover:"h-full w-full object-cover",contain:"h-full w-full object-contain"};function M(r){const i=j(r,{fallbackWidth:960});return i.src===r?{src:r}:{src:i.src,srcSet:`${i.src} 1x, ${j(r,{fallbackWidth:1280}).src} 2x`}}const P=()=>typeof window<"u"&&typeof window.matchMedia=="function"&&window.matchMedia("(hover: hover) and (pointer: fine)").matches;function Z({media:r,name:i,cover:o="card",ground:u}){const v=W(null),h=J(),[c,w]=p(!1),[D,S]=p(!1),[l,L]=p(0),[E,_]=p(!1),f=r?.urls??[],s=f.length;if(T(()=>{const n=v.current;if(!n||s===0)return;const e=Q(n)??n.parentElement;if(!e)return;let t,m=!1;const y=()=>{t!==void 0&&clearTimeout(t),t=void 0,w(!1),S(!1),L(0),_(!1),m=!1},O=a=>{a.pointerType!=="mouse"||!P()||(t!==void 0&&clearTimeout(t),t=setTimeout(()=>{t=void 0,w(!0)},K))},R=a=>{if(a.pointerType==="mouse"){if(!m&&e.contains(document.activeElement)){t!==void 0&&clearTimeout(t),t=void 0;return}y()}},b=()=>{m=!0},x=()=>{!m&&P()&&w(!0)},g=a=>{const C=a.relatedTarget;(!C||!e.contains(C))&&y()};return e.addEventListener("pointerenter",O),e.addEventListener("pointerleave",R),e.addEventListener("pointerdown",b),e.addEventListener("focusin",x),e.addEventListener("focusout",g),()=>{t!==void 0&&clearTimeout(t),e.removeEventListener("pointerenter",O),e.removeEventListener("pointerleave",R),e.removeEventListener("pointerdown",b),e.removeEventListener("focusin",x),e.removeEventListener("focusout",g)}},[s]),T(()=>{if(!c)return;const n=requestAnimationFrame(()=>S(!0));return()=>cancelAnimationFrame(n)},[c]),T(()=>{if(!c||!E||s<2)return;const n=new Image,e=M(f[(l+1)%s]);e.srcSet&&(n.srcset=e.srcSet),n.src=e.src},[c,E,l,s,f]),!r||s===0)return null;const d=c?M(f[Math.min(l,s-1)]):null,F=(n,e)=>{e.preventDefault(),e.stopPropagation(),_(!0),L(t=>z(n,t,s))},N=Object.fromEntries(Y.map(n=>[n,q(n,i)]));return I(k,{children:[A("span",{ref:v,className:"sr-only","aria-live":"polite",[H]:"",children:c&&E?V(l,s):""}),d?I("div",{"data-hover-media":"","data-hover-cover":o,className:U[o],style:{opacity:D?1:0,...u?{backgroundColor:u}:{}},children:[A("img",{src:d.src,...d.srcSet?{srcSet:d.srcSet}:{},alt:"",decoding:"async",...h,className:X[r.fit]}),s>1?A($,{shape:"solid",sides:!0,labels:N,onPress:F}):null]}):null]})}export{Z as default};
1
+ "use client";import{jsx as w,jsxs as P,Fragment as q}from"react/jsx-runtime";import{createContext as B,useCallback as V,useContext as G,useEffect as A,useRef as J,useState as E}from"react";import K from"./HeroArrows.js";import{arrowStep as Q,HERO_ARROW_DIRECTIONS as U}from"../../format/lib/hero-arrows.js";import{hoverArrowLabel as X,hoverMediaCount as Z}from"../../format/lib/content/hover-media.js";import{CARD_COPY_ATTR as ee,PHOTO_HOST_ATTR as te}from"../../format/lib/content/image-treatment.js";import{useDeferredPicture as ne}from"../lib/first-screen.js";import{sizedImage as $}from"../../format/lib/sized-image.js";const re=B(null);function N({name:t,count:s,press:o}){if(s<2)return null;const a=Object.fromEntries(U.map(l=>[l,X(l,t)]));return w(K,{shape:"solid",sides:!0,labels:a,onPress:o})}function Ae({state:t}){return w("div",{className:ce,style:{opacity:t.shown?1:0},children:N(t)})}const oe=200,k="data-hover-media-anchor";function se(t){const s=t.closest(`[${ee}]`);for(let o=t.parentElement;o;o=o.parentElement){const a=!s?.contains(o)&&[...o.children].some(d=>d.matches("a[href]"));if(o.hasAttribute(te)||a)return o.querySelectorAll(`[${k}]`).length===1?o:null}return null}const b="transition-opacity duration-200 motion-reduce:transition-none",ie={card:`pointer-events-none absolute inset-0 z-20 overflow-hidden rounded-[inherit] ${b}`,picture:`pointer-events-none absolute inset-0 z-20 overflow-hidden ${b}`},ce=`pointer-events-none absolute inset-0 ${b}`,ae={cover:"h-full w-full object-cover",contain:"h-full w-full object-contain"};function W(t){const s=$(t,{fallbackWidth:960});return s.src===t?{src:t}:{src:s.src,srcSet:`${s.src} 1x, ${$(t,{fallbackWidth:1280}).src} 2x`}}const Y=()=>typeof window<"u"&&typeof window.matchMedia=="function"&&window.matchMedia("(hover: hover) and (pointer: fine)").matches;function le({media:t,name:s,cover:o="card",ground:a,arrowsAbove:l=!1}){const d=J(null),z=ne(),[c,S]=E(!1),[L,x]=E(!1),[m,O]=E(0),[T,y]=E(!1),u=G(re),_=l&&u!==null,p=t?.urls??[],n=p.length;A(()=>{const i=d.current;if(!i||n===0)return;const e=se(i)??i.parentElement;if(!e)return;let r,h=!1;const g=()=>{r!==void 0&&clearTimeout(r),r=void 0,S(!1),x(!1),O(0),y(!1),h=!1},H=f=>{f.pointerType!=="mouse"||!Y()||(r!==void 0&&clearTimeout(r),r=setTimeout(()=>{r=void 0,S(!0)},oe))},I=f=>{if(f.pointerType==="mouse"){if(!h&&e.contains(document.activeElement)){r!==void 0&&clearTimeout(r),r=void 0;return}g()}},M=()=>{h=!0},j=()=>{!h&&Y()&&S(!0)},D=f=>{const F=f.relatedTarget;(!F||!e.contains(F))&&g()};return e.addEventListener("pointerenter",H),e.addEventListener("pointerleave",I),e.addEventListener("pointerdown",M),e.addEventListener("focusin",j),e.addEventListener("focusout",D),()=>{r!==void 0&&clearTimeout(r),e.removeEventListener("pointerenter",H),e.removeEventListener("pointerleave",I),e.removeEventListener("pointerdown",M),e.removeEventListener("focusin",j),e.removeEventListener("focusout",D)}},[n]),A(()=>{if(!c)return;const i=requestAnimationFrame(()=>x(!0));return()=>cancelAnimationFrame(i)},[c]),A(()=>{if(!c||!T||n<2)return;const i=new Image,e=W(p[(m+1)%n]);e.srcSet&&(i.srcset=e.srcSet),i.src=e.src},[c,T,m,n,p]);const R=V((i,e)=>{e.preventDefault(),e.stopPropagation(),y(!0),O(r=>Q(i,r,n))},[n]),C=!!t&&c&&n>1;if(A(()=>{if(!(!_||!u))return u(C?{name:s,count:n,shown:L,press:R}:null),()=>u(null)},[_,u,C,s,n,L,R]),!t||n===0)return null;const v=c?W(p[Math.min(m,n-1)]):null;return P(q,{children:[w("span",{ref:d,className:"sr-only","aria-live":"polite",[k]:"",children:c&&T?Z(m,n):""}),v?P("div",{"data-hover-media":"","data-hover-cover":o,className:ie[o],style:{opacity:L?1:0,...a?{backgroundColor:a}:{}},children:[w("img",{src:v.src,...v.srcSet?{srcSet:v.srcSet}:{},alt:"",decoding:"async",...z,className:ae[t.fit]}),_?null:N({name:s,count:n,press:R})]}):null]})}export{re as HoverArrowsSlot,Ae as HoverMediaArrows,le as default};
@@ -1,7 +1,7 @@
1
1
  import { type ImageAspect } from "../../format/lib/content/image-aspect.js";
2
2
  import { type ImageFit } from "../../format/lib/content/image-fit.js";
3
3
  import type { HoverMediaCover, PictureHoverDrawn } from "../../format/lib/animation/hover.js";
4
- import type { HoverMediaPick } from "../../format/lib/content/hover-media.js";
4
+ import { type HoverMediaPick } from "../../format/lib/content/hover-media.js";
5
5
  import type { PadValues } from "../lib/content/section-padding.js";
6
6
  export type ImageHoverLayer = {
7
7
  media: HoverMediaPick;