efficient-web-builder 22.1.1 → 23.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (139) hide show
  1. package/CHANGELOG.md +189 -5
  2. package/dist/components/DuplicateToPageMenu.d.ts +1 -1
  3. package/dist/components/DuplicateToPageMenu.js +1 -1
  4. package/dist/components/HeroArrows.js +1 -1
  5. package/dist/components/HeroSection.d.ts +1 -1
  6. package/dist/components/HeroSection.js +1 -1
  7. package/dist/components/HeroSingle.js +1 -1
  8. package/dist/components/HeroVideoPlay.js +1 -1
  9. package/dist/components/LocationsGroupedField.js +1 -1
  10. package/dist/components/MediaUploadField.js +1 -1
  11. package/dist/components/PagesPanel.js +1 -1
  12. package/dist/components/PartSettingsPanel.js +1 -1
  13. package/dist/components/PreviewChatContext.js +1 -1
  14. package/dist/components/PreviewHeaderContext.js +1 -1
  15. package/dist/components/PreviewHeroPartContext.d.ts +1 -1
  16. package/dist/components/PreviewHeroPartContext.js +1 -1
  17. package/dist/components/PreviewLocationPartContext.d.ts +1 -1
  18. package/dist/components/PreviewLocationPartContext.js +1 -1
  19. package/dist/components/PreviewPartAnchors.js +1 -1
  20. package/dist/components/PreviewTickerContext.d.ts +1 -1
  21. package/dist/components/PreviewTickerContext.js +1 -1
  22. package/dist/components/SectionEditor.js +1 -1
  23. package/dist/components/SectionTextEntries.js +1 -1
  24. package/dist/components/SectionTextPartBridge.js +1 -1
  25. package/dist/components/SiteFields.js +1 -1
  26. package/dist/components/SiteTextStylesField.js +1 -1
  27. package/dist/components/SlotChildRows.d.ts +1 -1
  28. package/dist/components/StandaloneSectionEditor.js +1 -1
  29. package/dist/components/StorefrontEditor.js +1 -1
  30. package/dist/components/WebsiteScreenParts.js +1 -1
  31. package/dist/components/preview-devices.d.ts +1 -1
  32. package/dist/components/preview-devices.js +1 -1
  33. package/dist/components/storefront-editor.css +5 -42
  34. package/dist/components/usePinnedChromeSeed.js +1 -1
  35. package/dist/lib/content/footer.d.ts +1 -1
  36. package/dist/lib/puck/apply-card-corners.d.ts +1 -1
  37. package/dist/lib/puck/block-source-fields.d.ts +2 -0
  38. package/dist/lib/puck/block-source-fields.js +1 -1
  39. package/dist/lib/puck/blocks/block-types.d.ts +4 -1
  40. package/dist/lib/puck/blocks/general/CategoryBar/render.js +1 -1
  41. package/dist/lib/puck/blocks/general/ContactLocations/render.js +1 -1
  42. package/dist/lib/puck/blocks/general/Eyebrow/render.js +1 -1
  43. package/dist/lib/puck/blocks/general/FAQ/render.js +1 -1
  44. package/dist/lib/puck/blocks/general/FeaturedCover/fields.js +1 -1
  45. package/dist/lib/puck/blocks/general/FeaturedCover/render.js +1 -1
  46. package/dist/lib/puck/blocks/general/Flex/fields.js +1 -1
  47. package/dist/lib/puck/blocks/general/Footprint/render.js +1 -1
  48. package/dist/lib/puck/blocks/general/Heading/render.js +1 -1
  49. package/dist/lib/puck/blocks/general/HeroGroup/fields.js +1 -1
  50. package/dist/lib/puck/blocks/general/IntroBleed/render.js +1 -1
  51. package/dist/lib/puck/blocks/general/LogoBlock/fields.js +1 -1
  52. package/dist/lib/puck/blocks/general/LogoBlock/render.js +1 -1
  53. package/dist/lib/puck/blocks/general/LongRead/fields.js +1 -1
  54. package/dist/lib/puck/blocks/general/LongRead/render.js +1 -1
  55. package/dist/lib/puck/blocks/general/Mockup/fields.js +2 -2
  56. package/dist/lib/puck/blocks/general/PostCard/fields.js +1 -1
  57. package/dist/lib/puck/blocks/general/PostCard/render.js +1 -1
  58. package/dist/lib/puck/blocks/general/ProcessSteps/fields.js +1 -1
  59. package/dist/lib/puck/blocks/general/SectionHeader/fields.js +1 -1
  60. package/dist/lib/puck/blocks/general/SectionHeader/render.js +1 -1
  61. package/dist/lib/puck/blocks/general/Split/render.js +1 -1
  62. package/dist/lib/puck/blocks/general/Text/render.js +1 -1
  63. package/dist/lib/puck/blocks/general/TitleWithButtons/render.js +1 -1
  64. package/dist/lib/puck/blocks/general/render-config.d.ts +8 -0
  65. package/dist/lib/puck/blocks/general/render-config.js +1 -0
  66. package/dist/lib/puck/blocks/scaffold.js +1 -1
  67. package/dist/lib/puck/blocks/shared-fields.d.ts +2 -2
  68. package/dist/lib/puck/canvas-typing.d.ts +1 -1
  69. package/dist/lib/puck/canvas-typing.js +1 -1
  70. package/dist/lib/puck/controls.d.ts +5 -3
  71. package/dist/lib/puck/controls.js +1 -1
  72. package/dist/lib/puck/footer-blocks.d.ts +1 -1
  73. package/dist/lib/puck/footer-blocks.js +1 -1
  74. package/dist/lib/puck/general-order.d.ts +3 -0
  75. package/dist/lib/puck/general-order.js +1 -0
  76. package/dist/lib/puck/general-registry.d.ts +1 -1
  77. package/dist/lib/puck/general-registry.js +1 -1
  78. package/dist/lib/puck/header-clearance.js +1 -1
  79. package/dist/lib/puck/heading-outline.d.ts +1 -1
  80. package/dist/lib/puck/heading-outline.js +1 -1
  81. package/dist/lib/puck/migrate-legacy.js +1 -1
  82. package/dist/lib/puck/mockup-variant-fields.d.ts +1 -1
  83. package/dist/lib/puck/mockup-variant-fields.js +1 -1
  84. package/dist/lib/puck/overrides.js +1 -1
  85. package/dist/lib/puck/page-frame.d.ts +34 -0
  86. package/dist/lib/puck/page-frame.js +1 -0
  87. package/dist/lib/puck/page-root.d.ts +1 -26
  88. package/dist/lib/puck/page-root.js +2 -2
  89. package/dist/lib/puck/part-rows.d.ts +1 -1
  90. package/dist/lib/puck/part-rows.js +1 -1
  91. package/dist/lib/puck/part-text.d.ts +2 -2
  92. package/dist/lib/puck/part-text.js +1 -1
  93. package/dist/lib/puck/part-typing.d.ts +1 -1
  94. package/dist/lib/puck/passes/cell-width.d.ts +2 -0
  95. package/dist/lib/puck/passes/cell-width.js +1 -1
  96. package/dist/lib/puck/passes/index.js +1 -1
  97. package/dist/lib/puck/passes/inspector.js +1 -1
  98. package/dist/lib/puck/passes/section-height.js +1 -1
  99. package/dist/lib/puck/passes/section-sticky.js +1 -1
  100. package/dist/lib/puck/passes/section-width.js +1 -1
  101. package/dist/lib/puck/passes/show-when-rows.d.ts +4 -0
  102. package/dist/lib/puck/passes/show-when-rows.js +1 -0
  103. package/dist/lib/puck/passes/types.d.ts +5 -0
  104. package/dist/lib/puck/registry.js +1 -1
  105. package/dist/lib/puck/selection-parent.d.ts +1 -1
  106. package/dist/lib/puck/selection-parent.js +1 -1
  107. package/dist/lib/puck/show-when-attach.d.ts +19 -0
  108. package/dist/lib/puck/show-when-attach.js +1 -0
  109. package/dist/lib/puck/show-when-resolve.d.ts +9 -0
  110. package/dist/lib/puck/show-when-resolve.js +1 -0
  111. package/dist/lib/puck/show-when.d.ts +12 -7
  112. package/dist/lib/puck/show-when.js +1 -1
  113. package/dist/lib/puck/slot-specs.d.ts +1 -1
  114. package/dist/lib/puck/slot-specs.js +1 -1
  115. package/dist/lib/puck/template-field.d.ts +1 -1
  116. package/dist/lib/puck/text-part-shape.d.ts +1 -1
  117. package/dist/lib/puck/text-part-shape.js +1 -1
  118. package/dist/lib/puck/text-parts.d.ts +2 -2
  119. package/dist/lib/puck/text-parts.js +1 -1
  120. package/dist/lib/sections/section-head-placement.d.ts +5 -2
  121. package/dist/lib/sections/section-head-placement.js +1 -1
  122. package/dist/lib/sections/section-head-style.d.ts +1 -0
  123. package/dist/lib/sections/section-head-style.js +1 -1
  124. package/dist/lib/sections/ticker-scroll.d.ts +1 -1
  125. package/dist/lib/source-rules/import-time-work.d.ts +9 -0
  126. package/dist/lib/source-rules/import-time-work.js +5 -0
  127. package/dist/lib/source-rules/one-show-when.d.ts +9 -0
  128. package/dist/lib/source-rules/one-show-when.js +4 -0
  129. package/dist/lib/source-rules/support/registry-source.d.ts +1 -1
  130. package/dist/lib/source-rules/support/registry-source.js +3 -3
  131. package/package.json +8 -5
  132. package/dist/lib/puck/part-id.d.ts +0 -1
  133. package/dist/lib/puck/part-id.js +0 -1
  134. package/dist/lib/puck/preview-events.d.ts +0 -2
  135. package/dist/lib/puck/preview-events.js +0 -1
  136. package/dist/lib/puck/preview-selection-context.d.ts +0 -2
  137. package/dist/lib/puck/preview-selection-context.js +0 -1
  138. package/dist/lib/puck/text-control-kinds.d.ts +0 -2
  139. package/dist/lib/puck/text-control-kinds.js +0 -1
@@ -2,6 +2,7 @@ import type { CSSProperties, ReactNode, MouseEvent } from "react";
2
2
  import type { WidthMode } from "../content/section-width.js";
3
3
  import { type ThemeValue, type HeadingTypographyValue } from "../theme.js";
4
4
  import { type FontsValue } from "../fonts.js";
5
+ export { PageWidthWrapper, PublishedPageFrame, pageWidthTokens } from "./page-frame.js";
5
6
  export declare const SECTION_PREVIEW_CANVAS = "color-mix(in oklab, var(--bg) 40%, #ffffff)";
6
7
  export declare const SECTION_PREVIEW_CANVAS_TAIL = "12vh";
