efficient-web-builder 49.0.0 → 50.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +28 -0
- package/dist/editor/components/EditorPagePathProvider.d.ts +4 -0
- package/dist/editor/components/EditorPagePathProvider.js +1 -0
- package/dist/editor/components/PagesPanel.js +1 -1
- package/dist/editor/components/PartSettingsPanel.js +1 -1
- package/dist/editor/components/PreviewPartAnchors.d.ts +2 -2
- package/dist/editor/components/PreviewPartAnchors.js +1 -1
- package/dist/editor/components/SectionTextPartBridge.d.ts +3 -1
- package/dist/editor/components/SectionTextPartBridge.js +1 -1
- package/dist/editor/components/SourceStatus.d.ts +3 -3
- package/dist/editor/components/SourceStatus.js +1 -1
- package/dist/editor/components/StorefrontEditor.js +1 -1
- package/dist/editor/components/WebsiteScreenParts.js +1 -1
- package/dist/editor/lib/animation/hover-fields.js +1 -1
- package/dist/editor/lib/document/add-target.js +1 -1
- package/dist/editor/lib/document/block-source-fields.d.ts +6 -0
- package/dist/editor/lib/document/block-source-fields.js +1 -1
- package/dist/editor/lib/document/blocks/general/Cards/fields.js +1 -1
- package/dist/editor/lib/document/blocks/general/ContactLocations/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/PaymentBadges/fields.js +1 -1
- package/dist/editor/lib/document/blocks/general/Text/fields.js +1 -1
- package/dist/editor/lib/document/blocks/general/index.d.ts +2 -2
- package/dist/editor/lib/document/card-display-chips.d.ts +9 -3
- package/dist/editor/lib/document/card-display-chips.js +1 -1
- package/dist/editor/lib/document/card-row-fields.js +1 -1
- package/dist/editor/lib/document/field-groups.js +1 -1
- package/dist/editor/lib/document/mirror-cards-field.d.ts +20 -0
- package/dist/editor/lib/document/mirror-cards-field.js +1 -0
- package/dist/editor/lib/document/slot-new-children.d.ts +2 -0
- package/dist/editor/lib/document/slot-new-children.js +1 -0
- package/dist/editor/lib/sections/hero-ticker-to-strip.js +1 -1
- package/dist/editor/lib/sections/new-section-node.js +1 -1
- package/dist/format/lib/content/block-sources.d.ts +11 -0
- package/dist/format/lib/content/block-sources.js +1 -1
- package/dist/format/lib/content/box-layout.d.ts +2 -0
- package/dist/format/lib/content/box-layout.js +1 -1
- package/dist/format/lib/content/card-place.d.ts +8 -0
- package/dist/format/lib/content/card-place.js +1 -0
- package/dist/format/lib/content/card-template.d.ts +16 -2
- package/dist/format/lib/content/card-template.js +1 -1
- package/dist/format/lib/content/mirror-cards.d.ts +32 -0
- package/dist/format/lib/content/mirror-cards.js +1 -0
- package/dist/format/lib/document/blocks/general/Cards/card-seed.d.ts +15 -0
- package/dist/format/lib/document/blocks/general/Cards/card-seed.js +1 -0
- package/dist/format/lib/document/blocks/general/Cards/meta.d.ts +6 -0
- package/dist/format/lib/document/blocks/general/Cards/meta.js +1 -1
- package/dist/format/lib/document/blocks/general/text-part-shapes.json +8 -0
- package/dist/format/lib/document/cards-template-on-read.d.ts +4 -0
- package/dist/format/lib/document/cards-template-on-read.js +1 -0
- package/dist/format/lib/document/editor-page-context.js +1 -1
- package/dist/format/lib/document/renamed-props.js +1 -1
- package/dist/format/lib/document/section-catalog.js +22 -2
- package/dist/format/lib/document/seed-parts.d.ts +18 -0
- package/dist/format/lib/document/seed-parts.js +1 -0
- package/dist/format/lib/editor-page-rows.d.ts +2 -0
- package/dist/format/lib/editor-page-rows.js +1 -1
- package/dist/format/lib/editor-words-catalogue.d.ts +20 -4
- package/dist/format/lib/editor-words-catalogue.js +4 -4
- package/dist/format/lib/hero-ticker.d.ts +4 -0
- package/dist/format/lib/hero-ticker.js +1 -1
- package/dist/format/lib/page-at-own-slug.d.ts +9 -0
- package/dist/format/lib/page-at-own-slug.js +1 -0
- package/dist/format/lib/popup/new-popup.js +1 -1
- package/dist/format/lib/sections/faq-text-regions.js +1 -1
- package/dist/format/lib/sections/section-text-regions.d.ts +1 -0
- package/dist/format/lib/sections/section-text-regions.js +1 -1
- package/dist/format/lib/sections/text-regions.d.ts +2 -0
- package/dist/format/lib/sections/text-regions.js +1 -1
- package/dist/render/components/CardRowContext.d.ts +1 -0
- package/dist/render/components/CardRowContext.js +1 -1
- package/dist/render/components/Cards.d.ts +4 -2
- package/dist/render/components/Cards.js +1 -1
- package/dist/render/components/FAQ.js +1 -1
- package/dist/render/components/Flex.d.ts +6 -1
- package/dist/render/components/Flex.js +1 -1
- package/dist/render/components/MirrorContext.d.ts +3 -0
- package/dist/render/components/MirrorContext.js +1 -0
- package/dist/render/components/SiteGutterFrame.d.ts +1 -0
- package/dist/render/components/SiteGutterFrame.js +1 -1
- package/dist/render/components/Text.d.ts +3 -1
- package/dist/render/components/Text.js +1 -1
- package/dist/render/components/TextRegionRun.d.ts +7 -0
- package/dist/render/components/TextRegionRun.js +1 -0
- package/dist/render/lib/content/box-shared-columns.d.ts +31 -0
- package/dist/render/lib/content/box-shared-columns.js +1 -0
- package/dist/render/lib/document/blocks/general/Cards/render.js +1 -1
- package/dist/render/lib/document/blocks/general/Flex/render.js +1 -1
- package/dist/render/lib/document/blocks/general/Text/render.js +1 -1
- package/dist/render/lib/document/blocks/general/section-head-looks.d.ts +1 -2
- package/dist/render/lib/document/blocks/general/section-head-looks.js +2 -2
- package/dist/render/lib/document/blocks/general/section-to-box-row-parts.d.ts +1 -5
- 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-locations.js +1 -1
- package/dist/render/lib/document/blocks/general/section-to-box-rows-timeline.js +2 -2
- package/dist/render/lib/document/blocks/general/section-to-box-rows.js +1 -1
- package/dist/render/lib/document/editing-bridges.d.ts +2 -0
- package/dist/render/lib/document/part-styles.d.ts +26 -0
- package/dist/render/lib/document/part-styles.js +2 -2
- package/dist/render/lib/document/passes/section-width.js +1 -1
- package/dist/render/lib/sections/section-to-box.d.ts +7 -7
- package/dist/render/lib/sections/section-to-box.js +1 -1
- package/dist/render/lib/site-runtime.d.ts +2 -0
- package/dist/render/lib/site-runtime.js +1 -1
- package/package.json +2 -2
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,33 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## 50.0.0 - 2026-11-04
|
|
4
|
+
|
|
5
|
+
From main at `7bcd4d2a`: #481, #489, #490, #491. A major because of #481: `components/Cards` loses `items` as a drawing path and its built-in card. No declared export is removed (39 added), and the peers are unchanged (`efficient-easel` `^27.0.0`, `efficient-shell` `^11.8.0`). No stored page needs a data move: a stored Cards with no card template is given one on read and saved only with a merchant's edit (1 live node, hartesmetal.com /warranty).
|
|
6
|
+
|
|
7
|
+
**BREAKING for hosts (#481):** Delivery Options, Recurring Columns (`Series`) and Document Detail Cards (`DocMetaCards`) are merged into **Cards**, one data block with one card template (`template` slot). `components/Cards` draws the head and the template copies only: a caller that passed `items` to draw fixed cards draws none. Change every outside caller of `items` in the same bump (storefront `probe-eyebrow-fill`, storefront-blocks `test-section-head-style`). Look: from 700 to 719px the cards stand in one column (was three); from 720 to 799px the card padding is 32px (was 28).
|
|
8
|
+
|
|
9
|
+
### Added
|
|
10
|
+
|
|
11
|
+
- **One Cards block with one card template** (#481). A new Cards is laid down with its template; a stored Cards with no template is given it on read (`lib/document/cards-template-on-read`, from `migrateRenamedProps`). Content rows say "<thing> content" with the first answer "Manual" (Card content, Payment content, Location content); the keys do not change. The template's Text "Shows" row offers the source's fields (`BlockSourceSpec.fields`), or the Cards' own under Manual. The template copies stand in the section's column (`InsideSiteColumn`).
|
|
12
|
+
- **A host block's card template is seeded on read** (#491). `CardTemplateSpec.seed` (optional) and `templateOnRead(type, props)` in `lib/content/card-template`; `migrateRenamedProps` calls it, so the page render, the editor load and a host's published header and footer seed every block whose entry has a seed. A host declares a block once, with `registerCardTemplates`.
|
|
13
|
+
- **A drawn block can read the current page path** (#489). Optional `pagePath` on `SiteRuntime` and the hook `useCurrentPagePath()`; the editor fills it with `components/EditorPagePathProvider`. `lib/page-at-own-slug`: `pageAnswersAtOwnSlug` (moved here from storefront-blocks) and `servedAtOwnSlug`. `lib/editor-page-rows`: `POPUP_PAGE_ROW_KIND`, `isPopupPageRow`.
|
|
14
|
+
- **The Hero strip's Add lays down the whole Scrolling Bar Box** (#490): `heroStripBox` (`lib/document/slot-new-children`) and `STRIP_ON_MEDIA` (`lib/hero-ticker`), the one strip-on-media pair. It needs easel 27.2.0 (`SlotSectionSpec.newChild`); an older easel lays down one empty Box, as before.
|
|
15
|
+
|
|
16
|
+
## 49.1.0 - 2026-11-04
|
|
17
|
+
|
|
18
|
+
From main at `83fe5162`: #471, #476, #477, #486, #488. A minor: exports are added, no export is removed, and the peers are unchanged (`efficient-easel` `^27.0.0`, `efficient-shell` `^11.8.0`). No stored page changes: Row columns (`sharedColumns`) and Mirror cards (`mirrorCards`) are new settings, and nothing seeds them; a sized text region stores under the existing `_partStyles` keys.
|
|
19
|
+
|
|
20
|
+
### Added
|
|
21
|
+
|
|
22
|
+
- **A host's data-drawn text takes a style and a size** (#471): a host registers its own text regions with `registerSectionTextRegions(tables)`, and a region with the new `sized` flag gets the Style list and the Font size cell (desktop and phone) in its part panel. Values are stored in `_partStyles["@<kind>"]` (`textStyle`, `size`, `sizePhone`); an old stored `role` draws as before. Exports: `registerSectionTextRegions`, `regionTakesSize`, `regionHasOwnLook`, `regionSheetStyle`, `regionShownDeclarations`, `regionCanvasDeclarations`, `regionCanvasRestore`, `partShownDeclarations`, `partCanvasDeclarations`, `partStyleWithoutSizeBox`, `storedPartStyle`, `ShownDeclarations`.
|
|
23
|
+
- **Mirror cards** (#476): on the card Box of a card template, every second card draws the other way round. Stored key `mirrorCards`: `"even"` mirrors cards 2, 4, 6; `"odd"` mirrors cards 1, 3, 5; absent draws the same bytes as before; Off removes the key. Exports: `MirrorCards`, `MirrorCardsBox`, `MirrorContext`, `MIRROR_CARDS_FACTS`, `MIRROR_CARDS_IDLE`, `MIRROR_CARDS_LABEL`, `MIRROR_CARDS_OFF`, `MIRROR_CARDS_OPTIONS`, `MIRROR_CARDS_TITLES`, `MIRROR_ROW_CLASS`, `mirrorCardsActs`, `mirrorCardsField`, `mirrorCardsOf`, `mirrorCardsOptions`, `mirrorCardsWrite`, `mirroredBoxClass`, `mirroredTextClasses`, `isMirroredCopy`, `useMirroredCopy`, `useUnderCardBox`, `ownsCard`, `CardCopyPlace`, `cardCopyPlace`.
|
|
24
|
+
- **A card template's row copies can share content-sized columns** (#477, decision D1 option B): Box setting **Row columns** (`sharedColumns`: `own` "Each row", the default, or `shared`) and its own phone key `sharedColumnsPhone` (`own` or `scroll` "Shared, scroll"). It shows only on a one-row Box that is the card of a card template. Exports: `SHARED_COLUMNS_KEY`, `SHARED_COLUMNS_LABEL`, `SHARED_COLUMNS_OFF`, `SHARED_COLUMNS_POINTS`, `SHARED_COLUMNS_PHONE_POINTS`, `SHARED_PLAIN_ATTR`, `sharedColumnsClasses`, `sharedColumnsCss`, `sharedColumnsDrawn`, `sharedColumnsFits`, `BOX_ALIGN_CLASS`, `useInsideSiteGutter`; `ON_A_CARD` is now exported. Known: the editor canvas draws shared columns with other widths than the published page (follow-up).
|
|
25
|
+
|
|
26
|
+
### Fixed
|
|
27
|
+
|
|
28
|
+
- **The Row columns row is drawn in the Box panel** (#488). Before, the panel dropped it, so a merchant never saw #477's setting. The same fix draws a nested Box's **Gutter** on a Full width site and a top-level Hero group's **Placement**. A guard keeps a row with a block-fact show-when rule in the panel.
|
|
29
|
+
- **The Hover heading hides with its rows in the Phone view** (#486): one `hoverHeading()` makes it a desktop heading on every card section and text part.
|
|
30
|
+
|
|
3
31
|
## 49.0.0 - 2026-11-04
|
|
4
32
|
|
|
5
33
|
From main at `7b0b29e8`: #479, #482, #484. A major because of #479: every class at a view line now uses the line's name from the host's site sheet. No export is removed, and the peers are unchanged (`efficient-easel` `^27.0.0`, `efficient-shell` `^11.8.0`). No stored page changes: the Hero strip converter (`heroTickerToStrip`) is not run by this package.
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use client";import{jsx as m}from"react/jsx-runtime";import{useMemo as s}from"react";import{useScreenDocument as a}from"efficient-easel/screen/components/ScreenDocumentContext";import{pagePath as c}from"../../format/lib/links/page-link-rules.js";import{servedAtOwnSlug as l}from"../../format/lib/page-at-own-slug.js";import{SiteRuntimeProvider as p,useSiteRuntime as d}from"../../render/lib/site-runtime.js";function x({children:n}){const{currentSlug:t,currentKind:u,data:r}=a(),e=d(),o=!!t&&!!r&&l({slug:t,kind:u,layout:r})?c(t):null,i=s(()=>({...e,pagePath:o}),[e,o]);return m(p,{runtime:i,children:n})}export{x as EditorPagePathProvider};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use client";import{jsx as t,Fragment as te,jsxs as
|
|
1
|
+
"use client";import{jsx as t,Fragment as te,jsxs as S}from"react/jsx-runtime";import{Fragment as Re,useEffect as De,useId as xe,useMemo as oe,useRef as Ne,useState as c}from"react";import{useScreenDocument as ae}from"efficient-easel/screen/components/ScreenDocumentContext";import{UiIcon as j}from"efficient-easel/draw/client";import ve from"efficient-easel/screen/components/SidePanelHead";import{useWebsiteName as Ee}from"./WebsiteSettingsPanel.js";import{InspectorIconButton as Le}from"efficient-easel/chrome";import{Button as se,Dialog as Oe,FormField as Be,Input as le,PopupMenu as Fe,PopupMenuItem as ie,toast as re}from"efficient-shell/ui";import{LayersTree as Me,TreeGroupLabel as _e,TreeRow as de,TreeRowAction as L}from"efficient-easel/tree";import{AddIcon as ze,DuplicateIcon as Ge,PageIcon as He,SettingsIcon as Ue}from"efficient-easel/icons";import{PagesIcon as Te}from"efficient-easel/rail";import{useEaselHost as We}from"efficient-easel/screen/lib/host";import{bucketEditorPageRows as je,DYNAMIC_PAGES_GROUP_KEY as qe,isDynamicPageRow as Ke,isPopupPageRow as Ye,MAIN_PAGES_GROUP as Je}from"../../format/lib/editor-page-rows.js";import{useEaselSession as ce}from"efficient-easel/screen/lib/session-context";import{holdPageRow as q,usePageRows as Qe}from"../lib/page-rows.js";import{say as n,sayCount as Ve}from"../../format/lib/editor-words.js";import{canDuplicatePage as Xe,DuplicatePageDialog as Ze,uniqueSlug as ue}from"efficient-easel/page-copy";import{backendOf as $e}from"../lib/website-session.js";import{shopRouteBase as en}from"../../format/lib/web-runtime.js";import{newPopupPage as nn}from"../../format/lib/popup/new-popup.js";const pe="sf-editor-pages-collapsed-groups";function tn(){const s=ce(),{siteId:O,templateId:k}=ae(),I=$e(s).pages;if(!(!I.duplicate||k))return(p,A)=>I.duplicate(p.id,{...A,...O?{siteId:O}:{}})}function on(){try{const s=en()||(typeof window>"u"?"":window.location.origin);return s?new URL(s).host:""}catch{return""}}function an({onNavigate:s,onClose:O,activeSurface:k,onPreviewSurface:I}){const p=ce().chrome?.pageRows,A=We(),{adapter:m,capabilities:g,ready:B,currentSlug:K}=ae(),me=Ee(),{rows:u,reload:F,setRows:Y,getRows:ge}=Qe(),[M,fe]=c(""),[r,R]=c(!1),[D,f]=c(null),[J,x]=c(!1),[h,_]=c(""),Q=xe(),z=tn(),[b,G]=c(null),[H,he]=c(()=>{if(typeof window>"u")return new Set;try{const e=window.localStorage.getItem(pe);return new Set(e?JSON.parse(e):[])}catch{return new Set}});De(()=>{try{window.localStorage.setItem(pe,JSON.stringify([...H]))}catch{}},[H]);const be=e=>he(a=>{const o=new Set(a);return o.has(e)?o.delete(e):o.add(e),o}),Pe=oe(()=>je(u??[]),[u]),U=M.trim().toLowerCase(),V=e=>!U||e.toLowerCase().includes(U),ye=e=>U?!0:!H.has(e),N=oe(()=>new Set((u??[]).map(e=>e.slug)),[u]),X=()=>{if(g.pageCreationInAdminForm){A.send("storefront-editor:new-page");return}_(""),f(null),x(!0)},Z=async()=>{const e=h.trim();if(!(!e||!B||r||!m.createPage)){R(!0),f(null);try{const a=await m.createPage({slug:ue(e,N),title:e,layout:{}});await F(),x(!1),_(""),s(a.slug)}catch{f(n("Couldn’t add the page — please retry."))}finally{R(!1)}}},v=g.hasSiteSettings&&!!m.createPage,we=async()=>{if(!(!B||r||!m.createPage)){R(!0),f(null);try{const e=await m.createPage(nn(n("New popup"),N));await F(),s(e.slug)}catch{f(n("Couldn’t add the popup — please retry."))}finally{R(!1)}}},$=Ne(null),[P,y]=c(null),Ce=()=>{if(!v)return X();if(P)return y(null);const e=$.current?.getBoundingClientRect();e&&y({top:e.bottom+6,right:Math.max(8,window.innerWidth-e.right)})},Se=e=>{const a=u??[],o=m.deletePage;if(!B||r||!o||a.length<=1)return;const i=a.findIndex(l=>l.id===e.id),d=a.filter(l=>l.id!==e.id),w=e.slug===K;q(e.id,!0),Y(d),f(null),w&&d[0]&&s(d[0].slug);const E=()=>{q(e.id,!1);const l=ge()??[];if(l.some(Ae=>Ae.id===e.id))return;const C=[...l];C.splice(Math.max(0,Math.min(i,C.length)),0,e),Y(C)};re.undoable(n("Deleted “{name}”",{name:e.label}),{actionLabel:n("Undo"),commit:async l=>{await o(e.id,l),q(e.id,!1)},undo:()=>{E(),w&&s(e.slug)},onFail:()=>{E(),re.error(n("Couldn’t delete the page — please retry."))}})},ke=e=>A.send("storefront-editor:open-page",{slug:e}),Ie=e=>{if(!V(e.label))return null;const a=!k&&e.slug===K,o=g.canDeletePagesInline&&(u??[]).length>1,i=Ke(e),d=Ye(e),w=[...i?[{label:n("Dynamic"),tone:"info"}]:[],...d?[{label:n("Lightbox"),tone:"success"}]:[],...e.draft?[{label:n("draft"),tone:"draft"}]:[]],E=w.length>0?w:void 0,l=!!z&&Xe(e),C=l||g.pageCreationInAdminForm||o?S(te,{children:[l&&t(L,{kind:"plain",label:n("Duplicate “{name}”",{name:e.label}),disabled:r,onClick:()=>G(e),children:t(Ge,{size:13})}),g.pageCreationInAdminForm&&t(L,{kind:"plain",label:n("Page settings for “{name}”",{name:e.label}),onClick:()=>ke(e.slug),children:t(Ue,{size:13})}),o&&t(L,{kind:"delete",label:n("Delete “{name}”",{name:e.label}),disabled:r,onClick:()=>Se(e),children:t(j,{name:"trash",size:13,strokeWidth:1.7,rounded:!0})})]}):void 0;return t(de,{icon:t(He,{size:14}),name:e.label,selected:a,onSelect:()=>s(e.slug),badge:E,actions:C,rowProps:{"data-page-slug":e.slug}},e.id)},T=(e,a,o)=>{const i=o.filter(Boolean);if(i.length===0)return null;const d=ye(e);return S(Re,{children:[t(_e,{count:i.length,countLabel:Ve("{n} page","{n} pages",i.length),expanded:d,onToggle:()=>be(e),children:a}),d&&i]},e)},ee=(p?.rows??[]).filter(e=>V(e.label)).map(e=>{const a=k===e.key;return t(de,{icon:e.icon,name:e.label,selected:a,onSelect:()=>I(e.key),badge:{label:n("Preview"),tone:"warning"},actions:t(L,{kind:"plain",label:n("Open the {name} in a new tab",{name:e.label}),onClick:()=>window.open(e.href,"_blank","noopener,noreferrer"),children:t(j,{name:"external-link",size:13,strokeWidth:1.7,rounded:!0})}),rowProps:{"data-shop-surface":e.key}},e.key)}),ne=g.hasSiteSettings&&!!p,W=(()=>{if(u===null)return null;const e=[];let a=!1;for(const o of Pe){ne&&!a&&o.key.startsWith("system:")&&(e.push(T("shop",p.title,ee)),a=!0);const i=o.key===qe||o.label===Je?n(o.label):o.label;e.push(T(o.key,i,o.rows.map(Ie)))}return ne&&!a&&e.push(T("shop",p.title,ee)),e})();return S("div",{className:"sf-pages",children:[t(ve,{icon:t(Te,{}),title:n("Pages"),context:me,actions:t(Le,{buttonRef:$,label:v?n("Add"):n("New page"),hasPopup:v?"menu":void 0,expanded:v?P!==null:void 0,onClick:Ce,children:t(ze,{size:15})})}),P&&t(Fe,{portal:!0,style:{top:P.top,right:P.right},onClose:()=>y(null),children:S("div",{role:"menu","aria-label":n("Add"),children:[t(ie,{role:"menuitem",onClick:()=>{y(null),X()},children:n("Page")}),t(ie,{role:"menuitem",disabled:r,onClick:()=>{y(null),we()},children:n("Popup")})]})}),t("div",{className:"sf-pages-find",children:t(le,{type:"search",leftIcon:t(j,{name:"search",size:14,rounded:!0}),placeholder:n("Search all pages…"),value:M,onChange:e=>fe(e.target.value),"aria-label":n("Search all pages")})}),D&&!J&&t("div",{className:"sf-note sf-note--error",role:"alert",children:D}),W===null?t("div",{className:"sf-note",children:n("Loading…")}):W.some(Boolean)?t(Me,{ariaLabel:n("Pages"),className:"sf-scroll",children:W}):t("div",{className:"sf-note",children:M.trim()?n("No pages match your search"):n("No pages yet. Add one with + above.")}),z&&b&&t(Ze,{source:{title:b.label,slug:b.slug},taken:N,host:on(),duplicate:e=>z(b,e),onClose:()=>G(null),onDuplicated:e=>{G(null),F(),s(e.slug)}},b.id),t(Oe,{open:J,onClose:()=>x(!1),size:"sm",title:n("Add a page"),description:n("Give the new template page a name. It starts blank — add sections once it opens."),footer:S(te,{children:[t(se,{variant:"secondary",onClick:()=>x(!1),children:n("Cancel")}),t(se,{onClick:()=>{Z()},disabled:r||!h.trim(),loading:r,children:n("Add page")})]}),children:t(Be,{label:n("Page name"),htmlFor:Q,hint:h.trim()?n("URL: /{slug}",{slug:ue(h,N)}):void 0,error:D??void 0,children:t(le,{id:Q,value:h,invalid:!!D,onChange:e=>_(e.target.value),onKeyDown:e=>{e.key==="Enter"&&Z()},placeholder:n("e.g. About")})})})]})}export{an as default};
|
|
@@ -1 +1 @@
|
|
|
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};
|
|
1
|
+
"use client";import{jsx as n,Fragment as H,jsxs as y}from"react/jsx-runtime";import{useContext as bt,useEffect as pe,useRef as Pt,useState as Le}from"react";import{FieldSelect as wt,InspectorField as vt,fieldShownInView as Tt}from"efficient-easel/fields";import{SettingsField as Nt}from"efficient-easel/panel";import{InspectorUpLevel as Y}from"efficient-easel/chrome";import{StylesIcon as kt,TypeIcon as Ot}from"efficient-easel/icons";import{useEasel as Ct}from"efficient-easel/easel";import{TextPartPanel as Be}from"efficient-easel/copy";import{Button as Rt,IconButton as Et,Tooltip as It}from"efficient-shell/ui";import{PartTextBox as zt,partTextCells as Ue}from"./PartTextBox.js";import{SiteFields as me}from"./SiteFields.js";import{usePartMotion as Ft}from"./usePartMotion.js";import{UiIcon as We}from"efficient-easel/draw/client";import{usePreviewHeader as _t}from"../../render/components/PreviewHeaderContext.js";import{UpdateStyleDialog as Vt}from"./UpdateStyleDialog.js";import{ScreenDocumentContext as At}from"efficient-easel/screen/components/ScreenDocumentContext";import{hasStyleChange as Lt,partStyleToTextStyleValues as Bt,pushIntoStyle as Ut,resolveTextStyles as He,styleIdOfRole as Wt}from"../../render/lib/text-styles/site-text-styles.js";import{useSiteTextStylesWriter as Ht}from"../lib/site-text-styles-writer.js";import{useThemeRowPersist as jt}from"../lib/theme-row-persist.js";import{usePreviewDevice as Dt}from"efficient-easel/draw/client";import{shownTier as q}from"efficient-easel/screen/lib/document/device-fields";import{PART_PANEL_ROWS as je}from"../lib/document/part-panel-rows.js";import{usePartStyle as Gt}from"./PreviewPartStyleContext.js";import{say as l}from"../../format/lib/editor-words.js";import{readHidable as J,textFieldOffPage as Kt,textFieldPanelOnly as Mt}from"../lib/document/controls.js";import{TEXT_FIELD_MARKER as $t}from"efficient-easel/draw";import{useSectionOps as Xt}from"efficient-easel/screen/lib/document/use-section-ops";import{FONT_OPTIONS as Yt,FONT_ROLES as qt,FONT_ROLE_LABELS as De,fontOption as he,fontRoleOf as Jt}from"../../format/lib/fonts.js";import{isMultilineKind as Qt,partPlaceholder as Zt,typeInPlaceKind as en}from"../../render/lib/document/part-text.js";import{partRowField as tn}from"../lib/document/part-row-field.js";import{decodePartKey as nn,partPropsWithRowValue as on,partRowValue as ln}from"../../render/lib/document/part-rows.js";import{followedStyleOf as Ge,propsWithPartStyleValue as U,propsWithoutPartStyle as sn,readPartStyle as ye,regionHasOwnLook as rn}from"../../render/lib/document/part-styles.js";import{partThemeColors as an}from"../../format/lib/document/part-inks.js";import{styleKeyForPart as Ke}from"../../format/lib/sections/section-text-kinds.js";import{commitPartText as cn}from"../lib/document/part-typing.js";import{keysOnCanvas as dn,useCanvasTypingPart as un}from"../lib/document/canvas-typing.js";import{useEaselHost as fn}from"efficient-easel/screen/lib/host";import{SOURCE_LINES as pn,SOURCE_ACTIONS as mn,SOURCE_ACTION_LABEL as hn,partSourceNoteFor as yn,partSourceOf as gn,sourceMenuIdOf as Sn,sourceSlugOf as ge}from"../../format/lib/document/source-bound-parts.js";import{encodePartId as xn,holdsAuthoredText as bn}from"../../render/lib/document/text-parts.js";import{regionsForSection as Pn}from"../../format/lib/sections/section-text-regions.js";import{regionTakesSize as wn,textRegionOfPartKey as vn}from"../../format/lib/sections/text-regions.js";import{SameInEveryViewNote as Me}from"./SameInEveryViewNote.js";function Se(t){return t?l(t):null}function $e(t){return t.kind==="role"?De[t.role]:t.kind==="custom"?"Custom":null}function Tn(t){const o=Jt(t.role);return o?{kind:"role",role:o}:null}function Nn(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 Q(t,o,r,i){return Tn(ye(t,o))??Nn(r,i)}function kn(t,o){if(!t.length)return null;const r=o(t[0]);return t.every(i=>o(i)===r)?r:null}function Xe(t){return[{value:j,label:l("No style"),description:l("Section’s own")},...t.map(o=>({value:o.id,label:o.name,description:o.values.font?he(o.values.font)?.label:void 0}))]}const j="";function On({face:t,base:o,onPick:r}){const i=t.kind==="role"?t.role:j,c=[{label:l("No style"),value:j},...qt.map(s=>({label:l(De[s]),value:s}))];return n(wt,{ariaLabel:l("Style"),value:i,options:c,inline:!0,onChange:s=>r(s===j?null:s),renderOption:s=>s.value===j?y(H,{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(${he(o.fontKey)?.cssVar})`:void 0,fontWeight:o?.weight},children:Se($e(t))}),valueText:s=>Se($e(t))??s?.label??""})}const Ye=["regionNote","regionStyle"],Cn=Object.keys(je).filter(t=>!Ye.includes(t));function qe(t,o){return!t.some(o)}function Rn({sectionName:t,onBack:o,textEditor:r,styleRow:i,children:c,tabs:s}){const E=y(H,{children:[r,i,c]});return y("div",{className:"sf-part-panel",children:[n(Y,{inline:!0,name:l(t),onSelect:o}),s?s(E):E]})}function Je({source:t,slug:o,menuId:r}){const i=fn(),c=mn[t],s=!c.needsSlug||!!o;return n("div",{className:"sf-note sf-note--source",children:y("p",{className:"es-field-hint sf-hint-keep",children:[l(pn[t]),s?y(H,{children:[" ",n(Rt,{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(hn)})]}):null]})})}const Qe=4,En=120;function Ze(t){return 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()})}function et({region:t,sizePx:o,face:r,base:i,onFollowStyle:c,source:s,slug:E,onBack:N,shows:x,sizedStyle:b,ownLook:I}){const D=t.follows;return y("div",{className:"sf-note",children:[n("p",{children:n("strong",{children:l(t.label)})}),x("regionNote")&&!I&&n("p",{children:o?l("Its size follows Styles ▸ {follows} — {px}px right now.",{follows:l(D),px:Math.round(o)}):l("Its size follows Styles ▸ {follows}.",{follows:l(D)})}),b?y(H,{children:[b,x("regionStyle")&&n("p",{className:"es-field-hint sf-hint-keep",children:Ze(t)})]}):c?x("regionStyle")?n(H,{children:n(Nt,{label:l("Style"),icon:n(kt,{}),hint:Ze(t),children:n(On,{face:r,base:i,onPick:c})})}):null:x("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&&x("sourceNote")?n(Je,{source:s,slug:E}):null,qe([...Ye,"sourceNote",...b?["fontSize"]:[]],z=>x(z)&&(z!=="sourceNote"||!!s))&&n(Me,{}),n(Y,{inline:!0,name:l("Page"),onSelect:N})]})}function In({onBack:t}){return y("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(Y,{inline:!0,name:l("Page"),onSelect:t})]})}function zn({onBack:t,partId:o,why:r}){return y("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:y("code",{children:[o," — ",r]})}),n(Y,{inline:!0,name:l("Page"),onSelect:t})]})}function Fn({nodeId:t,propKey:o,onBack:r,onEditStyle:i}){const{getItemById:c,getSelectorForId:s,config:E}=Ct(e=>e),N=Xt(),x=un(),{partStyle:b}=Gt(),{fonts:I,textStyles:D}=_t(),z=bt(At),xe=!z?.capabilities?.hasSiteTheme,{persist:nt}=jt({themeFromDocument:xe,tokenRef:z?.tokenRef,siteId:z?.siteId??null}),k=Ht({themeFromDocument:xe,persist:nt}),[ot,Z]=Le(!1),W=Dt(),f=e=>q(W)!=="tablet"&&Tt(je[e],W),be=Pt(null),d=c(t),p=s(t),Pe=d?E.components[d.type]:void 0,{key:P,row:w}=nn(o),we=Pe?.fields?.[P],g=w?tn(we,w):we,F=xn(t,o),u=d?.props??{},v=en(g),ve=Kt(g),Te=bn(g),Ne=d?gn(d.type):null,ee=d?yn(d.type,P):null,te=w?ln(u[P],w):u[P],ke=!!w&&!(Array.isArray(u[P])&&w.index<u[P].length);pe(()=>{if(dn(document))return;be.current?.querySelector(".es-copy [contenteditable='true'], .es-copy textarea, .sf-copybox textarea, .sf-copybox input")?.focus()},[F]);const[ne,Oe]=Le(0);pe(()=>Oe(0),[F]);const oe=!!d&&!ke&&(!p||!g);pe(()=>{if(!oe||ne>=Qe)return;const e=setTimeout(()=>Oe(a=>a+1),En);return()=>clearTimeout(e)},[oe,ne]);const lt=oe&&ne<Qe,le=Ft(t,Ke(d?.type,o),"textPart");if(!d||ke)return n(In,{onBack:r});const G=Pn(d.type),Ce=G?vn(G,o):null;if(G&&Ce){const e=b?.partId===F?b:null,a=G[Ce],h=a.writable===!0&&!!p,T=C=>{p&&N.replaceComponent(p.zone,p.index,{...d,props:U(u,o,"role",C)})};if(h&&wn(a)){const C=ye(u,o),Ae=R=>{if(!p)return;let fe=u;for(const[St,xt]of Object.entries(R))fe=U(fe,o,St,xt??null);N.replaceComponent(p.zone,p.index,{...d,props:fe})},ht=He(k.saved,k.old),yt=Ge(C)??"",gt=Ue(C,e?.base??tt,Ae,q(W)).filter(R=>R.key==="fontSize"&&f(R.key));return n(me,{motion:le,body:n(et,{region:a,sizePx:e?.base.sizePx??null,face:Q(u,o,e,I),base:e?.base??null,source:Ne,slug:ge(u),onBack:r,shows:f,ownLook:rn(C),sizedStyle:n(Be,{style:f("style")?{value:yt,options:Xe(ht),onChange:R=>Ae(R?{textStyle:R}:{textStyle:null,role:null}),onEditStyles:i}:void 0,cells:gt})})})}return n(me,{motion:le,body:n(et,{region:a,sizePx:e?.base.sizePx??null,face:Q(u,o,e,I),base:e?.base??null,onFollowStyle:h?T:void 0,source:Ne,slug:ge(u),onBack:r,shows:f})})}if(!p||!g)return lt?n("div",{className:"sf-note","aria-busy":"true"}):n(zn,{onBack:r,partId:F,why:p?"no field":"no selector"});const Re=e=>{N.replaceComponent(p.zone,p.index,{...d,props:e})},se=e=>{if(J(e).hidden!==J(te).hidden||!v){const h=w?on(u,P,w,e):{...u,[P]:e};h&&Re(h);return}cn({node:d,propKey:o,kind:v,zone:p.zone,index:p.index},J(e).text,N.replaceComponent)},st=te,_=b?.partId===F?b:null,V=_?.styleOwner,K=V?c(V.owner):null,re=V&&K?s(V.owner):null,ie=!!(V&&K&&re),A=ie?K.props??{}:u,ae=ie?e=>N.replaceComponent(re.zone,re.index,{...K,props:e}):Re,M=ie?V.kind:Ke(d?.type,o),S=ye(A,M),m=[{partKey:M,face:Q(A,M,_,I),sizeGroup:_?.sizeGroup??null,base:_?.base??tt,style:S}],Ee=kn(m,e=>e.sizeGroup),rt=an(_?.inks),L=(e,a)=>{let h=A;for(const T of m)h=U(h,T.partKey,e,a);ae(h)},it=e=>e?L("textStyle",e):ce({textStyle:null,role:null}),ce=e=>{let a=A;for(const h of m)for(const[T,C]of Object.entries(e))a=U(a,h.partKey,T,C??null);ae(a)},de=v==="text"||v==="textarea",{text:Ie,hidden:B}=J(te),$=g?.[$t]?.label??o,ze=B?l("Show {label} on the slide",{label:l($)}):l("Hide {label} on the slide",{label:l($)}),Fe=y("div",{className:"sf-field-head",children:[n(Ot,{}),n("span",{className:"sf-field-label sf-field-label--inline",children:l($)}),de&&n(It,{content:ze,children:n(Et,{"aria-pressed":B,"aria-label":ze,onClick:()=>se({text:Ie,hidden:!B}),children:B?n(We,{name:"eye-off",size:14}):n(We,{name:"eye",size:14})})})]}),X=!ve&&Te,at=!!v&&(Mt(g)||ve||B||!Te),_e=Q(A,M,_,I),ct=_e.kind==="role"?_e.role:null,ue=Ge(S)??Wt(ct),Ve=He(k.saved,k.old),dt=Object.entries(S).filter(([e,a])=>e!=="role"&&e!=="textStyle"&&a!==void 0).length,ut=()=>{let e=A;for(const a of m){const{role:h,textStyle:T}=a.style;e=sn(e,a.partKey),h&&(e=U(e,a.partKey,"role",h)),T&&(e=U(e,a.partKey,"textStyle",T))}ae(e)},O=ue,ft=Lt(m[0].style),pt=O?Ve.find(e=>e.id===O)?.name??O:"",mt=()=>{Z(!1),O&&(k.write(Ut({saved:k.saved,old:k.old,styleId:O,values:Bt(m[0].style)}),!0),ut())};return y(Rn,{sectionName:Pe?.label??d.type,onBack:r,tabs:e=>n(me,{motion:le,body:e}),textEditor:f("words")?n("div",{ref:be,className:"sf-part-text",children:at?n(zt,{text:Ie,onTextChange:e=>se(de?{text:e,hidden:B}:e),multiline:Qt(v),markup:v!=="plainText",styled:!1,style:m[0].style,base:m[0].base,setValue:ce,colors:rt,placeholder:Se(Zt(g))??void 0,ariaLabel:l($),head:Fe,typedOnCanvas:x===F}):v?de?Fe:null:n(vt,{field:g,name:o,value:st,onChange:se,id:`sf-part-${t}-${o}`})}):void 0,children:[ee&&f("sourceNote")&&n(Je,{source:ee,slug:ge(u),menuId:Sn(u)}),X&&n(Be,{style:f("style")?{value:ue??"",options:Xe(Ve),onChange:e=>it(e||null),changed:dt>0,onEditStyles:i,onUpdateStyle:O&&ft?()=>Z(!0):void 0}:void 0,font:f("font")?{value:S.font??"",styleValue:he(m[0].base.fontKey)?.label,options:Yt.map(e=>({label:e.label,value:e.key})),onChange:e=>L("font",e||null)}:void 0,italic:f("italic")?{value:S.italic,styleValue:_n(D,ue),onChange:e=>L("italic",e??null)}:void 0,cells:Ue(m[0].style,m[0].base,ce,q(W)).filter(e=>f(e.key)),align:f("align")?q(W)==="mobile"?{value:S.alignPhone??"",styleValue:S.align??m[0].base.align,onChange:e=>L("alignPhone",e||null)}:{value:S.align??"",styleValue:m[0].base.align,onChange:e=>L("align",e||null)}:void 0,letterCase:f("letterCase")?{value:S.case??"",styleValue:m[0].base.case,onChange:e=>L("case",e||null)}:void 0}),ot&&O&&n(Vt,{styleName:pt,onCancel:()=>Z(!1),onConfirm:mt}),X&&Ee===null&&f("fixedSizeHint")&&n("p",{className:"es-field-hint sf-hint-keep",children:l("Fixed size — the site’s Text setting doesn’t resize this.")}),qe(Cn,e=>f(e)&&(e==="words"||(e==="sourceNote"?!!ee:e==="fixedSizeHint"?X&&Ee===null:X)))&&n(Me,{})]})}function _n(t,o){return!o||!Array.isArray(t)?!1:t.find(i=>i?.id===o)?.values?.italic===!0}const tt={fontKey:"",sizePx:16,weight:400,lineRatio:1.4,letterEm:0,align:"left",case:"none",paddingPx:0};export{Rn as PartPanelBody,Je as PartSourceNote,On as PartStyleSelect,Fn as default,Q as partFace};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { type ReactNode } from "react";
|
|
2
2
|
import { type PartNeedle } from "../../render/lib/document/text-parts.js";
|
|
3
|
-
import { type PartStyleBase, type PartStyles } from "../../render/lib/document/part-styles.js";
|
|
3
|
+
import { type ShownDeclarations, 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
6
|
import { type PartMotion } from "../../render/lib/animation/part-motion.js";
|
|
@@ -8,7 +8,7 @@ export declare function styleTagsOf(element: HTMLElement): {
|
|
|
8
8
|
faceRole: FontRole;
|
|
9
9
|
sizeGroup: TypeGroup | null;
|
|
10
10
|
};
|
|
11
|
-
export declare function measureStyleBase(element: HTMLElement): PartStyleBase;
|
|
11
|
+
export declare function measureStyleBase(element: HTMLElement, shown?: ShownDeclarations): PartStyleBase;
|
|
12
12
|
export default function PreviewPartAnchors({ needles, styles, motions, type, children, }: {
|
|
13
13
|
needles: PartNeedle[];
|
|
14
14
|
styles: PartStyles;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use client";import{jsx as
|
|
1
|
+
"use client";import{jsx as Y}from"react/jsx-runtime";import{readInks as $}from"../../format/lib/document/part-inks.js";import{useEffect as j,useRef as x}from"react";import{markOverlayPortal as G}from"../../format/lib/document/overlay-portal.js";import{usePreviewParts as q}from"efficient-easel/draw/client";import{usePartStyle as U}from"./PreviewPartStyleContext.js";import{usePreviewDevice as V}from"efficient-easel/draw/client";import{decodePartId as I,encodePartId as Q}from"efficient-easel/draw";import{BLOCK_ATTRIBUTE as X}from"efficient-easel/canvas";import{engagePartAnchors as Z}from"../lib/document/part-anchors.js";import{PART_ATTR as P,PART_STYLE_KIND_ATTR as b,PART_STYLE_OWNER_ATTR as tt,partStyleOwnerOf as g}from"../../render/lib/document/text-parts.js";import{PART_STYLE_PROPERTIES as D,applyPartStyles as C,blockDrawsTextStyle as F,partFontKeyOf as et,partShownDeclarations as rt,partStyleBase as ot,partStyleSource as nt,storedPartStyle as st}from"../../render/lib/document/part-styles.js";import{fontRoleOfClassName as it,styleRoleOfClassName as lt}from"../../format/lib/fonts.js";import{typeScaleGroupOfClassName as k}from"../../format/lib/theme.js";import{styleKeyForPart as A}from"../../format/lib/sections/section-text-kinds.js";import{NO_MOTIONS as at,PART_HOST_ATTR as ct}from"../../render/lib/animation/part-motion.js";import{paintPartMotion as pt}from"../lib/document/part-motion-canvas.js";function ft(p){let s=null,o=null;for(let e=p;e&&(s===null||o===null);e=e.parentElement){const r=e.getAttribute("class");s??=lt(r),o??=k(r)}return{faceRole:s??"body",sizeGroup:o}}function z(p,s={}){const o=p.style,e={};for(const n of D)e[n]=o[n]??"",o[n]="";s.fontFamily&&(o.fontFamily=s.fontFamily),s.fontSize&&(o.fontSize=s.fontSize);const r=getComputedStyle(p),S=getComputedStyle(p.ownerDocument.documentElement),a=ot({fontSize:r.fontSize,fontWeight:r.fontWeight,lineHeight:r.lineHeight,letterSpacing:r.letterSpacing,textAlign:r.textAlign,textTransform:r.textTransform,paddingTop:r.paddingTop},et(r.fontFamily,n=>S.getPropertyValue(n)));for(const n of D)o[n]=e[n];return a}function ut({needles:p,styles:s,motions:o=at,type:e,children:r}){const S=x(null),{selectedPartId:a}=q(),{setPartStyle:n}=U(),y=V()==="mobile",h=JSON.stringify(p),R=JSON.stringify(s),w=JSON.stringify(o),J=x(new Map);return j(()=>{const d=S.current;if(!d)return;const E=[],_=()=>d.parentElement,M=c=>{const i=_();if(!i)return null;const u=new MutationObserver(c);return u.observe(i,{attributes:!0,attributeFilter:[X]}),()=>u.disconnect()},L=c=>{const i=new MutationObserver(c);return i.observe(d,{childList:!0,subtree:!0,characterData:!0}),()=>i.disconnect()};let f=[];E.push(()=>{for(const c of f)c();f=[]});const W=JSON.parse(h),T=JSON.parse(R),B=JSON.parse(w),H=Z(d,W,_,M,(c,i,u)=>{for(const t of f)t();f=[];const K=[];for(const t of u){const l=t,m=G(l);m&&f.push(m),l.getAttribute(P)===a&&K.push(l)}const N=nt(i,a,K,t=>it(t)!==null||k(t)!==null);if(N&&a){const t=N,l=I(a)?.propKey??"",m=g(t)?{}:rt(st(T,A(e,l)),y,{blockDrawsStyle:F(e,l)});n({partId:a,...ft(t),base:z(t,m),inks:$(t),...(()=>{const v=g(t);return v?{styleOwner:v}:{}})()})}C(u.filter(t=>!g(t)).map(t=>({element:t,partId:t.getAttribute(P)??""})),T,t=>z(t),t=>A(e,t),void 0,y,t=>F(e,t));const O=[...d.querySelectorAll(`[${tt}="${CSS.escape(i)}"][${b}]`)];O.length&&C(O.map(t=>({element:t,partId:Q(i,t.getAttribute(b)??"")})),T,void 0,t=>t,void 0,y),f.push(pt([...u.filter(t=>!g(t)).map(t=>{const l=t,m=I(l.getAttribute(P)??"")?.propKey??"";return{element:l,partKey:A(e,m)}}),...O.map(t=>({element:t,partKey:t.getAttribute(b)??""}))],t=>B[t],y,J.current))},L);return()=>{H();for(const c of E)c()}},[h,R,w,a,n,y,e]),Y("div",{ref:S,[ct]:"",style:{display:"contents"},children:r})}export{ut as default,z as measureStyleBase,ft as styleTagsOf};
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
import { type ReactNode } from "react";
|
|
2
|
-
|
|
2
|
+
import { type PartStyles } from "../../render/lib/document/part-styles.js";
|
|
3
|
+
export default function SectionTextPartBridge({ nodeId, sectionType, partStyles, children, }: {
|
|
3
4
|
nodeId: string;
|
|
4
5
|
sectionType: string;
|
|
6
|
+
partStyles?: PartStyles;
|
|
5
7
|
children: ReactNode;
|
|
6
8
|
}): import("react").JSX.Element;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use client";import{jsx as
|
|
1
|
+
"use client";import{jsx as x}from"react/jsx-runtime";import{useEffect as E,useRef as _}from"react";import{markOverlayPortal as I}from"../../format/lib/document/overlay-portal.js";import{measureStyleBase as O,styleTagsOf as w}from"./PreviewPartAnchors.js";import{usePreviewDevice as D,usePreviewParts as K}from"efficient-easel/draw/client";import{usePartStyle as N}from"./PreviewPartStyleContext.js";import{REGION_PART_ATTR as R,encodePartId as j}from"../../render/lib/document/text-parts.js";import{TEXT_REGION_ATTR as b,textRegionOfAttr as B,textRegionPartKey as C}from"../../format/lib/sections/text-regions.js";import{regionsForSection as G}from"../../format/lib/sections/section-text-regions.js";import{TEXT_STYLE_ATTR as n,isTextStyleId as X,regionCanvasDeclarations as k,regionCanvasRestore as q,regionSheetStyle as J,regionShownDeclarations as L}from"../../render/lib/document/part-styles.js";function Y({nodeId:s,sectionType:c,partStyles:m,children:v}){const y=_(null),{selectedPartId:u}=K(),{setPartStyle:p}=N(),f=D()==="mobile",z=JSON.stringify(m??null);return E(()=>{const S=y.current,o=G(c);if(!S||!s||!o)return;const l=[],d=Array.from(S.querySelectorAll(`[${b}]`));for(const t of d){const r=B(o,t.getAttribute(b));if(!r)continue;const g=I(t);g&&l.push(g);const A=C(r),a=j(s,A);t.setAttribute(R,a);const i=m?.[A];if(o[r].sized&&J(i)){const e=k(i,f),F={fontFamily:t.style.fontFamily,fontSize:t.style.fontSize},T=t.getAttribute(n);e.fontFamily&&(t.style.fontFamily=e.fontFamily),e.fontSize&&(t.style.fontSize=e.fontSize);const h={fontFamily:e.fontFamily?t.style.fontFamily:void 0,fontSize:e.fontSize?t.style.fontSize:void 0},P=i?.textStyle;X(P)&&t.setAttribute(n,P),l.push(()=>{q(t.style,F,h),T===null?t.removeAttribute(n):t.setAttribute(n,T)})}if(a===u){const e=O(t,L(i,o[r],f));p({partId:a,...w(t),base:e})}}return()=>{for(const t of l)t();for(const t of d)t.removeAttribute(R)}},[s,c,u,p,f,z]),x("div",{ref:y,style:{display:"contents"},children:v})}export{Y as default};
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import type
|
|
1
|
+
import { type ReactNode } from "react";
|
|
2
2
|
export interface SourceStatusProps {
|
|
3
3
|
status: string;
|
|
4
|
-
statusText
|
|
5
|
-
onRefresh
|
|
4
|
+
statusText?: ReactNode;
|
|
5
|
+
onRefresh?: () => void;
|
|
6
6
|
busy?: boolean;
|
|
7
7
|
edit?: {
|
|
8
8
|
label: string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use client";import{jsx as
|
|
1
|
+
"use client";import{jsx as l,jsxs as d}from"react/jsx-runtime";import{Fragment as b}from"react";import{Button as a,Tooltip as g}from"efficient-shell/ui";import{say as f}from"../../format/lib/editor-words.js";function h({status:o,statusText:n,onRefresh:e,busy:r=!1,edit:s,hint:c,spaced:i=!0,compact:u=!1}){return u?l("div",{className:"sf-blogsource sf-blogsource--compact",style:i?{marginTop:8}:void 0,children:l(g,{content:c,children:l("p",{className:"sf-blogsource-status","data-state":o,children:[n?l(b,{children:n},"status"):null,e?l(a,{variant:"link",size:"sm",className:"sf-blogsource-link",onClick:e,disabled:r,children:f("Refresh now")},"refresh"):null,s?l(a,{variant:"link",size:"sm",className:"sf-blogsource-link",onClick:s.onClick,children:s.label},"edit"):null].filter(Boolean).flatMap((t,m)=>m?[" · ",t]:[t])})})}):d("div",{className:"sf-blogsource",style:i?{marginTop:9}:void 0,children:[l("p",{className:"sf-blogsource-status","data-state":o,children:n}),e?l(a,{variant:"secondary",className:"sf-blogsource-action",onClick:e,disabled:r,children:f("Refresh now")}):null,s?l(a,{variant:"secondary",className:"sf-blogsource-action",onClick:s.onClick,children:s.label}):null,l("p",{className:"es-field-hint sf-hint-keep",children:c})]})}export{h as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use client";import{jsx as s,jsxs as pt}from"react/jsx-runtime";import{useCallback as n,useEffect as S,useMemo as ce,useRef as f,useState as r}from"react";import"efficient-easel/easel.css";import"efficient-easel/shell.css";import"efficient-easel/rail.css";import"efficient-easel/panel.css";import"efficient-easel/fields.css";import"efficient-easel/pick.css";import"efficient-easel/copy.css";import"efficient-easel/gold.css";import"efficient-easel/text-styles.css";import"efficient-easel/menu.css";import"efficient-easel/chrome.css";import"efficient-easel/tree.css";import"efficient-easel/drag.css";import"efficient-easel/screen.css";import"./storefront-editor.css";import{buildConfig as St}from"../lib/document/build-config.js";import{ChromeWrap as ft}from"efficient-easel/screen/lib/host-chrome";import{sessionRegistry as gt}from"efficient-easel/screen/lib/session";import{refreshSiteLiveState as wt}from"../lib/site-live-state.js";import{holdSiteWrites as Ct}from"../../format/lib/site-writes.js";import{backendOf as k,blocksOf as _t}from"../lib/website-session.js";import{useEaselSession as Tt}from"efficient-easel/screen/lib/session-context";import{withSiteBlockGapFields as Et}from"../../format/lib/document/site-gap-fields.js";import{withTemplateMediaPlaceholders as Pt}from"../../format/lib/document/templateFields.js";import{setEditorPage as se}from"../../format/lib/document/editor-page-context.js";import{
|
|
1
|
+
"use client";import{jsx as s,jsxs as pt}from"react/jsx-runtime";import{useCallback as n,useEffect as S,useMemo as ce,useRef as f,useState as r}from"react";import"efficient-easel/easel.css";import"efficient-easel/shell.css";import"efficient-easel/rail.css";import"efficient-easel/panel.css";import"efficient-easel/fields.css";import"efficient-easel/pick.css";import"efficient-easel/copy.css";import"efficient-easel/gold.css";import"efficient-easel/text-styles.css";import"efficient-easel/menu.css";import"efficient-easel/chrome.css";import"efficient-easel/tree.css";import"efficient-easel/drag.css";import"efficient-easel/screen.css";import"./storefront-editor.css";import{buildConfig as St}from"../lib/document/build-config.js";import{ChromeWrap as ft}from"efficient-easel/screen/lib/host-chrome";import{sessionRegistry as gt}from"efficient-easel/screen/lib/session";import{refreshSiteLiveState as wt}from"../lib/site-live-state.js";import{holdSiteWrites as Ct}from"../../format/lib/site-writes.js";import{backendOf as k,blocksOf as _t}from"../lib/website-session.js";import{useEaselSession as Tt}from"efficient-easel/screen/lib/session-context";import{withSiteBlockGapFields as Et}from"../../format/lib/document/site-gap-fields.js";import{withTemplateMediaPlaceholders as Pt}from"../../format/lib/document/templateFields.js";import{setEditorPage as se}from"../../format/lib/document/editor-page-context.js";import{EditorPagePathProvider as yt}from"./EditorPagePathProvider.js";import{resolveSiteName as Gt}from"../../format/lib/content/site-name.js";import{normalizeSiteGutter as vt,normalizeSiteGutterPhone as kt,normalizeSiteWidth as Ht}from"../../format/lib/content/page-width.js";import{normalizeSiteBackground as de}from"../../format/lib/content/section-width.js";import{normalizeSiteBlockGap as ue}from"../../format/lib/content/container-gap.js";import Wt,{DocumentScreen as Bt}from"efficient-easel/screen/components/ScreenMount";import{useScreenDocument as Rt}from"efficient-easel/screen/components/ScreenDocumentContext";import{PreviewHeaderProvider as Ft,siteThemeRow as It,themeEdited as Dt,themeSeeded as Mt}from"../../render/components/PreviewHeaderContext.js";import{PreviewFooterProvider as bt}from"./PreviewFooterContext.js";import{PreviewChatProvider as xt,DEFAULT_CHAT_PREVIEW as Nt}from"./PreviewChatContext.js";import{PreviewSocialProvider as Ot}from"../../render/components/PreviewSocialContext.js";import{useSocialSettings as zt}from"./useSocialSettings.js";import{PreviewSurfaceProvider as At}from"./PreviewSurfaceContext.js";import{WEBSITE_ADDRESSING as Lt}from"../lib/website-document-addressing.js";import{PreviewTickerProvider as Yt}from"../../render/components/PreviewTickerContext.js";import{PreviewHeroPartProvider as Ut}from"../../render/components/PreviewHeroPartContext.js";import{PreviewPartsProvider as jt}from"efficient-easel/draw/client";import{CanvasPartsBridge as Kt}from"./CanvasPartsBridge.js";import{PreviewLocationPartProvider as Vt}from"../../render/components/PreviewLocationPartContext.js";import{PreviewPartStyleProvider as Xt}from"./PreviewPartStyleContext.js";import{CORNER_STYLE_TO_PX as Zt,DEFAULT_HEADING_COMPRESSION as qt,DEFAULT_HEADING_TYPOGRAPHY as Jt,DEFAULT_SWITCH_SHOWN as H,DEFAULT_SIZES as Qt,DEFAULT_THEME_MODE as _,normalizeCornerRadius as $t,normalizeCornerStyle as er,normalizeCardShadow as tr,normalizeCardGap as rr,normalizeHoverEffect as or,normalizeShadowColor as nr,IDENTITY_CARD_GAP as he,IDENTITY_CARD_SHADOW as ar,IDENTITY_HOVER_EFFECT as ir,THEME_MODE_KEY as le,THEME_STORAGE_KEY as cr,THEME_SWITCH_HIDE as me,THEME_SWITCH_KEY as W}from"../../format/lib/theme.js";import{DEFAULT_FONTS as sr}from"../../format/lib/fonts.js";import{WEBSITE_SCREEN as dr}from"./WebsiteScreenParts.js";import{routeWebsiteHostMessage as ur}from"../../format/lib/website-host-inbound.js";import{siteTextFromRow as hr}from"../../render/lib/text-styles/site-text-styles.js";import{wordStylesFromRow as lr}from"../../format/lib/word-styles.js";import{chatPreviewFrom as mr}from"./PreviewChatContext.js";const pr=()=>{if(typeof window>"u")return _;try{const c=window.localStorage.getItem(le);return c==="light"||c==="dark"||c==="auto"?c:_}catch{return _}},pe=c=>{if(!(typeof window>"u"))try{window.localStorage.setItem(le,c)}catch{}},Sr=()=>{if(typeof window>"u")return H;try{return window.localStorage.getItem(W)!==me}catch{return H}},fr=()=>{if(!(typeof window>"u"))try{window.localStorage.removeItem(cr)}catch{}},Se=c=>{if(!(typeof window>"u"))try{c?window.localStorage.removeItem(W):window.localStorage.setItem(W,me)}catch{}};function gr(){const{adapter:c,capabilities:d,templateId:B,ready:w,token:h,siteId:i,currentSlug:R,currentKind:F}=Rt();S(()=>(se(R,F),()=>se(null,null)),[R,F]);const T=d.placeholderFrames,[fe,I]=r(null),[ge,D]=r("");S(()=>{const e=c.templateName;if(!w||!B||!e){D("");return}let a=!1;return e().then(l=>!a&&D(l??"")).catch(()=>{}),()=>{a=!0}},[w,h,B,c]);const[we,E]=r(_),[Ce,P]=r(H),[M,b]=r({value:{selected:0,themes:[]},readFor:null}),_e=M.value,[Te,x]=r(sr),[Ee,N]=r(Qt),[Pe,O]=r(null),[ye,z]=r(qt),[Ge,A]=r(null),[ve,L]=r(null),[ke,Y]=r(he),[He,U]=r(null),[We,j]=r(null),[Be,K]=r(null),[Re,V]=r(null),[y,X]=r(null),[G,Z]=r(null),u=Tt(),q=ce(()=>St(gt(u),_t(u)),[u]),Fe=ce(()=>Et(Pt(q,T),y,G),[q,T,y,G]),[Ie,J]=r(Jt),[De,Q]=r(null),[Me,$]=r(null),[be,ee]=r(null),[xe,te]=r(null),[Ne,re]=r(null),oe=f(null),o=f(!1);S(()=>{E(pr()),P(Sr())},[]);const Oe=n(e=>{o.current=!0,fr(),pe(e),E(e)},[]),ze=n(e=>{o.current=!0,Se(e),P(e)},[]),Ae=n(e=>{o.current=!0,b(a=>Dt(a,e,i??""))},[i]),Le=n(e=>{o.current=!0,x(e)},[]),Ye=n(e=>{o.current=!0,N(e)},[]),Ue=n(e=>{o.current=!0,O(e)},[]),je=n(e=>{o.current=!0,z(e)},[]),Ke=n(e=>{o.current=!0,A(e)},[]),Ve=n(e=>{o.current=!0,L(e)},[]),Xe=n(e=>{o.current=!0,Y(e)},[]),Ze=n(e=>{o.current=!0,U(e)},[]),qe=n(e=>{o.current=!0,J(e)},[]),[Je,ne]=r(null),[Qe,$e]=r(null),et=n(e=>{o.current=!0,ne(e)},[]),tt=n(e=>{o.current=!0,j(e)},[]),rt=n(e=>{o.current=!0,K(e)},[]),ot=n(e=>{o.current=!0,V(e)},[]),nt=n(e=>{o.current=!0,X(e)},[]),at=n(e=>{o.current=!0,Z(e)},[]),it=n(e=>{o.current=!0,Q(e)},[]),ct=n(e=>{o.current=!0,$(e)},[]),st=n(e=>{o.current=!0,ee(e)},[]),dt=n(e=>{o.current=!0,te(e)},[]),ut=n(e=>{o.current=!0,re(e)},[]);S(()=>{const e=k(u).theme;if(!h||!d.hasSiteTheme||!e)return;const a=i??"";oe.current!==a&&(oe.current=a,o.current=!1);let l=!1;return e.get(i?{siteId:i}:void 0).then(t=>{if(l||o.current)return;pe(t.default_mode),Se(t.show_theme_switch),E(t.default_mode),P(t.show_theme_switch),b(Mt({selected:t.selected_preset,themes:t.theme_presets},a));const g=hr(t);x(g.fonts),N(g.sizes),O(t.corner_radius_px===void 0?Zt[er(t.corner_style)]:$t(t.corner_radius_px)),z(g.compression),A(t.card_shadow==null?ar:tr(t.card_shadow)),Y(t.card_gap==null?he:rr(t.card_gap)),U(t.hover_effect==null?ir:or(t.hover_effect)),L(nr(t.shadow_color)),j(Ht(t.site_width)),K(vt(t.site_gutter)),V(kt(t.site_gutter_phone)),X(ue(t.block_gap)),Z(ue(t.block_gap_phone)),J(g.typography),ne(g.textStyles),$e(lr(t)),Q(t.hero_background_follows_width===!0),$(de(t.section_background_width)),ee(de(t.section_content_width)),te(t.photography_grayscale===!0),re(t.share_button_on_posts===!0)}).catch(()=>{}),()=>{l=!0}},[h,i,d.hasSiteTheme,u]);const ht=zt({token:h,siteId:i,enabled:d.hasSiteSettings}),[lt,ae]=r(Nt),ie=f(null),v=f(!1),m=f(null),p=f({}),C=n(async()=>{m.current&&clearTimeout(m.current),m.current=null;const e=p.current;p.current={};try{await k(u).chat?.update(e,i?{siteId:i}:void 0),wt()}catch(a){throw p.current={...e,...p.current},a}},[u,i]);S(()=>Ct(()=>m.current||Object.keys(p.current).length>0?C():void 0),[C]);const mt=n(e=>{v.current=!0,ae(a=>({...a,...e})),!(!d.hasSiteSettings||!h)&&(p.current={...p.current,...e},m.current&&clearTimeout(m.current),m.current=setTimeout(()=>{C().catch(()=>{})},500))},[d.hasSiteSettings,h,C]);return S(()=>{if(!h||!d.hasSiteSettings)return;const e=i??"";ie.current!==e&&(ie.current=e,v.current=!1);let a=!1;const l=k(u).chat;if(l)return l.get(i?{siteId:i}:void 0).then(t=>{a||v.current||ae(mr(t))}).catch(()=>{}),()=>{a=!0}},[h,i,d.hasSiteSettings,u]),S(()=>{const e=c.site;if(!w||!d.hasSiteRecord||!e){I(null);return}let a=!1;return e().then(l=>{a||I(Gt(l.name))}).catch(()=>{}),()=>{a=!0}},[w,h,d.hasSiteRecord,i,c]),s(Bt,{config:Fe,parts:dr,wrap:(e,a)=>s(Ft,{websiteName:fe,templateChrome:T,templateName:ge||null,themeMode:we,onThemeModeChange:Oe,themeSwitchShown:Ce,onThemeSwitchShownChange:ze,theme:_e,themeRow:It(d.hasSiteTheme,M.readFor,i??""),onThemeChange:Ae,fonts:Te,onFontsChange:Le,cornerRadiusPx:Pe,onCornerRadiusPxChange:Ue,cardShadow:Ge,onCardShadowChange:Ke,shadowColor:ve,onShadowColorChange:Ve,cardGap:ke,onCardGapChange:Xe,hoverEffect:He,onHoverEffectChange:Ze,headingCompression:ye,onHeadingCompressionChange:je,headingTypography:Ie,onHeadingTypographyChange:qe,textStyles:Je,onTextStylesChange:et,wordStyles:Qe,sizes:Ee,onSizesChange:Ye,siteWidth:We,onSiteWidthChange:tt,siteGutter:Be,onSiteGutterChange:rt,siteGutterPhone:Re,onSiteGutterPhoneChange:ot,blockGap:y,onBlockGapChange:nt,blockGapPhone:G,onBlockGapPhoneChange:at,heroBackgroundFollowsWidth:De,onHeroBackgroundFollowsWidthChange:it,sectionBackgroundWidth:Me,onSectionBackgroundWidthChange:ct,sectionContentWidth:be,onSectionContentWidthChange:st,photographyGrayscale:xe,onPhotographyGrayscaleChange:dt,shareButtonOnPosts:Ne,onShareButtonOnPostsChange:ut,themeFromDocument:!d.hasSiteTheme,children:s(bt,{children:s(ft,{wrap:u.chrome?.wrap,surface:"page",children:s(Yt,{children:s(Ut,{children:s(jt,{children:s(Vt,{children:s(Kt,{children:pt(Xt,{children:[s(xt,{chat:lt,onChatChange:mt,children:s(Ot,{value:ht,children:s(At,{children:s(yt,{children:e})})})}),a]})})})})})})})})})})}function wr({target:c}){return s(Wt,{target:c,addressing:Lt,onHostMessage:ur,children:s(gr,{})})}export{wr as default};
|
|
@@ -1 +1 @@
|
|
|
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 y}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 D}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 fe}from"../../render/components/PreviewTickerContext.js";import{heroStoresLegacyTicker as ue}from"../../format/lib/hero-ticker.js";import{usePreviewHeroPart as Se}from"../../render/components/PreviewHeroPartContext.js";import{HERO_MEDIA_PARTS as Ee,HERO_PART_MODE as W,heroMediaRows as Pe,heroPartId as M,readHeroPartId as Te}from"../../render/lib/document/hero-media-parts.js";import he,{CHAT_MODE as we,HEADER_MODE as ge,SOCIAL_MODE as Ie,WEBSITE_MODE as V,WEBSITE_PAGE_MODE as be}from"./SectionEditor.js";import C from"./SectionIcon.js";import ve from"./SectionThumbnail.js";import{useScreenDocument as O}from"efficient-easel/screen/components/ScreenDocumentContext";import _e from"./StylesPanel.js";import{LOCATIONS_TYPE as ke,useLocationsTree as Re}from"./useLocationsTree.js";import{usePinnedChromeSeed as Ce}from"./usePinnedChromeSeed.js";import{useHostDocumentBridge as Oe}from"./useHostDocumentBridge.js";import{usePreviewHref as Le}from"./usePreviewHref.js";import{WebsitePreviewButton as Ae}from"./WebsitePreviewButton.js";import{SITE_STYLES_BASICS_TAB as Be,SITE_STYLES_TABS as ye,SITE_STYLES_TEXT_TAB as De,useWebsiteName as Ne}from"./WebsiteSettingsPanel.js";import{useWebsiteMainAction as He}from"./useWebsiteMainAction.js";import{VersionHistory as We}from"./VersionHistoryDrawer.js";import{useEaselSession as x}from"efficient-easel/screen/lib/session-context";import{useOpenPageName as Me}from"../lib/page-rows.js";import{HERO_GROUP_TYPE as Ve,heroGroupNestDepth as xe}from"../../format/lib/hero-group-placement.js";import{stripMarkup as Ge}from"../../format/lib/markup.js";import{categoryShortLabel as Ye,PINNED_SECTION_TYPE as Fe}from"../lib/document/add-palette.js";import{canAddTo as Ke}from"../lib/document/add-target.js";import{cardTemplateSlotsOf as je}from"../../format/lib/document/card-template-layers.js";import{blockIsOffered as ze}from"../lib/document/block-offer.js";import{sectionIdOfBoxZone as Ue,setBookingPreview as Ze}from"../../render/lib/document/booking-preview.js";import{footerBlockRowName as qe}from"../../format/lib/document/footer-block-row-name.js";import{sourceRowName as Xe}from"../../format/lib/document/source-row-name.js";import{FOOTER_TYPE as Je,HEADER_TYPE as G}from"../lib/document/footer-blocks.js";import{leftViewForSelection as Qe,readLeftView as $e,resolveLeftView as et,writeLeftView as tt}from"../../format/lib/document/left-view.js";import{websiteNodeIsLocked as ot}from"../lib/document/locked-blocks.js";import{everyPageNotice as rt,noOwnTab as nt,pinnedReach as Y,websiteDuplicateBlocked as it}from"../lib/document/every-page.js";import{sharedSectionReach as st,WEBSITE_SHARED_SECTIONS as at}from"../lib/shared-sections-layer.js";import{activeSharedSections as L,setSharedEditor as F}from"../../format/lib/shared-sections-active.js";import{sharedSectionsOf as ct}from"efficient-easel/screen/lib/shared-sections";import{pinnedChromeInPlace as v}from"../../format/lib/pinned-chrome-lock.js";import{scrollPreviewToSection as dt,scrollPreviewToTop as K}from"efficient-easel/screen/lib/document/preview-dom";import{SiteCanvas as lt}from"../lib/document/overrides.js";import{labelAtLevel as pt}from"../../format/lib/document/section-catalog.js";import{WEBSITE_MEDIA_DROP as mt}from"../../format/lib/document/media-drop.js";import{editorWords as ft,say as S}from"../../format/lib/editor-words.js";import{SECTION_DESCRIPTIONS as ut}from"../../format/lib/document/section-descriptions.js";import{groupAccepts as St,isSectionGroupType as Et,sectionGroupZone as Pt,SITE_FOOTER_TYPE as j,SITE_HEADER_TYPE as Tt}from"../../format/lib/document/section-groups.js";import{SaveAsTemplateButton as ht}from"./SaveAsTemplateButton.js";import{resolveSaveAsTemplateAction as wt,SAVE_AS_TEMPLATE_EVENT as gt}from"../../format/lib/save-as-template-action.js";import{cityPalettePresets as It}from"../lib/sections/city-presets.js";import{newSectionNode as bt}from"../lib/sections/new-section-node.js";import{useHostProducts as vt}from"../lib/use-host-products.js";import{backendOf as _t}from"../lib/website-session.js";function z({mode:e,open:t}){const{setSelectedHeroId:o,setSelectHandler:r}=fe(),c=H().tree,l=e,n=l.kind==="ticker"?l.heroId:null,s=R(i=>{if(!i)return;t({kind:"ticker",heroId:i}),dt(i)},[t]);return g(()=>{o(n)},[n,o]),g(()=>{r(s)},[r,s]),{partRows:(i,{rowClick:m})=>{const f=String(i.props.id);return i.type==="Hero"&&ue(i.props)&&a(D,{icon:a(C,{type:"ticker",size:13}),name:S(me),onSelect:()=>s(f),selected:n===f,rowProps:{onClick:m(()=>s(f))},words:c})}}}function U({mode:e,select:t}){const{setSelectedHeroPart:o,setSelectHandler:r}=Se(),c=H().tree,{appState:l}=N(p=>p),n=l.data.content??[],s=$(n);s.current=n;const i=e,m=Ee.find(p=>W[p]===i.kind),f=m&&"nodeId"in i?M(String(i.nodeId),m):null,E=R(p=>{const d=Te(p);if(!d)return;const P=s.current.findIndex(h=>String(h.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(f)},[f,o]),g(()=>{r(E)},[r,E]),{partRows:(p,{rowClick:d})=>{const P=String(p.props.id),T=Pe(p);if(T.length===0)return null;const h=u=>{const w=M(P,u.part);return a(D,{icon:a(C,{type:u.part==="media"?"heroMedia":"heroImage",size:13}),name:S(u.label),onSelect:()=>E(w),selected:f===w,rowProps:{onClick:d(()=>E(w))},words:c},w)},[b,...I]=T;return k(B,{children:[h(b),I.length>0&&a(ne,{children:I.map(h)})]})}}}function Z(e,t){return{partRows:(o,r)=>k(B,{children:[e.partRows?.(o,r),t.partRows?.(o,r)]})}}function kt(e){const{adapter:t,capabilities:o,currentSlug:r,siteId:c,docId:l,hasUnsavedEdits:n,bridgeCapabilities:s,notifyParent:i,token:m}=O(),{hasPreviewLink:f}=o,E=_t(x()).preview?.draftLink,p=He(e.data),d=wt({hasTrustedConsole:!!m,canCreatePlatformTemplate:s.canCreatePlatformTemplate,capabilities:o,siteId:c,hasUnsavedEdits:n}),P=R(()=>{!c||!r||i(gt,{siteId:c,slug:r})},[i,c,r]),T=Le({pageSlug:r,siteId:c,token:m}),h=t.previewHref?.(r)??T;return{barLead:()=>d.visible&&a(ht,{enabled:d.enabled,reason:d.enabled?"":d.disabledReason,onSaved:P}),barView:()=>f&&r&&a(Ae,{liveHref:h,pageId:l??null,draftLink:E}),mainAction:p}}function Rt(e,t){const{capabilities:o,templateId:r,siteId:c,tokenRef:l,navigate:n}=O(),{hasSiteTheme:s,explainsSiteSettings:i}=o,m=u=>t.setView(u),[f,E]=y(ye[0].id),[p,d]=y(!1),{surface:P,setSurface:T}=pe(),h=()=>{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:u})=>a(se,{activeSurface:P,onPreviewSurface:T,onNavigate:w=>{T(null),n(r?{kind:"template",id:r,pageSlug:w}:{kind:"page",slug:w,siteId:c??void 0})},onClose:u})},I=[];return!s&&i&&I.push({id:"appearance",label:S("Appearance"),icon:a(re,{}),active:e.kind==="website",onSelect:h}),s&&I.push({id:"styles",label:S("Styles"),icon:a(oe,{}),panel:({onHide:u,notify:w})=>a(_e,{tokenRef:l,siteId:c??void 0,onClose:u,onNotify:w,tab:f,onTabChange:E,revealPageGroup:p,onPageGroupRevealed:()=>d(!1)})}),{railLead:[b],railTrail:I,resolveLeftView:u=>et(u,s),openSettings:h,openStyles:()=>{E(De),m("styles")},openPageStyles:s?()=>{E(Be),d(!0),m("styles"),t.reveal()}:i?()=>{e.show(be),e.reveal()}:void 0}}function Ct(){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 ct(l).list().then(i=>{s||n.learn(i)}).catch(()=>{}),()=>{s=!0}},[r,l])}function Ot(e,t,o,r){const{kind:c,open:l}=e,{selected:n,zoneOf:s}=t;g(()=>{Ze(n?.type==="BookingBox"&&n.props.region==="confirm"?Ue(s(String(n.props.id))):null)},[n?.props.id]);const i=Re(e,t),{capabilities:{hasSiteSettings:m}}=O();Ct();const{chat:f,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:h}=le(),b=R(()=>l(Ie),[l]);g(()=>{h(b)},[h,b]);const I=Z(z(e),U(e)),u=kt(t),w=Rt(e,r),J=o.device;return{...I,...u,...w,hasOwnRows:_=>_.type===ke,ownRows:i.renderLocationTree,sectionPressed:i.sectionPressed,wrap:_=>a(ie.Provider,{value:!0,children:k(de.Provider,{value:J,children:[_,a(We,{})]})}),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:f.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 Lt(e){const t=ft();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 At={isLockedBlock:(e,t)=>ot(e,t)||!!(t&&L()?.heldElsewhere(t.props.id)),duplicateBlocked:it,nestDepth:(e,t,o)=>t===Ve?xe(e,o):0,newSectionNode:bt,canAddTo:(e,t,o,r)=>Lt(Ke(e,t,r,o)),blockIsOffered:ze,slotsOf:je},Bt=new Proxy(ut,{get:(e,t)=>{const o=Reflect.get(e,t);return typeof o=="string"?S(o):o}}),yt={labelAtLevel:(e,t,o)=>S(pt(e,t,o)),descriptions:Bt,categoryLabel:e=>{const t=Ye(e);return t===void 0?void 0:S(t)},firstSection:Fe,blockRowName:qe,rowName:Xe,plainText:Ge,Icon:C,Thumbnail:ve,useProducts:vt,presets:It()},Dt={desktop:2e3,tablet:800,mobile:390},X="desktop",Nt={options:ce,initial:X,fluid:X,widths:Dt},Ht={read:$e,write:e=>tt(e),forSelection:(e,t)=>Qe(e,t)},Wt={first:G,last:Je,firstGroup:Tt,lastGroup:j,isSectionGroup:Et,sectionGroupZone:Pt,panelOf:e=>e===G?ge:null,get sharedReach(){return v()?Vt:void 0},get shared(){return L()?at:void 0},get groupTab(){return v()?nt:void 0},get groupBadge(){return v()?Y({type:j})??void 0:void 0},get changeNotice(){return v()?rt():void 0},get band(){return v()?Mt:void 0},get groupAccepts(){return v()?St:void 0}},Mt={foldable:!0},Vt=e=>Y(e)??st(e);function xt(e){return{...Z(z(e),U(e)),openSettings:()=>e.show(V)}}function Gt(e,t){Ce(e,t),Oe()}const $o={useOwnerName:Ne,useDocumentLabel:Me,useBridges:Ot,useStandaloneBridges:xt,useDocumentPass:Gt,blockRules:At,blockLook:yt,devices:Nt,leftView:Ht,pinned:Wt,Canvas:lt,canvasDrag:{media:mt},Inspector:he};export{$o 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 y}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 D}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 fe}from"../../render/components/PreviewTickerContext.js";import{heroStoresLegacyTicker as ue}from"../../format/lib/hero-ticker.js";import{usePreviewHeroPart as Se}from"../../render/components/PreviewHeroPartContext.js";import{HERO_MEDIA_PARTS as Ee,HERO_PART_MODE as W,heroMediaRows as he,heroPartId as M,readHeroPartId as Pe}from"../../render/lib/document/hero-media-parts.js";import Te,{CHAT_MODE as we,HEADER_MODE as ge,SOCIAL_MODE as be,WEBSITE_MODE as V,WEBSITE_PAGE_MODE as Ie}from"./SectionEditor.js";import L from"./SectionIcon.js";import ve from"./SectionThumbnail.js";import{useScreenDocument as C}from"efficient-easel/screen/components/ScreenDocumentContext";import _e from"./StylesPanel.js";import{LOCATIONS_TYPE as ke,useLocationsTree as Re}from"./useLocationsTree.js";import{usePinnedChromeSeed as Le}from"./usePinnedChromeSeed.js";import{useHostDocumentBridge as Ce}from"./useHostDocumentBridge.js";import{usePreviewHref as Oe}from"./usePreviewHref.js";import{WebsitePreviewButton as Ae}from"./WebsitePreviewButton.js";import{SITE_STYLES_BASICS_TAB as Be,SITE_STYLES_TABS as ye,SITE_STYLES_TEXT_TAB as De,useWebsiteName as Ne}from"./WebsiteSettingsPanel.js";import{useWebsiteMainAction as He}from"./useWebsiteMainAction.js";import{VersionHistory as We}from"./VersionHistoryDrawer.js";import{useEaselSession as x}from"efficient-easel/screen/lib/session-context";import{useOpenPageName as Me}from"../lib/page-rows.js";import{HERO_GROUP_TYPE as Ve,heroGroupNestDepth as xe}from"../../format/lib/hero-group-placement.js";import{stripMarkup as Ge}from"../../format/lib/markup.js";import{categoryShortLabel as Ye,PINNED_SECTION_TYPE as Fe}from"../lib/document/add-palette.js";import{canAddTo as Ke}from"../lib/document/add-target.js";import{cardTemplateSlotsOf as je}from"../../format/lib/document/card-template-layers.js";import{blockIsOffered as ze}from"../lib/document/block-offer.js";import{sectionIdOfBoxZone as Ue,setBookingPreview as Ze}from"../../render/lib/document/booking-preview.js";import{footerBlockRowName as qe}from"../../format/lib/document/footer-block-row-name.js";import{sourceRowName as Xe}from"../../format/lib/document/source-row-name.js";import{FOOTER_TYPE as Je,HEADER_TYPE as G}from"../lib/document/footer-blocks.js";import{leftViewForSelection as Qe,readLeftView as $e,resolveLeftView as et,writeLeftView as tt}from"../../format/lib/document/left-view.js";import{websiteNodeIsLocked as ot}from"../lib/document/locked-blocks.js";import{everyPageNotice as rt,noOwnTab as nt,pinnedReach as Y,websiteDuplicateBlocked as it}from"../lib/document/every-page.js";import{sharedSectionReach as st,WEBSITE_SHARED_SECTIONS as at}from"../lib/shared-sections-layer.js";import{activeSharedSections as O,setSharedEditor as F}from"../../format/lib/shared-sections-active.js";import{sharedSectionsOf as ct}from"efficient-easel/screen/lib/shared-sections";import{pinnedChromeInPlace as v}from"../../format/lib/pinned-chrome-lock.js";import{scrollPreviewToSection as dt,scrollPreviewToTop as K}from"efficient-easel/screen/lib/document/preview-dom";import{SiteCanvas as lt}from"../lib/document/overrides.js";import{labelAtLevel as pt}from"../../format/lib/document/section-catalog.js";import{WEBSITE_MEDIA_DROP as mt}from"../../format/lib/document/media-drop.js";import{editorWords as ft,say as f}from"../../format/lib/editor-words.js";import{SECTION_DESCRIPTIONS as ut}from"../../format/lib/document/section-descriptions.js";import{groupAccepts as St,isSectionGroupType as Et,sectionGroupZone as ht,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 gt}from"../../format/lib/save-as-template-action.js";import{cityPalettePresets as bt}from"../lib/sections/city-presets.js";import{newSectionNode as It}from"../lib/sections/new-section-node.js";import{useHostProducts as vt}from"../lib/use-host-products.js";import{backendOf as _t}from"../lib/website-session.js";function z({mode:e,open:t}){const{setSelectedHeroId:o,setSelectHandler:r}=fe(),c=H().tree,l=e,n=l.kind==="ticker"?l.heroId:null,s=R(i=>{if(!i)return;t({kind:"ticker",heroId:i}),dt(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"&&ue(i.props)&&a(D,{icon:a(L,{type:"ticker",size:13}),name:f(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}=Se(),c=H().tree,{appState:l}=N(p=>p),n=l.data.content??[],s=$(n);s.current=n;const i=e,m=Ee.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 h=s.current.findIndex(T=>String(T.props.id)===d.nodeId);if(h<0)return;const P={kind:W[d.part],nodeId:d.nodeId};t({index:h},P)},[t]);return g(()=>{o(u)},[u,o]),g(()=>{r(E)},[r,E]),{partRows:(p,{rowClick:d})=>{const h=String(p.props.id),P=he(p);if(P.length===0)return null;const T=S=>{const w=M(h,S.part);return a(D,{icon:a(L,{type:S.part==="media"?"heroMedia":"heroImage",size:13}),name:f(S.label),onSelect:()=>E(w),selected:u===w,rowProps:{onClick:d(()=>E(w))},words:c},w)},[I,...b]=P;return k(B,{children:[T(I),b.length>0&&a(ne,{children:b.map(T)})]})}}}function Z(e,t){return{partRows:(o,r)=>k(B,{children:[e.partRows?.(o,r),t.partRows?.(o,r)]})}}function kt(e){const{adapter:t,capabilities:o,currentSlug:r,siteId:c,docId:l,hasUnsavedEdits:n,bridgeCapabilities:s,notifyParent:i,token:m}=C(),{hasPreviewLink:u}=o,E=_t(x()).preview?.draftLink,p=He(e.data),d=wt({hasTrustedConsole:!!m,canCreatePlatformTemplate:s.canCreatePlatformTemplate,capabilities:o,siteId:c,hasUnsavedEdits:n}),h=R(()=>{!c||!r||i(gt,{siteId:c,slug:r})},[i,c,r]),P=Oe({pageSlug:r,siteId:c,token:m}),T=t.previewHref?.(r)??P;return{barLead:()=>d.visible&&a(Tt,{enabled:d.enabled,reason:d.enabled?"":d.disabledReason,onSaved:h}),barView:()=>u&&r&&a(Ae,{liveHref:T,pageId:l??null,draftLink:E}),mainAction:p}}function Rt(e,t){const{capabilities:o,templateId:r,siteId:c,tokenRef:l,navigate:n}=C(),{hasSiteTheme:s,explainsSiteSettings:i}=o,m=S=>t.setView(S),[u,E]=y(ye[0].id),[p,d]=y(!1),{surface:h,setSurface:P}=pe(),T=()=>{if(s){m("styles"),t.reveal(),K();return}e.show(V),e.reveal(),K()},I={id:"pages",label:f("Pages"),icon:a(te,{}),panel:({onHide:S})=>a(se,{activeSurface:h,onPreviewSurface:P,onNavigate:w=>{P(null),n(r?{kind:"template",id:r,pageSlug:w}:{kind:"page",slug:w,siteId:c??void 0})},onClose:S})},b=[];return!s&&i&&b.push({id:"appearance",label:f("Appearance"),icon:a(re,{}),active:e.kind==="website",onSelect:T}),s&&b.push({id:"styles",label:f("Styles"),icon:a(oe,{}),panel:({onHide:S,notify:w})=>a(_e,{tokenRef:l,siteId:c??void 0,onClose:S,onNotify:w,tab:u,onTabChange:E,revealPageGroup:p,onPageGroupRevealed:()=>d(!1)})}),{railLead:[I],railTrail:b,resolveLeftView:S=>et(S,s),openSettings:T,openStyles:()=>{E(De),m("styles")},openPageStyles:s?()=>{E(Be),d(!0),m("styles"),t.reveal()}:i?()=>{e.show(Ie),e.reveal()}:void 0}}function Lt(){const{navigate:e,siteId:t,reloadFromServer:o,docId:r}=C(),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=O();if(!n||!r)return;let s=!1;return ct(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(()=>{Ze(n?.type==="BookingBox"&&n.props.region==="confirm"?Ue(s(String(n.props.id))):null)},[n?.props.id]);const i=Re(e,t),{capabilities:{hasSiteSettings:m}}=C();Lt();const{chat:u,setChat:E,setSelected:p,setSelectHandler:d}=ae(),h=R(()=>l(we),[l]),P=c==="chat";g(()=>{p(P)},[P,p]),g(()=>{d(h)},[d,h]);const{setOpenHandler:T}=le(),I=R(()=>l(be),[l]);g(()=>{T(I)},[T,I]);const b=Z(z(e),U(e)),S=kt(t),w=Rt(e,r),J=o.device;return{...b,...S,...w,hasOwnRows:_=>_.type===ke,ownRows:i.renderLocationTree,sectionPressed:i.sectionPressed,wrap:_=>a(ie.Provider,{value:!0,children:k(de.Provider,{value:J,children:[_,a(We,{})]})}),addPanelRow:_=>m?k("div",{className:"sf-addside-sitewide",children:[a("span",{className:"sf-addside-sitewide-glyph","aria-hidden":"true",children:a(L,{type:"chat",size:16})}),k("button",{type:"button",className:"sf-addside-sitewide-name",onClick:()=>{_(),h()},children:[f("Live chat"),a("span",{className:"sf-addside-sitewide-desc",children:f("A chat bubble on every page")})]}),a(ee,{checked:u.enabled,onChange:Q=>E({enabled:Q}),ariaLabel:f("Show the chat bubble on the whole site")})]}):void 0}}let q=null,A=new WeakMap;function Ot(e){const t=ft();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:f(r.label)})):null,spec:e.spec?{...e.spec,addLabel:f(e.spec.addLabel),...e.spec.childLabel?{childLabel:f(e.spec.childLabel)}:{}}:null},A.set(e,o)),o}const At={isLockedBlock:(e,t)=>ot(e,t)||!!(t&&O()?.heldElsewhere(t.props.id)),duplicateBlocked:it,nestDepth:(e,t,o)=>t===Ve?xe(e,o):0,newSectionNode:It,canAddTo:(e,t,o,r)=>Ot(Ke(e,t,r,o)),blockIsOffered:ze,slotsOf:je},Bt=new Proxy(ut,{get:(e,t)=>{const o=Reflect.get(e,t);return typeof o=="string"?f(o):o}}),yt={labelAtLevel:(e,t,o)=>f(pt(e,t,o)),descriptions:Bt,categoryLabel:e=>{const t=Ye(e);return t===void 0?void 0:f(t)},firstSection:Fe,blockRowName:qe,rowName:Xe,plainText:Ge,Icon:L,Thumbnail:ve,useProducts:vt,presets:bt()},Dt={desktop:2e3,tablet:800,mobile:390},X="desktop",Nt={options:ce,initial:X,fluid:X,widths:Dt},Ht={read:$e,write:e=>tt(e),forSelection:(e,t)=>Qe(e,t)},Wt={first:G,last:Je,firstGroup:Pt,lastGroup:j,isSectionGroup:Et,sectionGroupZone:ht,panelOf:e=>e===G?ge:null,get sharedReach(){return v()?Vt:void 0},get shared(){return O()?at:void 0},get groupTab(){return v()?nt:void 0},get groupBadge(){return v()?Y({type:j})??void 0:void 0},get changeNotice(){return v()?rt():void 0},get band(){return v()?Mt:void 0},get groupAccepts(){return v()?St:void 0}},Mt={foldable:!0},Vt=e=>Y(e)??st(e);function xt(e){return{...Z(z(e),U(e)),openSettings:()=>e.show(V)}}function Gt(e,t){Le(e,t),Ce()}const $o={useOwnerName:Ne,useDocumentLabel:Me,useBridges:Ct,useStandaloneBridges:xt,useDocumentPass:Gt,blockRules:At,blockLook:yt,devices:Nt,leftView:Ht,pinned:Wt,Canvas:lt,canvasDrag:{media:mt},Inspector:Te};export{$o as WEBSITE_SCREEN};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{jsx as a}from"react/jsx-runtime";import{HoverIcon as h,RotateIcon as l}from"efficient-easel/icons";import{group as
|
|
1
|
+
import{jsx as a}from"react/jsx-runtime";import{HoverIcon as h,RotateIcon as l}from"efficient-easel/icons";import{group as H}from"efficient-easel/screen/lib/document/box-fields";import{deviceField as o}from"efficient-easel/screen/lib/document/device-fields";import{NoControlMark as f,noControlField as E}from"efficient-easel/screen/lib/document/panel-no-control-mark";import{segmented as u,slider as v}from"../document/box-fields.js";import{withShowWhen as i}from"../../../format/lib/document/show-when-attach.js";import{animationDelayField as O,animationDurationField as D,showsWhatRuns as d}from"./AnimationDurationRow.js";import{CARD_HOVER_ANGLE as s,CARD_HOVER_KEYS as n,CARD_HOVER_KINDS as A,CARD_HOVER_TURN as V,HOVER_KEY as N,HOVER_KIND_LABELS as w,OLD_SPIN_KEY as I,PART_HOVER_KINDS as K,cardHoverAngleOf as k,cardHoverKindOf as C,cardRotatesRule as g}from"../../../format/lib/animation/hover.js";const m="_gHover",c=()=>o("desktop",H("Hover")),F="What this does when a shopper points at it, or taps it on a phone.",S="What each card does when a shopper points at it, or taps it on a phone. Rotate turns the wheel picture.";function R(e,t){return u("Hover effect",a(h,{}),e.map(r=>({label:w[r],value:r})),t)}function U(){return{[m]:c(),[N]:o("desktop",{...R(K,"none"),description:F})}}function b(e){const t=g(e),r=v("Angle",a(l,{}),s.min,s.max,s.step,V,"°");return{[m]:c(),[n.kind]:o("desktop",{...d(R(A,e),(p,_)=>C(_??{},e)),description:S}),[I]:E({type:"custom",render:()=>a(f,{})},"always"),[n.angle]:o("desktop",i(d(r,p=>k(p)),t)),[n.duration]:o("desktop",i(D("hover"),t)),[n.delay]:o("desktop",i(O("hover"),t))}}export{b as cardHoverFields,U as hoverFields};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{cardTemplateBlocks as i,cardTemplateOwner as f,cardTemplatesNameBlocks as u}from"../../../format/lib/content/card-template.js";import{blockOfferOf as p}from"./block-offer.js";import{containerBlocksFor as
|
|
1
|
+
import{cardTemplateBlocks as i,cardTemplateOwner as f,cardTemplatesNameBlocks as u}from"../../../format/lib/content/card-template.js";import{blockOfferOf as p}from"./block-offer.js";import{containerBlocksFor as m}from"../../../format/lib/document/container-blocks.js";import{blockChoicesFor as h,FOOTER_BLOCKS_SLOT as a}from"./footer-blocks.js";import{EDITOR_SLOT_EXTRA_SPECS as d}from"./slot-new-children.js";import{SLOT_SECTION_SPECS as O}from"../../../render/lib/document/slot-specs.js";function L(o,r=0,n,c){const e=S(y(o,r,c),n),t=e?p():null;return e&&t?T(e,t):e}function T(o,r){if(o.spec)return r.offers(o.spec.childType)?o:null;const n=o.choices??[],c=n.filter(e=>r.offers(e.type));return c.length===n.length?o:c.length>0?{...o,choices:c}:null}function S(o,r){if(!o||o.source!=="container"||!r||!u())return o;const n=f({data:r.data},r.id),c=typeof n?.type=="string"?i(n.type):[],e=o.choices??[],t=c.filter(s=>!e.some(l=>l.type===s.type));return t.length?{...o,choices:[...e,...t.map(s=>({type:s.type,label:s.label}))]}:o}function y(o,r,n){const c=n?d[o]?.[n]:void 0;if(c)return{source:"section",slot:c.slot,choices:null,spec:c};const e=O[o];if(e)return{source:"section",slot:e.slot,choices:null,spec:e};const t=m(o,r);if(t)return{source:"container",slot:t.slot,choices:t.choices,spec:null};const s=h(o);return s?{source:"footer",slot:a,choices:s,spec:null}:null}export{L as canAddTo};
|
|
@@ -1,6 +1,12 @@
|
|
|
1
|
+
import type { ReactElement } from "react";
|
|
1
2
|
import { type SelectField } from "efficient-easel/screen/lib/document/box-fields";
|
|
2
3
|
import { type ShowWhenRule } from "../../../render/lib/document/show-when.js";
|
|
3
4
|
export declare function blockSourceField(label: string, own: string): SelectField;
|
|
5
|
+
export declare const BLOCK_SOURCE_EDIT_PROP = "_sourceEdit";
|
|
6
|
+
export declare function blockSourceEditField(): {
|
|
7
|
+
type: "custom";
|
|
8
|
+
render: () => ReactElement;
|
|
9
|
+
};
|
|
4
10
|
export declare const NO_BLOCK_SOURCE: ShowWhenRule;
|
|
5
11
|
export declare function blockSourceFields<Fields extends Record<string, unknown>>(block: string, fields: Fields, props: Record<string, unknown> | null | undefined, options?: {
|
|
6
12
|
hides?: readonly string[];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{jsx as
|
|
1
|
+
import{jsx as p}from"react/jsx-runtime";import{ListIcon as g}from"efficient-easel/icons";import x from"../../components/SourceStatus.js";import{say as $}from"../../../format/lib/editor-words.js";import{NoControlMark as M,noControlField as E}from"efficient-easel/screen/lib/document/panel-no-control-mark";import{BLOCK_SOURCE_PROP as m,blockSourceSpec as j,blockSources as h,blockSourcesRevision as w,declaredBlockSource as W}from"../../../format/lib/content/block-sources.js";import{select as B}from"./box-fields.js";import{withShowWhen as F}from"../../../render/lib/document/show-when.js";function H(t,e){return B(t,p(g,{}),[{label:e,value:""}],"")}const K="_sourceEdit";function J(){return E({type:"custom",render:()=>p(M,{})},"always")}const y=new Map;function L(t){const e=`${t.label}\0${t.href}`;let o=y.get(e);return o||(o={type:"custom",render:()=>p(x,{compact:!0,status:"ok",hint:$("Where this content is edited."),edit:{label:t.label,onClick:()=>window.open(t.href,"_blank","noopener")}})},y.set(e,o)),o}const R=new WeakMap;let v=-1,d={};const O=new WeakMap;function P(t,e,o){v!==w()&&(v=w(),d={});let n=R.get(e);(!n||O.get(n)!==d)&&(n=new Map,O.set(n,d),R.set(e,n));const l=h(t),r=o&&!l.some(s=>s.key===o)?o:"",u=`${t}\0${r}`;let i=n.get(u);return i||(i={...e,options:[...e.options,...l.map(s=>({label:s.label,value:s.key})),...r?[{label:r,value:r}]:[]]},n.set(u,i)),i}const _=new WeakMap,U={not:{field:m,set:!0}};function Q(t,e,o,n={}){const l=e[m];if(!l)return e;const r=W(o),u=h(t).length>0||r!=="",i=u?P(t,l,r):null;let s=_.get(e);s||_.set(e,s=new Map);const S=`${w()}\0${u?"1":"0"}\0${r}\0${(n.hides??[]).join(",")}`,b=s.get(S);if(b)return b;const C=new Set(n.hides??[]),k=r?j(r)?.edit:void 0,a={};for(const[c,f]of Object.entries(e))c===m?i&&(a[c]=i):c===K?k&&(a[c]=L(k)):a[c]=C.has(c)&&f&&typeof f=="object"?F(f,U):f;return s.set(S,a),a}export{K as BLOCK_SOURCE_EDIT_PROP,U as NO_BLOCK_SOURCE,J as blockSourceEditField,H as blockSourceField,Q as blockSourceFields};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{jsx as
|
|
1
|
+
import{jsx as c}from"react/jsx-runtime";import{AccentIcon as v,ColumnsIcon as x,StylesIcon as f}from"efficient-easel/icons";import{copyText as b,plainText as C,plainTextarea as B,text as w,textarea as M,withOffPage as S}from"../../../controls.js";import{group as p}from"efficient-easel/screen/lib/document/box-fields";import{select as y,slider as A}from"../../../box-fields.js";import{SPLITTABLE_SECTIONS as H,headFieldsForPlacement as N}from"../../../../../../format/lib/sections/section-head-placement.js";import{SECTION_EYEBROW_LOOK_OPTIONS as D,eyebrowLookFor as k}from"../../../../../../format/lib/sections/section-eyebrow-look.js";import{BLOCK_SOURCE_EDIT_PROP as K,blockSourceEditField as W,blockSourceField as J,blockSourceFields as U}from"../../../block-source-fields.js";import{declaredBlockSource as E,sourceChoices as Y}from"../../../../../../format/lib/content/block-sources.js";import{cardKeyOf as q,cardRow as z,cardTemplateFields as O}from"../../../../../../format/lib/content/card-template.js";import{isNodeList as G,newId as I}from"efficient-easel/data";import{say as Q}from"../../../../../../format/lib/editor-words.js";import{withCardsTemplate as V}from"../../../../../../format/lib/document/cards-template-on-read.js";import{CARDS_PH as F,CardsSlots as X}from"../../../../../../format/lib/document/blocks/general/Cards/meta.js";const Z=e=>G(e.template)&&e.template.length>0;function $(e){const r=E(e);return r?Y(r).map(t=>({label:t.label,value:t.key})):(Array.isArray(e.items)?e.items:[]).map((t,l)=>({label:typeof t?.title=="string"&&t.title.trim()||Q("Card {n}",{n:l+1}),value:q(z(t),l)}))}const ee=e=>Object.defineProperty({...e},"key",{get:()=>I("card"),enumerable:!0});function te(e,r){const o=Z(r)&&r.cardStyle!=="label-only"&&!!e.highlightedCard;return Object.fromEntries(Object.entries(e).flatMap(([t,l])=>t==="highlightedCard"?o?[[t,re(l,$(r))]]:[]:t==="highlightBadge"?o?[[t,l]]:[]:t==="items"&&o&&l?[[t,ae(l)]]:[[t,l]]))}const L=new WeakMap;function re(e,r){let o=L.get(e);o||L.set(e,o=new Map);const t=JSON.stringify(r);let l=o.get(t);return l||o.set(t,l={...e,options:[...e.options,...r]}),l}const T=e=>e.kind==="link"?S(C(e.label)):e.multiline?B(e.label):b(e.label),oe=Object.fromEntries(O("Cards").filter(e=>!e.everySource).map(e=>[e.key,T(e)])),le=Object.fromEntries(O("Cards").filter(e=>e.key==="title"||e.key==="body").map(e=>[e.key,T(e)])),_=new WeakMap;function ae(e){let r=_.get(e);return r||_.set(e,r={...e,arrayFields:oe}),r}const we={fields:{_gSource:p("Source"),dataSource:J("Card content","Manual"),[K]:W(),_gContent:p("Content"),eyebrow:w("Eyebrow",F.eyebrow),eyebrowLook:y("Eyebrow style",c(f,{}),[...D],k("Cards")),title:M("Heading",F.title),items:{type:"array",label:"Cards",arrayFields:le,defaultItemProps:ee({title:"",body:""}),getItemSummary:e=>e?.title||e?.body||"Card"},...X,highlightedCard:y("Highlighted card",c(v,{}),[{label:"None",value:""}],""),highlightBadge:w("Highlight badge","Most popular"),_gStyle:p("Style"),cardStyle:y("Card style",c(f,{}),[{label:"Cards",value:"cards"},{label:"Label only",value:"label-only"}],"cards"),columns:A("Columns",c(x,{}),2,4,1,3)},resolveData:e=>{const r=V("Cards",e.props),o=r===e.props?e:{...e,props:r},t=o.props;if(!Array.isArray(t.items)||E(t))return o;const l=t.items,s=typeof t.highlightedCard=="string"?t.highlightedCard.trim():"",i=a=>a&&typeof a=="object"&&typeof a.key=="string"?a.key:"",P=!!s&&!l.some(a=>i(a)===s),d=new Set;let u=t.highlightedCard,h=!1;const R=l.map((a,j)=>{if(!a||typeof a!="object")return a;const n=i(a);if(n&&!d.has(n))return d.add(n),a;const g=!n&&P&&s===String(j+1);if(n||g){const m=I("card");return d.add(m),h=!0,g&&(u=m),{...a,key:m}}return a});return h?{...o,props:{...t,items:R,highlightedCard:u}}:o},resolveFields:(e,{fields:r})=>{const o=N(U("Cards",r,e.props,{hides:["items"]}),e.props.headPlacement,H.Cards.headRows),t=e.props,l=te(o,t);if(t.cardStyle!=="label-only")return l;const s=o.items,i=o.eyebrowLook;return{...l,...s?{items:{...s,arrayFields:{title:b("Feature label"),href:S(C("Link"))}}}:{},...i?{eyebrowLook:{...i,fallback:k("KeyFeatures")}}:{}}}};export{we as CardsFields};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{jsx as a}from"react/jsx-runtime";import p from"../../../../../components/LocationsGroupedField.js";import{splitLegacyRegion as m}from"../../../../../../format/lib/content/contact.js";import{BLOCK_SOURCE_ROWS_PROP as l}from"../../../../../../format/lib/content/block-sources.js";import{blockSourceField as d,blockSourceFields as u}from"../../../block-source-fields.js";import{needsGeocodeWork as
|
|
1
|
+
import{jsx as a}from"react/jsx-runtime";import p from"../../../../../components/LocationsGroupedField.js";import{splitLegacyRegion as m}from"../../../../../../format/lib/content/contact.js";import{BLOCK_SOURCE_ROWS_PROP as l}from"../../../../../../format/lib/content/block-sources.js";import{blockSourceField as d,blockSourceFields as u}from"../../../block-source-fields.js";import{needsGeocodeWork as g,resolveGeocodeRows as f}from"../../../geocode-resolve.js";const _={fields:{dataSource:d("Location content","Manual"),locations:{type:"custom",render:({value:o,onChange:r})=>a(p,{value:o,onChange:r})}},resolveData:async o=>{const r=o.props,e=r.locations??[];if(!g(e))return o;const n=await f(e,t=>{const s=m(t.region);return[String(t.address??"").replace(/\s*\n+\s*/g,", "),t.name,String(t.state??"").trim()||s.state,String(t.country??"").trim()||s.country].map(c=>String(c??"").trim()).filter(Boolean).join(", ")}),{[l]:S,...i}=r;return{...o,props:{...i,locations:n}}},resolveFields:(o,{fields:r})=>u("ContactLocations",r,o.props)};export{_ as ContactLocationsFields};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{jsx as o}from"react/jsx-runtime";import{phoneKey as
|
|
1
|
+
import{jsx as o}from"react/jsx-runtime";import{phoneKey as t,tabletKey as h}from"efficient-easel/draw";import{BOX_CARD_PAD as d,BOX_DARKEN as s,BOX_DARKEN_STYLES as u,isBackgroundBox as X}from"../../../../../../format/lib/content/box-background.js";import{BOX_TAB_SHAPES as K,REEL_SHAPE_LABELS as j}from"../../../../../../format/lib/reel.js";import{deviceField as a}from"efficient-easel/screen/lib/document/device-fields";import{ClockIcon as v,CropIcon as f,LineBetweenIcon as G,LineSolidIcon as Y,OpacityIcon as J,ShadowIcon as z,StylesIcon as O,TableIcon as g,TargetIcon as V}from"efficient-easel/icons";import{boxBlockSpacingField as q,boxFillField as Q,boxColumnsFields as Z,boxShareField as $,boxSharePhoneField as ee,containerDirectionField as oe,containerGapRows as te,linkField as ne,plainText as ae,swapPadding as A,toggle as c,upload as R,withPanelOnly as ie}from"../../../controls.js";import{BOX_SHAPE_OPTIONS as b,boxShapeOf as le}from"../../../../../../format/lib/content/box-shape.js";import{BOX_COLUMNS_MAX as re,BOX_COLUMNS_MIN as se,boxPhoneRowOneLine as pe}from"../../../../../../format/lib/content/box-layout.js";import{BOX_SEPARATOR_POINTS as E}from"../../../../../../format/lib/content/box-separator.js";import{group as i,phoneTwinFields as C}from"efficient-easel/screen/lib/document/box-fields";import{boxAlignField as de,boxJustifyField as ce,boxWrapField as N,placementField as Se,select as l,sidesPaddingFields as D,slider as me}from"../../../box-fields.js";import{withRowRules as _e}from"../../../../../../render/lib/document/show-when.js";import{separatorField as he}from"../../../separator-field.js";import{LOOP_SCROLLS as ue}from"../../../../../../format/lib/animation/index.js";import{FlexSlots as fe}from"../../../../../../format/lib/document/blocks/general/Flex/meta.js";import{CARD_BOX_FACTS as Oe,ON_A_CARD as ge,cardDisplayField as Ae}from"../../../card-display-chips.js";import{MIRROR_CARDS_FACTS as Re,mirrorCardsField as be}from"../../../mirror-cards-field.js";import{SHARED_COLUMNS_KEY as r,SHARED_COLUMNS_LABEL as L,SHARED_COLUMNS_OFF as x,sharedColumnsDrawn as F,sharedColumnsFits as H,SHARED_COLUMNS_PHONE_POINTS as Ee,SHARED_COLUMNS_POINTS as Ce}from"../../../../../../render/lib/content/box-shared-columns.js";const Ne={field:"bgImage",set:!0},I={field:"phoneRow",in:[2,3]},De={field:"direction",is:"tabs"},Le={field:"line",in:[!0,!1]},xe={field:"anchor",set:!0},T=["fixed","screen"],Fe={not:{any:[{field:"sectionHeightMode",in:T},{field:"sectionHeightModePhone",in:T}]}},He={context:"parent.line",is:!0},m={field:"direction",is:"row",default:"row"},p={not:ue},k={all:[m,p,{not:{field:"separator",in:E.map(e=>e.value)}},{not:{field:"line",is:!0}}]},Ie={all:[p,{not:{all:[m,{field:"separator",in:E.map(e=>e.value)}]}}]},w={not:{all:[k,{field:"columns",in:Array.from({length:re},(e,n)=>n+se)}]}},Te="sharedColumnsFits",B="sharedColumnsMisfit",P="sharedColumnsDraws",y="sharedColumnsPhoneDraws",ke={[Te]:e=>H(e.props??{}),[B]:e=>!H(e.props??{}),[P]:e=>F(e.props??{}).desktop,[y]:e=>F(e.props??{}).phone};function M(e){return{all:[{not:{context:B,is:!0}},{any:[ge,{field:e,set:!0}]}]}}const _={not:{context:P,is:!0}},S={not:{context:y,is:!0}},we={any:[_,S]};function Be(e){return{...e,render:n=>e.render({...n,value:pe(n.value)?"nowrap":"wrap"})}}const to={fields:_e({_gContent:i("Content"),content:fe.content,_gCardDisplay:i("Display"),cardDisplay:Ae(),_gLayout:i("Layout"),direction:oe("Flex"),tabShape:l("Tab shape",o(O,{}),K.map(e=>({label:j[e],value:e})),"tabs"),mirrorCards:be(),label:ie(ae("Tab name")),...te("Flex"),justify:ce(),align:de(),...C("wrap",N(),void 0,{phoneRow:Be(N())}),boxShape:a("desktop",l("Box shape",o(f,{}),[...b],"auto")),[t("boxShape")]:C("boxShape",l("Box shape",o(f,{}),[...b],"auto",{phoneRest:e=>le(e)}))[t("boxShape")],separator:he(o(G,{size:18}),"none"),share:a("desktop",$()),[t("share")]:ee(),[r]:a("desktop",l(L,o(g,{}),[...Ce],x)),[t(r)]:a("mobile",l(L,o(g,{}),[...Ee],x)),...Z(),blockSpacing:q(),line:c("Line",!1,o(Y,{}),"A line across the blocks, with a dot on each."),upcoming:c("Upcoming",!1,o(v,{}),"Still to come: a hollow dot, and the gold line stops before it."),_gShadow:i("Shadow"),shadow:c("Shadow",!1,o(z,{})),fillColor:Q(),_gBackground:i("Background image"),bgImage:a("desktop",R("Image","image/*")),bgImagePhone:a("mobile",R("Image","image/*")),darken:me("Darken",o(J,{}),s.min,s.max,s.step,s.fallback,s.unit),darkenStyle:l("Darken style",o(O,{}),u,u[0].value),placement:Se("Content position"),_gLink:i("Link"),link:ne("Link to"),jumpHighlight:c("Highlight when a link jumps here",!1,o(V,{}),"When a link lands on this Box's anchor, the Box gets an accent outline and its first block turns accent.")},[[["darken","darkenStyle","placement"],Ne],[[t("share")],{all:[I,S]}],[[r],M(r)],[[t(r)],M(t(r))],[[t("wrap")],{all:[I,p,S]}],[["phoneRow"],S],[["tabShape"],De],[["separator"],m],[["columns",h("columns")],k],[[h("gap")],Ie],[["justify"],{all:[p,we]}],[["wrap"],{all:[p,w,_]}],[["share"],{all:[w,_]}],[["line"],Le],[["upcoming"],He],[["jumpHighlight"],xe],[["boxShape",t("boxShape")],Fe]]),resolveFields:(e,{fields:n})=>{const U=e.props;if(X(U.bgImage)){const W=D({fallback:{top:d.desktop,bottom:d.desktop,left:d.side,right:d.side},tablet:!0});return A(n,W)}return e.props.padV2!==!0?A(n,D({fallback:{top:24,bottom:24},tablet:!0})):n},showWhenFacts:{...Oe,...Re,...ke}};export{to as FlexFields};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{jsx as r}from"react/jsx-runtime";import{HERO_GROUP_NUDGE_LIMIT as n,HERO_GROUP_WIDTH_DEFAULT as u,HERO_GROUP_WIDTH_MAX as p,HERO_GROUP_WIDTH_MIN as l,HERO_GROUP_WIDTH_NESTED_DEFAULT as _,heroGroupNestDepth as f}from"../../../../../../format/lib/hero-group-placement.js";import{WidthIcon as
|
|
1
|
+
import{jsx as r}from"react/jsx-runtime";import{HERO_GROUP_NUDGE_LIMIT as n,HERO_GROUP_WIDTH_DEFAULT as u,HERO_GROUP_WIDTH_MAX as p,HERO_GROUP_WIDTH_MIN as l,HERO_GROUP_WIDTH_NESTED_DEFAULT as _,heroGroupNestDepth as f}from"../../../../../../format/lib/hero-group-placement.js";import{WidthIcon as d}from"efficient-easel/icons";import{containerDirectionField as c,containerGapRows as h,heroGroupPlacementPoints as G,plainText as H,withIdentifier as g,withOffPage as R,withPanelOnly as x}from"../../../controls.js";import{group as o}from"efficient-easel/screen/lib/document/box-fields";import{boxAlignField as F,boxJustifyField as O,boxWrapField as P,placementField as D,positionFields as E,sidesPaddingFields as w,slider as m}from"../../../box-fields.js";import{PH as I}from"../../../../../../format/lib/document/blocks/placeholders.js";import{withRowRules as T}from"../../../../../../render/lib/document/show-when.js";import{HeroGroupSlots as y}from"../../../../../../format/lib/document/blocks/general/HeroGroup/meta.js";const S={fields:T({_gContent:o("Content"),name:x(g(R(H("Box name",I.boxName)))),content:y.content,_gLayout:o("Layout"),placement:D("Placement",{pointsFor:G}),width:m("Width",r(d,{}),l,p,5,u,"%"),direction:c("HeroGroup"),...h("HeroGroup"),justify:O(),align:F(),wrap:P(),_gNudge:o("Nudge"),...E({keys:{x:"nudgeX",y:"nudgeY"},min:-n,max:n,label:null}),...w({tablet:!0})},[[["placement"],{context:"heroGroupDepth",is:0,default:0}]]),resolveFields:(e,{fields:t,appState:s})=>{const a=typeof e.props.id=="string"?e.props.id:"";if(f(s?.data,a)===0)return t;const i={...t};return i.width=m("Width",r(d,{}),l,p,5,_,"%"),i}};export{S as HeroGroupFields};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{blockSourceField as
|
|
1
|
+
import{blockSourceField as r,blockSourceFields as s}from"../../../block-source-fields.js";import{copyText as a,text as l,upload as m}from"../../../controls.js";import{group as t}from"efficient-easel/screen/lib/document/box-fields";import{PAYMENT_PH as n}from"../../../../../../format/lib/document/blocks/general/PaymentBadges/meta.js";const c={fields:{_gContent:t("Content"),heading:l("Heading",n.heading),dataSource:r("Payment content","Manual"),badges:{type:"array",label:"Payment methods",arrayFields:{label:a("Name"),src:m("Logo","image/*")},getItemSummary:e=>e.label||e.src||"Method"},assurances:{type:"array",label:"Reassurance lines",arrayFields:{text:a("Line")},getItemSummary:e=>e.text||"Line"},_gLayout:t("Layout")},resolveFields:(e,{fields:o})=>s("PaymentBadges",o,e.props,{hides:["badges"]})};export{c as PaymentBadgesFields};
|