efficient-web-builder 52.0.0 → 54.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (153) hide show
  1. package/CHANGELOG.md +47 -0
  2. package/dist/editor/components/ChatSettingsPanel.js +1 -1
  3. package/dist/editor/components/DuplicateToPageMenu.d.ts +2 -0
  4. package/dist/editor/components/DuplicateToPageMenu.js +1 -1
  5. package/dist/editor/components/MediaUploadField.d.ts +7 -7
  6. package/dist/editor/components/MediaUploadField.js +1 -1
  7. package/dist/editor/components/PartSettingsPanel.js +1 -1
  8. package/dist/editor/components/PartTextBox.js +1 -1
  9. package/dist/editor/components/PreviewPartAnchors.js +1 -1
  10. package/dist/editor/components/SectionTextPartBridge.js +1 -1
  11. package/dist/editor/components/SiteAccentField.js +1 -1
  12. package/dist/editor/components/SiteTextStylesField.d.ts +3 -3
  13. package/dist/editor/components/SiteTextStylesField.js +1 -1
  14. package/dist/editor/components/WebsiteSettingsPanel.js +1 -1
  15. package/dist/editor/components/storefront-editor.css +70 -20
  16. package/dist/editor/lib/animation/entrance-fields.js +1 -1
  17. package/dist/editor/lib/animation/hover-fields.js +1 -1
  18. package/dist/editor/lib/document/blocks/general/Breadcrumb/fields.js +1 -1
  19. package/dist/editor/lib/document/blocks/general/ButtonBlock/fields.js +1 -1
  20. package/dist/editor/lib/document/blocks/general/Cards/fields.js +1 -1
  21. package/dist/editor/lib/document/blocks/general/Chart/fields.js +1 -1
  22. package/dist/editor/lib/document/blocks/general/Contents/fields.js +1 -1
  23. package/dist/editor/lib/document/blocks/general/Divider/fields.js +1 -1
  24. package/dist/editor/lib/document/blocks/general/Flex/fields.js +1 -1
  25. package/dist/editor/lib/document/blocks/general/Hero/fields.js +1 -1
  26. package/dist/editor/lib/document/blocks/general/HeroSingle/fields.js +1 -1
  27. package/dist/editor/lib/document/blocks/general/HeroSlide/fields.js +1 -1
  28. package/dist/editor/lib/document/blocks/general/ImageBlock/fields.js +1 -1
  29. package/dist/editor/lib/document/blocks/general/IntroBleed/fields.js +1 -1
  30. package/dist/editor/lib/document/blocks/general/Logos/fields.js +1 -1
  31. package/dist/editor/lib/document/blocks/general/Mockup/fields.js +2 -2
  32. package/dist/editor/lib/document/blocks/general/PostCard/fields.js +1 -1
  33. package/dist/editor/lib/document/blocks/general/SectionHeader/fields.js +1 -1
  34. package/dist/editor/lib/document/blocks/general/Timeline/fields.js +1 -1
  35. package/dist/editor/lib/document/blocks/shared-fields.d.ts +5 -0
  36. package/dist/editor/lib/document/blocks/shared-fields.js +1 -1
  37. package/dist/editor/lib/document/box-fields.d.ts +23 -2
  38. package/dist/editor/lib/document/box-fields.js +1 -1
  39. package/dist/editor/lib/document/box-phone-order-field.d.ts +8 -0
  40. package/dist/editor/lib/document/box-phone-order-field.js +1 -0
  41. package/dist/editor/lib/document/card-row-fields.js +1 -1
  42. package/dist/editor/lib/document/choice-pictures.d.ts +21 -0
  43. package/dist/editor/lib/document/choice-pictures.js +1 -0
  44. package/dist/editor/lib/document/controls.d.ts +19 -5
  45. package/dist/editor/lib/document/controls.js +1 -1
  46. package/dist/editor/lib/document/hidable-rows-drawn.d.ts +1 -0
  47. package/dist/editor/lib/document/hidable-rows-drawn.js +1 -1
  48. package/dist/editor/lib/document/part-panel-rows.d.ts +1 -0
  49. package/dist/editor/lib/document/part-panel-rows.js +1 -1
  50. package/dist/editor/lib/document/separator-field.d.ts +9 -1
  51. package/dist/editor/lib/document/separator-field.js +1 -1
  52. package/dist/editor/lib/document/shape-picker.d.ts +37 -0
  53. package/dist/editor/lib/document/shape-picker.js +1 -0
  54. package/dist/editor/lib/document/show-for-field.d.ts +6 -0
  55. package/dist/editor/lib/document/show-for-field.js +1 -0
  56. package/dist/format/lib/animation/hover.d.ts +0 -2
  57. package/dist/format/lib/animation/hover.js +1 -1
  58. package/dist/format/lib/content/box-layout.d.ts +21 -6
  59. package/dist/format/lib/content/box-layout.js +1 -1
  60. package/dist/format/lib/content/box-phone-place.d.ts +11 -0
  61. package/dist/format/lib/content/box-phone-place.js +1 -0
  62. package/dist/format/lib/content/box-shape.d.ts +1 -5
  63. package/dist/format/lib/content/box-shape.js +1 -1
  64. package/dist/format/lib/content/box-show-for-choices.d.ts +9 -0
  65. package/dist/format/lib/content/box-show-for-choices.js +1 -0
  66. package/dist/format/lib/content/card-template.js +1 -1
  67. package/dist/format/lib/content/gallery-card-layout.d.ts +45 -1
  68. package/dist/format/lib/content/gallery-card-layout.js +1 -1
  69. package/dist/format/lib/content/image-aspect.d.ts +47 -0
  70. package/dist/format/lib/content/image-aspect.js +1 -0
  71. package/dist/format/lib/content/list-number.d.ts +11 -0
  72. package/dist/format/lib/content/list-number.js +1 -1
  73. package/dist/format/lib/content/phone-focus.d.ts +4 -1
  74. package/dist/format/lib/content/phone-focus.js +1 -1
  75. package/dist/format/lib/content/record-row.d.ts +14 -0
  76. package/dist/format/lib/content/record-row.js +1 -0
  77. package/dist/format/lib/content/record-types.d.ts +1 -1
  78. package/dist/format/lib/content/record-types.js +1 -1
  79. package/dist/format/lib/content/section-height.d.ts +8 -0
  80. package/dist/format/lib/content/section-height.js +1 -1
  81. package/dist/format/lib/document/blocks/block-types.d.ts +1 -1
  82. package/dist/format/lib/document/blocks/general/Flex/meta.js +1 -1
  83. package/dist/format/lib/document/blocks/general/text-part-shapes.json +2 -2
  84. package/dist/format/lib/document/media-manifest.json +5 -2
  85. package/dist/format/lib/document/mockup-variant-fields.d.ts +1 -0
  86. package/dist/format/lib/document/mockup-variant-fields.js +1 -1
  87. package/dist/format/lib/document/section-catalog.js +2 -2
  88. package/dist/format/lib/document/section-descriptions.js +1 -1
  89. package/dist/format/lib/editor-words-catalogue.d.ts +26 -11
  90. package/dist/format/lib/editor-words-catalogue.js +4 -4
  91. package/dist/format/lib/fonts.js +1 -1
  92. package/dist/format/lib/sections/divider-style.d.ts +4 -0
  93. package/dist/format/lib/sections/divider-style.js +1 -1
  94. package/dist/format/lib/sections/hero-single-to-hero.js +1 -1
  95. package/dist/format/lib/sections/section-presets.js +1 -1
  96. package/dist/format/lib/source-rules/editor-words.js +2 -2
  97. package/dist/format/lib/source-rules/mirrored-rows-agree.js +4 -4
  98. package/dist/format/lib/source-rules/shape-rows-use-the-picker.d.ts +7 -0
  99. package/dist/format/lib/source-rules/shape-rows-use-the-picker.js +2 -0
  100. package/dist/format/lib/text-styles/site-text-colours.d.ts +2 -9
  101. package/dist/format/lib/text-styles/site-text-colours.js +1 -1
  102. package/dist/render/components/Breadcrumb.d.ts +2 -1
  103. package/dist/render/components/Breadcrumb.js +1 -1
  104. package/dist/render/components/CardRowContext.d.ts +1 -1
  105. package/dist/render/components/CardRowContext.js +1 -1
  106. package/dist/render/components/ContentsList.d.ts +4 -1
  107. package/dist/render/components/ContentsList.js +1 -1
  108. package/dist/render/components/CurrentRecord.d.ts +23 -0
  109. package/dist/render/components/CurrentRecord.js +1 -0
  110. package/dist/render/components/Flex.d.ts +3 -2
  111. package/dist/render/components/Flex.js +1 -1
  112. package/dist/render/components/HeroPictures.d.ts +2 -0
  113. package/dist/render/components/HeroPictures.js +1 -1
  114. package/dist/render/components/HeroPoster.d.ts +2 -1
  115. package/dist/render/components/HeroPoster.js +1 -1
  116. package/dist/render/components/HeroSection.d.ts +2 -1
  117. package/dist/render/components/HeroSection.js +1 -1
  118. package/dist/render/components/HeroSingle.d.ts +3 -1
  119. package/dist/render/components/HeroSingle.js +1 -1
  120. package/dist/render/components/HeroSlide.d.ts +3 -1
  121. package/dist/render/components/HeroSlide.js +1 -1
  122. package/dist/render/components/ImageBlock.d.ts +5 -3
  123. package/dist/render/components/ImageBlock.js +1 -1
  124. package/dist/render/components/InBoxContext.d.ts +4 -0
  125. package/dist/render/components/SiteGutterFrame.d.ts +1 -0
  126. package/dist/render/components/SiteGutterFrame.js +1 -1
  127. package/dist/render/lib/content/block-size.d.ts +3 -0
  128. package/dist/render/lib/content/block-size.js +1 -1
  129. package/dist/render/lib/content/box-show-for.d.ts +14 -0
  130. package/dist/render/lib/content/box-show-for.js +1 -0
  131. package/dist/render/lib/content/page-contents.d.ts +1 -0
  132. package/dist/render/lib/content/page-contents.js +1 -1
  133. package/dist/render/lib/content/picture-focus-rows.d.ts +13 -0
  134. package/dist/render/lib/content/picture-focus-rows.js +1 -0
  135. package/dist/render/lib/document/blocks/general/Breadcrumb/render.js +1 -1
  136. package/dist/render/lib/document/blocks/general/Contents/render.js +1 -1
  137. package/dist/render/lib/document/blocks/general/Flex/render.js +1 -1
  138. package/dist/render/lib/document/blocks/general/Hero/render.js +1 -1
  139. package/dist/render/lib/document/blocks/general/HeroSingle/render.js +1 -1
  140. package/dist/render/lib/document/blocks/general/HeroSlide/render.js +1 -1
  141. package/dist/render/lib/document/blocks/general/ImageBlock/render.js +1 -1
  142. package/dist/render/lib/document/blocks/general/section-to-box-rows-timeline.js +1 -1
  143. package/dist/render/lib/document/blocks/general/section-to-box-rows.js +1 -1
  144. package/dist/render/lib/document/part-styles.d.ts +21 -7
  145. package/dist/render/lib/document/part-styles.js +2 -2
  146. package/dist/render/lib/document/passes/block-size.js +1 -1
  147. package/dist/render/lib/document/passes/index.js +1 -1
  148. package/dist/render/lib/document/passes/show-for.d.ts +2 -0
  149. package/dist/render/lib/document/passes/show-for.js +1 -0
  150. package/dist/render/lib/document/passes/slots-start-afresh.js +1 -1
  151. package/dist/render/lib/document/show-when.js +1 -1
  152. package/dist/render/lib/text-styles/site-text-styles.js +2 -2
  153. package/package.json +3 -3
@@ -26,6 +26,11 @@ export declare const PART_MEASURED_TRACKS: {
26
26
  readonly max: 1000;
27
27
  readonly step: 1;
28
28
  };
