efficient-web-builder 67.2.0 → 67.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +19 -0
- package/dist/editor/components/useSectionToBoxPass.d.ts +4 -0
- package/dist/editor/components/useSectionToBoxPass.js +1 -1
- package/dist/editor/lib/document/add-palette.js +1 -1
- package/dist/editor/lib/document/add-target.js +1 -1
- package/dist/editor/lib/document/block-offer.js +1 -1
- package/dist/editor/lib/document/blocks/shared-fields.js +1 -1
- package/dist/editor/lib/document/controls.js +1 -1
- package/dist/editor/lib/document/field-groups.js +1 -1
- package/dist/editor/lib/document/heading-outline.js +1 -1
- package/dist/editor/lib/document/slot-new-children.js +1 -1
- package/dist/editor/lib/host-document-bridge.js +1 -1
- package/dist/editor/lib/sections/city-presets.js +1 -1
- package/dist/editor/lib/sections/new-section-node.js +1 -1
- package/dist/editor/lib/sections/section-dry-run.js +2 -2
- package/dist/editor/lib/sections/text-layouts.js +1 -1
- package/dist/format/lib/content/box-layout.js +1 -1
- package/dist/format/lib/content/mirror-cards.js +1 -1
- package/dist/format/lib/content/section-width.js +1 -1
- package/dist/format/lib/document/box-footer.js +1 -1
- package/dist/format/lib/document/container-blocks.js +1 -1
- package/dist/format/lib/document/media-drop.js +1 -1
- package/dist/format/lib/document/part-inks.js +1 -1
- package/dist/format/lib/document/part-records.js +1 -1
- package/dist/format/lib/document/passes/catalogue-labels.js +1 -1
- package/dist/format/lib/document/passes/media-values.js +1 -1
- package/dist/format/lib/document/row-hand.js +1 -1
- package/dist/format/lib/document/section-catalog.js +3 -3
- package/dist/format/lib/document/source-bound-parts.js +1 -1
- package/dist/format/lib/document/templateFields.js +1 -1
- package/dist/format/lib/document/theme-slots.js +1 -1
- package/dist/format/lib/editor-words.js +1 -1
- package/dist/format/lib/logo/logo-size.d.ts +5 -0
- package/dist/format/lib/logo/logo-size.js +1 -1
- package/dist/format/lib/own-entry.d.ts +2 -0
- package/dist/format/lib/own-entry.js +1 -0
- package/dist/format/lib/preview-header-settings.d.ts +3 -0
- package/dist/format/lib/sections/active-press-context.js +1 -1
- package/dist/format/lib/sections/hero-single-to-hero.js +1 -1
- package/dist/format/lib/sections/section-eyebrow-look.js +1 -1
- package/dist/format/lib/sections/section-head-placement.js +1 -1
- package/dist/format/lib/sections/section-presets.d.ts +2 -0
- package/dist/format/lib/sections/section-presets.js +1 -1
- package/dist/format/lib/sections/section-text-kinds.js +1 -1
- package/dist/format/lib/sections/section-text-regions.js +1 -1
- package/dist/format/lib/source-rules/editor-words.js +3 -3
- package/dist/format/lib/source-rules/import-time-work.js +4 -4
- package/dist/format/lib/source-rules/own-key-reads.d.ts +26 -0
- package/dist/format/lib/source-rules/own-key-reads.js +7 -0
- package/dist/render/components/Logo.d.ts +2 -1
- package/dist/render/components/Logo.js +1 -1
- package/dist/render/lib/document/blocks/general/section-head-looks.js +2 -2
- package/dist/render/lib/document/blocks/general/section-to-box-row-parts.js +1 -1
- package/dist/render/lib/document/blocks/general/section-to-box-rows-head.js +1 -1
- package/dist/render/lib/document/head-core-boxes.js +1 -1
- package/dist/render/lib/document/migrate-legacy.js +1 -1
- package/dist/render/lib/document/part-styles.js +2 -2
- package/dist/render/lib/document/passes/section-animation.js +1 -1
- package/dist/render/lib/document/passes/section-padding.js +1 -1
- package/dist/render/lib/document/passes/section-width.js +1 -1
- package/dist/render/lib/document/slot-counts.js +1 -1
- package/dist/render/lib/document/slot-specs.js +1 -1
- package/dist/render/lib/sections/section-to-box.js +1 -1
- package/package.json +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
import{ENTRANCE_STORE_KEYS as y,LEGACY_ENTRANCE_KEY as m}from"../animation/entrance-keys.js";import{SCROLL_STORE_KEYS as S}from"../animation/scroll.js";import{PICTURE_DOTS as E,viewFocusKeys as
|
|
1
|
+
import{ENTRANCE_STORE_KEYS as y,LEGACY_ENTRANCE_KEY as m}from"../animation/entrance-keys.js";import{SCROLL_STORE_KEYS as S}from"../animation/scroll.js";import{PICTURE_DOTS as E,viewFocusKeys as f}from"../content/picture-focus-rows.js";import{SECTION_PIN_KEYS as u}from"../content/section-sticky.js";import{SECTION_CORNERS_ROW as v}from"../content/section-corners.js";import{SECTION_BORDER_UNIT_KEYS as T}from"../content/borders.js";import{SECTION_WIDTH_KEYS as _}from"../content/section-width.js";import{DEFAULT_TINT as O}from"../content/tint.js";import{finiteNumber as b}from"../finite-number.js";import{nonEmptyString as a}from"../non-empty-string.js";import{DEFAULT_OVERLAY_POSITION as w}from"./hero-overlay.js";import{normaliseVideoSource as g}from"../hero-video.js";import{VIEW_HIDE_KEYS as H}from"../content/view-hide-class.js";import{ownEntry as x}from"../own-entry.js";const C=50,d=["mediaImage","mediaVideo","poster","tintColor","mediaLayout","mediaLayoutPhone","mediaImage2","tintColor2","tintOpacity2","videoSource","youtubeUrl","videoPlayback","_partMotion",...E.filter(r=>r.block==="HeroSingle").flatMap(r=>f(r.focus))],I=["heightDesktop","heightMobile","heightFixed","heightFixedTablet","heightFixedMobile","sectionCorners",v.unitKey,"sectionCornerSides","sectionBorder","sectionBorderTablet","sectionBorderPhone",...T,"sectionAccent",...u,"anchor",...y,m,...S,...Object.values(_),...H],k=new Set(I),R="the Hero does not read this key as a section setting (only the section pass rows both heroes share carry), so it is not copied",N={eyebrow:"the single Hero stopped drawing its own copy on 2026-09-09 (owner: delete the old text); the words are blocks in its boxes, which the slide keeps",titleTop:"the single Hero stopped drawing its own copy on 2026-09-09 (owner: delete the old text); the words are blocks in its boxes, which the slide keeps",titleLevel:"it set the level of the copy the single Hero stopped drawing on 2026-09-09; a Text block in a box sets its own level",alignment:"its row was deleted on 2026-09-09 with the copy it placed; a box places itself on nine anchors, and the value was drawn by nothing"};function j(r){const e=r.props,p=a(e.id)??"HeroSingle",i=[],n=[],t={id:`${p}~slide`},s={id:`${p}~hero`};t.mediaType=e.mediaType==="video"?"video":"image","mediaType"in e&&i.push({key:"mediaType",home:"HeroSlide.mediaType"}),t.mediaType==="video"&&g(e.videoSource)==="upload"&&(t.videoSpeed=C);for(const o of d)o in e&&(t[o]=e[o],i.push({key:o,home:`HeroSlide.${o}`}));"tintOpacity"in e&&(t.overlay=e.tintOpacity,i.push({key:"tintOpacity",home:"HeroSlide.overlay (Image tint)"})),t.overlayColor=a(e.overlayColor)??O,t.overlayPosition=a(e.overlayPosition)??w,"overlayColor"in e&&i.push({key:"overlayColor",home:"HeroSlide.overlayColor"}),"overlayPosition"in e&&i.push({key:"overlayPosition",home:"HeroSlide.overlayPosition"}),Array.isArray(e.boxes)?(t.groups=e.boxes,i.push({key:"boxes",home:"HeroSlide.groups (the same HeroGroup boxes)"})):"boxes"in e&&i.push({key:"boxes",home:"HeroSlide.groups (none stored)"}),s.textureOpacity=b(e.overlay)??100,"overlay"in e&&i.push({key:"overlay",home:"Hero.textureOpacity (the ramp's opacity)"}),s.showTicker=!1;const h=new Set(["id","mediaType","tintOpacity","overlay","overlayColor","overlayPosition","boxes",...d]);for(const[o,c]of Object.entries(e)){if(h.has(o))continue;const l=x(N,o);if(l!==void 0){n.push({key:o,why:l});continue}if(!k.has(o)){n.push({key:o,why:R});continue}s[o]=c,i.push({key:o,home:`Hero.${o} (section pass)`})}return s.slides=[{type:"HeroSlide",props:t}],{node:{type:"Hero",props:s},carried:i,dropped:n}}export{I as HERO_SECTION_PASS_KEYS,j as heroSingleToHero};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{parseOption as o}from"../parse-option.js";const
|
|
1
|
+
import{parseOption as o}from"../parse-option.js";import{ownEntry as t}from"../own-entry.js";const l="plain",r=[{label:"Plain",value:"plain"},{label:"Filled",value:"filled"},{label:"Line",value:"line"}],E="line",O={KeyFeatures:"filled"};function i(e){return t(O,e)??l}function L(e,n){return o(r,i(n),e)}function _(e){return o(r,E,e)}export{E as DEFAULT_EYEBROW_BLOCK_LOOK,l as DEFAULT_SECTION_EYEBROW_LOOK,O as SECTION_EYEBROW_DEFAULTS,r as SECTION_EYEBROW_LOOK_OPTIONS,i as eyebrowLookFor,_ as parseEyebrowBlockLook,L as parseSectionEyebrowLook};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{parseOption as n}from"../parse-option.js";import{withRowsShownWhen as o}from"../document/show-when-attach.js";import{nonEmptyString as d}from"../non-empty-string.js";const
|
|
1
|
+
import{parseOption as n}from"../parse-option.js";import{withRowsShownWhen as o}from"../document/show-when-attach.js";import{nonEmptyString as d}from"../non-empty-string.js";import{hasOwnEntry as l}from"../own-entry.js";const a="inline",s=[{label:"In this section",value:"inline"},{label:"In its own box",value:"own-box"}];function y(e){return[e.num,e.title,e.description,e.linkProp].filter(t=>d(t)!==void 0)}const p={ProductGrid:{num:"num",title:"title",description:"description",headRows:["num","title","titleSize","description","linkText","linkHref"],renderer:"ProductGridSection",padKey:"padTop",linkProp:"link"},TyreSizes:{num:"num",title:"title",description:"description",headRows:["num","title","description"],renderer:"DynamicTyreSizes"},FitmentFinder:{num:"num",title:"title",description:"description",headRows:["num","title","description"],renderer:"FitmentFinder"},TyreFitment:{num:"num",title:"title",description:"description",headRows:["num","title","description"],renderer:"DynamicTyreFitment"},BundleOffer:{num:"num",title:"title",description:"description",headRows:["num","title","description"],renderer:"DynamicRelatedProducts"},CompatibleTyres:{num:"num",title:"title",description:"description",headRows:["num","title","description"],renderer:"DynamicRelatedProducts"},RelatedProducts:{num:"num",title:"title",description:"description",headRows:["num","title","description"],renderer:"DynamicRelatedProducts"},SpecTable:{num:"num",title:"title",description:"description",headRows:["num","title","description"],renderer:"SpecTable"},FAQ:{num:"num",title:"title",linkProp:"link",headRows:["num","title","linkText","linkHref"],renderer:"FAQ"},GalleryB:{num:"num",title:"title",headRows:["num","title","linkText","linkHref"],renderer:"GalleryGrid"},FitmentTable:{num:"num",title:"title",description:"description",headRows:["num","title","description"],renderer:"FitmentTable"},Events:{num:"num",title:"title",linkProp:"link",headRows:["num","title","linkText","linkHref"],renderer:"Events"},ProcessSteps:{num:"num",title:"title",description:"description",headRows:["num","title","description"],headStyle:"editorial",renderer:"ProcessSteps",padKey:"padTop"},LongRead:{num:"headNum",title:"headTitle",description:"headDesc",headRows:["headNum","headTitle","headDesc"],headStyle:"editorial",renderer:"LongRead"},Series:{num:"headNum",title:"headTitle",description:"headDesc",headRows:["headNum","headTitle","headDesc"],headStyle:"editorial",renderer:"Series"},TimelineTrack:{num:"eyebrow",title:"title",description:"intro",headRows:["eyebrow","title","intro"],headStyle:"editorial",renderer:"TimelineTrack",padKey:"padTop"},StatsParagraph:{num:"eyebrow",title:"title",description:"desc",headRows:["eyebrow","title","desc"],headStyle:"editorial",renderer:"StatsParagraph"},Footprint:{num:"sectionNumber",title:"heading",description:"tagline",headRows:["sectionNumber","heading","tagline"],headStyle:"editorial",renderer:"Footprint",padKey:"padTop"},Collections:{num:"eyebrow",title:"heading",headRows:["eyebrow","heading"],renderer:"Collections"},Cards:{num:"eyebrow",title:"title",headRows:["eyebrow","eyebrowLook","title"],headStyle:"simple",renderer:"Cards"},Testimonials:{num:"eyebrow",title:"title",headRows:["eyebrow","eyebrowLook","title"],headStyle:"simple",renderer:"Testimonials"},Reviews:{num:"eyebrow",title:"title",headRows:["eyebrow","eyebrowLook","title"],headStyle:"simple",renderer:"Reviews"},Prose:{num:"eyebrow",title:"title",headRows:["eyebrow","title"],headStyle:"essay",renderer:"Prose"},ReviewForm:{num:"eyebrow",title:"title",headRows:["eyebrow","title"],headStyle:"simple",renderer:"ReviewForm"},DeliveryOptions:{num:"eyebrow",title:"title",description:"body",headRows:["eyebrow","title","body"],headStyle:"natural",headRowGap:"gap-3",headDescriptionSize:"text-[15px]",renderer:"DeliveryOptions"}},S="SectionHeader";function R(e){return l(p,e)}function T(e){return n(s,a,e)}const m=new Set(["Flex"]);function b(e){return!!e?.type&&m.has(e.type)}const i={not:{field:"headPlacement",is:"own-box"}},P={not:i};function E(e,t,r){return o(e,r,i)}export{a as DEFAULT_SECTION_HEAD_PLACEMENT,i as HEAD_ROWS_SHOW_WHEN,P as OWN_BOX_ROWS_SHOW_WHEN,s as SECTION_HEAD_PLACEMENT_OPTIONS,S as SECTION_HEAD_TYPE,p as SPLITTABLE_SECTIONS,R as canSplitHead,E as headFieldsForPlacement,y as headRoleProps,b as parentCapsWidth,T as parseSectionHeadPlacement};
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { type ThemeValue } from "../theme.js";
|
|
2
|
+
import type { SiteFacts } from "../../../render/lib/sections/section-to-box.js";
|
|
2
3
|
export type NodeDefaults = (type: string) => Record<string, unknown>;
|
|
3
4
|
export type NewNodeId = (type: string) => string;
|
|
4
5
|
export interface PresetNode {
|
|
@@ -7,6 +8,7 @@ export interface PresetNode {
|
|
|
7
8
|
}
|
|
8
9
|
export type PressContext = {
|
|
9
10
|
theme?: ThemeValue;
|
|
11
|
+
site?: SiteFacts;
|
|
10
12
|
};
|
|
11
13
|
export type SectionPreset = (defaultsFor: NodeDefaults, newId: NewNodeId, ctx?: PressContext) => PresetNode;
|
|
12
14
|
export declare const SECTION_PRESETS: Readonly<Record<string, SectionPreset>>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{SITE_SIDE as
|
|
1
|
+
import{SITE_SIDE as S}from"efficient-easel/screen/lib/content/length-units";import{BOX_TYPE as i}from"../document/container-blocks.js";import{headingTextSeed as m,labelTextSeed as a}from"../document/text-seeds.js";import{TICKER_SCAFFOLD_ITEMS as d}from"../document/blocks/general/Ticker/meta.js";import{specStripScaffold as s}from"../document/blocks/general/SpecStrip/meta.js";import{darkBandIndex as E,normalizeTheme as h}from"../theme.js";import{SPEC_PAD as u,SPEC_STRIP as g,SPEC_TEXT as B,STRIP_BOX as _,TICKER_PAD as b,TICKER_SMALL as R,TICKER_STRIP as C}from"./strip-shape.js";import{ownEntry as l}from"../own-entry.js";function o(t,e,n,c={}){return{type:t,props:{...e(t),id:n(t),...c}}}function P(t,e,n){return o(i,t,e,{...n,sectionPaddingTop:void 0,sectionPaddingBottom:void 0})}const y={Manifesto:(t,e)=>({type:i,props:{...t(i),id:e(i),direction:"row",share:"equal",sectionHeightMode:"screen",name:"Brand Text",content:[o(i,t,e,{direction:"column",justify:"center",blockSpacing:"gap",name:"Text",sectionPaddingTop:100,sectionPaddingBottom:100,sectionPaddingLeft:S,sectionPaddingRight:S,content:[o("Text",t,e,a()),o("Text",t,e,m()),o("Text",t,e),o("Stats",t,e)]}),P(t,e,{direction:"column",name:"Picture",content:[]})]}}),Split:(t,e)=>({type:i,props:{...t(i),id:e(i),direction:"row",share:"equal",sectionHeightMode:"screen",sectionHeightValue:70,name:"Image & Text Split",content:[o(i,t,e,{direction:"column",justify:"center",blockSpacing:"gap",name:"Text",sectionPaddingTop:100,sectionPaddingBottom:100,sectionPaddingLeft:60,sectionPaddingRight:60,content:[o("Text",t,e,a()),o("Text",t,e,m()),o("Text",t,e),o("ButtonBlock",t,e)]}),P(t,e,{direction:"column",name:"Image",content:[o("ImageBlock",t,e)]})]}}),Subscribe:(t,e)=>({type:i,props:{...t(i),id:e(i),direction:"column",name:"Subscribe",content:[o("Text",t,e,m()),o("Text",t,e),o("Form",t,e)]}}),Ticker:(t,e)=>x("Scrolling Bar",C,b,d.map(n=>({text:n.text,style:R,muted:!0})),t,e),SpecStrip:(t,e,n)=>x("Spec Strip",n?.theme?{...g,sectionAccent:E(h(n.theme))}:{...g,sectionBorder:{top:1}},u,s().map(c=>({text:c.text??"",style:B,muted:c.tone==="muted"})),t,e)};function x(t,e,n,c,p,T){return o(i,p,T,{..._,...e,blockSpacing:"gap",padV2:!0,name:t,sectionPaddingTop:n.top,sectionPaddingBottom:n.bottom,sectionPaddingTopPhone:n.topPhone,sectionPaddingBottomPhone:n.bottomPhone,content:c.map(r=>o("Text",p,T,{text:r.text,...r.muted?{tone:"dim"}:{},_partStyles:{text:r.style}}))})}function H(t){return l(y,t)??null}export{y as SECTION_PRESETS,H as presetFor};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{decodePartKey as s}from"../document/part-key.js";const o="@name",n="@body",i="@value",
|
|
1
|
+
import{decodePartKey as s}from"../document/part-key.js";import{ownEntry as c}from"../own-entry.js";const o="@name",n="@body",i="@value",E={[o]:"Name",[n]:"Body",[i]:"Value"},l={TimelineTrack:{"entries.date":o,"entries.title":o,"entries.blurb":n},Footprint:{"offices.city":o},Stats:{"items.label":o,"items.value":i}};function u(r){const{key:t,row:e}=s(r);return e?`${t}.${e.rowKey}`:null}function _(r,t){if(!r)return t;const e=u(t);return e?c(l,r)?.[e]??t:t}export{l as SECTION_TEXT_KINDS,n as TEXT_KIND_BODY,E as TEXT_KIND_LABELS,o as TEXT_KIND_NAME,i as TEXT_KIND_VALUE,u as partColumn,_ as styleKeyForPart};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{globalRegistry as c}from"../global-registry.js";import{COLLECTION_CARD_TEXT_REGIONS as l}from"./collection-card-text-regions.js";import{FAQ_TEXT_REGIONS as f}from"./faq-text-regions.js";import{CONTENTS_REGIONS as
|
|
1
|
+
import{globalRegistry as c}from"../global-registry.js";import{COLLECTION_CARD_TEXT_REGIONS as l}from"./collection-card-text-regions.js";import{FAQ_TEXT_REGIONS as f}from"./faq-text-regions.js";import{CONTENTS_REGIONS as E}from"./contents-text-regions.js";import{SPEC_REGIONS as a}from"./spec-table-regions.js";import{hasOwnEntry as T,ownEntry as m}from"../own-entry.js";const i={SpecTable:a,FAQ:f,Collections:l,Contents:E};function s(){return c("efficient.section-text-regions",()=>new Map)}function N(t){const o=s();for(const[e,r]of Object.entries(t)){if(T(i,e))throw new Error(`lib/sections/section-text-regions: "${e}" is a builder section; its table is the builder's`);const n=o.get(e);if(n&&n!==r)throw new Error(`lib/sections/section-text-regions: "${e}" already has a table`);o.set(e,r)}}function _(t){return t?m(i,t)??s().get(t)??null:null}export{i as SECTION_TEXT_REGIONS,_ as regionsForSection,N as registerSectionTextRegions};
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import{ruleChecks as A}from"./rule.js";const E={text:[0,1,2],textarea:[0,1,2],plainText:[0,1,2],copyText:[0,1,2],plainTextarea:[0,1,2],linkField:[0],textList:[0,2],upload:[0,2],toggle:[0,3],select:[0,4],searchSelect:[0,3],segmented:[0],iconPickerRow:[0],shapePickerRow:[0],multiSelect:[0,2],slider:[0],colorInput:[0],focalPicker:[0],sizeField:[0],backgroundField:[0],cardImageBackgroundField:[0],placementField:[0],pxField:[0],dateTime:[0,2],edgePad:[0,3],blockSourceField:[0,1],cardRowField:[0],phPrev:[1],phHide:[1],phHideDefault:[1],group:[0],section:[0],panelNote:[0]},
|
|
2
|
-
`)}function
|
|
3
|
-
`)},{path:"names.ts",text:'export const N = [{ key: "openers", title: "Hero & intros", sections: [{ type: "Hero", label: "Hero Slideshow" }] }];'},{path:"block.tsx",text:'export const B = { label: "Banner", fields: {}, defaultProps: { cta: { label: "Shop now", href: "/" } } };'}],o=[...w(t,f,{dataFiles:[{path:"names.ts",keys:["title"]}],known:new Set(["Already listed"])}).keys()],y=["A hint","A note","Align","Banner","Borders","Corner sides","Corners","Round","Rounds it.","Square","Template pages","Text color","Wording","Desktop","Delete {name}","Heading","Hero & intros","Hero Slideshow","Large","Left","Main heading","Section heading","Show","Size","Small","{n} page","{n} pages"].sort(L);a("the reader reads every shape on a fixture, and no value, link or built phrase",JSON.stringify(o)===JSON.stringify(y),`read ${JSON.stringify(o)}`)}const d=w(t,p,s);a(`the source says at least ${s.floor} phrases`,d.size>=s.floor,`read ${d.size}: the reader broke, or the editor stopped saying its words through it`);const u=
|
|
1
|
+
import{ruleChecks as A}from"./rule.js";import{hasOwnEntry as b}from"../own-entry.js";const E={text:[0,1,2],textarea:[0,1,2],plainText:[0,1,2],copyText:[0,1,2],plainTextarea:[0,1,2],linkField:[0],textList:[0,2],upload:[0,2],toggle:[0,3],select:[0,4],searchSelect:[0,3],segmented:[0],iconPickerRow:[0],shapePickerRow:[0],multiSelect:[0,2],slider:[0],colorInput:[0],focalPicker:[0],sizeField:[0],backgroundField:[0],cardImageBackgroundField:[0],placementField:[0],pxField:[0],dateTime:[0,2],edgePad:[0,3],blockSourceField:[0,1],cardRowField:[0],phPrev:[1],phHide:[1],phHideDefault:[1],group:[0],section:[0],panelNote:[0]},N=new Set(["value","render","defaultProps","fields","type","arrayFields","icon","shape"]),O=/(^|_)(PH|LABELS?|HINTS?|NOTES?|TITLES?|SWATCH_NAMES|GROUP|REASON|ROWS|PANELS|TABS|LINES)$/,$=new Set(["key","value","id","type","href","slug","kind","cell","set","icon","token","unit","path","url","src","className","variant","mode","side","align","role"]),R=new Set(["hint","coverHint","unsetLabel","emptyLabel","addLabel"]),_=new Set(["say","sayCount"]);function C(t){return/\p{L}/u.test(t)&&t.trim()===t&&t.length>0&&!/^[a-z0-9]+(?:-[a-z0-9]+)+$/.test(t)}const P=/(?:Key|Id|Slug|Href|Url|ClassName)$/;function w(t,p,s={}){const a=new Map,k=new Set(s.skip??[]),d=new Map((s.dataFiles??[]).map(e=>[e.path,e.keys])),u=(e,l)=>{if(!C(e))return;let S=a.get(e);S||a.set(e,S=new Set),S.add(l)},f=e=>e&&(t.isStringLiteral(e)||t.isNoSubstitutionTemplateLiteral(e))?e.text:null,o=e=>{if(!e)return[];const l=f(e);return l!==null?[l]:t.isParenthesizedExpression(e)?o(e.expression):t.isConditionalExpression(e)?[...o(e.whenTrue),...o(e.whenFalse)]:t.isBinaryExpression(e)&&(e.operatorToken.kind===t.SyntaxKind.QuestionQuestionToken||e.operatorToken.kind===t.SyntaxKind.BarBarToken)?[...o(e.left),...o(e.right)]:[]},y=e=>{const l=e.expression;return t.isIdentifier(l)?l.text:t.isPropertyAccessExpression(l)?l.name.text:null},g=e=>e.name&&(t.isIdentifier(e.name)||t.isStringLiteral(e.name))?e.name.text:null;for(const e of p){if(!/\.tsx?$/.test(e.path)||k.has(e.path))continue;const l=d.get(e.path),S=t.createSourceFile(e.path,e.text,t.ScriptTarget.Latest,!0,e.path.endsWith(".tsx")?t.ScriptKind.TSX:t.ScriptKind.TS),T=n=>{if(t.isCallExpression(n)){const r=y(n);if(r&&_.has(r))for(const c of n.arguments){const i=f(c);i!==null&&u(i,e.path)}else if(r&&t.isIdentifier(n.expression)&&b(E,r)){for(const c of E[r])for(const i of o(n.arguments[c]))u(i,e.path);if(r==="segmented"){const c=n.arguments[2];if(c&&t.isArrayLiteralExpression(c))for(const i of c.elements){const h=f(i);h!==null&&u(h,e.path)}}}}else if(t.isJsxAttribute(n)&&n.name.getText(S)==="label"&&n.initializer&&t.isStringLiteral(n.initializer)&&/^[A-Z]/.test(n.parent.parent.tagName.getText(S).split(".").pop()??""))u(n.initializer.text,e.path);else if(t.isObjectLiteralExpression(n)){const r=n.properties.filter(t.isPropertyAssignment),c=r.find(i=>g(i)==="label");if(c&&r.some(i=>N.has(g(i)??""))){const i=f(c.initializer);i!==null&&u(i,e.path)}for(const i of r){const h=g(i);if(h!==null&&R.has(h))for(const x of o(i.initializer))u(x,e.path)}if(l)for(const i of r){const h=g(i);if(h!==null&&(l==="*"||l.includes(h))){const x=f(i.initializer);x!==null&&u(x,e.path)}}}else if(t.isVariableDeclaration(n)&&t.isIdentifier(n.name)&&O.test(n.name.text)&&n.initializer&&!/CSSProperties|Style\b/.test(n.type?.getText(S)??"")){const r=f(n.initializer);r!==null&&!/^[a-z0-9_]+$/.test(r)&&u(r,e.path);const c=i=>{const h=t.isPropertyAssignment(i)?g(i)??"":"";if(t.isPropertyAssignment(i)&&!$.has(h)&&!P.test(h)){const x=f(i.initializer);x!==null&&u(x,e.path)}t.forEachChild(i,c)};c(n.initializer)}t.forEachChild(n,T)};T(S)}const m=new Map;for(const e of[...a.keys()].sort(L))s.known?.has(e)||m.set(e,[...a.get(e)].sort());return m}function L(t,p){return t<p?-1:t>p?1:0}function z(t,p){return["/**",...p.header.map(a=>a?` * ${a}`:" *")," */",`export const ${p.constant} = {`,...[...t].map(a=>` ${JSON.stringify(a)}: ${JSON.stringify(a)},`),"} as const;","",`/** Every phrase of {@link ${p.constant}}: what a host's words are keyed by. */`,`export type ${p.phraseType} = keyof typeof ${p.constant};`,""].join(`
|
|
2
|
+
`)}function F(t,p,s){const{check:a,report:k}=A("editor words");{const f=[{path:"fixture.tsx",text:['const a = say("Delete {name}", { name });','const b = sayCount("{n} page", "{n} pages", n);','const c = text("Heading", "Main heading", "A hint");','const d = select("Align", icon, [{ label: "Left", value: "left" }], "left", "A note");','const e = segmented("Size", icon, ["Small", "Large"], "Small");','const SERIES_PH = { headTitle: "Section heading", link: "#" };','export const CORNER_SIDES_LABEL = "Corner sides";','const VIEW_TIER_LABEL = { desktop: "Desktop" };',"const DEFAULT_LABEL_KEY = 12;",'const FOCUS_HINT: CSSProperties = { display: "flex" };','const LAYOUT_TABS = "tabs";','const TEMPLATE_GROUP = { group: "Template pages", groupKey: "template" };','const a4 = <MenuLink label="text-fg" />;','const THEME_COLOUR_ROWS = [{ key: "fg", label: "Text color" }, { group: "Borders" }];','const a1 = <GroupLabel label="Wording" />;','const a2 = <input label="raw" />;','const a3 = say("Already listed");','const f = toggle("Show", false, "not-a-word");','const i = pxField("Corners", { min: 0, unsetLabel: on ? "Square" : "Round", hint: opts?.hint ?? "Rounds it." });','const g = { label: "Content", href: "/" };',"const h = say(`${x} colour`);"].join(`
|
|
3
|
+
`)},{path:"names.ts",text:'export const N = [{ key: "openers", title: "Hero & intros", sections: [{ type: "Hero", label: "Hero Slideshow" }] }];'},{path:"block.tsx",text:'export const B = { label: "Banner", fields: {}, defaultProps: { cta: { label: "Shop now", href: "/" } } };'}],o=[...w(t,f,{dataFiles:[{path:"names.ts",keys:["title"]}],known:new Set(["Already listed"])}).keys()],y=["A hint","A note","Align","Banner","Borders","Corner sides","Corners","Round","Rounds it.","Square","Template pages","Text color","Wording","Desktop","Delete {name}","Heading","Hero & intros","Hero Slideshow","Large","Left","Main heading","Section heading","Show","Size","Small","{n} page","{n} pages"].sort(L);a("the reader reads every shape on a fixture, and no value, link or built phrase",JSON.stringify(o)===JSON.stringify(y),`read ${JSON.stringify(o)}`)}const d=w(t,p,s);a(`the source says at least ${s.floor} phrases`,d.size>=s.floor,`read ${d.size}: the reader broke, or the editor stopped saying its words through it`);const u=z(d.keys(),s.shape);if(!s.catalogue)a("the catalogue exists",!1,`run ${s.write}`);else{const f=s.catalogue.text===u;let o;if(!f){const y=new Set([...s.catalogue.text.matchAll(/^ {2}("(?:[^"\\]|\\.)*"): /gm)].map(e=>JSON.parse(e[1]))),g=[...d.keys()].filter(e=>!y.has(e)),m=[...y].filter(e=>!d.has(e));o=`${s.catalogue.path} is not what the source says — run ${s.write}. Missing ${g.length}${g.length?` (${g.slice(0,5).map(e=>JSON.stringify(e)).join(", ")}…)`:""}; no longer said ${m.length}${m.length?` (${m.slice(0,5).map(e=>JSON.stringify(e)).join(", ")}…)`:""}.`}a(`${s.catalogue.path} lists exactly the ${d.size} phrases the source says`,f,o)}return k()}export{E as BUILDER_WORDS,w as editorPhrases,F as editorWordsCatalogue,z as editorWordsCatalogueText,C as isPhrase};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import{ruleChecks as
|
|
2
|
-
`)[0].slice(0,80)}`);continue}e.isVariableStatement(i)||e.isFunctionDeclaration(i)||e.isClassDeclaration(i)||e.isInterfaceDeclaration(i)||e.isTypeAliasDeclaration(i)||e.isEnumDeclaration(i)||e.isModuleDeclaration(i)||e.isExportDeclaration(i)||e.isExportAssignment(i)||e.isImportEqualsDeclaration(i)||e.isEmptyStatement(i)||r(i,`a top-level ${e.SyntaxKind[i.kind]}`)}return o}function
|
|
3
|
-
`)});l("the reader finds a side-effect import, a call and a write through imported or global names, and a top-level if — and nothing else",JSON.stringify(r.map(s=>s.line))===JSON.stringify([2,9,10,11,12]),JSON.stringify(r));const i=t.filter(s=>
|
|
1
|
+
import{ruleChecks as p}from"./rule.js";import{hasOwnEntry as u}from"../own-entry.js";const h=e=>/\.(ts|tsx|mts|cts)$/.test(e)&&!e.endsWith(".d.ts");function g(e,t){const n=new Set,l=o=>{if(e.isIdentifier(o))n.add(o.text);else for(const r of o.elements)e.isOmittedExpression(r)||l(r.name)};for(const o of t.statements)if(e.isVariableStatement(o))for(const r of o.declarationList.declarations)l(r.name);else(e.isFunctionDeclaration(o)||e.isClassDeclaration(o)||e.isEnumDeclaration(o))&&o.name&&n.add(o.name.text);return n}function x(e,t){let n=t;for(;;)if(e.isParenthesizedExpression(n)||e.isNonNullExpression(n)||e.isAsExpression(n))n=n.expression;else if(e.isPropertyAccessExpression(n)||e.isElementAccessExpression(n))n=n.expression;else if(e.isCallExpression(n))n=n.expression;else break;return e.isIdentifier(n)?n.text:null}function E(e,t){return e.isBinaryExpression(t)&&t.operatorToken.kind>=e.SyntaxKind.FirstAssignment&&t.operatorToken.kind<=e.SyntaxKind.LastAssignment?t.left:e.isPrefixUnaryExpression(t)||e.isPostfixUnaryExpression(t)?t.operand:e.isVoidExpression(t)||e.isAwaitExpression(t)?t.expression:t}function f(e,t){const n=e.createSourceFile(t.path,t.text,e.ScriptTarget.Latest,!0,t.path.endsWith("x")?e.ScriptKind.TSX:e.ScriptKind.TS),l=g(e,n),o=[],r=(i,a)=>o.push({file:t.path,line:n.getLineAndCharacterOfPosition(i.getStart(n)).line+1,what:a});for(const i of n.statements){if(e.isImportDeclaration(i)){const a=i.moduleSpecifier.text;!i.importClause&&!a.endsWith(".css")&&r(i,`imports "${a}" for what it does`);continue}if(e.isExpressionStatement(i)){if(e.isStringLiteral(i.expression))continue;const a=x(e,E(e,i.expression));(!a||!l.has(a))&&r(i,`${i.getText(n).split(`
|
|
2
|
+
`)[0].slice(0,80)}`);continue}e.isVariableStatement(i)||e.isFunctionDeclaration(i)||e.isClassDeclaration(i)||e.isInterfaceDeclaration(i)||e.isTypeAliasDeclaration(i)||e.isEnumDeclaration(i)||e.isModuleDeclaration(i)||e.isExportDeclaration(i)||e.isExportAssignment(i)||e.isImportEqualsDeclaration(i)||e.isEmptyStatement(i)||r(i,`a top-level ${e.SyntaxKind[i.kind]}`)}return o}function k(e,t,n){const{check:l,report:o}=p("no work at import"),r=f(e,{path:"fixture.ts",text:['"use client";','import "./polyfill";','import "./look.css";','import { register, lib } from "./lib";',"const CACHE = new Map<string, number>();",'CACHE.set("a", 1);',"export const TABLE: Record<string, number> = {};","TABLE.b = 2;",'register("x");',"lib.hook(() => 0);","window.ready = true;",'if (typeof window !== "undefined") CACHE.clear();'].join(`
|
|
3
|
+
`)});l("the reader finds a side-effect import, a call and a write through imported or global names, and a top-level if — and nothing else",JSON.stringify(r.map(s=>s.line))===JSON.stringify([2,9,10,11,12]),JSON.stringify(r));const i=t.filter(s=>h(s.path));l(`read the modules (${i.length})`,i.length>0,"found no module to read — this rule is not measuring anything");const a=i.flatMap(s=>f(e,s)),c=a.filter(s=>!u(n,s.file));l(`no module does work at import that reaches past itself, outside the ${Object.keys(n).length} named (${i.length} modules)`,c.length===0,`${c.length} statement(s) a bundler may drop with their module once it is unused. Make it a function its user calls, or name the file with its reason:
|
|
4
4
|
`+c.map(s=>` ${s.file}:${s.line} ${s.what}`).join(`
|
|
5
|
-
`));const m=new Set(a.map(s=>s.file)),d=Object.keys(n).filter(s=>!m.has(s));return l("every named file still does the work it is named for",d.length===0,`named, but doing no work at import now: ${d.join(", ")} — take the line out`),o()}export{f as importTimeWork,
|
|
5
|
+
`));const m=new Set(a.map(s=>s.file)),d=Object.keys(n).filter(s=>!m.has(s));return l("every named file still does the work it is named for",d.length===0,`named, but doing no work at import now: ${d.join(", ")} — take the line out`),o()}export{f as importTimeWork,k as noImportTimeWork};
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import type * as TS from "typescript";
|
|
2
|
+
import { type RuleReport, type SourceFile } from "./rule.js";
|
|
3
|
+
export type OwnKeyPlace = {
|
|
4
|
+
readonly file: string;
|
|
5
|
+
readonly line: number;
|
|
6
|
+
readonly map: string;
|
|
7
|
+
readonly kind: "[]" | "in" | "{}";
|
|
8
|
+
};
|
|
9
|
+
export type OwnKeyExemption = {
|
|
10
|
+
readonly file: string;
|
|
11
|
+
readonly map: string;
|
|
12
|
+
readonly lines: readonly number[];
|
|
13
|
+
readonly reason: string;
|
|
14
|
+
readonly owner: string;
|
|
15
|
+
readonly until: string;
|
|
16
|
+
};
|
|
17
|
+
export declare function repositoryProgram(ts: typeof TS, root: string, files: readonly SourceFile[]): TS.Program;
|
|
18
|
+
export declare function bareRegistryReads(ts: typeof TS, root: string, files: readonly SourceFile[], scan: (path: string) => boolean): OwnKeyPlace[];
|
|
19
|
+
export declare function ownKeyReads(ts: typeof TS, root: string, files: readonly SourceFile[], opts: {
|
|
20
|
+
readonly scan: (path: string) => boolean;
|
|
21
|
+
readonly exempt: readonly OwnKeyExemption[];
|
|
22
|
+
readonly today: string;
|
|
23
|
+
}): {
|
|
24
|
+
report: RuleReport;
|
|
25
|
+
places: OwnKeyPlace[];
|
|
26
|
+
};
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import{ruleChecks as C}from"./rule.js";const E=new Map;function j(e,r,t){const a=n=>`${r}/src/${n}`,l=new Map(t.filter(n=>/\.(tsx?|mts)$/.test(n.path)&&!n.path.endsWith(".d.ts")).map(n=>[a(n.path),n.text])),o=e.getParsedCommandLineOfConfigFile(`${r}/tsconfig.json`,{},{...e.sys,onUnRecoverableConfigFileDiagnostic:n=>{throw new Error(`own-key reads: ${r}/tsconfig.json: ${e.flattenDiagnosticMessageText(n.messageText,`
|
|
2
|
+
`)}`)}});if(!o)throw new Error(`own-key reads: cannot read ${r}/tsconfig.json`);const i={...o.options,noEmit:!0},c=e.createCompilerHost(i,!0),d=c.fileExists.bind(c),y=c.readFile.bind(c),m=c.getSourceFile.bind(c);c.fileExists=n=>l.has(n)||d(n),c.readFile=n=>l.get(n)??y(n),c.getSourceFile=(n,f,g)=>{const h=l.get(n);return h!==void 0?e.createSourceFile(n,h,f,!0):(E.has(n)||E.set(n,m(n,f,g,!1)),E.get(n))};const u=o.errors.filter(n=>n.code!==18003);if(u.length)throw new Error(`own-key reads: ${r}/tsconfig.json: ${u.map(n=>e.flattenDiagnosticMessageText(n.messageText,`
|
|
3
|
+
`)).join("; ")}`);if(i.noLib)throw new Error(`own-key reads: ${r}/tsconfig.json sets noLib: the rule needs the lib to type a key (no lib)`);const s=e.createProgram({rootNames:[...l.keys()],options:i,host:c}),p=s.getSourceFiles().filter(n=>s.isSourceFileDefaultLibrary(n));if(p.length===0)throw new Error(`own-key reads: the program at ${r} loaded no lib file (no lib)`);if(!p.some(n=>/lib\.es(next|\d{4}|5)\b/.test(n.fileName)))throw new Error(`own-key reads: the program at ${r} loaded no ES lib (no ES lib): an array, a string or a lib call would have no type`);return s}const N=/\.(css|scss|svg|png|jpe?g|gif|webp|woff2?)$/;function A(e,r,t,a){const l=[],o=i=>{(e.isImportDeclaration(i)||e.isExportDeclaration(i))&&i.moduleSpecifier&&e.isStringLiteral(i.moduleSpecifier)?l.push(i.moduleSpecifier):e.isExternalModuleReference(i)&&e.isStringLiteral(i.expression)?l.push(i.expression):e.isCallExpression(i)&&i.expression.kind===e.SyntaxKind.ImportKeyword&&i.arguments[0]&&e.isStringLiteral(i.arguments[0])?l.push(i.arguments[0]):e.isImportTypeNode(i)&&e.isLiteralTypeNode(i.argument)&&e.isStringLiteral(i.argument.literal)&&l.push(i.argument.literal),e.forEachChild(i,o)};o(t);for(const i of l)if(!N.test(i.text)&&!r.getSymbolAtLocation(i))throw new Error(`own-key reads: ${a}: import "${i.text}" does not resolve`)}function L(e,r){return(r.isUnion()?r.types:[r]).some(a=>(a.flags&(e.TypeFlags.Undefined|e.TypeFlags.Null))===0&&a.getStringIndexType()!==void 0)}function b(e,r){let t=r;for(;e.isParenthesizedExpression(t);)t=t.expression;return t}function D(e,r,t){let a=null;if(e.isIdentifier(t)?a=t:e.isPropertyAccessExpression(t)&&e.isIdentifier(t.expression)&&r.getSymbolAtLocation(t.expression)?.declarations?.some(e.isNamespaceImport)&&(a=t.name),!a)return null;let l=r.getSymbolAtLocation(a);l&&l.flags&e.SymbolFlags.Alias&&(l=r.getAliasedSymbol(l));const o=l?.valueDeclaration;if(o&&e.isEnumDeclaration(o))return e.isSourceFile(o.parent)?o:null;if(!o||!e.isVariableDeclaration(o)||!e.isVariableDeclarationList(o.parent))return null;const i=o.parent.parent;return e.isVariableStatement(i)&&e.isSourceFile(i.parent)?o:null}function S(e,r,t){let a=t,l=!1;for(;e.isParenthesizedExpression(a)||e.isAsExpression(a)||e.isNonNullExpression(a)||e.isSatisfiesExpression(a);)e.isAsExpression(a)&&L(e,r.getTypeFromTypeNode(a.type))&&(l=!0),a=a.expression;const o=D(e,r,a);return o?{d:o,indexed:l||e.isVariableDeclaration(o)&&L(e,r.getTypeAtLocation(o.name))}:null}function T(e,r,t){if(e.isTemplateExpression(b(e,t)))return!0;const a=e.TypeFlags.String|e.TypeFlags.TemplateLiteral|e.TypeFlags.StringMapping|e.TypeFlags.Any,l=new Set,o=i=>{if(l.has(i))return!1;if(l.add(i),(i.flags&a)!==0)return!0;if(i.isUnion()||i.isIntersection())return i.types.some(o);if((i.flags&(e.TypeFlags.TypeParameter|e.TypeFlags.Index|e.TypeFlags.IndexedAccess|e.TypeFlags.Conditional|e.TypeFlags.Substitution))!==0){const c=r.getBaseConstraintOfType(i);return!!c&&c!==i&&o(c)}return!1};return o(r.getTypeAtLocation(t))}function P(e,r){const t=r.parent;return e.isDeleteExpression(t)?!0:e.isBinaryExpression(t)&&t.left===r&&t.operatorToken.kind===e.SyntaxKind.EqualsToken}function I(e,r){return e.isObjectBindingPattern(r)?r.elements.flatMap(t=>t.propertyName&&e.isComputedPropertyName(t.propertyName)?[t.propertyName.expression]:[]):e.isObjectLiteralExpression(r)?r.properties.flatMap(t=>t.name&&e.isComputedPropertyName(t.name)?[t.name.expression]:[]):[]}function M(e,r,t,a){const l=j(e,r,t),o=l.getTypeChecker(),i=[];for(const c of t){if(!a(c.path))continue;const d=l.getSourceFile(`${r}/src/${c.path}`);if(!d)throw new Error(`own-key reads: ${c.path} is not in the program`);A(e,o,d,c.path);const y=(s,p,n)=>i.push({file:c.path,line:d.getLineAndCharacterOfPosition(s.getStart()).line+1,map:p.name.getText(),kind:n}),m=(s,p)=>{const n=S(e,o,p);if(n?.indexed)for(const f of I(e,s))T(e,o,f)&&y(f,n.d,"{}")},u=s=>{if(e.isElementAccessExpression(s)&&!P(e,s)){const p=S(e,o,s.expression);p?.indexed&&T(e,o,s.argumentExpression)&&y(s,p.d,"[]")}else if(e.isBinaryExpression(s)&&s.operatorToken.kind===e.SyntaxKind.InKeyword){const p=S(e,o,s.right);p&&T(e,o,s.left)&&y(s,p.d,"in")}else(e.isVariableDeclaration(s)||e.isParameter(s))&&s.initializer&&e.isObjectBindingPattern(s.name)?m(s.name,s.initializer):e.isBinaryExpression(s)&&s.operatorToken.kind===e.SyntaxKind.EqualsToken&&e.isObjectLiteralExpression(b(e,s.left))&&m(b(e,s.left),s.right);e.forEachChild(s,u)};u(d)}return i}function B(e,r,t,a){const l=M(e,r,t,a.scan),o=C("own-key reads"),i=n=>{const f=new Map;for(const g of n)f.set(g,(f.get(g)??0)+1);return f},c=new Map;for(const n of l)c.set(`${n.file}|${n.map}`,[...c.get(`${n.file}|${n.map}`)??[],n.line]);const d=new Map;for(const n of a.exempt)d.set(`${n.file}|${n.map}`,[...d.get(`${n.file}|${n.map}`)??[],...n.lines]);const y=new Map(l.map(n=>[`${n.file}|${n.map}|${n.line}`,n.kind])),m=[],u=[];for(const n of new Set([...c.keys(),...d.keys()])){const[f,g]=n.split("|"),h=i(c.get(n)??[]),k=i(d.get(n)??[]);for(const[x,w]of h){const $=w-(k.get(x)??0),F=y.get(`${n}|${x}`),v=F==="in"?`k in ${g}`:F==="{}"?`{ [k]: v } = ${g}`:`${g}[k]`;$>0&&m.push(`${f}:${x} ${v}${$>1?` (${$} reads)`:""}: read it with ownEntry / hasOwnEntry (lib/own-entry)`)}for(const[x,w]of k)w-(h.get(x)??0)>0&&u.push(`${f}:${x} ${g}: listed ${w}, found ${h.get(x)??0}`)}o.check("every bare string-keyed registry read goes through lib/own-entry or is a read the exemption list names",m.length===0,m.join(`
|
|
4
|
+
`)),o.check("every read the exemption list names is still there (delete-only: remove a line when its read moves)",u.length===0,u.join(`
|
|
5
|
+
`));const s=a.exempt.filter(n=>!(n.until>a.today));o.check("every exemption is before its date",s.length===0,s.map(n=>`${n.file} ${n.map}: until ${n.until}`).join(`
|
|
6
|
+
`));const p=a.exempt.filter(n=>!n.reason.trim()||!n.owner.trim()||!/^\d{4}-\d{2}-\d{2}$/.test(n.until));return o.check("every exemption gives a reason, an owner and a date",p.length===0,p.map(n=>`${n.file} ${n.map}`).join(`
|
|
7
|
+
`)),{report:o.report(),places:l}}export{M as bareRegistryReads,B as ownKeyReads,j as repositoryProgram};
|
|
@@ -11,6 +11,7 @@ interface Props {
|
|
|
11
11
|
inkIsDark?: boolean | null;
|
|
12
12
|
size?: "small" | "medium" | "large";
|
|
13
13
|
sizePx?: number | null;
|
|
14
|
+
sizeUnit?: unknown;
|
|
14
15
|
wordmark?: string | null;
|
|
15
16
|
siteName?: string;
|
|
16
17
|
fitToContainer?: boolean;
|
|
@@ -19,4 +20,4 @@ interface Props {
|
|
|
19
20
|
}
|
|
20
21
|
export { FOOTER_LOGO_PX, HEADER_LOGO_PX, HEADER_LOGO_PX_MAX, HEADER_LOGO_PX_MIN, LOGO_BLOCK_PX_MAX } from "../../format/lib/logo/logo-size.js";
|
|
21
22
|
export declare const WORDMARK_FIT_FLOOR_PX = 16;
|
|
22
|
-
export default function Logo({ variant, scrolled, src, reverse, color, onLightSurface, reversedSrc, inkIsDark, size, sizePx, wordmark, siteName, fitToContainer, fitWordmarkToContainer, fitFloorPx, hideClass, hideAttrs }: Props): import("react").JSX.Element;
|
|
23
|
+
export default function Logo({ variant, scrolled, src, reverse, color, onLightSurface, reversedSrc, inkIsDark, size, sizePx, sizeUnit, wordmark, siteName, fitToContainer, fitWordmarkToContainer, fitFloorPx, hideClass, hideAttrs }: Props): import("react").JSX.Element;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use client";import{jsx as
|
|
1
|
+
"use client";import{jsx as a,jsxs as v}from"react/jsx-runtime";import{withViewHide as at}from"./ViewHideRoot.js";import{useEffect as h,useId as ut,useRef as W,useState as p}from"react";import{NEUTRAL_SITE_NAME as dt}from"../../format/lib/content/site-name.js";import{useRootIsDark as mt}from"efficient-shell/theme";import{isSvgUrl as ft}from"../../format/lib/logo/reverse-svg.js";import{analyzeLogoViaServer as ht}from"../lib/logo/analyze-logo-client.js";import{siteLengthCss as pt}from"../../format/lib/content/css-length.js";import{FOOTER_LOGO_PX as _t,HEADER_LOGO_GRID as Ot,HEADER_LOGO_PX as gt}from"../../format/lib/logo/logo-size.js";import{FOOTER_LOGO_PX as Ht,HEADER_LOGO_PX as Tt,HEADER_LOGO_PX_MAX as Mt,HEADER_LOGO_PX_MIN as Nt,LOGO_BLOCK_PX_MAX as Wt}from"../../format/lib/logo/logo-size.js";const Et=202/22,Rt=.88,Ft=16,It="invert(1)";function Lt({variant:b="header",scrolled:C=!0,src:_,reverse:j=!1,color:O=null,onLightSurface:P,reversedSrc:D,inkIsDark:K,size:U="medium",sizePx:l,sizeUnit:V,wordmark:g,siteName:q=dt,fitToContainer:x=!1,fitWordmarkToContainer:B=!1,fitFloorPx:u,hideClass:Z,hideAttrs:z}){const d=g&&g.trim()?g.trim():q,[J,Q]=p(null),S=W(null),Y=t=>{S.current=t};h(()=>{Q(S.current?.ownerDocument??null)},[]);const tt=!mt({doc:J,whenUnset:!0}),n=_&&_.trim()?_.trim():null,m=!!n&&ft(n),$=P??(tt&&C),o=O&&O.trim()?O.trim():null,f=j&&!o,k=`logo-color-${ut().replace(/[^A-Za-z0-9_-]/g,"")}`,y=f&&m&&n&&D!=null?{reversed:D,inkIsDark:K??null}:null,w=y!==null,[et,E]=p(null);h(()=>{if(!f||!n||!m||w){E(null);return}let t=!1;return E(null),ht(n).then(c=>{t||E(c)}),()=>{t=!0}},[f,n,m,w]);const s=y??et,F=!!s&&s.inkIsDark!==null&&($?!s.inkIsDark:s.inkIsDark),nt=f&&!!n&&!m&&!$,R=F&&s?s.reversed:n,G=R?[R]:[],[X,I]=p(0);h(()=>{I(0)},[n,F]);const ot=b==="footer"?_t:gt[U],i=l&&l>0?l:ot,r=(l&&l>0?pt(l,V,"size",Ot,{floor:!0}):null)??`${i}px`,lt=Math.round(i*Et),e=X<G.length?G[X]:null,[st,L]=p(R),H=e!==null&&e===st,T=W(null);h(()=>{const t=T.current;if(!t||!t.complete)return;if(t.naturalWidth>0||t.naturalHeight>0){L(e);return}let c=!1;return t.decode().then(()=>!c&&L(e),()=>!c&&I(ct=>ct+1)),()=>{c=!0}},[e]);const M=x||B,N=`calc(100cqi / ${((d.length+1)*Rt).toFixed(2)})`,A=M&&u&&u>0?r===`${i}px`?`${Math.min(u,i)}px`:`min(${u}px, ${r})`:null,rt=M?A===null?`min(${r}, ${N})`:`clamp(${A}, ${N}, ${r})`:r,it=v("span",{className:`font-display font-bold tracking-[0.18em] ${A===null?"whitespace-nowrap":"whitespace-normal"}`,style:{fontSize:rt,lineHeight:1,...o?{color:o}:{}},"aria-label":d,children:[d,a("span",{className:"text-accent",style:o?{color:o}:void 0,children:"."})]});return v("span",{ref:Y,className:at("inline-flex items-center",Z??""),...z,children:[!H&&it,o&&e&&a("svg",{"aria-hidden":"true",focusable:"false",width:"0",height:"0",style:{position:"absolute"},children:v("filter",{id:k,colorInterpolationFilters:"sRGB",children:[a("feFlood",{style:{floodColor:o}}),a("feComposite",{in2:"SourceAlpha",operator:"in"})]})}),e&&a("img",{ref:T,src:e,alt:d,width:lt,height:i,className:"shrink-0 object-contain",style:{...H?{height:r,width:"auto",...x?{maxWidth:"100cqi"}:{}}:{display:"none"},...nt?{filter:It}:{},...o?{filter:`url(#${k})`}:{}},onLoad:()=>L(e),onError:()=>I(t=>t+1)},e)]})}export{Ht as FOOTER_LOGO_PX,Tt as HEADER_LOGO_PX,Mt as HEADER_LOGO_PX_MAX,Nt as HEADER_LOGO_PX_MIN,Wt as LOGO_BLOCK_PX_MAX,Ft as WORDMARK_FIT_FLOOR_PX,Lt as default};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{SPLITTABLE_SECTIONS as
|
|
2
|
-
one standard.`,
|
|
1
|
+
import{SPLITTABLE_SECTIONS as P}from"../../../../../format/lib/sections/section-head-placement.js";import{AUTO_COLUMN as A,BUTTON as M,DIM as W,INNER_BOX as r,SH_LINK as C,TEXT as h,smallText as R}from"./section-to-box-row-parts.js";import{labelTextSeed as D}from"../../../../../format/lib/document/text-seeds.js";import{labelStyle as x,token as a}from"../../../../../format/lib/document/seed-parts.js";import{tabletKey as w}from"efficient-easel/draw";import{BOX_DESKTOP_LINE as H,STACK_BELOW_PROP as F}from"../../../content/box-stack-line.js";import{ownEntry as u}from"../../../../../format/lib/own-entry.js";function b(e){if(e==="ProductGrid")return"shelf";const t=u(P,e)?.headStyle;return t==="editorial"||t==="simple"||t==="essay"?t:"standard"}const ne={standard:64,editorial:60,simple:36,essay:28,shelf:20},K={SectionHeader:"accent",FAQ:"accent",FitmentFinder:"accent",FitmentTable:"accent",SpecTable:"accent",RelatedProducts:"accent",Collections:"accentNum"};function z(e){if(e==="SectionHeader")return{num:"num",title:"title",description:"description",link:!0};const t=u(P,e);if(!t)throw new Error(`section-head-looks: "${e}" has no head row in SPLITTABLE_SECTIONS`);return{num:t.num,title:t.title,description:t.description,link:t.headRows.includes("linkText")&&t.headRows.includes("linkHref")}}function ie(e,t,n){const i=`editorial:${e}|${t}|${n}`,o=p.get(i);if(o)return o;const l=L({num:e,title:t,description:n,link:!1});return p.set(i,l),l}const E={[F]:H},m={top:0,right:0,bottom:1,left:0};import{token as le}from"../../../../../format/lib/document/seed-parts.js";const _=(e,t,n,i)=>({sizeToken:{step:e,px:i,fluid:{minPx:t,vw:n}}}),c=(e,t,n={})=>R(e,{...a("label",t),...n}),d=(e,t)=>({kind:"text",key:e,role:"heading",props:h,style:{textStyle:"heading-2",...t}}),f=800,U=H,T=(e,t,n,i,o={})=>({kind:"text",key:e,props:{...W,align:"right",alignPhone:"left",...n?{maxWidth:n,maxWidthPhone:f}:{},...o},style:{textStyle:"body-5",fontRole:"heading",alignPhone:"left",...a("body",t),...i,...o}}),N={...M,align:"right",alignPhone:"left",...C},S=e=>({kind:"button",key:"linkText",href:"linkHref",variant:"ghost",props:N,style:{...x(e),color:"labels"}}),O=(e,t,n)=>{const i=n.role==="heading"?{tag:"h2"}:{};return{kind:"block",type:"Text",when:o=>o[e]===void 0,props:{...h,...i,...n.props,text:t,_partStyles:{text:{...n.role==="eyebrow"?j(D()):{},...n.style}}}}},j=e=>e._partStyles.text??{},s={widthFitPhone:"fill"};function $(e){if(e.kind!=="group")return e;if(e.name==="Words"){const t=e.props;return{...e,props:typeof t=="function"?(n,i)=>({...t(n,i),...s}):{...t,...s}}}return{...e,parts:e.parts.map($)}}function v(e,t){const n=u(K,e),i=n==="accent",o=c(t.num,14,{color:i?"accent":"labels"}),l=n==="accentNum"&&o.kind==="text"?{...o,mark:"accentLead"}:o,k=d(t.title,i?{..._("headingMedium",36,5,64),case:"upper",lineHeight:.95,letterSpacing:-.025}:{...a("headingMedium",56,36),case:"none",lineHeight:1,letterSpacing:-.03}),g=e==="Collections";return{kind:"group",name:"Header",props:{...r,direction:"row",align:"end",justify:"between",gap:40,gapPhone:12,share:"content",sectionBorder:m,sectionPaddingBottom:24,sectionPaddingBottomPhone:20},parts:[{kind:"group",name:"Title",props:{...r,...s,direction:"row",align:"end",gap:40,gapPhone:12,share:"content"},parts:[{kind:"group",name:"Number",props:{...r,...s,align:"start",gap:12},parts:[{kind:"image",key:"logoSrc",alt:"logoAlt",props:{aspect:"auto",contained:!1}},l,...g?[O(t.num,"==01== / Collections",l)]:[]]},{kind:"group",name:"Heading",props:{...r,...s},parts:[k,...g?[O(t.title,`Three ranges,
|
|
2
|
+
one standard.`,k)]:[]]}]},{kind:"group",name:"Words",props:{...r,...s,gap:12,maxWidth:340,maxWidthPhone:f},parts:[...t.description?[T(t.description,14,void 0,{lineHeight:1.5})]:[],...t.link?[S(14)]:[],...g?[{kind:"block",type:"ButtonBlock",props:{...N,variant:"ghost",label:"View all",href:"/wheels",_partStyles:{label:S(14).style}}}]:[]]}]}}function y(e,t){return e.kind==="text"?t.includes(e.key)?{...e,mark:"accentItalic"}:e:e.kind==="group"?{...e,parts:e.parts.map(n=>y(n,t))}:e}function L(e){const t=d(e.title,{..._("headingMedium",40,5.5,80),case:"upper",weight:500,lineHeight:1,letterSpacing:-.03});return{kind:"group",name:"Header",props:{...r,direction:"row",align:"end",justify:"between",gap:40,gapPhone:14,share:"content",sectionBorder:m,sectionPaddingBottom:32,...E},parts:[{kind:"group",name:"Title",props:{...r,direction:"row",align:"end",gap:40,gapPhone:14,share:"content",...E},parts:[{kind:"group",name:"Number",props:{...r,sectionPaddingBottom:8},parts:[{...c(e.num,13),props:{...h,...A}}]},y(t,[e.title])]},{kind:"group",name:"Words",props:{...r,sectionPaddingBottom:4,maxWidth:360,[w("maxWidth")]:U,maxWidthPhone:f},parts:e.description?[T(e.description,14,void 0,{lineHeight:1.5},{[w("align")]:"left"})]:[]}]}}function B(e,t){return{kind:"group",name:"Header",props:{...r,gap:16,gapPhone:16},parts:[c(e.num,13),d(e.title,t)]}}const I=[["para",{...x(13),weight:400,lineHeight:1,letterSpacing:.22}],["sm",{...a("headingMedium",40,28),case:"none",weight:500,lineHeight:1,letterSpacing:-.03}],["md",{...a("headingMedium",48,32),case:"none",weight:500,lineHeight:1,letterSpacing:-.03}],["lg",{...a("headingMedium",56,36),case:"none",weight:500,lineHeight:1,letterSpacing:-.03}],["xl",{...a("headingMedium",64,40),case:"none",weight:500,lineHeight:1,letterSpacing:-.03}]],X=e=>I.some(([t])=>t===e.titleSize)?e.titleSize:"lg";function G(e){return{kind:"group",name:"Header",props:{...r,direction:"row",align:"center",justify:"between",gap:16,share:"content",stickTop:!0,sectionBorder:m,sectionPaddingTop:12,sectionPaddingBottom:12},parts:[{kind:"group",name:"Title",props:{...r,direction:"row",align:"end",gap:24,share:"content"},parts:[c(e.num,13,{color:"labels",letterSpacing:.22,lineHeight:1}),...I.map(([t,n])=>({...d(e.title,n),when:i=>X(i)===t}))]},{kind:"group",name:"Words",props:{...r,direction:"row",align:"center",justify:"end",gap:20,share:"content"},parts:[...e.description?[T(e.description,13,340,{lineHeight:1.4})]:[],...e.link?[S(13)]:[]]}]}}function oe(e){return b(e)==="shelf"?{titleSize:"the Header Box's title Text part: its size, as the old shelf title drew it (lib/document/blocks/general/section-head-looks)"}:{}}const p=new Map,Q={...a("headingMedium",44,32),case:"upper",weight:500,lineHeight:1,letterSpacing:-.02};function re(e){const t=p.get(e);if(t)return t;const n=z(e),i=b(e),o=i==="editorial"?L(n):i==="simple"?B(n,Q):i==="essay"?B(n,{...a("headingMedium",38,28,"headingSmall"),case:"upper",lineHeight:1,letterSpacing:-.02}):i==="shelf"?G(n):v(e,n);return p.set(e,o),o}export{E as EDITORIAL_LINE,ne as HEAD_BELOW,Q as SIMPLE_HEADING_LOOK,ie as editorialHeadTree,_ as fluidToken,b as headLookOf,oe as headReads,re as headTree,$ as headWordsOnPhoneLine,le as token,y as withAccentItalic};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{siteLengthHeld as D,storedUnit as x}from"../../../../../format/lib/content/css-length.js";import{SECTION_WIDTH_KEYS as G}from"../../../../../format/lib/content/section-width.js";import{BLOCK_LENGTH_KEYS as I,blockLengthUnitKey as M}from"../../../content/block-size.js";import{viewStoreKeys as v}from"../../../../../format/lib/animation/views.js";import{BOX as W,INNER_BOX as C,LABEL_FACE as U,TEXT as R,boxPadding as
|
|
1
|
+
import{siteLengthHeld as D,storedUnit as x}from"../../../../../format/lib/content/css-length.js";import{SECTION_WIDTH_KEYS as G}from"../../../../../format/lib/content/section-width.js";import{BLOCK_LENGTH_KEYS as I,blockLengthUnitKey as M}from"../../../content/block-size.js";import{viewStoreKeys as v}from"../../../../../format/lib/animation/views.js";import{BOX as W,INNER_BOX as C,LABEL_FACE as U,TEXT as R,boxPadding as w,fillSlot as B,token as F}from"../../../../../format/lib/document/seed-parts.js";import{ENTRANCE_STORE_KEYS as Y,LEGACY_ENTRANCE_KEY as X}from"../../../animation/entrance.js";import{SCROLL_STORE_KEYS as V}from"../../../../../format/lib/animation/scroll.js";import{SECTION_PIN_KEYS as $}from"../../../../../format/lib/content/section-sticky.js";import{SECTION_CORNERS_ROW as j}from"../../../../../format/lib/content/section-corners.js";import{SECTION_BORDER_UNIT_KEYS as z}from"../../../../../format/lib/content/borders.js";import{CARD_HOVER_KEYS as N}from"../../../../../format/lib/animation/hover.js";import{COUNT_KEY_PROP as J}from"../../../../../format/lib/content/block-sources.js";import{SITE_GUTTER as q,SITE_GUTTER_PHONE as Q,normalizeSiteGutter as Z,normalizeSiteGutterPhone as tt,siteGutterPhoneFollows as ot}from"../../../../../format/lib/content/page-width.js";import{resolveSectionPadding as et}from"../../../content/section-padding.js";import{ButtonBlockMeta as nt}from"../../../../../format/lib/document/blocks/general/ButtonBlock/meta.js";import{SECTION_PAD_INNER_DEFAULTS as it}from"../../passes/section-padding.js";import{finiteNumber as b}from"../../../../../format/lib/finite-number.js";import{convertTheme as _,hasWords as rt}from"../../../sections/section-to-box.js";import{THEME_SECTION_BG as st}from"../../../../../format/lib/content/section-background.js";import{fillSlotOfInk as A}from"../../../../../format/lib/document/part-inks.js";import{parseHexColor as dt}from"efficient-shell/format";import{convertLength as ct}from"efficient-easel/screen/lib/content/length-units";import{bandPresetIndex as at,surfacePresetIndex as pt,surfaceTwoTone as lt}from"../../../../../format/lib/theme.js";import{VIEW_HIDE_KEYS as mt}from"../../../../../format/lib/content/view-hide-class.js";import{tierOfView as gt}from"../../../../../format/lib/content/view-tier.js";import{ownEntry as Pt}from"../../../../../format/lib/own-entry.js";const s=(t,o,e,n)=>o===e?t:ct(t,o,e,n,{min:0,max:200,step:4});import{BOX as So,DIM as Bo,INNER_BOX as No,TEXT as Io}from"../../../../../format/lib/document/seed-parts.js";const Jt={textFit:"line",textFitPhone:"wrap"},ht={...R,[J]:""},{label:qt,href:Qt,...ft}=nt.defaultProps,Zt=ft,to={buttonFillOpacity:0,buttonBorder:{width:0},buttonPaddingTop:0,buttonPaddingRight:0,buttonPaddingBottom:0,buttonPaddingLeft:0},oo={...W,sectionAccent:0},eo={sectionAccent:-1},no=["gridSpan","sectionHeightMode","sectionHeightValue","sectionHeightUnit","sectionHeightModeTablet","sectionHeightValueTablet","sectionHeightUnitTablet","sectionHeightModePhone","sectionHeightValuePhone","sectionHeightUnitPhone","sectionCorners","sectionCornerSides","sectionBorder","sectionBorderTablet","sectionBorderPhone","sectionAccent",j.unitKey,...z,...$,"anchor",X,...mt,...Y,...V,...v(["widthFit",...I,...I.map(M)]),...Object.values(G)],P="a section width key, ignored since efficient-web-builder 45 (an old key; a section's own width has new keys, lib/content/section-width), so dropping it changes nothing",io={sectionSurface:"read by nothing in src/ (searched 2026-10-24): a retired theme key that draws nothing today, so dropping it changes nothing",widthMode:P,fullWidth:P,pageWidth:P,backgroundWidth:P,contentWidth:P,contentMax:P},ro=Object.fromEntries(["sectionPaddingLeft","sectionPaddingRight","sectionPaddingLeftTablet","sectionPaddingRightTablet","sectionPaddingLeftPhone","sectionPaddingRightPhone"].map(t=>[t,"needs Box side padding outside its gutter: the old section added it outside its frame, a Box's side padding replaces the gutter. 0 live nodes store it (JJ's read-only export, 2026-10-24)"]));function ut(t,o){const e=b(t.sectionPaddingTop)??0,n=b(t.sectionPaddingBottom)??0,i=b(t.sectionPaddingTopTablet),r=b(t.sectionPaddingBottomTablet),c=x(t.sectionPaddingUnit),p=x(t.sectionPaddingUnitTablet),l=x(t.sectionPaddingUnitPhone),h=(m,a,u,g)=>{const d=b(m);if(d!==void 0)return d+s(g,"px",l,"mobile");const T=a===void 0?{n:u,unit:c}:{n:a,unit:p};return s(T.n,T.unit,l,"mobile")+s(g,"px",l,"mobile")},f=(m,a,u,g,d)=>a!==void 0?{[m]:a+s(d??g,"px",p,"tablet")}:d===void 0?{}:{[m]:s(u,c,p,"tablet")+s(d,"px",p,"tablet")};return{sectionPaddingTop:e+s(o.top,"px",c,"desktop"),sectionPaddingBottom:n+s(o.bottom,"px",c,"desktop"),...f("sectionPaddingTopTablet",i,e,o.top,o.topTablet),...f("sectionPaddingBottomTablet",r,n,o.bottom,o.bottomTablet),sectionPaddingTopPhone:h(t.sectionPaddingTopPhone,i,e,o.topPhone),sectionPaddingBottomPhone:h(t.sectionPaddingBottomPhone,r,n,o.bottomPhone)}}const so=t=>[...["sectionPaddingTop","sectionPaddingBottom","sectionPaddingTopTablet","sectionPaddingBottomTablet","sectionPaddingTopPhone","sectionPaddingBottomPhone"].map(o=>[o,o,(e,n)=>ut(n,typeof t=="function"?t(n):t)[o]]),["sectionPaddingUnit","sectionPaddingUnit"],["sectionPaddingUnitTablet","sectionPaddingUnitTablet"],["sectionPaddingUnitPhone","sectionPaddingUnitPhone"]];function E(t,o){const e=et(t,Pt(it,o));return{sectionPaddingTop:e.top,sectionPaddingBottom:e.bottom}}const co=t=>[["padTop","sectionPaddingTop",(o,e)=>E(e,t).sectionPaddingTop],["padBottom","sectionPaddingBottom",(o,e)=>E(e,t).sectionPaddingBottom],["sectionPaddingTop","sectionPaddingTop",(o,e)=>E(e,t).sectionPaddingTop],["sectionPaddingBottom","sectionPaddingBottom",(o,e)=>E(e,t).sectionPaddingBottom]],Tt={kind:"heading-case-upper",styles:["heading-1","heading-2","heading-3"]},ao=t=>o=>rt(o.props[t])?[Tt]:[],bt=(t,o)=>({kind:"text",key:t,role:"eyebrow",props:R,...o?{style:o}:{}}),po=t=>({kind:"group",name:"Chip",props:{...C,...B("main"),...w(6,14)},parts:[bt(t,{color:"background",...F("label",12),weight:600,letterSpacing:.16})]}),H=t=>t.background!=="transparent",xt=(t,o)=>{const[e,n]=[t,o].map(i=>typeof i=="string"?i.trim():"");return e?n?`[${e} ]{color=text}${n}`:`[${e}]{color=text}`:n},k={align:"right",alignPhone:"left"},_t=(t,o,e)=>{const n=i=>xt(i[t],i[o]);return{kind:"block",type:"Text",when:(i,r)=>r!==void 0&&n(r)!=="",box:[[t,"text",(i,r)=>n(r)],[o,"text",(i,r)=>n(r)]],props:e}},lo=(t,o,e,n={})=>_t(t,o,{...ht,...k,...n,_partStyles:{text:{...U,color:"labels",...e,case:U.case,...k}}}),O=(t,o)=>typeof t=="number"&&Number.isInteger(t)&&t>=0?t:_(o)?.selected??0,L="var(--site-surface-2)",y=(t,o)=>_(o)?.themes[O(t.sectionAccent??0,o)],Et=(t,o)=>(e,n)=>{if(!o?.(e,n))return B(t);const i=y(e,n)?.[t];return i?{fillColor:i}:{}},mo=(t,o)=>S(t,o)>=0,K=t=>t.startsWith("#")&&dt(t)!==null,go=(t,o,e)=>{const n=t?.trim();if(n&&K(n))return{fillColor:n};const i=A(n);if(i)return B(i);const r=n===L?y(o,e):void 0;return r?{fillColor:lt(r)}:{}},Po=t=>{const o=t?.trim();return!o||o==="transparent"||o===st||A(o)||o===L||K(o)?void 0:"it paints a colour that no Box Fill can hold"},S=(t,o)=>{const e=_(o)?.themes;return e&&H(t)?at(e,O(t.sectionAccent,o)):-1},ho=(t,o,e)=>{const n=S(o,e);return n>=0?n:t},fo=(t,o)=>{const e=_(o)?.themes,n=e?pt(e,O(t,o)):-1;return n>=0?n:t},uo=(t,o)=>{const e=S(t,o);return e>=0?{sectionAccent:e}:{}},To=(t,o)=>H(t.props)&&S(t.props,o)<0?[{kind:"band-preset",page:O(t.props.sectionAccent,o)}]:[],bo=(t,{view:o="desktop",to:e="px",maxPx:n=1/0}={})=>{const{siteGutter:i,siteGutterUnit:r,siteGutterPhone:c,siteGutterPhoneUnit:p}=t.site??{},l=gt(o),h=(a,u,g)=>{const d=x(u),T=D(a,d,"spacing",g);return T===null?null:s(T,d,"px",l)},f=h(i,r,q)??Z(i),m=o==="desktop"?f:h(c,p,Q)??tt(c)??ot(f);return s(Math.min(n,m),"px",e,l)},Ot=Object.fromEntries(["Top","Right","Bottom","Left","TopPhone","RightPhone","BottomPhone","LeftPhone"].map(t=>[`sectionPadding${t}`,0])),xo=t=>({top:0,right:0,bottom:0,left:0,...t}),_o=(t,o,e,n=[])=>({kind:"group",name:t,keepEmpty:!0,props:(i,r)=>({...C,...Ot,...Et("surface")(i,r),...typeof e=="function"?e(i,r):e}),box:[[o,"bgImage"],N.kind,N.duration,N.delay],parts:n});export{Jt as AUTO_COLUMN,So as BOX,Zt as BUTTON,Bo as DIM,io as DROP_COMMON,ro as DROP_SIDE_PADDING,eo as FOLLOW_THE_BOX,Tt as HEADING_CASE_UPPER,No as INNER_BOX,Ot as NO_PAD,ht as NUMBER_TEXT,k as RIGHT_WORDS,no as SAME_KEYS,oo as SECTION_BOX,to as SH_LINK,Io as TEXT,ho as bandAccent,S as bandIndex,O as bandPage,uo as bandProps,To as bandWrites,Et as fillFrom,Po as fillNoBoxHolds,po as filledChip,ao as headingCaseOf,E as innerPad,co as innerPadKeys,lo as leadLine,_t as leadText,xo as lineSides,xt as numberAndUnit,mo as onBandPreset,go as ownFill,_o as pictureCell,y as sectionPage,bo as siteGutterOf,bt as smallText,fo as surfaceAccent,ut as wrapperPad,so as wrapperPadKeys};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{SPLITTABLE_SECTIONS as
|
|
1
|
+
import{SPLITTABLE_SECTIONS as b}from"../../../../../format/lib/sections/section-head-placement.js";import{SECTION_LABELS as g}from"../../../../../format/lib/document/section-catalog.js";import{SAME_KEYS as B,SECTION_BOX as A,innerPad as R}from"./section-to-box-row-parts.js";import{SITE_SIDE as l}from"efficient-easel/screen/lib/content/length-units";import{EDITORIAL_LINE as C,HEAD_BELOW as S,headLookOf as E,headReads as L,headTree as w}from"./section-head-looks.js";import{finiteNumber as I}from"../../../../../format/lib/finite-number.js";import{CARD_TEMPLATE_SLOT as P}from"../../../../../format/lib/content/card-template.js";import{footprintCardSeed as N}from"../../../../../format/lib/document/blocks/general/Footprint/card-seed.js";import{faqCardSeed as k,faqRunStyleKeys as D}from"../../../../../format/lib/document/blocks/general/FAQ/card-seed.js";import{PROCESS_COLUMNS_SLOT as H,processColumnSeeds as F}from"../../../../../format/lib/document/blocks/general/ProcessSteps/column-seed.js";import{BOX_SIDE_SPACE_PROP as y,BOX_SIDE_SPACE_SITE as j}from"../../../../../format/lib/content/box-side-space.js";import{INNER_BOX as x}from"../../../../../format/lib/document/seed-parts.js";import{SECTION_ACCENT_INHERIT as X}from"../../../../../format/lib/content/section-surface.js";import{ownEntry as c}from"../../../../../format/lib/own-entry.js";const Y=["FAQ","Footprint","LongRead","ProcessSteps","RelatedProducts"],io=["Collections","Events","FitmentTable","GalleryB","ProductGrid","SpecTable"],s=(e,o)=>()=>({top:e,topPhone:o}),_=e=>o=>{const r=R(o,e).sectionPaddingTop;return{top:r,topPhone:r}},M={Collections:s(120,70),Events:s(120,70),FAQ:s(120,70),GalleryB:s(120,70),FitmentTable:s(120,80),SpecTable:s(120,80),LongRead:s(120,80),RelatedProducts:s(0,0),Footprint:_("Footprint"),ProcessSteps:_("ProcessSteps"),ProductGrid:e=>({top:I(e.padTop)??120,topPhone:0})};function Q(e,o={}){const r=c(b,e),n=c(M,e);if(!r||!n)throw new Error(`section-to-box-rows-head: "${e}" has no head row or no head room`);const p=r.padKey,O=w(e),d=L(e),f=r.headRows.filter(t=>![r.num,r.title,r.description,"linkText","linkHref"].includes(t)),a={...Object.fromEntries(f.filter(t=>!(t in d)).map(t=>[t,"a head setting no Header Box part reads (lib/document/blocks/general/section-head-looks `headReads`)"])),...o.drop};return{name:c(g,e)??e,boxProps:(t,i)=>{const m=n(t),h=o.roomBelow?{sectionPaddingBottom:o.roomBelow.bottom,sectionPaddingBottomPhone:o.roomBelow.bottomPhone}:{},T=typeof o.boxProps=="function"?o.boxProps(t,i):o.boxProps??{},u=E(e)==="editorial"?C:{};return{...A,direction:"column",gap:S[E(e)],sectionPaddingTop:m.top,sectionPaddingTopPhone:m.topPhone,...u,...h,...T}},box:[...B,...p?[[p,"sectionPaddingTop",(t,i)=>n(i).top]]:[]],parts:[O,...(()=>{const t={...p?{[p]:0}:{},...o.coreProps},i={kind:"core",keep:"rest",...Object.keys(t).length?{props:t}:{},...o.slots?{slots:o.slots}:{}};return[o.coreBox?{kind:"group",name:o.coreBox.name,props:o.coreBox.props,parts:[i]}:i]})(),...o.partsAfter??[]],...Object.keys(d).length?{reads:d}:{},...Object.keys(a).length?{drop:a}:{},...o.pressHeading?{pressKeepsEmpty:[r.title]}:{},...o.skip?{skip:o.skip}:{}}}const G={...x,direction:"accordion",rowStyle:"numbered"},K={sectionPaddingLeft:l,sectionPaddingRight:l},v={Footprint:{slots:{[P]:[N()]},pressHeading:!0},ProcessSteps:{slots:(e,o)=>o.press?{[H]:F().map(r=>({...r,props:{...r.props,...K}}))}:{},boxProps:{gapPhone:S.editorial}},FAQ:{slots:{[P]:[k()]},pressHeading:!0,coreBox:{name:"Questions",props:G},coreProps:{sectionAccent:X},roomBelow:{bottom:120,bottomPhone:70},boxProps:(e,o)=>o.press?{}:{[y]:j},skip:e=>{const o=e._partStyles??{},r=D().filter(n=>o[n]!==void 0);return r.length?`held: its rows carry their own run style (_partStyles ${r.map(n=>`"${n}"`).join(", ")}), which the Box path does not draw the same`:void 0}}},po=Object.fromEntries(Y.map(e=>[e,Q(e,c(v,e))]));export{G as FAQ_ROWS_BOX,v as HEAD_ONLY_CARD_SEEDS,po as HEAD_ONLY_SECTION_TO_BOX,Y as HEAD_ONLY_TYPES,io as HOST_ROW_HEAD_TYPES,Q as headOnlyRow};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{isNode as
|
|
1
|
+
import{isNode as w,isNodeList as u}from"efficient-easel/data";import{storedStepsShown as A}from"../../components/ProcessSteps.js";import{declaredBlockSource as l,servedRows as L,sourcedRows as P}from"../../../format/lib/content/block-sources.js";import{rowHoldsContent as B}from"../../../format/lib/content/card-state.js";import{CARD_LIST_TYPE as C}from"../../../format/lib/content/card-template.js";import{wallRows as R}from"./blocks/general/Logos/wall-rows.js";import{HEAD_CORE_PROP as _,HOLDS_HEAD_CORE_PROP as a}from"../content/empty-hides.js";import{parseSectionHeadPlacement as v}from"../../../format/lib/sections/section-head-placement.js";import{ownEntry as y}from"../../../format/lib/own-entry.js";const p="Flex",H="Text",i=r=>Object.values(r??{}).filter(u),b=r=>r.type===C&&l(r.props)!=="",x=r=>{if(r.type!==p)return!1;const t=i(r.props).flat();return t.length>0&&t.every(b)},c=r=>v(r.props?.headPlacement)==="own-box"||x(r),m=r=>r===void 0||Array.isArray(r)&&r.length===0;function g(r){return r.type===H?!0:r.type===p&&i(r.props).every(t=>t.every(g))}const E={ProcessSteps:r=>m(r.boxes)&&A(r.steps).length===0,Logos:r=>l(r)?T(r):m(r.logos)&&m(r.items)};function T(r){return L(r)!==null&&R(r,!1).length===0}function d(r){return i(r.props).flat().every(t=>!P(t.props,!1).rows.some(B))}function f(r){const t=i(r.props).flat();return t.some(c)&&t.every(o=>c(o)||g(o))}function S(r){const t={...r.props};for(const[o,s]of Object.entries(r.props??{}))!u(s)||!s.some(e=>w(e)&&c(e))||(t[o]=s.map(e=>{if(!c(e))return e;const n=x(e)?d(e):y(E,String(e.type))?.(e.props??{})===!0;return{...e,props:{...e.props,[_]:n?"empty":!0}}}));return{...r,props:t}}function h(r){const o=Object.entries(r.props??{}).filter(([,e])=>u(e)).filter(([,e])=>e.length>0);if(o.length!==1||o[0][1].length!==1)return null;const s=o[0][1][0];return s?.type===p&&s.props?{key:o[0][0],inner:s}:null}function O(r){if(r?.type!==p||!r.props)return r;if(f(r)){const o=S(r);return{...o,props:{...o.props,[a]:!0}}}const t=h(r);return!t||!f(t.inner)?r:{...r,props:{...r.props,[t.key]:[S(t.inner)],[a]:!0}}}function G(r){const t=r;if(!t||!Array.isArray(t.content))return r;let o=!1;const s=t.content.map(e=>{const n=O(e);return n!==e&&(o=!0),n});return o?{...t,content:s}:r}const j=r=>y(E,String(r.type))?.(r.props??{})===!0;function D(r){if(r.type!==p||!r.props)return!1;const t=f(r)?null:h(r),o=t?t.inner:r;if(!f(o))return!1;const s=i(o.props).flat().filter(c);return s.some(e=>l(e.props)!=="")&&s.every(j)}function k(r){let t;for(const[o,s]of Object.entries(r.props??{})){if(!u(s))continue;const e=s,n=I(e);n!==e&&((t??={...r.props})[o]=n)}return t?{...r,props:t}:r}function I(r){let t=!1;const o=[];for(const s of r){if(D(s)){t=!0;continue}const e=k(s);e!==s&&(t=!0),o.push(e)}return t?o:r}function J(r){const t=r;if(!t||!Array.isArray(t.content))return r;let o=!1;const s=t.content.map(e=>{if(O(e)!==e)return e;const n=k(e);return n!==e&&(o=!0),n});return o?{...t,content:s}:r}export{J as dropEmptySourcedBoxes,G as markHeadCoreBoxes};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{pinnedDuplicateIndices as h}from"efficient-easel/draw";import{SLOT_SECTION_SPECS as A}from"./slot-specs.js";const
|
|
1
|
+
import{pinnedDuplicateIndices as h}from"efficient-easel/draw";import{SLOT_SECTION_SPECS as A}from"./slot-specs.js";import{ownEntry as S}from"../../../format/lib/own-entry.js";const T=["GalleryB"];function I(n){const o=n.content;if(!Array.isArray(o))return n;let i=!1;const c=o.map(t=>{const r=t?.type;if(!r||!T.includes(r))return t;const e=S(A,r);if(!e?.legacy)return t;const s=t.props??{},l=s[e.slot];if(Array.isArray(l)&&l.length>0)return t;const a=e.legacy(s);if(!a.length)return t;i=!0;const u=String(s.id??r),f=a.map((g,m)=>({type:e.childType,props:{id:`${e.childType}-${u}-${m}`,...g}}));return{...t,props:{...s,[e.slot]:f}}}),p=new Set(h(c)),y=p.size?c.filter((t,r)=>!p.has(r)):c;return p.size&&(i=!0),i?{...n,content:y}:n}export{I as migrateLegacyPageData};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{textStyleCaseCss as ce,textStyleCaseOfCss as le,viewKeyAt as K}from"efficient-easel/draw";import{FONT_OPTIONS as ue,fontOption as pe,fontRoleOf as w,SIZE_STEP_OF_ROLE as k}from"../../../format/lib/fonts.js";import{encodePartKey as B}from"../../../format/lib/document/part-key.js";import{decodePartId as X,normalizePartText as I}from"./text-parts.js";import{partInkCss as de}from"../../../format/lib/document/part-inks.js";import{regionStyle as ge}from"../../../format/lib/sections/text-regions.js";import{EDGE_PHONE_MEDIA as xe,EDGE_TABLET_MEDIA as he,PHONE_MEDIA as be,TABLET_MEDIA as Se,viewOverrides as me}from"../content/view-values.js";import{plainRecord as F,propsWithPartRecord as Te,readPartRecord as Pe,readPartRecords as ze}from"../../../format/lib/document/part-records.js";import{isLengthUnit as M}from"efficient-easel/screen/lib/content/length-units";import{cssLengthOf as _,storedUnit as _e}from"../../../format/lib/content/css-length.js";const y="_partStyles",Ae="data-sf-part-styled",Y="data-sf-text-style",Re=/^(heading|body)-[1-7]$/;function S(e){return typeof e=="string"&&Re.test(e)}const V={heading:"heading-1",heading2:"heading-2",heading3:"heading-3",body:"body-1",label:"body-5"};function Ee(e){if(!e)return null;for(const[t,n]of Object.entries(V))if(n===e)return t;return null}function Lt(e){if(S(e.textStyle))return e.textStyle;const t=w(e.role);return t?V[t]:void 0}const we=[400,500,600,700],R=["left","center","right","justify"],L=5,D=1e3,Oe=-5,Ne=10,$e=0,ke=64,Ie=2,Z={size:{min:L,max:D,step:1},sizeTablet:{min:L,max:D,step:1},sizePhone:{min:L,max:D,step:1},padding:{min:$e,max:ke,step:Ie}},Fe=.05,Me=.01,ye=["line","letter"],Le=.5,De=2.5,je=-1,He=1,Ue=0,Ce=400,ve=[...new Set(Object.values(k))];function Dt(e){return[`${e} { transition: translate var(--page-motion-hover-duration) var(--page-ease-media) var(--page-motion-hover-delay) }`,`${e}:hover, ${e}:active { translate: 0 calc(-1 * var(--page-hover-lift)) }`]}function jt(e){return ze(e,y)}function q(e,t){return Pe(e,y,t)}function Ht(e,t){return Object.values(q(e,t)).filter(n=>n!==void 0).length}function J(e,t,n){return Te(e,y,t,We(n).length?n:null)}function We(e){return Object.entries(e).filter(([,t])=>t!==void 0)}function Ge(e){return ye.includes(e)}const E=(e,t,n)=>Math.min(n,Math.max(t,e)),Ke=["sizeUnit","sizeUnitTablet","sizeUnitPhone"];function j(e){const t=K("sizeUnit",e),n=Ke.find(o=>o===t);if(!n)throw new Error(`a part stores no unit key ${t}`);return n}const m={size:j("desktop"),sizeTablet:j("tablet"),sizePhone:j("mobile"),paragraphSpacing:"paragraphSpacingUnit",padding:"paddingUnit"},Q=Object.values(m);function h(e,t){return _e(e[m[t]])}function Be(e,t,n={}){if(Q.includes(e))return M(t)&&t!=="px"?t:null;if(Object.hasOwn(m,e)&&h(n,e)!=="px"){const o=P(Number(t),2);return!Number.isFinite(o)||o<0||o===0&&e!=="padding"?null:o}if(Ge(e)){const o=Math.round(Number(t));return!Number.isFinite(o)||o===0?null:E(o,Oe,Ne)}if(e==="lineHeight"){const o=Number(t);return Number.isFinite(o)?P(E(o,Le,De),3):null}if(e==="letterSpacing"){const o=Number(t);return Number.isFinite(o)?P(E(o,je,He),4):null}if(e==="paragraphSpacing"){const o=Math.round(Number(t));return!Number.isFinite(o)||o<=0?null:E(o,Ue,Ce)}if(Object.hasOwn(Z,e)){const{min:o,max:i}=Z[e],r=Math.round(Number(t));return Number.isFinite(r)?E(r,o,i):null}return e==="italic"?typeof t=="boolean"?t:null:e==="role"||e==="fontRole"?w(t)?t:null:e==="sizeToken"?H(t)?t:null:e==="textStyle"?S(t)?t:null:e==="alignPhone"||e==="alignTablet"?R.includes(t)?t:null:t}const Xe=["weight","size","sizeTablet","sizePhone","line","letter","lineHeight","letterSpacing","paragraphSpacing","padding"];function A(e){let t=null;const n=o=>{t??={...e},delete t[o]};for(const o of Xe){const i=e[o];i!==void 0&&!(typeof i=="number"&&Number.isFinite(i))&&n(o)}e.align!==void 0&&!R.includes(e.align)&&n("align"),e.alignTablet!==void 0&&!R.includes(e.alignTablet)&&n("alignTablet"),e.alignPhone!==void 0&&!R.includes(e.alignPhone)&&n("alignPhone"),e.textStyle!==void 0&&!S(e.textStyle)&&n("textStyle"),e.sizeToken!==void 0&&!H(e.sizeToken)&&n("sizeToken"),e.fontRole!==void 0&&!w(e.fontRole)&&n("fontRole");for(const o of Q)e[o]!==void 0&&!M(e[o])&&n(o);return t??e}function H(e){if(!e||typeof e!="object")return!1;const{step:t,px:n,stepPhone:o,pxPhone:i,fluid:r}=e,c=l=>typeof l=="number"&&Number.isFinite(l)&&l>0,a=l=>typeof l=="string"&&ve.includes(l);return a(t)&&c(n)&&(o===void 0||a(o))&&(i===void 0||c(i))&&(r===void 0||Ye(r,n))}function Ye(e,t){if(!e||typeof e!="object"||Array.isArray(e))return!1;const{minPx:n,vw:o,...i}=e;return Object.keys(i).length===0&&typeof n=="number"&&Number.isFinite(n)&&n>0&&n<t&&typeof o=="number"&&Number.isFinite(o)&&o>0&&o<=100}function U(e){return e?.pxPhone&&H(e)?{step:e.stepPhone??e.step,px:e.pxPhone}:null}function ee({step:e,px:t,fluid:n}){const o=n?`clamp(${n.minPx}px, ${n.vw}vw, ${t}px)`:`${t}px`,i=`var(--size-${e}, ${o})`;return e.startsWith("heading")?`min(${i}, var(--sf-heading-max,9999px))`:i}const Ve=[["font","role"],["font","fontRole"],["role","textStyle"],["line","lineHeight"],["letter","letterSpacing"]];function Ze(e){const t=[];for(const[n,o]of Ve)n===e?t.push(o):o===e&&t.push(n);return t}function Ut(e,t,n,o){const i={...q(e,t)},r=o==null?null:Be(n,o,i);if(r===null)delete i[n];else{i[n]=r;for(const c of Ze(n))delete i[c]}return J(e,t,i)}function Ct(e,t){return J(e,t,{})}function qe(e){return le(e)??"none"}function Je(e){return ce(e)??""}const te={heading:"--font-role-heading",heading2:"--font-role-heading2",heading3:"--font-role-heading3",body:"--font-role-body",accent:"--font-role-accent",label:"--font-role-label"};function Qe(e,t){const n=w(e.role);return n||(t?.blockDrawsStyle?null:Ee(e.textStyle))}function vt(e,t){return e==="Text"&&t==="text"}const et={headingLarge:"min(clamp(64px,9vw,144px), var(--sf-heading-max,9999px))",headingMedium:"min(32px, var(--sf-heading-max,9999px))",headingSmall:"min(24px, var(--sf-heading-max,9999px))",accent:"32px",body:"14px",label:"12px"};function tt(e){const t=k[e],n=et[t];return n?`var(--size-${t}, ${n})`:`var(--size-${t})`}function nt(e){const t={};return typeof e.lineHeight=="number"?t.lineHeight=e.lineHeight:e.line&&(t.lineHeight=P(ot+e.line*Fe,3)),typeof e.letterSpacing=="number"?t.letterSpacingEm=e.letterSpacing:e.letter&&(t.letterSpacingEm=P(e.letter*Me,4)),t}const ot=1,T="--sf-part-para";function it(e){e=A(e);const t={};if(typeof e.sizePhone=="number"&&e.sizePhone>0)t.fontSize=_(e.sizePhone,h(e,"sizePhone"));else{const o=U(e.sizeToken);if(o)t.fontSize=ee(o);else{const i=N(e);i!==void 0&&(t.fontSize=_(i,h(e,"sizeTablet")))}}const n=e.alignPhone??O(e);return n&&(t.textAlign=n),t}function O(e){return e.alignTablet&&e.alignTablet!==e.align?e.alignTablet:void 0}function N(e){const n=e.sizeTablet!==void 0&&h(e,"sizeTablet")!==h(e,"size")?e.sizeTablet:me("textSize",e.size,e.sizeTablet,void 0).tablet;return n&&n>0?n:void 0}function rt(e){const t=A(e),n={},o=N(t);o!==void 0&&(n.fontSize=_(o,h(t,"sizeTablet")));const i=O(t);return i&&(n.textAlign=i),n}function Wt(e,t){if(t==="desktop")return;const n=A(e);return(t==="mobile"?O(n):void 0)??n.align}function at(e,t){if(t==="desktop")return e;const n=A(e),o=N(n),i=O(n);if(t==="tablet"){let a=e;return o!==void 0&&(a={...a,size:o,sizeUnit:n[m.sizeTablet]}),i&&(a={...a,align:i}),a}let r=e;if(typeof n.sizePhone=="number"&&n.sizePhone>0)r={...r,size:n.sizePhone,sizeUnit:n[m.sizePhone]};else{const a=U(n.sizeToken);a?r={...r,size:void 0,sizeToken:a}:o!==void 0&&(r={...r,size:o,sizeUnit:n[m.sizeTablet]})}const c=n.alignPhone??i;return c&&(r={...r,align:c}),r}function C(e,t,n){return v(at(e,t),$,n)}function st(e){return K("size",e)}function Gt(e,t){if(t==="desktop")return null;const n=A(e);if(t==="mobile"){if(U(n.sizeToken))return null;const o=N(n);if(o!==void 0)return{px:o,view:"tablet"}}return typeof n.size=="number"&&n.size>0?{px:n.size,view:"desktop"}:null}function ne(e,t){const n=st(t);if(!Object.hasOwn(e,n))return e;const o={...e};return delete o[n],o}function Kt(e,t,n){const o=C(ne(e,t),t,n);return{fontFamily:o.fontFamily,fontSize:o.fontSize}}function v(e,t,n){e=A(e);const o=Qe(e,n),i=nt(e),r=e.size?_(e.size,h(e,"size")):e.sizeToken?ee(e.sizeToken):o?tt(o):"";return{fontFamily:e.font?ut(e.font):e.fontRole?`var(${te[e.fontRole]})`:o?`var(${te[o]})`:"",fontWeight:e.weight?String(e.weight):"",fontSize:r,minWidth:r?"0":"",overflowWrap:r?"break-word":"",lineHeight:i.lineHeight!==void 0?String(i.lineHeight):"",letterSpacing:i.letterSpacingEm!==void 0?`${i.letterSpacingEm}em`:"",[T]:e.paragraphSpacing?_(e.paragraphSpacing,h(e,"paragraphSpacing")):"",textTransform:Je(e.case),textAlign:e.align??"",paddingTop:oe(e.padding,h(e,"padding")),paddingBottom:oe(e.padding,h(e,"padding")),color:ft(e.color),fontStyle:e.italic===!0?"italic":e.italic===!1?"normal":""}}const ft=e=>de(e),oe=(e,t)=>e===void 0?"":_(e,t),P=(e,t)=>Number(e.toFixed(t));function Bt(e,t){const n=Number.parseFloat(e.fontSize)||16,o=Number.parseFloat(e.lineHeight),i=Number.parseFloat(e.letterSpacing),r=Number.parseFloat(e.paddingTop);return{fontKey:t,sizePx:n,weight:ct(Number.parseInt(e.fontWeight,10)),lineRatio:Number.isFinite(o)?P(o/n,3):1.2,letterEm:Number.isFinite(i)?P(i/n,4):0,align:lt(e.textAlign),case:qe(e.textTransform),paddingPx:Number.isFinite(r)?Math.round(r):0}}function ct(e){return Number.isFinite(e)?we.reduce((t,n)=>Math.abs(n-e)<Math.abs(t-e)?n:t):400}function lt(e){for(const t of R)if(t===e)return t;return e==="end"?"right":"left"}function Xt(e,t){const n=ie(e);if(!n)return"";for(const o of ue)if(ie(t(o.cssVar))===n)return o.key;return""}const ie=e=>(e.split(",")[0]??"").replace(/["']/g,"").replace(/\s+/g," ").trim().toLowerCase();function ut(e){const t=pe(e);return t?`var(${t.cssVar})`:""}function Yt(e,t,n,o){return!t||X(t)?.nodeId!==e?null:n.find(r=>o(r.getAttribute("class")))??n[0]??null}function pt(e,t){return Object.hasOwn(e,t)?F(e[t])??{}:{}}function Vt(e,t,n=()=>$,o=a=>a,i=xt,r="desktop",c=()=>!1){let a=0;for(const{element:l,partId:b}of e){const g=X(b)?.propKey;if(!g)continue;const s=pt(t,o(g)),f=C(s,r,{blockDrawsStyle:c(g)});S(s.textStyle)?l.setAttribute?.(Y,s.textStyle):l.removeAttribute?.(Y);const d=G.some(x=>l.style[x]);let p=!1;for(const[x,u]of Object.entries(f))St(l,x,u),u&&(p=!0);if(d||G.some(x=>f[x]))for(const x of dt(l,i))for(const u of G)x.style[u]=f[u]??"";p&&(a+=1)}return a}function dt(e,t){const n=I(e.textContent??""),o=[];let i=e;for(let r=0;r<gt&&t(i);r+=1){const c=i.parentElement;if(!c||I(c.textContent??"")!==n)break;o.push(c),i=c}return o}const gt=8;function xt(e){const t=e;return typeof window>"u"||!t?.ownerDocument?!1:window.getComputedStyle(t).display==="inline"}const $={fontKey:"",sizePx:16,weight:400,lineRatio:1,letterEm:0,align:"left",case:"none",paddingPx:0};function ht(e){if(!e||typeof e!="object")return null;const t={};S(e.textStyle)&&(t.textStyle=e.textStyle),typeof e.size=="number"&&e.size>0&&(t.size=e.size),typeof e.sizeTablet=="number"&&e.sizeTablet>0&&(t.sizeTablet=e.sizeTablet),typeof e.sizePhone=="number"&&e.sizePhone>0&&(t.sizePhone=e.sizePhone);for(const n of["size","sizeTablet","sizePhone"]){const o=m[n];t[n]!==void 0&&M(e[o])&&(t[o]=e[o])}return Object.keys(t).length?t:null}function bt(e,t){const n=ht(e);if(!n)return{};const o=C(n,t);return{...o.fontFamily?{fontFamily:o.fontFamily}:{},...o.fontSize?{fontSize:o.fontSize}:{}}}function Zt(e){return S(e?.textStyle)||!!e?.role||typeof e?.size=="number"&&e.size>0}function qt(e,t,n){if(!e||typeof e!="object")return{};const o=ge(e.role,t,k)??{},i=t.sized?bt(ne(e,n),n):{};return{...o,...i}}function Jt(e,t,n){n.fontFamily&&e.fontFamily===n.fontFamily&&(e.fontFamily=t.fontFamily),n.fontSize&&e.fontSize===n.fontSize&&(e.fontSize=t.fontSize)}function St(e,t,n){if(!t.startsWith("--")){e.style[t]=n;return}const o=e.style;typeof o.setProperty=="function"?n?o.setProperty(t,n):o.removeProperty?.(t):o[t]=n;const i=e;t===T&&(n?i.setAttribute?.(re,""):i.removeAttribute?.(re))}const re="data-sf-part-para",mt=Object.keys(v({},$)),W=new Set(["color","overflowWrap",T,"fontStyle"]),G=mt.filter(e=>!W.has(e));function Qt(e,t,n,o=a=>a,i=()=>!1,r=()=>null,c=[]){const a=new Map;for(const s of e){const f=B(s.key,s.row);for(const d of s.texts){const p=a.get(d);p?(p.keys.add(s.key),p.partKeys.add(f)):a.set(d,{keys:new Set([s.key]),partKeys:new Set([f])})}}const l=new Map;for(const s of new Set([...Object.keys(t),...c])){if(!Tt(s))continue;const f=ae(n,s,F(t[s])??{},!1,r(s));f&&l.set(s,f)}const b=s=>{const f=o(s),d=r(f);if(!Object.hasOwn(t,f)&&!d)return null;const p=F(t[f])??{};return ae(n,s,p,i(s),d)},g=new Map;for(const[s,{keys:f,partKeys:d}]of a){const p=d.size===1?[...d][0]:f.size===1?[...f][0]:null;if(!p)continue;const z=b(p);z&&g.set(s,z)}for(const s of e){if(!s.keyed)continue;const f=b(B(s.key,s.row));f&&l.set(s.key,f)}return g.size||l.size?{rules:g,kindRules:l,drawn:new Set(a.keys())}:null}function ae(e,t,n,o,i){const r=v(n,$,{blockDrawsStyle:o}),c=rt(n),a=it(n),l=S(n.textStyle)?n.textStyle:void 0;return!Object.values(r).some(Boolean)&&!Object.keys(c).length&&!Object.keys(a).length&&!l&&!i?null:{stamp:Pt(e,t),declarations:r,...Object.keys(c).length?{tablet:c}:{},...Object.keys(a).length?{phone:a}:{},...l?{textStyle:l}:{},...i?{motion:i}:{}}}function Tt(e){return e.startsWith("@")}function en(e,t){return e?.kindRules.get(t)??null}function Pt(e,t){const n=o=>o.replace(/[^A-Za-z0-9_-]+/g,"-");return`${n(e)}~${n(t)}`}function zt(e){return e?{tablet:he,phone:xe}:{tablet:Se,phone:be}}function tn(e,{inBox:t=!1}={}){const{tablet:n,phone:o}=zt(t),i=[],r=new Set,c=a=>{const{stamp:l,declarations:b}=a;if(r.has(l))return;r.add(l);const g=Object.entries(b).filter(([,u])=>u!==""),s=u=>u.map(([se,fe])=>`${At(se)}: ${fe}`).join("; "),f=`[${Ae}="${l}"]`,d=g.filter(([u])=>!W.has(u)),p=g.filter(([u])=>W.has(u));d.length&&i.push(`${f}, *:has(> ${f}) { ${s(d)} }`),p.length&&i.push(`${f} { ${s(p)} }`),b[T]&&(i.push(`*:has(> ${f}) { ${T}: ${b[T]} }`),i.push(..._t(f,`*:has(> ${f})`)));const z=Object.entries(a.tablet??{}).filter(([,u])=>u!=="");z.length&&i.push(`@media ${n} { ${f}, *:has(> ${f}) { ${s(z)} } }`);const x=Object.entries(a.phone??{}).filter(([,u])=>u!=="");x.length&&i.push(`@media ${o} { ${f}, *:has(> ${f}) { ${s(x)} } }`)};for(const a of e.rules.values())c(a);for(const a of e.kindRules.values())c(a);return i.join(`
|
|
2
|
-
`)}function
|
|
1
|
+
import{textStyleCaseCss as ut,textStyleCaseOfCss as pt,viewKeyAt as B}from"efficient-easel/draw";import{FONT_OPTIONS as dt,fontOption as gt,fontRoleOf as w,SIZE_STEP_OF_ROLE as I}from"../../../format/lib/fonts.js";import{encodePartKey as X}from"../../../format/lib/document/part-key.js";import{decodePartId as Y,normalizePartText as F}from"./text-parts.js";import{partInkCss as xt}from"../../../format/lib/document/part-inks.js";import{regionStyle as ht}from"../../../format/lib/sections/text-regions.js";import{EDGE_PHONE_MEDIA as St,EDGE_TABLET_MEDIA as bt,PHONE_MEDIA as mt,TABLET_MEDIA as Tt,viewOverrides as Pt}from"../content/view-values.js";import{plainRecord as y,propsWithPartRecord as zt,readPartRecord as _t,readPartRecords as At}from"../../../format/lib/document/part-records.js";import{isLengthUnit as M}from"efficient-easel/screen/lib/content/length-units";import{cssLengthOf as _,storedUnit as Rt}from"../../../format/lib/content/css-length.js";import{hasOwnEntry as N,ownEntry as V}from"../../../format/lib/own-entry.js";const L="_partStyles",Et="data-sf-part-styled",Z="data-sf-text-style",wt=/^(heading|body)-[1-7]$/;function b(t){return typeof t=="string"&&wt.test(t)}const q={heading:"heading-1",heading2:"heading-2",heading3:"heading-3",body:"body-1",label:"body-5"};function Nt(t){if(!t)return null;for(const[e,n]of Object.entries(q))if(n===t)return e;return null}function Ue(t){if(b(t.textStyle))return t.textStyle;const e=w(t.role);return e?q[e]:void 0}const Ot=[400,500,600,700],R=["left","center","right","justify"],D=5,H=1e3,$t=-5,kt=10,It=0,Ft=64,yt=2,J={size:{min:D,max:H,step:1},sizeTablet:{min:D,max:H,step:1},sizePhone:{min:D,max:H,step:1},padding:{min:It,max:Ft,step:yt}},Mt=.05,Lt=.01,Dt=["line","letter"],Ht=.5,Ut=2.5,jt=-1,Ct=1,vt=0,Kt=400,Wt=[...new Set(Object.values(I))];function je(t){return[`${t} { transition: translate var(--page-motion-hover-duration) var(--page-ease-media) var(--page-motion-hover-delay) }`,`${t}:hover, ${t}:active { translate: 0 calc(-1 * var(--page-hover-lift)) }`]}function Ce(t){return At(t,L)}function Q(t,e){return _t(t,L,e)}function ve(t,e){return Object.values(Q(t,e)).filter(n=>n!==void 0).length}function tt(t,e,n){return zt(t,L,e,Gt(n).length?n:null)}function Gt(t){return Object.entries(t).filter(([,e])=>e!==void 0)}function Bt(t){return Dt.includes(t)}const E=(t,e,n)=>Math.min(n,Math.max(e,t)),Xt=["sizeUnit","sizeUnitTablet","sizeUnitPhone"];function U(t){const e=B("sizeUnit",t),n=Xt.find(o=>o===e);if(!n)throw new Error(`a part stores no unit key ${e}`);return n}const m={size:U("desktop"),sizeTablet:U("tablet"),sizePhone:U("mobile"),paragraphSpacing:"paragraphSpacingUnit",padding:"paddingUnit"},et=Object.values(m);function h(t,e){return Rt(t[m[e]])}function Yt(t,e,n={}){if(et.includes(t))return M(e)&&e!=="px"?e:null;if(N(m,t)&&h(n,t)!=="px"){const o=P(Number(e),2);return!Number.isFinite(o)||o<0||o===0&&t!=="padding"?null:o}if(Bt(t)){const o=Math.round(Number(e));return!Number.isFinite(o)||o===0?null:E(o,$t,kt)}if(t==="lineHeight"){const o=Number(e);return Number.isFinite(o)?P(E(o,Ht,Ut),3):null}if(t==="letterSpacing"){const o=Number(e);return Number.isFinite(o)?P(E(o,jt,Ct),4):null}if(t==="paragraphSpacing"){const o=Math.round(Number(e));return!Number.isFinite(o)||o<=0?null:E(o,vt,Kt)}if(N(J,t)){const{min:o,max:i}=J[t],r=Math.round(Number(e));return Number.isFinite(r)?E(r,o,i):null}return t==="italic"?typeof e=="boolean"?e:null:t==="role"||t==="fontRole"?w(e)?e:null:t==="sizeToken"?j(e)?e:null:t==="textStyle"?b(e)?e:null:t==="alignPhone"||t==="alignTablet"?R.includes(e)?e:null:e}const Vt=["weight","size","sizeTablet","sizePhone","line","letter","lineHeight","letterSpacing","paragraphSpacing","padding"];function A(t){let e=null;const n=o=>{e??={...t},delete e[o]};for(const o of Vt){const i=t[o];i!==void 0&&!(typeof i=="number"&&Number.isFinite(i))&&n(o)}t.align!==void 0&&!R.includes(t.align)&&n("align"),t.alignTablet!==void 0&&!R.includes(t.alignTablet)&&n("alignTablet"),t.alignPhone!==void 0&&!R.includes(t.alignPhone)&&n("alignPhone"),t.textStyle!==void 0&&!b(t.textStyle)&&n("textStyle"),t.sizeToken!==void 0&&!j(t.sizeToken)&&n("sizeToken"),t.fontRole!==void 0&&!w(t.fontRole)&&n("fontRole");for(const o of et)t[o]!==void 0&&!M(t[o])&&n(o);return e??t}function j(t){if(!t||typeof t!="object")return!1;const{step:e,px:n,stepPhone:o,pxPhone:i,fluid:r}=t,c=l=>typeof l=="number"&&Number.isFinite(l)&&l>0,a=l=>typeof l=="string"&&Wt.includes(l);return a(e)&&c(n)&&(o===void 0||a(o))&&(i===void 0||c(i))&&(r===void 0||Zt(r,n))}function Zt(t,e){if(!t||typeof t!="object"||Array.isArray(t))return!1;const{minPx:n,vw:o,...i}=t;return Object.keys(i).length===0&&typeof n=="number"&&Number.isFinite(n)&&n>0&&n<e&&typeof o=="number"&&Number.isFinite(o)&&o>0&&o<=100}function C(t){return t?.pxPhone&&j(t)?{step:t.stepPhone??t.step,px:t.pxPhone}:null}function nt({step:t,px:e,fluid:n}){const o=n?`clamp(${n.minPx}px, ${n.vw}vw, ${e}px)`:`${e}px`,i=`var(--size-${t}, ${o})`;return t.startsWith("heading")?`min(${i}, var(--sf-heading-max,9999px))`:i}const qt=[["font","role"],["font","fontRole"],["role","textStyle"],["line","lineHeight"],["letter","letterSpacing"]];function Jt(t){const e=[];for(const[n,o]of qt)n===t?e.push(o):o===t&&e.push(n);return e}function Ke(t,e,n,o){const i={...Q(t,e)},r=o==null?null:Yt(n,o,i);if(r===null)delete i[n];else{i[n]=r;for(const c of Jt(n))delete i[c]}return tt(t,e,i)}function We(t,e){return tt(t,e,{})}function Qt(t){return pt(t)??"none"}function te(t){return ut(t)??""}const ot={heading:"--font-role-heading",heading2:"--font-role-heading2",heading3:"--font-role-heading3",body:"--font-role-body",accent:"--font-role-accent",label:"--font-role-label"};function ee(t,e){const n=w(t.role);return n||(e?.blockDrawsStyle?null:Nt(t.textStyle))}function Ge(t,e){return t==="Text"&&e==="text"}const ne={headingLarge:"min(clamp(64px,9vw,144px), var(--sf-heading-max,9999px))",headingMedium:"min(32px, var(--sf-heading-max,9999px))",headingSmall:"min(24px, var(--sf-heading-max,9999px))",accent:"32px",body:"14px",label:"12px"};function oe(t){const e=I[t],n=V(ne,e);return n?`var(--size-${e}, ${n})`:`var(--size-${e})`}function ie(t){const e={};return typeof t.lineHeight=="number"?e.lineHeight=t.lineHeight:t.line&&(e.lineHeight=P(re+t.line*Mt,3)),typeof t.letterSpacing=="number"?e.letterSpacingEm=t.letterSpacing:t.letter&&(e.letterSpacingEm=P(t.letter*Lt,4)),e}const re=1,T="--sf-part-para";function ae(t){t=A(t);const e={};if(typeof t.sizePhone=="number"&&t.sizePhone>0)e.fontSize=_(t.sizePhone,h(t,"sizePhone"));else{const o=C(t.sizeToken);if(o)e.fontSize=nt(o);else{const i=$(t);i!==void 0&&(e.fontSize=_(i,h(t,"sizeTablet")))}}const n=t.alignPhone??O(t);return n&&(e.textAlign=n),e}function O(t){return t.alignTablet&&t.alignTablet!==t.align?t.alignTablet:void 0}function $(t){const n=t.sizeTablet!==void 0&&h(t,"sizeTablet")!==h(t,"size")?t.sizeTablet:Pt("textSize",t.size,t.sizeTablet,void 0).tablet;return n&&n>0?n:void 0}function se(t){const e=A(t),n={},o=$(e);o!==void 0&&(n.fontSize=_(o,h(e,"sizeTablet")));const i=O(e);return i&&(n.textAlign=i),n}function Be(t,e){if(e==="desktop")return;const n=A(t);return(e==="mobile"?O(n):void 0)??n.align}function fe(t,e){if(e==="desktop")return t;const n=A(t),o=$(n),i=O(n);if(e==="tablet"){let a=t;return o!==void 0&&(a={...a,size:o,sizeUnit:n[m.sizeTablet]}),i&&(a={...a,align:i}),a}let r=t;if(typeof n.sizePhone=="number"&&n.sizePhone>0)r={...r,size:n.sizePhone,sizeUnit:n[m.sizePhone]};else{const a=C(n.sizeToken);a?r={...r,size:void 0,sizeToken:a}:o!==void 0&&(r={...r,size:o,sizeUnit:n[m.sizeTablet]})}const c=n.alignPhone??i;return c&&(r={...r,align:c}),r}function v(t,e,n){return K(fe(t,e),k,n)}function ce(t){return B("size",t)}function Xe(t,e){if(e==="desktop")return null;const n=A(t);if(e==="mobile"){if(C(n.sizeToken))return null;const o=$(n);if(o!==void 0)return{px:o,view:"tablet"}}return typeof n.size=="number"&&n.size>0?{px:n.size,view:"desktop"}:null}function it(t,e){const n=ce(e);if(!N(t,n))return t;const o={...t};return delete o[n],o}function Ye(t,e,n){const o=v(it(t,e),e,n);return{fontFamily:o.fontFamily,fontSize:o.fontSize}}function K(t,e,n){t=A(t);const o=ee(t,n),i=ie(t),r=t.size?_(t.size,h(t,"size")):t.sizeToken?nt(t.sizeToken):o?oe(o):"";return{fontFamily:t.font?de(t.font):t.fontRole?`var(${ot[t.fontRole]})`:o?`var(${ot[o]})`:"",fontWeight:t.weight?String(t.weight):"",fontSize:r,minWidth:r?"0":"",overflowWrap:r?"break-word":"",lineHeight:i.lineHeight!==void 0?String(i.lineHeight):"",letterSpacing:i.letterSpacingEm!==void 0?`${i.letterSpacingEm}em`:"",[T]:t.paragraphSpacing?_(t.paragraphSpacing,h(t,"paragraphSpacing")):"",textTransform:te(t.case),textAlign:t.align??"",paddingTop:rt(t.padding,h(t,"padding")),paddingBottom:rt(t.padding,h(t,"padding")),color:le(t.color),fontStyle:t.italic===!0?"italic":t.italic===!1?"normal":""}}const le=t=>xt(t),rt=(t,e)=>t===void 0?"":_(t,e),P=(t,e)=>Number(t.toFixed(e));function Ve(t,e){const n=Number.parseFloat(t.fontSize)||16,o=Number.parseFloat(t.lineHeight),i=Number.parseFloat(t.letterSpacing),r=Number.parseFloat(t.paddingTop);return{fontKey:e,sizePx:n,weight:ue(Number.parseInt(t.fontWeight,10)),lineRatio:Number.isFinite(o)?P(o/n,3):1.2,letterEm:Number.isFinite(i)?P(i/n,4):0,align:pe(t.textAlign),case:Qt(t.textTransform),paddingPx:Number.isFinite(r)?Math.round(r):0}}function ue(t){return Number.isFinite(t)?Ot.reduce((e,n)=>Math.abs(n-t)<Math.abs(e-t)?n:e):400}function pe(t){for(const e of R)if(e===t)return e;return t==="end"?"right":"left"}function Ze(t,e){const n=at(t);if(!n)return"";for(const o of dt)if(at(e(o.cssVar))===n)return o.key;return""}const at=t=>(t.split(",")[0]??"").replace(/["']/g,"").replace(/\s+/g," ").trim().toLowerCase();function de(t){const e=gt(t);return e?`var(${e.cssVar})`:""}function qe(t,e,n,o){return!e||Y(e)?.nodeId!==t?null:n.find(r=>o(r.getAttribute("class")))??n[0]??null}function ge(t,e){return y(V(t,e))??{}}function Je(t,e,n=()=>k,o=a=>a,i=Se,r="desktop",c=()=>!1){let a=0;for(const{element:l,partId:S}of t){const g=Y(S)?.propKey;if(!g)continue;const s=ge(e,o(g)),f=v(s,r,{blockDrawsStyle:c(g)});b(s.textStyle)?l.setAttribute?.(Z,s.textStyle):l.removeAttribute?.(Z);const d=G.some(x=>l.style[x]);let p=!1;for(const[x,u]of Object.entries(f))Te(l,x,u),u&&(p=!0);if(d||G.some(x=>f[x]))for(const x of xe(l,i))for(const u of G)x.style[u]=f[u]??"";p&&(a+=1)}return a}function xe(t,e){const n=F(t.textContent??""),o=[];let i=t;for(let r=0;r<he&&e(i);r+=1){const c=i.parentElement;if(!c||F(c.textContent??"")!==n)break;o.push(c),i=c}return o}const he=8;function Se(t){const e=t;return typeof window>"u"||!e?.ownerDocument?!1:window.getComputedStyle(e).display==="inline"}const k={fontKey:"",sizePx:16,weight:400,lineRatio:1,letterEm:0,align:"left",case:"none",paddingPx:0};function be(t){if(!t||typeof t!="object")return null;const e={};b(t.textStyle)&&(e.textStyle=t.textStyle),typeof t.size=="number"&&t.size>0&&(e.size=t.size),typeof t.sizeTablet=="number"&&t.sizeTablet>0&&(e.sizeTablet=t.sizeTablet),typeof t.sizePhone=="number"&&t.sizePhone>0&&(e.sizePhone=t.sizePhone);for(const n of["size","sizeTablet","sizePhone"]){const o=m[n];e[n]!==void 0&&M(t[o])&&(e[o]=t[o])}return Object.keys(e).length?e:null}function me(t,e){const n=be(t);if(!n)return{};const o=v(n,e);return{...o.fontFamily?{fontFamily:o.fontFamily}:{},...o.fontSize?{fontSize:o.fontSize}:{}}}function Qe(t){return b(t?.textStyle)||!!t?.role||typeof t?.size=="number"&&t.size>0}function tn(t,e,n){if(!t||typeof t!="object")return{};const o=ht(t.role,e,I)??{},i=e.sized?me(it(t,n),n):{};return{...o,...i}}function en(t,e,n){n.fontFamily&&t.fontFamily===n.fontFamily&&(t.fontFamily=e.fontFamily),n.fontSize&&t.fontSize===n.fontSize&&(t.fontSize=e.fontSize)}function Te(t,e,n){if(!e.startsWith("--")){t.style[e]=n;return}const o=t.style;typeof o.setProperty=="function"?n?o.setProperty(e,n):o.removeProperty?.(e):o[e]=n;const i=t;e===T&&(n?i.setAttribute?.(st,""):i.removeAttribute?.(st))}const st="data-sf-part-para",Pe=Object.keys(K({},k)),W=new Set(["color","overflowWrap",T,"fontStyle"]),G=Pe.filter(t=>!W.has(t));function nn(t,e,n,o=a=>a,i=()=>!1,r=()=>null,c=[]){const a=new Map;for(const s of t){const f=X(s.key,s.row);for(const d of s.texts){const p=a.get(d);p?(p.keys.add(s.key),p.partKeys.add(f)):a.set(d,{keys:new Set([s.key]),partKeys:new Set([f])})}}const l=new Map;for(const s of new Set([...Object.keys(e),...c])){if(!ze(s))continue;const f=ft(n,s,y(e[s])??{},!1,r(s));f&&l.set(s,f)}const S=s=>{const f=o(s),d=r(f);if(!N(e,f)&&!d)return null;const p=y(e[f])??{};return ft(n,s,p,i(s),d)},g=new Map;for(const[s,{keys:f,partKeys:d}]of a){const p=d.size===1?[...d][0]:f.size===1?[...f][0]:null;if(!p)continue;const z=S(p);z&&g.set(s,z)}for(const s of t){if(!s.keyed)continue;const f=S(X(s.key,s.row));f&&l.set(s.key,f)}return g.size||l.size?{rules:g,kindRules:l,drawn:new Set(a.keys())}:null}function ft(t,e,n,o,i){const r=K(n,k,{blockDrawsStyle:o}),c=se(n),a=ae(n),l=b(n.textStyle)?n.textStyle:void 0;return!Object.values(r).some(Boolean)&&!Object.keys(c).length&&!Object.keys(a).length&&!l&&!i?null:{stamp:_e(t,e),declarations:r,...Object.keys(c).length?{tablet:c}:{},...Object.keys(a).length?{phone:a}:{},...l?{textStyle:l}:{},...i?{motion:i}:{}}}function ze(t){return t.startsWith("@")}function on(t,e){return t?.kindRules.get(e)??null}function _e(t,e){const n=o=>o.replace(/[^A-Za-z0-9_-]+/g,"-");return`${n(t)}~${n(e)}`}function Ae(t){return t?{tablet:bt,phone:St}:{tablet:Tt,phone:mt}}function rn(t,{inBox:e=!1}={}){const{tablet:n,phone:o}=Ae(e),i=[],r=new Set,c=a=>{const{stamp:l,declarations:S}=a;if(r.has(l))return;r.add(l);const g=Object.entries(S).filter(([,u])=>u!==""),s=u=>u.map(([ct,lt])=>`${Ee(ct)}: ${lt}`).join("; "),f=`[${Et}="${l}"]`,d=g.filter(([u])=>!W.has(u)),p=g.filter(([u])=>W.has(u));d.length&&i.push(`${f}, *:has(> ${f}) { ${s(d)} }`),p.length&&i.push(`${f} { ${s(p)} }`),S[T]&&(i.push(`*:has(> ${f}) { ${T}: ${S[T]} }`),i.push(...Re(f,`*:has(> ${f})`)));const z=Object.entries(a.tablet??{}).filter(([,u])=>u!=="");z.length&&i.push(`@media ${n} { ${f}, *:has(> ${f}) { ${s(z)} } }`);const x=Object.entries(a.phone??{}).filter(([,u])=>u!=="");x.length&&i.push(`@media ${o} { ${f}, *:has(> ${f}) { ${s(x)} } }`)};for(const a of t.rules.values())c(a);for(const a of t.kindRules.values())c(a);return i.join(`
|
|
2
|
+
`)}function Re(t,e){const n=`var(${T})`,o=":is([data-sf-bullet], [data-sf-number])";return[`${t} br:not(br + br) { display: block; content: ""; margin-top: ${n} }`,`${t} ${o}:not(:first-child) { margin-top: ${n} }`,`${t} ${o}:not(:last-child) { margin-bottom: ${n} }`,`:is(${e}) + :is(${e}) { margin-top: ${n} }`]}const Ee=t=>t.replace(/[A-Z]/g,e=>`-${e.toLowerCase()}`);function an(t,e){if(!t)return null;const n=F(e),o=t.rules.get(n);if(o)return o;if(n.length<we||t.drawn.has(n))return null;let i=null;for(const[r,c]of t.rules)if(r.includes(n)){if(i&&i.stamp!==c.stamp)return null;i=c}return i}const we=8;export{R as PART_ALIGNS,Ct as PART_LETTER_EM_MAX,jt as PART_LETTER_EM_MIN,Lt as PART_LETTER_STEP,Ut as PART_LINE_HEIGHT_MAX,Ht as PART_LINE_HEIGHT_MIN,Mt as PART_LINE_STEP,J as PART_MEASURED_TRACKS,kt as PART_NUDGE_MAX,$t as PART_NUDGE_MIN,Ft as PART_PADDING_MAX,It as PART_PADDING_MIN,yt as PART_PADDING_STEP,st as PART_PARAGRAPH_ATTR,Kt as PART_PARAGRAPH_MAX,vt as PART_PARAGRAPH_MIN,T as PART_PARAGRAPH_VAR,Dt as PART_RELATIVE_PROPS,H as PART_SIZE_MAX,D as PART_SIZE_MIN,Wt as PART_SIZE_STEPS,Et as PART_STYLED_ATTR,L as PART_STYLES_PROP,Pe as PART_STYLE_PROPERTIES,m as PART_UNIT_KEY_OF,Ot as PART_WEIGHTS,G as SHARED_PART_PROPERTIES,q as STYLE_ID_OF_ROLE,Z as TEXT_STYLE_ATTR,Je as applyPartStyles,Ge as blockDrawsTextStyle,Ue as followedStyleOf,ze as isPartKindKey,b as isTextStyleId,Re as paragraphRules,Be as partAlignFollowed,v as partCanvasDeclarations,Qt as partCaseOfTransform,te as partCaseTransform,Ze as partFontKeyOf,je as partLiftRules,ae as partPhoneDeclarations,on as partRuleForKind,an as partRuleForText,Ye as partShownDeclarations,ce as partSizeBoxOf,Xe as partSizeFollowed,ie as partSpacingOf,Ve as partStyleBase,ve as partStyleCount,rn as partStyleCss,K as partStyleDeclarations,fe as partStyleForScreen,qe as partStyleSource,it as partStyleWithoutSizeBox,se as partTabletDeclarations,Ke as propsWithPartStyleValue,We as propsWithoutPartStyle,nn as publishedPartStyles,Q as readPartStyle,Ce as readPartStyles,me as regionCanvasDeclarations,en as regionCanvasRestore,Qe as regionHasOwnLook,be as regionSheetStyle,tn as regionShownDeclarations,ge as storedPartStyle,Ae as viewMediaOf};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{jsx as
|
|
1
|
+
import{jsx as f}from"react/jsx-runtime";import{SectionAnimation as l}from"../../../components/SectionAnimation.js";import{ENTRANCE_EXCLUDED as p,entranceDrawn as w}from"../../animation/entrance.js";import{CARD_HOVER_SECTIONS as T,PICTURE_HOVER_BLOCKS as _}from"../../../../format/lib/animation/hover.js";import{BOX_TYPE as a}from"../../../../format/lib/document/container-blocks.js";import{drawsCopiesInTheBox as b}from"../../../../format/lib/content/copies-in-box.js";import{ownEntry as c}from"../../../../format/lib/own-entry.js";const s=Object.fromEntries(_.map(n=>[n,"picture"])),u={[a]:"box",Ticker:"marquee",...Object.fromEntries(T.map(n=>[n,"cards"])),...s},m=(n,e)=>!p.has(n)&&!!e&&typeof e.render=="function";function d(n,e,t,o){n.fields={...n.fields,...t.animationTabFields(e,o)}}function E(n,e){const t=n,o=t.render;t.render=i=>{const r=w(i);return!r||b(e,i)?o(i):f(l,{views:r,editing:!!i.editor?.isEditing,takesViewHide:!0,atEdge:e===a,children:o(i)})}}const D={name:"sectionAnimation",applies:(n,e,t)=>e.isSection(n)&&m(n,t),panel:(n,e,t)=>d(n,c(u,e)??"section",t,e),draw:(n,e)=>E(n,e)},S={name:"blockEntrance",applies:(n,e,t)=>!e.isSection(n)&&m(n,t),panel:(n,e,t)=>d(n,c(s,e)??"block",t,e),draw:(n,e)=>E(n,e)};export{S as blockEntrance,D as sectionAnimation};
|