efficient-easel 20.0.0 → 20.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{ScreenDocumentContext-RxVWWWHq.d.ts → ScreenDocumentContext-CFJeqqKk.d.ts} +27 -2
- package/dist/chrome/chrome.css +2 -1
- package/dist/chunk-276MBG5P.js +2 -0
- package/dist/chunk-2BOXPUGF.js +1 -0
- package/dist/{chunk-MS2U6MV5.js → chunk-2G6MAXPY.js} +1 -1
- package/dist/chunk-3R3PEVU7.js +65 -0
- package/dist/{chunk-EZG3TGQ7.js → chunk-77IWWW6X.js} +1 -1
- package/dist/{chunk-SK3P56FS.js → chunk-7LYKFL3Q.js} +13 -13
- package/dist/{chunk-ROPYFLNZ.js → chunk-EFHV56BO.js} +13 -13
- package/dist/chunk-FGJTX2DL.js +8 -0
- package/dist/{chunk-LNHT2KPX.js → chunk-FHCKFOCD.js} +2 -2
- package/dist/{chunk-LDEEFLE3.js → chunk-H2PRGXCW.js} +8 -8
- package/dist/{chunk-KC24D76S.js → chunk-I7BROL77.js} +1 -1
- package/dist/{chunk-BW5COX42.js → chunk-JQXD3TDE.js} +1 -1
- package/dist/{chunk-2A7HLAI5.js → chunk-L2Y3PF2R.js} +1 -1
- package/dist/chunk-MEHLY5Q4.js +1 -0
- package/dist/chunk-MQA7OFRA.js +2 -0
- package/dist/{chunk-RR4VIAHP.js → chunk-OTONLZR4.js} +4 -4
- package/dist/chunk-PAOZMXEI.js +5 -0
- package/dist/{chunk-2E2SXDYQ.js → chunk-TNGOL65V.js} +1 -1
- package/dist/{chunk-VPFNZ7TB.js → chunk-U66YKDAR.js} +1 -1
- package/dist/{chunk-5DPIGWUL.js → chunk-UJ46J7QW.js} +1 -1
- package/dist/{chunk-RYNBSKE7.js → chunk-UNVKPVZW.js} +1 -1
- package/dist/chunk-WEIE2FBC.js +1 -0
- package/dist/copy/index.js +12 -12
- package/dist/drag/index.js +1 -1
- package/dist/easel/index.js +1 -1
- package/dist/fields/index.js +1 -1
- package/dist/screen/components/AddBlockRow.js +1 -1
- package/dist/screen/components/AddSidePanel.js +1 -1
- package/dist/screen/components/MediaPopup.js +1 -1
- package/dist/screen/components/NodeContextMenu.d.ts +1 -1
- package/dist/screen/components/NodeContextMenu.js +1 -1
- package/dist/screen/components/PageEditGuardNotices.js +1 -1
- package/dist/screen/components/SaveControls.d.ts +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 +1 -1
- package/dist/screen/components/ScreenMount.js +1 -1
- package/dist/screen/components/ScreenStoreProvider.d.ts +1 -1
- package/dist/screen/components/ScreenStoreProvider.js +1 -1
- package/dist/screen/components/SectionScreenShell.js +16 -16
- package/dist/screen/components/usePartBridge.d.ts +1 -1
- package/dist/screen/components/usePartBridge.js +1 -1
- package/dist/screen/index.d.ts +1 -1
- package/dist/screen/index.js +1 -1
- package/dist/screen/lib/admin-bridge.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 +1 -1
- package/dist/screen/lib/host.js +1 -1
- package/dist/screen/lib/key-scope.js +1 -1
- package/dist/screen/lib/media-panel.d.ts +1 -1
- package/dist/screen/lib/media-panel.js +1 -1
- package/dist/screen/lib/media-picker.d.ts +1 -1
- package/dist/screen/lib/media-picker.js +1 -1
- package/dist/screen/lib/puck/preview-dom.js +1 -1
- package/dist/screen/lib/puck/style-clipboard.d.ts +1 -1
- 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/screen-parts.d.ts +6 -1
- package/dist/screen/lib/screen-parts.js +1 -1
- package/dist/screen/screen.css +37 -0
- package/dist/strings/index.js +1 -1
- package/dist/text-styles/index.js +27 -27
- package/package.json +1 -1
- package/dist/chunk-A42LPWNM.js +0 -1
- package/dist/chunk-BC5KJNHN.js +0 -63
- package/dist/chunk-CBICQ4J3.js +0 -5
- package/dist/chunk-EW6XAMDZ.js +0 -8
- package/dist/chunk-M62P4IQK.js +0 -2
- package/dist/chunk-NHY5L3SE.js +0 -1
- package/dist/chunk-QALW2ECZ.js +0 -1
- package/dist/chunk-U3JP4VGF.js +0 -2
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import * as react from 'react';
|
|
2
2
|
import { ComponentType, ReactNode } from 'react';
|
|
3
|
-
import { H as HostPickedMedia, c as EaselHost } from '../../ScreenDocumentContext-
|
|
3
|
+
import { H as HostPickedMedia, c as EaselHost } from '../../ScreenDocumentContext-CFJeqqKk.js';
|
|
4
4
|
import '../../blocks/index.js';
|
|
5
5
|
import '../../types-Cq53lL8d.js';
|
|
6
6
|
import '../../data/index.js';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export{MediaPanelProvider,cancelPanelPick,createMediaPickStore,hasMediaPanel,mediaPickStoreFor,requestPanelPick,settlePanelPick,useCloseMediaPopup,useMediaBrowsing,useMediaPanel,useMediaPlace,useOpenMediaBrowse,usePanelPick,usePickFollowsSelection}from"../../chunk-
|
|
1
|
+
export{MediaPanelProvider,cancelPanelPick,createMediaPickStore,hasMediaPanel,mediaPickStoreFor,requestPanelPick,settlePanelPick,useCloseMediaPopup,useMediaBrowsing,useMediaPanel,useMediaPlace,useOpenMediaBrowse,usePanelPick,usePickFollowsSelection}from"../../chunk-FHCKFOCD.js";import"../../chunk-MQA7OFRA.js";
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { H as HostPickedMedia, c as EaselHost } from '../../ScreenDocumentContext-
|
|
1
|
+
import { H as HostPickedMedia, c as EaselHost } from '../../ScreenDocumentContext-CFJeqqKk.js';
|
|
2
2
|
import 'react';
|
|
3
3
|
import '../../blocks/index.js';
|
|
4
4
|
import '../../types-Cq53lL8d.js';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export{requestMediaPick,resolveMediaPick}from"../../chunk-
|
|
1
|
+
export{requestMediaPick,resolveMediaPick}from"../../chunk-UNVKPVZW.js";import"../../chunk-FHCKFOCD.js";import"../../chunk-MQA7OFRA.js";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export{gotoPreviewSlide,pinPreviewToBottom,pinPreviewToSection,previewFrame,scrollPreviewToSection,scrollPreviewToTop}from"../../../chunk-
|
|
1
|
+
export{gotoPreviewSlide,pinPreviewToBottom,pinPreviewToSection,previewFrame,scrollPreviewToSection,scrollPreviewToTop}from"../../../chunk-TNGOL65V.js";import"../../../chunk-R5L2E7JX.js";import"../../../chunk-IQ5TA7AM.js";import"../../../chunk-LF3FUSCQ.js";
|
|
@@ -27,7 +27,7 @@ import '../section-template-types.js';
|
|
|
27
27
|
import './content-tree.js';
|
|
28
28
|
import '../shared-section-types.js';
|
|
29
29
|
import './block-choice.js';
|
|
30
|
-
import '../../../ScreenDocumentContext-
|
|
30
|
+
import '../../../ScreenDocumentContext-CFJeqqKk.js';
|
|
31
31
|
import '../document-contract.js';
|
|
32
32
|
import '../document-switch.js';
|
|
33
33
|
import '../../../engine-CvXpFE86.js';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export{copyNodeStyle,nodeStyleRows,planNodePaste,shopFieldKind,siteStyleScope,styleClipboardOf}from"../../../chunk-JBOSEHIX.js";import"../../../chunk-LER7RKTO.js";import"../../../chunk-FGYJ5DJY.js";import"../../../chunk-7F52SZOI.js";import"../../../chunk-MQNBD6AB.js";import"../../../chunk-23DYNW6S.js";import"../../../chunk-V7U33NF2.js";import"../../../chunk-6WY6ZXJG.js";import"../../../chunk-
|
|
1
|
+
export{copyNodeStyle,nodeStyleRows,planNodePaste,shopFieldKind,siteStyleScope,styleClipboardOf}from"../../../chunk-JBOSEHIX.js";import"../../../chunk-LER7RKTO.js";import"../../../chunk-FGYJ5DJY.js";import"../../../chunk-7F52SZOI.js";import"../../../chunk-MQNBD6AB.js";import"../../../chunk-23DYNW6S.js";import"../../../chunk-V7U33NF2.js";import"../../../chunk-6WY6ZXJG.js";import"../../../chunk-BPXEFVSQ.js";import"../../../chunk-MFIRYGHW.js";import"../../../chunk-BSPCSC45.js";import"../../../chunk-DUVRZ456.js";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export{useSectionOps}from"../../../chunk-
|
|
1
|
+
export{useSectionOps}from"../../../chunk-WEIE2FBC.js";import"../../../chunk-PAOZMXEI.js";import"../../../chunk-FHCKFOCD.js";import"../../../chunk-MQA7OFRA.js";import"../../../chunk-EFHV56BO.js";import"../../../chunk-TBY3DFKS.js";import"../../../chunk-7LYKFL3Q.js";import"../../../chunk-BPXEFVSQ.js";import"../../../chunk-A6Z4SD3I.js";import"../../../chunk-K56YDHYQ.js";import"../../../chunk-ZEH6QLBH.js";import"../../../chunk-IWCKVZHS.js";import"../../../chunk-BSHIQIZC.js";import"../../../chunk-FIVU2COQ.js";import"../../../chunk-RC25EGHD.js";import"../../../chunk-KFV7N2DJ.js";import"../../../chunk-23VM4PMV.js";import"../../../chunk-KRL3IUV3.js";import"../../../chunk-ZOBSIXRD.js";import"../../../chunk-QAJAEWCZ.js";import"../../../chunk-WRFD4EXD.js";import"../../../chunk-VANKQVOW.js";import"../../../chunk-MFIRYGHW.js";import"../../../chunk-3S5N4HLJ.js";import"../../../chunk-K7BTCBWD.js";import"../../../chunk-L55YIXDC.js";import"../../../chunk-P2VEMZH5.js";import"../../../chunk-QIDRJH3S.js";import"../../../chunk-PLVEGYK6.js";import"../../../chunk-LF3FUSCQ.js";
|
|
@@ -10,7 +10,7 @@ import { E as EaselRailItem } from '../../types-Cy7rdmXt.js';
|
|
|
10
10
|
import { StyleRow } from '../../style-clipboard/index.js';
|
|
11
11
|
import { T as TreeRowMark } from '../../types-Bqq6ya0y.js';
|
|
12
12
|
import { AddKey } from '../components/AddSidePanel.js';
|
|
13
|
-
import {
|
|
13
|
+
import { p as AnyScreenTarget } from '../../ScreenDocumentContext-CFJeqqKk.js';
|
|
14
14
|
import { HostProduct } from './host-chrome.js';
|
|
15
15
|
import { EaselSession } from './session.js';
|
|
16
16
|
import { SharedSectionUse, SharedSection } from './shared-section-types.js';
|
|
@@ -460,6 +460,11 @@ interface ScreenBridges {
|
|
|
460
460
|
* the document is read (the website's Preview, the email designer's "Send
|
|
461
461
|
* a test email"). */
|
|
462
462
|
barTrail?: () => ReactNode;
|
|
463
|
+
/** …and `barView` stands in the CENTRE cluster, right after Refresh: a way
|
|
464
|
+
* to look at the document drawn as an icon beside the preview's own
|
|
465
|
+
* controls (the website's Preview, owner 2026-10-25). A layer that has one
|
|
466
|
+
* hands it here instead of `barTrail`. */
|
|
467
|
+
barView?: () => ReactNode;
|
|
463
468
|
/**
|
|
464
469
|
* …and `barMain` IS the main button, in its place at the end of the cluster
|
|
465
470
|
* (0.103.0): the layer's own way to finish with the document — the campaign
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export{SELECTION_MODE,ScreenCanvasTargetProvider,ScreenPartsProvider,isPinnedFirst,isPinnedLast,isSlotMode,sameInspectorMode,screenSlotsOf,useScreenBlockLook,useScreenBlockRules,useScreenBridges,useScreenCanvasDrag,useScreenCanvasFrame,useScreenCanvasHead,useScreenCanvasTarget,useScreenDevices,useScreenDocumentLabel,useScreenDocumentPass,useScreenInspectorPanel,useScreenLeftView,useScreenNodeKeys,useScreenNotify,useScreenOwnerName,useScreenParts,useScreenPickFollowsSelection,useScreenPinned,useScreenSaveSwitch,useScreenStorageNamespace,useScreenStyleClipboard,useStandaloneScreenBridges}from"../../chunk-
|
|
1
|
+
export{SELECTION_MODE,ScreenCanvasTargetProvider,ScreenPartsProvider,isPinnedFirst,isPinnedLast,isSlotMode,sameInspectorMode,screenSlotsOf,useScreenBlockLook,useScreenBlockRules,useScreenBridges,useScreenCanvasDrag,useScreenCanvasFrame,useScreenCanvasHead,useScreenCanvasTarget,useScreenDevices,useScreenDocumentLabel,useScreenDocumentPass,useScreenInspectorPanel,useScreenLeftView,useScreenNodeKeys,useScreenNotify,useScreenOwnerName,useScreenParts,useScreenPickFollowsSelection,useScreenPinned,useScreenSaveSwitch,useScreenStorageNamespace,useScreenStyleClipboard,useStandaloneScreenBridges}from"../../chunk-PAOZMXEI.js";import"../../chunk-FHCKFOCD.js";import"../../chunk-MQA7OFRA.js";import"../../chunk-EFHV56BO.js";import"../../chunk-TBY3DFKS.js";import"../../chunk-7LYKFL3Q.js";import"../../chunk-BPXEFVSQ.js";import"../../chunk-A6Z4SD3I.js";import"../../chunk-K56YDHYQ.js";import"../../chunk-ZEH6QLBH.js";import"../../chunk-IWCKVZHS.js";import"../../chunk-BSHIQIZC.js";import"../../chunk-FIVU2COQ.js";import"../../chunk-RC25EGHD.js";import"../../chunk-KFV7N2DJ.js";import"../../chunk-23VM4PMV.js";import"../../chunk-KRL3IUV3.js";import"../../chunk-ZOBSIXRD.js";import"../../chunk-QAJAEWCZ.js";import"../../chunk-WRFD4EXD.js";import"../../chunk-VANKQVOW.js";import"../../chunk-MFIRYGHW.js";import"../../chunk-3S5N4HLJ.js";import"../../chunk-K7BTCBWD.js";import"../../chunk-L55YIXDC.js";import"../../chunk-P2VEMZH5.js";import"../../chunk-QIDRJH3S.js";import"../../chunk-PLVEGYK6.js";import"../../chunk-LF3FUSCQ.js";
|
package/dist/screen/screen.css
CHANGED
|
@@ -859,3 +859,40 @@
|
|
|
859
859
|
flex: none;
|
|
860
860
|
background: var(--es-panel);
|
|
861
861
|
}
|
|
862
|
+
|
|
863
|
+
/* Hide panel first, a divider, then the tabs (owner 2026-10-25). The tabs keep
|
|
864
|
+
the row's remaining width, shared equally as before; the divider is the
|
|
865
|
+
panel head's own (`.sf-head-divider`'s colour and height). */
|
|
866
|
+
.es-paneltabs--with-hide {
|
|
867
|
+
display: flex;
|
|
868
|
+
align-items: center;
|
|
869
|
+
gap: 4px;
|
|
870
|
+
padding-left: 8px;
|
|
871
|
+
}
|
|
872
|
+
.es-paneltabs--with-hide > :last-child {
|
|
873
|
+
flex: 1;
|
|
874
|
+
min-width: 0;
|
|
875
|
+
}
|
|
876
|
+
.es-paneltabs-divider {
|
|
877
|
+
width: 1px;
|
|
878
|
+
height: 18px;
|
|
879
|
+
background: var(--es-divider);
|
|
880
|
+
flex: none;
|
|
881
|
+
}
|
|
882
|
+
|
|
883
|
+
/* A labelled button in the top bar (the Media library; a host's own, such as
|
|
884
|
+
the admin portal's JARVIS): its icon at the bar's glyph size, the same as
|
|
885
|
+
`.es-iconbtn`'s, so every icon on the bar is one size. */
|
|
886
|
+
.es-barbtn svg {
|
|
887
|
+
width: 16px;
|
|
888
|
+
height: 16px;
|
|
889
|
+
}
|
|
890
|
+
|
|
891
|
+
/* The bar's left end has the room its right end has (owner 2026-10-25: "no
|
|
892
|
+
padding on the left of the Media Library"): the bar pads only its right. */
|
|
893
|
+
.es-cluster--left {
|
|
894
|
+
display: flex;
|
|
895
|
+
align-items: center;
|
|
896
|
+
gap: 4px;
|
|
897
|
+
padding-left: 12px;
|
|
898
|
+
}
|
package/dist/strings/index.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{DEFAULT_SCREEN_WORDS as r}from"../chunk-23DYNW6S.js";import{DEFAULT_STYLE_CLIPBOARD_WORDS as o}from"../chunk-6WY6ZXJG.js";import{DEFAULT_TEXT_STYLES_WORDS as n}from"../chunk-OGH6CC3E.js";import{
|
|
1
|
+
import{DEFAULT_SCREEN_WORDS as r}from"../chunk-23DYNW6S.js";import{DEFAULT_STYLE_CLIPBOARD_WORDS as o}from"../chunk-6WY6ZXJG.js";import{DEFAULT_TEXT_STYLES_WORDS as n}from"../chunk-OGH6CC3E.js";import{DEFAULT_PICK_WORDS as t}from"../chunk-OFBZOI6W.js";import{DEFAULT_CANVAS_WORDS as c}from"../chunk-TBY3DFKS.js";import{DEFAULT_TREE_WORDS as e}from"../chunk-K56YDHYQ.js";import{DEFAULT_NODE_MENU_WORDS as m}from"../chunk-WK3AFPXY.js";import{DEFAULT_PANEL_WORDS as i}from"../chunk-KFV7N2DJ.js";import{DEFAULT_SAVE_WORDS as s}from"../chunk-H6DDIBQ4.js";import{DEFAULT_CHROME_WORDS as u,DEFAULT_NOTICE_WORDS as f}from"../chunk-AJSDWWJW.js";import{DEFAULT_RAIL_WORDS as p}from"../chunk-2OAZYSWJ.js";import{DEFAULT_LOCK_WORDS as l}from"../chunk-RE4LP46F.js";import{DEFAULT_COPY_WORDS as h}from"../chunk-KRL3IUV3.js";import{DEFAULT_FIELDS_WORDS as j}from"../chunk-WRFD4EXD.js";import{stringsContext as k}from"../chunk-MFIRYGHW.js";import{DEFAULT_DRAG_WORDS as a}from"../chunk-KAML3KQH.js";import{useContext as W,useMemo as D}from"react";import{jsx as Y}from"react/jsx-runtime";var y={notice:f,lock:l,save:s,chrome:u,rail:p,tree:e,panel:i,fields:j,pick:t,drag:a,menu:m,styleClipboard:o,copy:h,canvas:c,textStyles:n,screen:r},F=r=>"object"==typeof r&&null!==r;function K(r,o){const n={};for(const t of Object.keys(r)){const c=r[t],e=o[t];null==e?n[t]=c:F(c)?n[t]=F(e)?K(c,e):c:n[t]=typeof e==typeof c?e:c}return n}function d(r,o){return o?K(r,o):r}function v({value:r,locale:o,children:n}){const t=k(),c=W(t),e=c?.strings??y,m=o??c?.locale??"en",i=D(()=>({strings:d(e,r),locale:m}),[e,r,m]);/* @__PURE__ */
|
|
2
2
|
return Y(t.Provider,{value:i,children:n})}function H(){return W(k())?.strings??y}function J(){return W(k())?.locale??"en"}export{y as DEFAULT_EASEL_STRINGS,v as EaselStringsProvider,d as mergeEaselStrings,J as useEaselLocale,H as useEaselStrings};
|
|
@@ -1,36 +1,36 @@
|
|
|
1
|
-
import{
|
|
1
|
+
import{hexReadout as e,ColourWindow as s,typedHex as t}from"../chunk-U6LJ5UKD.js";import{DEFAULT_TEXT_STYLES_WORDS as a}from"../chunk-OGH6CC3E.js";export{DEFAULT_TEXT_STYLES_WORDS}from"../chunk-OGH6CC3E.js";import"../chunk-OFBZOI6W.js";import{FieldSlider as n}from"../chunk-ZEH6QLBH.js";import{FieldSelect as l}from"../chunk-QAJAEWCZ.js";import"../chunk-WRFD4EXD.js";import{useWords as i}from"../chunk-MFIRYGHW.js";import{withTip as r}from"../chunk-P2VEMZH5.js";import{TEXT_STYLE_KINDS as o,canAddTextStyle as d,TEXT_STYLE_MAX as c,isDefaultTextStyle as u,CAMPAIGN_TEXT_STYLE_SETTINGS as m,TEXT_STYLE_SETTINGS as h,textStyleRowSize as f,describeTextStyle as p,updateTextStyle as v,textStyleCaseCss as y,TEXT_STYLE_CASES as S,addTextStyle as g,removeTextStyle as b,TEXT_STYLE_RANGES as k}from"../chunk-YHZSBL2N.js";export{CAMPAIGN_TEXT_STYLE_SETTINGS,TEXT_STYLE_CASES,TEXT_STYLE_CASE_CSS,TEXT_STYLE_DEFAULT_COUNT,TEXT_STYLE_KINDS,TEXT_STYLE_MAX,TEXT_STYLE_RANGES,TEXT_STYLE_SETTINGS,addTextStyle,canAddTextStyle,defaultTextStyles,describeTextStyle,isDefaultTextStyle,isTextStyleCase,removeTextStyle,resolveTextStyle,textStyleCaseCss,textStyleCaseOfCss,textStyleRowSize,updateTextStyle,weightWord}from"../chunk-YHZSBL2N.js";import{hsvToHex as N,Tooltip as C,ColorSwatch as x,IconButton as T}from"efficient-shell/ui";import{useState as w,useRef as E,useId as z,useEffect as O,Fragment as _}from"react";import{TrashIcon as L,ChevronIcon as A,BoldIcon as j,ItalicIcon as M,CaseLowerIcon as $,CaseCapitalizedIcon as D,CaseUpperIcon as W,CaseNormalIcon as Y}from"efficient-shell/icons/efficient";import{jsxs as I,jsx as X,Fragment as H}from"react/jsx-runtime";var B=`conic-gradient(${[0,60,120,180,240,300,0].map(e=>N({h:e,s:1,v:1})).join(", ")})`;function F({value:t,hex:a,colours:n,label:l,followsWord:i,anyWord:r,onChange:o,readOnly:d=!1}){const[c,u]=w(!1),m=E(null),h=E(null),f=z(),p=void 0!==t&&n.some(e=>e.key===t),v=void 0!==t&&!p;return O(()=>{if(!c)return;const e=m.current?.ownerDocument;if(!e)return;const s=e=>{m.current&&!m.current.contains(e.target)&&u(!1)};return e.addEventListener("click",s,!0),()=>e.removeEventListener("click",s,!0)},[c]),/* @__PURE__ */I("div",{ref:m,className:"es-ts-set","data-ts-setting":"color",children:[
|
|
2
2
|
/* @__PURE__ */I("div",{className:"es-ts-top",children:[
|
|
3
3
|
/* @__PURE__ */X("span",{className:"es-ts-sub",children:l}),
|
|
4
|
-
/* @__PURE__ */X("span",{className:"es-ts-colour-read",children:
|
|
5
|
-
/* @__PURE__ */I("div",{className:"es-ts-swatches",role:"group","aria-label":l,children:[n.map(s=>/* @__PURE__ */X(C,{content:`${s.name} · ${
|
|
6
|
-
/* @__PURE__ */X(C,{content:r,children:/* @__PURE__ */X(x,{ref:h,color:B,size:"sm",className:"es-ts-swatch es-ts-swatch--any","aria-label":r,selected:v,"aria-expanded":c,"aria-controls":c?f:void 0,disabled:d,onClick:()=>u(e=>!e)})})]}),c?/* @__PURE__ */X(
|
|
7
|
-
return X("div",{className:"es-ts",ref:Y,children:
|
|
8
|
-
return I(R,{label:A.groups[
|
|
9
|
-
return X(G,{style:
|
|
10
|
-
/* @__PURE__ */X("span",{className:"es-ts-add-word",children:A.add[
|
|
11
|
-
/* @__PURE__ */X("span",{className:"es-ts-count",children:A.count({n:
|
|
4
|
+
/* @__PURE__ */X("span",{className:"es-ts-colour-read",children:a?e(a):i})]}),
|
|
5
|
+
/* @__PURE__ */I("div",{className:"es-ts-swatches",role:"group","aria-label":l,children:[n.map(s=>/* @__PURE__ */X(C,{content:`${s.name} · ${e(s.value)}`,children:/* @__PURE__ */X(x,{color:s.value,size:"sm",className:"es-ts-swatch","aria-label":s.name,selected:t===s.key,disabled:d,onClick:()=>o(s.key)})},s.key)),
|
|
6
|
+
/* @__PURE__ */X(C,{content:r,children:/* @__PURE__ */X(x,{ref:h,color:B,size:"sm",className:"es-ts-swatch es-ts-swatch--any","aria-label":r,selected:v,"aria-expanded":c,"aria-controls":c?f:void 0,disabled:d,onClick:()=>u(e=>!e)})})]}),c?/* @__PURE__ */X(s,{id:f,value:a??"",onChange:e=>o(e),label:l,readOnly:d,onClose:()=>{u(!1),h.current?.focus()}}):null]})}function P({styles:e,onChange:s,fonts:t,colours:n=[],settings:l=m,auto:h=[],fallback:f,sample:p,openId:v,defaultOpenId:y=null,onOpenChange:S,onAdd:k,rowActions:N,onRemove:C,max:x=c,device:T="desktop",readOnly:_=!1}){const A=i("textStyles",a),j=z(),[M,$]=w(y),D=void 0!==v?v:M,W=e=>{void 0===v&&$(e),S?.(e)},Y=E(null),[B,F]=w(null);O(()=>{if(!B||!Y.current)return;const e=[...Y.current.querySelectorAll(".es-ts-item")].find(e=>e.dataset.tsId===B.id),s=e?e.querySelector(".es-ts-row"):Y.current.querySelector(`.es-ts-add[data-ts-kind="${B.kind}"]`);s?.focus(),F(null)},[B]);/* @__PURE__ */
|
|
7
|
+
return X("div",{className:"es-ts",ref:Y,children:o.map(a=>{const i=e.filter(e=>e.kind===a),o=!d(e,a,x),c=!_&&!o;/* @__PURE__ */
|
|
8
|
+
return I(R,{label:A.groups[a],children:[i.map(a=>{const i=N?.(a),o=null!=i&&!1!==i,d=Boolean(C)&&!_&&!u(a);/* @__PURE__ */
|
|
9
|
+
return X(G,{style:a,fonts:t,colours:n,settings:l,auto:h,fallback:f,sample:p,device:T,readOnly:_,open:D===a.id,onOpenChange:e=>W(e?a.id:null),onChange:t=>s(e.map(e=>e.id===t.id?t:e)),actions:d||o?/* @__PURE__ */I(H,{children:[d?r(A.remove,/* @__PURE__ */X("button",{type:"button",className:"es-ts-del","aria-label":A.removeNamed({name:a.name}),onClick:()=>(t=>{if(_||!C)return;const a=b(e,t.id,{name:A.styleName});if(!a)return;const n=e.filter(e=>e.kind===t.kind),l=n[n.indexOf(t)+1];D===t.id&&W(null),s(a.styles),C(a.removed),F({id:l?.id??null,kind:t.kind})})(a),children:/* @__PURE__ */X(L,{size:14,"aria-hidden":"true"})})):null,o?i:null]}):null},a.id)}),r(!_&&o?A.full({kind:a,max:x}):void 0,/* @__PURE__ */I("button",{type:"button",className:"es-ts-add","data-ts-kind":a,disabled:_,"aria-disabled":!(_||!o)||void 0,"aria-describedby":!_&&o?`${j}-full-${a}`:void 0,onClick:()=>{c&&(t=>{if(_)return;const a=g(e,t,{max:x,name:A.styleName,make:k});a&&s(a.styles)})(a)},children:[
|
|
10
|
+
/* @__PURE__ */X("span",{className:"es-ts-add-word",children:A.add[a]}),
|
|
11
|
+
/* @__PURE__ */X("span",{className:"es-ts-count",children:A.count({n:i.length,max:x})})]})),_||!o?null:/* @__PURE__ */X("span",{id:`${j}-full-${a}`,className:"es-vh",children:A.full({kind:a,max:x})})]},a)})})}function R({label:e,children:s}){const t=z();/* @__PURE__ */
|
|
12
12
|
return I("section",{className:"es-ts-section","aria-labelledby":t,children:[
|
|
13
|
-
/* @__PURE__ */X("div",{className:"es-ts-group",id:t,children:e}),s]})}function G({style:
|
|
13
|
+
/* @__PURE__ */X("div",{className:"es-ts-group",id:t,children:e}),s]})}function G({style:e,fonts:s,colours:t=[],settings:n=m,auto:l=[],fallback:r,sample:o,open:d,onOpenChange:c,onChange:u,actions:y,device:S="desktop",readOnly:g=!1}){const b=i("textStyles",a),k=`${z()}-open-${e.id}`,N=new Set(l),C=h.filter(e=>n.includes(e)),x={...r?.(e)??{},...e.values},T="phone"===S,w=T&&void 0!==e.values.sizePhone?{...x,size:e.values.sizePhone}:x,E=s.find(e=>e.value===x.font),O={fontFamily:E?.family,fontSize:`${f(w.size??16)}px`,fontWeight:x.weight,fontStyle:x.italic?"italic":void 0};/* @__PURE__ */
|
|
14
14
|
return I(_,{children:[
|
|
15
|
-
/* @__PURE__ */I("div",{className:"es-ts-item","data-ts-id":
|
|
16
|
-
/* @__PURE__ */I("button",{type:"button",className:"es-ts-row","aria-expanded":
|
|
15
|
+
/* @__PURE__ */I("div",{className:"es-ts-item","data-ts-id":e.id,children:[
|
|
16
|
+
/* @__PURE__ */I("button",{type:"button",className:"es-ts-row","aria-expanded":d,"aria-controls":d?k:void 0,onClick:()=>c(!d),children:[
|
|
17
17
|
/* @__PURE__ */X("span",{className:"es-ts-chev","aria-hidden":"true",children:/* @__PURE__ */X(A,{size:12})}),
|
|
18
|
-
/* @__PURE__ */X("span",{className:"es-ts-name",style:O,children:
|
|
19
|
-
/* @__PURE__ */X("span",{className:"es-ts-meta",children:
|
|
20
|
-
return X("div",{className:"es-ts-slider","data-ts-setting":e,children:/* @__PURE__ */X(
|
|
18
|
+
/* @__PURE__ */X("span",{className:"es-ts-name",style:O,children:e.name}),
|
|
19
|
+
/* @__PURE__ */X("span",{className:"es-ts-meta",children:p(w,s,b,{autoSize:N.has("size")&&w===x&&void 0===e.values.size})})]}),y?/* @__PURE__ */X("div",{className:"es-ts-actions",children:y}):null]}),d?/* @__PURE__ */X("div",{className:"es-ts-open",id:k,children:/* @__PURE__ */X(Z,{style:e,values:x,fonts:s,colours:t,settings:C,autoSet:N,sample:o??b.sample,words:b,phone:T,readOnly:g,set:s=>u(v([e],e.id,s)[0])})}):null]})}var U={none:Y,upper:W,capitalize:D,lower:$};function Z({style:e,values:s,fonts:a,colours:l,settings:i,autoSet:o,sample:d,words:c,phone:u,readOnly:m,set:h}){const f=e.values,p=a.find(e=>e.value===s.font),v=function(e,s){return e?s.find(s=>s.key===e)?.value??t(e)??void 0:void 0}(s.color,l),S=e=>"largestSize"===e||o.has(e),g=e=>S(e)?f[e]:s[e],b=g("size"),N=u&&void 0!==f.sizePhone?f.sizePhone:b,C=g("lineSpacing"),x=g("letterSpacing"),w=S("letterCase")?f.letterCase:s.letterCase,E={fontFamily:p?.family,fontSize:void 0===N?void 0:`${N}px`,fontWeight:s.weight,fontStyle:s.italic?"italic":void 0,lineHeight:void 0===C?void 0:String(C/100),letterSpacing:void 0===x?void 0:`${x}px`,color:v,textTransform:y(w)},z=e=>{const t=k[e],a=S(e);/* @__PURE__ */
|
|
20
|
+
return X("div",{className:"es-ts-slider","data-ts-setting":e,children:/* @__PURE__ */X(n,{label:c.settings[e],value:f[e],onChange:s=>h({[e]:s}),min:t.min,max:t.max,step:t.step,shiftStep:t.shiftStep,sliderMin:t.sliderMin,sliderMax:t.sliderMax,unit:t.unit||void 0,styleValue:a?void 0:s[e],auto:a?c.auto:void 0,readOnly:m})},e)};/* @__PURE__ */
|
|
21
21
|
return I(H,{children:[
|
|
22
|
-
/* @__PURE__ */X("div",{className:"es-ts-preview",style:E,"aria-label":
|
|
23
|
-
return X(q,{value:
|
|
24
|
-
return X(K,{value:
|
|
25
|
-
return I("div",{className:"es-ts-set","data-ts-setting":
|
|
26
|
-
/* @__PURE__ */X("span",{className:"es-ts-sub",children:
|
|
27
|
-
/* @__PURE__ */I("div",{className:"es-ts-icons",children:[
|
|
28
|
-
return X(V,{value:
|
|
29
|
-
return X("div",{className:"es-ts-slider","data-ts-setting":"size","data-ts-device":"phone",children:/* @__PURE__ */X(
|
|
22
|
+
/* @__PURE__ */X("div",{className:"es-ts-preview",style:E,"aria-label":c.preview,children:d}),i.map(t=>{switch(t){case"font":/* @__PURE__ */
|
|
23
|
+
return X(q,{value:f.font,fonts:a,words:c,readOnly:m,set:h},t);case"color":/* @__PURE__ */
|
|
24
|
+
return X(K,{value:f.color,hex:v,colours:l,words:c,readOnly:m,set:h},t);case"emphasis":{const e=(s.weight??400)>=600,a=!1!==p?.italic;/* @__PURE__ */
|
|
25
|
+
return I("div",{className:"es-ts-set","data-ts-setting":t,children:[
|
|
26
|
+
/* @__PURE__ */X("span",{className:"es-ts-sub",children:c.settings.emphasis}),
|
|
27
|
+
/* @__PURE__ */I("div",{className:"es-ts-icons",children:[r(c.bold,/* @__PURE__ */X(T,{className:"es-ts-icon","aria-label":c.bold,"aria-pressed":e,disabled:m,onClick:()=>h({weight:e?400:700}),children:/* @__PURE__ */X(j,{size:16})})),m||a?r(c.italic,/* @__PURE__ */X(T,{className:"es-ts-icon","aria-label":c.italic,"aria-pressed":Boolean(s.italic),disabled:m,onClick:()=>h({italic:!s.italic||void 0}),children:/* @__PURE__ */X(M,{size:16})})):/* @__PURE__ */X(T,{className:"es-ts-icon","aria-label":c.italic,"aria-pressed":Boolean(s.italic),"aria-disabled":!0,disabledReason:c.italicMissing,children:/* @__PURE__ */X(M,{size:16})})]})]},t)}case"letterCase":/* @__PURE__ */
|
|
28
|
+
return X(V,{value:f.letterCase??s.letterCase,auto:S("letterCase"),words:c,readOnly:m,set:h},t);case"largestSize":return"heading"===e.kind?z(t):null;case"size":return u?(()=>{const e=k.size;/* @__PURE__ */
|
|
29
|
+
return X("div",{className:"es-ts-slider","data-ts-setting":"size","data-ts-device":"phone",children:/* @__PURE__ */X(n,{label:c.settings.size,value:f.sizePhone,onChange:e=>h({sizePhone:e}),min:e.min,max:e.max,step:e.step,shiftStep:e.shiftStep,sliderMin:e.sliderMin,sliderMax:e.sliderMax,unit:e.unit||void 0,styleValue:b,readOnly:m})},"size")})():z(t);default:return z(t)}})]})}function q({value:e,fonts:s,words:t,readOnly:a,set:n}){const i=z();/* @__PURE__ */
|
|
30
30
|
return I("div",{className:"es-ts-set","data-ts-setting":"font",children:[
|
|
31
|
-
/* @__PURE__ */X("span",{className:"es-ts-sub",id:
|
|
32
|
-
/* @__PURE__ */X(
|
|
33
|
-
return X(F,{value:e,hex:s,colours:t,label:a.settings.color,followsWord:a.colour.follows,anyWord:a.colour.any,readOnly:n,onChange:e=>l({color:e})})}function V({value:e,auto:s,words:t,readOnly:a,set:n}){const l=s?["auto",...
|
|
31
|
+
/* @__PURE__ */X("span",{className:"es-ts-sub",id:i,children:t.settings.font}),
|
|
32
|
+
/* @__PURE__ */X(l,{value:e,options:s.map(e=>({label:e.label,value:e.value})),onChange:e=>n({font:e}),ariaLabelledBy:i,readOnly:a})]})}function K({value:e,hex:s,colours:t,words:a,readOnly:n,set:l}){/* @__PURE__ */
|
|
33
|
+
return X(F,{value:e,hex:s,colours:t,label:a.settings.color,followsWord:a.colour.follows,anyWord:a.colour.any,readOnly:n,onChange:e=>l({color:e})})}function V({value:e,auto:s,words:t,readOnly:a,set:n}){const l=s?["auto",...S]:S,i=e??(s?"auto":"none"),o=E([]),d=e=>n({letterCase:"auto"===e?void 0:e});/* @__PURE__ */
|
|
34
34
|
return I("div",{className:"es-ts-set","data-ts-setting":"letterCase",children:[
|
|
35
35
|
/* @__PURE__ */X("span",{className:"es-ts-sub",children:t.settings.letterCase}),
|
|
36
|
-
/* @__PURE__ */X("div",{className:"es-ts-icons",role:"radiogroup","aria-label":t.settings.letterCase,onKeyDown:e=>{const s="ArrowRight"===e.key||"ArrowDown"===e.key?1:"ArrowLeft"===e.key||"ArrowUp"===e.key?-1:0;if(!s||a)return;e.preventDefault();const t=(l.indexOf(i)+s+l.length)%l.length;
|
|
36
|
+
/* @__PURE__ */X("div",{className:"es-ts-icons",role:"radiogroup","aria-label":t.settings.letterCase,onKeyDown:e=>{const s="ArrowRight"===e.key||"ArrowDown"===e.key?1:"ArrowLeft"===e.key||"ArrowUp"===e.key?-1:0;if(!s||a)return;e.preventDefault();const t=(l.indexOf(i)+s+l.length)%l.length;d(l[t]),o.current[t]?.focus()},children:l.map((e,s)=>{const n=e===i;if("auto"===e)return r(t.case.autoTitle,/* @__PURE__ */X(T,{ref:e=>{o.current[s]=e},role:"radio",pressed:n,className:"es-ts-icon es-ts-icon--word","aria-checked":n,"aria-label":t.case.auto,tabIndex:n?0:-1,disabled:a,onClick:()=>d(e),children:t.case.auto},e));const l=U[e];return r(t.case[e],/* @__PURE__ */X(T,{ref:e=>{o.current[s]=e},role:"radio",pressed:n,className:"es-ts-icon","aria-checked":n,"aria-label":t.case[e],tabIndex:n?0:-1,disabled:a,onClick:()=>d(e),children:/* @__PURE__ */X(l,{size:16})},e))})})]})}export{F as ColourSwatchRow,G as TextStyleItem,R as TextStylesGroup,P as TextStylesList};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "efficient-easel",
|
|
3
|
-
"version": "20.
|
|
3
|
+
"version": "20.2.0",
|
|
4
4
|
"description": "Efficient Easel: the EFFICIENT editors' shared engine and chrome: the saved document as pure functions, the published renderer, and the editor frame, panels, Layers tree, text grammar and type-in-place box. Published as editor-shell up to 0.66.0 and as efficient-editor up to 0.95.0.",
|
|
5
5
|
"license": "UNLICENSED",
|
|
6
6
|
"author": "Efficient Pty Ltd",
|
package/dist/chunk-A42LPWNM.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{useSectionOps as o}from"./chunk-NHY5L3SE.js";import{SELECTION_MODE as e}from"./chunk-CBICQ4J3.js";import{decodePartId as r,encodePartId as t}from"./chunk-IYT6NN2J.js";import{useEasel as n}from"./chunk-ROPYFLNZ.js";import{usePreviewParts as p}from"./chunk-I54UCYOU.js";import{useCallback as d,useEffect as c}from"react";var s=o=>"part"===o.kind;function m({mode:m,setMode:i,onOpenPart:I}){const{getSelectorForId:a}=n(o=>o),u=o(),{setSelectedPartId:f,setSelectHandler:k}=p(),l=d(o=>{const t=r(o);if(!t)return;const{nodeId:n,propKey:p}=t;p?(i(o=>s(o)&&o.nodeId===n&&o.propKey===p?o:{kind:"part",nodeId:n,propKey:p}),I?.(n)):i(o=>"part"===o.kind?e:o)},[i,I]);c(()=>{k(l)},[k,l]);const h=s(m)?t(m.nodeId,m.propKey):null;c(()=>{f(h)},[h,f]);return{selectNode:d(o=>{i(()=>e);const r=a(o);r&&u.select(r)},[i,a,u]),openPartId:h}}export{m as usePartBridge};
|
package/dist/chunk-BC5KJNHN.js
DELETED
|
@@ -1,63 +0,0 @@
|
|
|
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-2E2SXDYQ.js";import{useEaselKeyTarget as a,useEaselUndoKeys as c,useEaselSaveKey as p,editorRootFocus as u}from"./chunk-KC24D76S.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-A42LPWNM.js";import{useSectionOps as v}from"./chunk-NHY5L3SE.js";import{ScreenSaveIcon as k,ScreenMainButton as b}from"./chunk-PY7OOQEZ.js";import{useBrowserOffline as S}from"./chunk-RKTF5XLP.js";import{AddChildRow as w}from"./chunk-5545A3PC.js";import{AddSidePanel as x}from"./chunk-EW6XAMDZ.js";import{keepsSharedSections as z,sharedSectionsOf as C}from"./chunk-43AEUUNQ.js";import{SidePanelHead as N,PanelShowStrip as I}from"./chunk-SINAM2IT.js";import{offeredChoices as B}from"./chunk-M2Z775ZC.js";import{useScreenSaveSwitch as O,useScreenNodeKeys as P,useScreenPinned as $,useScreenDocumentLabel as M,useScreenCanvasFrame as L,useScreenInspectorPanel as j,useScreenDevices as A,useScreenPickFollowsSelection as E,useScreenLeftView as T,SELECTION_MODE as R,sameInspectorMode as D,useScreenBridges as F,useScreenBlockRules as H,useScreenBlockLook as W,useScreenStorageNamespace as V,useScreenNotify as U,useScreenCanvasHead as J,isSlotMode as Y,useScreenStyleClipboard as K,useScreenDocumentPass as G,useScreenCanvasDrag as Z,ScreenCanvasTargetProvider as Q,isPinnedFirst as X,isPinnedLast as _,screenSlotsOf as q}from"./chunk-CBICQ4J3.js";import{MediaPopup as ee}from"./chunk-MS2U6MV5.js";import{useNodeClipboard as ne,useNodeContextMenu as te}from"./chunk-QALW2ECZ.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-XFYFKITX.js";import{DEFAULT_SCREEN_WORDS as ge}from"./chunk-23DYNW6S.js";import{heldStyle as ye,styleShortcut as ve}from"./chunk-V7U33NF2.js";import{DEFAULT_STYLE_CLIPBOARD_WORDS as ke}from"./chunk-6WY6ZXJG.js";import{rootRowName as be,slotChildRowName as Se,slotChildRenameProp as we,sectionRenameProp as xe}from"./chunk-BHRC3ASL.js";import{ROOT_ZONE as ze,blockNodeActions as Ce,TREE_MAX_DEPTH as Ne,childSlotsOf as Ie,slotFieldsOf as Be,newNodeId as Oe,slotChildrenIn as Pe,nestsInTree as $e}from"./chunk-PLVEGYK6.js";import{useEasel as Me,useEaselApi as Le,CanvasPassThroughContext as je,CanvasSharedContext as Ae}from"./chunk-ROPYFLNZ.js";import{TreeRow as Ee,Subtree as Te,LayersTree as Re,TreeGroupLabel as De,TreeRowAction as Fe,TreeSeam as He}from"./chunk-A6Z4SD3I.js";import{DEFAULT_TREE_WORDS as We}from"./chunk-K56YDHYQ.js";import{DEFAULT_NODE_MENU_WORDS as Ve}from"./chunk-WK3AFPXY.js";import{toItemSelector as Ue,useNodeOps as Je,clickPick as Ye}from"./chunk-BSHIQIZC.js";import{EaselTopBar as Ke,TopBarCluster as Ge,EaselIconButton as Ze,TopBarDivider as Qe,DeviceSwitch as Xe,InspectorIconButton as _e,PanelResizeHandle as qe,MAX_PANEL_W as en,MIN_PANEL_W_BY_SIDE as nn,panelWidthVars as tn}from"./chunk-ZG6PVMC3.js";import{DEFAULT_NOTICE_WORDS as on,DEFAULT_CHROME_WORDS as rn}from"./chunk-AJSDWWJW.js";import{holderOf as ln,nameOrSomeone as sn}from"./chunk-THWO5YVZ.js";import{DEFAULT_LOCK_WORDS as dn}from"./chunk-RE4LP46F.js";import{useWords as an}from"./chunk-MFIRYGHW.js";import{insertSeams as cn,CanvasDragLayer as pn,CanvasInsert as un}from"./chunk-LDEEFLE3.js";import{DEFAULT_DRAG_WORDS as fn}from"./chunk-KAML3KQH.js";import{createDragSession as hn,useTreeDrag as mn,gapToMoveIndex as gn}from"./chunk-3S5N4HLJ.js";import{useCanvasFrame as yn,LIST_SELECTOR as vn,BLOCK_SELECTOR as kn,useCanvasTyping as bn,useCanvasEvent as Sn,nodeIdAt as wn,frameRectToHost as xn,BLOCK_ATTRIBUTE as zn,drawnBox as Cn}from"./chunk-QIDRJH3S.js";import{queryMainCopy as Nn}from"./chunk-LF3FUSCQ.js";import{ROOT_ID as In,ROOT_SLOT as Bn,zoneKey as On,parseZoneKey as Pn,find as $n,DataError as Mn}from"./chunk-K7BTCBWD.js";import{useRef as Ln,useMemo as jn,useState as An,useEffect as En,useCallback as Tn,useLayoutEffect as Rn,Fragment as Dn,useId as Fn}from"react";import{ColoredBadge as Hn,Tabs as Wn,toast as Vn,readMediaFileDrag as Un,Tooltip as Jn,groupColors as Yn,Dialog as Kn,FormField as Gn,Input as Zn,Button as Qn,MEDIA_FILE_DRAG_TYPE as Xn}from"efficient-shell/ui";import{UndoIcon as _n,RedoIcon as qn,RefreshIcon as et,AddIcon as nt,TrashIcon as tt,EyeOffIcon as ot,EyeIcon as rt,SharedIcon as it,DuplicateIcon as lt}from"efficient-shell/icons/efficient";import{jsx as st,jsxs as dt,Fragment as at}from"react/jsx-runtime";var ct="media-file";function pt({name:e,onMake:n,onCancel:t}){const o=an("screen",ge).shared,[r,i]=An(e),[l,s]=An(!1),d=Fn(),a=Ln(null),c=async()=>{const e=r.trim();if(e&&!l){s(!0);try{await n(e)}finally{s(!1)}}};/* @__PURE__ */
|
|
2
|
-
return st(Kn,{open:!0,size:"sm",title:o.makeShared,description:o.makeSharedHint,onClose:t,initialFocus:a,footer:/* @__PURE__ */dt(at,{children:[
|
|
3
|
-
/* @__PURE__ */st(Qn,{variant:"secondary",onClick:t,children:o.cancel}),
|
|
4
|
-
/* @__PURE__ */st(Qn,{variant:"primary",loading:l,disabled:!r.trim(),onClick:()=>{c()},children:o.makeShared})]}),children:/* @__PURE__ */st("form",{onSubmit:e=>{e.preventDefault(),c()},children:/* @__PURE__ */st(Gn,{label:o.name,htmlFor:d,children:/* @__PURE__ */st(Zn,{id:d,ref:a,value:r,onChange:e=>i(e.target.value)})})})})}var ut=/* @__PURE__ */new WeakSet;function ft(e,n,t){const o=$n(e,n,t);if(!o)return null;const r=o.path.find(e=>"root"!==e.parentId);return r?r.parentId:t}function ht({canvas:e,tabs:n,onSelect:t}){const o=Ln(null),[r,i]=An({}),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=xn(l,{left:0,top:0,width:r.innerWidth,height:r.innerHeight},e),a={};for(const o of n){const n=Nn(t,`[${zn}="${r.CSS?.escape?r.CSS.escape(o.id):o.id}"]`),i=n?Cn(n):null;if(!i||0===i.height){a[o.id]=null;continue}const s=xn(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__ */st("div",{ref:o,className:"es-band-tabs","aria-hidden":"true",children:n.map(e=>{const n=r[e.id];return n?/* @__PURE__ */st("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__ */st(Jn,{content:e.reach,children:/* @__PURE__ */dt(Hn,{colorClass:Yn("success","solid"),size:"sm",children:[
|
|
6
|
-
/* @__PURE__ */st("span",{className:"es-band-tab-mark",children:/* @__PURE__ */st(it,{size:12})}),e.label]})}):/* @__PURE__ */st(Hn,{colorClass:Yn("info","solid"),size:"sm",children:e.label})},e.id):null})})}function mt({expand:e}){/* @__PURE__ */
|
|
7
|
-
return st("svg",{width:"15",height:"15",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:1.9,strokeLinecap:"round",strokeLinejoin:"round",children:/* @__PURE__ */dt(at,e?{children:[
|
|
8
|
-
/* @__PURE__ */st("path",{d:"M8 9l4-4 4 4"}),
|
|
9
|
-
/* @__PURE__ */st("path",{d:"M8 15l4 4 4-4"})]}:{children:[
|
|
10
|
-
/* @__PURE__ */st("path",{d:"M8 4l4 4 4-4"}),
|
|
11
|
-
/* @__PURE__ */st("path",{d:"M8 20l4-4 4 4"}),
|
|
12
|
-
/* @__PURE__ */st("path",{d:"M5 12h14"})]})})}var gt=`${vn}, ${kn}`;function yt(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 vt="__rungs";var kt="screen:band",bt={duplicate:!0,delete:!0};function St(){const vn=ue(),{target:xn,docId:zn,capabilities:Cn,currentSlug:Fn,siteId:Jn,onPublish:Yn,saveState:Kn,saveConflict:Gn,retrySave:Zn,toggleAutoSave:Qn,flushSave:it,access:St,saveUnreachable:wt=!1,readOnly:xt,readOnlyReason:zt=null}=re(),Ct=O(),Nt=P(),{mediaEditing:It,hasEditGuard:Bt,hasPinnedChrome:Ot}=Cn,{appState:Pt,dispatch:$t,history:Mt,selectedItem:Lt,getSelectorForId:jt,config:At}=Me(e=>e),Et=$(),{first:Tt,firstGroup:Rt,lastGroup:Dt,isSectionGroup:Ft,sectionGroupZone:Ht,panelOf:Wt}=Et,Vt=Wt(Tt),Ut=e=>X(Et,e),Jt=e=>_(Et,e),Yt="node"===Et.firstRow,Kt=Et.band??null,Gt=an("screen",ge),Zt=an("tree",We),Qt=an("drag",fn),Xt=an("notice",on),_t=an("lock",dn),qt=an("menu",Ve),eo=an("styleClipboard",ke),no=an("chrome",rn),to=M()??`/${Fn}`,oo=L(),ro=j(),io=v({readOnly:xt}),lo=v({readOnly:xt,foldIntoHistory:!0}),so=Ln(null),ao=Le(),co=jn(()=>({...io,select:e=>{so.current=e,io.select(e)},commitDocument:(e,n)=>{if(void 0!==n){const t=ao.config;so.current=Ue(e,t,n)}io.commitDocument(e,n)}}),[io,ao]),po=Pt.ui,uo=po.leftSideBarVisible,fo=po.rightSideBarVisible,{options:ho,widths:mo,initial:go,fluid:yo,fit:vo}=A(),[ko,bo]=An(go),So=le(),wo=It&&null!==So,xo=se(),zo=de(),Co=null!==xo||zo,No=ae();E(Lt?.props.id);const{read:Io,write:Bo,forSelection:Oo}=T(),[Po,$o]=An(Io);En(()=>{Bo(Po)},[Po]);const[Mo,Lo]=An(0),jo=Ln(null),Ao=Ln(null),Eo=yn(Ao,{readySelector:gt}),To=bn(Eo),Ro=a(Ao);c(Ao,Eo);const Do=S(),Fo=ln(St),Ho={state:Kn,offline:Do||Kn.failed&&wt,readOnlyReason:zt,editing:Fo?Xt.editing({name:sn(Fo.name,_t),noun:Gt.noun}):null,conflict:null!=Gn,notSaving:Gt.bar.notSaving},Wo=()=>{xt||(Kn.failed?Zn():it())};p(Ao,Eo,Wo);const[Vo,Uo]=An(!1),Jo=Ln(!1),[Yo,Ko]=An(null),[Go,Zo]=An([]),[Qo,Xo]=An(R),_o="puck"===Qo.kind,qo=o(Qo,Lt?.props.id),[er,nr]=An(null);En(()=>{er&&(r(),nr(null))},[er]);const tr=Ln(jt);tr.current=jt;const or=Tn((e,{scroll:n})=>{$o(n=>Oo(e,n)),n&&nr(e);const t=[];let o=e;for(let e=0;e<4;e++){const e=tr.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})},[]),rr=Ln(null);En(()=>{const e=rr.current;rr.current=null;const n=null==Lt?.props.id?null:String(Lt.props.id);Xo(t=>e&&e.id===n?e.mode:"part"===t.kind&&"nodeId"in t&&t.nodeId===n?t:Wt(Lt?.type)??R);const t=Lt?.props.id,o=so.current;if(so.current=null,!t)return;const r=jt(t);or(String(t),{scroll:!i(o,r??null,ze)})},[Lt?.props.id,or]);const ir=Tn(e=>{Xo(n=>D(n,e)?n:e),$t({type:"setUi",ui:{rightSideBarVisible:!0}})},[$t]),lr=Ln(()=>{});lr.current=(e,n)=>{const t=e?Oi(e.zone??ze)[e.index]?.props.id:null,o=null==t?null:String(t),r=null==Lt?.props.id?null:String(Lt.props.id);Xo(e=>D(e,n)?e:n),o!==r&&(rr.current={id:o,mode:n},co.select(e))};const sr=Tn((e,n)=>lr.current(e,n),[]),dr={kind:Qo.kind,mode:Qo,open:ir,show:e=>Xo(e),reveal:()=>{fo||$t({type:"setUi",ui:{rightSideBarVisible:!0}})},select:sr},ar=F(dr,{data:Pt.data,selected:Lt??null,zoneOf:e=>jt(e)?.zone,readOnly:Boolean(xt),select:e=>{Xo(R),co.select({index:e})},replace:(e,n)=>co.replaceComponent(ze,e,n),scrollTo:e=>l(e)},{device:ko,refreshes:Mo},{setView:$o,reveal:()=>{uo||$t({type:"setUi",ui:{leftSideBarVisible:!0}})}}),cr=ar.resolveLeftView?ar.resolveLeftView(Po):"sections",pr=H(),{isLockedBlock:ur,duplicateBlocked:fr,nestDepth:hr,newSectionNode:mr,canAddTo:gr,blockIsOffered:yr}=pr,vr=W(),{labelAtLevel:kr,Icon:br,useProducts:Sr}=vr,wr=vr.rowName?(e,n,t)=>vr.rowName(e,n,t):void 0,xr=Tn(e=>{$t({type:"setUi",ui:{rightSideBarVisible:!0}}),l(e),or(e,{scroll:!0})},[$t,or]),{selectNode:zr,openPartId:Cr}=y({mode:Qo,setMode:Xo,onOpenPart:xr}),[Nr,Ir]=An(null);fe(null!==Nr,()=>Ir(null));const Br=h(V()),Or=Br.collapsed,Pr=Br.panelWidths,[$r,Mr]=An(()=>{if("undefined"==typeof window)/* @__PURE__ */return new Set;try{const e=window.localStorage.getItem(Or);return new Set(e?JSON.parse(e):[])}catch{/* @__PURE__ */
|
|
13
|
-
return new Set}});En(()=>{try{window.localStorage.setItem(Or,JSON.stringify([...$r]))}catch{}},[$r]);const[Lr,jr]=An(()=>{if("undefined"==typeof window)return{...m};try{const e=window.localStorage.getItem(Pr);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}}});En(()=>{const e=setTimeout(()=>{try{window.localStorage.setItem(Pr,JSON.stringify(Lr))}catch{}},300);return()=>clearTimeout(e)},[Lr]);const Ar=Tn((e,n)=>jr(t=>{const o="function"==typeof n?n(t[e]):n;return t[e]===o?t:{...t,[e]:o}}),[]),Er=Tn(e=>Ar("left",e),[Ar]),Tr=Tn(e=>Ar("right",e),[Ar]),Rr=e=>$r.has(e),Dr=e=>Mr(n=>{const t=new Set(n);return t.has(e)?t.delete(e):t.add(e),t}),Fr=Ln(!1),Hr=Ln(null);En(()=>{if(Fr.current&&!Vo){const e=Hr.current,n=e&&e.isConnected&&!e.closest('[aria-hidden="true"]')?e:null;(n??Ao.current?.querySelector(`button[aria-label="${CSS.escape(Gt.add.title)}"]`))?.focus(),Hr.current=null}Fr.current=Vo},[Vo]),En(()=>{if(!Vo||!Ro)return;const e=e=>{"Escape"===e.key&&sl()};return Ro.addEventListener("keydown",e),()=>Ro.removeEventListener("keydown",e)},[Vo,Ro]),fe(Vo,()=>sl()),En(()=>{!uo&&Vo&&(Uo(!1),Ko(null),Jo.current=!1)},[uo]);const Wr=U(),Vr=(e,n="success",t)=>{if(Wr)return void(t?Wr(e,"error"===n?"error":"info",t):Wr(e,"error"===n?"error":"info"));const o={sound:!1,action:t?.action,onClose:t?.onClose};"error"===n?Vn.error(e,{...o,duration:t?.duration??3200}):Vn.success(e,{...o,duration:t?.duration??1900})},Ur=Ln(null),[Jr,Yr]=An(0),[Kr,Gr]=An(0),Zr=J(),Qr=Ln(null),Xr=e=>Math.max(0,e.clientHeight-(Qr.current?.offsetHeight??0));En(()=>{const e=Ur.current;if(!e)return;const n=()=>{Yr(e.clientWidth),Gr(Xr(e))};n();const t=new ResizeObserver(n);return t.observe(e),Qr.current&&t.observe(Qr.current),()=>t.disconnect()},[]),Rn(()=>{Ur.current&&(Yr(Ur.current.clientWidth),Gr(Xr(Ur.current)))},[Lr,uo,fo]);const _r=ko===yo?Jr>0?Jr:mo[yo]:mo[ko],qr=Jr>0?Math.min(Jr/_r,"shrink"===vo?1:2):1,ei=_r*qr,ni=Jr>0&&ei>Jr+1,ti={width:ei,height:Kr||"100%",flex:"none",position:"relative"},oi={width:_r,height:Kr?Kr/qr:"100%",maxHeight:"none",transform:1!==qr?`scale(${qr})`:void 0,transformOrigin:"top left"},ri=()=>$t({type:"setUi",ui:{leftSideBarVisible:!uo}}),ii=()=>$t({type:"setUi",ui:{rightSideBarVisible:!fo}}),li=e=>{Vo&&(Uo(!1),Ko(null),Jo.current=!1,uo&&Po===e)||($o(e),uo||$t({type:"setUi",ui:{leftSideBarVisible:!0}}))},si=()=>{ie(vn,{accept:"image/*",title:no.mediaLibrary})},di=()=>{Xo(R),co.select(null),d()},ai=()=>{Xo(Vt??R),fo||$t({type:"setUi",ui:{rightSideBarVisible:!0}})},ci=Pt.data.content??[],pi=()=>{const e=ci.findIndex(Ut),n=ci.findIndex(Jt);return{floor:e>=0?e+1:0,cap:n>=0?n:ci.length}},ui=At,fi=pr.stripCopy,hi=n=>e(n,fi),mi=ne(),gi=Je({data:Pt.data,config:ui,readOnly:Boolean(xt),clipboard:mi,strip:fi?e=>fi(e):void 0,afterRemove:"none",stepBounds:(e,n)=>{if(e.parentId!==In||e.slot!==Bn)return{min:0,max:n-1};const{floor:t,cap:o}=pi();return{min:t,max:o-1}},commit:(e,{select:n})=>{void 0!==n&&Xo(R);const t=void 0===n||"node"===n?.kind?n:null;co.commitDocument(e,t)}}),yi=pe(),[vi,ki]=An(null),bi=e=>{const n=ci.find(n=>String(n.props.id)===e),t=Et.shared;n&&t&&gi.swap(e,t.detach(n))},Si=e=>{const n=$n(Pt.data,At,e);if(!n)return!1;const t=On(n.place),o=n.node,r=t===ze?Ni(o):Fi(o),i=t===ze?Et.shared?.usedOn(o):null;return!!gi.remove(e)&&(Vr(i?Gt.shared.removed({count:Math.max(0,i.length-1)}):Gt.deleted({name:r}),"success",{duration:8e3,action:{label:Gt.bar.undo,onClick:()=>{gi.restore(n.node,n.place)}}}),!0)},wi={...gi,remove:Si},xi=e=>kr(e,"block",At.components[e]?.label??e),zi=Tn(e=>At.components[e]?.defaultProps??{},[At]),Ci=e=>kr(e,"section",xi(e)),Ni=e=>be({type:e.type,props:e.props??{}},Ci(e.type),wr),{nodeAddresses:Ii,zoneItems:Bi}=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>=Ne)return;const s=/* @__PURE__ */new Map;for(const{child:e,zone:t}of Ie(At,n))s.set(t,[...s.get(t)??[],e]);for(const[e,n]of s)t(n,e,i+1)})};return t(ci,ze,0),{nodeAddresses:e,zoneItems:n}},[ci,At]),Oi=Tn(e=>Bi.get(e)??[],[Bi]),Pi=e=>{const n=Ii.get(e);return n?Oi(n.zone)[n.index]:void 0},$i=e=>q(pr,At,e),Mi=e=>{if(!pr.slotsOf||e===ze)return null;const n=e.lastIndexOf(":");if(n<=0)return null;const t=Pi(e.slice(0,n));if(!t)return null;const o=$i(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}},Li=(()=>{if(!Y(Qo))return null;const e=`${Qo.nodeId}:${Qo.slot}`;return Mi(e)?.slot.panel===Qo.kind?e:null})(),ji=Ln(null);En(()=>{const e=ji.current;if(ji.current=null,!Li||!Y(Qo))return;const n=Qo.nodeId;or(n,{scroll:e!==Li}),Mr(e=>{if(!e.has(n))return e;const t=new Set(e);return t.delete(n),t})},[Qo]);const Ai=(e,n,t)=>{const o=String(e.props.id);if(!n.panel)return void(e=>{const n=Ii.get(e);n&&(n.zone===ze?el(n.index):Il(n.zone,n.index,e,Pi(n.zone.slice(0,n.zone.lastIndexOf(":")))?.type??""))})(o);const r={kind:n.panel,nodeId:o,slot:n.slot},i=`${o}:${n.slot}`;t&&Li!==i&&(ji.current=i),sr(null,r),fo||$t({type:"setUi",ui:{rightSideBarVisible:!0}}),l(o)},Ei=(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;Li!==o&&(ji.current=o);sr(null,{kind:t,nodeId:e,slot:n})},Ti=(e,n,t)=>{if(xt||!pr.moveSlot)return;const o=Pi(e),r=o?$i(o).filter(e=>e.rung):[],i=r[n];if(!i)return;const l={parentId:e,slot:vt,index:n},s=gn(l,{...l,index:Math.min(Math.max(t,0),r.length)});if(s===n)return;const d=pr.moveSlot(e,n,s);"string"==typeof d&&Ei(e,d,i.panel)},Ri=Sr(),Di=jn(()=>{const e=/* @__PURE__ */new Map;for(const n of Ri??[])e.set(n.slug,n.name);return e},[Ri]),Fi=e=>Se(e,xi,vr.plainText,e=>Di.get(e),vr.rowName),Hi=(e,n)=>{const t=At.components[e.type]?.fields,o=n===ze||ql(n)?"section":"block",r=n===ze&&(Ut(e)||Jt(e)||Ft(e.type)),i="block"===o?we(t):r?null:xe(t);return vr.renamePropOf?vr.renamePropOf(e,o,i):i},Wi=(e,n,t,o)=>{if(!(!xt&&Nr?.zone===e&&Nr.index===n))return;const r=(t,o)=>{Ir(null),o&&((e,n,t)=>{const o=Oi(e)[n];if(!o)return;const r=Hi(o,e);r&&co.replaceComponent(e,n,{...o,props:{...o.props,[r]:t.trim()}})})(e,n,t)};/* @__PURE__ */
|
|
14
|
-
return st("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)},Vi=t(K(),eo),Ui=Vi.scope({target:xn,siteId:Jn,docId:zn}),Ji=At,Yi=(e,n)=>n===ze?Ci(e):xi(e),Ki=(e,n,t)=>{const o=Vi.plan(Ui,t,Yi(t.type,e),Ji);o&&(o.changed&&co.replaceComponent(e,n,{...t,props:{...o.props,id:t.props.id}}),Vr(o.message))},Gi=te({nodesIn:Oi,nodeAt:(e,n)=>Oi(e)[n]??null,labelOf:(e,n)=>n===ze?Ci(e):xi(e),renamePropOf:Hi,beginRename:(e,n)=>Ir({zone:e,index:n}),history:{hasPast:Mt.hasPast,hasFuture:Mt.hasFuture,back:()=>Mt.back(),forward:()=>Mt.forward()},openPageSettings:()=>{co.select(null),Xo(R)},pageSettingsLabel:Gt.pageSettings,words:{menu:qt,styleClipboard:eo,screen:Gt.menu},readOnly:Boolean(xt),collapseAll:()=>Mr(new Set(Oi(ze).map(e=>String(e.props.id)))),onPasteRefused:e=>Vr(e?Gt.pasteRefused({name:e.label}):Gt.menu.clipboardRefused,"error"),canPasteAt:(e,n)=>ts(e,n),menuRows:(e,n,t)=>{const o=ar.menuRows?.(e,n,t)??null,r=((e,n)=>{const t=Et.shared;if(!t||n!==ze)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 xt||ur(e.type,e)?n:{...n,change:[{label:Gt.shared.detach,onClick:()=>bi(e.props.id)}],remove:[{label:Gt.shared.removeFromPage,danger:!0,onClick:()=>{Si(e.props.id)}}]}}return xt||Ut(e)||Jt(e)||Ft(e.type)?null:z(yi)?{change:[{label:Gt.shared.makeShared,onClick:()=>ki({id:e.props.id,name:Ni(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=>ur(e.type,e),duplicateBlocked:e=>fr(Pt.data,e),permits:e=>{const n=Ce(At,e.type);return Et.shared?.usedOn(e)?{...n,delete:!1}:n},nodeOps:wi,isPinned:(e,n)=>n===ze&&(Ut(e)||Jt(e)),sectionBand:pi,locate:e=>Ii.get(e)??null,rowNameOf:(e,n)=>n===ze?Ni(e):Fi(e),selectAt:(e,n,t,o)=>{e===ze?el(n):Il(e,n,t,o??"")},slotRung:e=>{const n=Mi(e);return n?.slot.panel?{label:n.slot.label,select:()=>Ai(n.node,n.slot,!1)}:null},style:{held:()=>ye(Ui),canCopy:e=>Vi.rows(Ji,e).some(e=>!1!==e.counted),copy:(e,n)=>Vi.copy(Ui,e,Yi(e.type,n),Ji),paste:(e,n,t)=>Ki(e,n,t)},keys:Nt?{target:Ro,selected:()=>{const e=Pt.ui.itemSelector;return e?{zone:e.zone??ze,index:e.index}:null},held:()=>mi.get(),readOnly:Boolean(xt),onDone:({done:e,name:n})=>{"copied"===e&&Vr(Gt.copied({name:n}))}}:void 0},Eo),Zi=Ln({copy:(e,n)=>{},paste:(e,n,t)=>{},at:()=>null,readOnly:!1});En(()=>{Zi.current={copy:(e,n)=>Vi.copy(Ui,e,Yi(e.type,n),Ji),paste:Ki,at:()=>{const e=Pt.ui.itemSelector;if(!e)return null;const n=e.zone??ze,t=Oi(n)[e.index];return t?{zone:n,index:e.index,node:t}:null},readOnly:Boolean(xt)}});const Qi=Tn(e=>{const n=ve(e);if(!n)return;const t=Zi.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))},[]);En(()=>{if(!Ro)return;const e=e=>Qi(e);return Ro.addEventListener("keydown",e),()=>Ro.removeEventListener("keydown",e)},[Qi,Ro]),Sn(Eo,"keydown",Qi);const Xi=ci.map(e=>e.props.id).join("|");En(()=>{const e=Eo?.document??null,n=Eo?.window??null;let t=0;const o=[],r=()=>{if(!e)return void Zo(e=>e.length?[]:e);const n=ci.findIndex(Jt),t=n>=0?n:ci.length,o=n=>{const t=ci[n]?.props?.id;return null==t?null:Nn(e,`[data-puck-component="${CSS.escape(String(t))}"]`)},r=e=>e?[...e.querySelectorAll(kn)].map(e=>e.getBoundingClientRect()).filter(e=>e.width>0||e.height>0):[],i=[];for(let e=ci.length>0&&!Ut(ci[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=yt(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})}Zo(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()}},[Eo,Xi,ko,qr,uo,fo,Lt?.props.id]);const _i=Eo?.document??null,qi=Eo?.window??null;En(()=>{const e=jo.current;if(!e||!_i||!qi)return;const n=[],t=()=>{const n=Nn(_i,`[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 jo.current=null,t()&&n.push(setTimeout(t,150),setTimeout(t,450)),()=>n.forEach(clearTimeout)},[_i,qi]);const el=e=>{Xo(R),co.select({index:e}),ar.sectionPressed?.(ci[e]);const n=ci[e]?.props?.id;n&&l(n)},nl=e=>{const{floor:n,cap:t}=pi(),o=e=>Math.min(Math.max(n,e),t);if("number"==typeof e)return o(e);const r=Lt&&Qo.kind!==Vt?.kind?ci.findIndex(e=>e.props.id===Lt.props.id):-1;return o(r>=0?r+1:t)},tl=(e,n)=>{const{floor:t,cap:o}=pi(),r=Math.min(Math.max(n,t),o),i=e<r?r-1:r;return i===e?{moved:!1,dest:e}:(co.reorderComponent(ze,e,i),co.select({index:i}),{moved:!0,dest:i})},ol=(e,n,t,o)=>{Xo(R),co.select(o?{index:o.index,zone:o.zone}:{index:e}),l(n),Vr(Gt.sectionAdded({name:t}))},rl=(e,n)=>{const t=nl(n),o=mr(e,{nodeDefaults:zi,newNodeId:Oe,sectionLabel:Ci,blockIsOffered:yr}),r=o?co.insertNode(ze,t,o):co.insertSection(e,t);return ol(t,r,Ci(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 Ie(At,e)){if(s.type===t&&(!o.at||n>o.at.depth)){const r=gr(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},il=e=>ll(ze,e),ll=(e,n)=>{Hr.current=document.activeElement??null,Ko(null===n?null:{zone:e,index:n}),Uo(!0),uo||(Jo.current=!0,$t({type:"setUi",ui:{leftSideBarVisible:!0}}))},sl=()=>{Uo(!1),Ko(null),Jo.current&&$t({type:"setUi",ui:{leftSideBarVisible:!1}}),Jo.current=!1},dl=(e,n)=>vr.rowName?n?Ut(e)?vr.rowName(e,"section",Gt.header):Jt(e)?vr.rowName(e,"section",Gt.footer):Ft(e.type)?vr.rowName(e,"section",xi(e.type)):Ni(e):Fi(e):n?Ci(e.type):xi(e.type),al=e=>n=>{e()},cl=(e,n,t)=>{if(xt)return null;const o=Oi(e)[n];return o&&!Ce(At,o.type).delete||o&&ur(o.type,o)?null:/* @__PURE__ */st(Fe,{kind:"delete",label:e===ze&&o&&Et.shared?.usedOn(o)?Gt.shared.removeFromPage:Gt.deleteNamed({name:t}),onClick:()=>((e,n)=>{const t=Oi(e)[n]?.props?.id;null!=t&&Si(String(t))})(e,n),children:/* @__PURE__ */st(tt,{size:15})})},pl=e=>vr.rowPreview?.(e)||void 0,ul=e=>vr.rowMarks?.(e)??void 0,fl=(e,n,t)=>vr.rowActions?.(e,n,t)??null,hl=(e,n,t,o)=>{if(xt)return null;if(ur(t.type,t))return null;const r=Boolean(t.props._hidden);/* @__PURE__ */
|
|
15
|
-
return st(Fe,{kind:"eye",label:r?Gt.showNamed({name:o}):Gt.hideNamed({name:o}),onClick:()=>gl(e,n,t),children:/* @__PURE__ */st(r?ot:rt,{size:14,strokeWidth:1.8,strokeLinecap:void 0,strokeLinejoin:void 0})})},ml=e=>Ws(ze,e),gl=(e,n,t)=>{co.replaceComponent(e,n,{...t,props:{...t.props,_hidden:!t.props._hidden}})},yl=e=>Be(At,e),vl=e=>Ie(At,e),kl=e=>pr.slotsOf?$i(e).map(n=>({slot:n.slot,rung:n.rung?n:null,kids:Pe(e,n.slot)})):[{slot:null,rung:null,kids:vl(e)}],bl=e=>pr.slotsOf?kl(e).flatMap(e=>e.kids):vl(e),Sl=e=>Boolean(pr.slotsOf)&&$i(e).some(e=>e.rung),wl=(e,n,t)=>null===t?void 0===n?gr(e):gr(e,n):gr(e,n,t),xl=(e,n,t)=>{const o=$e(At,e.type,n)&&(t||bl(e).length>0||Sl(e));return{collapsible:o,folded:o&&Rr(String(e.props.id))}},zl=(e,n,t)=>kl(e).flatMap(o=>{const r=o.rung?n+1:n,i=o.kids.flatMap(({child:e})=>xl(e,r,t(e.type)).collapsible?[String(e.props.id),...zl(e,r+1,t)]:[]);return o.rung?[`${e.props.id}:${o.rung.slot}`,...i]:i}),Cl=e=>bl(e).length>0||Sl(e)||Boolean(gr(e.type)),Nl=e=>Boolean(gr(e)),Il=(e,n,t,o)=>{if(Xo(R),gr(o)?.spec?.slider){const t=e.split(":")[0];s(t,n),co.select({index:n,zone:e}),l(t)}else co.select({index:n,zone:e}),l(t)},Bl=(e,n,t,o,r)=>{const i=`${e}:${n}`;co.insertComponent(i,t,o),gr(r)?.spec?.slider?requestAnimationFrame(()=>{s(e,o),co.select({index:o,zone:i})}):co.select({index:o,zone:i})},Ol=Ln(/* @__PURE__ */new Set);En(()=>{ci.forEach(e=>{const n=gr(e.type)?.spec;if(!n)return;const t=e.props.id;if(Ol.current.has(t))return;Ol.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(zi)).forEach((e,t)=>lo.seedChild(o,t,n.childType,e))})},[ci,lo,zi]);const Pl=Ln(/* @__PURE__ */new Set);En(()=>{ci.forEach((e,t)=>{const o=e.props.id;if(Pl.current.has(o))return;const r=n(e,yl(e.type));Pl.current.add(o),r&&lo.replaceComponent(ze,t,{...e,props:r})})},[ci,lo]),G(lo,At);const $l=ci.findIndex(Jt),Ml=$l>=0?ci[$l]:null,Ll=Yt?ci.findIndex(Ut):-1,jl=Ll>=0?ci[Ll]:null,Al=Et.groupTab,El=jn(()=>Al?e=>Ft(e.type):void 0,[Al]),Tl=Boolean(Et.groupBadge),Rl=Et.sharedReach,Dl=e=>Rl?.(e)??void 0,Fl=jn(()=>Rl?new Set(ci.filter(e=>Dl(e)).map(e=>String(e.props.id))):null,[ci,Rl]),Hl=jn(()=>Fl?e=>Fl.has(e):void 0,[Fl]),Wl=Et.first?Rl?.({type:Et.first,props:{id:""}})??void 0:void 0,Vl=Et.groupBadge?/* @__PURE__ */st("span",{className:"es-tree-group-badge",children:/* @__PURE__ */st(Hn,{tone:"info",size:"xs",children:Et.groupBadge})}):void 0,Ul=ci.find(e=>e.type===Rt)??null,Jl=ci.find(e=>e.type===Dt)??null,Yl=$l>=0?$l:ci.length,Kl=[];ci.forEach(e=>{Jt(e)||(Cl(e)&&Kl.push(String(e.props.id)),Kl.push(...zl(e,1,Nl)))}),Ml&&(Kl.push(String(Ml.props.id)),Kl.push(...zl(Ml,1,Nl)));const Gl=Kl.length>0&&Kl.every(e=>$r.has(e)),Zl=e=>{const n=vr.blockRowName(e,xi);return vr.rowName?vr.rowName(e,"block",n):n},Ql=(e,n,t,o)=>{const r=Oi(e)[t];if(!r)return;const i={...Pn(e),index:t},l={...Pn(n),index:Math.min(Math.max(o,0),Oi(n).length)},s=gn(i,l);if(e!==n||s!==t)try{gi.move(String(r.props.id),{...l,index:s})}catch(e){if(!(e instanceof Mn))throw e}},Xl=e=>{const n=/* @__PURE__ */new Set,t=e=>{for(const{child:o,zone:r}of vl(e))n.add(r),t(o)};for(const t of yl(e.type))n.add(`${e.props.id}:${t}`);return t(e),n},_l=e=>{let n=e.slice(0,e.indexOf(":"));for(let e=0;e<64;e++){const e=Ii.get(n);if(!e)return null;if(e.zone===ze)return n;n=e.zone.slice(0,e.zone.indexOf(":"))}return null},ql=e=>{const n=e.slice(0,e.indexOf(":")),t=ci.find(e=>Ft(e.type)&&String(e.props.id)===n);return t&&Ht(n)===e?t:null},es=(e,n)=>{const t=ql(e);return!t||(!Et.groupAccepts||Et.groupAccepts(t.type,n,Oi(e).length))},ns=(e,n,t)=>{if(e.rung){const t=Pi(e.rung.nodeId),o=t?$i(t).filter(e=>e.rung).length:0;return n.parentId===e.rung.nodeId&&n.slot===vt&&n.index>=0&&n.index<=o}if(n.slot===vt)return!1;if(e.add)return is(e.add,n);const o=On(n);if(Ft(e.type))return!1;const r=ql(o),i=ql(e.zone);if(r||i)return!(!r||!i)&&(!(r!==i&&!es(o,e.type))&&(n.index>=0&&n.index<=Oi(o).length));if(e.zone===ze||o===ze){if(e.zone!==o)return!1;const{floor:t,cap:r}=pi();return n.index>=t&&n.index<=r}if(n.index<0||n.index>Oi(o).length)return!1;if(e.zone===o)return!0;const l=Ml&&!Et.lastIsOpen?String(Ml.props.id):null;return(!l||_l(e.zone)!==l&&_l(o)!==l)&&((e,n,t,o)=>{if(e===n)return!0;const r=o??Oi(e)[t];if(!r)return!1;const i=n.split(":")[0],l=Ii.get(i),s=l?Oi(l.zone)[l.index]:void 0;if(!s)return!1;if(!o&&Xl(r).has(n))return!1;const d=gr(s.type,hr(Pt?.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?.(Oi(n),r))})(e.zone,o,e.index,t)},ts=(e,n)=>{const t=On(e.from),o=e.node;return t===On(n)?es(t,o.type):ns({id:String(o.props?.id??""),zone:t,index:-1,type:o.type},n,o)},os=e=>{const n=e.slice(0,e.indexOf(":")),t=Ii.get(n),o=t?Oi(t.zone)[t.index]:void 0;if(!t||!o)return null;const r=gr(o.type,hr(Pt?.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=B(r.choices??(r.spec?[{type:r.spec.childType,label:xi(r.spec.childType)}]:[])),l=Mi(e);return{parent:o,parentId:n,target:r,choices:i,parentName:l?l.slot.label:dl(o,t.zone===ze)}},rs=(e,n)=>{if("section"!==e.kind)return e;const t=On(n);return t===ze||ql(t)?e:os(t)?.choices.some(n=>n.type===e.type)?{kind:"block",type:e.type}:e},is=(e,n)=>{const t=rs(e,n),o=On(n);if("shared"===t.kind){if(o!==ze||!Et.shared?.nodeOf(t.section))return!1;const{floor:e,cap:r}=pi();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 es(o,e)&&n.index>=0&&n.index<=Oi(o).length}if(o!==ze)return!1;const{floor:e,cap:r}=pi();return n.index>=e&&n.index<=r}if(o===ze)return!1;const r=os(o);return!(!r||!r.choices.some(e=>e.type===t.type))&&!r.target.spec?.addBlocked?.(Oi(o))},ls=(e,n)=>{const t=rs(e,n);if("block"!==t.kind&&ql(On(n)))return void((e,n,t)=>{const o="section"===e.kind?e.type:"template"===e.kind?e.template.node.type:null;if(o&&es(n,o)){if("section"===e.kind)co.insertComponent(n,e.type,t);else{if("template"!==e.kind)return;co.insertNode(n,t,hi(e.template.node))}Xo(R),co.select({index:t,zone:n})}})(t,On(n),n.index);if("section"===t.kind)return void rl(t.type,n.index);if("template"===t.kind)return void((e,n,t)=>{const o=nl(t),r=co.insertNode(ze,o,n);ol(o,r,e)})(t.template.name,hi(t.template.node),n.index);if("shared"===t.kind){const e=Et.shared?.nodeOf(t.section);if(!e)return;const o=nl(n.index);return void(gi.restore(e,{parentId:In,slot:Bn,index:o})&&ol(o,e.props.id,t.section.title))}const o=On(n),r=os(o);r&&(r.target.spec?Bl(r.parentId,r.target.slot,t.type,n.index,r.parent.type):((e,n,t)=>{co.insertComponent(e,n,t),Xo(R),co.select({index:t,zone:e})})(o,t.type,n.index))},ss=(e,n)=>{e.media?function(e){const n=Ts();if(!n||!js)return;Ds(n).then(n=>{n&&function(e,n){if(!js)return;const t=js.create(e,{nodeDefaults:zi,newNodeId:Oe,sectionLabel:Ci,blockIsOffered:yr}),o=On(n);if(o===ze){const e=nl(n.index),o=co.insertNode(ze,e,t);return void ol(e,o,Ci(t.type))}co.insertNode(o,n.index,t),Xo(R),co.select({index:n.index,zone:o})}(n,e)})}(n):e.rung?Ti(e.rung.nodeId,e.index,n.index):e.add?ls(e.add,n):e.zone===ze?tl(e.index,n.index):Ql(e.zone,On(n),e.index,n.index)},[ds]=An(()=>hn()),as=mn({keyOf:e=>e.id,readOnly:Boolean(xt),session:ds,canDrop:ns,onDrop:ss,onStep:(e,n)=>{e.rung?Ti(e.rung.nodeId,e.index,n<0?e.index-1:e.index+2):e.zone===ze?((e,n)=>{const t=Ci(ci[e]?.type??""),o=tl(e,n<0?e-1:e+2);if(!o.moved)return void Vr(n<0?Gt.sectionFirst({name:t}):Gt.sectionLast({name:t}));const{floor:r,cap:i}=pi();Vr(Gt.sectionMoved({name:t,n:o.dest-r+1,total:i-r}))})(e.index,n):Ql(e.zone,e.zone,e.index,n<0?e.index-1:e.index+2)}}),cs=Tn(e=>{const{floor:n,cap:t}=pi(),o=[];for(const r of e.nodes){const e=On(r.place),i=Oi(e)[r.place.index];if(!i||String(i.props.id)!==r.id)continue;if(Ut(i)||Jt(i)||ur(i.type,i))continue;if(Ft(i.type))continue;const l=Boolean(ql(e)),s=e===ze||l;e===ze&&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?Ci(i.type):Fi(i),from:r.place})}const r=e.zones.flatMap(e=>{const n=On(e.list);if(n===ze&&0===e.children.length)return[{...e,addLabel:Gt.addSection,addAlways:!0}];const t=os(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=On(e.list),t=n===ze||ql(n)?null:os(n);return t?.choices.length?cn(e,t.target.spec?.addLabel??Gt.addBlockHere):[]});return{sources:o,zones:r,seams:i}},[Pt.data]),ps=null==Lt?.props.id?null:String(Lt.props.id),us=Tn(e=>{const n=At,t=e=>!e.item.rung&&null!==$n(Pt.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(ps);return i||(r(Ye(Pt.data,n,o.item.id,ps,El))??o)},[Pt.data,At,ps,El]),[fs,hs]=An(null),ms=Boolean(Al||Rl);Sn(Eo,"mouseover",e=>{if(!ms)return;const n=wn(e.target),t=n?ft(Pt.data,At,n):null;t!==fs&&hs(t)}),Sn(Eo,"mouseout",e=>{ms&&!e.relatedTarget&&hs(null)});const gs=e=>Ut(e)||Jt(e)||Ft(e.type),ys=e=>{const n=Ft(e.type)?xi(e.type):Ut(e)?Gt.header:Jt(e)?Gt.footer:null;return null===n?Ni(e):vr.rowName?vr.rowName(e,"section",n):n},vs=[];if(ms){const e=ps?ft(Pt.data,At,ps):null;for(const n of/* @__PURE__ */new Set([e,fs])){const e=n?ci.find(e=>String(e.props.id)===n):void 0;if(!e)continue;const t=Ut(e)||e.type===Rt,o=Dl(e);if(o){vs.push({id:String(e.props.id),label:ys(e),below:t,reach:o});continue}if(!Al||!gs(e))continue;const r=Al(e);r&&vs.push({id:String(e.props.id),label:r,below:t})}}const ks=pe(),bs=Ln(null);En(()=>{const e=Et.changeNotice;if(!e)return;const n=JSON.stringify(ci.filter(gs)),t=bs.current;if(bs.current={doc:zn,bands:n,index:Mt.index},!t||t.doc!==zn||t.bands===n)return;Mt.hasPast&&Mt.index>=t.index&&!ut.has(ks)&&(ut.add(ks),Vr(e,"success",{action:{label:Gt.bar.undo,onClick:()=>Mt.back()},duration:8e3}))},[ci]);const Ss=e=>{Xo(R),co.select(e.zone===ze?{index:e.index}:{index:e.index,zone:e.zone})},ws=Z(),xs=()=>({data:Pt.data,device:ko,ops:co,inspector:dr}),zs=ws?.model,Cs=jn(()=>zs?e=>zs(e,cs(e),xs()):cs,[zs,cs,ko]),Ns=ws?.measure,Is=Ns?(e,n)=>Ns(e,n,xs()):void 0,Bs=ws?.canDrop,Os=Bs?(e,n)=>Bs(e,n,ns,xs()):ns,Ps=ws?.drop,$s=Ps?(e,n)=>Ps(e,n,ss,xs()):ss,Ms=ws?.pick,Ls=Ms?e=>Ms(e,Ss,xs()):Ss,js=ws?.media??null,As=Ln(null),Es=jn(()=>js?{id:ct,zone:"",index:-1,type:js.adds.type,add:{kind:js.adds.kind,type:js.adds.type},media:!0}:null,[js]);En(()=>{if(!Es||xt||"undefined"==typeof document)return;const e=e=>{(e=>Array.from(e.dataTransfer?.types??[]).includes(Xn))(e)&&(As.current=null,ds.start({key:ct,item:Es}))},n=e=>{ds.get()?.item.media&&(As.current=Un(e.dataTransfer))},t=()=>{ds.get()?.item.media&&ds.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)}},[Es,xt,ds]);const Ts=()=>{const e=As.current;return As.current=null,e},Rs=ce(),Ds=async e=>{if(!Rs)return e;const n=await Rs(e);return n?{...e,id:n.id,url:n.url}:null};const Fs=(e,n)=>{if(!js)return;const t=$n(ao.getState().appState.data,ui,n);if(!t)return;const o=t.node;co.replaceComponent(On(t.place),t.place.index,{...o,props:{...js.replace(o,e),id:o.props.id}})},Hs=e=>{const n=On(e),t=Mi(n);t&&Ai(t.node,t.slot,!1),ll(n,e.index)},Ws=(e,n)=>/* @__PURE__ */st(He,{...xt?{}:as.seam({place:{...Pn(e),index:n}})},`seam:${e}:${n}`),Vs={rowClick:al,isCollapsed:Rr,toggleCollapse:Dr},Us=e=>{const n=String(e.props.id),t=ci.findIndex(e=>String(e.props.id)===n),o=Ht(n),r=Oi(o),i=Rr(n),l=xi(e.type),s=vr.rowName?vr.rowName(e,"section",l):l,d=e=>Ws(o,e);/* @__PURE__ */
|
|
16
|
-
return dt(at,{children:[
|
|
17
|
-
/* @__PURE__ */st(Ee,{words:Zt,icon:/* @__PURE__ */st(br,{type:e.type,size:13}),name:s,preview:pl(e),marks:ul(e),onSelect:()=>el(t),nameSlot:Wi(ze,t,n,s),selected:qo===n,badge:Dl(e)?void 0:Vl,shared:Dl(e),actions:fl(e,ze,t)??void 0,rowProps:{"data-node-id":n,onClick:al(()=>el(t))},fold:{open:!i,label:"section",onToggle:()=>Dr(n)}}),!i&&/* @__PURE__ */dt(Te,{children:[r.map((n,t)=>{const r=String(n.props.id),i=Ni(n),l=Cl(n),s=l&&Rr(r),a=()=>Il(o,t,r,e.type),{rowProps:c,...p}=as.row({item:{id:r,zone:o,index:t,type:n.type},place:{...Pn(o),index:t}},{"data-node-id":r,onClick:al(a)});/* @__PURE__ */
|
|
18
|
-
return dt(Dn,{children:[d(t),
|
|
19
|
-
/* @__PURE__ */st(Ee,{words:Zt,icon:/* @__PURE__ */st(br,{type:n.type,size:13}),name:i,preview:pl(n),marks:ul(n),onSelect:a,nameSlot:Wi(o,t,r,i),selected:qo===r,hidden:Boolean(n.props._hidden),...p,fold:l?{open:!s,label:"section",onToggle:()=>Dr(r)}:void 0,actions:/* @__PURE__ */dt(at,{children:[cl(o,t,i),fl(n,o,t),hl(o,t,n,i)]}),rowProps:c}),l&&!s&&/* @__PURE__ */st(Te,{children:Ks(n,2)})]},r)}),d(r.length)]})]})},Js=(e,n,t,o,r)=>{const i=String(e.props.id),l=`${i}:${n.slot}`,s=as.dragging,d=!Rr(l)&&s?.rung?.nodeId!==i,a={...Pn(l),index:0},c=s&&!s.rung&&ns(s,a)?a:void 0,p=()=>Ai(e,n,!0),{rowProps:u,...f}=as.row({item:{id:`rung:${l}`,zone:`${i}:${vt}`,index:t,type:e.type,rung:{nodeId:i,slot:n.slot}},place:{parentId:i,slot:vt,index:t},into:c,canDrag:Boolean(pr.moveSlot)&&!1!==n.movable&&o>1},{"data-slot-zone":l,onClick:al(p)}),h=xt?null:pr.slotActions?.(e,n.slot);/* @__PURE__ */
|
|
20
|
-
return dt(Dn,{children:[n.heading,
|
|
21
|
-
/* @__PURE__ */st(Ee,{words:Zt,icon:n.glyph??null,name:n.label,badge:n.badge,onSelect:p,selected:Li===l,...f,dragHint:n.dragHint,fold:{open:d,label:n.label,onToggle:()=>Dr(l)},actions:h&&h.length>0?/* @__PURE__ */st(at,{children:h.map((t,o)=>/* @__PURE__ */st(Fe,{kind:"delete"===t.kind?"delete":"plain",label:t.label,disabled:t.disabled,onClick:()=>((e,n,t)=>{if(xt||t.disabled)return;const o=String(e.props.id),r=e=>{"string"==typeof e&&Ei(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__ */st(tt,{size:15}):/* @__PURE__ */st(lt,{size:15})},`${o}:${t.kind}`))}):void 0,rowProps:u}),d&&/* @__PURE__ */st(Te,{children:r})]},l)},Ys=(e,n)=>{const t=kl(e),o=t.filter(e=>e.rung).length;let r=0;/* @__PURE__ */
|
|
22
|
-
return st(at,{children:t.map(t=>{const i=t.kids,l=t.rung?n+1:n,s=wl(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)=>Ws(e,n),p=/* @__PURE__ */dt(at,{children:[i.map(({child:n,zone:t,index:o})=>{const r=qo===String(n.props.id),{collapsible:i,folded:s}=xl(n,l,Nl(n.type)),d=String(n.props.id),a=Zl(n),p=()=>Il(t,o,d,e.type),{rowProps:u,...f}=as.row({item:{id:d,zone:t,index:o,type:n.type},place:{...Pn(t),index:o}},{"data-node-id":d,onClick:al(p)});/* @__PURE__ */
|
|
23
|
-
return dt(Dn,{children:[0===o&&c(t,0),
|
|
24
|
-
/* @__PURE__ */st(Ee,{words:Zt,icon:/* @__PURE__ */st(br,{type:n.type,size:13}),name:a,preview:pl(n),marks:ul(n),onSelect:p,nameSlot:Wi(t,o,d,a),selected:r,hidden:Boolean(n.props._hidden),...f,fold:i?{open:!s,label:"group",onToggle:()=>Dr(d)}:void 0,actions:/* @__PURE__ */dt(at,{children:[cl(t,o,a),fl(n,t,o),hl(t,o,n,a)]}),rowProps:u}),i&&!s&&/* @__PURE__ */st(Te,{children:Ys(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__ */st(Dn,{children:p},t.slot??"")})})},Ks=(e,n)=>{const t=hr(Pt?.data,e.type,String(e.props.id)),o=kl(e),r=o.filter(e=>e.rung).length;let i=0;/* @__PURE__ */
|
|
25
|
-
return st(at,{children:o.map(o=>{const l=o.kids,s=o.rung?n+1:n,d=wl(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)=>Ws(e,n),g=null===o.slot?null:`${u}:${o.slot}`,y=Boolean(a&&!a.fixed&&(null===g||g===f)),v=/* @__PURE__ */dt(at,{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}=xl(n,s,Nl(n.type)),c=yl(n.type),p=1===c.length?`${l}:${c[0]}`:null,u=p?{...Pn(p),index:Oi(p).length}:void 0,f=as.dragging,h=u&&f&&ns(f,u)?u:void 0,g=()=>Il(t,o,l,e.type),{rowProps:y,...v}=as.row({item:{id:l,zone:t,index:o,type:n.type},place:{...Pn(t),index:o},into:h,canDrag:!ur(n.type,n)},{"data-node-id":l,onClick:al(g)});/* @__PURE__ */
|
|
26
|
-
return dt(Dn,{children:[0===o&&m(t,0),
|
|
27
|
-
/* @__PURE__ */st(Ee,{words:Zt,icon:/* @__PURE__ */st(br,{type:n.type,size:13}),name:i,preview:pl(n),marks:ul(n),onSelect:g,nameSlot:Wi(t,o,l,i),selected:r,hidden:Boolean(n.props._hidden),...v,fold:d?{open:!a,label:"group",onToggle:()=>Dr(l)}:void 0,actions:ur(n.type,n)?fl(n,t,o)??void 0:/* @__PURE__ */dt(at,{children:[cl(t,o,i),fl(n,t,o),hl(t,o,n,i)]}),rowProps:y}),d&&!a&&/* @__PURE__ */st(Te,{children:Ks(n,s+1)}),m(t,o+1)]},String(n.props.id??`${t}-${o}`))}),y&&a&&
|
|
28
|
-
/* @__PURE__ */st(w,{small:!0,label:a.addLabel,blocked:a.addBlocked?.(c)??null,onAdd:()=>Bl(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,v):/* @__PURE__ */st(Dn,{children:v},o.slot??"")})})},Gs=Vo,Zs=e=>"panel"in e?{id:e.id,label:e.label,icon:e.icon,active:uo&&!Gs&&cr===e.id,onSelect:()=>li(e.id)}:e,Qs=[...(ar.railLead??[]).map(Zs),{id:"sections",label:Gt.layers,icon:/* @__PURE__ */st(he,{}),active:uo&&!Gs&&"sections"===cr,onSelect:()=>li("sections")},...(ar.railTrail??[]).map(Zs)];wo?Qs.push({id:"media",label:Gt.railMedia,icon:/* @__PURE__ */st(me,{}),active:Co,onSelect:No}):It&&Qs.push({id:"media",label:Gt.railMedia,icon:/* @__PURE__ */st(me,{}),onSelect:si});const Xs={value:Qs.find(e=>!0===e.active)?.id??"",press:e=>{const n=Qs.find(n=>n.id===e);n&&!n.disabled&&!0!==n.active&&n.onSelect?.()},items:Qs.map(e=>({id:e.id,icon:e.icon,label:/* @__PURE__ */st("span",{className:"sr-only",children:e.label}),tooltip:e.label,disabled:e.disabled}))},_s=[...ar.railLead??[],...ar.railTrail??[]].find(e=>"panel"in e&&e.id===cr),qs=Boolean(Kt?.foldable),ed=Kt?.label??(Bt?Gt.pageSections:Gt.templateSections),nd=qs&&Rr(kt),td=/* @__PURE__ */dt(at,{children:[ci.map((e,n)=>{if(Ut(e)||Jt(e)||Ft(e.type))return null;const t=qo===String(e.props.id),o=Boolean(e.props._hidden);vl(e);const r=String(e.props.id),i=ar.hasOwnRows?.(e)??!1,l=Cl(e)||i,s=l&&Rr(r),d=yl(e.type),a=1===d.length?`${r}:${d[0]}`:null,c=a?{...Pn(a),index:Oi(a).length}:void 0,p=as.dragging,u=c&&p&&ns(p,c)?c:void 0,{rowProps:f,...h}=as.row({item:{id:r,zone:ze,index:n,type:e.type},place:{...Pn(ze),index:n},into:u,canDrag:!ur(e.type,e)},{"data-node-id":r,onClick:al(()=>el(n))});/* @__PURE__ */
|
|
29
|
-
return dt(Dn,{children:[n>0&&ml(n),
|
|
30
|
-
/* @__PURE__ */st(Ee,{words:Zt,icon:/* @__PURE__ */st(br,{type:e.type,size:13}),name:Ni(e),preview:pl(e),marks:ul(e),shared:Dl(e),onSelect:()=>el(n),nameSlot:Wi(ze,n,r,Ni(e)),selected:t,hidden:o,...h,fold:l?{open:!s,label:"section",onToggle:()=>Dr(r)}:void 0,actions:/* @__PURE__ */dt(at,{children:[cl(ze,n,Ni(e)),fl(e,ze,n),hl(ze,n,e,Ni(e))]}),rowProps:f}),Cl(e)&&!s&&/* @__PURE__ */dt(Te,{children:[Ks(e,1),ar.partRows?.(e,Vs)]}),i&&!s&&/* @__PURE__ */st(Te,{children:ar.ownRows?.(e,n,Vs)})]},String(e.props.id??n))}),Yl>0&&ml(Yl)]}),od=(e,n,t)=>{const o=String(e.props.id),r=bl(e).length>0||Sl(e)||Boolean(gr(e.type)),i=r&&Rr(o),l="header"===t?Gt.header:Gt.footer,s=vr.rowName?vr.rowName(e,"section",l):l;/* @__PURE__ */
|
|
31
|
-
return dt(at,{children:[
|
|
32
|
-
/* @__PURE__ */st(Ee,{words:Zt,icon:/* @__PURE__ */st(br,{type:t,size:13}),name:s,preview:pl(e),marks:ul(e),badge:Dl(e)?void 0:Vl,shared:Dl(e),onSelect:()=>el(n),nameSlot:Wi(ze,n,o,s),selected:qo===String(e.props.id),fold:r?{open:!i,label:"section",onToggle:()=>Dr(o)}:void 0,actions:fl(e,ze,n)??void 0,rowProps:{"data-node-id":o,onClick:al(()=>el(n))}}),r&&!i&&/* @__PURE__ */st(Te,{children:Ys(e,1)})]})};return(ar.wrap??(e=>e))(
|
|
33
|
-
/* @__PURE__ */st(Q,{target:Eo,children:/* @__PURE__ */dt("div",{ref:Ao,className:"sf-editor es-editor",style:tn(Lr),onContextMenu:Gi.onEditorContextMenu,...u(vn),children:[
|
|
34
|
-
/* @__PURE__ */dt(Ke,{children:[
|
|
35
|
-
/* @__PURE__ */st("div",{className:"es-cluster es-cluster--left","aria-hidden":"true"}),
|
|
36
|
-
/* @__PURE__ */dt(Ge,{children:[
|
|
37
|
-
/* @__PURE__ */st(Ze,{label:Gt.bar.undo,disabled:Boolean(xt)||!Mt.hasPast,onClick:()=>Mt.back(),children:/* @__PURE__ */st(_n,{})}),
|
|
38
|
-
/* @__PURE__ */st(Ze,{label:Gt.bar.redo,disabled:Boolean(xt)||!Mt.hasFuture,onClick:()=>Mt.forward(),children:/* @__PURE__ */st(qn,{})}),
|
|
39
|
-
/* @__PURE__ */st(Qe,{}),
|
|
40
|
-
/* @__PURE__ */st(Xe,{devices:ho,value:ko,onChange:bo}),
|
|
41
|
-
/* @__PURE__ */st(Ze,{label:Gt.bar.refresh,tip:Gt.bar.refreshTip,onClick:()=>{jo.current=(()=>{const e=Eo?.document;if(!e)return null;const n=ci.findIndex(Jt),t=n>=0?n:ci.length;let o=null;for(let n=0;n<t;n++){const t=ci[n]?.props?.id;if(null==t)continue;const r=Nn(e,`[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=Lt?.props?.id??ci[0]?.props?.id;null!=e&&(o={id:String(e),offset:0})}return o})(),Lo(e=>e+1)},children:/* @__PURE__ */st(et,{})})]}),
|
|
42
|
-
/* @__PURE__ */dt(Ge,{kind:"right",style:{minWidth:300},children:[
|
|
43
|
-
/* @__PURE__ */st(k,{input:Ho,words:Gt.saveStatus}),ar.barLead?.(),ar.barTrail?.(),ar.mainAction||!ar.barMain?/* @__PURE__ */st(b,{input:Ho,action:ar.mainAction??{label:Gt.done,onPress:()=>{Yn(Pt.data)}},readOnly:Boolean(xt),saveSwitch:Ct,onToggleAutoSave:Qn,onSaveNow:Wo,bar:Gt.bar,words:Gt.saveStatus}):ar.barMain()]})]}),
|
|
44
|
-
/* @__PURE__ */st(oe,{}),
|
|
45
|
-
/* @__PURE__ */dt("div",{className:"sf-body",children:[uo?/* @__PURE__ */dt(at,{children:[
|
|
46
|
-
/* @__PURE__ */dt("aside",{className:"es-sidepanel es-sidepanel--left sf-panel sf-panel--left","aria-label":Gt.leftPanel,children:[
|
|
47
|
-
/* @__PURE__ */st("div",{className:"es-paneltabs",children:/* @__PURE__ */st(Wn,{variant:"underline",block:!0,"aria-label":Gt.bar.views,value:Xs.value,onChange:Xs.press,items:Xs.items})}),Vo?/* @__PURE__ */st(x,{at:Yo?{label:(e=>{const n=ql(e.zone);if(n)return Gt.add.addingTo({name:vr.rowName?dl(n,!0):xi(n.type)});if(e.zone===ze){const n=ci[e.index];return n&&!Jt(n)?Gt.add.addingBefore({name:dl(n,!0)}):Gt.add.addingAtEnd}const t=os(e.zone);return t?Gt.add.addingTo({name:t.parentName}):Gt.add.addingHere})(Yo),onClear:()=>Ko(null)}:void 0,placeBlocks:Yo&&Yo.zone!==ze?os(Yo.zone)?.choices:void 0,canTake:Yo?e=>{if(!Yo)return null;const n={...Pn(Yo.zone),index:Yo.index};if(is(e,n))return null;if("shared"===e.kind&&Yo.zone===ze&&!Et.shared?.nodeOf(e.section))return Gt.shared.alreadyHere;const t=ql(Yo.zone);if(t)return Gt.add.notInside({name:dl(t,!0)});if(Yo.zone===ze)return Gt.add.onlySections;const o=os(Yo.zone);return o?Gt.add.notInside({name:o.parentName}):Gt.add.onlySections}:void 0,onPick:Yo?e=>{if(!Yo)return;const n={...Pn(Yo.zone),index:Yo.index};is(e,n)&&(ls(e,n),sl())}: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:ds,siteWide:ar.addPanelRow?.(sl),onClose:sl,onHide:ri,readOnly:Boolean(xt)}):_s?_s.panel({onHide:ri,notify:Vr}):/* @__PURE__ */dt(at,{children:[
|
|
48
|
-
/* @__PURE__ */st(N,{icon:/* @__PURE__ */st(he,{}),title:Gt.layers,context:to,actions:/* @__PURE__ */dt(at,{children:[!xt&&/* @__PURE__ */st(_e,{label:Gt.add.title,onClick:()=>il(null),children:/* @__PURE__ */st(nt,{size:15})}),
|
|
49
|
-
/* @__PURE__ */st(_e,{label:Gl?Gt.expandAll:Gt.collapseAll,title:0===Kl.length?Gt.nothingToFold:void 0,disabled:0===Kl.length,onClick:()=>Mr(e=>{const n=new Set(Kl);return Gl?new Set([...e].filter(e=>!n.has(e))):/* @__PURE__ */new Set([...e,...Kl])}),children:/* @__PURE__ */st(mt,{expand:Gl})})]}),onHide:ri}),
|
|
50
|
-
/* @__PURE__ */dt(Re,{className:"sf-tree sf-scroll",words:Zt,children:[
|
|
51
|
-
/* @__PURE__ */st(Ee,{words:Zt,icon:/* @__PURE__ */st(br,{type:"page",size:13}),name:Gt.pageSettings,onSelect:di,selected:!Lt&&_o,rowProps:{onClick:al(di)}}),Ul&&/* @__PURE__ */dt(at,{children:[!Tl&&/* @__PURE__ */st(De,{children:Gt.header}),Us(Ul)]}),Ot&&!(Tl&&Ul)&&/* @__PURE__ */dt(at,{children:[!Tl&&/* @__PURE__ */st(De,{children:Gt.header}),!Yt&&/* @__PURE__ */st(Ee,{words:Zt,icon:/* @__PURE__ */st(br,{type:"header",size:13}),name:Gt.header,badge:Wl?void 0:Vl,shared:Wl,onSelect:ai,selected:Qo.kind===Vt?.kind,rowProps:{onClick:al(ai)}})]}),jl&&!(Tl&&Ul)&&od(jl,Ll,"header"),!qs&&/* @__PURE__ */st(De,{children:ed}),qs?/* @__PURE__ */dt(at,{children:[
|
|
52
|
-
/* @__PURE__ */st(Ee,{words:Zt,icon:null,name:ed,fold:{open:!nd,label:ed,onToggle:()=>Dr(kt)}}),!nd&&/* @__PURE__ */st(Te,{children:td})]}):td,Ot&&!Tl&&/* @__PURE__ */st(De,{children:Gt.footer}),Ml&&!(Tl&&Jl)&&od(Ml,$l,"footer"),Jl&&Us(Jl),ar.treeFoot?.()]})]})]}),
|
|
53
|
-
/* @__PURE__ */st(qe,{side:"left",width:Lr.left,min:nn.left,max:en,defaultWidth:m.left,label:Gt.resizeLeftPanel,onResize:Er})]}):/* @__PURE__ */st(I,{side:"left",onShow:ri}),
|
|
54
|
-
/* @__PURE__ */dt("div",{ref:Ur,className:"sf-center sf-scroll","data-sf-canvas-head":Zr?"":void 0,style:{overflowX:ni?"auto":"hidden",overflowY:"hidden"},children:[Zr&&/* @__PURE__ */st("div",{ref:Qr,className:"sf-canvas-head",children:/* @__PURE__ */st(Zr,{device:ko})}),
|
|
55
|
-
/* @__PURE__ */dt("div",{className:"sf-frame-scaler",style:ti,children:[
|
|
56
|
-
/* @__PURE__ */st("div",{className:"sf-frame "+(ko===yo?"":`sf-frame--${ko}`),style:oi,children:/* @__PURE__ */dt("div",{className:"sf-preview-host",children:[
|
|
57
|
-
/* @__PURE__ */st(je.Provider,{value:El,children:/* @__PURE__ */st(Ae.Provider,{value:Hl,children:/* @__PURE__ */st(oo,{},Mo)})}),
|
|
58
|
-
/* @__PURE__ */st(pn,{canvas:Eo,session:ds,model:Cs,measure:Is,canDrop:Os,onDrop:$s,choose:us,onPick:Ls,dropOn:js?{accepts:(e,n)=>{if(!e.media||!js||n.item.rung)return!1;const t=$n(Pt.data,ui,n.item.id);return null!==t&&js.takes(t.node)},onDrop:(e,n)=>(e=>{const n=Ts();n&&js&&Ds(n).then(n=>{n&&Fs(n,e.item.id)})})(n),label:()=>Gt.canvasReplaceImage}:void 0,onZoneAdd:Hs,onSeamAdd:Hs,zoneAddLabel:Gt.canvasAddBlock,words:Qt.canvas,readOnly:Boolean(xt),revision:Pt.data}),Go.length>0&&!To&&/* @__PURE__ */st("div",{className:"sf-preview-gaps",children:Go.map(e=>
|
|
59
|
-
/* @__PURE__ */st(un,{index:e.index,label:Gt.addSectionHere,onInsert:()=>il(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))})]})}),ms?/* @__PURE__ */st(ht,{canvas:Eo,tabs:vs,onSelect:e=>{const n=ci.findIndex(n=>String(n.props.id)===e);n>=0&&el(n)}}):null]})]}),fo?/* @__PURE__ */dt(at,{children:[
|
|
60
|
-
/* @__PURE__ */st(f,{value:{selectChild:Il,addChild:Bl,childRowName:Fi,blockRowName:Zl},children:/* @__PURE__ */st(ro,{mode:Qo,onOpenWebsiteSettings:ar.openSettings??(()=>{}),onOpenSiteStyles:ar.openStyles,onSelectNode:zr,onNotify:Vr,onHidePanel:ii,nodeActions:Lt?Ce(At,Lt.type):bt})}),
|
|
61
|
-
/* @__PURE__ */st(qe,{side:"right",width:Lr.right,min:nn.right,max:en,defaultWidth:m.right,label:Gt.resizeSettingsPanel,onResize:Tr})]}):
|
|
62
|
-
/* @__PURE__ */st(I,{side:"right",onShow:ii})]}),Gi.menu,
|
|
63
|
-
/* @__PURE__ */st(ee,{}),vi?/* @__PURE__ */st(pt,{name:vi.name,onMake:e=>(async(e,n)=>{const t=ci.find(n=>String(n.props.id)===e),o=Et.shared;if(!t||!o)return;let r;try{r=await C(yi).create(n,t)}catch{return void Vr(Gt.shared.makeFailed,"error")}o.adopt(t,r),ki(null)})(vi.id,e),onCancel:()=>ki(null)}):null]})}))}export{St as ScreenChrome};
|
package/dist/chunk-CBICQ4J3.js
DELETED
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
import{usePickFollowsSelection as n}from"./chunk-LNHT2KPX.js";import{slotFieldsOf as e}from"./chunk-PLVEGYK6.js";import{EaselCanvas as t,useSelectedFields as r}from"./chunk-ROPYFLNZ.js";import{Inspector as i}from"./chunk-SK3P56FS.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,t,r){const i=n.slotsOf?.(r);return i||e(t,r.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},L={labelAtLevel:(n,e,t)=>t,descriptions:{},categoryLabel:()=>{},firstSection:null,blockRowName:(n,e)=>e(n.type),plainText:n=>n,Icon:()=>null,Thumbnail:()=>null,useProducts:()=>null},O={options:[{id:"desktop",label:"Desktop",icon:/* @__PURE__ */s(l,{})}],initial:"desktop",fluid:"desktop",widths:{desktop:2e3}},P={read:()=>"sections",write:()=>{},forSelection:(n,e)=>n?"sections":e},S={first:null,last:null,firstGroup:null,lastGroup:null,isSectionGroup:()=>!1,sectionGroupZone:()=>"",panelOf:()=>null};function j(){/* @__PURE__ */
|
|
2
|
-
return s(t,{height:"fill"})}function w(){const{id:n,fields:e,values:t,readOnly:o,onChange:u}=r();/* @__PURE__ */
|
|
3
|
-
return s("div",{className:"es-sidepanel es-sidepanel--right",children:/* @__PURE__ */s(i,{fields:e,values:t,onChange:u,readOnly:o,idPrefix:n})})}var N=o({});function C({parts:n,children:e}){/* @__PURE__ */
|
|
4
|
-
return s(N.Provider,{value:n,children:e})}function D(){return u(N)}function F(){return(D().useOwnerName??v)()}function G(){return(D().useDocumentLabel??g)()}function x(n,e,t,r){return(D().useBridges??h)(n,e,t,r)}function B(n){return(D().useStandaloneBridges??h)(n)}function I(n,e){(D().useDocumentPass??y)(n,e)}function K(){return D().blockRules??b}function T(){return D().blockLook??L}function R(){return D().devices??O}function A(){return D().leftView??P}function H(){return D().pinned??S}function V(){return D().saveSwitch??!0}function Y(e){n(!0===D().pickFollowsSelection,e)}function Z(){return D().storageNamespace||void 0}function E(){return D().styleClipboard??null}function X(){return D().nodeKeys??!0}function q(){return D().notify??null}function z(){return D().Canvas??j}function J(){return D().CanvasHead??null}function M(){return D().canvasDrag??null}var Q=o(null);function U({target:n,children:e}){/* @__PURE__ */
|
|
5
|
-
return s(Q.Provider,{value:n,children:e})}function W(){return u(Q)}function $(){return D().Inspector??w}export{c as SELECTION_MODE,U as ScreenCanvasTargetProvider,C as ScreenPartsProvider,p as isPinnedFirst,m as isPinnedLast,a as isSlotMode,f as sameInspectorMode,d as screenSlotsOf,T as useScreenBlockLook,K as useScreenBlockRules,x as useScreenBridges,M as useScreenCanvasDrag,z as useScreenCanvasFrame,J as useScreenCanvasHead,W as useScreenCanvasTarget,R as useScreenDevices,G as useScreenDocumentLabel,I as useScreenDocumentPass,$ as useScreenInspectorPanel,A as useScreenLeftView,X as useScreenNodeKeys,q as useScreenNotify,F as useScreenOwnerName,D as useScreenParts,Y as useScreenPickFollowsSelection,H as useScreenPinned,V as useScreenSaveSwitch,Z as useScreenStorageNamespace,E as useScreenStyleClipboard,B as useStandaloneScreenBridges};
|
package/dist/chunk-EW6XAMDZ.js
DELETED
|
@@ -1,8 +0,0 @@
|
|
|
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-CBICQ4J3.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-ROPYFLNZ.js";import{easelMenuEntries as y}from"./chunk-FIVU2COQ.js";import{useWords as h}from"./chunk-MFIRYGHW.js";import{AddPanel as k}from"./chunk-LDEEFLE3.js";import{DEFAULT_DRAG_WORDS as g}from"./chunk-KAML3KQH.js";import{useState as b,useEffect as v,useMemo as j,useRef as C}from"react";import{SharedIcon as w,AddIcon as E}from"efficient-shell/icons/efficient";import{ContextMenu as F,toast as I,Dialog as L,Button as N}from"efficient-shell/ui";import{jsx as O,jsxs as T,Fragment as $}from"react/jsx-runtime";function x({name:e,pages:t,onDelete:n,onCancel:o}){const l=h("screen",f).shared,[r,i]=b(!1),s=C(null);/* @__PURE__ */
|
|
2
|
-
return O(L,{open:!0,role:"alertdialog",size:"sm",title:l.deleteTitle({name:e}),onClose:o,initialFocus:s,footer:/* @__PURE__ */T($,{children:[
|
|
3
|
-
/* @__PURE__ */O(N,{ref:s,variant:"secondary",onClick:o,children:l.cancel}),
|
|
4
|
-
/* @__PURE__ */O(N,{variant:"danger",loading:r,onClick:()=>{(async()=>{i(!0);try{await n()}finally{i(!1)}})()},children:l.deleteShared})]}),children:l.deleteMessage({count:t})})}var A=e=>`section:${e}`,D=e=>`block:${e}`,M=e=>`template:${e}`,B=e=>`shared:${e}`;function S({at:C,placeBlocks:L,canTake:N,onPick:S,itemFor:P,session:Q,siteWide:z,onClose:H,onHide:R,readOnly:V}){const W=u(e=>e.config),Y=a(),{labelAtLevel:Z,categoryLabel:K,firstSection:U,Icon:J,Thumbnail:_}=Y,{blockIsOffered:G,canAddTo:q}=d(),X=h("screen",f).add,ee=h("drag",g).add,te=m(),[ne,oe]=b([]);v(()=>{let e=!1;const t=e=>G(e,te);return l(te).list().then(n=>{if(e)return;const l=W.components;oe(n.filter(e=>e.node?.type&&l[e.node.type]&&o(e.node).every(t)))}).catch(()=>{}),()=>{e=!0}},[W,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=>G(e,te);return r(te).list().then(n=>{if(e)return;const l=W.components;se(n.filter(e=>e.node?.type&&l[e.node.type]&&o(e.node).every(t)))}).catch(()=>{}),()=>{e=!0}},[W,te,ce]);const[de,pe]=b(null),[me,fe]=b(null),ue=j(()=>e(W,Y),[W]),ye=e=>Z(e,"section",W.components[e]?.label??e),he=e=>({type:A(e.type),label:e.name,cover:/* @__PURE__ */O(_,{type:e.type}),title:e.desc?`${e.name} — ${e.desc}`:X.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__ */O("span",{className:"es-add-glyph-cover",children:/* @__PURE__ */O(J,{type:e,size:26})}),be=j(()=>{const e=t(ue,U),o=/* @__PURE__ */new Map,l=e=>{e.retired||o.has(e.type)||!G(e.type,te)||o.set(e.type,e)};for(const t of e?[e]:ue){const e=q(t.type)?.choices??[];e.forEach(l),e.forEach(e=>q(e.type,1)?.choices?.forEach(l))}L?.forEach(l);const r=new Set(ue.map(e=>e.type)),i=[...o.values()].filter(e=>!r.has(e.type)),s=e=>({type:D(e.type),label:e.label,cover:ge(e.type),title:X.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__ */O(_,{type:e.node.type}),mark:/* @__PURE__ */O(w,{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:X.templates,tiles:ne.map(e=>({type:M(e.id),label:e.name,cover:/* @__PURE__ */O(_,{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(W.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(W,t,K),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,W,X,N,L,te]);/* @__PURE__ */
|
|
5
|
-
return T($,{children:[
|
|
6
|
-
/* @__PURE__ */O(i,{icon:/* @__PURE__ */O(E,{size:15}),title:X.title,context:X.contextAll,actions:/* @__PURE__ */O(s,{label:X.done,description:X.doneDescription,onClick:H}),onHide:R}),
|
|
7
|
-
/* @__PURE__ */T("div",{className:"sf-addside sf-scroll",children:[
|
|
8
|
-
/* @__PURE__ */O(k,{groups:be,session:Q,itemFor:e=>P(ke(e)??{kind:"section",type:e}),onInsert:S?e=>{const t=ke(e);t&&S(t)}:void 0,onTileMenu:(e,t)=>{const n=ke(e);return"shared"===n?.kind&&!V&&(pe({section:n.section,...t}),!0)},at:C,hint:X.hint,searchLabel:X.search,readOnly:V,words:ee}),z??null]}),de?/* @__PURE__ */O(F,{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__ */O(x,{name:me.title,pages:me.used_on.length,onDelete:()=>(async e=>{try{await r(te).remove(e.id)}catch{return void I.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{S as AddSidePanel,D as blockKey,A as sectionKey,B as sharedKey,M as templateKey};
|
package/dist/chunk-M62P4IQK.js
DELETED
|
@@ -1,2 +0,0 @@
|
|
|
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};
|
package/dist/chunk-NHY5L3SE.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{useScreenBlockRules as e}from"./chunk-CBICQ4J3.js";import{newNodeId as t,ROOT_ZONE as n}from"./chunk-PLVEGYK6.js";import{useEasel as o,useEaselApi as r}from"./chunk-ROPYFLNZ.js";import{useMemo as s}from"react";function i(i={}){const{dispatch:p}=o(e=>e),d=r(),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,o=(n,o,r)=>{const s=t(o);return c||e({type:"insert",componentType:o,destinationZone:n,destinationIndex:r,id:s}),s},r=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,t,n)=>r(o(e,t,n));return{insertComponent:i,insertSection:(e,t)=>i(n,e,t),replaceComponent:s,seedChild:(e,t,n,i)=>{const p=o(e,n,t);s(e,t,{type:n,props:{id:p,...i}}),r(p)},insertNode:(e,t,n)=>{const i=o(e,n.type,t);return s(e,t,{type:n.type,props:{...n.props,id:i}}),r(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};
|
package/dist/chunk-QALW2ECZ.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{useEaselSession as e}from"./chunk-O7Q4DDJT.js";import{useHostEscape as n}from"./chunk-U3JP4VGF.js";import{DEFAULT_SCREEN_WORDS as t}from"./chunk-23DYNW6S.js";import{styleMenuItems as o}from"./chunk-V7U33NF2.js";import{ROOT_ZONE as l}from"./chunk-PLVEGYK6.js";import{easelMenuEntries as r,menuLabel as i}from"./chunk-FIVU2COQ.js";import{createNodeClipboard as c,nodeMenuItems as s}from"./chunk-P5VYGWYO.js";import{DEFAULT_NODE_MENU_WORDS as u}from"./chunk-WK3AFPXY.js";import{isTypingTarget as a,useCanvasEvent as d,framePointToHost as p}from"./chunk-QIDRJH3S.js";import{zoneKey as f,ROOT_SLOT as m,ROOT_ID as h}from"./chunk-K7BTCBWD.js";import{useState as y,useCallback as k,useRef as b,useEffect as g}from"react";import{ContextMenu as v}from"efficient-shell/ui";import{UndoIcon as w,RedoIcon as x,PasteIcon as C,SettingsIcon as z,LayersIcon as O,CopyIcon as P}from"efficient-shell/icons/efficient";import{jsx as D}from"react/jsx-runtime";function A(e,n){const t=[],o=/* @__PURE__ */new Set;let r={zone:n.zone,index:n.index};for(;r;){const n=e.nodeAt(r.zone,r.index);if(!n||o.has(n.props.id))break;if(o.add(n.props.id),t.push({zone:r.zone,index:r.index,node:n,parentType:null}),r.zone===l)break;const i=r.zone.lastIndexOf(":");if(i<=0)break;r=e.locate(r.zone.slice(0,i))}for(let e=0;e<t.length-1;e+=1)t[e].parentType=t[e+1].node.type;return t}var K=c(),j=/* @__PURE__ */new WeakMap;function S(e){if(e.claimsPage)return K;const n=e.registry;if(!n)return e.cache("easel:node-clipboard",c);let t=j.get(n);return t||(t=c(),j.set(n,t)),t}function T(){return S(e())}function M(e,n,t){if(n===l){const{floor:n,cap:o}=e.sectionBand();return{parentId:h,slot:m,index:Math.min(Math.max(t,n),o)}}const o=n.lastIndexOf(":");return{parentId:n.slice(0,o),slot:n.slice(o+1),index:t}}function Y(e,n,t){const o=e.isPinned(n,t),l=!o&&!e.isLocked(n)&&!e.duplicateBlocked(n),r=e.permits?.(n)??{duplicate:!0,delete:!0};return{copy:!o&&r.duplicate,cut:l&&r.duplicate&&r.delete,delete:l&&r.delete}}function I(e,n,t){const o=e.canPasteAt;if(!o)return f(n.from)===t.zone?M(e,t.zone,t.index+1):null;for(const l of A(e,t)){const t=M(e,l.zone,l.index+1);if(o(n,t))return t}return null}function V(e){if(e.defaultPrevented||e.altKey||e.shiftKey)return null;if(a(e.target))return null;const n=e.target,t=n&&"ownerDocument"in n?n.ownerDocument??n:null,o=t?.getSelection?.();if(o&&!o.isCollapsed&&o.toString().trim())return null;if(!e.metaKey&&!e.ctrlKey)return"Delete"===e.key?"delete":null;const l=e.code||(1===e.key.length?`Key${e.key.toUpperCase()}`:"");return"KeyC"===l?"copy":"KeyX"===l?"cut":"KeyV"===l?"paste":null}function B(e,n,t,o){const l=e.nodeAt(t.zone,t.index);if(!l)return null;const r=l.props.id,i=e.labelOf(l.type,t.zone),c=Y(e,l,t.zone);if("copy"===n)return c.copy?(e.nodeOps.copy(r,i),{done:"copied",name:i}):null;if(o.readOnly)return null;if("cut"===n)return c.cut?(e.nodeOps.cut(r,i),{done:"cut",name:i}):null;if("delete"===n)return c.delete?(e.nodeOps.remove(r),{done:"deleted",name:i}):null;const s=o.held;if(!s)return null;const u=e.isPinned(l,t.zone)?null:I(e,s,t);return u?(e.nodeOps.paste(u),{done:"pasted",name:s.label}):(e.onPasteRefused(s),{done:"refused",name:s.label})}function E(e,n){const{zone:t,index:r}=n,i=e.nodeAt(t,r);if(!i)return[];const c=i.props.id,u=e.labelOf(i.type,t),a=Boolean(i.props._hidden),d=e.nodeOps,p=e.isPinned(i,t),f=e.isLocked(i),m=!p&&!f&&!e.duplicateBlocked(i),h=e.permits?.(i)??{duplicate:!0,delete:!0},y=Y(e,i,t),k=A(e,n),b=d.held,g=b&&!p?I(e,b,n):null,v=!e.readOnly,w=e.style?o({held:v?e.style.held():null,canCopy:e.style.canCopy(i,t),onCopy:()=>e.style?.copy(i,t),onPaste:()=>e.style?.paste(t,r,i),words:e.words?.styleClipboard}):[];return s({title:u,words:e.words?.menu,layer:{group:"pick",items:k.flatMap((n,t)=>{const o={label:e.rowNameOf(n.node,n.zone),checked:0===t,onClick:()=>e.selectAt(n.zone,n.index,n.node.props.id,n.parentType)},r=n.zone===l?null:e.slotRung?.(n.zone)??null;return r?[o,{label:r.label,checked:!1,onClick:r.select}]:[o]})},actions:{duplicate:v&&m&&h.duplicate?()=>d.duplicate(c):void 0,...L(v&&!p,e=>d.canStep(c,e),e=>d.step(c,e)),copy:y.copy?()=>d.copy(c,u):void 0,cut:v&&y.cut?()=>d.cut(c,u):void 0,paste:v&&b&&g?{label:b.label,run:()=>d.paste(g)}:void 0,rename:v&&e.renamePropOf(i,t)?()=>e.beginRename(t,r):void 0,hide:!v||f||p?void 0:{hidden:a,run:()=>d.setProps(c,{_hidden:!a})},delete:v&&m&&h.delete?()=>d.remove(c):void 0},style:w,extras:e.menuRows?.(i,t,r)??void 0,pinnedLine:p?R(e).pinned:void 0})}function L(e,n,t){return e?{moveUp:n(-1)?()=>t(-1):null,moveDown:n(1)?()=>t(1):null}:{}}var R=e=>e.words?.screen??t.menu;function X(e){const n=R(e),o=!e.readOnly,r=[];o&&e.history.hasPast&&r.push({label:n.undo,icon:/* @__PURE__ */D(w,{}),shortcut:"⌘Z",onClick:e.history.back}),o&&e.history.hasFuture&&r.push({label:n.redo,icon:/* @__PURE__ */D(x,{}),shortcut:"⇧⌘Z",onClick:e.history.forward});const i=[],c=e.nodeOps.held,s=M(e,l,e.sectionBand().cap);if(o&&c&&(e.canPasteAt?e.canPasteAt(c,s):f(c.from)===l)){const n=s,t=e.words?.menu??u;i.push({label:t.pasteNamed({paste:t.paste,label:c.label}),icon:/* @__PURE__ */D(C,{}),shortcut:"⌘V",onClick:()=>e.nodeOps.paste(n)})}const a=[r,i,[{label:e.pageSettingsLabel??t.pageSettings,icon:/* @__PURE__ */D(z,{}),onClick:e.openPageSettings},{label:n.collapseAll,icon:/* @__PURE__ */D(O,{}),onClick:e.collapseAll}]].filter(e=>e.length>0),d={label:"—",onClick:()=>{}};return a.flatMap((e,n)=>n?[d,...e]:e)}function N(e,n){const t=n.selectionStart??0,o=n.selectionEnd??0,l=n.value.slice(t,o),r=e=>{n.focus(),n.setRangeText(e,t,o,"end"),n.dispatchEvent(new Event("input",{bubbles:!0}))},i=e.words?.menu??u,c=R(e),s=[];l&&(s.push({label:i.copy,icon:/* @__PURE__ */D(P,{}),shortcut:"⌘C",onClick:()=>navigator.clipboard?.writeText(l)}),s.push({label:i.cut,icon:/* @__PURE__ */D(P,{}),shortcut:"⌘X",onClick:()=>{navigator.clipboard?.writeText(l),r("")}})),s.push({label:i.paste,icon:/* @__PURE__ */D(C,{}),shortcut:"⌘V",onClick:()=>{navigator.clipboard?.readText().then(e=>{e&&r(e)}).catch(()=>e.onPasteRefused())}});const a=[s,n.value?[{label:c.selectAll,shortcut:"⌘A",onClick:()=>{n.focus(),n.select()}}]:[]].filter(e=>e.length>0),d={label:"—",onClick:()=>{}};return a.flatMap((e,n)=>n?[d,...e]:e)}function U(e){return e.shiftKey}function F(e,t){const[o,l]=y(null),r=k(()=>l(null),[]);n(null!==o,r);const i=b(e);i.current=e;const c=k(e=>{const n=i.current,t=n.keys;if(!t)return;const o=V(e);if(!o)return;const l=t.selected();if(!l)return;const r=B(n,o,l,{readOnly:t.readOnly,held:t.held()});r&&(e.preventDefault(),t.onDone?.(r))},[]),s=e.keys?.target??null;g(()=>{if(!s)return;const e=e=>c(e);return s.addEventListener("keydown",e),()=>s.removeEventListener("keydown",e)},[s,c]),d(t,"keydown",c);const u=k(n=>{if(U(n))return;const t=n.target;if(t?.closest?.("[data-slot-zone]"))return n.preventDefault(),void l(null);const o=function(e){const n=e?.closest?.("input, textarea");return n&&("INPUT"!==n.tagName||["text","search","url","email","tel","number",""].includes(n.type))?n:null}(t);if(o)return n.preventDefault(),void l({kind:"input",x:n.clientX,y:n.clientY,el:o,owner:t});const r=t?.closest?.("[data-node-id]")?.getAttribute("data-node-id"),i=r?e.locate(r):null;n.preventDefault(),l(i?{kind:"node",x:n.clientX,y:n.clientY,...i,owner:t}:{kind:"empty",x:n.clientX,y:n.clientY,owner:t})},[e]);d(t,"contextmenu",n=>{if(U(n)||!t)return;const o=n.target?.closest?.("[data-puck-component]")??null,r=o?.getAttribute("data-puck-component"),i=r?e.locate(r):null;n.preventDefault();const c=p(t.frame,n.clientX,n.clientY),s=t.frame;l(i?{kind:"node",...c,...i,owner:s}:{kind:"empty",...c,owner:s})}),d(t,"mousedown",r),d(t,"scroll",r,{on:"window"});return{onEditorContextMenu:u,menu:o?/* @__PURE__ */D(W,{host:e,target:o,onClose:r}):null,closeMenu:r}}function W({host:e,target:n,onClose:t}){const o="node"===n.kind?E(e,n):"input"===n.kind?N(e,n.el):X(e);return 0===o.length?null:/* @__PURE__ */D(v,{at:{x:n.x,y:n.y},owner:n.owner??null,onClose:t,"aria-label":i(o),items:r(o)})}export{K as EASEL_NODE_CLIPBOARD,A as ancestorChain,S as nodeClipboardOf,Y as nodeClipboardRules,E as nodeMenuItems,V as nodeShortcut,X as pageMenuItems,I as pastePlace,B as runNodeShortcut,N as textMenuItems,T as useNodeClipboard,F as useNodeContextMenu};
|
package/dist/chunk-U3JP4VGF.js
DELETED
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
import{createContext as e,useContext as r,useRef as c,useEffect as n}from"react";import{jsx as s}from"react/jsx-runtime";var t={connected:!1,ownsDocument:!0,send:()=>{},subscribe:()=>()=>{},address:{search:()=>"",show:()=>{},load:()=>{},reload:()=>{}}},o=e(t);function a({host:e,children:r}){/* @__PURE__ */
|
|
2
|
-
return s(o.Provider,{value:e,children:r})}function d(){return r(o)}function i(e,r){const s=d(),t=c(r);t.current=r,n(()=>{if(e&&s.claimEscape)return s.claimEscape(e=>"Escape"===e.key&&(t.current(),!0))},[e,s])}function u(e){const r=/* @__PURE__ */new Set;return{host:{connected:!0,ownsDocument:!1,send:(r,c)=>{e.onMessage({type:r,...c})},subscribe:e=>(r.add(e),()=>{r.delete(e)}),address:e.address,...e.claimEscape?{claimEscape:e.claimEscape}:null},deliver:e=>{for(const c of[...r])c(e)}}}export{t as DETACHED_EASEL_HOST,o as EaselHostContext,a as EaselHostProvider,u as createEaselHost,d as useEaselHost,i as useHostEscape};
|