efficient-web-builder 74.7.0 → 74.8.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 (55) hide show
  1. package/CHANGELOG.md +29 -0
  2. package/dist/editor/components/CustomHtmlCodeWindow.js +3 -3
  3. package/dist/editor/components/DuplicateToPageMenu.js +1 -1
  4. package/dist/editor/components/PagesPanel.js +1 -1
  5. package/dist/editor/components/PartSettingsPanel.js +1 -1
  6. package/dist/editor/components/PreviewPartAnchors.d.ts +2 -2
  7. package/dist/editor/components/PreviewPartAnchors.js +1 -1
  8. package/dist/editor/components/SectionTextPartBridge.js +1 -1
  9. package/dist/editor/components/SiteAccentField.js +1 -1
  10. package/dist/editor/components/SiteTextStylesField.d.ts +2 -0
  11. package/dist/editor/components/SiteTextStylesField.js +1 -1
  12. package/dist/editor/components/StandaloneSectionEditor.js +1 -1
  13. package/dist/editor/components/StorefrontEditor.js +1 -1
  14. package/dist/editor/components/storefront-editor.css +5 -5
  15. package/dist/editor/components/useSocialSettings.d.ts +2 -2
  16. package/dist/editor/lib/content/section-one-padding.d.ts +31 -0
  17. package/dist/editor/lib/content/section-one-padding.js +1 -0
  18. package/dist/editor/lib/document/blocks/general/index.d.ts +2 -2
  19. package/dist/editor/lib/document/box-fields.d.ts +1 -1
  20. package/dist/editor/lib/document/page-root.js +2 -2
  21. package/dist/format/lib/content/box-shape.d.ts +1 -1
  22. package/dist/format/lib/document/blocks/block-types.d.ts +2 -0
  23. package/dist/format/lib/document/passes/types.d.ts +2 -0
  24. package/dist/format/lib/document/style-text.d.ts +2 -0
  25. package/dist/format/lib/document/style-text.js +1 -1
  26. package/dist/format/lib/fonts.d.ts +43 -7
  27. package/dist/format/lib/fonts.js +1 -1
  28. package/dist/format/lib/site-font-faces.d.ts +9 -0
  29. package/dist/format/lib/site-font-faces.js +2 -0
  30. package/dist/format/lib/site-theme-row.d.ts +29 -1
  31. package/dist/format/lib/site-theme-row.js +1 -0
  32. package/dist/format/lib/sized-image.js +1 -1
  33. package/dist/format/lib/source-rules/one-dropdown.js +3 -3
  34. package/dist/format/lib/source-rules/page-picture-place.js +3 -3
  35. package/dist/format/lib/source-rules/published-mounts.js +38 -38
  36. package/dist/format/lib/source-rules/shape-rows-use-the-picker.js +2 -2
  37. package/dist/format/lib/source-rules/support/element-call.d.ts +5 -0
  38. package/dist/format/lib/source-rules/support/element-call.js +1 -0
  39. package/dist/format/lib/word-styles.d.ts +7 -6
  40. package/dist/format/lib/word-styles.js +1 -1
  41. package/dist/render/components/HeroPictures.d.ts +2 -2
  42. package/dist/render/components/PublishedPartStylesContext.js +1 -1
  43. package/dist/render/components/SiteFontsContext.d.ts +11 -0
  44. package/dist/render/components/SiteFontsContext.js +2 -0
  45. package/dist/render/lib/content/section-own-pads.d.ts +2 -2
  46. package/dist/render/lib/content/section-own-pads.js +1 -1
  47. package/dist/render/lib/document/part-styles.d.ts +7 -5
  48. package/dist/render/lib/document/part-styles.js +2 -2
  49. package/dist/render/lib/document/passes/section-padding.d.ts +2 -1
  50. package/dist/render/lib/document/passes/section-padding.js +1 -1
  51. package/dist/render/lib/text-styles/site-text-styles.d.ts +3 -3
  52. package/dist/render/lib/text-styles/site-text-styles.js +2 -2
  53. package/dist/routine-index.json +1 -1
  54. package/dist/value-index.json +1 -1
  55. package/package.json +1 -1
@@ -1,2 +1,2 @@
1
- export declare const assembleGeneralBlocks: () => Record<"CardList" | "Text" | "ImageBlock" | "ButtonBlock" | "Flex" | "Cards" | "FAQ" | "Footprint" | "Grid" | "Hero" | "HeroGroup" | "HeroSingle" | "HeroSlide" | "Logos" | "LogoBlock" | "OrderSummary" | "ProcessSteps" | "IntroBleed" | "Stats" | "Chart" | "Mockup" | "Countdown" | "FeaturedCover" | "LongRead" | "Breadcrumb" | "DocBody" | "SectionHeader" | "Divider" | "CustomHTML" | "Manifesto" | "Split" | "Ticker" | "SpecStrip" | "TimelineTrack" | "Timeline" | "DocMasthead" | "DocTabs" | "Prose" | "ParagraphsA" | "TitleWithButtons" | "Banner" | "CategoryBar" | "Masthead" | "Spacer" | "KeyFeatures" | "Series" | "DocMetaCards" | "StatsParagraph" | "Testimonials" | "Integrations" | "ContactLocations" | "PaymentBadges" | "Heading" | "Eyebrow" | "LocationMap" | "Contents" | "ListSearch" | "HostPart" | "PostCard", import("efficient-easel/blocks").ComponentConfig<any, any, Omit<import("efficient-easel/blocks").ComponentData<any, string, Record<string, import("efficient-easel/blocks").DefaultComponentProps>>, "type">>>;
2
- export declare const generalBlocks: Record<"CardList" | "Text" | "ImageBlock" | "ButtonBlock" | "Flex" | "Cards" | "FAQ" | "Footprint" | "Grid" | "Hero" | "HeroGroup" | "HeroSingle" | "HeroSlide" | "Logos" | "LogoBlock" | "OrderSummary" | "ProcessSteps" | "IntroBleed" | "Stats" | "Chart" | "Mockup" | "Countdown" | "FeaturedCover" | "LongRead" | "Breadcrumb" | "DocBody" | "SectionHeader" | "Divider" | "CustomHTML" | "Manifesto" | "Split" | "Ticker" | "SpecStrip" | "TimelineTrack" | "Timeline" | "DocMasthead" | "DocTabs" | "Prose" | "ParagraphsA" | "TitleWithButtons" | "Banner" | "CategoryBar" | "Masthead" | "Spacer" | "KeyFeatures" | "Series" | "DocMetaCards" | "StatsParagraph" | "Testimonials" | "Integrations" | "ContactLocations" | "PaymentBadges" | "Heading" | "Eyebrow" | "LocationMap" | "Contents" | "ListSearch" | "HostPart" | "PostCard", import("efficient-easel/blocks").ComponentConfig<any, any, Omit<import("efficient-easel/blocks").ComponentData<any, string, Record<string, import("efficient-easel/blocks").DefaultComponentProps>>, "type">>>;
1
+ export declare const assembleGeneralBlocks: () => Record<"CardList" | "Text" | "ImageBlock" | "ButtonBlock" | "Flex" | "Footprint" | "FAQ" | "ProcessSteps" | "LongRead" | "Series" | "TimelineTrack" | "StatsParagraph" | "Cards" | "Testimonials" | "Prose" | "SectionHeader" | "Manifesto" | "Split" | "ContactLocations" | "CategoryBar" | "DocTabs" | "CustomHTML" | "Hero" | "HeroSingle" | "IntroBleed" | "SpecStrip" | "Timeline" | "ParagraphsA" | "KeyFeatures" | "Chart" | "Mockup" | "TitleWithButtons" | "Countdown" | "DocMasthead" | "DocBody" | "DocMetaCards" | "Breadcrumb" | "Banner" | "Stats" | "Logos" | "Divider" | "OrderSummary" | "PaymentBadges" | "Grid" | "Masthead" | "FeaturedCover" | "Ticker" | "HeroGroup" | "HeroSlide" | "HostPart" | "Contents" | "Spacer" | "Integrations" | "Heading" | "Eyebrow" | "LogoBlock" | "LocationMap" | "ListSearch" | "PostCard", import("efficient-easel/blocks").ComponentConfig<any, any, Omit<import("efficient-easel/blocks").ComponentData<any, string, Record<string, import("efficient-easel/blocks").DefaultComponentProps>>, "type">>>;
2
+ export declare const generalBlocks: Record<"CardList" | "Text" | "ImageBlock" | "ButtonBlock" | "Flex" | "Footprint" | "FAQ" | "ProcessSteps" | "LongRead" | "Series" | "TimelineTrack" | "StatsParagraph" | "Cards" | "Testimonials" | "Prose" | "SectionHeader" | "Manifesto" | "Split" | "ContactLocations" | "CategoryBar" | "DocTabs" | "CustomHTML" | "Hero" | "HeroSingle" | "IntroBleed" | "SpecStrip" | "Timeline" | "ParagraphsA" | "KeyFeatures" | "Chart" | "Mockup" | "TitleWithButtons" | "Countdown" | "DocMasthead" | "DocBody" | "DocMetaCards" | "Breadcrumb" | "Banner" | "Stats" | "Logos" | "Divider" | "OrderSummary" | "PaymentBadges" | "Grid" | "Masthead" | "FeaturedCover" | "Ticker" | "HeroGroup" | "HeroSlide" | "HostPart" | "Contents" | "Spacer" | "Integrations" | "Heading" | "Eyebrow" | "LogoBlock" | "LocationMap" | "ListSearch" | "PostCard", import("efficient-easel/blocks").ComponentConfig<any, any, Omit<import("efficient-easel/blocks").ComponentData<any, string, Record<string, import("efficient-easel/blocks").DefaultComponentProps>>, "type">>>;
@@ -3,7 +3,7 @@ import { boxFieldBuilders, type BoxFieldSay } from "efficient-easel/screen/lib/d
3
3
  import type { ShowWhenRule } from "efficient-shell/format";
4
4
  type Rows = ReturnType<typeof boxFieldBuilders>;
5
5
  export declare const rowSay: BoxFieldSay;
6
- export declare const LENGTH_UNITS_TABLE: Readonly<Record<"size" | "spacing" | "gap" | "radius" | "fontSize" | "letterSpacing" | "position" | "border" | "height" | "breakpoint", readonly ("px" | "%" | "vw")[]>>;
6
+ export declare const LENGTH_UNITS_TABLE: Readonly<Record<"spacing" | "gap" | "size" | "radius" | "fontSize" | "letterSpacing" | "position" | "border" | "height" | "breakpoint", readonly ("px" | "%" | "vw")[]>>;
7
7
  export declare const slider: Rows["slider"];
8
8
  export declare const select: Rows["select"];
9
9
  export declare const Segmented: Rows["Segmented"];
