efficient-easel 18.2.0 → 19.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +26 -1
- package/dist/{CanvasDragLayer-dZCPbQCP.d.ts → CanvasDragLayer-ARfaivCu.d.ts} +21 -3
- package/dist/{host-epHo7r8P.d.ts → ScreenDocumentContext-D55vIrG3.d.ts} +208 -208
- package/dist/autosave/index.d.ts +4 -4
- package/dist/{canvas-typing-BsNigaCa.d.ts → canvas-typing-Be4FO4q7.d.ts} +5 -5
- package/dist/chrome/chrome.css +2 -18
- package/dist/chrome/index.d.ts +5 -39
- package/dist/chrome/index.js +1 -1
- package/dist/{chunk-C2RHV42O.js → chunk-23DYNW6S.js} +1 -1
- package/dist/chunk-32JJK7PQ.js +8 -0
- package/dist/chunk-3WLT3GQS.js +1 -0
- package/dist/{chunk-4ES5JGGX.js → chunk-3Z2MVLCD.js} +1 -1
- package/dist/{chunk-HGV3FWOB.js → chunk-5DPIGWUL.js} +1 -1
- package/dist/chunk-5Z6KYASQ.js +1 -0
- package/dist/{chunk-N5AN2RF2.js → chunk-6B542CLG.js} +1 -1
- package/dist/chunk-AJSDWWJW.js +1 -0
- package/dist/chunk-C56MPJBH.js +1 -0
- package/dist/{chunk-S4AWJX4Q.js → chunk-EZG3TGQ7.js} +1 -1
- package/dist/chunk-FCRNT5PM.js +5 -0
- package/dist/{chunk-XHHVMAGM.js → chunk-FGYJ5DJY.js} +1 -1
- package/dist/chunk-GNMBJUG7.js +62 -0
- package/dist/{chunk-VEZPDGDQ.js → chunk-JBOSEHIX.js} +1 -1
- package/dist/chunk-KRL3IUV3.js +1 -0
- package/dist/{chunk-YLQYEDUQ.js → chunk-LBOJCTTC.js} +1 -1
- package/dist/chunk-LNHT2KPX.js +2 -0
- package/dist/chunk-M5Q4VYOH.js +14 -0
- package/dist/chunk-M62P4IQK.js +2 -0
- package/dist/chunk-MS2U6MV5.js +1 -0
- package/dist/chunk-MZ5PWTDV.js +7 -0
- package/dist/{chunk-7TOQCTHV.js → chunk-PY7OOQEZ.js} +3 -3
- package/dist/{chunk-KG7RJWOK.js → chunk-RYNBSKE7.js} +1 -1
- package/dist/chunk-SGFDUXUH.js +18 -0
- package/dist/{chunk-XDZHKYQX.js → chunk-SINAM2IT.js} +1 -1
- package/dist/chunk-Y6RJAOFH.js +1 -0
- package/dist/chunk-YZALWZT7.js +2 -0
- package/dist/chunk-ZG6PVMC3.js +19 -0
- package/dist/copy/index.d.ts +7 -7
- package/dist/copy/index.js +29 -29
- package/dist/drag/drag.css +23 -0
- package/dist/drag/index.d.ts +1 -1
- package/dist/drag/index.js +1 -1
- package/dist/easel/index.d.ts +15 -2
- package/dist/easel/index.js +1 -1
- package/dist/fields/fields.css +3 -3
- package/dist/fields/index.d.ts +1 -1
- package/dist/fields/index.js +1 -1
- package/dist/panel/index.d.ts +65 -84
- package/dist/panel/index.js +14 -19
- package/dist/panel/panel.css +41 -137
- package/dist/{panelWidths-D9hTLR25.d.ts → panelWidths-DgQXiPXU.d.ts} +34 -6
- package/dist/screen/components/AddBlockRow.js +1 -1
- package/dist/screen/components/AddSidePanel.js +1 -1
- package/dist/screen/components/MediaPopup.d.ts +21 -0
- package/dist/screen/components/MediaPopup.js +1 -0
- package/dist/screen/components/NodeContextMenu.d.ts +4 -4
- package/dist/screen/components/NodeContextMenu.js +1 -1
- package/dist/screen/components/PageEditGuardNotices.js +1 -1
- package/dist/screen/components/SaveControls.d.ts +6 -6
- package/dist/screen/components/SaveControls.js +1 -1
- package/dist/screen/components/ScreenChrome.js +1 -1
- package/dist/screen/components/ScreenDocumentContext.d.ts +1 -1
- package/dist/screen/components/ScreenDocumentContext.js +1 -1
- package/dist/screen/components/ScreenMount.d.ts +8 -8
- package/dist/screen/components/ScreenMount.js +1 -1
- package/dist/screen/components/ScreenStoreProvider.d.ts +10 -8
- package/dist/screen/components/ScreenStoreProvider.js +1 -1
- package/dist/screen/components/SectionScreenShell.js +17 -16
- package/dist/screen/components/SidePanelHead.js +1 -1
- package/dist/screen/components/panel-widths.d.ts +7 -6
- package/dist/screen/components/panel-widths.js +1 -1
- package/dist/screen/components/usePartBridge.d.ts +7 -7
- package/dist/screen/components/usePartBridge.js +1 -1
- package/dist/screen/index.d.ts +5 -5
- package/dist/screen/index.js +1 -1
- package/dist/screen/lib/document-addressing.d.ts +1 -1
- package/dist/screen/lib/host-inbound.js +1 -1
- package/dist/screen/lib/host.d.ts +5 -5
- package/dist/screen/lib/key-scope.js +1 -1
- package/dist/screen/lib/media-panel.d.ts +74 -37
- package/dist/screen/lib/media-panel.js +1 -1
- package/dist/screen/lib/media-picker.d.ts +5 -5
- package/dist/screen/lib/media-picker.js +1 -1
- package/dist/screen/lib/puck/device-fields.js +1 -1
- package/dist/screen/lib/puck/preview-dom.js +1 -1
- package/dist/screen/lib/puck/style-clipboard.d.ts +7 -7
- package/dist/screen/lib/puck/style-clipboard.js +1 -1
- package/dist/screen/lib/puck/use-section-ops.js +1 -1
- package/dist/screen/lib/save-status.d.ts +2 -2
- package/dist/screen/lib/screen-parts.d.ts +52 -11
- package/dist/screen/lib/screen-parts.js +1 -1
- package/dist/screen/screen.css +5 -4
- package/dist/screen/words.d.ts +3 -0
- package/dist/screen/words.js +1 -1
- package/dist/strings/index.d.ts +6 -6
- package/dist/strings/index.js +2 -2
- package/dist/text-styles/index.js +21 -21
- package/dist/{types-DT8ywrFQ.d.ts → types-B3iSHX-w.d.ts} +2 -22
- package/dist/{words-zH1H0WFw.d.ts → words-BeX5eGq7.d.ts} +2 -2
- package/dist/words-BpTjCfqO.d.ts +89 -0
- package/dist/{words-DkWcK1rh.d.ts → words-Cm8PMYn0.d.ts} +1 -1
- package/dist/{words-BpiVrsW5.d.ts → words-DYu4iBrR.d.ts} +1 -21
- package/package.json +8 -8
- package/dist/chunk-2ZWA6ARJ.js +0 -8
- package/dist/chunk-5EZ5Z3K7.js +0 -7
- package/dist/chunk-B4JN227A.js +0 -1
- package/dist/chunk-DXROGLB5.js +0 -2
- package/dist/chunk-GWIVPLOX.js +0 -23
- package/dist/chunk-LIRNQXAY.js +0 -1
- package/dist/chunk-LLDHIBYG.js +0 -18
- package/dist/chunk-OBIL7BZO.js +0 -4
- package/dist/chunk-QEAUF632.js +0 -14
- package/dist/chunk-R6WTQWAC.js +0 -2
- package/dist/chunk-SEVGZP36.js +0 -62
- package/dist/chunk-SNB4LQMK.js +0 -1
- package/dist/chunk-STWSCR25.js +0 -2
- package/dist/chunk-U277UX5I.js +0 -1
- package/dist/chunk-W6SDWCOL.js +0 -5
- package/dist/chunk-X52NFKUS.js +0 -1
- package/dist/chunk-Z6PVRXVY.js +0 -1
- package/dist/screen/components/MediaSidePanel.d.ts +0 -49
- package/dist/screen/components/MediaSidePanel.js +0 -1
- package/dist/words-D-yhjdOg.d.ts +0 -183
package/dist/chrome/index.d.ts
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import * as react from 'react';
|
|
2
|
-
import { T as TopBarProps, b as TopBarClusterProps, c as TopBarRailProps, E as EaselIconButtonProps, d as DeviceSwitchProps, e as SaveStateProps, f as SaveStateToggleProps, g as SaveIconProps, a as SaveIconState, h as SaveIconTone, P as PanelResizeHandleProps, I as InspectorHeadProps, i as InspectorIconButtonProps, j as InspectorUpLevelProps,
|
|
3
|
-
export { D as DeviceOption, R as RailWordsShown, S as SaveTone } from '../types-
|
|
4
|
-
import { C as ChromeWords, N as NoticeWords } from '../words-
|
|
2
|
+
import { T as TopBarProps, b as TopBarClusterProps, c as TopBarRailProps, E as EaselIconButtonProps, d as DeviceSwitchProps, e as SaveStateProps, f as SaveStateToggleProps, g as SaveIconProps, a as SaveIconState, h as SaveIconTone, P as PanelResizeHandleProps, I as InspectorHeadProps, i as InspectorIconButtonProps, j as InspectorUpLevelProps, k as EditNoticeProps } from '../types-B3iSHX-w.js';
|
|
3
|
+
export { D as DeviceOption, R as RailWordsShown, S as SaveTone } from '../types-B3iSHX-w.js';
|
|
4
|
+
import { C as ChromeWords, N as NoticeWords } from '../words-DYu4iBrR.js';
|
|
5
5
|
import { LockWords, EditAccess, SaveConflict } from '../edit-lock/index.js';
|
|
6
|
-
export { D as DEFAULT_PANEL_W, M as MAX_PANEL_W, a as MIN_PANEL_W, P as PanelSide,
|
|
6
|
+
export { D as DEFAULT_PANEL_W, M as MAX_PANEL_W, a as MIN_PANEL_W, b as MIN_PANEL_W_BY_SIDE, P as PanelSide, c as PanelWidths, d as clampPanelWidth, p as panelWidthVars, s as setPanelWidthVars } from '../panelWidths-DgQXiPXU.js';
|
|
7
7
|
import '../types-Cy7rdmXt.js';
|
|
8
8
|
import '../wordFit-7XpmhcaW.js';
|
|
9
9
|
|
|
@@ -208,40 +208,6 @@ declare function headWords({ name, tier, of }: {
|
|
|
208
208
|
kind: string;
|
|
209
209
|
};
|
|
210
210
|
|
|
211
|
-
/**
|
|
212
|
-
* THE MEDIA PANEL'S HEAD — one part for both editors (card [MERGE] One Media
|
|
213
|
-
* Panel Head For Both Editors, owner ruling 2026-10-06: a part exists once, in
|
|
214
|
-
* efficient-easel).
|
|
215
|
-
*
|
|
216
|
-
* The Media Library under it was already one component, the admin portal's,
|
|
217
|
-
* drawn narrow in a left panel. Its head was drawn twice: by the campaign
|
|
218
|
-
* designer (`EmailMediaPanel`) and by the website editor (`MediaSidePanel` on
|
|
219
|
-
* its `SidePanelHead`). Both were this shape on `InspectorHead`; where they
|
|
220
|
-
* differed, the website editor's won (GG, 2026-10-06):
|
|
221
|
-
*
|
|
222
|
-
* browsing [media] Media library │ [hide]
|
|
223
|
-
* <the site or campaign>
|
|
224
|
-
* picking [image] Choose image [Cancel] │ [hide]
|
|
225
|
-
* For Background image
|
|
226
|
-
*
|
|
227
|
-
* • choosing is a MODE over the panel, so the head says so and names its way
|
|
228
|
-
* out in a WORD. Cancel leaves the field as it was; what the panel shows
|
|
229
|
-
* next is the host's to decide (both go back to the view before);
|
|
230
|
-
* • the kind word is what the field can hold: image, video or SVG logo
|
|
231
|
-
* ({@link mediaPickKind} reads it from the field's `accept`);
|
|
232
|
-
* • a pick with no field name keeps the browsing context line;
|
|
233
|
-
* • Hide panel is always last, after a hairline when Cancel is there, and is
|
|
234
|
-
* not drawn at all where the panel cannot be hidden (no `onHide`). There
|
|
235
|
-
* is no ✕ in a panel head: ✕ closes windows.
|
|
236
|
-
*/
|
|
237
|
-
declare function MediaPanelHead({ context, pick, onCancel, onHide, side }: MediaPanelHeadProps): react.JSX.Element;
|
|
238
|
-
/**
|
|
239
|
-
* What a field can hold, from the `accept` it asks with: `image/svg+xml` is an
|
|
240
|
-
* SVG logo, `video/*` a video, anything else an image. The website editor's
|
|
241
|
-
* rule (`pickNoun`), lifted with its head.
|
|
242
|
-
*/
|
|
243
|
-
declare function mediaPickKind(accept: string): MediaPickKind;
|
|
244
|
-
|
|
245
211
|
/**
|
|
246
212
|
* The bar that says why edits are not being saved — somebody else holds the
|
|
247
213
|
* document, or a save was refused. Never a dialog (blueprint 2.5): the operator
|
|
@@ -317,4 +283,4 @@ type EditNoticeWords = {
|
|
|
317
283
|
*/
|
|
318
284
|
declare function editNotice(access: EditAccess, conflict: SaveConflict | null, noun: string, words?: EditNoticeWords): EditNoticeContent | null;
|
|
319
285
|
|
|
320
|
-
export { ChromeWords, DeviceSwitch, DeviceSwitchProps, EaselIconButton, EaselIconButtonProps, EaselTopBar, EditNotice, type EditNoticeAction, type EditNoticeContent, EditNoticeProps, type EditNoticeWords, type HeadTier, InspectorHead, InspectorHeadProps, InspectorIconButton, InspectorIconButtonProps, InspectorUpLevel, InspectorUpLevelProps,
|
|
286
|
+
export { ChromeWords, DeviceSwitch, DeviceSwitchProps, EaselIconButton, EaselIconButtonProps, EaselTopBar, EditNotice, type EditNoticeAction, type EditNoticeContent, EditNoticeProps, type EditNoticeWords, type HeadTier, InspectorHead, InspectorHeadProps, InspectorIconButton, InspectorIconButtonProps, InspectorUpLevel, InspectorUpLevelProps, NoticeWords, PanelResizeHandle, PanelResizeHandleProps, SaveIcon, SaveIconProps, SaveIconState, SaveIconTone, SaveState, SaveStateProps, SaveStateToggle, SaveStateToggleProps, TopBarCluster, TopBarClusterProps, TopBarDivider, TopBarProps, TopBarRail, TopBarRailProps, editNotice, headWords, saveIconTone };
|
package/dist/chrome/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export{DEFAULT_PANEL_W,DeviceSwitch,EaselIconButton,EaselTopBar,EditNotice,InspectorHead,InspectorIconButton,InspectorUpLevel,MAX_PANEL_W,MIN_PANEL_W,
|
|
1
|
+
export{DEFAULT_PANEL_W,DeviceSwitch,EaselIconButton,EaselTopBar,EditNotice,InspectorHead,InspectorIconButton,InspectorUpLevel,MAX_PANEL_W,MIN_PANEL_W,MIN_PANEL_W_BY_SIDE,PanelResizeHandle,SaveIcon,SaveState,SaveStateToggle,TopBarCluster,TopBarDivider,TopBarRail,clampPanelWidth,editNotice,headWords,panelWidthVars,saveIconTone,setPanelWidthVars}from"../chunk-ZG6PVMC3.js";import"../chunk-MJM6SFD3.js";import"../chunk-AJSDWWJW.js";import"../chunk-2OAZYSWJ.js";import"../chunk-THWO5YVZ.js";import"../chunk-RE4LP46F.js";import"../chunk-MFIRYGHW.js";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
var e={title:"Add",contextAll:"Sections and blocks",done:"Done",doneDescription:"Close Add and go back",templates:"Your templates",tile:({name:e})=>`Add ${e}`,hint:"Drag onto the page.",search:"Search",onlySections:"Only sections go here",notInside:({name:e})=>`Cannot go inside ${e}`,addingTo:({name:e})=>`Adding to ${e}`,addingBefore:({name:e})=>`Adding before ${e}`,addingAtEnd:"Adding at the end of the page",addingHere:"Adding here"},a=e=>1===e?"1 page":`${e} pages`,t={group:"Shared sections",onPages:({count:e})=>`On ${a(e)}`,makeShared:"Make shared",makeSharedHint:"Use this section on other pages from Add. Change it once, and every page changes.",name:"Name",cancel:"Cancel",makeFailed:"Could not make it shared. Try again.",detach:"Detach from shared",removeFromPage:"Remove from this page",removed:({count:e})=>e>0?`Removed from this page · still on ${a(e)}`:"Removed from this page",deleteShared:"Delete shared section",deleteTitle:({name:e})=>`Delete “${e}”?`,deleteMessage:({count:e})=>0===e?"No page uses it. Nothing on the website changes.":1===e?"The page that uses it keeps its own copy. Nothing disappears from the website.":`The ${e} pages that use it each keep their own copy. Nothing disappears from the website.`,deleteFailed:"Could not delete it. Try again.",alreadyHere:"Already on this page"};var o={savedAgo:function({seconds:e}){const a=Math.max(0,Math.floor(e));if(a<1)return"Saved just now";if(a<60)return`Saved ${a} second${1===a?"":"s"} ago`;const t=Math.floor(a/60);if(t<60)return`Saved ${t} minute${1===t?"":"s"} ago`;const o=Math.floor(t/60);return`Saved ${o} hour${1===o?"":"s"} ago`},saved:"All changes saved",saving:"Saving",pending:"Changes not saved yet — saving in a moment",failedIn:({seconds:e})=>`Not saved — trying again in ${e} s`,failedSoon:"Not saved — trying again soon",offline:"You’re offline — we’ll save when you’re back",pausedHeld:"Auto-save is off — changes not saved",paused:"Auto-save is off",locked:({editing:e})=>`Not saving — ${e}`,blockedOffline:"You’re offline. Try again when you’re back online.",blockedFailed:"Your last changes are not saved yet. Try again when they are.",blockedConflict:"Your last save was refused. See the notice below."},n={loading:"Loading",waitingForAuthorization:"Waiting for editor authorization",missingTemplatePage:"Couldn’t open a page in this template.",missingPage:({slug:e})=>`No page with slug "${e}".`,missingDocument:"Couldn’t open this document.",loadFailed:({cause:e})=>`Could not load the document — ${e}`,noun:"page",pageSettings:"Page settings",header:"Header",footer:"Footer",pageSections:"Page",templateSections:"Template",addSection:"Add section",addSectionHere:"Add section here",done:"Done",copied:({name:e})=>`Copied ${e}`,pasteRefused:({name:e})=>`${e} can’t be pasted here.`,add:e,shared:t,canvasAddBlock:"Add block",railMedia:"Media library",leftPanel:"Left panel",resizeLeftPanel:"Resize left panel",leave:{title:"Unsaved changes",body:"Your most recent edits haven’t finished saving yet. Save them before switching, or leave and discard them.",cancel:"Cancel",discard:"Discard & leave",save:"Save & leave",saving:"Saving"},bar:{undo:"Undo",redo:"Redo",refresh:"Reload the preview",refreshTip:"Reload the preview (keeps your place)",notSaving:"Not saving — see the notice below",retry:"Retry now",autoSaveOff:"Auto-save is off — click to turn it back on (saves your held edits)",autoSaveOn:"Auto-save is on — click to pause it",views:"Left panel views",saveOptions:"Save options",autoSave:"Auto-save",saveNow:"Save now"},saveStatus:o,menu:{undo:"Undo",redo:"Redo",collapseAll:"Collapse all layers",selectAll:"Select all",pinned:"Pinned — can’t be moved or deleted",clipboardRefused:"Your browser won’t let us read the clipboard — press ⌘V"},layers:"Layers",expandAll:"Expand all sections",collapseAll:"Collapse all sections",nothingToFold:"Nothing to fold on this page",rename:"Rename",deleteNamed:({name:e})=>`Delete ${e}`,hideNamed:({name:e})=>`Hide ${e}`,showNamed:({name:e})=>`Show ${e}`,addBlockHere:"Add block here",sectionFirst:({name:e})=>`“${e}” is already first`,sectionLast:({name:e})=>`“${e}” is already last`,sectionMoved:({name:e,n:a,total:t})=>`Moved “${e}” to position ${a} of ${t}`,sectionAdded:({name:e})=>`Added “${e}” section`,deleted:({name:e})=>`Deleted “${e}”`,resizeSettingsPanel:"Resize settings panel",sectionSettings:({name:e})=>`${e} settings`,headerSettings:"Header settings",addBlockMenu:"Add block",deviceNote:{tablet:"Tablet uses the desktop settings.",mobile:"Showing the phone settings for this section."}};export{e as DEFAULT_SCREEN_ADD_WORDS,o as DEFAULT_SCREEN_SAVE_STATUS_WORDS,t as DEFAULT_SCREEN_SHARED_WORDS,n as DEFAULT_SCREEN_WORDS};
|
|
1
|
+
var e={title:"Add",contextAll:"Sections and blocks",done:"Done",doneDescription:"Close Add and go back",templates:"Your templates",tile:({name:e})=>`Add ${e}`,hint:"Drag onto the page.",search:"Search",onlySections:"Only sections go here",notInside:({name:e})=>`Cannot go inside ${e}`,addingTo:({name:e})=>`Adding to ${e}`,addingBefore:({name:e})=>`Adding before ${e}`,addingAtEnd:"Adding at the end of the page",addingHere:"Adding here"},a=e=>1===e?"1 page":`${e} pages`,t={group:"Shared sections",onPages:({count:e})=>`On ${a(e)}`,makeShared:"Make shared",makeSharedHint:"Use this section on other pages from Add. Change it once, and every page changes.",name:"Name",cancel:"Cancel",makeFailed:"Could not make it shared. Try again.",detach:"Detach from shared",removeFromPage:"Remove from this page",removed:({count:e})=>e>0?`Removed from this page · still on ${a(e)}`:"Removed from this page",deleteShared:"Delete shared section",deleteTitle:({name:e})=>`Delete “${e}”?`,deleteMessage:({count:e})=>0===e?"No page uses it. Nothing on the website changes.":1===e?"The page that uses it keeps its own copy. Nothing disappears from the website.":`The ${e} pages that use it each keep their own copy. Nothing disappears from the website.`,deleteFailed:"Could not delete it. Try again.",alreadyHere:"Already on this page"};var o={savedAgo:function({seconds:e}){const a=Math.max(0,Math.floor(e));if(a<1)return"Saved just now";if(a<60)return`Saved ${a} second${1===a?"":"s"} ago`;const t=Math.floor(a/60);if(t<60)return`Saved ${t} minute${1===t?"":"s"} ago`;const o=Math.floor(t/60);return`Saved ${o} hour${1===o?"":"s"} ago`},saved:"All changes saved",saving:"Saving",pending:"Changes not saved yet — saving in a moment",failedIn:({seconds:e})=>`Not saved — trying again in ${e} s`,failedSoon:"Not saved — trying again soon",offline:"You’re offline — we’ll save when you’re back",pausedHeld:"Auto-save is off — changes not saved",paused:"Auto-save is off",locked:({editing:e})=>`Not saving — ${e}`,blockedOffline:"You’re offline. Try again when you’re back online.",blockedFailed:"Your last changes are not saved yet. Try again when they are.",blockedConflict:"Your last save was refused. See the notice below."},n={loading:"Loading",waitingForAuthorization:"Waiting for editor authorization",missingTemplatePage:"Couldn’t open a page in this template.",missingPage:({slug:e})=>`No page with slug "${e}".`,missingDocument:"Couldn’t open this document.",loadFailed:({cause:e})=>`Could not load the document — ${e}`,noun:"page",pageSettings:"Page settings",header:"Header",footer:"Footer",pageSections:"Page",templateSections:"Template",addSection:"Add section",addSectionHere:"Add section here",done:"Done",copied:({name:e})=>`Copied ${e}`,pasteRefused:({name:e})=>`${e} can’t be pasted here.`,add:e,shared:t,canvasAddBlock:"Add block",canvasReplaceImage:"Replace image",railMedia:"Media library",leftPanel:"Left panel",resizeLeftPanel:"Resize left panel",leave:{title:"Unsaved changes",body:"Your most recent edits haven’t finished saving yet. Save them before switching, or leave and discard them.",cancel:"Cancel",discard:"Discard & leave",save:"Save & leave",saving:"Saving"},bar:{undo:"Undo",redo:"Redo",refresh:"Reload the preview",refreshTip:"Reload the preview (keeps your place)",notSaving:"Not saving — see the notice below",retry:"Retry now",autoSaveOff:"Auto-save is off — click to turn it back on (saves your held edits)",autoSaveOn:"Auto-save is on — click to pause it",views:"Left panel views",saveOptions:"Save options",autoSave:"Auto-save",saveNow:"Save now"},saveStatus:o,menu:{undo:"Undo",redo:"Redo",collapseAll:"Collapse all layers",selectAll:"Select all",pinned:"Pinned — can’t be moved or deleted",clipboardRefused:"Your browser won’t let us read the clipboard — press ⌘V"},layers:"Layers",expandAll:"Expand all sections",collapseAll:"Collapse all sections",nothingToFold:"Nothing to fold on this page",rename:"Rename",deleteNamed:({name:e})=>`Delete ${e}`,hideNamed:({name:e})=>`Hide ${e}`,showNamed:({name:e})=>`Show ${e}`,addBlockHere:"Add block here",sectionFirst:({name:e})=>`“${e}” is already first`,sectionLast:({name:e})=>`“${e}” is already last`,sectionMoved:({name:e,n:a,total:t})=>`Moved “${e}” to position ${a} of ${t}`,sectionAdded:({name:e})=>`Added “${e}” section`,deleted:({name:e})=>`Deleted “${e}”`,resizeSettingsPanel:"Resize settings panel",sectionSettings:({name:e})=>`${e} settings`,headerSettings:"Header settings",addBlockMenu:"Add block",deviceNote:{tablet:"Tablet uses the desktop settings.",mobile:"Showing the phone settings for this section."}};export{e as DEFAULT_SCREEN_ADD_WORDS,o as DEFAULT_SCREEN_SAVE_STATUS_WORDS,t as DEFAULT_SCREEN_SHARED_WORDS,n as DEFAULT_SCREEN_WORDS};
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import{buildPaletteSections as e,pinnedSection as t,categoryLabel as n}from"./chunk-PA3PNTVV.js";import{blockTypesIn as o}from"./chunk-5ZBY24K7.js";import{sectionTemplatesOf as l}from"./chunk-BVN33R76.js";import{sharedSectionsOf as r}from"./chunk-43AEUUNQ.js";import{SidePanelHead as i,PanelModeExit as s}from"./chunk-SINAM2IT.js";import{blockRuns as c}from"./chunk-M2Z775ZC.js";import{useScreenBlockLook as a,useScreenBlockRules as d,useScreenPinned as p}from"./chunk-FCRNT5PM.js";import{useEaselSession as m}from"./chunk-O7Q4DDJT.js";import{DEFAULT_SCREEN_WORDS as f}from"./chunk-23DYNW6S.js";import{useEasel as u}from"./chunk-M5Q4VYOH.js";import{easelMenuEntries as y}from"./chunk-BALFHI3G.js";import{useWords as h}from"./chunk-MFIRYGHW.js";import{AddPanel as k}from"./chunk-SGFDUXUH.js";import{DEFAULT_DRAG_WORDS as g}from"./chunk-KAML3KQH.js";import{useState as b,useEffect as v,useMemo as j,useRef as w}from"react";import{SharedIcon as C,AddIcon as M}from"efficient-shell/icons/efficient";import{ContextMenu as T,toast as A,Dialog as F,Button as N}from"efficient-shell/ui";import{jsx as $,jsxs as x,Fragment as D}from"react/jsx-runtime";function H({name:e,pages:t,onDelete:n,onCancel:o}){const l=h("screen",f).shared,[r,i]=b(!1),s=w(null);/* @__PURE__ */
|
|
2
|
+
return $(F,{open:!0,role:"alertdialog",size:"sm",title:l.deleteTitle({name:e}),onClose:o,initialFocus:s,footer:/* @__PURE__ */x(D,{children:[
|
|
3
|
+
/* @__PURE__ */$(N,{ref:s,variant:"secondary",onClick:o,children:l.cancel}),
|
|
4
|
+
/* @__PURE__ */$(N,{variant:"danger",loading:r,onClick:()=>{(async()=>{i(!0);try{await n()}finally{i(!1)}})()},children:l.deleteShared})]}),children:l.deleteMessage({count:t})})}var I=e=>`section:${e}`,O=e=>`block:${e}`,S=e=>`template:${e}`,B=e=>`shared:${e}`;function E({at:w,placeBlocks:F,canTake:N,onPick:E,itemFor:L,session:P,siteWide:z,onClose:Q,onHide:R,readOnly:U}){const V=u(e=>e.config),W=a(),{labelAtLevel:Y,categoryLabel:G,firstSection:K,Icon:Z,Thumbnail:_}=W,{blockIsOffered:J,canAddTo:X}=d(),q=h("screen",f).add,ee=h("drag",g).add,te=m(),[ne,oe]=b([]);v(()=>{let e=!1;const t=e=>J(e,te);return l(te).list().then(n=>{if(e)return;const l=V.components;oe(n.filter(e=>e.node?.type&&l[e.node.type]&&o(e.node).every(t)))}).catch(()=>{}),()=>{e=!0}},[V,te]);const le=p().shared,re=h("screen",f).shared,[ie,se]=b([]),[ce,ae]=b(0);v(()=>{if(!le)return;let e=!1;const t=e=>J(e,te);return r(te).list().then(n=>{if(e)return;const l=V.components;se(n.filter(e=>e.node?.type&&l[e.node.type]&&o(e.node).every(t)))}).catch(()=>{}),()=>{e=!0}},[V,te,ce]);const[de,pe]=b(null),[me,fe]=b(null),ue=j(()=>e(V,W),[V]),ye=e=>Y(e,"section",V.components[e]?.label??e),he=e=>({type:I(e.type),label:e.name,cover:/* @__PURE__ */$(_,{type:e.type}),title:e.desc?`${e.name} — ${e.desc}`:q.tile({name:e.name}),keywords:[e.alias??"",e.desc,e.type,e.catLabel].filter(Boolean)}),ke=e=>{const t=e.indexOf(":"),n=e.slice(0,t),o=e.slice(t+1);if("section"===n)return{kind:"section",type:o};if("block"===n)return{kind:"block",type:o};if("template"===n){const e=ne.find(e=>e.id===o);return e?{kind:"template",template:e}:null}if("shared"===n){const e=ie.find(e=>e.id===o);return e?{kind:"shared",section:e}:null}return null},ge=e=>/* @__PURE__ */$("span",{className:"es-add-glyph-cover",children:/* @__PURE__ */$(Z,{type:e,size:26})}),be=j(()=>{const e=t(ue,K),o=/* @__PURE__ */new Map,l=e=>{e.retired||o.has(e.type)||!J(e.type,te)||o.set(e.type,e)};for(const t of e?[e]:ue){const e=X(t.type)?.choices??[];e.forEach(l),e.forEach(e=>X(e.type,1)?.choices?.forEach(l))}F?.forEach(l);const r=new Set(ue.map(e=>e.type)),i=[...o.values()].filter(e=>!r.has(e.type)),s=e=>({type:O(e.type),label:e.label,cover:ge(e.type),title:q.tile({name:e.label}),keywords:[e.group??"",e.type].filter(Boolean)}),a=e=>o.has(e.type)?{...he(e),cover:ge(e.type)}:he(e),d=[];ie.length>0&&d.push({key:"shared",title:re.group,tiles:ie.map(e=>({type:B(e.id),label:e.title,cover:/* @__PURE__ */$(_,{type:e.node.type}),mark:/* @__PURE__ */$(C,{size:12}),title:re.onPages({count:e.used_on.length}),keywords:[ye(e.node.type),e.node.type]}))}),ne.length>0&&d.push({key:"templates",title:q.templates,tiles:ne.map(e=>({type:S(e.id),label:e.name,cover:/* @__PURE__ */$(_,{type:e.node.type}),keywords:[ye(e.node.type),e.node.type]}))});const p=i.filter(e=>!e.group);let m=!1;for(const t of Object.keys(V.categories??{})){const o=ue.filter(e=>e.cat===t);if(0===o.length)continue;const l=e&&o.some(t=>t.type===e.type)?e:null,r=(l?[l,...o.filter(e=>e.type!==l.type)]:o).map(a);l&&!m&&(r.splice(1,0,...p.map(s)),m=!0),d.push({key:`category:${t}`,title:n(V,t,G),tiles:r})}const f=d.find(e=>e.key?.startsWith("category:"));if(!m&&f&&p.length>0&&(f.tiles=[...f.tiles,...p.map(s)],m=!0),c(i.filter(e=>e.group||!m)).forEach((e,t)=>{d.push({key:`blocks:${t}`,title:e.group??"",tiles:e.items.map(s)})}),!N)return d;const u=d.map(e=>({...e,tiles:e.tiles.map(e=>{const t=ke(e.type),n=t?N(t):null;return n?{...e,disabled:!0,disabledReason:n}:e})})),y=e=>e.tiles.some(e=>!e.disabled);return[...u.filter(y),...u.filter(e=>!y(e))]},[ne,ie,re,ue,V,q,N,F,te]);/* @__PURE__ */
|
|
5
|
+
return x(D,{children:[
|
|
6
|
+
/* @__PURE__ */$(i,{icon:/* @__PURE__ */$(M,{size:15}),title:q.title,context:q.contextAll,actions:/* @__PURE__ */$(s,{label:q.done,description:q.doneDescription,onClick:Q}),onHide:R}),
|
|
7
|
+
/* @__PURE__ */x("div",{className:"sf-addside sf-scroll",children:[
|
|
8
|
+
/* @__PURE__ */$(k,{groups:be,session:P,itemFor:e=>L(ke(e)??{kind:"section",type:e}),onInsert:E?e=>{const t=ke(e);t&&E(t)}:void 0,onTileMenu:(e,t)=>{const n=ke(e);return"shared"===n?.kind&&!U&&(pe({section:n.section,...t}),!0)},at:w,hint:q.hint,searchLabel:q.search,readOnly:U,words:ee}),z??null]}),de?/* @__PURE__ */$(T,{at:{x:de.x,y:de.y},owner:de.owner,onClose:()=>pe(null),"aria-label":de.section.title,items:y([{label:re.deleteShared,danger:!0,onClick:()=>{fe(de.section),pe(null)}}])}):null,me?/* @__PURE__ */$(H,{name:me.title,pages:me.used_on.length,onDelete:()=>(async e=>{try{await r(te).remove(e.id)}catch{return void A.error(re.deleteFailed)}fe(null),le?.removed?.(e),se(t=>t.filter(t=>t.id!==e.id)),ae(e=>e+1)})(me),onCancel:()=>fe(null)}):null]})}export{E as AddSidePanel,O as blockKey,I as sectionKey,B as sharedKey,S as templateKey};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{useScreenBlockRules as e}from"./chunk-FCRNT5PM.js";import{useEasel as t,useEaselApi as n}from"./chunk-M5Q4VYOH.js";import{newNodeId as o,ROOT_ZONE as r}from"./chunk-PLVEGYK6.js";import{useMemo as s}from"react";function i(i={}){const{dispatch:p}=t(e=>e),d=n(),c=!0===i.readOnly,a=e().resolveOnInsert,l=!0===(i.resolveOnInsert??a),m=!0===i.foldIntoHistory;return s(()=>{const e=m?e=>p({...e,recordHistory:!1}):p,t=(t,n,r)=>{const s=o(n);return c||e({type:"insert",componentType:n,destinationZone:t,destinationIndex:r,id:s}),s},n=e=>(l&&!c&&d.resolveNode(e,{trigger:"insert"}),e),s=(t,n,o)=>{c||e({type:"replace",destinationZone:t,destinationIndex:n,data:o})},i=(e,o,r)=>n(t(e,o,r));return{insertComponent:i,insertSection:(e,t)=>i(r,e,t),replaceComponent:s,seedChild:(e,o,r,i)=>{const p=t(e,r,o);s(e,o,{type:r,props:{id:p,...i}}),n(p)},insertNode:(e,o,r)=>{const i=t(e,r.type,o);return s(e,o,{type:r.type,props:{...r.props,id:i}}),n(i)},removeComponent:(t,n)=>{c||e({type:"remove",index:n,zone:t})},reorderComponent:(t,n,o)=>{c||e({type:"reorder",sourceIndex:n,destinationIndex:o,destinationZone:t})},duplicateComponent:(t,n)=>{c||e({type:"duplicate",sourceIndex:n,sourceZone:t})},select:e=>p({type:"setUi",ui:{itemSelector:e}}),setDocument:t=>{c||e({type:"setData",data:t})},commitDocument:(t,n)=>{c||(m?d.batch(()=>{e({type:"setData",data:t}),void 0!==n&&("slot"===n?.kind?d.selectSlot({parentId:n.parentId,slot:n.slot}):d.select(n?n.id:null))}):d.run({data:t,select:n}))}}},[p,c,l,d,m])}export{i as useSectionOps};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{
|
|
1
|
+
import{isPreviewClick as t}from"./chunk-R5L2E7JX.js";import{HERO_SLIDER_GOTO_EVENT as e}from"./chunk-IQ5TA7AM.js";var n=()=>document.querySelector(".sf-editor #preview-frame");function o(e){t()||requestAnimationFrame(()=>{n()?.contentDocument?.querySelector(`[data-puck-component="${CSS.escape(e)}"]`)?.scrollIntoView({behavior:"smooth",block:"start"})})}function r(t,o){const r=n()?.contentWindow;if(!r)return;const c={id:t,index:o};r.dispatchEvent(new CustomEvent(e,{detail:c}))}function c(){requestAnimationFrame(()=>{n()?.contentWindow?.scrollTo({top:0,behavior:"smooth"})})}function u(t,{passes:e=[150,400],onPinned:o}={}){let r=0,c=!1;const u=[],i=()=>{const r=n(),s=r?.contentWindow,l=r?.contentDocument;if(!s||!l)return!1;const a=t(s,l);if(null==a)return!1;if(s.scrollTo({left:s.scrollX,top:a,behavior:"instant"}),!c){c=!0,o?.();for(const t of e)u.push(setTimeout(i,t))}return!0},s=()=>{!i()&&r++<150&&u.push(setTimeout(s,32))};return s(),()=>u.forEach(clearTimeout)}function i(t){return u((e,n)=>{const o=n.querySelector(`[data-puck-component="${CSS.escape(t)}"]`);return o?e.scrollY+o.getBoundingClientRect().top:null})}function s(t){return u((t,e)=>{if(!e.querySelector("[data-puck-component]"))return null;const n=Math.max(e.documentElement.scrollHeight,e.body?.scrollHeight??0);return n<=e.documentElement.clientHeight?null:n},{passes:[150,400,800,1300,2e3],onPinned:t})}export{r as gotoPreviewSlide,s as pinPreviewToBottom,i as pinPreviewToSection,n as previewFrame,o as scrollPreviewToSection,c as scrollPreviewToTop};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{useScreenDocument as n}from"./chunk-
|
|
1
|
+
import{useScreenDocument as n}from"./chunk-M62P4IQK.js";import{DEFAULT_SCREEN_WORDS as o}from"./chunk-23DYNW6S.js";import{EditNotice as r}from"./chunk-ZG6PVMC3.js";import{useWords as e}from"./chunk-MFIRYGHW.js";import{jsx as i}from"react/jsx-runtime";function t(){const{capabilities:t,access:c,takeOverEditing:a,viewReadOnly:s,saveConflict:m,reloadFromServer:u}=n(),{noun:l}=e("screen",o);return t.hasEditGuard?/* @__PURE__ */i(r,{access:c,conflict:m,noun:l,onTakeOver:a,onViewReadOnly:s,onReload:u}):null}export{t as PageEditGuardNotices};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{useSectionOps as o}from"./chunk-3WLT3GQS.js";import{SELECTION_MODE as e}from"./chunk-FCRNT5PM.js";import{useEasel as r}from"./chunk-M5Q4VYOH.js";import{usePreviewParts as t}from"./chunk-I54UCYOU.js";import{decodePartId as n,encodePartId as p}from"./chunk-IYT6NN2J.js";import{useCallback as d,useEffect as c}from"react";var s=o=>"part"===o.kind;function m({mode:m,setMode:i,onOpenPart:a}){const{getSelectorForId:u}=r(o=>o),I=o(),{setSelectedPartId:f,setSelectHandler:k}=t(),l=d(o=>{const r=n(o);if(!r)return;const{nodeId:t,propKey:p}=r;p?(i(o=>s(o)&&o.nodeId===t&&o.propKey===p?o:{kind:"part",nodeId:t,propKey:p}),a?.(t)):i(o=>"part"===o.kind?e:o)},[i,a]);c(()=>{k(l)},[k,l]);const h=s(m)?p(m.nodeId,m.propKey):null;c(()=>{f(h)},[h,f]);return{selectNode:d(o=>{i(()=>e);const r=u(o);r&&I.select(r)},[i,u,I]),openPartId:h}}export{m as usePartBridge};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{blockRuns as e,offeredChoices as r}from"./chunk-M2Z775ZC.js";import{useScreenBlockLook as s}from"./chunk-
|
|
1
|
+
import{blockRuns as e,offeredChoices as r}from"./chunk-M2Z775ZC.js";import{useScreenBlockLook as s}from"./chunk-FCRNT5PM.js";import{DEFAULT_SCREEN_WORDS as t}from"./chunk-23DYNW6S.js";import{useWords as n}from"./chunk-MFIRYGHW.js";import{DropdownMenu as c}from"efficient-shell/ui";import{jsxs as i,Fragment as o,jsx as l}from"react/jsx-runtime";function p({choices:p,onPick:a}){const{Icon:m}=s(),u=n("screen",t),f=e(r(p)).flatMap(e=>[...e.group?[{type:"label",key:`group:${e.group}`,label:/* @__PURE__ */i(o,{children:[e.group," ",
|
|
2
2
|
/* @__PURE__ */l("span",{className:"sf-menugroup-count",children:e.items.length})]})}]:[],...e.items.map(e=>({key:e.type,label:e.label,icon:/* @__PURE__ */l("span",{className:"sf-chip",children:/* @__PURE__ */l(m,{type:e.type,size:13})}),onSelect:()=>a(e.type)}))]);/* @__PURE__ */
|
|
3
3
|
return l(c,{align:"start",triggerClassName:"sf-add-card",items:f,trigger:/* @__PURE__ */i(o,{children:[
|
|
4
4
|
/* @__PURE__ */l("span",{className:"sf-plus sf-plus--sm",children:"+"}),u.addBlockMenu]})})}export{p as AddBlockRow};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
var e={reload:"Reload the saved version",takeOver:"Take over editing",takeBack:"Take it back",viewReadOnly:"View read-only",savedByYou:({noun:e,when:n})=>`You saved this ${e} in another tab or window ${n}.`,savedByOther:({name:e,noun:n,when:o})=>`${e} saved this ${n} ${o}.`,conflictBody:"Your last change was not saved. It is still on screen here, but this copy is out of date — copy anything you need, then reload to carry on from the saved version.",takeOverWhileDeciding:"Nobody else can save while you decide. Nothing on your screen is lost.",tookOver:({name:e,noun:n,when:o})=>`${e} took over this ${n} ${o}.`,tookOverBody:"Your changes since then are still on screen but are no longer being saved.",viewingOnly:"Viewing only.",viewingOnlyBody:({name:e,noun:n,seen:o})=>`${e} is editing this ${n} (last seen ${o}). Nothing you change here is saved.`,editing:({name:e,noun:n})=>`${e} is editing this ${n}`,editingBody:({seen:e})=>`(last seen ${e}). Nothing you change here will be saved while they are in it.`,takeOverTold:"They are told straight away and stop being able to save."},n={device:"Preview device",upLevel:"Go up one level",upLevelTo:({label:e,name:n})=>`${e} to ${n}`,resize:"Drag to resize · double-click to reset",tierSection:"Section",tierBlock:"Block",partOf:({name:e})=>`Part of ${e}`,mediaLibrary:"Media library",hidePanel:"Hide panel",hidePanelLabel:({side:e})=>`Hide the ${e} panel`,showPanel:"Show panel",showPanelLabel:({side:e})=>`Show the ${e} panel`};export{n as DEFAULT_CHROME_WORDS,e as DEFAULT_NOTICE_WORDS};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{DEFAULT_PANEL_W as s,clampPanelWidth as e}from"./chunk-ZG6PVMC3.js";var a="sf-editor-panel-widths",l="sf-editor-collapsed-sections";function t(s){return s?{panelWidths:`${s}-panel-widths`,collapsed:`${s}-collapsed-sections`}:{panelWidths:a,collapsed:l}}var o={...s},d=(s,a)=>e(s,a);export{l as COLLAPSED_SECTIONS_KEY,o as DEFAULT_PANEL_W,a as PANEL_WIDTHS_KEY,d as clampPanelWidth,t as screenStorageKeys};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{resolveMediaPick as e}from"./chunk-
|
|
1
|
+
import{resolveMediaPick as e}from"./chunk-RYNBSKE7.js";function t(t){const r=t;switch(r?.type){case"storefront-editor:media-picked":{const r=t;return r.requestId&&e(r.requestId,r.media??null),!0}case"storefront-editor:media-pick-cancelled":{const r=t;return r.requestId&&e(r.requestId,null),!0}default:return!1}}export{t as routeSharedHostMessage};
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import{usePickFollowsSelection as n}from"./chunk-LNHT2KPX.js";import{EaselCanvas as e,useSelectedFields as t}from"./chunk-M5Q4VYOH.js";import{Inspector as r}from"./chunk-5ZBV5RA6.js";import{slotFieldsOf as i}from"./chunk-PLVEGYK6.js";import{createContext as o,useContext as u}from"react";import{DesktopIcon as l}from"efficient-shell/icons/efficient";import{jsx as s}from"react/jsx-runtime";var c={kind:"puck"};function f(n,e){const t=n,r=e,i=Object.keys(t);return i.length===Object.keys(r).length&&i.every(n=>Object.is(t[n],r[n]))}function a(n){const e=n;return"string"==typeof e.nodeId&&"string"==typeof e.slot}function d(n,e,t){const r=n.slotsOf?.(t);return r||i(e,t.type).map(n=>({slot:n,label:n,rung:!1}))}function p(n,e){return n.isFirst?n.isFirst(e):e.type===n.first}function m(n,e){return n.isLast?n.isLast(e):e.type===n.last}var k={},h=()=>k,v=()=>"",g=()=>null,y=()=>{},b={isLockedBlock:()=>!1,duplicateBlocked:()=>null,nestDepth:()=>0,newSectionNode:()=>null,canAddTo:()=>null,blockIsOffered:()=>!0},O={labelAtLevel:(n,e,t)=>t,descriptions:{},categoryLabel:()=>{},firstSection:null,blockRowName:(n,e)=>e(n.type),plainText:n=>n,Icon:()=>null,Thumbnail:()=>null,useProducts:()=>null},L={options:[{id:"desktop",label:"Desktop",icon:/* @__PURE__ */s(l,{})}],initial:"desktop",fluid:"desktop",widths:{desktop:2e3}},j={read:()=>"sections",write:()=>{},forSelection:(n,e)=>n?"sections":e},w={first:null,last:null,firstGroup:null,lastGroup:null,isSectionGroup:()=>!1,sectionGroupZone:()=>"",panelOf:()=>null};function P(){/* @__PURE__ */
|
|
2
|
+
return s(e,{height:"fill"})}function S(){const{id:n,fields:e,values:i,readOnly:o,onChange:u}=t();/* @__PURE__ */
|
|
3
|
+
return s("div",{className:"es-sidepanel es-sidepanel--right",children:/* @__PURE__ */s(r,{fields:e,values:i,onChange:u,readOnly:o,idPrefix:n})})}var N=o({});function B({parts:n,children:e}){/* @__PURE__ */
|
|
4
|
+
return s(N.Provider,{value:n,children:e})}function C(){return u(N)}function D(){return(C().useOwnerName??v)()}function G(){return(C().useDocumentLabel??g)()}function x(n,e,t,r){return(C().useBridges??h)(n,e,t,r)}function I(n){return(C().useStandaloneBridges??h)(n)}function T(n,e){(C().useDocumentPass??y)(n,e)}function V(){return C().blockRules??b}function A(){return C().blockLook??O}function F(){return C().devices??L}function H(){return C().leftView??j}function K(){return C().pinned??w}function R(){return C().saveSwitch??!0}function Y(e){n(!0===C().pickFollowsSelection,e)}function Z(){return C().storageNamespace||void 0}function E(){return C().styleClipboard??null}function M(){return C().nodeKeys??!0}function Q(){return C().notify??null}function X(){return C().Canvas??P}function q(){return C().CanvasHead??null}function z(){return C().canvasDrag??null}var J=o(null);function U({target:n,children:e}){/* @__PURE__ */
|
|
5
|
+
return s(J.Provider,{value:n,children:e})}function W(){return u(J)}function $(){return C().Inspector??S}export{c as SELECTION_MODE,U as ScreenCanvasTargetProvider,B as ScreenPartsProvider,p as isPinnedFirst,m as isPinnedLast,a as isSlotMode,f as sameInspectorMode,d as screenSlotsOf,A as useScreenBlockLook,V as useScreenBlockRules,x as useScreenBridges,z as useScreenCanvasDrag,X as useScreenCanvasFrame,q as useScreenCanvasHead,W as useScreenCanvasTarget,F as useScreenDevices,G as useScreenDocumentLabel,T as useScreenDocumentPass,$ as useScreenInspectorPanel,H as useScreenLeftView,M as useScreenNodeKeys,Q as useScreenNotify,D as useScreenOwnerName,C as useScreenParts,Y as useScreenPickFollowsSelection,K as useScreenPinned,R as useScreenSaveSwitch,Z as useScreenStorageNamespace,E as useScreenStyleClipboard,I as useStandaloneScreenBridges};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{noControlField as e}from"./chunk-7F52SZOI.js";import{DEFAULT_SCREEN_WORDS as n}from"./chunk-
|
|
1
|
+
import{noControlField as e}from"./chunk-7F52SZOI.js";import{DEFAULT_SCREEN_WORDS as n}from"./chunk-23DYNW6S.js";import{useWords as r}from"./chunk-MFIRYGHW.js";import{usePreviewDevice as t}from"./chunk-BSPCSC45.js";import{jsx as o}from"react/jsx-runtime";function i(e){return"mobile"===e?"mobile":"desktop"}var c={desktop:null,tablet:n.deviceNote.tablet,mobile:n.deviceNote.mobile},u="data-sf-device-hidden";function d(){/* @__PURE__ */
|
|
2
2
|
return o("span",{hidden:!0,[u]:""})}function s({tier:e,render:n,...r}){return i(t())===e?/* @__PURE__ */o(n,{...r}):/* @__PURE__ */o(d,{})}var m="__device";function f(e){const n=e?.[m];return n??null}function l(e){return f(e)?.inner??e}function a(e,n){const r=n.render;return{...n,[m]:{tier:e,inner:n},render:n=>/* @__PURE__ */o(s,{tier:e,render:r,...n})}}function p(){const e=r("screen",n).deviceNote,i=t(),c="desktop"===i?null:e[i];return c?/* @__PURE__ */o("div",{className:"sf-device-scope",children:c}):/* @__PURE__ */o(d,{})}function v(){return e({type:"custom",render:()=>/* @__PURE__ */o(p,{})},"always")}export{m as DEVICE_FIELD_MARKER,u as DEVICE_HIDDEN_ATTR,c as DEVICE_NOTE,a as deviceField,f as deviceMetaOf,v as deviceNote,i as shownTier,l as withoutDeviceGate};
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
import{cloneNodeWithFreshIds as e}from"./chunk-2GVCAIPX.js";import{dedupeSlotChildren as n}from"./chunk-26OOWIJJ.js";import{styleClipboardOf as t}from"./chunk-JBOSEHIX.js";import{markedTreeNodeId as o,revealSelectedTreeRow as r,sameSelector as i}from"./chunk-FGNR22NY.js";import{scrollPreviewToSection as l,gotoPreviewSlide as s,scrollPreviewToTop as d}from"./chunk-3Z2MVLCD.js";import{useEaselKeyTarget as a,useEaselUndoKeys as c,useEaselSaveKey as p,editorRootFocus as u}from"./chunk-LBOJCTTC.js";import{SlotChildActionsProvider as f}from"./chunk-KCBEE2MC.js";import{screenStorageKeys as h,DEFAULT_PANEL_W as m,clampPanelWidth as g}from"./chunk-C56MPJBH.js";import{usePartBridge as y}from"./chunk-5Z6KYASQ.js";import{useSectionOps as k}from"./chunk-3WLT3GQS.js";import{ScreenSaveIcon as v,ScreenMainButton as S}from"./chunk-PY7OOQEZ.js";import{useBrowserOffline as b}from"./chunk-RKTF5XLP.js";import{AddChildRow as w}from"./chunk-5545A3PC.js";import{AddSidePanel as x}from"./chunk-32JJK7PQ.js";import{keepsSharedSections as z,sharedSectionsOf as C}from"./chunk-43AEUUNQ.js";import{SidePanelHead as O,PanelShowStrip as N}from"./chunk-SINAM2IT.js";import{offeredChoices as I}from"./chunk-M2Z775ZC.js";import{useScreenSaveSwitch as B,useScreenNodeKeys as P,useScreenPinned as M,useScreenDocumentLabel as $,useScreenCanvasFrame as T,useScreenInspectorPanel as j,useScreenDevices as L,useScreenPickFollowsSelection as A,useScreenLeftView as E,SELECTION_MODE as R,sameInspectorMode as F,useScreenBridges as D,useScreenBlockRules as V,useScreenBlockLook as H,useScreenStorageNamespace as W,useScreenNotify as J,useScreenCanvasHead as U,isSlotMode as Y,useScreenStyleClipboard as G,useScreenDocumentPass as K,useScreenCanvasDrag as X,ScreenCanvasTargetProvider as Q,isPinnedFirst as Z,isPinnedLast as q,screenSlotsOf as _}from"./chunk-FCRNT5PM.js";import{MediaPopup as ee}from"./chunk-MS2U6MV5.js";import{useNodeClipboard as ne,useNodeContextMenu as te}from"./chunk-Y6RJAOFH.js";import{PageEditGuardNotices as oe}from"./chunk-5DPIGWUL.js";import{useScreenDocument as re}from"./chunk-M62P4IQK.js";import{requestMediaPick as ie}from"./chunk-RYNBSKE7.js";import{useMediaPanel as le,usePanelPick as se,useMediaBrowsing as de,useOpenMediaBrowse as ae,useMediaPlace as ce}from"./chunk-LNHT2KPX.js";import{useEaselSession as pe}from"./chunk-O7Q4DDJT.js";import{useEaselHost as ue,useHostEscape as fe}from"./chunk-U3JP4VGF.js";import{LayersIcon as he,MediaIcon as me}from"./chunk-4VJATVVR.js";import{DEFAULT_SCREEN_WORDS as ge}from"./chunk-23DYNW6S.js";import{heldStyle as ye,styleShortcut as ke}from"./chunk-V7U33NF2.js";import{DEFAULT_STYLE_CLIPBOARD_WORDS as ve}from"./chunk-6WY6ZXJG.js";import{useEasel as Se,useEaselApi as be,CanvasPassThroughContext as we,CanvasSharedContext as xe}from"./chunk-M5Q4VYOH.js";import{TreeRow as ze,Subtree as Ce,LayersTree as Oe,TreeGroupLabel as Ne,TreeRowAction as Ie,TreeSeam as Be}from"./chunk-A6Z4SD3I.js";import{DEFAULT_TREE_WORDS as Pe}from"./chunk-K56YDHYQ.js";import{DEFAULT_NODE_MENU_WORDS as Me}from"./chunk-WK3AFPXY.js";import{toItemSelector as $e,useNodeOps as Te,clickPick as je}from"./chunk-X3TYRF5V.js";import{EaselTopBar as Le,TopBarRail as Ae,TopBarCluster as Ee,EaselIconButton as Re,TopBarDivider as Fe,DeviceSwitch as De,InspectorIconButton as Ve,PanelResizeHandle as He,MAX_PANEL_W as We,MIN_PANEL_W_BY_SIDE as Je,panelWidthVars as Ue}from"./chunk-ZG6PVMC3.js";import{DEFAULT_NOTICE_WORDS as Ye,DEFAULT_CHROME_WORDS as Ge}from"./chunk-AJSDWWJW.js";import{holderOf as Ke,nameOrSomeone as Xe}from"./chunk-THWO5YVZ.js";import{DEFAULT_LOCK_WORDS as Qe}from"./chunk-RE4LP46F.js";import{useWords as Ze}from"./chunk-MFIRYGHW.js";import{insertSeams as qe,CanvasDragLayer as _e,CanvasInsert as en}from"./chunk-SGFDUXUH.js";import{DEFAULT_DRAG_WORDS as nn}from"./chunk-KAML3KQH.js";import{createDragSession as tn,useTreeDrag as on,gapToMoveIndex as rn}from"./chunk-67GNT6PF.js";import{ROOT_ID as ln,ROOT_SLOT as sn,zoneKey as dn,parseZoneKey as an,find as cn,DataError as pn}from"./chunk-KRXQM65X.js";import{useCanvasFrame as un,LIST_SELECTOR as fn,BLOCK_SELECTOR as hn,useCanvasTyping as mn,useCanvasEvent as gn,nodeIdAt as yn,frameRectToHost as kn,BLOCK_ATTRIBUTE as vn,drawnBox as Sn}from"./chunk-X4T6JT3M.js";import{rootRowName as bn,slotChildRowName as wn,slotChildRenameProp as xn,sectionRenameProp as zn}from"./chunk-BHRC3ASL.js";import{ROOT_ZONE as Cn,blockNodeActions as On,TREE_MAX_DEPTH as Nn,childSlotsOf as In,slotFieldsOf as Bn,newNodeId as Pn,slotChildrenIn as Mn,nestsInTree as $n}from"./chunk-PLVEGYK6.js";import{useRef as Tn,useMemo as jn,useState as Ln,useEffect as An,useCallback as En,useLayoutEffect as Rn,Fragment as Fn,useId as Dn}from"react";import{ColoredBadge as Vn,toast as Hn,readMediaFileDrag as Wn,Tooltip as Jn,groupColors as Un,Dialog as Yn,FormField as Gn,Input as Kn,Button as Xn,MEDIA_FILE_DRAG_TYPE as Qn}from"efficient-shell/ui";import{UndoIcon as Zn,RedoIcon as qn,RefreshIcon as _n,AddIcon as et,TrashIcon as nt,EyeOffIcon as tt,EyeIcon as ot,SharedIcon as rt,DuplicateIcon as it}from"efficient-shell/icons/efficient";import{jsx as lt,jsxs as st,Fragment as dt}from"react/jsx-runtime";var at="media-file";function ct({name:e,onMake:n,onCancel:t}){const o=Ze("screen",ge).shared,[r,i]=Ln(e),[l,s]=Ln(!1),d=Dn(),a=Tn(null),c=async()=>{const e=r.trim();if(e&&!l){s(!0);try{await n(e)}finally{s(!1)}}};/* @__PURE__ */
|
|
2
|
+
return lt(Yn,{open:!0,size:"sm",title:o.makeShared,description:o.makeSharedHint,onClose:t,initialFocus:a,footer:/* @__PURE__ */st(dt,{children:[
|
|
3
|
+
/* @__PURE__ */lt(Xn,{variant:"secondary",onClick:t,children:o.cancel}),
|
|
4
|
+
/* @__PURE__ */lt(Xn,{variant:"primary",loading:l,disabled:!r.trim(),onClick:()=>{c()},children:o.makeShared})]}),children:/* @__PURE__ */lt("form",{onSubmit:e=>{e.preventDefault(),c()},children:/* @__PURE__ */lt(Gn,{label:o.name,htmlFor:d,children:/* @__PURE__ */lt(Kn,{id:d,ref:a,value:r,onChange:e=>i(e.target.value)})})})})}var pt=/* @__PURE__ */new WeakSet;function ut(e,n,t){const o=cn(e,n,t);if(!o)return null;const r=o.path.find(e=>"root"!==e.parentId);return r?r.parentId:t}function ft({canvas:e,tabs:n,onSelect:t}){const o=Tn(null),[r,i]=Ln({}),l=n.map(e=>`${e.id}:${e.below?1:0}`).join("|");return Rn(()=>{const t=e?.document,r=e?.window,l=e?.frame;if(!t||!r||!l||0===n.length)return void i({});let s=0;const d=()=>{s=0;const e=o.current;if(!e)return;const d=kn(l,{left:0,top:0,width:r.innerWidth,height:r.innerHeight},e),a={};for(const o of n){const n=t.querySelector(`[${vn}="${r.CSS?.escape?r.CSS.escape(o.id):o.id}"]`),i=n?Sn(n):null;if(!i||0===i.height){a[o.id]=null;continue}const s=kn(l,{left:i.left,top:i.top,width:i.width,height:i.height},e),c=s.top+s.height;if(c<d.top||s.top>d.top+d.height){a[o.id]=null;continue}const p=o.below?c+4:Math.max(s.top,d.top)+6;a[o.id]={left:Math.max(s.left,d.left)+6,top:p}}i(a)},a=()=>{s||(s=r.requestAnimationFrame(d))};d(),r.addEventListener("scroll",a,!0),r.addEventListener("resize",a);const c=new r.MutationObserver(a);return c.observe(t.body,{childList:!0,subtree:!0,attributes:!0}),()=>{s&&r.cancelAnimationFrame(s),r.removeEventListener("scroll",a,!0),r.removeEventListener("resize",a),c.disconnect()}},[e,l]),/* @__PURE__ */lt("div",{ref:o,className:"es-band-tabs","aria-hidden":"true",children:n.map(e=>{const n=r[e.id];return n?/* @__PURE__ */lt("span",{className:"es-band-tab","data-band-tab":e.id,style:{left:n.left,top:n.top},onClick:n=>{n.stopPropagation(),t(e.id)},children:e.reach?
|
|
5
|
+
/* @__PURE__ */lt(Jn,{content:e.reach,children:/* @__PURE__ */st(Vn,{colorClass:Un("success","solid"),size:"sm",children:[
|
|
6
|
+
/* @__PURE__ */lt("span",{className:"es-band-tab-mark",children:/* @__PURE__ */lt(rt,{size:12})}),e.label]})}):/* @__PURE__ */lt(Vn,{colorClass:Un("info","solid"),size:"sm",children:e.label})},e.id):null})})}function ht({expand:e}){/* @__PURE__ */
|
|
7
|
+
return lt("svg",{width:"15",height:"15",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:1.9,strokeLinecap:"round",strokeLinejoin:"round",children:/* @__PURE__ */st(dt,e?{children:[
|
|
8
|
+
/* @__PURE__ */lt("path",{d:"M8 9l4-4 4 4"}),
|
|
9
|
+
/* @__PURE__ */lt("path",{d:"M8 15l4 4 4-4"})]}:{children:[
|
|
10
|
+
/* @__PURE__ */lt("path",{d:"M8 4l4 4 4-4"}),
|
|
11
|
+
/* @__PURE__ */lt("path",{d:"M8 20l4-4 4 4"}),
|
|
12
|
+
/* @__PURE__ */lt("path",{d:"M5 12h14"})]})})}var mt=`${fn}, ${hn}`;function gt(e,n,t){const o=t-n;if(o<6)return null;if(o<24)return{top:Math.round((n+t)/2),height:Math.round(o)};return{top:Math.round(Math.min(Math.max(e,n+12),t-12))}}var yt="__rungs";var kt="screen:band",vt={duplicate:!0,delete:!0};function St(){const fn=ue(),{target:kn,docId:vn,capabilities:Sn,currentSlug:Dn,siteId:Jn,onPublish:Un,saveState:Yn,saveConflict:Gn,retrySave:Kn,toggleAutoSave:Xn,flushSave:rt,access:St,saveUnreachable:bt=!1,readOnly:wt,readOnlyReason:xt=null}=re(),zt=B(),Ct=P(),{mediaEditing:Ot,hasEditGuard:Nt,hasPinnedChrome:It}=Sn,{appState:Bt,dispatch:Pt,history:Mt,selectedItem:$t,getSelectorForId:Tt,config:jt}=Se(e=>e),Lt=M(),{first:At,firstGroup:Et,lastGroup:Rt,isSectionGroup:Ft,sectionGroupZone:Dt,panelOf:Vt}=Lt,Ht=Vt(At),Wt=e=>Z(Lt,e),Jt=e=>q(Lt,e),Ut="node"===Lt.firstRow,Yt=Lt.band??null,Gt=Ze("screen",ge),Kt=Ze("tree",Pe),Xt=Ze("drag",nn),Qt=Ze("notice",Ye),Zt=Ze("lock",Qe),qt=Ze("menu",Me),_t=Ze("styleClipboard",ve),eo=Ze("chrome",Ge),no=$()??`/${Dn}`,to=T(),oo=j(),ro=k({readOnly:wt}),io=k({readOnly:wt,foldIntoHistory:!0}),lo=Tn(null),so=be(),ao=jn(()=>({...ro,select:e=>{lo.current=e,ro.select(e)},commitDocument:(e,n)=>{if(void 0!==n){const t=so.config;lo.current=$e(e,t,n)}ro.commitDocument(e,n)}}),[ro,so]),co=Bt.ui,po=co.leftSideBarVisible,uo=co.rightSideBarVisible,{options:fo,widths:ho,initial:mo,fluid:go,fit:yo}=L(),[ko,vo]=Ln(mo),So=le(),bo=Ot&&null!==So,wo=se(),xo=de(),zo=null!==wo||xo,Co=ae();A($t?.props.id);const{read:Oo,write:No,forSelection:Io}=E(),[Bo,Po]=Ln(Oo);An(()=>{No(Bo)},[Bo]);const[Mo,$o]=Ln(0),To=Tn(null),jo=Tn(null),Lo=un(jo,{readySelector:mt}),Ao=mn(Lo),Eo=a(jo);c(jo,Lo);const Ro=b(),Fo=Ke(St),Do={state:Yn,offline:Ro||Yn.failed&&bt,readOnlyReason:xt,editing:Fo?Qt.editing({name:Xe(Fo.name,Zt),noun:Gt.noun}):null,conflict:null!=Gn,notSaving:Gt.bar.notSaving},Vo=()=>{wt||(Yn.failed?Kn():rt())};p(jo,Lo,Vo);const[Ho,Wo]=Ln(!1),Jo=Tn(!1),[Uo,Yo]=Ln(null),[Go,Ko]=Ln([]),[Xo,Qo]=Ln(R),Zo="puck"===Xo.kind,qo=o(Xo,$t?.props.id),[_o,er]=Ln(null);An(()=>{_o&&(r(),er(null))},[_o]);const nr=Tn(Tt);nr.current=Tt;const tr=En((e,{scroll:n})=>{Po(n=>Io(e,n)),n&&er(e);const t=[];let o=e;for(let e=0;e<4;e++){const e=nr.current(o)?.zone;if(!e||!e.includes(":"))break;const n=e.split(":")[0];t.push(n),t.push(e),o=n}0!==t.length&&Mr(e=>{if(t.every(n=>!e.has(n)))return e;const n=new Set(e);return t.forEach(e=>n.delete(e)),n})},[]),or=Tn(null);An(()=>{const e=or.current;or.current=null;const n=null==$t?.props.id?null:String($t.props.id);Qo(t=>e&&e.id===n?e.mode:"part"===t.kind&&"nodeId"in t&&t.nodeId===n?t:Vt($t?.type)??R);const t=$t?.props.id,o=lo.current;if(lo.current=null,!t)return;const r=Tt(t);tr(String(t),{scroll:!i(o,r??null,Cn)})},[$t?.props.id,tr]);const rr=En(e=>{Qo(n=>F(n,e)?n:e),Pt({type:"setUi",ui:{rightSideBarVisible:!0}})},[Pt]),ir=Tn(()=>{});ir.current=(e,n)=>{const t=e?Ii(e.zone??Cn)[e.index]?.props.id:null,o=null==t?null:String(t),r=null==$t?.props.id?null:String($t.props.id);Qo(e=>F(e,n)?e:n),o!==r&&(or.current={id:o,mode:n},ao.select(e))};const lr=En((e,n)=>ir.current(e,n),[]),sr={kind:Xo.kind,mode:Xo,open:rr,show:e=>Qo(e),reveal:()=>{uo||Pt({type:"setUi",ui:{rightSideBarVisible:!0}})},select:lr},dr=D(sr,{data:Bt.data,selected:$t??null,zoneOf:e=>Tt(e)?.zone,readOnly:Boolean(wt),select:e=>{Qo(R),ao.select({index:e})},replace:(e,n)=>ao.replaceComponent(Cn,e,n),scrollTo:e=>l(e)},{device:ko,refreshes:Mo},{setView:Po,reveal:()=>{po||Pt({type:"setUi",ui:{leftSideBarVisible:!0}})}}),ar=dr.resolveLeftView?dr.resolveLeftView(Bo):"sections",cr=V(),{isLockedBlock:pr,duplicateBlocked:ur,nestDepth:fr,newSectionNode:hr,canAddTo:mr,blockIsOffered:gr}=cr,yr=H(),{labelAtLevel:kr,Icon:vr,useProducts:Sr}=yr,br=yr.rowName?(e,n,t)=>yr.rowName(e,n,t):void 0,wr=En(e=>{Pt({type:"setUi",ui:{rightSideBarVisible:!0}}),l(e),tr(e,{scroll:!0})},[Pt,tr]),{selectNode:xr,openPartId:zr}=y({mode:Xo,setMode:Qo,onOpenPart:wr}),[Cr,Or]=Ln(null);fe(null!==Cr,()=>Or(null));const Nr=h(W()),Ir=Nr.collapsed,Br=Nr.panelWidths,[Pr,Mr]=Ln(()=>{if("undefined"==typeof window)/* @__PURE__ */return new Set;try{const e=window.localStorage.getItem(Ir);return new Set(e?JSON.parse(e):[])}catch{/* @__PURE__ */
|
|
13
|
+
return new Set}});An(()=>{try{window.localStorage.setItem(Ir,JSON.stringify([...Pr]))}catch{}},[Pr]);const[$r,Tr]=Ln(()=>{if("undefined"==typeof window)return{...m};try{const e=window.localStorage.getItem(Br);if(!e)return{...m};const n=JSON.parse(e);return{left:g(Number(n.left)||m.left,"left"),right:g(Number(n.right)||m.right,"right")}}catch{return{...m}}});An(()=>{const e=setTimeout(()=>{try{window.localStorage.setItem(Br,JSON.stringify($r))}catch{}},300);return()=>clearTimeout(e)},[$r]);const jr=En((e,n)=>Tr(t=>{const o="function"==typeof n?n(t[e]):n;return t[e]===o?t:{...t,[e]:o}}),[]),Lr=En(e=>jr("left",e),[jr]),Ar=En(e=>jr("right",e),[jr]),Er=e=>Pr.has(e),Rr=e=>Mr(n=>{const t=new Set(n);return t.has(e)?t.delete(e):t.add(e),t}),Fr=Tn(!1),Dr=Tn(null);An(()=>{if(Fr.current&&!Ho){const e=Dr.current,n=e&&e.isConnected&&!e.closest('[aria-hidden="true"]')?e:null;(n??jo.current?.querySelector(`button[aria-label="${CSS.escape(Gt.add.title)}"]`))?.focus(),Dr.current=null}Fr.current=Ho},[Ho]),An(()=>{if(!Ho||!Eo)return;const e=e=>{"Escape"===e.key&&ll()};return Eo.addEventListener("keydown",e),()=>Eo.removeEventListener("keydown",e)},[Ho,Eo]),fe(Ho,()=>ll()),An(()=>{!po&&Ho&&(Wo(!1),Yo(null),Jo.current=!1)},[po]);const Vr=J(),Hr=(e,n="success",t)=>{if(Vr)return void(t?Vr(e,"error"===n?"error":"info",t):Vr(e,"error"===n?"error":"info"));const o={sound:!1,action:t?.action,onClose:t?.onClose};"error"===n?Hn.error(e,{...o,duration:t?.duration??3200}):Hn.success(e,{...o,duration:t?.duration??1900})},Wr=Tn(null),[Jr,Ur]=Ln(0),[Yr,Gr]=Ln(0),Kr=U(),Xr=Tn(null),Qr=e=>Math.max(0,e.clientHeight-(Xr.current?.offsetHeight??0));An(()=>{const e=Wr.current;if(!e)return;const n=()=>{Ur(e.clientWidth),Gr(Qr(e))};n();const t=new ResizeObserver(n);return t.observe(e),Xr.current&&t.observe(Xr.current),()=>t.disconnect()},[]),Rn(()=>{Wr.current&&(Ur(Wr.current.clientWidth),Gr(Qr(Wr.current)))},[$r,po,uo]);const Zr=ko===go?Jr>0?Jr:ho[go]:ho[ko],qr=Jr>0?Math.min(Jr/Zr,"shrink"===yo?1:2):1,_r=Zr*qr,ei=Jr>0&&_r>Jr+1,ni={width:_r,height:Yr||"100%",flex:"none",position:"relative"},ti={width:Zr,height:Yr?Yr/qr:"100%",maxHeight:"none",transform:1!==qr?`scale(${qr})`:void 0,transformOrigin:"top left"},oi=()=>Pt({type:"setUi",ui:{leftSideBarVisible:!po}}),ri=()=>Pt({type:"setUi",ui:{rightSideBarVisible:!uo}}),ii=e=>{Ho&&(Wo(!1),Yo(null),Jo.current=!1,po&&Bo===e)||(po&&Bo===e?oi():(Po(e),po||Pt({type:"setUi",ui:{leftSideBarVisible:!0}})))},li=()=>{ie(fn,{accept:"image/*",title:eo.mediaLibrary})},si=()=>{Qo(R),ao.select(null),d()},di=()=>{Qo(Ht??R),uo||Pt({type:"setUi",ui:{rightSideBarVisible:!0}})},ai=Bt.data.content??[],ci=()=>{const e=ai.findIndex(Wt),n=ai.findIndex(Jt);return{floor:e>=0?e+1:0,cap:n>=0?n:ai.length}},pi=jt,ui=cr.stripCopy,fi=n=>e(n,ui),hi=ne(),mi=Te({data:Bt.data,config:pi,readOnly:Boolean(wt),clipboard:hi,strip:ui?e=>ui(e):void 0,afterRemove:"none",stepBounds:(e,n)=>{if(e.parentId!==ln||e.slot!==sn)return{min:0,max:n-1};const{floor:t,cap:o}=ci();return{min:t,max:o-1}},commit:(e,{select:n})=>{void 0!==n&&Qo(R);const t=void 0===n||"node"===n?.kind?n:null;ao.commitDocument(e,t)}}),gi=pe(),[yi,ki]=Ln(null),vi=e=>{const n=ai.find(n=>String(n.props.id)===e),t=Lt.shared;n&&t&&mi.swap(e,t.detach(n))},Si=e=>{const n=cn(Bt.data,jt,e);if(!n)return!1;const t=dn(n.place),o=n.node,r=t===Cn?Ci(o):Fi(o),i=t===Cn?Lt.shared?.usedOn(o):null;return!!mi.remove(e)&&(Hr(i?Gt.shared.removed({count:Math.max(0,i.length-1)}):Gt.deleted({name:r}),"success",{duration:8e3,action:{label:Gt.bar.undo,onClick:()=>{mi.restore(n.node,n.place)}}}),!0)},bi={...mi,remove:Si},wi=e=>kr(e,"block",jt.components[e]?.label??e),xi=En(e=>jt.components[e]?.defaultProps??{},[jt]),zi=e=>kr(e,"section",wi(e)),Ci=e=>bn({type:e.type,props:e.props??{}},zi(e.type),br),{nodeAddresses:Oi,zoneItems:Ni}=jn(()=>{const e=/* @__PURE__ */new Map,n=/* @__PURE__ */new Map,t=(o,r,i)=>{n.set(r,o),o.forEach((n,o)=>{const l=String(n.props?.id??"");if(l&&e.set(l,{zone:r,index:o}),i>=Nn)return;const s=/* @__PURE__ */new Map;for(const{child:e,zone:t}of In(jt,n))s.set(t,[...s.get(t)??[],e]);for(const[e,n]of s)t(n,e,i+1)})};return t(ai,Cn,0),{nodeAddresses:e,zoneItems:n}},[ai,jt]),Ii=En(e=>Ni.get(e)??[],[Ni]),Bi=e=>{const n=Oi.get(e);return n?Ii(n.zone)[n.index]:void 0},Pi=e=>_(cr,jt,e),Mi=e=>{if(!cr.slotsOf||e===Cn)return null;const n=e.lastIndexOf(":");if(n<=0)return null;const t=Bi(e.slice(0,n));if(!t)return null;const o=Pi(t).filter(e=>e.rung),r=o.findIndex(t=>t.slot===e.slice(n+1));return r<0?null:{node:t,slot:o[r],position:r}},$i=(()=>{if(!Y(Xo))return null;const e=`${Xo.nodeId}:${Xo.slot}`;return Mi(e)?.slot.panel===Xo.kind?e:null})(),Ti=Tn(null);An(()=>{const e=Ti.current;if(Ti.current=null,!$i||!Y(Xo))return;const n=Xo.nodeId;tr(n,{scroll:e!==$i}),Mr(e=>{if(!e.has(n))return e;const t=new Set(e);return t.delete(n),t})},[Xo]);const ji=(e,n,t)=>{const o=String(e.props.id);if(!n.panel)return void(e=>{const n=Oi.get(e);n&&(n.zone===Cn?_i(n.index):Ol(n.zone,n.index,e,Bi(n.zone.slice(0,n.zone.lastIndexOf(":")))?.type??""))})(o);const r={kind:n.panel,nodeId:o,slot:n.slot},i=`${o}:${n.slot}`;t&&$i!==i&&(Ti.current=i),lr(null,r),uo||Pt({type:"setUi",ui:{rightSideBarVisible:!0}}),l(o)},Li=(e,n,t)=>{const o=`${e}:${n}`;if(Mr(n=>{if(!n.has(o)&&!n.has(e))return n;const t=new Set(n);return t.delete(o),t.delete(e),t}),!t)return;$i!==o&&(Ti.current=o);lr(null,{kind:t,nodeId:e,slot:n})},Ai=(e,n,t)=>{if(wt||!cr.moveSlot)return;const o=Bi(e),r=o?Pi(o).filter(e=>e.rung):[],i=r[n];if(!i)return;const l={parentId:e,slot:yt,index:n},s=rn(l,{...l,index:Math.min(Math.max(t,0),r.length)});if(s===n)return;const d=cr.moveSlot(e,n,s);"string"==typeof d&&Li(e,d,i.panel)},Ei=Sr(),Ri=jn(()=>{const e=/* @__PURE__ */new Map;for(const n of Ei??[])e.set(n.slug,n.name);return e},[Ei]),Fi=e=>wn(e,wi,yr.plainText,e=>Ri.get(e),yr.rowName),Di=(e,n)=>{const t=jt.components[e.type]?.fields,o=n===Cn||ql(n)?"section":"block",r=n===Cn&&(Wt(e)||Jt(e)||Ft(e.type)),i="block"===o?xn(t):r?null:zn(t);return yr.renamePropOf?yr.renamePropOf(e,o,i):i},Vi=(e,n,t,o)=>{if(!(!wt&&Cr?.zone===e&&Cr.index===n))return;const r=(t,o)=>{Or(null),o&&((e,n,t)=>{const o=Ii(e)[n];if(!o)return;const r=Di(o,e);r&&ao.replaceComponent(e,n,{...o,props:{...o.props,[r]:t.trim()}})})(e,n,t)};/* @__PURE__ */
|
|
14
|
+
return lt("input",{className:"es-tree-rename",defaultValue:o,autoFocus:!0,"aria-label":Gt.rename,onClick:e=>e.stopPropagation(),onBlur:e=>r(e.currentTarget.value,!0),onKeyDown:e=>{"Enter"===e.key?(e.preventDefault(),r(e.currentTarget.value,!0)):"Escape"===e.key&&(e.preventDefault(),r("",!1))}},t)},Hi=t(G(),_t),Wi=Hi.scope({target:kn,siteId:Jn,docId:vn}),Ji=jt,Ui=(e,n)=>n===Cn?zi(e):wi(e),Yi=(e,n,t)=>{const o=Hi.plan(Wi,t,Ui(t.type,e),Ji);o&&(o.changed&&ao.replaceComponent(e,n,{...t,props:{...o.props,id:t.props.id}}),Hr(o.message))},Gi=te({nodesIn:Ii,nodeAt:(e,n)=>Ii(e)[n]??null,labelOf:(e,n)=>n===Cn?zi(e):wi(e),renamePropOf:Di,beginRename:(e,n)=>Or({zone:e,index:n}),history:{hasPast:Mt.hasPast,hasFuture:Mt.hasFuture,back:()=>Mt.back(),forward:()=>Mt.forward()},openPageSettings:()=>{ao.select(null),Qo(R)},pageSettingsLabel:Gt.pageSettings,words:{menu:qt,styleClipboard:_t,screen:Gt.menu},readOnly:Boolean(wt),collapseAll:()=>Mr(new Set(Ii(Cn).map(e=>String(e.props.id)))),onPasteRefused:e=>Hr(e?Gt.pasteRefused({name:e.label}):Gt.menu.clipboardRefused,"error"),canPasteAt:(e,n)=>ns(e,n),menuRows:(e,n,t)=>{const o=dr.menuRows?.(e,n,t)??null,r=((e,n)=>{const t=Lt.shared;if(!t||n!==Cn)return null;const o=t.usedOn(e);if(o){const n={pick:[{label:Gt.shared.onPages({count:o.length}),onClick:()=>{},children:o.map(e=>({label:e.title,onClick:()=>t.openPage(e)}))}]};return wt||pr(e.type,e)?n:{...n,change:[{label:Gt.shared.detach,onClick:()=>vi(e.props.id)}],remove:[{label:Gt.shared.removeFromPage,danger:!0,onClick:()=>{Si(e.props.id)}}]}}return wt||Wt(e)||Jt(e)||Ft(e.type)?null:z(gi)?{change:[{label:Gt.shared.makeShared,onClick:()=>ki({id:e.props.id,name:Ci(e)})}]}:null})(e,n);if(!r)return o;return Object.fromEntries(["pick","make","change","remove"].map(e=>[e,[...o?.[e]??[],...r[e]??[]]]).filter(([,e])=>e.length>0))},isLocked:e=>pr(e.type,e),duplicateBlocked:e=>ur(Bt.data,e),permits:e=>{const n=On(jt,e.type);return Lt.shared?.usedOn(e)?{...n,delete:!1}:n},nodeOps:bi,isPinned:(e,n)=>n===Cn&&(Wt(e)||Jt(e)),sectionBand:ci,locate:e=>Oi.get(e)??null,rowNameOf:(e,n)=>n===Cn?Ci(e):Fi(e),selectAt:(e,n,t,o)=>{e===Cn?_i(n):Ol(e,n,t,o??"")},slotRung:e=>{const n=Mi(e);return n?.slot.panel?{label:n.slot.label,select:()=>ji(n.node,n.slot,!1)}:null},style:{held:()=>ye(Wi),canCopy:e=>Hi.rows(Ji,e).some(e=>!1!==e.counted),copy:(e,n)=>Hi.copy(Wi,e,Ui(e.type,n),Ji),paste:(e,n,t)=>Yi(e,n,t)},keys:Ct?{target:Eo,selected:()=>{const e=Bt.ui.itemSelector;return e?{zone:e.zone??Cn,index:e.index}:null},held:()=>hi.get(),readOnly:Boolean(wt),onDone:({done:e,name:n})=>{"copied"===e&&Hr(Gt.copied({name:n}))}}:void 0},Lo),Ki=Tn({copy:(e,n)=>{},paste:(e,n,t)=>{},at:()=>null,readOnly:!1});An(()=>{Ki.current={copy:(e,n)=>Hi.copy(Wi,e,Ui(e.type,n),Ji),paste:Yi,at:()=>{const e=Bt.ui.itemSelector;if(!e)return null;const n=e.zone??Cn,t=Ii(n)[e.index];return t?{zone:n,index:e.index,node:t}:null},readOnly:Boolean(wt)}});const Xi=En(e=>{const n=ke(e);if(!n)return;const t=Ki.current,o=t.at();o&&(e.preventDefault(),"copy"===n?t.copy(o.node,o.zone):t.readOnly||t.paste(o.zone,o.index,o.node))},[]);An(()=>{if(!Eo)return;const e=e=>Xi(e);return Eo.addEventListener("keydown",e),()=>Eo.removeEventListener("keydown",e)},[Xi,Eo]),gn(Lo,"keydown",Xi);const Qi=ai.map(e=>e.props.id).join("|");An(()=>{const e=Lo?.document??null,n=Lo?.window??null;let t=0;const o=[],r=()=>{if(!e)return void Ko(e=>e.length?[]:e);const n=ai.findIndex(Jt),t=n>=0?n:ai.length,o=n=>{const t=ai[n]?.props?.id;return null==t?null:e.querySelector(`[data-puck-component="${CSS.escape(String(t))}"]`)},r=e=>e?[...e.querySelectorAll(hn)].map(e=>e.getBoundingClientRect()).filter(e=>e.width>0||e.height>0):[],i=[];for(let e=ai.length>0&&!Wt(ai[0])?0:1;e<=t;e++){const n=o(e),t=o(e-1),l=n?.getBoundingClientRect()??null,s=t?.getBoundingClientRect()??null;if(!l&&!s)continue;const d=gt(l&&s?(s.bottom+l.top)/2:l?0===e?l.top+12:l.top:s.bottom,Math.max(0===e?0:-1/0,...r(t).map(e=>e.bottom)),Math.min(1/0,...r(n).map(e=>e.top)));d&&i.push({...d,index:e})}Ko(e=>function(e,n){if(e.length!==n.length)return!1;for(let t=0;t<e.length;t++)if(e[t].top!==n[t].top||e[t].index!==n[t].index||e[t].height!==n[t].height)return!1;return!0}(e,i)?e:i)},i=()=>{cancelAnimationFrame(t),t=requestAnimationFrame(r)};if(!e||!n)return void r();n.addEventListener("scroll",i,{passive:!0});const l=new ResizeObserver(i);return l.observe(e.documentElement),r(),o.push(setTimeout(r,150),setTimeout(r,450)),()=>{cancelAnimationFrame(t),o.forEach(clearTimeout),n.removeEventListener("scroll",i),l.disconnect()}},[Lo,Qi,ko,qr,po,uo,$t?.props.id]);const Zi=Lo?.document??null,qi=Lo?.window??null;An(()=>{const e=To.current;if(!e||!Zi||!qi)return;const n=[],t=()=>{const n=Zi.querySelector(`[data-puck-component="${CSS.escape(e.id)}"]`);if(!n)return!1;const t=n.getBoundingClientRect().top-e.offset;return Math.abs(t)>1&&qi.scrollTo({left:qi.scrollX,top:qi.scrollY+t,behavior:"instant"}),!0};return To.current=null,t()&&n.push(setTimeout(t,150),setTimeout(t,450)),()=>n.forEach(clearTimeout)},[Zi,qi]);const _i=e=>{Qo(R),ao.select({index:e}),dr.sectionPressed?.(ai[e]);const n=ai[e]?.props?.id;n&&l(n)},el=e=>{const{floor:n,cap:t}=ci(),o=e=>Math.min(Math.max(n,e),t);if("number"==typeof e)return o(e);const r=$t&&Xo.kind!==Ht?.kind?ai.findIndex(e=>e.props.id===$t.props.id):-1;return o(r>=0?r+1:t)},nl=(e,n)=>{const{floor:t,cap:o}=ci(),r=Math.min(Math.max(n,t),o),i=e<r?r-1:r;return i===e?{moved:!1,dest:e}:(ao.reorderComponent(Cn,e,i),ao.select({index:i}),{moved:!0,dest:i})},tl=(e,n,t,o)=>{Qo(R),ao.select(o?{index:o.index,zone:o.zone}:{index:e}),l(n),Hr(Gt.sectionAdded({name:t}))},ol=(e,n)=>{const t=el(n),o=hr(e,{nodeDefaults:xi,newNodeId:Pn,sectionLabel:zi,blockIsOffered:gr}),r=o?ao.insertNode(Cn,t,o):ao.insertSection(e,t);return tl(t,r,zi(e),o?((e,n,t)=>{if(e.type===t)return null;const o={at:null},r=(e,n,i)=>{const l=i.filter(n=>n===e.type).length;for(const{child:s,zone:d,index:a}of In(jt,e)){if(s.type===t&&(!o.at||n>o.at.depth)){const r=mr(e.type,l,d.slice(d.lastIndexOf(":")+1)),i=r?.choices??(r?.spec?[{type:r.spec.childType,label:r.spec.childType}]:[]);null!==r&&"footer"!==r.source&&`${e.props.id}:${r.slot}`===d&&i.some(e=>e.type===t)&&(o.at={zone:d,index:a,depth:n})}r(s,n+1,[...i,e.type])}};return r({type:e.type,props:{...e.props,id:n}},1,[]),o.at?{zone:o.at.zone,index:o.at.index}:null})(o,r,e):null),t},rl=e=>il(Cn,e),il=(e,n)=>{Dr.current=document.activeElement??null,Yo(null===n?null:{zone:e,index:n}),Wo(!0),po||(Jo.current=!0,Pt({type:"setUi",ui:{leftSideBarVisible:!0}}))},ll=()=>{Wo(!1),Yo(null),Jo.current&&Pt({type:"setUi",ui:{leftSideBarVisible:!1}}),Jo.current=!1},sl=(e,n)=>yr.rowName?n?Wt(e)?yr.rowName(e,"section",Gt.header):Jt(e)?yr.rowName(e,"section",Gt.footer):Ft(e.type)?yr.rowName(e,"section",wi(e.type)):Ci(e):Fi(e):n?zi(e.type):wi(e.type),dl=e=>n=>{e()},al=(e,n,t)=>{if(wt)return null;const o=Ii(e)[n];return o&&!On(jt,o.type).delete||o&&pr(o.type,o)?null:/* @__PURE__ */lt(Ie,{kind:"delete",label:e===Cn&&o&&Lt.shared?.usedOn(o)?Gt.shared.removeFromPage:Gt.deleteNamed({name:t}),onClick:()=>((e,n)=>{const t=Ii(e)[n]?.props?.id;null!=t&&Si(String(t))})(e,n),children:/* @__PURE__ */lt(nt,{size:15})})},cl=e=>yr.rowPreview?.(e)||void 0,pl=e=>yr.rowMarks?.(e)??void 0,ul=(e,n,t)=>yr.rowActions?.(e,n,t)??null,fl=(e,n,t,o)=>{if(wt)return null;if(pr(t.type,t))return null;const r=Boolean(t.props._hidden);/* @__PURE__ */
|
|
15
|
+
return lt(Ie,{kind:"eye",label:r?Gt.showNamed({name:o}):Gt.hideNamed({name:o}),onClick:()=>ml(e,n,t),children:/* @__PURE__ */lt(r?tt:ot,{size:14,strokeWidth:1.8,strokeLinecap:void 0,strokeLinejoin:void 0})})},hl=e=>Vs(Cn,e),ml=(e,n,t)=>{ao.replaceComponent(e,n,{...t,props:{...t.props,_hidden:!t.props._hidden}})},gl=e=>Bn(jt,e),yl=e=>In(jt,e),kl=e=>cr.slotsOf?Pi(e).map(n=>({slot:n.slot,rung:n.rung?n:null,kids:Mn(e,n.slot)})):[{slot:null,rung:null,kids:yl(e)}],vl=e=>cr.slotsOf?kl(e).flatMap(e=>e.kids):yl(e),Sl=e=>Boolean(cr.slotsOf)&&Pi(e).some(e=>e.rung),bl=(e,n,t)=>null===t?void 0===n?mr(e):mr(e,n):mr(e,n,t),wl=(e,n,t)=>{const o=$n(jt,e.type,n)&&(t||vl(e).length>0||Sl(e));return{collapsible:o,folded:o&&Er(String(e.props.id))}},xl=(e,n,t)=>kl(e).flatMap(o=>{const r=o.rung?n+1:n,i=o.kids.flatMap(({child:e})=>wl(e,r,t(e.type)).collapsible?[String(e.props.id),...xl(e,r+1,t)]:[]);return o.rung?[`${e.props.id}:${o.rung.slot}`,...i]:i}),zl=e=>vl(e).length>0||Sl(e)||Boolean(mr(e.type)),Cl=e=>Boolean(mr(e)),Ol=(e,n,t,o)=>{if(Qo(R),mr(o)?.spec?.slider){const t=e.split(":")[0];s(t,n),ao.select({index:n,zone:e}),l(t)}else ao.select({index:n,zone:e}),l(t)},Nl=(e,n,t,o,r)=>{const i=`${e}:${n}`;ao.insertComponent(i,t,o),mr(r)?.spec?.slider?requestAnimationFrame(()=>{s(e,o),ao.select({index:o,zone:i})}):ao.select({index:o,zone:i})},Il=Tn(/* @__PURE__ */new Set);An(()=>{ai.forEach(e=>{const n=mr(e.type)?.spec;if(!n)return;const t=e.props.id;if(Il.current.has(t))return;Il.current.add(t);if((Array.isArray(e.props[n.slot])?e.props[n.slot]:[]).length>0)return;if(n.skipSeed?.(e.props))return;const o=`${t}:${n.slot}`,r=n.legacy?.(e.props)??[];(r.length?r:n.seeds(xi)).forEach((e,t)=>io.seedChild(o,t,n.childType,e))})},[ai,io,xi]);const Bl=Tn(/* @__PURE__ */new Set);An(()=>{ai.forEach((e,t)=>{const o=e.props.id;if(Bl.current.has(o))return;const r=n(e,gl(e.type));Bl.current.add(o),r&&io.replaceComponent(Cn,t,{...e,props:r})})},[ai,io]),K(io,jt);const Pl=ai.findIndex(Jt),Ml=Pl>=0?ai[Pl]:null,$l=Ut?ai.findIndex(Wt):-1,Tl=$l>=0?ai[$l]:null,jl=Lt.groupTab,Ll=jn(()=>jl?e=>Ft(e.type):void 0,[jl]),Al=Boolean(Lt.groupBadge),El=Lt.sharedReach,Rl=e=>El?.(e)??void 0,Fl=jn(()=>El?new Set(ai.filter(e=>Rl(e)).map(e=>String(e.props.id))):null,[ai,El]),Dl=jn(()=>Fl?e=>Fl.has(e):void 0,[Fl]),Vl=Lt.first?El?.({type:Lt.first,props:{id:""}})??void 0:void 0,Hl=Lt.groupBadge?/* @__PURE__ */lt("span",{className:"es-tree-group-badge",children:/* @__PURE__ */lt(Vn,{tone:"info",size:"xs",children:Lt.groupBadge})}):void 0,Wl=ai.find(e=>e.type===Et)??null,Jl=ai.find(e=>e.type===Rt)??null,Ul=Pl>=0?Pl:ai.length,Yl=[];ai.forEach(e=>{Jt(e)||(zl(e)&&Yl.push(String(e.props.id)),Yl.push(...xl(e,1,Cl)))}),Ml&&(Yl.push(String(Ml.props.id)),Yl.push(...xl(Ml,1,Cl)));const Gl=Yl.length>0&&Yl.every(e=>Pr.has(e)),Kl=e=>{const n=yr.blockRowName(e,wi);return yr.rowName?yr.rowName(e,"block",n):n},Xl=(e,n,t,o)=>{const r=Ii(e)[t];if(!r)return;const i={...an(e),index:t},l={...an(n),index:Math.min(Math.max(o,0),Ii(n).length)},s=rn(i,l);if(e!==n||s!==t)try{mi.move(String(r.props.id),{...l,index:s})}catch(e){if(!(e instanceof pn))throw e}},Ql=e=>{const n=/* @__PURE__ */new Set,t=e=>{for(const{child:o,zone:r}of yl(e))n.add(r),t(o)};for(const t of gl(e.type))n.add(`${e.props.id}:${t}`);return t(e),n},Zl=e=>{let n=e.slice(0,e.indexOf(":"));for(let e=0;e<64;e++){const e=Oi.get(n);if(!e)return null;if(e.zone===Cn)return n;n=e.zone.slice(0,e.zone.indexOf(":"))}return null},ql=e=>{const n=e.slice(0,e.indexOf(":")),t=ai.find(e=>Ft(e.type)&&String(e.props.id)===n);return t&&Dt(n)===e?t:null},_l=(e,n)=>{const t=ql(e);return!t||(!Lt.groupAccepts||Lt.groupAccepts(t.type,n,Ii(e).length))},es=(e,n,t)=>{if(e.rung){const t=Bi(e.rung.nodeId),o=t?Pi(t).filter(e=>e.rung).length:0;return n.parentId===e.rung.nodeId&&n.slot===yt&&n.index>=0&&n.index<=o}if(n.slot===yt)return!1;if(e.add)return rs(e.add,n);const o=dn(n);if(Ft(e.type))return!1;const r=ql(o),i=ql(e.zone);if(r||i)return!(!r||!i)&&(!(r!==i&&!_l(o,e.type))&&(n.index>=0&&n.index<=Ii(o).length));if(e.zone===Cn||o===Cn){if(e.zone!==o)return!1;const{floor:t,cap:r}=ci();return n.index>=t&&n.index<=r}if(n.index<0||n.index>Ii(o).length)return!1;if(e.zone===o)return!0;const l=Ml&&!Lt.lastIsOpen?String(Ml.props.id):null;return(!l||Zl(e.zone)!==l&&Zl(o)!==l)&&((e,n,t,o)=>{if(e===n)return!0;const r=o??Ii(e)[t];if(!r)return!1;const i=n.split(":")[0],l=Oi.get(i),s=l?Ii(l.zone)[l.index]:void 0;if(!s)return!1;if(!o&&Ql(r).has(n))return!1;const d=mr(s.type,fr(Bt?.data,s.type,i),n.slice(n.lastIndexOf(":")+1));return!!d&&(!!(d.choices?d.choices.some(e=>e.type===r.type):d.spec?.childType===r.type)&&!d.spec?.addBlocked?.(Ii(n),r))})(e.zone,o,e.index,t)},ns=(e,n)=>{const t=dn(e.from),o=e.node;return t===dn(n)?_l(t,o.type):es({id:String(o.props?.id??""),zone:t,index:-1,type:o.type},n,o)},ts=e=>{const n=e.slice(0,e.indexOf(":")),t=Oi.get(n),o=t?Ii(t.zone)[t.index]:void 0;if(!t||!o)return null;const r=mr(o.type,fr(Bt?.data,o.type,n),e.slice(e.lastIndexOf(":")+1));if(!r||`${n}:${r.slot}`!==e)return null;if("footer"===r.source)return null;const i=I(r.choices??(r.spec?[{type:r.spec.childType,label:wi(r.spec.childType)}]:[])),l=Mi(e);return{parent:o,parentId:n,target:r,choices:i,parentName:l?l.slot.label:sl(o,t.zone===Cn)}},os=(e,n)=>{if("section"!==e.kind)return e;const t=dn(n);return t===Cn||ql(t)?e:ts(t)?.choices.some(n=>n.type===e.type)?{kind:"block",type:e.type}:e},rs=(e,n)=>{const t=os(e,n),o=dn(n);if("shared"===t.kind){if(o!==Cn||!Lt.shared?.nodeOf(t.section))return!1;const{floor:e,cap:r}=ci();return n.index>=e&&n.index<=r}if("block"!==t.kind){if(ql(o)){const e="section"===t.kind?t.type:t.template.node.type;return _l(o,e)&&n.index>=0&&n.index<=Ii(o).length}if(o!==Cn)return!1;const{floor:e,cap:r}=ci();return n.index>=e&&n.index<=r}if(o===Cn)return!1;const r=ts(o);return!(!r||!r.choices.some(e=>e.type===t.type))&&!r.target.spec?.addBlocked?.(Ii(o))},is=(e,n)=>{const t=os(e,n);if("block"!==t.kind&&ql(dn(n)))return void((e,n,t)=>{const o="section"===e.kind?e.type:"template"===e.kind?e.template.node.type:null;if(o&&_l(n,o)){if("section"===e.kind)ao.insertComponent(n,e.type,t);else{if("template"!==e.kind)return;ao.insertNode(n,t,fi(e.template.node))}Qo(R),ao.select({index:t,zone:n})}})(t,dn(n),n.index);if("section"===t.kind)return void ol(t.type,n.index);if("template"===t.kind)return void((e,n,t)=>{const o=el(t),r=ao.insertNode(Cn,o,n);tl(o,r,e)})(t.template.name,fi(t.template.node),n.index);if("shared"===t.kind){const e=Lt.shared?.nodeOf(t.section);if(!e)return;const o=el(n.index);return void(mi.restore(e,{parentId:ln,slot:sn,index:o})&&tl(o,e.props.id,t.section.title))}const o=dn(n),r=ts(o);r&&(r.target.spec?Nl(r.parentId,r.target.slot,t.type,n.index,r.parent.type):((e,n,t)=>{ao.insertComponent(e,n,t),Qo(R),ao.select({index:t,zone:e})})(o,t.type,n.index))},ls=(e,n)=>{e.media?function(e){const n=As();if(!n||!Ts)return;Rs(n).then(n=>{n&&function(e,n){if(!Ts)return;const t=Ts.create(e,{nodeDefaults:xi,newNodeId:Pn,sectionLabel:zi,blockIsOffered:gr}),o=dn(n);if(o===Cn){const e=el(n.index),o=ao.insertNode(Cn,e,t);return void tl(e,o,zi(t.type))}ao.insertNode(o,n.index,t),Qo(R),ao.select({index:n.index,zone:o})}(n,e)})}(n):e.rung?Ai(e.rung.nodeId,e.index,n.index):e.add?is(e.add,n):e.zone===Cn?nl(e.index,n.index):Xl(e.zone,dn(n),e.index,n.index)},[ss]=Ln(()=>tn()),ds=on({keyOf:e=>e.id,readOnly:Boolean(wt),session:ss,canDrop:es,onDrop:ls,onStep:(e,n)=>{e.rung?Ai(e.rung.nodeId,e.index,n<0?e.index-1:e.index+2):e.zone===Cn?((e,n)=>{const t=zi(ai[e]?.type??""),o=nl(e,n<0?e-1:e+2);if(!o.moved)return void Hr(n<0?Gt.sectionFirst({name:t}):Gt.sectionLast({name:t}));const{floor:r,cap:i}=ci();Hr(Gt.sectionMoved({name:t,n:o.dest-r+1,total:i-r}))})(e.index,n):Xl(e.zone,e.zone,e.index,n<0?e.index-1:e.index+2)}}),as=En(e=>{const{floor:n,cap:t}=ci(),o=[];for(const r of e.nodes){const e=dn(r.place),i=Ii(e)[r.place.index];if(!i||String(i.props.id)!==r.id)continue;if(Wt(i)||Jt(i)||pr(i.type,i))continue;if(Ft(i.type))continue;const l=Boolean(ql(e)),s=e===Cn||l;e===Cn&&t-n<2||o.push({key:r.id,item:{id:r.id,zone:e,index:r.place.index,type:i.type},box:r.box,label:s?zi(i.type):Fi(i),from:r.place})}const r=e.zones.flatMap(e=>{const n=dn(e.list);if(n===Cn&&0===e.children.length)return[{...e,addLabel:Gt.addSection,addAlways:!0}];const t=ts(n),o=t?.target.spec?.addLabel;return e.children.length>0||Boolean(t?.choices.length)||Boolean(ql(n))?[o?{...e,addLabel:o}:e]:[]}),i=r.flatMap(e=>{const n=dn(e.list),t=n===Cn||ql(n)?null:ts(n);return t?.choices.length?qe(e,t.target.spec?.addLabel??Gt.addBlockHere):[]});return{sources:o,zones:r,seams:i}},[Bt.data]),cs=null==$t?.props.id?null:String($t.props.id),ps=En(e=>{const n=jt,t=e=>!e.item.rung&&null!==cn(Bt.data,n,e.item.id),o=e[e.length-1];if(!t(o))return o;const r=n=>e.find(e=>t(e)&&e.item.id===n),i=r(cs);return i||(r(je(Bt.data,n,o.item.id,cs,Ll))??o)},[Bt.data,jt,cs,Ll]),[us,fs]=Ln(null),hs=Boolean(jl||El);gn(Lo,"mouseover",e=>{if(!hs)return;const n=yn(e.target),t=n?ut(Bt.data,jt,n):null;t!==us&&fs(t)}),gn(Lo,"mouseout",e=>{hs&&!e.relatedTarget&&fs(null)});const ms=e=>Wt(e)||Jt(e)||Ft(e.type),gs=e=>{const n=Ft(e.type)?wi(e.type):Wt(e)?Gt.header:Jt(e)?Gt.footer:null;return null===n?Ci(e):yr.rowName?yr.rowName(e,"section",n):n},ys=[];if(hs){const e=cs?ut(Bt.data,jt,cs):null;for(const n of/* @__PURE__ */new Set([e,us])){const e=n?ai.find(e=>String(e.props.id)===n):void 0;if(!e)continue;const t=Wt(e)||e.type===Et,o=Rl(e);if(o){ys.push({id:String(e.props.id),label:gs(e),below:t,reach:o});continue}if(!jl||!ms(e))continue;const r=jl(e);r&&ys.push({id:String(e.props.id),label:r,below:t})}}const ks=pe(),vs=Tn(null);An(()=>{const e=Lt.changeNotice;if(!e)return;const n=JSON.stringify(ai.filter(ms)),t=vs.current;if(vs.current={doc:vn,bands:n,index:Mt.index},!t||t.doc!==vn||t.bands===n)return;Mt.hasPast&&Mt.index>=t.index&&!pt.has(ks)&&(pt.add(ks),Hr(e,"success",{action:{label:Gt.bar.undo,onClick:()=>Mt.back()},duration:8e3}))},[ai]);const Ss=e=>{Qo(R),ao.select(e.zone===Cn?{index:e.index}:{index:e.index,zone:e.zone})},bs=X(),ws=()=>({data:Bt.data,device:ko,ops:ao,inspector:sr}),xs=bs?.model,zs=jn(()=>xs?e=>xs(e,as(e),ws()):as,[xs,as,ko]),Cs=bs?.measure,Os=Cs?(e,n)=>Cs(e,n,ws()):void 0,Ns=bs?.canDrop,Is=Ns?(e,n)=>Ns(e,n,es,ws()):es,Bs=bs?.drop,Ps=Bs?(e,n)=>Bs(e,n,ls,ws()):ls,Ms=bs?.pick,$s=Ms?e=>Ms(e,Ss,ws()):Ss,Ts=bs?.media??null,js=Tn(null),Ls=jn(()=>Ts?{id:at,zone:"",index:-1,type:Ts.adds.type,add:{kind:Ts.adds.kind,type:Ts.adds.type},media:!0}:null,[Ts]);An(()=>{if(!Ls||wt||"undefined"==typeof document)return;const e=e=>{(e=>Array.from(e.dataTransfer?.types??[]).includes(Qn))(e)&&(js.current=null,ss.start({key:at,item:Ls}))},n=e=>{ss.get()?.item.media&&(js.current=Wn(e.dataTransfer))},t=()=>{ss.get()?.item.media&&ss.end()};return document.addEventListener("dragstart",e),document.addEventListener("drop",n,!0),document.addEventListener("dragend",t,!0),()=>{document.removeEventListener("dragstart",e),document.removeEventListener("drop",n,!0),document.removeEventListener("dragend",t,!0)}},[Ls,wt,ss]);const As=()=>{const e=js.current;return js.current=null,e},Es=ce(),Rs=async e=>{if(!Es)return e;const n=await Es(e);return n?{...e,id:n.id,url:n.url}:null};const Fs=(e,n)=>{if(!Ts)return;const t=cn(so.getState().appState.data,pi,n);if(!t)return;const o=t.node;ao.replaceComponent(dn(t.place),t.place.index,{...o,props:{...Ts.replace(o,e),id:o.props.id}})},Ds=e=>{const n=dn(e),t=Mi(n);t&&ji(t.node,t.slot,!1),il(n,e.index)},Vs=(e,n)=>/* @__PURE__ */lt(Be,{...wt?{}:ds.seam({place:{...an(e),index:n}})},`seam:${e}:${n}`),Hs={rowClick:dl,isCollapsed:Er,toggleCollapse:Rr},Ws=e=>{const n=String(e.props.id),t=ai.findIndex(e=>String(e.props.id)===n),o=Dt(n),r=Ii(o),i=Er(n),l=wi(e.type),s=yr.rowName?yr.rowName(e,"section",l):l,d=e=>Vs(o,e);/* @__PURE__ */
|
|
16
|
+
return st(dt,{children:[
|
|
17
|
+
/* @__PURE__ */lt(ze,{words:Kt,icon:/* @__PURE__ */lt(vr,{type:e.type,size:13}),name:s,preview:cl(e),marks:pl(e),onSelect:()=>_i(t),nameSlot:Vi(Cn,t,n,s),selected:qo===n,badge:Rl(e)?void 0:Hl,shared:Rl(e),actions:ul(e,Cn,t)??void 0,rowProps:{"data-node-id":n,onClick:dl(()=>_i(t))},fold:{open:!i,label:"section",onToggle:()=>Rr(n)}}),!i&&/* @__PURE__ */st(Ce,{children:[r.map((n,t)=>{const r=String(n.props.id),i=Ci(n),l=zl(n),s=l&&Er(r),a=()=>Ol(o,t,r,e.type),{rowProps:c,...p}=ds.row({item:{id:r,zone:o,index:t,type:n.type},place:{...an(o),index:t}},{"data-node-id":r,onClick:dl(a)});/* @__PURE__ */
|
|
18
|
+
return st(Fn,{children:[d(t),
|
|
19
|
+
/* @__PURE__ */lt(ze,{words:Kt,icon:/* @__PURE__ */lt(vr,{type:n.type,size:13}),name:i,preview:cl(n),marks:pl(n),onSelect:a,nameSlot:Vi(o,t,r,i),selected:qo===r,hidden:Boolean(n.props._hidden),...p,fold:l?{open:!s,label:"section",onToggle:()=>Rr(r)}:void 0,actions:/* @__PURE__ */st(dt,{children:[al(o,t,i),ul(n,o,t),fl(o,t,n,i)]}),rowProps:c}),l&&!s&&/* @__PURE__ */lt(Ce,{children:Ys(n,2)})]},r)}),d(r.length)]})]})},Js=(e,n,t,o,r)=>{const i=String(e.props.id),l=`${i}:${n.slot}`,s=ds.dragging,d=!Er(l)&&s?.rung?.nodeId!==i,a={...an(l),index:0},c=s&&!s.rung&&es(s,a)?a:void 0,p=()=>ji(e,n,!0),{rowProps:u,...f}=ds.row({item:{id:`rung:${l}`,zone:`${i}:${yt}`,index:t,type:e.type,rung:{nodeId:i,slot:n.slot}},place:{parentId:i,slot:yt,index:t},into:c,canDrag:Boolean(cr.moveSlot)&&!1!==n.movable&&o>1},{"data-slot-zone":l,onClick:dl(p)}),h=wt?null:cr.slotActions?.(e,n.slot);/* @__PURE__ */
|
|
20
|
+
return st(Fn,{children:[n.heading,
|
|
21
|
+
/* @__PURE__ */lt(ze,{words:Kt,icon:n.glyph??null,name:n.label,badge:n.badge,onSelect:p,selected:$i===l,...f,dragHint:n.dragHint,fold:{open:d,label:n.label,onToggle:()=>Rr(l)},actions:h&&h.length>0?/* @__PURE__ */lt(dt,{children:h.map((t,o)=>/* @__PURE__ */lt(Ie,{kind:"delete"===t.kind?"delete":"plain",label:t.label,disabled:t.disabled,onClick:()=>((e,n,t)=>{if(wt||t.disabled)return;const o=String(e.props.id),r=e=>{"string"==typeof e&&Li(o,e,n.panel)},i=t.run();i&&"function"==typeof i.then?i.then(r):r(i)})(e,n,t),children:"delete"===t.kind?/* @__PURE__ */lt(nt,{size:15}):/* @__PURE__ */lt(it,{size:15})},`${o}:${t.kind}`))}):void 0,rowProps:u}),d&&/* @__PURE__ */lt(Ce,{children:r})]},l)},Us=(e,n)=>{const t=kl(e),o=t.filter(e=>e.rung).length;let r=0;/* @__PURE__ */
|
|
22
|
+
return lt(dt,{children:t.map(t=>{const i=t.kids,l=t.rung?n+1:n,s=bl(e.type,void 0,t.slot),d=s?`${e.props.id}:${s.slot}`:null,a=null===t.slot?null:`${e.props.id}:${t.slot}`,c=(e,n)=>Vs(e,n),p=/* @__PURE__ */st(dt,{children:[i.map(({child:n,zone:t,index:o})=>{const r=qo===String(n.props.id),{collapsible:i,folded:s}=wl(n,l,Cl(n.type)),d=String(n.props.id),a=Kl(n),p=()=>Ol(t,o,d,e.type),{rowProps:u,...f}=ds.row({item:{id:d,zone:t,index:o,type:n.type},place:{...an(t),index:o}},{"data-node-id":d,onClick:dl(p)});/* @__PURE__ */
|
|
23
|
+
return st(Fn,{children:[0===o&&c(t,0),
|
|
24
|
+
/* @__PURE__ */lt(ze,{words:Kt,icon:/* @__PURE__ */lt(vr,{type:n.type,size:13}),name:a,preview:cl(n),marks:pl(n),onSelect:p,nameSlot:Vi(t,o,d,a),selected:r,hidden:Boolean(n.props._hidden),...f,fold:i?{open:!s,label:"group",onToggle:()=>Rr(d)}:void 0,actions:/* @__PURE__ */st(dt,{children:[al(t,o,a),ul(n,t,o),fl(t,o,n,a)]}),rowProps:u}),i&&!s&&/* @__PURE__ */lt(Ce,{children:Us(n,l+1)}),c(t,o+1)]},String(n.props.id??`${t}-${o}`))}),null===a?d&&!i.some(e=>e.zone===d)?c(d,0):null:0!==i.length||!t.rung&&d!==a?null:c(a,0)]});return t.rung?Js(e,t.rung,r++,o,p):/* @__PURE__ */lt(Fn,{children:p},t.slot??"")})})},Ys=(e,n)=>{const t=fr(Bt?.data,e.type,String(e.props.id)),o=kl(e),r=o.filter(e=>e.rung).length;let i=0;/* @__PURE__ */
|
|
25
|
+
return lt(dt,{children:o.map(o=>{const l=o.kids,s=o.rung?n+1:n,d=bl(e.type,t,o.slot),a=d?.spec??null,c=a&&Array.isArray(e.props[a.slot])?e.props[a.slot]:[],p=d&&d.choices?{slot:d.slot,choices:d.choices}:null,u=String(e.props.id),f=a&&!a.fixed?`${u}:${a.slot}`:null,h=p?`${u}:${p.slot}`:null,m=(e,n)=>Vs(e,n),g=null===o.slot?null:`${u}:${o.slot}`,y=Boolean(a&&!a.fixed&&(null===g||g===f)),k=/* @__PURE__ */st(dt,{children:[l.map(({child:n,zone:t,index:o})=>{const r=qo===String(n.props.id),i=Fi(n),l=String(n.props.id),{collapsible:d,folded:a}=wl(n,s,Cl(n.type)),c=gl(n.type),p=1===c.length?`${l}:${c[0]}`:null,u=p?{...an(p),index:Ii(p).length}:void 0,f=ds.dragging,h=u&&f&&es(f,u)?u:void 0,g=()=>Ol(t,o,l,e.type),{rowProps:y,...k}=ds.row({item:{id:l,zone:t,index:o,type:n.type},place:{...an(t),index:o},into:h,canDrag:!pr(n.type,n)},{"data-node-id":l,onClick:dl(g)});/* @__PURE__ */
|
|
26
|
+
return st(Fn,{children:[0===o&&m(t,0),
|
|
27
|
+
/* @__PURE__ */lt(ze,{words:Kt,icon:/* @__PURE__ */lt(vr,{type:n.type,size:13}),name:i,preview:cl(n),marks:pl(n),onSelect:g,nameSlot:Vi(t,o,l,i),selected:r,hidden:Boolean(n.props._hidden),...k,fold:d?{open:!a,label:"group",onToggle:()=>Rr(l)}:void 0,actions:pr(n.type,n)?ul(n,t,o)??void 0:/* @__PURE__ */st(dt,{children:[al(t,o,i),ul(n,t,o),fl(t,o,n,i)]}),rowProps:y}),d&&!a&&/* @__PURE__ */lt(Ce,{children:Ys(n,s+1)}),m(t,o+1)]},String(n.props.id??`${t}-${o}`))}),y&&a&&
|
|
28
|
+
/* @__PURE__ */lt(w,{small:!0,label:a.addLabel,blocked:a.addBlocked?.(c)??null,onAdd:()=>Nl(e.props.id,a.slot,a.childType,c.length,e.type)}),null===g?h&&!l.some(e=>e.zone===h)?m(h,0):null:0!==l.length||(o.rung?y:g!==h)?null:m(g,0)]});return o.rung?Js(e,o.rung,i++,r,k):/* @__PURE__ */lt(Fn,{children:k},o.slot??"")})})},Gs=Ho,Ks=e=>"panel"in e?{id:e.id,label:e.label,icon:e.icon,active:po&&!Gs&&ar===e.id,onSelect:()=>ii(e.id)}:e,Xs=[...(dr.railLead??[]).map(Ks),{id:"sections",label:Gt.layers,icon:/* @__PURE__ */lt(he,{}),active:po&&!Gs&&"sections"===ar,onSelect:()=>ii("sections")},...(dr.railTrail??[]).map(Ks)];bo?Xs.push({id:"media",label:Gt.railMedia,icon:/* @__PURE__ */lt(me,{}),active:zo,onSelect:Co}):Ot&&Xs.push({id:"media",label:Gt.railMedia,icon:/* @__PURE__ */lt(me,{}),onSelect:li});const Qs=[...dr.railLead??[],...dr.railTrail??[]].find(e=>"panel"in e&&e.id===ar),Zs=Boolean(Yt?.foldable),qs=Yt?.label??(Nt?Gt.pageSections:Gt.templateSections),_s=Zs&&Er(kt),ed=/* @__PURE__ */st(dt,{children:[ai.map((e,n)=>{if(Wt(e)||Jt(e)||Ft(e.type))return null;const t=qo===String(e.props.id),o=Boolean(e.props._hidden);yl(e);const r=String(e.props.id),i=dr.hasOwnRows?.(e)??!1,l=zl(e)||i,s=l&&Er(r),d=gl(e.type),a=1===d.length?`${r}:${d[0]}`:null,c=a?{...an(a),index:Ii(a).length}:void 0,p=ds.dragging,u=c&&p&&es(p,c)?c:void 0,{rowProps:f,...h}=ds.row({item:{id:r,zone:Cn,index:n,type:e.type},place:{...an(Cn),index:n},into:u,canDrag:!pr(e.type,e)},{"data-node-id":r,onClick:dl(()=>_i(n))});/* @__PURE__ */
|
|
29
|
+
return st(Fn,{children:[n>0&&hl(n),
|
|
30
|
+
/* @__PURE__ */lt(ze,{words:Kt,icon:/* @__PURE__ */lt(vr,{type:e.type,size:13}),name:Ci(e),preview:cl(e),marks:pl(e),shared:Rl(e),onSelect:()=>_i(n),nameSlot:Vi(Cn,n,r,Ci(e)),selected:t,hidden:o,...h,fold:l?{open:!s,label:"section",onToggle:()=>Rr(r)}:void 0,actions:/* @__PURE__ */st(dt,{children:[al(Cn,n,Ci(e)),ul(e,Cn,n),fl(Cn,n,e,Ci(e))]}),rowProps:f}),zl(e)&&!s&&/* @__PURE__ */st(Ce,{children:[Ys(e,1),dr.partRows?.(e,Hs)]}),i&&!s&&/* @__PURE__ */lt(Ce,{children:dr.ownRows?.(e,n,Hs)})]},String(e.props.id??n))}),Ul>0&&hl(Ul)]}),nd=(e,n,t)=>{const o=String(e.props.id),r=vl(e).length>0||Sl(e)||Boolean(mr(e.type)),i=r&&Er(o),l="header"===t?Gt.header:Gt.footer,s=yr.rowName?yr.rowName(e,"section",l):l;/* @__PURE__ */
|
|
31
|
+
return st(dt,{children:[
|
|
32
|
+
/* @__PURE__ */lt(ze,{words:Kt,icon:/* @__PURE__ */lt(vr,{type:t,size:13}),name:s,preview:cl(e),marks:pl(e),badge:Rl(e)?void 0:Hl,shared:Rl(e),onSelect:()=>_i(n),nameSlot:Vi(Cn,n,o,s),selected:qo===String(e.props.id),fold:r?{open:!i,label:"section",onToggle:()=>Rr(o)}:void 0,actions:ul(e,Cn,n)??void 0,rowProps:{"data-node-id":o,onClick:dl(()=>_i(n))}}),r&&!i&&/* @__PURE__ */lt(Ce,{children:Us(e,1)})]})};return(dr.wrap??(e=>e))(
|
|
33
|
+
/* @__PURE__ */lt(Q,{target:Lo,children:/* @__PURE__ */st("div",{ref:jo,className:"sf-editor es-editor",style:Ue($r),onContextMenu:Gi.onEditorContextMenu,...u(fn),children:[
|
|
34
|
+
/* @__PURE__ */st(Le,{children:[
|
|
35
|
+
/* @__PURE__ */lt(Ae,{items:Xs,ariaLabel:Gt.bar.views}),
|
|
36
|
+
/* @__PURE__ */st(Ee,{children:[
|
|
37
|
+
/* @__PURE__ */lt(Re,{label:Gt.bar.undo,disabled:Boolean(wt)||!Mt.hasPast,onClick:()=>Mt.back(),children:/* @__PURE__ */lt(Zn,{})}),
|
|
38
|
+
/* @__PURE__ */lt(Re,{label:Gt.bar.redo,disabled:Boolean(wt)||!Mt.hasFuture,onClick:()=>Mt.forward(),children:/* @__PURE__ */lt(qn,{})}),
|
|
39
|
+
/* @__PURE__ */lt(Fe,{}),
|
|
40
|
+
/* @__PURE__ */lt(De,{devices:fo,value:ko,onChange:vo}),
|
|
41
|
+
/* @__PURE__ */lt(Re,{label:Gt.bar.refresh,tip:Gt.bar.refreshTip,onClick:()=>{To.current=(()=>{const e=Lo?.document;if(!e)return null;const n=ai.findIndex(Jt),t=n>=0?n:ai.length;let o=null;for(let n=0;n<t;n++){const t=ai[n]?.props?.id;if(null==t)continue;const r=e.querySelector(`[data-puck-component="${CSS.escape(String(t))}"]`);if(!r)continue;const i=r.getBoundingClientRect().top;i<=4&&(null===o||i>o.offset)&&(o={id:String(t),offset:i})}if(!o){const e=$t?.props?.id??ai[0]?.props?.id;null!=e&&(o={id:String(e),offset:0})}return o})(),$o(e=>e+1)},children:/* @__PURE__ */lt(_n,{})})]}),
|
|
42
|
+
/* @__PURE__ */st(Ee,{kind:"right",style:{minWidth:300},children:[
|
|
43
|
+
/* @__PURE__ */lt(v,{input:Do,words:Gt.saveStatus}),dr.barLead?.(),dr.barTrail?.(),dr.mainAction||!dr.barMain?/* @__PURE__ */lt(S,{input:Do,action:dr.mainAction??{label:Gt.done,onPress:()=>{Un(Bt.data)}},readOnly:Boolean(wt),saveSwitch:zt,onToggleAutoSave:Xn,onSaveNow:Vo,bar:Gt.bar,words:Gt.saveStatus}):dr.barMain()]})]}),
|
|
44
|
+
/* @__PURE__ */lt(oe,{}),
|
|
45
|
+
/* @__PURE__ */st("div",{className:"sf-body",children:[po?/* @__PURE__ */st(dt,{children:[
|
|
46
|
+
/* @__PURE__ */lt("aside",{className:"es-sidepanel es-sidepanel--left sf-panel sf-panel--left","aria-label":Gt.leftPanel,children:Ho?/* @__PURE__ */lt(x,{at:Uo?{label:(e=>{const n=ql(e.zone);if(n)return Gt.add.addingTo({name:yr.rowName?sl(n,!0):wi(n.type)});if(e.zone===Cn){const n=ai[e.index];return n&&!Jt(n)?Gt.add.addingBefore({name:sl(n,!0)}):Gt.add.addingAtEnd}const t=ts(e.zone);return t?Gt.add.addingTo({name:t.parentName}):Gt.add.addingHere})(Uo),onClear:()=>Yo(null)}:void 0,placeBlocks:Uo&&Uo.zone!==Cn?ts(Uo.zone)?.choices:void 0,canTake:Uo?e=>{if(!Uo)return null;const n={...an(Uo.zone),index:Uo.index};if(rs(e,n))return null;if("shared"===e.kind&&Uo.zone===Cn&&!Lt.shared?.nodeOf(e.section))return Gt.shared.alreadyHere;const t=ql(Uo.zone);if(t)return Gt.add.notInside({name:sl(t,!0)});if(Uo.zone===Cn)return Gt.add.onlySections;const o=ts(Uo.zone);return o?Gt.add.notInside({name:o.parentName}):Gt.add.onlySections}:void 0,onPick:Uo?e=>{if(!Uo)return;const n={...an(Uo.zone),index:Uo.index};rs(e,n)&&(is(e,n),ll())}:void 0,itemFor:e=>({id:`new:${e.kind}:${"template"===e.kind?e.template.id:"shared"===e.kind?e.section.id:e.type}`,zone:"",index:-1,type:"template"===e.kind?e.template.node.type:"shared"===e.kind?e.section.node.type:e.type,add:e}),session:ss,siteWide:dr.addPanelRow?.(ll),onClose:ll,onHide:oi,readOnly:Boolean(wt)}):Qs?Qs.panel({onHide:oi,notify:Hr}):/* @__PURE__ */st(dt,{children:[
|
|
47
|
+
/* @__PURE__ */lt(O,{icon:/* @__PURE__ */lt(he,{}),title:Gt.layers,context:no,actions:/* @__PURE__ */st(dt,{children:[!wt&&/* @__PURE__ */lt(Ve,{label:Gt.add.title,onClick:()=>rl(null),children:/* @__PURE__ */lt(et,{size:15})}),
|
|
48
|
+
/* @__PURE__ */lt(Ve,{label:Gl?Gt.expandAll:Gt.collapseAll,title:0===Yl.length?Gt.nothingToFold:void 0,disabled:0===Yl.length,onClick:()=>Mr(e=>{const n=new Set(Yl);return Gl?new Set([...e].filter(e=>!n.has(e))):/* @__PURE__ */new Set([...e,...Yl])}),children:/* @__PURE__ */lt(ht,{expand:Gl})})]}),onHide:oi}),
|
|
49
|
+
/* @__PURE__ */st(Oe,{className:"sf-tree sf-scroll",words:Kt,children:[
|
|
50
|
+
/* @__PURE__ */lt(ze,{words:Kt,icon:/* @__PURE__ */lt(vr,{type:"page",size:13}),name:Gt.pageSettings,onSelect:si,selected:!$t&&Zo,rowProps:{onClick:dl(si)}}),Wl&&/* @__PURE__ */st(dt,{children:[!Al&&/* @__PURE__ */lt(Ne,{children:Gt.header}),Ws(Wl)]}),It&&!(Al&&Wl)&&/* @__PURE__ */st(dt,{children:[!Al&&/* @__PURE__ */lt(Ne,{children:Gt.header}),!Ut&&/* @__PURE__ */lt(ze,{words:Kt,icon:/* @__PURE__ */lt(vr,{type:"header",size:13}),name:Gt.header,badge:Vl?void 0:Hl,shared:Vl,onSelect:di,selected:Xo.kind===Ht?.kind,rowProps:{onClick:dl(di)}})]}),Tl&&!(Al&&Wl)&&nd(Tl,$l,"header"),!Zs&&/* @__PURE__ */lt(Ne,{children:qs}),Zs?/* @__PURE__ */st(dt,{children:[
|
|
51
|
+
/* @__PURE__ */lt(ze,{words:Kt,icon:null,name:qs,fold:{open:!_s,label:qs,onToggle:()=>Rr(kt)}}),!_s&&/* @__PURE__ */lt(Ce,{children:ed})]}):ed,It&&!Al&&/* @__PURE__ */lt(Ne,{children:Gt.footer}),Ml&&!(Al&&Jl)&&nd(Ml,Pl,"footer"),Jl&&Ws(Jl),dr.treeFoot?.()]})]})}),
|
|
52
|
+
/* @__PURE__ */lt(He,{side:"left",width:$r.left,min:Je.left,max:We,defaultWidth:m.left,label:Gt.resizeLeftPanel,onResize:Lr})]}):/* @__PURE__ */lt(N,{side:"left",onShow:oi}),
|
|
53
|
+
/* @__PURE__ */st("div",{ref:Wr,className:"sf-center sf-scroll","data-sf-canvas-head":Kr?"":void 0,style:{overflowX:ei?"auto":"hidden",overflowY:"hidden"},children:[Kr&&/* @__PURE__ */lt("div",{ref:Xr,className:"sf-canvas-head",children:/* @__PURE__ */lt(Kr,{device:ko})}),
|
|
54
|
+
/* @__PURE__ */st("div",{className:"sf-frame-scaler",style:ni,children:[
|
|
55
|
+
/* @__PURE__ */lt("div",{className:"sf-frame "+(ko===go?"":`sf-frame--${ko}`),style:ti,children:/* @__PURE__ */st("div",{className:"sf-preview-host",children:[
|
|
56
|
+
/* @__PURE__ */lt(we.Provider,{value:Ll,children:/* @__PURE__ */lt(xe.Provider,{value:Dl,children:/* @__PURE__ */lt(to,{},Mo)})}),
|
|
57
|
+
/* @__PURE__ */lt(_e,{canvas:Lo,session:ss,model:zs,measure:Os,canDrop:Is,onDrop:Ps,choose:ps,onPick:$s,dropOn:Ts?{accepts:(e,n)=>{if(!e.media||!Ts||n.item.rung)return!1;const t=cn(Bt.data,pi,n.item.id);return null!==t&&Ts.takes(t.node)},onDrop:(e,n)=>(e=>{const n=As();n&&Ts&&Rs(n).then(n=>{n&&Fs(n,e.item.id)})})(n),label:()=>Gt.canvasReplaceImage}:void 0,onZoneAdd:Ds,onSeamAdd:Ds,zoneAddLabel:Gt.canvasAddBlock,words:Xt.canvas,readOnly:Boolean(wt),revision:Bt.data}),Go.length>0&&!Ao&&/* @__PURE__ */lt("div",{className:"sf-preview-gaps",children:Go.map(e=>
|
|
58
|
+
/* @__PURE__ */lt(en,{index:e.index,label:Gt.addSectionHere,onInsert:()=>rl(e.index),className:void 0===e.height?"sf-preview-gap":"sf-preview-gap sf-preview-gap--tight",style:void 0===e.height?{top:e.top}:{top:e.top,height:e.height}},e.index))})]})}),hs?/* @__PURE__ */lt(ft,{canvas:Lo,tabs:ys,onSelect:e=>{const n=ai.findIndex(n=>String(n.props.id)===e);n>=0&&_i(n)}}):null]})]}),uo?/* @__PURE__ */st(dt,{children:[
|
|
59
|
+
/* @__PURE__ */lt(f,{value:{selectChild:Ol,addChild:Nl,childRowName:Fi,blockRowName:Kl},children:/* @__PURE__ */lt(oo,{mode:Xo,onOpenWebsiteSettings:dr.openSettings??(()=>{}),onOpenSiteStyles:dr.openStyles,onSelectNode:xr,onNotify:Hr,onHidePanel:ri,nodeActions:$t?On(jt,$t.type):vt})}),
|
|
60
|
+
/* @__PURE__ */lt(He,{side:"right",width:$r.right,min:Je.right,max:We,defaultWidth:m.right,label:Gt.resizeSettingsPanel,onResize:Ar})]}):
|
|
61
|
+
/* @__PURE__ */lt(N,{side:"right",onShow:ri})]}),Gi.menu,
|
|
62
|
+
/* @__PURE__ */lt(ee,{}),yi?/* @__PURE__ */lt(ct,{name:yi.name,onMake:e=>(async(e,n)=>{const t=ai.find(n=>String(n.props.id)===e),o=Lt.shared;if(!t||!o)return;let r;try{r=await C(gi).create(n,t)}catch{return void Hr(Gt.shared.makeFailed,"error")}o.adopt(t,r),ki(null)})(yi.id,e),onCancel:()=>ki(null)}):null]})}))}export{St as ScreenChrome};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{panelFieldsOf as t}from"./chunk-LER7RKTO.js";import{withoutDeviceGate as o,deviceMetaOf as n}from"./chunk-
|
|
1
|
+
import{panelFieldsOf as t}from"./chunk-LER7RKTO.js";import{withoutDeviceGate as o,deviceMetaOf as n}from"./chunk-FGYJ5DJY.js";import{DESIGN_GROUP_KEY as e,BUCKET_KEY as r}from"./chunk-MQNBD6AB.js";import{STYLE_KIND as s,fieldKind as c,copyStyle as i,heldStyle as p,planPaste as u,pasteMessage as a}from"./chunk-V7U33NF2.js";import{ANCHOR_FIELD_KEYS as f,foldMetaOf as l,MEDIA_FIELD_MARKER as m,TEXT_FIELD_MARKER as h,LINK_FIELD_MARKER as y}from"./chunk-DUVRZ456.js";var j=/* @__PURE__ */new Set([e.Size,e.Design,e.Layout,e.Position]),w=new Set(Object.values(e)),b=new Set(Object.values(r)),S=new Set(f),g=/* @__PURE__ */new Set(["focal","imageFocal"]),k=[m,h,y];function v(t){return`site:${t??""}`}function D(t){if(!t||"object"!=typeof t)return null;const n=t,e=o(t)??t,r=n[s]??e[s];if("string"==typeof r)return r;const i=n.options??e.options;if(Array.isArray(i)){return`choice:${i.map(t=>String(t?.value)).sort().join("|")}`}return c(e)}function O(t){const n=t,e=o(t);return k.some(t=>t in n||e&&t in e)}function d(o,e){const s=t(o,e)??{},c=[];let i=!0,p=!1;for(const[t,o]of Object.entries(s))b.has(t)?(i=t===r.Design,p=!1):w.has(t)?i&&(p=j.has(t)):p&&o&&"object"==typeof o&&!t.startsWith("_")&&(l(o)||S.has(t)||g.has(t)||O(o)||"slot"!==o.type&&c.push({path:[t],kind:D(o),counted:"mobile"!==n(o)?.tier}));return c}function A(t,o,n,e,r){i({scope:n,type:e.type,label:r,rows:t(o,e),props:e.props})}function F(t,o,n,e,r,s){const c=p(n);if(!c)return null;const i=u(c,{type:e.type,rows:t(o,e),props:e.props});return{...i,message:a(i,c.sourceLabel,r,s)}}function L(t,o,n,e){A(d,t,o,n,e)}function R(t,o,n,e,r){return F(d,t,o,n,e,r)}var B={scope:t=>v(t.siteId),rows:(t,o)=>d(t,o),copy:(t,o,n,e)=>L(e,t,o,n),plan:(t,o,n,e)=>R(e,t,o,n)};function J(t,o){if(!t&&!o)return B;const n=t?.rows,e=n?(t,o)=>n(t,o):d;return{scope:t?.scope??B.scope,rows:(t,o)=>e(t,o),copy:t?.copy??((t,o,n,r)=>A(e,r,t,o,n)),plan:t?.plan??((t,n,r,s)=>F(e,s,t,n,r,o))}}export{L as copyNodeStyle,d as nodeStyleRows,R as planNodePaste,D as shopFieldKind,v as siteStyleScope,J as styleClipboardOf};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{MARKUP_TOOLS as e,MARK_PLACEHOLDERS as t}from"efficient-shell/markup";var i={formatting:"Formatting",alignment:"Alignment",marks:{...Object.fromEntries(e.map(e=>[e.style,{name:e.name??e.title,title:e.title}])),underline:{name:"Underline",title:"Underline · [words]{underline}"},sup:{name:"Superscript",title:"Superscript · [words]{sup}"},sub:{name:"Subscript",title:"Subscript · [words]{sub}"}},placeholders:t,showMarks:"Show marks",colors:{title:"Color",theme:"Theme colors",remove:"Remove",any:"Any color",square:"Saturation and brightness",hue:"Hue",hex:"Hex color"},panel:{style:"Style",editStyles:"Edit styles",updateStyle:"Update style",font:"Font",italic:"Italic",list:"List",lists:{none:"No list",bullet:"Bulleted",number:"Numbered"},capitalization:"Capitalization",cases:{none:"As typed",upper:"Uppercase",capitalize:"Capitalized",lower:"Lowercase"}},cells:{fontSize:"Font size",lineHeight:"Line spacing",letterSpacing:"Letter spacing",paragraphSpacing:"Paragraph spacing",tip:({name:e,step:t,unit:i})=>`${e} · step ${t} ${i} · Shift ×10`}};export{i as DEFAULT_COPY_WORDS};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{useEaselHost as n}from"./chunk-U3JP4VGF.js";import{useEaselApi as e,bindUndoKeys as t}from"./chunk-
|
|
1
|
+
import{useEaselHost as n}from"./chunk-U3JP4VGF.js";import{useEaselApi as e,bindUndoKeys as t}from"./chunk-M5Q4VYOH.js";import{useState as r,useEffect as o,useRef as u}from"react";function c(e){const t=n(),[u,c]=r(null);return o(()=>c(e.current),[e]),t.ownsDocument?"undefined"==typeof document?null:document:u}function i(r,u){const i=n(),s=e(),f=c(r);o(()=>{if(!i.ownsDocument&&f)return t(f,s,{leaveTyping:!0})},[i,s,f]);const m=u?.document??null;o(()=>{if(!i.ownsDocument&&m)return t(m,s,{leaveTyping:!0})},[i,s,m])}function s(n){return n.ownsDocument?{}:{tabIndex:-1}}function f(n){return!n.altKey&&!n.shiftKey&&(!(!n.metaKey&&!n.ctrlKey)&&("s"===n.key||"S"===n.key||"KeyS"===n.code))}function m(n,e,t){const r=c(n),i=u(t);o(()=>{i.current=t}),o(()=>{if(!r)return;const n=n=>{f(n)&&(n.preventDefault(),i.current())};return r.addEventListener("keydown",n),()=>r.removeEventListener("keydown",n)},[r]);const s=e?.document??null;o(()=>{if(!s)return;const n=n=>{f(n)&&(n.preventDefault(),i.current())};return s.addEventListener("keydown",n),()=>s.removeEventListener("keydown",n)},[s])}export{s as editorRootFocus,f as isSaveShortcut,c as useEaselKeyTarget,m as useEaselSaveKey,i as useEaselUndoKeys};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{useEaselHost as e}from"./chunk-U3JP4VGF.js";import{createContext as n,useState as t,useEffect as r,useMemo as l,useContext as o,useSyncExternalStore as s,useRef as u}from"react";import{jsx as c}from"react/jsx-runtime";var i=/* @__PURE__ */new Set,f=()=>{for(const e of[...i])e()};function a(){let e=null,n=!1;const t=/* @__PURE__ */new Set,r=()=>{for(const e of[...t])e();f()},l=(t,l)=>{if(!e||e.request.requestId!==t)return;const{resolve:o}=e;e=null,n=!1,r(),o(l)};return{current:()=>e?.request??null,request:n=>new Promise(t=>{const l=e;e={request:n,resolve:t},r(),l?.resolve(null)}),settle:l,cancel:()=>{e&&l(e.request.requestId,null)},browsing:()=>n,browse:()=>{n||(n=!0,r())},close:()=>{e&&l(e.request.requestId,null),n&&(n=!1,r())},subscribe:e=>(t.add(e),()=>{t.delete(e)})}}var p=[],b=null,d=a(),h=()=>p[p.length-1]??b,w=()=>h()?.store??d,q=n(null);function v({panel:n,place:o=null,children:s}){const u=e(),[i]=t(()=>({panel:n,place:o,host:u,store:a()}));i.panel=n,i.place=o,i.host=u,p.includes(i)||(b=i),r(()=>{const e=p.indexOf(i);return e>=0&&p.splice(e,1),p.push(i),b?.host===i.host&&(b=null),f(),()=>{const e=p.indexOf(i);e>=0&&p.splice(e,1),b===i&&(b=null),i.store.cancel(),f()}},[i]);const d=l(()=>({panel:n,place:o,store:i.store}),[n,o,i]);/* @__PURE__ */
|
|
2
|
+
return c(q.Provider,{value:d,children:s})}function m(){return o(q)?.place??null}function g(){return o(q)?.panel??null}function x(e){let n=null;for(let t=p.length-1;t>=0&&!n;t-=1)p[t].host===e&&(n=p[t]);n||b?.host!==e||(n=b);const t=n??h();return t?.panel?t.store:null}function j(){return null!=h()?.panel}function I(e){return w().request(e)}function O(e,n){for(const{store:t}of[...p])t.settle(e,n);b?.store.settle(e,n),d.settle(e,n)}function P(){w().cancel()}var S={current:()=>w().current(),browsing:()=>w().browsing(),browse:()=>w().browse(),close:()=>w().close(),subscribe:e=>(i.add(e),()=>{i.delete(e)}),cancel:()=>w().cancel()};function k(){return o(q)?.store??S}var F=()=>null,G=()=>!1;function J(){const e=k();return s(e.subscribe,e.current,F)}function U(){const e=k();return s(e.subscribe,e.browsing,G)}function V(){return k().browse}function y(){return k().close}function z(e,n){const t=k(),l=u(n);r(()=>{Object.is(l.current,n)||(l.current=n,e&&t.cancel())},[e,n,t])}export{v as MediaPanelProvider,P as cancelPanelPick,a as createMediaPickStore,j as hasMediaPanel,x as mediaPickStoreFor,I as requestPanelPick,O as settlePanelPick,y as useCloseMediaPopup,U as useMediaBrowsing,g as useMediaPanel,m as useMediaPlace,V as useOpenMediaBrowse,J as usePanelPick,z as usePickFollowsSelection};
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import{DEFAULT_CANVAS_WORDS as e}from"./chunk-TBY3DFKS.js";import{useResolvedFields as t}from"./chunk-YRLPFZW3.js";import{toItemSelector as n,fromItemSelector as o,useNodeOps as r,parentStep as i,clickPickPart as l,clickPick as s}from"./chunk-X3TYRF5V.js";import{selectionBox as a,placeWindow as c,offsetOrigin as d,colorRunOf as u,ColorWindow as p,startCanvasTyping as f,textMap as h}from"./chunk-23VM4PMV.js";import{DEFAULT_COPY_WORDS as m}from"./chunk-KRL3IUV3.js";import{useWords as g}from"./chunk-MFIRYGHW.js";import{find as v,ROOT_ID as y,getList as w,remove as b,parseZoneKey as k,move as S,duplicate as C,replaceNode as I,createNode as E,insert as D,normalizeData as x,createResolveCache as M,resolveNodeData as A,ROOT_SLOT as O}from"./chunk-KRXQM65X.js";import{topLevelSlotKeys as R,fieldsFrom as z,defaultsFrom as V}from"./chunk-NKB3KVAB.js";import{setCanvasNonce as P,CANVAS_TYPABLE_EVENT as $,isTypingTarget as B,frameRectToHost as L,CANVAS_TYPING_EVENT as N,drawnBox as K}from"./chunk-X4T6JT3M.js";import{createContext as j,useEffect as Z,useContext as T,useRef as F,useSyncExternalStore as H,useState as W,useMemo as Y,useCallback as q,useLayoutEffect as X}from"react";import{jsx as U,jsxs as G,Fragment as J}from"react/jsx-runtime";import{createPortal as Q}from"react-dom";import{registerModalEscapeInterceptor as _,FloatingBar as ee,TextToolbar as te,LinkPicker as ne}from"efficient-shell/ui";function oe(e){return!["setData","setUi","set"].includes(e.type)}var re=(e,t,n,o)=>{const r=w(e,t,k(n));return r?.[o]??null},ie=(e,t,n,o,r)=>{const i=re(e,t,n,o);if(!i)throw new Error(`${r}: nothing at ${n}[${o}]`);return i};function le(e,t){const{selection:o}=e;return{...e.ui,itemSelector:n(e.data,t,o),selectedSlot:o&&"slot"===o.kind?{parentId:o.parentId,slot:o.slot}:null}}function se(e,t,n){return n?"node"===n.kind?v(e,t,n.id)?n:null:n.parentId===y?w(e,t,n)?n:null:v(e,t,n.parentId)&&w(e,t,n)?n:null:null}function ae(e,t,n,r=!1){const{itemSelector:i,selectedSlot:l,...s}=n;let a=e.selection;var c;return"itemSelector"in n&&(a=o(e.data,t,i??null)),"selectedSlot"in n&&(l?a=(c=l)?{kind:"slot",parentId:c.parentId,slot:c.slot}:null:"slot"===a?.kind&&(a=null)),{...e,selection:a,ui:r?s:{...e.ui,...s}}}function ce(e,t,n){const o=de(e,t,n);if(o===e)return e;const r=se(o.data,n,o.selection);return r===o.selection?o:{...o,selection:r}}function de(e,t,n){const{data:o}=e;switch(t.type){case"setData":{const n="function"==typeof t.data?t.data(o):t.data;return{...e,data:{...o,...n}}}case"setUi":return ae(e,n,"function"==typeof t.ui?t.ui(le(e,n)):t.ui);case"set":{const r={data:o,ui:le(e,n)},i="function"==typeof t.state?t.state(r):t.state;let l=i.data?{...e,data:i.data}:e;return i.ui&&(l=ae(l,n,i.ui,!0)),l}case"insert":{const r={...k(t.destinationZone),index:t.destinationIndex},i=E(n,t.componentType,{},t.id?{id:t.id}:{});return{...e,data:D(o,n,r,i)}}case"replace":{const r=ie(o,n,t.destinationZone,t.destinationIndex,"replace");if(r.props.id!==t.data.props.id)throw new Error("Can't change the id during a replace action. Use remove and insert for a new node.");return{...e,data:I(o,n,r.props.id,t.data)}}case"replaceRoot":{const n={...o.root,props:{...o.root.props,...t.root.props},readOnly:t.root.readOnly};return{...e,data:{...o,root:n}}}case"duplicate":{const r=ie(o,n,t.sourceZone,t.sourceIndex,"duplicate"),i=C(o,n,r.props.id),l=re(i,n,t.sourceZone,t.sourceIndex+1);return{...e,data:i,selection:l?{kind:"node",id:l.props.id}:e.selection}}case"reorder":return de(e,{...t,type:"move",sourceZone:t.destinationZone},n);case"move":{if(t.sourceZone===t.destinationZone&&t.sourceIndex===t.destinationIndex)return e;const r=re(o,n,t.sourceZone,t.sourceIndex);if(!r)return e;const i={...k(t.destinationZone),index:t.destinationIndex};return{...e,data:S(o,n,r.props.id,i)}}case"remove":{const r=ie(o,n,t.zone,t.index,"remove");return{...e,data:b(o,n,r.props.id)}}default:return e}}var ue={drag:!0,duplicate:!0,delete:!0,edit:!0,insert:!0},pe={leftSideBarVisible:!0,rightSideBarVisible:!0,arrayState:{},componentList:{},isDragging:!1,previewMode:"edit",viewports:{current:{width:360,height:"auto"},options:[],controlsVisible:!0},field:{focus:null}},fe=0,he=()=>`history-${fe+=1}`;function me(e){let t=e.config;const r=e.now??(()=>Date.now()),i=e.historyCoalesceMs??250;let l=e.permissions??{};const s=x(e.data,t);let a=s,c={data:s,selection:null,ui:{...pe}};if(e.ui){const{itemSelector:n,selectedSlot:r,...i}=e.ui;c={data:s,selection:r?{kind:"slot",...r}:o(s,t,n??null),ui:{...pe,...i}}}let d=[{core:c,at:-1/0,sealed:!0,id:he()}],u=0;const p=e=>{const t=d[u],n=r();!e&&u===d.length-1&&u>0&&!t.sealed&&n-t.at<i?d=[...d.slice(0,u),{...t,core:c,at:n}]:(d=[...d.slice(0,u+1),{core:c,at:n,sealed:e,id:he()}],u=d.length-1)},f=/* @__PURE__ */new Set;let h=null,m=null,g=0,y=null,b=!1;const k=()=>{for(const e of[...f])e()},S=()=>{d=[...d.slice(0,u),{...d[u],core:c},...d.slice(u+1)]},C=(t,n)=>{g>0?b=b||n:(n?p(!1):c!==t&&S(),c.data!==t.data&&e.onChange?.(c.data),c!==t&&k())},E=e=>{const n=c;if(c=ce(c,e,t),c===n)return;const o=e.recordHistory??oe(e);C(n,o&&c.data!==n.data)},D=t=>{0===g&&(y=c,b=!1),g+=1;try{t()}catch(e){throw g-=1,0===g&&y&&(c=y,y=null),e}if(g-=1,g>0||!y)return;const n=y;y=null,b&&c.data!==n.data?p(!0):c!==n&&S(),c.data!==n.data&&e.onChange?.(c.data),c!==n&&k()},O=e=>{const n=c,o=se(c.data,t,e);var r,i;(r=o,i=c.selection,r===i||r&&i&&r.kind===i.kind&&("node"===r.kind&&"node"===i.kind?r.id===i.id:"slot"===r.kind&&"slot"===i.kind&&r.parentId===i.parentId&&r.slot===i.slot))||(c={...c,selection:o},C(n,!1))},R=t=>{const n=c;u=t,c=d[u].core,c.data!==n.data&&e.onChange?.(c.data),c!==n&&k()},z=()=>(e={})=>{const n=e.root?t.root?.permissions:t.components[e.item?.type??e.type??""]?.permissions;return{...ue,...l,...n}};let V=z();const P=M(),$={resolveCache:P,async resolveAll({trigger:e="load",metadata:n}={}){const o=c.data,r={type:"root",props:{...o.root.props??{}}},i=[...o.content,...Object.values(o.zones??{}).flat()],[l,...s]=await Promise.all([A(r,t,{cache:P,trigger:e,metadata:n}),...i.map(o=>A(o,t,{cache:P,trigger:e,metadata:n}))]);D(()=>{const n=c;let r=c.data;s.forEach((e,n)=>{if(!e.didChange)return;const l=i[n].props.id,s=v(r,t,l)?.node;s&&s===v(o,t,l)?.node&&(r=I(r,t,l,e.node))}),l.didChange&&r.root===o.root&&(r={...r,root:{...r.root,props:l.node.props,readOnly:l.node.readOnly??r.root.readOnly}}),r!==c.data&&("load"===e&&c.data===a&&(a=r),c={...c,data:r,selection:se(r,t,c.selection)},C(n,!1))})},async resolveNode(e,{trigger:n="replace",metadata:o}={}){const r=v(c.data,t,e)?.node;if(!r)return!1;const i=await A(r,t,{cache:P,trigger:n,metadata:o});if(!i.didChange)return!1;let l=!1;return D(()=>{const n=c;if(v(c.data,t,e)?.node!==r)return;const o=I(c.data,t,e,i.node);o!==c.data&&(c={...c,data:o,selection:se(o,t,c.selection)},C(n,!1),l=!0)}),l},get config(){return t},get loaded(){return a},getState(){if(h&&m===c)return h;const e=c,o={data:e.data,ui:le(e,t)},r="node"===e.selection?.kind?v(e.data,t,e.selection.id)?.node??null:null;return h={appState:o,selection:e.selection,selectedItem:r,config:t,dispatch:E,history:{back:()=>$.undo(),forward:()=>$.redo(),hasPast:u>0,hasFuture:u<d.length-1,histories:d.map(e=>({id:e.id,state:{data:e.core.data,ui:le(e.core,t)}})),index:u,setHistoryIndex:e=>{e>=0&&e<d.length&&e!==u&&R(e)}},getPermissions:V,getItemById:n=>v(e.data,t,n)?.node,getItemBySelector:n=>function(e,t,n){const[o,r]=(n.zone??"root:default-zone").split(/:(.*)/s);return w(e,t,{parentId:o,slot:r})?.[n.index]}(e.data,t,n),getSelectorForId:o=>{const r=n(e.data,t,{kind:"node",id:o});return r?{index:r.index,zone:r.zone??"root:default-zone"}:void 0}},m=e,h},subscribe:e=>(f.add(e),()=>{f.delete(e)}),dispatch:E,batch:D,group:()=>{const e=u,t=d[e].id;let n=!0;return{close:()=>{if(!n)return;if(n=!1,d[e]?.id!==t)return;if(u<=e+1)return void(u===e+1&&(d=[...d.slice(0,u),{...d[u],sealed:!0},...d.slice(u+1)]));const o=d[u];d=[...d.slice(0,e+1),{...o,sealed:!0},...d.slice(u+1)],u=e+1}}},select:e=>O(e?{kind:"node",id:e}:null),selectSlot:e=>O(e?{kind:"slot",parentId:e.parentId,slot:e.slot}:null),run(e){D(()=>{const n=c,o=void 0===e.select?c.selection:e.select;c={...c,data:e.data,selection:se(e.data,t,o)},C(n,e.data!==n.data)})},load(e,n={}){const o=c,r=x(e,t);c={...c,data:r,selection:se(r,t,n.selection??c.selection)},a=r,n.keepHistory||(d=[{core:c,at:-1/0,sealed:!0,id:he()}],u=0),c!==o&&k()},undo(){u>0&&R(u-1)},redo(){u<d.length-1&&R(u+1)},setPermissions(e){(function(e,t){if(e===t)return!0;const n=Object.keys(e);return n.length===Object.keys(t).length&&n.every(n=>e[n]===t[n])})(e,l)||(l=e,V=z(),h=null,k())},setConfig(e){e!==t&&(t=e,V=z(),h=null,k())}};return $}function ge(e,t,n={}){const o=e=>{if(e.altKey)return;if(!(e.metaKey!==e.ctrlKey))return;const o="KeyZ"===e.code,r="KeyY"===e.code&&!e.shiftKey;(o||r)&&(n.leaveTyping&&B(e.target)||!1!==t.getState?.().getPermissions().edit&&(e.preventDefault(),r||e.shiftKey?t.redo():t.undo()))};return e.addEventListener("keydown",o),()=>e.removeEventListener("keydown",o)}var ve=j(null),ye=j(!0);function we({easel:e,hotkeys:t=!0,resolveOnMount:n=!0,children:o}){return Z(()=>{n&&e.resolveAll()},[e,n]),Z(()=>{if(t&&"undefined"!=typeof document)return ge(document,e)},[e,t]),/* @__PURE__ */U(ve.Provider,{value:e,children:/* @__PURE__ */U(ye.Provider,{value:t,children:o})})}function be(){const e=T(ve);if(!e)throw new Error("useEasel: no <EaselProvider> above this component");return e}function ke(e){const t=be(),n=F({view:null,selector:null,value:void 0,has:!1}),o=()=>{const o=t.getState(),r=n.current;if(r.has&&r.view===o&&r.selector===e)return r.value;const i=e(o);return r.has&&Object.is(r.value,i)?(n.current={view:o,selector:e,value:r.value,has:!0},r.value):(n.current={view:o,selector:e,value:i,has:!0},i)};return H(t.subscribe,o,o)}function Se(){return function(e){return ke(e)}}var Ce="data-puck-component",Ie="data-puck-dropzone",Ee={},De="data-es-mirror",xe="undefined"==typeof window?Z:X;function Me(e,t,n){for(const e of Array.from(t.head.querySelectorAll(`[${De}]`)))e.remove();for(const o of Array.from(e.head.querySelectorAll('style, link[rel="stylesheet"]'))){const e=o.cloneNode(!0);e.setAttribute(De,""),n&&e.setAttribute("nonce",n),t.head.appendChild(e)}}function Ae({children:t,id:n="preview-frame",title:o,className:r,style:i,mirrorStyles:l=!0,onDocument:s,height:a="auto",nonce:c}){const d=g("canvas",e),u=F(null),[p,f]=W(null);return xe(()=>{const e=u.current,t=p?.ownerDocument.defaultView;if("auto"!==a||!e||!p||!t)return;const n=()=>{e.style.height=`${Math.ceil(p.getBoundingClientRect().height)}px`};n();const o=t.ResizeObserver,r=o?new o(n):null;return r?.observe(p),()=>r?.disconnect()},[p,a]),xe(()=>{let e=u.current?.contentDocument;if(!e)return;"CSS1Compat"!==e.compatMode&&(e.open(),e.write("<!DOCTYPE html><html><head></head><body></body></html>"),e.close(),e=u.current?.contentDocument??e),e.body||e.documentElement.appendChild(e.createElement("body")),e.body.style.margin="0";const t=e.createElement("div");t.setAttribute("data-puck-entry",""),t.id="frame-root","fill"===a&&t.classList.add("es-frame-fill"),e.body.appendChild(t),P(e,c),f(t),s?.(e);let n=null;const o=u.current?.ownerDocument;if(l&&o){Me(o,e,c);const t=o.defaultView;t&&"MutationObserver"in t&&(n=new t.MutationObserver(()=>Me(o,e,c)),n.observe(o.head,{childList:!0,subtree:!0,characterData:!0}))}return()=>{n?.disconnect(),t.remove(),f(null),s?.(null)}},[]),/* @__PURE__ */U("iframe",{ref:u,id:n,title:o??d.frame,className:["es-canvas-frame","fill"===a?"is-fill":"",r??""].filter(Boolean).join(" "),style:i,children:p?Q(t,p):null})}var Oe=j(null),Re=j(Ee),ze=[];function Ve({parentId:e,slot:t,className:n,style:o,minEmptyHeight:r=128,minEmptyWidth:i=120}){const l=be(),s=ke(n=>w(n.appState.data,l.config,{parentId:e,slot:t})??ze),a=ke(t=>"node"===t.selection?.kind&&t.selection.id===e&&e!==y),c=ke(n=>"slot"===n.selection?.kind&&n.selection.parentId===e&&n.selection.slot===t),d=T(Oe),u=["es-zone"];return s.length&&u.push("has-children"),e===y&&u.push("is-root"),(a||c)&&u.push("is-area-selected"),null!==d&&d===e&&e!==y&&u.push("is-hovering-area"),n&&u.push(n),/* @__PURE__ */U("div",{className:u.join(" "),[Ie]:`${e}:${t}`,style:{...o,"--min-empty-height":`${r}px`,"--min-empty-width":`${i}px`},children:s.map(e=>/* @__PURE__ */U(Ze,{node:e},e.props.id))})}function Pe(e,t){return Y(()=>{const n={};for(const o of R(z(e)))n[o]=function(e={}){/* @__PURE__ */
|
|
2
|
+
return U(Ve,{parentId:t,slot:o,...e})};return n},[e,t])}function $e(e){return Y(()=>function({zone:t,...n}){/* @__PURE__ */
|
|
3
|
+
return U(Ve,{parentId:e,slot:t,...n})},[e])}var Be=["top","bottom","zIndex"];function Le(e,t,n){e.style[t]!==n&&(e.style[t]=n)}function Ne(e){const t=function(e){const t=e?.ownerDocument.defaultView?.getComputedStyle(e);if(!t||"sticky"!==t.position)return null;const n=e=>"auto"===e?"":e;return{top:n(t.top),bottom:n(t.bottom),zIndex:n(t.zIndex)}}(function(e){const t=e.ownerDocument.defaultView;let n=null;for(const o of Array.from(e.children))if("none"!==t?.getComputedStyle(o).display){if(n)return null;n=o}return n}(e));Le(e,"position",t?"sticky":"relative");for(const n of Be)Le(e,n,t?.[n]??"");return!!t}var Ke="data-es-canvas-relative";function je(e){e.hasAttribute(Ke)&&("relative"===e.style.position&&(e.style.position=""),e.removeAttribute(Ke));const t=e.ownerDocument.defaultView?.getComputedStyle(e).position;return t&&"static"!==t?"sticky"===t:(e.style.position||(e.style.position="relative",e.setAttribute(Ke,"")),!1)}function Ze({node:e}){const t=be().config.components[e.type],n=e.props.id,o=F(null),r=function(e,t){return Y(()=>n=>{const o=t.current;o&&o!==n&&(o.removeAttribute(Ce),o.removeAttribute("data-puck-dnd")),t.current=n,n&&(n.setAttribute(Ce,e),n.setAttribute("data-puck-dnd",e),je(n))},[e,t])}(n,o),i=F(null),l=!!t?.inline;!function(e,t){const n=F(!1),o=F(()=>{});o.current=()=>{const o=e(),i=n.current;n.current=!!o&&t(o),i!==n.current&&r.current()};const r=F(()=>{});xe(()=>o.current()),xe(()=>{const t=e(),i=t?.ownerDocument.defaultView;if(!t||!i)return;const l=()=>o.current();i.addEventListener("resize",l);const s=i.ResizeObserver,a=s?new s(l):null;a?.observe(t);let c=null;return r.current=()=>{c?.disconnect(),c=null;const e=t.ownerDocument.documentElement;n.current&&e&&i.MutationObserver&&(c=new i.MutationObserver(l),c.observe(e,{attributes:!0}))},r.current(),()=>{i.removeEventListener("resize",l),a?.disconnect(),c?.disconnect(),r.current=()=>{}}},[])}(()=>l?o.current:i.current,e=>l?je(e):Ne(e));const s=T(Re),a=Pe(t,n),c=$e(n);if(!t?.render)return null;const d=t.render,u={...V(t),...e.props,...a},p={renderDropZone:c,isEditing:!0,dragRef:t.inline?r:null,metadata:{...s,...t.metadata}};return t.inline?/* @__PURE__ */U(d,{...u,puck:p,editMode:!0}):
|
|
4
|
+
/* @__PURE__ */U("div",{ref:i,[Ce]:n,"data-puck-dnd":n,style:{position:"relative"},children:/* @__PURE__ */U(d,{...u,puck:p,editMode:!0})})}function Te({metadata:e}){const t=ke(e=>e.config),n=ke(e=>e.appState.data.root).props??{},o=t.root?.render,r=Pe(t.root,y),i=$e(y),l=/* @__PURE__ */U(Ve,{parentId:y,slot:O}),s=o?/* @__PURE__ */U(o,{id:"puck-root",...n,...r,puck:{renderDropZone:i,isEditing:!0,dragRef:null,metadata:e??{}},editMode:!0,children:l}):l;/* @__PURE__ */
|
|
5
|
+
return U(Re.Provider,{value:e??Ee,children:s})}var Fe=j(void 0),He=j(void 0),We=j(void 0);function Ye({element:e}){const t=F(null),n=qe(t,e?()=>e:null,e);/* @__PURE__ */
|
|
6
|
+
return U("div",{ref:t,"aria-hidden":"true",className:"es-canvas-outline is-hover is-hover-part",style:n?{position:"absolute",top:n.top,left:n.left,width:n.width,height:n.height}:{display:"none"}})}function qe(e,t,n){const[o,r]=W(null),i=F(t);return i.current=t,xe(()=>{const t=e.current?.ownerDocument,n=t?.defaultView;if(!t||!n||!i.current)return void r(null);let o=0;const l=()=>{o=0;const n=function(e,t){if(!e||!t)return null;const n=K(e),o=t.getBoundingClientRect();return{top:n.top-o.top,left:n.left-o.left,width:n.width,height:n.height}}(i.current?i.current(t):null,e.current?.parentElement??null);r(e=>{return(t=e)===(o=n)||t&&o&&t.top===o.top&&t.left===o.left&&t.width===o.width&&t.height===o.height?e:n;var t,o})},s=()=>{o||(o=(n.requestAnimationFrame??(e=>n.setTimeout(e,16)))(l))};l();const a="MutationObserver"in n?new n.MutationObserver(s):null;a?.observe(t.body,{childList:!0,subtree:!0,attributes:!0,characterData:!0});const c="ResizeObserver"in n?new n.ResizeObserver(s):null;return c?.observe(t.documentElement),n.addEventListener("resize",s),()=>{a?.disconnect(),c?.disconnect(),n.removeEventListener("resize",s),o&&(n.cancelAnimationFrame??n.clearTimeout)(o)}},[n]),o}function Xe({id:e,kind:t,overlay:n}){const o=F(null),r=T(He),i=null!==e&&!0===r?.(e),l=qe(o,e?t=>t.querySelector(`[${Ce}="${t.defaultView?.CSS?.escape?t.defaultView.CSS.escape(e):e}"]`):null,e),s=/* @__PURE__ */U("div",{ref:o,"aria-hidden":"true",className:`es-canvas-outline is-${t}${i?" is-shared":""}`,style:l?{position:"absolute",top:l.top,left:l.left,width:l.width,height:l.height}:{display:"none"}});return n&&e?/* @__PURE__ */U(n,{componentId:e,kind:t,children:s}):s}function Ue(e,t,n){const o=h(e,n),r=o.text.length,i=e.ownerDocument;if(!t)return[r,r];let l=null;const s=i.caretPositionFromPoint?.(t.x,t.y);if(s&&e.contains(s.offsetNode))l=o.at(s.offsetNode,s.offset);else{const n=i.caretRangeFromPoint?.(t.x,t.y);n&&e.contains(n.startContainer)&&(l=o.at(n.startContainer,n.startOffset))}if(null===l)return[r,r];const a=o.text;let c=l,d=l;for(;c>0&&!/\s/.test(a[c-1]);)c-=1;for(;d<a.length&&!/\s/.test(a[d]);)d+=1;return[c,d]}function Ge({s:e,element:t,toolbar:n,label:o,keys:r}){const i=g("copy",m),l=e.pressed(),s=new Set(n.offered),f=n.colors&&n.colors.length>0?n.colors:null,h=F(null),[v,y]=W(!1),[w,b]=W(null),k=v||null!==w,S=()=>{e.hold(),y(!1),b({href:e.pressed().href})},C=()=>{y(!1),b(null),e.resume()};X(()=>{r.current={escape:()=>!!k&&(C(),!0),link:()=>!!s.has("link")&&(S(),!0)}}),X(()=>()=>{r.current=null},[r]);const I=F(C);I.current=C,Z(()=>{if(v)return _(e=>{const t=h.current;return!!("Escape"===e.key&&t&&e.target instanceof Node&&t.contains(e.target))&&(I.current(),!0)},()=>h.current?.querySelector(".es-copy-colors"))},[v]),Z(()=>{const n=h.current;if(!k||!n)return;const o=/* @__PURE__ */new Set([n.ownerDocument]),r=t();r&&o.add(r.ownerDocument);const i=o=>{const r=o.target;if(r&&n.contains(r))return;y(!1),b(null);const i=t();r&&i&&i.contains(r)?e.release():e.stop("outside")};for(const e of o)e.addEventListener("pointerdown",i,!0);return()=>{for(const e of o)e.removeEventListener("pointerdown",i,!0)}},[k,e,t]),X(()=>{const e=h.current,n=e?.querySelector(".rosh-tb-wrap > .es-copy-pop"),o=t();if(!(k&&e&&n&&o))return;const r=o.ownerDocument.defaultView?.getSelection()??null,i=r&&r.rangeCount>0&&o.contains(r.getRangeAt(0).startContainer)?r.getRangeAt(0):null,l=(i?a(i,o):null)??(()=>{const e=o.getBoundingClientRect();return{left:e.left,top:e.top,right:e.right,bottom:e.bottom}})(),s=o.ownerDocument.defaultView?.frameElement,u=s?L(s,{left:l.left,top:l.top,width:l.right-l.left,height:l.bottom-l.top}):{left:l.left,top:l.top,width:l.right-l.left,height:l.bottom-l.top},p=o.getBoundingClientRect(),f=s?L(s,{left:p.left,top:p.top,width:p.width,height:p.height}):{left:p.left,top:p.top,width:p.width,height:p.height},m=(e.closest("[data-floating-bar]")??e).getBoundingClientRect(),g={left:u.left,right:u.left+u.width,top:Math.min(u.top,f.top-6,m.top),bottom:Math.max(u.top+u.height,f.top+f.height+6,m.bottom)},v=e.ownerDocument.documentElement,y=(s??o.closest(".es-canvas")??o).getBoundingClientRect(),w={left:Math.max(0,y.left),top:Math.max(0,y.top),right:Math.min(v.clientWidth||y.right,y.right),bottom:Math.min(v.clientHeight||y.bottom,y.bottom)};if(w.right<=w.left||w.bottom<=w.top||0===n.offsetWidth)return;const b=c({anchor:g,size:{width:n.offsetWidth,height:n.offsetHeight},within:{left:y.left,top:y.top,right:y.right,bottom:y.bottom},clip:w,parent:d(n)});n.style.top=`${b.top}px`,n.style.left=`${b.left}px`,n.style.setProperty("--es-pop-point",`${b.point}px`),n.dataset.side=b.above?"above":"below"});const E=f?{run:u(l.color,f),open:v,onToggle:()=>{b(null),v?C():(e.hold(),y(!0))}}:void 0;/* @__PURE__ */
|
|
7
|
+
return U(ee,{anchor:()=>{const e=t();if(!e)return null;const n=e.getBoundingClientRect(),o=e.ownerDocument.defaultView?.frameElement,r=o?L(o,{left:n.left,top:n.top,width:n.width,height:n.height}):{left:n.left,top:n.top,width:n.width,height:n.height};return{left:r.left-6,top:r.top-6,right:r.left+r.width+6,bottom:r.top+r.height+6}},bounds:()=>{const e=t(),n=e?.ownerDocument.defaultView?.frameElement,o=(n??e?.closest(".es-canvas")??e)?.getBoundingClientRect();return o?{left:o.left,top:o.top,right:o.right,bottom:o.bottom}:{left:0,top:0,right:window.innerWidth,bottom:window.innerHeight}},"aria-label":o,children:/* @__PURE__ */U("div",{ref:h,children:/* @__PURE__ */U(te,{layout:"row",offered:s,pressed:l.marks,onMark:t=>{"link"===t?S():e.press(t)},color:E,linkOpen:null!==w,list:{pressed:l.list,onList:t=>e.list(t)},alignment:n.alignment,letterCase:n.letterCase,last:n.lastTool?.({className:"rosh-tb-btn",disabled:!1,selected:l.selected,keepCaret:t=>{t.preventDefault(),e.hold()},insert:t=>e.insert(t)}),windows:/* @__PURE__ */G(J,{children:[v&&f?/* @__PURE__ */U(p,{colors:f,current:l.color,words:i.colors??m.colors,onPick:t=>e.color(t)}):null,w?
|
|
8
|
+
/* @__PURE__ */U(ne,{className:"es-copy-link es-copy-pop",value:w.href??"",onApply:t=>{b(null),e.link(t)},onRemove:null!==w.href?()=>{b(null),e.link(null)}:void 0,onCancel:C}):null]})})})})}function Je({element:e}){const t=F(null),n=qe(t,()=>e(),e);/* @__PURE__ */
|
|
9
|
+
return U("div",{ref:t,"aria-hidden":"true",className:"es-canvas-outline is-typing",style:n?{position:"absolute",top:n.top,left:n.left,width:n.width,height:n.height}:{display:"none"}})}function Qe({frame:t=!0,className:n,style:o,metadata:r,mirrorStyles:a,onDocument:c,height:d,title:u,nonce:p,hotkeys:h,frameWrapper:m,overlay:v,children:y,typing:w,passThrough:b}){const k=be(),S=T(Fe),C=b??S,I=T(ye),E=g("canvas",e),D=h??I,[x,M]=W(void 0),A=ke(e=>"node"===e.selection?.kind?e.selection.id:null),[O,R]=W(null),[z,V]=W(null),P=T(We),[B,L]=W(null),K=F(null),[,j]=W(0),H=F(w);H.current=w;const Y=F(null),q=F(null),X=ke(e=>e.appState.data);Z(()=>{const e=q.current?.ownerDocument,t=e?.defaultView?.CustomEvent;if(!e||!t)return;const n=A&&!B&&H.current?.atSelection?.()?A:null;e.dispatchEvent(new t($,{detail:{id:n}}))},[A,B,X]);const J=e=>{const t=q.current?.ownerDocument,n=t?.defaultView?.CustomEvent;t&&n&&t.dispatchEvent(new n(N,{detail:{typing:e}}))},Q=(e,t)=>{K.current?.s.stop("stop");const n=e.element();if(!n)return!1;const o=k.group(),r=e.element,i=f({element:r,value:e.value,rules:e.rules,multiline:e.multiline,skip:e.skip,caret:Ue(n,t,e.skip),write:e.write,remount:e.remount,onSelect:()=>j(e=>e+1),onEscape:()=>Y.current?.escape()??!1,onLinkKey:()=>Y.current?.link()??!1,end:e=>{o.close(),K.current?.element===r&&(K.current=null),L(null),J(!1),H.current?.onChange?.({typing:!1,why:e})}});if(!i)return o.close(),!1;const l=n.closest?.(`[${Ce}]`)?.getAttribute(Ce);return l&&k.select(l),K.current={s:i,element:r,target:e},L(()=>r),R(null),J(!0),H.current?.onChange?.({typing:!0,element:n}),!0};Z(()=>()=>K.current?.s.stop("stop"),[]);const _=e=>{const t=K.current?.element();return Boolean(t&&t.contains(e))},ee=e=>{const t=e.closest?.(`[${Ce}]`)?.getAttribute(Ce);if(!t)return;const n=k.getState(),o="node"===n.selection?.kind?n.selection.id:null,r=P?.partAt(e,t)??null;if(r){const e=l(n.appState.data,k.config,t,r.id,o,P?.selected()??null,C);if(e)return{node:e.node,part:e.part?r:null}}return{node:s(n.appState.data,k.config,t,o,C)??t,part:null}},te=e=>{if("Enter"!==e.key||e.defaultPrevented||e.shiftKey||e.metaKey||e.ctrlKey||e.altKey)return;if(K.current)return;const t=e.target;if(t?.isContentEditable||t?.closest?.("input, textarea, select, button"))return;const n=H.current?.atSelection?.();n&&Q(n,null)&&e.preventDefault()},ne=/* @__PURE__ */G("div",{ref:q,className:"es-canvas-content",style:{position:"relative"},onClick:e=>{const t=e.target;if(t.closest?.("a[href]")&&e.preventDefault(),K.current){if(_(t))return;K.current.s.stop("outside")}const n=t.ownerDocument?.getSelection?.();n&&n.rangeCount>0&&n.isCollapsed&&n.removeAllRanges();const o=ee(t);if(void 0!==o)return k.select(o.node),void(P&&(o.part?.id??null)!==P.selected()&&P.select(o.part?.id??null));t.hasAttribute?.(Ie)||(k.select(null),P?.selected()&&P.select(null))},onDoubleClick:e=>{const t=H.current;if(!t||_(e.target))return;const n=t.at(e.target);n&&Q(n,{x:e.clientX,y:e.clientY})&&e.preventDefault()},onKeyDown:e=>te(e),onMouseOver:e=>{if(K.current)return;const t=ee(e.target),n=t?.part&&t.part.id!==P?.selected()?t.part.element:null,o=t&&!t.part?t.node:null;o!==O&&R(o),n!==z&&V(n)},onMouseLeave:()=>{R(null),V(null)},children:[
|
|
10
|
+
/* @__PURE__ */U(Oe.Provider,{value:O,children:/* @__PURE__ */U(Te,{metadata:r})}),
|
|
11
|
+
/* @__PURE__ */G("div",{className:"es-canvas-outlines",style:{position:"absolute",top:0,left:0,pointerEvents:"none"},children:[
|
|
12
|
+
/* @__PURE__ */U(Xe,{id:!B&&O&&O!==A?O:null,kind:"hover",overlay:v}),P?/* @__PURE__ */U(Ye,{element:B?null:z}):null,
|
|
13
|
+
/* @__PURE__ */U(Xe,{id:B?null:A,kind:"selected",overlay:v}),B?/* @__PURE__ */U(Je,{element:B}):null]}),y]}),oe=m?/* @__PURE__ */U(m,{document:x,children:ne}):ne;Z(()=>{if(x&&D)return ge(x,k)},[x,D,k]),Z(()=>{if(!x)return;const e=e=>{if("Enter"===e.key)return void te(e);if("Escape"!==e.key||e.defaultPrevented)return;const t=e.target;if(t?.isContentEditable||t?.closest?.("input, textarea, select"))return;const n=k.getState();if("node"!==n.selection?.kind)return;if(P?.selected())return void P.select(null);const o=i(n.appState.data,k.config,n.selection);"node"===o?.kind&&k.select(o.id)};return x.addEventListener("keydown",e),()=>x.removeEventListener("keydown",e)},[x,k,P]);/* @__PURE__ */
|
|
14
|
+
return G("div",{className:"es-canvas"+(n?` ${n}`:""),style:o,"data-puck-preview":"","data-es-typing":B?"":void 0,children:[B&&K.current?.target.toolbar?/* @__PURE__ */U(Ge,{s:K.current.s,element:K.current.element,toolbar:K.current.target.toolbar,label:E.textTools,keys:Y}):null,t?/* @__PURE__ */U(Ae,{mirrorStyles:a,onDocument:e=>{M(e??void 0),c?.(e)},height:d,title:u,nonce:p,children:oe}):/* @__PURE__ */U("div",{id:"preview-frame","data-puck-entry":"",children:oe})]})}function _e(e={}){const t=be(),n=ke(e=>e.appState.data);return r({...e,data:n,config:t.config,commit:(e,{select:n})=>t.run({data:e,select:n})})}function et(){const e=be(),n=ke(e=>e.config),o=e.resolveCache,r=ke(e=>e.selectedItem),i=ke(e=>e.appState.data.root),l=r?r.props.id:"root",s=i.props??{},a=Y(()=>r||{type:"root",props:s},[r,s]),c=r?n.components[r.type]:n.root,d=e.getState(),u=r?v(d.appState.data,n,l):null,p=u&&"root"!==u.place.parentId?u.place.parentId:null,f=p?d.getItemById(p)??null:null,{fields:h}=t({id:l,node:a,block:c,parent:f,appState:d.appState}),m=ke(e=>!1===e.getPermissions(r?{item:r}:{root:!0}).edit),g=q(t=>{(async()=>{const r=e.getState();if("root"!==l){const i=r.getItemById(l),s=r.getSelectorForId(l);if(!i||!s)return;const a={...i,props:{...i.props,...t}},{node:c}=await A(a,n,{cache:o,trigger:"replace"}),d=e.getState().getSelectorForId(l);if(!d)return;return void e.dispatch({type:"replace",destinationZone:d.zone??"root:default-zone",destinationIndex:d.index,data:c})}const i=r.appState.data.root.props??{},{node:s}=await A({type:"root",props:{...i,...t}},n,{cache:o,trigger:"replace"});e.dispatch({type:"replaceRoot",root:{props:s.props,readOnly:s.readOnly},recordHistory:!0})})()},[e,n,o,l]),y=q((e,t)=>g({[e]:t}),[g]);return{id:l,node:a,fields:h,values:a.props,readOnly:m,onChange:y,onChangeMany:g}}export{Ae as CanvasFrame,We as CanvasPartsContext,Fe as CanvasPassThroughContext,He as CanvasSharedContext,pe as DEFAULT_UI,Qe as EaselCanvas,we as EaselProvider,Te as EditDocument,ge as bindUndoKeys,me as createEasel,Se as createUseEasel,oe as recordsByDefault,ce as reduce,le as uiView,ke as useEasel,be as useEaselApi,_e as useEaselNodeOps,et as useSelectedFields,se as validSelection};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{routeSharedHostMessage as e}from"./chunk-EZG3TGQ7.js";import{describeLoadFailure as r,hostLoadRefusal as n}from"./chunk-ERR437B5.js";import{editLockOf as t}from"./chunk-GMCZXMOV.js";import{NO_DOCUMENT_ADDRESSING as o}from"./chunk-RLBXE4EU.js";import{saveStatusOf as u,resetForDocumentSwitch as a}from"./chunk-HNKB2ZYR.js";import{isExpiredSession as s,readEaselFailure as i}from"./chunk-CLOS6SSX.js";import{useAdminBridge as l}from"./chunk-VPFNZ7TB.js";import{STATUS_UNREACHABLE as c}from"./chunk-KCOBHPN6.js";import{useEaselSession as d}from"./chunk-O7Q4DDJT.js";import{backendOf as f,setSessionDocumentSite as m}from"./chunk-RSCMJIWS.js";import{useEaselHost as k}from"./chunk-U3JP4VGF.js";import{DEFAULT_SCREEN_WORDS as v}from"./chunk-23DYNW6S.js";import{useAutosave as g}from"./chunk-NDRZP6YR.js";import{canWriteDocument as p,newEaselClientId as h,reloadIfVersionMoved as y,openUnansweredClaim as w,FAIL_OPEN_RETRY_MS as S,CLAIM_FAIL_OPEN_MS as b,holderOf as P}from"./chunk-THWO5YVZ.js";import{useWords as I}from"./chunk-MFIRYGHW.js";import{createContext as j,useContext as R,useState as B,useMemo as E,useCallback as C,useEffect as H,useRef as O}from"react";import{jsx as T}from"react/jsx-runtime";var D={content:[],root:{},zones:{}};var N=j(null);function M(){const e=R(N);if(!e)throw new Error("useStorefrontDocument must be used within StorefrontDocumentProvider");return e}function A({target:j,addressing:R=o,onHostMessage:M,children:A}){const F=R,{homeSlug:V,entryMayBounce:L,entryBounce:W,onSwitch:Y,tellsHost:Z,adapterFor:G,migrateRenamedProps:U,describeMissing:x,onLoadFailed:J}=F,[K,X]=B(j),Q=k(),z=d(),_=E(()=>f(z),[z]),q=E(()=>t(z),[z]),$="template"===K.kind,ee="template"===K.kind?K.id:null,re="template"===K.kind?K.pageSlug??V??"":"document"===K.kind?K.slug??"":K.slug,ne="page"===K.kind?K.siteId??null:null,te=z.blocks,oe=E(()=>G(K,_,te),[G,_,te,K.kind,"template"===K.kind?K.id:"document"===K.kind?K.record:K.siteId]),ue=oe.capabilities,ae=C(e=>z.documentHooks?.stored?.(e)??e,[z]);H(()=>{m(z,ne)},[z,ne]);const se=O(K);H(()=>{se.current=K},[K]);const{token:ie,tokenRef:le,capabilities:ce}=l({onMessage:r=>{if(M?.(r)||e(r))return;const n=r;if("storefront-editor:navigate"===n?.type){const e=r;e?.target&&Br(e.target)}}}),de=!z.usesBridgedToken||null!==ie,fe=oe.lock,me=Boolean(_.lock),[ke,ve]=B(null),[ge,pe]=B(null),[he,ye]=B(null),[we,Se]=B(null),be=I("screen",v),Pe=we?function(e,r){if(null!==e.sentence)return e.sentence;if(!e.missing)return r.loadFailed({cause:e.cause});switch(e.target.kind){case"template":return r.missingTemplatePage;case"document":return r.missingDocument;default:return r.missingPage({slug:e.slug})}}(we,be):null,[Ie,je]=B(null),Re=O(null),Be=O(null),[Ee,Ce]=B(!1),He=O(null),[Oe,Te]=B(null),De=O(null),[Ne,Me]=B(null),[Ae,Fe]=B(!1),Ve=O(null);H(()=>{Ve.current=Ne},[Ne]);const[Le,We]=B(ue.hasEditLock?{kind:"checking"}:{kind:"editing"}),Ye=O(Le);H(()=>{Ye.current=Le},[Le]);const Ze=O(()=>Promise.resolve(!1)),Ge=C(e=>{Be.current=e,Ce(!0)},[]),Ue=g({save:async({id:e,data:r})=>{if(p(Ye.current)){if(!await Ze.current(e,r)){if(!p(Ye.current))return void Ge({id:e,data:r});throw new Error("page save did not land")}}else Ge({id:e,data:r})},onFailure:(e,r)=>{0===r&&Q.send("storefront-editor:save-failed")}}),{state:xe,push:Je,flush:Ke,pause:Xe,resume:Qe,stop:ze,reset:_e,retryNow:qe,hasPending:$e}=Ue,er=O(xe);H(()=>{er.current=xe},[xe]);const rr=u(xe),nr=C(()=>{const e=Be.current;e&&(Be.current=null,Ce(!1),Je(e))},[Je]),tr=O("");tr.current||(tr.current=h());const[or,ur]=B(0),ar=O(!1),[sr,ir]=B(L(j)),lr=O(!1);H(()=>{if(lr.current)return;lr.current=!0;const e=Q.address.search(),r=W(j,e);r?Q.address.load(r):L(j)&&ir(!1)},[j,Q]);const cr=Q.send;H(()=>{if(!de)return;let e=!1;const t=se.current,o=oe.resolve(re),u=z.documentHooks?.opening?.({slug:re,isTemplate:$,capabilities:ue});return o.then(async r=>{if(e)return;if(!r)return"page"===t.kind&&null!==V&&re!==V?void Q.address.load({kind:"page",slug:V,siteId:ne??void 0}):(Se({target:t,slug:re,missing:!0,sentence:x?.(t)??null}),void J?.(t,null));const n=r.readOnlyReason?r.readOnlyReason:null;Re.current=n,je(n),ve(r.id),pe(r.kind??null),De.current=r.version??null;const o=r.layout,a=o&&Object.keys(o).length?o:D,s=U(a),i=u?await u(s):s;e||ye(i)}).catch(o=>{e||(console.error("[storefront-editor] document load failed",o),Se({target:t,slug:re,missing:!1,sentence:n(o,{slug:re},z),cause:r(o,z)}),J?.(t,o))}),()=>{e=!0}},[de,ie,$,oe,re]);const dr=C(e=>new Promise(r=>{const n=Date.now(),t=setInterval(()=>{const o=le.current;o&&o!==e?(clearInterval(t),r(o)):Date.now()-n>6e3&&(clearInterval(t),r(null))},200)}),[]),fr=C(async e=>{const r=le.current;if(!r&&z.usesBridgedToken)return{ok:!1,error:new Error("no editor token")};try{return{ok:!0,value:await e(r??"")}}catch(n){if(s(n,z)){cr("storefront-editor:auth-expired");const n=r?await dr(r):null;if(n)try{return{ok:!0,value:await e(n)}}catch(e){return{ok:!1,error:e}}}return{ok:!1,error:n}}},[cr,dr,z]),mr=C(async e=>{const r=le.current?await fr(e):{ok:!1};return r.ok||cr("storefront-editor:save-failed"),r.ok},[cr,fr]),kr=C(async(e,r,n=!1)=>{if(null!==Re.current)return!1;if(!p(Ye.current))return!1;if(Ve.current)return!1;const t=await fr(()=>oe.saveLayout(e,r,De.current,tr.current));if(t.ok)return De.current=t.value.version??De.current,Fe(!1),!0;const o=q.readLockTaken(t.error);if(o){const e={kind:"takenover",holder:o};return Ye.current=e,We(e),!1}const u=q.readSaveConflict(t.error);if(u){if(u.savedByYou&&!n&&oe.rereadVersion){const n=await fr(()=>oe.rereadVersion(e));if(n.ok&&n.value)return De.current=n.value,Ze.current(e,r,!0)}ze(),Ve.current=u,Me(u)}return Fe(i(t.error,z)?.status===c),!1},[oe,fr,ze,z]);H(()=>{Ze.current=kr},[kr]);const vr=C(e=>{if(null!==Re.current)return;if(cr("storefront-editor:dirty"),!ke)return;const r=ae(e);He.current=r,p(Ye.current)?Je({id:ke,data:r}):Ge({id:ke,data:r})},[ke,cr,Ge,Je,ae]),gr=C(async()=>{p(Ye.current)&&nr();return await Ke()&&null==Be.current},[nr,Ke]),pr=O(gr);H(()=>{pr.current=gr},[gr]);const hr=O(fr);H(()=>{hr.current=fr},[fr]);const yr=C(()=>{Q.address.reload()},[Q]),wr=O(()=>Promise.resolve(!1));H(()=>{wr.current=()=>{const e=oe.rereadVersion;return ke&&e?y({ours:De.current,stored:async()=>{const r=await hr.current(()=>e(ke));return r.ok?r.value:null},hasPending:()=>null!=Be.current||$e(),reload:yr}):Promise.resolve(!1)}},[oe,ke,$e,yr]);const Sr=null!==Ie;H(()=>{if(!fe||!ke||!de||Sr)return;let e=!1,r=null,n=null;const t=tr.current,o={claim:async e=>{const r=await hr.current(()=>fe.claim(ke,t,e));if(r.ok)return{heartbeat_seconds:r.value.heartbeatSeconds};throw r.error},cancelled:()=>e,currentAccess:()=>Ye.current,heldWrite:()=>({pending:null!=Be.current||$e(),autoSaveEnabled:!er.current.paused,saveConflict:null!=Ve.current}),setAccess:e=>{Ye.current=e,We(e)},releaseHeldWrite:()=>{pr.current()},startHeartbeat:e=>{r&&clearInterval(r),r=setInterval(()=>{u(!1)},e)},stopHeartbeat:()=>{r&&(clearInterval(r),r=null)},reloadIfMoved:()=>{wr.current()}},u=q.makeClaimBeat(o),a=ar.current;return ar.current=!1,a||(We({kind:"checking"}),n=setTimeout(()=>{n=null,w(o)&&o.startHeartbeat(S)},b)),u(a).finally(()=>{n&&clearTimeout(n),n=null}),()=>{e=!0,n&&clearTimeout(n),r&&clearInterval(r),fe.release(ke,t).catch(()=>{})}},[ke,fe,de,ie,or,Sr]);const br=C(()=>{fe&&ke&&(ar.current=!0,ur(e=>e+1))},[ke,fe]),Pr=C(()=>{We(e=>{const r="blocked"===e.kind||"takenover"===e.kind?e.holder:null;return r?{kind:"readonly",holder:r}:e})},[]),Ir=C(()=>{er.current.paused?(p(Ye.current)&&nr(),Qe()):Xe()},[nr,Xe,Qe]),jr=C(()=>{qe()},[qe]),Rr=C(e=>{He.current=null,a("template"!==e.kind&&me,{resetAutosave:()=>{_e(),Be.current=null,Ce(!1)},setVersion:e=>{De.current=e},setSaveConflict:Me,setAccess:We}),Y(e),X(e),Re.current=null,je(null),ve(null),pe(null),ye(null),Se(null),Q.address.show(e),"document"!==e.kind&&Z(e)&&Q.send("storefront-editor:navigated",{target:e})},[_e,Q,me,Y,Z]),Br=C(e=>{if(function(e,r,n){if(e.kind!==r.kind)return!1;if("template"===e.kind){const t=r;return e.id===t.id&&(e.pageSlug??n)===(t.pageSlug??n)}if("document"===e.kind){const n=r;return e.record===n.record&&(e.slug??"")===(n.slug??"")}const t=r;return e.slug===t.slug&&e.siteId===t.siteId}(e,se.current,V))return;const r=null!=Be.current;if(!r&&!$e())return void Rr(e);const n=er.current;r||n.paused||n.failed||n.stopped?Te(e):Ke().then(r=>{r?Rr(e):Te(e)})},[Rr,$e,Ke,V]),Er=C(()=>Te(null),[]),Cr=C(()=>{Te(e=>(e&&Rr(e),null))},[Rr]),Hr=C(async()=>{const e=Oe;if(!e)return;await gr()&&(Te(null),Rr(e))},[Oe,gr,Rr]),Or=C(async e=>{if(null!==Re.current)return;if(!ke)return;if(!p(Ye.current)||Ve.current)return;const r=ae(e);if(!await kr(ke,r))return void(Ve.current||cr("storefront-editor:save-failed"));const n=oe.publish;if(!ue.canPublish||!n)return void cr("storefront-editor:saved");const t=await fr(()=>n(ke,De.current??void 0));if(!t.ok){const{error:e}=t;return void cr("storefront-editor:publish-failed",{reason:e instanceof Error&&e.message?e.message:null})}De.current=t.value.version??De.current,cr("storefront-editor:published")},[ke,oe,ue.canPublish,cr,kr,fr,ae]);/* @__PURE__ */
|
|
2
|
+
return T(N.Provider,{value:{target:K,adapter:oe,capabilities:ue,templateId:ee,currentSlug:re,currentKind:ge,siteId:ne,ready:de,token:ie,tokenRef:le,notifyParent:cr,bridgeCapabilities:ce,runAuthed:mr,docId:ke,data:he,getLiveData:()=>He.current??he,error:Pe,redirecting:sr,saveStatus:rr,saveState:xe,autoSaveEnabled:!xe.paused,autoSaveStoppedByConflict:xe.stopped,hasUnsavedEdits:xe.pending||Ee,toggleAutoSave:Ir,retrySave:jr,onChange:vr,flushSave:gr,onPublish:Or,access:Le,readOnly:null!==P(Le)||null!==Ie||null!==Ne,readOnlyReason:Ie,takeOverEditing:br,viewReadOnly:Pr,saveConflict:Ne,saveUnreachable:Ae,reloadFromServer:yr,navigate:Br,pendingNav:Oe,cancelPendingNav:Er,discardAndNavigate:Cr,saveAndNavigate:Hr},children:A})}export{N as ScreenDocumentContext,A as ScreenDocumentProvider,M as useScreenDocument};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{useMediaPanel as o,usePanelPick as r,useMediaBrowsing as n,useCloseMediaPopup as t,settlePanelPick as e}from"./chunk-LNHT2KPX.js";import{jsx as i}from"react/jsx-runtime";function c(){const c=o(),s=r(),u=n(),m=t();return c?/* @__PURE__ */i(c,{pick:s,browsing:u,onPick:o=>{s&&e(s.requestId,o)},onClose:m}):null}export{c as MediaPopup};
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import{clientOnly as r}from"./chunk-GXQCZJOP.js";import{ScreenChrome as n}from"./chunk-GNMBJUG7.js";import{ScreenStoreProvider as e}from"./chunk-YZALWZT7.js";import{ScreenDocumentProvider as i,useScreenDocument as a}from"./chunk-M62P4IQK.js";import{DEFAULT_SCREEN_WORDS as o}from"./chunk-23DYNW6S.js";import{documentPermissions as s}from"./chunk-THWO5YVZ.js";import{useWords as c}from"./chunk-MFIRYGHW.js";import{useMemo as t,useState as d,useRef as l,useEffect as m,useCallback as g}from"react";import{Dialog as h,Button as f}from"efficient-shell/ui";import{jsx as u,jsxs as p,Fragment as v}from"react/jsx-runtime";var k=r(e),N=r(n);function C({onCancel:r,onDiscard:n,onSave:e}){const i=c("screen",o).leave,[a,s]=d(!1),t=l(!0);m(()=>(t.current=!0,()=>{t.current=!1}),[]);const k=g(async()=>{s(!0);try{await e()}finally{t.current&&s(!1)}},[e]);/* @__PURE__ */
|
|
2
|
+
return u(h,{open:!0,role:"alertdialog",size:"sm",title:i.title,onClose:r,footer:/* @__PURE__ */p(v,{children:[
|
|
3
|
+
/* @__PURE__ */u(f,{variant:"secondary",onClick:r,children:i.cancel}),
|
|
4
|
+
/* @__PURE__ */u(f,{variant:"ghost-danger",onClick:n,children:i.discard}),
|
|
5
|
+
/* @__PURE__ */u(f,{variant:"primary",loading:a,onClick:()=>{k()},children:i.save})]}),children:i.body})}function j({target:r,addressing:n,onHostMessage:e,children:a}){/* @__PURE__ */
|
|
6
|
+
return u(i,{target:r,addressing:n,onHostMessage:e,children:a})}var y=(r,n)=>/* @__PURE__ */p(v,{children:[r,n]});function M({config:r,parts:n,wrap:e=y}){const{data:i,error:d,redirecting:l,ready:m,readOnly:g,onChange:h,pendingNav:f,cancelPendingNav:p,discardAndNavigate:v,saveAndNavigate:j}=a(),M=t(()=>s(!g),[g]),A=c("screen",o);return l?/* @__PURE__ */u("div",{className:"sf-msg",children:A.loading}):d?/* @__PURE__ */u("div",{className:"sf-msg sf-msg--error",children:d}):m?i?e(
|
|
7
|
+
/* @__PURE__ */u(k,{config:r,data:i,onChange:h,permissions:M,parts:n,children:/* @__PURE__ */u(N,{})}),f&&/* @__PURE__ */u(C,{onCancel:p,onDiscard:v,onSave:j})):/* @__PURE__ */u("div",{className:"sf-msg",children:A.loading}):/* @__PURE__ */u("div",{className:"sf-msg",children:A.waitingForAuthorization})}export{M as DocumentScreen,j as ScreenMount};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{useNow as e,describeSave as t}from"./chunk-RKTF5XLP.js";import{SaveIcon as a}from"./chunk-
|
|
1
|
+
import{useNow as e,describeSave as t}from"./chunk-RKTF5XLP.js";import{SaveIcon as a}from"./chunk-ZG6PVMC3.js";import{SplitButton as l,Kbd as i,CMD_S as n}from"efficient-shell/ui";import{CloudIcon as s,CheckIcon as o}from"efficient-shell/icons/efficient";import{jsx as r,jsxs as d}from"react/jsx-runtime";var c=e=>e.state.failed&&null!=e.state.retryAt||null!=e.state.savedAt;function u({input:l,words:i}){const n=e(c(l)),s=t({...l,now:n},i);/* @__PURE__ */
|
|
2
2
|
return r(a,{state:s.state,label:s.label})}function m({input:a,action:u,readOnly:m,saveSwitch:y,onToggleAutoSave:b,onSaveNow:p,bar:v,words:f}){const k=e(c(a)),h=t({...a,now:k},f),w=h.retry?v.retry:v.saveNow,g=/* @__PURE__ */d("span",{className:"es-savemenu-row",children:[w,
|
|
3
|
-
/* @__PURE__ */r("span",{"aria-hidden":"true",children:/* @__PURE__ */r(i,{keys:n,size:"sm"})})]}),S=[{type:"status",key:"status",label:h.line(u.status)},...(u.goingLive??[]).map((e,t)=>({type:"status",key:`going-live-${t}`,label:e})),{type:"divider",key:"divider"},...y?[{type:"checkbox",key:"auto-save",label:v.autoSave,checked:!a.state.paused,disabled:m,onSelect:b}]:[],{key:"save-now",label:g,icon:/* @__PURE__ */r(s,{}),disabled:m,onSelect:p},...u.menuItems?.length?[{type:"divider",key:"layer-divider"},...u.menuItems.map(e=>({key:`layer-${e.key}`,label:e.label,icon:e.icon,disabled:e.disabled,onSelect:e.onSelect}))]:[]],
|
|
4
|
-
return r(l,{variant:
|
|
3
|
+
/* @__PURE__ */r("span",{"aria-hidden":"true",children:/* @__PURE__ */r(i,{keys:n,size:"sm"})})]}),S=[{type:"status",key:"status",label:h.line(u.status)},...(u.goingLive??[]).map((e,t)=>({type:"status",key:`going-live-${t}`,label:e})),{type:"divider",key:"divider"},...y?[{type:"checkbox",key:"auto-save",label:v.autoSave,checked:!a.state.paused,disabled:m,onSelect:b}]:[],{key:"save-now",label:g,icon:/* @__PURE__ */r(s,{}),disabled:m,onSelect:p},...u.menuItems?.length?[{type:"divider",key:"layer-divider"},...u.menuItems.map(e=>({key:`layer-${e.key}`,label:e.label,icon:e.icon,disabled:e.disabled,onSelect:e.onSelect}))]:[]],j=u.quiet??null,x=h.blocked??u.disabledReason??j?.reason??null;/* @__PURE__ */
|
|
4
|
+
return r(l,{variant:j?"secondary":"primary",leftIcon:j?/* @__PURE__ */r(o,{}):void 0,onClick:()=>u.onPress(),disabled:null!==x,disabledReason:x??void 0,tooltip:u.tooltip,loading:!0===u.busy,menuLabel:v.saveOptions,items:S,menuMinWidth:300,children:j?j.label:u.label})}export{m as ScreenMainButton,u as ScreenSaveIcon};
|