29
+ readonly sizeTablet: {
30
+ readonly min: 5;
31
+ readonly max: 1000;
32
+ readonly step: 1;
33
+ };
29
34
  readonly sizePhone: {
30
35
  readonly min: 5;
31
36
  readonly max: 1000;
@@ -78,6 +83,7 @@ export type PartStyle = {
78
83
  color?: string;
79
84
  italic?: boolean;
80
85
  sizePhone?: number;
86
+ sizeTablet?: number;
81
87
  alignPhone?: PartAlign;
82
88
  };
83
89
  export type PartStyleBase = {
@@ -117,14 +123,21 @@ export declare function partSpacingOf(style: PartStyle): {
117
123
  };
118
124
  export declare const PART_PARAGRAPH_VAR = "--sf-part-para";
119
125
  export declare function partPhoneDeclarations(style: PartStyle): Record<string, string>;
120
- export declare function partStyleForScreen(style: PartStyle, phone: boolean): PartStyle;
121
- export declare function partCanvasDeclarations(style: PartStyle, phone: boolean, options?: PartDeclarationOptions): Record<string, string>;
122
- export declare function partStyleWithoutSizeBox(style: PartStyle, phone: boolean): PartStyle;
126
+ export declare function partTabletDeclarations(style: PartStyle): Record<string, string>;
127
+ export type PartScreen = "desktop" | "tablet" | "mobile";
128
+ export declare function partStyleForScreen(style: PartStyle, screen: PartScreen): PartStyle;
129
+ export declare function partCanvasDeclarations(style: PartStyle, screen: PartScreen, options?: PartDeclarationOptions): Record<string, string>;
130
+ export declare function partSizeBoxOf(screen: PartScreen): "size" | "sizeTablet" | "sizePhone";
131
+ export declare function partSizeFollowed(style: PartStyle, screen: PartScreen): {
132
+ px: number;
133
+ view: "desktop" | "tablet";
134
+ } | null;
135
+ export declare function partStyleWithoutSizeBox(style: PartStyle, screen: PartScreen): PartStyle;
123
136
  export type ShownDeclarations = {
124
137
  fontFamily?: string;
125
138
  fontSize?: string;
126
139
  };
127
- export declare function partShownDeclarations(style: PartStyle, phone: boolean, options?: PartDeclarationOptions): ShownDeclarations;
140
+ export declare function partShownDeclarations(style: PartStyle, screen: PartScreen, options?: PartDeclarationOptions): ShownDeclarations;
128
141
  export declare function partStyleDeclarations(style: PartStyle, base: PartStyleBase, options?: PartDeclarationOptions): Record<string, string>;
129
142
  export type MeasuredPartStyle = {
130
143
  fontSize: string;
@@ -141,14 +154,14 @@ export declare function partStyleSource<E extends {
141
154
  getAttribute(name: string): string | null;
142
155
  }>(nodeId: string, selectedPartId: string | null, selectedElements: readonly E[], declaresStyle: (className: string | null) => boolean): E | null;
143
156
  export declare function storedPartStyle(styles: PartStyles, styleKey: string): PartStyle;
144
- export declare function applyPartStyles(stamps: readonly StyledPartStamp[], styles: PartStyles, baseOf?: (element: StyledPartEl) => PartStyleBase, styleKeyOf?: (partKey: string) => string, isInline?: (element: StyledPartEl) => boolean, phone?: boolean, drawsStyle?: (partKey: string) => boolean): number;
157
+ export declare function applyPartStyles(stamps: readonly StyledPartStamp[], styles: PartStyles, baseOf?: (element: StyledPartEl) => PartStyleBase, styleKeyOf?: (partKey: string) => string, isInline?: (element: StyledPartEl) => boolean, screen?: PartScreen, drawsStyle?: (partKey: string) => boolean): number;
145
158
  export declare function regionSheetStyle(style: PartStyle | undefined | null): PartStyle | null;
146
- export declare function regionCanvasDeclarations(style: PartStyle | undefined | null, phone: boolean): {
159
+ export declare function regionCanvasDeclarations(style: PartStyle | undefined | null, screen: PartScreen): {
147
160
  fontFamily?: string;
148
161
  fontSize?: string;
149
162
  };
150
163
  export declare function regionHasOwnLook(style: PartStyle | undefined | null): boolean;
151
- export declare function regionShownDeclarations(style: PartStyle | undefined | null, region: TextRegion, phone: boolean): ShownDeclarations;
164
+ export declare function regionShownDeclarations(style: PartStyle | undefined | null, region: TextRegion, screen: PartScreen): ShownDeclarations;
152
165
  export declare function regionCanvasRestore(style: {
153
166
  fontFamily: string;
154
167
  fontSize: string;
@@ -166,6 +179,7 @@ export type PublishedPartRule = {
166
179
  stamp: string;
167
180
  textStyle?: string;
168
181
  declarations: Record<string, string>;
182
+ tablet?: Record<string, string>;
169
183
  phone?: Record<string, string>;
170
184
  motion?: PublishedPartMotion;
171
185
  };
@@ -1,2 +1,2 @@
1
- import{textStyleCaseCss as q,textStyleCaseOfCss as J}from"efficient-easel/draw";import{FONT_OPTIONS as Q,fontOption as tt,fontRoleOf as R,SIZE_STEP_OF_ROLE as z}from"../../../format/lib/fonts.js";import{encodePartKey as et}from"../../../format/lib/document/part-key.js";import{decodePartId as M,normalizePartText as E}from"./text-parts.js";import{partInkCss as nt}from"../../../format/lib/document/part-inks.js";import{regionStyle as ot}from"../../../format/lib/sections/text-regions.js";import{PHONE_MEDIA as rt}from"../content/view-values.js";import{plainRecord as $,propsWithPartRecord as it,readPartRecord as at,readPartRecords as st}from"../../../format/lib/document/part-records.js";const y="_partStyles",ft="data-sf-part-styled",L="data-sf-text-style",ct=/^(heading|body)-[1-7]$/;function g(t){return typeof t=="string"&&ct.test(t)}const H={heading:"heading-1",heading2:"heading-2",heading3:"heading-3",body:"body-1",label:"body-5"};function lt(t){if(!t)return null;for(const[e,n]of Object.entries(H))if(n===t)return e;return null}function xe(t){if(g(t.textStyle))return t.textStyle;const e=R(t.role);return e?H[e]:void 0}const ut=[400,500,600,700],_=["left","center","right","justify"],j=5,D=1e3,pt=-5,dt=10,xt=0,ht=64,St=2,C={size:{min:j,max:D,step:1},sizePhone:{min:j,max:D,step:1},padding:{min:xt,max:ht,step:St}},gt=.05,mt=.01,Pt=["line","letter"],Tt=.5,bt=2.5,Rt=-1,_t=1,At=0,zt=400,Et=[...new Set(Object.values(z))];function he(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 Se(t){return st(t,y)}function v(t,e){return at(t,y,e)}function ge(t,e){return Object.values(v(t,e)).filter(n=>n!==void 0).length}function W(t,e,n){return it(t,y,e,$t(n).length?n:null)}function $t(t){return Object.entries(t).filter(([,e])=>e!==void 0)}function yt(t){return Pt.includes(t)}const b=(t,e,n)=>Math.min(n,Math.max(e,t));function Nt(t,e){if(yt(t)){const n=Math.round(Number(e));return!Number.isFinite(n)||n===0?null:b(n,pt,dt)}if(t==="lineHeight"){const n=Number(e);return Number.isFinite(n)?P(b(n,Tt,bt),3):null}if(t==="letterSpacing"){const n=Number(e);return Number.isFinite(n)?P(b(n,Rt,_t),4):null}if(t==="paragraphSpacing"){const n=Math.round(Number(e));return!Number.isFinite(n)||n<=0?null:b(n,At,zt)}if(Object.hasOwn(C,t)){const{min:n,max:o}=C[t],r=Math.round(Number(e));return Number.isFinite(r)?b(r,n,o):null}return t==="italic"?typeof e=="boolean"?e:null:t==="role"||t==="fontRole"?R(e)?e:null:t==="sizeToken"?O(e)?e:null:t==="textStyle"?g(e)?e:null:t==="alignPhone"?_.includes(e)?e:null:e}const Ot=["weight","size","sizePhone","line","letter","lineHeight","letterSpacing","paragraphSpacing","padding"];function N(t){let e=null;const n=o=>{e??={...t},delete e[o]};for(const o of Ot){const r=t[o];r!==void 0&&!(typeof r=="number"&&Number.isFinite(r))&&n(o)}return t.align!==void 0&&!_.includes(t.align)&&n("align"),t.alignPhone!==void 0&&!_.includes(t.alignPhone)&&n("alignPhone"),t.textStyle!==void 0&&!g(t.textStyle)&&n("textStyle"),t.sizeToken!==void 0&&!O(t.sizeToken)&&n("sizeToken"),t.fontRole!==void 0&&!R(t.fontRole)&&n("fontRole"),e??t}function O(t){if(!t||typeof t!="object")return!1;const{step:e,px:n,stepPhone:o,pxPhone:r,fluid:i}=t,a=f=>typeof f=="number"&&Number.isFinite(f)&&f>0,s=f=>typeof f=="string"&&Et.includes(f);return s(e)&&a(n)&&(o===void 0||s(o))&&(r===void 0||a(r))&&(i===void 0||wt(i,n))}function wt(t,e){if(!t||typeof t!="object"||Array.isArray(t))return!1;const{minPx:n,vw:o,...r}=t;return Object.keys(r).length===0&&typeof n=="number"&&Number.isFinite(n)&&n>0&&n<e&&typeof o=="number"&&Number.isFinite(o)&&o>0&&o<=100}function G(t){return t?.pxPhone&&O(t)?{step:t.stepPhone??t.step,px:t.pxPhone}:null}function K({step:t,px:e,fluid:n}){const o=n?`clamp(${n.minPx}px, ${n.vw}vw, ${e}px)`:`${e}px`,r=`var(--size-${t}, ${o})`;return t.startsWith("heading")?`min(${r}, var(--sf-heading-max,9999px))`:r}const It=[["font","role"],["font","fontRole"],["role","textStyle"],["line","lineHeight"],["letter","letterSpacing"]];function Ft(t){const e=[];for(const[n,o]of It)n===t?e.push(o):o===t&&e.push(n);return e}function me(t,e,n,o){const r={...v(t,e)},i=o==null?null:Nt(n,o);if(i===null)delete r[n];else{r[n]=i;for(const a of Ft(n))delete r[a]}return W(t,e,r)}function Pe(t,e){return W(t,e,{})}function kt(t){return J(t)??"none"}function Mt(t){return q(t)??""}const X={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 Lt(t,e){const n=R(t.role);return n||(e?.blockDrawsStyle?null:lt(t.textStyle))}function Te(t,e){return t==="Text"&&e==="text"}const Ht={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 jt(t){const e=z[t],n=Ht[e];return n?`var(--size-${e}, ${n})`:`var(--size-${e})`}function Dt(t){const e={};return typeof t.lineHeight=="number"?e.lineHeight=t.lineHeight:t.line&&(e.lineHeight=P(Ct+t.line*gt,3)),typeof t.letterSpacing=="number"?e.letterSpacingEm=t.letterSpacing:t.letter&&(e.letterSpacingEm=P(t.letter*mt,4)),e}const Ct=1,m="--sf-part-para";function vt(t){t=N(t);const e={};if(typeof t.sizePhone=="number"&&t.sizePhone>0)e.fontSize=`${t.sizePhone}px`;else{const n=G(t.sizeToken);n&&(e.fontSize=K(n))}return t.alignPhone&&(e.textAlign=t.alignPhone),e}function Wt(t,e){if(!e)return t;const n=N(t);let o=t;if(typeof n.sizePhone=="number"&&n.sizePhone>0)o={...o,size:n.sizePhone};else{const r=G(n.sizeToken);r&&(o={...o,size:void 0,sizeToken:r})}return n.alignPhone&&(o={...o,align:n.alignPhone}),o}function w(t,e,n){return I(Wt(t,e),A,n)}function B(t,e){const n=e?"sizePhone":"size";if(!Object.hasOwn(t,n))return t;const o={...t};return delete o[n],o}function be(t,e,n){const o=w(B(t,e),e,n);return{fontFamily:o.fontFamily,fontSize:o.fontSize}}function I(t,e,n){t=N(t);const o=Lt(t,n),r=Dt(t),i=t.size?`${t.size}px`:t.sizeToken?K(t.sizeToken):o?jt(o):"";return{fontFamily:t.font?Bt(t.font):t.fontRole?`var(${X[t.fontRole]})`:o?`var(${X[o]})`:"",fontWeight:t.weight?String(t.weight):"",fontSize:i,minWidth:i?"0":"",overflowWrap:i?"break-word":"",lineHeight:r.lineHeight!==void 0?String(r.lineHeight):"",letterSpacing:r.letterSpacingEm!==void 0?`${r.letterSpacingEm}em`:"",[m]:t.paragraphSpacing?`${t.paragraphSpacing}px`:"",textTransform:Mt(t.case),textAlign:t.align??"",paddingTop:U(t.padding),paddingBottom:U(t.padding),color:Gt(t.color),fontStyle:t.italic===!0?"italic":t.italic===!1?"normal":""}}const Gt=t=>nt(t),U=t=>t===void 0?"":`${t}px`,P=(t,e)=>Number(t.toFixed(e));function Re(t,e){const n=Number.parseFloat(t.fontSize)||16,o=Number.parseFloat(t.lineHeight),r=Number.parseFloat(t.letterSpacing),i=Number.parseFloat(t.paddingTop);return{fontKey:e,sizePx:n,weight:Kt(Number.parseInt(t.fontWeight,10)),lineRatio:Number.isFinite(o)?P(o/n,3):1.2,letterEm:Number.isFinite(r)?P(r/n,4):0,align:Xt(t.textAlign),case:kt(t.textTransform),paddingPx:Number.isFinite(i)?Math.round(i):0}}function Kt(t){return Number.isFinite(t)?ut.reduce((e,n)=>Math.abs(n-t)<Math.abs(e-t)?n:e):400}function Xt(t){for(const e of _)if(e===t)return e;return t==="end"?"right":"left"}function _e(t,e){const n=V(t);if(!n)return"";for(const o of Q)if(V(e(o.cssVar))===n)return o.key;return""}const V=t=>(t.split(",")[0]??"").replace(/["']/g,"").replace(/\s+/g," ").trim().toLowerCase();function Bt(t){const e=tt(t);return e?`var(${e.cssVar})`:""}function Ae(t,e,n,o){return!e||M(e)?.nodeId!==t?null:n.find(i=>o(i.getAttribute("class")))??n[0]??null}function Ut(t,e){return Object.hasOwn(t,e)?$(t[e])??{}:{}}function ze(t,e,n=()=>A,o=s=>s,r=Zt,i=!1,a=()=>!1){let s=0;for(const{element:f,partId:p}of t){const c=M(p)?.propKey;if(!c)continue;const u=Ut(e,o(c)),d=w(u,i,{blockDrawsStyle:a(c)});g(u.textStyle)?f.setAttribute?.(L,u.textStyle):f.removeAttribute?.(L);const l=k.some(x=>f.style[x]);let h=!1;for(const[x,S]of Object.entries(d))Qt(f,x,S),S&&(h=!0);if(l||k.some(x=>d[x]))for(const x of Vt(f,r))for(const S of k)x.style[S]=d[S]??"";h&&(s+=1)}return s}function Vt(t,e){const n=E(t.textContent??""),o=[];let r=t;for(let i=0;i<Yt&&e(r);i+=1){const a=r.parentElement;if(!a||E(a.textContent??"")!==n)break;o.push(a),r=a}return o}const Yt=8;function Zt(t){const e=t;return typeof window>"u"||!e?.ownerDocument?!1:window.getComputedStyle(e).display==="inline"}const A={fontKey:"",sizePx:16,weight:400,lineRatio:1,letterEm:0,align:"left",case:"none",paddingPx:0};function qt(t){if(!t||typeof t!="object")return null;const e={};return g(t.textStyle)&&(e.textStyle=t.textStyle),typeof t.size=="number"&&t.size>0&&(e.size=t.size),typeof t.sizePhone=="number"&&t.sizePhone>0&&(e.sizePhone=t.sizePhone),Object.keys(e).length?e:null}function Jt(t,e){const n=qt(t);if(!n)return{};const o=w(n,e);return{...o.fontFamily?{fontFamily:o.fontFamily}:{},...o.fontSize?{fontSize:o.fontSize}:{}}}function Ee(t){return g(t?.textStyle)||!!t?.role||typeof t?.size=="number"&&t.size>0}function $e(t,e,n){if(!t||typeof t!="object")return{};const o=ot(t.role,e,z)??{},r=e.sized?Jt(B(t,n),n):{};return{...o,...r}}function ye(t,e,n){n.fontFamily&&t.fontFamily===n.fontFamily&&(t.fontFamily=e.fontFamily),n.fontSize&&t.fontSize===n.fontSize&&(t.fontSize=e.fontSize)}function Qt(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 r=t;e===m&&(n?r.setAttribute?.(Y,""):r.removeAttribute?.(Y))}const Y="data-sf-part-para",te=Object.keys(I({},A)),F=new Set(["color","overflowWrap",m,"fontStyle"]),k=te.filter(t=>!F.has(t));function Ne(t,e,n,o=s=>s,r=()=>!1,i=()=>null,a=[]){const s=new Map;for(const c of t){const u=et(c.key,c.row);for(const d of c.texts){const l=s.get(d);l?(l.keys.add(c.key),l.partKeys.add(u)):s.set(d,{keys:new Set([c.key]),partKeys:new Set([u])})}}const f=new Map;for(const c of new Set([...Object.keys(e),...a])){if(!ee(c))continue;const u=Z(n,c,$(e[c])??{},!1,i(c));u&&f.set(c,u)}const p=new Map;for(const[c,{keys:u,partKeys:d}]of s){const l=d.size===1?[...d][0]:u.size===1?[...u][0]:null;if(!l)continue;const h=o(l),T=i(h);if(!Object.hasOwn(e,h)&&!T)continue;const x=$(e[h])??{},S=Z(n,l,x,r(l),T);S&&p.set(c,S)}return p.size||f.size?{rules:p,kindRules:f,drawn:new Set(s.keys())}:null}function Z(t,e,n,o,r){const i=I(n,A,{blockDrawsStyle:o}),a=vt(n),s=g(n.textStyle)?n.textStyle:void 0;return!Object.values(i).some(Boolean)&&!Object.keys(a).length&&!s&&!r?null:{stamp:ne(t,e),declarations:i,...Object.keys(a).length?{phone:a}:{},...s?{textStyle:s}:{},...r?{motion:r}:{}}}function ee(t){return t.startsWith("@")}function Oe(t,e){return t?.kindRules.get(e)??null}function ne(t,e){const n=o=>o.replace(/[^A-Za-z0-9_-]+/g,"-");return`${n(t)}~${n(e)}`}function we(t){const e=[],n=new Set,o=r=>{const{stamp:i,declarations:a}=r;if(n.has(i))return;n.add(i);const s=Object.entries(a).filter(([,l])=>l!==""),f=l=>l.map(([h,T])=>`${re(h)}: ${T}`).join("; "),p=`[${ft}="${i}"]`,c=s.filter(([l])=>!F.has(l)),u=s.filter(([l])=>F.has(l));c.length&&e.push(`${p}, *:has(> ${p}) { ${f(c)} }`),u.length&&e.push(`${p} { ${f(u)} }`),a[m]&&(e.push(`*:has(> ${p}) { ${m}: ${a[m]} }`),e.push(...oe(p,`*:has(> ${p})`)));const d=Object.entries(r.phone??{}).filter(([,l])=>l!=="");d.length&&e.push(`@media ${rt} { ${p}, *:has(> ${p}) { ${f(d)} } }`)};for(const r of t.rules.values())o(r);for(const r of t.kindRules.values())o(r);return e.join(`
2
- `)}function oe(t,e){const n=`var(${m})`,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 re=t=>t.replace(/[A-Z]/g,e=>`-${e.toLowerCase()}`);function Ie(t,e){if(!t)return null;const n=E(e),o=t.rules.get(n);if(o)return o;if(n.length<ie||t.drawn.has(n))return null;let r=null;for(const[i,a]of t.rules)if(i.includes(n)){if(r&&r.stamp!==a.stamp)return null;r=a}return r}const ie=8;export{_ as PART_ALIGNS,_t as PART_LETTER_EM_MAX,Rt as PART_LETTER_EM_MIN,mt as PART_LETTER_STEP,bt as PART_LINE_HEIGHT_MAX,Tt as PART_LINE_HEIGHT_MIN,gt as PART_LINE_STEP,C as PART_MEASURED_TRACKS,dt as PART_NUDGE_MAX,pt as PART_NUDGE_MIN,ht as PART_PADDING_MAX,xt as PART_PADDING_MIN,St as PART_PADDING_STEP,Y as PART_PARAGRAPH_ATTR,zt as PART_PARAGRAPH_MAX,At as PART_PARAGRAPH_MIN,m as PART_PARAGRAPH_VAR,Pt as PART_RELATIVE_PROPS,D as PART_SIZE_MAX,j as PART_SIZE_MIN,Et as PART_SIZE_STEPS,ft as PART_STYLED_ATTR,y as PART_STYLES_PROP,te as PART_STYLE_PROPERTIES,ut as PART_WEIGHTS,k as SHARED_PART_PROPERTIES,H as STYLE_ID_OF_ROLE,L as TEXT_STYLE_ATTR,ze as applyPartStyles,Te as blockDrawsTextStyle,xe as followedStyleOf,ee as isPartKindKey,g as isTextStyleId,oe as paragraphRules,w as partCanvasDeclarations,kt as partCaseOfTransform,Mt as partCaseTransform,_e as partFontKeyOf,he as partLiftRules,vt as partPhoneDeclarations,Oe as partRuleForKind,Ie as partRuleForText,be as partShownDeclarations,Dt as partSpacingOf,Re as partStyleBase,ge as partStyleCount,we as partStyleCss,I as partStyleDeclarations,Wt as partStyleForScreen,Ae as partStyleSource,B as partStyleWithoutSizeBox,me as propsWithPartStyleValue,Pe as propsWithoutPartStyle,Ne as publishedPartStyles,v as readPartStyle,Se as readPartStyles,Jt as regionCanvasDeclarations,ye as regionCanvasRestore,Ee as regionHasOwnLook,qt as regionSheetStyle,$e as regionShownDeclarations,Ut as storedPartStyle};
1
+ import{textStyleCaseCss as J,textStyleCaseOfCss as Q}from"efficient-easel/draw";import{FONT_OPTIONS as tt,fontOption as et,fontRoleOf as z,SIZE_STEP_OF_ROLE as $}from"../../../format/lib/fonts.js";import{encodePartKey as nt}from"../../../format/lib/document/part-key.js";import{decodePartId as D,normalizePartText as O}from"./text-parts.js";import{partInkCss as ot}from"../../../format/lib/document/part-inks.js";import{regionStyle as rt}from"../../../format/lib/sections/text-regions.js";import{PHONE_MEDIA as it,TABLET_MEDIA as at,viewOverrides as st}from"../content/view-values.js";import{plainRecord as w,propsWithPartRecord as ft,readPartRecord as ct,readPartRecords as lt}from"../../../format/lib/document/part-records.js";const N="_partStyles",ut="data-sf-part-styled",v="data-sf-text-style",pt=/^(heading|body)-[1-7]$/;function m(t){return typeof t=="string"&&pt.test(t)}const C={heading:"heading-1",heading2:"heading-2",heading3:"heading-3",body:"body-1",label:"body-5"};function dt(t){if(!t)return null;for(const[e,n]of Object.entries(C))if(n===t)return e;return null}function be(t){if(m(t.textStyle))return t.textStyle;const e=z(t.role);return e?C[e]:void 0}const xt=[400,500,600,700],_=["left","center","right","justify"],y=5,k=1e3,ht=-5,St=10,mt=0,gt=64,bt=2,W={size:{min:y,max:k,step:1},sizeTablet:{min:y,max:k,step:1},sizePhone:{min:y,max:k,step:1},padding:{min:mt,max:gt,step:bt}},Pt=.05,Tt=.01,Rt=["line","letter"],zt=.5,_t=2.5,At=-1,Et=1,$t=0,Ot=400,wt=[...new Set(Object.values($))];function Pe(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 Te(t){return lt(t,N)}function G(t,e){return ct(t,N,e)}function Re(t,e){return Object.values(G(t,e)).filter(n=>n!==void 0).length}function K(t,e,n){return ft(t,N,e,Nt(n).length?n:null)}function Nt(t){return Object.entries(t).filter(([,e])=>e!==void 0)}function yt(t){return Rt.includes(t)}const T=(t,e,n)=>Math.min(n,Math.max(e,t));function kt(t,e){if(yt(t)){const n=Math.round(Number(e));return!Number.isFinite(n)||n===0?null:T(n,ht,St)}if(t==="lineHeight"){const n=Number(e);return Number.isFinite(n)?b(T(n,zt,_t),3):null}if(t==="letterSpacing"){const n=Number(e);return Number.isFinite(n)?b(T(n,At,Et),4):null}if(t==="paragraphSpacing"){const n=Math.round(Number(e));return!Number.isFinite(n)||n<=0?null:T(n,$t,Ot)}if(Object.hasOwn(W,t)){const{min:n,max:o}=W[t],r=Math.round(Number(e));return Number.isFinite(r)?T(r,n,o):null}return t==="italic"?typeof e=="boolean"?e:null:t==="role"||t==="fontRole"?z(e)?e:null:t==="sizeToken"?I(e)?e:null:t==="textStyle"?m(e)?e:null:t==="alignPhone"?_.includes(e)?e:null:e}const It=["weight","size","sizeTablet","sizePhone","line","letter","lineHeight","letterSpacing","paragraphSpacing","padding"];function R(t){let e=null;const n=o=>{e??={...t},delete e[o]};for(const o of It){const r=t[o];r!==void 0&&!(typeof r=="number"&&Number.isFinite(r))&&n(o)}return t.align!==void 0&&!_.includes(t.align)&&n("align"),t.alignPhone!==void 0&&!_.includes(t.alignPhone)&&n("alignPhone"),t.textStyle!==void 0&&!m(t.textStyle)&&n("textStyle"),t.sizeToken!==void 0&&!I(t.sizeToken)&&n("sizeToken"),t.fontRole!==void 0&&!z(t.fontRole)&&n("fontRole"),e??t}function I(t){if(!t||typeof t!="object")return!1;const{step:e,px:n,stepPhone:o,pxPhone:r,fluid:i}=t,s=a=>typeof a=="number"&&Number.isFinite(a)&&a>0,f=a=>typeof a=="string"&&wt.includes(a);return f(e)&&s(n)&&(o===void 0||f(o))&&(r===void 0||s(r))&&(i===void 0||Ft(i,n))}function Ft(t,e){if(!t||typeof t!="object"||Array.isArray(t))return!1;const{minPx:n,vw:o,...r}=t;return Object.keys(r).length===0&&typeof n=="number"&&Number.isFinite(n)&&n>0&&n<e&&typeof o=="number"&&Number.isFinite(o)&&o>0&&o<=100}function F(t){return t?.pxPhone&&I(t)?{step:t.stepPhone??t.step,px:t.pxPhone}:null}function B({step:t,px:e,fluid:n}){const o=n?`clamp(${n.minPx}px, ${n.vw}vw, ${e}px)`:`${e}px`,r=`var(--size-${t}, ${o})`;return t.startsWith("heading")?`min(${r}, var(--sf-heading-max,9999px))`:r}const Mt=[["font","role"],["font","fontRole"],["role","textStyle"],["line","lineHeight"],["letter","letterSpacing"]];function Lt(t){const e=[];for(const[n,o]of Mt)n===t?e.push(o):o===t&&e.push(n);return e}function ze(t,e,n,o){const r={...G(t,e)},i=o==null?null:kt(n,o);if(i===null)delete r[n];else{r[n]=i;for(const s of Lt(n))delete r[s]}return K(t,e,r)}function _e(t,e){return K(t,e,{})}function jt(t){return Q(t)??"none"}function Ht(t){return J(t)??""}const X={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 Dt(t,e){const n=z(t.role);return n||(e?.blockDrawsStyle?null:dt(t.textStyle))}function Ae(t,e){return t==="Text"&&e==="text"}const vt={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 Ct(t){const e=$[t],n=vt[e];return n?`var(--size-${e}, ${n})`:`var(--size-${e})`}function Wt(t){const e={};return typeof t.lineHeight=="number"?e.lineHeight=t.lineHeight:t.line&&(e.lineHeight=b(Gt+t.line*Pt,3)),typeof t.letterSpacing=="number"?e.letterSpacingEm=t.letterSpacing:t.letter&&(e.letterSpacingEm=b(t.letter*Tt,4)),e}const Gt=1,g="--sf-part-para";function Kt(t){t=R(t);const e={};if(typeof t.sizePhone=="number"&&t.sizePhone>0)e.fontSize=`${t.sizePhone}px`;else{const n=F(t.sizeToken);if(n)e.fontSize=B(n);else{const o=A(t);o!==void 0&&(e.fontSize=`${o}px`)}}return t.alignPhone&&(e.textAlign=t.alignPhone),e}function A(t){const e=st("textSize",t.size,t.sizeTablet,void 0).tablet;return e&&e>0?e:void 0}function Bt(t){const e=A(R(t));return e===void 0?{}:{fontSize:`${e}px`}}function Xt(t,e){if(e==="desktop")return t;const n=R(t),o=A(n);if(e==="tablet")return o===void 0?t:{...t,size:o};let r=t;if(typeof n.sizePhone=="number"&&n.sizePhone>0)r={...r,size:n.sizePhone};else{const i=F(n.sizeToken);i?r={...r,size:void 0,sizeToken:i}:o!==void 0&&(r={...r,size:o})}return n.alignPhone&&(r={...r,align:n.alignPhone}),r}function M(t,e,n){return L(Xt(t,e),E,n)}function Ut(t){return t==="mobile"?"sizePhone":t==="tablet"?"sizeTablet":"size"}function Ee(t,e){if(e==="desktop")return null;const n=R(t);if(e==="mobile"){if(F(n.sizeToken))return null;const o=A(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 U(t,e){const n=Ut(e);if(!Object.hasOwn(t,n))return t;const o={...t};return delete o[n],o}function $e(t,e,n){const o=M(U(t,e),e,n);return{fontFamily:o.fontFamily,fontSize:o.fontSize}}function L(t,e,n){t=R(t);const o=Dt(t,n),r=Wt(t),i=t.size?`${t.size}px`:t.sizeToken?B(t.sizeToken):o?Ct(o):"";return{fontFamily:t.font?qt(t.font):t.fontRole?`var(${X[t.fontRole]})`:o?`var(${X[o]})`:"",fontWeight:t.weight?String(t.weight):"",fontSize:i,minWidth:i?"0":"",overflowWrap:i?"break-word":"",lineHeight:r.lineHeight!==void 0?String(r.lineHeight):"",letterSpacing:r.letterSpacingEm!==void 0?`${r.letterSpacingEm}em`:"",[g]:t.paragraphSpacing?`${t.paragraphSpacing}px`:"",textTransform:Ht(t.case),textAlign:t.align??"",paddingTop:V(t.padding),paddingBottom:V(t.padding),color:Vt(t.color),fontStyle:t.italic===!0?"italic":t.italic===!1?"normal":""}}const Vt=t=>ot(t),V=t=>t===void 0?"":`${t}px`,b=(t,e)=>Number(t.toFixed(e));function Oe(t,e){const n=Number.parseFloat(t.fontSize)||16,o=Number.parseFloat(t.lineHeight),r=Number.parseFloat(t.letterSpacing),i=Number.parseFloat(t.paddingTop);return{fontKey:e,sizePx:n,weight:Yt(Number.parseInt(t.fontWeight,10)),lineRatio:Number.isFinite(o)?b(o/n,3):1.2,letterEm:Number.isFinite(r)?b(r/n,4):0,align:Zt(t.textAlign),case:jt(t.textTransform),paddingPx:Number.isFinite(i)?Math.round(i):0}}function Yt(t){return Number.isFinite(t)?xt.reduce((e,n)=>Math.abs(n-t)<Math.abs(e-t)?n:e):400}function Zt(t){for(const e of _)if(e===t)return e;return t==="end"?"right":"left"}function we(t,e){const n=Y(t);if(!n)return"";for(const o of tt)if(Y(e(o.cssVar))===n)return o.key;return""}const Y=t=>(t.split(",")[0]??"").replace(/["']/g,"").replace(/\s+/g," ").trim().toLowerCase();function qt(t){const e=et(t);return e?`var(${e.cssVar})`:""}function Ne(t,e,n,o){return!e||D(e)?.nodeId!==t?null:n.find(i=>o(i.getAttribute("class")))??n[0]??null}function Jt(t,e){return Object.hasOwn(t,e)?w(t[e])??{}:{}}function ye(t,e,n=()=>E,o=f=>f,r=ee,i="desktop",s=()=>!1){let f=0;for(const{element:a,partId:u}of t){const c=D(u)?.propKey;if(!c)continue;const p=Jt(e,o(c)),x=M(p,i,{blockDrawsStyle:s(c)});m(p.textStyle)?a.setAttribute?.(v,p.textStyle):a.removeAttribute?.(v);const d=H.some(h=>a.style[h]);let l=!1;for(const[h,S]of Object.entries(x))re(a,h,S),S&&(l=!0);if(d||H.some(h=>x[h]))for(const h of Qt(a,r))for(const S of H)h.style[S]=x[S]??"";l&&(f+=1)}return f}function Qt(t,e){const n=O(t.textContent??""),o=[];let r=t;for(let i=0;i<te&&e(r);i+=1){const s=r.parentElement;if(!s||O(s.textContent??"")!==n)break;o.push(s),r=s}return o}const te=8;function ee(t){const e=t;return typeof window>"u"||!e?.ownerDocument?!1:window.getComputedStyle(e).display==="inline"}const E={fontKey:"",sizePx:16,weight:400,lineRatio:1,letterEm:0,align:"left",case:"none",paddingPx:0};function ne(t){if(!t||typeof t!="object")return null;const e={};return m(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),Object.keys(e).length?e:null}function oe(t,e){const n=ne(t);if(!n)return{};const o=M(n,e);return{...o.fontFamily?{fontFamily:o.fontFamily}:{},...o.fontSize?{fontSize:o.fontSize}:{}}}function ke(t){return m(t?.textStyle)||!!t?.role||typeof t?.size=="number"&&t.size>0}function Ie(t,e,n){if(!t||typeof t!="object")return{};const o=rt(t.role,e,$)??{},r=e.sized?oe(U(t,n),n):{};return{...o,...r}}function Fe(t,e,n){n.fontFamily&&t.fontFamily===n.fontFamily&&(t.fontFamily=e.fontFamily),n.fontSize&&t.fontSize===n.fontSize&&(t.fontSize=e.fontSize)}function re(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 r=t;e===g&&(n?r.setAttribute?.(Z,""):r.removeAttribute?.(Z))}const Z="data-sf-part-para",ie=Object.keys(L({},E)),j=new Set(["color","overflowWrap",g,"fontStyle"]),H=ie.filter(t=>!j.has(t));function Me(t,e,n,o=f=>f,r=()=>!1,i=()=>null,s=[]){const f=new Map;for(const c of t){const p=nt(c.key,c.row);for(const x of c.texts){const d=f.get(x);d?(d.keys.add(c.key),d.partKeys.add(p)):f.set(x,{keys:new Set([c.key]),partKeys:new Set([p])})}}const a=new Map;for(const c of new Set([...Object.keys(e),...s])){if(!ae(c))continue;const p=q(n,c,w(e[c])??{},!1,i(c));p&&a.set(c,p)}const u=new Map;for(const[c,{keys:p,partKeys:x}]of f){const d=x.size===1?[...x][0]:p.size===1?[...p][0]:null;if(!d)continue;const l=o(d),P=i(l);if(!Object.hasOwn(e,l)&&!P)continue;const h=w(e[l])??{},S=q(n,d,h,r(d),P);S&&u.set(c,S)}return u.size||a.size?{rules:u,kindRules:a,drawn:new Set(f.keys())}:null}function q(t,e,n,o,r){const i=L(n,E,{blockDrawsStyle:o}),s=Bt(n),f=Kt(n),a=m(n.textStyle)?n.textStyle:void 0;return!Object.values(i).some(Boolean)&&!Object.keys(s).length&&!Object.keys(f).length&&!a&&!r?null:{stamp:se(t,e),declarations:i,...Object.keys(s).length?{tablet:s}:{},...Object.keys(f).length?{phone:f}:{},...a?{textStyle:a}:{},...r?{motion:r}:{}}}function ae(t){return t.startsWith("@")}function Le(t,e){return t?.kindRules.get(e)??null}function se(t,e){const n=o=>o.replace(/[^A-Za-z0-9_-]+/g,"-");return`${n(t)}~${n(e)}`}function je(t){const e=[],n=new Set,o=r=>{const{stamp:i,declarations:s}=r;if(n.has(i))return;n.add(i);const f=Object.entries(s).filter(([,l])=>l!==""),a=l=>l.map(([P,h])=>`${ce(P)}: ${h}`).join("; "),u=`[${ut}="${i}"]`,c=f.filter(([l])=>!j.has(l)),p=f.filter(([l])=>j.has(l));c.length&&e.push(`${u}, *:has(> ${u}) { ${a(c)} }`),p.length&&e.push(`${u} { ${a(p)} }`),s[g]&&(e.push(`*:has(> ${u}) { ${g}: ${s[g]} }`),e.push(...fe(u,`*:has(> ${u})`)));const x=Object.entries(r.tablet??{}).filter(([,l])=>l!=="");x.length&&e.push(`@media ${at} { ${u}, *:has(> ${u}) { ${a(x)} } }`);const d=Object.entries(r.phone??{}).filter(([,l])=>l!=="");d.length&&e.push(`@media ${it} { ${u}, *:has(> ${u}) { ${a(d)} } }`)};for(const r of t.rules.values())o(r);for(const r of t.kindRules.values())o(r);return e.join(`
2
+ `)}function fe(t,e){const n=`var(${g})`,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 ce=t=>t.replace(/[A-Z]/g,e=>`-${e.toLowerCase()}`);function He(t,e){if(!t)return null;const n=O(e),o=t.rules.get(n);if(o)return o;if(n.length<le||t.drawn.has(n))return null;let r=null;for(const[i,s]of t.rules)if(i.includes(n)){if(r&&r.stamp!==s.stamp)return null;r=s}return r}const le=8;export{_ as PART_ALIGNS,Et as PART_LETTER_EM_MAX,At as PART_LETTER_EM_MIN,Tt as PART_LETTER_STEP,_t as PART_LINE_HEIGHT_MAX,zt as PART_LINE_HEIGHT_MIN,Pt as PART_LINE_STEP,W as PART_MEASURED_TRACKS,St as PART_NUDGE_MAX,ht as PART_NUDGE_MIN,gt as PART_PADDING_MAX,mt as PART_PADDING_MIN,bt as PART_PADDING_STEP,Z as PART_PARAGRAPH_ATTR,Ot as PART_PARAGRAPH_MAX,$t as PART_PARAGRAPH_MIN,g as PART_PARAGRAPH_VAR,Rt as PART_RELATIVE_PROPS,k as PART_SIZE_MAX,y as PART_SIZE_MIN,wt as PART_SIZE_STEPS,ut as PART_STYLED_ATTR,N as PART_STYLES_PROP,ie as PART_STYLE_PROPERTIES,xt as PART_WEIGHTS,H as SHARED_PART_PROPERTIES,C as STYLE_ID_OF_ROLE,v as TEXT_STYLE_ATTR,ye as applyPartStyles,Ae as blockDrawsTextStyle,be as followedStyleOf,ae as isPartKindKey,m as isTextStyleId,fe as paragraphRules,M as partCanvasDeclarations,jt as partCaseOfTransform,Ht as partCaseTransform,we as partFontKeyOf,Pe as partLiftRules,Kt as partPhoneDeclarations,Le as partRuleForKind,He as partRuleForText,$e as partShownDeclarations,Ut as partSizeBoxOf,Ee as partSizeFollowed,Wt as partSpacingOf,Oe as partStyleBase,Re as partStyleCount,je as partStyleCss,L as partStyleDeclarations,Xt as partStyleForScreen,Ne as partStyleSource,U as partStyleWithoutSizeBox,Bt as partTabletDeclarations,ze as propsWithPartStyleValue,_e as propsWithoutPartStyle,Me as publishedPartStyles,G as readPartStyle,Te as readPartStyles,oe as regionCanvasDeclarations,Fe as regionCanvasRestore,ke as regionHasOwnLook,ne as regionSheetStyle,Ie as regionShownDeclarations,Jt as storedPartStyle};
@@ -1 +1 @@
1
- import{jsx as C}from"react/jsx-runtime";import{parseBlockWidthFit as D,phoneKey as s,tabletKey as l}from"efficient-easel/draw";import{blockSizeOf as j,blockSizeValuesOf as K}from"../../content/block-size.js";import{CellWrap as P}from"../../../components/InBoxContext.js";import{boxPhoneRowFits as A,boxRowColumnsClass as W,boxShareClasses as g,boxShareTabletOf as L,boxTabletColumnsClass as G}from"../../../../format/lib/content/box-layout.js";import{resolveContainerDirection as X}from"../../../../format/lib/content/container-direction.js";import{containerBlocksFor as Z}from"../../../../format/lib/document/container-blocks.js";import{readPartStyle as v}from"../part-styles.js";import{addShowWhenFacts as U,withRowRules as x}from"../../../../format/lib/document/show-when-attach.js";import{BOX_BLOCK_KEYS as M}from"./cell-width.js";import{findParentNode as V}from"../../../../format/lib/document/passes/document-position.js";const Y=new Set(["Text","Heading"]),q=new Set(["h1","h2","h3","h4","h5","h6"]);function O(t,e){return t==="Heading"?!0:t!=="Text"?!1:typeof e.tag=="string"&&q.has(e.tag)?!0:v(e,"text").textStyle?.startsWith("heading-")===!0}const c={not:{context:"blockOutsideBox",is:!0}},T={all:[c,{not:{context:"boxSharesWidth",is:!0}}]},B={all:[c,{not:{context:"boxSharesWidthPhone",is:!0}}]},k={all:[c,{not:{context:"boxSharesWidthTablet",is:!0}}]};function J(t,e){return{any:[{field:l(t),is:e},{all:[{field:l(t),set:!1},{field:t,is:e}]}]}}function y(t,e,i){return{any:[{field:s(t),is:e},{all:[{field:s(t),set:!1},i??{field:t,is:e}]}]}}const H={any:[{field:"textFit",is:"shrink"},{all:[{field:"textFit",set:!1},{not:{context:"textWrapsByDefault",is:!0}}]}]},Q=[[["_gBlockSize","minWidth",l("minWidth"),s("minWidth"),"maxWidth",l("maxWidth"),s("maxWidth")],c],[["widthFit"],T],[[l("widthFit")],k],[[s("widthFit")],B],[["width"],{all:[T,{field:"widthFit",is:"fixed"}]}],[[l("width")],{all:[k,J("widthFit","fixed")]}],[[s("width")],{all:[B,y("widthFit","fixed")]}]],I=[[["_gText","textFit",s("textFit")],c],[["minFont"],{all:[c,H]}],[[s("minFont")],{all:[c,y("textFit","shrink",H)]}]],f=(t,e)=>V(e.appState,t.props?.id),h=t=>!!t&&typeof t.type=="string"&&Z(t.type)!==null,S=t=>(t.type==="Flex"||t.type==="HeroGroup")&&X(t.type,t.props?.direction)==="row",w=t=>{const e=D(t);return e!==void 0&&e!=="fit"},$={blockOutsideBox:(t,e)=>!h(f(t,e)),boxSharesWidth:(t,e)=>{const i=f(t,e);return!h(i)||!S(i)?!1:W({...i.props,direction:"row"})!==""?!0:g(i.props?.share)!==""&&!w(t.props?.widthFit)},boxSharesWidthTablet:(t,e)=>{const i=f(t,e);if(!h(i)||!S(i))return!1;if(G(i.props?.[l("columns")])!==""||W({...i.props,direction:"row"})!=="")return!0;const n=L(i.props?.[l("share")])??i.props?.share;return g(n)!==""&&!w(t.props?.[l("widthFit")]??t.props?.widthFit)},boxSharesWidthPhone:(t,e)=>{const i=f(t,e);if(!h(i)||!S(i))return!1;const n=i.props?.phoneRow;return(Number(n)===2||Number(n)===3)&&!A(n,i.props?.[s("share")])&&!w(t.props?.[s("widthFit")]??t.props?.widthFit)}},tt=t=>/^_[gds][A-Z]/.test(t);function et(t,e,i){const n=Object.entries(t),r=n.findIndex(([a])=>a===e);if(r===-1)return null;let o=r+1;for(;o<n.length&&!tt(n[o][0]);)o++;return Object.fromEntries([...n.slice(0,o),...Object.entries(i),...n.slice(o)])}function N(t,e,i){const n=Object.entries(t);return Object.fromEntries([...n.slice(0,e),...Object.entries(i),...n.slice(e)])}function it(t,e,i){const n=Object.keys(e);if(n.includes("_dSize")){const{_gBlockSize:r,...o}=i;return N(e,n.indexOf("_dSize")+1,o)}return nt.has(t)&&n.includes("_gSpacing")?N(e,n.indexOf("_gSpacing"),i):{...e,...i}}const nt=new Set(["Text","Heading"]);function rt(t,e){const{_gText:i,...n}=e;return et(t,"_gText",n)??{...t,...e}}function st(t){const e=new WeakMap;return i=>{if(!i||!("textFit"in i))return i;let n=e.get(i);if(!n){n={...i};for(const r of["textFit",s("textFit")])r in n&&(n[r]=t[r]);e.set(i,n)}return n}}const bt={name:"blockSize",applies:(t,e,i)=>M.includes(t)&&!!i&&typeof i.render=="function",panel(t,e,i){const n=Y.has(e),{text:r}=i.blockSizeFields(n?{textFit:e==="Heading"?"shrink":"wrap"}:{}),{size:o}=i.blockSizeFields({tablet:!0});let a=it(e,t.fields??{},x(o,Q));if(n){const d=x(r,I);if(a=rt(a,d),e==="Text"){const z=x(i.blockSizeFields({textFit:"shrink"}).text,I),E=st(z),b=t.resolveFields,R=(F,u)=>{const p=b?b(F,u):u.fields,m=_=>O(e,F?.props??{})?E(_??u.fields):_;return p instanceof Promise?p.then(m):m(p)};t.resolveFields=R}}t.fields=a,U(t,{...$,textWrapsByDefault:d=>!O(e,d.props??{})})},draw(t){ot(t)}};function ot(t){const e=t.render;t.render=i=>{const n=j(K(i)),r=e(i);return n===null?r:C(P,{className:n.className,...Object.keys(n.style).length?{style:n.style}:{},attrs:n.attrs,children:r})}}export{bt as blockSize,O as textShrinksByDefault};
1
+ import{jsx as W}from"react/jsx-runtime";import{parseBlockWidthFit as D,phoneKey as o,tabletKey as l}from"efficient-easel/draw";import{blockFillInCellClass as j,blockPhoneHideClass as P,blockSizeOf as K,blockSizeValuesOf as A}from"../../content/block-size.js";import{CellWrap as L,useBoxCell as G}from"../../../components/InBoxContext.js";import{boxPhoneRowFits as X,boxRowColumnsClass as g,boxShareClasses as O,boxShareTabletOf as Z,boxTabletColumnsClass as $}from"../../../../format/lib/content/box-layout.js";import{resolveContainerDirection as v}from"../../../../format/lib/content/container-direction.js";import{containerBlocksFor as U}from"../../../../format/lib/document/container-blocks.js";import{readPartStyle as M}from"../part-styles.js";import{addShowWhenFacts as V,withRowRules as x}from"../../../../format/lib/document/show-when-attach.js";import{BOX_BLOCK_KEYS as Y}from"./cell-width.js";import{findParentNode as q}from"../../../../format/lib/document/passes/document-position.js";const J=new Set(["Text","Heading"]),Q=new Set(["h1","h2","h3","h4","h5","h6"]);function T(t,e){return t==="Heading"?!0:t!=="Text"?!1:typeof e.tag=="string"&&Q.has(e.tag)?!0:M(e,"text").textStyle?.startsWith("heading-")===!0}const a={not:{context:"blockOutsideBox",is:!0}},B={all:[a,{not:{context:"boxSharesWidth",is:!0}}]},k={all:[a,{not:{context:"boxSharesWidthPhone",is:!0}}]},C={all:[a,{not:{context:"boxSharesWidthTablet",is:!0}}]};function tt(t,e){return{any:[{field:l(t),is:e},{all:[{field:l(t),set:!1},{field:t,is:e}]}]}}function y(t,e,i){return{any:[{field:o(t),is:e},{all:[{field:o(t),set:!1},i??{field:t,is:e}]}]}}const H={any:[{field:"textFit",is:"shrink"},{all:[{field:"textFit",set:!1},{not:{context:"textWrapsByDefault",is:!0}}]}]},et=[[["_gBlockSize","minWidth",l("minWidth"),o("minWidth"),"maxWidth",l("maxWidth"),o("maxWidth")],a],[["widthFit"],B],[[l("widthFit")],C],[[o("widthFit")],k],[["width"],{all:[B,{field:"widthFit",is:"fixed"}]}],[[l("width")],{all:[C,tt("widthFit","fixed")]}],[[o("width")],{all:[k,y("widthFit","fixed")]}]],I=[[["_gText","textFit",o("textFit")],a],[["minFont"],{all:[a,H]}],[[o("minFont")],{all:[a,y("textFit","shrink",H)]}]],h=(t,e)=>q(e.appState,t.props?.id),f=t=>!!t&&typeof t.type=="string"&&U(t.type)!==null,S=t=>(t.type==="Flex"||t.type==="HeroGroup")&&v(t.type,t.props?.direction)==="row",w=t=>{const e=D(t);return e!==void 0&&e!=="fit"},it={blockOutsideBox:(t,e)=>!f(h(t,e)),boxSharesWidth:(t,e)=>{const i=h(t,e);return!f(i)||!S(i)?!1:g({...i.props,direction:"row"})!==""?!0:O(i.props?.share)!==""&&!w(t.props?.widthFit)},boxSharesWidthTablet:(t,e)=>{const i=h(t,e);if(!f(i)||!S(i))return!1;if($(i.props?.[l("columns")])!==""||g({...i.props,direction:"row"})!=="")return!0;const n=Z(i.props?.[l("share")])??i.props?.share;return O(n)!==""&&!w(t.props?.[l("widthFit")]??t.props?.widthFit)},boxSharesWidthPhone:(t,e)=>{const i=h(t,e);if(!f(i)||!S(i))return!1;const n=i.props?.phoneRow;return(Number(n)===2||Number(n)===3)&&!X(n,i.props?.[o("share")])&&!w(t.props?.[o("widthFit")]??t.props?.widthFit)}},nt=t=>/^_[gds][A-Z]/.test(t);function rt(t,e,i){const n=Object.entries(t),r=n.findIndex(([c])=>c===e);if(r===-1)return null;let s=r+1;for(;s<n.length&&!nt(n[s][0]);)s++;return Object.fromEntries([...n.slice(0,s),...Object.entries(i),...n.slice(s)])}function N(t,e,i){const n=Object.entries(t);return Object.fromEntries([...n.slice(0,e),...Object.entries(i),...n.slice(e)])}function st(t,e,i){const n=Object.keys(e);if(n.includes("_dSize")){const{_gBlockSize:r,...s}=i;return N(e,n.indexOf("_dSize")+1,s)}return ot.has(t)&&n.includes("_gSpacing")?N(e,n.indexOf("_gSpacing"),i):{...e,...i}}const ot=new Set(["Text","Heading"]);function lt(t,e){const{_gText:i,...n}=e;return rt(t,"_gText",n)??{...t,...e}}function ct(t){const e=new WeakMap;return i=>{if(!i||!("textFit"in i))return i;let n=e.get(i);if(!n){n={...i};for(const r of["textFit",o("textFit")])r in n&&(n[r]=t[r]);e.set(i,n)}return n}}const Wt={name:"blockSize",applies:(t,e,i)=>Y.includes(t)&&!!i&&typeof i.render=="function",panel(t,e,i){const n=J.has(e),{text:r}=i.blockSizeFields(n?{textFit:e==="Heading"?"shrink":"wrap"}:{}),{size:s}=i.blockSizeFields({tablet:!0});let c=st(e,t.fields??{},x(s,et));if(n){const d=x(r,I);if(c=lt(c,d),e==="Text"){const z=x(i.blockSizeFields({textFit:"shrink"}).text,I),E=ct(z),b=t.resolveFields,R=(F,u)=>{const p=b?b(F,u):u.fields,m=_=>T(e,F?.props??{})?E(_??u.fields):_;return p instanceof Promise?p.then(m):m(p)};t.resolveFields=R}}t.fields=c,V(t,{...it,textWrapsByDefault:d=>!T(e,d.props??{})})},draw(t){at(t)}};function at(t){const e=t.render;t.render=i=>{const n=A(i),r=K(n),s=e(i);if(r===null)return s;const c=P(i);return W(ht,{size:r,className:c?`${r.className} ${c}`:r.className,inCell:j(n),children:s})}}function ht({size:t,className:e,inCell:i,children:n}){const r=G()?.phoneCells===!0;return W(L,{className:r&&i?`${e} ${i}`:e,...Object.keys(t.style).length?{style:t.style}:{},attrs:t.attrs,children:n})}export{Wt as blockSize,T as textShrinksByDefault};
@@ -1 +1 @@
1
- import{catalogueLabel as e}from"../../../../format/lib/document/passes/catalogue-labels.js";import{blockSize as n}from"./block-size.js";import{cardTemplateOnInsert as s}from"../../../../format/lib/document/passes/card-template-on-insert.js";import{cellWidth as p}from"./cell-width.js";import{clickableParts as c}from"./clickable-parts.js";import{cardCorners as f,sectionCorners as a}from"./corners.js";import{emptyHeadings as l}from"../../../../format/lib/document/passes/empty-headings.js";import{showWhenRows as d}from"../../../../format/lib/document/passes/show-when-rows.js";import{hiddenNodes as h}from"../../../../format/lib/document/passes/hidden-nodes.js";import{mediaValues as u}from"../../../../format/lib/document/passes/media-values.js";import{sectionAnchor as S}from"./section-anchor.js";import{blockEntrance as g,sectionAnimation as b}from"./section-animation.js";import{sectionHeight as w}from"./section-height.js";import{cardSticky as A,sectionSticky as P}from"./section-sticky.js";import{sectionBorder as k}from"./borders.js";import{blockPadding as C,sectionPadding as W}from"./section-padding.js";import{sectionTheme as y,slideTheme as B}from"./section-theme.js";import{buttonAlignInRow as G,containedWidth as T,sectionWidth as E}from"./section-width.js";import{blockGroups as H,sectionGroups as I}from"../../../../format/lib/document/passes/settings-groups.js";import{slotsStartAfresh as L}from"./slots-start-afresh.js";import{openSlotDisallow as O,sectionGroupAllow as R}from"../../../../format/lib/document/passes/slot-rules.js";import{registryPassContext as no}from"../../../../format/lib/document/passes/registry-context.js";const z=[L,u,R,O,W,a,k,f,C,g,p,E,T,G,w,S,y,b,P,A,B,n,I,H,d,l,c,h,e,s];function io(r,m,o){const t=m;for(const i of z)i.applies(r,o,t)&&(o.inspector&&i.panel?.(t,r,o.inspector,o),i.draw?.(t,r,o));return m}export{z as BLOCK_PASSES,io as applyBlockPasses,no as registryPassContext};
1
+ import{catalogueLabel as e}from"../../../../format/lib/document/passes/catalogue-labels.js";import{blockSize as n}from"./block-size.js";import{cardTemplateOnInsert as s}from"../../../../format/lib/document/passes/card-template-on-insert.js";import{cellWidth as p}from"./cell-width.js";import{clickableParts as c}from"./clickable-parts.js";import{cardCorners as f,sectionCorners as a}from"./corners.js";import{emptyHeadings as l}from"../../../../format/lib/document/passes/empty-headings.js";import{showWhenRows as d}from"../../../../format/lib/document/passes/show-when-rows.js";import{hiddenNodes as h}from"../../../../format/lib/document/passes/hidden-nodes.js";import{showFor as u}from"./show-for.js";import{mediaValues as S}from"../../../../format/lib/document/passes/media-values.js";import{sectionAnchor as g}from"./section-anchor.js";import{blockEntrance as w,sectionAnimation as b}from"./section-animation.js";import{sectionHeight as A}from"./section-height.js";import{cardSticky as P,sectionSticky as k}from"./section-sticky.js";import{sectionBorder as C}from"./borders.js";import{blockPadding as W,sectionPadding as y}from"./section-padding.js";import{sectionTheme as B,slideTheme as G}from"./section-theme.js";import{buttonAlignInRow as T,containedWidth as E,sectionWidth as H}from"./section-width.js";import{blockGroups as I,sectionGroups as L}from"../../../../format/lib/document/passes/settings-groups.js";import{slotsStartAfresh as O}from"./slots-start-afresh.js";import{openSlotDisallow as R,sectionGroupAllow as z}from"../../../../format/lib/document/passes/slot-rules.js";import{registryPassContext as po}from"../../../../format/lib/document/passes/registry-context.js";const D=[O,S,z,R,y,a,C,f,W,w,p,H,E,T,A,g,B,b,k,P,G,n,L,I,d,l,c,u,h,e,s];function eo(r,m,o){const t=m;for(const i of D)i.applies(r,o,t)&&(o.inspector&&i.panel?.(t,r,o.inspector,o),i.draw?.(t,r,o));return m}export{D as BLOCK_PASSES,eo as applyBlockPasses,po as registryPassContext};
@@ -0,0 +1,2 @@
1
+ import type { BlockPass } from "../../../../format/lib/document/passes/types.js";
2
+ export declare const showFor: BlockPass;
@@ -0,0 +1 @@
1
+ import{jsx as i}from"react/jsx-runtime";import{ShowForGate as d}from"../../content/box-show-for.js";import{SHOW_FOR_PROP as s,showForOf as a}from"../../../../format/lib/content/box-show-for-choices.js";const m="Flex",h={name:"showFor",applies:(n,r,e)=>n===m&&typeof e?.render=="function",draw(n){const r=n.render;n.render=e=>{const o=a(e[s])?.name;if(o===void 0)return r(e);const t=!!e.editor?.isEditing;return i(d,{name:o,editing:t,children:r(e)})}}};export{h as showFor};
@@ -1 +1 @@
1
- import{jsx as s}from"react/jsx-runtime";import{SlotsStartAfresh as l}from"../../../components/InBoxContext.js";import{NotASectionEdge as d}from"../../../components/SiteGutterFrame.js";const u=new Set(["Flex","Grid"]),i=t=>Object.entries(t.fields??{}).filter(([,e])=>e?.type==="slot").map(([e])=>e),a=new WeakMap;function h(t){const e=a.get(t);if(e)return e;const r=t,n=o=>s(d,{children:s(l,{children:s(r,{...o})})});return Object.assign(n,t),Object.defineProperty(n,"blockCount",{get:()=>t.blockCount,configurable:!0}),a.set(t,n),n}const b={name:"slotsStartAfresh",applies:(t,e,r)=>!u.has(t)&&typeof r?.render=="function"&&i(r).length>0,draw(t){const e=i(t),r=t.render;t.render=n=>{const o={...n};for(const c of e){const f=n[c];typeof f=="function"&&(o[c]=h(f))}return r(o)}}};export{b as slotsStartAfresh};
1
+ import{jsx as s}from"react/jsx-runtime";import{SlotsStartAfresh as l}from"../../../components/InBoxContext.js";import{NotASectionEdge as d}from"../../../components/SiteGutterFrame.js";const u=new Set(["Flex","Grid"]),i=e=>Object.entries(e.fields??{}).filter(([,t])=>t?.type==="slot").map(([t])=>t),S=["blockCount","blockIds"],a=new WeakMap;function h(e){const t=a.get(e);if(t)return t;const o=e,n=r=>s(d,{children:s(l,{children:s(o,{...r})})});Object.assign(n,e);for(const r of S)Object.defineProperty(n,r,{get:()=>e[r],configurable:!0,enumerable:!0});return a.set(e,n),n}const k={name:"slotsStartAfresh",applies:(e,t,o)=>!u.has(e)&&typeof o?.render=="function"&&i(o).length>0,draw(e){const t=i(e),o=e.render;e.render=n=>{const r={...n};for(const c of t){const f=n[c];typeof f=="function"&&(r[c]=h(f))}return o(r)}}};export{k as slotsStartAfresh};
@@ -1 +1 @@
1
- import{isShown as f,lazyShowWhenContext as a}from"efficient-shell/format";import{isEditorOnDynamicPage as h}from"../../../format/lib/document/editor-page-context.js";import{parentOfSelection as u}from"./selection-parent.js";import{showWhenOf as C,shownByUsedValue as b,shownForOption as g,truthy as R,withRowRules as j,withRowsShownWhen as v,withShowWhen as A}from"../../../format/lib/document/show-when-attach.js";import{showWhenOf as c}from"../../../format/lib/document/show-when-attach.js";function x(t,o,e){let r=!1;const n={};for(const[s,i]of Object.entries(t))f(c(i),o??{},e)?n[s]=i:r=!0;return r?n:t}function m(t,o,e,r){const n=u(o,e,r);return{device:t,parentType:n?.item.type,parent:n?.item.props}}function p(t,o){if(!t||typeof t!="object")return!1;const e=t;if(typeof e.context=="string"&&(e.context===o||e.context.startsWith(`${o}.`)))return!0;if("not"in e)return p(e.not,o);for(const r of[e.all,e.any])if(Array.isArray(r)&&r.some(n=>p(n,o)))return!0;return!1}function W(t,o={}){return a({parentType:()=>t.parent?.type??void 0,parent:()=>t.parent?.props??void 0,dynamicPage:()=>h(),root:()=>t.appState?.data?.root?.props,...o})}export{p as readsContext,W as resolverContext,m as showWhenContext,C as showWhenOf,b as shownByUsedValue,g as shownForOption,R as truthy,x as visibleFields,j as withRowRules,v as withRowsShownWhen,A as withShowWhen};
1
+ import{isShown as f,lazyShowWhenContext as u}from"efficient-shell/format";import{isEditorOnDynamicPage as a}from"../../../format/lib/document/editor-page-context.js";import{parentOfSelection as c}from"./selection-parent.js";import{showWhenOf as C,shownByUsedValue as b,shownForOption as R,truthy as j,withRowRules as F,withRowsShownWhen as P,withShowWhen as T}from"../../../format/lib/document/show-when-attach.js";import{showWhenOf as w}from"../../../format/lib/document/show-when-attach.js";function W(t,o,n){let r=!1;const e={};for(const[s,i]of Object.entries(t)){if(!f(w(i),o??{},n)){r=!0;continue}const p=y(i,o?.[s],o??{},n);p!==i&&(r=!0),e[s]=p}return r?e:t}function y(t,o,n,r){const e=t?.options;if(!Array.isArray(e))return t;const s=e.filter(i=>i?.value===o||!i?.showWhen||f(i.showWhen,n,r));return s.length===e.length?t:{...t,options:s}}function O(t,o,n,r){const e=c(o,n,r);return{device:t,parentType:e?.item.type,parent:e?.item.props}}function h(t,o){if(!t||typeof t!="object")return!1;const n=t;if(typeof n.context=="string"&&(n.context===o||n.context.startsWith(`${o}.`)))return!0;if("not"in n)return h(n.not,o);for(const r of[n.all,n.any])if(Array.isArray(r)&&r.some(e=>h(e,o)))return!0;return!1}function S(t,o={}){return u({parentType:()=>t.parent?.type??void 0,parent:()=>t.parent?.props??void 0,dynamicPage:()=>a(),root:()=>t.appState?.data?.root?.props,...o})}export{h as readsContext,S as resolverContext,O as showWhenContext,C as showWhenOf,b as shownByUsedValue,R as shownForOption,j as truthy,W as visibleFields,F as withRowRules,P as withRowsShownWhen,T as withShowWhen};
@@ -1,2 +1,2 @@
1
- import{defaultTextStyles as Y,textStyleCaseCss as re,textStyleViewKey as le}from"efficient-easel/text-styles/model";import{phoneKey as ce,resolveViewValue as B,tabletKey as de}from"efficient-easel/draw";import{FONT_OPTIONS as pe,normalizeFonts as U}from"../../../format/lib/fonts.js";import{PHONE_MEDIA as fe,TABLET_MEDIA as ue,viewOverrides as H,viewRules as X}from"../content/view-values.js";import{STYLE_ID_OF_ROLE as ge,TEXT_STYLE_ATTR as he,paragraphRules as Z,partSpacingOf as me}from"../document/part-styles.js";import{faceClassOf as q}from"../../../format/lib/text-style-face.js";import{partColourName as Se,partInkCss as ye}from"../../../format/lib/document/part-inks.js";import{compressionMetrics as be,headingTypographyFromRow as xe,normalizeHeadingCompression as A,normalizeSizes as Q}from"../../../format/lib/theme.js";import{finiteNumber as v}from"../../../format/lib/finite-number.js";import{nonEmptyString as O}from"../../../format/lib/non-empty-string.js";const L=e=>e==="sentence"?"none":void 0,ee=["font","color","size","sizeTablet","sizePhone","weight","italic","lineHeight","lineHeightTablet","lineHeightPhone","letterSpacing","letterSpacingTablet","letterSpacingPhone","paragraphSpacing","paragraphSpacingTablet","paragraphSpacingPhone","letterCase","largestSize","largestSizeTablet","largestSizePhone"],T=["desktop","tablet","phone"],C=(e,t)=>t==="desktop"?e:t==="tablet"?de(e):ce(e),k=(e,t)=>t==="desktop"?e:le(e,t);function j(e,t,i,n=X()){return B("textSize",t,e.sizeTablet,e.sizePhone,n)[i]}const ze=[["lineSpacing","lineHeight","line"],["letterSpacing","letterSpacing","letter"]];function M(e){for(const[t,i,n]of ze)for(const o of T)if(e===k(t,o))return{key:C(i,o),view:o,spacing:n};return{key:e,view:"desktop",spacing:null}}function b(e){const t={};for(const i of ee)e[i]!==void 0&&(t[i]=e[i]);return t}function R(e,t){const{auto:i,...n}=e,o=new Set(t??[]),r=ee.filter(s=>o.has(s)&&e.values[s]===void 0);return r.length?{...n,auto:r}:n}function ne(e){const t=e.fonts,i=e.sizes,n=e.typography,o=be(e.compression),r={"heading-1":{font:O(t.heading),size:v(i.headingLarge),weight:v(n.weight),lineHeight:o.lineHeight,letterSpacing:o.letterSpacing,letterCase:L(n.case),largestSize:v(n.maxPx)},"heading-2":{font:O(t.heading2),size:v(i.headingMedium),weight:v(n.weight2),lineHeight:o.lineHeight,letterSpacing:o.letterSpacing,letterCase:L(n.case2)},"heading-3":{font:O(t.heading3),size:v(i.headingSmall),weight:v(n.weight3),lineHeight:o.lineHeight,letterSpacing:o.letterSpacing,letterCase:L(n.case3)},"body-1":{font:O(t.body),size:v(i.body)},"body-5":{font:O(t.label),size:v(i.label)}};return Y().map(({id:s,kind:l,name:d})=>({id:s,kind:l,name:d,values:b(r[s]??{})}))}function E(e){return Array.isArray(e)&&e.every(i=>i&&typeof i=="object"&&typeof i.id=="string"&&(i.kind==="heading"||i.kind==="body")&&typeof i.name=="string")?e.map(i=>R({...i,values:b(i.values??{})},Array.isArray(i.auto)?i.auto:void 0)):null}function je(e){return E(e)??[]}function te(e){return E(e)??Y().map(({id:t,kind:i,name:n})=>({id:t,kind:i,name:n,values:{}}))}function V(e,t){const i=ne(t),n=E(e);return n?n.map(o=>{const r={...F(i,o.id)};for(const s of o.auto??[])delete r[s];return{...o,values:b({...r,...o.values})}}):i}const F=(e,t)=>e.find(i=>i.id===t)?.values??{},ie=["heading-1","heading-2","heading-3"];function Me({saved:e,old:t,cur:i,next:n,sizeOf:o,panelView:r="desktop"}){const s=ne(t),l=te(e),d=V(l,t),c=[],f=n.map(a=>{const S=i.find(m=>m.id===a.id),g=l.find(m=>m.id===a.id);if(!S||!g)return ve([a],o,r)[0];const p={...g.values},x=new Set(g.auto??[]),y=a.values,_=S.values,z=[...new Set([...Object.keys(y),...Object.keys(_)])].filter(m=>JSON.stringify(y[m])!==JSON.stringify(_[m])),D=m=>M(m).spacing==="letter";z.sort((m,N)=>Number(D(m))-Number(D(N)));for(const m of z){const{key:N,view:ae,spacing:K}=M(m),$=N,P=y[m];if(P===void 0){delete p[$],F(s,a.id)[$]!==void 0&&(c.push([a.id,$]),x.add($));continue}if(x.delete($),K==="line")p[$]=w(P/100,3);else if(K==="letter"){const W={...d.find(I=>I.id===a.id)?.values??{}};for(const I of z)y[I]===void 0&&delete W[M(I).key];const G=b({...W,...p}),J=j(G,o({...a,values:G}),ae);p[$]=J?w(P/J,4):0}else p[$]=P}return R({id:a.id,kind:a.kind,name:a.name,values:b(p)},x)});let u=t.compression;if(c.some(([a,S])=>(S==="lineHeight"||S==="letterSpacing")&&ie.includes(a))&&A(u)!=="normal"){for(const a of ie){const S=f.find(p=>p.id===a);if(!S)continue;const g={...S.values};for(const p of["lineHeight","letterSpacing"])c.some(([x,y])=>x===a&&y===p)||g[p]===void 0&&!(S.auto??[]).includes(p)&&(g[p]=F(s,a)[p]);S.values=b(g)}u="normal"}return{saved:f,old:{...t,compression:u}}}function Re(e,t){const i={text_styles:e.saved};return e.old.compression!==t.compression&&(i.heading_compression=A(e.old.compression)),i}const w=(e,t)=>Number(e.toFixed(t)),oe=(e,t)=>T.indexOf(e)<T.indexOf(t)?t:e;function Ve(e,t,i="desktop"){return e.map(n=>{const o={...n.values},r=t(n);for(const s of T){const l=C("lineHeight",s),d=n.values[l],c=n.values[C("letterSpacing",s)];delete o[l],d!==void 0&&(o[k("lineSpacing",s)]=w(d*100,1));const f=oe(s,i);c!==void 0&&(o[k("letterSpacing",s)]=w(c*j(n.values,r,f),f===s?2:4))}return typeof n.values.color=="string"&&(o.color=Se(n.values.color)),{id:n.id,kind:n.kind,name:n.name,values:o}})}function ve(e,t,i="desktop"){return e.map(n=>{const o=n.values,r={...o};for(const c of T)delete r[k("lineSpacing",c)],delete r[k("letterSpacing",c)];const s={id:n.id,kind:n.kind,name:n.name,values:b(r)},l={...s.values},d=t({...s,values:{...s.values}});for(const c of T){const f=o[k("lineSpacing",c)],u=o[k("letterSpacing",c)];if(typeof f=="number"&&(l[C("lineHeight",c)]=w(f/100,3)),typeof u=="number"){const h=j(s.values,d,oe(c,i));l[C("letterSpacing",c)]=h?w(u/h,4):0}}return{...s,values:b(l)}})}function Fe(e){const t={fonts:U({heading:e.heading_font??void 0,heading2:e.heading_2_font??void 0,heading3:e.heading_3_font??void 0,body:e.body_font??void 0,accent:e.accent_font??void 0,label:e.label_font??void 0}),sizes:Q({headingLarge:e.heading_size_large_px,headingMedium:e.heading_size_medium_px,headingSmall:e.heading_size_small_px,accent:e.accent_size_px,body:e.body_size_px,label:e.label_size_px}),compression:A(e.heading_compression),typography:xe(e)},i=e.text_styles??null,n=Array.isArray(i)?se(V(i,t),t):t;return{fonts:U(n.fonts),sizes:Q(n.sizes),compression:A(n.compression),typography:n.typography,textStyles:i}}function se(e,t){const i=h=>e.find(a=>a.id===h)?.values??{},n=i("heading-1"),o=i("heading-2"),r=i("heading-3"),s=i("body-1"),l=i("body-5"),d=t.fonts,c=t.sizes,f=t.typography,u=h=>h==="none"?"sentence":"authored";return{fonts:{...d,heading:n.font??d.heading,heading2:o.font??n.font??d.heading2,heading3:r.font??n.font??d.heading3,body:s.font??d.body,label:l.font??d.label},sizes:{...c,headingLarge:n.size??null,headingMedium:o.size??null,headingSmall:r.size??null,body:s.size??null,label:l.size??null},compression:t.compression,typography:{...f,case:u(n.letterCase),weight:n.weight??null,maxPx:n.largestSize??null,weight2:o.weight??null,weight3:r.weight??null,case2:u(o.letterCase),case3:u(r.letterCase)}}}function De(e){const t=E(e.textStyles);if(!t||t.every(o=>Object.keys(o.values).length===0&&!o.auto))return e;const i={fonts:e.fonts??{},sizes:e.sizes??{},compression:String(e.headingCompression??"normal"),typography:e.headingTypography??{}},n=se(V(t,i),i);return{...e,fonts:n.fonts,sizes:n.sizes,headingCompression:n.compression,headingTypography:n.typography}}function Ke(e){const t=[];for(const i of e){const n=i.values,o=`.${q(i)}`,r=`[${he}="${i.id}"]`,s=`${o}, ${r}`,l=[],d=n.font!==void 0?pe.find(h=>h.key===n.font)?.cssVar:void 0;if(d&&l.push(`font-family: var(${d})`),n.size!==void 0){const h=n.largestSize!==void 0?Math.min(n.size,n.largestSize):n.size;l.push(`font-size: ${h}px`)}const c=ye(n.color);c&&l.push(`color: ${c}`),n.italic===!0&&l.push("font-style: italic"),n.weight!==void 0&&l.push(`font-weight: ${n.weight}`);const f=[];n.lineHeight!==void 0&&f.push(`line-height: ${n.lineHeight}`),n.letterSpacing!==void 0&&f.push(`letter-spacing: ${n.letterSpacing}em`),i.kind==="body"&&l.push(...f);const u=re(n.letterCase);u&&i.kind==="body"&&l.push(`text-transform: ${u}`),n.paragraphSpacing&&l.push(`--sf-part-para: ${n.paragraphSpacing}px`),l.length&&t.push(`${s} { ${l.join("; ")} }`),i.kind==="heading"&&f.length&&t.push(`${s}, ${o}:is(h1, h2, h3, h4), ${r}:is(h1, h2, h3, h4) { ${f.join("; ")} }`),i.kind==="heading"&&u&&t.push(`${r}, ${o}:is(h1, h2, h3, h4) { text-transform: ${u} }`),n.paragraphSpacing&&(t.push(`*:has(> ${r}) { --sf-part-para: ${n.paragraphSpacing}px }`),t.push(...Z(`:is(${s})`,`*:has(> ${r})`))),t.push(...$e(i,s,o,r))}return t.join(`
2
- `)}function $e(e,t,i,n){const o=e.values,r=H("textSize",o.size,o.sizeTablet,o.sizePhone),s=H("textSize",o.largestSize,o.largestSizeTablet,o.largestSizePhone),l=H("same",o.lineHeight,o.lineHeightTablet,o.lineHeightPhone),d=H("same",o.letterSpacing,o.letterSpacingTablet,o.letterSpacingPhone),c=H("spacing",o.paragraphSpacing,o.paragraphSpacingTablet,o.paragraphSpacingPhone),f=B("textSize",o.size,o.sizeTablet,o.sizePhone,X()),u=_e[e.id],h=[];for(const[a,S]of[["tablet",ue],["phone",fe]]){const g=[],p=[],x=f[a],y=s[a],_=r[a]===void 0&&y===void 0||x===void 0?void 0:y===void 0?x:Math.min(x,y);_!==void 0&&p.push(`font-size: ${_}px`);const z=[];l[a]!==void 0&&z.push(`line-height: ${l[a]}`),d[a]!==void 0&&z.push(`letter-spacing: ${d[a]}em`),e.kind==="body"&&p.push(...z),c[a]!==void 0&&p.push(`--sf-part-para: ${c[a]}px`),p.length&&g.push(`${t} { ${p.join("; ")} }`),e.kind==="heading"&&z.length&&g.push(`${t}, ${i}:is(h1, h2, h3, h4), ${n}:is(h1, h2, h3, h4) { ${z.join("; ")} }`),c[a]!==void 0&&g.push(`*:has(> ${n}) { --sf-part-para: ${c[a]}px }`),c[a]!==void 0&&!o.paragraphSpacing&&g.push(...Z(`:is(${t})`,`*:has(> ${n})`)),_!==void 0&&u&&g.push(`.sf-themed-content { --size-${u}: ${_}px !important }`),g.length&&h.push(`@media ${S} { ${g.join(" ")} }`)}return h}const _e={"heading-1":"headingLarge","heading-2":"headingMedium","heading-3":"headingSmall","body-1":"body","body-5":"label"};function We(e){return e!==!0&&e!==!1?"":`em.text-accent { font-style: ${e?"italic":"normal"} }`}function Ge(e){return e?ge[e]:void 0}function ke(e){const t=me(e);return b({font:e.font,color:e.color,size:e.size,weight:e.weight,italic:e.italic,lineHeight:t.lineHeight,letterSpacing:t.letterSpacingEm,paragraphSpacing:e.paragraphSpacing,letterCase:e.case})}function Je(e){return Object.keys(ke(e)).length>0}function Ye({saved:e,old:t,styleId:i,values:n}){const o=te(e);return{saved:Te(o,i,n),old:t}}function Te(e,t,i){return e.map(n=>n.id===t?R({...n,values:b({...n.values,...i})},n.auto):n)}function Be(e){const t=e.filter(i=>i.kind==="body").map(i=>Number(/^body-(\d+)$/.exec(i.id)?.[1])).filter(i=>Number.isInteger(i)&&i>0);return t.length?`body-${Math.max(...t)}`:"body-1"}export{We as accentItalicCss,Me as applyListChange,Be as eyebrowStyleId,q as faceClassOf,ve as fromPanelStyles,Je as hasStyleChange,Re as listChangePatch,te as listToWrite,ke as partStyleToTextStyleValues,Ye as pushIntoStyle,V as resolveTextStyles,Te as setStyleValues,Fe as siteTextFromRow,je as storedTextStyles,Ge as styleIdOfRole,Ke as textStylesCss,ne as textStylesFromOld,se as textStylesToOld,De as themeWithTextStyles,Ve as toPanelStyles,j as viewSizeOf};
1
+ import{defaultTextStyles as Y,textStyleCaseCss as le,textStyleViewKey as ce}from"efficient-easel/text-styles/model";import{phoneKey as de,resolveViewValue as B,tabletKey as pe}from"efficient-easel/draw";import{FONT_OPTIONS as ue,normalizeFonts as U}from"../../../format/lib/fonts.js";import{PHONE_MEDIA as fe,TABLET_MEDIA as ge,viewOverrides as O,viewRules as X}from"../content/view-values.js";import{STYLE_ID_OF_ROLE as he,TEXT_STYLE_ATTR as me,paragraphRules as Z,partSpacingOf as Se}from"../document/part-styles.js";import{faceClassOf as q}from"../../../format/lib/text-style-face.js";import{partColourName as Q,partInkCss as ye}from"../../../format/lib/document/part-inks.js";import{compressionMetrics as be,headingTypographyFromRow as xe,normalizeHeadingCompression as E,normalizeSizes as ee}from"../../../format/lib/theme.js";import{finiteNumber as v}from"../../../format/lib/finite-number.js";import{nonEmptyString as C}from"../../../format/lib/non-empty-string.js";const L=e=>e==="sentence"?"none":void 0,ne=["font","color","size","sizeTablet","sizePhone","weight","italic","lineHeight","lineHeightTablet","lineHeightPhone","letterSpacing","letterSpacingTablet","letterSpacingPhone","paragraphSpacing","paragraphSpacingTablet","paragraphSpacingPhone","letterCase","largestSize","largestSizeTablet","largestSizePhone"],w=["desktop","tablet","phone"],P=(e,t)=>t==="desktop"?e:t==="tablet"?pe(e):de(e),k=(e,t)=>t==="desktop"?e:ce(e,t);function j(e,t,i,n=X()){return B("textSize",t,e.sizeTablet,e.sizePhone,n)[i]}const ze=[["lineSpacing","lineHeight","line"],["letterSpacing","letterSpacing","letter"]];function M(e){for(const[t,i,n]of ze)for(const o of w)if(e===k(t,o))return{key:P(i,o),view:o,spacing:n};return{key:e,view:"desktop",spacing:null}}function b(e){const t={};for(const i of ne)e[i]!==void 0&&(t[i]=e[i]);return t}function R(e,t){const{auto:i,...n}=e,o=new Set(t??[]),r=ne.filter(s=>o.has(s)&&e.values[s]===void 0);return r.length?{...n,auto:r}:n}function te(e){const t=e.fonts,i=e.sizes,n=e.typography,o=be(e.compression),r={"heading-1":{font:C(t.heading),size:v(i.headingLarge),weight:v(n.weight),lineHeight:o.lineHeight,letterSpacing:o.letterSpacing,letterCase:L(n.case),largestSize:v(n.maxPx)},"heading-2":{font:C(t.heading2),size:v(i.headingMedium),weight:v(n.weight2),lineHeight:o.lineHeight,letterSpacing:o.letterSpacing,letterCase:L(n.case2)},"heading-3":{font:C(t.heading3),size:v(i.headingSmall),weight:v(n.weight3),lineHeight:o.lineHeight,letterSpacing:o.letterSpacing,letterCase:L(n.case3)},"body-1":{font:C(t.body),size:v(i.body)},"body-5":{font:C(t.label),size:v(i.label)}};return Y().map(({id:s,kind:l,name:d})=>({id:s,kind:l,name:d,values:b(r[s]??{})}))}function N(e){return Array.isArray(e)&&e.every(i=>i&&typeof i=="object"&&typeof i.id=="string"&&(i.kind==="heading"||i.kind==="body")&&typeof i.name=="string")?e.map(i=>R({...i,values:b(i.values??{})},Array.isArray(i.auto)?i.auto:void 0)):null}function je(e){return N(e)??[]}function ie(e){return N(e)??Y().map(({id:t,kind:i,name:n})=>({id:t,kind:i,name:n,values:{}}))}function V(e,t){const i=te(t),n=N(e);return n?n.map(o=>{const r={...F(i,o.id)};for(const s of o.auto??[])delete r[s];return{...o,values:b({...r,...o.values})}}):i}const F=(e,t)=>e.find(i=>i.id===t)?.values??{},oe=["heading-1","heading-2","heading-3"];function Me({saved:e,old:t,cur:i,next:n,sizeOf:o,panelView:r="desktop"}){const s=te(t),l=ie(e),d=V(l,t),c=[],u=n.map(a=>{const S=i.find(g=>g.id===a.id),h=l.find(g=>g.id===a.id);if(!S||!h){const g=ve([a],o,r)[0],T=g.values.color;return T===void 0?g:{...g,values:{...g.values,color:Q(T)}}}const p={...h.values},x=new Set(h.auto??[]),y=a.values,_=S.values,z=[...new Set([...Object.keys(y),...Object.keys(_)])].filter(g=>JSON.stringify(y[g])!==JSON.stringify(_[g])),D=g=>M(g).spacing==="letter";z.sort((g,T)=>Number(D(g))-Number(D(T)));for(const g of z){const{key:T,view:re,spacing:K}=M(g),$=T,I=y[g];if(I===void 0){delete p[$],F(s,a.id)[$]!==void 0&&(c.push([a.id,$]),x.add($));continue}if(x.delete($),K==="line")p[$]=H(I/100,3);else if(K==="letter"){const W={...d.find(A=>A.id===a.id)?.values??{}};for(const A of z)y[A]===void 0&&delete W[M(A).key];const G=b({...W,...p}),J=j(G,o({...a,values:G}),re);p[$]=J?H(I/J,4):0}else p[$]=I}return R({id:a.id,kind:a.kind,name:a.name,values:b(p)},x)});let f=t.compression;if(c.some(([a,S])=>(S==="lineHeight"||S==="letterSpacing")&&oe.includes(a))&&E(f)!=="normal"){for(const a of oe){const S=u.find(p=>p.id===a);if(!S)continue;const h={...S.values};for(const p of["lineHeight","letterSpacing"])c.some(([x,y])=>x===a&&y===p)||h[p]===void 0&&!(S.auto??[]).includes(p)&&(h[p]=F(s,a)[p]);S.values=b(h)}f="normal"}return{saved:u,old:{...t,compression:f}}}function Re(e,t){const i={text_styles:e.saved};return e.old.compression!==t.compression&&(i.heading_compression=E(e.old.compression)),i}const H=(e,t)=>Number(e.toFixed(t)),se=(e,t)=>w.indexOf(e)<w.indexOf(t)?t:e;function Ve(e,t,i="desktop"){return e.map(n=>{const o={...n.values},r=t(n);for(const s of w){const l=P("lineHeight",s),d=n.values[l],c=n.values[P("letterSpacing",s)];delete o[l],d!==void 0&&(o[k("lineSpacing",s)]=H(d*100,1));const u=se(s,i);c!==void 0&&(o[k("letterSpacing",s)]=H(c*j(n.values,r,u),u===s?2:4))}return{id:n.id,kind:n.kind,name:n.name,values:o}})}function ve(e,t,i="desktop"){return e.map(n=>{const o=n.values,r={...o};for(const c of w)delete r[k("lineSpacing",c)],delete r[k("letterSpacing",c)];const s={id:n.id,kind:n.kind,name:n.name,values:b(r)},l={...s.values},d=t({...s,values:{...s.values}});for(const c of w){const u=o[k("lineSpacing",c)],f=o[k("letterSpacing",c)];if(typeof u=="number"&&(l[P("lineHeight",c)]=H(u/100,3)),typeof f=="number"){const m=j(s.values,d,se(c,i));l[P("letterSpacing",c)]=m?H(f/m,4):0}}return{...s,values:b(l)}})}function Fe(e){const t={fonts:U({heading:e.heading_font??void 0,heading2:e.heading_2_font??void 0,heading3:e.heading_3_font??void 0,body:e.body_font??void 0,accent:e.accent_font??void 0,label:e.label_font??void 0}),sizes:ee({headingLarge:e.heading_size_large_px,headingMedium:e.heading_size_medium_px,headingSmall:e.heading_size_small_px,accent:e.accent_size_px,body:e.body_size_px,label:e.label_size_px}),compression:E(e.heading_compression),typography:xe(e)},i=e.text_styles??null,n=Array.isArray(i)?ae(V(i,t),t):t;return{fonts:U(n.fonts),sizes:ee(n.sizes),compression:E(n.compression),typography:n.typography,textStyles:i}}function ae(e,t){const i=m=>e.find(a=>a.id===m)?.values??{},n=i("heading-1"),o=i("heading-2"),r=i("heading-3"),s=i("body-1"),l=i("body-5"),d=t.fonts,c=t.sizes,u=t.typography,f=m=>m==="none"?"sentence":"authored";return{fonts:{...d,heading:n.font??d.heading,heading2:o.font??n.font??d.heading2,heading3:r.font??n.font??d.heading3,body:s.font??d.body,label:l.font??d.label},sizes:{...c,headingLarge:n.size??null,headingMedium:o.size??null,headingSmall:r.size??null,body:s.size??null,label:l.size??null},compression:t.compression,typography:{...u,case:f(n.letterCase),weight:n.weight??null,maxPx:n.largestSize??null,weight2:o.weight??null,weight3:r.weight??null,case2:f(o.letterCase),case3:f(r.letterCase)}}}function De(e){const t=N(e.textStyles);if(!t||t.every(o=>Object.keys(o.values).length===0&&!o.auto))return e;const i={fonts:e.fonts??{},sizes:e.sizes??{},compression:String(e.headingCompression??"normal"),typography:e.headingTypography??{}},n=ae(V(t,i),i);return{...e,fonts:n.fonts,sizes:n.sizes,headingCompression:n.compression,headingTypography:n.typography}}function Ke(e){const t=[];for(const i of e){const n=i.values,o=`.${q(i)}`,r=`[${me}="${i.id}"]`,s=`${o}, ${r}`,l=[],d=n.font!==void 0?ue.find(m=>m.key===n.font)?.cssVar:void 0;if(d&&l.push(`font-family: var(${d})`),n.size!==void 0){const m=n.largestSize!==void 0?Math.min(n.size,n.largestSize):n.size;l.push(`font-size: ${m}px`)}const c=ye(n.color);c&&l.push(`color: ${c}`),n.italic===!0&&l.push("font-style: italic"),n.weight!==void 0&&l.push(`font-weight: ${n.weight}`);const u=[];n.lineHeight!==void 0&&u.push(`line-height: ${n.lineHeight}`),n.letterSpacing!==void 0&&u.push(`letter-spacing: ${n.letterSpacing}em`),i.kind==="body"&&l.push(...u);const f=le(n.letterCase);f&&i.kind==="body"&&l.push(`text-transform: ${f}`),n.paragraphSpacing&&l.push(`--sf-part-para: ${n.paragraphSpacing}px`),l.length&&t.push(`${s} { ${l.join("; ")} }`),i.kind==="heading"&&u.length&&t.push(`${s}, ${o}:is(h1, h2, h3, h4), ${r}:is(h1, h2, h3, h4) { ${u.join("; ")} }`),i.kind==="heading"&&f&&t.push(`${r}, ${o}:is(h1, h2, h3, h4) { text-transform: ${f} }`),n.paragraphSpacing&&(t.push(`*:has(> ${r}) { --sf-part-para: ${n.paragraphSpacing}px }`),t.push(...Z(`:is(${s})`,`*:has(> ${r})`))),t.push(...$e(i,s,o,r))}return t.join(`
2
+ `)}function $e(e,t,i,n){const o=e.values,r=O("textSize",o.size,o.sizeTablet,o.sizePhone),s=O("textSize",o.largestSize,o.largestSizeTablet,o.largestSizePhone),l=O("same",o.lineHeight,o.lineHeightTablet,o.lineHeightPhone),d=O("same",o.letterSpacing,o.letterSpacingTablet,o.letterSpacingPhone),c=O("spacing",o.paragraphSpacing,o.paragraphSpacingTablet,o.paragraphSpacingPhone),u=B("textSize",o.size,o.sizeTablet,o.sizePhone,X()),f=_e[e.id],m=[];for(const[a,S]of[["tablet",ge],["phone",fe]]){const h=[],p=[],x=u[a],y=s[a],_=r[a]===void 0&&y===void 0||x===void 0?void 0:y===void 0?x:Math.min(x,y);_!==void 0&&p.push(`font-size: ${_}px`);const z=[];l[a]!==void 0&&z.push(`line-height: ${l[a]}`),d[a]!==void 0&&z.push(`letter-spacing: ${d[a]}em`),e.kind==="body"&&p.push(...z),c[a]!==void 0&&p.push(`--sf-part-para: ${c[a]}px`),p.length&&h.push(`${t} { ${p.join("; ")} }`),e.kind==="heading"&&z.length&&h.push(`${t}, ${i}:is(h1, h2, h3, h4), ${n}:is(h1, h2, h3, h4) { ${z.join("; ")} }`),c[a]!==void 0&&h.push(`*:has(> ${n}) { --sf-part-para: ${c[a]}px }`),c[a]!==void 0&&!o.paragraphSpacing&&h.push(...Z(`:is(${t})`,`*:has(> ${n})`)),_!==void 0&&f&&h.push(`.sf-themed-content { --size-${f}: ${_}px !important }`),h.length&&m.push(`@media ${S} { ${h.join(" ")} }`)}return m}const _e={"heading-1":"headingLarge","heading-2":"headingMedium","heading-3":"headingSmall","body-1":"body","body-5":"label"};function We(e){return e!==!0&&e!==!1?"":`em.text-accent { font-style: ${e?"italic":"normal"} }`}function Ge(e){return e?he[e]:void 0}function ke(e){const t=Se(e);return b({font:e.font,color:e.color===void 0?void 0:Q(e.color),size:e.size,weight:e.weight,italic:e.italic,lineHeight:t.lineHeight,letterSpacing:t.letterSpacingEm,paragraphSpacing:e.paragraphSpacing,letterCase:e.case})}function Je(e){return Object.keys(ke(e)).length>0}function Ye({saved:e,old:t,styleId:i,values:n}){const o=ie(e);return{saved:Te(o,i,n),old:t}}function Te(e,t,i){return e.map(n=>n.id===t?R({...n,values:b({...n.values,...i})},n.auto):n)}function Be(e){const t=e.filter(i=>i.kind==="body").map(i=>Number(/^body-(\d+)$/.exec(i.id)?.[1])).filter(i=>Number.isInteger(i)&&i>0);return t.length?`body-${Math.max(...t)}`:"body-1"}export{We as accentItalicCss,Me as applyListChange,Be as eyebrowStyleId,q as faceClassOf,ve as fromPanelStyles,Je as hasStyleChange,Re as listChangePatch,ie as listToWrite,ke as partStyleToTextStyleValues,Ye as pushIntoStyle,V as resolveTextStyles,Te as setStyleValues,Fe as siteTextFromRow,je as storedTextStyles,Ge as styleIdOfRole,Ke as textStylesCss,te as textStylesFromOld,ae as textStylesToOld,De as themeWithTextStyles,Ve as toPanelStyles,j as viewSizeOf};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "efficient-web-builder",
3
- "version": "52.0.0",
3
+ "version": "54.0.0",
4
4
  "description": "The EFFICIENT website builder: the website editor, the general sections and the renderer that draws them, compiled. Hostable by any EFFICIENT product; nothing here imports a host.",
5
5
  "license": "UNLICENSED",
6
6
  "author": "Efficient Pty Ltd",
@@ -53,7 +53,7 @@
53
53
  },
54
54
  "peerDependencies": {
55
55
  "@tabler/icons-react": "^3.46.0",
56
- "efficient-easel": "^27.3.0",
56
+ "efficient-easel": "^27.7.0",
57
57
  "efficient-shell": "^11.8.0",
58
58
  "isomorphic-dompurify": "^3.18.0",
59
59
  "next": ">=16",
@@ -72,7 +72,7 @@
72
72
  "@types/node": "^20",
73
73
  "@types/react": "^19",
74
74
  "@types/react-dom": "^19",
75
- "efficient-easel": "^27.3.0",
75
+ "efficient-easel": "^27.7.0",
76
76
  "efficient-shell": "^11.8.0",
77
77
  "esbuild": "^0.28.0",
78
78
  "happy-dom": "^20.14.5",