@@ -1,2 +1,2 @@
1
- import{jsx as t,Fragment as q,jsxs as A}from"react/jsx-runtime";import{Suspense as J,useMemo as Q}from"react";import{accentItalicCss as Z,storedTextStyles as ee,textStylesCss as te}from"../../../render/lib/text-styles/site-text-styles.js";import{pageWidthMarker as oe,PAGE_WIDTH_ATTR as re,siteWidthTokens as ne,siteGutterTokens as ie,siteGutterPhoneClass as se,siteGutterPhoneTokens as ae,heroBackgroundTokens as de,SIDE_ONCE_ATTR as ce,sideSpaceOnceAttr as pe}from"../../../format/lib/content/page-width.js";import{SITE_FOOTER_KIND as le}from"../../../format/lib/content/footer.js";import{siteBlockGapPhoneClass as he,siteBlockGapPhoneTokens as me,siteBlockGapTokens as fe}from"../../../format/lib/content/container-gap.js";import{usePreviewHeader as ue}from"../../../render/components/PreviewHeaderContext.js";import{usePreviewFooter as Se}from"../../components/PreviewFooterContext.js";import{SiteRootPropsProvider as ge}from"../../../render/components/SiteRootProps.js";import{SITE_CSS_SCOPE_ATTR as Te,siteCssScopeAttr as ye}from"../../../format/lib/content/site-css.js";import{SitePhotographyProvider as Pe}from"../../../render/components/SitePhotographyContext.js";import{ThemeLightInkProvider as xe}from"../../../render/components/ThemeLightInkContext.js";import{CORNER_STYLE_TO_PX as ke,normalizeCornerStyle as Ce,normalizeCornerRadius as Ee,themeColorStyle as _e,themeLightInk as Ae,typeSizesStyle as Re,headingTypographyStyle as Ge,normalizeHeadingTypography as ve,themeAccentStyle as Ie,themeButtonStyle as Be,themePresetAccentVars as we,themeSurfaceStyle as We,siteCornerRadiusTokens as He,shadowColorTokens as Fe,headingCompressionAttr as be,cardShadowAttr as Ne,cardGapAttr as De,hoverEffectAttr as Oe}from"../../../format/lib/theme.js";import{fontRoleStyle as Le}from"../../../format/lib/fonts.js";import{wordStyleTokens as Ue}from"../../../format/lib/word-styles.js";import{isStandaloneSectionDocument as ze,pageHasHeaderSection as R,pageTakesTopSpace as je,topSpaceMarker as Ve,TOP_SPACE_ATTR as Me,HEADER_CLEARANCE_CLASS as $e}from"../../../render/lib/document/header-clearance.js";import{leadSectionInk as Ke,HEADER_INK_ATTR as Xe}from"../../../render/lib/document/header-ink.js";import{useEasel as y}from"efficient-easel/easel";import{chromeRootWithFooter as Ye,inPlaceFooterProps as qe}from"../pinned-chrome-doc.js";import{useCardContentSwitchPass as Je}from"../../components/useCardContentSwitchPass.js";import{pageBackgroundVars as Qe}from"../../../format/lib/content/page-background.js";import{pageWidthTokens as Ze}from"../../../render/lib/document/page-frame.js";import{EditingBridgesProvider as et}from"../../../render/lib/document/editing-bridges.js";import tt from"../../components/SectionTextPartBridge.js";import{PageContentsFromDocument as G}from"../../../render/components/PageContentsContext.js";const ot={SectionTextParts:tt};import{PageWidthWrapper as bt,PublishedPageFrame as Nt,pageWidthTokens as Dt}from"../../../render/lib/document/page-frame.js";const rt="color-mix(in oklab, var(--bg) 40%, #ffffff)",nt="12vh";function it({style:r,children:c}){const{appState:p}=y(a=>a),o=p.data.content,n=p.data.root;if(ze(o))return t("div",{className:"sf-themed-content",style:{...r,background:rt,minHeight:"100vh",paddingBottom:nt},children:t("div",{style:{background:"var(--bg)"},children:t(G,{content:o,children:c})})});const l=R(o)&&je(n,o),h=R(o)?Ve(n,o):null,S=h?{[Me]:h}:null,m=oe(n?.widthChoice),i=m?{[re]:m}:null,s=l?null:Ke(o),g=s?{[Xe]:s}:null;return t("div",{className:`sf-themed-content${l?` ${$e}`:""}`,style:r,...g,...S,...i,children:t("div",{style:{background:"var(--bg)",minHeight:"100%"},children:t(G,{content:o,children:c})})})}function wt({propsTheme:r,propsFonts:c,propsCornerStyle:p,propsCornerRadiusPx:o,propsHeadingCompression:n,propsHeadingTypography:l,pageBackground:h,chromeInheritsSiteBackground:S,suppressPreviewNav:m,footer:i,overlay:s,children:g}){Je();const a=y(d=>d.appState.data.root?.props),T=y(d=>qe(d.appState.data.content));return t(st,{siteFooterRootProps:a?.kind===le?a:void 0,inPlaceFooterProps:T,propsTheme:r,propsFonts:c,propsCornerStyle:p,propsCornerRadiusPx:o,propsHeadingCompression:n,propsHeadingTypography:l,pageBackground:h,chromeInheritsSiteBackground:S,onClickCapture:m,body:d=>A(q,{children:[t(it,{style:d,children:g}),i,s]})})}function st({propsTheme:r,propsFonts:c,propsCornerStyle:p,propsCornerRadiusPx:o,propsHeadingCompression:n,propsHeadingTypography:l,pageBackground:h,chromeInheritsSiteBackground:S,onClickCapture:m,siteFooterRootProps:i,inPlaceFooterProps:s,body:g}){const{chromeRootProps:a}=Se(),T=Q(()=>Ye(a,s),[a,s]),{theme:d,fonts:v,sizes:I,cornerRadiusPx:B,cardShadow:P,shadowColor:w,cardGap:W,hoverEffect:x,headingCompression:H,siteWidth:F,siteGutter:b,siteGutterPhone:k,blockGap:N,blockGapPhone:C,siteLengthUnits:D,headingTypography:O,heroBackgroundFollowsWidth:L,photographyGrayscale:U,textStyles:z,wordStyles:j,themeFromDocument:e}=ue(),f=e?r:d,V=e?c:v,M=e?void 0:I,$=e?o===void 0?ke[Ce(p)]:Ee(o):B,u=e?{}:D,K=e?n:H,E=e?l:O,_=[te(ee(e?void 0:z)),Z(ve(E).italicStrong)].filter(Boolean).join(`
2
- `),X=Ze(),Y={..._e(f),...Re(M),...Ge(E),...X.style,...S?{}:Qe(h)};return A("div",{className:`sf-theme-surfaces sf-theme-accent ${[se(e?void 0:k),he(e?void 0:C)].filter(Boolean).join(" ")}`.trim(),style:{...Le(V),...Ue(e?null:j),...Ie(f),...Be(f),...we(f),...We(f),...He($,u.cornerRadiusUnit),...Fe(e?void 0:P,e?void 0:w,e?void 0:x),...ne(e?void 0:F,u.siteWidthUnit),...ie(e?void 0:b,u.siteGutterUnit),...ae(e?void 0:k,u.siteGutterPhoneUnit),...fe(e?void 0:N,u.blockGapUnit),...me(e?void 0:C,u.blockGapPhoneUnit),...de(e?void 0:L)},"data-sf-headings":be(K),[ce]:pe(i??T),[Te]:ye(i??T),"data-sf-card-shadow":e?void 0:Ne(P),"data-sf-card-gap":e?void 0:De(W),"data-sf-card-hover":e?void 0:Oe(x),onClickCapture:m,children:[_?t("style",{"data-sf-text-styles":"",dangerouslySetInnerHTML:{__html:_}}):null,t(Pe,{grayscale:e?void 0:U,children:t(et,{value:ot,children:t(xe,{ink:Ae(f),children:t(J,{fallback:null,children:t(ge,{rootProps:i??T,children:g(Y)})})})})})]})}const Wt=r=>{r.target?.closest?.("a")&&r.preventDefault()};export{ot as EDITING_BRIDGES,it as EditorPageBody,wt as EditorThemedBody,bt as PageWidthWrapper,Nt as PublishedPageFrame,rt as SECTION_PREVIEW_CANVAS,nt as SECTION_PREVIEW_CANVAS_TAIL,st as SiteThemeCarrier,Dt as pageWidthTokens,Wt as suppressPreviewNav};
1
+ import{jsx as t,Fragment as J,jsxs as A}from"react/jsx-runtime";import{Suspense as Q,useMemo as Z}from"react";import{accentItalicCss as ee,storedTextStyles as te,textStylesCss as oe}from"../../../render/lib/text-styles/site-text-styles.js";import{pageWidthMarker as re,PAGE_WIDTH_ATTR as ne,siteWidthTokens as ie,siteGutterTokens as se,siteGutterPhoneClass as ae,siteGutterPhoneTokens as de,heroBackgroundTokens as ce,SIDE_ONCE_ATTR as pe,sideSpaceOnceAttr as le}from"../../../format/lib/content/page-width.js";import{SITE_FOOTER_KIND as he}from"../../../format/lib/content/footer.js";import{siteBlockGapPhoneClass as me,siteBlockGapPhoneTokens as fe,siteBlockGapTokens as ue}from"../../../format/lib/content/container-gap.js";import{usePreviewHeader as Se}from"../../../render/components/PreviewHeaderContext.js";import{usePreviewFooter as ge}from"../../components/PreviewFooterContext.js";import{SiteRootPropsProvider as ye}from"../../../render/components/SiteRootProps.js";import{SITE_CSS_SCOPE_ATTR as Te,siteCssScopeAttr as Pe}from"../../../format/lib/content/site-css.js";import{SitePhotographyProvider as xe}from"../../../render/components/SitePhotographyContext.js";import{ThemeLightInkProvider as ke}from"../../../render/components/ThemeLightInkContext.js";import{CORNER_STYLE_TO_PX as Ce,normalizeCornerStyle as Ee,normalizeCornerRadius as Re,themeColorStyle as _e,themeLightInk as Ae,typeSizesStyle as Ge,headingTypographyStyle as ve,normalizeHeadingTypography as Ie,themeAccentStyle as Be,themeButtonStyle as we,themePresetAccentVars as We,themeSurfaceStyle as Fe,siteCornerRadiusTokens as He,shadowColorTokens as be,headingCompressionAttr as Ne,cardShadowAttr as De,cardGapAttr as Oe,hoverEffectAttr as Le}from"../../../format/lib/theme.js";import{fontRoleStyle as Ue}from"../../../format/lib/fonts.js";import{wordStyleTokens as ze}from"../../../format/lib/word-styles.js";import{useFontRegistry as je}from"../../../render/components/SiteFontsContext.js";import{isStandaloneSectionDocument as Ve,pageHasHeaderSection as G,pageTakesTopSpace as Me,topSpaceMarker as $e,TOP_SPACE_ATTR as Ke,HEADER_CLEARANCE_CLASS as Xe}from"../../../render/lib/document/header-clearance.js";import{leadSectionInk as Ye,HEADER_INK_ATTR as qe}from"../../../render/lib/document/header-ink.js";import{useEasel as P}from"efficient-easel/easel";import{chromeRootWithFooter as Je,inPlaceFooterProps as Qe}from"../pinned-chrome-doc.js";import{useCardContentSwitchPass as Ze}from"../../components/useCardContentSwitchPass.js";import{pageBackgroundVars as et}from"../../../format/lib/content/page-background.js";import{pageWidthTokens as tt}from"../../../render/lib/document/page-frame.js";import{EditingBridgesProvider as ot}from"../../../render/lib/document/editing-bridges.js";import rt from"../../components/SectionTextPartBridge.js";import{PageContentsFromDocument as v}from"../../../render/components/PageContentsContext.js";const nt={SectionTextParts:rt};import{PageWidthWrapper as Ot,PublishedPageFrame as Lt,pageWidthTokens as Ut}from"../../../render/lib/document/page-frame.js";const it="color-mix(in oklab, var(--bg) 40%, #ffffff)",st="12vh";function at({style:r,children:c}){const{appState:p}=P(a=>a),o=p.data.content,n=p.data.root;if(Ve(o))return t("div",{className:"sf-themed-content",style:{...r,background:it,minHeight:"100vh",paddingBottom:st},children:t("div",{style:{background:"var(--bg)"},children:t(v,{content:o,children:c})})});const l=G(o)&&Me(n,o),h=G(o)?$e(n,o):null,S=h?{[Ke]:h}:null,m=re(n?.widthChoice),i=m?{[ne]:m}:null,s=l?null:Ye(o),g=s?{[qe]:s}:null;return t("div",{className:`sf-themed-content${l?` ${Xe}`:""}`,style:r,...g,...S,...i,children:t("div",{style:{background:"var(--bg)",minHeight:"100%"},children:t(v,{content:o,children:c})})})}function Ht({propsTheme:r,propsFonts:c,propsCornerStyle:p,propsCornerRadiusPx:o,propsHeadingCompression:n,propsHeadingTypography:l,pageBackground:h,chromeInheritsSiteBackground:S,suppressPreviewNav:m,footer:i,overlay:s,children:g}){Ze();const a=P(d=>d.appState.data.root?.props),y=P(d=>Qe(d.appState.data.content));return t(dt,{siteFooterRootProps:a?.kind===he?a:void 0,inPlaceFooterProps:y,propsTheme:r,propsFonts:c,propsCornerStyle:p,propsCornerRadiusPx:o,propsHeadingCompression:n,propsHeadingTypography:l,pageBackground:h,chromeInheritsSiteBackground:S,onClickCapture:m,body:d=>A(J,{children:[t(at,{style:d,children:g}),i,s]})})}function dt({propsTheme:r,propsFonts:c,propsCornerStyle:p,propsCornerRadiusPx:o,propsHeadingCompression:n,propsHeadingTypography:l,pageBackground:h,chromeInheritsSiteBackground:S,onClickCapture:m,siteFooterRootProps:i,inPlaceFooterProps:s,body:g}){const{chromeRootProps:a}=ge(),y=Z(()=>Je(a,s),[a,s]),{theme:d,fonts:I,sizes:B,cornerRadiusPx:w,cardShadow:x,shadowColor:W,cardGap:F,hoverEffect:k,headingCompression:H,siteWidth:b,siteGutter:N,siteGutterPhone:C,blockGap:D,blockGapPhone:E,siteLengthUnits:O,headingTypography:L,heroBackgroundFollowsWidth:U,photographyGrayscale:z,textStyles:j,wordStyles:V,themeFromDocument:e}=Se(),T=je(),f=e?r:d,M=e?c:I,$=e?void 0:B,K=e?o===void 0?Ce[Ee(p)]:Re(o):w,u=e?{}:O,X=e?n:H,R=e?l:L,_=[oe(te(e?void 0:j),T),ee(Ie(R).italicStrong)].filter(Boolean).join(`
2
+ `),Y=tt(),q={..._e(f),...Ge($),...ve(R),...Y.style,...S?{}:et(h)};return A("div",{className:`sf-theme-surfaces sf-theme-accent ${[ae(e?void 0:C),me(e?void 0:E)].filter(Boolean).join(" ")}`.trim(),style:{...Ue(M,T),...ze(e?null:V,T),...Be(f),...we(f),...We(f),...Fe(f),...He(K,u.cornerRadiusUnit),...be(e?void 0:x,e?void 0:W,e?void 0:k),...ie(e?void 0:b,u.siteWidthUnit),...se(e?void 0:N,u.siteGutterUnit),...de(e?void 0:C,u.siteGutterPhoneUnit),...ue(e?void 0:D,u.blockGapUnit),...fe(e?void 0:E,u.blockGapPhoneUnit),...ce(e?void 0:U)},"data-sf-headings":Ne(X),[pe]:le(i??y),[Te]:Pe(i??y),"data-sf-card-shadow":e?void 0:De(x),"data-sf-card-gap":e?void 0:Oe(F),"data-sf-card-hover":e?void 0:Le(k),onClickCapture:m,children:[_?t("style",{"data-sf-text-styles":"",dangerouslySetInnerHTML:{__html:_}}):null,t(xe,{grayscale:e?void 0:z,children:t(ot,{value:nt,children:t(ke,{ink:Ae(f),children:t(Q,{fallback:null,children:t(ye,{rootProps:i??y,children:g(q)})})})})})]})}const bt=r=>{r.target?.closest?.("a")&&r.preventDefault()};export{nt as EDITING_BRIDGES,at as EditorPageBody,Ht as EditorThemedBody,Ot as PageWidthWrapper,Lt as PublishedPageFrame,it as SECTION_PREVIEW_CANVAS,st as SECTION_PREVIEW_CANVAS_TAIL,dt as SiteThemeCarrier,Ut as pageWidthTokens,bt as suppressPreviewNav};
@@ -1,4 +1,4 @@
1
- export declare const BOX_SHAPES: ("custom" | "auto" | "square" | "video" | "tall" | "wide" | "screen" | "landscape" | "portrait" | "panorama" | "story" | "poster")[];
1
+ export declare const BOX_SHAPES: ("auto" | "square" | "screen" | "custom" | "tall" | "wide" | "landscape" | "portrait" | "video" | "panorama" | "story" | "poster")[];
2
2
  export type BoxShape = (typeof BOX_SHAPES)[number];
3
3
  export declare function boxShapeOf(value: unknown): BoxShape;
4
4
  export declare function boxShapeClass(value: unknown): string;
@@ -1,5 +1,6 @@
1
1
  import type { Config } from "efficient-easel/blocks";
2
2
  import type { BlockShowWhenFacts } from "../show-when-attach.js";
3
+ import type { SectionOwnPad } from "../../../../render/lib/content/section-own-pads.js";
3
4
  export type Block = Config["components"][string];
4
5
  export type BlockSlots = Record<string, {
5
6
  type: "slot";
@@ -16,6 +17,7 @@ export type BlockRender = Pick<Block, "label" | "defaultProps" | "render" | "inl
16
17
  };
17
18
  sitsInBox?: true;
18
19
  partSizeCaps?: Readonly<Record<string, true>>;
20
+ ownPad?: SectionOwnPad;
19
21
  };
20
22
  export type BlockMeta = Omit<BlockRender, "render">;
