efficient-web-builder 47.2.0 → 48.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +54 -0
- package/dist/editor/components/HeroPartPanel.js +1 -1
- package/dist/editor/components/HoverEffectField.d.ts +1 -0
- package/dist/editor/components/HoverEffectField.js +1 -1
- package/dist/editor/components/MediaUploadField.d.ts +9 -0
- package/dist/editor/components/MediaUploadField.js +1 -1
- package/dist/editor/components/PartSettingsPanel.d.ts +2 -1
- package/dist/editor/components/PartSettingsPanel.js +1 -1
- package/dist/editor/components/PreviewPartAnchors.d.ts +3 -1
- package/dist/editor/components/PreviewPartAnchors.js +1 -1
- package/dist/editor/components/SameInEveryViewNote.d.ts +1 -0
- package/dist/editor/components/SameInEveryViewNote.js +1 -0
- package/dist/editor/components/SaveAsTemplateButton.d.ts +5 -0
- package/dist/editor/components/SaveAsTemplateButton.js +1 -0
- package/dist/editor/components/SectionIcon.js +1 -1
- package/dist/editor/components/SiteFields.d.ts +4 -1
- package/dist/editor/components/SiteFields.js +1 -1
- package/dist/editor/components/SiteRestoreNotice.js +1 -1
- package/dist/editor/components/SiteTextStylesField.js +1 -1
- package/dist/editor/components/TickerSettingsPanel.js +1 -1
- package/dist/editor/components/VersionHistoryDrawer.js +1 -1
- package/dist/editor/components/WebsitePreviewButton.d.ts +2 -1
- package/dist/editor/components/WebsitePreviewButton.js +1 -1
- package/dist/editor/components/WebsiteScreenParts.js +1 -1
- package/dist/editor/components/usePartMotion.d.ts +10 -0
- package/dist/editor/components/usePartMotion.js +1 -0
- package/dist/editor/components/useSocialSettings.d.ts +2 -2
- package/dist/editor/lib/animation/AnimationDurationRow.js +1 -1
- package/dist/editor/lib/animation/fields.d.ts +1 -1
- package/dist/editor/lib/animation/fields.js +1 -1
- package/dist/editor/lib/animation/hover-fields.d.ts +1 -0
- package/dist/editor/lib/animation/hover-fields.js +1 -0
- package/dist/editor/lib/document/add-target.d.ts +2 -1
- package/dist/editor/lib/document/add-target.js +1 -1
- package/dist/editor/lib/document/blocks/general/ButtonBlock/fields.js +1 -1
- package/dist/editor/lib/document/blocks/general/Contents/fields.d.ts +2 -0
- package/dist/editor/lib/document/blocks/general/Contents/fields.js +1 -0
- package/dist/editor/lib/document/blocks/general/Divider/fields.js +1 -1
- package/dist/editor/lib/document/blocks/general/Flex/fields.js +1 -1
- package/dist/editor/lib/document/blocks/general/HeroGroup/fields.js +1 -1
- package/dist/editor/lib/document/blocks/general/index.d.ts +2 -2
- package/dist/editor/lib/document/blocks/general/index.js +1 -1
- package/dist/editor/lib/document/build-config.js +1 -1
- package/dist/editor/lib/document/canvas-typing.d.ts +1 -0
- package/dist/editor/lib/document/canvas-typing.js +1 -1
- package/dist/editor/lib/document/card-display-chips.js +1 -1
- package/dist/editor/lib/document/controls.d.ts +7 -3
- package/dist/editor/lib/document/controls.js +1 -1
- package/dist/editor/lib/document/field-groups.js +1 -1
- package/dist/editor/lib/document/geocode-resolve.d.ts +1 -0
- package/dist/editor/lib/document/geocode-resolve.js +1 -1
- package/dist/editor/lib/document/overrides.js +1 -1
- package/dist/editor/lib/document/page-root.js +2 -2
- package/dist/editor/lib/document/part-motion-canvas.d.ts +9 -0
- package/dist/editor/lib/document/part-motion-canvas.js +1 -0
- package/dist/format/lib/animation/hover.d.ts +5 -0
- package/dist/format/lib/animation/hover.js +1 -0
- package/dist/format/lib/content/anchor-name.d.ts +2 -0
- package/dist/format/lib/content/anchor-name.js +1 -0
- package/dist/format/lib/content/box-layout.d.ts +8 -0
- package/dist/format/lib/content/box-layout.js +1 -1
- package/dist/format/lib/content/box-link.js +1 -1
- package/dist/format/lib/content/box-separator.js +1 -1
- package/dist/format/lib/content/card-template.d.ts +8 -0
- package/dist/format/lib/content/card-template.js +1 -1
- package/dist/format/lib/content/container-gap.d.ts +2 -1
- package/dist/format/lib/content/container-gap.js +1 -1
- package/dist/format/lib/content/list-number.d.ts +1 -0
- package/dist/format/lib/content/list-number.js +1 -0
- package/dist/format/lib/content/section-min-height.d.ts +3 -2
- package/dist/format/lib/content/section-min-height.js +1 -1
- package/dist/format/lib/content/section-sticky.js +1 -1
- package/dist/format/lib/content/sticky-aside.d.ts +2 -0
- package/dist/format/lib/content/sticky-aside.js +1 -0
- package/dist/format/lib/document/blocks/general/Contents/meta.d.ts +5 -0
- package/dist/format/lib/document/blocks/general/Contents/meta.js +1 -0
- package/dist/format/lib/document/blocks/general/metas.d.ts +1 -0
- package/dist/format/lib/document/blocks/general/metas.js +1 -1
- package/dist/format/lib/document/blocks/general/text-part-shapes.json +10 -0
- package/dist/format/lib/document/container-blocks.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/general-order.d.ts +1 -1
- package/dist/format/lib/document/general-order.js +1 -1
- package/dist/format/lib/document/panel-tabs.d.ts +8 -0
- package/dist/format/lib/document/panel-tabs.js +1 -0
- package/dist/format/lib/document/part-records.d.ts +6 -0
- package/dist/format/lib/document/part-records.js +1 -0
- package/dist/format/lib/document/passes/registry-context.d.ts +1 -1
- package/dist/format/lib/document/passes/registry-context.js +1 -1
- package/dist/format/lib/document/passes/types.d.ts +2 -0
- package/dist/format/lib/document/section-groups.d.ts +1 -1
- package/dist/format/lib/editor-words-catalogue.d.ts +6 -0
- package/dist/format/lib/editor-words-catalogue.js +3 -3
- package/dist/format/lib/hero-ticker.d.ts +1 -0
- package/dist/format/lib/hero-ticker.js +1 -1
- package/dist/format/lib/links/page-link-rules.js +1 -1
- package/dist/format/lib/sections/contents-text-regions.d.ts +3 -0
- package/dist/format/lib/sections/contents-text-regions.js +1 -0
- package/dist/format/lib/sections/section-text-regions.js +1 -1
- package/dist/format/lib/sections/strip-shape.js +1 -1
- package/dist/render/components/CardRowContext.d.ts +3 -1
- package/dist/render/components/CardRowContext.js +1 -1
- package/dist/render/components/ContentsList.d.ts +14 -0
- package/dist/render/components/ContentsList.js +1 -0
- package/dist/render/components/DocBody.d.ts +18 -0
- package/dist/render/components/DocBody.js +5 -5
- package/dist/render/components/FAQ.js +1 -1
- package/dist/render/components/Flex.d.ts +3 -1
- package/dist/render/components/Flex.js +1 -1
- package/dist/render/components/Grid.d.ts +2 -1
- package/dist/render/components/Grid.js +1 -1
- package/dist/render/components/HeroGroup.d.ts +2 -1
- package/dist/render/components/HeroGroup.js +1 -1
- package/dist/render/components/HeroSection.d.ts +2 -1
- package/dist/render/components/HeroSection.js +1 -1
- package/dist/render/components/HeroSingle.d.ts +2 -1
- package/dist/render/components/HeroSingle.js +1 -1
- package/dist/render/components/PageContentsContext.d.ts +14 -0
- package/dist/render/components/PageContentsContext.js +1 -0
- package/dist/render/components/PartStyledKind.js +1 -1
- package/dist/render/components/PartStyledText.js +1 -1
- package/dist/render/components/PublishedPartStylesContext.d.ts +4 -1
- package/dist/render/components/PublishedPartStylesContext.js +1 -1
- package/dist/render/components/Reel.js +1 -1
- package/dist/render/components/SectionAnimation.d.ts +10 -3
- package/dist/render/components/SectionAnimation.js +1 -1
- package/dist/render/components/Text.d.ts +2 -1
- package/dist/render/components/Text.js +1 -1
- package/dist/render/components/Timeline.js +1 -1
- package/dist/render/components/goldPhrases.d.ts +1 -1
- package/dist/render/components/goldPhrases.js +2 -2
- package/dist/render/lib/animation/entrance.d.ts +1 -0
- package/dist/render/lib/animation/entrance.js +1 -1
- package/dist/render/lib/animation/part-motion.d.ts +25 -0
- package/dist/render/lib/animation/part-motion.js +2 -0
- package/dist/render/lib/content/button-look.js +1 -1
- package/dist/render/lib/content/page-contents.d.ts +17 -0
- package/dist/render/lib/content/page-contents.js +1 -0
- package/dist/render/lib/document/blocks/general/Contents/render.d.ts +2 -0
- package/dist/render/lib/document/blocks/general/Contents/render.js +1 -0
- package/dist/render/lib/document/blocks/general/Flex/render.js +1 -1
- package/dist/render/lib/document/blocks/general/Grid/render.js +1 -1
- package/dist/render/lib/document/blocks/general/Hero/render.js +1 -1
- package/dist/render/lib/document/blocks/general/HeroGroup/render.js +1 -1
- package/dist/render/lib/document/blocks/general/HeroSingle/render.js +1 -1
- package/dist/render/lib/document/blocks/general/Text/render.js +1 -1
- package/dist/render/lib/document/blocks/general/renders.d.ts +1 -0
- package/dist/render/lib/document/blocks/general/renders.js +1 -1
- package/dist/render/lib/document/blocks/general/section-to-box-row-parts.d.ts +3 -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.js +1 -1
- package/dist/render/lib/document/blocks/general/section-to-box-rows-docbody.d.ts +2 -0
- package/dist/render/lib/document/blocks/general/section-to-box-rows-docbody.js +2 -0
- 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-pageheader.d.ts +2 -0
- package/dist/render/lib/document/blocks/general/section-to-box-rows-pageheader.js +1 -0
- package/dist/render/lib/document/blocks/general/section-to-box-rows.js +1 -1
- package/dist/render/lib/document/hero-media-parts.d.ts +2 -2
- package/dist/render/lib/document/page-render.js +1 -1
- package/dist/render/lib/document/part-styles.d.ts +10 -1
- package/dist/render/lib/document/part-styles.js +2 -2
- package/dist/render/lib/document/passes/clickable-parts.js +1 -1
- package/dist/render/lib/document/passes/section-anchor.d.ts +1 -0
- 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/sections/section-to-box.d.ts +1 -0
- package/dist/render/lib/sections/section-to-box.js +1 -1
- package/dist/render/lib/text-styles/site-text-styles.d.ts +16 -4
- package/dist/render/lib/text-styles/site-text-styles.js +2 -2
- package/package.json +3 -3
- package/dist/editor/lib/document/selected-host.d.ts +0 -2
- package/dist/editor/lib/document/selected-host.js +0 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,59 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## 48.1.0 - 2026-11-03
|
|
4
|
+
|
|
5
|
+
From main at `88c0e0a8`: #459, #460, #461, #462, and #463 (CI only). A minor: exports are added, no export is removed, peers are unchanged (`efficient-easel` `^27.0.0`, `efficient-shell` `^11.8.0`). The converter rows stay OFF (`SECTION_TO_BOX_ON` is empty), so no stored page converts.
|
|
6
|
+
|
|
7
|
+
**For hosts:** efficient-storefront-blocks takes this in #336; that bump relaxes `scripts/test-web-host-contract.tsx:1470` (#462).
|
|
8
|
+
|
|
9
|
+
### Added
|
|
10
|
+
|
|
11
|
+
- The Contents block (`blocks/general/Contents`): a heading and one numbered link per anchored Box below it; `ContentsList` is the one list that DocBody and the block draw. The Document Text section (DocBody) gets a Box converter row, switched off (#460). One home for list numbers (`lib/content/list-number.ts`) and anchor names (`lib/content/anchor-name.ts`).
|
|
12
|
+
- One box of a part for the canvas and the page (#459): `partBoxOf`, `PART_HOST_ATTR`, `ensurePartLiftSheet`; `ENTRANCE_WRAPPER_CLASS` is also exported from `lib/animation/entrance`.
|
|
13
|
+
|
|
14
|
+
### Fixed
|
|
15
|
+
|
|
16
|
+
- A section anchor stored in the old `{text}` form draws its `id` and lights the jump highlight (#460).
|
|
17
|
+
- An anchored block in a Box stands one Gap from the block before it, not two (#461). Read-only count on the inovit_us pages: 0 blocks change.
|
|
18
|
+
- The Locations city card on a phone (#462): a Height grid is never wider than its parent (all three Height grid layers, one `minmax(0,1fr)` column); a city name wraps between words, never inside one; on a phone the time zone goes below a long name (Name row phone Wrap on). Live dry run on 58 US pages at 1440 and 390: 0 change.
|
|
19
|
+
|
|
20
|
+
### Internal
|
|
21
|
+
|
|
22
|
+
- The Commit convention check is repinned to efficient-ops `release-v1` (#463). No code change.
|
|
23
|
+
|
|
24
|
+
## 48.0.0 - 2026-11-03
|
|
25
|
+
|
|
26
|
+
From main at `1abf1642`: #448, #434, #449, #451, #453, #452, #455, #456, #458, #457. A major.
|
|
27
|
+
|
|
28
|
+
**Pair for hosts:** the Tablet Gap (#458) draws only with efficient-storefront-blocks #334 (`.sf-gap-zone` reads `--sf-gap-len-tablet` from 720 to 1099 px). The tablet text-style keys (#452) are the nine view keys efficient-backend #4256 accepts.
|
|
29
|
+
|
|
30
|
+
### Breaking
|
|
31
|
+
|
|
32
|
+
- Peer `efficient-easel` `^26.7.0` → `^27.0.0` (#448 took `^26.13.0`, #452 takes `^27.0.0`, which gates the Tablet view). `efficient-shell` stays `^11.8.0`.
|
|
33
|
+
- The export `entriesHiddenForTab` is removed from `lib/document/controls` (#434). `efficient-storefront-blocks` imports it in `scripts/test-entries-follow-the-tab.ts`; its bump to 48 changes that guard. `efficient-storefront` does not import it.
|
|
34
|
+
- The module `lib/document/selected-host` is deleted, and the published path `efficient-web-builder/editor/lib/document/selected-host` with it (#449). Import `useSelectedHost` from `efficient-easel/easel`.
|
|
35
|
+
- A strip Box's `Gap` is the space on each side of its mark, not the space the mark is laid over (#451). A Box that stores a separator draws a different space. Read-only count on the inovit_us pages, 2026-11-03: 0 Box nodes store a separator (the 12 stored separators are Scrolling Bar sections, which store no gap). No data move.
|
|
36
|
+
- In the Tablet view, a row that still writes the desktop value is hidden (#452): the part panel's Font size and Alignment, and a picture's focus point.
|
|
37
|
+
|
|
38
|
+
### Added
|
|
39
|
+
|
|
40
|
+
- The Tablet view keeps its own values (#452, #458): four-side Padding (section, block, Box card, Hero's Box, Divider); the site text styles (`sizeTablet` and the tablet and phone line, letter and paragraph spacing and Largest size); Box Columns (`columnsTablet`); the container Gap (`gapTablet`, `containerGapTabletField`; none for a strip or a scrolling row). New exports: `BOX_TABLET_COLUMNS_CLASS`, `boxTabletColumnsClass`, `boxRowTabletColumnsClass`, `GAP_TABLET_LENGTH_VAR`, `containerGapTabletField`.
|
|
41
|
+
- An empty view panel says "These settings apply to every view." (`SameInEveryViewNote`, #452). New word: `{value} on tablet`.
|
|
42
|
+
- Every node panel draws the Design and Animation tabs (#434).
|
|
43
|
+
- Every part panel has the Design and Animation tabs (#453): `usePartMotion`; `animationTabFields` takes the kind `"textPart"`.
|
|
44
|
+
- The editor canvas plays a text part's Entrance (when the view's value changes) and Lift (a real hover), as the published page does (#457): `usePhoneWidth`, `partLiftRules`, `drawPartEntrance`, `PART_LIFT_ATTR`, `paintPartMotion`; optional `motions` on the PartAnchors contract.
|
|
45
|
+
- The Box Direction row and the phone Box shape row (#448). `openDraftPreview` takes an optional `ready`; Save as Template, the draft Preview and Restore version wait for writes. Map Find says `LOOKUP_BUSY_NOTE` for a stale lookup.
|
|
46
|
+
- A card template takes a host's own blocks (#455): a block type that a card template declares (`CardTemplateSpec.blocks`) gets no section rows, and no Add category may list it. A config that breaks this throws by name.
|
|
47
|
+
- Document Header, Issue Header and Breadcrumb get Box converter rows, switched off (#456): `PAGE_HEADER_SECTION_TO_BOX`, `leadText`, `leadLine`, `RIGHT_WORDS`. A strip Box draws its mark before a Button block too.
|
|
48
|
+
|
|
49
|
+
### Fixed
|
|
50
|
+
|
|
51
|
+
- City cards stand one per line in Tablet: the Locations converter writes `columnsTablet: 1` (#458; the 47.2.0 cards were 21-41 px too wide at 900 and 820 px).
|
|
52
|
+
- With easel 27, the Phone view's Line, Letter and Paragraph spacing and Largest size rows write their values; before, only `sizePhone` was kept (#452).
|
|
53
|
+
- The grey letter spacing in a view is the px the page draws (#452).
|
|
54
|
+
- Rows that read the selected node's host read easel's `useSelectedHost`, so under `RootHostScope` they read the root's host (#449).
|
|
55
|
+
- A Scrolling Bar converted to a Box stores Gap 60 / 32, on the 4 spacing scale (#451).
|
|
56
|
+
|
|
3
57
|
## 47.2.0 - 2026-11-03
|
|
4
58
|
|
|
5
59
|
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.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use client";import{jsx as
|
|
1
|
+
"use client";import{jsx as o,jsxs as l}from"react/jsx-runtime";import{InspectorUpLevel as t}from"efficient-easel/chrome";import{usePreviewHeroPart as c}from"../../render/components/PreviewHeroPartContext.js";import{SiteFields as f}from"./SiteFields.js";import{usePartMotion as p}from"./usePartMotion.js";import{say as i}from"../../format/lib/editor-words.js";import{HERO_MEDIA_PART_LABELS as u,heroPartId as P}from"../../render/lib/document/hero-media-parts.js";function d({nodeId:r,part:e,sectionName:m,onUpToSection:n}){const{select:s}=c(),a=p(r,e,"block");return l("div",{children:[e!=="media"?o(t,{inline:!0,name:i(u.media),onSelect:()=>s(P(r,"media"))}):o(t,{inline:!0,name:i(m),onSelect:n}),o(f,{part:e,motion:a})]})}export{d as default};
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { type HoverEffect } from "../../format/lib/theme.js";
|
|
2
|
+
export declare const HOVER_EFFECT_LABELS: Readonly<Record<HoverEffect, string>>;
|
|
2
3
|
export default function HoverEffectField({ value, onChange, showHint, }: {
|
|
3
4
|
value: HoverEffect | null;
|
|
4
5
|
onChange: (v: HoverEffect | null) => void;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use client";import{jsx as t}from"react/jsx-runtime";import{SettingsDefaultReset as c,SettingsField as d,SettingsSegmented as
|
|
1
|
+
"use client";import{jsx as t}from"react/jsx-runtime";import{SettingsDefaultReset as c,SettingsField as d,SettingsSegmented as E}from"efficient-easel/panel";import{HoverIcon as h}from"efficient-easel/icons";import{say as e,editorEaselWords as p}from"../../format/lib/editor-words.js";import{HOVER_EFFECTS as u,DEFAULT_HOVER_EFFECT as s}from"../../format/lib/theme.js";const o={none:"None",lift:"Lift",highlight:"Highlight"},g="What a card does when a shopper points at it — or taps it, on a phone. Highlight is the effect your cards already use.";function m({value:i,onChange:n,showHint:f=!0}){const r=i===null,a=i??s;return t(d,{label:e("Hover effect"),icon:t(h,{}),value:e(o[a]),changed:!r,action:t(c,{words:p()?.panel,label:e("Hover effect"),changed:!r,detail:e(o[s]),onReset:()=>n(null)}),hint:f?e(g):void 0,children:t(E,{options:u.map(l=>({id:l,label:e(o[l])})),value:a,ariaLabel:e("Hover effect"),onChange:n})})}export{o as HOVER_EFFECT_LABELS,m as default};
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { usePreviewDevice } from "efficient-easel/draw/client";
|
|
1
2
|
import { type MediaValue } from "../../format/lib/media-value.js";
|
|
2
3
|
interface Props {
|
|
3
4
|
value: MediaValue;
|
|
@@ -10,5 +11,13 @@ interface Props {
|
|
|
10
11
|
frameKey?: string;
|
|
11
12
|
fieldKey?: string;
|
|
12
13
|
}
|
|
14
|
+
export declare function viewFocusOf(values: Record<string, unknown>, focusKey: string, device: ReturnType<typeof usePreviewDevice>): {
|
|
15
|
+
phone: boolean;
|
|
16
|
+
desktop: string;
|
|
17
|
+
own: string | undefined;
|
|
18
|
+
focus: string;
|
|
19
|
+
key: string;
|
|
20
|
+
twin: string;
|
|
21
|
+
} | null;
|
|
13
22
|
export default function MediaUploadField({ value, onChange, label, accept, placeholder, focusKey, focusWhen, frameKey, fieldKey }: Props): import("react").JSX.Element;
|
|
14
23
|
export {};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use client";import{jsx as
|
|
1
|
+
"use client";import{jsx as i}from"react/jsx-runtime";import{SettingsDefaultReset as D,SettingsField as S}from"efficient-easel/panel";import{useSelectedHost as H}from"efficient-easel/easel";import{FOCAL_DEFAULT as I}from"efficient-shell/format";import{ImageIcon as E,PlayIcon as F}from"efficient-easel/icons";import{MediaUploadField as M}from"efficient-shell/ui";import{useContext as O}from"react";import{ScreenDocumentContext as T}from"efficient-easel/screen/components/ScreenDocumentContext";import{editorEaselWords as A,say as m}from"../../format/lib/editor-words.js";import{phoneKey as B}from"efficient-easel/draw";import{PHONE_CLEAR as L}from"../../format/lib/document/phone-override.js";import{usePreviewDevice as R}from"efficient-easel/draw/client";import{shownTier as b}from"efficient-easel/screen/lib/document/device-fields";import{requestMediaPick as V}from"efficient-easel/screen/lib/media-picker";import{useEaselHost as _}from"efficient-easel/screen/lib/host";import{mediaValueSrc as j}from"../../format/lib/media-value.js";import{useSelectedPatch as N}from"../lib/document/controls.js";import{backendOf as W}from"../lib/website-session.js";import{useEaselSession as q}from"efficient-easel/screen/lib/session-context";function z(t,o,s){if(b(s)==="tablet")return null;const r=b(s)==="mobile",n=typeof t[o]=="string"&&t[o]?String(t[o]):I,e=B(o),a=typeof t[e]=="string"&&t[e]?String(t[e]):void 0;return{phone:r,desktop:n,own:a,focus:r?a??n:n,key:r?e:o,twin:e}}function G(t,o){const s=H(),r=R();if(!t||!s)return null;const n=s.values??{};if(o&&!o(n))return null;const e=z(n,t,r);if(!e)return null;const a=s.onChange;return{phone:e.phone,desktop:e.desktop,own:e.own,focus:e.focus,set:u=>a(e.key,u),clear:()=>a(e.twin,L)}}function J({value:t,onChange:o,label:s,accept:r,placeholder:n,focusKey:e,focusWhen:a,frameKey:u,fieldKey:w}){const x=_(),C=q(),h=m(s),l=r.startsWith("video"),c=G(l?void 0:e,a),g=O(T),k=N(),d=u&&w?{video:w,frame:u}:null,P=p=>V(x,{accept:r,title:h,...p?{file:p}:{}}).then(f=>!f||!d?f?.url??null:(k({[d.video]:f.url,[d.frame]:f.posterUrl??""}),null)),U=d?p=>p?o(p):k({[d.video]:"",[d.frame]:""}):o;if(g&&!g.capabilities.mediaEditing)return i(S,{label:h,icon:l?i(F,{}):i(E,{}),children:i("div",{className:"sf-image-slot-inert",children:l?m("Templates don’t store videos — this slot stays a placeholder. Each website picks its own after it’s created."):m("Templates don’t store images — this slot stays a placeholder. Each website picks its own after it’s created.")})});const v=j(t),y=c?.phone&&v?i(D,{words:A()?.panel,label:m("Image focus"),changed:!!c.own,detail:m("{value} on desktop",{value:c.desktop}),onReset:c.clear}):void 0;return i(S,{label:h,icon:l?i(F,{}):i(E,{}),action:y,children:i("div",{style:{flex:"1 1 auto",minWidth:0},children:i(M,{value:v,onChange:U,onPick:P,accept:l?"video/*":"image/*",kind:l?"video":"image",placeholder:n===void 0?void 0:m(n),maxSizeBytes:W(C).media.maxUploadBytes,...c?{focus:c.focus,onFocusChange:c.set}:{}})})})}export{J as default,z as viewFocusOf};
|
|
@@ -27,12 +27,13 @@ export declare function PartStyleSelect({ face, base, onPick, }: {
|
|
|
27
27
|
base: PartStyleBase | null;
|
|
28
28
|
onPick: (role: FontRole | null) => void;
|
|
29
29
|
}): import("react").JSX.Element;
|
|
30
|
-
export declare function PartPanelBody({ sectionName, onBack, textEditor, styleRow, children, }: {
|
|
30
|
+
export declare function PartPanelBody({ sectionName, onBack, textEditor, styleRow, children, tabs, }: {
|
|
31
31
|
sectionName: string;
|
|
32
32
|
onBack: () => void;
|
|
33
33
|
textEditor?: ReactNode;
|
|
34
34
|
styleRow?: ReactNode;
|
|
35
35
|
children?: ReactNode;
|
|
36
|
+
tabs?: (body: ReactNode) => ReactNode;
|
|
36
37
|
}): import("react").JSX.Element;
|
|
37
38
|
export declare function PartSourceNote({ source, slug, menuId }: {
|
|
38
39
|
source: PartSource;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use client";import{jsx as t,Fragment as K,jsxs as h}from"react/jsx-runtime";import{useContext as Je,useEffect as se,useRef as Qe,useState as Ce}from"react";import{FieldSelect as Ze,InspectorField as et,fieldShownInView as tt}from"efficient-easel/fields";import{SettingsField as nt}from"efficient-easel/panel";import{InspectorUpLevel as U}from"efficient-easel/chrome";import{StylesIcon as ot,TypeIcon as lt}from"efficient-easel/icons";import{useEasel as st}from"efficient-easel/easel";import{TextPartPanel as rt}from"efficient-easel/copy";import{Button as it,IconButton as at,Tooltip as ct}from"efficient-shell/ui";import{PartTextBox as dt,partTextCells as ut}from"./PartTextBox.js";import{UiIcon as ke}from"efficient-easel/draw/client";import{usePreviewHeader as ft}from"../../render/components/PreviewHeaderContext.js";import{UpdateStyleDialog as pt}from"./UpdateStyleDialog.js";import{ScreenDocumentContext as mt}from"efficient-easel/screen/components/ScreenDocumentContext";import{hasStyleChange as ht,partStyleToTextStyleValues as yt,pushIntoStyle as gt,resolveTextStyles as St,styleIdOfRole as xt}from"../../render/lib/text-styles/site-text-styles.js";import{useSiteTextStylesWriter as bt}from"../lib/site-text-styles-writer.js";import{useThemeRowPersist as wt}from"../lib/theme-row-persist.js";import{usePreviewDevice as Pt}from"efficient-easel/draw/client";import{shownTier as Oe}from"efficient-easel/screen/lib/document/device-fields";import{PART_PANEL_ROWS as vt}from"../lib/document/part-panel-rows.js";import{usePartStyle as Tt}from"./PreviewPartStyleContext.js";import{say as l}from"../../format/lib/editor-words.js";import{readHidable as W,textFieldOffPage as Nt,textFieldPanelOnly as Ct}from"../lib/document/controls.js";import{TEXT_FIELD_MARKER as kt}from"efficient-easel/draw";import{useSectionOps as Ot}from"efficient-easel/screen/lib/document/use-section-ops";import{FONT_OPTIONS as Rt,FONT_ROLES as It,FONT_ROLE_LABELS as Re,fontOption as re,fontRoleOf as Et}from"../../format/lib/fonts.js";import{isMultilineKind as Ft,partPlaceholder as _t,typeInPlaceKind as zt}from"../../render/lib/document/part-text.js";import{partRowField as At}from"../lib/document/part-row-field.js";import{decodePartKey as Vt,partPropsWithRowValue as Lt,partRowValue as Bt}from"../../render/lib/document/part-rows.js";import{followedStyleOf as Kt,propsWithPartStyleValue as z,propsWithoutPartStyle as Ut,readPartStyle as Ie}from"../../render/lib/document/part-styles.js";import{partThemeColors as Wt}from"../../format/lib/document/part-inks.js";import{styleKeyForPart as Dt}from"../../format/lib/sections/section-text-kinds.js";import{commitPartText as jt}from"../lib/document/part-typing.js";import{keysOnCanvas as Gt,useCanvasTypingPart as Ht}from"../lib/document/canvas-typing.js";import{useEaselHost as Mt}from"efficient-easel/screen/lib/host";import{SOURCE_LINES as $t,SOURCE_ACTIONS as Yt,SOURCE_ACTION_LABEL as qt,partSourceNoteFor as Xt,partSourceOf as Jt,sourceMenuIdOf as Qt,sourceSlugOf as Ee}from"../../format/lib/document/source-bound-parts.js";import{encodePartId as Zt,holdsAuthoredText as en}from"../../render/lib/document/text-parts.js";import{regionsForSection as tn}from"../../format/lib/sections/section-text-regions.js";import{textRegionOfPartKey as nn}from"../../format/lib/sections/text-regions.js";function ie(n){return n?l(n):null}function Fe(n){return n.kind==="role"?Re[n.role]:n.kind==="custom"?"Custom":null}function on(n){const o=Et(n.role);return o?{kind:"role",role:o}:null}function ln(n,o){if(!n)return{kind:"unread"};const{faceRole:s,base:i}=n;if(o[s]===i.fontKey)return{kind:"role",role:s};const c=Object.keys(o).filter(r=>o[r]===i.fontKey);return c.length===1?{kind:"role",role:c[0]}:{kind:"custom"}}function ae(n,o,s,i){return on(Ie(n,o))??ln(s,i)}function sn(n,o){if(!n.length)return null;const s=o(n[0]);return n.every(i=>o(i)===s)?s:null}const D="";function rn({face:n,base:o,onPick:s}){const i=n.kind==="role"?n.role:D,c=[{label:l("No style"),value:D},...It.map(r=>({label:l(Re[r]),value:r}))];return t(Ze,{ariaLabel:l("Style"),value:i,options:c,inline:!0,onChange:r=>s(r===D?null:r),renderOption:r=>r.value===D?h(K,{children:[t("span",{className:"es-fsel-label sf-part-style-keep",children:r.label}),t("span",{className:"sf-part-style-aside","aria-hidden":"true",children:l("Section’s own")})]}):t("span",{className:"es-fsel-label",style:{fontFamily:`var(--font-role-${r.value})`},children:r.label}),renderValue:()=>t("span",{style:{fontFamily:o?.fontKey?`var(${re(o.fontKey)?.cssVar})`:void 0,fontWeight:o?.weight},children:ie(Fe(n))}),valueText:r=>ie(Fe(n))??r?.label??""})}function an({sectionName:n,onBack:o,textEditor:s,styleRow:i,children:c}){return h("div",{className:"sf-part-panel",children:[t(U,{inline:!0,name:l(n),onSelect:o}),s,i,c]})}function _e({source:n,slug:o,menuId:s}){const i=Mt(),c=Yt[n],r=!c.needsSlug||!!o;return t("div",{className:"sf-note sf-note--source",children:h("p",{className:"es-field-hint sf-hint-keep",children:[l($t[n]),r?h(K,{children:[" ",t(it,{type:"button",variant:"link",size:"sm",onClick:()=>{c.type==="storefront-editor:open-menus"?i.send(c.type,{menuId:s??null}):o&&i.send(c.type,{slug:o})},children:l(qt)})]}):null]})})}const ze=4,cn=120;function dn({region:n,sizePx:o,face:s,base:i,onFollowStyle:c,source:r,slug:j,onBack:N,shows:C}){const v=n.follows;return h("div",{className:"sf-note",children:[C("regionNote")&&h(K,{children:[t("p",{children:t("strong",{children:l(n.label)})}),t("p",{children:o?l("Its size follows Styles ▸ {follows} — {px}px right now.",{follows:l(v),px:Math.round(o)}):l("Its size follows Styles ▸ {follows}.",{follows:l(v)})})]}),c?C("regionStyle")?t(K,{children:t(nt,{label:l("Style"),icon:t(ot,{}),hint:l("Every {part} in this section follows it. The face and the size change; the letter case is the section’s own and stays as it is.",{part:l(n.label).toLowerCase()}),children:t(rn,{face:s,base:i,onPick:c})})}):null:C("regionNote")&&t("p",{className:"es-field-hint sf-hint-keep",children:l("Only the size follows a site style. This section sets its own font, weight and letter case.")}),r&&C("sourceNote")?t(_e,{source:r,slug:j}):null,t(U,{inline:!0,name:l("Page"),onSelect:N})]})}function un({onBack:n}){return h("div",{className:"sf-note",children:[t("p",{children:t("strong",{children:l("This part is no longer here.")})}),t("p",{children:l("The section it belonged to has been changed or removed.")}),t(U,{inline:!0,name:l("Page"),onSelect:n})]})}function fn({onBack:n,partId:o,why:s}){return h("div",{className:"sf-note",children:[t("p",{children:t("strong",{children:l("This part's settings did not open.")})}),t("p",{children:l("The words are still on your page and nothing has been lost. The editor could not work out which control belongs to them, which is a fault on our side. Go back and click the section to open its settings instead.")}),t("p",{className:"sf-note-detail",children:h("code",{children:[o," — ",s]})}),t(U,{inline:!0,name:l("Page"),onSelect:n})]})}function pn({nodeId:n,propKey:o,onBack:s,onEditStyle:i}){const{getItemById:c,getSelectorForId:r,config:j}=st(e=>e),N=Ot(),C=Ht(),{partStyle:v}=Tt(),{fonts:G,textStyles:Ae}=ft(),H=Je(mt),ce=!H?.capabilities?.hasSiteTheme,{persist:Ve}=wt({themeFromDocument:ce,tokenRef:H?.tokenRef,siteId:H?.siteId??null}),_=bt({themeFromDocument:ce,persist:Ve}),[Le,M]=Ce(!1),$=Pt(),y=e=>tt(vt[e],$),de=Qe(null),d=c(n),m=r(n),ue=d?j.components[d.type]:void 0,{key:x,row:b}=Vt(o),fe=ue?.fields?.[x],g=b?At(fe,b):fe,k=Zt(n,o),p=d?.props??{},w=zt(g),pe=Nt(g),me=en(g),Be=d?Jt(d.type):null,he=d?Xt(d.type,x):null,Y=b?Bt(p[x],b):p[x],ye=!!b&&!(Array.isArray(p[x])&&b.index<p[x].length);se(()=>{if(Gt(document))return;de.current?.querySelector(".es-copy [contenteditable='true'], .es-copy textarea, .sf-copybox textarea, .sf-copybox input")?.focus()},[k]);const[q,ge]=Ce(0);se(()=>ge(0),[k]);const X=!!d&&!ye&&(!m||!g);se(()=>{if(!X||q>=ze)return;const e=setTimeout(()=>ge(a=>a+1),cn);return()=>clearTimeout(e)},[X,q]);const Ke=X&&q<ze;if(!d||ye)return t(un,{onBack:s});const A=tn(d.type),Se=A?nn(A,o):null;if(A&&Se){const e=v?.partId===k?v:null,a=A[Se],f=a.writable===!0&&!!m,P=le=>{m&&N.replaceComponent(m.zone,m.index,{...d,props:z(p,o,"role",le)})};return t(dn,{region:a,sizePx:e?.base.sizePx??null,face:ae(p,o,e,G),base:e?.base??null,onFollowStyle:f?P:void 0,source:Be,slug:Ee(p),onBack:s,shows:y})}if(!m||!g)return Ke?t("div",{className:"sf-note","aria-busy":"true"}):t(fn,{onBack:s,partId:k,why:m?"no field":"no selector"});const xe=e=>{N.replaceComponent(m.zone,m.index,{...d,props:e})},J=e=>{if(W(e).hidden!==W(Y).hidden||!w){const f=b?Lt(p,x,b,e):{...p,[x]:e};f&&xe(f);return}jt({node:d,propKey:o,kind:w,zone:m.zone,index:m.index},W(e).text,N.replaceComponent)},Ue=Y,O=v?.partId===k?v:null,R=O?.styleOwner,V=R?c(R.owner):null,Q=R&&V?r(R.owner):null,Z=!!(R&&V&&Q),I=Z?V.props??{}:p,ee=Z?e=>N.replaceComponent(Q.zone,Q.index,{...V,props:e}):xe,L=Z?R.kind:Dt(d?.type,o),S=Ie(I,L),u=[{partKey:L,face:ae(I,L,O,G),sizeGroup:O?.sizeGroup??null,base:O?.base??hn,style:S}],We=sn(u,e=>e.sizeGroup),De=Wt(O?.inks),E=(e,a)=>{let f=I;for(const P of u)f=z(f,P.partKey,e,a);ee(f)},je=e=>e?E("textStyle",e):te({textStyle:null,role:null}),te=e=>{let a=I;for(const f of u)for(const[P,le]of Object.entries(e))a=z(a,f.partKey,P,le??null);ee(a)},ne=w==="text"||w==="textarea",{text:be,hidden:F}=W(Y),B=g?.[kt]?.label??o,we=F?l("Show {label} on the slide",{label:l(B)}):l("Hide {label} on the slide",{label:l(B)}),Pe=h("div",{className:"sf-field-head",children:[t(lt,{}),t("span",{className:"sf-field-label sf-field-label--inline",children:l(B)}),ne&&t(ct,{content:we,children:t(at,{"aria-pressed":F,"aria-label":we,onClick:()=>J({text:be,hidden:!F}),children:F?t(ke,{name:"eye-off",size:14}):t(ke,{name:"eye",size:14})})})]}),ve=!pe&&me,Ge=!!w&&(Ct(g)||pe||F||!me),Te=ae(I,L,O,G),He=Te.kind==="role"?Te.role:null,oe=Kt(S)??xt(He),Ne=St(_.saved,_.old),Me=Object.entries(S).filter(([e,a])=>e!=="role"&&e!=="textStyle"&&a!==void 0).length,$e=()=>{let e=I;for(const a of u){const{role:f,textStyle:P}=a.style;e=Ut(e,a.partKey),f&&(e=z(e,a.partKey,"role",f)),P&&(e=z(e,a.partKey,"textStyle",P))}ee(e)},T=oe,Ye=ht(u[0].style),qe=T?Ne.find(e=>e.id===T)?.name??T:"",Xe=()=>{M(!1),T&&(_.write(gt({saved:_.saved,old:_.old,styleId:T,values:yt(u[0].style)}),!0),$e())};return h(an,{sectionName:ue?.label??d.type,onBack:s,textEditor:y("words")?t("div",{ref:de,className:"sf-part-text",children:Ge?t(dt,{text:be,onTextChange:e=>J(ne?{text:e,hidden:F}:e),multiline:Ft(w),markup:w!=="plainText",styled:!1,style:u[0].style,base:u[0].base,setValue:te,colors:De,placeholder:ie(_t(g))??void 0,ariaLabel:l(B),head:Pe,typedOnCanvas:C===k}):w?ne?Pe:null:t(et,{field:g,name:o,value:Ue,onChange:J,id:`sf-part-${n}-${o}`})}):void 0,children:[he&&y("sourceNote")&&t(_e,{source:he,slug:Ee(p),menuId:Qt(p)}),ve&&t(rt,{style:y("style")?{value:oe??"",options:[{value:"",label:l("No style"),description:l("Section’s own")},...Ne.map(e=>({value:e.id,label:e.name,description:e.values.font?re(e.values.font)?.label:void 0}))],onChange:e=>je(e||null),changed:Me>0,onEditStyles:i,onUpdateStyle:T&&Ye?()=>M(!0):void 0}:void 0,font:y("font")?{value:S.font??"",styleValue:re(u[0].base.fontKey)?.label,options:Rt.map(e=>({label:e.label,value:e.key})),onChange:e=>E("font",e||null)}:void 0,italic:y("italic")?{value:S.italic,styleValue:mn(Ae,oe),onChange:e=>E("italic",e??null)}:void 0,cells:ut(u[0].style,u[0].base,te,Oe($)).filter(e=>y(e.key)),align:y("align")?Oe($)==="mobile"?{value:S.alignPhone??"",styleValue:S.align??u[0].base.align,onChange:e=>E("alignPhone",e||null)}:{value:S.align??"",styleValue:u[0].base.align,onChange:e=>E("align",e||null)}:void 0,letterCase:y("letterCase")?{value:S.case??"",styleValue:u[0].base.case,onChange:e=>E("case",e||null)}:void 0}),Le&&T&&t(pt,{styleName:qe,onCancel:()=>M(!1),onConfirm:Xe}),ve&&We===null&&y("fixedSizeHint")&&t("p",{className:"es-field-hint sf-hint-keep",children:l("Fixed size — the site’s Text setting doesn’t resize this.")})]})}function mn(n,o){return!o||!Array.isArray(n)?!1:n.find(i=>i?.id===o)?.values?.italic===!0}const hn={fontKey:"",sizePx:16,weight:400,lineRatio:1.4,letterEm:0,align:"left",case:"none",paddingPx:0};export{an as PartPanelBody,_e as PartSourceNote,rn as PartStyleSelect,pn as default,ae as partFace};
|
|
1
|
+
"use client";import{jsx as n,Fragment as A,jsxs as m}from"react/jsx-runtime";import{useContext as lt,useEffect as ie,useRef as st,useState as Ce}from"react";import{FieldSelect as rt,InspectorField as it,fieldShownInView as at}from"efficient-easel/fields";import{SettingsField as ct}from"efficient-easel/panel";import{InspectorUpLevel as G}from"efficient-easel/chrome";import{StylesIcon as dt,TypeIcon as ut}from"efficient-easel/icons";import{useEasel as ft}from"efficient-easel/easel";import{TextPartPanel as pt}from"efficient-easel/copy";import{Button as mt,IconButton as ht,Tooltip as yt}from"efficient-shell/ui";import{PartTextBox as St,partTextCells as gt}from"./PartTextBox.js";import{SiteFields as Ee}from"./SiteFields.js";import{usePartMotion as xt}from"./usePartMotion.js";import{UiIcon as Ie}from"efficient-easel/draw/client";import{usePreviewHeader as bt}from"../../render/components/PreviewHeaderContext.js";import{UpdateStyleDialog as Pt}from"./UpdateStyleDialog.js";import{ScreenDocumentContext as vt}from"efficient-easel/screen/components/ScreenDocumentContext";import{hasStyleChange as wt,partStyleToTextStyleValues as Tt,pushIntoStyle as Nt,resolveTextStyles as Ot,styleIdOfRole as Rt}from"../../render/lib/text-styles/site-text-styles.js";import{useSiteTextStylesWriter as kt}from"../lib/site-text-styles-writer.js";import{useThemeRowPersist as Ct}from"../lib/theme-row-persist.js";import{usePreviewDevice as Et}from"efficient-easel/draw/client";import{shownTier as ae}from"efficient-easel/screen/lib/document/device-fields";import{PART_PANEL_ROWS as Fe}from"../lib/document/part-panel-rows.js";import{usePartStyle as It}from"./PreviewPartStyleContext.js";import{say as l}from"../../format/lib/editor-words.js";import{readHidable as H,textFieldOffPage as Ft,textFieldPanelOnly as _t}from"../lib/document/controls.js";import{TEXT_FIELD_MARKER as zt}from"efficient-easel/draw";import{useSectionOps as Vt}from"efficient-easel/screen/lib/document/use-section-ops";import{FONT_OPTIONS as At,FONT_ROLES as Lt,FONT_ROLE_LABELS as _e,fontOption as ce,fontRoleOf as Bt}from"../../format/lib/fonts.js";import{isMultilineKind as Kt,partPlaceholder as Ut,typeInPlaceKind as Wt}from"../../render/lib/document/part-text.js";import{partRowField as Dt}from"../lib/document/part-row-field.js";import{decodePartKey as jt,partPropsWithRowValue as Gt,partRowValue as Ht}from"../../render/lib/document/part-rows.js";import{followedStyleOf as Mt,propsWithPartStyleValue as L,propsWithoutPartStyle as $t,readPartStyle as ze}from"../../render/lib/document/part-styles.js";import{partThemeColors as Xt}from"../../format/lib/document/part-inks.js";import{styleKeyForPart as Ve}from"../../format/lib/sections/section-text-kinds.js";import{commitPartText as Yt}from"../lib/document/part-typing.js";import{keysOnCanvas as qt,useCanvasTypingPart as Jt}from"../lib/document/canvas-typing.js";import{useEaselHost as Qt}from"efficient-easel/screen/lib/host";import{SOURCE_LINES as Zt,SOURCE_ACTIONS as en,SOURCE_ACTION_LABEL as tn,partSourceNoteFor as nn,partSourceOf as on,sourceMenuIdOf as ln,sourceSlugOf as Ae}from"../../format/lib/document/source-bound-parts.js";import{encodePartId as sn,holdsAuthoredText as rn}from"../../render/lib/document/text-parts.js";import{regionsForSection as an}from"../../format/lib/sections/section-text-regions.js";import{textRegionOfPartKey as cn}from"../../format/lib/sections/text-regions.js";import{SameInEveryViewNote as Le}from"./SameInEveryViewNote.js";function de(t){return t?l(t):null}function Be(t){return t.kind==="role"?_e[t.role]:t.kind==="custom"?"Custom":null}function dn(t){const o=Bt(t.role);return o?{kind:"role",role:o}:null}function un(t,o){if(!t)return{kind:"unread"};const{faceRole:r,base:i}=t;if(o[r]===i.fontKey)return{kind:"role",role:r};const c=Object.keys(o).filter(s=>o[s]===i.fontKey);return c.length===1?{kind:"role",role:c[0]}:{kind:"custom"}}function ue(t,o,r,i){return dn(ze(t,o))??un(r,i)}function fn(t,o){if(!t.length)return null;const r=o(t[0]);return t.every(i=>o(i)===r)?r:null}const M="";function pn({face:t,base:o,onPick:r}){const i=t.kind==="role"?t.role:M,c=[{label:l("No style"),value:M},...Lt.map(s=>({label:l(_e[s]),value:s}))];return n(rt,{ariaLabel:l("Style"),value:i,options:c,inline:!0,onChange:s=>r(s===M?null:s),renderOption:s=>s.value===M?m(A,{children:[n("span",{className:"es-fsel-label sf-part-style-keep",children:s.label}),n("span",{className:"sf-part-style-aside","aria-hidden":"true",children:l("Section’s own")})]}):n("span",{className:"es-fsel-label",style:{fontFamily:`var(--font-role-${s.value})`},children:s.label}),renderValue:()=>n("span",{style:{fontFamily:o?.fontKey?`var(${ce(o.fontKey)?.cssVar})`:void 0,fontWeight:o?.weight},children:de(Be(t))}),valueText:s=>de(Be(t))??s?.label??""})}const Ke=["regionNote","regionStyle"],mn=Object.keys(Fe).filter(t=>!Ke.includes(t));function Ue(t,o){return!t.some(o)}function hn({sectionName:t,onBack:o,textEditor:r,styleRow:i,children:c,tabs:s}){const O=m(A,{children:[r,i,c]});return m("div",{className:"sf-part-panel",children:[n(G,{inline:!0,name:l(t),onSelect:o}),s?s(O):O]})}function We({source:t,slug:o,menuId:r}){const i=Qt(),c=en[t],s=!c.needsSlug||!!o;return n("div",{className:"sf-note sf-note--source",children:m("p",{className:"es-field-hint sf-hint-keep",children:[l(Zt[t]),s?m(A,{children:[" ",n(mt,{type:"button",variant:"link",size:"sm",onClick:()=>{c.type==="storefront-editor:open-menus"?i.send(c.type,{menuId:r??null}):o&&i.send(c.type,{slug:o})},children:l(tn)})]}):null]})})}const De=4,yn=120;function Sn({region:t,sizePx:o,face:r,base:i,onFollowStyle:c,source:s,slug:O,onBack:R,shows:w}){const T=t.follows;return m("div",{className:"sf-note",children:[w("regionNote")&&m(A,{children:[n("p",{children:n("strong",{children:l(t.label)})}),n("p",{children:o?l("Its size follows Styles ▸ {follows} — {px}px right now.",{follows:l(T),px:Math.round(o)}):l("Its size follows Styles ▸ {follows}.",{follows:l(T)})})]}),c?w("regionStyle")?n(A,{children:n(ct,{label:l("Style"),icon:n(dt,{}),hint:l("Every {part} in this section follows it. The face and the size change; the letter case is the section’s own and stays as it is.",{part:l(t.label).toLowerCase()}),children:n(pn,{face:r,base:i,onPick:c})})}):null:w("regionNote")&&n("p",{className:"es-field-hint sf-hint-keep",children:l("Only the size follows a site style. This section sets its own font, weight and letter case.")}),s&&w("sourceNote")?n(We,{source:s,slug:O}):null,Ue([...Ke,"sourceNote"],k=>w(k)&&(k!=="sourceNote"||!!s))&&n(Le,{}),n(G,{inline:!0,name:l("Page"),onSelect:R})]})}function gn({onBack:t}){return m("div",{className:"sf-note",children:[n("p",{children:n("strong",{children:l("This part is no longer here.")})}),n("p",{children:l("The section it belonged to has been changed or removed.")}),n(G,{inline:!0,name:l("Page"),onSelect:t})]})}function xn({onBack:t,partId:o,why:r}){return m("div",{className:"sf-note",children:[n("p",{children:n("strong",{children:l("This part's settings did not open.")})}),n("p",{children:l("The words are still on your page and nothing has been lost. The editor could not work out which control belongs to them, which is a fault on our side. Go back and click the section to open its settings instead.")}),n("p",{className:"sf-note-detail",children:m("code",{children:[o," — ",r]})}),n(G,{inline:!0,name:l("Page"),onSelect:t})]})}function bn({nodeId:t,propKey:o,onBack:r,onEditStyle:i}){const{getItemById:c,getSelectorForId:s,config:O}=ft(e=>e),R=Vt(),w=Jt(),{partStyle:T}=It(),{fonts:k,textStyles:je}=bt(),$=lt(vt),fe=!$?.capabilities?.hasSiteTheme,{persist:Ge}=Ct({themeFromDocument:fe,tokenRef:$?.tokenRef,siteId:$?.siteId??null}),V=kt({themeFromDocument:fe,persist:Ge}),[He,X]=Ce(!1),B=Et(),h=e=>ae(B)!=="tablet"&&at(Fe[e],B),pe=st(null),d=c(t),y=s(t),me=d?O.components[d.type]:void 0,{key:x,row:b}=jt(o),he=me?.fields?.[x],S=b?Dt(he,b):he,C=sn(t,o),p=d?.props??{},P=Wt(S),ye=Ft(S),Se=rn(S),Me=d?on(d.type):null,Y=d?nn(d.type,x):null,q=b?Ht(p[x],b):p[x],ge=!!b&&!(Array.isArray(p[x])&&b.index<p[x].length);ie(()=>{if(qt(document))return;pe.current?.querySelector(".es-copy [contenteditable='true'], .es-copy textarea, .sf-copybox textarea, .sf-copybox input")?.focus()},[C]);const[J,xe]=Ce(0);ie(()=>xe(0),[C]);const Q=!!d&&!ge&&(!y||!S);ie(()=>{if(!Q||J>=De)return;const e=setTimeout(()=>xe(a=>a+1),yn);return()=>clearTimeout(e)},[Q,J]);const $e=Q&&J<De,be=xt(t,Ve(d?.type,o),"textPart");if(!d||ge)return n(gn,{onBack:r});const K=an(d.type),Pe=K?cn(K,o):null;if(K&&Pe){const e=T?.partId===C?T:null,a=K[Pe],f=a.writable===!0&&!!y,v=re=>{y&&R.replaceComponent(y.zone,y.index,{...d,props:L(p,o,"role",re)})};return n(Ee,{motion:be,body:n(Sn,{region:a,sizePx:e?.base.sizePx??null,face:ue(p,o,e,k),base:e?.base??null,onFollowStyle:f?v:void 0,source:Me,slug:Ae(p),onBack:r,shows:h})})}if(!y||!S)return $e?n("div",{className:"sf-note","aria-busy":"true"}):n(xn,{onBack:r,partId:C,why:y?"no field":"no selector"});const ve=e=>{R.replaceComponent(y.zone,y.index,{...d,props:e})},Z=e=>{if(H(e).hidden!==H(q).hidden||!P){const f=b?Gt(p,x,b,e):{...p,[x]:e};f&&ve(f);return}Yt({node:d,propKey:o,kind:P,zone:y.zone,index:y.index},H(e).text,R.replaceComponent)},Xe=q,E=T?.partId===C?T:null,I=E?.styleOwner,U=I?c(I.owner):null,ee=I&&U?s(I.owner):null,te=!!(I&&U&&ee),F=te?U.props??{}:p,ne=te?e=>R.replaceComponent(ee.zone,ee.index,{...U,props:e}):ve,W=te?I.kind:Ve(d?.type,o),g=ze(F,W),u=[{partKey:W,face:ue(F,W,E,k),sizeGroup:E?.sizeGroup??null,base:E?.base??vn,style:g}],we=fn(u,e=>e.sizeGroup),Ye=Xt(E?.inks),_=(e,a)=>{let f=F;for(const v of u)f=L(f,v.partKey,e,a);ne(f)},qe=e=>e?_("textStyle",e):oe({textStyle:null,role:null}),oe=e=>{let a=F;for(const f of u)for(const[v,re]of Object.entries(e))a=L(a,f.partKey,v,re??null);ne(a)},le=P==="text"||P==="textarea",{text:Te,hidden:z}=H(q),D=S?.[zt]?.label??o,Ne=z?l("Show {label} on the slide",{label:l(D)}):l("Hide {label} on the slide",{label:l(D)}),Oe=m("div",{className:"sf-field-head",children:[n(ut,{}),n("span",{className:"sf-field-label sf-field-label--inline",children:l(D)}),le&&n(yt,{content:Ne,children:n(ht,{"aria-pressed":z,"aria-label":Ne,onClick:()=>Z({text:Te,hidden:!z}),children:z?n(Ie,{name:"eye-off",size:14}):n(Ie,{name:"eye",size:14})})})]}),j=!ye&&Se,Je=!!P&&(_t(S)||ye||z||!Se),Re=ue(F,W,E,k),Qe=Re.kind==="role"?Re.role:null,se=Mt(g)??Rt(Qe),ke=Ot(V.saved,V.old),Ze=Object.entries(g).filter(([e,a])=>e!=="role"&&e!=="textStyle"&&a!==void 0).length,et=()=>{let e=F;for(const a of u){const{role:f,textStyle:v}=a.style;e=$t(e,a.partKey),f&&(e=L(e,a.partKey,"role",f)),v&&(e=L(e,a.partKey,"textStyle",v))}ne(e)},N=se,tt=wt(u[0].style),nt=N?ke.find(e=>e.id===N)?.name??N:"",ot=()=>{X(!1),N&&(V.write(Nt({saved:V.saved,old:V.old,styleId:N,values:Tt(u[0].style)}),!0),et())};return m(hn,{sectionName:me?.label??d.type,onBack:r,tabs:e=>n(Ee,{motion:be,body:e}),textEditor:h("words")?n("div",{ref:pe,className:"sf-part-text",children:Je?n(St,{text:Te,onTextChange:e=>Z(le?{text:e,hidden:z}:e),multiline:Kt(P),markup:P!=="plainText",styled:!1,style:u[0].style,base:u[0].base,setValue:oe,colors:Ye,placeholder:de(Ut(S))??void 0,ariaLabel:l(D),head:Oe,typedOnCanvas:w===C}):P?le?Oe:null:n(it,{field:S,name:o,value:Xe,onChange:Z,id:`sf-part-${t}-${o}`})}):void 0,children:[Y&&h("sourceNote")&&n(We,{source:Y,slug:Ae(p),menuId:ln(p)}),j&&n(pt,{style:h("style")?{value:se??"",options:[{value:"",label:l("No style"),description:l("Section’s own")},...ke.map(e=>({value:e.id,label:e.name,description:e.values.font?ce(e.values.font)?.label:void 0}))],onChange:e=>qe(e||null),changed:Ze>0,onEditStyles:i,onUpdateStyle:N&&tt?()=>X(!0):void 0}:void 0,font:h("font")?{value:g.font??"",styleValue:ce(u[0].base.fontKey)?.label,options:At.map(e=>({label:e.label,value:e.key})),onChange:e=>_("font",e||null)}:void 0,italic:h("italic")?{value:g.italic,styleValue:Pn(je,se),onChange:e=>_("italic",e??null)}:void 0,cells:gt(u[0].style,u[0].base,oe,ae(B)).filter(e=>h(e.key)),align:h("align")?ae(B)==="mobile"?{value:g.alignPhone??"",styleValue:g.align??u[0].base.align,onChange:e=>_("alignPhone",e||null)}:{value:g.align??"",styleValue:u[0].base.align,onChange:e=>_("align",e||null)}:void 0,letterCase:h("letterCase")?{value:g.case??"",styleValue:u[0].base.case,onChange:e=>_("case",e||null)}:void 0}),He&&N&&n(Pt,{styleName:nt,onCancel:()=>X(!1),onConfirm:ot}),j&&we===null&&h("fixedSizeHint")&&n("p",{className:"es-field-hint sf-hint-keep",children:l("Fixed size — the site’s Text setting doesn’t resize this.")}),Ue(mn,e=>h(e)&&(e==="words"||(e==="sourceNote"?!!Y:e==="fixedSizeHint"?j&&we===null:j)))&&n(Le,{})]})}function Pn(t,o){return!o||!Array.isArray(t)?!1:t.find(i=>i?.id===o)?.values?.italic===!0}const vn={fontKey:"",sizePx:16,weight:400,lineRatio:1.4,letterEm:0,align:"left",case:"none",paddingPx:0};export{hn as PartPanelBody,We as PartSourceNote,pn as PartStyleSelect,bn as default,ue as partFace};
|
|
@@ -3,14 +3,16 @@ import { type PartNeedle } from "../../render/lib/document/text-parts.js";
|
|
|
3
3
|
import { type PartStyleBase, type PartStyles } from "../../render/lib/document/part-styles.js";
|
|
4
4
|
import { type FontRole } from "../../format/lib/fonts.js";
|
|
5
5
|
import { type TypeGroup } from "../../format/lib/theme.js";
|
|
6
|
+
import { type PartMotion } from "../../render/lib/animation/part-motion.js";
|
|
6
7
|
export declare function styleTagsOf(element: HTMLElement): {
|
|
7
8
|
faceRole: FontRole;
|
|
8
9
|
sizeGroup: TypeGroup | null;
|
|
9
10
|
};
|
|
10
11
|
export declare function measureStyleBase(element: HTMLElement): PartStyleBase;
|
|
11
|
-
export default function PreviewPartAnchors({ needles, styles, type, children, }: {
|
|
12
|
+
export default function PreviewPartAnchors({ needles, styles, motions, type, children, }: {
|
|
12
13
|
needles: PartNeedle[];
|
|
13
14
|
styles: PartStyles;
|
|
15
|
+
motions?: Readonly<Record<string, PartMotion>>;
|
|
14
16
|
type?: string;
|
|
15
17
|
children: ReactNode;
|
|
16
18
|
}): import("react").JSX.Element;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use client";import{jsx as
|
|
1
|
+
"use client";import{jsx as F}from"react/jsx-runtime";import{readInks as z}from"../../format/lib/document/part-inks.js";import{useEffect as H,useRef as v}from"react";import{markOverlayPortal as Y}from"../../format/lib/document/overlay-portal.js";import{usePreviewParts as $}from"efficient-easel/draw/client";import{usePartStyle as j}from"./PreviewPartStyleContext.js";import{usePreviewDevice as G}from"efficient-easel/draw/client";import{decodePartId as q,encodePartId as U}from"efficient-easel/draw";import{BLOCK_ATTRIBUTE as V}from"efficient-easel/canvas";import{engagePartAnchors as Q}from"../lib/document/part-anchors.js";import{PART_ATTR as g,PART_STYLE_KIND_ATTR as T,PART_STYLE_OWNER_ATTR as X,partStyleOwnerOf as O}from"../../render/lib/document/text-parts.js";import{PART_STYLE_PROPERTIES as K,applyPartStyles as x,blockDrawsTextStyle as Z,partFontKeyOf as ee,partStyleBase as te,partStyleSource as re}from"../../render/lib/document/part-styles.js";import{fontRoleOfClassName as oe,styleRoleOfClassName as ne}from"../../format/lib/fonts.js";import{typeScaleGroupOfClassName as I}from"../../format/lib/theme.js";import{styleKeyForPart as C}from"../../format/lib/sections/section-text-kinds.js";import{NO_MOTIONS as se,PART_HOST_ATTR as ie}from"../../render/lib/animation/part-motion.js";import{paintPartMotion as le}from"../lib/document/part-motion-canvas.js";function ae(a){let o=null,i=null;for(let t=a;t&&(o===null||i===null);t=t.parentElement){const p=t.getAttribute("class");o??=ne(p),i??=I(p)}return{faceRole:o??"body",sizeGroup:i}}function D(a){const o=a.style,i={};for(const r of K)i[r]=o[r]??"",o[r]="";const t=getComputedStyle(a),p=getComputedStyle(a.ownerDocument.documentElement),m=te({fontSize:t.fontSize,fontWeight:t.fontWeight,lineHeight:t.lineHeight,letterSpacing:t.letterSpacing,textAlign:t.textAlign,textTransform:t.textTransform,paddingTop:t.paddingTop},ee(t.fontFamily,r=>p.getPropertyValue(r)));for(const r of K)o[r]=i[r];return m}function pe({needles:a,styles:o,motions:i=se,type:t,children:p}){const m=v(null),{selectedPartId:r}=$(),{setPartStyle:P}=j(),d=G()==="mobile",b=JSON.stringify(a),h=JSON.stringify(o),A=JSON.stringify(i),J=v(new Map);return H(()=>{const u=m.current;if(!u)return;const R=[],w=()=>u.parentElement,M=l=>{const n=w();if(!n)return null;const f=new MutationObserver(l);return f.observe(n,{attributes:!0,attributeFilter:[V]}),()=>f.disconnect()},k=l=>{const n=new MutationObserver(l);return n.observe(u,{childList:!0,subtree:!0,characterData:!0}),()=>n.disconnect()};let c=[];R.push(()=>{for(const l of c)l();c=[]});const L=JSON.parse(b),E=JSON.parse(h),W=JSON.parse(A),B=Q(u,L,w,M,(l,n,f)=>{for(const e of c)e();c=[];const _=[];for(const e of f){const s=e,y=Y(s);y&&c.push(y),s.getAttribute(g)===r&&_.push(s)}const N=re(n,r,_,e=>oe(e)!==null||I(e)!==null);if(N&&r){const e=N;P({partId:r,...ae(e),base:D(e),inks:z(e),...(()=>{const s=O(e);return s?{styleOwner:s}:{}})()})}x(f.filter(e=>!O(e)).map(e=>({element:e,partId:e.getAttribute(g)??""})),E,e=>D(e),e=>C(t,e),void 0,d,e=>Z(t,e));const S=[...u.querySelectorAll(`[${X}="${CSS.escape(n)}"][${T}]`)];S.length&&x(S.map(e=>({element:e,partId:U(n,e.getAttribute(T)??"")})),E,void 0,e=>e,void 0,d),c.push(le([...f.filter(e=>!O(e)).map(e=>{const s=e,y=q(s.getAttribute(g)??"")?.propKey??"";return{element:s,partKey:C(t,y)}}),...S.map(e=>({element:e,partKey:e.getAttribute(T)??""}))],e=>W[e],d,J.current))},k);return()=>{B();for(const l of R)l()}},[b,h,A,r,P,d,t]),F("div",{ref:m,[ie]:"",style:{display:"contents"},children:p})}export{pe as default,D as measureStyleBase,ae as styleTagsOf};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function SameInEveryViewNote(): import("react").JSX.Element;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use client";import{jsx as e}from"react/jsx-runtime";import{EmptyState as t}from"efficient-shell/ui";import{say as o}from"../../format/lib/editor-words.js";function n(){return e(t,{variant:"none",icon:!1,message:o("These settings apply to every view.")})}export{n as SameInEveryViewNote};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use client";import{jsx as e}from"react/jsx-runtime";import{useState as p}from"react";import{Button as u,Tooltip as d,toast as r}from"efficient-shell/ui";import{TemplateIcon as v}from"efficient-easel/icons";import{useSettledAction as h}from"efficient-easel/easel";import{useScreenDocument as y}from"efficient-easel/screen/components/ScreenDocumentContext";import{say as t}from"../../format/lib/editor-words.js";function I({enabled:s,reason:c,onSaved:m}){const{flushSave:l}=y(),[a,n]=p(!1),f=async()=>{if(!a){n(!0);try{await l()?m():r.error(t(i))}catch{r.error(t(i))}finally{n(!1)}}},o=h({onPress:()=>{f()},busy:a});return e(d,{side:"bottom",content:s?t("Save this website as a platform template"):t(c),children:e("span",{className:"sf-tip-disabled",tabIndex:s?void 0:0,children:e(u,{variant:"secondary",disabled:!s||o.busy,loading:o.busy,onClick:o.onPress,rightIcon:e(v,{size:15}),children:t("Save as Template")})})})}const i="Your last changes did not save, so the template was not made. Try again.";export{I as SaveAsTemplateButton};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{jsx as h,Fragment as t,jsxs as e}from"react/jsx-runtime";import{BlockBannerIcon as n,BlockBoxIcon as M,BlockButtonIcon as g,BlockDividerIcon as x,BlockFooterIcon as a,BlockHeadingIcon as y,BlockProductIcon as p,BlockSocialIcon as w,BlockTextIcon as s,CardPaymentIcon as B,ChatIcon as k,AccountIcon as u,GlobeIcon as I,GridIcon as m,ImageIcon as c,MapIcon as S,MediaIcon as L,PageIcon as F}from"efficient-easel/icons";import{CART_GLYPH as v}from"../../render/components/cartGlyph.js";const H={header:e(t,{children:[h("rect",{x:"3",y:"5",width:"18",height:"14",rx:"2"}),h("path",{d:"M3 9.5h18"})]}),social:e(t,{children:[h("circle",{cx:"6",cy:"12",r:"2.5"}),h("circle",{cx:"18",cy:"6",r:"2.5"}),h("circle",{cx:"18",cy:"18",r:"2.5"}),h("path",{d:"M8.2 10.8l7.6-3.6M8.2 13.2l7.6 3.6"})]}),ticker:e(t,{children:[h("rect",{x:"3",y:"8.5",width:"18",height:"7",rx:"2"}),h("path",{d:"M6 12h3.5M11.5 12h2M15.5 12h2.5"})]}),FooterLogo:e(t,{children:[h("path",{d:"M4 15.5h6M4 18h4"}),h("path",{d:"M14 8.5l3 7 3-7"})]}),FooterMenu:h("path",{d:"M6 7h12M6 11h12M6 15h8M6 19h8"}),FooterGroup:e(t,{children:[h("rect",{x:"4",y:"4",width:"16",height:"16",rx:"2",strokeDasharray:"3 2.5"}),h("path",{d:"M8 9h8M8 13h8M8 16h5"})]}),FooterText:h("path",{d:"M5 7h14M5 12h14M5 17h9"}),FooterEmailSignup:e(t,{children:[h("rect",{x:"3",y:"6",width:"18",height:"12",rx:"2"}),h("path",{d:"M3.5 7l8.5 6 8.5-6"})]}),SearchBlock:e(t,{children:[h("circle",{cx:"11",cy:"11",r:"6"}),h("path",{d:"M20 20l-4.2-4.2"})]}),CartBlock:v,CountrySwitchBlock:e(t,{children:[h("circle",{cx:"12",cy:"12",r:"8.5"}),h("path",{d:"M3.5 12h17M12 3.5c2.6 2.4 3.6 5.2 3.6 8.5s-1 6.1-3.6 8.5M12 3.5c-2.6 2.4-3.6 5.2-3.6 8.5s1 6.1 3.6 8.5"})]}),ThemeSwitchBlock:e(t,{children:[h("circle",{cx:"12",cy:"12",r:"8.5"}),h("path",{d:"M12 3.5v17M12 5.5l6 6M12 10.5l5.2 5.2M12 15.5l2.8 2.8"})]}),LegalLineBlock:e(t,{children:[h("path",{d:"M3 9h18"}),h("path",{d:"M3 14h8M14 14h2M18 14h3"})]}),Hero:e(t,{children:[h("rect",{x:"3",y:"4",width:"18",height:"16",rx:"2"}),h("path",{d:"M7 13.5h7M7 16.5h10"})]}),HeroSlide:e(t,{children:[h("rect",{x:"3",y:"5",width:"18",height:"14",rx:"2"}),h("path",{d:"M7 15h6M16 9.5h.01M9.5 12l-2.5 3"})]}),HeroSingle:e(t,{children:[h("rect",{x:"3",y:"4",width:"18",height:"16",rx:"2"}),h("path",{d:"M10.5 8.5l4 2.5-4 2.5z"}),h("path",{d:"M7 17h7"})]}),Collections:e(t,{children:[h("rect",{x:"3",y:"5",width:"4.6",height:"14",rx:"1.3"}),h("rect",{x:"9.7",y:"5",width:"4.6",height:"14",rx:"1.3"}),h("rect",{x:"16.4",y:"5",width:"4.6",height:"14",rx:"1.3"})]}),CollectionCard:e(t,{children:[h("rect",{x:"6",y:"4",width:"12",height:"16",rx:"2"}),h("path",{d:"M9 15h6M9 17.5h4"})]}),AlloyWheelsListing:e(t,{children:[h("path",{d:"M3 5h5M3 9h5M3 13h5M3 17h5"}),h("rect",{x:"11.5",y:"5",width:"4.2",height:"5",rx:"1"}),h("rect",{x:"17.3",y:"5",width:"4.2",height:"5",rx:"1"}),h("rect",{x:"11.5",y:"12",width:"4.2",height:"5",rx:"1"}),h("rect",{x:"17.3",y:"12",width:"4.2",height:"5",rx:"1"})]}),CatalogFilterBar:e(t,{children:[h("path",{d:"M3 7h9M15.5 7H21"}),h("circle",{cx:"13.5",cy:"7",r:"1.7"}),h("path",{d:"M3 12h4M10.5 12H21"}),h("circle",{cx:"8.5",cy:"12",r:"1.7"}),h("path",{d:"M3 17h9M15.5 17H21"}),h("circle",{cx:"13.5",cy:"17",r:"1.7"})]}),ProductGrid:e(t,{children:[h("rect",{x:"3",y:"5",width:"4.8",height:"6",rx:"1"}),h("rect",{x:"9.6",y:"5",width:"4.8",height:"6",rx:"1"}),h("rect",{x:"16.2",y:"5",width:"4.8",height:"6",rx:"1"}),h("rect",{x:"3",y:"13",width:"4.8",height:"6",rx:"1"}),h("rect",{x:"9.6",y:"13",width:"4.8",height:"6",rx:"1"}),h("rect",{x:"16.2",y:"13",width:"4.8",height:"6",rx:"1"})]}),RelatedProducts:e(t,{children:[h("path",{d:"M3 5h10"}),h("rect",{x:"3",y:"9.5",width:"5",height:"9",rx:"1"}),h("rect",{x:"9.5",y:"9.5",width:"5",height:"9",rx:"1"}),h("rect",{x:"16",y:"9.5",width:"5",height:"9",rx:"1"})]}),Gallery:e(t,{children:[h("rect",{x:"3",y:"4",width:"11",height:"16",rx:"2"}),h("rect",{x:"15.5",y:"4",width:"5.5",height:"7.5",rx:"1.5"}),h("rect",{x:"15.5",y:"12.5",width:"5.5",height:"7.5",rx:"1.5"})]}),GalleryB:e(t,{children:[h("rect",{x:"3.5",y:"4",width:"7.5",height:"7.5",rx:"1.5"}),h("rect",{x:"13",y:"4",width:"7.5",height:"7.5",rx:"1.5"}),h("rect",{x:"3.5",y:"12.5",width:"7.5",height:"7.5",rx:"1.5"}),h("rect",{x:"13",y:"12.5",width:"7.5",height:"7.5",rx:"1.5"})]}),GalleryItem:e(t,{children:[h("rect",{x:"4",y:"5",width:"16",height:"14",rx:"2"}),h("circle",{cx:"9",cy:"10",r:"1.6"}),h("path",{d:"M20 15.5l-4.5-4L7 19"})]}),Events:e(t,{children:[h("rect",{x:"4",y:"5",width:"16",height:"15",rx:"2"}),h("path",{d:"M4 9.5h16M8.5 3v4M15.5 3v4M8 14h2M14 14h2"})]}),PostCard:e(t,{children:[h("rect",{x:"4",y:"3.5",width:"16",height:"17",rx:"2"}),h("rect",{x:"6.5",y:"6",width:"11",height:"6",rx:"1"}),h("path",{d:"M6.5 14.5h11M6.5 17.5h7"})]}),Manifesto:e(t,{children:[h("path",{d:"M7 8h3.2v4c0 1.6-1 2.6-3 3.2"}),h("path",{d:"M14 8h3.2v4c0 1.6-1 2.6-3 3.2"})]}),Stats:e(t,{children:[h("path",{d:"M3.5 20h17"}),h("path",{d:"M6 20v-7M11 20V7M16 20v-5M20.5 20v-9"})]}),Logos:e(t,{children:[h("circle",{cx:"6",cy:"12",r:"2.6"}),h("rect",{x:"10",y:"9.4",width:"5.2",height:"5.2",rx:"1.2"}),h("path",{d:"M19 9.2l2.4 5h-4.8z"})]}),Ticker:e(t,{children:[h("rect",{x:"3",y:"8.5",width:"18",height:"7",rx:"2"}),h("path",{d:"M6 12h3.5M11.5 12h2M15.5 12h2.5"})]}),SectionHeader:e(t,{children:[h("rect",{x:"3.5",y:"6",width:"5",height:"5",rx:"1.2"}),h("path",{d:"M11 8.5h9M3.5 15.5h17"})]}),IntroBleed:e(t,{children:[h("rect",{x:"3",y:"4",width:"18",height:"16",rx:"2"}),h("path",{d:"M3 13.5h18M7 16.8h6"})]}),Split:e(t,{children:[h("rect",{x:"3",y:"5",width:"8",height:"14",rx:"1.5"}),h("path",{d:"M14 8.5h6M14 12h6M14 15.5h4"})]}),Eyebrow:e(t,{children:[h("path",{d:"M4 8.5h4.5M11 8.5h9"}),h("path",{d:"M4 14.5h16"})]}),HeroGroup:e(t,{children:[h("rect",{x:"3.5",y:"4.5",width:"17",height:"15",rx:"2"}),h("path",{d:"M7 9h8M7 12.5h10M7 16h6"})]}),Form:e(t,{children:[h("rect",{x:"3",y:"4",width:"18",height:"16",rx:"2"}),h("path",{d:"M6.5 9h11M6.5 12.5h11"}),h("rect",{x:"6.5",y:"15",width:"6.5",height:"2.6",rx:"1.3"})]}),LogoBlock:h(t,{children:h("path",{d:"M12 3.5l7.5 3.2v5.1c0 4.2-3.2 7.1-7.5 8.7-4.3-1.6-7.5-4.5-7.5-8.7V6.7z"})}),Spacer:e(t,{children:[h("path",{d:"M12 4v6M9.5 6.5L12 4l2.5 2.5M12 20v-6M9.5 17.5L12 20l2.5-2.5"}),h("path",{d:"M5 13h14",strokeDasharray:"2 2.5"})]}),ContactRouting:e(t,{children:[h("rect",{x:"3",y:"4",width:"5",height:"5",rx:"1"}),h("rect",{x:"9.5",y:"4",width:"5",height:"5",rx:"1"}),h("rect",{x:"16",y:"4",width:"5",height:"5",rx:"1"}),h("path",{d:"M4 13.5h11M4 17.5h7"}),h("path",{d:"M17 15l3 2-3 2"})]}),CustomHTML:h("path",{d:"M9 8l-4 4 4 4M15 8l4 4-4 4"})},C=h("rect",{x:"4",y:"4",width:"16",height:"16",rx:"2.5"}),P={footer:a,Footer:a,Divider:x,FooterDivider:x,Banner:n,Flex:M,FooterSocial:w,FooterPayment:B,page:F,website:I,AccountBlock:u,chat:k,Heading:y,Text:s,ImageBlock:c,ButtonBlock:g,LocationMap:S,Grid:m,ProductRef:p,heroMedia:L,heroImage:c,heroImage2:c},G={MenuBlock:"FooterMenu",EmailFormBlock:"FooterEmailSignup",SocialLogosBlock:"FooterSocial",PaymentLogosBlock:"FooterPayment",SiteHeader:"header",SiteFooter:"footer"};function f({type:i,size:r=16,className:d}){const o=G[i]??i,l=P[o];return l?h(l,{size:r,className:d}):h("svg",{width:r,height:r,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:1.7,strokeLinecap:"round",strokeLinejoin:"round",className:d,"aria-hidden":"true",children:H[o]??C})}export{f as default};
|
|
1
|
+
import{jsx as h,Fragment as t,jsxs as e}from"react/jsx-runtime";import{BlockBannerIcon as n,BlockBoxIcon as M,BlockButtonIcon as g,BlockDividerIcon as x,BlockFooterIcon as a,BlockHeadingIcon as y,BlockProductIcon as p,BlockSocialIcon as w,BlockTextIcon as s,CardPaymentIcon as B,ChatIcon as k,AccountIcon as u,GlobeIcon as I,GridIcon as m,ImageIcon as c,MapIcon as S,MediaIcon as L,PageIcon as F}from"efficient-easel/icons";import{CART_GLYPH as v}from"../../render/components/cartGlyph.js";const H={header:e(t,{children:[h("rect",{x:"3",y:"5",width:"18",height:"14",rx:"2"}),h("path",{d:"M3 9.5h18"})]}),social:e(t,{children:[h("circle",{cx:"6",cy:"12",r:"2.5"}),h("circle",{cx:"18",cy:"6",r:"2.5"}),h("circle",{cx:"18",cy:"18",r:"2.5"}),h("path",{d:"M8.2 10.8l7.6-3.6M8.2 13.2l7.6 3.6"})]}),ticker:e(t,{children:[h("rect",{x:"3",y:"8.5",width:"18",height:"7",rx:"2"}),h("path",{d:"M6 12h3.5M11.5 12h2M15.5 12h2.5"})]}),FooterLogo:e(t,{children:[h("path",{d:"M4 15.5h6M4 18h4"}),h("path",{d:"M14 8.5l3 7 3-7"})]}),FooterMenu:h("path",{d:"M6 7h12M6 11h12M6 15h8M6 19h8"}),FooterGroup:e(t,{children:[h("rect",{x:"4",y:"4",width:"16",height:"16",rx:"2",strokeDasharray:"3 2.5"}),h("path",{d:"M8 9h8M8 13h8M8 16h5"})]}),FooterText:h("path",{d:"M5 7h14M5 12h14M5 17h9"}),FooterEmailSignup:e(t,{children:[h("rect",{x:"3",y:"6",width:"18",height:"12",rx:"2"}),h("path",{d:"M3.5 7l8.5 6 8.5-6"})]}),SearchBlock:e(t,{children:[h("circle",{cx:"11",cy:"11",r:"6"}),h("path",{d:"M20 20l-4.2-4.2"})]}),CartBlock:v,CountrySwitchBlock:e(t,{children:[h("circle",{cx:"12",cy:"12",r:"8.5"}),h("path",{d:"M3.5 12h17M12 3.5c2.6 2.4 3.6 5.2 3.6 8.5s-1 6.1-3.6 8.5M12 3.5c-2.6 2.4-3.6 5.2-3.6 8.5s1 6.1 3.6 8.5"})]}),ThemeSwitchBlock:e(t,{children:[h("circle",{cx:"12",cy:"12",r:"8.5"}),h("path",{d:"M12 3.5v17M12 5.5l6 6M12 10.5l5.2 5.2M12 15.5l2.8 2.8"})]}),LegalLineBlock:e(t,{children:[h("path",{d:"M3 9h18"}),h("path",{d:"M3 14h8M14 14h2M18 14h3"})]}),Hero:e(t,{children:[h("rect",{x:"3",y:"4",width:"18",height:"16",rx:"2"}),h("path",{d:"M7 13.5h7M7 16.5h10"})]}),HeroSlide:e(t,{children:[h("rect",{x:"3",y:"5",width:"18",height:"14",rx:"2"}),h("path",{d:"M7 15h6M16 9.5h.01M9.5 12l-2.5 3"})]}),HeroSingle:e(t,{children:[h("rect",{x:"3",y:"4",width:"18",height:"16",rx:"2"}),h("path",{d:"M10.5 8.5l4 2.5-4 2.5z"}),h("path",{d:"M7 17h7"})]}),Collections:e(t,{children:[h("rect",{x:"3",y:"5",width:"4.6",height:"14",rx:"1.3"}),h("rect",{x:"9.7",y:"5",width:"4.6",height:"14",rx:"1.3"}),h("rect",{x:"16.4",y:"5",width:"4.6",height:"14",rx:"1.3"})]}),CollectionCard:e(t,{children:[h("rect",{x:"6",y:"4",width:"12",height:"16",rx:"2"}),h("path",{d:"M9 15h6M9 17.5h4"})]}),AlloyWheelsListing:e(t,{children:[h("path",{d:"M3 5h5M3 9h5M3 13h5M3 17h5"}),h("rect",{x:"11.5",y:"5",width:"4.2",height:"5",rx:"1"}),h("rect",{x:"17.3",y:"5",width:"4.2",height:"5",rx:"1"}),h("rect",{x:"11.5",y:"12",width:"4.2",height:"5",rx:"1"}),h("rect",{x:"17.3",y:"12",width:"4.2",height:"5",rx:"1"})]}),CatalogFilterBar:e(t,{children:[h("path",{d:"M3 7h9M15.5 7H21"}),h("circle",{cx:"13.5",cy:"7",r:"1.7"}),h("path",{d:"M3 12h4M10.5 12H21"}),h("circle",{cx:"8.5",cy:"12",r:"1.7"}),h("path",{d:"M3 17h9M15.5 17H21"}),h("circle",{cx:"13.5",cy:"17",r:"1.7"})]}),ProductGrid:e(t,{children:[h("rect",{x:"3",y:"5",width:"4.8",height:"6",rx:"1"}),h("rect",{x:"9.6",y:"5",width:"4.8",height:"6",rx:"1"}),h("rect",{x:"16.2",y:"5",width:"4.8",height:"6",rx:"1"}),h("rect",{x:"3",y:"13",width:"4.8",height:"6",rx:"1"}),h("rect",{x:"9.6",y:"13",width:"4.8",height:"6",rx:"1"}),h("rect",{x:"16.2",y:"13",width:"4.8",height:"6",rx:"1"})]}),RelatedProducts:e(t,{children:[h("path",{d:"M3 5h10"}),h("rect",{x:"3",y:"9.5",width:"5",height:"9",rx:"1"}),h("rect",{x:"9.5",y:"9.5",width:"5",height:"9",rx:"1"}),h("rect",{x:"16",y:"9.5",width:"5",height:"9",rx:"1"})]}),Gallery:e(t,{children:[h("rect",{x:"3",y:"4",width:"11",height:"16",rx:"2"}),h("rect",{x:"15.5",y:"4",width:"5.5",height:"7.5",rx:"1.5"}),h("rect",{x:"15.5",y:"12.5",width:"5.5",height:"7.5",rx:"1.5"})]}),GalleryB:e(t,{children:[h("rect",{x:"3.5",y:"4",width:"7.5",height:"7.5",rx:"1.5"}),h("rect",{x:"13",y:"4",width:"7.5",height:"7.5",rx:"1.5"}),h("rect",{x:"3.5",y:"12.5",width:"7.5",height:"7.5",rx:"1.5"}),h("rect",{x:"13",y:"12.5",width:"7.5",height:"7.5",rx:"1.5"})]}),GalleryItem:e(t,{children:[h("rect",{x:"4",y:"5",width:"16",height:"14",rx:"2"}),h("circle",{cx:"9",cy:"10",r:"1.6"}),h("path",{d:"M20 15.5l-4.5-4L7 19"})]}),Events:e(t,{children:[h("rect",{x:"4",y:"5",width:"16",height:"15",rx:"2"}),h("path",{d:"M4 9.5h16M8.5 3v4M15.5 3v4M8 14h2M14 14h2"})]}),PostCard:e(t,{children:[h("rect",{x:"4",y:"3.5",width:"16",height:"17",rx:"2"}),h("rect",{x:"6.5",y:"6",width:"11",height:"6",rx:"1"}),h("path",{d:"M6.5 14.5h11M6.5 17.5h7"})]}),Manifesto:e(t,{children:[h("path",{d:"M7 8h3.2v4c0 1.6-1 2.6-3 3.2"}),h("path",{d:"M14 8h3.2v4c0 1.6-1 2.6-3 3.2"})]}),Stats:e(t,{children:[h("path",{d:"M3.5 20h17"}),h("path",{d:"M6 20v-7M11 20V7M16 20v-5M20.5 20v-9"})]}),Logos:e(t,{children:[h("circle",{cx:"6",cy:"12",r:"2.6"}),h("rect",{x:"10",y:"9.4",width:"5.2",height:"5.2",rx:"1.2"}),h("path",{d:"M19 9.2l2.4 5h-4.8z"})]}),Ticker:e(t,{children:[h("rect",{x:"3",y:"8.5",width:"18",height:"7",rx:"2"}),h("path",{d:"M6 12h3.5M11.5 12h2M15.5 12h2.5"})]}),SectionHeader:e(t,{children:[h("rect",{x:"3.5",y:"6",width:"5",height:"5",rx:"1.2"}),h("path",{d:"M11 8.5h9M3.5 15.5h17"})]}),IntroBleed:e(t,{children:[h("rect",{x:"3",y:"4",width:"18",height:"16",rx:"2"}),h("path",{d:"M3 13.5h18M7 16.8h6"})]}),Split:e(t,{children:[h("rect",{x:"3",y:"5",width:"8",height:"14",rx:"1.5"}),h("path",{d:"M14 8.5h6M14 12h6M14 15.5h4"})]}),Eyebrow:e(t,{children:[h("path",{d:"M4 8.5h4.5M11 8.5h9"}),h("path",{d:"M4 14.5h16"})]}),HeroGroup:e(t,{children:[h("rect",{x:"3.5",y:"4.5",width:"17",height:"15",rx:"2"}),h("path",{d:"M7 9h8M7 12.5h10M7 16h6"})]}),Form:e(t,{children:[h("rect",{x:"3",y:"4",width:"18",height:"16",rx:"2"}),h("path",{d:"M6.5 9h11M6.5 12.5h11"}),h("rect",{x:"6.5",y:"15",width:"6.5",height:"2.6",rx:"1.3"})]}),LogoBlock:h(t,{children:h("path",{d:"M12 3.5l7.5 3.2v5.1c0 4.2-3.2 7.1-7.5 8.7-4.3-1.6-7.5-4.5-7.5-8.7V6.7z"})}),Spacer:e(t,{children:[h("path",{d:"M12 4v6M9.5 6.5L12 4l2.5 2.5M12 20v-6M9.5 17.5L12 20l2.5-2.5"}),h("path",{d:"M5 13h14",strokeDasharray:"2 2.5"})]}),ContactRouting:e(t,{children:[h("rect",{x:"3",y:"4",width:"5",height:"5",rx:"1"}),h("rect",{x:"9.5",y:"4",width:"5",height:"5",rx:"1"}),h("rect",{x:"16",y:"4",width:"5",height:"5",rx:"1"}),h("path",{d:"M4 13.5h11M4 17.5h7"}),h("path",{d:"M17 15l3 2-3 2"})]}),Contents:e(t,{children:[h("path",{d:"M4 7h2M4 12h2M4 17h2"}),h("path",{d:"M9 7h11M9 12h9M9 17h10"})]}),CustomHTML:h("path",{d:"M9 8l-4 4 4 4M15 8l4 4-4 4"})},C=h("rect",{x:"4",y:"4",width:"16",height:"16",rx:"2.5"}),P={footer:a,Footer:a,Divider:x,FooterDivider:x,Banner:n,Flex:M,FooterSocial:w,FooterPayment:B,page:F,website:I,AccountBlock:u,chat:k,Heading:y,Text:s,ImageBlock:c,ButtonBlock:g,LocationMap:S,Grid:m,ProductRef:p,heroMedia:L,heroImage:c,heroImage2:c},G={MenuBlock:"FooterMenu",EmailFormBlock:"FooterEmailSignup",SocialLogosBlock:"FooterSocial",PaymentLogosBlock:"FooterPayment",SiteHeader:"header",SiteFooter:"footer"};function f({type:i,size:r=16,className:d}){const o=G[i]??i,l=P[o];return l?h(l,{size:r,className:d}):h("svg",{width:r,height:r,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:1.7,strokeLinecap:"round",strokeLinejoin:"round",className:d,"aria-hidden":"true",children:H[o]??C})}export{f as default};
|
|
@@ -1,10 +1,13 @@
|
|
|
1
1
|
import { type ReactNode } from "react";
|
|
2
2
|
import { type SettingsBucket } from "efficient-easel/fields";
|
|
3
|
+
import type { PartMotionRows } from "./usePartMotion.js";
|
|
3
4
|
import { type HeroMediaPart } from "../../render/lib/document/hero-media-parts.js";
|
|
4
5
|
export declare const TAB_ICONS: Record<SettingsBucket, ReactNode>;
|
|
5
|
-
export declare function SiteFields({ entries, entryCount, part, omit, }: {
|
|
6
|
+
export declare function SiteFields({ entries, entryCount, part, omit, motion, body, }: {
|
|
6
7
|
entries?: ReactNode;
|
|
7
8
|
entryCount?: number;
|
|
8
9
|
part?: HeroMediaPart | null;
|
|
9
10
|
omit?: readonly string[];
|
|
11
|
+
motion?: PartMotionRows;
|
|
12
|
+
body?: ReactNode;
|
|
10
13
|
}): import("react").JSX.Element;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use client";import{jsx as
|
|
1
|
+
"use client";import{jsx as c,Fragment as ce,jsxs as de}from"react/jsx-runtime";import{createContext as ie,useContext as ue,useLayoutEffect as V,useMemo as g,useRef as W,useState as F}from"react";import{useEasel as q,useSelectedFields as fe}from"efficient-easel/easel";import{fieldShownInView as pe,Inspector as me,planFields as P}from"efficient-easel/fields";import{BUCKET_ICONS as we,RowPropsContext as he}from"../lib/document/controls.js";import{panelTab as be}from"../../format/lib/document/panel-tabs.js";import{BUCKETS as ge}from"../lib/document/field-groups.js";import{say as ye}from"../../format/lib/editor-words.js";import{SameInEveryViewNote as xe}from"./SameInEveryViewNote.js";import{usePreviewDevice as Se}from"efficient-easel/draw/client";import{deviceField as ve}from"efficient-easel/screen/lib/document/device-fields";import{showWhenContext as Be,visibleFields as U}from"../../render/lib/document/show-when.js";import{fieldsOfPart as Ce}from"../../render/lib/document/hero-media-parts.js";import{bandIsDropped as Te,droppedBands as ke,loneDesignBand as Ee,sameKeys as De,TEXT_BAND_KEY as O,TEXT_BAND_TITLE as _e,withoutBands as Fe}from"../../format/lib/document/panel-bands.js";const I=new Map,y=new Set;function X(o,r){const p=new Map;for(const t of o.querySelectorAll(".es-insp-row[data-field]"))p.set(t.getAttribute("data-field")??"",t);const d=[];for(const[t,b]of r)d.push({key:t,rows:b.map(m=>{const w=p.get(m),i=!!w&&[...w.children].some(S=>!S.hidden),x=w?.querySelector(".es-field-label, .es-list-label")?.textContent?.trim();return{shown:i,labelled:i&&!!x}})});return d}const Pe=Object.fromEntries(ge.map(o=>{const r=we[o];return[o,c(r,{},o)]})),Y=ie(null),Oe={_partBody:ve("each",{type:"custom",render:()=>c(Ie,{})})};function Ie(){return c(ce,{children:ue(Y)})}function Ge({entries:o,entryCount:r=0,part:p=null,omit:d,motion:t,body:b}){const{id:m,fields:w,values:i,readOnly:x,onChange:S}=fe(),l=g(()=>t?{...i,...t.values}:i,[i,t?.values]),G=(e,n)=>t?.keys.has(e)?t.onChange(e,n):S(e,n),v=Se(),{appState:R,config:H}=q(e=>e),B=Be(v,H,R.data.content??[],R.ui.itemSelector),C=b===void 0?Ce(w,p):Oe,j=g(()=>{const e=d?.length?Object.fromEntries(Object.entries(C).filter(([n])=>!d.includes(n))):C;return t?{...e,...t.fields}:e},[C,d,t?.fields]),h=U(j,l,B),[z,J]=F(()=>new Set(y)),[T,Q]=F(()=>new Set),A=W(null),{bandRows:Z,designBands:ee,looseRows:te}=g(()=>{const e=new Map,n=new Set,f=[];for(const s of P(h).rows){if(!s.fold){s.bucket==="Design"&&f.push(s.name);continue}const a=e.get(s.fold.key)??[];a.push(s.name),e.set(s.fold.key,a),s.bucket==="Design"&&n.add(s.fold.key)}return{bandRows:e,designBands:n,looseRows:new Map([["",f]])}},[h]),k=pe({},v),M={key:O,rows:Array.from({length:k?r:0},()=>({shown:!0,labelled:!0}))};V(()=>{const e=A.current?.parentElement;if(!e)return;const n=X(e,Z),f=new Set(ke(n)),s=Ee([M,...n.filter(a=>ee.has(a.key))],X(e,te)[0].rows);s&&f.add(s),Q(a=>De(a,f)?a:f)});const ne=g(()=>Fe(h,T),[h,T]),se=!Te(M)&&!T.has(O)?{key:O,title:_e}:void 0,K=q(e=>e.selectedItem)!==null,N=t?.part??p??"",E=`${m}:${N}:${String(v)}`,[oe,re]=F(()=>({tab:I.get(E)})),$=`${m}:${N}`,D=W(null),_={...B,node:l},L=P(h,{values:l,context:_}).buckets,u=be({allTabs:K,remembered:I.get(E),inherited:D.current?.panel===$?D.current.tab:oe.tab,buckets:L,hasText:k&&r>0}),le=!k&&!L.includes(u)&&(P(U(j,l,{...B,device:"desktop"}),{values:l,context:{..._,device:"desktop"}}).buckets.includes(u)||u==="Design"&&r>0);V(()=>{D.current={panel:$,tab:u}});const ae=u==="Design";return c(Y.Provider,{value:b??null,children:c(he.Provider,{value:t?l:null,children:de(me,{fields:ne,values:l,onChange:G,readOnly:x,allTabs:K,showWhenContext:_,tab:u,onTab:e=>{I.set(E,e),re({tab:e})},tabIcons:Pe,idPrefix:m,ariaLabel:ye("Section settings"),lead:ae?o:null,leadFold:se,closedFolds:z,onFold:(e,n)=>{n?y.delete(e):y.add(e),J(new Set(y))},children:[c("span",{ref:A,hidden:!0}),le&&c(xe,{})]})})})}export{Ge as SiteFields,Pe as TAB_ICONS};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use client";import{jsx as e}from"react/jsx-runtime";import{useState as
|
|
1
|
+
"use client";import{jsx as e}from"react/jsx-runtime";import{useState as d}from"react";import{Banner as p,Button as h}from"efficient-shell/ui";import{UndoIcon as y}from"efficient-shell/icons/efficient";import{useScreenDocument as v}from"efficient-easel/screen/components/ScreenDocumentContext";import{say as n}from"../../format/lib/editor-words.js";import{clearRestoreNote as S,undoSiteRestore as b,useRestoreNote as g}from"../lib/site-versions.js";import{useSettledAction as N}from"efficient-easel/easel";function C(){const t=g(),{adapter:l,flushSave:u,reloadFromServer:f}=v(),o=l.siteVersions,[r,i]=d(!1),[a,c]=d(!1),m=async()=>{if(!(!o||r)){i(!0),c(!1);try{await b({access:o,flushSave:u,reload:f})}catch{c(!0)}finally{i(!1)}}},s=N({onPress:()=>{m()},busy:r});return t?e("aside",{className:"sf-canvas-notice",children:e(p,{tone:a?"danger":"info",title:t.title,onDismiss:S,action:o&&t.undo?e(h,{variant:"secondary",size:"sm",leftIcon:e(y,{}),loading:s.busy,disabled:s.busy,onClick:s.onPress,children:n("Undo")}):void 0,children:a?n("Undo did not work. Nothing changed. Try again."):n("Check it with Preview. Press Publish to put it live.")})}):null}export{C as SiteRestoreNotice};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use client";import{jsx as
|
|
1
|
+
"use client";import{jsx as v}from"react/jsx-runtime";import{useState as y}from"react";import{TextStylesList as O}from"efficient-easel/text-styles";import{FONT_OPTIONS as _}from"../../format/lib/fonts.js";import{usePreviewDevice as I}from"efficient-easel/draw/client";import{applyListChange as b,resolveTextStyles as w,toPanelStyles as x}from"../../render/lib/text-styles/site-text-styles.js";const C={desktop:"desktop",tablet:"tablet",mobile:"phone"},p=["font","color","size","weight","emphasis","lineSpacing","letterSpacing","paragraphSpacing","letterCase","largestSize"],k=["size","lineSpacing","letterSpacing","letterCase"],L=500,N=_.map(e=>({value:e.key,label:e.label,family:`var(${e.cssVar})`,italic:e.italicLoaded}));function A({saved:e,old:o,colours:f,sizeOf:a,onChange:S,openId:l,onOpenChange:d,readOnly:g=!1,withoutSize:m=!1}){const u=I(),[T,h]=y(null),r=w(e,o),n=C[u],c=x(r,a,n);return v(O,{styles:c,onChange:t=>S(b({saved:e,old:o,cur:c,next:t,sizeOf:a,panelView:n})),fonts:N,colours:f,settings:m?p.filter(t=>t!=="size"):p,auto:k,openId:l===void 0?T:l,onOpenChange:d??h,readOnly:g,device:n,fallback:t=>{const i=r.find(E=>E.id===(t.kind==="heading"?"heading-1":"body-1")),s={};return i?.values.font&&t.id!==i.id&&(s.font=i.values.font),t.kind==="heading"&&(s.weight=L),s}})}export{N as SITE_FONTS,A as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use client";import{jsx as t,jsxs as
|
|
1
|
+
"use client";import{jsx as t,Fragment as w,jsxs as k}from"react/jsx-runtime";import{useId as E,useMemo as S}from"react";import{useEasel as _}from"efficient-easel/easel";import{SettingsField as g,SettingsSwitch as x}from"efficient-easel/panel";import{EyeIcon as b}from"efficient-easel/icons";import{fieldShownInView as y}from"efficient-easel/fields";import{usePreviewDevice as R}from"efficient-easel/draw/client";import{DEFAULT_TICKER_ITEMS as O}from"../../format/lib/hero-ticker.js";import{TextListField as C,TICKER_ITEMS_ROW as a}from"../lib/document/controls.js";import{say as p}from"../../format/lib/editor-words.js";import{SiteFields as F}from"./SiteFields.js";import{usePartMotion as A}from"./usePartMotion.js";import{TICKER_MOTION_PART as L}from"../../format/lib/hero-ticker.js";import{TICKER_PANEL_ROWS as M}from"../lib/document/part-panel-rows.js";import{SameInEveryViewNote as N}from"./SameInEveryViewNote.js";const P="root:default-zone";function j({heroId:s}){const{appState:l,dispatch:d}=_(e=>e),n=l.data.content??[],i=n.findIndex(e=>e.props.id===s),o=i>=0?n[i]:null,f=o?o.props.showTicker??!0:!0,h=S(()=>{const e=o?.props.tickerItems;return Array.isArray(e)?e:O.map(I=>({text:I}))},[o]),m=E(),u=R(),r=e=>y(M[e],u),T=A(s,L,"block");if(!o)return t("p",{className:"sf-note",children:p("This ticker’s hero is no longer on the page.")});const c=e=>d({type:"replace",destinationZone:P,destinationIndex:i,data:{...o,props:{...o.props,...e}}});return t(F,{motion:T,body:k(w,{children:[!r("showTicker")&&!r("items")&&t(N,{}),r("showTicker")&&t(g,{label:p("Show ticker"),labelId:m,icon:t(b,{}),action:t(x,{checked:f,onChange:e=>c({showTicker:e}),ariaLabelledBy:m})}),r("items")&&t(C,{label:a.label,icon:a.icon,items:h,placeholder:"item",onChange:e=>c({tickerItems:e}),markup:!0})]})})}export{j as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use client";import{jsx as e,jsxs as u,Fragment as N}from"react/jsx-runtime";import{useCallback as
|
|
1
|
+
"use client";import{jsx as e,jsxs as u,Fragment as N}from"react/jsx-runtime";import{useCallback as q,useEffect as J,useId as L,useRef as Q,useState as g}from"react";import{useSettledAction as X}from"efficient-easel/easel";import{Avatar as Z,Banner as S,Button as k,ColoredBadge as z,Dialog as _,Drawer as ee,DropdownMenu as ne,FormField as H,iconButtonClasses as te,Inline as E,Input as re,ListRow as oe,Select as se,SortableList as ae,Stack as P}from"efficient-shell/ui";import{EditIcon as ie,EyeIcon as Y,MenuIcon as le,MoreIcon as ce,PageIcon as j,RevertIcon as A,StylesIcon as de}from"efficient-shell/icons/efficient";import{useScreenDocument as M}from"efficient-easel/screen/components/ScreenDocumentContext";import{say as n,sayCount as G}from"../../format/lib/editor-words.js";import{useSiteLiveState as ue}from"../lib/site-live-state.js";import{changeLine as he,closeVersionHistory as ge,HeldEditsNotSaved as pe,changesSummary as me,restoreSiteVersion as fe,useVersionHistoryOpen as ye,versionTitle as we,versionWhen as be}from"../lib/site-versions.js";const ve={page:j,menu:le};function ke(t,o){return t.pages.find(r=>r.id===o)??t.pages[0]??null}function Ce(t,o){const r=window.open("","_blank");if(r)try{r.opener=null}catch{}return t.preview(o).then(({url:a})=>{r&&!r.closed?r.location.href=a:window.open(a,"_blank","noopener,noreferrer")},a=>{throw r?.close(),a})}function Ne({version:t,page:o,waiting:r,busy:a,error:p,onCancel:b,onConfirm:y,onPage:i}){const l=L();if(!t)return null;const m=t.kind==="draft_before_restore",c=t.number,d=me(t),v=m?n("Put your drafts back?"):o?n("Restore {page} from version {n}?",{page:o.name,n:c}):n("Restore version {n}?",{n:c}),f=m?n("Your drafts go back to how they were before the restore."):o?n("{page} goes back to version {n} as a draft. Nothing else on your website changes.",{page:o.name,n:c}):d?n("The whole website goes back to version {n} as a draft: {what}.",{n:c,what:d}):n("The whole website goes back to version {n} as a draft.",{n:c}),h=t.deletedPictures??0;return e(_,{open:!0,onClose:()=>{a||b()},size:"sm",title:v,footer:u(N,{children:[e(k,{variant:"secondary",onClick:b,disabled:a,children:n("Cancel")}),e(k,{onClick:y,loading:a,disabled:a,children:n("Restore as draft")})]}),children:u(P,{gap:4,children:[o&&t.pages.length>1?e(H,{label:n("Page"),htmlFor:l,children:e(se,{id:l,value:o.id,options:t.pages.map(C=>({value:C.id,label:C.name})),onChange:i,disabled:a})}):null,e("p",{children:f}),e("p",{children:n("Your live website does not change until you press Publish.")}),h>0?e(S,{tone:"warning",children:G("{n} picture in this version was deleted from the media library. It stays empty.","{n} pictures in this version were deleted from the media library. They stay empty.",h)}):null,r?e(S,{tone:"info",title:n("Your unpublished changes are kept"),children:n("They are saved in Version history as “Draft before restore”, so you can get them back.")}):null,p?e(S,{tone:"danger",children:p}):null]})})}function Se({version:t,onCancel:o,onSave:r}){const a=L(),[p,b]=g(null),[y,i]=g(""),[l,m]=g(!1),[c,d]=g(null);if(t!==p&&(b(t),i(t?.name??""),d(null)),!t)return null;const v=y.trim()===t.name,f=async()=>{if(!(l||v)){m(!0),d(null);try{await r(y.trim())}catch{d(n("The name was not saved. Try again."))}finally{m(!1)}}};return e(_,{open:!0,onClose:()=>{l||o()},size:"sm",title:n("Name this version"),footer:u(N,{children:[e(k,{variant:"secondary",onClick:o,disabled:l,children:n("Cancel")}),e(k,{onClick:()=>{f()},loading:l,disabled:l||v,children:n("Save")})]}),children:e(H,{label:n("Name"),htmlFor:a,hint:n("Named versions are always kept. Leave it empty to take the name away."),error:c??void 0,children:e(re,{id:a,value:y,invalid:!!c,onChange:h=>i(h.target.value),onKeyDown:h=>{h.key==="Enter"&&f()}})})})}function Pe({version:t,expanded:o,onToggle:r,onPreview:a,onRestore:p,onRestorePage:b,onName:y}){const i=t.kind==="draft_before_restore",l=!t.live,m=t.changes.length,c=[...i?[]:[{key:"preview",label:n("Preview"),icon:e(Y,{}),onSelect:a}],...l?[{key:"restore",label:i?n("Put these drafts back"):n("Restore whole website"),icon:e(A,{}),onSelect:p}]:[],...l&&!i&&t.pages.length?[{key:"restore-page",label:n("Restore one page only"),icon:e(j,{}),onSelect:b}]:[],...i?[]:[{type:"divider",key:"divider"},{key:"name",label:n("Name this version"),icon:e(ie,{}),onSelect:y}]];return e(oe,{title:u("span",{className:"sf-version-title",children:[e("span",{children:we(t)}),t.live?e(z,{tone:"success",size:"xs",children:n("Live")}):null,t.name?e(z,{tone:"neutral",size:"xs",children:n("Version {n}",{n:t.number})}):null,i?e(z,{tone:"warning",size:"xs",children:n("Not published")}):null]}),expanded:o,onToggle:r,actions:e(ne,{align:"end","aria-label":n("More"),items:c,triggerClassName:te({variant:"ghost",size:"sm"}),trigger:e(ce,{})}),below:u(P,{gap:3,children:[u(E,{gap:2,align:"center",wrap:!0,className:"sf-version-meta",children:[e(Z,{name:t.createdBy,size:"xs"}),e("span",{children:t.createdBy}),e("span",{"aria-hidden":"true",children:"·"}),e("span",{children:be(t.createdAt)}),m?u(N,{children:[e("span",{"aria-hidden":"true",children:"·"}),e("span",{children:G("{n} change","{n} changes",m)})]}):null]}),o?u(P,{gap:3,children:[m?e(P,{gap:2,children:t.changes.map(d=>{const v=ve[d.kind]??de;return u(E,{gap:2,align:"center",children:[e(v,{size:16}),e("span",{children:he(d)})]},`${d.kind}:${d.id}`)})}):null,u(E,{gap:2,children:[i?null:e(k,{variant:"secondary",size:"sm",leftIcon:e(Y,{}),onClick:a,children:n("Preview")}),l?e(k,{variant:"secondary",size:"sm",leftIcon:e(A,{}),onClick:p,children:n("Restore")}):null]})]}):null]})})}function Ie({open:t,onClose:o,access:r,waiting:a}){const{flushSave:p,reloadFromServer:b,docId:y}=M(),[i,l]=g(null),[m,c]=g(!1),[d,v]=g(null),[f,h]=g(null),[C,F]=g(!1),[O,I]=g(null),[B,T]=g(null),[$,V]=g(!1),x=Q(0),R=q(()=>{const s=++x.current;c(!1),r.list().then(w=>{s===x.current&&l(w)},()=>{s===x.current&&c(!0)})},[r]);J(()=>{t&&R()},[t,R]);const K=s=>{V(!1),Ce(r,s.id).catch(()=>V(!0))},U=async()=>{if(!(!f||C)){F(!0),I(null);try{await fe({access:r,version:f.version,page:f.page,flushSave:p,reload:b}),h(null),o()}catch(s){I(s instanceof pe?n("Your last changes did not save, so nothing was restored. Try again."):n("The version was not restored. Nothing changed. Try again."))}finally{F(!1)}}},D=X({onPress:()=>{U()},busy:C});return u(N,{children:[e(ee,{open:t,onClose:o,side:"right",size:"md",title:n("Version history"),description:u(N,{children:[n("Every Publish keeps a copy of the whole website: pages, menus and site styles.")," ",n("Products, prices and forms always show as they are now.")]}),footer:e("span",{className:"sf-version-foot",children:n("The newest 30 are kept. Named versions are always kept.")}),children:u(P,{gap:3,children:[$?e(S,{tone:"danger",onDismiss:()=>V(!1),children:n("The preview did not open. Try again.")}):null,m?e(S,{tone:"danger",action:e(k,{variant:"secondary",size:"sm",onClick:R,children:n("Try again")}),children:n("Version history did not load.")}):i===null?e("p",{className:"sf-version-foot",children:n("Loading versions")}):i.length===0?e("p",{className:"sf-version-foot",children:n("No versions yet. Every Publish from now on keeps one.")}):e(ae,{"aria-label":n("Versions"),spacing:"comfortable",children:i.map(s=>e(Pe,{version:s,expanded:d===s.id,onToggle:()=>v(w=>w===s.id?null:s.id),onPreview:()=>K(s),onRestore:()=>{I(null),h({version:s,page:null})},onRestorePage:()=>{I(null),h({version:s,page:ke(s,y)})},onName:()=>T(s)},s.id))})]})}),e(Ne,{version:f?.version??null,page:f?.page??null,waiting:a,busy:D.busy===!0,error:O,onCancel:()=>h(null),onConfirm:D.onPress,onPage:s=>h(w=>w&&{...w,page:w.version.pages.find(W=>W.id===s)??w.page})}),e(Se,{version:B,onCancel:()=>T(null),onSave:async s=>{await r.name(B.id,s),T(null),R()}})]})}function Le(){const{adapter:t,hasUnsavedEdits:o}=M(),r=t.siteVersions,a=ye(),p=ue();return r?e(Ie,{open:a,onClose:ge,access:r,waiting:o||p?.state==="changed"}):null}export{Ne as RestoreVersionDialog,Le as VersionHistory,Ie as VersionHistoryDrawer};
|
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
import type { WebsitePreview } from "../../format/lib/web-backend.js";
|
|
2
2
|
type DraftLink = NonNullable<WebsitePreview["draftLink"]>;
|
|
3
3
|
type Opener = Pick<Window, "open">;
|
|
4
|
-
export declare function openDraftPreview({ pageId, liveHref, draftLink, win, }: {
|
|
4
|
+
export declare function openDraftPreview({ pageId, liveHref, draftLink, ready, win, }: {
|
|
5
5
|
pageId: string;
|
|
6
6
|
liveHref: string;
|
|
7
7
|
draftLink: DraftLink;
|
|
8
|
+
ready?: () => Promise<unknown>;
|
|
8
9
|
win?: Opener;
|
|
9
10
|
}): Promise<void>;
|
|
10
11
|
export declare function WebsitePreviewButton({ liveHref, pageId, draftLink, }: {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use client";import{jsx as
|
|
1
|
+
"use client";import{jsx as s}from"react/jsx-runtime";import{useEffect as h,useRef as p,useState as v}from"react";import{ExternalIcon as m}from"efficient-easel/icons";import{EaselIconButton as y}from"efficient-easel/chrome";import{Tooltip as P,iconButtonClasses as g}from"efficient-shell/ui";import{useSettledPress as x}from"efficient-easel/easel";import{useScreenDocument as S}from"efficient-easel/screen/components/ScreenDocumentContext";import{say as l}from"../../format/lib/editor-words.js";async function _({pageId:i,liveHref:n,draftLink:a,ready:c=async()=>!0,win:r=window}){const e=r.open("","_blank");if(e)try{e.opener=null}catch{}const o=t=>{e&&!e.closed?e.location.href=t:r.open(t,"_blank","noopener,noreferrer")};try{await c()}catch{}return a(i).then(t=>o(t.url??n),()=>o(n))}function I({liveHref:i,pageId:n,draftLink:a}){const{flushSave:c}=S(),r=p(c);r.current=c;const e=x(),[o,t]=v(!1),u=p(null);if(h(()=>()=>u.current?.(),[]),a&&n){const d=()=>new Promise((f,w)=>{u.current=()=>f(!1),e.run(()=>{u.current=null,r.current().then(f,w)})}),b=()=>{o||e.waiting||(t(!0),_({pageId:n,liveHref:i,draftLink:a,ready:d}).finally(()=>t(!1)))};return s(y,{label:l("Preview your saved draft in a new tab"),tip:l("Open your saved draft in a new tab. Visitors don't see it."),disabled:o||e.waiting,onClick:b,children:s(m,{})})}return s(P,{content:l("Preview the live site (opens in a new tab)"),side:"bottom",children:s("a",{className:g({className:"es-iconbtn"}),href:i,target:"_blank",rel:"noopener noreferrer","aria-label":l("Preview the live site in a new tab"),children:s(m,{})})})}export{I as WebsitePreviewButton,_ as openDraftPreview};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use client";import{jsx as s,Fragment as B,jsxs as k}from"react/jsx-runtime";import{useCallback as R,useEffect as g,useRef as $,useState as y}from"react";import{Button as ee,Tooltip as te}from"efficient-shell/ui";import{SettingsSwitch as oe}from"efficient-easel/panel";import{PagesIcon as re,StylesIcon as ne}from"efficient-easel/rail";import{PaletteIcon as ie}from"efficient-shell/icons/efficient";import{TemplateIcon as se}from"efficient-easel/icons";import{Subtree as ae,TreeRow as D}from"efficient-easel/tree";import{useEasel as N}from"efficient-easel/easel";import{useEaselStrings as H}from"efficient-easel/strings";import{LocationsTreeContext as ce}from"./LocationsTreeContext.js";import de from"./PagesPanel.js";import{usePreviewChat as le}from"./PreviewChatContext.js";import{PREVIEW_DEVICES as pe}from"./preview-devices.js";import{PreviewDeviceContext as me}from"efficient-easel/draw/client";import{usePreviewSocial as fe}from"../../render/components/PreviewSocialContext.js";import{usePreviewSurface as ue}from"./PreviewSurfaceContext.js";import{TICKER_PART_LABEL as Se,usePreviewTicker as Ee}from"../../render/components/PreviewTickerContext.js";import{usePreviewHeroPart as he}from"../../render/components/PreviewHeroPartContext.js";import{HERO_MEDIA_PARTS as Pe,HERO_PART_MODE as W,heroMediaRows as Te,heroPartId as M,readHeroPartId as we}from"../../render/lib/document/hero-media-parts.js";import ge,{CHAT_MODE as Ie,HEADER_MODE as be,SOCIAL_MODE as ve,WEBSITE_MODE as V,WEBSITE_PAGE_MODE as _e}from"./SectionEditor.js";import C from"./SectionIcon.js";import ke from"./SectionThumbnail.js";import{useScreenDocument as O}from"efficient-easel/screen/components/ScreenDocumentContext";import Re from"./StylesPanel.js";import{LOCATIONS_TYPE as Ce,useLocationsTree as Oe}from"./useLocationsTree.js";import{usePinnedChromeSeed as Le}from"./usePinnedChromeSeed.js";import{useHostDocumentBridge as Ae}from"./useHostDocumentBridge.js";import{usePreviewHref as Be}from"./usePreviewHref.js";import{WebsitePreviewButton as ye}from"./WebsitePreviewButton.js";import{SITE_STYLES_BASICS_TAB as De,SITE_STYLES_TABS as Ne,SITE_STYLES_TEXT_TAB as He,useWebsiteName as We}from"./WebsiteSettingsPanel.js";import{useWebsiteMainAction as Me}from"./useWebsiteMainAction.js";import{VersionHistory as Ve}from"./VersionHistoryDrawer.js";import{useEaselSession as x}from"efficient-easel/screen/lib/session-context";import{useOpenPageName as xe}from"../lib/page-rows.js";import{HERO_GROUP_TYPE as Ge,heroGroupNestDepth as Ye}from"../../format/lib/hero-group-placement.js";import{stripMarkup as Fe}from"../../format/lib/markup.js";import{categoryShortLabel as ze,PINNED_SECTION_TYPE as Ke}from"../lib/document/add-palette.js";import{canAddTo as je}from"../lib/document/add-target.js";import{cardTemplateSlotsOf as Ue}from"../../format/lib/document/card-template-layers.js";import{blockIsOffered as Ze}from"../lib/document/block-offer.js";import{sectionIdOfBoxZone as qe,setBookingPreview as Xe}from"../../render/lib/document/booking-preview.js";import{footerBlockRowName as Je}from"../../format/lib/document/footer-block-row-name.js";import{sourceRowName as Qe}from"../../format/lib/document/source-row-name.js";import{FOOTER_TYPE as $e,HEADER_TYPE as G}from"../lib/document/footer-blocks.js";import{leftViewForSelection as et,readLeftView as tt,resolveLeftView as ot,writeLeftView as rt}from"../../format/lib/document/left-view.js";import{websiteNodeIsLocked as nt}from"../lib/document/locked-blocks.js";import{everyPageNotice as it,noOwnTab as st,pinnedReach as Y,websiteDuplicateBlocked as at}from"../lib/document/every-page.js";import{sharedSectionReach as ct,WEBSITE_SHARED_SECTIONS as dt}from"../lib/shared-sections-layer.js";import{activeSharedSections as L,setSharedEditor as F}from"../../format/lib/shared-sections-active.js";import{sharedSectionsOf as lt}from"efficient-easel/screen/lib/shared-sections";import{pinnedChromeInPlace as v}from"../../format/lib/pinned-chrome-lock.js";import{scrollPreviewToSection as pt,scrollPreviewToTop as z}from"efficient-easel/screen/lib/document/preview-dom";import{SiteCanvas as mt}from"../lib/document/overrides.js";import{labelAtLevel as ft}from"../../format/lib/document/section-catalog.js";import{WEBSITE_MEDIA_DROP as ut}from"../../format/lib/document/media-drop.js";import{editorWords as St,say as p}from"../../format/lib/editor-words.js";import{SECTION_DESCRIPTIONS as Et}from"../../format/lib/document/section-descriptions.js";import{groupAccepts as ht,isSectionGroupType as Pt,sectionGroupZone as Tt,SITE_FOOTER_TYPE as K,SITE_HEADER_TYPE as wt}from"../../format/lib/document/section-groups.js";import{resolveSaveAsTemplateAction as gt,SAVE_AS_TEMPLATE_EVENT as It}from"../../format/lib/save-as-template-action.js";import{cityPalettePresets as bt}from"../lib/sections/city-presets.js";import{newSectionNode as vt}from"../lib/sections/new-section-node.js";import{useHostProducts as _t}from"../lib/use-host-products.js";import{backendOf as kt}from"../lib/website-session.js";function j({mode:e,open:t}){const{setSelectedHeroId:o,setSelectHandler:r}=Ee(),d=H().tree,l=e,n=l.kind==="ticker"?l.heroId:null,a=R(i=>{if(!i)return;t({kind:"ticker",heroId:i}),pt(i)},[t]);return g(()=>{o(n)},[n,o]),g(()=>{r(a)},[r,a]),{partRows:(i,{rowClick:f})=>{const u=String(i.props.id);return i.type==="Hero"&&s(D,{icon:s(C,{type:"ticker",size:13}),name:p(Se),onSelect:()=>a(u),selected:n===u,rowProps:{onClick:f(()=>a(u))},words:d})}}}function U({mode:e,select:t}){const{setSelectedHeroPart:o,setSelectHandler:r}=he(),d=H().tree,{appState:l}=N(m=>m),n=l.data.content??[],a=$(n);a.current=n;const i=e,f=Pe.find(m=>W[m]===i.kind),u=f&&"nodeId"in i?M(String(i.nodeId),f):null,E=R(m=>{const c=we(m);if(!c)return;const h=a.current.findIndex(T=>String(T.props.id)===c.nodeId);if(h<0)return;const P={kind:W[c.part],nodeId:c.nodeId};t({index:h},P)},[t]);return g(()=>{o(u)},[u,o]),g(()=>{r(E)},[r,E]),{partRows:(m,{rowClick:c})=>{const h=String(m.props.id),P=Te(m);if(P.length===0)return null;const T=S=>{const w=M(h,S.part);return s(D,{icon:s(C,{type:S.part==="media"?"heroMedia":"heroImage",size:13}),name:p(S.label),onSelect:()=>E(w),selected:u===w,rowProps:{onClick:c(()=>E(w))},words:d},w)},[b,...I]=P;return k(B,{children:[T(b),I.length>0&&s(ae,{children:I.map(T)})]})}}}function Z(e,t){return{partRows:(o,r)=>k(B,{children:[e.partRows?.(o,r),t.partRows?.(o,r)]})}}function Rt(e){const{adapter:t,capabilities:o,currentSlug:r,siteId:d,docId:l,hasUnsavedEdits:n,bridgeCapabilities:a,notifyParent:i,token:f}=O(),{hasPreviewLink:u}=o,E=kt(x()).preview?.draftLink,m=Me(e.data),c=gt({hasTrustedConsole:!!f,canCreatePlatformTemplate:a.canCreatePlatformTemplate,capabilities:o,siteId:d,hasUnsavedEdits:n}),h=R(()=>{!d||!r||i(It,{siteId:d,slug:r})},[i,d,r]),P=Be({pageSlug:r,siteId:d,token:f}),T=t.previewHref?.(r)??P;return{barLead:()=>c.visible&&s(te,{side:"bottom",content:c.enabled?p("Save this website as a platform template"):p(c.disabledReason),children:s("span",{className:"sf-tip-disabled",tabIndex:c.enabled?void 0:0,children:s(ee,{variant:"secondary",disabled:!c.enabled,onClick:h,rightIcon:s(se,{size:15}),children:p("Save as Template")})})}),barView:()=>u&&r&&s(ye,{liveHref:T,pageId:l??null,draftLink:E}),mainAction:m}}function Ct(e,t){const{capabilities:o,templateId:r,siteId:d,tokenRef:l,navigate:n}=O(),{hasSiteTheme:a,explainsSiteSettings:i}=o,f=S=>t.setView(S),[u,E]=y(Ne[0].id),[m,c]=y(!1),{surface:h,setSurface:P}=ue(),T=()=>{if(a){f("styles"),t.reveal(),z();return}e.show(V),e.reveal(),z()},b={id:"pages",label:p("Pages"),icon:s(re,{}),panel:({onHide:S})=>s(de,{activeSurface:h,onPreviewSurface:P,onNavigate:w=>{P(null),n(r?{kind:"template",id:r,pageSlug:w}:{kind:"page",slug:w,siteId:d??void 0})},onClose:S})},I=[];return!a&&i&&I.push({id:"appearance",label:p("Appearance"),icon:s(ie,{}),active:e.kind==="website",onSelect:T}),a&&I.push({id:"styles",label:p("Styles"),icon:s(ne,{}),panel:({onHide:S,notify:w})=>s(Re,{tokenRef:l,siteId:d??void 0,onClose:S,onNotify:w,tab:u,onTabChange:E,revealPageGroup:m,onPageGroupRevealed:()=>c(!1)})}),{railLead:[b],railTrail:I,resolveLeftView:S=>ot(S,a),openSettings:T,openStyles:()=>{E(He),f("styles")},openPageStyles:a?()=>{E(De),c(!0),f("styles"),t.reveal()}:i?()=>{e.show(_e),e.reveal()}:void 0}}function Ot(){const{navigate:e,siteId:t,reloadFromServer:o,docId:r}=O(),d=N(n=>n.config),l=x();g(()=>(F({openPage:n=>e({kind:"page",slug:n.slug,siteId:t??void 0}),reload:()=>{o()},config:d}),()=>F(null)),[e,t,o,d]),g(()=>{const n=L();if(!n||!r)return;let a=!1;return lt(l).list().then(i=>{a||n.learn(i)}).catch(()=>{}),()=>{a=!0}},[r,l])}function Lt(e,t,o,r){const{kind:d,open:l}=e,{selected:n,zoneOf:a}=t;g(()=>{Xe(n?.type==="BookingBox"&&n.props.region==="confirm"?qe(a(String(n.props.id))):null)},[n?.props.id]);const i=Oe(e,t),{capabilities:{hasSiteSettings:f}}=O();Ot();const{chat:u,setChat:E,setSelected:m,setSelectHandler:c}=le(),h=R(()=>l(Ie),[l]),P=d==="chat";g(()=>{m(P)},[P,m]),g(()=>{c(h)},[c,h]);const{setOpenHandler:T}=fe(),b=R(()=>l(ve),[l]);g(()=>{T(b)},[T,b]);const I=Z(j(e),U(e)),S=Rt(t),w=Ct(e,r),J=o.device;return{...I,...S,...w,hasOwnRows:_=>_.type===Ce,ownRows:i.renderLocationTree,sectionPressed:i.sectionPressed,wrap:_=>s(ce.Provider,{value:!0,children:k(me.Provider,{value:J,children:[_,s(Ve,{})]})}),addPanelRow:_=>f?k("div",{className:"sf-addside-sitewide",children:[s("span",{className:"sf-addside-sitewide-glyph","aria-hidden":"true",children:s(C,{type:"chat",size:16})}),k("button",{type:"button",className:"sf-addside-sitewide-name",onClick:()=>{_(),h()},children:[p("Live chat"),s("span",{className:"sf-addside-sitewide-desc",children:p("A chat bubble on every page")})]}),s(oe,{checked:u.enabled,onChange:Q=>E({enabled:Q}),ariaLabel:p("Show the chat bubble on the whole site")})]}):void 0}}let q=null,A=new WeakMap;function At(e){const t=St();if(!e||!t)return e;q!==t&&(q=t,A=new WeakMap);let o=A.get(e);return o||(o={...e,choices:e.choices?e.choices.map(r=>({...r,label:p(r.label)})):null,spec:e.spec?{...e.spec,addLabel:p(e.spec.addLabel)}:null},A.set(e,o)),o}const Bt={isLockedBlock:(e,t)=>nt(e,t)||!!(t&&L()?.heldElsewhere(t.props.id)),duplicateBlocked:at,nestDepth:(e,t,o)=>t===Ge?Ye(e,o):0,newSectionNode:vt,canAddTo:(e,t)=>At(je(e,t)),blockIsOffered:Ze,slotsOf:Ue},yt=new Proxy(Et,{get:(e,t)=>{const o=Reflect.get(e,t);return typeof o=="string"?p(o):o}}),Dt={labelAtLevel:(e,t,o)=>p(ft(e,t,o)),descriptions:yt,categoryLabel:e=>{const t=ze(e);return t===void 0?void 0:p(t)},firstSection:Ke,blockRowName:Je,rowName:Qe,plainText:Fe,Icon:C,Thumbnail:ke,useProducts:_t,presets:bt()},Nt={desktop:2e3,tablet:800,mobile:390},X="desktop",Ht={options:pe,initial:X,fluid:X,widths:Nt},Wt={read:tt,write:e=>rt(e),forSelection:(e,t)=>et(e,t)},Mt={first:G,last:$e,firstGroup:wt,lastGroup:K,isSectionGroup:Pt,sectionGroupZone:Tt,panelOf:e=>e===G?be:null,get sharedReach(){return v()?xt:void 0},get shared(){return L()?dt:void 0},get groupTab(){return v()?st:void 0},get groupBadge(){return v()?Y({type:K})??void 0:void 0},get changeNotice(){return v()?it():void 0},get band(){return v()?Vt:void 0},get groupAccepts(){return v()?ht:void 0}},Vt={foldable:!0},xt=e=>Y(e)??ct(e);function Gt(e){return{...Z(j(e),U(e)),openSettings:()=>e.show(V)}}function Yt(e,t){Le(e,t),Ae()}const er={useOwnerName:We,useDocumentLabel:xe,useBridges:Lt,useStandaloneBridges:Gt,useDocumentPass:Yt,blockRules:Bt,blockLook:Dt,devices:Ht,leftView:Wt,pinned:Mt,Canvas:mt,canvasDrag:{media:ut},Inspector:ge};export{er as WEBSITE_SCREEN};
|
|
1
|
+
"use client";import{jsx as a,Fragment as B,jsxs as k}from"react/jsx-runtime";import{useCallback as R,useEffect as g,useRef as $,useState as D}from"react";import{SettingsSwitch as ee}from"efficient-easel/panel";import{PagesIcon as te,StylesIcon as oe}from"efficient-easel/rail";import{PaletteIcon as re}from"efficient-shell/icons/efficient";import{Subtree as ne,TreeRow as y}from"efficient-easel/tree";import{useEasel as N}from"efficient-easel/easel";import{useEaselStrings as H}from"efficient-easel/strings";import{LocationsTreeContext as ie}from"./LocationsTreeContext.js";import se from"./PagesPanel.js";import{usePreviewChat as ae}from"./PreviewChatContext.js";import{PREVIEW_DEVICES as ce}from"./preview-devices.js";import{PreviewDeviceContext as de}from"efficient-easel/draw/client";import{usePreviewSocial as le}from"../../render/components/PreviewSocialContext.js";import{usePreviewSurface as pe}from"./PreviewSurfaceContext.js";import{TICKER_PART_LABEL as me,usePreviewTicker as ue}from"../../render/components/PreviewTickerContext.js";import{usePreviewHeroPart as fe}from"../../render/components/PreviewHeroPartContext.js";import{HERO_MEDIA_PARTS as Se,HERO_PART_MODE as W,heroMediaRows as Ee,heroPartId as M,readHeroPartId as Pe}from"../../render/lib/document/hero-media-parts.js";import Te,{CHAT_MODE as we,HEADER_MODE as he,SOCIAL_MODE as ge,WEBSITE_MODE as V,WEBSITE_PAGE_MODE as Ie}from"./SectionEditor.js";import C from"./SectionIcon.js";import be from"./SectionThumbnail.js";import{useScreenDocument as O}from"efficient-easel/screen/components/ScreenDocumentContext";import ve from"./StylesPanel.js";import{LOCATIONS_TYPE as _e,useLocationsTree as ke}from"./useLocationsTree.js";import{usePinnedChromeSeed as Re}from"./usePinnedChromeSeed.js";import{useHostDocumentBridge as Ce}from"./useHostDocumentBridge.js";import{usePreviewHref as Oe}from"./usePreviewHref.js";import{WebsitePreviewButton as Le}from"./WebsitePreviewButton.js";import{SITE_STYLES_BASICS_TAB as Ae,SITE_STYLES_TABS as Be,SITE_STYLES_TEXT_TAB as De,useWebsiteName as ye}from"./WebsiteSettingsPanel.js";import{useWebsiteMainAction as Ne}from"./useWebsiteMainAction.js";import{VersionHistory as He}from"./VersionHistoryDrawer.js";import{useEaselSession as x}from"efficient-easel/screen/lib/session-context";import{useOpenPageName as We}from"../lib/page-rows.js";import{HERO_GROUP_TYPE as Me,heroGroupNestDepth as Ve}from"../../format/lib/hero-group-placement.js";import{stripMarkup as xe}from"../../format/lib/markup.js";import{categoryShortLabel as Ge,PINNED_SECTION_TYPE as Ye}from"../lib/document/add-palette.js";import{canAddTo as Fe}from"../lib/document/add-target.js";import{cardTemplateSlotsOf as Ke}from"../../format/lib/document/card-template-layers.js";import{blockIsOffered as je}from"../lib/document/block-offer.js";import{sectionIdOfBoxZone as ze,setBookingPreview as Ue}from"../../render/lib/document/booking-preview.js";import{footerBlockRowName as Ze}from"../../format/lib/document/footer-block-row-name.js";import{sourceRowName as qe}from"../../format/lib/document/source-row-name.js";import{FOOTER_TYPE as Xe,HEADER_TYPE as G}from"../lib/document/footer-blocks.js";import{leftViewForSelection as Je,readLeftView as Qe,resolveLeftView as $e,writeLeftView as et}from"../../format/lib/document/left-view.js";import{websiteNodeIsLocked as tt}from"../lib/document/locked-blocks.js";import{everyPageNotice as ot,noOwnTab as rt,pinnedReach as Y,websiteDuplicateBlocked as nt}from"../lib/document/every-page.js";import{sharedSectionReach as it,WEBSITE_SHARED_SECTIONS as st}from"../lib/shared-sections-layer.js";import{activeSharedSections as L,setSharedEditor as F}from"../../format/lib/shared-sections-active.js";import{sharedSectionsOf as at}from"efficient-easel/screen/lib/shared-sections";import{pinnedChromeInPlace as v}from"../../format/lib/pinned-chrome-lock.js";import{scrollPreviewToSection as ct,scrollPreviewToTop as K}from"efficient-easel/screen/lib/document/preview-dom";import{SiteCanvas as dt}from"../lib/document/overrides.js";import{labelAtLevel as lt}from"../../format/lib/document/section-catalog.js";import{WEBSITE_MEDIA_DROP as pt}from"../../format/lib/document/media-drop.js";import{editorWords as mt,say as S}from"../../format/lib/editor-words.js";import{SECTION_DESCRIPTIONS as ut}from"../../format/lib/document/section-descriptions.js";import{groupAccepts as ft,isSectionGroupType as St,sectionGroupZone as Et,SITE_FOOTER_TYPE as j,SITE_HEADER_TYPE as Pt}from"../../format/lib/document/section-groups.js";import{SaveAsTemplateButton as Tt}from"./SaveAsTemplateButton.js";import{resolveSaveAsTemplateAction as wt,SAVE_AS_TEMPLATE_EVENT as ht}from"../../format/lib/save-as-template-action.js";import{cityPalettePresets as gt}from"../lib/sections/city-presets.js";import{newSectionNode as It}from"../lib/sections/new-section-node.js";import{useHostProducts as bt}from"../lib/use-host-products.js";import{backendOf as vt}from"../lib/website-session.js";function z({mode:e,open:t}){const{setSelectedHeroId:o,setSelectHandler:r}=ue(),c=H().tree,l=e,n=l.kind==="ticker"?l.heroId:null,s=R(i=>{if(!i)return;t({kind:"ticker",heroId:i}),ct(i)},[t]);return g(()=>{o(n)},[n,o]),g(()=>{r(s)},[r,s]),{partRows:(i,{rowClick:m})=>{const u=String(i.props.id);return i.type==="Hero"&&a(y,{icon:a(C,{type:"ticker",size:13}),name:S(me),onSelect:()=>s(u),selected:n===u,rowProps:{onClick:m(()=>s(u))},words:c})}}}function U({mode:e,select:t}){const{setSelectedHeroPart:o,setSelectHandler:r}=fe(),c=H().tree,{appState:l}=N(p=>p),n=l.data.content??[],s=$(n);s.current=n;const i=e,m=Se.find(p=>W[p]===i.kind),u=m&&"nodeId"in i?M(String(i.nodeId),m):null,E=R(p=>{const d=Pe(p);if(!d)return;const P=s.current.findIndex(w=>String(w.props.id)===d.nodeId);if(P<0)return;const T={kind:W[d.part],nodeId:d.nodeId};t({index:P},T)},[t]);return g(()=>{o(u)},[u,o]),g(()=>{r(E)},[r,E]),{partRows:(p,{rowClick:d})=>{const P=String(p.props.id),T=Ee(p);if(T.length===0)return null;const w=f=>{const h=M(P,f.part);return a(y,{icon:a(C,{type:f.part==="media"?"heroMedia":"heroImage",size:13}),name:S(f.label),onSelect:()=>E(h),selected:u===h,rowProps:{onClick:d(()=>E(h))},words:c},h)},[b,...I]=T;return k(B,{children:[w(b),I.length>0&&a(ne,{children:I.map(w)})]})}}}function Z(e,t){return{partRows:(o,r)=>k(B,{children:[e.partRows?.(o,r),t.partRows?.(o,r)]})}}function _t(e){const{adapter:t,capabilities:o,currentSlug:r,siteId:c,docId:l,hasUnsavedEdits:n,bridgeCapabilities:s,notifyParent:i,token:m}=O(),{hasPreviewLink:u}=o,E=vt(x()).preview?.draftLink,p=Ne(e.data),d=wt({hasTrustedConsole:!!m,canCreatePlatformTemplate:s.canCreatePlatformTemplate,capabilities:o,siteId:c,hasUnsavedEdits:n}),P=R(()=>{!c||!r||i(ht,{siteId:c,slug:r})},[i,c,r]),T=Oe({pageSlug:r,siteId:c,token:m}),w=t.previewHref?.(r)??T;return{barLead:()=>d.visible&&a(Tt,{enabled:d.enabled,reason:d.enabled?"":d.disabledReason,onSaved:P}),barView:()=>u&&r&&a(Le,{liveHref:w,pageId:l??null,draftLink:E}),mainAction:p}}function kt(e,t){const{capabilities:o,templateId:r,siteId:c,tokenRef:l,navigate:n}=O(),{hasSiteTheme:s,explainsSiteSettings:i}=o,m=f=>t.setView(f),[u,E]=D(Be[0].id),[p,d]=D(!1),{surface:P,setSurface:T}=pe(),w=()=>{if(s){m("styles"),t.reveal(),K();return}e.show(V),e.reveal(),K()},b={id:"pages",label:S("Pages"),icon:a(te,{}),panel:({onHide:f})=>a(se,{activeSurface:P,onPreviewSurface:T,onNavigate:h=>{T(null),n(r?{kind:"template",id:r,pageSlug:h}:{kind:"page",slug:h,siteId:c??void 0})},onClose:f})},I=[];return!s&&i&&I.push({id:"appearance",label:S("Appearance"),icon:a(re,{}),active:e.kind==="website",onSelect:w}),s&&I.push({id:"styles",label:S("Styles"),icon:a(oe,{}),panel:({onHide:f,notify:h})=>a(ve,{tokenRef:l,siteId:c??void 0,onClose:f,onNotify:h,tab:u,onTabChange:E,revealPageGroup:p,onPageGroupRevealed:()=>d(!1)})}),{railLead:[b],railTrail:I,resolveLeftView:f=>$e(f,s),openSettings:w,openStyles:()=>{E(De),m("styles")},openPageStyles:s?()=>{E(Ae),d(!0),m("styles"),t.reveal()}:i?()=>{e.show(Ie),e.reveal()}:void 0}}function Rt(){const{navigate:e,siteId:t,reloadFromServer:o,docId:r}=O(),c=N(n=>n.config),l=x();g(()=>(F({openPage:n=>e({kind:"page",slug:n.slug,siteId:t??void 0}),reload:()=>{o()},config:c}),()=>F(null)),[e,t,o,c]),g(()=>{const n=L();if(!n||!r)return;let s=!1;return at(l).list().then(i=>{s||n.learn(i)}).catch(()=>{}),()=>{s=!0}},[r,l])}function Ct(e,t,o,r){const{kind:c,open:l}=e,{selected:n,zoneOf:s}=t;g(()=>{Ue(n?.type==="BookingBox"&&n.props.region==="confirm"?ze(s(String(n.props.id))):null)},[n?.props.id]);const i=ke(e,t),{capabilities:{hasSiteSettings:m}}=O();Rt();const{chat:u,setChat:E,setSelected:p,setSelectHandler:d}=ae(),P=R(()=>l(we),[l]),T=c==="chat";g(()=>{p(T)},[T,p]),g(()=>{d(P)},[d,P]);const{setOpenHandler:w}=le(),b=R(()=>l(ge),[l]);g(()=>{w(b)},[w,b]);const I=Z(z(e),U(e)),f=_t(t),h=kt(e,r),J=o.device;return{...I,...f,...h,hasOwnRows:_=>_.type===_e,ownRows:i.renderLocationTree,sectionPressed:i.sectionPressed,wrap:_=>a(ie.Provider,{value:!0,children:k(de.Provider,{value:J,children:[_,a(He,{})]})}),addPanelRow:_=>m?k("div",{className:"sf-addside-sitewide",children:[a("span",{className:"sf-addside-sitewide-glyph","aria-hidden":"true",children:a(C,{type:"chat",size:16})}),k("button",{type:"button",className:"sf-addside-sitewide-name",onClick:()=>{_(),P()},children:[S("Live chat"),a("span",{className:"sf-addside-sitewide-desc",children:S("A chat bubble on every page")})]}),a(ee,{checked:u.enabled,onChange:Q=>E({enabled:Q}),ariaLabel:S("Show the chat bubble on the whole site")})]}):void 0}}let q=null,A=new WeakMap;function Ot(e){const t=mt();if(!e||!t)return e;q!==t&&(q=t,A=new WeakMap);let o=A.get(e);return o||(o={...e,choices:e.choices?e.choices.map(r=>({...r,label:S(r.label)})):null,spec:e.spec?{...e.spec,addLabel:S(e.spec.addLabel)}:null},A.set(e,o)),o}const Lt={isLockedBlock:(e,t)=>tt(e,t)||!!(t&&L()?.heldElsewhere(t.props.id)),duplicateBlocked:nt,nestDepth:(e,t,o)=>t===Me?Ve(e,o):0,newSectionNode:It,canAddTo:(e,t,o,r)=>Ot(Fe(e,t,r)),blockIsOffered:je,slotsOf:Ke},At=new Proxy(ut,{get:(e,t)=>{const o=Reflect.get(e,t);return typeof o=="string"?S(o):o}}),Bt={labelAtLevel:(e,t,o)=>S(lt(e,t,o)),descriptions:At,categoryLabel:e=>{const t=Ge(e);return t===void 0?void 0:S(t)},firstSection:Ye,blockRowName:Ze,rowName:qe,plainText:xe,Icon:C,Thumbnail:be,useProducts:bt,presets:gt()},Dt={desktop:2e3,tablet:800,mobile:390},X="desktop",yt={options:ce,initial:X,fluid:X,widths:Dt},Nt={read:Qe,write:e=>et(e),forSelection:(e,t)=>Je(e,t)},Ht={first:G,last:Xe,firstGroup:Pt,lastGroup:j,isSectionGroup:St,sectionGroupZone:Et,panelOf:e=>e===G?he:null,get sharedReach(){return v()?Mt:void 0},get shared(){return L()?st:void 0},get groupTab(){return v()?rt:void 0},get groupBadge(){return v()?Y({type:j})??void 0:void 0},get changeNotice(){return v()?ot():void 0},get band(){return v()?Wt:void 0},get groupAccepts(){return v()?ft:void 0}},Wt={foldable:!0},Mt=e=>Y(e)??it(e);function Vt(e){return{...Z(z(e),U(e)),openSettings:()=>e.show(V)}}function xt(e,t){Re(e,t),Ce()}const Jo={useOwnerName:ye,useDocumentLabel:We,useBridges:Ct,useStandaloneBridges:Vt,useDocumentPass:xt,blockRules:Lt,blockLook:Bt,devices:yt,leftView:Nt,pinned:Ht,Canvas:dt,canvasDrag:{media:pt},Inspector:Te};export{Jo as WEBSITE_SCREEN};
|