efficient-web-builder 72.0.0 → 73.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +29 -0
- package/dist/editor/components/AddPageWindow.js +1 -1
- package/dist/editor/components/MediaUploadField.d.ts +2 -1
- package/dist/editor/components/PageStarterCard.js +1 -1
- package/dist/editor/components/SideSpaceField.d.ts +3 -0
- package/dist/editor/components/SideSpaceField.js +1 -1
- package/dist/editor/components/storefront-editor.css +9 -19
- package/dist/editor/lib/content/site-length-rows.js +1 -1
- package/dist/editor/lib/document/blocks/hero-shared-fields.js +1 -1
- package/dist/editor/lib/document/controls.d.ts +4 -2
- package/dist/editor/lib/document/controls.js +1 -1
- package/dist/editor/lib/document/shape-picker.d.ts +16 -8
- package/dist/editor/lib/document/shape-picker.js +1 -1
- package/dist/editor/lib/document/show-when-resolve.js +1 -1
- package/dist/format/lib/content/box-shape.d.ts +2 -1
- package/dist/format/lib/content/box-shape.js +1 -1
- package/dist/format/lib/content/css-length.d.ts +2 -3
- package/dist/format/lib/content/css-length.js +1 -1
- package/dist/format/lib/content/gallery-card-layout.d.ts +22 -1
- package/dist/format/lib/content/gallery-card-layout.js +1 -1
- package/dist/format/lib/content/grid-span.d.ts +15 -2
- package/dist/format/lib/content/grid-span.js +1 -1
- package/dist/format/lib/content/image-aspect.d.ts +5 -3
- package/dist/format/lib/content/image-aspect.js +1 -1
- package/dist/format/lib/content/page-width.d.ts +3 -0
- package/dist/format/lib/content/page-width.js +1 -1
- package/dist/format/lib/content/section-min-height.js +1 -1
- package/dist/format/lib/content/view-hide-class.js +1 -1
- package/dist/format/lib/content/view-tier.d.ts +2 -2
- package/dist/format/lib/document/style-text.d.ts +1 -0
- package/dist/format/lib/document/style-text.js +1 -0
- package/dist/format/lib/editor-words-catalogue.d.ts +3 -0
- package/dist/format/lib/editor-words-catalogue.js +1 -1
- package/dist/format/lib/site-twin-row.d.ts +2 -1
- package/dist/render/components/Flex.js +1 -1
- package/dist/render/components/ImageBlock.js +1 -1
- package/dist/render/components/PublishedPartStylesContext.js +1 -1
- package/dist/render/lib/content/section-padding.d.ts +2 -1
- package/dist/render/lib/document/blocks/general/CustomHTML/render.js +1 -1
- package/dist/render/lib/document/custom-css.d.ts +7 -0
- package/dist/render/lib/document/custom-css.js +2 -0
- package/dist/render/lib/document/part-styles.d.ts +2 -2
- package/dist/render/lib/document/passes/cell-width.js +1 -1
- package/dist/render/lib/document/render-registry.js +1 -1
- package/package.json +9 -5
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,34 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## 73.0.0 - 2026-11-19
|
|
4
|
+
|
|
5
|
+
From main at `e3945738`: #792, #793, #798, #800, #801, #802, #803.
|
|
6
|
+
|
|
7
|
+
A major: the `efficient-easel` peer moves to `^37.0.0` and `efficient-shell` to `^13.24.1`; two new peers, `postcss` and `postcss-selector-parser`; a Custom HTML section's own `<style>` is limited to that section. No stored key or value moves.
|
|
8
|
+
|
|
9
|
+
### BREAKING
|
|
10
|
+
|
|
11
|
+
- **`efficient-easel` peer `^36.0.0` -> `^37.0.0`**: the left panel's toggle is back in the top bar (left of Undo); `AddSidePanel` loses `onHide`; the rail's geometry is shell tokens (`railTokens.railWidth` is a `calc()` of `--row-height-menu` and `--space-4`). (#803)
|
|
12
|
+
- **`efficient-shell` peer `^13.17.0` -> `^13.24.1`**: easel 37 needs the shell's `IconRail` 8px gap (13.23.1+); 13.24.1 carries the popup close-cross fix. (#803)
|
|
13
|
+
- **New peers `postcss ^8.5.33` and `postcss-selector-parser ^7.2.1`**: the Custom HTML section limits its CSS with them. (#793)
|
|
14
|
+
- **A Custom HTML section's `<style>` is limited to the section.** Every selector is prefixed with the block's own scope `[data-sf-custom-html="<block id>"]`; a leading `html`, `body`, `:root` or `*` becomes the section root; a rule that would reach past the section is dropped; nested style rules are dropped; `@keyframes` names take the block id. Live check before release: 0 Custom HTML sections with `<style>` on the US sites (1378 blocks, draft and published). (#793)
|
|
15
|
+
|
|
16
|
+
**For hosts:**
|
|
17
|
+
- Install `efficient-easel` 37.0.0, `efficient-shell` 13.24.1 or later, `postcss` and `postcss-selector-parser` with this release.
|
|
18
|
+
- efficient-storefront-blocks: raise its `efficient-web-builder` range to `^73.0.0` and add `postcss` and `postcss-selector-parser` as dev dependencies with the peer ranges. efficient-storefront: declare both (it already has `postcss` through Tailwind).
|
|
19
|
+
- Drop any host code that passes `onHide` to `AddSidePanel`.
|
|
20
|
+
|
|
21
|
+
### Added
|
|
22
|
+
|
|
23
|
+
- **A host slot offers positions to its tiles.** A host block names a slot in its meta (`positionSlots`); a Box in that slot is a cell of the host's grid with span rows, an "At card" place (`--sf-tile-at`) and its own phone Positions and Rows tall. Nothing stored draws different bytes. (#792)
|
|
24
|
+
- **Custom W:H in the one shape table.** Box shape, Image aspect ratio and Hero height take a custom ratio stored as text (`"45/28"`) in the key each row already writes; a ratio equal to a table line stores that line's value. (#801)
|
|
25
|
+
- **Site styles Side space in px has no upper limit.** The slider track still ends at 80 px; a typed number goes past it. A px side space past the track draws as `min(<value>px, 25vw)`. Saves past 80 need efficient-backend#5030; until then the backend refuses them as before. (#802)
|
|
26
|
+
|
|
27
|
+
### Fixed
|
|
28
|
+
|
|
29
|
+
- **The Add page window draws with the shell's parts** (`Title`, `Paragraph`, `LoadingSpinner`, `Card`, `Text`, `--motion-fast`). No words change. (#800)
|
|
30
|
+
- **The view tier names come from easel** (`ViewTier`, `VIEW_TIERS`) in place of local copies; `SiteRowView`, `PartScreen` and `ViewTierName` stay as aliases. A new guard refuses a restated tier list. (#798)
|
|
31
|
+
|
|
3
32
|
## 72.0.0 - 2026-11-18
|
|
4
33
|
|
|
5
34
|
From main at `58477c36`: #794, #795.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use client";import{jsx as a,jsxs as g}from"react/jsx-runtime";import{useEffect as
|
|
1
|
+
"use client";import{jsx as a,jsxs as g}from"react/jsx-runtime";import{useEffect as G,useId as W,useMemo as q,useRef as z,useState as h}from"react";import{useScreenDocument as H}from"efficient-easel/screen/components/ScreenDocumentContext";import{useEaselSession as O}from"efficient-easel/screen/lib/session-context";import{uniqueSlug as I}from"efficient-easel/page-copy";import{AddIcon as V}from"efficient-easel/icons";import{Dialog as J,EmptyState as K,Grid as Q,LoadingSpinner as U,Paragraph as X,SidebarActionButton as Y,SidebarLayout as Z,SidebarNavItem as S,Title as $,toast as T}from"efficient-shell/ui";import ee from"./PageStarterCard.js";import{useHostConfig as te}from"../lib/document/host-config.js";import{useSiteWidthsMetadata as ae}from"../lib/document/overrides.js";import{say as t}from"../../format/lib/editor-words.js";import{ALL_STARTERS as i,TEMPLATE_STARTERS as w,shownLibraryGroups as re,startersIn as se,templateStarters as oe}from"../../format/lib/page-starters.js";import{backendOf as ne}from"../lib/website-session.js";function ie({open:l,onClose:x,takenSlugs:b,onCreated:L}){const N=O(),{adapter:d,siteId:c,templateId:R}=H(),r=ne(N).pages,y=!R&&!!(r.starters&&r.createFromStarter),u=q(()=>c?{siteId:c}:{},[c]),j=te(),B=ae(),[k,s]=h(null),[o,n]=h(i),[m,v]=h(null),C=z(null),A=W();G(()=>{if(!l)return;if(n(i),!y){s([]);return}let e=!0;return s(null),r.starters(u).then(f=>e&&s(f),()=>{e&&(s([]),T.error(t("Couldn’t load the pages — please retry.")))}),()=>{e=!1}},[l,y,r,u]);const P=async(e,f)=>{if(!m){v(e);try{L(await f())}catch{T.error(t("Couldn’t add the page — please retry."))}finally{v(null)}}},F=()=>{if(!d.createPage)return;const e=t("New page");P("blank",()=>d.createPage({slug:I(e,b),title:e,layout:{}}))},M=e=>{P(e.id,()=>r.createFromStarter(e.id,{title:e.title,slug:I(e.slug,b),...u}))},p=k??[],_=re(p),E=se(o,p),D=g("nav",{"aria-label":t("Pages"),className:"sf-add-page-nav",children:[a(S,{label:t("All pages"),active:o===i,onClick:()=>n(i)}),_.map(e=>a(S,{label:t(e.label),active:o===e.key,onClick:()=>n(e.key)},e.key)),oe(p).length>0?a("div",{className:"sf-add-page-group",children:a(S,{label:t("From your template"),active:o===w,onClick:()=>n(w)})}):null]});return a(J,{open:l,onClose:x,size:"full",title:t("Add page"),initialFocus:C,children:a(Z,{sidebarTop:g(Y,{onClick:F,disabled:!d.createPage||m!==null,children:[a(V,{"aria-hidden":!0}),t("Blank page")]}),sidebar:D,children:g("div",{ref:C,tabIndex:-1,role:"region","aria-labelledby":A,className:"sf-add-page",children:[a($,{id:A,level:2,as:"h3",children:t("Pages for your site")}),a(X,{tone:"default",className:"sf-add-page-sub",children:t("Choose a page and change the text, images and more.")}),k===null?a(U,{label:t("Loading…")}):E.length===0?a(K,{title:t("No pages to start from"),description:t("Start with a blank page, then add sections.")}):a(Q,{cols:1,smCols:2,lgCols:3,gap:8,children:E.map(e=>a(ee,{starter:e,config:j,metadata:B,busy:m===e.id,onAdd:M},e.id))})]})})})}export{ie as default};
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { type ViewTier } from "efficient-easel/draw";
|
|
1
2
|
import { usePreviewDevice } from "efficient-easel/draw/client";
|
|
2
3
|
import { type MediaValue } from "../../format/lib/media-value.js";
|
|
3
4
|
interface Props {
|
|
@@ -7,7 +8,7 @@ interface Props {
|
|
|
7
8
|
accept: string;
|
|
8
9
|
placeholder?: string;
|
|
9
10
|
focusKey?: string;
|
|
10
|
-
focusWhen?: (props: Record<string, unknown>, view:
|
|
11
|
+
focusWhen?: (props: Record<string, unknown>, view: ViewTier) => boolean;
|
|
11
12
|
frameKey?: string;
|
|
12
13
|
fieldKey?: string;
|
|
13
14
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use client";import{jsx as e,jsxs as o}from"react/jsx-runtime";import{useMemo as p,useState as h}from"react";import{CanvasFrame as
|
|
1
|
+
"use client";import{jsx as e,jsxs as o}from"react/jsx-runtime";import{useMemo as p,useState as h}from"react";import{CanvasFrame as g}from"efficient-easel/easel";import{Button as v,Card as y,FitFrame as C,Text as S}from"efficient-shell/ui";import x from"./PreviewThemeFrame.js";import D from"../../render/lib/document/page-render.js";import{SiteThemeCarrier as N,suppressPreviewNav as F}from"../lib/document/page-root.js";import{useEditorCanvasStyles as T}from"../lib/editor-canvas-styles.js";import{say as i}from"../../format/lib/editor-words.js";import{firstSectionOf as b}from"../../format/lib/page-starters.js";const j=1440,z=1080;function A({starter:t,config:a,metadata:n,busy:s,onAdd:d}){const{mirrorHostStyles:m}=T(),[l,c]=h(null),f=p(()=>{const r=b(t.layout),u=t.layout.zones;return{root:{props:{}},content:r?[r]:[],zones:u??{}}},[t.layout]);return o("div",{className:"sf-starter",children:[o(y,{padding:"none",className:"sf-starter-picture",children:[e("div",{inert:!0,className:"sf-starter-frame",children:e(C,{width:j,height:z,children:e(g,{id:`page-starter-${t.id}`,title:t.title,mirrorStyles:m,onDocument:c,height:"fill",children:e(x,{document:l??void 0,children:e(N,{onClickCapture:F,body:r=>e("div",{className:"sf-themed-content",style:r,children:e("div",{style:{background:"var(--bg)"},children:e(D,{config:a,data:f,metadata:n})})})})})})})}),e("div",{className:"sf-starter-add",children:e(v,{onClick:()=>d(t),loading:s,"aria-label":i("Add “{name}”",{name:t.title}),children:i("Add page")})})]}),e(S,{size:"sm",children:t.title})]})}export{A as default};
|
|
@@ -15,6 +15,7 @@ export declare function sideSpaceRow(device: SiteRowView, site: {
|
|
|
15
15
|
readonly max: 80;
|
|
16
16
|
readonly step: 4;
|
|
17
17
|
readonly default: 40;
|
|
18
|
+
readonly typedMax: number;
|
|
18
19
|
};
|
|
19
20
|
} | {
|
|
20
21
|
key: "site_gutter_phone";
|
|
@@ -24,6 +25,7 @@ export declare function sideSpaceRow(device: SiteRowView, site: {
|
|
|
24
25
|
readonly min: 0;
|
|
25
26
|
readonly max: 24;
|
|
26
27
|
readonly step: 4;
|
|
28
|
+
readonly typedMax: number;
|
|
27
29
|
};
|
|
28
30
|
} | null;
|
|
29
31
|
export default function SideSpaceField({ value, onChange, unsetPx, bounds, length, restsOn, }: {
|
|
@@ -34,6 +36,7 @@ export default function SideSpaceField({ value, onChange, unsetPx, bounds, lengt
|
|
|
34
36
|
readonly min: number;
|
|
35
37
|
readonly max: number;
|
|
36
38
|
readonly step: number;
|
|
39
|
+
readonly typedMax?: number;
|
|
37
40
|
};
|
|
38
41
|
length?: SiteRowLength;
|
|
39
42
|
restsOn?: number;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use client";import{jsx as r}from"react/jsx-runtime";import{SettingsDefaultReset as
|
|
1
|
+
"use client";import{jsx as r}from"react/jsx-runtime";import{SettingsDefaultReset as f,SettingsField as m}from"efficient-easel/panel";import{PaddingXIcon as c}from"efficient-easel/icons";import{SITE_GUTTER as a,SITE_GUTTER_PHONE as x,siteGutterPhoneFollows as S}from"../../format/lib/content/page-width.js";import{say as n,editorEaselWords as _}from"../../format/lib/editor-words.js";import{Slider as E}from"../lib/document/controls.js";import{siteTwinRow as T}from"../../format/lib/site-twin-row.js";const p="Side space",l=a.default,g="The room left at the left and right edge of every page.";function k(o,e){return T(o,{desktop:{key:"site_gutter",value:e.gutter,unsetPx:l,bounds:a},phone:{key:"site_gutter_phone",value:e.phone,unsetPx:S(e.gutter,e.gutterUnit),bounds:x}})}function I({value:o,onChange:e,unsetPx:s=l,bounds:i=a,length:t,restsOn:u=s}){const d=o===null;return r(m,{label:n(p),labelId:"sf-side-space",icon:r(c,{}),changed:!d,action:r(f,{words:_()?.panel,label:n(p),changed:!d,detail:`${s}px`,onReset:()=>e(null)}),hint:n(g),children:r(E,{min:(t?.grid??i).min,max:(t?.grid??i).max,step:(t?.grid??i).step,value:o,suffix:t?.unit??"px",...t?{units:t.units}:{},...i.typedMax!==void 0&&(t?.unit??"px")==="px"?{inputMax:i.typedMax}:{},placeholder:u,onClear:()=>e(null),ariaLabel:n(p),onChange:e})})}export{g as SIDE_SPACE_HINT,p as SIDE_SPACE_LABEL,I as default,k as sideSpaceRow};
|
|
@@ -202,7 +202,7 @@
|
|
|
202
202
|
border-radius: calc(var(--radius-sm) / 2);
|
|
203
203
|
background: var(--sf-accent);
|
|
204
204
|
opacity: 0;
|
|
205
|
-
transition: opacity
|
|
205
|
+
transition: opacity var(--motion-fast);
|
|
206
206
|
}
|
|
207
207
|
.sf-gap-plus {
|
|
208
208
|
position: absolute;
|
|
@@ -1675,15 +1675,11 @@
|
|
|
1675
1675
|
.sf-add-page {
|
|
1676
1676
|
padding: var(--space-32) var(--space-48);
|
|
1677
1677
|
}
|
|
1678
|
-
|
|
1679
|
-
|
|
1680
|
-
|
|
1681
|
-
|
|
1682
|
-
|
|
1683
|
-
}
|
|
1684
|
-
/* The heading takes the window's first focus (initialFocus), so a mouse open
|
|
1685
|
-
draws no ring on "+ Blank page". It is not a control: no ring of its own. */
|
|
1686
|
-
.sf-add-page-title:focus {
|
|
1678
|
+
/* The main area takes the window's first focus (initialFocus), so a mouse
|
|
1679
|
+
open draws no ring on "+ Blank page". It is not a control: no ring of its
|
|
1680
|
+
own. Its title, sub line and Loading are the shell's Title, Paragraph and
|
|
1681
|
+
LoadingSpinner. */
|
|
1682
|
+
.sf-add-page:focus {
|
|
1687
1683
|
outline: none;
|
|
1688
1684
|
}
|
|
1689
1685
|
/* The list's rows on the same side gutter as "+ Blank page" above them, so the
|
|
@@ -1693,8 +1689,6 @@
|
|
|
1693
1689
|
}
|
|
1694
1690
|
.sf-add-page-sub {
|
|
1695
1691
|
margin: var(--space-8) 0 var(--space-32);
|
|
1696
|
-
font-size: var(--text-sm);
|
|
1697
|
-
color: var(--ink);
|
|
1698
1692
|
}
|
|
1699
1693
|
.sf-add-page-group {
|
|
1700
1694
|
margin-top: var(--space-32);
|
|
@@ -1706,11 +1700,11 @@
|
|
|
1706
1700
|
flex-direction: column;
|
|
1707
1701
|
gap: var(--space-12);
|
|
1708
1702
|
}
|
|
1703
|
+
/* The picture's frame is the shell's Card (its border, radius and surface);
|
|
1704
|
+
this only holds the hover button over it and clips the drawing. */
|
|
1709
1705
|
.sf-starter-picture {
|
|
1710
1706
|
position: relative;
|
|
1711
1707
|
overflow: hidden;
|
|
1712
|
-
border: 1px solid var(--line);
|
|
1713
|
-
border-radius: var(--radius-sm);
|
|
1714
1708
|
}
|
|
1715
1709
|
.sf-starter-frame {
|
|
1716
1710
|
pointer-events: none;
|
|
@@ -1727,16 +1721,12 @@
|
|
|
1727
1721
|
align-items: center;
|
|
1728
1722
|
justify-content: center;
|
|
1729
1723
|
opacity: 0;
|
|
1730
|
-
transition: opacity
|
|
1724
|
+
transition: opacity var(--motion-fast);
|
|
1731
1725
|
}
|
|
1732
1726
|
.sf-starter:hover .sf-starter-add,
|
|
1733
1727
|
.sf-starter:focus-within .sf-starter-add {
|
|
1734
1728
|
opacity: 1;
|
|
1735
1729
|
}
|
|
1736
|
-
.sf-starter-name {
|
|
1737
|
-
font-size: var(--text-sm);
|
|
1738
|
-
color: var(--ink-strongest);
|
|
1739
|
-
}
|
|
1740
1730
|
/* `.sf-pgroup*` and `.sf-prow` WERE HERE: the Pages headings are the shell's
|
|
1741
1731
|
`TreeGroupLabel` (its count pill and fold), its rows the shell's `TreeRow`. */
|
|
1742
1732
|
/* `.sf-page-draft`, `.sf-badge-dynamic` and `.sf-badge-lightbox` WERE HERE: a
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{convertRowLength as
|
|
1
|
+
import{convertRowLength as h,rowUnits as b,unitPickPatch as a}from"efficient-easel/screen/lib/content/length-units";import{viewKeyAt as G}from"efficient-easel/draw";import{SITE_LENGTH_UNIT_COLUMNS as T,siteLengthTrack as f,storedUnit as s}from"../../../format/lib/content/css-length.js";import{SITE_BLOCK_GAP as g}from"../../../format/lib/content/container-gap.js";import{PAGE_WIDTH as l,SITE_GUTTER as E,SITE_GUTTER_PHONE as x}from"../../../format/lib/content/page-width.js";import{LENGTH_UNITS_TABLE as L}from"../document/box-fields.js";import{CORNER_RADIUS_GRID as P}from"../../../format/lib/theme.js";const R=["cornerRadius","siteWidth","siteGutter","siteGutterPhone","blockGap","blockGapPhone"],p={cornerRadius:{number:"corner_radius_px",kind:"radius",grid:P,tier:"desktop"},siteWidth:{number:"site_width",kind:"size",grid:l,tier:"desktop"},siteGutter:{number:"site_gutter",kind:"spacing",grid:E,tier:"desktop"},siteGutterPhone:{number:"site_gutter_phone",kind:"spacing",grid:x,tier:"mobile"},blockGap:{number:"block_gap",kind:"gap",grid:g,tier:"desktop"},blockGapPhone:{number:"block_gap_phone",kind:"gap",grid:g,tier:"mobile"}};function _(t){return{number:p[t].number,unit:T[`${t}Unit`]}}function H(t,n,e){const i=s(e),{number:o,unit:r}=_(t);return{[o]:n,[r]:n===null||i==="px"?null:i}}function U(t,n,e,i){const{kind:o,grid:r,tier:u}=p[t],c=s(e),d=s(i),m=r.typedMax,k=m!==void 0&&d==="px"?{...r,max:m}:r;return c===d?n:h(n,c,d,u,{kind:o},k)}function W(t,n,e,i){const{number:o,unit:r}=_(t),u=a({[o]:n},c=>U(t,c,e,i),r,s(i),"px");return{[o]:u[o],[r]:u[r]??null}}function D(t,n){const{kind:e,grid:i}=p[t];return f(e,s(n),i)}function y(t){return b({kind:p[t].kind},L)}function B(t,n){const e=G(t,n);if(!R.includes(e))throw new Error(`no site length row ${e}`);return e}export{R as SITE_LENGTH_ROWS,_ as siteLengthColumns,U as siteLengthConvert,D as siteLengthGrid,H as siteLengthPatch,B as siteLengthRowAt,W as siteLengthUnitPick,y as siteLengthUnits};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{jsx as i,jsxs as $,Fragment as X}from"react/jsx-runtime";import{HeightIcon as q,ImageIcon as z,ImagesIcon as J,OpacityIcon as Q,MediaLayoutSideBySideIcon as Z,MediaLayoutStackedIcon as ee,PlacementIcon as H,PlayIcon as oe,UploadIcon as te}from"efficient-easel/icons";import{viewFocusKeys as
|
|
1
|
+
import{jsx as i,jsxs as $,Fragment as X}from"react/jsx-runtime";import{HeightIcon as q,ImageIcon as z,ImagesIcon as J,OpacityIcon as Q,MediaLayoutSideBySideIcon as Z,MediaLayoutStackedIcon as ee,PlacementIcon as H,PlayIcon as oe,UploadIcon as te}from"efficient-easel/icons";import{viewFocusKeys as C}from"../../../../format/lib/content/picture-focus-rows.js";import{HERO_FOCUS as p,MEDIA_LAYOUT_DEFAULT as ie,MEDIA_LAYOUT_LABELS as ne,MEDIA_LAYOUTS as re,resolvePhoneLayout as le}from"../../../../format/lib/hero-media-layout.js";import{useEasel as ae,useSelectedHost as de}from"efficient-easel/easel";import{SettingsDefaultReset as se,SettingsField as ue,SettingsSegmented as he}from"efficient-easel/panel";import{describedAs as ce,FLAT_ACCESS as pe,iconOf as me,onDesktopWords as fe,phoneTwinFields as b,useAccessPatch as ge}from"efficient-easel/screen/lib/document/box-fields";import{keptByRow as _}from"efficient-easel/screen/lib/document/style-fields";import{colorInput as w,edgePad as F,focusKeptField as Oe,plainText as Ee,Slider as D,upload as be,useSelectedSibling as x}from"../controls.js";import{ColourRow as _e,InheritedColourRow as xe}from"../ColourControl.js";import{rowSay as ye,segmented as y,slider as Se}from"../box-fields.js";import{CUSTOM_SHAPE as ve,SHAPE_TABLE as Te}from"../../../../format/lib/content/gallery-card-layout.js";import{ShapePicker as Re}from"../shape-picker.js";import{HERO_FIXED_DEFAULT as Ae,HERO_HEIGHT_PX as S,readHeroFixedHeight as Le,SECTION_HEIGHT as h}from"../../../../format/lib/content/section-height.js";import{DEFAULT_TINT as v}from"../../../../format/lib/content/tint.js";import{editorEaselWords as Ie,say as a}from"../../../../format/lib/editor-words.js";import{nonEmptyString as T}from"../../../../format/lib/non-empty-string.js";import{findParentNode as He}from"../../../../format/lib/document/passes/document-position.js";import{DEFAULT_OVERLAY_POSITION as P,OVERLAY_POSITION_OPTIONS as k,slideOverlayState as U}from"../../../../format/lib/sections/hero-overlay.js";import{VIDEO_PLAYBACK_DEFAULT as Ce,VIDEO_PLAYBACK_LABELS as we,VIDEO_PLAYBACKS as Fe,VIDEO_SOURCE_DEFAULT as De,VIDEO_SOURCE_LABELS as Pe,VIDEO_SOURCES as ke}from"../../../../format/lib/hero-video.js";function Ue(){return Te.filter(e=>e.ratio!==null||e.shape===ve)}const R={desktop:{number:"heightDesktop",fixed:"heightFixed"},tablet:{number:"heightTablet",fixed:"heightFixedTablet"},mobile:{number:"heightMobile",fixed:"heightFixedMobile"}},M={read:e=>e.heightMobile,write:(e,o,t)=>({heightMobile:t}),fieldKey:()=>"heightMobile",ownField:!0,tablet:{read:e=>e.heightTablet,write:(e,o,t)=>({heightTablet:t}),fieldKey:()=>"heightTablet",ownField:!0}};function Y(e,{number:o,fixed:t}){const r=o===void 0?void 0:e[o];return Le(e[t])??(typeof r=="number"?{unit:"vh",vh:r}:null)}const Me="On Tablet, this hero uses the Desktop vh. Set vh in the Desktop view.";function Ye({view:e,keys:o,props:t}){const r=de(),d=ge(pe),{number:s}=o,m={...r?.values??{},...s?{[s]:t.value}:{}},O=Y(m,o),n=e==="tablet"?Y(m,R.desktop):null,u=O??n??{unit:"vh",vh:h.fallback},c=t.readOnly===!0,A=Ue(),G=l=>{if(l===u.unit)return;if(l!=="vh"){d([[o.fixed,n?.unit===l?n.value:Ae[l]]]);return}const N=s!==void 0&&typeof m[s]!="number"&&n!==null&&n.unit!=="vh";d([[o.fixed,void 0],...N?[[s,h.fallback]]:[]])},f=O===null&&e!=="desktop",E=s===void 0,L=E&&n!==null&&n.unit!=="vh",I=n===null?`${h.fallback} ${h.unit}`:n.unit==="vh"?`${n.vh} ${h.unit}`:n.unit==="px"?n.value:A.find(l=>l.image===n.value)?.label??n.value;return i(ue,{label:a("Height"),icon:me(i(q,{})),hint:E&&(u.unit==="vh"||L)?a(Me):void 0,action:e==="desktop"?void 0:i(se,{words:Ie()?.panel,label:a("Height"),changed:O!==null||!!m[o.fixed],detail:e==="tablet"?fe(ye,I):I,disabled:c,onReset:()=>d([...s?[[s,void 0]]:[],[o.fixed,void 0]])}),children:$("div",{style:{display:"flex",flexDirection:"column",gap:"var(--space-8)",flex:"1 1 auto",minWidth:0},children:[i(he,{options:[{id:"vh",label:a("vh"),disabled:L},{id:"ratio",label:a("Ratio")},{id:"px",label:a("px")}],value:u.unit,onChange:G,ariaLabel:a("Unit"),disabled:c}),u.unit==="ratio"?i(Re,{label:"Height",lines:A,column:"image",value:u.value,disabled:c,onChange:l=>d([[o.fixed,l]])}):u.unit==="px"?D({...S,value:f?null:u.px,...f?{placeholder:u.px}:{},suffix:S.unit,ariaLabel:"Height",disabled:c,onChange:l=>d([[o.fixed,`${l}${S.unit}`]])}):D({min:h.min,max:h.max,step:h.step,value:f?null:u.vh,...f?{placeholder:u.vh}:{},suffix:h.unit,ariaLabel:"Height",disabled:c||E,onChange:l=>t.onChange(l)})]})})}const g=(e,o=R[e])=>({type:"custom",...ce({},{type:"number",label:"Height"}),render:t=>i(Ye,{view:e,keys:o,props:t})}),We={read:e=>e.heightFixedTablet,write:(e,o,t)=>({heightFixedTablet:t}),fieldKey:()=>"heightFixedTablet",ownField:!0};function xo({tabletNumber:e=!0}={}){const o=e?M:{...M,tablet:We},t=g("tablet",e?void 0:{fixed:R.tablet.fixed}),r=b("heightDesktop",g("desktop"),o,{phoneRow:t}),d=b("heightDesktop",g("desktop"),o,{phoneRow:g("mobile")});return{heightDesktop:r.heightDesktop,...e?{heightTablet:r.heightTablet,heightFixedTablet:_("heightTablet")}:{heightFixedTablet:r.heightFixedTablet},heightMobile:d.heightMobile,heightFixed:_("heightDesktop"),heightFixedMobile:_("heightMobile")}}const yo={overlayColor:w("Overlay color",v),overlayPosition:F("Overlay position",k,P,"A corner would need a diagonal ramp, which this overlay does not draw.",i(H,{}))},W="Texture",B=e=>F("Overlay position",k,e,"A corner would need a diagonal ramp, which this overlay does not draw.",i(H,{}),void 0,W);function Be(){try{const{appState:e,selectedItem:o}=ae(t=>t);return Ve(e,o?.props?.id)}catch{return}}function Ve(e,o){return T(He(e,o)?.props?.textureColor)}function Ke({value:e,onChange:o}){const[t]=x("overlayPosition"),r=Be(),d=T(e)??"",s=U({overlayColor:d,overlayPosition:t},r);return i(xe,{label:a("Overlay color"),value:d,inherited:s.color,resetTo:a(W),onChange:o,onReset:()=>o("")})}const je=B(P),Ge=B("");function Ne(e){const[o]=x("overlayColor"),t=U({overlayColor:o,overlayPosition:e.value}).own?je:Ge;return i(X,{children:t.render(e)})}function $e(e){if(!Array.isArray(e))return;const o=e.flatMap((t,r)=>T(t?.props?.overlayColor)?[r+1]:[]);if(o.length!==0)return o.length===1?a("Slide {n}: own Overlay color.",{n:o[0]}):a("Slides {n}: own Overlay color.",{n:o.join(", ")})}function Xe({value:e,onChange:o}){const[t]=x("slides");return i(_e,{label:a("Texture color"),value:e||v,onChange:o,hint:$e(t)})}const So={type:"custom",render:({value:e,onChange:o})=>i(Xe,{value:e,onChange:o})},vo={overlayColor:{type:"custom",render:({value:e,onChange:o})=>i(Ke,{value:e,onChange:o})},overlayPosition:{type:"custom",render:({value:e,onChange:o})=>i(Ne,{value:e,onChange:o})}},qe={one:i(z,{}),side:i(Z,{}),stacked:i(ee,{})},V=e=>y("Layout",i(J,{}),re.map(o=>({label:ne[o],value:o,picture:qe[o]})),ie,e?{phoneRest:o=>le(void 0,o)}:void 0),ze={mediaLayout:V(),mediaLayoutPhone:b("mediaLayout",V(!0)).mediaLayoutPhone},Je=()=>Se("Tint",i(Q,{}),0,100,5,0,"%"),K=e=>Object.fromEntries(C(e).map(o=>[o,Oe()])),j=e=>be("Background image","image/*","Upload a background image",{focus:e}),Qe=()=>w("Tint color",v),To={mediaImage:j(p.image),...K(p.image)},Ze={mediaImage2:j(p.image2),...K(p.image2),tintColor2:Qe(),tintOpacity2:Je()},Ro=Object.keys(ze),Ao=Object.keys(Ze),Lo=["mediaImage",...C(p.image)],Io=e=>({mediaLayout:{all:[e,{not:{context:"device",is:"mobile"}}]},mediaLayoutPhone:{all:[e,{context:"device",is:"mobile"}]}}),Ho={videoSource:y("Source",i(te,{}),ke.map(e=>({label:Pe[e],value:e})),De),youtubeUrl:Ee("YouTube link","https://youtu.be/…"),videoPlayback:y("Playback",i(oe,{}),Fe.map(e=>({label:we[e],value:e})),Ce)};export{Ao as HERO_IMAGE2_KEYS,Ze as HERO_IMAGE2_ROWS,Lo as HERO_IMAGE_KEYS,To as HERO_IMAGE_ROWS,Ro as HERO_LAYOUT_KEYS,ze as HERO_LAYOUT_ROWS,yo as HERO_OVERLAY_ROWS,vo as HERO_SLIDE_OVERLAY_ROWS,Me as HERO_TABLET_VH_HINT,So as HERO_TEXTURE_COLOR_ROW,Ho as HERO_VIDEO_ROWS,xo as heroHeightFields,Io as heroLayoutRules,Ue as heroRatioLines,Qe as heroTintColorRow,Je as heroTintRow,$e as textureColorHint,Ve as textureColorOfSlide};
|
|
@@ -11,6 +11,7 @@ import { CARD_IMAGE_RADIUS_ROW } from "../../../format/lib/content/card-image-sh
|
|
|
11
11
|
import { FOCAL_DEFAULT, type UnitChoice as ShellUnitChoice } from "efficient-shell/ui";
|
|
12
12
|
import { type ColourChoice } from "./ColourControl.js";
|
|
13
13
|
import { type DeviceTier } from "efficient-easel/screen/lib/document/device-fields";
|
|
14
|
+
import { type ViewTier } from "efficient-easel/draw";
|
|
14
15
|
import type { GeocodeState } from "../../../format/lib/content/contact.js";
|
|
15
16
|
import { SECTION_PIN_SCREENS_KEY } from "../../../format/lib/content/section-sticky.js";
|
|
16
17
|
import { type SectionHeightMode, type SectionHeightUnit } from "../../../format/lib/content/section-min-height.js";
|
|
@@ -159,7 +160,7 @@ export declare function useLengthRow(o: {
|
|
|
159
160
|
convertTo?: (convert: (value: number) => number) => Record<string, unknown>;
|
|
160
161
|
followsView?: DeviceTier;
|
|
161
162
|
}): LengthUnitState | undefined;
|
|
162
|
-
export declare function Slider({ min, max, step, value, onChange, suffix, readout, notch, ariaLabel, disabled, placeholder, placeholderWord, onClear, units, }: {
|
|
163
|
+
export declare function Slider({ min, max, step, value, onChange, suffix, readout, notch, ariaLabel, disabled, placeholder, placeholderWord, onClear, units, inputMax, }: {
|
|
163
164
|
min: number;
|
|
164
165
|
max: number;
|
|
165
166
|
step: number;
|
|
@@ -174,6 +175,7 @@ export declare function Slider({ min, max, step, value, onChange, suffix, readou
|
|
|
174
175
|
placeholderWord?: string;
|
|
175
176
|
onClear?: () => void;
|
|
176
177
|
units?: ShellUnitChoice;
|
|
178
|
+
inputMax?: number;
|
|
177
179
|
}): import("react").JSX.Element;
|
|
178
180
|
export declare function pxField(label: string, opts: {
|
|
179
181
|
min: number;
|
|
@@ -338,7 +340,7 @@ export declare function loadingShowsField(label: string, icon: ReactElement, pic
|
|
|
338
340
|
export declare function loadingRowHint(values: Readonly<Record<string, unknown>>, frames: Readonly<Record<string, KnownVideoFrame>> | undefined, hasUnsavedEdits: boolean): string | undefined;
|
|
339
341
|
export declare function upload(label: string, accept: string, placeholder?: string, opts?: {
|
|
340
342
|
focus?: string;
|
|
341
|
-
focusWhen?: (props: Record<string, unknown>, view:
|
|
343
|
+
focusWhen?: (props: Record<string, unknown>, view: ViewTier) => boolean;
|
|
342
344
|
frame?: string;
|
|
343
345
|
}): CustomField<MediaValue>;
|
|
344
346
|
export declare function mediaFieldPaths(fields: Readonly<Record<string, unknown>> | undefined): string[];
|