21
23
  export type BlockFields = Pick<Block, "fields" | "resolveFields" | "resolveData"> & {
@@ -2,6 +2,7 @@ import type { ComponentType, ReactNode } from "react";
2
2
  import type { TextFit } from "efficient-easel/draw";
3
3
  import type { AnimationTabKind } from "../../../../editor/lib/animation/fields.js";
4
4
  import type { OwnFrame } from "../../../../render/lib/content/section-padding.js";
5
+ import type { SectionOwnPad } from "../../../../render/lib/content/section-own-pads.js";
5
6
  export type PassRenderProps = Record<string, unknown>;
6
7
  export type PassResolveFields = (data: {
7
8
  props?: Record<string, unknown>;
@@ -29,6 +30,7 @@ export type PassBlock = {
29
30
  };
30
31
  sitsInBox?: true;
31
32
  partSizeCaps?: Readonly<Record<string, true>>;
33
+ ownPad?: SectionOwnPad;
32
34
  resolveFields?: PassResolveFields;
33
35
  resolveData?: PassResolveData;
34
36
  render: (props: PassRenderProps) => ReactNode;
@@ -1 +1,3 @@
1
1
  export declare function styleElementText(css: string): string;
2
+ export declare function cssStringBody(value: string): string;
3
+ export declare function cssHash(css: string): string;
@@ -1 +1 @@
1
- function t(e){return e.replace(/<(?=\/)/g,"\\3c ")}export{t as styleElementText};
1
+ import{ownEntry as n}from"../own-entry.js";function i(r){return r.replace(/<(?=\/)/g,"\\3c ")}const o={"\\":"\\\\",'"':'\\"',"\n":"\\a ","\r":"\\d ","\f":"\\c "};function l(r){return r.replace(/[\\"\n\r\f]/g,t=>n(o,t)??t)}function f(r){let t=2166136261;for(let e=0;e<r.length;e+=1)t^=r.charCodeAt(e),t=Math.imul(t,16777619);return(t>>>0).toString(36)}export{f as cssHash,l as cssStringBody,i as styleElementText};
@@ -8,11 +8,46 @@ export interface FontOption {
8
8
  italicLoaded: boolean;
9
9
  }
10
10
  export declare const FONT_OPTIONS: FontOption[];
11
+ export declare const SITE_FONT_KEY_PREFIX = "site-";
12
+ export declare const SITE_FONT_CSS_VAR_PREFIX = "--font-site-";
13
+ export interface SiteFontFile {
14
+ id: string;
15
+ weight: number;
16
+ style: "normal" | "italic";
17
+ subset: string;
18
+ unicodeRange: string;
19
+ url: string;
20
+ }
21
+ interface SiteFontMetrics {
22
+ ascent: number;
23
+ descent: number;
24
+ lineGap: number;
25
+ sizeAdjust: number;
26
+ }
27
+ export interface SiteFont {
28
+ key: string;
29
+ family: string;
30
+ label: string;
31
+ category: FontCategory;
32
+ condensed: boolean;
33
+ weights: number[];
34
+ italic: boolean;
35
+ fallbackMetrics: SiteFontMetrics | null;
36
+ files: SiteFontFile[];
37
+ }
38
+ export interface FontRegistry {
39
+ readonly options: readonly FontOption[];
40
+ readonly byKey: ReadonlyMap<string, FontOption>;
41
+ readonly siteFonts: ReadonlyMap<string, SiteFont>;
42
+ }
43
+ export declare const POOL_FONT_REGISTRY: FontRegistry;
44
+ export declare function fontRegistry(siteFonts?: readonly SiteFont[] | null): FontRegistry;
11
45
  export declare const FONT_CATEGORY_LABELS: Record<FontCategory, string>;
12
- export declare function fontsByCategory(): [FontCategory, FontOption[]][];
13
- export declare function fontHasItalic(key: string): boolean;
14
- export declare function fontItalicIsUsable(key: string): boolean;
15
- export declare function fontOption(key: string): FontOption | undefined;
46
+ export declare function fontsByCategory(registry?: FontRegistry): [FontCategory, FontOption[]][];
47
+ export declare function fontsInPickerOrder(registry?: FontRegistry): FontOption[];
48
+ export declare function fontHasItalic(key: string, registry?: FontRegistry): boolean;
49
+ export declare function fontItalicIsUsable(key: string, registry?: FontRegistry): boolean;
50
+ export declare function fontOption(key: string, registry?: FontRegistry): FontOption | undefined;
16
51
  export declare const FONT_ROLES: readonly ["heading", "heading2", "heading3", "body", "accent", "label"];
17
52
  export type FontRole = (typeof FONT_ROLES)[number];
18
53
  export declare function fontRoleOf(value: unknown): FontRole | null;
@@ -25,8 +60,9 @@ export declare const HEADING_FACE_UTILITIES: readonly ["font-display", "font-hea
25
60
  export declare function drawsHeadingFace(className: string | null | undefined): boolean;
26
61
  export type FontsValue = Record<FontRole, string>;
27
62
  export declare const DEFAULT_FONTS: FontsValue;
28
- export declare function normalizeFonts(v?: Partial<FontsValue> | null): FontsValue;
29
- export declare function siteFontCssVars(v?: Partial<FontsValue> | null): string[];
63
+ export declare function normalizeFonts(v?: Partial<FontsValue> | null, registry?: FontRegistry): FontsValue;
64
+ export declare function siteFontCssVars(v?: Partial<FontsValue> | null, registry?: FontRegistry): string[];
30
65
  export declare const ROOT_FALLBACK_CSS_VARS: string[];
31
66
  export declare const ALL_FONT_CSS_VARS: string[];
32
- export declare function fontRoleStyle(v?: Partial<FontsValue> | null): Record<string, string>;
67
+ export declare function fontRoleStyle(v?: Partial<FontsValue> | null, registry?: FontRegistry): Record<string, string>;
68
+ export {};
@@ -1 +1 @@
1
- const c=[{key:"space-grotesk",label:"Space Grotesk",cssVar:"--font-display",category:"sans",italic:!1,italicLoaded:!1},{key:"inter",label:"Inter",cssVar:"--font-body",category:"sans",italic:!0,italicLoaded:!0},{key:"poppins",label:"Poppins",cssVar:"--font-poppins",category:"sans",italic:!0,italicLoaded:!0},{key:"dm-sans",label:"DM Sans",cssVar:"--font-dm-sans",category:"sans",italic:!0,italicLoaded:!0},{key:"sora",label:"Sora",cssVar:"--font-sora",category:"sans",italic:!1,italicLoaded:!1},{key:"oswald",label:"Oswald",cssVar:"--font-oswald",category:"sans",italic:!1,italicLoaded:!1},{key:"archivo",label:"Archivo",cssVar:"--font-archivo",category:"sans",italic:!0,italicLoaded:!0},{key:"outfit",label:"Outfit",cssVar:"--font-outfit",category:"sans",italic:!1,italicLoaded:!1},{key:"manrope",label:"Manrope",cssVar:"--font-manrope",category:"sans",italic:!1,italicLoaded:!1},{key:"big-shoulders",label:"Big Shoulders",cssVar:"--font-big-shoulders",category:"sans",italic:!1,italicLoaded:!1},{key:"michroma",label:"Michroma",cssVar:"--font-michroma",category:"sans",italic:!1,italicLoaded:!1},{key:"assistant",label:"Assistant",cssVar:"--font-assistant",category:"sans",italic:!1,italicLoaded:!1},{key:"jost",label:"Jost",cssVar:"--font-jost",category:"sans",italic:!0,italicLoaded:!0},{key:"fraunces",label:"Fraunces",cssVar:"--font-serif",category:"serif",italic:!0,italicLoaded:!0},{key:"playfair-display",label:"Playfair Display",cssVar:"--font-playfair",category:"serif",italic:!0,italicLoaded:!0},{key:"cormorant",label:"Cormorant",cssVar:"--font-cormorant",category:"serif",italic:!0,italicLoaded:!0},{key:"jetbrains-mono",label:"JetBrains Mono",cssVar:"--font-mono-loaded",category:"mono",italic:!0,italicLoaded:!0}],n=new Map(c.map(e=>[e.key,e])),g={sans:"Sans",serif:"Serif",mono:"Mono"};function m(){return Object.keys(g).map(e=>[e,c.filter(t=>t.category===e)]).filter(([,e])=>e.length>0)}function O(e){return n.get(e)?.italic??!1}function S(e){return n.get(e)?.italicLoaded??!1}function _(e){return n.get(e)}const s=["heading","heading2","heading3","body","accent","label"];function k(e){return typeof e=="string"&&s.includes(e)?e:null}const x={heading:"Heading 1",heading2:"Heading 2",heading3:"Heading 3",body:"Body",accent:"Emphasis",label:"Labels"},u=[["font-heading2","heading2"],["font-heading3","heading3"],["font-display","heading"],["font-serif","accent"],["font-mono","label"],["font-body","body"]],y=/var\(--size-(headingLarge|headingMedium|headingSmall|accent|body|label)\s*,/,V={heading:"headingLarge",heading2:"headingMedium",heading3:"headingSmall",accent:"accent",body:"body",label:"label"},p={headingLarge:"heading",headingMedium:"heading2",headingSmall:"heading3",accent:"accent",body:"body",label:"label"};function E(e){const t=e?y.exec(e):null;return t?p[t[1]]??null:h(e)}function h(e){if(!e)return null;const t=e.split(/\s+/).filter(a=>!a.slice(0,a.lastIndexOf(":")+1).includes("&")).map(a=>a.slice(a.lastIndexOf(":")+1));for(const[a,i]of u)if(t.includes(a))return i;return null}const I=["heading","heading2","heading3"],b=["font-display","font-heading2","font-heading3"];function T(e){if(!e)return!1;const t=e.split(/\s+/).filter(a=>!a.slice(0,a.lastIndexOf(":")+1).includes("&")).map(a=>a.slice(a.lastIndexOf(":")+1));return b.some(a=>t.includes(a))}const r={heading:"space-grotesk",heading2:"space-grotesk",heading3:"space-grotesk",body:"inter",accent:"fraunces",label:"jetbrains-mono"};function d(e){const t=a=>{const i=e?.[a];if(i&&n.has(i))return i;if(a==="heading2"||a==="heading3"){const l=e?.heading;return l&&n.has(l)?l:r.heading}return r[a]};return Object.fromEntries(s.map(a=>[a,t(a)]))}function f(e,t){return n.get(e[t])??n.get(r[t])}function o(e,t){return`var(${f(e,t).cssVar})`}function F(e){const t=d(e);return[...new Set([...L,...s.map(a=>f(t,a).cssVar)])]}const L=[...new Set(s.map(e=>n.get(r[e]).cssVar))],A=[...new Set(c.map(e=>e.cssVar))];function R(e){const t=d(e);return{"--font-role-heading":o(t,"heading"),"--font-role-heading2":o(t,"heading2"),"--font-role-heading3":o(t,"heading3"),"--font-role-body":o(t,"body"),"--font-role-accent":o(t,"accent"),"--font-role-label":o(t,"label"),fontFamily:"var(--font-role-body)"}}export{A as ALL_FONT_CSS_VARS,r as DEFAULT_FONTS,g as FONT_CATEGORY_LABELS,c as FONT_OPTIONS,s as FONT_ROLES,x as FONT_ROLE_LABELS,b as HEADING_FACE_UTILITIES,I as HEADING_FONT_ROLES,L as ROOT_FALLBACK_CSS_VARS,V as SIZE_STEP_OF_ROLE,T as drawsHeadingFace,O as fontHasItalic,S as fontItalicIsUsable,_ as fontOption,k as fontRoleOf,h as fontRoleOfClassName,R as fontRoleStyle,m as fontsByCategory,d as normalizeFonts,F as siteFontCssVars,E as styleRoleOfClassName};
1
+ import{nonEmptyString as b}from"./non-empty-string.js";import{ownEntry as O}from"./own-entry.js";const l=[{key:"space-grotesk",label:"Space Grotesk",cssVar:"--font-display",category:"sans",italic:!1,italicLoaded:!1},{key:"inter",label:"Inter",cssVar:"--font-body",category:"sans",italic:!0,italicLoaded:!0},{key:"poppins",label:"Poppins",cssVar:"--font-poppins",category:"sans",italic:!0,italicLoaded:!0},{key:"dm-sans",label:"DM Sans",cssVar:"--font-dm-sans",category:"sans",italic:!0,italicLoaded:!0},{key:"sora",label:"Sora",cssVar:"--font-sora",category:"sans",italic:!1,italicLoaded:!1},{key:"oswald",label:"Oswald",cssVar:"--font-oswald",category:"sans",italic:!1,italicLoaded:!1},{key:"archivo",label:"Archivo",cssVar:"--font-archivo",category:"sans",italic:!0,italicLoaded:!0},{key:"outfit",label:"Outfit",cssVar:"--font-outfit",category:"sans",italic:!1,italicLoaded:!1},{key:"manrope",label:"Manrope",cssVar:"--font-manrope",category:"sans",italic:!1,italicLoaded:!1},{key:"big-shoulders",label:"Big Shoulders",cssVar:"--font-big-shoulders",category:"sans",italic:!1,italicLoaded:!1},{key:"michroma",label:"Michroma",cssVar:"--font-michroma",category:"sans",italic:!1,italicLoaded:!1},{key:"assistant",label:"Assistant",cssVar:"--font-assistant",category:"sans",italic:!1,italicLoaded:!1},{key:"jost",label:"Jost",cssVar:"--font-jost",category:"sans",italic:!0,italicLoaded:!0},{key:"fraunces",label:"Fraunces",cssVar:"--font-serif",category:"serif",italic:!0,italicLoaded:!0},{key:"playfair-display",label:"Playfair Display",cssVar:"--font-playfair",category:"serif",italic:!0,italicLoaded:!0},{key:"cormorant",label:"Cormorant",cssVar:"--font-cormorant",category:"serif",italic:!0,italicLoaded:!0},{key:"jetbrains-mono",label:"JetBrains Mono",cssVar:"--font-mono-loaded",category:"mono",italic:!0,italicLoaded:!0}],c=new Map(l.map(e=>[e.key,e])),g="site-",L="--font-site-",S=/^[a-z0-9]+(?:-[a-z0-9]+)*$/,s={options:l,byKey:c,siteFonts:new Map};function m(e){if(typeof e?.key!="string"||!e.key.startsWith(g))return null;const t=e.key.slice(g.length);if(!S.test(t))return null;const a=e.italic===!0;return{key:e.key,label:b(e.label)??e.family,cssVar:`${L}${t}`,category:Object.hasOwn(u,e.category)?e.category:"sans",italic:a,italicLoaded:a}}function A(e){if(!e?.length)return s;const t=new Map(c),a=[],i=new Map;for(const n of e){const o=m(n);!o||t.has(o.key)||(t.set(o.key,o),a.push(o),i.set(o.key,n))}return i.size===0?s:{options:[...a,...l],byKey:t,siteFonts:i}}const u={sans:"Sans",serif:"Serif",mono:"Mono"};function _(e=s){return Object.keys(u).map(t=>[t,e.options.filter(a=>a.category===t)]).filter(([,t])=>t.length>0)}function N(e=s){return _(e).flatMap(([,t])=>t)}function w(e,t=s){return t.byKey.get(e)?.italic??!1}function C(e,t=s){return t.byKey.get(e)?.italicLoaded??!1}function M(e,t=s){return t.byKey.get(e)}const d=["heading","heading2","heading3","body","accent","label"];function P(e){return typeof e=="string"&&d.includes(e)?e:null}const K={heading:"Heading 1",heading2:"Heading 2",heading3:"Heading 3",body:"Body",accent:"Emphasis",label:"Labels"},k=[["font-heading2","heading2"],["font-heading3","heading3"],["font-display","heading"],["font-serif","accent"],["font-mono","label"],["font-body","body"]],E=/var\(--size-(headingLarge|headingMedium|headingSmall|accent|body|label)\s*,/,B={heading:"headingLarge",heading2:"headingMedium",heading3:"headingSmall",accent:"accent",body:"body",label:"label"},x={headingLarge:"heading",headingMedium:"heading2",headingSmall:"heading3",accent:"accent",body:"body",label:"label"};function j(e){const t=e?E.exec(e):null;return t?O(x,t[1])??null:I(e)}function I(e){if(!e)return null;const t=e.split(/\s+/).filter(a=>!a.slice(0,a.lastIndexOf(":")+1).includes("&")).map(a=>a.slice(a.lastIndexOf(":")+1));for(const[a,i]of k)if(t.includes(a))return i;return null}const H=["heading","heading2","heading3"],T=["font-display","font-heading2","font-heading3"];function G(e){if(!e)return!1;const t=e.split(/\s+/).filter(a=>!a.slice(0,a.lastIndexOf(":")+1).includes("&")).map(a=>a.slice(a.lastIndexOf(":")+1));return T.some(a=>t.includes(a))}const f={heading:"space-grotesk",heading2:"space-grotesk",heading3:"space-grotesk",body:"inter",accent:"fraunces",label:"jetbrains-mono"};function p(e,t=s){const a=t.byKey,i=n=>{const o=e?.[n];if(o&&a.has(o))return o;if(n==="heading2"||n==="heading3"){const y=e?.heading;return y&&a.has(y)?y:f.heading}return f[n]};return Object.fromEntries(d.map(n=>[n,i(n)]))}function h(e,t,a){return a.byKey.get(e[t])??c.get(f[t])}function r(e,t,a){return`var(${h(e,t,a).cssVar})`}function z(e,t=s){const a=p(e,t);return[...new Set([...V,...d.map(i=>h(a,i,t).cssVar)])]}const V=[...new Set(d.map(e=>c.get(f[e]).cssVar))],D=[...new Set(l.map(e=>e.cssVar))];function U(e,t=s){const a=p(e,t);return{"--font-role-heading":r(a,"heading",t),"--font-role-heading2":r(a,"heading2",t),"--font-role-heading3":r(a,"heading3",t),"--font-role-body":r(a,"body",t),"--font-role-accent":r(a,"accent",t),"--font-role-label":r(a,"label",t),fontFamily:"var(--font-role-body)"}}export{D as ALL_FONT_CSS_VARS,f as DEFAULT_FONTS,u as FONT_CATEGORY_LABELS,l as FONT_OPTIONS,d as FONT_ROLES,K as FONT_ROLE_LABELS,T as HEADING_FACE_UTILITIES,H as HEADING_FONT_ROLES,s as POOL_FONT_REGISTRY,V as ROOT_FALLBACK_CSS_VARS,L as SITE_FONT_CSS_VAR_PREFIX,g as SITE_FONT_KEY_PREFIX,B as SIZE_STEP_OF_ROLE,G as drawsHeadingFace,w as fontHasItalic,C as fontItalicIsUsable,M as fontOption,A as fontRegistry,P as fontRoleOf,I as fontRoleOfClassName,U as fontRoleStyle,_ as fontsByCategory,N as fontsInPickerOrder,p as normalizeFonts,z as siteFontCssVars,j as styleRoleOfClassName};
@@ -0,0 +1,9 @@
1
+ import type { FontCategory, FontRegistry, SiteFontFile } from "./fonts.js";
2
+ export declare const SITE_FONT_PRELOAD_MAX = 4;
3
+ export declare const SITE_FONT_FALLBACK_LOCAL: Readonly<Record<FontCategory | "condensed", string>>;
4
+ export interface SiteFontFaces {
5
+ css: string;
6
+ vars: Record<string, string>;
7
+ preload: SiteFontFile[];
8
+ }
9
+ export declare function siteFontFaces(registry: FontRegistry, usedKeys: Iterable<string>): SiteFontFaces;
@@ -0,0 +1,2 @@
1
+ import{cssStringBody as F,styleElementText as y}from"./document/style-text.js";const g=4,$={sans:"Arial",condensed:"Arial Narrow",serif:"Times New Roman",mono:"Courier New"},w={sans:"sans-serif",serif:"serif",mono:"monospace"},E="latin",b=/^\/(?![\/\\])[^\s"'()\\<>:]+$/,_=/^U\+[0-9A-Fa-f?]{1,6}(?:-[0-9A-Fa-f]{1,6})?(?:\s*,\s*U\+[0-9A-Fa-f?]{1,6}(?:-[0-9A-Fa-f]{1,6})?)*$/,u=e=>`"${F(e)}"`,p=e=>`${e} Fallback`;function h(e){return typeof e?.url=="string"&&b.test(e.url)&&typeof e.unicodeRange=="string"&&_.test(e.unicodeRange.trim())&&Number.isInteger(e.weight)&&e.weight>=1&&e.weight<=1e3&&(e.style==="normal"||e.style==="italic")}const c=e=>`${e}%`,r=e=>typeof e=="number"&&Number.isFinite(e);function R(e,A){const i={css:"",vars:{},preload:[]};if(e.siteFonts.size===0)return i;const l=[],f=[];for(const o of new Set(A)){const n=e.siteFonts.get(o),a=e.byKey.get(o);if(!n||!a)continue;const m=u(n.family);for(const s of n.files??[])h(s)&&(l.push(`@font-face { font-family: ${m}; src: url("${s.url}") format("woff2"); font-weight: ${s.weight}; font-style: ${s.style}; unicode-range: ${s.unicodeRange.trim()}; font-display: swap; }`),s.subset===E&&f.push(s));const t=n.fallbackMetrics,d=!!t&&r(t.ascent)&&r(t.descent)&&r(t.lineGap)&&r(t.sizeAdjust);if(d){const s=$[n.condensed?"condensed":a.category];l.push(`@font-face { font-family: ${u(p(n.family))}; src: local("${s}"); ascent-override: ${c(t.ascent)}; descent-override: ${c(t.descent)}; line-gap-override: ${c(t.lineGap)}; size-adjust: ${c(t.sizeAdjust)}; }`)}i.vars[a.cssVar]=y([m,...d?[u(p(n.family))]:[],w[a.category]].join(", "))}return i.css=y(l.join(`
2
+ `)),i.preload=[...f.filter(o=>o.style==="normal"),...f.filter(o=>o.style!=="normal")].slice(0,g),i}export{$ as SITE_FONT_FALLBACK_LOCAL,g as SITE_FONT_PRELOAD_MAX,R as siteFontFaces};
@@ -1,3 +1,4 @@
1
+ import type { FontCategory, SiteFont } from "./fonts.js";
1
2
  export interface SiteThemeRow {
2
3
  id: string;
3
4
  selected_preset: number;
@@ -69,5 +70,32 @@ export interface SiteThemeRow {
69
70
  values: Record<string, unknown>;
70
71
  auto?: string[];
71
72
  }[] | null;
73
+ site_fonts?: SiteThemeRowFont[] | null;
72
74
  }
73
- export type SiteThemeRowPatch = Partial<Omit<SiteThemeRow, "id">>;
75
+ interface SiteThemeRowFontFile {
76
+ id: string;
77
+ weight: number;
78
+ style: "normal" | "italic";
79
+ subset: string;
80
+ unicode_range: string;
81
+ url?: string | null;
82
+ }
83
+ export interface SiteThemeRowFont {
84
+ key: string;
85
+ family: string;
86
+ label: string;
87
+ category: FontCategory;
88
+ condensed: boolean;
89
+ weights: number[];
90
+ italic: boolean;
91
+ fallback_metrics: {
92
+ ascent: number;
93
+ descent: number;
94
+ line_gap: number;
95
+ size_adjust: number;
96
+ } | null;
97
+ files: SiteThemeRowFontFile[];
98
+ }
99
+ export declare function siteFontsFromRow(row: Pick<Partial<SiteThemeRow>, "site_fonts"> | null | undefined): SiteFont[] | null;
100
+ export type SiteThemeRowPatch = Partial<Omit<SiteThemeRow, "id" | "site_fonts">>;
101
+ export {};
@@ -0,0 +1 @@
1
+ function r(a){const s=a?.site_fonts;return Array.isArray(s)?s.map(e=>({key:e.key,family:e.family,label:e.label,category:e.category,condensed:e.condensed===!0,weights:Array.isArray(e.weights)?[...e.weights]:[],italic:e.italic===!0,fallbackMetrics:e.fallback_metrics?{ascent:e.fallback_metrics.ascent,descent:e.fallback_metrics.descent,lineGap:e.fallback_metrics.line_gap,sizeAdjust:e.fallback_metrics.size_adjust}:null,files:(Array.isArray(e.files)?e.files:[]).map(t=>({id:t.id,weight:t.weight,style:t.style,subset:t.subset,unicodeRange:t.unicode_range,url:typeof t.url=="string"?t.url:""}))})):null}export{r as siteFontsFromRow};
@@ -1 +1 @@
1
- import{imageCopyUrl as s,imageSrcSet as S}from"efficient-shell/image-copies";let e;function d(t){e=t}function o(){return e===void 0?{}:{host:e}}const x="(max-width: 800px) 100vw, min(100vw, 1600px)",a="(max-width: 960px) 100vw, 50vw";function m(t,{fallbackWidth:n=1280,maxWidth:r}={}){const i=S(t,{...o(),...r===void 0?{}:{maxWidth:r}});return i?{src:s(t,n,o()),srcSet:i}:{src:t}}const p=/[\s"'()\\;]/,c={"\\":"\\\\",'"':'\\"',"\n":"\\a ","\r":"\\d ","\f":"\\c "};function u(t){return t.replace(/[\\"\n\r\f]/g,n=>c[n]??n)}function E(t){const n=s(t,1920,o());return n===t?p.test(t)?`url("${u(t)}")`:`url(${t})`:`url("${u(n)}")`}export{x as CONTENT_SIZES,a as HALF_SIZES,d as __setImageCopiesHostForTests,E as sizedBackground,m as sizedImage};
1
+ import{imageCopyUrl as s,imageSrcSet as p}from"efficient-shell/image-copies";import{cssStringBody as u}from"./document/style-text.js";let e;function c(t){e=t}function n(){return e===void 0?{}:{host:e}}const d="(max-width: 800px) 100vw, min(100vw, 1600px)",x="(max-width: 960px) 100vw, 50vw";function a(t,{fallbackWidth:o=1280,maxWidth:r}={}){const i=p(t,{...n(),...r===void 0?{}:{maxWidth:r}});return i?{src:s(t,o,n()),srcSet:i}:{src:t}}const f=/[\s"'()\\;]/;function g(t){const o=s(t,1920,n());return o===t?f.test(t)?`url("${u(t)}")`:`url(${t})`:`url("${u(o)}")`}export{d as CONTENT_SIZES,x as HALF_SIZES,c as __setImageCopiesHostForTests,g as sizedBackground,a as sizedImage};
@@ -1,4 +1,4 @@
1
- import{ruleChecks as x}from"./rule.js";function S(c,d){const i=c.createSourceFile(d.path,d.text,c.ScriptTarget.Latest,!0,c.ScriptKind.TSX),n=[];let g=0;const h=s=>i.getLineAndCharacterOfPosition(s.getStart(i)).line+1,u=s=>{if(c.isJsxOpeningElement(s)||c.isJsxSelfClosingElement(s)){const a=s.tagName.getText(i);a==="select"&&n.push({file:d.path,line:h(s),what:"R1 raw <select> — use efficient-easel's FieldSelect"}),(a==="FieldSelect"||/^FieldSelect</.test(a))&&g++}if(c.isCallExpression(s)){const a=s.expression.getText(i),r=s.arguments[0];(a==="h"||/(^|\.)createElement$/.test(a))&&r&&c.isStringLiteralLike(r)&&r.text==="select"&&n.push({file:d.path,line:h(s),what:`R2 ${a}("select") — use efficient-easel's FieldSelect`})}c.forEachChild(s,u)};return u(i),{selects:n,fieldSelect:g}}function v(c,d,i){const{check:n,report:g}=x("one dropdown"),h=i.notEditor??{},u=i.ownedNow??{},s=i.until??{};{const e=["const a = <select value={v} onChange={f}><option>x</option></select>;",'const b = h("select", { value: v });','const c = React.createElement("select", null);',"// a comment about <select> is not a use","const d = <FieldSelect value={v} options={o} onChange={f} />;","const e = <FieldSelect<string> value={v} options={o} onChange={f} />;",'const s = "<select>"; const t = <Select />;'].join(`
2
- `),{selects:t,fieldSelect:f}=S(c,{path:"fixture.tsx",text:e}),l=t.map(o=>o.line);n("R1 flags a JSX <select>",t.some(o=>o.line===1&&o.what.startsWith("R1"))),n('R2 flags h("select")',t.some(o=>o.line===2&&o.what.startsWith("R2"))),n('R2 flags React.createElement("select")',t.some(o=>o.line===3&&o.what.startsWith("R2"))),n("a comment, a string and a <Select> component are not uses",!l.includes(4)&&!l.includes(7)),n("FieldSelect passes and is counted, generic form too",!l.includes(5)&&!l.includes(6)&&f===2)}const a=d.filter(e=>/\.tsx?$/.test(e.path)&&!e.path.endsWith(".d.ts")),r=new Map;let w=0;for(const e of a){const t=S(c,e);t.selects.length&&r.set(e.path,t.selects),w+=t.fieldSelect}const p=[];for(const[e,t]of r)e in h||e in u||e in s||p.push(...t);n("no raw <select> in editor code",p.length===0,`${p.length} hit(s):
1
+ import{ruleChecks as x}from"./rule.js";import{elementOf as v}from"./support/element-call.js";function S(c,h){const o=c.createSourceFile(h.path,h.text,c.ScriptTarget.Latest,!0,c.ScriptKind.TSX),s=[];let g=0;const d=n=>o.getLineAndCharacterOfPosition(n.getStart(o)).line+1,u=n=>{if(c.isJsxOpeningElement(n)||c.isJsxSelfClosingElement(n)){const a=n.tagName.getText(o);a==="select"&&s.push({file:h.path,line:d(n),what:"R1 raw <select> — use efficient-easel's FieldSelect"}),(a==="FieldSelect"||/^FieldSelect</.test(a))&&g++}if(c.isCallExpression(n)){const a=n.expression.getText(o),r=v(c,n);r&&c.isStringLiteralLike(r)&&r.text==="select"&&s.push({file:h.path,line:d(n),what:`R2 ${a}("select") — use efficient-easel's FieldSelect`})}c.forEachChild(n,u)};return u(o),{selects:s,fieldSelect:g}}function b(c,h,o){const{check:s,report:g}=x("one dropdown"),d=o.notEditor??{},u=o.ownedNow??{},n=o.until??{};{const e=["const a = <select value={v} onChange={f}><option>x</option></select>;",'const b = h("select", { value: v });','const c = React.createElement("select", null);',"// a comment about <select> is not a use","const d = <FieldSelect value={v} options={o} onChange={f} />;","const e = <FieldSelect<string> value={v} options={o} onChange={f} />;",'const s = "<select>"; const t = <Select />;','const f = _jsx("select", { value: v });'].join(`
2
+ `),{selects:t,fieldSelect:f}=S(c,{path:"fixture.tsx",text:e}),i=t.map(l=>l.line);s("R1 flags a JSX <select>",t.some(l=>l.line===1&&l.what.startsWith("R1"))),s('R2 flags h("select")',t.some(l=>l.line===2&&l.what.startsWith("R2"))),s('R2 flags React.createElement("select")',t.some(l=>l.line===3&&l.what.startsWith("R2"))),s('R2 flags a jsx("select") call, by its spelling',t.some(l=>l.line===8&&l.what.startsWith("R2"))),s("a comment, a string and a <Select> component are not uses",!i.includes(4)&&!i.includes(7)),s("FieldSelect passes and is counted, generic form too",!i.includes(5)&&!i.includes(6)&&f===2)}const a=h.filter(e=>/\.tsx?$/.test(e.path)&&!e.path.endsWith(".d.ts")),r=new Map;let w=0;for(const e of a){const t=S(c,e);t.selects.length&&r.set(e.path,t.selects),w+=t.fieldSelect}const p=[];for(const[e,t]of r)e in d||e in u||e in n||p.push(...t);s("no raw <select> in editor code",p.length===0,`${p.length} hit(s):
3
3
  `+p.map(e=>`${e.file}:${e.line} ${e.what}`).join(`
4
- `));for(const[e,[t,f]]of Object.entries(h)){const l=r.get(e)?.length??0;n(`shopper select still real and still ${t}: ${e} (${f})`,l===t,`found ${l} — fix or remove the entry`)}for(const[e,[t,f]]of Object.entries(u)){const l=r.get(e)?.length??0;n(`left for another card, exactly ${t}: ${e} (${f})`,l===t,l>t?`found ${l} — a NEW raw <select> in a file that is being replaced; use FieldSelect`:`found ${l} — that card has landed; remove this entry`)}for(const[e,[t,f,l]]of Object.entries(s)){const o=r.get(e)?.length??0;n(`waiting, exactly ${t}: ${e} (until ${f})`,o===t,`found ${o} — swapped? remove this entry`);let m=!1;try{m=l()}catch($){n(`could read whether ${e}'s wait is over`,!1,$.message);continue}n(`${e} is still waiting (installed efficient-easel lacks it)`,!m,`the installed efficient-easel now has ${f} — swap ${e} to FieldSelect and remove its UNTIL entry`)}return n(`walked the editor source (${a.length} TS/TSX files, at least ${i.minFiles})`,a.length>=i.minFiles),n(`found >= ${i.fieldSelectFloor} <FieldSelect> uses (found ${w})`,w>=i.fieldSelectFloor,"the builder + the swapped rows; fewer means a row went back to a raw <select> or the reader broke"),g()}export{v as oneDropdown};
4
+ `));for(const[e,[t,f]]of Object.entries(d)){const i=r.get(e)?.length??0;s(`shopper select still real and still ${t}: ${e} (${f})`,i===t,`found ${i} — fix or remove the entry`)}for(const[e,[t,f]]of Object.entries(u)){const i=r.get(e)?.length??0;s(`left for another card, exactly ${t}: ${e} (${f})`,i===t,i>t?`found ${i} — a NEW raw <select> in a file that is being replaced; use FieldSelect`:`found ${i} — that card has landed; remove this entry`)}for(const[e,[t,f,i]]of Object.entries(n)){const l=r.get(e)?.length??0;s(`waiting, exactly ${t}: ${e} (until ${f})`,l===t,`found ${l} — swapped? remove this entry`);let m=!1;try{m=i()}catch($){s(`could read whether ${e}'s wait is over`,!1,$.message);continue}s(`${e} is still waiting (installed efficient-easel lacks it)`,!m,`the installed efficient-easel now has ${f} — swap ${e} to FieldSelect and remove its UNTIL entry`)}return s(`walked the editor source (${a.length} TS/TSX files, at least ${o.minFiles})`,a.length>=o.minFiles),s(`found >= ${o.fieldSelectFloor} <FieldSelect> uses (found ${w})`,w>=o.fieldSelectFloor,"the builder + the swapped rows; fewer means a row went back to a raw <select> or the reader broke"),g()}export{b as oneDropdown};
@@ -1,4 +1,4 @@
1
- import{ruleChecks as y}from"./rule.js";import{blockEnd as $}from"./support/css-rules.js";const f="<img",o="<Image",b=/createElement\(\s*["']img["']/g,w=/(^|\s)loading=(?:"lazy"|\{(?!\s*["'`]eager))|\{\s*loading:\s*"lazy"/,k=/\.\.\.\s*\(?\s*(?:deferred\b|useDeferredPicture\b)/,P=/\spriority(?=[\s/>]|=\{true\})|\sloading=(?:"eager"|\{\s*["'`]eager)/;function u(r,t){const n=[];let a=r.indexOf(t);for(;a!==-1;){const l=r[a+t.length];if(l===void 0||/\s|\/|>/.test(l)){let s=a;for(;s<r.length&&r[s]!==">";)s=r[s]==="{"?$(r,s)+1:s+1;n.push(r.slice(a,s+1))}a=r.indexOf(t,a+1)}return n}function d(r){const t=r.replace(/\/\*[\s\S]*?\*\/|(^|\s)\/\/.*$/gm,"$1"),n=/\buseDeferredPicture\(/.test(t);return[...u(t,f).filter(a=>!w.test(a)&&!(n&&k.test(a))),...u(t,o).filter(a=>P.test(a)),...t.match(b)??[]]}function x(r,t){const{check:n,report:a}=y("page picture place"),l=t.allowed??{};{const e=i=>`${f} ${i} />`,c=[["a bare tag",e('src={a} alt=""')],["a tag with an arrow in a handler",e("src={a} onError={() => fail()}")],["an eager tag",e('src={a} loading="eager"')],["an eager tag in braces",e('src={a} loading={"eager"}')],["a look-alike attribute",e('src={a} data-loading="x"')],["the word in a handler",e("src={a} onLoad={() => { state.loading = false; }}")],["a spread of `deferred` from anywhere",e("src={a} {...deferred}")],["a created tag",'createElement("img", { src: a })'],["a next image asked first",`${o} src={a} priority />`],["a next image made eager",`${o} src={a} loading="eager" />`],["a next image made eager in braces",`${o} src={a} loading={"eager"} />`],["a bare tag with a stray } before a lazy tag",`${e("src={a} }")} <p loading="lazy">x</p>`]];for(const[i,g]of c)n(`the reader finds ${i}`,d(g).length===1);const p=[["a lazy tag",e('src={a} loading="lazy"')],["a lazy tag in braces",e('src={a} loading={"lazy"}')],["a loading chosen in code",e('src={a} loading={far ? "lazy" : "eager"}')],["a conditional lazy tag",e('src={a} {...(far ? { loading: "lazy" as const } : {})}')],["a spread from the page's place",`const deferred = useDeferredPicture(); ${e("src={a} {...deferred}")}`],["a next image",`${o} src={a} />`],["a next image chosen by place",`${o} src={a} {...(far ? {} : { priority: true })} />`],["a lookalike block",`${o}Block src={a} priority />`],["another element that starts the same",`${f}Row src={a} />`]];for(const[i,g]of p)n(`…and leaves ${i} alone`,d(g).length===0)}const s=r.filter(e=>e.path.endsWith(".tsx"));n(`read the source (${s.length} .tsx files, at least ${t.minFiles})`,s.length>=t.minFiles,"fewer means the walk broke, and every check below is vacuous");const h=s.filter(e=>!(e.path in l)).flatMap(e=>d(e.text).map(()=>e.path));n("every plain picture says how it loads",h.length===0,`
2
- ${h.join(`
1
+ import{ruleChecks as y}from"./rule.js";import{blockEnd as b}from"./support/css-rules.js";import{ELEMENT_FACTORY_PATTERN as $}from"./support/element-call.js";const f="<img",o="<Image",w=new RegExp(`${$}\\(\\s*["']img["']`,"g"),E=/(^|\s)loading=(?:"lazy"|\{(?!\s*["'`]eager))|\{\s*loading:\s*"lazy"/,k=/\.\.\.\s*\(?\s*(?:deferred\b|useDeferredPicture\b)/,P=/\spriority(?=[\s/>]|=\{true\})|\sloading=(?:"eager"|\{\s*["'`]eager)/;function u(r,t){const n=[];let a=r.indexOf(t);for(;a!==-1;){const i=r[a+t.length];if(i===void 0||/\s|\/|>/.test(i)){let s=a;for(;s<r.length&&r[s]!==">";)s=r[s]==="{"?b(r,s)+1:s+1;n.push(r.slice(a,s+1))}a=r.indexOf(t,a+1)}return n}function g(r){const t=r.replace(/\/\*[\s\S]*?\*\/|(^|\s)\/\/.*$/gm,"$1"),n=/\buseDeferredPicture\(/.test(t);return[...u(t,f).filter(a=>!E.test(a)&&!(n&&k.test(a))),...u(t,o).filter(a=>P.test(a)),...t.match(w)??[]]}function R(r,t){const{check:n,report:a}=y("page picture place"),i=t.allowed??{};{const e=l=>`${f} ${l} />`,c=[["a bare tag",e('src={a} alt=""')],["a tag with an arrow in a handler",e("src={a} onError={() => fail()}")],["an eager tag",e('src={a} loading="eager"')],["an eager tag in braces",e('src={a} loading={"eager"}')],["a look-alike attribute",e('src={a} data-loading="x"')],["the word in a handler",e("src={a} onLoad={() => { state.loading = false; }}")],["a spread of `deferred` from anywhere",e("src={a} {...deferred}")],["a created tag",'createElement("img", { src: a })'],["a tag made by h",'h("img", { src: a })'],["a tag made by a member call",'React.createElement("img", { src: a })'],["a tag made by jsx",'_jsx("img", { src: a })'],["a next image asked first",`${o} src={a} priority />`],["a next image made eager",`${o} src={a} loading="eager" />`],["a next image made eager in braces",`${o} src={a} loading={"eager"} />`],["a bare tag with a stray } before a lazy tag",`${e("src={a} }")} <p loading="lazy">x</p>`]];for(const[l,d]of c)n(`the reader finds ${l}`,g(d).length===1);const p=[["a lazy tag",e('src={a} loading="lazy"')],["a lazy tag in braces",e('src={a} loading={"lazy"}')],["a loading chosen in code",e('src={a} loading={far ? "lazy" : "eager"}')],["a conditional lazy tag",e('src={a} {...(far ? { loading: "lazy" as const } : {})}')],["a spread from the page's place",`const deferred = useDeferredPicture(); ${e("src={a} {...deferred}")}`],["a next image",`${o} src={a} />`],["a next image chosen by place",`${o} src={a} {...(far ? {} : { priority: true })} />`],["a lookalike block",`${o}Block src={a} priority />`],["another element that starts the same",`${f}Row src={a} />`]];for(const[l,d]of p)n(`…and leaves ${l} alone`,g(d).length===0)}const s=r.filter(e=>e.path.endsWith(".tsx"));n(`read the source (${s.length} .tsx files, at least ${t.minFiles})`,s.length>=t.minFiles,"fewer means the walk broke, and every check below is vacuous");const m=s.filter(e=>!(e.path in i)).flatMap(e=>g(e.text).map(()=>e.path));n("every plain picture says how it loads",m.length===0,`
2
+ ${m.join(`
3
3
  `)}
4
- Draw a PagePicture, or spread useDeferredPicture (lib/first-screen).`);const m=Object.keys(l).filter(e=>!s.some(c=>c.path===e&&d(c.text).length>0));return n("every exemption still draws a silent picture",m.length===0,`drop these from \`allowed\`: ${m.join(", ")}`),a()}export{x as pagePicturePlace};
4
+ Draw a PagePicture, or spread useDeferredPicture (lib/first-screen).`);const h=Object.keys(i).filter(e=>!s.some(c=>c.path===e&&g(c.text).length>0));return n("every exemption still draws a silent picture",h.length===0,`drop these from \`allowed\`: ${h.join(", ")}`),a()}export{R as pagePicturePlace};
@@ -1,68 +1,68 @@
1
- import{ruleChecks as U}from"./rule.js";import{programOf as ae}from"./support/ts-program.js";function re(n){const a=[];let e=0,m=0;for(let i=0;i<n.length;i++){const l=n[i];"([{".includes(l)?e++:")]}".includes(l)?e--:l===","&&e===0&&(a.push(n.slice(m,i)),m=i+1)}return a.push(n.slice(m)),a.map(i=>i.trim()).filter(i=>i!=="")}const ie=/^[A-Za-z_$][\w$]*$/,oe=/^(?:@\/|\.\.?\/)/;function se(n,a){const e=ae(n,[{path:"mount.tsx",text:a}]);return{sf:e.getSourceFile("/mount.tsx"),checker:e.getTypeChecker()}}function pe(n,a){const e=[],m=i=>{e.push(i),n.forEachChild(i,m)};return m(a),e}function N(n,a){const e=a.parent;return(n.isVariableDeclaration(e)||n.isParameter(e)||n.isBindingElement(e)||n.isFunctionDeclaration(e)||n.isFunctionExpression(e)||n.isClassDeclaration(e)||n.isClassExpression(e)||n.isImportSpecifier(e)||n.isImportClause(e)||n.isNamespaceImport(e)||n.isImportEqualsDeclaration(e))&&e.name===a}function L(n,a){return n.isParenthesizedExpression(a)||n.isAsExpression(a)||n.isNonNullExpression(a)||n.isTypeAssertionExpression(a)||n.isSatisfiesExpression(a)}function le(n,a){for(;a.parent&&L(n,a.parent);)a=a.parent;return a}function _(n,a){let e=a,m=!1;for(;;){e=le(n,e);const i=e.parent;if(i&&(n.isPropertyAccessExpression(i)||n.isElementAccessExpression(i))&&i.expression===e){e=i,m=!0;continue}return{top:e,path:m}}}const H=(n,a)=>n.isBinaryExpression(a)&&(a.operatorToken.kind===n.SyntaxKind.QuestionQuestionToken||a.operatorToken.kind===n.SyntaxKind.BarBarToken);function ce(n,a){const e=a.parent;if(!e)return"used";if(n.isBinaryExpression(e)&&e.left===a&&e.operatorToken.kind>=n.SyntaxKind.FirstAssignment&&e.operatorToken.kind<=n.SyntaxKind.LastAssignment)return"assigned";if((n.isPrefixUnaryExpression(e)||n.isPostfixUnaryExpression(e))&&(e.operator===n.SyntaxKind.PlusPlusToken||e.operator===n.SyntaxKind.MinusMinusToken))return"changed by ++ or --";if(n.isDeleteExpression(e))return"deleted";if(n.isCallExpression(e)&&e.expression===a)return"called, or a method called on it";if(n.isCallExpression(e)||n.isNewExpression(e))return`handed to ${e.expression.getText()}(…)`;if(n.isJsxExpression(e)&&n.isJsxAttribute(e.parent))return`handed to the JSX attribute ${e.parent.name.getText()}`;if(n.isVariableDeclaration(e)||n.isBindingElement(e))return"aliased by a local";if(n.isSpreadElement(e)||n.isSpreadAssignment(e)||n.isJsxSpreadAttribute(e))return"spread";if(n.isForOfStatement(e)||n.isForInStatement(e))return"looped over";for(let m=a;m.parent;m=m.parent){const i=m.parent;if(n.isBinaryExpression(i)){if(i.left===m&&i.operatorToken.kind===n.SyntaxKind.EqualsToken)return"a destructuring target";break}if(!(n.isObjectLiteralExpression(i)||n.isArrayLiteralExpression(i)||n.isPropertyAssignment(i)||n.isShorthandPropertyAssignment(i)||n.isSpreadAssignment(i)||n.isSpreadElement(i)||L(n,i)))break}return`used in a ${n.SyntaxKind[e.kind]} (syntax kind)`}function Q(n,a,e){if(!e)return["the rule was not handed the compiler (`options.ts`)"];const{sf:m,checker:i}=se(e,n),l=pe(e,m),x=l.filter(e.isIdentifier),f=t=>m.getLineAndCharacterOfPosition(t.getStart(m)).line+1,p=t=>e.isShorthandPropertyAssignment(t.parent)&&t.parent.name===t?i.getShorthandAssignmentValueSymbol(t.parent):i.getSymbolAtLocation(t),h=t=>x.filter(r=>r.text===t&&N(e,r)),d=t=>{for(let r=t;r.parent;r=r.parent){const o=r.parent;if(e.isExpressionWithTypeArguments(o)&&o.expression===r)return!1;if(e.isTypeNode(o))return!0}return!1},s=[],c=(t,r,o)=>{const u=l.filter(E=>e.isImportSpecifier(E)&&E.name.text===r),g=u[0],b=g?g.parent.parent.parent.moduleSpecifier.text:"";return u.length!==1?`${t} is not imported once in the mount`:g.propertyName&&g.propertyName.text!==r?`${t} is ${g.propertyName.text} renamed: it is imported by its own name`:g.isTypeOnly||g.parent.parent.isTypeOnly?`${t} is a type-only import`:(o===void 0?!oe.test(b):b!==o)?`${t} comes from "${b}", not ${o===void 0?"a module inside this package":`"${o}"`}`:h(r).length!==1?`${t} is declared again in the mount: it is the imported function`:i.getSymbolAtLocation(g.name)??`${t} has no binding in the mount`},K=h(a.variable);if(K.length!==1)return[`\`${a.variable}\` is declared ${K.length} times, not once`];const A=K[0].parent;if(!e.isVariableDeclaration(A))return[`\`${a.variable}\` is not a variable declaration`];const $=p(K[0]),k=A.initializer;let y=null;const T=c(`the call ${a.call}`,a.call,a.callFrom);if(typeof T=="string"&&s.push(T),!k||!e.isCallExpression(k)||!e.isIdentifier(k.expression)||k.expression.text!==a.call||typeof T!="string"&&p(k.expression)!==T)s.push(`\`${a.variable}\` is not set straight from ${a.call}(…): a pass wraps it, or something follows the call`);else{y=k;const t=n.slice(k.arguments.pos,k.arguments.end).trim();a.args!==void 0&&t!==a.args&&s.push(`${a.call} is handed \`${t}\`, not \`${a.args}\``)}const R=e.findAncestor(A,t=>e.isFunctionDeclaration(t)||e.isFunctionExpression(t)||e.isArrowFunction(t));if(!R||!R.body||A.parent.parent.parent!==R.body)return[...s,`\`${a.variable}\` is not declared at the top level of a component's body`];const C=R.parameters[0]?.name,S=new Map;if(C&&e.isObjectBindingPattern(C))for(const t of C.elements)e.isIdentifier(t.name)&&!t.dotDotDotToken&&S.set(t.name.text,t.name);else s.push("the component does not destructure its props");const B=a.inputs??re(a.args??"").filter(t=>ie.test(t));B.length===0&&s.push(`${a.call}(…) reads no input the rule can check: name the props it reads in \`inputs\`, or bare names in \`args\``);const P=new Set;for(const t of B){const r=S.get(t);if(!r){s.push(`\`${t}\` is not a prop of the component: the call is handed something made in the mount`);continue}h(t).length!==1&&s.push(`\`${t}\` is declared ${h(t).length} times in the file: a second binding would pass for the input`);const o=p(r);o&&P.add(o)}for(const t of x)t.text==="arguments"&&!N(e,t)&&e.findAncestor(t,r=>r===R)&&s.push(`\`arguments\` is used in the component (line ${f(t)}): it is the props by another name`);for(const t of x)(t.text==="eval"||t.text==="Function")&&!N(e,t)&&!d(t)&&!(e.isPropertyAccessExpression(t.parent)&&t.parent.name===t)&&s.push(`\`${t.text}\` is used in the mount file (line ${f(t)}): code run from a string cannot be read`);const z=new Set;for(const t of a.readers??[]){const r=typeof t=="string"?t:t.name,o=c(`the reader ${r}`,r,typeof t=="string"?void 0:t.from);typeof o=="string"?s.push(o):z.add(o)}const Y=t=>{if(!e.isCallExpression(t)||!e.isIdentifier(t.expression))return!1;const r=p(t.expression);return r!==void 0&&z.has(r)};let V=null;const I=l.filter(t=>e.isImportSpecifier(t)&&t.name.text==="Render"),J=a.renderFrom??"efficient-easel/render",ee=I.length===1?I[0].parent.parent.parent.moduleSpecifier.text:"",M=l.filter(t=>e.isImportDeclaration(t)&&e.isStringLiteral(t.moduleSpecifier)&&t.moduleSpecifier.text===J&&!t.importClause?.isTypeOnly).flatMap(t=>{const r=t.importClause;if(!r)return[];const o=r.namedBindings;return[...r.name?[r.name.text]:[],...o&&e.isNamespaceImport(o)?[`* as ${o.name.text}`]:[],...o&&e.isNamedImports(o)?o.elements.filter(u=>!u.isTypeOnly).map(u=>u.propertyName?`${u.propertyName.text} as ${u.name.text}`:u.name.text):[]]});(M.length!==1||M[0]!=="Render")&&s.push(`"${J}" gives this file ${M.length} binding(s) (${M.join(", ")||"none"}), not the one \`Render\``);const q=I.length===1&&!I[0].propertyName&&ee===J?i.getSymbolAtLocation(I[0].name):void 0;if(!q||h("Render").length!==1)s.push(`\`Render\` is not imported once by its own name from "${J}"`);else{const t=x.filter(o=>!N(e,o)&&p(o)===q),r=t.filter(o=>(e.isJsxOpeningElement(o.parent)||e.isJsxSelfClosingElement(o.parent))&&o.parent.tagName===o);if(r.length!==1||t.length!==1)s.push(`\`Render\` is used ${t.length} times, ${r.length} as a tag: one <Render> and no alias`);else{const u=r[0].parent.attributes.properties;u.some(w=>e.isJsxSpreadAttribute(w))&&s.push("the Render tag has a spread attribute, which can hand it another document");const g=u.filter(w=>e.isJsxAttribute(w)&&w.name.getText()==="data"),b=g.length===1?g[0].initializer:void 0,E=b&&e.isJsxExpression(b)?b.expression:void 0;!E||!e.isIdentifier(E)||p(E)!==$?s.push(`the Render tag draws \`${E?E.getText():g.length===1?g[0].getText():"nothing"}\`, not \`${a.variable}\``):V=E;const G=u.filter(w=>e.isJsxAttribute(w)&&w.name.getText()==="keep"),W=G.length===1?G[0].initializer:void 0,F=W&&e.isJsxExpression(W)?W.expression:void 0;if(!F||!e.isIdentifier(F))s.push("the Render tag has no `keep={keep}`: a mount drawn again would remount every slot it holds (lib/document/render-keep)");else{const w=c("the keep hook useRenderKeep","useRenderKeep",a.keepFrom??j);typeof w=="string"&&s.push(w);const D=p(F)?.valueDeclaration;if(!D||!e.isVariableDeclaration(D)||D.parent.parent.parent!==R.body||h(F.text).length!==1)s.push(`\`${F.text}\` (the Render tag's keep) is not declared once at the top level of the component's body: a keep made at module level is shared by every mount and request`);else if(!(e.getCombinedNodeFlags(D)&e.NodeFlags.Const))s.push(`\`${F.text}\` (the Render tag's keep) is not a \`const\`: a keep set again is a new keep`);else{const O=D.initializer;(!O||!e.isCallExpression(O)||O.arguments.length!==0||!e.isIdentifier(O.expression)||typeof w=="string"||p(O.expression)!==w)&&s.push(`\`${F.text}\` is not set straight from useRenderKeep(): a keep made new on each draw keeps nothing`)}}}}const v=new Map;for(const t of P)v.set(t,t.name);$&&v.set($,a.variable);const te=t=>{for(let r=t;r.parent;r=r.parent){const o=r.parent;if(y&&o===y)return y.arguments.some(g=>g===r);if(!(L(e,o)||e.isObjectLiteralExpression(o)||e.isPropertyAssignment(o)&&o.initializer===r||e.isShorthandPropertyAssignment(o)||e.isSpreadAssignment(o)||e.isArrayLiteralExpression(o)||e.isSpreadElement(o)||e.isConditionalExpression(o)&&o.condition!==r||H(e,o)))return!1}return!1},ne=t=>{let r=t,o=!1;for(;;){const u=r.parent;if(!u)return;if(L(e,u))r=u;else if(e.isConditionalExpression(u)&&u.condition!==r)r=u,o=!0;else if(e.isSpreadAssignment(u)&&e.isObjectLiteralExpression(u.parent))r=u.parent,o=!0;else return e.isVariableDeclaration(u)&&u.initializer===r&&e.isIdentifier(u.name)&&o?p(u.name):void 0}},X=(t,r)=>{if(d(t))return!0;const{top:o,path:u}=_(e,t);if(t===V)return!0;let g=o;for(;g.parent&&(L(e,g.parent)||H(e,g.parent));)g=g.parent;if(g.parent&&Y(g.parent)&&g.parent.arguments.some(E=>E===g)||P.has(r)&&te(o))return!0;const b=u?void 0:ne(o);return b?(v.has(b)||v.set(b,b.name),!0):!1};for(let t=-1;t!==v.size;){t=v.size;for(const r of x){if(N(e,r))continue;const o=p(r);o&&v.has(o)&&X(r,o)}}for(const t of x){if(N(e,t))continue;const r=p(t);if(!r||!v.has(r)||X(t,r))continue;const{top:o}=_(e,t),u=v.get(r),g=P.has(r)||r===$?"":" (a local that holds an input or the variable)";s.push(`\`${u}\`${g} is ${ce(e,o)} at line ${f(t)}`)}return s}const j="@/lib/document/render-keep";function de(n,a,e,m){if(!e.includes(m))return!1;const i=n.createSourceFile(a,e,n.ScriptTarget.Latest,!0,a.endsWith(".tsx")?n.ScriptKind.TSX:n.ScriptKind.TS),l=f=>f.some(p=>!p.isTypeOnly&&(p.propertyName??p.name).text==="Render"),x=f=>{if(n.isImportDeclaration(f)&&n.isStringLiteral(f.moduleSpecifier)&&f.moduleSpecifier.text===m){const p=f.importClause;if(!p||p.isTypeOnly)return!1;const h=p.namedBindings;return!!p.name||h!==void 0&&(n.isNamespaceImport(h)||l(h.elements))}if(n.isExportDeclaration(f)&&f.moduleSpecifier&&n.isStringLiteral(f.moduleSpecifier)&&f.moduleSpecifier.text===m){if(f.isTypeOnly)return!1;const p=f.exportClause;return!p||n.isNamespaceExport(p)||l(p.elements)}return n.isCallExpression(f)&&f.arguments.length>0&&n.isStringLiteralLike(f.arguments[0])&&f.arguments[0].text===m&&(f.expression.kind===n.SyntaxKind.ImportKeyword||n.isIdentifier(f.expression)&&f.expression.text==="require")?!0:n.forEachChild(f,x)??!1};return x(i)}const Z=new WeakMap;function ue(n){const a=Z.get(n);if(a)return a;const{check:e,report:m}=U("published mounts fixtures"),i=($,k)=>Q($,k,n),l={call:"publishedPageData",variable:"page",args:"data, metadata",readers:["first"]},x="return <Render config={c} keep={keep} data={page} />;",f=`const page = ${l.call}(data, metadata);`,p="const keep = useRenderKeep();",h=$=>`import { Render } from "efficient-easel/render";
1
+ import{ruleChecks as U}from"./rule.js";import{programOf as ae}from"./support/ts-program.js";function re(n){const a=[];let e=0,m=0;for(let i=0;i<n.length;i++){const l=n[i];"([{".includes(l)?e++:")]}".includes(l)?e--:l===","&&e===0&&(a.push(n.slice(m,i)),m=i+1)}return a.push(n.slice(m)),a.map(i=>i.trim()).filter(i=>i!=="")}const ie=/^[A-Za-z_$][\w$]*$/,oe=/^(?:@\/|\.\.?\/)/;function se(n,a){const e=ae(n,[{path:"mount.tsx",text:a}]);return{sf:e.getSourceFile("/mount.tsx"),checker:e.getTypeChecker()}}function pe(n,a){const e=[],m=i=>{e.push(i),n.forEachChild(i,m)};return m(a),e}function I(n,a){const e=a.parent;return(n.isVariableDeclaration(e)||n.isParameter(e)||n.isBindingElement(e)||n.isFunctionDeclaration(e)||n.isFunctionExpression(e)||n.isClassDeclaration(e)||n.isClassExpression(e)||n.isImportSpecifier(e)||n.isImportClause(e)||n.isNamespaceImport(e)||n.isImportEqualsDeclaration(e))&&e.name===a}function j(n,a){return n.isParenthesizedExpression(a)||n.isAsExpression(a)||n.isNonNullExpression(a)||n.isTypeAssertionExpression(a)||n.isSatisfiesExpression(a)}function le(n,a){for(;a.parent&&j(n,a.parent);)a=a.parent;return a}function _(n,a){let e=a,m=!1;for(;;){e=le(n,e);const i=e.parent;if(i&&(n.isPropertyAccessExpression(i)||n.isElementAccessExpression(i))&&i.expression===e){e=i,m=!0;continue}return{top:e,path:m}}}const H=(n,a)=>n.isBinaryExpression(a)&&(a.operatorToken.kind===n.SyntaxKind.QuestionQuestionToken||a.operatorToken.kind===n.SyntaxKind.BarBarToken);function ce(n,a){const e=a.parent;if(!e)return"used";if(n.isBinaryExpression(e)&&e.left===a&&e.operatorToken.kind>=n.SyntaxKind.FirstAssignment&&e.operatorToken.kind<=n.SyntaxKind.LastAssignment)return"assigned";if((n.isPrefixUnaryExpression(e)||n.isPostfixUnaryExpression(e))&&(e.operator===n.SyntaxKind.PlusPlusToken||e.operator===n.SyntaxKind.MinusMinusToken))return"changed by ++ or --";if(n.isDeleteExpression(e))return"deleted";if(n.isCallExpression(e)&&e.expression===a)return"called, or a method called on it";if(n.isCallExpression(e)||n.isNewExpression(e))return`handed to ${e.expression.getText()}(…)`;if(n.isJsxExpression(e)&&n.isJsxAttribute(e.parent))return`handed to the JSX attribute ${e.parent.name.getText()}`;if(n.isVariableDeclaration(e)||n.isBindingElement(e))return"aliased by a local";if(n.isSpreadElement(e)||n.isSpreadAssignment(e)||n.isJsxSpreadAttribute(e))return"spread";if(n.isForOfStatement(e)||n.isForInStatement(e))return"looped over";for(let m=a;m.parent;m=m.parent){const i=m.parent;if(n.isBinaryExpression(i)){if(i.left===m&&i.operatorToken.kind===n.SyntaxKind.EqualsToken)return"a destructuring target";break}if(!(n.isObjectLiteralExpression(i)||n.isArrayLiteralExpression(i)||n.isPropertyAssignment(i)||n.isShorthandPropertyAssignment(i)||n.isSpreadAssignment(i)||n.isSpreadElement(i)||j(n,i)))break}return`used in a ${n.SyntaxKind[e.kind]} (syntax kind)`}function Q(n,a,e){if(!e)return["the rule was not handed the compiler (`options.ts`)"];const{sf:m,checker:i}=se(e,n),l=pe(e,m),x=l.filter(e.isIdentifier),d=t=>m.getLineAndCharacterOfPosition(t.getStart(m)).line+1,s=t=>e.isShorthandPropertyAssignment(t.parent)&&t.parent.name===t?i.getShorthandAssignmentValueSymbol(t.parent):i.getSymbolAtLocation(t),h=t=>x.filter(r=>r.text===t&&I(e,r)),u=t=>{for(let r=t;r.parent;r=r.parent){const o=r.parent;if(e.isExpressionWithTypeArguments(o)&&o.expression===r)return!1;if(e.isTypeNode(o))return!0}return!1},p=[],c=(t,r,o)=>{const f=l.filter(E=>e.isImportSpecifier(E)&&E.name.text===r),g=f[0],b=g?g.parent.parent.parent.moduleSpecifier.text:"";return f.length!==1?`${t} is not imported once in the mount`:g.propertyName&&g.propertyName.text!==r?`${t} is ${g.propertyName.text} renamed: it is imported by its own name`:g.isTypeOnly||g.parent.parent.isTypeOnly?`${t} is a type-only import`:(o===void 0?!oe.test(b):b!==o)?`${t} comes from "${b}", not ${o===void 0?"a module inside this package":`"${o}"`}`:h(r).length!==1?`${t} is declared again in the mount: it is the imported function`:i.getSymbolAtLocation(g.name)??`${t} has no binding in the mount`},F=h(a.variable);if(F.length!==1)return[`\`${a.variable}\` is declared ${F.length} times, not once`];const A=F[0].parent;if(!e.isVariableDeclaration(A))return[`\`${a.variable}\` is not a variable declaration`];const $=s(F[0]),y=A.initializer;let k=null;const T=c(`the call ${a.call}`,a.call,a.callFrom);if(typeof T=="string"&&p.push(T),!y||!e.isCallExpression(y)||!e.isIdentifier(y.expression)||y.expression.text!==a.call||typeof T!="string"&&s(y.expression)!==T)p.push(`\`${a.variable}\` is not set straight from ${a.call}(…): a pass wraps it, or something follows the call`);else{k=y;const t=n.slice(y.arguments.pos,y.arguments.end).trim();a.args!==void 0&&t!==a.args&&p.push(`${a.call} is handed \`${t}\`, not \`${a.args}\``)}const R=e.findAncestor(A,t=>e.isFunctionDeclaration(t)||e.isFunctionExpression(t)||e.isArrowFunction(t));if(!R||!R.body||A.parent.parent.parent!==R.body)return[...p,`\`${a.variable}\` is not declared at the top level of a component's body`];const C=R.parameters[0]?.name,S=new Map;if(C&&e.isObjectBindingPattern(C))for(const t of C.elements)e.isIdentifier(t.name)&&!t.dotDotDotToken&&S.set(t.name.text,t.name);else p.push("the component does not destructure its props");const B=a.inputs??re(a.args??"").filter(t=>ie.test(t));B.length===0&&p.push(`${a.call}(…) reads no input the rule can check: name the props it reads in \`inputs\`, or bare names in \`args\``);const P=new Set;for(const t of B){const r=S.get(t);if(!r){p.push(`\`${t}\` is not a prop of the component: the call is handed something made in the mount`);continue}h(t).length!==1&&p.push(`\`${t}\` is declared ${h(t).length} times in the file: a second binding would pass for the input`);const o=s(r);o&&P.add(o)}for(const t of x)t.text==="arguments"&&!I(e,t)&&e.findAncestor(t,r=>r===R)&&p.push(`\`arguments\` is used in the component (line ${d(t)}): it is the props by another name`);for(const t of x)(t.text==="eval"||t.text==="Function")&&!I(e,t)&&!u(t)&&!(e.isPropertyAccessExpression(t.parent)&&t.parent.name===t)&&p.push(`\`${t.text}\` is used in the mount file (line ${d(t)}): code run from a string cannot be read`);const z=new Set;for(const t of a.readers??[]){const r=typeof t=="string"?t:t.name,o=c(`the reader ${r}`,r,typeof t=="string"?void 0:t.from);typeof o=="string"?p.push(o):z.add(o)}const Y=t=>{if(!e.isCallExpression(t)||!e.isIdentifier(t.expression))return!1;const r=s(t.expression);return r!==void 0&&z.has(r)};let W=null;const N=l.filter(t=>e.isImportSpecifier(t)&&t.name.text==="Render"),J=a.renderFrom??"efficient-easel/render",ee=N.length===1?N[0].parent.parent.parent.moduleSpecifier.text:"",M=l.filter(t=>e.isImportDeclaration(t)&&e.isStringLiteral(t.moduleSpecifier)&&t.moduleSpecifier.text===J&&!t.importClause?.isTypeOnly).flatMap(t=>{const r=t.importClause;if(!r)return[];const o=r.namedBindings;return[...r.name?[r.name.text]:[],...o&&e.isNamespaceImport(o)?[`* as ${o.name.text}`]:[],...o&&e.isNamedImports(o)?o.elements.filter(f=>!f.isTypeOnly).map(f=>f.propertyName?`${f.propertyName.text} as ${f.name.text}`:f.name.text):[]]});(M.length!==1||M[0]!=="Render")&&p.push(`"${J}" gives this file ${M.length} binding(s) (${M.join(", ")||"none"}), not the one \`Render\``);const q=N.length===1&&!N[0].propertyName&&ee===J?i.getSymbolAtLocation(N[0].name):void 0;if(!q||h("Render").length!==1)p.push(`\`Render\` is not imported once by its own name from "${J}"`);else{const t=x.filter(o=>!I(e,o)&&s(o)===q),r=t.filter(o=>(e.isJsxOpeningElement(o.parent)||e.isJsxSelfClosingElement(o.parent))&&o.parent.tagName===o);if(r.length!==1||t.length!==1)p.push(`\`Render\` is used ${t.length} times, ${r.length} as a tag: one <Render> and no alias`);else{const f=r[0].parent.attributes.properties;f.some(w=>e.isJsxSpreadAttribute(w))&&p.push("the Render tag has a spread attribute, which can hand it another document");const g=f.filter(w=>e.isJsxAttribute(w)&&w.name.getText()==="data"),b=g.length===1?g[0].initializer:void 0,E=b&&e.isJsxExpression(b)?b.expression:void 0;!E||!e.isIdentifier(E)||s(E)!==$?p.push(`the Render tag draws \`${E?E.getText():g.length===1?g[0].getText():"nothing"}\`, not \`${a.variable}\``):W=E;const G=f.filter(w=>e.isJsxAttribute(w)&&w.name.getText()==="keep"),V=G.length===1?G[0].initializer:void 0,K=V&&e.isJsxExpression(V)?V.expression:void 0;if(!K||!e.isIdentifier(K))p.push("the Render tag has no `keep={keep}`: a mount drawn again would remount every slot it holds (lib/document/render-keep)");else{const w=c("the keep hook useRenderKeep","useRenderKeep",a.keepFrom??L);typeof w=="string"&&p.push(w);const D=s(K)?.valueDeclaration;if(!D||!e.isVariableDeclaration(D)||D.parent.parent.parent!==R.body||h(K.text).length!==1)p.push(`\`${K.text}\` (the Render tag's keep) is not declared once at the top level of the component's body: a keep made at module level is shared by every mount and request`);else if(!(e.getCombinedNodeFlags(D)&e.NodeFlags.Const))p.push(`\`${K.text}\` (the Render tag's keep) is not a \`const\`: a keep set again is a new keep`);else{const O=D.initializer;(!O||!e.isCallExpression(O)||O.arguments.length!==0||!e.isIdentifier(O.expression)||typeof w=="string"||s(O.expression)!==w)&&p.push(`\`${K.text}\` is not set straight from useRenderKeep(): a keep made new on each draw keeps nothing`)}}}}const v=new Map;for(const t of P)v.set(t,t.name);$&&v.set($,a.variable);const te=t=>{for(let r=t;r.parent;r=r.parent){const o=r.parent;if(k&&o===k)return k.arguments.some(g=>g===r);if(!(j(e,o)||e.isObjectLiteralExpression(o)||e.isPropertyAssignment(o)&&o.initializer===r||e.isShorthandPropertyAssignment(o)||e.isSpreadAssignment(o)||e.isArrayLiteralExpression(o)||e.isSpreadElement(o)||e.isConditionalExpression(o)&&o.condition!==r||H(e,o)))return!1}return!1},ne=t=>{let r=t,o=!1;for(;;){const f=r.parent;if(!f)return;if(j(e,f))r=f;else if(e.isConditionalExpression(f)&&f.condition!==r)r=f,o=!0;else if(e.isSpreadAssignment(f)&&e.isObjectLiteralExpression(f.parent))r=f.parent,o=!0;else return e.isVariableDeclaration(f)&&f.initializer===r&&e.isIdentifier(f.name)&&o?s(f.name):void 0}},X=(t,r)=>{if(u(t))return!0;const{top:o,path:f}=_(e,t);if(t===W)return!0;let g=o;for(;g.parent&&(j(e,g.parent)||H(e,g.parent));)g=g.parent;if(g.parent&&Y(g.parent)&&g.parent.arguments.some(E=>E===g)||P.has(r)&&te(o))return!0;const b=f?void 0:ne(o);return b?(v.has(b)||v.set(b,b.name),!0):!1};for(let t=-1;t!==v.size;){t=v.size;for(const r of x){if(I(e,r))continue;const o=s(r);o&&v.has(o)&&X(r,o)}}for(const t of x){if(I(e,t))continue;const r=s(t);if(!r||!v.has(r)||X(t,r))continue;const{top:o}=_(e,t),f=v.get(r),g=P.has(r)||r===$?"":" (a local that holds an input or the variable)";p.push(`\`${f}\`${g} is ${ce(e,o)} at line ${d(t)}`)}return p}const L="@/lib/document/render-keep";function de(n,a,e,m){if(!e.includes(m))return!1;const i=n.createSourceFile(a,e,n.ScriptTarget.Latest,!0,/\.[jt]sx$/.test(a)?n.ScriptKind.TSX:/\.[jt]s$/.test(a)?n.ScriptKind.TS:n.ScriptKind.TSX),l=d=>d.some(s=>!s.isTypeOnly&&(s.propertyName??s.name).text==="Render"),x=d=>{if(n.isImportDeclaration(d)&&n.isStringLiteral(d.moduleSpecifier)&&d.moduleSpecifier.text===m){const s=d.importClause;if(!s||s.isTypeOnly)return!1;const h=s.namedBindings;return!!s.name||h!==void 0&&(n.isNamespaceImport(h)||l(h.elements))}if(n.isExportDeclaration(d)&&d.moduleSpecifier&&n.isStringLiteral(d.moduleSpecifier)&&d.moduleSpecifier.text===m){if(d.isTypeOnly)return!1;const s=d.exportClause;return!s||n.isNamespaceExport(s)||l(s.elements)}if(n.isCallExpression(d)&&d.arguments.length>0&&n.isStringLiteralLike(d.arguments[0])&&d.arguments[0].text===m){if(d.expression.kind===n.SyntaxKind.ImportKeyword||n.isIdentifier(d.expression)&&d.expression.text==="require"||n.isPropertyAccessExpression(d.expression)&&d.expression.name.text==="require")return!0;const s=d.expression;if(n.isCallExpression(s)&&n.isIdentifier(s.expression)&&s.expression.text==="createRequire")return!0}return n.forEachChild(d,x)??!1};return x(i)}const Z=new WeakMap;function ue(n){const a=Z.get(n);if(a)return a;const{check:e,report:m}=U("published mounts fixtures"),i=($,y)=>Q($,y,n),l={call:"publishedPageData",variable:"page",args:"data, metadata",readers:["first"]},x="return <Render config={c} keep={keep} data={page} />;",d=`const page = ${l.call}(data, metadata);`,s="const keep = useRenderKeep();",h=$=>`import { Render } from "efficient-easel/render";
2
2
  import { first } from "./first";
3
- import { useRenderKeep } from "${j}";
3
+ import { useRenderKeep } from "${L}";
4
4
  import { ${l.call} } from "./published-passes";
5
5
  export default function P({ data, metadata = {} }: Props) {
6
- ${p}
6
+ ${s}
7
7
  ${$}
8
- }`,d=h(`${f}
9
- ${x}`),s=$=>h(`${$}
10
- ${f}
11
- ${x}`),c=$=>h(`${f}
8
+ }`,u=h(`${d}
9
+ ${x}`),p=$=>h(`${$}
10
+ ${d}
11
+ ${x}`),c=$=>h(`${d}
12
12
  ${$}
13
- ${x}`);e("the one call, drawn, passes",i(d,l).length===0,i(d,l).join("; "));{const $={...l,callFrom:"@/lib/document/published-passes"},k=d.replace('from "./published-passes"',`from "${$.callFrom}"`);e("…the call imported from the module the mount names passes",i(k,$).length===0,i(k,$).join("; ")),e("…and the call imported from another module inside this package fails it",i(d,$).length>0)}e("…a comment naming a wrapper does not fail it",i(`// const page = x(${l.call}(data, metadata));
14
- ${d}`,l).length===0),e("…a path handed to a listed reader does not fail it",i(c("const lead = first(page.content);"),l).length===0),e("…an input spread, and an input as a ternary's last branch, do not fail it",i(c("const facts = ok ? { ...metadata, k: 1 } : metadata;"),l).length===0,i(c("const facts = ok ? { ...metadata, k: 1 } : metadata;"),l).join("; "));{const $="efficient-web-builder/render/lib/document/published-passes",k="efficient-web-builder/render/lib/document/render-keep",y={call:"publishedChromeData",callFrom:$,variable:"data",inputs:["group"],keepFrom:k},T=`import { useRenderKeep } from "${k}";
13
+ ${x}`);e("the one call, drawn, passes",i(u,l).length===0,i(u,l).join("; "));{const $={...l,callFrom:"@/lib/document/published-passes"},y=u.replace('from "./published-passes"',`from "${$.callFrom}"`);e("…the call imported from the module the mount names passes",i(y,$).length===0,i(y,$).join("; ")),e("…and the call imported from another module inside this package fails it",i(u,$).length>0)}e("…a comment naming a wrapper does not fail it",i(`// const page = x(${l.call}(data, metadata));
14
+ ${u}`,l).length===0),e("…a path handed to a listed reader does not fail it",i(c("const lead = first(page.content);"),l).length===0),e("…an input spread, and an input as a ternary's last branch, do not fail it",i(c("const facts = ok ? { ...metadata, k: 1 } : metadata;"),l).length===0,i(c("const facts = ok ? { ...metadata, k: 1 } : metadata;"),l).join("; "));{const $="efficient-web-builder/render/lib/document/published-passes",y="efficient-web-builder/render/lib/document/render-keep",k={call:"publishedChromeData",callFrom:$,variable:"data",inputs:["group"],keepFrom:y},T=`import { useRenderKeep } from "${y}";
15
15
  `,R=`import { Render } from "efficient-easel/render";
16
- ${T}import { ${y.call} } from "${$}";
16
+ ${T}import { ${k.call} } from "${$}";
17
17
  export default function H({ group }: { group: G }) {
18
- const data = ${y.call}({ content: [group] } as unknown as D);
18
+ const data = ${k.call}({ content: [group] } as unknown as D);
19
19
  const keep = useRenderKeep();
20
20
  return <Render config={c} keep={keep} data={data} />;
21
- }`;e("…a chrome mount drawing `data={data}` passes",i(R,y).length===0,i(R,y).join("; ")),e("…and a write into its prop fails it",i(R.replace("const data",`group.props = {};
22
- const data`),y).length>0);const C="<Render config={headerRenderConfig()} keep={keep} data={data} />",S=`import { Render } from "efficient-easel/render";
23
- ${T}import { ${y.call} } from "${$}";
21
+ }`;e("…a chrome mount drawing `data={data}` passes",i(R,k).length===0,i(R,k).join("; ")),e("…and a write into its prop fails it",i(R.replace("const data",`group.props = {};
22
+ const data`),k).length>0);const C="<Render config={headerRenderConfig()} keep={keep} data={data} />",S=`import { Render } from "efficient-easel/render";
23
+ ${T}import { ${k.call} } from "${$}";
24
24
  export default function PublishedHeader({ group }: { group: G }) {
25
- const data = ${y.call}({ root: { props: {} }, content: [group], zones: {} } as unknown as D);
25
+ const data = ${k.call}({ root: { props: {} }, content: [group], zones: {} } as unknown as D);
26
26
  const keep = useRenderKeep();
27
27
  return (
28
28
  <Bar sticky={sticky}>
29
29
  ${C}
30
30
  </Bar>
31
31
  );
32
- }`;e("…a header mount drawing `data={data}` inside a wrapper passes",i(S,y).length===0,i(S,y).join("; "));const B=[["`data` assigned after the call",S.replace(" return (",` data = extra;
32
+ }`;e("…a header mount drawing `data={data}` inside a wrapper passes",i(S,k).length===0,i(S,k).join("; "));const B=[["`data` assigned after the call",S.replace(" return (",` data = extra;
33
33
  return (`)],["a property write on `data`",S.replace(" return (",` data.content = [];
34
34
  return (`)],["a second Render with `data={data}` and a spread",S.replace(C,`${C}
35
- <Render data={data} {...extra} />`)],["its call imported from another module",S.replace(`from "${$}"`,'from "./published-passes"')],["no keep on the tag",S.replace(" keep={keep}","")],["its keep hook imported from another module",S.replace(`from "${k}"`,'from "./render-keep"')]];for(const[P,z]of B)e(`…${P} fails it`,i(z,y).length>0)}const K=[["a wrapping pass",h(`const page = extra(${l.call}(data, metadata));
35
+ <Render data={data} {...extra} />`)],["its call imported from another module",S.replace(`from "${$}"`,'from "./published-passes"')],["no keep on the tag",S.replace(" keep={keep}","")],["its keep hook imported from another module",S.replace(`from "${y}"`,'from "./render-keep"')]];for(const[P,z]of B)e(`…${P} fails it`,i(z,k).length>0)}const F=[["a wrapping pass",h(`const page = extra(${l.call}(data, metadata));
36
36
  ${x}`)],["a pass after the call",h(`const page = ${l.call}(data, metadata).x;
37
37
  ${x}`)],["a reassignment",h(`let page = ${l.call}(data, metadata);
38
38
  page = extra(page);
39
- ${x}`)],["a pass in the Render prop",h(`${f}
39
+ ${x}`)],["a pass in the Render prop",h(`${d}
40
40
  return <Render data={extra(page)} />;`)],["other arguments",h(`const page = ${l.call}(extra(data), metadata);
41
- ${x}`)],["no call at all",h(x)],["a pass on the input before the call",s("data = extra(data);")],["a compound assignment to the input",s("metadata ??= {};")],["an increment of the input",s("data++;")],["a destructured reassignment of the input",s("({ data } = extra({ data }));")],["an array reassignment of the input",s("[data, metadata] = extra([data, metadata]);")],["a local shadowing the input",s("{ const data = extra(0); }")],["a rebuilt argument named as the args",h(`const d = extra(data);
41
+ ${x}`)],["no call at all",h(x)],["a pass on the input before the call",p("data = extra(data);")],["a compound assignment to the input",p("metadata ??= {};")],["an increment of the input",p("data++;")],["a destructured reassignment of the input",p("({ data } = extra({ data }));")],["an array reassignment of the input",p("[data, metadata] = extra([data, metadata]);")],["a local shadowing the input",p("{ const data = extra(0); }")],["a rebuilt argument named as the args",h(`const d = extra(data);
42
42
  const page = ${l.call}(d, metadata);
43
43
  ${x}`),{...l,args:"d, metadata"}],["an argument that is no prop at all",`const page = ${l.call}(data, metadata);
44
- ${x}`],["a property write",c("page.content = extra(page.content);")],["a deep property write",c("page.root.props = {};")],["a compound property write",c("page.count += 1;")],["a bracket write",c('page["content"] = [];')],["an optional-path write",c("page.root!.props = {};")],["a delete",c("delete page.root;")],["Object.assign into it",c("Object.assign(page, extra(page));")],["the variable handed whole to a call",c("mutate(page);")],["the variable aliased",c("const shown = page;")],["a push on a path from it",c("page.content.push(extra(0));")],["a splice on an optional path from it",c("page.content?.splice(0, 1);")],["a sort on a bracket path from it",c('page["content"].sort();')],["an input handed to a pass through a cast",s("inPlacePass(data as Doc);")],["an input handed whole to a call",s("mutate(data);")],["a push through a cast of an input",s("(data as Doc).content.push(x);")],["a property write through a cast of an input",s("(metadata as any).x = 1;")],["a property write through an old-style cast",s("(<any>metadata).x = 1;")],["a property write through a non-null input",s("(metadata!).x = 1;")],["a push on a non-null input",s("data!.content.push(x);")],["an input aliased through a cast, then written",s(`const d = data as any;
45
- d.content = [];`)],["an input aliased",s("const d = data;")],["an input path aliased",s("const p = metadata.facts;")],["a path value bound to a local",c("const one = page.content.length === 1;")],["a path alias pushed into",c(`const c = page.content;
44
+ ${x}`],["a property write",c("page.content = extra(page.content);")],["a deep property write",c("page.root.props = {};")],["a compound property write",c("page.count += 1;")],["a bracket write",c('page["content"] = [];')],["an optional-path write",c("page.root!.props = {};")],["a delete",c("delete page.root;")],["Object.assign into it",c("Object.assign(page, extra(page));")],["the variable handed whole to a call",c("mutate(page);")],["the variable aliased",c("const shown = page;")],["a push on a path from it",c("page.content.push(extra(0));")],["a splice on an optional path from it",c("page.content?.splice(0, 1);")],["a sort on a bracket path from it",c('page["content"].sort();')],["an input handed to a pass through a cast",p("inPlacePass(data as Doc);")],["an input handed whole to a call",p("mutate(data);")],["a push through a cast of an input",p("(data as Doc).content.push(x);")],["a property write through a cast of an input",p("(metadata as any).x = 1;")],["a property write through an old-style cast",p("(<any>metadata).x = 1;")],["a property write through a non-null input",p("(metadata!).x = 1;")],["a push on a non-null input",p("data!.content.push(x);")],["an input aliased through a cast, then written",p(`const d = data as any;
45
+ d.content = [];`)],["an input aliased",p("const d = data;")],["an input path aliased",p("const p = metadata.facts;")],["a path value bound to a local",c("const one = page.content.length === 1;")],["a path alias pushed into",c(`const c = page.content;
46
46
  c.push(x);`)],["a path alias written",c(`const r = page.root;
47
47
  r.props = {};`)],["a path assigned to a let",c(`let c;
48
48
  c = page.content;`)],["a path handed to a writing call",c("mutate(page.content);")],["a path's forEach writing",c("page.content.forEach((s) => { s.props = {}; });")],["a path's for-of writing",c("for (const s of page.content) s.props.x = 1;")],["a path in an array literal",c("const all = [page.content];")],["the variable spread into a copy",c(`const copy = { ...page };
49
- copy.content.push(x);`)],["a path handed to a method that shares a reader's name",c("evil.first(page.content);")],["a local from an input's ternary branch, written through a cast",s(`const f = ok ? {} : metadata;
50
- (f as any).x = 1;`)],["a local from an input's ternary branch, handed to a call",s(`const f = ok ? {} : metadata;
51
- mutate(f);`)],["an input assigned an object with no space",s("data={content: [], root: {}};")],["an input assigned a cast object with no space",s("data={ content: [] } as unknown;")],["a second input assigned with no space",s("metadata={k: 1};")],["an input assigned a string with no space",s('data="";')],["the variable assigned with no space",c("page={content: [], root:{props:{}}} as any;")],["a spread copy of an input, written deep",s(`const copy: any = { ...metadata };
52
- copy.theme.x = 1;`)],["a spread copy of an input, handed to a call",s(`const copy = { ...metadata };
53
- mutate(copy);`)],["a reader declared in the mount",`${d}
54
- function first(x) { x.content = []; }`],["a reader declared as a local arrow",`${d}
55
- const first = (x) => { x.content = []; };`],["a reader that is not imported",d.replace(`import { first } from "./first";
56
- `,"")],["eval",c('eval("page.content = []");')],["new Function",c('new Function("p", "p.content = []")(page);')],["Function called",c('Function("p", "p.content = []");')],["a call in a class extends clause",c("class W extends (mutate(page), Object) {}")],["a call in an instantiation expression",c("const g = (mutate(page), id)<number>;")],["a Render from another module",d.replace('from "efficient-easel/render"','from "./fake-render"')],["a second Render import, renamed",d.replace('import { Render } from "efficient-easel/render";',`import { Render } from "efficient-easel/render";
57
- import { Render as Second } from "efficient-easel/render";`)],["a namespace import of Render's module",d.replace('import { Render } from "efficient-easel/render";',`import { Render } from "efficient-easel/render";
58
- import * as E from "efficient-easel/render";`)],["a default import of Render's module",d.replace('import { Render } from "efficient-easel/render";',`import { Render } from "efficient-easel/render";
59
- import E from "efficient-easel/render";`)],["the call declared in the mount, not imported",`${d.replace(`import { ${l.call} } from "./published-passes";
49
+ copy.content.push(x);`)],["a path handed to a method that shares a reader's name",c("evil.first(page.content);")],["a local from an input's ternary branch, written through a cast",p(`const f = ok ? {} : metadata;
50
+ (f as any).x = 1;`)],["a local from an input's ternary branch, handed to a call",p(`const f = ok ? {} : metadata;
51
+ mutate(f);`)],["an input assigned an object with no space",p("data={content: [], root: {}};")],["an input assigned a cast object with no space",p("data={ content: [] } as unknown;")],["a second input assigned with no space",p("metadata={k: 1};")],["an input assigned a string with no space",p('data="";')],["the variable assigned with no space",c("page={content: [], root:{props:{}}} as any;")],["a spread copy of an input, written deep",p(`const copy: any = { ...metadata };
52
+ copy.theme.x = 1;`)],["a spread copy of an input, handed to a call",p(`const copy = { ...metadata };
53
+ mutate(copy);`)],["a reader declared in the mount",`${u}
54
+ function first(x) { x.content = []; }`],["a reader declared as a local arrow",`${u}
55
+ const first = (x) => { x.content = []; };`],["a reader that is not imported",u.replace(`import { first } from "./first";
56
+ `,"")],["eval",c('eval("page.content = []");')],["new Function",c('new Function("p", "p.content = []")(page);')],["Function called",c('Function("p", "p.content = []");')],["a call in a class extends clause",c("class W extends (mutate(page), Object) {}")],["a call in an instantiation expression",c("const g = (mutate(page), id)<number>;")],["a Render from another module",u.replace('from "efficient-easel/render"','from "./fake-render"')],["a second Render import, renamed",u.replace('import { Render } from "efficient-easel/render";',`import { Render } from "efficient-easel/render";
57
+ import { Render as Second } from "efficient-easel/render";`)],["a namespace import of Render's module",u.replace('import { Render } from "efficient-easel/render";',`import { Render } from "efficient-easel/render";
58
+ import * as E from "efficient-easel/render";`)],["a default import of Render's module",u.replace('import { Render } from "efficient-easel/render";',`import { Render } from "efficient-easel/render";
59
+ import E from "efficient-easel/render";`)],["the call declared in the mount, not imported",`${u.replace(`import { ${l.call} } from "./published-passes";
60
60
  `,"")}
61
- function ${l.call}(d, m) { const x: any = d; x.content = []; return x; }`],["the call declared again beside its import",`${d}
62
- function ${l.call}(d, m) { return d; }`],["the call imported from outside this package",d.replace('from "./published-passes"','from "evil-passes"')],["another function imported as the call",d.replace(`import { ${l.call} }`,`import { evilPass as ${l.call} }`)],["the call as a type-only import",d.replace(`import { ${l.call} }`,`import type { ${l.call} }`)],["no keep on the tag",d.replace(" keep={keep}","")],["a keep made at module level",d.replace(`${p}
61
+ function ${l.call}(d, m) { const x: any = d; x.content = []; return x; }`],["the call declared again beside its import",`${u}
62
+ function ${l.call}(d, m) { return d; }`],["the call imported from outside this package",u.replace('from "./published-passes"','from "evil-passes"')],["another function imported as the call",u.replace(`import { ${l.call} }`,`import { evilPass as ${l.call} }`)],["the call as a type-only import",u.replace(`import { ${l.call} }`,`import type { ${l.call} }`)],["no keep on the tag",u.replace(" keep={keep}","")],["a keep made at module level",u.replace(`${s}
63
63
  `,"").replace("export default function",`const keep = createRenderKeep();
64
- export default function`)],["a keep made new on each draw",d.replace(p,"const keep = createRenderKeep();")],["a keep wrapped in a call",d.replace(p,"const keep = other(useRenderKeep());")],["a keep set again",d.replace(p,`let keep = useRenderKeep();
65
- keep = createRenderKeep();`)],["a keep hook declared in the mount",`${d.replace(`import { useRenderKeep } from "${j}";
64
+ export default function`)],["a keep made new on each draw",u.replace(s,"const keep = createRenderKeep();")],["a keep wrapped in a call",u.replace(s,"const keep = other(useRenderKeep());")],["a keep set again",u.replace(s,`let keep = useRenderKeep();
65
+ keep = createRenderKeep();`)],["a keep hook declared in the mount",`${u.replace(`import { useRenderKeep } from "${L}";
66
66
  `,"")}
67
- function useRenderKeep() { return new WeakMap(); }`],["a keep hook from outside this package",d.replace(`from "${j}"`,'from "evil-keep"')],["a keep hook from another module of this package",d.replace(`from "${j}"`,'from "./render-keep"')],["a call with no input it can check",h(`const page = ${l.call}({ ...data });
68
- ${x}`),{call:l.call,variable:"page",args:"{ ...data }"}],["a call with no args and no inputs named",d,{call:l.call,variable:"page"}]];for(const[$,k,y]of K)e(`…${$} fails it`,i(k,y??l).length>0);const A=m().checks;return Z.set(n,A),A}function ge(n,a){const{check:e,report:m}=U("published mounts"),i=a.ts;if(!e("the rule is handed the compiler (`options.ts`)",i!==void 0,"a host passes `ts` from its own typescript"))return m();for(const p of ue(i))e(p.name,p.ok,p.detail);const l=n.filter(p=>/\.tsx?$/.test(p.path));e(`the source scan reached the tree (${l.length} TS/TSX files, at least ${a.minFiles})`,l.length>=a.minFiles);const x=Object.keys(a.mounts);e("at least one published mount is named",x.length>0);const f=new Set(x.map(p=>a.mounts[p].renderFrom??"efficient-easel/render"));for(const p of l)!x.includes(p.path)&&[...f].some(h=>de(i,p.path,p.text,h))&&e(`${p.path} draws easel Render: it is a named published mount (a row), or the rule never reads it`,!1,"add its row to the mounts this repository names");for(const p of x){const h=l.find(s=>s.path===p);if(!e(`${p} is here`,h!==void 0,"a stale row would shelter nothing"))continue;const d=Q(h.text,a.mounts[p],i);e(`${p} draws exactly what ${a.mounts[p].call} returns — a pass belongs in lib/document/published-passes`,d.length===0,d.join("; "))}return m()}export{Q as mountProblems,ge as publishedMounts};
67
+ function useRenderKeep() { return new WeakMap(); }`],["a keep hook from outside this package",u.replace(`from "${L}"`,'from "evil-keep"')],["a keep hook from another module of this package",u.replace(`from "${L}"`,'from "./render-keep"')],["a call with no input it can check",h(`const page = ${l.call}({ ...data });
68
+ ${x}`),{call:l.call,variable:"page",args:"{ ...data }"}],["a call with no args and no inputs named",u,{call:l.call,variable:"page"}]];for(const[$,y,k]of F)e(`…${$} fails it`,i(y,k??l).length>0);const A=m().checks;return Z.set(n,A),A}function ge(n,a){const{check:e,report:m}=U("published mounts"),i=a.ts;if(!e("the rule is handed the compiler (`options.ts`)",i!==void 0,"a host passes `ts` from its own typescript"))return m();for(const s of ue(i))e(s.name,s.ok,s.detail);const l=n.filter(s=>/\.[jt]sx?$/.test(s.path));e(`the source scan reached the tree (${l.length} TS/TSX files, at least ${a.minFiles})`,l.length>=a.minFiles);const x=Object.keys(a.mounts);e("at least one published mount is named",x.length>0);const d=new Set(x.map(s=>a.mounts[s].renderFrom??"efficient-easel/render"));for(const s of l)!x.includes(s.path)&&[...d].some(h=>de(i,s.path,s.text,h))&&e(`${s.path} draws easel Render: it is a named published mount (a row), or the rule never reads it`,!1,"add its row to the mounts this repository names");for(const s of x){const h=l.find(p=>p.path===s);if(!e(`${s} is here`,h!==void 0,"a stale row would shelter nothing"))continue;const u=Q(h.text,a.mounts[s],i);e(`${s} draws exactly what ${a.mounts[s].call} returns — a pass belongs in lib/document/published-passes`,u.length===0,u.join("; "))}return m()}export{Q as mountProblems,ge as publishedMounts};