efficient-web-builder 17.0.1 → 17.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,38 @@
1
1
  # Changelog
2
2
 
3
+ ## 17.1.0 - 2026-10-16
4
+
5
+ **A section can show or hide each part of its repeated items, with the phone's own answers; a text part takes its own phone font size; and a repeated item's look can be kept once by its parent** (card: gallery tiles on phone, for Lewis's Hartes US homepage; design approved by Lewis 2026-10-16: https://claude.ai/artifact/XydQQ2bzLGCpoZdNfB9Z5K). A minor: nothing changes for a page that sets none of it.
6
+
7
+ ### Changed for merchants
8
+
9
+ - **Display row** (new): one row of the shell's Display chips — a press shows or hides that part on every item (Lewis's option C, 2026-10-08). In the Phone view the same row edits the phone: a press stores that one part for the phone, the others keep following Desktop, and the row's ↺ hands every part back to Desktop. Phone answers apply below 720px, the Phone view's own edge.
10
+ - **Font size on a phone** (new): in the Phone view, a text part's Font size cell writes the phone's own size. Empty, it shows grey what the phone draws now; a clear hands it back to Desktop. Clear changes removes it with the rest.
11
+ - **One look for every item** (new): where a section says so, a style set on one item's text (e.g. a gallery tile's Title) is stored once on the section and reaches every item. The words stay the item's own: clicked and typed on the item as before.
12
+
13
+ ### Changed for hosts
14
+
15
+ - `controls`: `displayFields(parts, key = "display")` returns the row's two keys (`display` on Desktop, `displayPhone` on Phone). Nothing is seeded; absent means every part shown.
16
+ - `lib/content/part-display`: the stored shape and the render rule — `partShownOnDesktop`, `partShownOnPhone`, `partDisplayClass` (Tailwind `max-[720px]:hidden` / `min-[720px]:hidden` / `hidden`).
17
+ - `part-styles`: `PartStyle.sizePhone`; `partPhoneDeclarations`, `partStyleForScreen`, `PART_PHONE_MAX_CSS` (`(max-width: 719.98px)`); the published sheet writes a phone rule after the desktop one; `applyPartStyles` takes a `phone` flag (the canvas sets it in the Phone view).
18
+ - `text-parts`: `PART_STYLE_OWNER_ATTR` and `PART_STYLE_KIND_ATTR` mark a run whose look another node keeps; `partStyleOwnerOf(element)`. The canvas paints such runs from the owner's store, the part panel writes the owner's `_partStyles[kind]`, and live a renderer stamps them with `PartStyledKind shared` inside the owner's `SharedPartKinds` (`PublishedPartStylesContext`).
19
+
20
+ ### Guards
21
+
22
+ - New `scripts/test-part-display.tsx` (24 checks), `scripts/test-part-phone-size.tsx` (18), `scripts/test-part-style-owner.tsx` (9).
23
+
24
+ ## 17.0.2 - 2026-10-16
25
+
26
+ **Every kept key of the four-side Padding row names the row that edits it** (GG 2026-10-16; it blocked the storefront's move to 17.0.x). A patch.
27
+
28
+ ### Fixed
29
+
30
+ - `sidesPaddingFields` draws its row on the top key and keeps the other three (`sectionPaddingRight`, `sectionPaddingBottom`, `sectionPaddingLeft`, or the caller's own keys) as fields with no control of their own. They now carry `reachedBy` = the row's top key, as ButtonBlock's kept keys do, so the storefront's `test-panel-no-empty-rows` no longer counts them as unreachable ("183 unreachable"). Their phone twins already passed (phone-only fields). Nothing a merchant sees changes.
31
+
32
+ ### Guards
33
+
34
+ - `scripts/test-padding-phone-twins-and-hero-group.tsx` §4: each kept key is reached by the top key, with the default keys and with a caller's own. Failed before the fix.
35
+
3
36
  ## 17.0.1 - 2026-10-16
4
37
 
5
38
  **On a phone, the hero's words are as wide as the hero, so a long word is fitted instead of cut** (card [FIX] Hero Grows On Phone, GG 2026-10-16). A patch.
@@ -1 +1 @@
1
- "use client";import{jsx as n,Fragment as D,jsxs as h}from"react/jsx-runtime";import{useEffect as $,useRef as Re,useState as Ce}from"react";import{PartResetDot as _e}from"./PartResetDot.js";import{FieldSelect as Fe,InspectorField as Ie}from"efficient-easel/fields";import{SettingsField as ze}from"efficient-easel/panel";import{InspectorUpLevel as z}from"efficient-easel/chrome";import{StylesIcon as Ae,TypeIcon as Le}from"efficient-easel/icons";import{useEasel as Ve}from"efficient-easel/easel";import{TextPartPanel as Be}from"efficient-easel/copy";import{Tooltip as Ke}from"efficient-shell/ui";import{PartTextBox as je,partTextCells as Ge}from"./PartTextBox.js";import he from"./UiIcon.js";import{usePreviewHeader as Me}from"./PreviewHeaderContext.js";import{usePartStyle as Ue}from"./PreviewPartStyleContext.js";import{say as l}from"../lib/editor-words.js";import{readHidable as A,textFieldOffPage as We,textFieldPanelOnly as He}from"../lib/puck/controls.js";import{TEXT_FIELD_MARKER as De}from"../lib/puck/field-markers.js";import{useSectionOps as $e}from"../lib/puck/use-section-ops.js";import{FONT_OPTIONS as Ye,FONT_ROLES as Y,FONT_ROLE_LABELS as X,fontOption as q}from"../lib/fonts.js";import{isMultilineKind as Xe,partPlaceholder as qe,typeInPlaceKind as Je}from"../lib/puck/part-text.js";import{partRowField as Qe}from"../lib/puck/part-row-field.js";import{decodePartKey as Ze,partPropsWithRowValue as et,partRowValue as tt}from"../lib/puck/part-rows.js";import{PART_WIDTH_MAX as nt,propsWithPartStyleValue as L,propsWithoutPartStyle as ot,readPartStyle as ye}from"../lib/puck/part-styles.js";import{partInks as lt}from"../lib/puck/part-inks.js";import{styleKeyForPart as st}from"../lib/sections/section-text-kinds.js";import{commitPartText as rt}from"../lib/puck/part-typing.js";import{keysOnCanvas as it,useCanvasTypingPart as at}from"../lib/puck/canvas-typing.js";import{useEditorHost as ct}from"../lib/editor-host.js";import{SOURCE_LINES as dt,SOURCE_ACTIONS as ut,SOURCE_ACTION_LABEL as ft,partSourceOf as pt,sourceSlugOf as ge}from"../lib/puck/source-bound-parts.js";import{encodePartId as mt,holdsAuthoredText as ht}from"../lib/puck/text-parts.js";import{regionsForSection as yt}from"../lib/sections/section-text-regions.js";import{textRegionOfPartKey as gt}from"../lib/sections/text-regions.js";function J(t){return t?l(t):null}function be(t){return t.kind==="role"?X[t.role]:t.kind==="custom"?"Custom":null}function bt(t){const o=t.role;return o&&Y.includes(o)?{kind:"role",role:o}:null}function xt(t,o){if(!t)return{kind:"unread"};const{faceRole:s,base:r}=t;if(o[s]===r.fontKey)return{kind:"role",role:s};const d=Object.keys(o).filter(i=>o[i]===r.fontKey);return d.length===1?{kind:"role",role:d[0]}:{kind:"custom"}}function Q(t,o,s,r){return bt(ye(t,o))??xt(s,r)}function St(t,o){if(!t.length)return null;const s=o(t[0]);return t.every(r=>o(r)===s)?s:null}const V="";function Pt({face:t,base:o,onPick:s}){const r=t.kind==="role"?t.role:V,d=[{label:l("No style"),value:V},...Y.map(i=>({label:l(X[i]),value:i}))];return n(Fe,{ariaLabel:l("Style"),value:r,options:d,inline:!0,onChange:i=>s(i===V?null:i),renderOption:i=>i.value===V?h(D,{children:[n("span",{className:"es-fsel-label sf-part-style-keep",children:i.label}),n("span",{className:"sf-part-style-aside","aria-hidden":"true",children:l("Section’s own")})]}):n("span",{className:"es-fsel-label",style:{fontFamily:`var(--font-role-${i.value})`},children:i.label}),renderValue:()=>n("span",{style:{fontFamily:o?.fontKey?`var(${q(o.fontKey)?.cssVar})`:void 0,fontWeight:o?.weight},children:J(be(t))}),valueText:i=>J(be(t))??i?.label??""})}function vt({sectionName:t,onBack:o,textEditor:s,styleRow:r,children:d}){return h("div",{className:"sf-part-panel",children:[n(z,{inline:!0,name:l(t),onSelect:o}),s,r,d]})}function xe({source:t,slug:o}){const s=ct(),r=ut[t],d=!r.needsSlug||!!o;return n("div",{className:"sf-note sf-note--source",children:h("p",{className:"es-field-hint sf-hint-keep",children:[l(dt[t]),d?h(D,{children:[" ",n("button",{type:"button",className:"sf-source-open",onClick:()=>{r.type==="storefront-editor:open-menus"?s.send(r.type):o&&s.send(r.type,{slug:o})},children:l(ft)})]}):null]})})}const Se=4,Tt=120;function wt({region:t,sizePx:o,face:s,base:r,onFollowStyle:d,source:i,slug:B,onBack:T}){const O=t.follows;return h("div",{className:"sf-note",children:[n("p",{children:n("strong",{children:l(t.label)})}),n("p",{children:o?l("Its size follows Site styles ▸ {follows} — {px}px right now.",{follows:l(O),px:Math.round(o)}):l("Its size follows Site styles ▸ {follows}.",{follows:l(O)})}),d?n(D,{children:n(ze,{label:l("Style"),icon:n(Ae,{}),hint:l("Every {part} in this section follows it. The face and the size change; the letter case is the section’s own and stays as it is.",{part:l(t.label).toLowerCase()}),children:n(Pt,{face:s,base:r,onPick:d})})}):n("p",{className:"es-field-hint sf-hint-keep",children:l("Only the size follows a site style. This section sets its own font, weight and letter case.")}),i?n(xe,{source:i,slug:B}):null,n(z,{inline:!0,name:l("Page"),onSelect:T})]})}function kt({onBack:t}){return h("div",{className:"sf-note",children:[n("p",{children:n("strong",{children:l("This part is no longer here.")})}),n("p",{children:l("The section it belonged to has been changed or removed.")}),n(z,{inline:!0,name:l("Page"),onSelect:t})]})}function Nt({onBack:t,partId:o,why:s}){return h("div",{className:"sf-note",children:[n("p",{children:n("strong",{children:l("This part's settings did not open.")})}),n("p",{children:l("The words are still on your page and nothing has been lost. The editor could not work out which control belongs to them, which is a fault on our side. Go back and click the section to open its settings instead.")}),n("p",{className:"sf-note-detail",children:h("code",{children:[o," — ",s]})}),n(z,{inline:!0,name:l("Page"),onSelect:t})]})}function Ot({nodeId:t,propKey:o,onBack:s,onEditStyle:r}){const{getItemById:d,getSelectorForId:i,config:B}=Ve(e=>e),T=$e(),O=at(),{partStyle:E}=Ue(),{fonts:R,textStyles:Pe}=Me(),Z=Re(null),u=d(t),p=i(t),ee=u?B.components[u.type]:void 0,{key:x,row:b}=Ze(o),te=ee?.fields?.[x],y=b?Qe(te,b):te,S=mt(t,o),c=u?.props??{},g=Je(y),ne=We(y),oe=ht(y),K=u?pt(u.type):null,j=b?tt(c[x],b):c[x],le=!!b&&!(Array.isArray(c[x])&&b.index<c[x].length);$(()=>{if(it(document))return;Z.current?.querySelector(".es-copy [contenteditable='true'], .es-copy textarea, .sf-copybox textarea, .sf-copybox input")?.focus()},[S]);const[G,se]=Ce(0);$(()=>se(0),[S]);const M=!!u&&!le&&(!p||!y);$(()=>{if(!M||G>=Se)return;const e=setTimeout(()=>se(a=>a+1),Tt);return()=>clearTimeout(e)},[M,G]);const ve=M&&G<Se;if(!u||le)return n(kt,{onBack:s});const C=yt(u.type),re=C?gt(C,o):null;if(C&&re){const e=E?.partId===S?E:null,a=C[re],f=a.writable===!0&&!!p,N=H=>{p&&T.replaceComponent(p.zone,p.index,{...u,props:L(c,o,"role",H)})};return n(wt,{region:a,sizePx:e?.base.sizePx??null,face:Q(c,o,e,R),base:e?.base??null,onFollowStyle:f?N:void 0,source:K,slug:ge(c),onBack:s})}if(!p||!y)return ve?n("div",{className:"sf-note","aria-busy":"true"}):n(Nt,{onBack:s,partId:S,why:p?"no field":"no selector"});const _=e=>{T.replaceComponent(p.zone,p.index,{...u,props:e})},U=e=>{if(A(e).hidden!==A(j).hidden||!g){const f=b?et(c,x,b,e):{...c,[x]:e};f&&_(f);return}rt({node:u,propKey:o,kind:g,zone:p.zone,index:p.index},A(e).text,T.replaceComponent)},Te=j,F=st(u?.type,o),P=ye(c,F),w=E?.partId===S?E:null,m=[{partKey:F,face:Q(c,F,w,R),sizeGroup:w?.sizeGroup??null,base:w?.base??Ct,style:P}],we=St(m,e=>e.sizeGroup),ke=lt(w?.inks),k=(e,a)=>{let f=c;for(const N of m)f=L(f,N.partKey,e,a);_(f)},Ne=e=>k("role",e),ie=e=>{let a=c;for(const f of m)for(const[N,H]of Object.entries(e))a=L(a,f.partKey,N,H??null);_(a)},W=g==="text"||g==="textarea",{text:ae,hidden:v}=A(j),I=y?.[De]?.label??o,ce=v?l("Show {label} on the slide",{label:l(I)}):l("Hide {label} on the slide",{label:l(I)}),de=h("div",{className:"sf-field-head",children:[n(Le,{}),n("span",{className:"sf-field-label sf-field-label--inline",children:l(I)}),W&&n(Ke,{content:ce,children:n("button",{type:"button",className:"sf-field-eye","aria-pressed":v,"aria-label":ce,onClick:()=>U({text:ae,hidden:!v}),children:v?n(he,{name:"eye-off",size:14}):n(he,{name:"eye",size:14})})})]}),ue=!ne&&oe,Oe=!!g&&(He(y)||ne||v||!oe||g!=="plainText"),fe=Q(c,F,w,R),pe=fe.kind==="role"?fe.role:null,me=Object.entries(P).filter(([e,a])=>e!=="role"&&a!==void 0).length,Ee=()=>{let e=c;for(const a of m){const f=a.style.role;e=ot(e,a.partKey),f&&(e=L(e,a.partKey,"role",f))}_(e)};return h(vt,{sectionName:ee?.label??u.type,onBack:s,textEditor:n("div",{ref:Z,className:"sf-part-text",children:Oe?n(je,{text:ae,onTextChange:e=>U(W?{text:e,hidden:v}:e),multiline:Xe(g),markup:g!=="plainText",styled:!1,style:m[0].style,base:m[0].base,setValue:ie,colors:ke.map(e=>({name:e.key,label:l(e.name),value:e.value})),placeholder:J(qe(y))??void 0,ariaLabel:l(I),head:de,typedOnCanvas:O===S}):g?W?de:null:n(Ie,{field:y,name:o,value:Te,onChange:U,id:`sf-part-${t}-${o}`})}),children:[K&&n(xe,{source:K,slug:ge(c)}),ue&&n(Be,{style:{value:pe??"",options:[{value:"",label:l("No style"),description:l("Section’s own")},...Y.map(e=>({value:e,label:l(X[e]),description:q(R[e])?.label}))],onChange:e=>Ne(e||null),changed:me>0,onClearChanges:me>0?Ee:void 0,onEditStyles:r},font:{value:P.font??"",styleValue:q(m[0].base.fontKey)?.label,options:Ye.map(e=>({label:e.label,value:e.key})),onChange:e=>k("font",e||null)},italic:{value:P.italic,styleValue:Rt(Pe,pe),onChange:e=>k("italic",e??null)},cells:Ge(m[0].style,m[0].base,ie),align:{value:P.align??"",styleValue:m[0].base.align,onChange:e=>k("align",e||null)},letterCase:{value:P.case??"",styleValue:m[0].base.case,onChange:e=>k("case",e||null)}}),ue&&we===null&&n("p",{className:"es-field-hint sf-hint-keep",children:l("Fixed size — the site’s Text setting doesn’t resize this.")})]})}const Et={heading:"heading-1",heading2:"heading-2",heading3:"heading-3",body:"body-1",label:"body-5"};function Rt(t,o){const s=o?Et[o]:void 0;return!s||!Array.isArray(t)?!1:t.find(d=>d?.id===s)?.values?.italic===!0}const Ct={fontKey:"",sizePx:16,weight:400,lineRatio:1.4,letterEm:0,align:"left",case:"none",paddingPx:0,widthPx:nt};export{vt as PartPanelBody,_e as PartResetDot,xe as PartSourceNote,Pt as PartStyleSelect,Ot as default,Q as partFace};
1
+ "use client";import{jsx as n,Fragment as J,jsxs as h}from"react/jsx-runtime";import{useEffect as Q,useRef as Le,useState as Ve}from"react";import{PartResetDot as Ke}from"./PartResetDot.js";import{FieldSelect as Be,InspectorField as je}from"efficient-easel/fields";import{SettingsField as Ge}from"efficient-easel/panel";import{InspectorUpLevel as L}from"efficient-easel/chrome";import{StylesIcon as Me,TypeIcon as Ue}from"efficient-easel/icons";import{useEasel as We}from"efficient-easel/easel";import{TextPartPanel as De}from"efficient-easel/copy";import{Tooltip as He}from"efficient-shell/ui";import{PartTextBox as $e,partTextCells as Ye}from"./PartTextBox.js";import Pe from"./UiIcon.js";import{usePreviewHeader as Xe}from"./PreviewHeaderContext.js";import{usePreviewDevice as qe}from"./PreviewDeviceContext.js";import{usePartStyle as Je}from"./PreviewPartStyleContext.js";import{say as l}from"../lib/editor-words.js";import{readHidable as V,textFieldOffPage as Qe,textFieldPanelOnly as Ze}from"../lib/puck/controls.js";import{TEXT_FIELD_MARKER as et}from"../lib/puck/field-markers.js";import{useSectionOps as tt}from"../lib/puck/use-section-ops.js";import{FONT_OPTIONS as nt,FONT_ROLES as Z,FONT_ROLE_LABELS as ee,fontOption as te}from"../lib/fonts.js";import{isMultilineKind as ot,partPlaceholder as lt,typeInPlaceKind as st}from"../lib/puck/part-text.js";import{partRowField as rt}from"../lib/puck/part-row-field.js";import{decodePartKey as it,partPropsWithRowValue as at,partRowValue as ct}from"../lib/puck/part-rows.js";import{PART_WIDTH_MAX as dt,propsWithPartStyleValue as K,propsWithoutPartStyle as ut,readPartStyle as we}from"../lib/puck/part-styles.js";import{partInks as ft}from"../lib/puck/part-inks.js";import{styleKeyForPart as pt}from"../lib/sections/section-text-kinds.js";import{commitPartText as mt}from"../lib/puck/part-typing.js";import{keysOnCanvas as ht,useCanvasTypingPart as yt}from"../lib/puck/canvas-typing.js";import{useEditorHost as gt}from"../lib/editor-host.js";import{SOURCE_LINES as bt,SOURCE_ACTIONS as xt,SOURCE_ACTION_LABEL as St,partSourceOf as Pt,sourceSlugOf as ve}from"../lib/puck/source-bound-parts.js";import{encodePartId as wt,holdsAuthoredText as vt}from"../lib/puck/text-parts.js";import{regionsForSection as Tt}from"../lib/sections/section-text-regions.js";import{textRegionOfPartKey as kt}from"../lib/sections/text-regions.js";function ne(t){return t?l(t):null}function Te(t){return t.kind==="role"?ee[t.role]:t.kind==="custom"?"Custom":null}function Nt(t){const o=t.role;return o&&Z.includes(o)?{kind:"role",role:o}:null}function Ot(t,o){if(!t)return{kind:"unread"};const{faceRole:s,base:r}=t;if(o[s]===r.fontKey)return{kind:"role",role:s};const c=Object.keys(o).filter(i=>o[i]===r.fontKey);return c.length===1?{kind:"role",role:c[0]}:{kind:"custom"}}function oe(t,o,s,r){return Nt(we(t,o))??Ot(s,r)}function Ct(t,o){if(!t.length)return null;const s=o(t[0]);return t.every(r=>o(r)===s)?s:null}const B="";function Et({face:t,base:o,onPick:s}){const r=t.kind==="role"?t.role:B,c=[{label:l("No style"),value:B},...Z.map(i=>({label:l(ee[i]),value:i}))];return n(Be,{ariaLabel:l("Style"),value:r,options:c,inline:!0,onChange:i=>s(i===B?null:i),renderOption:i=>i.value===B?h(J,{children:[n("span",{className:"es-fsel-label sf-part-style-keep",children:i.label}),n("span",{className:"sf-part-style-aside","aria-hidden":"true",children:l("Section’s own")})]}):n("span",{className:"es-fsel-label",style:{fontFamily:`var(--font-role-${i.value})`},children:i.label}),renderValue:()=>n("span",{style:{fontFamily:o?.fontKey?`var(${te(o.fontKey)?.cssVar})`:void 0,fontWeight:o?.weight},children:ne(Te(t))}),valueText:i=>ne(Te(t))??i?.label??""})}function Rt({sectionName:t,onBack:o,textEditor:s,styleRow:r,children:c}){return h("div",{className:"sf-part-panel",children:[n(L,{inline:!0,name:l(t),onSelect:o}),s,r,c]})}function ke({source:t,slug:o}){const s=gt(),r=xt[t],c=!r.needsSlug||!!o;return n("div",{className:"sf-note sf-note--source",children:h("p",{className:"es-field-hint sf-hint-keep",children:[l(bt[t]),c?h(J,{children:[" ",n("button",{type:"button",className:"sf-source-open",onClick:()=>{r.type==="storefront-editor:open-menus"?s.send(r.type):o&&s.send(r.type,{slug:o})},children:l(St)})]}):null]})})}const Ne=4,_t=120;function Ft({region:t,sizePx:o,face:s,base:r,onFollowStyle:c,source:i,slug:j,onBack:S}){const E=t.follows;return h("div",{className:"sf-note",children:[n("p",{children:n("strong",{children:l(t.label)})}),n("p",{children:o?l("Its size follows Site styles ▸ {follows} — {px}px right now.",{follows:l(E),px:Math.round(o)}):l("Its size follows Site styles ▸ {follows}.",{follows:l(E)})}),c?n(J,{children:n(Ge,{label:l("Style"),icon:n(Me,{}),hint:l("Every {part} in this section follows it. The face and the size change; the letter case is the section’s own and stays as it is.",{part:l(t.label).toLowerCase()}),children:n(Et,{face:s,base:r,onPick:c})})}):n("p",{className:"es-field-hint sf-hint-keep",children:l("Only the size follows a site style. This section sets its own font, weight and letter case.")}),i?n(ke,{source:i,slug:j}):null,n(L,{inline:!0,name:l("Page"),onSelect:S})]})}function It({onBack:t}){return h("div",{className:"sf-note",children:[n("p",{children:n("strong",{children:l("This part is no longer here.")})}),n("p",{children:l("The section it belonged to has been changed or removed.")}),n(L,{inline:!0,name:l("Page"),onSelect:t})]})}function zt({onBack:t,partId:o,why:s}){return h("div",{className:"sf-note",children:[n("p",{children:n("strong",{children:l("This part's settings did not open.")})}),n("p",{children:l("The words are still on your page and nothing has been lost. The editor could not work out which control belongs to them, which is a fault on our side. Go back and click the section to open its settings instead.")}),n("p",{className:"sf-note-detail",children:h("code",{children:[o," — ",s]})}),n(L,{inline:!0,name:l("Page"),onSelect:t})]})}function At({nodeId:t,propKey:o,onBack:s,onEditStyle:r}){const{getItemById:c,getSelectorForId:i,config:j}=We(e=>e),S=tt(),E=yt(),{partStyle:R}=Je(),{fonts:_,textStyles:Oe}=Xe(),Ce=qe()==="mobile",le=Le(null),d=c(t),f=i(t),se=d?j.components[d.type]:void 0,{key:x,row:b}=it(o),re=se?.fields?.[x],y=b?rt(re,b):re,P=wt(t,o),p=d?.props??{},g=st(y),ie=Qe(y),ae=vt(y),G=d?Pt(d.type):null,M=b?ct(p[x],b):p[x],ce=!!b&&!(Array.isArray(p[x])&&b.index<p[x].length);Q(()=>{if(ht(document))return;le.current?.querySelector(".es-copy [contenteditable='true'], .es-copy textarea, .sf-copybox textarea, .sf-copybox input")?.focus()},[P]);const[U,de]=Ve(0);Q(()=>de(0),[P]);const W=!!d&&!ce&&(!f||!y);Q(()=>{if(!W||U>=Ne)return;const e=setTimeout(()=>de(a=>a+1),_t);return()=>clearTimeout(e)},[W,U]);const Ee=W&&U<Ne;if(!d||ce)return n(It,{onBack:s});const F=Tt(d.type),ue=F?kt(F,o):null;if(F&&ue){const e=R?.partId===P?R:null,a=F[ue],u=a.writable===!0&&!!f,C=q=>{f&&S.replaceComponent(f.zone,f.index,{...d,props:K(p,o,"role",q)})};return n(Ft,{region:a,sizePx:e?.base.sizePx??null,face:oe(p,o,e,_),base:e?.base??null,onFollowStyle:u?C:void 0,source:G,slug:ve(p),onBack:s})}if(!f||!y)return Ee?n("div",{className:"sf-note","aria-busy":"true"}):n(zt,{onBack:s,partId:P,why:f?"no field":"no selector"});const fe=e=>{S.replaceComponent(f.zone,f.index,{...d,props:e})},D=e=>{if(V(e).hidden!==V(M).hidden||!g){const u=b?at(p,x,b,e):{...p,[x]:e};u&&fe(u);return}mt({node:d,propKey:o,kind:g,zone:f.zone,index:f.index},V(e).text,S.replaceComponent)},Re=M,w=R?.partId===P?R:null,v=w?.styleOwner,I=v?c(v.owner):null,H=v&&I?i(v.owner):null,$=!!(v&&I&&H),T=$?I.props??{}:p,Y=$?e=>S.replaceComponent(H.zone,H.index,{...I,props:e}):fe,z=$?v.kind:pt(d?.type,o),k=we(T,z),m=[{partKey:z,face:oe(T,z,w,_),sizeGroup:w?.sizeGroup??null,base:w?.base??Kt,style:k}],_e=Ct(m,e=>e.sizeGroup),Fe=ft(w?.inks),O=(e,a)=>{let u=T;for(const C of m)u=K(u,C.partKey,e,a);Y(u)},Ie=e=>O("role",e),pe=e=>{let a=T;for(const u of m)for(const[C,q]of Object.entries(e))a=K(a,u.partKey,C,q??null);Y(a)},X=g==="text"||g==="textarea",{text:me,hidden:N}=V(M),A=y?.[et]?.label??o,he=N?l("Show {label} on the slide",{label:l(A)}):l("Hide {label} on the slide",{label:l(A)}),ye=h("div",{className:"sf-field-head",children:[n(Ue,{}),n("span",{className:"sf-field-label sf-field-label--inline",children:l(A)}),X&&n(He,{content:he,children:n("button",{type:"button",className:"sf-field-eye","aria-pressed":N,"aria-label":he,onClick:()=>D({text:me,hidden:!N}),children:N?n(Pe,{name:"eye-off",size:14}):n(Pe,{name:"eye",size:14})})})]}),ge=!ie&&ae,ze=!!g&&(Ze(y)||ie||N||!ae||g!=="plainText"),be=oe(T,z,w,_),xe=be.kind==="role"?be.role:null,Se=Object.entries(k).filter(([e,a])=>e!=="role"&&a!==void 0).length,Ae=()=>{let e=T;for(const a of m){const u=a.style.role;e=ut(e,a.partKey),u&&(e=K(e,a.partKey,"role",u))}Y(e)};return h(Rt,{sectionName:se?.label??d.type,onBack:s,textEditor:n("div",{ref:le,className:"sf-part-text",children:ze?n($e,{text:me,onTextChange:e=>D(X?{text:e,hidden:N}:e),multiline:ot(g),markup:g!=="plainText",styled:!1,style:m[0].style,base:m[0].base,setValue:pe,colors:Fe.map(e=>({name:e.key,label:l(e.name),value:e.value})),placeholder:ne(lt(y))??void 0,ariaLabel:l(A),head:ye,typedOnCanvas:E===P}):g?X?ye:null:n(je,{field:y,name:o,value:Re,onChange:D,id:`sf-part-${t}-${o}`})}),children:[G&&n(ke,{source:G,slug:ve(p)}),ge&&n(De,{style:{value:xe??"",options:[{value:"",label:l("No style"),description:l("Section’s own")},...Z.map(e=>({value:e,label:l(ee[e]),description:te(_[e])?.label}))],onChange:e=>Ie(e||null),changed:Se>0,onClearChanges:Se>0?Ae:void 0,onEditStyles:r},font:{value:k.font??"",styleValue:te(m[0].base.fontKey)?.label,options:nt.map(e=>({label:e.label,value:e.key})),onChange:e=>O("font",e||null)},italic:{value:k.italic,styleValue:Vt(Oe,xe),onChange:e=>O("italic",e??null)},cells:Ye(m[0].style,m[0].base,pe,{phone:Ce}),align:{value:k.align??"",styleValue:m[0].base.align,onChange:e=>O("align",e||null)},letterCase:{value:k.case??"",styleValue:m[0].base.case,onChange:e=>O("case",e||null)}}),ge&&_e===null&&n("p",{className:"es-field-hint sf-hint-keep",children:l("Fixed size — the site’s Text setting doesn’t resize this.")})]})}const Lt={heading:"heading-1",heading2:"heading-2",heading3:"heading-3",body:"body-1",label:"body-5"};function Vt(t,o){const s=o?Lt[o]:void 0;return!s||!Array.isArray(t)?!1:t.find(c=>c?.id===s)?.values?.italic===!0}const Kt={fontKey:"",sizePx:16,weight:400,lineRatio:1.4,letterEm:0,align:"left",case:"none",paddingPx:0,widthPx:dt};export{Rt as PartPanelBody,Ke as PartResetDot,ke as PartSourceNote,Et as PartStyleSelect,At as default,oe as partFace};
@@ -1,5 +1,6 @@
1
1
  import type { ReactNode } from "react";
2
- export default function PartStyledKind({ kind, children, }: {
2
+ export default function PartStyledKind({ kind, shared, children, }: {
3
3
  kind: string;
4
+ shared?: boolean;
4
5
  children: ReactNode;
5
6
  }): import("react").JSX.Element;
@@ -1 +1 @@
1
- "use client";import{Fragment as i,jsx as e}from"react/jsx-runtime";import{usePublishedPartKindRule as s}from"./PublishedPartStylesContext.js";import{PART_STYLED_ATTR as a}from"../lib/puck/part-styles.js";function m({kind:n,children:r}){const t=s(n);return t?e("span",{[a]:t.stamp,children:r}):e(i,{children:r})}export{m as default};
1
+ "use client";import{Fragment as a,jsx as n}from"react/jsx-runtime";import{usePublishedPartKindRule as i,usePublishedSharedKindRule as l}from"./PublishedPartStylesContext.js";import{PART_STYLED_ATTR as m}from"../lib/puck/part-styles.js";function d({kind:e,shared:s=!1,children:t}){const o=i(e),u=l(e),r=s?u:o;return r?n("span",{[m]:r.stamp,children:t}):n(a,{children:t})}export{d as default};
@@ -4,7 +4,9 @@ import { type PartStyle, type PartStyleBase } from "../lib/puck/part-styles.js";
4
4
  export type PartStylePatch = {
5
5
  [K in keyof PartStyle]?: PartStyle[K] | null;
6
6
  };
7
- export declare function partTextCells(style: PartStyle, base: PartStyleBase, setValue: (patch: PartStylePatch) => void): CopyCell[];
7
+ export declare function partTextCells(style: PartStyle, base: PartStyleBase, setValue: (patch: PartStylePatch) => void, opts?: {
8
+ phone?: boolean;
9
+ }): CopyCell[];
8
10
  export declare function PartTextBox({ text, onTextChange, multiline, markup, styled, style, base, setValue, colors, placeholder, ariaLabel, head, typedOnCanvas, }: {
9
11
  text: string;
10
12
  onTextChange: (next: string) => void;
@@ -1 +1 @@
1
- "use client";import{jsx as g,jsxs as _}from"react/jsx-runtime";import{COPY_CELLS as r,CopyBox as T}from"efficient-easel/copy";import{PaddingYIcon as S,WidthIcon as A}from"efficient-easel/icons";import{say as u}from"../lib/editor-words.js";import{SHOP_MARKUP as C}from"../lib/markup.js";import{partTextTools as I}from"../lib/puck/canvas-typing.js";import{PART_PADDING_MAX as R,PART_PADDING_MIN as D,PART_PADDING_STEP as v,PART_WIDTH_MAX as z,PART_WIDTH_MIN as H,PART_WIDTH_STEP as w,partSpacingOf as N}from"../lib/puck/part-styles.js";const M=["left","center","right","justify"];function j(i,a,e){const l=N(i),t=i.size??a.sizePx;return[{...r.fontSize,value:i.size,styleValue:Math.round(a.sizePx),onChange:n=>e({size:n??null})},{...r.lineHeight,value:l.lineHeight,styleValue:a.lineRatio,onChange:n=>e(n===void 0?{lineHeight:null,line:null}:{lineHeight:n})},{...r.letterSpacing,scale:t,value:l.letterSpacingEm,styleValue:a.letterEm,onChange:n=>e(n===void 0?{letterSpacing:null,letter:null}:{letterSpacing:n})},{...r.paragraphSpacing,value:i.paragraphSpacing,styleValue:0,onChange:n=>e({paragraphSpacing:n??null})},{key:"padding",name:u("Padding"),icon:g(S,{}),unit:"px",step:v,shiftStep:10,min:D,max:R,value:i.padding,styleValue:a.paddingPx,onChange:n=>e({padding:n??null})},{key:"width",name:u("Width"),icon:g(A,{}),unit:"px",step:w,shiftStep:100,min:H,max:z,value:i.width,styleValue:a.widthPx,onChange:n=>e({width:n??null})}]}function X({text:i,onTextChange:a,multiline:e,markup:l=!0,styled:t=!0,style:n,base:c,setValue:p,colors:d,placeholder:s,ariaLabel:h,head:f,typedOnCanvas:P=!1}){const m=j(n,c,p),x=I(l,e);return _("div",{className:"sf-part-textbox",children:[f,g(T,{value:i,onChange:a,multiline:e,placeholder:s,ariaLabel:h,rules:C,tools:x,barShows:P?"focus":"always",colors:l?d:[],align:t?{value:n.align??c.align,allow:M,onChange:o=>p({align:o})}:void 0,letterCase:t?{value:n.case==="capitalize"?"":n.case??"",onChange:o=>p({case:o||null})}:void 0,cells:t?m:void 0})]})}export{X as PartTextBox,j as partTextCells};
1
+ "use client";import{jsx as g,jsxs as _}from"react/jsx-runtime";import{COPY_CELLS as r,CopyBox as S}from"efficient-easel/copy";import{PaddingYIcon as T,WidthIcon as A}from"efficient-easel/icons";import{say as h}from"../lib/editor-words.js";import{SHOP_MARKUP as C}from"../lib/markup.js";import{partTextTools as z}from"../lib/puck/canvas-typing.js";import{PART_PADDING_MAX as I,PART_PADDING_MIN as R,PART_PADDING_STEP as v,PART_WIDTH_MAX as D,PART_WIDTH_MIN as H,PART_WIDTH_STEP as w,partSpacingOf as M}from"../lib/puck/part-styles.js";const N=["left","center","right","justify"];function j(e,a,i,t={}){const l=M(e),o=(t.phone?e.sizePhone:void 0)??e.size??a.sizePx;return[t.phone?{...r.fontSize,value:e.sizePhone,styleValue:Math.round(a.sizePx),onChange:n=>i({sizePhone:n??null})}:{...r.fontSize,value:e.size,styleValue:Math.round(a.sizePx),onChange:n=>i({size:n??null})},{...r.lineHeight,value:l.lineHeight,styleValue:a.lineRatio,onChange:n=>i(n===void 0?{lineHeight:null,line:null}:{lineHeight:n})},{...r.letterSpacing,scale:o,value:l.letterSpacingEm,styleValue:a.letterEm,onChange:n=>i(n===void 0?{letterSpacing:null,letter:null}:{letterSpacing:n})},{...r.paragraphSpacing,value:e.paragraphSpacing,styleValue:0,onChange:n=>i({paragraphSpacing:n??null})},{key:"padding",name:h("Padding"),icon:g(T,{}),unit:"px",step:v,shiftStep:10,min:R,max:I,value:e.padding,styleValue:a.paddingPx,onChange:n=>i({padding:n??null})},{key:"width",name:h("Width"),icon:g(A,{}),unit:"px",step:w,shiftStep:100,min:H,max:D,value:e.width,styleValue:a.widthPx,onChange:n=>i({width:n??null})}]}function Y({text:e,onTextChange:a,multiline:i,markup:t=!0,styled:l=!0,style:o,base:n,setValue:u,colors:c,placeholder:d,ariaLabel:s,head:P,typedOnCanvas:f=!1}){const m=j(o,n,u),x=z(t,i);return _("div",{className:"sf-part-textbox",children:[P,g(S,{value:e,onChange:a,multiline:i,placeholder:d,ariaLabel:s,rules:C,tools:x,barShows:f?"focus":"always",colors:t?c:[],align:l?{value:o.align??n.align,allow:N,onChange:p=>u({align:p})}:void 0,letterCase:l?{value:o.case==="capitalize"?"":o.case??"",onChange:p=>u({case:p||null})}:void 0,cells:l?m:void 0})]})}export{Y as PartTextBox,j as partTextCells};
@@ -1 +1 @@
1
- "use client";import{jsx as D}from"react/jsx-runtime";import{readInks as F}from"../lib/puck/part-inks.js";import{useEffect as I,useRef as K}from"react";import{markOverlayPortal as L}from"../lib/puck/overlay-portal.js";import{usePreviewParts as J}from"./PreviewPartsContext.js";import{usePartStyle as z}from"./PreviewPartStyleContext.js";import{PUCK_COMPONENT_ATTR as M,engagePartAnchors as j,isPartClick as B,partIdForClick as G}from"../lib/puck/part-anchors.js";import{PART_ATTR as O,PART_SELECTED_ATTR as R}from"../lib/puck/text-parts.js";import{PART_STYLE_PROPERTIES as v,applyPartStyles as H,partFontKeyOf as U,partStyleBase as V,partStyleSource as Y}from"../lib/puck/part-styles.js";import{fontRoleOfClassName as q,styleRoleOfClassName as Q}from"../lib/fonts.js";import{typeScaleGroupOfClassName as x}from"../lib/theme.js";import{styleKeyForPart as X}from"../lib/sections/section-text-kinds.js";function Z(a){let o=null,l=null;for(let e=a;e&&(o===null||l===null);e=e.parentElement){const c=e.getAttribute("class");o??=Q(c),l??=x(c)}return{faceRole:o??"body",sizeGroup:l}}function C(a){const o=a.style,l={};for(const r of v)l[r]=o[r]??"",o[r]="";const e=getComputedStyle(a),c=getComputedStyle(a.ownerDocument.documentElement),p=V({fontSize:e.fontSize,fontWeight:e.fontWeight,lineHeight:e.lineHeight,letterSpacing:e.letterSpacing,textAlign:e.textAlign,textTransform:e.textTransform,paddingTop:e.paddingTop,maxWidth:e.maxWidth},U(e.fontFamily,r=>c.getPropertyValue(r)));for(const r of v)o[r]=l[r];return p}function $({needles:a,styles:o,type:l,children:e}){const c=K(null),{selectedPartId:p,select:r}=J(),{setPartStyle:d}=z(),y=JSON.stringify(a),g=JSON.stringify(o);return I(()=>{const m=c.current;if(!m)return;const S=[],P=()=>m.parentElement,w=s=>{const n=P();if(!n)return null;const f=new MutationObserver(s);return f.observe(n,{attributes:!0,attributeFilter:[M]}),()=>f.disconnect()},N=s=>{const n=new MutationObserver(s);return n.observe(m,{childList:!0,subtree:!0,characterData:!0}),()=>n.disconnect()};let u=[];S.push(()=>{for(const s of u)s();u=[]});const k=JSON.parse(y),_=JSON.parse(g),W=j(m,k,P,w,(s,n,f)=>{for(const t of u)t();u=[];const h=[];for(const t of f){const i=t,A=L(i);A&&u.push(A),i.getAttribute(O)===p?(i.setAttribute(R,""),h.push(i)):i.removeAttribute(R)}const b=Y(n,p,h,t=>q(t)!==null||x(t)!==null);if(b&&p){const t=b;d({partId:p,...Z(t),base:C(t),inks:F(t)})}H(f.map(t=>({element:t,partId:t.getAttribute(O)??""})),_,t=>C(t),t=>X(l,t));const T=t=>{const i=G(t.target,n);B(i,n)&&(t.stopPropagation(),t.preventDefault()),r(i)},E=s;E.addEventListener("click",T,{capture:!0}),u.push(()=>E.removeEventListener("click",T,{capture:!0}))},N);return()=>{W();for(const s of S)s()}},[y,g,p,r,d]),D("div",{ref:c,style:{display:"contents"},children:e})}export{$ as default,C as measureStyleBase,Z as styleTagsOf};
1
+ "use client";import{jsx as J}from"react/jsx-runtime";import{readInks as z}from"../lib/puck/part-inks.js";import{useEffect as M,useRef as Y}from"react";import{markOverlayPortal as $}from"../lib/puck/overlay-portal.js";import{usePreviewParts as j}from"./PreviewPartsContext.js";import{usePartStyle as B}from"./PreviewPartStyleContext.js";import{usePreviewDevice as G}from"./PreviewDeviceContext.js";import{encodePartId as H}from"../lib/puck/part-id.js";import{PUCK_COMPONENT_ATTR as q,engagePartAnchors as U,isPartClick as V,partIdForClick as Q}from"../lib/puck/part-anchors.js";import{PART_ATTR as _,PART_SELECTED_ATTR as w,PART_STYLE_KIND_ATTR as C,PART_STYLE_OWNER_ATTR as X,partStyleOwnerOf as x}from"../lib/puck/text-parts.js";import{PART_STYLE_PROPERTIES as N,applyPartStyles as k,partFontKeyOf as Z,partStyleBase as tt,partStyleSource as et}from"../lib/puck/part-styles.js";import{fontRoleOfClassName as rt,styleRoleOfClassName as ot}from"../lib/fonts.js";import{typeScaleGroupOfClassName as D}from"../lib/theme.js";import{styleKeyForPart as st}from"../lib/sections/section-text-kinds.js";function nt(a){let n=null,l=null;for(let e=a;e&&(n===null||l===null);e=e.parentElement){const c=e.getAttribute("class");n??=ot(c),l??=D(c)}return{faceRole:n??"body",sizeGroup:l}}function L(a){const n=a.style,l={};for(const r of N)l[r]=n[r]??"",n[r]="";const e=getComputedStyle(a),c=getComputedStyle(a.ownerDocument.documentElement),p=tt({fontSize:e.fontSize,fontWeight:e.fontWeight,lineHeight:e.lineHeight,letterSpacing:e.letterSpacing,textAlign:e.textAlign,textTransform:e.textTransform,paddingTop:e.paddingTop,maxWidth:e.maxWidth},Z(e.fontFamily,r=>c.getPropertyValue(r)));for(const r of N)n[r]=l[r];return p}function it({needles:a,styles:n,type:l,children:e}){const c=Y(null),{selectedPartId:p,select:r}=j(),{setPartStyle:y}=B(),d=G()==="mobile",S=JSON.stringify(a),g=JSON.stringify(n);return M(()=>{const f=c.current;if(!f)return;const T=[],P=()=>f.parentElement,W=i=>{const o=P();if(!o)return null;const m=new MutationObserver(i);return m.observe(o,{attributes:!0,attributeFilter:[q]}),()=>m.disconnect()},I=i=>{const o=new MutationObserver(i);return o.observe(f,{childList:!0,subtree:!0,characterData:!0}),()=>o.disconnect()};let u=[];T.push(()=>{for(const i of u)i();u=[]});const K=JSON.parse(S),h=JSON.parse(g),F=U(f,K,P,W,(i,o,m)=>{for(const t of u)t();u=[];const A=[];for(const t of m){const s=t,v=$(s);v&&u.push(v),s.getAttribute(_)===p?(s.setAttribute(w,""),A.push(s)):s.removeAttribute(w)}const b=et(o,p,A,t=>rt(t)!==null||D(t)!==null);if(b&&p){const t=b;y({partId:p,...nt(t),base:L(t),inks:z(t),...(()=>{const s=x(t);return s?{styleOwner:s}:{}})()})}k(m.filter(t=>!x(t)).map(t=>({element:t,partId:t.getAttribute(_)??""})),h,t=>L(t),t=>st(l,t),void 0,d);const E=[...f.querySelectorAll(`[${X}="${CSS.escape(o)}"][${C}]`)];E.length&&k(E.map(t=>({element:t,partId:H(o,t.getAttribute(C)??"")})),h,void 0,t=>t,void 0,d);const O=t=>{const s=Q(t.target,o);V(s,o)&&(t.stopPropagation(),t.preventDefault()),r(s)},R=i;R.addEventListener("click",O,{capture:!0}),u.push(()=>R.removeEventListener("click",O,{capture:!0}))},I);return()=>{F();for(const i of T)i()}},[S,g,p,r,y,d]),J("div",{ref:c,style:{display:"contents"},children:e})}export{it as default,L as measureStyleBase,nt as styleTagsOf};
@@ -9,6 +9,10 @@ export type PartStyleReading = {
9
9
  sizeGroup: TypeGroup | null;
10
10
  base: PartStyleBase;
11
11
  inks?: Partial<Record<WordStyleColour, string>>;
12
+ styleOwner?: {
13
+ owner: string;
14
+ kind: string;
15
+ };
12
16
  };
13
17
  type PartStyleValue = {
14
18
  partStyle: PartStyleReading | null;
@@ -13,3 +13,7 @@ export declare function ClaimedStamp({ stamp, children }: {
13
13
  stamp: string;
14
14
  children: ReactNode;
15
15
  }): import("react").JSX.Element;
16
+ export declare function SharedPartKinds({ children }: {
17
+ children: ReactNode;
18
+ }): import("react").JSX.Element;
19
+ export declare function usePublishedSharedKindRule(kind: string): PublishedPartRule | null;
@@ -1 +1 @@
1
- "use client";import{Fragment as i,jsx as n,jsxs as x}from"react/jsx-runtime";import{createContext as c,useContext as l,useId as h,useMemo as P}from"react";import{partRuleForKind as f,partRuleForText as y,partStyleCss as S,publishedPartStyles as C}from"../lib/puck/part-styles.js";import{styleKeyForPart as b}from"../lib/sections/section-text-kinds.js";const u=c(null),m=c(null);function v({needles:t,styles:e,type:s,children:r}){const a=h(),d=JSON.stringify([a,t,e,s]),o=P(()=>C(t,e,a,p=>b(s,p)),[d]);return o?x(i,{children:[n("style",{"data-sf-part-styles":"",dangerouslySetInnerHTML:{__html:S(o)}}),n(u.Provider,{value:o,children:r})]}):n(i,{children:r})}function R(t){const e=l(u),s=l(m),r=y(e,t);return r&&r.stamp!==s?r:null}function K(t){return f(l(u),t)}function I({stamp:t,children:e}){return n(m.Provider,{value:t,children:e})}export{I as ClaimedStamp,v as PublishedPartStyles,K as usePublishedPartKindRule,R as usePublishedPartRule};
1
+ "use client";import{Fragment as d,jsx as n,jsxs as P}from"react/jsx-runtime";import{createContext as i,useContext as s,useId as f,useMemo as S}from"react";import{partRuleForKind as c,partRuleForText as y,partStyleCss as C,publishedPartStyles as b}from"../lib/puck/part-styles.js";import{styleKeyForPart as v}from"../lib/sections/section-text-kinds.js";const u=i(null),h=i(null),m=i(null);function g({needles:e,styles:t,type:o,children:r}){const a=f(),p=JSON.stringify([a,e,t,o]),l=S(()=>b(e,t,a,x=>v(o,x)),[p]);return l?P(d,{children:[n("style",{"data-sf-part-styles":"",dangerouslySetInnerHTML:{__html:C(l)}}),n(u.Provider,{value:l,children:r})]}):n(d,{children:r})}function j(e){const t=s(u),o=s(h),r=y(t,e);return r&&r.stamp!==o?r:null}function I(e){return c(s(u),e)}function M({stamp:e,children:t}){return n(h.Provider,{value:e,children:t})}function T({children:e}){const t=s(u);return n(m.Provider,{value:t,children:e})}function k(e){return c(s(m),e)}export{M as ClaimedStamp,g as PublishedPartStyles,T as SharedPartKinds,I as usePublishedPartKindRule,j as usePublishedPartRule,k as usePublishedSharedKindRule};
@@ -0,0 +1,9 @@
1
+ export type PartDisplay = Readonly<Record<string, boolean>>;
2
+ export declare function readPartDisplay(value: unknown): PartDisplay;
3
+ export declare function partShownOnDesktop(display: unknown, part: string): boolean;
4
+ export declare function partShownOnPhone(display: unknown, displayPhone: unknown, part: string): boolean;
5
+ export declare function desktopDisplayChanged(display: unknown): boolean;
6
+ export declare function phoneDisplayChanged(displayPhone: unknown): boolean;
7
+ export declare function withDesktopPart(display: unknown, part: string, shown: boolean): PartDisplay | undefined;
8
+ export declare function withPhonePart(displayPhone: unknown, part: string, shown: boolean): PartDisplay;
9
+ export declare function partDisplayClass(display: unknown, displayPhone: unknown, part: string): string;
@@ -0,0 +1 @@
1
+ function r(e){if(!e||typeof e!="object"||Array.isArray(e))return{};const n={};for(const[o,t]of Object.entries(e))typeof t=="boolean"&&(n[o]=t);return n}function s(e,n){return r(e)[n]!==!1}function f(e,n,o){const t=r(n)[o];return typeof t=="boolean"?t:s(e,o)}function p(e){return Object.values(r(e)).some(n=>n===!1)}function c(e){return Object.keys(r(e)).length>0}function u(e,n,o){const t={...r(e)};return o?delete t[n]:t[n]=!1,Object.keys(t).length?t:void 0}function a(e,n,o){return{...r(e),[n]:o}}function h(e,n,o){const t=s(e,o),i=f(e,n,o);return t&&i?"":!t&&!i?"hidden":t?"max-[720px]:hidden":"min-[720px]:hidden"}export{p as desktopDisplayChanged,h as partDisplayClass,s as partShownOnDesktop,f as partShownOnPhone,c as phoneDisplayChanged,r as readPartDisplay,u as withDesktopPart,a as withPhonePart};
@@ -1183,6 +1183,7 @@ export declare const WEB_BUILDER_WORDS: {
1183
1183
  readonly "the admin": "the admin";
1184
1184
  readonly "the built-in corners": "the built-in corners";
1185
1185
  readonly "the page": "the page";
1186
+ readonly "the same as Desktop": "the same as Desktop";
1186
1187
  readonly "the section": "the section";
1187
1188
  readonly "the theme's image stage": "the theme's image stage";
1188
1189
  readonly "the theme's section background": "the theme's section background";
@@ -8,4 +8,4 @@ const e={"$ efficient …":"$ efficient …","0 min":"0 min","0 min read":"0 min
8
8
  *the counter.*`,"Select a word, then press the highlighter.":"Select a word, then press the highlighter.","Selector guide (pills + results)":"Selector guide (pills + results)","Selector pills":"Selector pills",Separator:"Separator","Series title":"Series title",Serif:"Serif","Set this card's corners first.":"Set this card's corners first.","Shadow color":"Shadow color",Shape:"Shape",Shared:"Shared","Shop & galleries":"Shop & galleries","Short description of this figure.":"Short description of this figure.","Short detail line":"Short detail line","Short supporting line":"Short supporting line","Show arrows":"Show arrows","Show cover image":"Show cover image","Show hints":"Show hints","Show on a card":"Show on a card","Show slide picker":"Show slide picker","Show texture":"Show texture","Show the chat bubble":"Show the chat bubble","Show the chat bubble on the whole site":"Show the chat bubble on the whole site","Show ticker":"Show ticker","Show {label} on the slide":"Show {label} on the slide","Shown beside the heading":"Shown beside the heading","Side space":"Side space","Side-by-side image and text in two columns.":"Side-by-side image and text in two columns.",Sideways:"Sideways","Signup Form":"Signup Form",Simple:"Simple","Site settings":"Site settings","Site styles":"Site styles","Six across":"Six across","Six stagger":"Six stagger",Size:"Size",Sizes:"Sizes","Slash /":"Slash /","Slide name":"Slide name","Slide picker":"Slide picker","Slide picker placement":"Slide picker placement","Slide picker shape":"Slide picker shape",Small:"Small","Social Logos":"Social Logos","Social link settings belong to a website.":"Social link settings belong to a website.","Social links":"Social links",Soft:"Soft",Solid:"Solid","Space above and below":"Space above and below","Space between":"Space between",Spacer:"Spacer","Spec Strip":"Spec Strip","Spec Table":"Spec Table","Spec label":"Spec label","Spec tiles":"Spec tiles","Spec value":"Spec value","Spine (single rail)":"Spine (single rail)","Split (editorial aside)":"Split (editorial aside)",Square:"Square",Stacked:"Stacked",Standard:"Standard",Start:"Start",Stat:"Stat","Stat & note":"Stat & note","Stat label":"Stat label","Stat name":"Stat name","Stat value":"Stat value",State:"State","State / Province":"State / Province",Statement:"Statement",Stats:"Stats","Stats & social proof":"Stats & social proof","Stats with Text":"Stats with Text","Status chip":"Status chip","Step *one*":"Step *one*","Step *three*":"Step *three*","Step *two*":"Step *two*","Stick under header":"Stick under header","Still time per slide":"Still time per slide","Storefront → Blog":"Storefront → Blog","Storefront ▸ Sites ▸ Settings":"Storefront ▸ Sites ▸ Settings","Story Timeline":"Story Timeline","Street address":"Street address",Stretch:"Stretch","Strip fill":"Strip fill","Strip items":"Strip items","Stripes · bold":"Stripes · bold","Stripes · fine":"Stripes · fine","Stripes · medium":"Stripes · medium",Style:"Style","Sub-title":"Sub-title","Sub-total lines":"Sub-total lines",Subtitle:"Subtitle","Subtitle font size":"Subtitle font size",Subtotal:"Subtotal","Success heading":"Success heading","Success message":"Success message",Superscript:"Superscript",Surfaces:"Surfaces","Switch now":"Switch now","Switch to Box footer":"Switch to Box footer","Synced from the blog post.":"Synced from the blog post.","Synced from the product.":"Synced from the product.","Synced from the site menu.":"Synced from the site menu.","Syncing from {place}…":"Syncing from {place}…",Tab:"Tab","Tab label":"Tab label","Tab name":"Tab name","Tabbed Gallery":"Tabbed Gallery",Tabs:"Tabs","Tall (3:4)":"Tall (3:4)","Tall first":"Tall first","Tall middle":"Tall middle","Team four":"Team four","Team one":"Team one","Team three":"Team three","Team two":"Team two",Telegram:"Telegram","Templates don’t store images — this slot stays a placeholder. Each website picks its own after it’s created.":"Templates don’t store images — this slot stays a placeholder. Each website picks its own after it’s created.","Templates don’t store videos — this slot stays a placeholder. Each website picks its own after it’s created.":"Templates don’t store videos — this slot stays a placeholder. Each website picks its own after it’s created.","Templates keep their look. Press Done.":"Templates keep their look. Press Done.",Terminal:"Terminal","Terminal (CLI session)":"Terminal (CLI session)","Terminal lines":"Terminal lines",Testimonials:"Testimonials",Text:"Text","Text & content":"Text & content","Text & media":"Text & media","Text color":"Text color","Text column":"Text column","Text height":"Text height","Text position":"Text position","Text size":"Text size","Text style":"Text style",Texts:"Texts",Texture:"Texture","Texture color":"Texture color","Texture opacity":"Texture opacity","Thanks — we'll email you to confirm.":"Thanks — we'll email you to confirm.","The built-in spacing.":"The built-in spacing.","The chat bubble is hidden across the whole site.":"The chat bubble is hidden across the whole site.","The current product's compatible tyres — image, size, key specs and price per tyre, with an inquiry link. Display only.":"The current product's compatible tyres — image, size, key specs and price per tyre, with an inquiry link. Display only.","The current product's related items in a tidy row — the product page's built-in 'Pair with' cross-sell.":"The current product's related items in a tidy row — the product page's built-in 'Pair with' cross-sell.","The floating chat bubble shows in the corner of every page.":"The floating chat bubble shows in the corner of every page.","The footer cannot take another one of these":"The footer cannot take another one of these","The footer holds at most 6 sections":"The footer holds at most 6 sections","The header and footer could not load. They are hidden for now and nothing in them is saved. Reload to try again.":"The header and footer could not load. They are hidden for now and nothing in them is saved. Reload to try again.","The header cannot take another one of these":"The header cannot take another one of these","The header holds at most 3 sections":"The header holds at most 3 sections","The only setting that changes a heading's capitals.":"The only setting that changes a heading's capitals.","The room left at the left and right edge of every page.":"The room left at the left and right edge of every page.","The section is full width, so this card follows Site styles ▸ Basics ▸ Corners.":"The section is full width, so this card follows Site styles ▸ Basics ▸ Corners.","The section it belonged to has been changed or removed.":"The section it belonged to has been changed or removed.","The size a text takes when you set it to follow this style. Sections keep their own sizes.":"The size a text takes when you set it to follow this style. Sections keep their own sizes.","The standard width every page on this site renders at.":"The standard width every page on this site renders at.","The words are still on your page and nothing has been lost. The editor could not work out which control belongs to them, which is a fault on our side. Go back and click the section to open its settings instead.":"The words are still on your page and nothing has been lost. The editor could not work out which control belongs to them, which is a fault on our side. Go back and click the section to open its settings instead.",Theme:"Theme","Theme {n}":"Theme {n}","Theme {n} background":"Theme {n} background","Theme {n} main color":"Theme {n} main color","Theme {n} text color":"Theme {n} text color","Third item":"Third item","This cannot be undone.":"This cannot be undone.","This card is not in a section that can share corners.":"This card is not in a section that can share corners.","This color is hard to read on this theme's page. The buttons below are the same hue, darkened.":"This color is hard to read on this theme's page. The buttons below are the same hue, darkened.","This color is hard to read on your page background. Pick one further from it — lighter if your pages are dark, deeper if they are light.":"This color is hard to read on your page background. Pick one further from it — lighter if your pages are dark, deeper if they are light.","This color reads clearly on your pages.":"This color reads clearly on your pages.","This face":"This face","This footer uses the old layout":"This footer uses the old layout","This is the only card in the section.":"This is the only card in the section.","This part is no longer here.":"This part is no longer here.","This part's settings did not open.":"This part's settings did not open.","This section runs edge to edge, so its corners sit off the page. Set Width to Content width to use them.":"This section runs edge to edge, so its corners sit off the page. Set Width to Content width to use them.","This site has {n} color theme of its own. Clearing takes them away and puts back the four the shop supplies.":"This site has {n} color theme of its own. Clearing takes them away and puts back the four the shop supplies.","This site has {n} color themes of its own. Clearing takes them away and puts back the four the shop supplies.":"This site has {n} color themes of its own. Clearing takes them away and puts back the four the shop supplies.","This ticker’s hero is no longer on the page.":"This ticker’s hero is no longer on the page.","Three across":"Three across","Three ladder":"Three ladder","Three stagger":"Three stagger",Ticker:"Ticker","Ticker items":"Ticker items",Tight:"Tight",TikTok:"TikTok","Timeline entries":"Timeline entries","Timezone chip":"Timezone chip","Tint color":"Tint color","Tint opacity":"Tint opacity",Title:"Title",Tone:"Tone",Top:"Top","Top and bottom":"Top and bottom","Top border":"Top border","Top center":"Top center","Top left":"Top left","Top right":"Top right","Top row":"Top row","Top space":"Top space",Total:"Total","Total amount":"Total amount","Total label":"Total label","Total line":"Total line","Trailing note":"Trailing note","Triangle ▼":"Triangle ▼","Trusted by *teams worldwide*":"Trusted by *teams worldwide*","Two across":"Two across","Two image galleries with tabs and filters.":"Two image galleries with tabs and filters.","Two tall":"Two tall",Type:"Type","Typed here":"Typed here","Tyre Fitment Form":"Tyre Fitment Form","Tyre Sizes":"Tyre Sizes","URL pill":"URL pill","URL: /{slug}":"URL: /{slug}",Undo:"Undo",Ungrouped:"Ungrouped",Unit:"Unit","Unit labels":"Unit labels",Up:"Up","Up and down":"Up and down",Upcoming:"Upcoming","Upload a background image":"Upload a background image","Upload a background video":"Upload a background video","Upload a poster still":"Upload a poster still","Uppercase heading":"Uppercase heading","Use {colour}":"Use {colour}",Value:"Value","Value suffix":"Value suffix","Vertical breathing room between sections.":"Vertical breathing room between sections.",Video:"Video","Video poster":"Video poster","View all":"View all","View all questions":"View all questions","View series →":"View series →",Volume:"Volume","Ways to pay":"Ways to pay",WeChat:"WeChat",Weight:"Weight","What people *say.*":"What people *say.*",WhatsApp:"WhatsApp","Whether this page sits on the site's content column, or runs edge to edge.":"Whether this page sits on the site's content column, or runs edge to edge.","Whole number Theme Color":"Whole number Theme Color","Wide (2:1)":"Wide (2:1)","Wide promo strip with background image.":"Wide promo strip with background image.",Width:"Width","With us":"With us",Wording:"Wording",Wrap:"Wrap","Write the answer here.":"Write the answer here.","Write the opening paragraph here.\n\n- Start a line with a dash for a bullet.\n- Add as many as you like.":`Write the opening paragraph here.
9
9
 
10
10
  - Start a line with a dash for a bullet.
11
- - Add as many as you like.`,X:"X","X-Large":"X-Large",Year:"Year","Year →":"Year →",Years:"Years",YouTube:"YouTube","Your *first* section.":"Your *first* section.","Your *second* section.":"Your *second* section.","Your fifth question goes here?":"Your fifth question goes here?","Your first question goes here?":"Your first question goes here?","Your fourth question goes here?":"Your fourth question goes here?","Your locations as a city gallery plus address and map cards.":"Your locations as a city gallery plus address and map cards.","Your review":"Your review","Your second question goes here?":"Your second question goes here?","Your third question goes here?":"Your third question goes here?",Zigzag:"Zigzag",accent:"accent","all theme colors":"all theme colors",body:"body","body text":"body text",button:"button",card:"card",city:"city",draft:"draft","e.g. About":"e.g. About","e.g. Americas":"e.g. Americas","e.g. about":"e.g. about","e.g. {example}":"e.g. {example}","each block's own spacing":"each block's own spacing",entries:"entries",group:"group",heading:"heading",headingLarge:"headingLarge",headingMedium:"headingMedium",headingSmall:"headingSmall","images only":"images only",item:"item",label:"label",manifesto:"manifesto","not set":"not set","not shown live":"not shown live",part:"part",px:"px","the Text style in Site styles":"the Text style in Site styles","the admin":"the admin","the built-in corners":"the built-in corners","the page":"the page","the section":"the section","the theme's image stage":"the theme's image stage","the theme's section background":"the theme's section background","this container's own spacing":"this container's own spacing","videos only":"videos only","{face} is loaded without an italic, so it cannot be set in italic. Slanting it would deform the letters rather than style them.":"{face} is loaded without an italic, so it cannot be set in italic. Slanting it would deform the letters rather than style them.","{grade} on the button":"{grade} on the button","{label} hex code":"{label} hex code","{label} {n}":"{label} {n}","{label} — row {n}":"{label} — row {n}","{letter} · Step":"{letter} · Step","{name} (unavailable)":"{name} (unavailable)","{name} is on this section":"{name} is on this section","{name} — renamed in the Console: {place}.":"{name} — renamed in the Console: {place}.","{n} cities":"{n} cities","{n} city":"{n} city","{n} of {total} layouts":"{n} of {total} layouts","{value} from {from}":"{value} from {from}","{value} on desktop":"{value} on desktop","{what} settings belong to a website.":"{what} settings belong to a website.","— Articles in total":"— Articles in total","— Label":"— Label","— Name, Year":"— Name, Year"};export{e as WEB_BUILDER_WORDS};
11
+ - Add as many as you like.`,X:"X","X-Large":"X-Large",Year:"Year","Year →":"Year →",Years:"Years",YouTube:"YouTube","Your *first* section.":"Your *first* section.","Your *second* section.":"Your *second* section.","Your fifth question goes here?":"Your fifth question goes here?","Your first question goes here?":"Your first question goes here?","Your fourth question goes here?":"Your fourth question goes here?","Your locations as a city gallery plus address and map cards.":"Your locations as a city gallery plus address and map cards.","Your review":"Your review","Your second question goes here?":"Your second question goes here?","Your third question goes here?":"Your third question goes here?",Zigzag:"Zigzag",accent:"accent","all theme colors":"all theme colors",body:"body","body text":"body text",button:"button",card:"card",city:"city",draft:"draft","e.g. About":"e.g. About","e.g. Americas":"e.g. Americas","e.g. about":"e.g. about","e.g. {example}":"e.g. {example}","each block's own spacing":"each block's own spacing",entries:"entries",group:"group",heading:"heading",headingLarge:"headingLarge",headingMedium:"headingMedium",headingSmall:"headingSmall","images only":"images only",item:"item",label:"label",manifesto:"manifesto","not set":"not set","not shown live":"not shown live",part:"part",px:"px","the Text style in Site styles":"the Text style in Site styles","the admin":"the admin","the built-in corners":"the built-in corners","the page":"the page","the same as Desktop":"the same as Desktop","the section":"the section","the theme's image stage":"the theme's image stage","the theme's section background":"the theme's section background","this container's own spacing":"this container's own spacing","videos only":"videos only","{face} is loaded without an italic, so it cannot be set in italic. Slanting it would deform the letters rather than style them.":"{face} is loaded without an italic, so it cannot be set in italic. Slanting it would deform the letters rather than style them.","{grade} on the button":"{grade} on the button","{label} hex code":"{label} hex code","{label} {n}":"{label} {n}","{label} — row {n}":"{label} — row {n}","{letter} · Step":"{letter} · Step","{name} (unavailable)":"{name} (unavailable)","{name} is on this section":"{name} is on this section","{name} — renamed in the Console: {place}.":"{name} — renamed in the Console: {place}.","{n} cities":"{n} cities","{n} city":"{n} city","{n} of {total} layouts":"{n} of {total} layouts","{value} from {from}":"{value} from {from}","{value} on desktop":"{value} on desktop","{what} settings belong to a website.":"{what} settings belong to a website.","— Articles in total":"— Articles in total","— Label":"— Label","— Name, Year":"— Name, Year"};export{e as WEB_BUILDER_WORDS};
@@ -354,6 +354,10 @@ export declare function cardStyleFields(): Record<string, CustomField<unknown>>;
354
354
  export declare function cardShowFields(opts?: {
355
355
  bottomDefault: boolean;
356
356
  }): Record<string, CustomField<unknown>>;
357
+ export declare function displayFields(parts: readonly {
358
+ id: string;
359
+ label: string;
360
+ }[], key?: string): Record<string, CustomField<unknown>>;
357
361
  export declare function cardImageField(): CustomField<number | null>;
358
362
  export declare function imageCornersField(): CustomField<number | null>;
359
363
  export declare function galleryLayoutField(): CustomField<string>;
@@ -1 +1 @@
1
- "use client";import{jsx as r,jsxs as P,Fragment as O}from"react/jsx-runtime";import{cloneElement as ue,useId as ct,useRef as ee,useState as $}from"react";import{useEasel as w,useSelectedFields as de}from"efficient-easel/easel";import{say as l,editorEaselWords as y}from"../editor-words.js";import{readHidable as pe,hidableText as fe}from"./hidable.js";import{FOLD_FIELD_MARKER as z,LINK_FIELD_MARKER as me,MEDIA_FIELD_MARKER as he,SCAFFOLD_FIELD_MARKER as ge,TEXT_FIELD_MARKER as I,foldMetaOf as V,textFieldIdentifier as ut}from"./field-markers.js";import dt from"../../components/ApplyCornersToSiblings.js";import{CARD_IMAGE_RADIUS_STEP as pt,CORNER_RADIUS_MAX as be,CORNER_RADIUS_MIN as L}from"../content/card-image-shape.js";import{IMAGE_CORNER_STEP as ft,IMAGE_CORNERS_LABEL as mt}from"../content/image-corners.js";import{GRID_MAX_COLUMNS as ht}from"../content/grid-span.js";import{GALLERY_ACROSS_BUCKETS as gt,GALLERY_LAYOUTS as F,GALLERY_LAYOUT_KEYS as xe}from"../content/gallery-layout.js";import{anchorSiblingsOf as bt,HERO_GROUP_PLACEMENTS as xt,HERO_GROUP_PLACEMENT_DEFAULT as St,normalisePlacement as yt,placementPoints as Se}from"../hero-group-placement.js";import Ct from"../../components/KeepHint.js";import{AdjustIcon as _t,AlignLeftIcon as It,AlignSeparateIcon as Et,AnimationIcon as ye,BackgroundIcon as Rt,BorderAllIcon as Tt,BlockSectionIcon as Ot,CartIcon as At,ColumnWidthsIcon as Ce,ColumnsIcon as Nt,CornerIcon as Pt,DirectionDownIcon as wt,DirectionLeftIcon as Lt,DirectionRightIcon as Ft,DirectionUpIcon as vt,DollarIcon as kt,FinishIcon as Dt,GapIcon as _e,GridIcon as Bt,GroundIcon as Ht,HashIcon as Ie,HeightIcon as Gt,ImageIcon as Mt,ListIcon as Kt,LocationIcon as te,PaddingAllIcon as Wt,PaddingBottomIcon as Ee,PaddingLeftIcon as Re,PaddingRightIcon as Te,PaddingTopIcon as Oe,PageIcon as Ae,PhoneIcon as Ut,PlacementIcon as Xt,ProductSizeIcon as jt,RotateIcon as $t,SquareIcon as zt,TypeIcon as Vt,WidthIcon as Yt,WrapIcon as qt}from"efficient-easel/icons";import{FieldGlyph as Ne}from"../../components/FieldGlyph.js";import{resolvePageBackground as Jt}from"../content/page-background.js";import{CORNER_SIDES as Pe,CORNER_SIDE_POINTS as Zt,hasOwnSectionCorners as Qt,normalizeCornerSides as we}from"../content/section-corners.js";import{SECTION_MOTION_NONE as en,SECTION_MOTION_OPTIONS as tn}from"../content/section-animation.js";import{enclosingSectionProps as Le}from"./enclosing-section.js";import{SettingsDefaultReset as C,SettingsField as h,SettingsGroupHead as nn,SettingsGroupSub as on,SettingsBorder as rn,SettingsSegmented as ln,SettingsSides as an,SettingsSidesEach as Fe,sidesStartEach as sn,SettingsSwitch as cn,borderSides as un,borderStartEach as dn}from"efficient-easel/panel";import{FieldSelect as pn,ListField as fn}from"efficient-easel/fields";import{AlignmentGrid as mn,Checkbox as hn,CornersInput as gn,DateTimePicker as bn,FOCAL_DEFAULT as ve,Slider as xn,Tooltip as Y}from"efficient-shell/ui";import{ColourControl as ke}from"./ColourControl.js";import De from"./MarkupToolbar.js";import{deviceField as _}from"./device-fields.js";import{NO_CONTROL_FIELD as Sn,NoControlMark as Be,noControlField as ne}from"./panel-no-control-mark.js";import{OWN_BOX_FIELD as yn}from"./own-box.js";import{phoneKey as M,resolvePhoneValue as oe}from"./phone-override.js";import{SuppressibleText as Cn}from"./section-text-suppress.js";import{CARD_INDEX_OPTIONS as _n,CARD_OUTLINE_OPTIONS as In,DEFAULT_CARD_INDEX_FORMAT as En,DEFAULT_CARD_OUTLINE as Rn}from"../sections/product-card-style.js";import{COVER_INDEX_OPTIONS as Tn,DEFAULT_COVER_INDEX as On}from"../sections/card-cover-index.js";import{SCALAR_TEXT_CONTROLS as An}from"./text-control-kinds.js";import Nn from"../../components/ImageFocusRow.js";import Pn from"../../components/MediaUploadField.js";import wn from"../../components/MultiSelectField.js";import Ln from"../../components/SectionThemePicker.js";import Fn from"../../components/SearchSelectField.js";import vn from"../../components/StorefrontLinkField.js";import He from"../../components/UiIcon.js";import{SECTION_PADDING as E}from"../content/section-padding.js";import{hasPhoneHeight as kn,resolveSectionMinHeight as Dn}from"../content/section-min-height.js";import{SECTION_MIN_HEIGHT as Bn,SECTION_MIN_HEIGHT_GROUP_LABEL as K,SECTION_SCREEN_PCT as Hn}from"../content/section-min-height.js";import{CONTAINER_DIRECTION_LABEL as Gn,containerDirectionPoints as Mn,resolveContainerDirection as Ge}from"../content/container-direction.js";import{BOX_ALIGN_POINTS as Kn,BOX_BLOCK_SPACING_LABEL as Wn,BOX_BLOCK_SPACING_POINTS as Me,BOX_JUSTIFY_POINTS as Ke,BOX_PHONE_ROW_LABEL as Un,BOX_PHONE_ROW_MAX as Xn,BOX_PHONE_ROW_MIN as We,BOX_SHARE_LABEL as Ue,BOX_SHARE_POINTS as re,BOX_WRAP_LABEL as jn,BOX_WRAP_POINTS as Xe}from"../content/box-layout.js";import{usePreviewHeader as W}from"../../components/PreviewHeaderContext.js";import{BORDER_MAX as $n}from"../content/borders.js";import{DEFAULT_SURFACES as zn,normalizeTheme as Vn}from"../theme.js";import{CONTAINER_GAP as ie,CONTAINER_GAP_BUILT_IN as Yn,GAP_FIELD_CONTAINER as qn,hasOwnContainerGap as Jn,resolveContainerGap as Zn}from"../content/container-gap.js";import{CARD_IMAGE_BG_INHERIT as Qn,CARD_IMAGE_BG_OFF as eo,CARD_IMAGE_BG_SWATCH_NAMES as to,CARD_IMAGE_BG_SWATCHES as no,isCardImageBackgroundInheriting as oo,cardImageBackgroundChoice as ro,THEME_CARD_IMAGE_BG as io}from"../content/card-image-background.js";import{SECTION_BG_INHERIT as lo,SECTION_BG_SWATCHES as ao,SECTION_BG_SWATCH_NAMES as so,THEME_SECTION_BG as co,isSectionBackgroundInheriting as uo}from"../content/section-background.js";import{SECTION_THEME_GROUP_LABEL as po}from"../content/section-surface.js";import{TYPE_SIZE_FIXED as fo,TYPE_SIZE_INHERIT as mo,isTypeSizeInheriting as ho}from"../content/section-type-size.js";import{SECTION_WIDTH_CHOICES as go,WIDTH_CHOICE_LABEL as bo,WIDTH_INHERIT as xo,resolveWidth as So,sectionRunsFullWidth as je}from"../content/section-width.js";import{useFoldHeadingLevel as $e}from"./panel-heading-scope.js";import{withStyleKind as yo}from"efficient-easel/style-clipboard";function v(e){for(const[t,n]of Object.entries(e))n&&typeof n=="object"&&!V(n)&&yo(n,`section:${t}`);return e}function Ii({children:e}){return r("div",{className:"sf-field-label",children:typeof e=="string"?l(e):e})}function ze(){return null}function Co(e){if(!e.trim())throw new Error("noGlyph() needs a reason naming the ruling that decided it.");return r(ze,{},e)}function _o(e){return e.type===ze}function k(e){return _o(e)?void 0:e}function D(e,t){return l("{value} from {from}",{value:e,from:t})}function Io(){const{appState:e}=w(i=>i),t=e.data.root?.props??{},{mode:n,pageWidth:o}=So(t,"full");return n==="page"?D(`${o}px`,l("the page")):n==="contained"?D(l("Contained"),l("the page")):D(l("Full"),l("the page"))}function Eo(){const{blockGap:e}=W();return e===null?l("this container's own spacing"):D(`${e}px`,l("Site styles"))}function Ro({inherited:e,onReset:t,label:n}){return r(C,{words:y()?.panel,label:l(n),changed:!e,detail:Eo(),onReset:t})}function To({inherited:e,onReset:t,label:n}){return r(C,{words:y()?.panel,label:l(n),changed:!e,detail:Io(),onReset:t})}function B({value:e,onChange:t,label:n,placeholder:o,hint:i,multiline:a,hideable:c=!0,markup:s=!0}){const{text:u,hidden:d}=pe(e),f=ee(null),p=ee(null),m=T=>t(c?{text:T,hidden:d}:T),g=()=>t({text:u,hidden:!d}),x=c&&d,R=ct(),S=i?wo(i)?r("span",{className:"sf-hint-keep sf-hint-while-typing",children:l(i)}):r(Ct,{children:l(i)}):void 0,j=d?l("Show {label} on the slide",{label:l(n)}):l("Hide {label} on the slide",{label:l(n)});return r(h,{label:l(n),icon:r(Vt,{}),htmlFor:R,className:x?"is-hidden":void 0,hint:S,action:c?r(Y,{content:j,children:r("button",{type:"button",className:"sf-field-eye","aria-pressed":d,"aria-label":j,onClick:g,children:d?r(He,{name:"eye-off",size:14}):r(He,{name:"eye",size:14})})}):void 0,children:P("div",{className:"sf-copybox",children:[s&&r(De,{target:a?p:f,value:u,onChange:m}),a?r("textarea",{id:R,ref:p,value:u,placeholder:o===void 0?void 0:l(o),onChange:T=>m(T.target.value)}):r("input",{id:R,ref:f,type:"text",value:u,placeholder:o===void 0?void 0:l(o),onChange:T=>m(T.target.value)})]})})}function Ei(e,t){return{...e,[ge]:t}}function Ri(e){const t=e[I];if(!t)throw new Error("withOffPage: the field holds no authored text");return{...e,[I]:{...t,offPage:!0}}}function Ti(e){return!e||typeof e!="object"?!1:e[I]?.offPage===!0}const Ve="sfPanelOnly";function Oi(e){if(!e[I])throw new Error("withPanelOnly: the field holds no authored text");return{...e,[Ve]:!0}}function Ai(e){return!!e&&typeof e=="object"&&e[Ve]===!0}function Ni(e){const t=e[I];if(!t)throw new Error("withIdentifier: the field holds no authored text");return{...e,[I]:{...t,identifier:!0}}}import{TEXT_CONTROL_KINDS as Gl,SCALAR_TEXT_CONTROLS as Ml}from"./text-control-kinds.js";function Pi(e,t){if(!e[I])throw new Error("inOwnBox: the field holds no authored text");const{[Sn]:o,...i}=e;return{...i,[yn]:!0,render:t}}const Oo=new Set(An),H=(e,t)=>{const n={...t,[I]:e};if(!Oo.has(e.control))return n;const o=t.render;return{...ne(n,"authored-copy"),render:i=>r(Cn,{name:i.name,children:o(i)})}},wi="Everything else on this block comes from the linked post. Unlink it to edit by hand.",Ao="Select a word, then press the highlighter.",No="A short name so a link can jump straight to this section, like yoursite.com/page#about.",Po=new Set([Ao]),wo=e=>Po.has(e);function Li(e,t,n){return H({control:"text",label:e,placeholder:t,hint:n},{type:"custom",render:({value:o,onChange:i})=>r(B,{value:o,onChange:i,label:e,placeholder:t,hint:n})})}function Fi(e,t,n){return H({control:"textarea",label:e,placeholder:t,hint:n},{type:"custom",render:({value:o,onChange:i})=>r(B,{value:o,onChange:i,label:e,placeholder:t,hint:n,multiline:!0})})}function Lo(e,t,n){return H({control:"plainText",label:e,placeholder:t,hint:n},{type:"custom",render:({value:o,onChange:i})=>r(B,{value:o,onChange:i,label:e,placeholder:t,hint:n,hideable:!1,markup:!1})})}function vi(e,t,n){return H({control:"copyText",label:e,placeholder:t,hint:n},{type:"custom",render:({value:o,onChange:i})=>r(B,{value:o,onChange:i,label:e,placeholder:t,hint:n,hideable:!1})})}function ki(e){return{type:"custom",[me]:{label:e},render:({value:t,onChange:n})=>r(vn,{value:fe(t),onChange:n,label:e})}}function Di(e,t,n){return H({control:"plainTextarea",label:e,placeholder:t,hint:n},{type:"custom",render:({value:o,onChange:i})=>r(B,{value:o,onChange:i,label:e,placeholder:t,hint:n,multiline:!0,hideable:!1})})}const Bi={Design:_t,Animation:ye};function Hi(e,t){return e.includes("Design")?t!=="Design":null}function Fo({label:e}){return r(nn,{title:l(e),level:$e(1)})}function vo({level:e,label:t}){return e===1?r(Fo,{label:t}):r(Bo,{label:t})}function Ye(e,t){return{type:"custom",[z]:{label:e,level:t},render:()=>r(vo,{level:t,label:e})}}function b(e){return Ye(e,2)}function Gi(e){return{type:"custom",render:()=>r(ko,{text:e})}}function ko({text:e}){return r("p",{className:"sf-note",children:l(e)})}function Mi(e){return Ye(e,1)}function Ki(e){return V(e)!==null&&e?.tabs!==void 0}const qe=new Map;function Wi(e,t){const n=`${e}\0${t?t.join(""):""}`,o=qe.get(n)??{type:"custom",tabs:t,[z]:{label:e,level:1},bucket:e,marker:!0,render:()=>r(O,{})};return qe.set(n,o),o}function Ui(e){return V(e)!==null&&e?.designGroup!==void 0}const Je=new Map;function Xi(e){const t=Je.get(e)??{type:"custom",[z]:{label:e,level:1},designGroup:e,marker:!0,...e==="Content"?{}:{fold:e},render:()=>r(O,{})};return Je.set(e,t),t}function Do(e){const t=e;return t?.marker===!0&&typeof t.fold=="string"?t.fold:null}function ji(e,t){return Do(e)===t?e:{...e,marker:!0,fold:t,render:()=>r(O,{})}}function $i(e){const t=e;if(t.marker===!0&&t.fold===void 0)return e;const{fold:n,...o}=e;return{...o,marker:!0,render:()=>r(O,{})}}function Bo({label:e}){return r(on,{title:l(e),level:$e(2)})}function Ze({swatches:e,current:t,onPick:n,names:o}){const i=e.find(s=>s.toLowerCase()===t.toLowerCase()),a=i?o?.[i]:void 0,c=a?l(a):t;return P("div",{className:"sf-swatches",children:[e.map(s=>{const u=o?.[s]?l(o[s]):s;return r(Y,{content:u,children:r("button",{type:"button","aria-pressed":t.toLowerCase()===s.toLowerCase(),className:`sf-swatch ${t.toLowerCase()===s.toLowerCase()?"is-active":""}`,style:{background:s},onClick:()=>n(s),"aria-label":u})},s)}),r("span",{className:"sf-swatch-hex",children:c})]})}function zi(e,t){return{type:"custom",render:({value:n,onChange:o})=>{const i=uo(n,t);return r(h,{label:l(e),icon:r(Rt,{}),changed:!i,action:r(C,{words:y()?.panel,label:l(e),changed:!i,detail:l("the theme's section background"),onReset:()=>o(lo)}),children:Ze({swatches:ao,current:i?co:n??t??"",onPick:o,names:so})})}}}function Ho(e,t){return{type:"custom",render:({value:n,onChange:o})=>{const i=n,a=oo(i,t);return r(h,{label:l(e),icon:r(Ht,{}),changed:!a,action:r(C,{words:y()?.panel,label:l(e),changed:!a,detail:l("the theme's image stage"),onReset:()=>o(Qn)}),children:Ze({swatches:no,current:a?io:ro(i,t),onPick:o,names:to})})}}}function Vi(e=n=>n,t){return v({_gSectionTheme:b(po),sectionAccent:{type:"custom",render:({value:n,onChange:o})=>r(Ln,{value:e(n),onChange:o,followLabel:t})}})}function U({min:e,max:t,step:n,value:o,onChange:i,suffix:a="",readout:c=!0,notch:s,ariaLabel:u,disabled:d=!1}){const f=s!==void 0&&Number.isFinite(s)&&s>=e&&s<=t;return r("div",{className:f?"sf-slider has-notch":"sf-slider",style:f?{"--sf-notch":(s-e)/(t-e)}:void 0,children:r(xn,{min:e,max:t,step:n,value:o,suffix:a||void 0,showInput:c,label:u===void 0?void 0:l(u),disabled:d,size:"sm",className:"sf-slider-track",onChange:p=>{p!==null&&p!==o&&i(p)}})})}function G(e,t,n,o,i,a,c="",s){return{type:"custom",render:u=>r(h,{label:l(e),icon:k(t),action:s?s("storedValue"in u?u.storedValue:u.value,u.onChange):void 0,children:U({min:n,max:o,step:i,value:typeof u.value=="number"?u.value:a,suffix:c,ariaLabel:e,onChange:u.onChange})})}}function Qe(e,t){const{min:n,max:o,step:i=1,unsetLabel:a,hint:c,restTrack:s,unsetMark:u,icon:d}=t;return{type:"custom",render:({value:f,onChange:p})=>{const m=typeof f=="number"?f:null,g=m===null;return r(h,{label:l(e),icon:d?k(d):void 0,value:g?u||a===void 0?void 0:l(a):`${m}px`,changed:!g,action:u?ue(u,{changed:!g,onReset:()=>p(null)}):r(C,{words:y()?.panel,label:l(e),changed:!g,onReset:()=>p(null)}),hint:typeof c=="string"?l(c):c,children:s?s({min:n,max:o,step:i,px:m,label:e,onChange:p}):U({min:n,max:o,step:i,value:m??n,readout:!1,ariaLabel:e,onChange:p})})}}}function Yi(e){const t=G("Gap",r(_e,{}),ie.min,ie.max,ie.step,Yn[e],"px",(n,o)=>r(Ro,{inherited:!Jn(e,n),onReset:()=>o(void 0),label:"Gap"}));return{type:"custom",[qn]:e,render:n=>t.render({...n,value:Zn(e,n.value,n.field?.siteGap),storedValue:n.value,onChange:o=>n.onChange(o)})}}const q="Corners";function le(e){return{type:"custom",render:({value:t,onChange:n})=>{const o=typeof t=="number"&&Number.isFinite(t)?t:null,i=o!==null;return r(h,{label:l(q),icon:r(Pt,{}),changed:i,action:ue(e.mark,{changed:i,onReset:()=>n(null)}),hint:e.hint,children:r(Go,{tier:e,px:o,onRadius:n})})}}}function et(e){let t=null;try{t=de()}catch{t=null}return[t?.values?.[e],n=>t?.onChange(e,n)]}function Go({tier:e,px:t,onRadius:n}){const o=e.useFollowed(),i=e.useClosedReason?e.useClosedReason():null,[a,c]=et(e.sidesKey),s=we(a)??[...Pe];return r(gn,{label:l(q),value:s,corners:Zt,onChange:u=>{const d=we(u)??[];c(d.length===Pe.length?null:d)},radius:t,onRadiusChange:n,radiusMin:L,radiusMax:be,radiusStep:e.step??1,radiusPlaceholder:String(o),disabled:i!==null,disabledReason:i??void 0})}function tt(){return ne({type:"custom",render:()=>r(Be,{})},"always")}function Mo({label:e,changed:t=!1,onReset:n=()=>{}}){const{cornerRadiusPx:o}=W(),i=typeof o=="number"?`${o}px`:l("not set");return r(C,{words:y()?.panel,label:l(e),changed:t,detail:o==null?l("the built-in corners"):D(i,l("Site styles")),onReset:n})}function Ko(){const{cornerRadiusPx:e}=W();return typeof e=="number"?e:L}function Wo(){return le({sidesKey:"sectionCornerSides",useFollowed:Ko,useClosedReason:()=>ot()?l(nt):null,mark:r(Mo,{label:q}),hint:r(Uo,{})})}const nt="This section runs edge to edge, so its corners sit off the page. Set Width to Content width to use them.";function ot(){return je(J())}function Uo(){return r(O,{children:ot()?nt:"Follows Site styles ▸ Basics ▸ Corners until you set a number here."})}function qi(){return v({_gShape:b("Shape"),sectionCorners:Wo(),sectionCornerSides:tt(),sectionBorder:rt("desktop"),sectionBorderPhone:rt("mobile")})}const Xo=()=>({width:l("Border width"),sides:{top:l("Border top"),right:l("Border right"),bottom:l("Border bottom"),left:l("Border left")},style:l("Border style"),styles:{solid:l("Solid"),dashed:l("Dashed"),dotted:l("Dotted")},color:l("Border color"),unit:"px"});function jo(e){const t=Object.fromEntries(Object.entries(e).filter(([,n])=>n!=null&&n!==""));return Object.keys(t).length?t:void 0}function $o(){let e;try{const t=Vn(W().theme);e=t.themes[t.selected]?.line}catch{e=void 0}return e||zn.line}function zo({value:e,onChange:t,tier:n}){const[o]=et("sectionBorder"),i=$o(),a=e&&typeof e=="object"?e:{},c=n==="mobile"?o&&typeof o=="object"?o:{}:{},[s,u]=$(()=>dn(a,c)),d=Xo();return r(h,{label:l("Border"),icon:r(Tt,{}),action:r(Fe,{each:s,label:l("Each side"),onChange:u}),children:r(rn,{label:l("Border"),value:a,each:s,onChange:f=>t(jo(f)),placeholder:{sides:un(c),style:c.style??"solid",color:c.color||i},presets:[i],words:d,max:$n})})}function rt(e){return _(e,{type:"custom",render:({value:t,onChange:n})=>r(zo,{value:t,onChange:n,tier:e})})}function Ji(){return{_gMotion:b("Motion"),sectionAnimation:ce("Entrance",r(ye,{}),[...tn],en)}}function ae(){let e=null;try{const{appState:t,selectedItem:n}=w(i=>i),o=n?.props?.id?String(n.props.id):void 0;e=o?Le(t?.data,o):null}catch{e=null}return e!==null&&je(e)}function it(e){const{cornerRadiusPx:t}=W(),n=ae(),o=typeof t=="number"?t:e;let i=null;try{const{appState:c,selectedItem:s}=w(d=>d),u=s?.props?.id?String(s.props.id):void 0;i=u?Le(c?.data,u):null}catch{i=null}if(n||!i)return o;const a=i.sectionCorners;return Qt(a)?a:o}function Vo({label:e,changed:t=!1,onReset:n=()=>{}}){const o=ae(),i=it(L),a=o?"Site":"Section";return r(C,{words:y()?.panel,label:l(e),changed:t,detail:D(`${i}px`,o?l("Site styles"):l("the section")),onReset:n})}function Yo(){return r(O,{children:ae()?l("The section is full width, so this card follows Site styles ▸ Basics ▸ Corners."):l("Follows the section's Corners until you set a number here.")})}function qo(){return le({sidesKey:"cardCornerSides",useFollowed:()=>it(L),mark:r(Vo,{label:q}),hint:r(Yo,{})})}function Jo(){return{type:"custom",render:()=>r(dt,{})}}function Zi(){return{_gShape:b("Shape"),cardCorners:qo(),cardCornerSides:tt(),cardCornersApplyAll:Jo()}}function Qi(){return A("Justify",r(Et,{}),Ke,Ke[0].value)}function el(){return A("Item alignment",r(It,{}),Kn,"stretch")}function tl(){return A(jn,r(qt,{}),Xe,Xe[0].value)}function nl(){return{type:"custom",render:({value:e,onChange:t})=>{const n=re.find(o=>o.value===e)??re[0];return r(h,{label:l(Ue),icon:r(Ce,{}),value:l(n.label),children:r("div",{className:"sf-gallery-layouts",role:"group","aria-label":l(Ue),children:re.map(o=>r(Y,{content:l(o.label),className:"sf-tile-tip",children:r("button",{type:"button","aria-pressed":n.value===o.value,"aria-label":l(o.label),onClick:()=>t(o.value),children:r("span",{className:"sf-gallery-pic",children:Zo(o.weights).map((i,a)=>r("i",{style:{gridColumn:`span ${i}`}},a))})})},o.value))})})}}}function Zo(e){if(!e)return[3,4];const t=e.reduce((n,o)=>n+o,0);return e.map(n=>Math.round(n/t*12))}function ol(){return A(Wn,r(_e,{}),Me,Me[0].value)}function rl(){return G(Un,r(Ut,{}),We,Xn,1,We)}function il(e){const t=ce(Gn,Co("`Direction` names how a container's children run — a MODIFIER, not a thing. doc/naming.md N10.1 gives the idea a dash in its Glyph column; editor-shell's own `direction` meaning says the bare row is CORRECT and not an omission (SS seat, 2026-09-11)."),Mn(e),Ge(e,void 0));return{type:"custom",render:n=>t.render({...n,value:Ge(e,n.value),onChange:o=>n.onChange(o)})}}function ll(e,t,n,o,i,a){return{type:"custom",render:({value:c,onChange:s})=>r(h,{label:l(e),icon:r(Ne,{noun:a}),action:r(C,{words:y()?.panel,label:l(e),changed:!ho(c),detail:l("the Text style in Site styles"),onReset:()=>s(mo),defaultAction:{onPress:()=>s(fo),title:l("Keep this section's own built-in size"),icon:r(Ot,{})}}),children:U({min:t,max:n,step:o,value:typeof c=="number"?c:i,suffix:"px",ariaLabel:e,onChange:s})})}}function al(){return{_gCellWidth:b("Cell width"),gridSpan:A("Positions",r(Ce,{}),[{label:"Auto",value:""},...Array.from({length:ht},(e,t)=>({label:t===0?"1 position":`${t+1} positions`,value:String(t+1)}))],"")}}function J(){let e=null;try{e=w(t=>t).selectedItem}catch{e=null}return e?.props??{}}function Qo({min:e,max:t,step:n,px:o,label:i,onChange:a,desktopKey:c,fallback:s}){const u=J()[c],d=oe(void 0,u,s);return r(O,{children:U({min:e,max:t,step:n,value:oe(o,u,s),readout:!1,ariaLabel:i,notch:d,onChange:a})})}function er({label:e,desktopKey:t,fallback:n,changed:o=!1,onReset:i=()=>{}}){const a=J()[t],c=oe(void 0,a,n);return r(C,{words:y()?.panel,label:l(e),changed:o,detail:l("{value} on desktop",{value:`${c}px`}),onReset:i})}function tr(e){return Qe(e.label,{icon:e.icon,min:e.min,max:e.max,step:e.step,unsetLabel:"Follows Desktop",unsetMark:r(er,{label:e.label,desktopKey:e.desktopKey,fallback:e.fallback}),restTrack:t=>r(Qo,{...t,desktopKey:e.desktopKey,fallback:e.fallback})})}const nr={Top:"Padding top",Bottom:"Padding bottom",Left:"Padding left",Right:"Padding right"},or={Top:Oe,Bottom:Ee,Left:Re,Right:Te},rr=e=>{const t=or[e];return r(t,{})};function sl(e={}){const t=e.keys?.top??"sectionPaddingTop",n=e.keys?.bottom??"sectionPaddingBottom",o=e.group!==!1,i=S=>nr[S],a=S=>G(i("Top"),r(Oe,{}),E.min,E.max,E.step,S,"px"),c=(S,j,T,Q=E)=>_("mobile",tr({label:i(S),icon:rr(S),desktopKey:j,min:Q.min,max:Q.max,step:Q.step,fallback:T})),s=e.top??E.min,u=e.bottom??E.min,d="sectionPaddingLeft",f="sectionPaddingRight",p=e.sideBounds??E,m=e.side??p.min,g=e.sidePhone??m,x=e.phone===!0,R=S=>x?_("desktop",S):S;return v({...o?{_gSpacing:b("Padding")}:{},[t]:R(a(s)),...x?{[M(t)]:c("Top",t,s)}:{},...e.only==="top"?{}:{[n]:R(G(i("Bottom"),r(Ee,{}),E.min,E.max,E.step,u,"px")),...x?{[M(n)]:c("Bottom",n,u)}:{}},...e.sides?{[d]:R(G(i("Left"),r(Re,{}),p.min,p.max,p.step,m,"px")),...x?{[M(d)]:c("Left",d,g,p)}:{},[f]:R(G(i("Right"),r(Te,{}),p.min,p.max,p.step,m,"px")),...x?{[M(f)]:c("Right",f,g,p)}:{}}:{}})}const X=["top","right","bottom","left"],ir={top:"sectionPaddingTop",right:"sectionPaddingRight",bottom:"sectionPaddingBottom",left:"sectionPaddingLeft"},lt=e=>typeof e=="number"?e:null;function lr(e,t,n){const o={};for(const i of X)n[i]!==t[i]&&(o[e[i]]=n[i]??void 0);return o}function ar({tier:e,o:t}){let n=null;try{n=de()}catch{n=null}const o=n?.values??{},i=e==="mobile"?t.phoneKeys:t.keys,a=Object.fromEntries(X.map(d=>[d,lt(o[i[d]])])),c=Object.fromEntries(X.map(d=>[d,String(e==="mobile"?lt(o[t.keys[d]])??t.fallback[d]:t.fallback[d])])),[s,u]=$(()=>sn(a,c));return r(h,{label:l("Padding"),icon:r(Wt,{}),action:r(Fe,{each:s,label:l("Each side"),onChange:u}),children:r(an,{label:l("Padding"),each:s,value:a,placeholder:c,min:t.min,max:t.max,step:t.step,onChange:d=>{const f=lr(i,a,d);Object.keys(f).length&&n?.onChangeMany(f)},words:{sides:{top:l("Padding top"),right:l("Padding right"),bottom:l("Padding bottom"),left:l("Padding left")},vertical:l("Top and bottom"),horizontal:l("Left and right"),unit:"px"}})})}function cl(e={}){const t={...ir,...e.keys},n={keys:t,phoneKeys:Object.fromEntries(X.map(s=>[s,M(t[s])])),fallback:{top:0,right:0,bottom:0,left:0,...e.fallback},min:e.min??0,max:e.max??200,step:e.step??4},o=e.phone!==!1,i=s=>{const u={type:"custom",render:()=>r(ar,{tier:s,o:n})};return o?_(s,u):u},a=()=>ne({type:"custom",render:()=>r(Be,{})},"always"),c=X.filter(s=>s!=="top");return v({...e.group===!1?{}:{_gSpacing:b("Padding")},[n.keys.top]:i("desktop"),...o?{[n.phoneKeys.top]:i("mobile")}:{},...Object.fromEntries(c.map(s=>[n.keys[s],a()])),...o?Object.fromEntries(c.map(s=>[n.phoneKeys[s],_("mobile",a())])):{}})}const sr={contained:"Contained",page:"Page",full:"Full"},Z="Width";function ul(e,t=go,n=!0){const o=t.map(i=>({label:bo[i]??sr[i],value:i}));return v({...n?{_gWidth:b(Z)}:{},widthMode:{type:"custom",render:({onChange:i,field:a})=>r(h,{label:l(Z),icon:r(Yt,{}),action:n?r(To,{inherited:a?.inherited??!1,onReset:()=>i(xo),label:Z}):void 0,children:se({options:o,value:a?.currentValue||e,onChange:i,ariaLabel:Z})})}})}function dl(){const e=o=>({type:"custom",render:({value:i,onChange:a})=>r(h,{label:K,icon:k(r(Gt,{})),action:o?o(a):void 0,children:se({options:[{label:"Auto",value:"auto"},{label:"Fixed",value:"fixed"},{label:"Screen",value:"screen"}],value:["auto","fixed","screen"].includes(i)?i:"auto",onChange:a,ariaLabel:K})})}),t=()=>({type:"custom",render:({value:o,onChange:i,field:a})=>{const c=a?.unit==="%"?"%":"px",s=c==="%"?Hn:Bn;return r("div",{className:"sf-field",children:U({min:s.min,max:s.max,step:s.step,value:typeof o=="number"?o:s.fallback,suffix:c,ariaLabel:K,onChange:i})})}}),n=()=>ce("Unit",r(Ie,{}),[{label:"px",value:"px"},{label:"%",value:"%"}],"px");return v({_gHeight:b(K),sectionHeightMode:_("desktop",e()),sectionHeightValue:_("desktop",t()),sectionHeightUnit:_("desktop",n()),sectionHeightModePhone:_("mobile",e(o=>r(cr,{onClear:()=>o(void 0)}))),sectionHeightValuePhone:_("mobile",t()),sectionHeightUnitPhone:_("mobile",n())})}function cr({onClear:e}){const t=J(),n=kn(t),o=Dn(t),i=l("{value} on desktop",{value:o.mode==="auto"?l("Auto"):`${o.value}${o.unit}`});return r(C,{words:y()?.panel,label:l(K),changed:n,detail:i,onReset:e})}function pl(){return{_gAnchor:b("Anchor"),anchor:Lo("Anchor name","e.g. about",No)}}function fl(e,t,n){return{type:"custom",render:({value:o,onChange:i,id:a,name:c})=>{const s=`${a??c??e}-datetime`,u=Date.parse(typeof o=="string"?o:"");return r(h,{label:l(e),icon:t,htmlFor:s,hint:n===void 0?void 0:l(n),children:r(bn,{id:s,value:Number.isFinite(u)?new Date(u):null,onChange:d=>i(d?d.toISOString():"")})})}}}function N(e,t,n){return{type:"custom",render:({value:o,onChange:i,id:a,name:c})=>{const s=typeof o=="boolean"?o:t,u=`${a??c??e}-label`;return r(h,{label:l(e),labelId:u,icon:n,action:r(cn,{checked:s,onChange:i,ariaLabelledBy:u})})}}}function ml(){return{type:"custom",render:({value:e,onChange:t,id:n,name:o})=>{const i=`${String(n??o??"pageBackground")}-colour`;return r(h,{label:l("Background"),icon:r(Ae,{}),htmlFor:i,action:r(ke,{id:i,label:"Background",value:Jt(e),onChange:t})})}}}function hl(e,t){return{type:"custom",render:({value:n,onChange:o,id:i})=>{const a=typeof n=="boolean"?n:t,c=`${i??e}-checkbox`;return r(h,{label:l(e),htmlFor:c,className:"sf-checkbox",action:r(hn,{id:c,checked:a,onChange:o})})}}}function gl(e,t){return{type:"custom",render:({value:n,onChange:o})=>r(h,{label:l(e),action:ke({value:n||t,onChange:o,label:e})})}}const ur=[{value:"0% 0%",label:"Top left"},{value:"50% 0%",label:"Top"},{value:"100% 0%",label:"Top right"},{value:"0% 50%",label:"Left"},{value:"50% 50%",label:"Center"},{value:"100% 50%",label:"Right"},{value:"0% 100%",label:"Bottom left"},{value:"50% 100%",label:"Bottom"},{value:"100% 100%",label:"Bottom right"}];function at({label:e,value:t,onChange:n,points:o=ur}){const i=o.map(a=>({...a,label:l(a.label),...a.title?{title:l(a.title)}:null}));return r(mn,{label:l(e),value:t,points:i,onChange:n})}function bl(e,t=ve,n="mediaImage"){return{type:"custom",render:({value:o,onChange:i})=>r("div",{className:"sf-focal-row",children:r(dr,{label:e,value:o||t,onChange:i,imageProp:n})})}}function dr({label:e,value:t,onChange:n,imageProp:o}){const{selectedItem:i}=w(c=>c),a=i?.props?.[o];return r(Nn,{label:e,value:t,onChange:n,image:typeof a=="string"?a:void 0})}const pr=Se([]);function xl(e,{stacking:t,fallback:n=St}){return{type:"custom",render:({value:o,onChange:i})=>{const a=xt.includes(o)?o:n;return t?r(fr,{label:e,value:a,onChange:i}):st({label:e,value:a,onChange:i,points:pr})}}}function fr({label:e,value:t,onChange:n}){const{appState:o,selectedItem:i}=w(s=>s),a=i?.props?.id?String(i.props.id):void 0,c=a?bt(o?.data,a):[];return st({label:e,value:t,onChange:n,points:Se(c,a)})}function st({label:e,value:t,onChange:n,points:o}){const i=o.find(a=>a.disabled);return r(h,{label:l(e),icon:r(Xt,{}),hint:i?.title?l(i.title):void 0,children:at({label:e,value:yt(t),onChange:n,points:o})})}const Sl={top:r(vt,{}),right:r(Ft,{}),bottom:r(wt,{}),left:r(Lt,{})};function yl(e,t,n,o,i,a){const c=f=>t.find(p=>p.value===f),s=f=>({value:f,label:"",disabled:!0,title:o}),u=f=>{const p=t.find(g=>g.cell===f);if(!p)return s(`missing-${f}`);const m=a?.[f];return m?{value:p.value,label:p.label,icon:m}:{value:p.value,label:p.label}},d=[s("corner-top-left"),u("top"),s("corner-top-right"),u("left"),s("centre"),u("right"),s("corner-bottom-left"),u("bottom"),s("corner-bottom-right")];return{type:"custom",render:({value:f,onChange:p})=>{const m=t.some(g=>g.value===f)?f:n;return r(h,{label:l(e),icon:i,value:c(m)?.label?l(c(m).label):"",children:at({label:e,value:m,onChange:p,points:d})})}}}const mr="\0note";function A(e,t,n,o,i){return{type:"custom",options:n,fallback:o,...i?{note:i}:{},render:({value:a,onChange:c,field:s})=>{const u=s.options??n,d=s.fallback??o,f=u.some(p=>p.value===a)?a:d;return r(h,{label:l(e),icon:k(t),children:r(pn,{value:f,ariaLabel:l(e),onChange:c,options:[...i?[{label:l(i),value:mr,disabled:!0}]:[],...u.map(p=>({label:l(p.label),value:p.value}))]})})}}}function Cl(e,t,n){return{type:"custom",options:t,render:({value:o,onChange:i,field:a})=>r(wn,{label:e,options:(a.options??t).map(c=>({...c,label:l(c.label)})),value:Array.isArray(o)?o:[],onChange:i,...n?{emptyLabel:l(n)}:{}})}}function _l(e,t,n,o){return{type:"custom",options:t,fallback:n,render:({value:i,onChange:a,field:c})=>r(Fn,{label:e,options:(c.options??t).map(s=>({...s,label:l(s.label)})),fallback:c.fallback??n,value:i,onChange:a,placeholder:o===void 0?void 0:l(o)})}}function Il(e,t={}){return{type:"custom",render:({value:n,onChange:o})=>{const i={value:n,onChange:o,...t};return r(e,{...i})}}}function se({options:e,value:t,onChange:n,ariaLabel:o,disabled:i=!1}){return r(ln,{options:e.map(a=>a.picture?{id:a.value,label:a.picture,title:l(a.title??a.label)}:{id:a.value,label:l(a.label),title:a.title===void 0?void 0:l(a.title)}),value:t,onChange:n,ariaLabel:l(o),disabled:i})}const El=[{label:"Image",value:"image"},{label:"Video",value:"video"}];function ce(e,t,n,o){const i=n.map(a=>typeof a=="string"?{label:a,value:a}:a);return{type:"custom",render:({value:a,onChange:c,field:s})=>r(h,{label:l(e),icon:k(t),children:se({options:i,value:i.some(u=>u.value===a)?a:a||s?.currentValue||o,onChange:c,ariaLabel:e})})}}function Rl(e,t,n){return{type:"custom",[he]:!0,render:({value:o,onChange:i})=>r(Pn,{value:o||"",onChange:i,label:e,accept:t,placeholder:n})}}const Tl={HeroSingle:["imageFocal"],ContactLocations:["locations[].photo"],ProcessSteps:["steps[].image"]};function Ol({value:e,onChange:t,label:n}){const o=e||{},i=!!o.pending,a=i?"var(--fg-dim, #888)":o.ok?"#1d9e75":"#d85a30",c=(s,u)=>t({...o,[s]:u===""?void 0:Number(u)});return P(h,{label:l(n),icon:r(te,{}),children:[r("button",{type:"button",disabled:i,onClick:()=>t({...o,pending:!0,ok:!1,status:"Finding…"}),style:{width:"100%",display:"flex",alignItems:"center",justifyContent:"center",gap:6,padding:"8px 10px",fontSize:13,cursor:i?"default":"pointer",opacity:i?.6:1,border:"1px solid var(--border-strong, #ccc)",borderRadius:6,background:"transparent",color:"inherit"},children:i?l("Finding…"):l("Find coordinates")}),o.status&&r("div",{style:{marginTop:6,fontSize:12,lineHeight:1.4,color:a},children:l(o.status)}),r("div",{style:{marginTop:6,fontSize:11,color:"var(--fg-dim, #999)"},children:l("Coordinates from OpenStreetMap")}),r("button",{type:"button",onClick:()=>t({...o,manual:!o.manual}),style:{marginTop:8,padding:0,border:"none",background:"none",font:"inherit",fontSize:12,color:"var(--sf-accent, #2563eb)",cursor:"pointer",textDecoration:"underline"},children:o.manual?l("Hide manual coordinates"):l("Enter coordinates manually")}),o.manual&&P("div",{style:{marginTop:8,display:"grid",gap:8},children:[r(h,{label:l("Latitude"),icon:r(te,{}),children:r("input",{type:"number",step:"any",placeholder:l("e.g. {example}",{example:"34.0990198"}),value:typeof o.lat=="number"?o.lat:"",onChange:s=>c("lat",s.target.value)})}),r(h,{label:l("Longitude"),icon:r(te,{}),children:r("input",{type:"number",step:"any",placeholder:l("e.g. {example}",{example:"-117.9842833"}),value:typeof o.lng=="number"?o.lng:"",onChange:s=>c("lng",s.target.value)})})]})]})}function hr(e,t){return t===null||t<0||t>=e.length?"":e[t]?.text??""}function gr(e,t,n){const o=e.map(i=>({text:i?.text??""}));return t===null||t<0||t>=e.length?o:o.map((i,a)=>a===t?{text:n}:i)}function Al(e,t){return e===null?null:t>e?e:null}function br(e,t,n){if(n===null||n>=t.length)return null;for(let o=0;o<n;o+=1)if(e[o]!==t[o])return null;return e[n]!==t[n]&&t.includes(e[n])||e[n]!==t[n]&&t.length!==e.length?null:n}const Nl={label:"Ticker items",icon:r(Kt,{})};function Pl(e,t,n,o){return{type:"custom",[I]:{control:"textList",label:e,placeholder:n,itemKey:"text",rendering:o},render:({value:i,onChange:a})=>r(xr,{label:e,icon:k(t),items:Array.isArray(i)?i:[],placeholder:n,onChange:a,markup:o==="markup"})}}function xr({label:e,icon:t,items:n,placeholder:o,onChange:i,markup:a=!1}){const c=ee(null),[s,u]=$(null),d=p=>p.map(m=>({text:m?.text??""})),f=p=>{const m=br(n,p,s);m===null&&(c.current=null),u(m),i(d(p))};return r(fn,{label:l(e),icon:t,noun:l("item"),items:n,onChange:f,newItem:()=>({text:""}),open:null,onOpen:()=>{},renderItem:()=>null,above:a?r(De,{target:c,value:hr(n,s),onChange:p=>i(gr(n,s??-1,p)),disabled:s===null,label:s===null?l("Formatting — click a row first"):l("Formatting — row {n}",{n:s+1})}):void 0,renderRow:(p,m,g)=>r("input",{type:"text",className:a&&s===m?"sf-list-marking":void 0,value:p?.text??"",placeholder:l(o),"aria-label":l("{label} {n}",{label:l(e),n:m+1}),onChange:x=>g({text:x.target.value}),onFocus:x=>{c.current=x.currentTarget,u(m)}})})}function wl(e,t){const n=`${e.label} — row ${t+1}`;return H({control:"plainText",label:n,placeholder:e.placeholder,offPage:e.offPage},{type:"custom",render:({value:o,onChange:i})=>r(B,{value:o,onChange:i,label:l("{label} — row {n}",{label:l(e.label),n:t+1}),placeholder:e.placeholder,hideable:!1,markup:e.rendering==="markup"})})}function Ll(e){return{_gCards:b("Cards"),coverIndex:A("Cover image",r(Mt,{}),Tn,String(On),e?.coverHint??"A card's opening picture — a card pinned to a finish keeps its own."),imageBackground:Ho("Image background",eo),cardImage:Sr(),spinOnHover:N("Rotate on hover",e?.spinDefault??!0,r($t,{}))}}function Fl(){return{outline:A("Card outline",r(zt,{}),In,Rn),indexBadge:A("Card number",r(Ie,{}),_n,En),showBadge:N("Product badge",!0,r(Ne,{noun:"tag"}))}}function vl(e){const t=e?.bottomDefault??!0;return{_gShowOnCard:b("Show on a card"),showCardPrice:N("Price",!0,r(kt,{})),showCardFinishes:N("Finish swatches",!0,r(Dt,{})),showCardSizes:N("Sizes",t,r(jt,{})),showCardBuy:N("Buy button",t,r(At,{})),showCardPage:N("Page button",t,r(Ae,{}))}}function Sr(){return Qe("Card image",{min:L,max:be,step:pt,hint:"Rounds the picture. The card's own corner is in Site styles."})}function kl(){return le({sidesKey:"cornerSides",step:ft,useFollowed:()=>L,mark:r(yr,{label:mt}),hint:l("Rounds the picture. Left alone it stays square.")})}function yr({label:e,changed:t=!1,onReset:n=()=>{}}){return r(C,{words:y()?.panel,label:l(e),changed:t,onReset:n})}function Dl(){return{type:"custom",render:({value:e,onChange:t})=>r(Cr,{value:typeof e=="string"?e:"",onChange:t})}}function Cr({value:e,onChange:t}){const[n,o]=$(null),i=xe.filter(c=>n===null||F[c].across===n),a=e&&e in F?F[e]:null;return P(O,{children:[r(h,{label:l("Photos in a row"),icon:r(Nt,{}),children:P("div",{className:"sf-gallery-filter",children:[r("button",{type:"button","aria-pressed":n===null,onClick:()=>o(null),children:l("All")}),gt.map(c=>r("button",{type:"button","aria-pressed":n===c,onClick:()=>o(c),children:c},c))]})}),r(h,{label:l("Layout"),icon:r(Bt,{}),value:a?l(a.label):l("Not chosen"),hint:l("{n} of {total} layouts",{n:i.length,total:xe.length}),children:r("div",{className:"sf-gallery-layouts",children:i.map(c=>r(Y,{content:l(F[c].label),className:"sf-tile-tip",children:r("button",{type:"button","aria-pressed":e===c,"aria-label":l(F[c].label),onClick:()=>t(e===c?"":c),children:r("span",{className:"sf-gallery-pic",children:F[c].desktop.map(([s,u],d)=>r("i",{style:{gridColumn:`span ${s}`,gridRow:`span ${u}`}},d))})})},c))})})]})}export{No as ANCHOR_HINT,wi as BOUND_TO_POST_NOTE,Bi as BUCKET_ICONS,Tl as CUSTOM_FIELD_MEDIA,Ol as CoordsField,Sl as EDGE_ARROWS,ve as FOCAL_DEFAULT,ur as FOCAL_POINTS,z as FOLD_FIELD_MARKER,at as FocalPicker,Bo as GroupLabel,Ao as HIGHLIGHT_HINT,B as HidableTextField,me as LINK_FIELD_MARKER,Ii as Label,he as MEDIA_FIELD_MARKER,El as MEDIA_TYPE_OPTIONS,ko as PanelNoteLine,st as PlacementGridView,ge as SCAFFOLD_FIELD_MARKER,Ml as SCALAR_TEXT_CONTROLS,nt as SECTION_BLEEDS_HINT,ir as SIDE_PAD_KEYS,Fo as SectionHeading,se as Segmented,Ro as SiteGapDefaultReset,U as Slider,Ze as Swatches,Gl as TEXT_CONTROL_KINDS,I as TEXT_FIELD_MARKER,Nl as TICKER_ITEMS_ROW,xr as TextListField,To as WidthDefaultReset,br as aimAfterListChange,pl as anchorFields,D as backTo,zi as backgroundField,el as boxAlignField,ol as boxBlockSpacingField,Qi as boxJustifyField,rl as boxPhoneRowField,nl as boxShareField,tl as boxWrapField,Wi as bucketHeader,qo as cardCornersField,Ho as cardImageBackgroundField,Sr as cardImageField,Ll as cardMediaFields,Zi as cardShapeFields,vl as cardShowFields,Fl as cardStyleFields,al as cellWidthFields,hl as checkbox,gl as colorInput,vi as copyText,tt as cornerSidesField,le as cornersRowField,fl as dateTime,Xi as designGroupHeader,il as directionField,yl as edgePad,Hi as entriesHiddenForTab,bl as focalPicker,Al as focusAfterRemove,ji as foldMarker,V as foldMetaOf,Do as foldTitleOf,Dl as galleryLayoutField,Yi as gapField,b as group,dl as heightFields,fe as hidableText,wo as hintIsWhileTyping,k as iconOf,kl as imageCornersField,Pi as inOwnBox,Ki as isBucketHeader,Ui as isDesignGroupHeader,_o as isNoGlyph,ki as linkField,Cl as multiSelect,Co as noGlyph,ml as pageBackgroundField,Gi as panelNote,tr as phoneOverrideField,xl as placementField,Lo as plainText,Di as plainTextarea,Qe as pxField,$i as quietMarker,pe as readHidable,hr as rowText,_l as searchSelect,Mi as section,Ji as sectionAnimationFields,rt as sectionBorderField,Wo as sectionCornersField,qi as sectionShapeFields,Vi as sectionThemeFields,ce as segmented,A as select,gr as setRowText,cl as sidesPaddingFields,lr as sidesPaddingPatch,ll as sizeField,G as slider,Il as sourceField,sl as spacingFields,Li as text,ut as textFieldIdentifier,Ti as textFieldOffPage,Ai as textFieldPanelOnly,Pl as textList,wl as textListRowField,Fi as textarea,N as toggle,Rl as upload,Io as usePageWidthDetail,Eo as useSiteGapDetail,ul as widthField,Ni as withIdentifier,Ri as withOffPage,Oi as withPanelOnly,Ei as withScaffold};
1
+ "use client";import{jsx as r,jsxs as A,Fragment as T}from"react/jsx-runtime";import{cloneElement as de,useId as dt,useRef as ee,useState as z}from"react";import{useEasel as N,useSelectedFields as ue}from"efficient-easel/easel";import{say as l,editorEaselWords as x}from"../editor-words.js";import{readHidable as pe,hidableText as fe}from"./hidable.js";import{FOLD_FIELD_MARKER as V,LINK_FIELD_MARKER as me,MEDIA_FIELD_MARKER as he,SCAFFOLD_FIELD_MARKER as ge,TEXT_FIELD_MARKER as I,foldMetaOf as Y,textFieldIdentifier as ut}from"./field-markers.js";import pt from"../../components/ApplyCornersToSiblings.js";import{CARD_IMAGE_RADIUS_STEP as ft,CORNER_RADIUS_MAX as be,CORNER_RADIUS_MIN as L}from"../content/card-image-shape.js";import{IMAGE_CORNER_STEP as mt,IMAGE_CORNERS_LABEL as ht}from"../content/image-corners.js";import{GRID_MAX_COLUMNS as gt}from"../content/grid-span.js";import{GALLERY_ACROSS_BUCKETS as bt,GALLERY_LAYOUTS as F,GALLERY_LAYOUT_KEYS as xe}from"../content/gallery-layout.js";import{anchorSiblingsOf as xt,HERO_GROUP_PLACEMENTS as yt,HERO_GROUP_PLACEMENT_DEFAULT as St,normalisePlacement as Ct,placementPoints as ye}from"../hero-group-placement.js";import _t from"../../components/KeepHint.js";import{AdjustIcon as It,AlignLeftIcon as Et,EyeIcon as Rt,AlignSeparateIcon as Ot,AnimationIcon as Se,BackgroundIcon as Tt,BorderAllIcon as wt,BlockSectionIcon as Pt,CartIcon as At,ColumnWidthsIcon as Ce,ColumnsIcon as Nt,CornerIcon as Lt,DirectionDownIcon as Ft,DirectionLeftIcon as kt,DirectionRightIcon as vt,DirectionUpIcon as Dt,DollarIcon as Bt,FinishIcon as Ht,GapIcon as _e,GridIcon as Gt,GroundIcon as Mt,HashIcon as Ie,HeightIcon as Kt,ImageIcon as Wt,ListIcon as Ut,LocationIcon as te,PaddingAllIcon as Xt,PaddingBottomIcon as Ee,PaddingLeftIcon as Re,PaddingRightIcon as Oe,PaddingTopIcon as Te,PageIcon as we,PhoneIcon as jt,PlacementIcon as $t,ProductSizeIcon as zt,RotateIcon as Vt,SquareIcon as Yt,TypeIcon as qt,WidthIcon as Jt,WrapIcon as Zt}from"efficient-easel/icons";import{FieldGlyph as Pe}from"../../components/FieldGlyph.js";import{resolvePageBackground as Qt}from"../content/page-background.js";import{CORNER_SIDES as Ae,CORNER_SIDE_POINTS as en,hasOwnSectionCorners as tn,normalizeCornerSides as Ne}from"../content/section-corners.js";import{SECTION_MOTION_NONE as nn,SECTION_MOTION_OPTIONS as on}from"../content/section-animation.js";import{enclosingSectionProps as Le}from"./enclosing-section.js";import{SettingsDefaultReset as y,SettingsField as h,SettingsGroupHead as rn,SettingsGroupSub as ln,SettingsBorder as an,SettingsSegmented as sn,SettingsSides as cn,SettingsSidesEach as Fe,sidesStartEach as dn,SettingsSwitch as un,borderSides as pn,borderStartEach as fn}from"efficient-easel/panel";import{FieldSelect as mn,ListField as hn}from"efficient-easel/fields";import{DisplayChips as gn}from"efficient-shell/ui";import{desktopDisplayChanged as bn,partShownOnDesktop as xn,partShownOnPhone as yn,phoneDisplayChanged as Sn,withDesktopPart as Cn,withPhonePart as _n}from"../content/part-display.js";import{AlignmentGrid as In,Checkbox as En,CornersInput as Rn,DateTimePicker as On,FOCAL_DEFAULT as ke,Slider as Tn,Tooltip as q}from"efficient-shell/ui";import{ColourControl as ve}from"./ColourControl.js";import De from"./MarkupToolbar.js";import{deviceField as b}from"./device-fields.js";import{NO_CONTROL_FIELD as wn,NoControlMark as Be,noControlField as ne}from"./panel-no-control-mark.js";import{OWN_BOX_FIELD as Pn}from"./own-box.js";import{PHONE_CLEAR as An,phoneKey as k,resolvePhoneValue as oe}from"./phone-override.js";import{SuppressibleText as Nn}from"./section-text-suppress.js";import{CARD_INDEX_OPTIONS as Ln,CARD_OUTLINE_OPTIONS as Fn,DEFAULT_CARD_INDEX_FORMAT as kn,DEFAULT_CARD_OUTLINE as vn}from"../sections/product-card-style.js";import{COVER_INDEX_OPTIONS as Dn,DEFAULT_COVER_INDEX as Bn}from"../sections/card-cover-index.js";import{SCALAR_TEXT_CONTROLS as Hn}from"./text-control-kinds.js";import Gn from"../../components/ImageFocusRow.js";import Mn from"../../components/MediaUploadField.js";import Kn from"../../components/MultiSelectField.js";import Wn from"../../components/SectionThemePicker.js";import Un from"../../components/SearchSelectField.js";import Xn from"../../components/StorefrontLinkField.js";import He from"../../components/UiIcon.js";import{SECTION_PADDING as E}from"../content/section-padding.js";import{hasPhoneHeight as jn,resolveSectionMinHeight as $n}from"../content/section-min-height.js";import{SECTION_MIN_HEIGHT as zn,SECTION_MIN_HEIGHT_GROUP_LABEL as K,SECTION_SCREEN_PCT as Vn}from"../content/section-min-height.js";import{CONTAINER_DIRECTION_LABEL as Yn,containerDirectionPoints as qn,resolveContainerDirection as Ge}from"../content/container-direction.js";import{BOX_ALIGN_POINTS as Jn,BOX_BLOCK_SPACING_LABEL as Zn,BOX_BLOCK_SPACING_POINTS as Me,BOX_JUSTIFY_POINTS as Ke,BOX_PHONE_ROW_LABEL as Qn,BOX_PHONE_ROW_MAX as eo,BOX_PHONE_ROW_MIN as We,BOX_SHARE_LABEL as Ue,BOX_SHARE_POINTS as re,BOX_WRAP_LABEL as to,BOX_WRAP_POINTS as Xe}from"../content/box-layout.js";import{usePreviewHeader as W}from"../../components/PreviewHeaderContext.js";import{BORDER_MAX as no}from"../content/borders.js";import{DEFAULT_SURFACES as oo,normalizeTheme as ro}from"../theme.js";import{CONTAINER_GAP as ie,CONTAINER_GAP_BUILT_IN as io,GAP_FIELD_CONTAINER as lo,hasOwnContainerGap as ao,resolveContainerGap as so}from"../content/container-gap.js";import{CARD_IMAGE_BG_INHERIT as co,CARD_IMAGE_BG_OFF as uo,CARD_IMAGE_BG_SWATCH_NAMES as po,CARD_IMAGE_BG_SWATCHES as fo,isCardImageBackgroundInheriting as mo,cardImageBackgroundChoice as ho,THEME_CARD_IMAGE_BG as go}from"../content/card-image-background.js";import{SECTION_BG_INHERIT as bo,SECTION_BG_SWATCHES as xo,SECTION_BG_SWATCH_NAMES as yo,THEME_SECTION_BG as So,isSectionBackgroundInheriting as Co}from"../content/section-background.js";import{SECTION_THEME_GROUP_LABEL as _o}from"../content/section-surface.js";import{TYPE_SIZE_FIXED as Io,TYPE_SIZE_INHERIT as Eo,isTypeSizeInheriting as Ro}from"../content/section-type-size.js";import{SECTION_WIDTH_CHOICES as Oo,WIDTH_CHOICE_LABEL as To,WIDTH_INHERIT as wo,resolveWidth as Po,sectionRunsFullWidth as je}from"../content/section-width.js";import{useFoldHeadingLevel as $e}from"./panel-heading-scope.js";import{withStyleKind as Ao}from"efficient-easel/style-clipboard";function v(e){for(const[t,n]of Object.entries(e))n&&typeof n=="object"&&!Y(n)&&Ao(n,`section:${t}`);return e}function Di({children:e}){return r("div",{className:"sf-field-label",children:typeof e=="string"?l(e):e})}function ze(){return null}function No(e){if(!e.trim())throw new Error("noGlyph() needs a reason naming the ruling that decided it.");return r(ze,{},e)}function Lo(e){return e.type===ze}function D(e){return Lo(e)?void 0:e}function B(e,t){return l("{value} from {from}",{value:e,from:t})}function Fo(){const{appState:e}=N(i=>i),t=e.data.root?.props??{},{mode:n,pageWidth:o}=Po(t,"full");return n==="page"?B(`${o}px`,l("the page")):n==="contained"?B(l("Contained"),l("the page")):B(l("Full"),l("the page"))}function ko(){const{blockGap:e}=W();return e===null?l("this container's own spacing"):B(`${e}px`,l("Site styles"))}function vo({inherited:e,onReset:t,label:n}){return r(y,{words:x()?.panel,label:l(n),changed:!e,detail:ko(),onReset:t})}function Do({inherited:e,onReset:t,label:n}){return r(y,{words:x()?.panel,label:l(n),changed:!e,detail:Fo(),onReset:t})}function H({value:e,onChange:t,label:n,placeholder:o,hint:i,multiline:a,hideable:c=!0,markup:s=!0}){const{text:d,hidden:u}=pe(e),f=ee(null),p=ee(null),m=O=>t(c?{text:O,hidden:u}:O),g=()=>t({text:d,hidden:!u}),C=c&&u,R=dt(),_=i?Ko(i)?r("span",{className:"sf-hint-keep sf-hint-while-typing",children:l(i)}):r(_t,{children:l(i)}):void 0,$=u?l("Show {label} on the slide",{label:l(n)}):l("Hide {label} on the slide",{label:l(n)});return r(h,{label:l(n),icon:r(qt,{}),htmlFor:R,className:C?"is-hidden":void 0,hint:_,action:c?r(q,{content:$,children:r("button",{type:"button",className:"sf-field-eye","aria-pressed":u,"aria-label":$,onClick:g,children:u?r(He,{name:"eye-off",size:14}):r(He,{name:"eye",size:14})})}):void 0,children:A("div",{className:"sf-copybox",children:[s&&r(De,{target:a?p:f,value:d,onChange:m}),a?r("textarea",{id:R,ref:p,value:d,placeholder:o===void 0?void 0:l(o),onChange:O=>m(O.target.value)}):r("input",{id:R,ref:f,type:"text",value:d,placeholder:o===void 0?void 0:l(o),onChange:O=>m(O.target.value)})]})})}function Bi(e,t){return{...e,[ge]:t}}function Hi(e){const t=e[I];if(!t)throw new Error("withOffPage: the field holds no authored text");return{...e,[I]:{...t,offPage:!0}}}function Gi(e){return!e||typeof e!="object"?!1:e[I]?.offPage===!0}const Ve="sfPanelOnly";function Mi(e){if(!e[I])throw new Error("withPanelOnly: the field holds no authored text");return{...e,[Ve]:!0}}function Ki(e){return!!e&&typeof e=="object"&&e[Ve]===!0}function Wi(e){const t=e[I];if(!t)throw new Error("withIdentifier: the field holds no authored text");return{...e,[I]:{...t,identifier:!0}}}import{TEXT_CONTROL_KINDS as Ql,SCALAR_TEXT_CONTROLS as ea}from"./text-control-kinds.js";function Ui(e,t){if(!e[I])throw new Error("inOwnBox: the field holds no authored text");const{[wn]:o,...i}=e;return{...i,[Pn]:!0,render:t}}const Bo=new Set(Hn),G=(e,t)=>{const n={...t,[I]:e};if(!Bo.has(e.control))return n;const o=t.render;return{...ne(n,"authored-copy"),render:i=>r(Nn,{name:i.name,children:o(i)})}},Xi="Everything else on this block comes from the linked post. Unlink it to edit by hand.",Ho="Select a word, then press the highlighter.",Go="A short name so a link can jump straight to this section, like yoursite.com/page#about.",Mo=new Set([Ho]),Ko=e=>Mo.has(e);function ji(e,t,n){return G({control:"text",label:e,placeholder:t,hint:n},{type:"custom",render:({value:o,onChange:i})=>r(H,{value:o,onChange:i,label:e,placeholder:t,hint:n})})}function $i(e,t,n){return G({control:"textarea",label:e,placeholder:t,hint:n},{type:"custom",render:({value:o,onChange:i})=>r(H,{value:o,onChange:i,label:e,placeholder:t,hint:n,multiline:!0})})}function Wo(e,t,n){return G({control:"plainText",label:e,placeholder:t,hint:n},{type:"custom",render:({value:o,onChange:i})=>r(H,{value:o,onChange:i,label:e,placeholder:t,hint:n,hideable:!1,markup:!1})})}function zi(e,t,n){return G({control:"copyText",label:e,placeholder:t,hint:n},{type:"custom",render:({value:o,onChange:i})=>r(H,{value:o,onChange:i,label:e,placeholder:t,hint:n,hideable:!1})})}function Vi(e){return{type:"custom",[me]:{label:e},render:({value:t,onChange:n})=>r(Xn,{value:fe(t),onChange:n,label:e})}}function Yi(e,t,n){return G({control:"plainTextarea",label:e,placeholder:t,hint:n},{type:"custom",render:({value:o,onChange:i})=>r(H,{value:o,onChange:i,label:e,placeholder:t,hint:n,multiline:!0,hideable:!1})})}const qi={Design:It,Animation:Se};function Ji(e,t){return e.includes("Design")?t!=="Design":null}function Uo({label:e}){return r(rn,{title:l(e),level:$e(1)})}function Xo({level:e,label:t}){return e===1?r(Uo,{label:t}):r(zo,{label:t})}function Ye(e,t){return{type:"custom",[V]:{label:e,level:t},render:()=>r(Xo,{level:t,label:e})}}function S(e){return Ye(e,2)}function Zi(e){return{type:"custom",render:()=>r(jo,{text:e})}}function jo({text:e}){return r("p",{className:"sf-note",children:l(e)})}function Qi(e){return Ye(e,1)}function el(e){return Y(e)!==null&&e?.tabs!==void 0}const qe=new Map;function tl(e,t){const n=`${e}\0${t?t.join(""):""}`,o=qe.get(n)??{type:"custom",tabs:t,[V]:{label:e,level:1},bucket:e,marker:!0,render:()=>r(T,{})};return qe.set(n,o),o}function nl(e){return Y(e)!==null&&e?.designGroup!==void 0}const Je=new Map;function ol(e){const t=Je.get(e)??{type:"custom",[V]:{label:e,level:1},designGroup:e,marker:!0,...e==="Content"?{}:{fold:e},render:()=>r(T,{})};return Je.set(e,t),t}function $o(e){const t=e;return t?.marker===!0&&typeof t.fold=="string"?t.fold:null}function rl(e,t){return $o(e)===t?e:{...e,marker:!0,fold:t,render:()=>r(T,{})}}function il(e){const t=e;if(t.marker===!0&&t.fold===void 0)return e;const{fold:n,...o}=e;return{...o,marker:!0,render:()=>r(T,{})}}function zo({label:e}){return r(ln,{title:l(e),level:$e(2)})}function Ze({swatches:e,current:t,onPick:n,names:o}){const i=e.find(s=>s.toLowerCase()===t.toLowerCase()),a=i?o?.[i]:void 0,c=a?l(a):t;return A("div",{className:"sf-swatches",children:[e.map(s=>{const d=o?.[s]?l(o[s]):s;return r(q,{content:d,children:r("button",{type:"button","aria-pressed":t.toLowerCase()===s.toLowerCase(),className:`sf-swatch ${t.toLowerCase()===s.toLowerCase()?"is-active":""}`,style:{background:s},onClick:()=>n(s),"aria-label":d})},s)}),r("span",{className:"sf-swatch-hex",children:c})]})}function ll(e,t){return{type:"custom",render:({value:n,onChange:o})=>{const i=Co(n,t);return r(h,{label:l(e),icon:r(Tt,{}),changed:!i,action:r(y,{words:x()?.panel,label:l(e),changed:!i,detail:l("the theme's section background"),onReset:()=>o(bo)}),children:Ze({swatches:xo,current:i?So:n??t??"",onPick:o,names:yo})})}}}function Vo(e,t){return{type:"custom",render:({value:n,onChange:o})=>{const i=n,a=mo(i,t);return r(h,{label:l(e),icon:r(Mt,{}),changed:!a,action:r(y,{words:x()?.panel,label:l(e),changed:!a,detail:l("the theme's image stage"),onReset:()=>o(co)}),children:Ze({swatches:fo,current:a?go:ho(i,t),onPick:o,names:po})})}}}function al(e=n=>n,t){return v({_gSectionTheme:S(_o),sectionAccent:{type:"custom",render:({value:n,onChange:o})=>r(Wn,{value:e(n),onChange:o,followLabel:t})}})}function U({min:e,max:t,step:n,value:o,onChange:i,suffix:a="",readout:c=!0,notch:s,ariaLabel:d,disabled:u=!1}){const f=s!==void 0&&Number.isFinite(s)&&s>=e&&s<=t;return r("div",{className:f?"sf-slider has-notch":"sf-slider",style:f?{"--sf-notch":(s-e)/(t-e)}:void 0,children:r(Tn,{min:e,max:t,step:n,value:o,suffix:a||void 0,showInput:c,label:d===void 0?void 0:l(d),disabled:u,size:"sm",className:"sf-slider-track",onChange:p=>{p!==null&&p!==o&&i(p)}})})}function M(e,t,n,o,i,a,c="",s){return{type:"custom",render:d=>r(h,{label:l(e),icon:D(t),action:s?s("storedValue"in d?d.storedValue:d.value,d.onChange):void 0,children:U({min:n,max:o,step:i,value:typeof d.value=="number"?d.value:a,suffix:c,ariaLabel:e,onChange:d.onChange})})}}function Qe(e,t){const{min:n,max:o,step:i=1,unsetLabel:a,hint:c,restTrack:s,unsetMark:d,icon:u}=t;return{type:"custom",render:({value:f,onChange:p})=>{const m=typeof f=="number"?f:null,g=m===null;return r(h,{label:l(e),icon:u?D(u):void 0,value:g?d||a===void 0?void 0:l(a):`${m}px`,changed:!g,action:d?de(d,{changed:!g,onReset:()=>p(null)}):r(y,{words:x()?.panel,label:l(e),changed:!g,onReset:()=>p(null)}),hint:typeof c=="string"?l(c):c,children:s?s({min:n,max:o,step:i,px:m,label:e,onChange:p}):U({min:n,max:o,step:i,value:m??n,readout:!1,ariaLabel:e,onChange:p})})}}}function sl(e){const t=M("Gap",r(_e,{}),ie.min,ie.max,ie.step,io[e],"px",(n,o)=>r(vo,{inherited:!ao(e,n),onReset:()=>o(void 0),label:"Gap"}));return{type:"custom",[lo]:e,render:n=>t.render({...n,value:so(e,n.value,n.field?.siteGap),storedValue:n.value,onChange:o=>n.onChange(o)})}}const J="Corners";function le(e){return{type:"custom",render:({value:t,onChange:n})=>{const o=typeof t=="number"&&Number.isFinite(t)?t:null,i=o!==null;return r(h,{label:l(J),icon:r(Lt,{}),changed:i,action:de(e.mark,{changed:i,onReset:()=>n(null)}),hint:e.hint,children:r(Yo,{tier:e,px:o,onRadius:n})})}}}function et(e){let t=null;try{t=ue()}catch{t=null}return[t?.values?.[e],n=>t?.onChange(e,n)]}function Yo({tier:e,px:t,onRadius:n}){const o=e.useFollowed(),i=e.useClosedReason?e.useClosedReason():null,[a,c]=et(e.sidesKey),s=Ne(a)??[...Ae];return r(Rn,{label:l(J),value:s,corners:en,onChange:d=>{const u=Ne(d)??[];c(u.length===Ae.length?null:u)},radius:t,onRadiusChange:n,radiusMin:L,radiusMax:be,radiusStep:e.step??1,radiusPlaceholder:String(o),disabled:i!==null,disabledReason:i??void 0})}function tt(){return ne({type:"custom",render:()=>r(Be,{})},"always")}function qo({label:e,changed:t=!1,onReset:n=()=>{}}){const{cornerRadiusPx:o}=W(),i=typeof o=="number"?`${o}px`:l("not set");return r(y,{words:x()?.panel,label:l(e),changed:t,detail:o==null?l("the built-in corners"):B(i,l("Site styles")),onReset:n})}function Jo(){const{cornerRadiusPx:e}=W();return typeof e=="number"?e:L}function Zo(){return le({sidesKey:"sectionCornerSides",useFollowed:Jo,useClosedReason:()=>ot()?l(nt):null,mark:r(qo,{label:J}),hint:r(Qo,{})})}const nt="This section runs edge to edge, so its corners sit off the page. Set Width to Content width to use them.";function ot(){return je(X())}function Qo(){return r(T,{children:ot()?nt:"Follows Site styles ▸ Basics ▸ Corners until you set a number here."})}function cl(){return v({_gShape:S("Shape"),sectionCorners:Zo(),sectionCornerSides:tt(),sectionBorder:rt("desktop"),sectionBorderPhone:rt("mobile")})}const er=()=>({width:l("Border width"),sides:{top:l("Border top"),right:l("Border right"),bottom:l("Border bottom"),left:l("Border left")},style:l("Border style"),styles:{solid:l("Solid"),dashed:l("Dashed"),dotted:l("Dotted")},color:l("Border color"),unit:"px"});function tr(e){const t=Object.fromEntries(Object.entries(e).filter(([,n])=>n!=null&&n!==""));return Object.keys(t).length?t:void 0}function nr(){let e;try{const t=ro(W().theme);e=t.themes[t.selected]?.line}catch{e=void 0}return e||oo.line}function or({value:e,onChange:t,tier:n}){const[o]=et("sectionBorder"),i=nr(),a=e&&typeof e=="object"?e:{},c=n==="mobile"?o&&typeof o=="object"?o:{}:{},[s,d]=z(()=>fn(a,c)),u=er();return r(h,{label:l("Border"),icon:r(wt,{}),action:r(Fe,{each:s,label:l("Each side"),onChange:d}),children:r(an,{label:l("Border"),value:a,each:s,onChange:f=>t(tr(f)),placeholder:{sides:pn(c),style:c.style??"solid",color:c.color||i},presets:[i],words:u,max:no})})}function rt(e){return b(e,{type:"custom",render:({value:t,onChange:n})=>r(or,{value:t,onChange:n,tier:e})})}function dl(){return{_gMotion:S("Motion"),sectionAnimation:ce("Entrance",r(Se,{}),[...on],nn)}}function ae(){let e=null;try{const{appState:t,selectedItem:n}=N(i=>i),o=n?.props?.id?String(n.props.id):void 0;e=o?Le(t?.data,o):null}catch{e=null}return e!==null&&je(e)}function it(e){const{cornerRadiusPx:t}=W(),n=ae(),o=typeof t=="number"?t:e;let i=null;try{const{appState:c,selectedItem:s}=N(u=>u),d=s?.props?.id?String(s.props.id):void 0;i=d?Le(c?.data,d):null}catch{i=null}if(n||!i)return o;const a=i.sectionCorners;return tn(a)?a:o}function rr({label:e,changed:t=!1,onReset:n=()=>{}}){const o=ae(),i=it(L),a=o?"Site":"Section";return r(y,{words:x()?.panel,label:l(e),changed:t,detail:B(`${i}px`,o?l("Site styles"):l("the section")),onReset:n})}function ir(){return r(T,{children:ae()?l("The section is full width, so this card follows Site styles ▸ Basics ▸ Corners."):l("Follows the section's Corners until you set a number here.")})}function lr(){return le({sidesKey:"cardCornerSides",useFollowed:()=>it(L),mark:r(rr,{label:J}),hint:r(ir,{})})}function ar(){return{type:"custom",render:()=>r(pt,{})}}function ul(){return{_gShape:S("Shape"),cardCorners:lr(),cardCornerSides:tt(),cardCornersApplyAll:ar()}}function pl(){return w("Justify",r(Ot,{}),Ke,Ke[0].value)}function fl(){return w("Item alignment",r(Et,{}),Jn,"stretch")}function ml(){return w(to,r(Zt,{}),Xe,Xe[0].value)}function hl(){return{type:"custom",render:({value:e,onChange:t})=>{const n=re.find(o=>o.value===e)??re[0];return r(h,{label:l(Ue),icon:r(Ce,{}),value:l(n.label),children:r("div",{className:"sf-gallery-layouts",role:"group","aria-label":l(Ue),children:re.map(o=>r(q,{content:l(o.label),className:"sf-tile-tip",children:r("button",{type:"button","aria-pressed":n.value===o.value,"aria-label":l(o.label),onClick:()=>t(o.value),children:r("span",{className:"sf-gallery-pic",children:sr(o.weights).map((i,a)=>r("i",{style:{gridColumn:`span ${i}`}},a))})})},o.value))})})}}}function sr(e){if(!e)return[3,4];const t=e.reduce((n,o)=>n+o,0);return e.map(n=>Math.round(n/t*12))}function gl(){return w(Zn,r(_e,{}),Me,Me[0].value)}function bl(){return M(Qn,r(jt,{}),We,eo,1,We)}function xl(e){const t=ce(Yn,No("`Direction` names how a container's children run — a MODIFIER, not a thing. doc/naming.md N10.1 gives the idea a dash in its Glyph column; editor-shell's own `direction` meaning says the bare row is CORRECT and not an omission (SS seat, 2026-09-11)."),qn(e),Ge(e,void 0));return{type:"custom",render:n=>t.render({...n,value:Ge(e,n.value),onChange:o=>n.onChange(o)})}}function yl(e,t,n,o,i,a){return{type:"custom",render:({value:c,onChange:s})=>r(h,{label:l(e),icon:r(Pe,{noun:a}),action:r(y,{words:x()?.panel,label:l(e),changed:!Ro(c),detail:l("the Text style in Site styles"),onReset:()=>s(Eo),defaultAction:{onPress:()=>s(Io),title:l("Keep this section's own built-in size"),icon:r(Pt,{})}}),children:U({min:t,max:n,step:o,value:typeof c=="number"?c:i,suffix:"px",ariaLabel:e,onChange:s})})}}function Sl(){return{_gCellWidth:S("Cell width"),gridSpan:w("Positions",r(Ce,{}),[{label:"Auto",value:""},...Array.from({length:gt},(e,t)=>({label:t===0?"1 position":`${t+1} positions`,value:String(t+1)}))],"")}}function X(){let e=null;try{e=N(t=>t).selectedItem}catch{e=null}return e?.props??{}}function cr({min:e,max:t,step:n,px:o,label:i,onChange:a,desktopKey:c,fallback:s}){const d=X()[c],u=oe(void 0,d,s);return r(T,{children:U({min:e,max:t,step:n,value:oe(o,d,s),readout:!1,ariaLabel:i,notch:u,onChange:a})})}function dr({label:e,desktopKey:t,fallback:n,changed:o=!1,onReset:i=()=>{}}){const a=X()[t],c=oe(void 0,a,n);return r(y,{words:x()?.panel,label:l(e),changed:o,detail:l("{value} on desktop",{value:`${c}px`}),onReset:i})}function ur(e){return Qe(e.label,{icon:e.icon,min:e.min,max:e.max,step:e.step,unsetLabel:"Follows Desktop",unsetMark:r(dr,{label:e.label,desktopKey:e.desktopKey,fallback:e.fallback}),restTrack:t=>r(cr,{...t,desktopKey:e.desktopKey,fallback:e.fallback})})}const pr={Top:"Padding top",Bottom:"Padding bottom",Left:"Padding left",Right:"Padding right"},fr={Top:Te,Bottom:Ee,Left:Re,Right:Oe},mr=e=>{const t=fr[e];return r(t,{})};function Cl(e={}){const t=e.keys?.top??"sectionPaddingTop",n=e.keys?.bottom??"sectionPaddingBottom",o=e.group!==!1,i=_=>pr[_],a=_=>M(i("Top"),r(Te,{}),E.min,E.max,E.step,_,"px"),c=(_,$,O,Q=E)=>b("mobile",ur({label:i(_),icon:mr(_),desktopKey:$,min:Q.min,max:Q.max,step:Q.step,fallback:O})),s=e.top??E.min,d=e.bottom??E.min,u="sectionPaddingLeft",f="sectionPaddingRight",p=e.sideBounds??E,m=e.side??p.min,g=e.sidePhone??m,C=e.phone===!0,R=_=>C?b("desktop",_):_;return v({...o?{_gSpacing:S("Padding")}:{},[t]:R(a(s)),...C?{[k(t)]:c("Top",t,s)}:{},...e.only==="top"?{}:{[n]:R(M(i("Bottom"),r(Ee,{}),E.min,E.max,E.step,d,"px")),...C?{[k(n)]:c("Bottom",n,d)}:{}},...e.sides?{[u]:R(M(i("Left"),r(Re,{}),p.min,p.max,p.step,m,"px")),...C?{[k(u)]:c("Left",u,g,p)}:{},[f]:R(M(i("Right"),r(Oe,{}),p.min,p.max,p.step,m,"px")),...C?{[k(f)]:c("Right",f,g,p)}:{}}:{}})}const j=["top","right","bottom","left"],hr={top:"sectionPaddingTop",right:"sectionPaddingRight",bottom:"sectionPaddingBottom",left:"sectionPaddingLeft"},lt=e=>typeof e=="number"?e:null;function gr(e,t,n){const o={};for(const i of j)n[i]!==t[i]&&(o[e[i]]=n[i]??void 0);return o}function br({tier:e,o:t}){let n=null;try{n=ue()}catch{n=null}const o=n?.values??{},i=e==="mobile"?t.phoneKeys:t.keys,a=Object.fromEntries(j.map(u=>[u,lt(o[i[u]])])),c=Object.fromEntries(j.map(u=>[u,String(e==="mobile"?lt(o[t.keys[u]])??t.fallback[u]:t.fallback[u])])),[s,d]=z(()=>dn(a,c));return r(h,{label:l("Padding"),icon:r(Xt,{}),action:r(Fe,{each:s,label:l("Each side"),onChange:d}),children:r(cn,{label:l("Padding"),each:s,value:a,placeholder:c,min:t.min,max:t.max,step:t.step,onChange:u=>{const f=gr(i,a,u);Object.keys(f).length&&n?.onChangeMany(f)},words:{sides:{top:l("Padding top"),right:l("Padding right"),bottom:l("Padding bottom"),left:l("Padding left")},vertical:l("Top and bottom"),horizontal:l("Left and right"),unit:"px"}})})}function _l(e={}){const t={...hr,...e.keys},n={keys:t,phoneKeys:Object.fromEntries(j.map(s=>[s,k(t[s])])),fallback:{top:0,right:0,bottom:0,left:0,...e.fallback},min:e.min??0,max:e.max??200,step:e.step??4},o=e.phone!==!1,i=s=>{const d={type:"custom",render:()=>r(br,{tier:s,o:n})};return o?b(s,d):d},a=()=>ne({type:"custom",render:()=>r(Be,{})},"always"),c=j.filter(s=>s!=="top");return v({...e.group===!1?{}:{_gSpacing:S("Padding")},[n.keys.top]:i("desktop"),...o?{[n.phoneKeys.top]:i("mobile")}:{},...Object.fromEntries(c.map(s=>[n.keys[s],{...a(),reachedBy:n.keys.top}])),...o?Object.fromEntries(c.map(s=>[n.phoneKeys[s],b("mobile",a())])):{}})}const xr={contained:"Contained",page:"Page",full:"Full"},Z="Width";function Il(e,t=Oo,n=!0){const o=t.map(i=>({label:To[i]??xr[i],value:i}));return v({...n?{_gWidth:S(Z)}:{},widthMode:{type:"custom",render:({onChange:i,field:a})=>r(h,{label:l(Z),icon:r(Jt,{}),action:n?r(Do,{inherited:a?.inherited??!1,onReset:()=>i(wo),label:Z}):void 0,children:se({options:o,value:a?.currentValue||e,onChange:i,ariaLabel:Z})})}})}function El(){const e=o=>({type:"custom",render:({value:i,onChange:a})=>r(h,{label:K,icon:D(r(Kt,{})),action:o?o(a):void 0,children:se({options:[{label:"Auto",value:"auto"},{label:"Fixed",value:"fixed"},{label:"Screen",value:"screen"}],value:["auto","fixed","screen"].includes(i)?i:"auto",onChange:a,ariaLabel:K})})}),t=()=>({type:"custom",render:({value:o,onChange:i,field:a})=>{const c=a?.unit==="%"?"%":"px",s=c==="%"?Vn:zn;return r("div",{className:"sf-field",children:U({min:s.min,max:s.max,step:s.step,value:typeof o=="number"?o:s.fallback,suffix:c,ariaLabel:K,onChange:i})})}}),n=()=>ce("Unit",r(Ie,{}),[{label:"px",value:"px"},{label:"%",value:"%"}],"px");return v({_gHeight:S(K),sectionHeightMode:b("desktop",e()),sectionHeightValue:b("desktop",t()),sectionHeightUnit:b("desktop",n()),sectionHeightModePhone:b("mobile",e(o=>r(yr,{onClear:()=>o(void 0)}))),sectionHeightValuePhone:b("mobile",t()),sectionHeightUnitPhone:b("mobile",n())})}function yr({onClear:e}){const t=X(),n=jn(t),o=$n(t),i=l("{value} on desktop",{value:o.mode==="auto"?l("Auto"):`${o.value}${o.unit}`});return r(y,{words:x()?.panel,label:l(K),changed:n,detail:i,onReset:e})}function Rl(){return{_gAnchor:S("Anchor"),anchor:Wo("Anchor name","e.g. about",Go)}}function Ol(e,t,n){return{type:"custom",render:({value:o,onChange:i,id:a,name:c})=>{const s=`${a??c??e}-datetime`,d=Date.parse(typeof o=="string"?o:"");return r(h,{label:l(e),icon:t,htmlFor:s,hint:n===void 0?void 0:l(n),children:r(On,{id:s,value:Number.isFinite(d)?new Date(d):null,onChange:u=>i(u?u.toISOString():"")})})}}}function P(e,t,n){return{type:"custom",render:({value:o,onChange:i,id:a,name:c})=>{const s=typeof o=="boolean"?o:t,d=`${a??c??e}-label`;return r(h,{label:l(e),labelId:d,icon:n,action:r(un,{checked:s,onChange:i,ariaLabelledBy:d})})}}}function Tl(){return{type:"custom",render:({value:e,onChange:t,id:n,name:o})=>{const i=`${String(n??o??"pageBackground")}-colour`;return r(h,{label:l("Background"),icon:r(we,{}),htmlFor:i,action:r(ve,{id:i,label:"Background",value:Qt(e),onChange:t})})}}}function wl(e,t){return{type:"custom",render:({value:n,onChange:o,id:i})=>{const a=typeof n=="boolean"?n:t,c=`${i??e}-checkbox`;return r(h,{label:l(e),htmlFor:c,className:"sf-checkbox",action:r(En,{id:c,checked:a,onChange:o})})}}}function Pl(e,t){return{type:"custom",render:({value:n,onChange:o})=>r(h,{label:l(e),action:ve({value:n||t,onChange:o,label:e})})}}const Sr=[{value:"0% 0%",label:"Top left"},{value:"50% 0%",label:"Top"},{value:"100% 0%",label:"Top right"},{value:"0% 50%",label:"Left"},{value:"50% 50%",label:"Center"},{value:"100% 50%",label:"Right"},{value:"0% 100%",label:"Bottom left"},{value:"50% 100%",label:"Bottom"},{value:"100% 100%",label:"Bottom right"}];function at({label:e,value:t,onChange:n,points:o=Sr}){const i=o.map(a=>({...a,label:l(a.label),...a.title?{title:l(a.title)}:null}));return r(In,{label:l(e),value:t,points:i,onChange:n})}function Al(e,t=ke,n="mediaImage"){return{type:"custom",render:({value:o,onChange:i})=>r("div",{className:"sf-focal-row",children:r(Cr,{label:e,value:o||t,onChange:i,imageProp:n})})}}function Cr({label:e,value:t,onChange:n,imageProp:o}){const{selectedItem:i}=N(c=>c),a=i?.props?.[o];return r(Gn,{label:e,value:t,onChange:n,image:typeof a=="string"?a:void 0})}const _r=ye([]);function Nl(e,{stacking:t,fallback:n=St}){return{type:"custom",render:({value:o,onChange:i})=>{const a=yt.includes(o)?o:n;return t?r(Ir,{label:e,value:a,onChange:i}):st({label:e,value:a,onChange:i,points:_r})}}}function Ir({label:e,value:t,onChange:n}){const{appState:o,selectedItem:i}=N(s=>s),a=i?.props?.id?String(i.props.id):void 0,c=a?xt(o?.data,a):[];return st({label:e,value:t,onChange:n,points:ye(c,a)})}function st({label:e,value:t,onChange:n,points:o}){const i=o.find(a=>a.disabled);return r(h,{label:l(e),icon:r($t,{}),hint:i?.title?l(i.title):void 0,children:at({label:e,value:Ct(t),onChange:n,points:o})})}const Ll={top:r(Dt,{}),right:r(vt,{}),bottom:r(Ft,{}),left:r(kt,{})};function Fl(e,t,n,o,i,a){const c=f=>t.find(p=>p.value===f),s=f=>({value:f,label:"",disabled:!0,title:o}),d=f=>{const p=t.find(g=>g.cell===f);if(!p)return s(`missing-${f}`);const m=a?.[f];return m?{value:p.value,label:p.label,icon:m}:{value:p.value,label:p.label}},u=[s("corner-top-left"),d("top"),s("corner-top-right"),d("left"),s("centre"),d("right"),s("corner-bottom-left"),d("bottom"),s("corner-bottom-right")];return{type:"custom",render:({value:f,onChange:p})=>{const m=t.some(g=>g.value===f)?f:n;return r(h,{label:l(e),icon:i,value:c(m)?.label?l(c(m).label):"",children:at({label:e,value:m,onChange:p,points:u})})}}}const Er="\0note";function w(e,t,n,o,i){return{type:"custom",options:n,fallback:o,...i?{note:i}:{},render:({value:a,onChange:c,field:s})=>{const d=s.options??n,u=s.fallback??o,f=d.some(p=>p.value===a)?a:u;return r(h,{label:l(e),icon:D(t),children:r(mn,{value:f,ariaLabel:l(e),onChange:c,options:[...i?[{label:l(i),value:Er,disabled:!0}]:[],...d.map(p=>({label:l(p.label),value:p.value}))]})})}}}function kl(e,t,n){return{type:"custom",options:t,render:({value:o,onChange:i,field:a})=>r(Kn,{label:e,options:(a.options??t).map(c=>({...c,label:l(c.label)})),value:Array.isArray(o)?o:[],onChange:i,...n?{emptyLabel:l(n)}:{}})}}function vl(e,t,n,o){return{type:"custom",options:t,fallback:n,render:({value:i,onChange:a,field:c})=>r(Un,{label:e,options:(c.options??t).map(s=>({...s,label:l(s.label)})),fallback:c.fallback??n,value:i,onChange:a,placeholder:o===void 0?void 0:l(o)})}}function Dl(e,t={}){return{type:"custom",render:({value:n,onChange:o})=>{const i={value:n,onChange:o,...t};return r(e,{...i})}}}function se({options:e,value:t,onChange:n,ariaLabel:o,disabled:i=!1}){return r(sn,{options:e.map(a=>a.picture?{id:a.value,label:a.picture,title:l(a.title??a.label)}:{id:a.value,label:l(a.label),title:a.title===void 0?void 0:l(a.title)}),value:t,onChange:n,ariaLabel:l(o),disabled:i})}const Bl=[{label:"Image",value:"image"},{label:"Video",value:"video"}];function ce(e,t,n,o){const i=n.map(a=>typeof a=="string"?{label:a,value:a}:a);return{type:"custom",render:({value:a,onChange:c,field:s})=>r(h,{label:l(e),icon:D(t),children:se({options:i,value:i.some(d=>d.value===a)?a:a||s?.currentValue||o,onChange:c,ariaLabel:e})})}}function Hl(e,t,n){return{type:"custom",[he]:!0,render:({value:o,onChange:i})=>r(Mn,{value:o||"",onChange:i,label:e,accept:t,placeholder:n})}}const Gl={HeroSingle:["imageFocal"],ContactLocations:["locations[].photo"],ProcessSteps:["steps[].image"]};function Ml({value:e,onChange:t,label:n}){const o=e||{},i=!!o.pending,a=i?"var(--fg-dim, #888)":o.ok?"#1d9e75":"#d85a30",c=(s,d)=>t({...o,[s]:d===""?void 0:Number(d)});return A(h,{label:l(n),icon:r(te,{}),children:[r("button",{type:"button",disabled:i,onClick:()=>t({...o,pending:!0,ok:!1,status:"Finding…"}),style:{width:"100%",display:"flex",alignItems:"center",justifyContent:"center",gap:6,padding:"8px 10px",fontSize:13,cursor:i?"default":"pointer",opacity:i?.6:1,border:"1px solid var(--border-strong, #ccc)",borderRadius:6,background:"transparent",color:"inherit"},children:i?l("Finding…"):l("Find coordinates")}),o.status&&r("div",{style:{marginTop:6,fontSize:12,lineHeight:1.4,color:a},children:l(o.status)}),r("div",{style:{marginTop:6,fontSize:11,color:"var(--fg-dim, #999)"},children:l("Coordinates from OpenStreetMap")}),r("button",{type:"button",onClick:()=>t({...o,manual:!o.manual}),style:{marginTop:8,padding:0,border:"none",background:"none",font:"inherit",fontSize:12,color:"var(--sf-accent, #2563eb)",cursor:"pointer",textDecoration:"underline"},children:o.manual?l("Hide manual coordinates"):l("Enter coordinates manually")}),o.manual&&A("div",{style:{marginTop:8,display:"grid",gap:8},children:[r(h,{label:l("Latitude"),icon:r(te,{}),children:r("input",{type:"number",step:"any",placeholder:l("e.g. {example}",{example:"34.0990198"}),value:typeof o.lat=="number"?o.lat:"",onChange:s=>c("lat",s.target.value)})}),r(h,{label:l("Longitude"),icon:r(te,{}),children:r("input",{type:"number",step:"any",placeholder:l("e.g. {example}",{example:"-117.9842833"}),value:typeof o.lng=="number"?o.lng:"",onChange:s=>c("lng",s.target.value)})})]})]})}function Rr(e,t){return t===null||t<0||t>=e.length?"":e[t]?.text??""}function Or(e,t,n){const o=e.map(i=>({text:i?.text??""}));return t===null||t<0||t>=e.length?o:o.map((i,a)=>a===t?{text:n}:i)}function Kl(e,t){return e===null?null:t>e?e:null}function Tr(e,t,n){if(n===null||n>=t.length)return null;for(let o=0;o<n;o+=1)if(e[o]!==t[o])return null;return e[n]!==t[n]&&t.includes(e[n])||e[n]!==t[n]&&t.length!==e.length?null:n}const Wl={label:"Ticker items",icon:r(Ut,{})};function Ul(e,t,n,o){return{type:"custom",[I]:{control:"textList",label:e,placeholder:n,itemKey:"text",rendering:o},render:({value:i,onChange:a})=>r(wr,{label:e,icon:D(t),items:Array.isArray(i)?i:[],placeholder:n,onChange:a,markup:o==="markup"})}}function wr({label:e,icon:t,items:n,placeholder:o,onChange:i,markup:a=!1}){const c=ee(null),[s,d]=z(null),u=p=>p.map(m=>({text:m?.text??""})),f=p=>{const m=Tr(n,p,s);m===null&&(c.current=null),d(m),i(u(p))};return r(hn,{label:l(e),icon:t,noun:l("item"),items:n,onChange:f,newItem:()=>({text:""}),open:null,onOpen:()=>{},renderItem:()=>null,above:a?r(De,{target:c,value:Rr(n,s),onChange:p=>i(Or(n,s??-1,p)),disabled:s===null,label:s===null?l("Formatting — click a row first"):l("Formatting — row {n}",{n:s+1})}):void 0,renderRow:(p,m,g)=>r("input",{type:"text",className:a&&s===m?"sf-list-marking":void 0,value:p?.text??"",placeholder:l(o),"aria-label":l("{label} {n}",{label:l(e),n:m+1}),onChange:C=>g({text:C.target.value}),onFocus:C=>{c.current=C.currentTarget,d(m)}})})}function Xl(e,t){const n=`${e.label} — row ${t+1}`;return G({control:"plainText",label:n,placeholder:e.placeholder,offPage:e.offPage},{type:"custom",render:({value:o,onChange:i})=>r(H,{value:o,onChange:i,label:l("{label} — row {n}",{label:l(e.label),n:t+1}),placeholder:e.placeholder,hideable:!1,markup:e.rendering==="markup"})})}function jl(e){return{_gCards:S("Cards"),coverIndex:w("Cover image",r(Wt,{}),Dn,String(Bn),e?.coverHint??"A card's opening picture — a card pinned to a finish keeps its own."),imageBackground:Vo("Image background",uo),cardImage:Ar(),spinOnHover:P("Rotate on hover",e?.spinDefault??!0,r(Vt,{}))}}function $l(){return{outline:w("Card outline",r(Yt,{}),Fn,vn),indexBadge:w("Card number",r(Ie,{}),Ln,kn),showBadge:P("Product badge",!0,r(Pe,{noun:"tag"}))}}function zl(e){const t=e?.bottomDefault??!0;return{_gShowOnCard:S("Show on a card"),showCardPrice:P("Price",!0,r(Bt,{})),showCardFinishes:P("Finish swatches",!0,r(Ht,{})),showCardSizes:P("Sizes",t,r(zt,{})),showCardBuy:P("Buy button",t,r(At,{})),showCardPage:P("Page button",t,r(we,{}))}}function Vl(e,t="display"){const n=k(t);return{[t]:b("desktop",{type:"custom",render:({value:o,onChange:i})=>r(ct,{parts:e,changed:bn(o),shown:a=>xn(o,a),onPress:(a,c)=>i(Cn(o,a,c)),onReset:()=>i(void 0)})}),[n]:b("mobile",{type:"custom",render:({value:o,onChange:i})=>r(Pr,{parts:e,desktopKey:t,value:o,onChange:i})})}}function ct({parts:e,changed:t,shown:n,onPress:o,onReset:i,detail:a}){const c=l("Display");return r(h,{label:c,icon:r(Rt,{}),changed:t,action:r(y,{words:x()?.panel,label:c,changed:t,detail:a,onReset:i}),children:r(gn,{label:c,items:e.map(s=>({id:s.id,label:l(s.label),shown:n(s.id)})),onChange:o})})}function Pr({parts:e,desktopKey:t,value:n,onChange:o}){const i=X()[t];return r(ct,{parts:e,changed:Sn(n),shown:a=>yn(i,n,a),onPress:(a,c)=>o(_n(n,a,c)),onReset:()=>o(An),detail:l("the same as Desktop")})}function Ar(){return Qe("Card image",{min:L,max:be,step:ft,hint:"Rounds the picture. The card's own corner is in Site styles."})}function Yl(){return le({sidesKey:"cornerSides",step:mt,useFollowed:()=>L,mark:r(Nr,{label:ht}),hint:l("Rounds the picture. Left alone it stays square.")})}function Nr({label:e,changed:t=!1,onReset:n=()=>{}}){return r(y,{words:x()?.panel,label:l(e),changed:t,onReset:n})}function ql(){return{type:"custom",render:({value:e,onChange:t})=>r(Lr,{value:typeof e=="string"?e:"",onChange:t})}}function Lr({value:e,onChange:t}){const[n,o]=z(null),i=xe.filter(c=>n===null||F[c].across===n),a=e&&e in F?F[e]:null;return A(T,{children:[r(h,{label:l("Photos in a row"),icon:r(Nt,{}),children:A("div",{className:"sf-gallery-filter",children:[r("button",{type:"button","aria-pressed":n===null,onClick:()=>o(null),children:l("All")}),bt.map(c=>r("button",{type:"button","aria-pressed":n===c,onClick:()=>o(c),children:c},c))]})}),r(h,{label:l("Layout"),icon:r(Gt,{}),value:a?l(a.label):l("Not chosen"),hint:l("{n} of {total} layouts",{n:i.length,total:xe.length}),children:r("div",{className:"sf-gallery-layouts",children:i.map(c=>r(q,{content:l(F[c].label),className:"sf-tile-tip",children:r("button",{type:"button","aria-pressed":e===c,"aria-label":l(F[c].label),onClick:()=>t(e===c?"":c),children:r("span",{className:"sf-gallery-pic",children:F[c].desktop.map(([s,d],u)=>r("i",{style:{gridColumn:`span ${s}`,gridRow:`span ${d}`}},u))})})},c))})})]})}export{Go as ANCHOR_HINT,Xi as BOUND_TO_POST_NOTE,qi as BUCKET_ICONS,Gl as CUSTOM_FIELD_MEDIA,Ml as CoordsField,Ll as EDGE_ARROWS,ke as FOCAL_DEFAULT,Sr as FOCAL_POINTS,V as FOLD_FIELD_MARKER,at as FocalPicker,zo as GroupLabel,Ho as HIGHLIGHT_HINT,H as HidableTextField,me as LINK_FIELD_MARKER,Di as Label,he as MEDIA_FIELD_MARKER,Bl as MEDIA_TYPE_OPTIONS,jo as PanelNoteLine,st as PlacementGridView,ge as SCAFFOLD_FIELD_MARKER,ea as SCALAR_TEXT_CONTROLS,nt as SECTION_BLEEDS_HINT,hr as SIDE_PAD_KEYS,Uo as SectionHeading,se as Segmented,vo as SiteGapDefaultReset,U as Slider,Ze as Swatches,Ql as TEXT_CONTROL_KINDS,I as TEXT_FIELD_MARKER,Wl as TICKER_ITEMS_ROW,wr as TextListField,Do as WidthDefaultReset,Tr as aimAfterListChange,Rl as anchorFields,B as backTo,ll as backgroundField,fl as boxAlignField,gl as boxBlockSpacingField,pl as boxJustifyField,bl as boxPhoneRowField,hl as boxShareField,ml as boxWrapField,tl as bucketHeader,lr as cardCornersField,Vo as cardImageBackgroundField,Ar as cardImageField,jl as cardMediaFields,ul as cardShapeFields,zl as cardShowFields,$l as cardStyleFields,Sl as cellWidthFields,wl as checkbox,Pl as colorInput,zi as copyText,tt as cornerSidesField,le as cornersRowField,Ol as dateTime,ol as designGroupHeader,xl as directionField,Vl as displayFields,Fl as edgePad,Ji as entriesHiddenForTab,Al as focalPicker,Kl as focusAfterRemove,rl as foldMarker,Y as foldMetaOf,$o as foldTitleOf,ql as galleryLayoutField,sl as gapField,S as group,El as heightFields,fe as hidableText,Ko as hintIsWhileTyping,D as iconOf,Yl as imageCornersField,Ui as inOwnBox,el as isBucketHeader,nl as isDesignGroupHeader,Lo as isNoGlyph,Vi as linkField,kl as multiSelect,No as noGlyph,Tl as pageBackgroundField,Zi as panelNote,ur as phoneOverrideField,Nl as placementField,Wo as plainText,Yi as plainTextarea,Qe as pxField,il as quietMarker,pe as readHidable,Rr as rowText,vl as searchSelect,Qi as section,dl as sectionAnimationFields,rt as sectionBorderField,Zo as sectionCornersField,cl as sectionShapeFields,al as sectionThemeFields,ce as segmented,w as select,Or as setRowText,_l as sidesPaddingFields,gr as sidesPaddingPatch,yl as sizeField,M as slider,Dl as sourceField,Cl as spacingFields,ji as text,ut as textFieldIdentifier,Gi as textFieldOffPage,Ki as textFieldPanelOnly,Ul as textList,Xl as textListRowField,$i as textarea,P as toggle,Hl as upload,Fo as usePageWidthDetail,ko as useSiteGapDetail,Il as widthField,Wi as withIdentifier,Hi as withOffPage,Mi as withPanelOnly,Bi as withScaffold};
@@ -25,6 +25,11 @@ export declare const PART_MEASURED_TRACKS: {
25
25
  readonly max: 1000;
26
26
  readonly step: 1;
27
27
  };
28
+ readonly sizePhone: {
29
+ readonly min: 5;
30
+ readonly max: 1000;
31
+ readonly step: 1;
32
+ };
28
33
  readonly padding: {
29
34
  readonly min: 0;
30
35
  readonly max: 64;
@@ -63,6 +68,7 @@ export type PartStyle = {
63
68
  width?: number;
64
69
  color?: string;
65
70
  italic?: boolean;
71
+ sizePhone?: number;
66
72
  };
67
73
  export type PartStyleBase = {
68
74
  fontKey: string;
@@ -96,6 +102,9 @@ export declare function partSpacingOf(style: PartStyle): {
96
102
  letterSpacingEm?: number;
97
103
  };
98
104
  export declare const PART_PARAGRAPH_VAR = "--sf-part-para";
105
+ export declare const PART_PHONE_MAX_CSS = "(max-width: 719.98px)";
106
+ export declare function partPhoneDeclarations(style: PartStyle): Record<string, string>;
107
+ export declare function partStyleForScreen(style: PartStyle, phone: boolean): PartStyle;
99
108
  export declare function partStyleDeclarations(style: PartStyle, base: PartStyleBase): Record<string, string>;
100
109
  export declare function isHexColour(value: string): boolean;
101
110
  export type MeasuredPartStyle = {
@@ -113,13 +122,14 @@ export declare function partFontKeyOf(family: string, resolve: (cssVar: string)
113
122
  export declare function partStyleSource<E extends {
114
123
  getAttribute(name: string): string | null;
115
124
  }>(nodeId: string, selectedPartId: string | null, selectedElements: readonly E[], declaresStyle: (className: string | null) => boolean): E | null;
116
- export declare function applyPartStyles(stamps: readonly StyledPartStamp[], styles: PartStyles, baseOf?: (element: StyledPartEl) => PartStyleBase, styleKeyOf?: (partKey: string) => string, isInline?: (element: StyledPartEl) => boolean): number;
125
+ export declare function applyPartStyles(stamps: readonly StyledPartStamp[], styles: PartStyles, baseOf?: (element: StyledPartEl) => PartStyleBase, styleKeyOf?: (partKey: string) => string, isInline?: (element: StyledPartEl) => boolean, phone?: boolean): number;
117
126
  export declare const PART_PARAGRAPH_ATTR = "data-sf-part-para";
118
127
  export declare const PART_STYLE_PROPERTIES: readonly string[];
119
128
  export declare const SHARED_PART_PROPERTIES: readonly string[];
120
129
  export type PublishedPartRule = {
121
130
  stamp: string;
122
131
  declarations: Record<string, string>;
132
+ phone?: Record<string, string>;
123
133
  };
124
134
  export type PublishedPartSheet = {
125
135
  rules: ReadonlyMap<string, PublishedPartRule>;
@@ -1,2 +1,2 @@
1
- import{FONT_OPTIONS as C,FONT_ROLES as I,fontOption as K,SIZE_STEP_OF_ROLE as G}from"../fonts.js";import{encodePartKey as X}from"./part-key.js";import{decodePartId as M,normalizePartText as S}from"./text-parts.js";import{COLOUR_TOKEN as $}from"../word-styles.js";const b="_partStyles",U="data-sf-part-styled",V=["none","upper","capitalize","lower"],B=[400,500,600,700],Y=["left","center","right","justify"],Z=5,q=1e3,J=-5,Q=10,v=0,tt=64,nt=2,et=120,T=1280,rt=10,H={size:{min:Z,max:q,step:1},padding:{min:v,max:tt,step:nt},width:{min:et,max:T,step:rt}},ot=.05,it=.01,st=["line","letter"],at=.5,ct=2.5,lt=-1,ft=1,ut=0,pt=400,E={none:"none",upper:"uppercase",capitalize:"capitalize",lower:"lowercase"};function g(t){return!t||typeof t!="object"||Array.isArray(t)?null:t}function F(t){return g(t?.[b])??{}}function L(t,n){const e=F(t);return Object.hasOwn(e,n)?g(e[n])??{}:{}}function Gt(t,n){return Object.values(L(t,n)).filter(e=>e!==void 0).length}function z(t,n,e){const r={...F(t)};if(dt(e).length?r[n]=e:delete r[n],!Object.keys(r).length){const{[b]:o,...i}=t;return i}return{...t,[b]:r}}function dt(t){return Object.entries(t).filter(([,n])=>n!==void 0)}function xt(t){return st.includes(t)}const h=(t,n,e)=>Math.min(e,Math.max(n,t));function mt(t,n){if(xt(t)){const e=Math.round(Number(n));return!Number.isFinite(e)||e===0?null:h(e,J,Q)}if(t==="lineHeight"){const e=Number(n);return Number.isFinite(e)?m(h(e,at,ct),3):null}if(t==="letterSpacing"){const e=Number(n);return Number.isFinite(e)?m(h(e,lt,ft),4):null}if(t==="paragraphSpacing"){const e=Math.round(Number(n));return!Number.isFinite(e)||e<=0?null:h(e,ut,pt)}if(Object.hasOwn(H,t)){const{min:e,max:r}=H[t],o=Math.round(Number(n));return Number.isFinite(o)?h(o,e,r):null}return t==="italic"?typeof n=="boolean"?n:null:t==="role"?I.includes(String(n))?n:null:n}const Pt=[["font","role"],["line","lineHeight"],["letter","letterSpacing"]];function gt(t){const n=[];for(const[e,r]of Pt)e===t?n.push(r):r===t&&n.push(e);return n}function Xt(t,n,e,r){const o={...L(t,n)},i=r==null?null:mt(e,r);if(i===null)delete o[e];else{o[e]=i;for(const s of gt(e))delete o[s]}return z(t,n,o)}function Ut(t,n){return z(t,n,{})}function ht(t){for(const n of V)if(E[n]===t)return n;return"none"}function At(t){return!t||!Object.hasOwn(E,t)?"":E[t]}const _t={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 Tt(t){const n=t.role;return n&&I.includes(n)?n:null}const Rt={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 St(t){const n=G[t],e=Rt[n];return e?`var(--size-${n}, ${e})`:`var(--size-${n})`}function bt(t){const n={};return typeof t.lineHeight=="number"?n.lineHeight=t.lineHeight:t.line&&(n.lineHeight=m(Et+t.line*ot,3)),typeof t.letterSpacing=="number"?n.letterSpacingEm=t.letterSpacing:t.letter&&(n.letterSpacingEm=m(t.letter*it,4)),n}const Et=1,A="--sf-part-para";function R(t,n){const e=Tt(t),r=bt(t),o=t.size?`${t.size}px`:e?St(e):"";return{fontFamily:t.font?yt(t.font):e?`var(${_t[e]})`:"",fontWeight:t.weight?String(t.weight):"",fontSize:o,minWidth:o?"0":"",overflowWrap:o?"break-word":"",lineHeight:r.lineHeight!==void 0?String(r.lineHeight):"",letterSpacing:r.letterSpacingEm!==void 0?`${r.letterSpacingEm}em`:"",[A]:t.paragraphSpacing?`${t.paragraphSpacing}px`:"",textTransform:At(t.case),textAlign:t.align??"",paddingTop:N(t.padding),paddingBottom:N(t.padding),maxWidth:N(t.width),color:Nt(t.color),fontStyle:t.italic===!0?"italic":t.italic===!1?"normal":""}}const Nt=t=>t===void 0||t===""?"":Object.hasOwn($,t)?$[t]:j.test(t)?t:"",j=/^#[0-9a-fA-F]{6}$/;function Vt(t){return j.test(t)}const N=t=>t===void 0?"":`${t}px`,m=(t,n)=>Number(t.toFixed(n));function Bt(t,n){const e=Number.parseFloat(t.fontSize)||16,r=Number.parseFloat(t.lineHeight),o=Number.parseFloat(t.letterSpacing),i=Number.parseFloat(t.paddingTop),s=Number.parseFloat(t.maxWidth);return{fontKey:n,sizePx:e,weight:Ot(Number.parseInt(t.fontWeight,10)),lineRatio:Number.isFinite(r)?m(r/e,3):1.2,letterEm:Number.isFinite(o)?m(o/e,4):0,align:wt(t.textAlign),case:ht(t.textTransform),paddingPx:Number.isFinite(i)?Math.round(i):0,widthPx:Number.isFinite(s)&&s<T?Math.round(s):T}}function Ot(t){return Number.isFinite(t)?B.reduce((n,e)=>Math.abs(e-t)<Math.abs(n-t)?e:n):400}function wt(t){for(const n of Y)if(n===t)return n;return t==="end"?"right":"left"}function Yt(t,n){const e=k(t);if(!e)return"";for(const r of C)if(k(n(r.cssVar))===e)return r.key;return""}const k=t=>(t.split(",")[0]??"").replace(/["']/g,"").replace(/\s+/g," ").trim().toLowerCase();function yt(t){const n=K(t);return n?`var(${n.cssVar})`:""}function Zt(t,n,e,r){return!n||M(n)?.nodeId!==t?null:e.find(i=>r(i.getAttribute("class")))??e[0]??null}function qt(t,n,e=()=>_,r=i=>i,o=$t){let i=0;for(const{element:s,partId:a}of t){const l=M(a)?.propKey;if(!l)continue;const c=r(l),f=Object.hasOwn(n,c)?g(n[c])??{}:{},p=R(f,_),u=w.some(x=>s.style[x]);let d=!1;for(const[x,P]of Object.entries(p))Ht(s,x,P),P&&(d=!0);if(u||w.some(x=>p[x]))for(const x of It(s,o))for(const P of w)x.style[P]=p[P]??"";d&&(i+=1)}return i}function It(t,n){const e=S(t.textContent??""),r=[];let o=t;for(let i=0;i<Mt&&n(o);i+=1){const s=o.parentElement;if(!s||S(s.textContent??"")!==e)break;r.push(s),o=s}return r}const Mt=8;function $t(t){const n=t;return typeof window>"u"||!n?.ownerDocument?!1:window.getComputedStyle(n).display==="inline"}const _={fontKey:"",sizePx:16,weight:400,lineRatio:1,letterEm:0,align:"left",case:"none",paddingPx:0,widthPx:T};function Ht(t,n,e){if(!n.startsWith("--")){t.style[n]=e;return}const r=t.style;typeof r.setProperty=="function"?e?r.setProperty(n,e):r.removeProperty?.(n):r[n]=e;const o=t;n===A&&(e?o.setAttribute?.(W,""):o.removeAttribute?.(W))}const W="data-sf-part-para",Ft=Object.keys(R({},_)),O=new Set(["color","overflowWrap",A,"fontStyle"]),w=Ft.filter(t=>!O.has(t));function Jt(t,n,e,r=o=>o){const o=new Map;for(const a of t){const l=X(a.key,a.row);for(const c of a.texts){const f=o.get(c);f?(f.keys.add(a.key),f.partKeys.add(l)):o.set(c,{keys:new Set([a.key]),partKeys:new Set([l])})}}const i=new Map;for(const a of Object.keys(n)){if(!Lt(a))continue;const l=g(n[a])??{},c=R(l,_);Object.values(c).some(Boolean)&&i.set(a,{stamp:D(e,a),declarations:c})}const s=new Map;for(const[a,{keys:l,partKeys:c}]of o){const f=c.size===1?[...c][0]:l.size===1?[...l][0]:null;if(!f)continue;const p=r(f);if(!Object.hasOwn(n,p))continue;const u=g(n[p])??{},d=R(u,_);Object.values(d).some(Boolean)&&s.set(a,{stamp:D(e,f),declarations:d})}return s.size||i.size?{rules:s,kindRules:i,drawn:new Set(o.keys())}:null}function Lt(t){return t.startsWith("@")}function Qt(t,n){return t?.kindRules.get(n)??null}function D(t,n){const e=r=>r.replace(/[^A-Za-z0-9_-]+/g,"-");return`${e(t)}~${e(n)}`}function vt(t){const n=[],e=new Set,r=o=>{const{stamp:i,declarations:s}=o;if(e.has(i))return;e.add(i);const a=Object.entries(s).filter(([,u])=>u!==""),l=u=>u.map(([d,y])=>`${jt(d)}: ${y}`).join("; "),c=`[${U}="${i}"]`,f=a.filter(([u])=>!O.has(u)),p=a.filter(([u])=>O.has(u));f.length&&n.push(`${c}, *:has(> ${c}) { ${l(f)} }`),p.length&&n.push(`${c} { ${l(p)} }`),s[A]&&n.push(...zt(c))};for(const o of t.rules.values())r(o);for(const o of t.kindRules.values())r(o);return n.join(`
2
- `)}function zt(t){const n=`var(${A})`,e=":is([data-sf-bullet], [data-sf-number])";return[`${t} br:not(br + br) { display: block; content: ""; margin-top: ${n} }`,`${t} ${e}:not(:first-child) { margin-top: ${n} }`,`${t} ${e}:not(:last-child) { margin-bottom: ${n} }`]}const jt=t=>t.replace(/[A-Z]/g,n=>`-${n.toLowerCase()}`);function tn(t,n){if(!t)return null;const e=S(n),r=t.rules.get(e);if(r)return r;if(e.length<kt||t.drawn.has(e))return null;let o=null;for(const[i,s]of t.rules)if(i.includes(e)){if(o&&o.stamp!==s.stamp)return null;o=s}return o}const kt=8;export{Y as PART_ALIGNS,V as PART_CASES,ft as PART_LETTER_EM_MAX,lt as PART_LETTER_EM_MIN,it as PART_LETTER_STEP,ct as PART_LINE_HEIGHT_MAX,at as PART_LINE_HEIGHT_MIN,ot as PART_LINE_STEP,H as PART_MEASURED_TRACKS,Q as PART_NUDGE_MAX,J as PART_NUDGE_MIN,tt as PART_PADDING_MAX,v as PART_PADDING_MIN,nt as PART_PADDING_STEP,W as PART_PARAGRAPH_ATTR,pt as PART_PARAGRAPH_MAX,ut as PART_PARAGRAPH_MIN,A as PART_PARAGRAPH_VAR,st as PART_RELATIVE_PROPS,q as PART_SIZE_MAX,Z as PART_SIZE_MIN,U as PART_STYLED_ATTR,b as PART_STYLES_PROP,Ft as PART_STYLE_PROPERTIES,B as PART_WEIGHTS,T as PART_WIDTH_MAX,et as PART_WIDTH_MIN,rt as PART_WIDTH_STEP,w as SHARED_PART_PROPERTIES,qt as applyPartStyles,Vt as isHexColour,Lt as isPartKindKey,zt as paragraphRules,ht as partCaseOfTransform,At as partCaseTransform,Yt as partFontKeyOf,Qt as partRuleForKind,tn as partRuleForText,bt as partSpacingOf,Bt as partStyleBase,Gt as partStyleCount,vt as partStyleCss,R as partStyleDeclarations,Zt as partStyleSource,Xt as propsWithPartStyleValue,Ut as propsWithoutPartStyle,Jt as publishedPartStyles,L as readPartStyle,F as readPartStyles};
1
+ import{FONT_OPTIONS as U,FONT_ROLES as $,fontOption as V,SIZE_STEP_OF_ROLE as B}from"../fonts.js";import{encodePartKey as Y}from"./part-key.js";import{decodePartId as M,normalizePartText as b}from"./text-parts.js";import{COLOUR_TOKEN as H}from"../word-styles.js";const E="_partStyles",Z="data-sf-part-styled",q=["none","upper","capitalize","lower"],J=[400,500,600,700],Q=["left","center","right","justify"],F=5,z=1e3,v=-5,tt=10,et=0,nt=64,rt=2,ot=120,T=1280,it=10,L={size:{min:F,max:z,step:1},sizePhone:{min:F,max:z,step:1},padding:{min:et,max:nt,step:rt},width:{min:ot,max:T,step:it}},st=.05,ct=.01,at=["line","letter"],lt=.5,ft=2.5,ut=-1,pt=1,dt=0,xt=400,O={none:"none",upper:"uppercase",capitalize:"capitalize",lower:"lowercase"};function g(t){return!t||typeof t!="object"||Array.isArray(t)?null:t}function j(t){return g(t?.[E])??{}}function k(t,e){const n=j(t);return Object.hasOwn(n,e)?g(n[e])??{}:{}}function Bt(t,e){return Object.values(k(t,e)).filter(n=>n!==void 0).length}function W(t,e,n){const r={...j(t)};if(ht(n).length?r[e]=n:delete r[e],!Object.keys(r).length){const{[E]:o,...s}=t;return s}return{...t,[E]:r}}function ht(t){return Object.entries(t).filter(([,e])=>e!==void 0)}function mt(t){return at.includes(t)}const _=(t,e,n)=>Math.min(n,Math.max(e,t));function Pt(t,e){if(mt(t)){const n=Math.round(Number(e));return!Number.isFinite(n)||n===0?null:_(n,v,tt)}if(t==="lineHeight"){const n=Number(e);return Number.isFinite(n)?m(_(n,lt,ft),3):null}if(t==="letterSpacing"){const n=Number(e);return Number.isFinite(n)?m(_(n,ut,pt),4):null}if(t==="paragraphSpacing"){const n=Math.round(Number(e));return!Number.isFinite(n)||n<=0?null:_(n,dt,xt)}if(Object.hasOwn(L,t)){const{min:n,max:r}=L[t],o=Math.round(Number(e));return Number.isFinite(o)?_(o,n,r):null}return t==="italic"?typeof e=="boolean"?e:null:t==="role"?$.includes(String(e))?e:null:e}const gt=[["font","role"],["line","lineHeight"],["letter","letterSpacing"]];function _t(t){const e=[];for(const[n,r]of gt)n===t?e.push(r):r===t&&e.push(n);return e}function Yt(t,e,n,r){const o={...k(t,e)},s=r==null?null:Pt(n,r);if(s===null)delete o[n];else{o[n]=s;for(const i of _t(n))delete o[i]}return W(t,e,o)}function Zt(t,e){return W(t,e,{})}function At(t){for(const e of q)if(O[e]===t)return e;return"none"}function St(t){return!t||!Object.hasOwn(O,t)?"":O[t]}const Tt={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 Rt(t){const e=t.role;return e&&$.includes(e)?e:null}const bt={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 Et(t){const e=B[t],n=bt[e];return n?`var(--size-${e}, ${n})`:`var(--size-${e})`}function Ot(t){const e={};return typeof t.lineHeight=="number"?e.lineHeight=t.lineHeight:t.line&&(e.lineHeight=m(Nt+t.line*st,3)),typeof t.letterSpacing=="number"?e.letterSpacingEm=t.letterSpacing:t.letter&&(e.letterSpacingEm=m(t.letter*ct,4)),e}const Nt=1,A="--sf-part-para",wt="(max-width: 719.98px)";function D(t){return typeof t.sizePhone=="number"&&t.sizePhone>0?{fontSize:`${t.sizePhone}px`}:{}}function yt(t,e){return e&&typeof t.sizePhone=="number"&&t.sizePhone>0?{...t,size:t.sizePhone}:t}function R(t,e){const n=Rt(t),r=Ot(t),o=t.size?`${t.size}px`:n?Et(n):"";return{fontFamily:t.font?Ht(t.font):n?`var(${Tt[n]})`:"",fontWeight:t.weight?String(t.weight):"",fontSize:o,minWidth:o?"0":"",overflowWrap:o?"break-word":"",lineHeight:r.lineHeight!==void 0?String(r.lineHeight):"",letterSpacing:r.letterSpacingEm!==void 0?`${r.letterSpacingEm}em`:"",[A]:t.paragraphSpacing?`${t.paragraphSpacing}px`:"",textTransform:St(t.case),textAlign:t.align??"",paddingTop:N(t.padding),paddingBottom:N(t.padding),maxWidth:N(t.width),color:It(t.color),fontStyle:t.italic===!0?"italic":t.italic===!1?"normal":""}}const It=t=>t===void 0||t===""?"":Object.hasOwn(H,t)?H[t]:C.test(t)?t:"",C=/^#[0-9a-fA-F]{6}$/;function qt(t){return C.test(t)}const N=t=>t===void 0?"":`${t}px`,m=(t,e)=>Number(t.toFixed(e));function Jt(t,e){const n=Number.parseFloat(t.fontSize)||16,r=Number.parseFloat(t.lineHeight),o=Number.parseFloat(t.letterSpacing),s=Number.parseFloat(t.paddingTop),i=Number.parseFloat(t.maxWidth);return{fontKey:e,sizePx:n,weight:$t(Number.parseInt(t.fontWeight,10)),lineRatio:Number.isFinite(r)?m(r/n,3):1.2,letterEm:Number.isFinite(o)?m(o/n,4):0,align:Mt(t.textAlign),case:At(t.textTransform),paddingPx:Number.isFinite(s)?Math.round(s):0,widthPx:Number.isFinite(i)&&i<T?Math.round(i):T}}function $t(t){return Number.isFinite(t)?J.reduce((e,n)=>Math.abs(n-t)<Math.abs(e-t)?n:e):400}function Mt(t){for(const e of Q)if(e===t)return e;return t==="end"?"right":"left"}function Qt(t,e){const n=K(t);if(!n)return"";for(const r of U)if(K(e(r.cssVar))===n)return r.key;return""}const K=t=>(t.split(",")[0]??"").replace(/["']/g,"").replace(/\s+/g," ").trim().toLowerCase();function Ht(t){const e=V(t);return e?`var(${e.cssVar})`:""}function vt(t,e,n,r){return!e||M(e)?.nodeId!==t?null:n.find(s=>r(s.getAttribute("class")))??n[0]??null}function te(t,e,n=()=>S,r=i=>i,o=Lt,s=!1){let i=0;for(const{element:c,partId:f}of t){const a=M(f)?.propKey;if(!a)continue;const l=r(a),x=Object.hasOwn(e,l)?g(e[l])??{}:{},p=R(yt(x,s),S),u=y.some(h=>c.style[h]);let d=!1;for(const[h,P]of Object.entries(p))jt(c,h,P),P&&(d=!0);if(u||y.some(h=>p[h]))for(const h of Ft(c,o))for(const P of y)h.style[P]=p[P]??"";d&&(i+=1)}return i}function Ft(t,e){const n=b(t.textContent??""),r=[];let o=t;for(let s=0;s<zt&&e(o);s+=1){const i=o.parentElement;if(!i||b(i.textContent??"")!==n)break;r.push(i),o=i}return r}const zt=8;function Lt(t){const e=t;return typeof window>"u"||!e?.ownerDocument?!1:window.getComputedStyle(e).display==="inline"}const S={fontKey:"",sizePx:16,weight:400,lineRatio:1,letterEm:0,align:"left",case:"none",paddingPx:0,widthPx:T};function jt(t,e,n){if(!e.startsWith("--")){t.style[e]=n;return}const r=t.style;typeof r.setProperty=="function"?n?r.setProperty(e,n):r.removeProperty?.(e):r[e]=n;const o=t;e===A&&(n?o.setAttribute?.(G,""):o.removeAttribute?.(G))}const G="data-sf-part-para",kt=Object.keys(R({},S)),w=new Set(["color","overflowWrap",A,"fontStyle"]),y=kt.filter(t=>!w.has(t));function ee(t,e,n,r=o=>o){const o=new Map;for(const c of t){const f=Y(c.key,c.row);for(const a of c.texts){const l=o.get(a);l?(l.keys.add(c.key),l.partKeys.add(f)):o.set(a,{keys:new Set([c.key]),partKeys:new Set([f])})}}const s=new Map;for(const c of Object.keys(e)){if(!Wt(c))continue;const f=g(e[c])??{},a=R(f,S),l=D(f);!Object.values(a).some(Boolean)&&!Object.keys(l).length||s.set(c,{stamp:X(n,c),declarations:a,...Object.keys(l).length?{phone:l}:{}})}const i=new Map;for(const[c,{keys:f,partKeys:a}]of o){const l=a.size===1?[...a][0]:f.size===1?[...f][0]:null;if(!l)continue;const x=r(l);if(!Object.hasOwn(e,x))continue;const p=g(e[x])??{},u=R(p,S),d=D(p);!Object.values(u).some(Boolean)&&!Object.keys(d).length||i.set(c,{stamp:X(n,l),declarations:u,...Object.keys(d).length?{phone:d}:{}})}return i.size||s.size?{rules:i,kindRules:s,drawn:new Set(o.keys())}:null}function Wt(t){return t.startsWith("@")}function ne(t,e){return t?.kindRules.get(e)??null}function X(t,e){const n=r=>r.replace(/[^A-Za-z0-9_-]+/g,"-");return`${n(t)}~${n(e)}`}function re(t){const e=[],n=new Set,r=o=>{const{stamp:s,declarations:i}=o;if(n.has(s))return;n.add(s);const c=Object.entries(i).filter(([,u])=>u!==""),f=u=>u.map(([d,I])=>`${Ct(d)}: ${I}`).join("; "),a=`[${Z}="${s}"]`,l=c.filter(([u])=>!w.has(u)),x=c.filter(([u])=>w.has(u));l.length&&e.push(`${a}, *:has(> ${a}) { ${f(l)} }`),x.length&&e.push(`${a} { ${f(x)} }`),i[A]&&e.push(...Dt(a));const p=Object.entries(o.phone??{}).filter(([,u])=>u!=="");p.length&&e.push(`@media ${wt} { ${a}, *:has(> ${a}) { ${f(p)} } }`)};for(const o of t.rules.values())r(o);for(const o of t.kindRules.values())r(o);return e.join(`
2
+ `)}function Dt(t){const e=`var(${A})`,n=":is([data-sf-bullet], [data-sf-number])";return[`${t} br:not(br + br) { display: block; content: ""; margin-top: ${e} }`,`${t} ${n}:not(:first-child) { margin-top: ${e} }`,`${t} ${n}:not(:last-child) { margin-bottom: ${e} }`]}const Ct=t=>t.replace(/[A-Z]/g,e=>`-${e.toLowerCase()}`);function oe(t,e){if(!t)return null;const n=b(e),r=t.rules.get(n);if(r)return r;if(n.length<Kt||t.drawn.has(n))return null;let o=null;for(const[s,i]of t.rules)if(s.includes(n)){if(o&&o.stamp!==i.stamp)return null;o=i}return o}const Kt=8;export{Q as PART_ALIGNS,q as PART_CASES,pt as PART_LETTER_EM_MAX,ut as PART_LETTER_EM_MIN,ct as PART_LETTER_STEP,ft as PART_LINE_HEIGHT_MAX,lt as PART_LINE_HEIGHT_MIN,st as PART_LINE_STEP,L as PART_MEASURED_TRACKS,tt as PART_NUDGE_MAX,v as PART_NUDGE_MIN,nt as PART_PADDING_MAX,et as PART_PADDING_MIN,rt as PART_PADDING_STEP,G as PART_PARAGRAPH_ATTR,xt as PART_PARAGRAPH_MAX,dt as PART_PARAGRAPH_MIN,A as PART_PARAGRAPH_VAR,wt as PART_PHONE_MAX_CSS,at as PART_RELATIVE_PROPS,z as PART_SIZE_MAX,F as PART_SIZE_MIN,Z as PART_STYLED_ATTR,E as PART_STYLES_PROP,kt as PART_STYLE_PROPERTIES,J as PART_WEIGHTS,T as PART_WIDTH_MAX,ot as PART_WIDTH_MIN,it as PART_WIDTH_STEP,y as SHARED_PART_PROPERTIES,te as applyPartStyles,qt as isHexColour,Wt as isPartKindKey,Dt as paragraphRules,At as partCaseOfTransform,St as partCaseTransform,Qt as partFontKeyOf,D as partPhoneDeclarations,ne as partRuleForKind,oe as partRuleForText,Ot as partSpacingOf,Jt as partStyleBase,Bt as partStyleCount,re as partStyleCss,R as partStyleDeclarations,yt as partStyleForScreen,vt as partStyleSource,Yt as propsWithPartStyleValue,Zt as propsWithoutPartStyle,ee as publishedPartStyles,k as readPartStyle,j as readPartStyles};
@@ -4,6 +4,15 @@ import { type PartRow } from "./part-rows.js";
4
4
  export declare const PART_ATTR = "data-sf-part";
5
5
  export declare const PART_SELECTED_ATTR = "data-sf-part-selected";
6
6
  export declare const PART_KIND_ATTR = "data-sf-part-kind";
7
+ export declare const PART_STYLE_OWNER_ATTR = "data-sf-part-style-owner";
8
+ export declare const PART_STYLE_KIND_ATTR = "data-sf-part-style-kind";
9
+ export declare function partStyleOwnerOf(element: {
10
+ getAttribute(name: string): string | null;
11
+ readonly parentElement: unknown;
12
+ } | null): {
13
+ owner: string;
14
+ kind: string;
15
+ } | null;
7
16
  export type PartNeedle = {
8
17
  key: string;
9
18
  label: string;
@@ -1 +1 @@
1
- import{decodePartId as T,encodePartId as L}from"./part-id.js";import{stripMarkup as y}from"../markup.js";import{LINK_FIELD_MARKER as h,SCAFFOLD_FIELD_MARKER as b,TEXT_FIELD_MARKER as u}from"./field-markers.js";import{readHidable as R}from"./hidable.js";import{SCALAR_TEXT_CONTROLS as g}from"./text-control-kinds.js";import{isStructuralTextProp as A}from"./neutralization-contracts.js";import{fieldInOwnBox as P}from"./own-box.js";import{partRowTexts as j}from"./part-rows.js";const X="data-sf-part",B="data-sf-part-selected",H="data-sf-part-kind",_=2;function Y(t,e){if(!t)return!1;const r=T(t);return!!r?.propKey&&r.nodeId===e}function w(t){return y(t).replace(/\s+/gu,"")}function x(t,e,r){const n=t[u];if(n){if(n.control==="textList"){const o=n.itemKey??"text";if(!Array.isArray(e))return;for(const i of e){const c=i?.[o];typeof c=="string"&&r.push(c)}return}const{text:s}=R(e);s?r.push(s):n.placeholder&&r.push(n.placeholder);return}if(!t[h]){if(t.type==="text"||t.type==="textarea"){typeof e=="string"&&e&&r.push(e);return}if(t.arrayFields&&Array.isArray(e)){for(const s of e)for(const[o,i]of Object.entries(t.arrayFields))x(i,s?.[o],r);return}if(t.objectFields&&e&&typeof e=="object")for(const[s,o]of Object.entries(t.objectFields))x(o,e[s],r)}}function q(t){if(!t||typeof t!="object")return!1;const e=t;return e[h]?!1:!!e[u]||e.type==="text"||e.type==="textarea"}function E(t,e){const r=t[u];return r?.label?r.label:typeof t.label=="string"?t.label:e}function F(t){const e=t.indexOf(" (");return(e>0?t.slice(0,e):t).trim()}function G(t,e){if(!t)return[];const r=[];for(const[n,s]of Object.entries(t)){if(!s||typeof s!="object"||A(n))continue;const o=s,i=[];x(o,e?.[n],i),!i.length&&o[b]!==void 0&&x(o,o[b],i);const c=E(o,n),a=new Set;for(const{row:m,text:f}of j(o,e?.[n])){const d=w(f);d.length<_||(a.add(d),r.push({key:n,label:c,texts:[d],row:m}))}const p=new Set(a),l=[];for(const m of i){const f=w(m);f.length<_||p.has(f)||(p.add(f),l.push(f))}l.length&&r.push({key:n,label:c,texts:l})}return r}const I=g;function O(t,e){if(!e||typeof e!="object"||A(t)||P(e))return null;const r=e[u];return!r||!I.includes(r.control)?null:r}function J(t,e){const r=O(t,e);return r!==null&&r.identifier!==!0}function Q(t,e){if(!t)return[];const r=[];for(const[n,s]of Object.entries(t)){const o=O(n,s);if(!o)continue;const{text:i,hidden:c}=R(e?.[n]),a=i||o.placeholder||"",p=y(a).replace(/\s+/gu," ").trim();r.push({key:n,label:F(E(s,n)),preview:p,offPage:o.offPage===!0,identifier:o.identifier===!0,hidden:!!c})}return r}export{X as PART_ATTR,H as PART_KIND_ATTR,B as PART_SELECTED_ATTR,T as decodePartId,L as encodePartId,O as entryPartMetaOf,J as fieldDrawsEntryRow,q as holdsAuthoredText,w as normalizePartText,F as partHeadLabel,E as partLabel,G as partNeedles,Y as partOpenOn,Q as sectionTextParts};
1
+ import{decodePartId as m,encodePartId as g}from"./part-id.js";import{stripMarkup as y}from"../markup.js";import{LINK_FIELD_MARKER as A,SCAFFOLD_FIELD_MARKER as R,TEXT_FIELD_MARKER as u}from"./field-markers.js";import{readHidable as b}from"./hidable.js";import{SCALAR_TEXT_CONTROLS as L}from"./text-control-kinds.js";import{isStructuralTextProp as _}from"./neutralization-contracts.js";import{fieldInOwnBox as P}from"./own-box.js";import{partRowTexts as S}from"./part-rows.js";const B="data-sf-part",H="data-sf-part-selected",W="data-sf-part-kind",j="data-sf-part-style-owner",I="data-sf-part-style-kind";function q(e){for(let t=e;t;t=t.parentElement){const r=t.getAttribute(j),n=t.getAttribute(I);if(r&&n)return{owner:r,kind:n};if(t.getAttribute("data-puck-component"))return null}return null}const h=2;function G(e,t){if(!e)return!1;const r=m(e);return!!r?.propKey&&r.nodeId===t}function E(e){return y(e).replace(/\s+/gu,"")}function l(e,t,r){const n=e[u];if(n){if(n.control==="textList"){const o=n.itemKey??"text";if(!Array.isArray(t))return;for(const i of t){const c=i?.[o];typeof c=="string"&&r.push(c)}return}const{text:s}=b(t);s?r.push(s):n.placeholder&&r.push(n.placeholder);return}if(!e[A]){if(e.type==="text"||e.type==="textarea"){typeof t=="string"&&t&&r.push(t);return}if(e.arrayFields&&Array.isArray(t)){for(const s of t)for(const[o,i]of Object.entries(e.arrayFields))l(i,s?.[o],r);return}if(e.objectFields&&t&&typeof t=="object")for(const[s,o]of Object.entries(e.objectFields))l(o,t[s],r)}}function J(e){if(!e||typeof e!="object")return!1;const t=e;return t[A]?!1:!!t[u]||t.type==="text"||t.type==="textarea"}function w(e,t){const r=e[u];return r?.label?r.label:typeof e.label=="string"?e.label:t}function F(e){const t=e.indexOf(" (");return(t>0?e.slice(0,t):e).trim()}function Q(e,t){if(!e)return[];const r=[];for(const[n,s]of Object.entries(e)){if(!s||typeof s!="object"||_(n))continue;const o=s,i=[];l(o,t?.[n],i),!i.length&&o[R]!==void 0&&l(o,o[R],i);const c=w(o,n),a=new Set;for(const{row:d,text:f}of S(o,t?.[n])){const T=E(f);T.length<h||(a.add(T),r.push({key:n,label:c,texts:[T],row:d}))}const p=new Set(a),x=[];for(const d of i){const f=E(d);f.length<h||p.has(f)||(p.add(f),x.push(f))}x.length&&r.push({key:n,label:c,texts:x})}return r}const K=L;function O(e,t){if(!t||typeof t!="object"||_(e)||P(t))return null;const r=t[u];return!r||!K.includes(r.control)?null:r}function U(e,t){const r=O(e,t);return r!==null&&r.identifier!==!0}function V(e,t){if(!e)return[];const r=[];for(const[n,s]of Object.entries(e)){const o=O(n,s);if(!o)continue;const{text:i,hidden:c}=b(t?.[n]),a=i||o.placeholder||"",p=y(a).replace(/\s+/gu," ").trim();r.push({key:n,label:F(w(s,n)),preview:p,offPage:o.offPage===!0,identifier:o.identifier===!0,hidden:!!c})}return r}export{B as PART_ATTR,W as PART_KIND_ATTR,H as PART_SELECTED_ATTR,I as PART_STYLE_KIND_ATTR,j as PART_STYLE_OWNER_ATTR,m as decodePartId,g as encodePartId,O as entryPartMetaOf,U as fieldDrawsEntryRow,J as holdsAuthoredText,E as normalizePartText,F as partHeadLabel,w as partLabel,Q as partNeedles,G as partOpenOn,q as partStyleOwnerOf,V as sectionTextParts};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "efficient-web-builder",
3
- "version": "17.0.1",
3
+ "version": "17.1.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",