efficient-web-builder 47.1.0 → 47.2.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 +34 -1
- package/dist/editor/components/BlockGapField.d.ts +15 -1
- package/dist/editor/components/BlockGapField.js +1 -1
- package/dist/editor/components/DuplicateToPageMenu.d.ts +2 -0
- package/dist/editor/components/DuplicateToPageMenu.js +1 -1
- package/dist/editor/components/SideSpaceField.d.ts +31 -1
- package/dist/editor/components/SideSpaceField.js +1 -1
- package/dist/editor/components/SiteFields.js +1 -1
- package/dist/editor/components/StandaloneSectionEditor.js +1 -1
- package/dist/editor/components/StorefrontEditor.js +1 -1
- package/dist/editor/components/WebsiteSettingsPanel.d.ts +10 -0
- package/dist/editor/components/WebsiteSettingsPanel.js +1 -1
- package/dist/editor/lib/animation/AnimationDurationRow.d.ts +4 -0
- package/dist/editor/lib/animation/AnimationDurationRow.js +1 -1
- package/dist/editor/lib/animation/entrance-fields.js +1 -1
- package/dist/editor/lib/animation/fields.js +1 -1
- package/dist/editor/lib/animation/loop-fields.js +1 -1
- package/dist/editor/lib/document/blocks/general/Flex/fields.js +1 -1
- package/dist/editor/lib/document/blocks/general/Text/fields.js +1 -1
- package/dist/editor/lib/document/canvas-typing.js +1 -1
- package/dist/editor/lib/document/card-display-chips.d.ts +33 -0
- package/dist/editor/lib/document/card-display-chips.js +1 -0
- package/dist/editor/lib/document/controls.d.ts +13 -0
- package/dist/editor/lib/document/controls.js +1 -1
- package/dist/editor/lib/document/field-groups.js +1 -1
- package/dist/editor/lib/document/live-number-field.d.ts +12 -0
- package/dist/editor/lib/document/live-number-field.js +1 -0
- package/dist/editor/lib/document/page-root.js +2 -2
- package/dist/editor/lib/editor-document-adapter.d.ts +5 -1
- package/dist/editor/lib/editor-document-adapter.js +1 -1
- package/dist/editor/lib/sections/section-dry-run.d.ts +34 -0
- package/dist/editor/lib/sections/section-dry-run.js +2 -2
- package/dist/format/lib/animation/index.d.ts +1 -0
- package/dist/format/lib/animation/index.js +1 -1
- package/dist/format/lib/content/block-sources.d.ts +9 -0
- package/dist/format/lib/content/block-sources.js +1 -1
- package/dist/format/lib/content/box-layout.d.ts +12 -1
- package/dist/format/lib/content/box-layout.js +1 -1
- package/dist/format/lib/content/box-separator.js +1 -1
- package/dist/format/lib/content/card-template.d.ts +1 -0
- package/dist/format/lib/content/card-template.js +1 -1
- package/dist/format/lib/content/container-gap.d.ts +9 -1
- package/dist/format/lib/content/container-gap.js +1 -1
- package/dist/format/lib/content/count-numbers.d.ts +7 -0
- package/dist/format/lib/content/count-numbers.js +1 -0
- package/dist/format/lib/content/page-width.d.ts +11 -0
- package/dist/format/lib/content/page-width.js +1 -1
- package/dist/format/lib/content/section-sticky.d.ts +1 -0
- package/dist/format/lib/content/section-sticky.js +1 -1
- package/dist/format/lib/content/site-gutter.d.ts +6 -0
- package/dist/format/lib/content/site-gutter.js +1 -1
- package/dist/format/lib/document/easel-row-words.d.ts +1 -0
- package/dist/format/lib/document/easel-row-words.js +1 -1
- package/dist/format/lib/document/panel-bands.d.ts +1 -0
- package/dist/format/lib/document/panel-bands.js +1 -1
- package/dist/format/lib/document/passes/settings-groups.js +1 -1
- package/dist/format/lib/document/site-gap-fields.d.ts +1 -1
- package/dist/format/lib/document/site-gap-fields.js +1 -1
- package/dist/format/lib/editor-words-catalogue.d.ts +5 -0
- package/dist/format/lib/editor-words-catalogue.js +3 -3
- package/dist/format/lib/fit-words.js +4 -3
- package/dist/format/lib/sections/strip-shape.d.ts +1 -0
- package/dist/format/lib/sections/strip-shape.js +1 -1
- package/dist/format/lib/site-theme-row.d.ts +2 -0
- package/dist/format/lib/site-twin-row.d.ts +5 -0
- package/dist/format/lib/site-twin-row.js +1 -0
- package/dist/format/lib/source-rules/flat-theme-palette.js +1 -1
- package/dist/format/lib/source-rules/one-loop-module.js +3 -3
- package/dist/render/components/BlockFrame.d.ts +2 -1
- package/dist/render/components/BlockFrame.js +1 -1
- package/dist/render/components/Btn.js +1 -1
- package/dist/render/components/CountRowsContext.d.ts +8 -0
- package/dist/render/components/CountRowsContext.js +1 -0
- package/dist/render/components/Flex.d.ts +3 -1
- package/dist/render/components/Flex.js +1 -1
- package/dist/render/components/ImageBlock.d.ts +4 -1
- package/dist/render/components/ImageBlock.js +1 -1
- package/dist/render/components/InBoxContext.d.ts +1 -0
- package/dist/render/components/InBoxContext.js +1 -1
- package/dist/render/components/IntroBleed.js +1 -1
- package/dist/render/components/LocationMap.js +1 -1
- package/dist/render/components/PreviewHeaderContext.d.ts +9 -1
- package/dist/render/components/PreviewHeaderContext.js +1 -1
- package/dist/render/components/SiteGutterFrame.d.ts +7 -1
- package/dist/render/components/SiteGutterFrame.js +1 -1
- package/dist/render/lib/animation/LoopTrack.d.ts +2 -2
- package/dist/render/lib/animation/LoopTrack.js +1 -1
- package/dist/render/lib/content/block-size.js +1 -1
- package/dist/render/lib/content/section-edge.d.ts +10 -0
- package/dist/render/lib/content/section-edge.js +1 -0
- package/dist/render/lib/document/blocks/general/Flex/render.js +1 -1
- package/dist/render/lib/document/blocks/general/ImageBlock/render.js +1 -1
- package/dist/render/lib/document/blocks/general/Text/render.js +1 -1
- package/dist/render/lib/document/blocks/general/section-head-looks.d.ts +1 -0
- package/dist/render/lib/document/blocks/general/section-head-looks.js +2 -2
- package/dist/render/lib/document/blocks/general/section-to-box-row-parts.d.ts +5 -0
- package/dist/render/lib/document/blocks/general/section-to-box-row-parts.js +1 -1
- package/dist/render/lib/document/blocks/general/section-to-box-rows-cards.d.ts +1 -1
- package/dist/render/lib/document/blocks/general/section-to-box-rows-cards.js +1 -1
- package/dist/render/lib/document/blocks/general/section-to-box-rows-locations.js +1 -1
- package/dist/render/lib/document/blocks/general/section-to-box-rows-stats.js +1 -1
- package/dist/render/lib/document/blocks/general/section-to-box-rows-strip.js +1 -1
- package/dist/render/lib/document/blocks/general/section-to-box-rows-timeline.js +2 -2
- package/dist/render/lib/document/blocks/general/section-to-box-rows.js +1 -1
- package/dist/render/lib/document/passes/block-size.js +1 -1
- package/dist/render/lib/document/passes/section-anchor.js +1 -1
- package/dist/render/lib/document/passes/section-padding.js +1 -1
- package/dist/render/lib/document/passes/slots-start-afresh.js +1 -1
- package/dist/render/lib/sections/section-to-box.d.ts +5 -1
- package/dist/render/lib/sections/section-to-box.js +1 -1
- package/package.json +2 -2
package/CHANGELOG.md
CHANGED
|
@@ -1,10 +1,43 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## 47.2.0 - 2026-11-03
|
|
4
|
+
|
|
5
|
+
From main at `9299d1ad`. It carries every change on main since 47.0.0; #435 is also in 47.1.0 (entry below). A minor: exports and optional props are added, no export is removed, peers are unchanged (`efficient-easel` `^26.7.0`, `efficient-shell` `^11.8.0`). No stored value moves.
|
|
6
|
+
|
|
7
|
+
**Pair for hosts:** #442 adds the class `sf-scroll-over` on a pinned intro; efficient-storefront-blocks 0.78.0 (#328) holds the CSS rule for it. A storefront takes both together.
|
|
8
|
+
|
|
9
|
+
### Added
|
|
10
|
+
|
|
11
|
+
- A number in a Box links to a live count (#433): `copyNodeToPage`, `saveSectionTemplate`, `settleCountNode`.
|
|
12
|
+
- The site's Block gap has its own phone value (#436): `block_gap_phone`, tokens `--sf-block-gap-phone` and `--sf-block-gap-phone-rem`, the module `format/site-twin-row` (`siteTwinRow`).
|
|
13
|
+
- Side space keeps its own phone value (#420).
|
|
14
|
+
- An image in a plain section reaches its edge (#419).
|
|
15
|
+
- A card's own panel says which parts show (#395).
|
|
16
|
+
- The Box: a Stats row, OFF, and a figure's live number mark (#429); the dry run reads the CLI page list and writes one edit per page (#437).
|
|
17
|
+
- Locations: one card size by a Columns row, the time zone tag on one line (#426); the Box's phone Wrap value `wrapPhone` and `boxPhoneRowOneLine`; `boxPhoneRowClasses` takes an optional third argument.
|
|
18
|
+
- A loop's Duration and Delay rows show what the page runs (#439): `loopDurationField`, `loopDelayField`.
|
|
19
|
+
|
|
20
|
+
### Changed (section conversions to the Box keep the old look; `SECTION_TO_BOX_ON` stays empty, so no stored page changes)
|
|
21
|
+
|
|
22
|
+
- Heading case (#438), Section Header (#440), CTA Heading (#441), Cards and Detail Cards (#443), Stats (#444), Prose and Paragraphs (#445), Recurring Columns (#446), Scrolling Bar (#442: `boxRunsEdgeToEdge`, `fillFrom`, `TICKER_BARE_GAP`).
|
|
23
|
+
|
|
24
|
+
### Fixed
|
|
25
|
+
|
|
26
|
+
- A block's Min width wins over its row's `min-w-0` (#423).
|
|
27
|
+
- Every block with an Entrance has the two tabs (#425).
|
|
28
|
+
- A picker row says its empty word once (#427); a Design tab with one group draws no band (#428).
|
|
29
|
+
- Site styles: width rows draw in the desktop view only (#430).
|
|
30
|
+
- A Text's Content width reaches its words (#435, as in 47.1.0).
|
|
31
|
+
|
|
32
|
+
### Internal
|
|
33
|
+
|
|
34
|
+
- easel 26.10 then 26.12 in the dev range (#422, #426); panel rows counted per view (#431).
|
|
35
|
+
|
|
3
36
|
## 47.1.0 - 2026-11-03
|
|
4
37
|
|
|
5
38
|
Cut from the `v47.0.0` tag, with only the changes of #435. Main holds later work that this release does not carry. A minor because it adds three exports and one optional prop. No stored value moves.
|
|
6
39
|
|
|
7
|
-
**Back to main:** #435
|
|
40
|
+
**Back to main:** #435 brought the same change to main, with this entry. The next release from main must be a version above 47.1.0.
|
|
8
41
|
|
|
9
42
|
### Fixed
|
|
10
43
|
|
|
@@ -1,5 +1,19 @@
|
|
|
1
|
-
|
|
1
|
+
import { type SiteRowView } from "../../format/lib/site-twin-row.js";
|
|
2
|
+
export declare function blockGapRow(device: SiteRowView, site: {
|
|
3
|
+
gap: number | null;
|
|
4
|
+
phone: number | null;
|
|
5
|
+
}): {
|
|
6
|
+
key: "block_gap";
|
|
7
|
+
value: number | null;
|
|
8
|
+
followsPx: null;
|
|
9
|
+
} | {
|
|
10
|
+
key: "block_gap_phone";
|
|
11
|
+
value: number | null;
|
|
12
|
+
followsPx: number | null;
|
|
13
|
+
} | null;
|
|
14
|
+
export default function BlockGapField({ value, onChange, showHint, followsPx, }: {
|
|
2
15
|
value: number | null;
|
|
3
16
|
onChange: (v: number | null) => void;
|
|
4
17
|
showHint?: boolean;
|
|
18
|
+
followsPx?: number | null;
|
|
5
19
|
}): import("react").JSX.Element;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use client";import{jsx as
|
|
1
|
+
"use client";import{jsx as n}from"react/jsx-runtime";import{SettingsDefaultReset as u,SettingsField as d}from"efficient-easel/panel";import{AlignSeparateIcon as h}from"efficient-easel/icons";import{CONTAINER_GAP_BUILT_IN as m,SITE_BLOCK_GAP as i,halfDesktopGap as f,normalizeSiteBlockGap as _}from"../../format/lib/content/container-gap.js";import{say as o,editorEaselWords as g}from"../../format/lib/editor-words.js";import{Slider as k}from"../lib/document/controls.js";import{siteTwinRow as b}from"../../format/lib/site-twin-row.js";const B="The space between the blocks inside a row, a grid or a box. Default means each one keeps the spacing it already has.",G="The space between the blocks inside a row, a grid or a box, on a phone. Until you set it, a phone uses half the desktop gap.",s="Block gap",r=m.Grid;function S(a,e){return b(a,{desktop:{key:"block_gap",value:e.gap,followsPx:null},phone:{key:"block_gap_phone",value:e.phone,followsPx:e.gap===null?null:f(e.gap)}})}function w({value:a,onChange:e,showHint:c=!0,followsPx:l=null}){const t=a===null,p=l===null?null:`${l}px`;return n(d,{label:o(s),labelId:"sf-block-gap",icon:n(h,{}),value:t?p??o("Default"):`${a}px`,changed:!t,action:n(u,{words:g()?.panel,label:o(s),changed:!t,detail:p??o("each block's own spacing"),onReset:()=>e(null)}),hint:c?o(p===null?B:G):void 0,children:n(k,{min:i.min,max:i.max,step:i.step,value:a??(l===null?r:_(l)??r),readout:!1,ariaLabel:o(s),onChange:e})})}export{S as blockGapRow,w as default};
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import type { RefObject } from "react";
|
|
2
2
|
import { type TreeItem } from "efficient-easel/draw";
|
|
3
|
+
import type { EditorPageRow, WebsitePages } from "../../format/lib/web-backend.js";
|
|
3
4
|
interface Props {
|
|
4
5
|
node: TreeItem;
|
|
5
6
|
currentSlug: string;
|
|
@@ -9,4 +10,5 @@ interface Props {
|
|
|
9
10
|
onNotify?: (msg: string, tone?: "success" | "error") => void;
|
|
10
11
|
}
|
|
11
12
|
export default function DuplicateToPageMenu({ node, currentSlug, siteId, tokenRef, runAuthed, onNotify }: Props): import("react").JSX.Element;
|
|
13
|
+
export declare function copyNodeToPage(pages: WebsitePages, page: Pick<EditorPageRow, "id" | "slug">, clone: TreeItem): Promise<void>;
|
|
12
14
|
export {};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use client";import{jsx as t,jsxs as
|
|
1
|
+
"use client";import{jsx as t,jsxs as x,Fragment as j}from"react/jsx-runtime";import{useCallback as B,useRef as F,useState as d}from"react";import{InspectorIconButton as O}from"efficient-easel/chrome";import{PopupMenu as R,PopupMenuItem as _,PopupMenuLabel as m}from"efficient-shell/ui";import{CopyToPageIcon as A}from"efficient-easel/icons";import{backendOf as N}from"../lib/website-session.js";import{useEaselSession as L}from"efficient-easel/screen/lib/session-context";import{say as o}from"../../format/lib/editor-words.js";import{cloneNodeWithFreshIds as z}from"efficient-easel/screen/lib/document/section-doc";import{FOOTER_TYPE as W}from"efficient-easel/draw";import{settlingPages as H}from"../lib/editor-document-adapter.js";function Y({node:f,currentSlug:r,siteId:l,tokenRef:a,runAuthed:i,onNotify:c}){const[n,s]=d(!1),[p,b]=d(null),u=L(),[T,g]=d(!1),[h,P]=d(null),k=F(null),[y,v]=d(null),M=B(async()=>{if(u.usesBridgedToken&&!a.current){g(!0);return}try{b(await N(u).pages.list(l?{siteId:l}:void 0))}catch{g(!0)}},[a,l,u]),D=()=>{if(n){s(!1);return}const e=k.current?.getBoundingClientRect();e&&v({top:e.bottom+6,right:Math.max(8,window.innerWidth-e.right)}),b(null),g(!1),M(),s(!0)},w=(p??[]).filter(e=>e.slug!==r),I=async e=>{if(h)return;P(e.slug);const C=z(f),S=u.documentHooks?.storedNode?.(C)??C,E=await i(()=>$(N(u).pages,e,S));P(null),s(!1),c?.(E?o("Duplicated to “{name}”",{name:e.label}):o("Couldn’t duplicate the section — please retry"),E?"success":"error")};return x(j,{children:[t("span",{"data-menu-toggle":!0,style:{display:"contents"},children:t(O,{buttonRef:k,label:o("Duplicate to another page"),hasPopup:"menu",expanded:n,onClick:D,children:t(A,{size:15})})}),n&&y&&t(R,{portal:!0,style:{top:y.top,right:y.right},onClose:()=>s(!1),children:x("div",{role:"menu","aria-label":o("Duplicate to page"),children:[t(m,{children:o("Duplicate to page")}),T?t(m,{children:o("Couldn’t load pages")}):p===null?t(m,{children:o("Loading…")}):w.length===0?t(m,{children:o("No other pages")}):w.map(e=>x(_,{role:"menuitem",disabled:h!==null,onClick:()=>{I(e)},children:[t("span",{className:"min-w-0 flex-1 truncate",children:e.label}),h===e.slug?t("span",{className:"shrink-0 text-xs",children:o("Copying…")}):e.draft&&t("span",{className:"shrink-0 text-xs",children:o("draft")})]},e.id))]})})]})}async function $(f,r,l){const a=H(f),i=await a.load({id:r.id});if(!i)throw new Error(`Page "${r.slug}" no longer exists.`);const c=i.layout??{},n=Array.isArray(c.content)?[...c.content]:[],s=n.findIndex(p=>p?.type===W);n.splice(s===-1?n.length:s,0,l),await a.save(r.id,{layout:{root:{},zones:{},...c,content:n}},{version:i.version,clientId:""})}export{$ as copyNodeToPage,Y as default};
|
|
@@ -1,7 +1,37 @@
|
|
|
1
|
+
import { type SiteRowView } from "../../format/lib/site-twin-row.js";
|
|
1
2
|
export declare const SIDE_SPACE_LABEL = "Side space";
|
|
2
3
|
export declare const SIDE_SPACE_HINT = "The room left at the left and right edge of every page.";
|
|
3
|
-
export
|
|
4
|
+
export declare function sideSpaceRow(device: SiteRowView, site: {
|
|
5
|
+
gutter: number | null;
|
|
6
|
+
phone: number | null;
|
|
7
|
+
}): {
|
|
8
|
+
key: "site_gutter";
|
|
9
|
+
value: number | null;
|
|
10
|
+
unsetPx: 40;
|
|
11
|
+
bounds: {
|
|
12
|
+
readonly min: 0;
|
|
13
|
+
readonly max: 80;
|
|
14
|
+
readonly step: 4;
|
|
15
|
+
readonly default: 40;
|
|
16
|
+
};
|
|
17
|
+
} | {
|
|
18
|
+
key: "site_gutter_phone";
|
|
19
|
+
value: number | null;
|
|
20
|
+
unsetPx: number;
|
|
21
|
+
bounds: {
|
|
22
|
+
readonly min: 0;
|
|
23
|
+
readonly max: 24;
|
|
24
|
+
readonly step: 4;
|
|
25
|
+
};
|
|
26
|
+
} | null;
|
|
27
|
+
export default function SideSpaceField({ value, onChange, showHint, unsetPx, bounds, }: {
|
|
4
28
|
value: number | null;
|
|
5
29
|
onChange: (v: number | null) => void;
|
|
6
30
|
showHint?: boolean;
|
|
31
|
+
unsetPx?: number;
|
|
32
|
+
bounds?: {
|
|
33
|
+
readonly min: number;
|
|
34
|
+
readonly max: number;
|
|
35
|
+
readonly step: number;
|
|
36
|
+
};
|
|
7
37
|
}): import("react").JSX.Element;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use client";import{jsx as
|
|
1
|
+
"use client";import{jsx as o}from"react/jsx-runtime";import{SettingsDefaultReset as u,SettingsField as m}from"efficient-easel/panel";import{PaddingXIcon as f}from"efficient-easel/icons";import{SITE_GUTTER as a,SITE_GUTTER_PHONE as c,siteGutterPhoneFollows as S}from"../../format/lib/content/page-width.js";import{say as r,editorEaselWords as _}from"../../format/lib/editor-words.js";import{Slider as g}from"../lib/document/controls.js";import{siteTwinRow as E}from"../../format/lib/site-twin-row.js";const l="Side space",d=a.default,h="The room left at the left and right edge of every page.";function N(t,e){return E(t,{desktop:{key:"site_gutter",value:e.gutter,unsetPx:d,bounds:a},phone:{key:"site_gutter_phone",value:e.phone,unsetPx:S(e.gutter),bounds:c}})}function x({value:t,onChange:e,showHint:p=!0,unsetPx:n=d,bounds:i=a}){const s=t===null;return o(m,{label:r(l),labelId:"sf-side-space",icon:o(f,{}),value:`${t??n}px`,changed:!s,action:o(u,{words:_()?.panel,label:r(l),changed:!s,detail:`${n}px`,onReset:()=>e(null)}),hint:p?r(h):void 0,children:o(g,{min:i.min,max:i.max,step:i.step,value:t??n,readout:!1,ariaLabel:r(l),onChange:e})})}export{h as SIDE_SPACE_HINT,l as SIDE_SPACE_LABEL,x as default,N as sideSpaceRow};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use client";import{jsx as
|
|
1
|
+
"use client";import{jsx as x}from"react/jsx-runtime";import{useLayoutEffect as V,useMemo as C,useRef as Y,useState as D}from"react";import{useEasel as z,useSelectedFields as J}from"efficient-easel/easel";import{fieldShownInView as Q,Inspector as Z,planFields as M}from"efficient-easel/fields";import{BUCKET_ICONS as $,entriesHiddenForTab as ee}from"../lib/document/controls.js";import{BUCKETS as te}from"../lib/document/field-groups.js";import{say as oe}from"../../format/lib/editor-words.js";import{usePreviewDevice as ne}from"efficient-easel/draw/client";import{showWhenContext as se,visibleFields as re}from"../../render/lib/document/show-when.js";import{fieldsOfPart as de}from"../../render/lib/document/hero-media-parts.js";import{bandIsDropped as le,droppedBands as ie,loneDesignBand as ae,sameKeys as ce,TEXT_BAND_KEY as F,TEXT_BAND_TITLE as fe,withoutBands as ue}from"../../format/lib/document/panel-bands.js";const k=new Map,h=new Set;function _(n,i){const u=new Map;for(const o of n.querySelectorAll(".es-insp-row[data-field]"))u.set(o.getAttribute("data-field")??"",o);const d=[];for(const[o,y]of i)d.push({key:o,rows:y.map(a=>{const c=u.get(a),m=!!c&&[...c.children].some(w=>!w.hidden),p=c?.querySelector(".es-field-label, .es-list-label")?.textContent?.trim();return{shown:m,labelled:m&&!!p}})});return d}const me=Object.fromEntries(te.map(n=>{const i=$[n];return[n,x(i,{},n)]}));function Ce({entries:n,entryCount:i=0,part:u=null,omit:d}){const{id:o,fields:y,values:a,readOnly:c,onChange:m}=J(),p=ne(),{appState:w,config:A}=z(e=>e),O=se(p,A,w.data.content??[],w.ui.itemSelector),S=de(y,u),j=C(()=>d?.length?Object.fromEntries(Object.entries(S).filter(([e])=>!d.includes(e))):S,[S,d]),f=re(j,a,O),[N,R]=D(()=>new Set(h)),[g,K]=D(()=>new Set),v=Y(null),{bandRows:P,designBands:L,looseRows:q}=C(()=>{const e=new Map,s=new Set,l=[];for(const t of M(f).rows){if(!t.fold){t.bucket==="Design"&&l.push(t.name);continue}const r=e.get(t.fold.key)??[];r.push(t.name),e.set(t.fold.key,r),t.bucket==="Design"&&s.add(t.fold.key)}return{bandRows:e,designBands:s,looseRows:new Map([["",l]])}},[f]),U=Q({},p),I={key:F,rows:Array.from({length:U?i:0},()=>({shown:!0,labelled:!0}))};V(()=>{const e=v.current?.parentElement;if(!e)return;const s=_(e,P),l=new Set(ie(s)),t=ae([I,...s.filter(r=>L.has(r.key))],_(e,q)[0].rows);t&&l.add(t),K(r=>ce(r,l)?r:l)});const W=C(()=>ue(f,g),[f,g]),X=!le(I)&&!g.has(F)?{key:F,title:fe}:void 0,[E,G]=D(()=>k.get(o)),B=k.get(o),b=M(f).buckets,T=B&&b.includes(B)?B:E&&b.includes(E)?E:b[0],H=T===void 0||ee(b,T)!==!0;return x(Z,{fields:W,values:a,onChange:m,readOnly:c,showWhenContext:{...O,node:a},tab:T,onTab:e=>{k.set(o,e),G(e)},tabIcons:me,idPrefix:o,ariaLabel:oe("Section settings"),lead:H?n:null,leadFold:X,closedFolds:N,onFold:(e,s)=>{s?h.delete(e):h.add(e),R(new Set(h))},children:x("span",{ref:v,hidden:!0})})}export{Ce as SiteFields,me as TAB_ICONS};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use client";import{jsx as o}from"react/jsx-runtime";import{useCallback as H,useEffect as P,useMemo as l,useRef as
|
|
1
|
+
"use client";import{jsx as o}from"react/jsx-runtime";import{useCallback as H,useEffect as P,useMemo as l,useRef as X,useState as u}from"react";import x from"next/dynamic";import"efficient-easel/easel.css";import"efficient-easel/shell.css";import"efficient-easel/rail.css";import"efficient-easel/panel.css";import"efficient-easel/fields.css";import"efficient-easel/pick.css";import"efficient-easel/copy.css";import"efficient-easel/gold.css";import"efficient-easel/text-styles.css";import"efficient-easel/menu.css";import"efficient-easel/chrome.css";import"efficient-easel/tree.css";import"efficient-easel/screen.css";import"./storefront-editor.css";import{buildConfig as Z}from"../lib/document/build-config.js";import{withTemplateMediaPlaceholders as $}from"../../format/lib/document/templateFields.js";import{setEditorPageSlug as B}from"../../format/lib/document/editor-page-context.js";import{ScreenDocumentContext as ee}from"efficient-easel/screen/components/ScreenDocumentContext";import{PreviewHeaderProvider as te}from"../../render/components/PreviewHeaderContext.js";import{PreviewTickerProvider as re}from"../../render/components/PreviewTickerContext.js";import{PreviewHeroPartProvider as oe}from"../../render/components/PreviewHeroPartContext.js";import{PreviewPartsProvider as ie}from"efficient-easel/draw/client";import{CanvasPartsBridge as ne}from"./CanvasPartsBridge.js";import{PreviewLocationPartProvider as se}from"../../render/components/PreviewLocationPartContext.js";import{PreviewPartStyleProvider as de}from"./PreviewPartStyleContext.js";import{sectionTemplates as b}from"efficient-easel/screen/lib/section-templates";import{saveSectionTemplate as R}from"../lib/editor-document-adapter.js";import{nodeToDoc as ae,docToNode as F}from"efficient-easel/screen/lib/document/section-doc";import{newNodeId as ce}from"efficient-easel/draw";import{migrateRenamedProps as me}from"../../format/lib/document/renamed-props.js";import{buildSlotSeedChildren as le}from"../../render/lib/document/slot-specs.js";import{FOOTER_TYPE as ue,buildDefaultFooterBlocks as fe}from"../lib/document/footer-blocks.js";import{NO_BRIDGED_CAPABILITIES as pe,useAdminBridge as ve}from"efficient-easel/screen/lib/admin-bridge";import{useEaselHost as ge}from"efficient-easel/screen/lib/host";import{ChromeWrap as he}from"efficient-easel/screen/lib/host-chrome";import{sessionRegistry as Pe}from"efficient-easel/screen/lib/session";import{useEaselSession as Se}from"efficient-easel/screen/lib/session-context";import{say as L}from"../../format/lib/editor-words.js";import{retargetWhenSaved as Ee}from"../../format/lib/section-retarget.js";import{routeSharedHostMessage as ye}from"efficient-easel/screen/lib/host-inbound";import{routeWebsiteHostMessage as Te}from"../../format/lib/website-host-inbound.js";import{DEFAULT_THEME_MODE as S,THEME_MODE_KEY as we}from"../../format/lib/theme.js";import{makeSitePageAdapter as U}from"../lib/editor-document-adapter.js";import{documentPermissions as Ne}from"efficient-easel/edit-lock";import{useAutosave as Ce}from"efficient-easel/autosave";import{saveStatusOf as ke}from"efficient-easel/screen/lib/document-switch";import{blocksOf as Ae}from"../lib/website-session.js";const Ie=x(()=>import("./SiteEditorProvider.js"),{ssr:!1}),be=x(()=>import("efficient-easel/screen/components/SectionScreenShell"),{ssr:!1}),W="HeroSingle",Y="Untitled section";function Me(i,E){const d=E.components,r=d[i]?i:W,y=d[r]?.defaultProps??{},n=le(r,f=>d[f]?.defaultProps??{}),s=r===ue?{blocks:fe()}:null;return{type:r,props:{id:ce(r),...y,...n?{[n.slot]:n.children}:null,...s}}}function Oe(){if(typeof window>"u")return S;try{const i=window.localStorage.getItem(we);return i==="light"||i==="dark"||i==="auto"?i:S}catch{return S}}function De({id:i,initialType:E,initialName:d=Y}){const[r,y]=u(i),n=X(r);P(()=>{n.current=r},[r]);const s=ge(),[f,j]=u(E),[M,K]=u(d),[a,T]=u(void 0),[G,q]=u(S),{token:w,tokenRef:O}=ve({onMessage:e=>{if(Te(e)||ye(e))return;const t=e;if(t?.type==="storefront-editor:navigate"&&t.target?.kind==="section"&&t.target.id){const I=t.target.id;if(I===n.current)return;const Q=t.target.type,V=t.target.name;Ee(C,()=>{j(Q),K(V||Y),y(I),s.address.show({kind:"section",id:I})},()=>s.send("storefront-editor:save-failed"))}}}),N=Ce({save:e=>R(b,e.id,e.node).then(()=>{}),onFailure:(e,t)=>{t===0&&s.send("storefront-editor:save-failed")}}),{state:p,push:D,flush:C}=N;P(()=>q(Oe()),[]);const c=Se(),v=c.usesBridgedToken?!!w:!0,g=l(()=>Z(Pe(c),Ae(c)),[c]);P(()=>{if(!v)return;let e=!1;return T(void 0),b.ensure(r,M,Me(f??W,g)).then(t=>!e&&T(t.node)).catch(()=>!e&&T(null)),()=>{e=!0}},[r,f,M,v,g]);const k=H(e=>{s.send("storefront-editor:dirty");const t=F(e);t&&D({id:n.current,node:t})},[D,s]),h=s.send,_=H(async e=>{try{return await e(O.current??""),!0}catch{return h("storefront-editor:save-failed"),!1}},[h]),z=l(()=>$(g,!0),[g]);P(()=>(B(null),()=>B(null)),[]);const m=l(()=>a?me(ae(a)):null,[a]),A=l(()=>({target:{kind:"page",slug:""},adapter:U(void 0),capabilities:U(void 0).capabilities,templateId:null,currentSlug:"",currentKind:null,siteId:null,ready:v,token:w,tokenRef:O,notifyParent:h,runAuthed:_,docId:r,data:m,getLiveData:()=>m,error:null,redirecting:!1,saveStatus:ke(p),saveState:p,autoSaveEnabled:!0,autoSaveStoppedByConflict:!1,hasUnsavedEdits:p.pending,toggleAutoSave:()=>{},retrySave:()=>{N.retryNow()},onChange:k,flushSave:C,onPublish:async e=>{const t=F(e);t&&await R(b,n.current,t)},bridgeCapabilities:pe,access:{kind:"editing"},readOnly:!1,takeOverEditing:()=>{},viewReadOnly:()=>{},saveConflict:null,reloadFromServer:()=>{},navigate:()=>{},pendingNav:null,cancelPendingNav:()=>{},discardAndNavigate:()=>{},saveAndNavigate:async()=>{}}),[r,v,w,h,_,m,p,k,C,N.retryNow]),J=l(()=>Ne(!A.readOnly),[A.readOnly]);return a===void 0?o("div",{className:"sf-msg",children:L("Loading…")}):a===null||!m?o("div",{className:"sf-msg sf-msg--error",children:L("Couldn’t open this section.")}):o(ee.Provider,{value:A,children:o(te,{themeMode:G,chromePlaceholder:!0,children:o(he,{wrap:c.chrome?.wrap,surface:"section",children:o(re,{children:o(oe,{children:o(ie,{children:o(se,{children:o(ne,{children:o(de,{children:o(Ie,{config:z,data:m,onChange:k,permissions:J,children:o(be,{})},r)})})})})})})})})})}export{De as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use client";import{jsx as s,jsxs as
|
|
1
|
+
"use client";import{jsx as s,jsxs as pt}from"react/jsx-runtime";import{useCallback as n,useEffect as S,useMemo as ce,useRef as f,useState as r}from"react";import"efficient-easel/easel.css";import"efficient-easel/shell.css";import"efficient-easel/rail.css";import"efficient-easel/panel.css";import"efficient-easel/fields.css";import"efficient-easel/pick.css";import"efficient-easel/copy.css";import"efficient-easel/gold.css";import"efficient-easel/text-styles.css";import"efficient-easel/menu.css";import"efficient-easel/chrome.css";import"efficient-easel/tree.css";import"efficient-easel/drag.css";import"efficient-easel/screen.css";import"./storefront-editor.css";import{buildConfig as St}from"../lib/document/build-config.js";import{ChromeWrap as ft}from"efficient-easel/screen/lib/host-chrome";import{sessionRegistry as gt}from"efficient-easel/screen/lib/session";import{refreshSiteLiveState as wt}from"../lib/site-live-state.js";import{holdSiteWrites as Ct}from"../../format/lib/site-writes.js";import{backendOf as k,blocksOf as _t}from"../lib/website-session.js";import{useEaselSession as Tt}from"efficient-easel/screen/lib/session-context";import{withSiteBlockGapFields as Et}from"../../format/lib/document/site-gap-fields.js";import{withTemplateMediaPlaceholders as Pt}from"../../format/lib/document/templateFields.js";import{setEditorPage as se}from"../../format/lib/document/editor-page-context.js";import{resolveSiteName as yt}from"../../format/lib/content/site-name.js";import{normalizeSiteGutter as Gt,normalizeSiteGutterPhone as vt,normalizeSiteWidth as kt}from"../../format/lib/content/page-width.js";import{normalizeSiteBackground as de}from"../../format/lib/content/section-width.js";import{normalizeSiteBlockGap as ue}from"../../format/lib/content/container-gap.js";import Ht,{DocumentScreen as Wt}from"efficient-easel/screen/components/ScreenMount";import{useScreenDocument as Bt}from"efficient-easel/screen/components/ScreenDocumentContext";import{PreviewHeaderProvider as Rt,siteThemeRow as Ft,themeEdited as It,themeSeeded as Dt}from"../../render/components/PreviewHeaderContext.js";import{PreviewFooterProvider as Mt}from"./PreviewFooterContext.js";import{PreviewChatProvider as bt,DEFAULT_CHAT_PREVIEW as xt}from"./PreviewChatContext.js";import{PreviewSocialProvider as Nt}from"../../render/components/PreviewSocialContext.js";import{useSocialSettings as Ot}from"./useSocialSettings.js";import{PreviewSurfaceProvider as zt}from"./PreviewSurfaceContext.js";import{WEBSITE_ADDRESSING as At}from"../lib/website-document-addressing.js";import{PreviewTickerProvider as Lt}from"../../render/components/PreviewTickerContext.js";import{PreviewHeroPartProvider as Yt}from"../../render/components/PreviewHeroPartContext.js";import{PreviewPartsProvider as Ut}from"efficient-easel/draw/client";import{CanvasPartsBridge as jt}from"./CanvasPartsBridge.js";import{PreviewLocationPartProvider as Kt}from"../../render/components/PreviewLocationPartContext.js";import{PreviewPartStyleProvider as Vt}from"./PreviewPartStyleContext.js";import{CORNER_STYLE_TO_PX as Xt,DEFAULT_HEADING_COMPRESSION as Zt,DEFAULT_HEADING_TYPOGRAPHY as qt,DEFAULT_SWITCH_SHOWN as H,DEFAULT_SIZES as Jt,DEFAULT_THEME_MODE as _,normalizeCornerRadius as Qt,normalizeCornerStyle as $t,normalizeCardShadow as er,normalizeCardGap as tr,normalizeHoverEffect as rr,normalizeShadowColor as or,IDENTITY_CARD_GAP as he,IDENTITY_CARD_SHADOW as nr,IDENTITY_HOVER_EFFECT as ar,THEME_MODE_KEY as le,THEME_STORAGE_KEY as ir,THEME_SWITCH_HIDE as me,THEME_SWITCH_KEY as W}from"../../format/lib/theme.js";import{DEFAULT_FONTS as cr}from"../../format/lib/fonts.js";import{WEBSITE_SCREEN as sr}from"./WebsiteScreenParts.js";import{routeWebsiteHostMessage as dr}from"../../format/lib/website-host-inbound.js";import{siteTextFromRow as ur}from"../../render/lib/text-styles/site-text-styles.js";import{wordStylesFromRow as hr}from"../../format/lib/word-styles.js";import{chatPreviewFrom as lr}from"./PreviewChatContext.js";const mr=()=>{if(typeof window>"u")return _;try{const c=window.localStorage.getItem(le);return c==="light"||c==="dark"||c==="auto"?c:_}catch{return _}},pe=c=>{if(!(typeof window>"u"))try{window.localStorage.setItem(le,c)}catch{}},pr=()=>{if(typeof window>"u")return H;try{return window.localStorage.getItem(W)!==me}catch{return H}},Sr=()=>{if(!(typeof window>"u"))try{window.localStorage.removeItem(ir)}catch{}},Se=c=>{if(!(typeof window>"u"))try{c?window.localStorage.removeItem(W):window.localStorage.setItem(W,me)}catch{}};function fr(){const{adapter:c,capabilities:d,templateId:B,ready:w,token:h,siteId:i,currentSlug:R,currentKind:F}=Bt();S(()=>(se(R,F),()=>se(null,null)),[R,F]);const T=d.placeholderFrames,[fe,I]=r(null),[ge,D]=r("");S(()=>{const e=c.templateName;if(!w||!B||!e){D("");return}let a=!1;return e().then(l=>!a&&D(l??"")).catch(()=>{}),()=>{a=!0}},[w,h,B,c]);const[we,E]=r(_),[Ce,P]=r(H),[M,b]=r({value:{selected:0,themes:[]},readFor:null}),_e=M.value,[Te,x]=r(cr),[Ee,N]=r(Jt),[Pe,O]=r(null),[ye,z]=r(Zt),[Ge,A]=r(null),[ve,L]=r(null),[ke,Y]=r(he),[He,U]=r(null),[We,j]=r(null),[Be,K]=r(null),[Re,V]=r(null),[y,X]=r(null),[G,Z]=r(null),u=Tt(),q=ce(()=>St(gt(u),_t(u)),[u]),Fe=ce(()=>Et(Pt(q,T),y,G),[q,T,y,G]),[Ie,J]=r(qt),[De,Q]=r(null),[Me,$]=r(null),[be,ee]=r(null),[xe,te]=r(null),[Ne,re]=r(null),oe=f(null),o=f(!1);S(()=>{E(mr()),P(pr())},[]);const Oe=n(e=>{o.current=!0,Sr(),pe(e),E(e)},[]),ze=n(e=>{o.current=!0,Se(e),P(e)},[]),Ae=n(e=>{o.current=!0,b(a=>It(a,e,i??""))},[i]),Le=n(e=>{o.current=!0,x(e)},[]),Ye=n(e=>{o.current=!0,N(e)},[]),Ue=n(e=>{o.current=!0,O(e)},[]),je=n(e=>{o.current=!0,z(e)},[]),Ke=n(e=>{o.current=!0,A(e)},[]),Ve=n(e=>{o.current=!0,L(e)},[]),Xe=n(e=>{o.current=!0,Y(e)},[]),Ze=n(e=>{o.current=!0,U(e)},[]),qe=n(e=>{o.current=!0,J(e)},[]),[Je,ne]=r(null),[Qe,$e]=r(null),et=n(e=>{o.current=!0,ne(e)},[]),tt=n(e=>{o.current=!0,j(e)},[]),rt=n(e=>{o.current=!0,K(e)},[]),ot=n(e=>{o.current=!0,V(e)},[]),nt=n(e=>{o.current=!0,X(e)},[]),at=n(e=>{o.current=!0,Z(e)},[]),it=n(e=>{o.current=!0,Q(e)},[]),ct=n(e=>{o.current=!0,$(e)},[]),st=n(e=>{o.current=!0,ee(e)},[]),dt=n(e=>{o.current=!0,te(e)},[]),ut=n(e=>{o.current=!0,re(e)},[]);S(()=>{const e=k(u).theme;if(!h||!d.hasSiteTheme||!e)return;const a=i??"";oe.current!==a&&(oe.current=a,o.current=!1);let l=!1;return e.get(i?{siteId:i}:void 0).then(t=>{if(l||o.current)return;pe(t.default_mode),Se(t.show_theme_switch),E(t.default_mode),P(t.show_theme_switch),b(Dt({selected:t.selected_preset,themes:t.theme_presets},a));const g=ur(t);x(g.fonts),N(g.sizes),O(t.corner_radius_px===void 0?Xt[$t(t.corner_style)]:Qt(t.corner_radius_px)),z(g.compression),A(t.card_shadow==null?nr:er(t.card_shadow)),Y(t.card_gap==null?he:tr(t.card_gap)),U(t.hover_effect==null?ar:rr(t.hover_effect)),L(or(t.shadow_color)),j(kt(t.site_width)),K(Gt(t.site_gutter)),V(vt(t.site_gutter_phone)),X(ue(t.block_gap)),Z(ue(t.block_gap_phone)),J(g.typography),ne(g.textStyles),$e(hr(t)),Q(t.hero_background_follows_width===!0),$(de(t.section_background_width)),ee(de(t.section_content_width)),te(t.photography_grayscale===!0),re(t.share_button_on_posts===!0)}).catch(()=>{}),()=>{l=!0}},[h,i,d.hasSiteTheme,u]);const ht=Ot({token:h,siteId:i,enabled:d.hasSiteSettings}),[lt,ae]=r(xt),ie=f(null),v=f(!1),m=f(null),p=f({}),C=n(async()=>{m.current&&clearTimeout(m.current),m.current=null;const e=p.current;p.current={};try{await k(u).chat?.update(e,i?{siteId:i}:void 0),wt()}catch(a){throw p.current={...e,...p.current},a}},[u,i]);S(()=>Ct(()=>m.current||Object.keys(p.current).length>0?C():void 0),[C]);const mt=n(e=>{v.current=!0,ae(a=>({...a,...e})),!(!d.hasSiteSettings||!h)&&(p.current={...p.current,...e},m.current&&clearTimeout(m.current),m.current=setTimeout(()=>{C().catch(()=>{})},500))},[d.hasSiteSettings,h,C]);return S(()=>{if(!h||!d.hasSiteSettings)return;const e=i??"";ie.current!==e&&(ie.current=e,v.current=!1);let a=!1;const l=k(u).chat;if(l)return l.get(i?{siteId:i}:void 0).then(t=>{a||v.current||ae(lr(t))}).catch(()=>{}),()=>{a=!0}},[h,i,d.hasSiteSettings,u]),S(()=>{const e=c.site;if(!w||!d.hasSiteRecord||!e){I(null);return}let a=!1;return e().then(l=>{a||I(yt(l.name))}).catch(()=>{}),()=>{a=!0}},[w,h,d.hasSiteRecord,i,c]),s(Wt,{config:Fe,parts:sr,wrap:(e,a)=>s(Rt,{websiteName:fe,templateChrome:T,templateName:ge||null,themeMode:we,onThemeModeChange:Oe,themeSwitchShown:Ce,onThemeSwitchShownChange:ze,theme:_e,themeRow:Ft(d.hasSiteTheme,M.readFor,i??""),onThemeChange:Ae,fonts:Te,onFontsChange:Le,cornerRadiusPx:Pe,onCornerRadiusPxChange:Ue,cardShadow:Ge,onCardShadowChange:Ke,shadowColor:ve,onShadowColorChange:Ve,cardGap:ke,onCardGapChange:Xe,hoverEffect:He,onHoverEffectChange:Ze,headingCompression:ye,onHeadingCompressionChange:je,headingTypography:Ie,onHeadingTypographyChange:qe,textStyles:Je,onTextStylesChange:et,wordStyles:Qe,sizes:Ee,onSizesChange:Ye,siteWidth:We,onSiteWidthChange:tt,siteGutter:Be,onSiteGutterChange:rt,siteGutterPhone:Re,onSiteGutterPhoneChange:ot,blockGap:y,onBlockGapChange:nt,blockGapPhone:G,onBlockGapPhoneChange:at,heroBackgroundFollowsWidth:De,onHeroBackgroundFollowsWidthChange:it,sectionBackgroundWidth:Me,onSectionBackgroundWidthChange:ct,sectionContentWidth:be,onSectionContentWidthChange:st,photographyGrayscale:xe,onPhotographyGrayscaleChange:dt,shareButtonOnPosts:Ne,onShareButtonOnPostsChange:ut,themeFromDocument:!d.hasSiteTheme,children:s(Mt,{children:s(ft,{wrap:u.chrome?.wrap,surface:"page",children:s(Lt,{children:s(Yt,{children:s(Ut,{children:s(Kt,{children:s(jt,{children:pt(Vt,{children:[s(bt,{chat:lt,onChatChange:mt,children:s(Nt,{value:ht,children:s(zt,{children:e})})}),a]})})})})})})})})})})}function gr({target:c}){return s(Ht,{target:c,addressing:At,onHostMessage:dr,children:s(fr,{})})}export{gr as default};
|
|
@@ -19,7 +19,17 @@ export type SiteStylesTabItem = {
|
|
|
19
19
|
export declare const SITE_STYLES_TABS: SiteStylesTabItem[];
|
|
20
20
|
export declare function siteWidthPatch(v: number | null): SiteThemeRowPatch;
|
|
21
21
|
export declare function blockGapPatch(v: number | null): SiteThemeRowPatch;
|
|
22
|
+
export declare function blockGapPhonePatch(v: number | null): SiteThemeRowPatch;
|
|
22
23
|
export declare function siteGutterPatch(v: number | null): SiteThemeRowPatch;
|
|
24
|
+
export declare function siteGutterPhonePatch(v: number | null): SiteThemeRowPatch;
|
|
25
|
+
export declare function SideSpaceRootField({ persist, showHint, }: {
|
|
26
|
+
persist: (p: SiteThemeRowPatch, immediate?: boolean) => void;
|
|
27
|
+
showHint: boolean;
|
|
28
|
+
}): import("react").JSX.Element | null;
|
|
29
|
+
export declare function BlockGapRootField({ persist, showHint, }: {
|
|
30
|
+
persist: (p: SiteThemeRowPatch, immediate?: boolean) => void;
|
|
31
|
+
showHint: boolean;
|
|
32
|
+
}): import("react").JSX.Element | null;
|
|
23
33
|
export declare function PageGroupFields({ persist, showHint, }: {
|
|
24
34
|
persist: (p: SiteThemeRowPatch, immediate?: boolean) => void;
|
|
25
35
|
showHint?: boolean;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use client";import{jsx as n,Fragment as x,jsxs as w}from"react/jsx-runtime";import{useEasel as B,useRootFields as G}from"efficient-easel/easel";import{Inspector as W}from"efficient-easel/fields";import{SettingsGroup as v}from"efficient-easel/panel";import{useEffect as z,useRef as Y,useState as E}from"react";import j from"./ThemeField.js";import U from"./CornersField.js";import X from"./CardShadowField.js";import q from"./ShadowColourField.js";import K from"./BlockGapField.js";import M from"./HoverEffectField.js";import $ from"./PhotographyField.js";import V from"./ShareButtonField.js";import J from"./SideSpaceField.js";import{BackgroundWidthRow as Q,ContentWidthRow as Z,SITE_BACKGROUND_HINT as D,SITE_CONTENT_HINT as ee}from"./SectionWidthRows.js";import te from"./SiteAccentField.js";import ne from"./SiteTextStylesField.js";import{usePreviewHeader as S}from"../../render/components/PreviewHeaderContext.js";import{Button as oe,EmptyState as re,Tabs as ie,Tooltip as se,tabButtonId as ae,tabPanelId as ce}from"efficient-shell/ui";import{ContrastIcon as le,NoteIcon as ue,SettingsIcon as de,TypeIcon as he}from"efficient-easel/icons";import{useThemeRowPersist as pe}from"../lib/theme-row-persist.js";import{themeSaveNotice as fe}from"../../format/lib/theme-save-message.js";import{say as f}from"../../format/lib/editor-words.js";import{NEUTRAL_SITE_NAME as ge}from"../../format/lib/content/site-name.js";import{PAGE_WIDTH as R}from"../../format/lib/content/page-width.js";import{PAGE_STYLE_FIELDS as me}from"../lib/document/page-root-fields.js";import{previewFrame as Se}from"efficient-easel/screen/lib/document/preview-dom";import{useSiteTextStylesWriter as Ce}from"../lib/site-text-styles-writer.js";import{CORNER_STYLE_TO_PX as _e,normalizeCornerRadius as Te,normalizeCornerStyle as xe,normalizeShadowColor as we,selectedThemeColors as ye}from"../../format/lib/theme.js";const H="sf-site-styles",be="sf-site-styles-tabpanel",Pe=!1,Ee="Show hints";function Re({shown:e,onChange:t}){return n("div",{className:"sf-hints",children:n(oe,{type:"button",variant:"ghost","aria-pressed":e,leftIcon:n(ue,{size:13}),onClick:()=>t(!e),children:f(Ee)})})}const Bt="text",O="basics",N="this-page-group",I=[{id:O,label:"Basics",icon:n(de,{})},{id:"theme",label:"Theme",icon:n(le,{})},{id:"text",label:"Text",icon:n(he,{})}];function Ie({themeFromDocument:e,persist:t}){const{appState:o,dispatch:i}=B(l=>l),{theme:c,setTheme:r}=S(),p=o.data,h=p.root?.props??{},a=l=>{if(e){const g={...h,theme:l};i({type:"replaceRoot",root:{...p.root,props:g},recordHistory:!0})}else r(l);t({selected_preset:l.selected,theme_presets:l.themes})};return n(j,{value:e?h.theme:c,onChange:a})}function Fe({themeFromDocument:e,persist:t}){const[o,i]=E(null),{theme:c,setFonts:r,setSizes:p,setHeadingTypography:h}=S(),a=Ce({themeFromDocument:e,persist:t}),{old:l,saved:g,writeRoot:m}=a,u=a.fonts,d=a.sizes,T=a.typography,y=s=>s.values.size??Ne(Ae[s.id]??"body")??Be[s.kind],C=s=>a.write(s),F=He(c),b=s=>{const _={...u,accent:s};e?m({fonts:_}):r(_),t({accent_font:s})},P=s=>{p({...d,accent:s}),t({accent_size_px:s})},k=s=>{const _={...T,weightStrong:s};e?m({headingTypography:_}):h(_),t({heading_weight_strong:s})},L=s=>{const _={...T,italicStrong:s};e?m({headingTypography:_}):h(_),t({accent_italic:s})};return w(x,{children:[n(ne,{saved:g,old:l,colours:F,sizeOf:y,onChange:C,openId:o===A?null:o,onOpenChange:i,withoutSize:e}),n(te,{font:u.accent,size:d.accent,weight:T.weightStrong,italic:T.italicStrong,headingWeight:T.weight,open:o===A,onOpenChange:s=>i(s?A:null),onChange:s=>{s.key==="font"?b(s.value):s.key==="size"?P(s.value):s.key==="weight"?k(s.value):L(s.value)},withoutSize:e})]})}const A="accent";function He(e){const t=ye(e);return[{key:"accent",name:f("Accent"),value:t.accent},{key:"text",name:f("Text"),value:t.text},{key:"labels",name:f("Labels"),value:t.muted??t.text}]}const Ae={"heading-1":"heading","heading-2":"heading2","heading-3":"heading3","body-1":"body","body-5":"label"},Be={heading:32,body:14},Oe={heading:"main h1, main h2",heading2:"main h1, main h2",heading3:"main h1, main h2",accent:"main h1 em, main h2 em",body:"main p",label:"main .mono-eyebrow"};function Ne(e){if(typeof document>"u")return null;const o=(Se()?.contentDocument??document).querySelector(Oe[e]);if(!o)return null;const i=parseFloat(getComputedStyle(o).fontSize);return Number.isFinite(i)?i:null}function ke({themeFromDocument:e,persist:t,showHint:o}){const{appState:i,dispatch:c}=B(d=>d),{cornerRadiusPx:r,setCornerRadiusPx:p}=S(),h=i.data,a=h.root?.props??{},l=a.cornerRadiusPx===void 0?_e[xe(a.cornerStyle)]:Te(a.cornerRadiusPx),g=e?l:r,m=d=>c({type:"replaceRoot",root:{...h.root,props:{...a,...d}},recordHistory:!0});return n(U,{value:g,onChange:d=>{e?m({cornerRadiusPx:d}):p(d),t({corner_radius_px:d})},showHint:o})}function Le(e){return{site_width:e}}function Ge({persist:e,showHint:t}){const{siteWidth:o,setSiteWidth:i,sectionBackgroundWidth:c,setSectionBackgroundWidth:r,sectionContentWidth:p,setSectionContentWidth:h}=S(),a=typeof o=="number"?o:R.default,l=u=>{i(u),e(Le(u),u===null)},g=u=>{r(u),e({section_background_width:u},!0)},m=u=>{h(u),e({section_content_width:u},!0)};return w(x,{children:[n(Q,{value:c??"full",changed:c!==null,detail:f("Full width"),onChange:g,onReset:()=>g(null),hint:t?D:void 0}),n(Z,{mode:p??"content",px:a,min:R.min,max:R.max,changed:typeof o=="number"||p!==null,detail:`${f("Content width")} ${R.default}px`,onMode:m,onPx:u=>l(u),onReset:()=>{m(null),l(null)},hint:t?ee:void 0})]})}function We(e){return{block_gap:e}}function ve(e){return{site_gutter:e}}function ze({persist:e,showHint:t}){const{siteGutter:o,setSiteGutter:i}=S();return n(J,{value:o,onChange:r=>{i(r),e(ve(r),r===null)},showHint:t})}function Ye({persist:e,showHint:t}){const{blockGap:o,setBlockGap:i}=S();return n(K,{value:o,onChange:r=>{i(r),e(We(r),r===null)},showHint:t})}function je({persist:e,showHint:t=!0}){return w(x,{children:[n(Ge,{persist:e,showHint:t}),n(ze,{persist:e,showHint:t}),n(Ye,{persist:e,showHint:t})]})}function Ue(e){return{card_shadow:e}}function Xe(e){return e===null?{shadow_color:null}:{shadow_color:we(e)}}function qe(e){return{hover_effect:e}}function Ke({persist:e,showHint:t=!0}){const{cardShadow:o,setCardShadow:i,shadowColor:c,setShadowColor:r,hoverEffect:p,setHoverEffect:h}=S();return w(x,{children:[n(X,{value:o,onChange:a=>{i(a),e(Ue(a),!0)},showHint:t}),n(q,{value:c,onChange:a=>{r(a),e(Xe(a),a===null)},showHint:t}),n(M,{value:p,onChange:a=>{h(a),e(qe(a),!0)},showHint:t})]})}function Me(e){return{photography_grayscale:e}}function $e({persist:e,showHint:t}){const{photographyGrayscale:o,setPhotographyGrayscale:i}=S();return n($,{value:o,onChange:r=>{i(r),e(Me(r),!0)},showHint:t})}function Ve({persist:e,showHint:t=!0}){return n(x,{children:n($e,{persist:e,showHint:t})})}function Je(e){return{share_button_on_posts:e}}function Qe({persist:e,showHint:t=!0}){const{shareButtonOnPosts:o,setShareButtonOnPosts:i}=S();return n(V,{value:o,onChange:r=>{i(r),e(Je(r),!0)},showHint:t})}function Ze(){const{websiteName:e}=S();return e?.trim()||ge}function Ot(){const e=Ze();return n(se,{content:f("{name} — renamed in the Console: {place}.",{name:e,place:f("Storefront ▸ Sites ▸ Settings")}),className:"sf-name-tip",children:n("span",{className:"sf-panel-site",children:e})})}function De({themeFromDocument:e=!1,tokenRef:t,siteId:o,onNotify:i,tab:c,onTabChange:r,initialTab:p,revealPageGroup:h=!1,onPageGroupRevealed:a}){const{persist:l}=pe({themeFromDocument:e,tokenRef:t,siteId:o,onResult:b=>{const P=fe(b);P&&i?.(P.msg,P.tone)}}),[g,m]=E(p??I[0].id),u=c!==void 0,d=u?c:g,T=u?r??(()=>{}):m,y=I.find(b=>b.id===d)??I[0],[C,F]=E(Pe);return w(x,{children:[n(nt,{activeId:y.id,onSelect:T}),w("div",{id:ce(H,y.id),className:be,role:"tabpanel","aria-labelledby":ae(H,y.id),children:[d===O&&w(x,{children:[n(ke,{themeFromDocument:e,persist:l,showHint:C}),!e&&n(Ke,{persist:l,showHint:C}),!e&&n(je,{persist:l,showHint:C}),!e&&n(Ve,{persist:l,showHint:C}),!e&&n(Qe,{persist:l,showHint:C}),n(et,{reveal:h,onRevealed:a}),n(Re,{shown:C,onChange:F})]}),d==="theme"&&n(Ie,{themeFromDocument:e,persist:l}),d==="text"&&n(Fe,{themeFromDocument:e,persist:l})]})]})}function et({reveal:e,onRevealed:t}){const[o,i]=E(!0),c=Y(t);return c.current=t,z(()=>{if(!e)return;i(!0);const r=requestAnimationFrame(()=>{document.getElementById(N)?.scrollIntoView({block:"start"}),c.current?.()});return()=>cancelAnimationFrame(r)},[e]),n(v,{title:f("This page"),open:o,onToggle:i,id:N,children:n(tt,{})})}function tt(){const{fields:e,values:t,readOnly:o,onChange:i}=G(),c=Object.fromEntries(me.filter(r=>r in e).map(r=>[r,e[r]]));return Object.keys(c).length===0?n(re,{variant:"none",icon:!1,message:f("This page has no look of its own to set.")}):n(W,{fields:c,values:t,onChange:i,readOnly:o,tabs:!1,idPrefix:"this-page",ariaLabel:f("This page")})}function nt({activeId:e,onSelect:t}){return n("div",{className:"es-insp-tabs",children:n(ie,{variant:"underline",block:!0,labelsFit:!0,"aria-label":f("Styles"),idPrefix:H,value:e,onChange:t,items:I.map(o=>{const i=f(o.label);return{id:o.id,icon:o.icon,label:i}})})})}export{Ke as CardLookFields,Re as HintsToggle,je as PageGroupFields,Ve as PhotographyGroupFields,Pe as SHOW_HINTS_DEFAULT,O as SITE_STYLES_BASICS_TAB,H as SITE_STYLES_ID_PREFIX,I as SITE_STYLES_TABS,Bt as SITE_STYLES_TEXT_TAB,Qe as ShareButtonRootField,nt as SiteStylesTabStrip,be as TABPANEL_CLASS,N as THIS_PAGE_GROUP_ID,Ot as WebsiteNameReadonly,We as blockGapPatch,Ue as cardShadowPatch,De as default,qe as hoverEffectPatch,Me as photographyPatch,Xe as shadowColourPatch,Je as shareButtonPatch,ve as siteGutterPatch,Le as siteWidthPatch,Ze as useWebsiteName};
|
|
1
|
+
"use client";import{jsx as o,Fragment as T,jsxs as C}from"react/jsx-runtime";import{useEasel as H,useRootFields as W}from"efficient-easel/easel";import{Inspector as z}from"efficient-easel/fields";import{SettingsGroup as Y}from"efficient-easel/panel";import{useEffect as j,useRef as U,useState as R}from"react";import X from"./ThemeField.js";import q from"./CornersField.js";import K from"./CardShadowField.js";import M from"./ShadowColourField.js";import $,{blockGapRow as V}from"./BlockGapField.js";import J from"./HoverEffectField.js";import Q from"./PhotographyField.js";import Z from"./ShareButtonField.js";import{usePreviewDevice as v}from"efficient-easel/draw/client";import D,{sideSpaceRow as ee}from"./SideSpaceField.js";import{BackgroundWidthRow as te,ContentWidthRow as oe,SITE_BACKGROUND_HINT as ne,SITE_CONTENT_HINT as re}from"./SectionWidthRows.js";import ie from"./SiteAccentField.js";import se from"./SiteTextStylesField.js";import{usePreviewHeader as m}from"../../render/components/PreviewHeaderContext.js";import{Button as ae,EmptyState as ce,Tabs as le,Tooltip as ue,tabButtonId as de,tabPanelId as he}from"efficient-shell/ui";import{ContrastIcon as pe,NoteIcon as fe,SettingsIcon as ge,TypeIcon as me}from"efficient-easel/icons";import{useThemeRowPersist as Se}from"../lib/theme-row-persist.js";import{themeSaveNotice as _e}from"../../format/lib/theme-save-message.js";import{say as p}from"../../format/lib/editor-words.js";import{NEUTRAL_SITE_NAME as we}from"../../format/lib/content/site-name.js";import{PAGE_WIDTH as E}from"../../format/lib/content/page-width.js";import{PAGE_STYLE_FIELDS as xe}from"../lib/document/page-root-fields.js";import{previewFrame as Te}from"efficient-easel/screen/lib/document/preview-dom";import{useSiteTextStylesWriter as Ce}from"../lib/site-text-styles-writer.js";import{CORNER_STYLE_TO_PX as be,normalizeCornerRadius as ye,normalizeCornerStyle as Pe,normalizeShadowColor as Re,selectedThemeColors as Ee}from"../../format/lib/theme.js";const F="sf-site-styles",ke="sf-site-styles-tabpanel",Ie=!1,ve="Show hints";function Fe({shown:e,onChange:t}){return o("div",{className:"sf-hints",children:o(ae,{type:"button",variant:"ghost","aria-pressed":e,leftIcon:o(fe,{size:13}),onClick:()=>t(!e),children:p(ve)})})}const Wt="text",A="basics",B="this-page-group",k=[{id:A,label:"Basics",icon:o(ge,{})},{id:"theme",label:"Theme",icon:o(pe,{})},{id:"text",label:"Text",icon:o(me,{})}];function Ge({themeFromDocument:e,persist:t}){const{appState:n,dispatch:r}=H(d=>d),{theme:l,setTheme:s}=m(),u=n.data,h=u.root?.props??{},i=d=>{if(e){const f={...h,theme:d};r({type:"replaceRoot",root:{...u.root,props:f},recordHistory:!0})}else s(d);t({selected_preset:d.selected,theme_presets:d.themes})};return o(X,{value:e?h.theme:l,onChange:i})}function He({themeFromDocument:e,persist:t}){const[n,r]=R(null),{theme:l,setFonts:s,setSizes:u,setHeadingTypography:h}=m(),i=Ce({themeFromDocument:e,persist:t}),{old:d,saved:f,writeRoot:g}=i,S=i.fonts,a=i.sizes,x=i.typography,b=c=>c.values.size??Le(Be[c.id]??"body")??Oe[c.kind],_=c=>i.write(c),I=Ae(l),y=c=>{const w={...S,accent:c};e?g({fonts:w}):s(w),t({accent_font:c})},P=c=>{u({...a,accent:c}),t({accent_size_px:c})},N=c=>{const w={...x,weightStrong:c};e?g({headingTypography:w}):h(w),t({heading_weight_strong:c})},L=c=>{const w={...x,italicStrong:c};e?g({headingTypography:w}):h(w),t({accent_italic:c})};return C(T,{children:[o(se,{saved:f,old:d,colours:I,sizeOf:b,onChange:_,openId:n===G?null:n,onOpenChange:r,withoutSize:e}),o(ie,{font:S.accent,size:a.accent,weight:x.weightStrong,italic:x.italicStrong,headingWeight:x.weight,open:n===G,onOpenChange:c=>r(c?G:null),onChange:c=>{c.key==="font"?y(c.value):c.key==="size"?P(c.value):c.key==="weight"?N(c.value):L(c.value)},withoutSize:e})]})}const G="accent";function Ae(e){const t=Ee(e);return[{key:"accent",name:p("Accent"),value:t.accent},{key:"text",name:p("Text"),value:t.text},{key:"labels",name:p("Labels"),value:t.muted??t.text}]}const Be={"heading-1":"heading","heading-2":"heading2","heading-3":"heading3","body-1":"body","body-5":"label"},Oe={heading:32,body:14},Ne={heading:"main h1, main h2",heading2:"main h1, main h2",heading3:"main h1, main h2",accent:"main h1 em, main h2 em",body:"main p",label:"main .mono-eyebrow"};function Le(e){if(typeof document>"u")return null;const n=(Te()?.contentDocument??document).querySelector(Ne[e]);if(!n)return null;const r=parseFloat(getComputedStyle(n).fontSize);return Number.isFinite(r)?r:null}function We({themeFromDocument:e,persist:t,showHint:n}){const{appState:r,dispatch:l}=H(a=>a),{cornerRadiusPx:s,setCornerRadiusPx:u}=m(),h=r.data,i=h.root?.props??{},d=i.cornerRadiusPx===void 0?be[Pe(i.cornerStyle)]:ye(i.cornerRadiusPx),f=e?d:s,g=a=>l({type:"replaceRoot",root:{...h.root,props:{...i,...a}},recordHistory:!0});return o(q,{value:f,onChange:a=>{e?g({cornerRadiusPx:a}):u(a),t({corner_radius_px:a})},showHint:n})}function ze(e){return{site_width:e}}function Ye({persist:e,showHint:t}){const{siteWidth:n,setSiteWidth:r,sectionBackgroundWidth:l,setSectionBackgroundWidth:s,sectionContentWidth:u,setSectionContentWidth:h}=m();if(v()!=="desktop")return null;const d=typeof n=="number"?n:E.default,f=a=>{r(a),e(ze(a),a===null)},g=a=>{s(a),e({section_background_width:a},!0)},S=a=>{h(a),e({section_content_width:a},!0)};return C(T,{children:[o(te,{value:l??"full",changed:l!==null,detail:p("Full width"),onChange:g,onReset:()=>g(null),hint:t?ne:void 0}),o(oe,{mode:u??"content",px:d,min:E.min,max:E.max,changed:typeof n=="number"||u!==null,detail:`${p("Content width")} ${E.default}px`,onMode:S,onPx:a=>f(a),onReset:()=>{S(null),f(null)},hint:t?re:void 0})]})}function je(e){return{block_gap:e}}function Ue(e){return{block_gap_phone:e}}function Xe(e){return{site_gutter:e}}function qe(e){return{site_gutter_phone:e}}function O(e,[t,n],r){t(e),r(n(e),e===null)}function Ke({persist:e,showHint:t}){const{siteGutter:n,siteGutterPhone:r,setSiteGutter:l,setSiteGutterPhone:s}=m(),u=ee(v(),{gutter:n,phone:r});if(!u)return null;const h=u.key==="site_gutter_phone"?[s,qe]:[l,Xe];return o(D,{value:u.value,onChange:i=>O(i,h,e),showHint:t,unsetPx:u.unsetPx,bounds:u.bounds})}function Me({persist:e,showHint:t}){const{blockGap:n,blockGapPhone:r,setBlockGap:l,setBlockGapPhone:s}=m(),u=V(v(),{gap:n,phone:r});if(!u)return null;const h=u.key==="block_gap_phone"?[s,Ue]:[l,je];return o($,{value:u.value,onChange:i=>O(i,h,e),showHint:t,followsPx:u.followsPx})}function $e({persist:e,showHint:t=!0}){return C(T,{children:[o(Ye,{persist:e,showHint:t}),o(Ke,{persist:e,showHint:t}),o(Me,{persist:e,showHint:t})]})}function Ve(e){return{card_shadow:e}}function Je(e){return e===null?{shadow_color:null}:{shadow_color:Re(e)}}function Qe(e){return{hover_effect:e}}function Ze({persist:e,showHint:t=!0}){const{cardShadow:n,setCardShadow:r,shadowColor:l,setShadowColor:s,hoverEffect:u,setHoverEffect:h}=m();return C(T,{children:[o(K,{value:n,onChange:i=>{r(i),e(Ve(i),!0)},showHint:t}),o(M,{value:l,onChange:i=>{s(i),e(Je(i),i===null)},showHint:t}),o(J,{value:u,onChange:i=>{h(i),e(Qe(i),!0)},showHint:t})]})}function De(e){return{photography_grayscale:e}}function et({persist:e,showHint:t}){const{photographyGrayscale:n,setPhotographyGrayscale:r}=m();return o(Q,{value:n,onChange:s=>{r(s),e(De(s),!0)},showHint:t})}function tt({persist:e,showHint:t=!0}){return o(T,{children:o(et,{persist:e,showHint:t})})}function ot(e){return{share_button_on_posts:e}}function nt({persist:e,showHint:t=!0}){const{shareButtonOnPosts:n,setShareButtonOnPosts:r}=m();return o(Z,{value:n,onChange:s=>{r(s),e(ot(s),!0)},showHint:t})}function rt(){const{websiteName:e}=m();return e?.trim()||we}function zt(){const e=rt();return o(ue,{content:p("{name} — renamed in the Console: {place}.",{name:e,place:p("Storefront ▸ Sites ▸ Settings")}),className:"sf-name-tip",children:o("span",{className:"sf-panel-site",children:e})})}function it({themeFromDocument:e=!1,tokenRef:t,siteId:n,onNotify:r,tab:l,onTabChange:s,initialTab:u,revealPageGroup:h=!1,onPageGroupRevealed:i}){const{persist:d}=Se({themeFromDocument:e,tokenRef:t,siteId:n,onResult:y=>{const P=_e(y);P&&r?.(P.msg,P.tone)}}),[f,g]=R(u??k[0].id),S=l!==void 0,a=S?l:f,x=S?s??(()=>{}):g,b=k.find(y=>y.id===a)??k[0],[_,I]=R(Ie);return C(T,{children:[o(ct,{activeId:b.id,onSelect:x}),C("div",{id:he(F,b.id),className:ke,role:"tabpanel","aria-labelledby":de(F,b.id),children:[a===A&&C(T,{children:[o(We,{themeFromDocument:e,persist:d,showHint:_}),!e&&o(Ze,{persist:d,showHint:_}),!e&&o($e,{persist:d,showHint:_}),!e&&o(tt,{persist:d,showHint:_}),!e&&o(nt,{persist:d,showHint:_}),o(st,{reveal:h,onRevealed:i}),o(Fe,{shown:_,onChange:I})]}),a==="theme"&&o(Ge,{themeFromDocument:e,persist:d}),a==="text"&&o(He,{themeFromDocument:e,persist:d})]})]})}function st({reveal:e,onRevealed:t}){const[n,r]=R(!0),l=U(t);return l.current=t,j(()=>{if(!e)return;r(!0);const s=requestAnimationFrame(()=>{document.getElementById(B)?.scrollIntoView({block:"start"}),l.current?.()});return()=>cancelAnimationFrame(s)},[e]),o(Y,{title:p("This page"),open:n,onToggle:r,id:B,children:o(at,{})})}function at(){const{fields:e,values:t,readOnly:n,onChange:r}=W(),l=Object.fromEntries(xe.filter(s=>s in e).map(s=>[s,e[s]]));return Object.keys(l).length===0?o(ce,{variant:"none",icon:!1,message:p("This page has no look of its own to set.")}):o(z,{fields:l,values:t,onChange:r,readOnly:n,tabs:!1,idPrefix:"this-page",ariaLabel:p("This page")})}function ct({activeId:e,onSelect:t}){return o("div",{className:"es-insp-tabs",children:o(le,{variant:"underline",block:!0,labelsFit:!0,"aria-label":p("Styles"),idPrefix:F,value:e,onChange:t,items:k.map(n=>{const r=p(n.label);return{id:n.id,icon:n.icon,label:r}})})})}export{Me as BlockGapRootField,Ze as CardLookFields,Fe as HintsToggle,$e as PageGroupFields,tt as PhotographyGroupFields,Ie as SHOW_HINTS_DEFAULT,A as SITE_STYLES_BASICS_TAB,F as SITE_STYLES_ID_PREFIX,k as SITE_STYLES_TABS,Wt as SITE_STYLES_TEXT_TAB,nt as ShareButtonRootField,Ke as SideSpaceRootField,ct as SiteStylesTabStrip,ke as TABPANEL_CLASS,B as THIS_PAGE_GROUP_ID,zt as WebsiteNameReadonly,je as blockGapPatch,Ue as blockGapPhonePatch,Ve as cardShadowPatch,it as default,Qe as hoverEffectPatch,De as photographyPatch,Je as shadowColourPatch,ot as shareButtonPatch,Xe as siteGutterPatch,qe as siteGutterPhonePatch,ze as siteWidthPatch,rt as useWebsiteName};
|
|
@@ -1,3 +1,7 @@
|
|
|
1
1
|
import { type TimedMotionGroup } from "efficient-shell/format";
|
|
2
2
|
export declare function animationDurationField(group: TimedMotionGroup): import("efficient-easel/screen/lib/document/box-fields").BoxField<number>;
|
|
3
3
|
export declare function animationDelayField(group: TimedMotionGroup): import("efficient-easel/screen/lib/document/box-fields").BoxField<number>;
|
|
4
|
+
export declare function loopDurationField({ readsSpeed }: {
|
|
5
|
+
readsSpeed: boolean;
|
|
6
|
+
}): import("efficient-easel/screen/lib/document/box-fields").BoxField<number>;
|
|
7
|
+
export declare function loopDelayField(): import("efficient-easel/screen/lib/document/box-fields").BoxField<number>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{jsx as
|
|
1
|
+
import{jsx as i}from"react/jsx-runtime";import{ClockIcon as m,DurationIcon as p}from"efficient-easel/icons";import{MOTION_TIMING as a}from"efficient-shell/format";import{slider as s}from"../document/box-fields.js";import{useSelectedHost as d}from"../document/selected-host.js";import{loopDelayOf as c,loopSecondsOf as f}from"../../../format/lib/animation/loop.js";function x(o){const{min:t,max:n,step:r,default:e}=a[o].duration;return s("Duration",i(p,{}),t,n,r,e,"s")}function D(o){const{min:t,max:n,step:r,default:e}=a[o].delay;return s("Delay",i(m,{}),t,n,r,e,"s")}function u(o,t){const n=o.render,r=e=>{const l=d();return n({...e,value:t(e.value,l?.values)})};return{...o,render:e=>i(r,{...e})}}function w({readsSpeed:o}){return u(x("loop"),(t,n)=>f({loopDuration:t,speed:o?n?.speed:void 0}))}function g(){return u(D("loop"),o=>c({loopDelay:o}))}export{D as animationDelayField,x as animationDurationField,g as loopDelayField,w as loopDurationField};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{jsx as e,jsxs as
|
|
1
|
+
import{jsx as e,jsxs as a}from"react/jsx-runtime";import{phoneKey as s}from"efficient-easel/draw";import{SettingsDefaultReset as O,SettingsField as R}from"efficient-easel/panel";import{AnimationIcon as N,ClockIcon as w,DirectionDownIcon as A,DirectionIcon as T,DirectionLeftIcon as L,DirectionRightIcon as P,DirectionUpIcon as S,DurationIcon as B}from"efficient-easel/icons";import{deviceField as p}from"efficient-easel/screen/lib/document/device-fields";import{NoControlMark as G,noControlField as U}from"efficient-easel/screen/lib/document/panel-no-control-mark";import{describedAs as k,group as j,phoneTwinFields as W}from"efficient-easel/screen/lib/document/box-fields";import{ENTRANCE_FROM as Y,ENTRANCE_FROM_DEFAULT as I,ENTRANCE_KINDS as h,ENTRANCE_KINDS_WITH_FROM as g,MOTION_TIMING as H,entranceAttrs as z,playEntrance as V,readEntrance as q}from"efficient-shell/format";import{IconPicker as J}from"efficient-shell/ui";import{segmented as Q}from"../document/box-fields.js";import{phoneOverrideField as _,useSelectedProps as v}from"../document/controls.js";import{withRowRules as X}from"../../../format/lib/document/show-when-attach.js";import{editorEaselWords as Z,say as l}from"../../../format/lib/editor-words.js";import{animationDelayField as $,animationDurationField as ee}from"./AnimationDurationRow.js";import{ENTRANCE_KEYS as t,LEGACY_ENTRANCE_KEY as D,entranceOf as C}from"../../../render/lib/animation/entrance.js";import{ENTRANCE_GROUP_KEY as ne}from"../../../format/lib/animation/index.js";const m={none:"None",fade:"Fade",rise:"Rise",scale:"Scale",glide:"Glide",bounce:"Bounce",flip:"Flip",reveal:"Reveal",spin:"Spin"},oe={top:"Top",bottom:"Bottom",left:"Left",right:"Right"},te={top:()=>e(A,{}),bottom:()=>e(S,{}),left:()=>e(P,{}),right:()=>e(L,{})},u="Entrance",x=h.filter(n=>n!=="none"),y=n=>({any:[{field:t.kind,in:n},{all:[{field:t.kind,set:!1},{field:D,in:n}]}]}),b=n=>({any:[{field:s(t.kind),in:n},{all:[{field:s(t.kind),set:!1},y(n)]}]}),ie=[[[t.from],y(g)],[[s(t.from)],b(g)],[[t.duration,t.delay],y(x)],[[s(t.duration),s(t.delay)],b(x)]],c=({children:n})=>e("svg",{viewBox:"0 0 40 40",width:"40",height:"40",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":!0,children:n}),r=({x:n=12,y:o=12,o:i=1})=>e("rect",{x:n,y:o,width:"16",height:"16",rx:"2",opacity:i}),re={none:e(c,{children:e(r,{})}),fade:a(c,{children:[e(r,{x:6,o:.3}),e(r,{x:18})]}),rise:a(c,{children:[e(r,{y:20,o:.3}),e(r,{y:8}),e("path",{d:"M20 36v-5m-2 2 2-2 2 2"})]}),scale:a(c,{children:[e("rect",{x:"16",y:"16",width:"8",height:"8",rx:"1",opacity:".35"}),e(r,{}),e("path",{d:"M6 6l4 4M34 34l-4-4"})]}),glide:a(c,{children:[e(r,{x:2,o:.3}),e(r,{x:20}),e("path",{d:"M4 33h12m-2-2 2 2-2 2"})]}),bounce:a(c,{children:[e(r,{y:6}),e("path",{d:"M8 34c3-6 5-6 8 0s5 6 8 0 5-6 8 0"})]}),flip:a(c,{children:[e("path",{d:"M12 12l16 4v8l-16 4z",opacity:".35"}),e(r,{}),e("path",{d:"M20 4v32",strokeDasharray:"2 2"})]}),reveal:a(c,{children:[e("rect",{x:"12",y:"12",width:"16",height:"16",rx:"2",strokeDasharray:"2 2",opacity:".5"}),e("path",{d:"M12 22h16v4a2 2 0 0 1-2 2H14a2 2 0 0 1-2-2z",fill:"currentColor",opacity:".35"}),e("path",{d:"M20 36v-5m-2 2 2-2 2 2"})]}),spin:a(c,{children:[e(r,{}),e("path",{d:"M33 14a14 14 0 0 1 0 12m0 0-3-1m3 1 1-3"})]})};function ae({kind:n}){const{attrs:o}=z(q(n,I));return a("span",{className:"sf-entrance-pic",children:[e("span",{className:"sf-entrance-stage",children:e("i",{...o,children:re[n]})}),e("span",{className:"sf-entrance-cap",children:l(m[n])})]})}const le=(n,o)=>{const i=o.querySelector(".sf-entrance-stage > i");i&&V(i)},ce={width:"3.5rem",height:"4.25rem"};function F({value:n,onChange:o}){return e(J,{label:l(u),value:n,emptyValue:"none",columns:3,cell:ce,onChange:o,onPreview:le,tooltips:!1,options:h.map(i=>({value:i,label:l(m[i]),icon:e(ae,{kind:i})}))})}const E="Effect",M=n=>n==="none"?void 0:l(m[n]);function se({value:n,onChange:o}){const i=v(),d=C({...i,[t.kind]:n},"desktop").kind;return e(R,{label:l(E),icon:e(N,{}),value:M(d),children:e(F,{value:d,onChange:o})})}function de({value:n,onChange:o}){const i=v(),d=typeof n=="string"&&h.includes(n),f=C(i,"desktop").kind;return e(R,{label:l(E),icon:e(N,{}),value:M(d?n:f),changed:d,action:e(O,{words:Z()?.panel,label:l(E),changed:d,detail:l("{value} on desktop",{value:l(m[f])}),onReset:()=>o(void 0)}),children:e(F,{value:d?n:f,onChange:o})})}const K={type:"select",label:u,options:h.map(n=>({value:n,label:m[n]}))},pe=()=>k({type:"custom",render:({value:n,onChange:o})=>e(se,{value:n,onChange:o})},K),me=()=>k({type:"custom",render:({value:n,onChange:o})=>e(de,{value:n,onChange:o})},K),he=Y.map(n=>({label:oe[n],value:n,picture:te[n]()}));function Me(){const{duration:n,delay:o}=H.entrance,i={[ne]:j(u),[t.kind]:p("desktop",pe()),[D]:U({type:"custom",render:()=>e(G,{})},"always"),[s(t.kind)]:p("mobile",me()),...W(t.from,Q("From",e(T,{}),he,I)),[t.duration]:p("desktop",ee("entrance")),[s(t.duration)]:p("mobile",_({label:"Duration",desktopKey:t.duration,icon:e(B,{}),min:n.min,max:n.max,step:n.step,fallback:n.default,unit:"s"})),[t.delay]:p("desktop",$("entrance")),[s(t.delay)]:p("mobile",_({label:"Delay",desktopKey:t.delay,icon:e(w,{}),min:o.min,max:o.max,step:o.step,fallback:o.default,unit:"s"}))};return X(i,ie)}export{re as ENTRANCE_PICTURE,Me as entranceFields};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{
|
|
1
|
+
import{loopDelayField as r,loopDurationField as i}from"./AnimationDurationRow.js";import{entranceFields as o}from"./entrance-fields.js";import{loopDirectionField as l,loopFields as t}from"./loop-fields.js";function p(e){switch(e){case"section":case"block":return o();case"box":return{...o(),...t()};case"marquee":return{...o(),scrollDirection:l(),loopDuration:i({readsSpeed:!0}),loopDelay:r()}}}export{p as animationTabFields};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{jsx as
|
|
1
|
+
import{jsx as e}from"react/jsx-runtime";import{DirectionIcon as i,LoopIcon as t}from"efficient-easel/icons";import{select as n}from"../document/box-fields.js";import{EDGE_ARROWS as l,edgePad as p}from"../document/controls.js";import{withShowWhen as o}from"../../../format/lib/document/show-when-attach.js";import{loopDelayField as O,loopDurationField as m}from"./AnimationDurationRow.js";import{DEFAULT_LOOP_DIRECTION as a,LOOP_DIRECTION_OPTIONS as c,LOOP_NONE as s,LOOP_OPTIONS as D,LOOP_SCROLLS as r}from"../../../format/lib/animation/loop.js";function d(){return p("Scroll direction",c,a,"A marquee cannot run diagonally, so the corners are not answers.",e(i,{}),l)}function E(){return{loop:n("Loop",e(t,{}),D,s),scrollDirection:o(d(),r),loopDuration:o(m({readsSpeed:!1}),r),loopDelay:o(O(),r)}}export{d as loopDirectionField,E as loopFields};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{jsx as
|
|
1
|
+
import{jsx as o}from"react/jsx-runtime";import{phoneKey as n}from"efficient-easel/draw";import{BOX_CARD_PAD as l,BOX_DARKEN as a,BOX_DARKEN_STYLES as c,isBackgroundBox as B}from"../../../../../../format/lib/content/box-background.js";import{containerDirectionPoints as F}from"../../../../../../format/lib/content/container-direction.js";import{BOX_TAB_SHAPES as R,REEL_SHAPE_LABELS as T}from"../../../../../../format/lib/reel.js";import{deviceField as r}from"efficient-easel/screen/lib/document/device-fields";import{ClockIcon as y,CropIcon as m,LineBetweenIcon as E,LineSolidIcon as N,OpacityIcon as C,ShadowIcon as P,StylesIcon as h,TargetIcon as H}from"efficient-easel/icons";import{boxBlockSpacingField as D,boxFillField as X,boxColumnsFields as M,boxShareField as j,boxSharePhoneField as W,containerGapRows as v,linkField as U,plainText as K,swapPadding as g,toggle as s,upload as f,withPanelOnly as G}from"../../../controls.js";import{BOX_SHAPE_OPTIONS as S,boxShapeOf as z}from"../../../../../../format/lib/content/box-shape.js";import{BOX_COLUMNS_MAX as J,BOX_COLUMNS_MIN as V,boxPhoneRowOneLine as Y}from"../../../../../../format/lib/content/box-layout.js";import{BOX_SEPARATOR_POINTS as q}from"../../../../../../format/lib/content/box-separator.js";import{group as i,phoneTwinFields as _}from"efficient-easel/screen/lib/document/box-fields";import{boxAlignField as Q,boxJustifyField as Z,boxWrapField as b,placementField as $,segmented as ee,select as d,sidesPaddingFields as u,slider as oe}from"../../../box-fields.js";import{withRowRules as te}from"../../../../../../render/lib/document/show-when.js";import{separatorField as ne}from"../../../separator-field.js";import{LOOP_SCROLLS as ie}from"../../../../../../format/lib/animation/index.js";import{FlexSlots as ae}from"../../../../../../format/lib/document/blocks/general/Flex/meta.js";import{CARD_BOX_FACTS as le,cardDisplayField as re}from"../../../card-display-chips.js";const se={field:"bgImage",set:!0},O={field:"phoneRow",in:[2,3]},pe={field:"direction",is:"tabs"},de={field:"line",in:[!0,!1]},ce={field:"anchor",set:!0},x=["fixed","screen"],me={not:{any:[{field:"sectionHeightMode",in:x},{field:"sectionHeightModePhone",in:x}]}},he={context:"parent.line",is:!0},k={field:"direction",is:"row",default:"row"},p={not:ie},A={all:[k,p,{not:{field:"separator",in:q.map(e=>e.value)}},{not:{field:"line",is:!0}}]},ge={not:{context:"device",is:"tablet"}},w={not:{all:[A,{field:"columns",in:Array.from({length:J},(e,t)=>t+V)}]}};function fe(e){return{...e,render:t=>e.render({...t,value:Y(t.value)?"nowrap":"wrap"})}}const Pe={fields:te({_gContent:i("Content"),content:ae.content,_gCardDisplay:i("Display"),cardDisplay:re(),_gLayout:i("Layout"),direction:{type:"radio",options:F("Flex")},tabShape:d("Tab shape",o(h,{}),R.map(e=>({label:T[e],value:e})),"tabs"),label:G(K("Tab name")),...v("Flex"),justify:Z(),align:Q(),..._("wrap",b(),void 0,{phoneRow:fe(b())}),boxShape:r("desktop",d("Box shape",o(m,{}),[...S],"auto")),[n("boxShape")]:_("boxShape",ee("Box shape",o(m,{}),[...S],"auto",{phoneRest:e=>z(e)}))[n("boxShape")],separator:ne(o(E,{size:18}),"none"),share:r("desktop",j()),[n("share")]:W(),...M(),blockSpacing:D(),line:s("Line",!1,o(N,{}),"A line across the blocks, with a dot on each."),upcoming:s("Upcoming",!1,o(y,{}),"Still to come: a hollow dot, and the gold line stops before it."),_gShadow:i("Shadow"),shadow:s("Shadow",!1,o(P,{})),fillColor:X(),_gBackground:i("Background image"),bgImage:r("desktop",f("Image","image/*")),bgImagePhone:r("mobile",f("Image","image/*")),darken:oe("Darken",o(C,{}),a.min,a.max,a.step,a.fallback,a.unit),darkenStyle:d("Darken style",o(h,{}),c,c[0].value),placement:$("Content position"),_gLink:i("Link"),link:U("Link to"),jumpHighlight:s("Highlight when a link jumps here",!1,o(H,{}),"When a link lands on this Box's anchor, the Box gets an accent outline and its first block turns accent.")},[[["darken","darkenStyle","placement"],se],[[n("share")],O],[[n("wrap")],{all:[O,p]}],[["tabShape"],pe],[["separator"],k],[["columns"],{all:[A,ge]}],[["justify"],p],[["wrap"],{all:[p,w]}],[["share"],w],[["line"],de],[["upcoming"],he],[["jumpHighlight"],ce],[["boxShape",n("boxShape")],me]]),resolveFields:(e,{fields:t})=>{const I=e.props;if(B(I.bgImage)){const L=u({fallback:{top:l.desktop,bottom:l.desktop,left:l.side,right:l.side}});return g(t,L)}return e.props.padV2!==!0?g(t,u({fallback:{top:24,bottom:24}})):t},showWhenFacts:le};export{Pe as FlexFields};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{jsx as
|
|
1
|
+
import{jsx as l}from"react/jsx-runtime";import{FieldGlyph as i}from"../../../../../components/FieldGlyph.js";import{COUNT_KEY_PROP as n}from"../../../../../../format/lib/content/block-sources.js";import{CARD_ROW_FACTS as s,cardRowField as m,cardRowFields as p}from"../../../card-row-fields.js";import{textarea as a}from"../../../controls.js";import{group as h}from"efficient-easel/screen/lib/document/box-fields";import{keptByRow as f}from"efficient-easel/screen/lib/document/style-fields";import{select as d}from"../../../box-fields.js";import{PH as g}from"../../../../../../format/lib/document/blocks/placeholders.js";import{toneField as u}from"../../shared-fields.js";import{blockAlignmentFields as x}from"../../../box-fields.js";import{consentWordsKept as c,withConsentWordsRow as w}from"../../../consent-words-field.js";import{withLiveNumberRow as b}from"../../../live-number-field.js";function F(e,o){const t=o?.textStyle;if(typeof t!="string"||!t.startsWith("heading-"))return e;const{align:v,alignPhone:H,...r}=e;return r}const K={fields:{text:a("Body",g.body),consentWords:c("text"),[n]:f("text"),...x(),tone:u(),_gText:h("Text"),rowField:m("Shows","text"),tag:d("HTML tag",l(i,{noun:"heading"}),[{label:"Paragraph",value:"p"},{label:"H1",value:"h1"},{label:"H2",value:"h2"},{label:"H3",value:"h3"},{label:"H4",value:"h4"},{label:"H5",value:"h5"},{label:"H6",value:"h6"}],"p")},resolveFields:(e,o)=>F(b(w(p(o.fields,e,o),e.props,"text"),e.props),e.props),showWhenFacts:s};export{K as TextFields};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{useSyncExternalStore as T}from"react";import{rowBound as P}from"../../../format/lib/content/card-template.js";import{SHOP_MARKUP as v}from"../../../format/lib/markup.js";import{readHidable as O,textFieldOffPage as S}from"./controls.js";import{decodePartId as
|
|
1
|
+
import{useSyncExternalStore as T}from"react";import{rowBound as P}from"../../../format/lib/content/card-template.js";import{linkedCount as k}from"../../../format/lib/content/count-numbers.js";import{SHOP_MARKUP as v}from"../../../format/lib/markup.js";import{readHidable as O,textFieldOffPage as S}from"./controls.js";import{decodePartId as b}from"efficient-easel/draw";import{canTypeOnCanvas as K,PART_ATTR as y}from"../../../render/lib/document/text-parts.js";import{partRowField as w}from"./part-row-field.js";import{decodePartKey as A,partRowValue as C}from"../../../render/lib/document/part-rows.js";import{isMultilineKind as R,typeInPlaceKind as F}from"../../../render/lib/document/part-text.js";import{commitPartText as E}from"./part-typing.js";import{consentWordsOf as I}from"../../../format/lib/content/consent-banner.js";const _=["bold","italic","underline","strike","link","sup","sub"],h=["bullet","number"];function B(e,n){return e?[..._,...n?h:[]]:[]}function x(e,n){const r=b(e);if(!r?.propKey)return null;const{nodeId:u,propKey:s}=r,o=n.getItemById(u),c=n.getSelectorForId(u);if(!o||!c)return null;const{key:t,row:i}=A(s),p=n.components[o.type]?.fields?.[t],d=i?w(p,i):p,m=F(d);if(!m)return null;const l=o.props??{};if(I(l)!==null||!i&&P(o.type,l,t)||o.type==="Text"&&t==="text"&&k(l)||i&&!(Array.isArray(l[t])&&i.index<l[t].length))return null;const g=i?C(l[t],i):l[t];return{node:o,selector:c,propKey:s,kind:m,stored:g,offPage:S(d)}}function X(e,n){const r=x(e,n);if(!r)return null;const{text:u,hidden:s}=O(r.stored);if(!K({offPage:r.offPage,hidden:!!s}))return null;const o=R(r.kind);return{partId:e,value:u,rules:v,multiline:o,offered:B(r.kind!=="plainText",o),write:c=>{const t=x(e,n);t&&E({node:t.node,propKey:t.propKey,kind:t.kind,zone:t.selector.zone,index:t.selector.index},c,n.replace)}}}function Y(e,n,r){return e?.isConnected&&e.getAttribute(y)===r?e:n?.querySelector(`[${y}="${L(r)}"]`)??null}function L(e){return e.replace(/["\\]/g,"\\$&")}function Z(e){const n=e.activeElement;return n?n.tagName==="IFRAME"||!!n.closest(".es-canvas"):!1}let f=null;const a=new Set;function M(){return f}function ee(e){if(e!==f){f=e;for(const n of a)n()}}function $(e){return a.add(e),()=>{a.delete(e)}}function ne(){return T($,M,()=>null)}export{M as canvasTypingPart,Z as keysOnCanvas,Y as partElement,B as partTextTools,X as partTypingTarget,ee as setCanvasTypingPart,$ as subscribeCanvasTypingPart,ne as useCanvasTypingPart};
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { type BlockShowWhenFacts } from "../../../format/lib/document/show-when-attach.js";
|
|
2
|
+
export declare const NOT_CARD_OF_TEMPLATE = "notCardOfTemplate";
|
|
3
|
+
export declare const CARD_BOX_FACTS: BlockShowWhenFacts;
|
|
4
|
+
type Child = {
|
|
5
|
+
type: string;
|
|
6
|
+
props: Record<string, unknown>;
|
|
7
|
+
};
|
|
8
|
+
type Card = {
|
|
9
|
+
type?: unknown;
|
|
10
|
+
props: Record<string, unknown>;
|
|
11
|
+
};
|
|
12
|
+
export declare function cardDisplayParts(card: Card, locked?: (child: Child) => boolean): Child[];
|
|
13
|
+
export declare function cardDisplayItems(card: Card, label: (child: Child) => string, locked?: (child: Child) => boolean): {
|
|
14
|
+
id: string;
|
|
15
|
+
label: string;
|
|
16
|
+
shown: boolean;
|
|
17
|
+
}[];
|
|
18
|
+
export declare function withChildShown<C extends Card>(card: C, id: string, shown: boolean): C;
|
|
19
|
+
export declare function cardChipLabel(child: Child, ownerType: string | undefined, layers: (child: Child) => string): string;
|
|
20
|
+
export declare function CardDisplayChips({ card, ownerType, labelOf, write, readOnly, }: {
|
|
21
|
+
card: Card;
|
|
22
|
+
ownerType: string | undefined;
|
|
23
|
+
labelOf: (type: string) => string;
|
|
24
|
+
write: (next: (latest: Card) => Card) => void;
|
|
25
|
+
readOnly?: boolean;
|
|
26
|
+
}): import("react").JSX.Element;
|
|
27
|
+
export declare function cardDisplayField(): {
|
|
28
|
+
type: "custom";
|
|
29
|
+
render: ({ readOnly }: {
|
|
30
|
+
readOnly?: boolean;
|
|
31
|
+
}) => import("react").JSX.Element;
|
|
32
|
+
};
|
|
33
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use client";import{jsx as f}from"react/jsx-runtime";import{useEffect as x,useRef as g}from"react";import{isNodeList as N}from"efficient-easel/data";import{useEasel as O}from"efficient-easel/easel";import{slotChildName as h,slotChildRowName as D}from"efficient-easel/draw";import{cardTemplateCardOwner as y,cardTemplateField as S,namedRowField as T}from"../../../format/lib/content/card-template.js";import{DisplayRow as _,useSelectedPatch as b}from"./controls.js";import{websiteNodeIsLocked as A}from"./locked-blocks.js";import{stripMarkup as E}from"../../../format/lib/markup.js";import{sourceRowName as F}from"../../../format/lib/document/source-row-name.js";import{withShowWhen as L}from"../../../format/lib/document/show-when-attach.js";import{deviceField as M}from"efficient-easel/screen/lib/document/device-fields";import{NoControlMark as P}from"efficient-easel/screen/lib/document/panel-no-control-mark";const C="notCardOfTemplate",k={not:{context:C,is:!0}},te={[C]:(e,n)=>{const t=y(n.appState,e.props?.id);return t===void 0?void 0:t===null}};function c(e){const n=e.props?.content;return N(n)?n:[]}const d=e=>!!e.props?._hidden;function R(e,n=()=>!1){return c(e).flatMap(t=>typeof t?.props?.id!="string"?[]:c(t).length&&!d(t)?R(t,n):n(t)?[]:[t])}function $(e,n,t){const p=R(e,t).map(r=>({child:r,name:n(r)})),i=new Set(p.map(r=>r.name)),u=new Set;return p.map(({child:r,name:s})=>{let o=s;if(u.has(s)){let a=2;for(;i.has(`${s} ${a}`);)a+=1;o=`${s} ${a}`,i.add(o)}return u.add(s),{id:r.props.id,label:o,shown:!d(r)}})}function l(e,n){return c(e).flatMap(t=>d(t)?n(t)?[]:[t,...l(t,n)]:l(t,n))}function w(e,n,t){const p=c(e);let i=!1;const u=p.map(r=>{if(i)return r;let s;if(r?.props?.id===n){if(t?!("_hidden"in r.props):d(r))return r;const{_hidden:o,...a}=r.props;s={...r,props:t?a:{...a,_hidden:!0}}}else s=w(r,n,t);return i=s!==r,s});return i?{...e,props:{...e.props,content:u}}:e}function B(e,n,t){return h(e).trim()?t(e):S(n,T(e.props))?.label??t(e)}const I="This page is read-only.";function j({card:e,ownerType:n,labelOf:t,write:p,readOnly:i}){const u=o=>D(o,t,E,void 0,F),r=o=>A(o.type,o),s=$(e,o=>B(o,n,u),r);return s.length?f(_,{parts:s,changed:s.some(o=>!o.shown),shown:o=>s.find(a=>a.id===o)?.shown??!0,disabledReason:i?I:void 0,onPress:(o,a)=>p(m=>w(m,o,a)),onReset:()=>p(o=>l(o,r).reduce((a,m)=>w(a,String(m.props.id),!0),o))}):f(P,{})}function v(){try{const e=O(i=>i),n=e.config.components??{},t=e.selectedItem;if(!t)return null;const p=y(e.appState,t.props?.id);return{labelOf:i=>n[i]?.label??i,card:t,ownerType:typeof p?.type=="string"?p.type:void 0}}catch{return null}}function H({readOnly:e}){const n=v(),t=b(),p=g(null),i=n?.card;return x(()=>{p.current=null},[i]),n?f(j,{...n,readOnly:e,write:u=>{if(e)return;const r=p.current??n.card,s=u(r);s!==r&&(p.current=s,t({content:s.props.content}))}}):f(_,{parts:[],changed:!1,shown:()=>!0,onPress:()=>{},onReset:()=>{}})}function ne(){return L(M("desktop",{type:"custom",render:({readOnly:e})=>f(H,{readOnly:e})}),k)}export{te as CARD_BOX_FACTS,j as CardDisplayChips,C as NOT_CARD_OF_TEMPLATE,B as cardChipLabel,ne as cardDisplayField,$ as cardDisplayItems,R as cardDisplayParts,w as withChildShown};
|