efficient-web-builder 74.7.0 → 74.9.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 +46 -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 +11 -3
  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
@@ -0,0 +1 @@
1
+ import{frameAt as B}from"../../../render/lib/content/section-padding.js";import{ownEntry as D}from"../../../format/lib/own-entry.js";const Z=/^(?:[^\s]*:)?p[ytb]-/,T=/(^|;)\s*padding-(top|bottom)\s*:/,z=/^p[ytb]-0$/,J={sectionPaddingTop:40,sectionPaddingBottom:50,sectionPaddingTopTablet:30,sectionPaddingBottomTablet:36,sectionPaddingTopPhone:20,sectionPaddingBottomPhone:24,padTotal:["sectionPaddingTop","sectionPaddingBottom","sectionPaddingTopTablet","sectionPaddingBottomTablet","sectionPaddingTopPhone","sectionPaddingBottomPhone"]};function K(t){const o=/^([pm])([ytb])-(?:(\d+(?:\.\d+)?)|\[(\d+(?:\.\d+)?)px\])$/.exec(t);return o?{kind:o[1],side:o[2],px:o[3]!==void 0?Number(o[3])*4:Number(o[4])}:null}const y=t=>(t.getAttribute("class")??"").split(/\s+/).filter(Boolean),a=t=>t.getAttribute("style")??"",Q=(t,o)=>new RegExp(`(?:^|;)\\s*padding-${o==="t"?"top":"bottom"}\\s*:\\s*(\\d+(?:\\.\\d+)?)px`).exec(a(t)),H={desktop:1440,tablet:1099,mobile:390},V={"view-desktop":1100,"view-wide":800,"view-tablet":720,sm:640,md:768,lg:1024,xl:1280,"2xl":1536},q=/^max-(?:\[(\d+)px\]|(.+))$/,F=/^@(?:(max-|min-)?\[(\d+)px\])$/,W=t=>{const o=q.exec(t);return o?o[1]!==void 0?Number(o[1]):D(V,o[2]):void 0};function U(t,o){const c=F.exec(t);if(c)return c[1]==="max-"?o<Number(c[2]):o>=Number(c[2]);if(q.test(t)){const $=W(t);return $===void 0?void 0:o<$}const i=/^(?:min-\[(\d+)px\]|(.+))$/.exec(t),b=i?.[1]!==void 0?Number(i[1]):D(V,i?.[2]??"");return b===void 0?void 0:o>=b}function tt(t,o,c,i){const b=t.split(":"),$=K(b.pop()??"");if(!$)return null;let m=0;for(const d of b){const w=(d==="first"?!c.previousElementSibling:d==="last"?!c.nextElementSibling:void 0)??U(d,o);if(w===void 0)return i.push(t),null;if(!w)return null;const e=F.exec(d),l=e?e[1]==="max-"?Number(e[2]):void 0:W(d);m+=1+(l!==void 0?1/(1+l):0)}return{...$,rank:m}}function L(t,o,c,i,b=!1){let $=0;const m=[];for(let d=t;d;d=o==="t"?d.firstElementChild:d.lastElementChild){const E=Q(d,o);let w={px:E?Number(E[1]):0,rank:E?1/0:-1},e={px:0,rank:-1};for(const x of y(d)){const f=tt(x,c,d,i);!f||f.side!=="y"&&f.side!==o||(f.kind==="m"?e=f.rank>=e.rank?f:e:w=f.rank>=w.rank?f:w)}const l=(b&&d===t?0:w.px)+e.px;l&&m.push(`${d.tagName.toLowerCase()}:${l}`),$+=l}return{sum:$,seen:m.join(" > ")}}const X=(t,o,c=[])=>L(t,o,H.desktop,c),et=(t,o,c,i)=>t-c>=0&&o-i===t-c,R=t=>Z.test(t)&&!z.test(t);function it(t){const o=[];let c=0;const i=(e,l,x="")=>{c++,e||o.push(`${l}${x?` — ${x.slice(0,600)}`:""}`)},b=t.innerRoom??{},$=t.defaultsOf??(()=>({})),m=[],d=e=>t.sectionOf(e)?.querySelectorAll("*").length??0,E=t.types.filter(e=>{const l=t.draw(e,{sectionPaddingTop:40});return l.includes("sf-section-pad")&&d(l)===d(t.draw(e,{}))+1}),w=[];for(const e of E){const l=t.frameOf(e),x=t.draw(e,J),f=t.sectionOf(x);if(!f){i(!1,`§2 ${e}: draws`,x.slice(0,200));continue}const k=Array.from(f.querySelectorAll("*")),A=k.filter(n=>y(n).includes("sf-section-pad")&&!n.parentElement?.closest("section")),G=Array.from(t.sectionOf(t.draw(e,{}))?.querySelectorAll("*")??[]).some(n=>y(n).some(R)||T.test(a(n))),v=Object.prototype.hasOwnProperty.call(b,e);if(v&&i(typeof l!="function",`§1 ${e}: its padding is a column's (${b[e]}), so it declares no frame`),!G||v){i(A.length===1&&/padding-top\s*:\s*40px/.test(a(A[0])),`§2 ${e}: no padding of its own, so the wrapper draws the total once`,x.slice(0,300));continue}i(typeof l=="function",`§1 ${e}: has padding of its own, so it declares its own frame (the builder's table, or its meta's ownPad)`),w.push(e),i(A.every(n=>!T.test(a(n))),`§2 ${e}: no outer wrapper draws a top or bottom`,A.map(a).join(" | "));const N=k.filter(n=>/(^|;)\s*padding-top\s*:\s*40px/.test(a(n))),C=k.filter(n=>/(^|;)\s*padding-bottom\s*:\s*50px/.test(a(n)));i(N.length===1,`§2 ${e}: ONE element draws the total top 40`,`${N.length} found`),i(C.length===1,`§2 ${e}: ONE element draws the total bottom 50`,`${C.length} found`);const u=N[0],g=C[0];if(!u||!g)continue;if(u!==g){const n=(p,r)=>{for(let s=f;s;s=r==="t"?s.firstElementChild:s.lastElementChild)if(s===p)return!0;return!1};i(n(u,"t")&&n(g,"b"),`§2 ${e}: a split total draws its top on the section's first part and its bottom on its last part`,`${u.tagName.toLowerCase()} / ${g.tagName.toLowerCase()}`)}i(/--sf-pad-t-tablet\s*:\s*30px/.test(a(u))&&/--sf-pad-b-tablet\s*:\s*36px/.test(a(g)),`§2 ${e}: …its tablet 30 / 36`,`${a(u)} | ${a(g)}`),i(/--sf-pad-t-phone\s*:\s*20px/.test(a(u))&&/--sf-pad-b-phone\s*:\s*24px/.test(a(g)),`§2 ${e}: …its phone 20 / 24`,`${a(u)} | ${a(g)}`);const I={t:u,b:g};for(const n of new Set([u,g])){const p=y(n).filter(R);i(p.length===0,`§2 ${e}: the padded element keeps no vertical padding class`,p.join(" "));const r=[];for(let s=n.parentElement;s&&s!==f;s=s.parentElement){const h=y(s).filter(R);(h.length||T.test(a(s)))&&r.push(`${s.tagName.toLowerCase()}[${h.join(" ")}${T.test(a(s))?` style=${a(s)}`:""}]`)}i(r.length===0,`§2 ${e}: nothing between the section's edge and the padded element pads`,r.join(" > "))}if(typeof l!="function")continue;const M=t.sectionOf(t.draw(e,{})),_=n=>{const p=[];for(let s=n;s&&s!==f;s=s.parentElement)p.unshift(Array.from(s.parentElement?.children??[]).indexOf(s));let r=M;for(const s of p)r=r?.children[s];return r},O={t:_(u),b:_(g)};if(!O.t||!O.b){i(!1,`§3 ${e}: the padded element is drawn with nothing stored`);continue}const P=l({...$(e),editor:{isEditing:!0}}),Y=typeof P=="object"&&P!==null&&"top"in P,j=n=>Y?P[n==="t"?"top":"bottom"]:P;for(const[n,p]of[["t",40],["b",50]]){const r=B(j(n),"desktop"),s=X(O[n],n,m),h=X(I[n],n,m);i(et(s.sum,h.sum,r,p),`§3 ${e}: the ${n==="t"?"top":"bottom"} edge draws its frame ${r} once, and a total in its place`,`nothing stored ${s.sum} (${s.seen}); total ${p} draws ${h.sum} (${h.seen})`)}for(const n of["tablet","mobile"]){const p=(t.views??H)[n];for(const r of["t","b"]){const s=B(j(r),n),h=L(O[r],r,p,m),S=L(I[r],r,p,m,!0);i(h.sum-s===S.sum,`§3 ${e} ${n}: the ${r==="t"?"top":"bottom"} edge at ${p}px draws its frame ${s} once`,`nothing stored ${h.sum} (${h.seen}); content under the total ${S.sum} (${S.seen})`)}}}return i(m.length===0,"§3 every view prefix on an edge line is one the rule reads",[...new Set(m)].join(" ")),{wrapped:E,owns:w,checks:c,failures:o}}export{et as edgeHolds,X as edgeLine,L as edgeLineAt,it as sectionOnePadding};
@@ -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};