7
8
  export declare function EditorPageBody({ style, frameClass, children, }: {
@@ -9,22 +10,6 @@ export declare function EditorPageBody({ style, frameClass, children, }: {
9
10
  frameClass?: string;
10
11
  children?: ReactNode;
11
12
  }): import("react").JSX.Element;
12
- export declare function pageWidthTokens(w: {
13
- widthMode?: unknown;
14
- fullWidth?: unknown;
15
- pageWidth?: unknown;
16
- }): {
17
- frameClass?: string;
18
- style: CSSProperties;
19
- };
20
- export declare function PageWidthWrapper({ w, children, }: {
21
- w: {
22
- widthMode?: unknown;
23
- fullWidth?: unknown;
24
- pageWidth?: unknown;
25
- };
26
- children?: ReactNode;
27
- }): import("react").JSX.Element;
28
13
  export declare function EditorThemedBody({ propsTheme, propsFonts, propsCornerStyle, propsCornerRadiusPx, propsHeadingCompression, propsHeadingTypography, widthMode, fullWidth, pageWidth, pageBackground, chromeInheritsSiteBackground, suppressPreviewNav, footer, overlay, children, }: {
29
14
  propsTheme?: ThemeValue;
30
15
  propsFonts?: FontsValue;
@@ -43,13 +28,3 @@ export declare function EditorThemedBody({ propsTheme, propsFonts, propsCornerSt
43
28
  children?: ReactNode;
44
29
  }): import("react").JSX.Element;
45
30
  export declare const suppressPreviewNav: (e: MouseEvent<HTMLDivElement>) => void;
46
- export declare function PublishedPageFrame({ pageBackground, inheritBackground, w, children, }: {
47
- pageBackground?: unknown;
48
- inheritBackground?: boolean;
49
- w: {
50
- widthMode?: unknown;
51
- fullWidth?: unknown;
52
- pageWidth?: unknown;
53
- };
54
- children?: ReactNode;
55
- }): import("react").JSX.Element;
@@ -1,2 +1,2 @@
1
- import{jsx as r,jsxs as A}from"react/jsx-runtime";import{accentItalicCss as Y,storedTextStyles as q,textStylesCss as J}from"../site-text-styles.js";import{pageWidthMarker as Q,PAGE_WIDTH_ATTR as U,SITE_WIDTH_CAP as Z,siteWidthTokens as ee,siteGutterTokens as te,heroBackgroundTokens as oe}from"../content/page-width.js";import{siteBlockGapTokens as ne}from"../content/container-gap.js";import{siteCardRadiusTokens as re}from"../content/card-corners.js";import{usePreviewHeader as se}from"../../components/PreviewHeaderContext.js";import{SitePhotographyProvider as ae}from"../../components/SitePhotographyContext.js";import{CORNER_STYLE_TO_PX as de,normalizeCornerStyle as ie,normalizeCornerRadius as ce,themeColorStyle as le,typeSizesStyle as he,headingTypographyStyle as pe,normalizeHeadingTypography as fe,themeAccentStyle as me,themeButtonStyle as ue,themePresetAccentVars as ge,themeSurfaceStyle as ye,siteCornerRadiusTokens as v,shadowColorTokens as Se,headingCompressionAttr as xe,cardShadowAttr as Te,cardGapAttr as Ce,hoverEffectAttr as ke}from"../theme.js";import{fontRoleStyle as Ae}from"../fonts.js";import{wordStyleTokens as ve}from"../word-styles.js";import{isStandaloneSectionDocument as Ee,pageHasHeaderSection as E,pageTakesTopSpace as _e,topSpaceMarker as Pe,TOP_SPACE_ATTR as we,HEADER_CLEARANCE_CLASS as Re}from"./header-clearance.js";import{leadSectionInk as He,HEADER_INK_ATTR as We}from"./header-ink.js";import{useEasel as Ie}from"efficient-easel/easel";import{pageBackgroundVars as _}from"../content/page-background.js";const Ge="color-mix(in oklab, var(--bg) 40%, #ffffff)",Ne="12vh";function be({style:t,frameClass:o,children:s}){const{appState:n}=Ie(g=>g),a=n.data.content,d=n.data.root;if(Ee(a))return r("div",{className:`sf-themed-content${o?` ${o}`:""}`,style:{...t,background:Ge,minHeight:"100vh",paddingBottom:Ne},children:r("div",{style:{background:"var(--bg)"},children:s})});const c=E(a)&&_e(d,a),l=E(a)?Pe(d,a):null,f=l?{[we]:l}:null,h=Q(d?.widthChoice),m=h?{[U]:h}:null,p=c?null:He(a),u=p?{[We]:p}:null;return r("div",{className:`sf-themed-content${c?` ${Re}`:""}${o?` ${o}`:""}`,style:t,...u,...f,...m,children:r("div",{style:{background:"var(--bg)",minHeight:"100%"},children:s})})}function P(t){return{frameClass:void 0,style:{"--sf-page-width":Z}}}function Be({w:t,children:o}){const{frameClass:s,style:n}=P(t);return r("div",{className:s,style:n,children:o})}function Qe({propsTheme:t,propsFonts:o,propsCornerStyle:s,propsCornerRadiusPx:n,propsHeadingCompression:a,propsHeadingTypography:d,widthMode:c,fullWidth:l,pageWidth:f,pageBackground:h,chromeInheritsSiteBackground:m,suppressPreviewNav:p,footer:u,overlay:g,children:w}){const{theme:R,fonts:H,sizes:W,cornerRadiusPx:I,cardShadow:y,shadowColor:G,cardGap:N,hoverEffect:S,headingCompression:b,siteWidth:B,siteGutter:z,blockGap:D,headingTypography:V,heroBackgroundFollowsWidth:$,photographyGrayscale:j,textStyles:F,wordStyles:L,themeFromDocument:e}=se(),i=e?t:R,O=e?o:H,M=e?void 0:W,x=e?n===void 0?de[ie(s)]:ce(n):I,X=e?a:b,T=e?d:V,C=[J(q(e?void 0:F)),Y(fe(T).italicStrong)].filter(Boolean).join(`
2
- `),k=P({widthMode:c,fullWidth:l,pageWidth:f}),K={...le(i),...he(M),...pe(T),...k.style,...m?{}:_(h)};return A("div",{className:"sf-theme-surfaces sf-theme-accent",style:{...Ae(O),...ve(e?null:L),...me(i),...ue(i),...ge(i),...ye(i),...v(x),...re(v(x)),...Se(e?void 0:y,e?void 0:G,e?void 0:S),...ee(e?void 0:B),...te(e?void 0:z),...ne(e?void 0:D),...oe(e?void 0:$)},"data-sf-headings":xe(X),"data-sf-card-shadow":e?void 0:Te(y),"data-sf-card-gap":e?void 0:Ce(N),"data-sf-card-hover":e?void 0:ke(S),onClickCapture:p,children:[C?r("style",{"data-sf-text-styles":"",dangerouslySetInnerHTML:{__html:C}}):null,A(ae,{grayscale:e?void 0:j,children:[r(be,{style:K,frameClass:k.frameClass,children:w}),u,g]})]})}const Ue=t=>{t.target?.closest?.("a")&&t.preventDefault()};function Ze({pageBackground:t,inheritBackground:o=!1,w:s,children:n}){return r("div",{style:{...o?{}:_(t),background:"var(--bg)",minHeight:"100%",overflowX:"clip"},children:r(Be,{w:s,children:n})})}export{be as EditorPageBody,Qe as EditorThemedBody,Be as PageWidthWrapper,Ze as PublishedPageFrame,Ge as SECTION_PREVIEW_CANVAS,Ne as SECTION_PREVIEW_CANVAS_TAIL,P as pageWidthTokens,Ue as suppressPreviewNav};
1
+ import{jsx as n,jsxs as A}from"react/jsx-runtime";import{accentItalicCss as K,storedTextStyles as X,textStylesCss as Y}from"../site-text-styles.js";import{pageWidthMarker as q,PAGE_WIDTH_ATTR as J,siteWidthTokens as Q,siteGutterTokens as U,heroBackgroundTokens as Z}from"../content/page-width.js";import{siteBlockGapTokens as ee}from"../content/container-gap.js";import{siteCardRadiusTokens as te}from"../content/card-corners.js";import{usePreviewHeader as oe}from"../../components/PreviewHeaderContext.js";import{SitePhotographyProvider as re}from"../../components/SitePhotographyContext.js";import{CORNER_STYLE_TO_PX as ne,normalizeCornerStyle as ae,normalizeCornerRadius as se,themeColorStyle as de,typeSizesStyle as ie,headingTypographyStyle as ce,normalizeHeadingTypography as le,themeAccentStyle as pe,themeButtonStyle as he,themePresetAccentVars as me,themeSurfaceStyle as fe,siteCornerRadiusTokens as E,shadowColorTokens as ue,headingCompressionAttr as ge,cardShadowAttr as Se,cardGapAttr as ye,hoverEffectAttr as xe}from"../theme.js";import{fontRoleStyle as Te}from"../fonts.js";import{wordStyleTokens as ke}from"../word-styles.js";import{isStandaloneSectionDocument as Ce,pageHasHeaderSection as _,pageTakesTopSpace as Ae,topSpaceMarker as Ee,TOP_SPACE_ATTR as _e,HEADER_CLEARANCE_CLASS as ve}from"./header-clearance.js";import{leadSectionInk as Pe,HEADER_INK_ATTR as Re}from"./header-ink.js";import{useEasel as we}from"efficient-easel/easel";import{pageBackgroundVars as We}from"../content/page-background.js";import{pageWidthTokens as He}from"./page-frame.js";import{PageWidthWrapper as et,PublishedPageFrame as tt,pageWidthTokens as ot}from"./page-frame.js";const Ge="color-mix(in oklab, var(--bg) 40%, #ffffff)",Ie="12vh";function Be({style:o,frameClass:r,children:i}){const{appState:a}=we(g=>g),t=a.data.content,s=a.data.root;if(Ce(t))return n("div",{className:`sf-themed-content${r?` ${r}`:""}`,style:{...o,background:Ge,minHeight:"100vh",paddingBottom:Ie},children:n("div",{style:{background:"var(--bg)"},children:i})});const c=_(t)&&Ae(s,t),l=_(t)?Ee(s,t):null,m=l?{[_e]:l}:null,p=q(s?.widthChoice),f=p?{[J]:p}:null,h=c?null:Pe(t),u=h?{[Re]:h}:null;return n("div",{className:`sf-themed-content${c?` ${ve}`:""}${r?` ${r}`:""}`,style:o,...u,...m,...f,children:n("div",{style:{background:"var(--bg)",minHeight:"100%"},children:i})})}function Je({propsTheme:o,propsFonts:r,propsCornerStyle:i,propsCornerRadiusPx:a,propsHeadingCompression:t,propsHeadingTypography:s,widthMode:c,fullWidth:l,pageWidth:m,pageBackground:p,chromeInheritsSiteBackground:f,suppressPreviewNav:h,footer:u,overlay:g,children:v}){const{theme:P,fonts:R,sizes:w,cornerRadiusPx:W,cardShadow:S,shadowColor:H,cardGap:G,hoverEffect:y,headingCompression:I,siteWidth:B,siteGutter:N,blockGap:b,headingTypography:z,heroBackgroundFollowsWidth:D,photographyGrayscale:V,textStyles:$,wordStyles:j,themeFromDocument:e}=oe(),d=e?o:P,F=e?r:R,L=e?void 0:w,x=e?a===void 0?ne[ae(i)]:se(a):W,O=e?t:I,T=e?s:z,k=[Y(X(e?void 0:$)),K(le(T).italicStrong)].filter(Boolean).join(`
2
+ `),C=He({widthMode:c,fullWidth:l,pageWidth:m}),M={...de(d),...ie(L),...ce(T),...C.style,...f?{}:We(p)};return A("div",{className:"sf-theme-surfaces sf-theme-accent",style:{...Te(F),...ke(e?null:j),...pe(d),...he(d),...me(d),...fe(d),...E(x),...te(E(x)),...ue(e?void 0:S,e?void 0:H,e?void 0:y),...Q(e?void 0:B),...U(e?void 0:N),...ee(e?void 0:b),...Z(e?void 0:D)},"data-sf-headings":ge(O),"data-sf-card-shadow":e?void 0:Se(S),"data-sf-card-gap":e?void 0:ye(G),"data-sf-card-hover":e?void 0:xe(y),onClickCapture:h,children:[k?n("style",{"data-sf-text-styles":"",dangerouslySetInnerHTML:{__html:k}}):null,A(re,{grayscale:e?void 0:V,children:[n(Be,{style:M,frameClass:C.frameClass,children:v}),u,g]})]})}const Qe=o=>{o.target?.closest?.("a")&&o.preventDefault()};export{Be as EditorPageBody,Je as EditorThemedBody,et as PageWidthWrapper,tt as PublishedPageFrame,Ge as SECTION_PREVIEW_CANVAS,Ie as SECTION_PREVIEW_CANVAS_TAIL,ot as pageWidthTokens,Qe as suppressPreviewNav};
@@ -1,4 +1,4 @@
1
- import { type TextFieldMeta } from "./field-markers.js";
1
+ import { type TextFieldMeta } from "efficient-easel/draw";
2
2
  import type { PartRow } from "./part-key.js";
3
3
  import { type TypeInPlaceKind } from "./part-text.js";
4
4
  export { decodePartKey, encodePartKey, type PartRow } from "./part-key.js";
@@ -1 +1 @@
1
- import{TEXT_FIELD_MARKER as s}from"./field-markers.js";import{partText as p,partValueWithText as x,typeInPlaceKind as y}from"./part-text.js";import{decodePartKey as P,encodePartKey as b}from"./part-key.js";function d(t){if(!(!t||typeof t!="object"))return t[s]}function l(t){if(!t||typeof t!="object")return null;const r=t.arrayFields;return r&&typeof r=="object"?r:null}function A(t,r){if(!Array.isArray(r))return[];const e=d(t),i=[];if(e?.control==="textList"){const n=e.itemKey??"text";return r.forEach((u,a)=>{const c=u?.[n];typeof c=="string"&&c&&i.push({row:{index:a,rowKey:n},text:c})}),i}const o=l(t);return o?(r.forEach((n,u)=>{for(const[a,c]of Object.entries(o)){if(!y(c))continue;const f=p(n?.[a]);f&&i.push({row:{index:u,rowKey:a},text:f})}}),i):[]}function w(t,r){if(Array.isArray(t))return t[r.index]?.[r.rowKey]}function K(t,r,e,i){const o=t[r];return!Array.isArray(o)||e.index<0||e.index>=o.length?null:{...t,[r]:o.map((n,u)=>u===e.index?{...n,[e.rowKey]:i}:n)}}function R(t,r,e,i,o){const n=w(t[r],e);return p(n)===o?null:K(t,r,e,x(i,n,o))}function T(t,r){return r?`${t} · row ${r.index+1}`:t}export{l as arrayFieldsOf,P as decodePartKey,b as encodePartKey,R as partPropsWithRowText,K as partPropsWithRowValue,T as partRowHeadLabel,A as partRowTexts,w as partRowValue,d as textMeta};
1
+ import{TEXT_FIELD_MARKER as s}from"efficient-easel/draw";import{partText as p,partValueWithText as x,typeInPlaceKind as y}from"./part-text.js";import{decodePartKey as P,encodePartKey as b}from"./part-key.js";function d(t){if(!(!t||typeof t!="object"))return t[s]}function l(t){if(!t||typeof t!="object")return null;const r=t.arrayFields;return r&&typeof r=="object"?r:null}function A(t,r){if(!Array.isArray(r))return[];const e=d(t),i=[];if(e?.control==="textList"){const n=e.itemKey??"text";return r.forEach((u,a)=>{const c=u?.[n];typeof c=="string"&&c&&i.push({row:{index:a,rowKey:n},text:c})}),i}const o=l(t);return o?(r.forEach((n,u)=>{for(const[a,c]of Object.entries(o)){if(!y(c))continue;const f=p(n?.[a]);f&&i.push({row:{index:u,rowKey:a},text:f})}}),i):[]}function w(t,r){if(Array.isArray(t))return t[r.index]?.[r.rowKey]}function K(t,r,e,i){const o=t[r];return!Array.isArray(o)||e.index<0||e.index>=o.length?null:{...t,[r]:o.map((n,u)=>u===e.index?{...n,[e.rowKey]:i}:n)}}function R(t,r,e,i,o){const n=w(t[r],e);return p(n)===o?null:K(t,r,e,x(i,n,o))}function T(t,r){return r?`${t} · row ${r.index+1}`:t}export{l as arrayFieldsOf,P as decodePartKey,b as encodePartKey,R as partPropsWithRowText,K as partPropsWithRowValue,T as partRowHeadLabel,A as partRowTexts,w as partRowValue,d as textMeta};
@@ -1,5 +1,5 @@
1
- import { type HidableValue } from "./hidable.js";
2
- import { type ScalarTextControlKind, type TextControlKind } from "./text-control-kinds.js";
1
+ import { type HidableValue } from "efficient-easel/draw";
2
+ import { type ScalarTextControlKind, type TextControlKind } from "efficient-easel/draw";
3
3
  export declare const TYPE_IN_PLACE_KINDS: readonly ScalarTextControlKind[];
4
4
  export type TypeInPlaceKind = ScalarTextControlKind;
5
5
  export declare function textControlKind(field: unknown): TextControlKind | null;
@@ -1 +1 @@
1
- import{TEXT_FIELD_MARKER as o}from"./field-markers.js";import{readHidable as u}from"./hidable.js";import{SCALAR_TEXT_CONTROLS as c}from"./text-control-kinds.js";const l=c,a=["text","textarea"],x=["textarea","plainTextarea"];function p(t){return!t||typeof t!="object"?null:t[o]?.control??null}function E(t){const n=p(t);return n&&l.includes(n)?n:null}function I(t){return x.includes(t)}function _(t){return!t||typeof t!="object"?void 0:t[o]?.placeholder}function f(t){return u(t).text}function i(t,n,e){return a.includes(t)?{text:e,hidden:u(n).hidden}:e}function s(t,n,e){return e===null||!n?t:i(n,t,e)}function L(t,n,e,r){return f(t[n])===r?null:{...t,[n]:i(e,t[n],r)}}export{l as TYPE_IN_PLACE_KINDS,I as isMultilineKind,s as panelPartValue,_ as partPlaceholder,L as partPropsWithText,f as partText,i as partValueWithText,p as textControlKind,E as typeInPlaceKind};
1
+ import{TEXT_FIELD_MARKER as o}from"efficient-easel/draw";import{readHidable as u}from"efficient-easel/draw";import{SCALAR_TEXT_CONTROLS as c}from"efficient-easel/draw";const l=c,a=["text","textarea"],x=["textarea","plainTextarea"];function p(t){return!t||typeof t!="object"?null:t[o]?.control??null}function E(t){const n=p(t);return n&&l.includes(n)?n:null}function I(t){return x.includes(t)}function _(t){return!t||typeof t!="object"?void 0:t[o]?.placeholder}function f(t){return u(t).text}function i(t,n,e){return a.includes(t)?{text:e,hidden:u(n).hidden}:e}function s(t,n,e){return e===null||!n?t:i(n,t,e)}function L(t,n,e,r){return f(t[n])===r?null:{...t,[n]:i(e,t[n],r)}}export{l as TYPE_IN_PLACE_KINDS,I as isMultilineKind,s as panelPartValue,_ as partPlaceholder,L as partPropsWithText,f as partText,i as partValueWithText,p as textControlKind,E as typeInPlaceKind};
@@ -1,4 +1,4 @@
1
- import type { TreeItem } from "./content-tree.js";
1
+ import type { TreeItem } from "efficient-easel/draw";
2
2
  import { type TypeInPlaceKind } from "./part-text.js";
3
3
  export type PartAddress = {
4
4
  node: TreeItem;
@@ -1,2 +1,4 @@
1
+ import { type ShowWhenRule } from "../show-when-attach.js";
1
2
  import type { BlockPass } from "./types.js";
3
+ export declare const CELL_WIDTH_SHOW_WHEN: ShowWhenRule;
2
4
  export declare const cellWidth: BlockPass;
@@ -1 +1 @@
1
- import{jsx as a}from"react/jsx-runtime";import{GRID_SPAN_ATTR as _,containerOffersPositions as p,resolveGridSpan as S}from"../../content/grid-span.js";import{CONTAINER_BLOCK_CHOICES as m}from"../container-blocks.js";import{RETIRED_NESTABLE_SECTIONS as E}from"../section-catalog.js";import{findParentNode as O}from"./document-position.js";import{BOX_MAY_HOLD as u}from"./slot-rules.js";const y=Array.from(new Set([...m.map(e=>e.type),...u,...E,"GalleryItem"])),R={name:"cellWidth",applies:(e,i,r)=>y.includes(e)&&!!r&&typeof r.render=="function",panel(e,i,r){const n=r.cellWidthFields;e.fields={...e.fields,...n()};const t=e.resolveFields;e.resolveFields=(s,o)=>{const l=t?t(s,o):o.fields,d=O(o.appState,s.props?.id);if(d===void 0||p(d))return l;const f={...l};for(const c of Object.keys(n()))delete f[c];return f}},draw(e){const i=e.render;e.render=r=>{const n=S(r.gridSpan),t=i(r);return n==null?t:a("div",{className:"sf-grid-cell",[_]:String(n),children:t})}}};export{R as cellWidth};
1
+ import{jsx as s}from"react/jsx-runtime";import{GRID_SPAN_ATTR as l,resolveGridSpan as o}from"../../content/grid-span.js";import{withRowsShownWhen as d}from"../show-when-attach.js";import{CONTAINER_BLOCK_CHOICES as f}from"../container-blocks.js";import{RETIRED_NESTABLE_SECTIONS as _}from"../section-catalog.js";import{BOX_MAY_HOLD as a}from"./slot-rules.js";const c=Array.from(new Set([...f.map(e=>e.type),...a,..._,"GalleryItem"])),m={not:{context:"parentOffersPositions",is:!1}},C={name:"cellWidth",applies:(e,n,r)=>c.includes(e)&&!!r&&typeof r.render=="function",panel(e,n,r){const t=r.cellWidthFields;e.fields={...e.fields,...t()},e.fields=d(e.fields??{},Object.keys(t()),m)},draw(e){const n=e.render;e.render=r=>{const t=o(r.gridSpan),i=n(r);return t==null?i:s("div",{className:"sf-grid-cell",[l]:String(t),children:i})}}};export{m as CELL_WIDTH_SHOW_WHEN,C as cellWidth};
@@ -1 +1 @@
1
- import{catalogueLabel as m}from"./catalogue-labels.js";import{cellWidth as n}from"./cell-width.js";import{clickableParts as s}from"./clickable-parts.js";import{cardCorners as p,sectionCorners as c}from"./corners.js";import{emptyHeadings as f}from"./empty-headings.js";import{hiddenNodes as a}from"./hidden-nodes.js";import{sectionAnchor as d}from"./section-anchor.js";import{sectionAnimation as l}from"./section-animation.js";import{sectionHeight as h}from"./section-height.js";import{cardSticky as g,sectionSticky as u}from"./section-sticky.js";import{sectionBorder as P}from"./borders.js";import{blockPadding as S,sectionPadding as A}from"./section-padding.js";import{sectionTheme as b,slideTheme as w}from"./section-theme.js";import{buttonAlignInRow as C,containedWidth as W,imageWidth as k,sectionWidth as y}from"./section-width.js";import{blockGroups as B,sectionGroups as G}from"./settings-groups.js";import{openSlotDisallow as H,sectionGroupAllow as L}from"./slot-rules.js";import{registryPassContext as X}from"./registry-context.js";const T=[L,H,A,c,P,p,S,n,y,W,C,k,h,d,b,l,u,g,w,G,B,f,s,a,m];function Q(r,e,o){const i=e;for(const t of T)t.applies(r,o,i)&&(o.inspector&&t.panel?.(i,r,o.inspector,o),t.draw?.(i,r,o));return e}export{T as BLOCK_PASSES,Q as applyBlockPasses,X as registryPassContext};
1
+ import{catalogueLabel as m}from"./catalogue-labels.js";import{cellWidth as n}from"./cell-width.js";import{clickableParts as s}from"./clickable-parts.js";import{cardCorners as p,sectionCorners as c}from"./corners.js";import{emptyHeadings as f}from"./empty-headings.js";import{showWhenRows as a}from"./show-when-rows.js";import{hiddenNodes as d}from"./hidden-nodes.js";import{sectionAnchor as l}from"./section-anchor.js";import{sectionAnimation as h}from"./section-animation.js";import{sectionHeight as g}from"./section-height.js";import{cardSticky as u,sectionSticky as w}from"./section-sticky.js";import{sectionBorder as P}from"./borders.js";import{blockPadding as S,sectionPadding as A}from"./section-padding.js";import{sectionTheme as W,slideTheme as b}from"./section-theme.js";import{buttonAlignInRow as C,containedWidth as k,imageWidth as y,sectionWidth as B}from"./section-width.js";import{blockGroups as G,sectionGroups as H}from"./settings-groups.js";import{openSlotDisallow as L,sectionGroupAllow as R}from"./slot-rules.js";import{registryPassContext as Z}from"./registry-context.js";const T=[R,L,A,c,P,p,S,n,B,k,C,y,g,l,W,h,w,u,b,H,G,a,f,s,d,m];function V(r,e,o){const i=e;for(const t of T)t.applies(r,o,i)&&(o.inspector&&t.panel?.(i,r,o.inspector,o),t.draw?.(i,r,o));return e}export{T as BLOCK_PASSES,V as applyBlockPasses,Z as registryPassContext};
@@ -1 +1 @@
1
- import{WidthIcon as i}from"efficient-easel/icons";import{BLOCK_THEME_FOLLOW_LABEL as e,SECTION_THEME_FOLLOW_LABEL as s}from"../../../components/SectionThemePicker.js";import{anchorFields as d,cardShapeFields as o,cellWidthFields as t,heightFields as r,sectionAnimationFields as l,sectionShapeFields as m,sectionThemeFields as n,slider as F,spacingFields as p,sidesPaddingFields as c,stickFields as a,widthField as h}from"../controls.js";import{assignSectionGroups as E}from"../field-groups.js";import{dropEmptyHeadings as L}from"../panel-drop-empty-headings.js";const T={spacingFields:p,sidesPaddingFields:c,sectionShapeFields:m,cardShapeFields:o,cellWidthFields:t,widthField:h,heightFields:r,anchorFields:d,stickFields:a,sectionThemeFields:n,sectionAnimationFields:l,slider:F,WidthIcon:i,assignSectionGroups:E,dropEmptyHeadings:L,SECTION_THEME_FOLLOW_LABEL:s,BLOCK_THEME_FOLLOW_LABEL:e};export{T as PASS_INSPECTOR};
1
+ import{WidthIcon as i}from"efficient-easel/icons";import{BLOCK_THEME_FOLLOW_LABEL as o,SECTION_THEME_FOLLOW_LABEL as e}from"../../../components/SectionThemePicker.js";import{anchorFields as s,cardShapeFields as d,cellWidthFields as r,heightFields as t,sectionAnimationFields as m,sectionShapeFields as l,sectionThemeFields as n,slider as F,spacingFields as p,sidesPaddingFields as c,stickFields as h,widthField as a}from"../controls.js";import{assignSectionGroups as E}from"../field-groups.js";import{dropEmptyHeadings as L}from"../panel-drop-empty-headings.js";import{rowsShownForNode as S}from"../show-when-resolve.js";const W={spacingFields:p,sidesPaddingFields:c,sectionShapeFields:l,cardShapeFields:d,cellWidthFields:r,widthField:a,heightFields:t,anchorFields:s,stickFields:h,sectionThemeFields:n,sectionAnimationFields:m,slider:F,WidthIcon:i,assignSectionGroups:E,dropEmptyHeadings:L,rowsShownForNode:S,SECTION_THEME_FOLLOW_LABEL:e,BLOCK_THEME_FOLLOW_LABEL:o};export{W as PASS_INSPECTOR};
@@ -1 +1 @@
1
- import{jsx as a}from"react/jsx-runtime";import{SECTION_MIN_HEIGHT_EXCLUDED as f,hasPhoneHeight as P,resolvePhoneHeight as v,resolveSectionMinHeight as F,sectionMinHeightAttrs as V}from"../../content/section-min-height.js";const M={name:"sectionHeight",applies:(t,n,e)=>n.isSection(t)&&!f.has(t)&&!!e&&typeof e.render=="function",panel(t,n,e){const i=e.heightFields;t.fields={...t.fields,...i()};const r=t.resolveFields;t.resolveFields=(c,h)=>{const o=r?r(c,h):h.fields,s=c?.props??{},l=F(s),u=P(s)?v(s):null;return o&&typeof o.then=="function"?o.then(d=>H(g(d,l),u)):H(g(o,l),u)}},draw(t){const n=t.render;t.render=e=>{const i=V(e);return i?a("div",{className:i.className,style:i.style,children:n(e)}):n(e)}}};function g(t,n){if(!t||!("sectionHeightMode"in t))return t;const e={...t};if(n.mode==="auto")return delete e.sectionHeightValue,delete e.sectionHeightUnit,e;n.mode==="screen"&&delete e.sectionHeightUnit;const i=e.sectionHeightValue;return i&&(e.sectionHeightValue={...i,unit:n.unit}),e}function H(t,n){if(!t||!("sectionHeightModePhone"in t))return t;const e={...t};if(!n||n.mode==="auto")return delete e.sectionHeightValuePhone,delete e.sectionHeightUnitPhone,e;n.mode==="screen"&&delete e.sectionHeightUnitPhone;const i=e.sectionHeightValuePhone;return i&&(e.sectionHeightValuePhone={...i,unit:n.unit}),e}export{M as sectionHeight};
1
+ import{jsx as M}from"react/jsx-runtime";import{SECTION_HEIGHT_MODES as s,SECTION_MIN_HEIGHT_EXCLUDED as P,hasPhoneHeight as x,resolvePhoneHeight as E,resolveSectionMinHeight as _,sectionMinHeightAttrs as v}from"../../content/section-min-height.js";import{shownForOption as r,withRowRules as F}from"../show-when-attach.js";const I=[[["sectionHeightValue"],r("sectionHeightMode",s,"auto",["fixed","screen"])],[["sectionHeightUnit"],r("sectionHeightMode",s,"auto",["fixed"])],[["sectionHeightValuePhone"],r("sectionHeightModePhone",s,"auto",["fixed","screen"])],[["sectionHeightUnitPhone"],r("sectionHeightModePhone",s,"auto",["fixed"])]],p={name:"sectionHeight",applies:(e,n,t)=>n.isSection(e)&&!P.has(e)&&!!t&&typeof t.render=="function",panel(e,n,t){const i=t.heightFields;e.fields={...e.fields,...F(i(),I)};const c=e.resolveFields;e.resolveFields=(u,H)=>{const o=c?c(u,H):H.fields,h=u?.props??{},g=_(h),l=x(h)?E(h):null;return o&&typeof o.then=="function"?o.then(f=>d(a(f,g),l)):d(a(o,g),l)}},draw(e){const n=e.render;e.render=t=>{const i=v(t);return i?M("div",{className:i.className,style:i.style,children:n(t)}):n(t)}}};function a(e,n){if(!e||!("sectionHeightMode"in e)||n.mode==="auto")return e;const t={...e},i=t.sectionHeightValue;return i&&(t.sectionHeightValue={...i,unit:n.unit}),t}function d(e,n){if(!e||!("sectionHeightModePhone"in e)||!n||n.mode==="auto")return e;const t={...e},i=t.sectionHeightValuePhone;return i&&(t.sectionHeightValuePhone={...i,unit:n.unit}),t}export{p as sectionHeight};
@@ -1 +1 @@
1
- import{jsx as k}from"react/jsx-runtime";import{SECTION_STICK_EXCLUDED as S,hasPhoneStick as y,resolveSectionStick as h,sectionStickAttrs as _}from"../../content/section-sticky.js";import{CARD_BLOCK_KEYS as x}from"./corners.js";const T=f("sectionSticky",(t,n,e)=>n.isSection(t)&&!S.has(t)&&!!e&&typeof e.render=="function"),E=f("cardSticky",(t,n,e)=>x.includes(t)&&!!e&&typeof e.render=="function");function f(t,n){return{name:t,applies:n,panel(e,s,o){e.fields={...e.fields,...o.stickFields()};const i=e.resolveFields;e.resolveFields=(c,l)=>{const r=i?i(c,l):l.fields,u=c?.props??{},d=a=>C(a,u);return r&&typeof r.then=="function"?r.then(d):d(r)}},draw(e){const s=e.render;e.render=o=>{const i=_(o);return i?k("div",{className:i.className,style:i.style,children:s(o)}):s(o)}}}}function C(t,n){if(!t||!("stickTop"in t))return t;const e=h(n),s={...t};return e.desktop||delete s.stickTopDistance,(!y(n)||!e.phone)&&delete s.stickTopDistancePhone,s}export{E as cardSticky,T as sectionSticky};
1
+ import{jsx as c}from"react/jsx-runtime";import{SECTION_STICK_EXCLUDED as a,sectionStickAttrs as d}from"../../content/section-sticky.js";import{withRowRules as l}from"../show-when-attach.js";import{CARD_BLOCK_KEYS as f}from"./corners.js";const T=o("sectionSticky",(e,s,t)=>s.isSection(e)&&!a.has(e)&&!!t&&typeof t.render=="function"),m=o("cardSticky",(e,s,t)=>f.includes(e)&&!!t&&typeof t.render=="function");function o(e,s){return{name:e,applies:s,panel(t,n,i){t.fields={...t.fields,...l(i.stickFields(),k)}},draw(t){const n=t.render;t.render=i=>{const r=d(i);return r?c("div",{className:r.className,style:r.style,children:n(i)}):n(i)}}}}const k=[[["stickTopDistance"],{field:"stickTop",is:!0}],[["stickTopDistancePhone"],{field:"stickTopPhone",is:!0}]];export{m as cardSticky,T as sectionSticky};
@@ -1 +1 @@
1
- import{jsx as a}from"react/jsx-runtime";import{resolveContainerDirection as w}from"../../content/container-direction.js";import{IMAGE_WIDTH as u}from"../../content/image-width.js";import{HERO_BACKGROUND_VAR as C,HERO_CHROME_CAP_VAR as I,HERO_CHROME_INSET_VAR as T,SITE_WIDTH_CAP as h,centredCap as B}from"../../content/page-width.js";import{resolveWidth as p}from"../../content/section-width.js";import{isInsideSiteGutter as g}from"../../content/site-gutter.js";import{parentCapsWidth as m}from"../../sections/section-head-placement.js";import{findParentNode as O,isNestedNode as S}from"./document-position.js";const W=new Set(["SectionHeader","ProductGrid","IntroBleed","RelatedProducts","Banner","Stats","Logos","Divider","OrderSummary","DeliveryOptions","PaymentBadges","CheckoutCTA","Ticker","CategoryBar","DocTabs","CustomHTML","Spacer","Flex","Grid"]),E=new Set(["Hero","HeroSingle","Manifesto","ProductHero"]),H=new Set(["ProductHero"]),G={name:"sectionWidth",applies:(e,n,t)=>n.isSection(e)&&!W.has(e)&&!!t&&typeof t.render=="function",panel(e,n,t){const r=t.widthField;e.fields={...e.fields,...r("full")};const d=e.resolveFields;e.resolveFields=(i,l)=>{const o=d?d(i,l):l.fields,s=p(i?.props??{},"full");return o&&typeof o.then=="function"?o.then(c=>f(c,s)):f(o,s)}},draw(e,n){const t=E.has(n),r=e.render;e.render=d=>{const{mode:i,inherited:l}=p(d,"full"),o=r(d);if(i==="full")return t&&!l&&!H.has(n)?a("div",{style:{[C]:"none",[T]:"initial",[I]:"initial"},children:o}):o;const s=B(h);return t?a("div",{style:{"--sf-page-cap":h},children:o}):a("div",{style:s,children:o})}}};function f(e,n){if(!e||!("widthMode"in e))return e;const t={...e},r=t.widthMode;return r&&(t.widthMode={...r,currentValue:n.mode,inherited:n.inherited}),t}const v=new Set(["Heading","Text","ImageBlock","ButtonBlock","Banner","Stats","Logos","Divider","Flex","Grid","OrderSummary","DeliveryOptions","PaymentBadges","CheckoutCTA"]),j={name:"containedWidth",applies:(e,n,t)=>v.has(e)&&!!t&&typeof t.render=="function",panel(e,n,t){const r=t.widthField;e.fields={...e.fields,...r("page")};const d=e.resolveFields;e.resolveFields=(i,l)=>{const o=d?d(i,l):l.fields,s=p(i?.props??{},"page"),c=_=>F(n,A(f(_,s),i,l));return o&&typeof o.then=="function"?o.then(c):c(o)}},draw(e){const n=e.render;e.render=t=>{const{mode:r}=p(t,"page");return n({...t,contained:r!=="full"})}}},L={name:"buttonAlignInRow",applies:e=>e==="ButtonBlock",panel(e){const n=e,t=n?.resolveFields;n.resolveFields=(r,d)=>{const i=t?t(r,d):d.fields,l=o=>{const s=O(d.appState,r.props?.id);if(!s||s.type!=="HeroGroup"||w("HeroGroup",s.props?.direction)!=="row")return o;const c={...o};return delete c.align,c};return i&&typeof i.then=="function"?i.then(l):l(i)}}};function y(e){return Object.values(e).some(n=>!!n&&typeof n=="object"&&n.type==="slot")}function F(e,n){if(e!=="ButtonBlock")return n;const t={...n};return delete t._gWidth,delete t.widthMode,delete t.pageWidth,t}function A(e,n,t){if(y(e)){const d=t.appState?.data?.content;if(g(d,n.props?.id)!==!0)return e;const i={...e};return delete i.widthMode,delete i.pageWidth,i}if("parent"in t){if(!m(t.parent))return e}else if(!S({props:n.props??{}},t))return e;const r={...e};return delete r.widthMode,delete r.pageWidth,r}const V={name:"imageWidth",applies:e=>e==="ImageBlock",panel(e,n,t){const{slider:r,WidthIcon:d}=t;if(e?.fields){const i=r("Image width",a(d,{}),u.min,u.max,u.step,u.fallback,u.unit),l="focal",o=Object.entries(e.fields),s=o.findIndex(([c])=>c===l);e.fields=Object.fromEntries(s===-1?[...o,["width",i]]:[...o.slice(0,s+1),["width",i],...o.slice(s+1)])}}};export{L as buttonAlignInRow,j as containedWidth,V as imageWidth,G as sectionWidth,f as widthModeFields};
1
+ import{jsx as p}from"react/jsx-runtime";import{resolveContainerDirection as C}from"../../content/container-direction.js";import{IMAGE_WIDTH as a}from"../../content/image-width.js";import{HERO_BACKGROUND_VAR as E,HERO_CHROME_CAP_VAR as O,HERO_CHROME_INSET_VAR as S,SITE_WIDTH_CAP as w,centredCap as I}from"../../content/page-width.js";import{resolveWidth as u}from"../../content/section-width.js";import{isInsideSiteGutter as m}from"../../content/site-gutter.js";import{parentCapsWidth as R}from"../../sections/section-head-placement.js";import{addShowWhenFacts as f,withRowsShownWhen as h}from"../show-when-attach.js";import{findParentNode as H,isNestedNode as N}from"./document-position.js";const W=new Set(["SectionHeader","ProductGrid","IntroBleed","RelatedProducts","Banner","Stats","Logos","Divider","OrderSummary","DeliveryOptions","PaymentBadges","CheckoutCTA","Ticker","CategoryBar","DocTabs","CustomHTML","Spacer","Flex","Grid"]),g=new Set(["Hero","HeroSingle","Manifesto","ProductHero"]),B=new Set(["ProductHero"]),K={name:"sectionWidth",applies:(e,n,t)=>n.isSection(e)&&!W.has(e)&&!!t&&typeof t.render=="function",panel(e,n,t){const r=t.widthField;e.fields={...e.fields,...r("full")};const o=e.resolveFields;e.resolveFields=(d,c)=>{const i=o?o(d,c):c.fields,s=u(d?.props??{},"full");return i&&typeof i.then=="function"?i.then(l=>_(l,s)):_(i,s)}},draw(e,n){const t=g.has(n),r=e.render;e.render=o=>{const{mode:d,inherited:c}=u(o,"full"),i=r(o);if(d==="full")return t&&!c&&!B.has(n)?p("div",{style:{[E]:"none",[S]:"initial",[O]:"initial"},children:i}):i;const s=I(w);return t?p("div",{style:{"--sf-page-cap":w},children:i}):p("div",{style:s,children:i})}}};function _(e,n){if(!e||!("widthMode"in e))return e;const t={...e},r=t.widthMode;return r&&(t.widthMode={...r,currentValue:n.mode,inherited:n.inherited}),t}const y=new Set(["Heading","Text","ImageBlock","ButtonBlock","Banner","Stats","Logos","Divider","Flex","Grid","OrderSummary","DeliveryOptions","PaymentBadges","CheckoutCTA"]),X={name:"containedWidth",applies:(e,n,t)=>y.has(e)&&!!t&&typeof t.render=="function",panel(e,n,t){const r=t.widthField;e.fields=F(n,e,{...e.fields,...r("page")});const o=e.resolveFields;e.resolveFields=(d,c)=>{const i=o?o(d,c):c.fields,s=u(d?.props??{},"page"),l=T=>_(T,s);return i&&typeof i.then=="function"?i.then(l):l(i)}},draw(e){const n=e.render;e.render=t=>{const{mode:r}=u(t,"page");return n({...t,contained:r!=="full"})}}},A={not:{context:"inHeroGroupRow",is:!0}},q={name:"buttonAlignInRow",applies:e=>e==="ButtonBlock",panel(e){const n=e;n.fields=h(n.fields??{},["align"],A),f(n,{inHeroGroupRow:(t,r)=>{const o=H(r.appState,t.props?.id);return!!o&&o.type==="HeroGroup"&&C("HeroGroup",o.props?.direction)==="row"}})}};function D(e){return Object.values(e).some(n=>!!n&&typeof n=="object"&&n.type==="slot")}const P={any:[]},x={not:{context:"insideSiteGutter",is:!0}},v={not:{context:"widthCappedByParent",is:!0}};function F(e,n,t){return e==="ButtonBlock"?h(t,["_gWidth","widthMode","pageWidth"],P):D(t)?(f(n,{insideSiteGutter:(r,o)=>m(o.appState?.data?.content,r.props?.id)}),h(t,["widthMode","pageWidth"],x)):(f(n,{widthCappedByParent:(r,o)=>"parent"in o?R(o.parent):N({props:r.props??{}},o)}),h(t,["widthMode","pageWidth"],v))}const z={name:"imageWidth",applies:e=>e==="ImageBlock",panel(e,n,t){const{slider:r,WidthIcon:o}=t;if(e?.fields){const d=r("Image width",p(o,{}),a.min,a.max,a.step,a.fallback,a.unit),c="focal",i=Object.entries(e.fields),s=i.findIndex(([l])=>l===c);e.fields=Object.fromEntries(s===-1?[...i,["width",d]]:[...i.slice(0,s+1),["width",d],...i.slice(s+1)])}}};export{q as buttonAlignInRow,X as containedWidth,z as imageWidth,K as sectionWidth,_ as widthModeFields};
@@ -0,0 +1,4 @@
1
+ import type { BlockShowWhenFacts } from "../show-when-resolve.js";
2
+ import type { BlockPass } from "./types.js";
3
+ export type { BlockShowWhenFacts };
4
+ export declare const showWhenRows: BlockPass;
@@ -0,0 +1 @@
1
+ const c={name:"showWhenRows",applies:()=>!0,panel(s,r,i){const n=i.rowsShownForNode,l=s.showWhenFacts??{},h=s.resolveFields;s.resolveFields=h?(o,e)=>{const t=h(o,e);return t instanceof Promise?t.then(w=>n(w??e.fields,o,e,l)):n(t??e.fields,o,e,l)}:(o,e)=>n(e.fields,o,e,l)}};export{c as showWhenRows};
@@ -40,6 +40,11 @@ export type PassInspector = {
40
40
  WidthIcon: ComponentType;
41
41
  assignSectionGroups: <T extends FieldMap>(fields: T, where: string) => T;
42
42
  dropEmptyHeadings: <T extends FieldMap>(fields: T) => T;
43
+ rowsShownForNode: (fields: FieldMap, data: {
44
+ props?: Record<string, unknown>;
45
+ }, params: Parameters<PassResolveFields>[1], facts?: Readonly<Record<string, (data: {
46
+ props?: Record<string, unknown>;
47
+ }, params: Parameters<PassResolveFields>[1]) => unknown>>) => FieldMap;
43
48
  SECTION_THEME_FOLLOW_LABEL: string;
44
49
  BLOCK_THEME_FOLLOW_LABEL: string;
45
50
  };
@@ -1 +1 @@
1
- import{withRecordTypeRow as c}from"./page-root-fields.js";import{dropEmptyHeadings as d}from"./panel-drop-empty-headings.js";import{PASS_INSPECTOR as l}from"./passes/inspector.js";import{finishRenderRegistry as m}from"./render-registry.js";function u(t){const f=m(t,l),s=t.root,n=s.resolveFields,r=(o,e)=>d(c(o,e?.props),"page");return s.resolveFields=n?(o,e)=>{const i=n(o,e);return i instanceof Promise?i.then(p=>r(p??e.fields,o)):r(i??e.fields,o)}:(o,e)=>r(e.fields,o),f}export{u as finishRegistry};
1
+ import{withRecordTypeRow as l}from"./page-root-fields.js";import{dropEmptyHeadings as p}from"./panel-drop-empty-headings.js";import{PASS_INSPECTOR as f}from"./passes/inspector.js";import{finishRenderRegistry as R}from"./render-registry.js";function F(s){const d=R(s,f),i=s.root,c=i.resolveFields,h=s.root?.showWhenFacts??{},n=(e,o,r)=>{const t=o?.props;return p(f.rowsShownForNode(l(e,t),{props:t},r,h),"page")};return i.resolveFields=c?(e,o)=>{const r=c(e,o);return r instanceof Promise?r.then(t=>n(t??o.fields,e,o)):n(r??o.fields,e,o)}:(e,o)=>n(o.fields,e,o),d}export{F as finishRegistry};
@@ -1,4 +1,4 @@
1
- import { type NodeLocation, type SlotConfigView, type TreeItem } from "./content-tree.js";
1
+ import { type NodeLocation, type SlotConfigView, type TreeItem } from "efficient-easel/draw";
2
2
  export declare function zoneOwner(zone: string | null | undefined): {
3
3
  ownerId: string;
4
4
  slot: string;
@@ -1 +1 @@
1
- import{locateNode as r}from"./content-tree.js";function c(n){if(!n)return null;const t=n.lastIndexOf(":");return t>0?{ownerId:n.slice(0,t),slot:n.slice(t+1)}:null}function s(n,t,l){const o=c(l?.zone),e=o?r(n,t,o.ownerId):null;return e&&o?{...e,slot:o.slot}:null}export{s as parentOfSelection,c as zoneOwner};
1
+ import{locateNode as r}from"efficient-easel/draw";function c(n){if(!n)return null;const t=n.lastIndexOf(":");return t>0?{ownerId:n.slice(0,t),slot:n.slice(t+1)}:null}function s(n,t,l){const o=c(l?.zone),e=o?r(n,t,o.ownerId):null;return e&&o?{...e,slot:o.slot}:null}export{s as parentOfSelection,c as zoneOwner};
@@ -0,0 +1,19 @@
1
+ import { showWhenOf, withShowWhen, type ShowWhenRule, type WithShowWhen } from "efficient-shell/format";
2
+ export { showWhenOf, withShowWhen };
3
+ export type { ShowWhenRule, WithShowWhen };
4
+ export declare function withRowsShownWhen<T extends Record<string, unknown>>(fields: T, keys: readonly string[], rule: ShowWhenRule): T;
5
+ export type RowRule = readonly [keys: readonly string[], rule: ShowWhenRule];
6
+ export declare function withRowRules<T extends Record<string, unknown>>(fields: T, table: readonly RowRule[]): T;
7
+ export declare function shownForOption(field: string, known: readonly string[], fallback: string, shownFor: readonly string[]): ShowWhenRule;
8
+ export type ShowWhenFactData = {
9
+ props?: Record<string, unknown>;
10
+ };
11
+ export type ShowWhenFactParams = {
12
+ fields: Record<string, unknown>;
13
+ appState?: unknown;
14
+ parent?: {
15
+ type?: string;
16
+ } | null;
17
+ };
18
+ export type BlockShowWhenFacts = Readonly<Record<string, (data: ShowWhenFactData, params: ShowWhenFactParams) => unknown>>;
19
+ export declare function addShowWhenFacts(block: object, facts: BlockShowWhenFacts): void;
@@ -0,0 +1 @@
1
+ import{showWhenOf as u,withShowWhen as p}from"efficient-shell/format";const f=new WeakMap;function W(t,o,n){if(!t||!o.some(i=>i in t))return t;let e=f.get(t);e||f.set(t,e=new WeakMap);let c=e.get(n);c||e.set(n,c=new Map);const r=o.join("\0"),a=c.get(r);if(a)return a;const h={...t};for(const i of o){const s=h[i];if(!s||typeof s!="object")continue;const w=u(s);h[i]=p(s,w?{all:[w,n]}:n)}return c.set(r,h),h}function b(t,o){return o.reduce((n,[e,c])=>W(n,e,c),t)}function y(t,o,n,e){const c={field:t,in:e};return e.includes(n)?{any:[c,{not:{field:t,in:o}}]}:c}function R(t,o){const n=t;n.showWhenFacts={...o,...n.showWhenFacts??{}}}export{R as addShowWhenFacts,u as showWhenOf,y as shownForOption,b as withRowRules,W as withRowsShownWhen,p as withShowWhen};
@@ -0,0 +1,9 @@
1
+ import type { PassResolveFields } from "./passes/types.js";
2
+ type Fields = Record<string, unknown>;
3
+ import type { BlockShowWhenFacts } from "./show-when-attach.js";
4
+ type ResolverData = {
5
+ props?: Record<string, unknown>;
6
+ };
7
+ type ResolverInput = Parameters<PassResolveFields>[1];
8
+ export type { BlockShowWhenFacts };
9
+ export declare function rowsShownForNode(fields: Fields, data: ResolverData, params: ResolverInput, facts?: BlockShowWhenFacts): Fields;
@@ -0,0 +1 @@
1
+ import{isShown as S}from"efficient-shell/format";import{containerOffersPositions as g}from"../content/grid-span.js";import{heroGroupNestDepth as j}from"../hero-group-placement.js";import{BUCKET_KEY as k,reseatBucketTabs as E}from"./field-groups.js";import{readsContext as x,resolverContext as y,showWhenOf as v}from"./show-when.js";import{findParentNode as B}from"./passes/document-position.js";const m=new WeakMap,C=new Set(Object.values(k));function A(e,p,s,w={}){if(!e)return e;const u=p?.props??{},c=u.id,d=Object.fromEntries(Object.entries(w).map(([t,r])=>[t,()=>r(p,s)])),O=y(s,{...d,parentOffersPositions:()=>{const t=B(s.appState,c);return t===void 0?void 0:g(t)},heroGroupDepth:()=>j(s.appState?.data,typeof c=="string"?c:"")}),o=[];for(const[t,r]of Object.entries(e)){const f=v(r);!f||x(f,"device")||S(f,u,O)||o.push(t)}if(o.length===0)return e;let i=m.get(e);i||m.set(e,i=new Map);const h=o.join("\0"),a=i.get(h);if(a)return a;const b=new Set(o);let n={};for(const[t,r]of Object.entries(e))b.has(t)||(n[t]=r);return o.some(t=>C.has(t))&&(n=E(n)),i.set(h,n),n}export{A as rowsShownForNode};
@@ -1,14 +1,19 @@
1
- import { type ShowWhenContext, type ShowWhenRule } from "efficient-shell/ui";
2
- import type { SlotConfigView, TreeItem } from "./content-tree.js";
1
+ import { type ShowWhenContext, type ShowWhenRule } from "efficient-shell/format";
2
+ import type { SlotConfigView, TreeItem } from "efficient-easel/draw";
3
3
  export type { ShowWhenRule, ShowWhenContext };
4
- export type WithShowWhen = {
5
- showWhen?: ShowWhenRule;
6
- };
7
- export declare function withShowWhen<F extends object>(field: F, rule: ShowWhenRule): F;
8
- export declare function showWhenOf(field: unknown): ShowWhenRule | undefined;
4
+ export { showWhenOf, shownForOption, withRowRules, withRowsShownWhen, withShowWhen, type RowRule, type WithShowWhen } from "./show-when-attach.js";
9
5
  export declare function visibleFields<T extends Record<string, unknown>>(fields: T, values: Readonly<Record<string, unknown>> | null | undefined, context: ShowWhenContext): T;
10
6
  export type ShowWhenSelector = {
11
7
  index: number;
12
8
  zone?: string;
13
9
  } | null | undefined;
14
10
  export declare function showWhenContext(device: string | undefined, config: SlotConfigView, content: ReadonlyArray<TreeItem>, selector: ShowWhenSelector): ShowWhenContext;
11
+ export declare function readsContext(rule: unknown, name: string): boolean;
12
+ export type ResolverParams = {
13
+ appState?: unknown;
14
+ parent?: {
15
+ type?: unknown;
16
+ props?: Record<string, unknown>;
17
+ } | null;
18
+ };
19
+ export declare function resolverContext(params: ResolverParams, extra?: Record<string, () => unknown>): ShowWhenContext;
@@ -1 +1 @@
1
- import{isShown as s}from"efficient-shell/ui";import{parentOfSelection as f}from"./selection-parent.js";function w(e,t){return{...e,showWhen:t}}function h(e){return e&&typeof e=="object"?e.showWhen:void 0}function m(e,t,r){let o=!1;const n={};for(const[i,p]of Object.entries(e))s(h(p),t??{},r)?n[i]=p:o=!0;return o?n:e}function a(e,t,r,o){const n=f(t,r,o);return{device:e,parentType:n?.item.type,parent:n?.item.props}}export{a as showWhenContext,h as showWhenOf,m as visibleFields,w as withShowWhen};
1
+ import{isShown as s}from"efficient-shell/format";import{isEditorOnDynamicPage as c}from"./editor-page-context.js";import{parentOfSelection as a}from"./selection-parent.js";import{showWhenOf as W,shownForOption as S,withRowRules as g,withRowsShownWhen as j,withShowWhen as C}from"./show-when-attach.js";import{showWhenOf as u}from"./show-when-attach.js";function w(o,n,t){let e=!1;const r={};for(const[i,p]of Object.entries(o))s(u(p),n??{},t)?r[i]=p:e=!0;return e?r:o}function x(o,n,t,e){const r=a(n,t,e);return{device:o,parentType:r?.item.type,parent:r?.item.props}}function f(o,n){if(!o||typeof o!="object")return!1;const t=o;if(typeof t.context=="string"&&(t.context===n||t.context.startsWith(`${n}.`)))return!0;if("not"in t)return f(t.not,n);for(const e of[t.all,t.any])if(Array.isArray(e)&&e.some(r=>f(r,n)))return!0;return!1}function m(o,n={}){const t={},e=(r,i)=>Object.defineProperty(t,r,{get:i,enumerable:!0});e("parentType",()=>o.parent?.type??void 0),e("parent",()=>o.parent?.props??void 0),e("dynamicPage",()=>c()),e("root",()=>o.appState?.data?.root?.props);for(const[r,i]of Object.entries(n))e(r,i);return t}export{f as readsContext,m as resolverContext,x as showWhenContext,W as showWhenOf,S as shownForOption,w as visibleFields,g as withRowRules,j as withRowsShownWhen,C as withShowWhen};
@@ -1,4 +1,4 @@
1
- import { type TreeItem } from "./content-tree.js";
1
+ import { type TreeItem } from "efficient-easel/draw";
2
2
  import type { NodeDefaults, SlotSectionSpec } from "./slot-section-spec.js";
3
3
  export type { NodeDefaults, SlotSectionSpec } from "./slot-section-spec.js";
4
4
  export declare const SLOT_SECTION_SPECS: Record<string, SlotSectionSpec>;
@@ -1 +1 @@
1
- import{HERO_SLIDE_SEEDS as a}from"../../components/HeroSlide.js";import{heroGroupAddBlocked as l,heroGroupOverCapNotice as c}from"../hero-group-placement.js";import{newNodeId as p}from"./content-tree.js";import{BOX_TYPE as t,CONTAINER_BLOCKS_SLOT as n}from"./container-blocks.js";import{BOX_LABEL as i}from"./section-catalog.js";const m="ImageBlock",E=3,d=(e,r,o={})=>({type:e,props:{...r?.(e)??{},id:p(e),...o}}),T=e=>({...e?.(t)??{},direction:"column",[n]:[d(m,e),d(t,e,{direction:"column",[n]:[d("Heading",e),d("Text",e)]})]}),s={Hero:{slot:"slides",childType:"HeroSlide",addLabel:"Add slide",slider:!0,seeds:()=>a.map(e=>({...e}))},HeroSlide:{slot:"groups",childType:"HeroGroup",addLabel:`Add ${i.toLowerCase()}`,seeds:()=>[],addBlocked:l,notice:c},HeroSingle:{slot:"boxes",childType:"HeroGroup",addLabel:`Add ${i.toLowerCase()}`,seeds:()=>[],addBlocked:l,notice:c},ProcessSteps:{slot:"boxes",childType:t,addLabel:`Add ${i.toLowerCase()}`,seeds:e=>Array.from({length:E},()=>T(e)),skipSeed:e=>Array.isArray(e.steps)&&e.steps.length>0}};function u(e){for(const[r,o]of Object.entries(e)){if(r in s&&s[r]!==o)throw new Error(`lib/puck/slot-specs: "${r}" already has a slot spec`);s[r]=o}}function A(e,r){const o=s[e];return o?{slot:o.slot,children:o.seeds(r).map(S=>({type:o.childType,props:{id:p(o.childType),...S}}))}:null}export{s as SLOT_SECTION_SPECS,A as buildSlotSeedChildren,u as registerSlotSectionSpecs};
1
+ import{HERO_SLIDE_SEEDS as a}from"../../components/HeroSlide.js";import{heroGroupAddBlocked as l,heroGroupOverCapNotice as c}from"../hero-group-placement.js";import{newNodeId as p}from"efficient-easel/draw";import{BOX_TYPE as t,CONTAINER_BLOCKS_SLOT as n}from"./container-blocks.js";import{BOX_LABEL as i}from"./section-catalog.js";const m="ImageBlock",E=3,d=(e,r,o={})=>({type:e,props:{...r?.(e)??{},id:p(e),...o}}),T=e=>({...e?.(t)??{},direction:"column",[n]:[d(m,e),d(t,e,{direction:"column",[n]:[d("Heading",e),d("Text",e)]})]}),s={Hero:{slot:"slides",childType:"HeroSlide",addLabel:"Add slide",slider:!0,seeds:()=>a.map(e=>({...e}))},HeroSlide:{slot:"groups",childType:"HeroGroup",addLabel:`Add ${i.toLowerCase()}`,seeds:()=>[],addBlocked:l,notice:c},HeroSingle:{slot:"boxes",childType:"HeroGroup",addLabel:`Add ${i.toLowerCase()}`,seeds:()=>[],addBlocked:l,notice:c},ProcessSteps:{slot:"boxes",childType:t,addLabel:`Add ${i.toLowerCase()}`,seeds:e=>Array.from({length:E},()=>T(e)),skipSeed:e=>Array.isArray(e.steps)&&e.steps.length>0}};function u(e){for(const[r,o]of Object.entries(e)){if(r in s&&s[r]!==o)throw new Error(`lib/puck/slot-specs: "${r}" already has a slot spec`);s[r]=o}}function A(e,r){const o=s[e];return o?{slot:o.slot,children:o.seeds(r).map(S=>({type:o.childType,props:{id:p(o.childType),...S}}))}:null}export{s as SLOT_SECTION_SPECS,A as buildSlotSeedChildren,u as registerSlotSectionSpecs};
@@ -1,4 +1,4 @@
1
- import type { SlotConfigView, TreeItem } from "./content-tree.js";
1
+ import type { SlotConfigView, TreeItem } from "efficient-easel/draw";
2
2
  export type TemplateSelector = {
3
3
  index: number;
4
4
  zone?: string;
@@ -1,4 +1,4 @@
1
- import { LINK_FIELD_MARKER, SCAFFOLD_FIELD_MARKER, TEXT_FIELD_MARKER, type TextFieldMeta } from "./field-markers.js";
1
+ import { LINK_FIELD_MARKER, SCAFFOLD_FIELD_MARKER, TEXT_FIELD_MARKER, type TextFieldMeta } from "efficient-easel/draw";
2
2
  export type TextPartShape = {
3
3
  type?: string;
4
4
  label?: string;
@@ -1,2 +1,2 @@
1
- import{LINK_FIELD_MARKER as p,SCAFFOLD_FIELD_MARKER as s,TEXT_FIELD_MARKER as a}from"./field-markers.js";import{isStructuralTextProp as y}from"./neutralization-contracts.js";const b=["control","label","placeholder","itemKey"];function l(e){if(!e||typeof e!="object")return null;const t={};for(const[n,i]of Object.entries(e)){const o=d(i);o&&(t[n]=o)}return Object.keys(t).length?t:null}function d(e){if(!e||typeof e!="object")return null;const t=e,n=t[a],i=t.type==="text"||t.type==="textarea",o=l(t.arrayFields),f=l(t.objectFields);if(!n&&!i&&!o&&!f)return null;const r={};if(typeof t.type=="string"&&(r.type=t.type),typeof t.label=="string"&&(r.label=t.label),n){const u={};for(const c of b)n[c]!==void 0&&(u[c]=n[c]);r[a]=u}return t[p]&&(r[p]=!0),t[s]!==void 0&&(r[s]=t[s]),o&&(r.arrayFields=o),f&&(r.objectFields=f),r}function h(e){const t=l(e)??{};for(const n of Object.keys(t))y(n)&&delete t[n];return t}function j(e){const t={};for(const[n,i]of Object.entries(e)){const o=h(i.fields);Object.keys(o).length&&(t[n]=o)}return t}function F(e){return`${JSON.stringify(j(e),null,2)}
1
+ import{LINK_FIELD_MARKER as p,SCAFFOLD_FIELD_MARKER as s,TEXT_FIELD_MARKER as a}from"efficient-easel/draw";import{isStructuralTextProp as y}from"./neutralization-contracts.js";const b=["control","label","placeholder","itemKey"];function l(e){if(!e||typeof e!="object")return null;const t={};for(const[n,i]of Object.entries(e)){const o=d(i);o&&(t[n]=o)}return Object.keys(t).length?t:null}function d(e){if(!e||typeof e!="object")return null;const t=e,n=t[a],i=t.type==="text"||t.type==="textarea",o=l(t.arrayFields),f=l(t.objectFields);if(!n&&!i&&!o&&!f)return null;const r={};if(typeof t.type=="string"&&(r.type=t.type),typeof t.label=="string"&&(r.label=t.label),n){const u={};for(const c of b)n[c]!==void 0&&(u[c]=n[c]);r[a]=u}return t[p]&&(r[p]=!0),t[s]!==void 0&&(r[s]=t[s]),o&&(r.arrayFields=o),f&&(r.objectFields=f),r}function h(e){const t=l(e)??{};for(const n of Object.keys(t))y(n)&&delete t[n];return t}function j(e){const t={};for(const[n,i]of Object.entries(e)){const o=h(i.fields);Object.keys(o).length&&(t[n]=o)}return t}function F(e){return`${JSON.stringify(j(e),null,2)}
2
2
  `}export{h as textPartShape,j as textPartShapes,F as textPartShapesText};
@@ -1,5 +1,5 @@
1
- import { decodePartId, encodePartId } from "./part-id.js";
2
- import { type TextFieldMeta } from "./field-markers.js";
1
+ import { decodePartId, encodePartId } from "efficient-easel/draw";
2
+ import { type TextFieldMeta } from "efficient-easel/draw";
3
3
  import { type PartRow } from "./part-rows.js";
4
4
  export declare const PART_ATTR = "data-sf-part";
5
5
  export declare const PART_SELECTED_ATTR = "data-sf-part-selected";
@@ -1 +1 @@
1
- import{decodePartId as m,encodePartId as g}from"./part-id.js";import{stripMarkup as y}from"../markup.js";import{LINK_FIELD_MARKER as A,SCAFFOLD_FIELD_MARKER as R,TEXT_FIELD_MARKER as u}from"./field-markers.js";import{readHidable as b}from"./hidable.js";import{SCALAR_TEXT_CONTROLS as L}from"./text-control-kinds.js";import{isStructuralTextProp as _}from"./neutralization-contracts.js";import{fieldInOwnBox as P}from"./own-box.js";import{partRowTexts as S}from"./part-rows.js";const B="data-sf-part",H="data-sf-part-selected",W="data-sf-part-kind",j="data-sf-part-style-owner",I="data-sf-part-style-kind";function q(e){for(let t=e;t;t=t.parentElement){const r=t.getAttribute(j),n=t.getAttribute(I);if(r&&n)return{owner:r,kind:n};if(t.getAttribute("data-puck-component"))return null}return null}const h=2;function G(e,t){if(!e)return!1;const r=m(e);return!!r?.propKey&&r.nodeId===t}function E(e){return y(e).replace(/\s+/gu,"")}function l(e,t,r){const n=e[u];if(n){if(n.control==="textList"){const o=n.itemKey??"text";if(!Array.isArray(t))return;for(const i of t){const c=i?.[o];typeof c=="string"&&r.push(c)}return}const{text:s}=b(t);s?r.push(s):n.placeholder&&r.push(n.placeholder);return}if(!e[A]){if(e.type==="text"||e.type==="textarea"){typeof t=="string"&&t&&r.push(t);return}if(e.arrayFields&&Array.isArray(t)){for(const s of t)for(const[o,i]of Object.entries(e.arrayFields))l(i,s?.[o],r);return}if(e.objectFields&&t&&typeof t=="object")for(const[s,o]of Object.entries(e.objectFields))l(o,t[s],r)}}function J(e){if(!e||typeof e!="object")return!1;const t=e;return t[A]?!1:!!t[u]||t.type==="text"||t.type==="textarea"}function w(e,t){const r=e[u];return r?.label?r.label:typeof e.label=="string"?e.label:t}function F(e){const t=e.indexOf(" (");return(t>0?e.slice(0,t):e).trim()}function Q(e,t){if(!e)return[];const r=[];for(const[n,s]of Object.entries(e)){if(!s||typeof s!="object"||_(n))continue;const o=s,i=[];l(o,t?.[n],i),!i.length&&o[R]!==void 0&&l(o,o[R],i);const c=w(o,n),a=new Set;for(const{row:d,text:f}of S(o,t?.[n])){const T=E(f);T.length<h||(a.add(T),r.push({key:n,label:c,texts:[T],row:d}))}const p=new Set(a),x=[];for(const d of i){const f=E(d);f.length<h||p.has(f)||(p.add(f),x.push(f))}x.length&&r.push({key:n,label:c,texts:x})}return r}const K=L;function O(e,t){if(!t||typeof t!="object"||_(e)||P(t))return null;const r=t[u];return!r||!K.includes(r.control)?null:r}function U(e,t){const r=O(e,t);return r!==null&&r.identifier!==!0}function V(e,t){if(!e)return[];const r=[];for(const[n,s]of Object.entries(e)){const o=O(n,s);if(!o)continue;const{text:i,hidden:c}=b(t?.[n]),a=i||o.placeholder||"",p=y(a).replace(/\s+/gu," ").trim();r.push({key:n,label:F(w(s,n)),preview:p,offPage:o.offPage===!0,identifier:o.identifier===!0,hidden:!!c})}return r}export{B as PART_ATTR,W as PART_KIND_ATTR,H as PART_SELECTED_ATTR,I as PART_STYLE_KIND_ATTR,j as PART_STYLE_OWNER_ATTR,m as decodePartId,g as encodePartId,O as entryPartMetaOf,U as fieldDrawsEntryRow,J as holdsAuthoredText,E as normalizePartText,F as partHeadLabel,w as partLabel,Q as partNeedles,G as partOpenOn,q as partStyleOwnerOf,V as sectionTextParts};
1
+ import{decodePartId as m,encodePartId as g}from"efficient-easel/draw";import{stripMarkup as y}from"../markup.js";import{LINK_FIELD_MARKER as A,SCAFFOLD_FIELD_MARKER as R,TEXT_FIELD_MARKER as u}from"efficient-easel/draw";import{readHidable as b}from"efficient-easel/draw";import{SCALAR_TEXT_CONTROLS as L}from"efficient-easel/draw";import{isStructuralTextProp as _}from"./neutralization-contracts.js";import{fieldInOwnBox as P}from"./own-box.js";import{partRowTexts as S}from"./part-rows.js";const B="data-sf-part",H="data-sf-part-selected",W="data-sf-part-kind",j="data-sf-part-style-owner",I="data-sf-part-style-kind";function q(e){for(let t=e;t;t=t.parentElement){const r=t.getAttribute(j),n=t.getAttribute(I);if(r&&n)return{owner:r,kind:n};if(t.getAttribute("data-puck-component"))return null}return null}const h=2;function G(e,t){if(!e)return!1;const r=m(e);return!!r?.propKey&&r.nodeId===t}function E(e){return y(e).replace(/\s+/gu,"")}function l(e,t,r){const n=e[u];if(n){if(n.control==="textList"){const o=n.itemKey??"text";if(!Array.isArray(t))return;for(const i of t){const c=i?.[o];typeof c=="string"&&r.push(c)}return}const{text:s}=b(t);s?r.push(s):n.placeholder&&r.push(n.placeholder);return}if(!e[A]){if(e.type==="text"||e.type==="textarea"){typeof t=="string"&&t&&r.push(t);return}if(e.arrayFields&&Array.isArray(t)){for(const s of t)for(const[o,i]of Object.entries(e.arrayFields))l(i,s?.[o],r);return}if(e.objectFields&&t&&typeof t=="object")for(const[s,o]of Object.entries(e.objectFields))l(o,t[s],r)}}function J(e){if(!e||typeof e!="object")return!1;const t=e;return t[A]?!1:!!t[u]||t.type==="text"||t.type==="textarea"}function w(e,t){const r=e[u];return r?.label?r.label:typeof e.label=="string"?e.label:t}function F(e){const t=e.indexOf(" (");return(t>0?e.slice(0,t):e).trim()}function Q(e,t){if(!e)return[];const r=[];for(const[n,s]of Object.entries(e)){if(!s||typeof s!="object"||_(n))continue;const o=s,i=[];l(o,t?.[n],i),!i.length&&o[R]!==void 0&&l(o,o[R],i);const c=w(o,n),a=new Set;for(const{row:d,text:f}of S(o,t?.[n])){const T=E(f);T.length<h||(a.add(T),r.push({key:n,label:c,texts:[T],row:d}))}const p=new Set(a),x=[];for(const d of i){const f=E(d);f.length<h||p.has(f)||(p.add(f),x.push(f))}x.length&&r.push({key:n,label:c,texts:x})}return r}const K=L;function O(e,t){if(!t||typeof t!="object"||_(e)||P(t))return null;const r=t[u];return!r||!K.includes(r.control)?null:r}function U(e,t){const r=O(e,t);return r!==null&&r.identifier!==!0}function V(e,t){if(!e)return[];const r=[];for(const[n,s]of Object.entries(e)){const o=O(n,s);if(!o)continue;const{text:i,hidden:c}=b(t?.[n]),a=i||o.placeholder||"",p=y(a).replace(/\s+/gu," ").trim();r.push({key:n,label:F(w(s,n)),preview:p,offPage:o.offPage===!0,identifier:o.identifier===!0,hidden:!!c})}return r}export{B as PART_ATTR,W as PART_KIND_ATTR,H as PART_SELECTED_ATTR,I as PART_STYLE_KIND_ATTR,j as PART_STYLE_OWNER_ATTR,m as decodePartId,g as encodePartId,O as entryPartMetaOf,U as fieldDrawsEntryRow,J as holdsAuthoredText,E as normalizePartText,F as partHeadLabel,w as partLabel,Q as partNeedles,G as partOpenOn,q as partStyleOwnerOf,V as sectionTextParts};
@@ -1,3 +1,4 @@
1
+ import type { ShowWhenRule } from "efficient-shell/format";
1
2
  import type { SectionHeadStyle } from "./section-head-style.js";
2
3
  export type SectionHeadPlacement = "inline" | "own-box";
3
4
  export declare const DEFAULT_SECTION_HEAD_PLACEMENT: SectionHeadPlacement;
@@ -25,7 +26,9 @@ export declare function parseSectionHeadPlacement(value: unknown): SectionHeadPl
25
26
  export declare function parentCapsWidth(parent: {
26
27
  type?: string;
27
28
  } | null | undefined): boolean;
28
- export declare function widthFieldsForParent<T extends Record<string, unknown>>(fields: T, parent: {
29
+ export declare const WIDTH_ROWS_SHOW_WHEN: ShowWhenRule;
30
+ export declare function widthFieldsForParent<T extends Record<string, unknown>>(fields: T, _parent: {
29
31
  type?: string;
30
32
  } | null | undefined, widthKeys: readonly string[]): T;
31
- export declare function headFieldsForPlacement<T extends Record<string, unknown>>(fields: T, placement: unknown, headKeys: readonly string[]): T;
33
+ export declare const HEAD_ROWS_SHOW_WHEN: ShowWhenRule;
34
+ export declare function headFieldsForPlacement<T extends Record<string, unknown>>(fields: T, _placement: unknown, headKeys: readonly string[]): T;
@@ -1 +1 @@
1
- import{parseOption as d}from"../parse-option.js";const l="inline",s=[{label:"In this section",value:"inline"},{label:"In its own box",value:"own-box"}];function h(e){return[e.num,e.title,e.description,e.linkProp].filter(t=>typeof t=="string"&&t.length>0)}const a={ProductGrid:{num:"num",title:"title",description:"description",headRows:["num","title","titleSize","description","linkText","linkHref"],renderer:"ProductGridSection",padKey:"padTop",linkProp:"link"},TyreSizes:{num:"num",title:"title",description:"description",headRows:["num","title","description"],renderer:"DynamicTyreSizes"},FitmentFinder:{num:"num",title:"title",description:"description",headRows:["num","title","description"],renderer:"FitmentFinder"},TyreFitment:{num:"num",title:"title",description:"description",headRows:["num","title","description"],renderer:"DynamicTyreFitment"},BundleOffer:{num:"num",title:"title",description:"description",headRows:["num","title","description"],renderer:"DynamicBundleOffer"},CompatibleTyres:{num:"num",title:"title",description:"description",headRows:["num","title","description"],renderer:"DynamicRelatedProducts"},RelatedProducts:{num:"num",title:"title",description:"description",headRows:["num","title","description"],renderer:"DynamicRelatedProducts"},SpecTable:{num:"num",title:"title",description:"description",headRows:["num","title","description"],renderer:"SpecTable"},FAQ:{num:"num",title:"title",linkProp:"link",headRows:["num","title","linkText","linkHref"],renderer:"FAQ"},GalleryB:{num:"num",title:"title",headRows:["num","title","linkText","linkHref"],renderer:"GalleryGrid"},FitmentTable:{num:"num",title:"title",description:"description",headRows:["num","title","description"],renderer:"FitmentTable"},Events:{num:"num",title:"title",linkProp:"link",headRows:["num","title","linkText","linkHref"],renderer:"Events"},ProcessSteps:{num:"num",title:"title",description:"description",headRows:["num","title","description"],headStyle:"editorial",renderer:"ProcessSteps",padKey:"padTop"},LongRead:{num:"headNum",title:"headTitle",description:"headDesc",headRows:["headNum","headTitle","headDesc"],headStyle:"editorial",renderer:"LongRead"},Series:{num:"headNum",title:"headTitle",description:"headDesc",headRows:["headNum","headTitle","headDesc"],headStyle:"editorial",renderer:"Series"},TimelineTrack:{num:"eyebrow",title:"title",description:"intro",headRows:["eyebrow","title","intro"],headStyle:"editorial",renderer:"TimelineTrack",padKey:"padTop"},StatsParagraph:{num:"eyebrow",title:"title",description:"desc",headRows:["eyebrow","title","desc"],headStyle:"editorial",renderer:"StatsParagraph"},Footprint:{num:"sectionNumber",title:"heading",description:"tagline",headRows:["sectionNumber","heading","tagline"],headStyle:"editorial",renderer:"Footprint",padKey:"padTop"},Collections:{num:"eyebrow",title:"heading",headRows:["eyebrow","heading"],renderer:"Collections"},Cards:{num:"eyebrow",title:"title",headRows:["eyebrow","eyebrowLook","title"],headStyle:"simple",renderer:"Cards"},Testimonials:{num:"eyebrow",title:"title",headRows:["eyebrow","eyebrowLook","title"],headStyle:"simple",renderer:"Testimonials"},Reviews:{num:"eyebrow",title:"title",headRows:["eyebrow","eyebrowLook","title"],headStyle:"simple",renderer:"Reviews"},Prose:{num:"eyebrow",title:"title",headRows:["eyebrow","title"],headStyle:"essay",renderer:"Prose"},ReviewForm:{num:"eyebrow",title:"title",headRows:["eyebrow","title"],headStyle:"simple",renderer:"ReviewForm"},DeliveryOptions:{num:"eyebrow",title:"title",description:"body",headRows:["eyebrow","title","body"],headStyle:"natural",headRowGap:"gap-3",headDescriptionSize:"text-[15px]",renderer:"DeliveryOptions"}},y="SectionHeader";function w(e){return e in a}function p(e){return d(s,l,e)}const c=new Set(["Flex"]);function u(e){return!!e?.type&&c.has(e.type)}function T(e,t,n){if(!u(t))return e;const i={};for(const[r,o]of Object.entries(e))n.includes(r)||(i[r]=o);return i}function b(e,t,n){if(p(t)!=="own-box")return e;const i={};for(const[r,o]of Object.entries(e))n.includes(r)||(i[r]=o);return i}export{l as DEFAULT_SECTION_HEAD_PLACEMENT,s as SECTION_HEAD_PLACEMENT_OPTIONS,y as SECTION_HEAD_TYPE,a as SPLITTABLE_SECTIONS,w as canSplitHead,b as headFieldsForPlacement,h as headRoleProps,u as parentCapsWidth,p as parseSectionHeadPlacement,T as widthFieldsForParent};
1
+ import{parseOption as o}from"../parse-option.js";import{withRowsShownWhen as r}from"../puck/show-when-attach.js";const d="inline",l=[{label:"In this section",value:"inline"},{label:"In its own box",value:"own-box"}];function u(e){return[e.num,e.title,e.description,e.linkProp].filter(t=>typeof t=="string"&&t.length>0)}const a={ProductGrid:{num:"num",title:"title",description:"description",headRows:["num","title","titleSize","description","linkText","linkHref"],renderer:"ProductGridSection",padKey:"padTop",linkProp:"link"},TyreSizes:{num:"num",title:"title",description:"description",headRows:["num","title","description"],renderer:"DynamicTyreSizes"},FitmentFinder:{num:"num",title:"title",description:"description",headRows:["num","title","description"],renderer:"FitmentFinder"},TyreFitment:{num:"num",title:"title",description:"description",headRows:["num","title","description"],renderer:"DynamicTyreFitment"},BundleOffer:{num:"num",title:"title",description:"description",headRows:["num","title","description"],renderer:"DynamicBundleOffer"},CompatibleTyres:{num:"num",title:"title",description:"description",headRows:["num","title","description"],renderer:"DynamicRelatedProducts"},RelatedProducts:{num:"num",title:"title",description:"description",headRows:["num","title","description"],renderer:"DynamicRelatedProducts"},SpecTable:{num:"num",title:"title",description:"description",headRows:["num","title","description"],renderer:"SpecTable"},FAQ:{num:"num",title:"title",linkProp:"link",headRows:["num","title","linkText","linkHref"],renderer:"FAQ"},GalleryB:{num:"num",title:"title",headRows:["num","title","linkText","linkHref"],renderer:"GalleryGrid"},FitmentTable:{num:"num",title:"title",description:"description",headRows:["num","title","description"],renderer:"FitmentTable"},Events:{num:"num",title:"title",linkProp:"link",headRows:["num","title","linkText","linkHref"],renderer:"Events"},ProcessSteps:{num:"num",title:"title",description:"description",headRows:["num","title","description"],headStyle:"editorial",renderer:"ProcessSteps",padKey:"padTop"},LongRead:{num:"headNum",title:"headTitle",description:"headDesc",headRows:["headNum","headTitle","headDesc"],headStyle:"editorial",renderer:"LongRead"},Series:{num:"headNum",title:"headTitle",description:"headDesc",headRows:["headNum","headTitle","headDesc"],headStyle:"editorial",renderer:"Series"},TimelineTrack:{num:"eyebrow",title:"title",description:"intro",headRows:["eyebrow","title","intro"],headStyle:"editorial",renderer:"TimelineTrack",padKey:"padTop"},StatsParagraph:{num:"eyebrow",title:"title",description:"desc",headRows:["eyebrow","title","desc"],headStyle:"editorial",renderer:"StatsParagraph"},Footprint:{num:"sectionNumber",title:"heading",description:"tagline",headRows:["sectionNumber","heading","tagline"],headStyle:"editorial",renderer:"Footprint",padKey:"padTop"},Collections:{num:"eyebrow",title:"heading",headRows:["eyebrow","heading"],renderer:"Collections"},Cards:{num:"eyebrow",title:"title",headRows:["eyebrow","eyebrowLook","title"],headStyle:"simple",renderer:"Cards"},Testimonials:{num:"eyebrow",title:"title",headRows:["eyebrow","eyebrowLook","title"],headStyle:"simple",renderer:"Testimonials"},Reviews:{num:"eyebrow",title:"title",headRows:["eyebrow","eyebrowLook","title"],headStyle:"simple",renderer:"Reviews"},Prose:{num:"eyebrow",title:"title",headRows:["eyebrow","title"],headStyle:"essay",renderer:"Prose"},ReviewForm:{num:"eyebrow",title:"title",headRows:["eyebrow","title"],headStyle:"simple",renderer:"ReviewForm"},DeliveryOptions:{num:"eyebrow",title:"title",description:"body",headRows:["eyebrow","title","body"],headStyle:"natural",headRowGap:"gap-3",headDescriptionSize:"text-[15px]",renderer:"DeliveryOptions"}},h="SectionHeader";function w(e){return e in a}function y(e){return o(l,d,e)}const n=new Set(["Flex"]);function S(e){return!!e?.type&&n.has(e.type)}const s={not:{context:"parentType",in:[...n]}};function T(e,t,i){return r(e,i,s)}const p={not:{field:"headPlacement",is:"own-box"}};function R(e,t,i){return r(e,i,p)}export{d as DEFAULT_SECTION_HEAD_PLACEMENT,p as HEAD_ROWS_SHOW_WHEN,l as SECTION_HEAD_PLACEMENT_OPTIONS,h as SECTION_HEAD_TYPE,a as SPLITTABLE_SECTIONS,s as WIDTH_ROWS_SHOW_WHEN,w as canSplitHead,R as headFieldsForPlacement,u as headRoleProps,S as parentCapsWidth,y as parseSectionHeadPlacement,T as widthFieldsForParent};
@@ -14,3 +14,4 @@ export type NaturalDescriptionSize = (typeof NATURAL_DESCRIPTION_SIZES)[number];
14
14
  export declare function parseNaturalRowGap(value: unknown): NaturalRowGap;
15
15
  export declare function parseNaturalDescriptionSize(value: unknown): NaturalDescriptionSize;
16
16
  export declare function parseSectionHeadStyle(value: unknown): SectionHeadStyle;
17
+ export declare function withHeadStyleRules<T extends Record<string, unknown>>(fields: T): T;
@@ -1 +1 @@
1
- import{parseOption as t}from"../parse-option.js";const n="standard",s=[{label:"Standard",value:"standard"},{label:"Editorial",value:"editorial"},{label:"Simple",value:"simple"},{label:"Statement",value:"statement"},{label:"Natural",value:"natural"},{label:"Essay",value:"essay"}],a=["numStyle","logoSrc","logoAlt","linkText","linkHref","_gLogo"],o=[...a,"description"],S={standard:["eyebrowLook"],editorial:[...a,"eyebrowLook"],simple:o,statement:o,natural:a,essay:o},r=["gap-5","gap-3"],l=["text-[length:var(--size-body,16px)]","text-[15px]"];function i(e){return t(r,r[0],e)}function E(e){return t(l,l[0],e)}function _(e){return t(s,n,e)}export{n as DEFAULT_SECTION_HEAD_STYLE,a as EDITORIAL_HEAD_UNUSED_FIELDS,S as HEAD_UNUSED_FIELDS,l as NATURAL_DESCRIPTION_SIZES,r as NATURAL_ROW_GAPS,s as SECTION_HEAD_STYLE_OPTIONS,o as SIMPLE_HEAD_UNUSED_FIELDS,E as parseNaturalDescriptionSize,i as parseNaturalRowGap,_ as parseSectionHeadStyle};
1
+ import{parseOption as a}from"../parse-option.js";import{shownForOption as c,withRowRules as _}from"../puck/show-when-attach.js";const n="standard",s=[{label:"Standard",value:"standard"},{label:"Editorial",value:"editorial"},{label:"Simple",value:"simple"},{label:"Statement",value:"statement"},{label:"Natural",value:"natural"},{label:"Essay",value:"essay"}],o=["numStyle","logoSrc","logoAlt","linkText","linkHref","_gLogo"],r=[...o,"description"],p={standard:["eyebrowLook"],editorial:[...o,"eyebrowLook"],simple:r,statement:r,natural:o,essay:r},i=["gap-5","gap-3"],S=["text-[length:var(--size-body,16px)]","text-[15px]"];function D(e){return a(i,i[0],e)}function m(e){return a(S,S[0],e)}function A(e){return a(s,n,e)}function L(e){const l=s.map(t=>t.value),u=[...new Set(Object.values(p).flat())];return _(e,u.map(t=>[[t],c("headStyle",l,n,l.filter(E=>!p[E].includes(t)))]))}export{n as DEFAULT_SECTION_HEAD_STYLE,o as EDITORIAL_HEAD_UNUSED_FIELDS,p as HEAD_UNUSED_FIELDS,S as NATURAL_DESCRIPTION_SIZES,i as NATURAL_ROW_GAPS,s as SECTION_HEAD_STYLE_OPTIONS,r as SIMPLE_HEAD_UNUSED_FIELDS,m as parseNaturalDescriptionSize,D as parseNaturalRowGap,A as parseSectionHeadStyle,L as withHeadStyleRules};
@@ -1,4 +1,4 @@
1
- import type { EdgeCell } from "../puck/field-markers.js";
1
+ import type { EdgeCell } from "efficient-easel/draw";
2
2
  export type TickerScroll = "left" | "right" | "up" | "down";
3
3
  export declare const DEFAULT_TICKER_SCROLL: TickerScroll;
4
4
  export declare const TICKER_SCROLL_OPTIONS: readonly {
@@ -0,0 +1,9 @@
1
+ import type * as TS from "typescript";
2
+ import { type RuleReport, type SourceFile } from "./rule.js";
3
+ export type ImportTimeWork = {
4
+ readonly file: string;
5
+ readonly line: number;
6
+ readonly what: string;
7
+ };
8
+ export declare function importTimeWork(ts: typeof TS, file: SourceFile): ImportTimeWork[];
9
+ export declare function noImportTimeWork(ts: typeof TS, files: readonly SourceFile[], allow: Readonly<Record<string, string>>): RuleReport;
@@ -0,0 +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:
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};
@@ -0,0 +1,9 @@
1
+ import type * as TS from "typescript";
2
+ import { type RuleReport, type SourceFile } from "./rule.js";
3
+ export type OneShowWhenOptions = {
4
+ readonly kept?: Readonly<Record<string, string>>;
5
+ readonly ruleFloor: number;
6
+ readonly minFiles: number;
7
+ readonly alsoFieldFiles?: readonly string[];
8
+ };
9
+ export declare function oneShowWhen(ts: typeof TS, files: readonly SourceFile[], options: OneShowWhenOptions): RuleReport;
@@ -0,0 +1,4 @@
1
+ import{ruleChecks as F}from"./rule.js";const W=["lib/puck/show-when.ts","lib/puck/show-when-resolve.ts"],k=(t,l=[])=>/(^|\/)fields\.tsx?$/.test(t)||t.includes("lib/puck/passes/")||l.includes(t),y=new Set(["SettingRow","SettingsField","SettingsSwitch","SettingsSegmented","SettingsDrill","SettingsAction","SettingsGroupSub","InspectorField","FieldText","FieldNumber","FieldSelect","FieldSlider","ListField"]),R=/\b(?:props|values|settings|data\.props)(?:\.|\[|\?\.)/;function g(t,l,c=[]){const i=t.createSourceFile(l.path,l.text,t.ScriptTarget.Latest,!0,t.ScriptKind.TSX),h=e=>i.getLineAndCharacterOfPosition(e.getStart(i)).line+1,r=[];let f=0;const p=W.some(e=>l.path.endsWith(e)),m=e=>t.isPropertyAssignment(e)&&e.name.getText(i)==="resolveFields"||t.isBinaryExpression(e)&&e.operatorToken.kind===t.SyntaxKind.EqualsToken&&t.isPropertyAccessExpression(e.left)&&e.left.name.text==="resolveFields",u=(e,o)=>{const d=o||m(e);if(t.isDeleteExpression(e)&&(t.isPropertyAccessExpression(e.expression)||t.isElementAccessExpression(e.expression))&&(d?r.push({file:l.path,line:h(e),what:"R1 a `delete` in a resolveFields — give the row a showWhen rule"}):k(l.path,c)&&r.push({file:l.path,line:h(e),what:"R2 a `delete` in a field file or a pass — give the row a showWhen rule"})),d&&t.isObjectBindingPattern(e)&&e.elements.some(n=>n.dotDotDotToken)&&r.push({file:l.path,line:h(e),what:"R1 a destructure that leaves a key out, in a resolveFields — give the row a showWhen rule"}),d&&t.isCallExpression(e)&&t.isPropertyAccessExpression(e.expression)&&e.expression.name.text==="filter"&&/^Object\.entries\(/.test(e.expression.expression.getText(i))&&r.push({file:l.path,line:h(e),what:"R1 a filter over Object.entries in a resolveFields — give the row a showWhen rule"}),d&&t.isForOfStatement(e)&&/^Object\.entries\(/.test(e.expression.getText(i))&&r.push({file:l.path,line:h(e),what:"R4 a loop over Object.entries in a resolveFields — give the row a showWhen rule"}),t.isJsxExpression(e)&&e.expression){const n=e.expression,w=a=>t.isParenthesizedExpression(a)?w(a.expression):a,s=a=>{if(!a)return!1;const S=t.isJsxElement(a)?a.openingElement:t.isJsxSelfClosingElement(a)?a:t.isJsxFragment(a)?null:void 0;return S===null?a.getChildren(i).some(v=>v.getChildren(i).some(b=>s(b))):!!S&&y.has(S.tagName.getText(i))};(t.isBinaryExpression(n)&&n.operatorToken.kind===t.SyntaxKind.AmpersandAmpersandToken&&R.test(n.left.getText(i))&&s(w(n.right))||t.isConditionalExpression(n)&&R.test(n.condition.getText(i))&&(s(w(n.whenTrue))||s(w(n.whenFalse))))&&r.push({file:l.path,line:h(e),what:"R5 a settings row drawn by a stored value — use the row's showWhen (SettingRow / ShowWhen)"})}const x=n=>!!n&&t.isIdentifier(n)&&(n.text==="withShowWhen"||n.text==="showWhenOf");if((t.isFunctionDeclaration(e)&&x(e.name)||t.isVariableDeclaration(e)&&x(e.name)&&e.initializer&&(t.isArrowFunction(e.initializer)||t.isFunctionExpression(e.initializer)))&&r.push({file:l.path,line:h(e),what:"R6 a second copy of the shell's withShowWhen / showWhenOf — import them from efficient-shell/format"}),t.isCallExpression(e)&&t.isIdentifier(e.expression)){const n=e.expression.text;n==="isShown"&&!p&&r.push({file:l.path,line:h(e),what:"R3 a second reader of the rule — `isShown(` lives in lib/puck/show-when"}),(n==="withShowWhen"||n==="withRowsShownWhen"||n==="withRowRules")&&f++}t.forEachChild(e,n=>u(n,d))};return u(i,!1),{bad:r,attached:f}}function T(t,l,c){const{check:i,report:h}=F("one show-when rule"),r=c.kept??{};{const e=["export const A = { resolveFields: (data, { fields }) => { const f = { ...fields }; delete f.alt; return f; } };","export const B = { resolveFields: (d, { fields }) => { const { align: _x, ...rest } = fields; return rest; } };",'comp.resolveFields = (d, p) => Object.fromEntries(Object.entries(p.fields).filter(([k]) => k !== "x"));',"function cull(f) { delete f[key]; }","const shown = isShown(rule, values);","// delete f.alt in a comment is not a use",'export const ok = { fields: { alt: withShowWhen(text("Alt"), { field: "src", set: true }) } };',"export const C = { resolveFields: (d, { fields }) => { const out = {}; for (const [k, v] of Object.entries(fields)) if (keep.includes(k)) out[k] = v; return out; } };",'const p = <div>{settings.logo_position === "center" && <SettingRow label="Left items" />}</div>;','const q = <div>{props.on ? (<SettingsField label="x" />) : null}</div>;','const r = <div>{style ? <SettingsField label="Style" /> : null}</div>;',"export function withShowWhen(field, rule) { return { ...field, showWhen: rule }; }","const showWhenOf = (f) => f.showWhen;",'export { showWhenOf, withShowWhen } from "efficient-shell/format";'].join(`
2
+ `),o=g(t,{path:"lib/puck/blocks/general/X/fields.tsx",text:e}),d=o.bad.map(s=>s.line);i("R1 flags a delete in a resolveFields",o.bad.some(s=>s.line===1&&s.what.startsWith("R1"))),i("R1 flags a destructure that leaves a key out",o.bad.some(s=>s.line===2&&s.what.startsWith("R1"))),i("R1 flags a filter over Object.entries",o.bad.some(s=>s.line===3&&s.what.startsWith("R1"))),i("R2 flags a delete in a field file's helper",o.bad.some(s=>s.line===4&&s.what.startsWith("R2"))),i("R3 flags a second isShown(",o.bad.some(s=>s.line===5&&s.what.startsWith("R3"))),i("a comment is not a use, and a rule passes and is counted",!d.includes(6)&&!d.includes(7)&&o.attached===1),i("R4 flags an allow-list loop over Object.entries",o.bad.some(s=>s.line===8&&s.what.startsWith("R4"))),i("R5 flags a row drawn by a stored value (&&)",o.bad.some(s=>s.line===9&&s.what.startsWith("R5"))),i("R5 flags a row drawn by a stored value (? :)",o.bad.some(s=>s.line===10&&s.what.startsWith("R5"))),i("R5 lets a part the host passed through",!d.includes(11)),i("R6 flags a second withShowWhen (a function)",o.bad.some(s=>s.line===12&&s.what.startsWith("R6"))),i("R6 flags a second showWhenOf (a const arrow)",o.bad.some(s=>s.line===13&&s.what.startsWith("R6"))),i("R6 lets a re-export from the shell through",!d.includes(14));const x=g(t,{path:"lib/puck/cull.ts",text:"function cull(f) { delete f.x; }"},["lib/puck/cull.ts"]);i("R2 reads a file a repository names as a field file",x.bad.length===1);const n=g(t,{path:"lib/puck/part-styles.ts",text:"function f(next) { delete next[k]; }"});i("R2 reads only field files and passes (a delete of a VALUE elsewhere is not a hide)",n.bad.length===0);const w=g(t,{path:"lib/puck/show-when.ts",text:"isShown(rule, values);"});i("R3 lets the reader read",w.bad.length===0)}const f=l.filter(e=>/\.tsx?$/.test(e.path)&&!e.path.endsWith(".d.ts")),p=[],m=new Map;let u=0;for(const e of f){const o=g(t,e,c.alsoFieldFiles);u+=o.attached,m.set(e.path,o.bad.length),e.path in r||p.push(...o.bad)}i("no settings row hidden by hand: no delete or key-dropping filter in a resolver, field file or pass; one reader",p.length===0,`${p.length} hit(s):
3
+ `+p.map(e=>`${e.file}:${e.line} ${e.what}`).join(`
4
+ `)),i(`read the source (${f.length} TS/TSX files, at least ${c.minFiles})`,f.length>=c.minFiles),i(`found >= ${c.ruleFloor} rows given a rule (found ${u})`,u>=c.ruleFloor,"fewer means rows went back to a hand-written hide, or the reader broke");for(const e of c.alsoFieldFiles??[])i(`read the named field file ${e}`,f.some(o=>o.path===e));for(const[e,o]of Object.entries(r))i(`the exception is still real: ${e} (${o})`,(m.get(e)??0)>0,"remove the stale entry");return h()}export{T as oneShowWhen};
@@ -2,7 +2,7 @@ import type * as TS from "typescript";
2
2
  import type { SourceFile } from "../rule.js";
3
3
  export declare const CONFIG_FILE = "lib/puck/config.tsx";
4
4
  export declare const REGISTRY_DIRS: readonly ["lib/puck/blocks", "lib/puck/passes"];
5
- export declare const REGISTRY_MODULES: readonly ["lib/puck/page-root.tsx", "lib/puck/page-root-fields.tsx", "lib/puck/registry.ts", "lib/puck/render-registry.ts"];
5
+ export declare const REGISTRY_MODULES: readonly ["lib/puck/page-frame.tsx", "lib/puck/page-root.tsx", "lib/puck/page-root-fields.tsx", "lib/puck/registry.ts", "lib/puck/render-registry.ts"];
6
6
  export declare function isRegistryPath(p: string): boolean;
7
7
  export declare function registryFiles(files: readonly SourceFile[]): SourceFile[];
8
8
  export declare function registryText(files: readonly SourceFile[]): string;