efficient-easel 14.2.0 → 16.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +5 -4
- package/dist/{CanvasDragLayer-CLb7j-CZ.d.ts → CanvasDragLayer-dZCPbQCP.d.ts} +1 -1
- package/dist/canvas/index.d.ts +21 -1
- package/dist/canvas/index.js +1 -1
- package/dist/{chunk-NY7HHUGB.js → chunk-23VM4PMV.js} +2 -2
- package/dist/{chunk-44QA42OJ.js → chunk-63ZDVAVE.js} +1 -1
- package/dist/chunk-BALFHI3G.js +2 -0
- package/dist/{chunk-CMXK3JT3.js → chunk-GGC72GS4.js} +1 -1
- package/dist/{chunk-CY52PUMZ.js → chunk-HM7S7H5H.js} +1 -1
- package/dist/{chunk-XGW6NWLC.js → chunk-JD5HXBEX.js} +1 -1
- package/dist/{chunk-AYWN5NRH.js → chunk-KAML3KQH.js} +1 -1
- package/dist/{chunk-YKJ3RIMT.js → chunk-KFPCMMRK.js} +1 -1
- package/dist/chunk-N2B32EZB.js +5 -0
- package/dist/{chunk-TR4APEJZ.js → chunk-N2BVA6TS.js} +1 -1
- package/dist/chunk-N3LYD2LK.js +21 -0
- package/dist/chunk-OFBZOI6W.js +1 -0
- package/dist/{chunk-F3A7SXSV.js → chunk-OK7OH2ZN.js} +1 -1
- package/dist/{chunk-35VMTYPH.js → chunk-P3XVBLZ6.js} +4 -4
- package/dist/chunk-POSLNRTO.js +18 -0
- package/dist/chunk-PQRYAW2G.js +5 -0
- package/dist/chunk-RQBIFINA.js +57 -0
- package/dist/chunk-SMM3ST7A.js +13 -0
- package/dist/chunk-U6LJ5UKD.js +6 -0
- package/dist/chunk-UVQR7W6I.js +1 -0
- package/dist/chunk-WXFZD7WC.js +1 -0
- package/dist/chunk-X4T6JT3M.js +1 -0
- package/dist/copy/copy.css +9 -9
- package/dist/copy/index.d.ts +2 -29
- package/dist/copy/index.js +12 -13
- package/dist/drag/drag.css +22 -0
- package/dist/drag/index.d.ts +2 -2
- package/dist/drag/index.js +1 -1
- package/dist/easel/easel.css +26 -0
- package/dist/easel/index.js +1 -1
- package/dist/fields/index.js +1 -1
- package/dist/menu/index.d.ts +22 -27
- package/dist/menu/index.js +1 -1
- package/dist/menu/menu.css +7 -6
- package/dist/pick/index.d.ts +5 -70
- package/dist/pick/index.js +1 -3
- package/dist/pick/pick.css +1 -21
- package/dist/screen/components/AddBlockRow.js +1 -1
- package/dist/screen/components/AddSidePanel.js +1 -1
- package/dist/screen/components/MediaSidePanel.js +1 -1
- package/dist/screen/components/NodeContextMenu.d.ts +3 -3
- package/dist/screen/components/NodeContextMenu.js +1 -1
- package/dist/screen/components/SaveControls.d.ts +2 -2
- package/dist/screen/components/ScreenChrome.js +1 -1
- package/dist/screen/components/ScreenMount.d.ts +2 -2
- package/dist/screen/components/ScreenMount.js +1 -1
- package/dist/screen/components/ScreenStoreProvider.d.ts +2 -2
- package/dist/screen/components/ScreenStoreProvider.js +1 -1
- package/dist/screen/components/SectionScreenShell.js +15 -15
- package/dist/screen/components/usePartBridge.d.ts +2 -2
- package/dist/screen/components/usePartBridge.js +1 -1
- package/dist/screen/index.d.ts +2 -2
- package/dist/screen/index.js +1 -1
- package/dist/screen/lib/key-scope.js +1 -1
- package/dist/screen/lib/puck/style-clipboard.d.ts +2 -2
- package/dist/screen/lib/puck/use-section-ops.js +1 -1
- package/dist/screen/lib/screen-parts.d.ts +2 -2
- package/dist/screen/lib/screen-parts.js +1 -1
- package/dist/strings/catalogue.d.ts +2 -2
- package/dist/strings/catalogue.js +1 -1
- package/dist/strings/index.d.ts +2 -2
- package/dist/strings/index.js +1 -1
- package/dist/text-styles/index.js +36 -36
- package/dist/{words-BDignMl_.d.ts → words-CvwYvkJm.d.ts} +2 -0
- package/dist/{words-is_Vy6hn.d.ts → words-DWvCJXwR.d.ts} +2 -37
- package/package.json +3 -3
- package/dist/chunk-5XUMLKQF.js +0 -6
- package/dist/chunk-643PVCEG.js +0 -1
- package/dist/chunk-BXMXTO36.js +0 -1
- package/dist/chunk-CSGTPJTY.js +0 -5
- package/dist/chunk-D46OYLJR.js +0 -5
- package/dist/chunk-EA2HTX37.js +0 -5
- package/dist/chunk-ILXP5VX5.js +0 -1
- package/dist/chunk-LPM2SCM4.js +0 -13
- package/dist/chunk-NW4LJ4G4.js +0 -1
- package/dist/chunk-QFVRMARS.js +0 -18
- package/dist/chunk-SO5OLDH7.js +0 -21
- package/dist/chunk-XUAKHY4T.js +0 -57
|
@@ -12,9 +12,9 @@ import '../../types-CsgMwHHa.js';
|
|
|
12
12
|
import '../../wordFit-7XpmhcaW.js';
|
|
13
13
|
import '../../edit-lock/index.js';
|
|
14
14
|
import '../../panelWidths-D9hTLR25.js';
|
|
15
|
-
import '../../CanvasDragLayer-
|
|
15
|
+
import '../../CanvasDragLayer-dZCPbQCP.js';
|
|
16
16
|
import '../../session-DSQFmIvx.js';
|
|
17
|
-
import '../../words-
|
|
17
|
+
import '../../words-CvwYvkJm.js';
|
|
18
18
|
import '../../types-BsyPh6EW.js';
|
|
19
19
|
import '../../style-clipboard/index.js';
|
|
20
20
|
import '../../words-CnnHb9jo.js';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export{usePartBridge}from"../../chunk-
|
|
1
|
+
export{usePartBridge}from"../../chunk-GGC72GS4.js";import"../../chunk-N2BVA6TS.js";import"../../chunk-PQRYAW2G.js";import"../../chunk-R6WTQWAC.js";import"../../chunk-U3JP4VGF.js";import"../../chunk-I54UCYOU.js";import"../../chunk-GOTN2KY4.js";import"../../chunk-R5L2E7JX.js";import"../../chunk-IYT6NN2J.js";import"../../chunk-PLVEGYK6.js";import"../../chunk-SMM3ST7A.js";import"../../chunk-TBY3DFKS.js";import"../../chunk-ECM5F6JJ.js";import"../../chunk-N3LYD2LK.js";import"../../chunk-BPXEFVSQ.js";import"../../chunk-XWFH2NHZ.js";import"../../chunk-4JSBIW5H.js";import"../../chunk-K56YDHYQ.js";import"../../chunk-BALFHI3G.js";import"../../chunk-RC25EGHD.js";import"../../chunk-KFV7N2DJ.js";import"../../chunk-YRLPFZW3.js";import"../../chunk-23VM4PMV.js";import"../../chunk-B4JN227A.js";import"../../chunk-2XMHLXMA.js";import"../../chunk-G3GWAP5R.js";import"../../chunk-WRFD4EXD.js";import"../../chunk-36LVP5WD.js";import"../../chunk-MFIRYGHW.js";import"../../chunk-67GNT6PF.js";import"../../chunk-P2VEMZH5.js";import"../../chunk-X4T6JT3M.js";import"../../chunk-KRXQM65X.js";import"../../chunk-NKB3KVAB.js";
|
package/dist/screen/index.d.ts
CHANGED
|
@@ -18,9 +18,9 @@ import '../types-CsgMwHHa.js';
|
|
|
18
18
|
import '../wordFit-7XpmhcaW.js';
|
|
19
19
|
import '../edit-lock/index.js';
|
|
20
20
|
import '../panelWidths-D9hTLR25.js';
|
|
21
|
-
import '../CanvasDragLayer-
|
|
21
|
+
import '../CanvasDragLayer-dZCPbQCP.js';
|
|
22
22
|
import '../session-DSQFmIvx.js';
|
|
23
|
-
import '../words-
|
|
23
|
+
import '../words-CvwYvkJm.js';
|
|
24
24
|
import '../types-BsyPh6EW.js';
|
|
25
25
|
import '../style-clipboard/index.js';
|
|
26
26
|
import '../words-CnnHb9jo.js';
|
package/dist/screen/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import"../chunk-GZO72N3Q.js";export{DocumentScreen,ScreenMount}from"../chunk-
|
|
1
|
+
import"../chunk-GZO72N3Q.js";export{DocumentScreen,ScreenMount}from"../chunk-P3XVBLZ6.js";import"../chunk-GXQCZJOP.js";import"../chunk-RQBIFINA.js";import"../chunk-XT6DOSHO.js";import"../chunk-FGNR22NY.js";import"../chunk-2GVCAIPX.js";import"../chunk-26OOWIJJ.js";import"../chunk-NBDMTIU2.js";import"../chunk-MQNBD6AB.js";import"../chunk-LER7RKTO.js";import"../chunk-7F52SZOI.js";import"../chunk-RSKHAHPJ.js";import"../chunk-RKTF5XLP.js";export{ScreenStoreProvider}from"../chunk-KFPCMMRK.js";import"../chunk-3Z2MVLCD.js";import"../chunk-HM7S7H5H.js";import"../chunk-KCBEE2MC.js";import"../chunk-TZIIRGVY.js";import"../chunk-GGC72GS4.js";import"../chunk-N2BVA6TS.js";import"../chunk-5545A3PC.js";import"../chunk-N2B32EZB.js";import"../chunk-PA3PNTVV.js";import"../chunk-BVN33R76.js";import"../chunk-5ZBY24K7.js";import"../chunk-62VPYC7F.js";import"../chunk-HQ4VVRIC.js";import"../chunk-63ZDVAVE.js";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-PQRYAW2G.js";import"../chunk-UVQR7W6I.js";import"../chunk-2H3W5OLQ.js";import"../chunk-ZZ64CEC2.js";import"../chunk-ERR437B5.js";import"../chunk-GMCZXMOV.js";export{NO_DOCUMENT_ADDRESSING}from"../chunk-RLBXE4EU.js";import"../chunk-HNKB2ZYR.js";import"../chunk-CLOS6SSX.js";import"../chunk-S4AWJX4Q.js";import"../chunk-KG7RJWOK.js";import"../chunk-VPFNZ7TB.js";import"../chunk-LOMEH6DG.js";import"../chunk-KCOBHPN6.js";import"../chunk-R6WTQWAC.js";export{EaselSessionProvider,useEaselSession}from"../chunk-O7Q4DDJT.js";export{EFFICIENT_BACKEND,activateEaselSession,backendOf,createEaselSession,currentEaselSession,deactivateEaselSession,efficientClientOpen,isEfficientBackend,provideDefaultBackend,resetAmbientEaselSession,sessionRegistry,setSessionBridgedSite,setSessionDocumentSite}from"../chunk-RSCMJIWS.js";export{DETACHED_EASEL_HOST,EaselHostContext,EaselHostProvider,createEaselHost,useEaselHost,useHostEscape}from"../chunk-U3JP4VGF.js";import"../chunk-UMDQ6CLQ.js";import"../chunk-VVPZMWJE.js";import"../chunk-V7U33NF2.js";import"../chunk-6WY6ZXJG.js";import"../chunk-WXFZD7WC.js";import"../chunk-OSPUG6S6.js";import"../chunk-WK3AFPXY.js";import"../chunk-I54UCYOU.js";import"../chunk-GOTN2KY4.js";import"../chunk-R5L2E7JX.js";import"../chunk-BSPCSC45.js";import"../chunk-IQ5TA7AM.js";import"../chunk-TBF5CVPA.js";import"../chunk-DUVRZ456.js";import"../chunk-6W7WLPZH.js";import"../chunk-IYT6NN2J.js";import"../chunk-PLVEGYK6.js";import"../chunk-SMM3ST7A.js";import"../chunk-TBY3DFKS.js";import"../chunk-ECM5F6JJ.js";import"../chunk-N3LYD2LK.js";import"../chunk-BPXEFVSQ.js";import"../chunk-XWFH2NHZ.js";import"../chunk-4JSBIW5H.js";import"../chunk-K56YDHYQ.js";import"../chunk-BALFHI3G.js";import"../chunk-RC25EGHD.js";import"../chunk-KFV7N2DJ.js";import"../chunk-YRLPFZW3.js";import"../chunk-4VJATVVR.js";import"../chunk-NDRZP6YR.js";import"../chunk-H6DDIBQ4.js";import"../chunk-IE55HNMA.js";import"../chunk-Z6PVRXVY.js";import"../chunk-THWO5YVZ.js";import"../chunk-RE4LP46F.js";import"../chunk-MJM6SFD3.js";import"../chunk-2OAZYSWJ.js";import"../chunk-23VM4PMV.js";import"../chunk-B4JN227A.js";import"../chunk-2XMHLXMA.js";import"../chunk-G3GWAP5R.js";import"../chunk-WRFD4EXD.js";import"../chunk-36LVP5WD.js";import"../chunk-MFIRYGHW.js";import"../chunk-POSLNRTO.js";import"../chunk-KAML3KQH.js";import"../chunk-67GNT6PF.js";import"../chunk-P2VEMZH5.js";import"../chunk-X4T6JT3M.js";import"../chunk-KRXQM65X.js";import"../chunk-NKB3KVAB.js";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export{editorRootFocus,isSaveShortcut,useEaselKeyTarget,useEaselSaveKey,useEaselUndoKeys}from"../../chunk-
|
|
1
|
+
export{editorRootFocus,isSaveShortcut,useEaselKeyTarget,useEaselSaveKey,useEaselUndoKeys}from"../../chunk-HM7S7H5H.js";import"../../chunk-U3JP4VGF.js";import"../../chunk-SMM3ST7A.js";import"../../chunk-TBY3DFKS.js";import"../../chunk-ECM5F6JJ.js";import"../../chunk-YRLPFZW3.js";import"../../chunk-23VM4PMV.js";import"../../chunk-B4JN227A.js";import"../../chunk-MFIRYGHW.js";import"../../chunk-X4T6JT3M.js";import"../../chunk-KRXQM65X.js";import"../../chunk-NKB3KVAB.js";
|
|
@@ -16,9 +16,9 @@ import '../../../types-CsgMwHHa.js';
|
|
|
16
16
|
import '../../../wordFit-7XpmhcaW.js';
|
|
17
17
|
import '../../../edit-lock/index.js';
|
|
18
18
|
import '../../../panelWidths-D9hTLR25.js';
|
|
19
|
-
import '../../../CanvasDragLayer-
|
|
19
|
+
import '../../../CanvasDragLayer-dZCPbQCP.js';
|
|
20
20
|
import '../../../session-DSQFmIvx.js';
|
|
21
|
-
import '../../../words-
|
|
21
|
+
import '../../../words-CvwYvkJm.js';
|
|
22
22
|
import '../../../types-D8P9q-BG.js';
|
|
23
23
|
import 'efficient-shell/ui';
|
|
24
24
|
import '../../../words-Cl9xMUYY.js';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export{useSectionOps}from"../../../chunk-
|
|
1
|
+
export{useSectionOps}from"../../../chunk-N2BVA6TS.js";import"../../../chunk-PQRYAW2G.js";import"../../../chunk-R6WTQWAC.js";import"../../../chunk-U3JP4VGF.js";import"../../../chunk-PLVEGYK6.js";import"../../../chunk-SMM3ST7A.js";import"../../../chunk-TBY3DFKS.js";import"../../../chunk-ECM5F6JJ.js";import"../../../chunk-N3LYD2LK.js";import"../../../chunk-BPXEFVSQ.js";import"../../../chunk-XWFH2NHZ.js";import"../../../chunk-4JSBIW5H.js";import"../../../chunk-K56YDHYQ.js";import"../../../chunk-BALFHI3G.js";import"../../../chunk-RC25EGHD.js";import"../../../chunk-KFV7N2DJ.js";import"../../../chunk-YRLPFZW3.js";import"../../../chunk-23VM4PMV.js";import"../../../chunk-B4JN227A.js";import"../../../chunk-2XMHLXMA.js";import"../../../chunk-G3GWAP5R.js";import"../../../chunk-WRFD4EXD.js";import"../../../chunk-36LVP5WD.js";import"../../../chunk-MFIRYGHW.js";import"../../../chunk-67GNT6PF.js";import"../../../chunk-P2VEMZH5.js";import"../../../chunk-X4T6JT3M.js";import"../../../chunk-KRXQM65X.js";import"../../../chunk-NKB3KVAB.js";
|
|
@@ -4,7 +4,7 @@ import { Data } from '../../blocks/index.js';
|
|
|
4
4
|
import { C as CanvasTarget } from '../../watch-BTYOJpQU.js';
|
|
5
5
|
import { D as DeviceOption } from '../../types-DGyDHiJV.js';
|
|
6
6
|
import { P as Place } from '../../types-41704JE4.js';
|
|
7
|
-
import { M as MeasuredCanvas, C as CanvasDragModel } from '../../CanvasDragLayer-
|
|
7
|
+
import { M as MeasuredCanvas, C as CanvasDragModel } from '../../CanvasDragLayer-dZCPbQCP.js';
|
|
8
8
|
import { E as EaselContextMenuItem } from '../../types-BsyPh6EW.js';
|
|
9
9
|
import { a as EaselRailItem } from '../../types-CsgMwHHa.js';
|
|
10
10
|
import { StyleRow } from '../../style-clipboard/index.js';
|
|
@@ -22,7 +22,7 @@ import '../../plan-CGREINRO.js';
|
|
|
22
22
|
import '../../edit-lock/index.js';
|
|
23
23
|
import '../../panelWidths-D9hTLR25.js';
|
|
24
24
|
import '../../session-DSQFmIvx.js';
|
|
25
|
-
import '../../words-
|
|
25
|
+
import '../../words-CvwYvkJm.js';
|
|
26
26
|
import '../../wordFit-7XpmhcaW.js';
|
|
27
27
|
import '../../words-CnnHb9jo.js';
|
|
28
28
|
import 'efficient-shell/ui';
|
|
@@ -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-PQRYAW2G.js";import"../../chunk-R6WTQWAC.js";import"../../chunk-U3JP4VGF.js";import"../../chunk-PLVEGYK6.js";import"../../chunk-SMM3ST7A.js";import"../../chunk-TBY3DFKS.js";import"../../chunk-ECM5F6JJ.js";import"../../chunk-N3LYD2LK.js";import"../../chunk-BPXEFVSQ.js";import"../../chunk-XWFH2NHZ.js";import"../../chunk-4JSBIW5H.js";import"../../chunk-K56YDHYQ.js";import"../../chunk-BALFHI3G.js";import"../../chunk-RC25EGHD.js";import"../../chunk-KFV7N2DJ.js";import"../../chunk-YRLPFZW3.js";import"../../chunk-23VM4PMV.js";import"../../chunk-B4JN227A.js";import"../../chunk-2XMHLXMA.js";import"../../chunk-G3GWAP5R.js";import"../../chunk-WRFD4EXD.js";import"../../chunk-36LVP5WD.js";import"../../chunk-MFIRYGHW.js";import"../../chunk-67GNT6PF.js";import"../../chunk-P2VEMZH5.js";import"../../chunk-X4T6JT3M.js";import"../../chunk-KRXQM65X.js";import"../../chunk-NKB3KVAB.js";
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import { S as SaveWords } from '../words-pgIK0I6g.js';
|
|
2
2
|
import { N as NoticeWords, C as ChromeWords } from '../words-BpiVrsW5.js';
|
|
3
3
|
import { C as CopyWords } from '../words-D-yhjdOg.js';
|
|
4
|
-
import { D as DragWords } from '../words-
|
|
4
|
+
import { D as DragWords } from '../words-CvwYvkJm.js';
|
|
5
5
|
import { LockWords } from '../edit-lock/index.js';
|
|
6
6
|
import { F as FieldsWords } from '../words-vhnV8sM7.js';
|
|
7
7
|
import { N as NodeMenuWords } from '../words-DMG4dYq2.js';
|
|
8
8
|
import { P as PanelWords } from '../words-zH1H0WFw.js';
|
|
9
|
-
import { P as PickWords } from '../words-
|
|
9
|
+
import { P as PickWords } from '../words-DWvCJXwR.js';
|
|
10
10
|
import { ScreenWords } from '../screen/words.js';
|
|
11
11
|
export { ScreenAddWords } from '../screen/words.js';
|
|
12
12
|
import { S as StyleClipboardWords } from '../words-CnnHb9jo.js';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export{DEFAULT_EASEL_STRINGS,mergeEaselStrings}from"../chunk-
|
|
1
|
+
export{DEFAULT_EASEL_STRINGS,mergeEaselStrings}from"../chunk-JD5HXBEX.js";import"../chunk-OGH6CC3E.js";import"../chunk-OFBZOI6W.js";import"../chunk-VVPZMWJE.js";import"../chunk-6WY6ZXJG.js";import"../chunk-WK3AFPXY.js";import"../chunk-TBY3DFKS.js";import"../chunk-K56YDHYQ.js";import"../chunk-KFV7N2DJ.js";import"../chunk-H6DDIBQ4.js";import"../chunk-Z6PVRXVY.js";import"../chunk-RE4LP46F.js";import"../chunk-2OAZYSWJ.js";import"../chunk-B4JN227A.js";import"../chunk-WRFD4EXD.js";import"../chunk-KAML3KQH.js";
|
package/dist/strings/index.d.ts
CHANGED
|
@@ -4,12 +4,12 @@ import * as react from 'react';
|
|
|
4
4
|
import { ReactNode } from 'react';
|
|
5
5
|
export { C as ChromeWords, N as NoticeWords } from '../words-BpiVrsW5.js';
|
|
6
6
|
export { C as CopyWords } from '../words-D-yhjdOg.js';
|
|
7
|
-
export { D as DragWords } from '../words-
|
|
7
|
+
export { D as DragWords } from '../words-CvwYvkJm.js';
|
|
8
8
|
export { F as FieldsWords } from '../words-vhnV8sM7.js';
|
|
9
9
|
export { LockWords } from '../edit-lock/index.js';
|
|
10
10
|
export { N as NodeMenuWords } from '../words-DMG4dYq2.js';
|
|
11
11
|
export { P as PanelWords } from '../words-zH1H0WFw.js';
|
|
12
|
-
export { P as PickWords } from '../words-
|
|
12
|
+
export { P as PickWords } from '../words-DWvCJXwR.js';
|
|
13
13
|
export { S as SaveWords } from '../words-pgIK0I6g.js';
|
|
14
14
|
export { ScreenAddWords, ScreenWords } from '../screen/words.js';
|
|
15
15
|
export { S as StyleClipboardWords } from '../words-CnnHb9jo.js';
|
package/dist/strings/index.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{DEFAULT_EASEL_STRINGS as r,mergeEaselStrings as n}from"../chunk-
|
|
1
|
+
import{DEFAULT_EASEL_STRINGS as r,mergeEaselStrings as n}from"../chunk-JD5HXBEX.js";export{DEFAULT_EASEL_STRINGS,mergeEaselStrings}from"../chunk-JD5HXBEX.js";import"../chunk-OGH6CC3E.js";import"../chunk-OFBZOI6W.js";import"../chunk-VVPZMWJE.js";import"../chunk-6WY6ZXJG.js";import"../chunk-WK3AFPXY.js";import"../chunk-TBY3DFKS.js";import"../chunk-K56YDHYQ.js";import"../chunk-KFV7N2DJ.js";import"../chunk-H6DDIBQ4.js";import"../chunk-Z6PVRXVY.js";import"../chunk-RE4LP46F.js";import"../chunk-2OAZYSWJ.js";import"../chunk-B4JN227A.js";import"../chunk-WRFD4EXD.js";import{stringsContext as o}from"../chunk-MFIRYGHW.js";import"../chunk-KAML3KQH.js";import{useContext as t,useMemo as c}from"react";import{jsx as i}from"react/jsx-runtime";function s({value:s,locale:u,children:m}){const e=o(),p=t(e),h=p?.strings??r,j=u??p?.locale??"en",k=c(()=>({strings:n(h,s),locale:j}),[h,s,j]);/* @__PURE__ */
|
|
2
2
|
return i(e.Provider,{value:k,children:m})}function u(){return t(o())?.strings??r}function m(){return t(o())?.locale??"en"}export{s as EaselStringsProvider,m as useEaselLocale,u as useEaselStrings};
|
|
@@ -1,36 +1,36 @@
|
|
|
1
|
-
import{DEFAULT_TEXT_STYLES_WORDS as e}from"../chunk-OGH6CC3E.js";export{DEFAULT_TEXT_STYLES_WORDS}from"../chunk-OGH6CC3E.js";import{hexReadout as s,ColourWindow as t,typedHex as a}from"../chunk-
|
|
2
|
-
/* @__PURE__ */
|
|
3
|
-
/* @__PURE__ */
|
|
4
|
-
/* @__PURE__ */
|
|
5
|
-
/* @__PURE__ */
|
|
6
|
-
/* @__PURE__ */
|
|
7
|
-
return
|
|
8
|
-
return
|
|
9
|
-
return
|
|
10
|
-
/* @__PURE__ */
|
|
11
|
-
/* @__PURE__ */
|
|
12
|
-
return
|
|
13
|
-
/* @__PURE__ */
|
|
14
|
-
return
|
|
15
|
-
/* @__PURE__ */
|
|
16
|
-
/* @__PURE__ */
|
|
17
|
-
/* @__PURE__ */
|
|
18
|
-
/* @__PURE__ */
|
|
19
|
-
/* @__PURE__ */
|
|
20
|
-
return
|
|
21
|
-
return
|
|
22
|
-
/* @__PURE__ */
|
|
23
|
-
return
|
|
24
|
-
return
|
|
25
|
-
return
|
|
26
|
-
/* @__PURE__ */
|
|
27
|
-
/* @__PURE__ */
|
|
28
|
-
return
|
|
29
|
-
return
|
|
30
|
-
return
|
|
31
|
-
/* @__PURE__ */
|
|
32
|
-
/* @__PURE__ */
|
|
33
|
-
return
|
|
34
|
-
return
|
|
35
|
-
/* @__PURE__ */
|
|
36
|
-
/* @__PURE__ */
|
|
1
|
+
import{DEFAULT_TEXT_STYLES_WORDS as e}from"../chunk-OGH6CC3E.js";export{DEFAULT_TEXT_STYLES_WORDS}from"../chunk-OGH6CC3E.js";import{hexReadout as s,ColourWindow as t,typedHex as a}from"../chunk-U6LJ5UKD.js";import"../chunk-OFBZOI6W.js";import{FieldSlider as n}from"../chunk-XWFH2NHZ.js";import{TEXT_STYLE_KINDS as l,canAddTextStyle as i,TEXT_STYLE_MAX as r,isDefaultTextStyle as o,CAMPAIGN_TEXT_STYLE_SETTINGS as d,TEXT_STYLE_SETTINGS as c,textStyleRowSize as u,describeTextStyle as m,updateTextStyle as h,textStyleCaseCss as f,TEXT_STYLE_CASES as p,addTextStyle as v,removeTextStyle as y,TEXT_STYLE_RANGES as S}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{FieldSelect as g}from"../chunk-G3GWAP5R.js";import"../chunk-WRFD4EXD.js";import{useWords as b}from"../chunk-MFIRYGHW.js";import{withTip as k}from"../chunk-P2VEMZH5.js";import{hsvToHex as N,Tooltip as C,ColorSwatch as x,IconButton as T}from"efficient-shell/ui";import{useState as w,useRef as z,useId as E,useEffect as O,Fragment as _}from"react";import{TrashIcon as L,ChevronIcon as A,BoldIcon as j,ItalicIcon as M,CaseLowerIcon as W,CaseCapitalizedIcon as $,CaseUpperIcon as D,CaseNormalIcon as X}from"efficient-shell/icons/efficient";import{jsxs as Y,jsx as I,Fragment as F}from"react/jsx-runtime";var G=`conic-gradient(${[0,60,120,180,240,300,0].map(e=>N({h:e,s:1,v:1})).join(", ")})`;function H({value:e,hex:a,colours:n,label:l,followsWord:i,anyWord:r,onChange:o,readOnly:d=!1}){const[c,u]=w(!1),m=z(null),h=z(null),f=E(),p=void 0!==e&&n.some(s=>s.key===e),v=void 0!==e&&!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__ */Y("div",{ref:m,className:"es-ts-set","data-ts-setting":"color",children:[
|
|
2
|
+
/* @__PURE__ */Y("div",{className:"es-ts-top",children:[
|
|
3
|
+
/* @__PURE__ */I("span",{className:"es-ts-sub",children:l}),
|
|
4
|
+
/* @__PURE__ */I("span",{className:"es-ts-colour-read",children:a?s(a):i})]}),
|
|
5
|
+
/* @__PURE__ */Y("div",{className:"es-ts-swatches",role:"group","aria-label":l,children:[n.map(t=>/* @__PURE__ */I(C,{content:`${t.name} · ${s(t.value)}`,children:/* @__PURE__ */I(x,{color:t.value,size:"sm",className:"es-ts-swatch","aria-label":t.name,selected:e===t.key,disabled:d,onClick:()=>o(t.key)})},t.key)),
|
|
6
|
+
/* @__PURE__ */I(C,{content:r,children:/* @__PURE__ */I(x,{ref:h,color:G,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__ */I(t,{id:f,value:a??"",onChange:e=>o(e),label:l,readOnly:d,onClose:()=>{u(!1),h.current?.focus()}}):null]})}function P({styles:s,onChange:t,fonts:a,colours:n=[],settings:c=d,auto:u=[],fallback:m,sample:h,openId:f,defaultOpenId:p=null,onOpenChange:S,onAdd:g,rowActions:N,onRemove:C,max:x=r,device:T="desktop",readOnly:_=!1}){const A=b("textStyles",e),j=E(),[M,W]=w(p),$=void 0!==f?f:M,D=e=>{void 0===f&&W(e),S?.(e)},X=z(null),[G,H]=w(null);O(()=>{if(!G||!X.current)return;const e=[...X.current.querySelectorAll(".es-ts-item")].find(e=>e.dataset.tsId===G.id),s=e?e.querySelector(".es-ts-row"):X.current.querySelector(`.es-ts-add[data-ts-kind="${G.kind}"]`);s?.focus(),H(null)},[G]);/* @__PURE__ */
|
|
7
|
+
return I("div",{className:"es-ts",ref:X,children:l.map(e=>{const l=s.filter(s=>s.kind===e),r=!i(s,e,x),d=!_&&!r;/* @__PURE__ */
|
|
8
|
+
return Y(R,{label:A.groups[e],children:[l.map(e=>{const l=N?.(e),i=null!=l&&!1!==l,r=Boolean(C)&&!_&&!o(e);/* @__PURE__ */
|
|
9
|
+
return I(B,{style:e,fonts:a,colours:n,settings:c,auto:u,fallback:m,sample:h,device:T,readOnly:_,open:$===e.id,onOpenChange:s=>D(s?e.id:null),onChange:e=>t(s.map(s=>s.id===e.id?e:s)),actions:r||i?/* @__PURE__ */Y(F,{children:[r?k(A.remove,/* @__PURE__ */I("button",{type:"button",className:"es-ts-del","aria-label":A.removeNamed({name:e.name}),onClick:()=>(e=>{if(_||!C)return;const a=y(s,e.id,{name:A.styleName});if(!a)return;const n=s.filter(s=>s.kind===e.kind),l=n[n.indexOf(e)+1];$===e.id&&D(null),t(a.styles),C(a.removed),H({id:l?.id??null,kind:e.kind})})(e),children:/* @__PURE__ */I(L,{size:14,"aria-hidden":"true"})})):null,i?l:null]}):null},e.id)}),k(!_&&r?A.full({kind:e,max:x}):void 0,/* @__PURE__ */Y("button",{type:"button",className:"es-ts-add","data-ts-kind":e,disabled:_,"aria-disabled":!(_||!r)||void 0,"aria-describedby":!_&&r?`${j}-full-${e}`:void 0,onClick:()=>{d&&(e=>{if(_)return;const a=v(s,e,{max:x,name:A.styleName,make:g});a&&t(a.styles)})(e)},children:[
|
|
10
|
+
/* @__PURE__ */I("span",{className:"es-ts-add-word",children:A.add[e]}),
|
|
11
|
+
/* @__PURE__ */I("span",{className:"es-ts-count",children:A.count({n:l.length,max:x})})]})),_||!r?null:/* @__PURE__ */I("span",{id:`${j}-full-${e}`,className:"es-vh",children:A.full({kind:e,max:x})})]},e)})})}function R({label:e,children:s}){const t=E();/* @__PURE__ */
|
|
12
|
+
return Y("section",{className:"es-ts-section","aria-labelledby":t,children:[
|
|
13
|
+
/* @__PURE__ */I("div",{className:"es-ts-group",id:t,children:e}),s]})}function B({style:s,fonts:t,colours:a=[],settings:n=d,auto:l=[],fallback:i,sample:r,open:o,onOpenChange:f,onChange:p,actions:v,device:y="desktop",readOnly:S=!1}){const g=b("textStyles",e),k=`${E()}-open-${s.id}`,N=new Set(l),C=c.filter(e=>n.includes(e)),x={...i?.(s)??{},...s.values},T="phone"===y,w=T&&void 0!==s.values.sizePhone?{...x,size:s.values.sizePhone}:x,z=t.find(e=>e.value===x.font),O={fontFamily:z?.family,fontSize:`${u(w.size??16)}px`,fontWeight:x.weight,fontStyle:x.italic?"italic":void 0};/* @__PURE__ */
|
|
14
|
+
return Y(_,{children:[
|
|
15
|
+
/* @__PURE__ */Y("div",{className:"es-ts-item","data-ts-id":s.id,children:[
|
|
16
|
+
/* @__PURE__ */Y("button",{type:"button",className:"es-ts-row","aria-expanded":o,"aria-controls":o?k:void 0,onClick:()=>f(!o),children:[
|
|
17
|
+
/* @__PURE__ */I("span",{className:"es-ts-chev","aria-hidden":"true",children:/* @__PURE__ */I(A,{size:12})}),
|
|
18
|
+
/* @__PURE__ */I("span",{className:"es-ts-name",style:O,children:s.name}),
|
|
19
|
+
/* @__PURE__ */I("span",{className:"es-ts-meta",children:m(w,t,g,{autoSize:N.has("size")&&w===x&&void 0===s.values.size})})]}),v?/* @__PURE__ */I("div",{className:"es-ts-actions",children:v}):null]}),o?/* @__PURE__ */I("div",{className:"es-ts-open",id:k,children:/* @__PURE__ */I(Z,{style:s,values:x,fonts:t,colours:a,settings:C,autoSet:N,sample:r??g.sample,words:g,phone:T,readOnly:S,set:e=>p(h([s],s.id,e)[0])})}):null]})}var U={none:X,upper:D,capitalize:$,lower:W};function Z({style:e,values:s,fonts:t,colours:l,settings:i,autoSet:r,sample:o,words:d,phone:c,readOnly:u,set:m}){const h=e.values,p=t.find(e=>e.value===s.font),v=function(e,s){return e?s.find(s=>s.key===e)?.value??a(e)??void 0:void 0}(s.color,l),y=e=>"largestSize"===e||r.has(e),g=e=>y(e)?h[e]:s[e],b=g("size"),N=c&&void 0!==h.sizePhone?h.sizePhone:b,C=g("lineSpacing"),x=g("letterSpacing"),w=y("letterCase")?h.letterCase:s.letterCase,z={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:f(w)},E=e=>{const t=S[e],a=y(e);/* @__PURE__ */
|
|
20
|
+
return I("div",{className:"es-ts-slider","data-ts-setting":e,children:/* @__PURE__ */I(n,{label:d.settings[e],value:h[e],onChange:s=>m({[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?d.auto:void 0,readOnly:u})},e)};/* @__PURE__ */
|
|
21
|
+
return Y(F,{children:[
|
|
22
|
+
/* @__PURE__ */I("div",{className:"es-ts-preview",style:z,"aria-label":d.preview,children:o}),i.map(a=>{switch(a){case"font":/* @__PURE__ */
|
|
23
|
+
return I(q,{value:h.font,fonts:t,words:d,readOnly:u,set:m},a);case"color":/* @__PURE__ */
|
|
24
|
+
return I(K,{value:h.color,hex:v,colours:l,words:d,readOnly:u,set:m},a);case"emphasis":{const e=(s.weight??400)>=600,t=!1!==p?.italic;/* @__PURE__ */
|
|
25
|
+
return Y("div",{className:"es-ts-set","data-ts-setting":a,children:[
|
|
26
|
+
/* @__PURE__ */I("span",{className:"es-ts-sub",children:d.settings.emphasis}),
|
|
27
|
+
/* @__PURE__ */Y("div",{className:"es-ts-icons",children:[k(d.bold,/* @__PURE__ */I(T,{className:"es-ts-icon","aria-label":d.bold,"aria-pressed":e,disabled:u,onClick:()=>m({weight:e?400:700}),children:/* @__PURE__ */I(j,{size:16})})),u||t?k(d.italic,/* @__PURE__ */I(T,{className:"es-ts-icon","aria-label":d.italic,"aria-pressed":Boolean(s.italic),disabled:u,onClick:()=>m({italic:!s.italic||void 0}),children:/* @__PURE__ */I(M,{size:16})})):/* @__PURE__ */I(T,{className:"es-ts-icon","aria-label":d.italic,"aria-pressed":Boolean(s.italic),"aria-disabled":!0,disabledReason:d.italicMissing,children:/* @__PURE__ */I(M,{size:16})})]})]},a)}case"letterCase":/* @__PURE__ */
|
|
28
|
+
return I(V,{value:h.letterCase??s.letterCase,auto:y("letterCase"),words:d,readOnly:u,set:m},a);case"largestSize":return"heading"===e.kind?E(a):null;case"size":return c?(()=>{const e=S.size;/* @__PURE__ */
|
|
29
|
+
return I("div",{className:"es-ts-slider","data-ts-setting":"size","data-ts-device":"phone",children:/* @__PURE__ */I(n,{label:d.settings.size,value:h.sizePhone,onChange:e=>m({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:u})},"size")})():E(a);default:return E(a)}})]})}function q({value:e,fonts:s,words:t,readOnly:a,set:n}){const l=E();/* @__PURE__ */
|
|
30
|
+
return Y("div",{className:"es-ts-set","data-ts-setting":"font",children:[
|
|
31
|
+
/* @__PURE__ */I("span",{className:"es-ts-sub",id:l,children:t.settings.font}),
|
|
32
|
+
/* @__PURE__ */I(g,{value:e,options:s.map(e=>({label:e.label,value:e.value})),onChange:e=>n({font:e}),ariaLabelledBy:l,readOnly:a})]})}function K({value:e,hex:s,colours:t,words:a,readOnly:n,set:l}){/* @__PURE__ */
|
|
33
|
+
return I(H,{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",...p]:p,i=e??(s?"auto":"none"),r=z([]),o=e=>n({letterCase:"auto"===e?void 0:e});/* @__PURE__ */
|
|
34
|
+
return Y("div",{className:"es-ts-set","data-ts-setting":"letterCase",children:[
|
|
35
|
+
/* @__PURE__ */I("span",{className:"es-ts-sub",children:t.settings.letterCase}),
|
|
36
|
+
/* @__PURE__ */I("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;o(l[t]),r.current[t]?.focus()},children:l.map((e,s)=>{const n=e===i;if("auto"===e)return k(t.case.autoTitle,/* @__PURE__ */I(T,{ref:e=>{r.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:()=>o(e),children:t.case.auto},e));const l=U[e];return k(t.case[e],/* @__PURE__ */I(T,{ref:e=>{r.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:()=>o(e),children:/* @__PURE__ */I(l,{size:16})},e))})})]})}export{H as ColourSwatchRow,B as TextStyleItem,R as TextStylesGroup,P as TextStylesList};
|
|
@@ -4,8 +4,8 @@
|
|
|
4
4
|
*
|
|
5
5
|
* A plain module with no import, in the pickers' own folder: they may reach
|
|
6
6
|
* nothing else (`tests/pick-leaf-safety.test.ts`), so they do NOT read the
|
|
7
|
-
* strings provider. `ColourPicker`
|
|
8
|
-
*
|
|
7
|
+
* strings provider. `ColourPicker` takes its group as `words`, and a host
|
|
8
|
+
* passes `useEaselStrings().pick.colour`.
|
|
9
9
|
*/
|
|
10
10
|
type PickWords = {
|
|
11
11
|
colour: {
|
|
@@ -46,41 +46,6 @@ type PickWords = {
|
|
|
46
46
|
label: string;
|
|
47
47
|
}) => string;
|
|
48
48
|
};
|
|
49
|
-
image: {
|
|
50
|
-
/** While the library is open. */
|
|
51
|
-
choosing: string;
|
|
52
|
-
/** The library threw. */
|
|
53
|
-
failed: string;
|
|
54
|
-
/** The empty box, for a picture. */
|
|
55
|
-
chooseImage: string;
|
|
56
|
-
/** The empty box, for a video. */
|
|
57
|
-
chooseVideo: string;
|
|
58
|
-
/** The empty box's accessible name. `placeholder` is the host's own words for the empty box, when it gave any. */
|
|
59
|
-
empty: (v: {
|
|
60
|
-
label: string;
|
|
61
|
-
kind: 'image' | 'video';
|
|
62
|
-
placeholder?: string;
|
|
63
|
-
}) => string;
|
|
64
|
-
/** The line under the empty box's words. */
|
|
65
|
-
hint: string;
|
|
66
|
-
/** The picture's (or the video's) accessible name, once its file has a name. */
|
|
67
|
-
named: (v: {
|
|
68
|
-
label: string;
|
|
69
|
-
name: string;
|
|
70
|
-
}) => string;
|
|
71
|
-
/** The Replace button. */
|
|
72
|
-
replace: string;
|
|
73
|
-
/** The Replace button's accessible name. */
|
|
74
|
-
replaceNamed: (v: {
|
|
75
|
-
label: string;
|
|
76
|
-
}) => string;
|
|
77
|
-
/** The Remove button. */
|
|
78
|
-
remove: string;
|
|
79
|
-
/** The Remove button's accessible name. */
|
|
80
|
-
removeNamed: (v: {
|
|
81
|
-
label: string;
|
|
82
|
-
}) => string;
|
|
83
|
-
};
|
|
84
49
|
};
|
|
85
50
|
|
|
86
51
|
export type { PickWords as P };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "efficient-easel",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "16.0.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",
|
|
@@ -654,7 +654,7 @@
|
|
|
654
654
|
"dist"
|
|
655
655
|
],
|
|
656
656
|
"peerDependencies": {
|
|
657
|
-
"efficient-shell": "^
|
|
657
|
+
"efficient-shell": "^8.18.0",
|
|
658
658
|
"react": ">=18",
|
|
659
659
|
"react-dom": ">=18"
|
|
660
660
|
},
|
|
@@ -664,7 +664,7 @@
|
|
|
664
664
|
"@types/node": "^22.0.0",
|
|
665
665
|
"@types/react": "^18.2.0",
|
|
666
666
|
"@types/react-dom": "^18.2.0",
|
|
667
|
-
"efficient-shell": "^8.
|
|
667
|
+
"efficient-shell": "^8.18.0",
|
|
668
668
|
"esbuild": "^0.27.0",
|
|
669
669
|
"jsdom": "^26.1.0",
|
|
670
670
|
"react": "^18.2.0",
|
package/dist/chunk-5XUMLKQF.js
DELETED
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
import{DEFAULT_PICK_WORDS as e}from"./chunk-643PVCEG.js";import{parseHexColor as t,Popover as n,colorSwatchClasses as r,colorFill as l,ColorPickerPanel as i}from"efficient-shell/ui";export{hexToHsv,hsvToHex}from"efficient-shell/ui";import{useRef as a,useState as s,useLayoutEffect as o,useEffect as c}from"react";import{jsx as u,jsxs as p}from"react/jsx-runtime";var d=t,h=7,m=e=>e.toUpperCase(),g=(e,t,n)=>Math.min(n,Math.max(t,e));function f(e,t,n){return{s:n.width>0?g((e-n.left)/n.width,0,1):0,v:n.height>0?1-g((t-n.top)/n.height,0,1):0}}function v(e,t){return t.width>0?360*g((e-t.left)/t.width,0,1):0}function w(e){if(/^(data|blob):/i.test(e))return"";const t=(e.split(/[?#]/)[0]??"").split("/").filter(Boolean).pop()??"";try{return decodeURIComponent(t)}catch{return t}}function k({value:t,onChange:i,label:h,theme:g,caption:f,inherited:v,after:w,id:k,readOnly:x,words:y=e.colour}){const E=a(null),L=a(null),N=()=>{const e=E.current?.parentElement;return e?.classList.contains("es-field-head")?e.querySelector(":scope > .es-field-name .es-field-label"):e?.classList.contains("es-pick-line")?e.querySelector(":scope > .es-pick-line-label"):null},B=()=>L.current?.querySelector(".es-pick-hexwrap > *")??null,R=e=>e.scrollWidth>e.clientWidth+1,O=e=>{e&&(R(e)?e.dataset.clipped="true":delete e.dataset.clipped)},D=a(()=>{});D.current=()=>{O(N()),S||O(B())};const[T,P]=s(null),[S,M]=s(null);o(()=>D.current()),c(()=>{const e=E.current?.parentElement,t=e?.ownerDocument.defaultView;if(!e||!t?.ResizeObserver)return;const n=new t.ResizeObserver(()=>D.current());return n.observe(e),()=>n.disconnect()},[]),c(()=>{const e=E.current?.parentElement;if(!e)return;const t=e=>{const t=e;if(!t)return null;const n=N(),r=B();return n&&(t===n||n.contains(t))?n:r&&t===r?r:null},n=e=>{const n=t(e.target),r=U();if(!n||!r||n.ownerDocument.activeElement===n||!R(n))return;const l=n.getBoundingClientRect(),i=r.getBoundingClientRect(),a="INPUT"===n.tagName?n.value:n.textContent??"";P({text:a,left:l.left-i.left,top:l.top-i.top})},r=e=>{t(e.target)&&P(null)};return e.addEventListener("pointerover",n),e.addEventListener("pointerout",r),()=>{e.removeEventListener("pointerover",n),e.removeEventListener("pointerout",r)}},[]);const U=()=>{const e=E.current?.parentElement;return e&&(e.classList.contains("es-field-head")||e.classList.contains("es-pick-line"))?e:L.current},W=t?null:d(v??""),q=void 0===f||t&&d(f)===d(t)?null:f,j=q??(t?m(t):W?m(W):y.notSet);/* @__PURE__ */
|
|
2
|
-
return u("div",{ref:E,className:"es-pick-colour",children:/* @__PURE__ */p("div",{ref:L,className:"es-pick-colour-row","data-editing":S??void 0,onFocus:e=>{const t=e.target,n=U();if(!n||!t.classList.contains("es-pick-hex"))return;P(null),t.style.setProperty("--es-pick-edit-room",n.getBoundingClientRect().right-t.getBoundingClientRect().left+"px");const r=t.parentElement?.nextElementSibling,l=!!r&&t.getBoundingClientRect().right>r.getBoundingClientRect().left-2;M(l?"over":"room")},onBlur:e=>{const t=e.target;t.classList.contains("es-pick-hex")&&(t.style.removeProperty("--es-pick-edit-room"),M(null))},children:[
|
|
3
|
-
/* @__PURE__ */u(n,{id:k,className:"es-pick-swatch-wrap",trigger:/* @__PURE__ */u("span",{"aria-hidden":"true",style:{position:"absolute",inset:0,...l(t||W)}}),triggerLabel:y.swatch({label:h,shown:j}),triggerClassName:r({className:t?"es-pick-swatch":W?"es-pick-swatch is-inherited":"es-pick-swatch is-unset"}),"aria-label":y.dialog({label:h}),disabled:x,children:/* @__PURE__ */u(b,{value:t,onChange:i,label:h,theme:g,inherited:v,readOnly:x})}),
|
|
4
|
-
/* @__PURE__ */u("span",{className:"es-pick-hexwrap",children:null===q?/* @__PURE__ */u(C,{value:t,follows:W?m(W):void 0,onChange:e=>{x||e===t||i(e)},name:y.hex({label:h}),readOnly:x}):/* @__PURE__ */u("span",{className:"es-pick-caption",children:q})}),w,T?/* @__PURE__ */u("span",{className:"es-pick-tag","aria-hidden":"true",style:{left:T.left,top:T.top},children:T.text}):null]})})}function b({value:e,onChange:t,label:n,theme:r,onClose:l,id:a,inherited:s,readOnly:o,words:c,swatch:p,dragWrites:d="live"}){/* @__PURE__ */
|
|
5
|
-
return u(i,{id:a,className:"es-pick-window",value:e,onChange:t,label:n,presets:r?.map(e=>({value:e.value,label:e.name})),fallback:s,dragWrites:d,disabled:o,onClose:l})}function C({value:e,follows:t,onChange:n,name:r,readOnly:l}){const[i,o]=s(null),c=a(!1);/* @__PURE__ */
|
|
6
|
-
return u("input",{type:"text",className:!e&&t?"es-pick-hex is-inherited":"es-pick-hex",value:i??(e?m(e):t??""),"aria-label":r,maxLength:7,spellCheck:!1,autoComplete:"off",readOnly:l,onChange:t=>{o(t.target.value);const r=d(t.target.value);null!==r&&r!==e&&n(r)},onFocus:e=>e.currentTarget.select(),onMouseDown:e=>{c.current=e.currentTarget.ownerDocument.activeElement!==e.currentTarget},onMouseUp:e=>{c.current&&e.preventDefault(),c.current=!1},onKeyDown:e=>{"Enter"!==e.key&&"Escape"!==e.key||(e.preventDefault(),e.stopPropagation(),o(null),e.currentTarget.blur())},onBlur:()=>o(null)})}export{k as ColourPicker,b as ColourWindow,h as HEX_MAX_LENGTH,m as hexReadout,v as hueFromPoint,w as mediaName,f as svFromPoint,d as typedHex};
|
package/dist/chunk-643PVCEG.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
var e={colour:{notSet:"Not set",swatch:({label:e,shown:a})=>`${e}: ${a}`,dialog:({label:e})=>`${e} colour`,theme:"Theme colours",themeSwatchTitle:({name:e,hex:a})=>`${e} · ${a}`,themeSwatch:({name:e,hex:a})=>`${e} ${a}`,square:"Saturation and brightness",squareValue:({saturation:e,brightness:a})=>`Saturation ${e}, brightness ${a}`,hue:"Hue",hex:({label:e})=>`${e} hex code`},image:{choosing:"Choosing",failed:"The library could not be opened. Try again.",chooseImage:"Choose an image",chooseVideo:"Choose a video",empty:({label:e,kind:a,placeholder:o})=>`${e}: ${o??"choose "+("video"===a?"a video":"an image")}`,hint:"From the library, or upload one",named:({label:e,name:a})=>`${e}: ${a}`,replace:"Replace",replaceNamed:({label:e})=>`Replace ${e.toLowerCase()}`,remove:"Remove",removeNamed:({label:e})=>`Remove ${e.toLowerCase()}`}};export{e as DEFAULT_PICK_WORDS};
|
package/dist/chunk-BXMXTO36.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{EaselMenuItems as o,menuLabel as e}from"./chunk-EA2HTX37.js";import{ContextMenu as r}from"efficient-shell/ui";import{jsx as n}from"react/jsx-runtime";function l({x:l,y:t,items:i,onClose:m,owner:s,portalTo:u}){return 0===i.length?null:/* @__PURE__ */n(r,{at:{x:l,y:t},owner:s??u??null,onClose:m,"aria-label":e(i),children:/* @__PURE__ */n(o,{items:i,onClose:m})})}export{l as EaselContextMenu};
|
package/dist/chunk-CSGTPJTY.js
DELETED
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
import{usePickFollowsSelection as n}from"./chunk-R6WTQWAC.js";import{slotFieldsOf as e}from"./chunk-PLVEGYK6.js";import{EaselCanvas as t,useSelectedFields as r}from"./chunk-LPM2SCM4.js";import{Inspector as i}from"./chunk-SO5OLDH7.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},O={labelAtLevel:(n,e,t)=>t,descriptions:{},categoryLabel:()=>{},firstSection:null,blockRowName:(n,e)=>e(n.type),plainText:n=>n,Icon:()=>null,Thumbnail:()=>null,useProducts:()=>null},L={options:[{id:"desktop",label:"Desktop",icon:/* @__PURE__ */s(l,{})}],initial:"desktop",fluid:"desktop",widths:{desktop:2e3}},S={read:()=>"sections",write:()=>{},forSelection:(n,e)=>n?"sections":e},j={first:null,last:null,firstGroup:null,lastGroup:null,isSectionGroup:()=>!1,sectionGroupZone:()=>"",panelOf:()=>null};function w(){/* @__PURE__ */
|
|
2
|
-
return s(t,{height:"fill"})}function C(){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 P=o({});function D({parts:n,children:e}){/* @__PURE__ */
|
|
4
|
-
return s(P.Provider,{value:n,children:e})}function G(){return u(P)}function N(){return(G().useOwnerName??v)()}function x(){return(G().useDocumentLabel??g)()}function B(n,e,t,r){return(G().useBridges??h)(n,e,t,r)}function I(n){return(G().useStandaloneBridges??h)(n)}function T(n,e){(G().useDocumentPass??y)(n,e)}function A(){return G().blockRules??b}function F(){return G().blockLook??O}function R(){return G().devices??L}function H(){return G().leftView??S}function K(){return G().pinned??j}function M(){return G().saveSwitch??!0}function V(e){n(!0===G().pickFollowsSelection,e)}function W(){return G().storageNamespace||void 0}function E(){return G().styleClipboard??null}function Q(){return G().nodeKeys??!0}function Y(){return G().notify??null}function Z(){return G().Canvas??w}function q(){return G().CanvasHead??null}function z(){return G().canvasDrag??null}var J=o(null);function U({target:n,children:e}){/* @__PURE__ */
|
|
5
|
-
return s(J.Provider,{value:n,children:e})}function X(){return u(J)}function $(){return G().Inspector??C}export{c as SELECTION_MODE,U as ScreenCanvasTargetProvider,D as ScreenPartsProvider,p as isPinnedFirst,m as isPinnedLast,a as isSlotMode,f as sameInspectorMode,d as screenSlotsOf,F as useScreenBlockLook,A as useScreenBlockRules,B as useScreenBridges,z as useScreenCanvasDrag,Z as useScreenCanvasFrame,q as useScreenCanvasHead,X as useScreenCanvasTarget,R as useScreenDevices,x as useScreenDocumentLabel,T as useScreenDocumentPass,$ as useScreenInspectorPanel,H as useScreenLeftView,Q as useScreenNodeKeys,Y as useScreenNotify,N as useScreenOwnerName,G as useScreenParts,V as useScreenPickFollowsSelection,K as useScreenPinned,M as useScreenSaveSwitch,W as useScreenStorageNamespace,E as useScreenStyleClipboard,I as useStandaloneScreenBridges};
|
package/dist/chunk-D46OYLJR.js
DELETED
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
import{buildPaletteSections as e,pinnedSection as t,categoryLabel as o}from"./chunk-PA3PNTVV.js";import{sectionTemplatesOf as n}from"./chunk-BVN33R76.js";import{blockTypesIn as s}from"./chunk-5ZBY24K7.js";import{SidePanelHead as i,PanelModeExit as r}from"./chunk-62VPYC7F.js";import{blockRuns as l}from"./chunk-HQ4VVRIC.js";import{useScreenBlockLook as c,useScreenBlockRules as a}from"./chunk-CSGTPJTY.js";import{useEaselSession as p}from"./chunk-O7Q4DDJT.js";import{DEFAULT_SCREEN_WORDS as m}from"./chunk-VVPZMWJE.js";import{useEasel as d}from"./chunk-LPM2SCM4.js";import{useWords as f}from"./chunk-MFIRYGHW.js";import{AddPanel as y}from"./chunk-QFVRMARS.js";import{DEFAULT_DRAG_WORDS as h}from"./chunk-AYWN5NRH.js";import{useState as u,useEffect as k,useMemo as b}from"react";import{AddIcon as g}from"efficient-shell/icons/efficient";import{jsx as j,jsxs as v,Fragment as V}from"react/jsx-runtime";var P=e=>`section:${e}`,R=e=>`block:${e}`,T=e=>`template:${e}`;function $({at:$,placeBlocks:w,canTake:A,onPick:C,itemFor:E,session:M,siteWide:N,onClose:O,onHide:x,readOnly:B}){const F=d(e=>e.config),H=c(),{labelAtLevel:I,categoryLabel:L,firstSection:S,Icon:W,Thumbnail:Y}=H,{blockIsOffered:D,canAddTo:J}=a(),Q=f("screen",m).add,z=f("drag",h).add,G=p(),[Z,K]=u([]);k(()=>{let e=!1;const t=e=>D(e,G);return n(G).list().then(o=>{if(e)return;const n=F.components;K(o.filter(e=>e.node?.type&&n[e.node.type]&&s(e.node).every(t)))}).catch(()=>{}),()=>{e=!0}},[F,G]);const q=b(()=>e(F,H),[F]),U=e=>({type:P(e.type),label:e.name,cover:/* @__PURE__ */j(Y,{type:e.type}),title:e.desc?`${e.name} — ${e.desc}`:Q.tile({name:e.name}),keywords:[e.alias??"",e.desc,e.type,e.catLabel].filter(Boolean)}),X=e=>{const t=e.indexOf(":"),o=e.slice(0,t),n=e.slice(t+1);if("section"===o)return{kind:"section",type:n};if("block"===o)return{kind:"block",type:n};if("template"===o){const e=Z.find(e=>e.id===n);return e?{kind:"template",template:e}:null}return null},_=e=>/* @__PURE__ */j("span",{className:"es-add-glyph-cover",children:/* @__PURE__ */j(W,{type:e,size:26})}),ee=b(()=>{const e=t(q,S),n=/* @__PURE__ */new Map,s=e=>{!n.has(e.type)&&D(e.type,G)&&n.set(e.type,e)};for(const t of e?[e]:q){const e=J(t.type)?.choices??[];e.forEach(s),e.forEach(e=>J(e.type,1)?.choices?.forEach(s))}w?.forEach(s);const i=new Set(q.map(e=>e.type)),r=[...n.values()].filter(e=>!i.has(e.type)),c=e=>({type:R(e.type),label:e.label,cover:_(e.type),title:Q.tile({name:e.label}),keywords:[e.group??"",e.type].filter(Boolean)}),a=e=>n.has(e.type)?{...U(e),cover:_(e.type)}:U(e),p=[];Z.length>0&&p.push({key:"templates",title:Q.templates,tiles:Z.map(e=>{return{type:T(e.id),label:e.name,cover:/* @__PURE__ */j(Y,{type:e.node.type}),keywords:[(t=e.node.type,I(t,"section",F.components[t]?.label??t)),e.node.type]};var t})});const m=r.filter(e=>!e.group);let d=!1;for(const t of Object.keys(F.categories??{})){const n=q.filter(e=>e.cat===t);if(0===n.length)continue;const s=e&&n.some(t=>t.type===e.type)?e:null,i=(s?[s,...n.filter(e=>e.type!==s.type)]:n).map(a);s&&!d&&(i.splice(1,0,...m.map(c)),d=!0),p.push({key:`category:${t}`,title:o(F,t,L),tiles:i})}const f=p.find(e=>e.key?.startsWith("category:"));if(!d&&f&&m.length>0&&(f.tiles=[...f.tiles,...m.map(c)],d=!0),l(r.filter(e=>e.group||!d)).forEach((e,t)=>{p.push({key:`blocks:${t}`,title:e.group??"",tiles:e.items.map(c)})}),!A)return p;const y=p.map(e=>({...e,tiles:e.tiles.map(e=>{const t=X(e.type),o=t?A(t):null;return o?{...e,disabled:!0,disabledReason:o}:e})})),h=e=>e.tiles.some(e=>!e.disabled);return[...y.filter(h),...y.filter(e=>!h(e))]},[Z,q,F,Q,A,w,G]);/* @__PURE__ */
|
|
2
|
-
return v(V,{children:[
|
|
3
|
-
/* @__PURE__ */j(i,{icon:/* @__PURE__ */j(g,{size:15}),title:Q.title,context:Q.contextAll,actions:/* @__PURE__ */j(r,{label:Q.done,description:Q.doneDescription,onClick:O}),onHide:x}),
|
|
4
|
-
/* @__PURE__ */v("div",{className:"sf-addside sf-scroll",children:[
|
|
5
|
-
/* @__PURE__ */j(y,{groups:ee,session:M,itemFor:e=>E(X(e)??{kind:"section",type:e}),onInsert:C?e=>{const t=X(e);t&&C(t)}:void 0,at:$,hint:Q.hint,searchLabel:Q.search,readOnly:B,words:z}),N??null]})]})}export{$ as AddSidePanel,R as blockKey,P as sectionKey,T as templateKey};
|
package/dist/chunk-EA2HTX37.js
DELETED
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
import{PopupMenuDivider as e,PopupMenuLabel as n,PopupSubmenu as l,PopupMenuItem as r}from"efficient-shell/ui";import{jsx as i,Fragment as c,jsxs as a}from"react/jsx-runtime";function t({items:a,onClose:t}){/* @__PURE__ */
|
|
2
|
-
return i(c,{children:a.map((c,a)=>{if("—"===c.label)/* @__PURE__ */return i(e,{},a);if(c.header)/* @__PURE__ */return i(n,{children:c.label},a);if(c.children?.length){const e=c.children.some(e=>void 0!==e.checked);/* @__PURE__ */
|
|
3
|
-
return i(l,{label:c.label,icon:u(c),children:c.children.map((n,l)=>/* @__PURE__ */i(r,{danger:n.danger,onClick:n.onClick,...e?{role:"menuitemradio",checked:Boolean(n.checked)}:{},children:d(n)},l))},a)}/* @__PURE__ */
|
|
4
|
-
return i(r,{danger:c.danger,onClick:()=>{c.onClick(),t()},children:d(c)},a)})})}function o(e){return e.find(e=>e.header)?.label}function u(e){return null==e.icon?null:/* @__PURE__ */i("span",{className:"es-menu-icon","aria-hidden":"true",children:e.icon})}function d(e){return null==e.icon&&null==e.shortcut?e.label:/* @__PURE__ */a(c,{children:[u(e),
|
|
5
|
-
/* @__PURE__ */i("span",{className:"es-menu-label",children:e.label}),null==e.shortcut?null:/* @__PURE__ */i("span",{className:"es-menu-shortcut","aria-hidden":"true",children:e.shortcut})]})}export{t as EaselMenuItems,o as menuLabel};
|
package/dist/chunk-ILXP5VX5.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{useState as t,useEffect as e,useRef as n}from"react";var o=/* @__PURE__ */new Set(["button","checkbox","color","file","hidden","image","radio","range","reset","submit"]);function r(t){const e=t;if(!e||"string"!=typeof e.tagName)return!1;const n=e.tagName.toUpperCase();if("TEXTAREA"===n||"SELECT"===n)return!0;if("INPUT"===n)return!o.has(String(e.type??"text").toLowerCase());if(e.isContentEditable)return!0;const r=e.closest?.("[contenteditable]");return!(!r||"false"===r.getAttribute("contenteditable"))||null!=e.closest?.('[role="textbox"]')}var i="data-puck-component";function c(t,e=i){const n=t;return n&&"function"==typeof n.closest?n.closest(`[${e}]`)?.getAttribute(e)??null:null}function u(t){const e=t.getBoundingClientRect();if(e.width>0&&e.height>0)return{left:e.left,top:e.top,width:e.width,height:e.height};let n=1/0,o=1/0,r=-1/0,i=-1/0;for(const e of Array.from(t.children)){const t=e.getBoundingClientRect();t.width<=0||t.height<=0||(n=Math.min(n,t.left),o=Math.min(o,t.top),r=Math.max(r,t.right??t.left+t.width),i=Math.max(i,t.bottom??t.top+t.height))}return n===1/0?{left:e.left,top:e.top,width:e.width,height:e.height}:{left:n,top:o,width:r-n,height:i-o}}function s(t){const e=t.offsetWidth;if(!e)return 1;const n=t.getBoundingClientRect().width;return n>0?n/e:1}function l(t,e,n){const o=t.getBoundingClientRect(),r=n?.getBoundingClientRect()??{left:0,top:0},i=s(t);return{left:o.left-r.left+e.left*i,top:o.top-r.top+e.top*i,width:e.width*i,height:e.height*i}}function d(t){const e=t.offsetWidth;if(!e)return 1;const n=t.getBoundingClientRect().width;return n>0?n/e:1}function a(t,e,n){const o=l(t,e,n),r=d(n);return{left:o.left/r,top:o.top/r,width:o.width/r,height:o.height/r}}function f(t,e,n){const o=t.getBoundingClientRect(),r=d(t);return{x:(e-o.left)/r,y:(n-o.top)/r}}function h(t,e,n,o){const{left:r,top:i}=l(t,{left:e,top:n,width:0,height:0},o);return{x:r,y:i}}function m({available:t,width:e,maxScale:n=1}){const o=Math.max(0,t);if(!e||e<=0)return{width:o,scale:1,shownWidth:o};const r=o>0?Math.min(o/e,n):1;return{width:e,scale:r,shownWidth:e*r}}var w="data-es-canvas-style",g=/* @__PURE__ */new WeakMap;function p(t,e){e?g.set(t,e):g.delete(t)}function b(t,e,n){const o=t.head??t.documentElement;let r=y(t,e);if(!r){r=t.createElement("style"),r.setAttribute(w,e);const n=g.get(t);n&&r.setAttribute("nonce",n),o.appendChild(r)}return r.textContent!==n&&(r.textContent=n),r}function v(t,e){y(t,e)?.remove()}function y(t,e){for(const n of Array.from(t.querySelectorAll(`style[${w}]`)))if(n.getAttribute(w)===e)return n;return null}var E="[data-puck-component]",A="[data-puck-dropzone]",C="iframe#preview-frame";function L(t){const e=t.contentDocument;if(!e||!t.contentWindow||"loading"===e.readyState||!e.body)return!1;if(t.hasAttribute("srcdoc"))return"about:srcdoc"===e.URL;const n=t.getAttribute("src");return!n||"about:blank"===n||"about:blank"!==e.URL}function x(t,e,{selector:n=C,readySelector:o}={}){let r=null,i=null,c=!1,u=!1,s=null;const l=()=>{s?.observer.disconnect(),s=null},d=()=>{if(u)return;let t=null;if(r&&L(r)){const e=r.contentDocument;(t=>{if(!o||t.querySelector(o))return l(),!0;if(s?.doc!==t){l();const e=t.defaultView?.MutationObserver;if(e){const n=new e(()=>d());n.observe(t,{childList:!0,subtree:!0}),s={doc:t,observer:n}}}return!1})(e)&&(t={frame:r,document:e,window:r.contentWindow})}else l();(t===i||!!t&&!!i&&t.frame===i.frame&&t.document===i.document)&&c||(c=!0,i=t,e(i))},a=()=>d(),f=()=>{const e=t.querySelector?.(n);e!==r?(r?.removeEventListener("load",a),r=e,r?.addEventListener("load",a),d()):d()},h=t.ownerDocument?.defaultView??t.defaultView,m=h?.MutationObserver,w=m?new m(t=>(t=>null!==r&&!r.isConnected||t.some(t=>[...t.addedNodes,...t.removedNodes].some(t=>"IFRAME"===t.nodeName||!!t.querySelector?.("iframe"))))(t)&&f()):null;return w?.observe(t,{childList:!0,subtree:!0}),f(),()=>{u=!0,w?.disconnect(),l(),r?.removeEventListener("load",a),r=null}}function M(n,{selector:o,readySelector:r}={}){const[i,c]=t(null);return e(()=>{const t=n.current;if(!t)return;const e=x(t,c,{selector:o,readySelector:r});return()=>{e(),c(null)}},[n,o,r]),i}var R="easel:canvas-typing";function S(t,o,r,{on:i="document",capture:c=!1}={}){const u=n(r);u.current=r;const s=t?.document??null,l=t?.window??null;e(()=>{const t="window"===i?l:s;if(!t)return;const e=t=>u.current(t);return t.addEventListener(o,e,c),()=>t.removeEventListener(o,e,c)},[s,l,o,i,c])}function k(t,n,o){const r=t?.document??null;e(()=>{if(!r)return;if(!o)return void v(r,n);const t=b(r,n,o),e=r.defaultView?.MutationObserver,i=e?new e(()=>{t.isConnected||b(r,n,o)}):null;return i?.observe(r.head??r.documentElement,{childList:!0}),()=>{i?.disconnect(),v(r,n)}},[r,n,o])}function B(n,{settle:o=[150,450]}={}){const[r,i]=t(0),c=n?.frame??null,u=n?.document??null,s=n?.window??null,l=o.join(",");return e(()=>{if(!c||!u||!s)return;const t=c.ownerDocument.defaultView;let e=!1,n=0;const r=()=>{if(e)return;e=!0;const o=()=>{e=!1,i(t=>t+1)};t?.requestAnimationFrame?n=t.requestAnimationFrame(o):o()},l=[],d=(t,e)=>{t.addEventListener(e,r,!0),l.push(()=>t.removeEventListener(e,r,!0))};d(u,"scroll"),d(s,"resize"),t&&(d(t,"scroll"),d(t,"resize"));const a=t?.ResizeObserver;if(a){const t=new a(r);t.observe(c),u.documentElement&&t.observe(u.documentElement),l.push(()=>t.disconnect())}const f=u.defaultView?.MutationObserver,h=u.body??u.documentElement;if(f&&h){const t=new f(r);t.observe(u===c.ownerDocument?c:h,{childList:!0,subtree:!0}),l.push(()=>t.disconnect())}const m=u.fonts;m&&d(m,"loadingdone");const w=o.map(t=>setTimeout(r,t));return r(),()=>{for(const t of l)t();for(const t of w)clearTimeout(t);n&&t?.cancelAnimationFrame&&t.cancelAnimationFrame(n)}},[c,u,s,l]),r}export{i as BLOCK_ATTRIBUTE,E as BLOCK_SELECTOR,C as CANVAS_SELECTOR,R as CANVAS_TYPING_EVENT,A as LIST_SELECTOR,f as clientPointToLayer,u as drawnBox,d as elementScale,m as fitCanvas,h as framePointToHost,l as frameRectToHost,a as frameRectToLayer,s as frameScale,L as isFrameReady,r as isTypingTarget,c as nodeIdAt,v as removeCanvasStyle,p as setCanvasNonce,b as upsertCanvasStyle,S as useCanvasEvent,M as useCanvasFrame,B as useCanvasLayout,k as useCanvasStyle,x as watchCanvasFrame};
|
package/dist/chunk-LPM2SCM4.js
DELETED
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
import{DEFAULT_CANVAS_WORDS as e}from"./chunk-TBY3DFKS.js";import{toItemSelector as t,fromItemSelector as n,useNodeOps as o,parentStep as r,clickPick as i}from"./chunk-ECM5F6JJ.js";import{useResolvedFields as l}from"./chunk-YRLPFZW3.js";import{selectionBox as s,placeWindow as a,offsetOrigin as c,colorRunOf as d,ColorWindow as u,startCanvasTyping as p,textMap as f}from"./chunk-NY7HHUGB.js";import{DEFAULT_COPY_WORDS as h}from"./chunk-B4JN227A.js";import{useWords as m}from"./chunk-MFIRYGHW.js";import{setCanvasNonce as g,isTypingTarget as v,frameRectToHost as y,CANVAS_TYPING_EVENT as w,drawnBox as b}from"./chunk-ILXP5VX5.js";import{find as k,ROOT_ID as S,getList as C,remove as I,parseZoneKey as E,move as x,duplicate as D,replaceNode as A,createNode as M,insert as O,normalizeData as z,createResolveCache as R,resolveNodeData as B,ROOT_SLOT as P}from"./chunk-KRXQM65X.js";import{topLevelSlotKeys as N,fieldsFrom as L,defaultsFrom as V}from"./chunk-NKB3KVAB.js";import{createContext as $,useEffect as K,useContext as j,useRef as Z,useSyncExternalStore as F,useState as H,useMemo as T,useCallback as W,useLayoutEffect as Y}from"react";import{jsx as q,jsxs as X,Fragment as U}from"react/jsx-runtime";import{createPortal as J}from"react-dom";import{registerModalEscapeInterceptor as G,FloatingBar as Q,TextToolbar as _,LinkPicker as ee}from"efficient-shell/ui";function te(e){return!["setData","setUi","set"].includes(e.type)}var ne=(e,t,n,o)=>{const r=C(e,t,E(n));return r?.[o]??null},oe=(e,t,n,o,r)=>{const i=ne(e,t,n,o);if(!i)throw new Error(`${r}: nothing at ${n}[${o}]`);return i};function re(e,n){const{selection:o}=e;return{...e.ui,itemSelector:t(e.data,n,o),selectedSlot:o&&"slot"===o.kind?{parentId:o.parentId,slot:o.slot}:null}}function ie(e,t,n){return n?"node"===n.kind?k(e,t,n.id)?n:null:n.parentId===S?C(e,t,n)?n:null:k(e,t,n.parentId)&&C(e,t,n)?n:null:null}function le(e,t,o,r=!1){const{itemSelector:i,selectedSlot:l,...s}=o;let a=e.selection;var c;return"itemSelector"in o&&(a=n(e.data,t,i??null)),"selectedSlot"in o&&(l?a=(c=l)?{kind:"slot",parentId:c.parentId,slot:c.slot}:null:"slot"===a?.kind&&(a=null)),{...e,selection:a,ui:r?s:{...e.ui,...s}}}function se(e,t,n){const o=ae(e,t,n);if(o===e)return e;const r=ie(o.data,n,o.selection);return r===o.selection?o:{...o,selection:r}}function ae(e,t,n){const{data:o}=e;switch(t.type){case"setData":{const n="function"==typeof t.data?t.data(o):t.data;return{...e,data:{...o,...n}}}case"setUi":return le(e,n,"function"==typeof t.ui?t.ui(re(e,n)):t.ui);case"set":{const r={data:o,ui:re(e,n)},i="function"==typeof t.state?t.state(r):t.state;let l=i.data?{...e,data:i.data}:e;return i.ui&&(l=le(l,n,i.ui,!0)),l}case"insert":{const r={...E(t.destinationZone),index:t.destinationIndex},i=M(n,t.componentType,{},t.id?{id:t.id}:{});return{...e,data:O(o,n,r,i)}}case"replace":{const r=oe(o,n,t.destinationZone,t.destinationIndex,"replace");if(r.props.id!==t.data.props.id)throw new Error("Can't change the id during a replace action. Use remove and insert for a new node.");return{...e,data:A(o,n,r.props.id,t.data)}}case"replaceRoot":{const n={...o.root,props:{...o.root.props,...t.root.props},readOnly:t.root.readOnly};return{...e,data:{...o,root:n}}}case"duplicate":{const r=oe(o,n,t.sourceZone,t.sourceIndex,"duplicate"),i=D(o,n,r.props.id),l=ne(i,n,t.sourceZone,t.sourceIndex+1);return{...e,data:i,selection:l?{kind:"node",id:l.props.id}:e.selection}}case"reorder":return ae(e,{...t,type:"move",sourceZone:t.destinationZone},n);case"move":{if(t.sourceZone===t.destinationZone&&t.sourceIndex===t.destinationIndex)return e;const r=ne(o,n,t.sourceZone,t.sourceIndex);if(!r)return e;const i={...E(t.destinationZone),index:t.destinationIndex};return{...e,data:x(o,n,r.props.id,i)}}case"remove":{const r=oe(o,n,t.zone,t.index,"remove");return{...e,data:I(o,n,r.props.id)}}default:return e}}var ce={drag:!0,duplicate:!0,delete:!0,edit:!0,insert:!0},de={leftSideBarVisible:!0,rightSideBarVisible:!0,arrayState:{},componentList:{},isDragging:!1,previewMode:"edit",viewports:{current:{width:360,height:"auto"},options:[],controlsVisible:!0},field:{focus:null}},ue=0,pe=()=>`history-${ue+=1}`;function fe(e){let o=e.config;const r=e.now??(()=>Date.now()),i=e.historyCoalesceMs??250;let l=e.permissions??{};const s=z(e.data,o);let a={data:s,selection:null,ui:{...de}};if(e.ui){const{itemSelector:t,selectedSlot:r,...i}=e.ui;a={data:s,selection:r?{kind:"slot",...r}:n(s,o,t??null),ui:{...de,...i}}}let c=[{core:a,at:-1/0,sealed:!0,id:pe()}],d=0;const u=e=>{const t=c[d],n=r();!e&&d===c.length-1&&d>0&&!t.sealed&&n-t.at<i?c=[...c.slice(0,d),{...t,core:a,at:n}]:(c=[...c.slice(0,d+1),{core:a,at:n,sealed:e,id:pe()}],d=c.length-1)},p=/* @__PURE__ */new Set;let f=null,h=null,m=0,g=null,v=!1;const y=()=>{for(const e of[...p])e()},w=()=>{c=[...c.slice(0,d),{...c[d],core:a},...c.slice(d+1)]},b=(t,n)=>{m>0?v=v||n:(n?u(!1):a!==t&&w(),a.data!==t.data&&e.onChange?.(a.data),a!==t&&y())},S=e=>{const t=a;if(a=se(a,e,o),a===t)return;const n=e.recordHistory??te(e);b(t,n&&a.data!==t.data)},I=t=>{0===m&&(g=a,v=!1),m+=1;try{t()}catch(e){throw m-=1,0===m&&g&&(a=g,g=null),e}if(m-=1,m>0||!g)return;const n=g;g=null,v&&a.data!==n.data?u(!0):a!==n&&w(),a.data!==n.data&&e.onChange?.(a.data),a!==n&&y()},E=e=>{const t=a,n=ie(a.data,o,e);var r,i;(r=n,i=a.selection,r===i||r&&i&&r.kind===i.kind&&("node"===r.kind&&"node"===i.kind?r.id===i.id:"slot"===r.kind&&"slot"===i.kind&&r.parentId===i.parentId&&r.slot===i.slot))||(a={...a,selection:n},b(t,!1))},x=t=>{const n=a;d=t,a=c[d].core,a.data!==n.data&&e.onChange?.(a.data),a!==n&&y()},D=()=>(e={})=>{const t=e.root?o.root?.permissions:o.components[e.item?.type??e.type??""]?.permissions;return{...ce,...l,...t}};let M=D();const O=R(),P={resolveCache:O,async resolveAll({trigger:e="load",metadata:t}={}){const n=a.data,r={type:"root",props:{...n.root.props??{}}},i=[...n.content,...Object.values(n.zones??{}).flat()],[l,...s]=await Promise.all([B(r,o,{cache:O,trigger:e,metadata:t}),...i.map(n=>B(n,o,{cache:O,trigger:e,metadata:t}))]);I(()=>{const e=a;let t=a.data;s.forEach((e,r)=>{if(!e.didChange)return;const l=i[r].props.id,s=k(t,o,l)?.node;s&&s===k(n,o,l)?.node&&(t=A(t,o,l,e.node))}),l.didChange&&t.root===n.root&&(t={...t,root:{...t.root,props:l.node.props,readOnly:l.node.readOnly??t.root.readOnly}}),t!==a.data&&(a={...a,data:t,selection:ie(t,o,a.selection)},b(e,!1))})},async resolveNode(e,{trigger:t="replace",metadata:n}={}){const r=k(a.data,o,e)?.node;if(!r)return!1;const i=await B(r,o,{cache:O,trigger:t,metadata:n});if(!i.didChange)return!1;let l=!1;return I(()=>{const t=a;if(k(a.data,o,e)?.node!==r)return;const n=A(a.data,o,e,i.node);n!==a.data&&(a={...a,data:n,selection:ie(n,o,a.selection)},b(t,!1),l=!0)}),l},get config(){return o},getState(){if(f&&h===a)return f;const e=a,n={data:e.data,ui:re(e,o)},r="node"===e.selection?.kind?k(e.data,o,e.selection.id)?.node??null:null;return f={appState:n,selection:e.selection,selectedItem:r,config:o,dispatch:S,history:{back:()=>P.undo(),forward:()=>P.redo(),hasPast:d>0,hasFuture:d<c.length-1,histories:c.map(e=>({id:e.id,state:{data:e.core.data,ui:re(e.core,o)}})),index:d,setHistoryIndex:e=>{e>=0&&e<c.length&&e!==d&&x(e)}},getPermissions:M,getItemById:t=>k(e.data,o,t)?.node,getItemBySelector:t=>function(e,t,n){const[o,r]=(n.zone??"root:default-zone").split(/:(.*)/s);return C(e,t,{parentId:o,slot:r})?.[n.index]}(e.data,o,t),getSelectorForId:n=>{const r=t(e.data,o,{kind:"node",id:n});return r?{index:r.index,zone:r.zone??"root:default-zone"}:void 0}},h=e,f},subscribe:e=>(p.add(e),()=>{p.delete(e)}),dispatch:S,batch:I,group:()=>{const e=d,t=c[e].id;let n=!0;return{close:()=>{if(!n)return;if(n=!1,c[e]?.id!==t)return;if(d<=e+1)return void(d===e+1&&(c=[...c.slice(0,d),{...c[d],sealed:!0},...c.slice(d+1)]));const o=c[d];c=[...c.slice(0,e+1),{...o,sealed:!0},...c.slice(d+1)],d=e+1}}},select:e=>E(e?{kind:"node",id:e}:null),selectSlot:e=>E(e?{kind:"slot",parentId:e.parentId,slot:e.slot}:null),run(e){I(()=>{const t=a,n=void 0===e.select?a.selection:e.select;a={...a,data:e.data,selection:ie(e.data,o,n)},b(t,e.data!==t.data)})},load(e,t={}){const n=a,r=z(e,o);a={...a,data:r,selection:ie(r,o,t.selection??a.selection)},t.keepHistory||(c=[{core:a,at:-1/0,sealed:!0,id:pe()}],d=0),a!==n&&y()},undo(){d>0&&x(d-1)},redo(){d<c.length-1&&x(d+1)},setPermissions(e){(function(e,t){if(e===t)return!0;const n=Object.keys(e);return n.length===Object.keys(t).length&&n.every(n=>e[n]===t[n])})(e,l)||(l=e,M=D(),f=null,y())},setConfig(e){e!==o&&(o=e,M=D(),f=null,y())}};return P}function he(e,t,n={}){const o=e=>{if(e.altKey)return;if(!(e.metaKey!==e.ctrlKey))return;const o="KeyZ"===e.code,r="KeyY"===e.code&&!e.shiftKey;(o||r)&&(n.leaveTyping&&v(e.target)||!1!==t.getState?.().getPermissions().edit&&(e.preventDefault(),r||e.shiftKey?t.redo():t.undo()))};return e.addEventListener("keydown",o),()=>e.removeEventListener("keydown",o)}var me=$(null),ge=$(!0);function ve({easel:e,hotkeys:t=!0,resolveOnMount:n=!0,children:o}){return K(()=>{n&&e.resolveAll()},[e,n]),K(()=>{if(t&&"undefined"!=typeof document)return he(document,e)},[e,t]),/* @__PURE__ */q(me.Provider,{value:e,children:/* @__PURE__ */q(ge.Provider,{value:t,children:o})})}function ye(){const e=j(me);if(!e)throw new Error("useEasel: no <EaselProvider> above this component");return e}function we(e){const t=ye(),n=Z({view:null,selector:null,value:void 0,has:!1}),o=()=>{const o=t.getState(),r=n.current;if(r.has&&r.view===o&&r.selector===e)return r.value;const i=e(o);return r.has&&Object.is(r.value,i)?(n.current={view:o,selector:e,value:r.value,has:!0},r.value):(n.current={view:o,selector:e,value:i,has:!0},i)};return F(t.subscribe,o,o)}function be(){return function(e){return we(e)}}var ke="data-puck-component",Se="data-puck-dropzone",Ce={},Ie="data-es-mirror",Ee="undefined"==typeof window?K:Y;function xe(e,t,n){for(const e of Array.from(t.head.querySelectorAll(`[${Ie}]`)))e.remove();for(const o of Array.from(e.head.querySelectorAll('style, link[rel="stylesheet"]'))){const e=o.cloneNode(!0);e.setAttribute(Ie,""),n&&e.setAttribute("nonce",n),t.head.appendChild(e)}}function De({children:t,id:n="preview-frame",title:o,className:r,style:i,mirrorStyles:l=!0,onDocument:s,height:a="auto",nonce:c}){const d=m("canvas",e),u=Z(null),[p,f]=H(null);return Ee(()=>{const e=u.current,t=p?.ownerDocument.defaultView;if("auto"!==a||!e||!p||!t)return;const n=()=>{e.style.height=`${Math.ceil(p.getBoundingClientRect().height)}px`};n();const o=t.ResizeObserver,r=o?new o(n):null;return r?.observe(p),()=>r?.disconnect()},[p,a]),Ee(()=>{let e=u.current?.contentDocument;if(!e)return;"CSS1Compat"!==e.compatMode&&(e.open(),e.write("<!DOCTYPE html><html><head></head><body></body></html>"),e.close(),e=u.current?.contentDocument??e),e.body||e.documentElement.appendChild(e.createElement("body")),e.body.style.margin="0";const t=e.createElement("div");t.setAttribute("data-puck-entry",""),t.id="frame-root","fill"===a&&t.classList.add("es-frame-fill"),e.body.appendChild(t),g(e,c),f(t),s?.(e);let n=null;const o=u.current?.ownerDocument;if(l&&o){xe(o,e,c);const t=o.defaultView;t&&"MutationObserver"in t&&(n=new t.MutationObserver(()=>xe(o,e,c)),n.observe(o.head,{childList:!0,subtree:!0,characterData:!0}))}return()=>{n?.disconnect(),t.remove(),f(null),s?.(null)}},[]),/* @__PURE__ */q("iframe",{ref:u,id:n,title:o??d.frame,className:["es-canvas-frame","fill"===a?"is-fill":"",r??""].filter(Boolean).join(" "),style:i,children:p?J(t,p):null})}var Ae=$(null),Me=$(Ce),Oe=[];function ze({parentId:e,slot:t,className:n,style:o,minEmptyHeight:r=128,minEmptyWidth:i=120}){const l=ye(),s=we(n=>C(n.appState.data,l.config,{parentId:e,slot:t})??Oe),a=we(t=>"node"===t.selection?.kind&&t.selection.id===e&&e!==S),c=we(n=>"slot"===n.selection?.kind&&n.selection.parentId===e&&n.selection.slot===t),d=j(Ae),u=["es-zone"];return s.length&&u.push("has-children"),e===S&&u.push("is-root"),(a||c)&&u.push("is-area-selected"),null!==d&&d===e&&e!==S&&u.push("is-hovering-area"),n&&u.push(n),/* @__PURE__ */q("div",{className:u.join(" "),[Se]:`${e}:${t}`,style:{...o,"--min-empty-height":`${r}px`,"--min-empty-width":`${i}px`},children:s.map(e=>/* @__PURE__ */q(Ke,{node:e},e.props.id))})}function Re(e,t){return T(()=>{const n={};for(const o of N(L(e)))n[o]=function(e={}){/* @__PURE__ */
|
|
2
|
-
return q(ze,{parentId:t,slot:o,...e})};return n},[e,t])}function Be(e){return T(()=>function({zone:t,...n}){/* @__PURE__ */
|
|
3
|
-
return q(ze,{parentId:e,slot:t,...n})},[e])}var Pe=["top","bottom","zIndex"];function Ne(e,t,n){e.style[t]!==n&&(e.style[t]=n)}function Le(e){const t=function(e){const t=e?.ownerDocument.defaultView?.getComputedStyle(e);if(!t||"sticky"!==t.position)return null;const n=e=>"auto"===e?"":e;return{top:n(t.top),bottom:n(t.bottom),zIndex:n(t.zIndex)}}(function(e){const t=e.ownerDocument.defaultView;let n=null;for(const o of Array.from(e.children))if("none"!==t?.getComputedStyle(o).display){if(n)return null;n=o}return n}(e));Ne(e,"position",t?"sticky":"relative");for(const n of Pe)Ne(e,n,t?.[n]??"");return!!t}var Ve="data-es-canvas-relative";function $e(e){e.hasAttribute(Ve)&&("relative"===e.style.position&&(e.style.position=""),e.removeAttribute(Ve));const t=e.ownerDocument.defaultView?.getComputedStyle(e).position;return t&&"static"!==t?"sticky"===t:(e.style.position||(e.style.position="relative",e.setAttribute(Ve,"")),!1)}function Ke({node:e}){const t=ye().config.components[e.type],n=e.props.id,o=Z(null),r=function(e,t){return T(()=>n=>{const o=t.current;o&&o!==n&&(o.removeAttribute(ke),o.removeAttribute("data-puck-dnd")),t.current=n,n&&(n.setAttribute(ke,e),n.setAttribute("data-puck-dnd",e),$e(n))},[e,t])}(n,o),i=Z(null),l=!!t?.inline;!function(e,t){const n=Z(!1),o=Z(()=>{});o.current=()=>{const o=e(),i=n.current;n.current=!!o&&t(o),i!==n.current&&r.current()};const r=Z(()=>{});Ee(()=>o.current()),Ee(()=>{const t=e(),i=t?.ownerDocument.defaultView;if(!t||!i)return;const l=()=>o.current();i.addEventListener("resize",l);const s=i.ResizeObserver,a=s?new s(l):null;a?.observe(t);let c=null;return r.current=()=>{c?.disconnect(),c=null;const e=t.ownerDocument.documentElement;n.current&&e&&i.MutationObserver&&(c=new i.MutationObserver(l),c.observe(e,{attributes:!0}))},r.current(),()=>{i.removeEventListener("resize",l),a?.disconnect(),c?.disconnect(),r.current=()=>{}}},[])}(()=>l?o.current:i.current,e=>l?$e(e):Le(e));const s=j(Me),a=Re(t,n),c=Be(n);if(!t?.render)return null;const d=t.render,u={...V(t),...e.props,...a},p={renderDropZone:c,isEditing:!0,dragRef:t.inline?r:null,metadata:{...s,...t.metadata}};return t.inline?/* @__PURE__ */q(d,{...u,puck:p,editMode:!0}):
|
|
4
|
-
/* @__PURE__ */q("div",{ref:i,[ke]:n,"data-puck-dnd":n,style:{position:"relative"},children:/* @__PURE__ */q(d,{...u,puck:p,editMode:!0})})}function je({metadata:e}){const t=we(e=>e.config),n=we(e=>e.appState.data.root).props??{},o=t.root?.render,r=Re(t.root,S),i=Be(S),l=/* @__PURE__ */q(ze,{parentId:S,slot:P}),s=o?/* @__PURE__ */q(o,{id:"puck-root",...n,...r,puck:{renderDropZone:i,isEditing:!0,dragRef:null,metadata:e??{}},editMode:!0,children:l}):l;/* @__PURE__ */
|
|
5
|
-
return q(Me.Provider,{value:e??Ce,children:s})}var Ze=$(void 0);function Fe(e,t,n){const[o,r]=H(null),i=Z(t);return i.current=t,Ee(()=>{const t=e.current?.ownerDocument,n=t?.defaultView;if(!t||!n||!i.current)return void r(null);let o=0;const l=()=>{o=0;const n=function(e,t){if(!e||!t)return null;const n=b(e),o=t.getBoundingClientRect();return{top:n.top-o.top,left:n.left-o.left,width:n.width,height:n.height}}(i.current?i.current(t):null,e.current?.parentElement??null);r(e=>{return(t=e)===(o=n)||t&&o&&t.top===o.top&&t.left===o.left&&t.width===o.width&&t.height===o.height?e:n;var t,o})},s=()=>{o||(o=(n.requestAnimationFrame??(e=>n.setTimeout(e,16)))(l))};l();const a="MutationObserver"in n?new n.MutationObserver(s):null;a?.observe(t.body,{childList:!0,subtree:!0,attributes:!0,characterData:!0});const c="ResizeObserver"in n?new n.ResizeObserver(s):null;return c?.observe(t.documentElement),n.addEventListener("resize",s),()=>{a?.disconnect(),c?.disconnect(),n.removeEventListener("resize",s),o&&(n.cancelAnimationFrame??n.clearTimeout)(o)}},[n]),o}function He({id:e,kind:t,overlay:n}){const o=Z(null),r=Fe(o,e?t=>t.querySelector(`[${ke}="${t.defaultView?.CSS?.escape?t.defaultView.CSS.escape(e):e}"]`):null,e),i=/* @__PURE__ */q("div",{ref:o,"aria-hidden":"true",className:`es-canvas-outline is-${t}`,style:r?{position:"absolute",top:r.top,left:r.left,width:r.width,height:r.height}:{display:"none"}});return n&&e?/* @__PURE__ */q(n,{componentId:e,kind:t,children:i}):i}function Te(e,t,n){const o=f(e,n),r=o.text.length,i=e.ownerDocument;if(!t)return[r,r];let l=null;const s=i.caretPositionFromPoint?.(t.x,t.y);if(s&&e.contains(s.offsetNode))l=o.at(s.offsetNode,s.offset);else{const n=i.caretRangeFromPoint?.(t.x,t.y);n&&e.contains(n.startContainer)&&(l=o.at(n.startContainer,n.startOffset))}if(null===l)return[r,r];const a=o.text;let c=l,d=l;for(;c>0&&!/\s/.test(a[c-1]);)c-=1;for(;d<a.length&&!/\s/.test(a[d]);)d+=1;return[c,d]}function We({s:e,element:t,toolbar:n,label:o,keys:r}){const i=m("copy",h),l=e.pressed(),p=new Set(n.offered),f=n.colors&&n.colors.length>0?n.colors:null,g=Z(null),[v,w]=H(!1),[b,k]=H(null),S=v||null!==b,C=()=>{e.hold(),w(!1),k({href:e.pressed().href})},I=()=>{w(!1),k(null),e.resume()};Y(()=>{r.current={escape:()=>!!S&&(I(),!0),link:()=>!!p.has("link")&&(C(),!0)}}),Y(()=>()=>{r.current=null},[r]);const E=Z(I);E.current=I,K(()=>{if(v)return G(e=>{const t=g.current;return!!("Escape"===e.key&&t&&e.target instanceof Node&&t.contains(e.target))&&(E.current(),!0)},()=>g.current?.querySelector(".es-copy-colors"))},[v]),K(()=>{const n=g.current;if(!S||!n)return;const o=/* @__PURE__ */new Set([n.ownerDocument]),r=t();r&&o.add(r.ownerDocument);const i=o=>{const r=o.target;if(r&&n.contains(r))return;w(!1),k(null);const i=t();r&&i&&i.contains(r)?e.release():e.stop("outside")};for(const e of o)e.addEventListener("pointerdown",i,!0);return()=>{for(const e of o)e.removeEventListener("pointerdown",i,!0)}},[S,e,t]),Y(()=>{const e=g.current,n=e?.querySelector(".rosh-tb-wrap > .es-copy-pop"),o=t();if(!(S&&e&&n&&o))return;const r=o.ownerDocument.defaultView?.getSelection()??null,i=r&&r.rangeCount>0&&o.contains(r.getRangeAt(0).startContainer)?r.getRangeAt(0):null,l=(i?s(i,o):null)??(()=>{const e=o.getBoundingClientRect();return{left:e.left,top:e.top,right:e.right,bottom:e.bottom}})(),d=o.ownerDocument.defaultView?.frameElement,u=d?y(d,{left:l.left,top:l.top,width:l.right-l.left,height:l.bottom-l.top}):{left:l.left,top:l.top,width:l.right-l.left,height:l.bottom-l.top},p=o.getBoundingClientRect(),f=d?y(d,{left:p.left,top:p.top,width:p.width,height:p.height}):{left:p.left,top:p.top,width:p.width,height:p.height},h=(e.closest("[data-floating-bar]")??e).getBoundingClientRect(),m={left:u.left,right:u.left+u.width,top:Math.min(u.top,f.top-6,h.top),bottom:Math.max(u.top+u.height,f.top+f.height+6,h.bottom)},v=e.ownerDocument.documentElement,w=(d??o.closest(".es-canvas")??o).getBoundingClientRect(),b={left:Math.max(0,w.left),top:Math.max(0,w.top),right:Math.min(v.clientWidth||w.right,w.right),bottom:Math.min(v.clientHeight||w.bottom,w.bottom)};if(b.right<=b.left||b.bottom<=b.top||0===n.offsetWidth)return;const k=a({anchor:m,size:{width:n.offsetWidth,height:n.offsetHeight},within:{left:w.left,top:w.top,right:w.right,bottom:w.bottom},clip:b,parent:c(n)});n.style.top=`${k.top}px`,n.style.left=`${k.left}px`,n.style.setProperty("--es-pop-point",`${k.point}px`),n.dataset.side=k.above?"above":"below"});const x=f?{run:d(l.color,f),open:v,onToggle:()=>{k(null),v?I():(e.hold(),w(!0))}}:void 0;/* @__PURE__ */
|
|
6
|
-
return q(Q,{anchor:()=>{const e=t();if(!e)return null;const n=e.getBoundingClientRect(),o=e.ownerDocument.defaultView?.frameElement,r=o?y(o,{left:n.left,top:n.top,width:n.width,height:n.height}):{left:n.left,top:n.top,width:n.width,height:n.height};return{left:r.left-6,top:r.top-6,right:r.left+r.width+6,bottom:r.top+r.height+6}},bounds:()=>{const e=t(),n=e?.ownerDocument.defaultView?.frameElement,o=(n??e?.closest(".es-canvas")??e)?.getBoundingClientRect();return o?{left:o.left,top:o.top,right:o.right,bottom:o.bottom}:{left:0,top:0,right:window.innerWidth,bottom:window.innerHeight}},"aria-label":o,children:/* @__PURE__ */q("div",{ref:g,style:{width:"18rem"},children:/* @__PURE__ */q(_,{offered:p,pressed:l.marks,onMark:t=>{"link"===t?C():e.press(t)},color:x,linkOpen:null!==b,list:{pressed:l.list,onList:t=>e.list(t)},alignment:n.alignment,letterCase:n.letterCase,last:n.lastTool?.({className:"rosh-tb-btn",disabled:!1,selected:l.selected,keepCaret:t=>{t.preventDefault(),e.hold()},insert:t=>e.insert(t)}),windows:/* @__PURE__ */X(U,{children:[v&&f?/* @__PURE__ */q(u,{colors:f,current:l.color,words:i.colors??h.colors,onPick:t=>e.color(t)}):null,b?
|
|
7
|
-
/* @__PURE__ */q(ee,{className:"es-copy-link es-copy-pop",value:b.href??"",onApply:t=>{k(null),e.link(t)},onRemove:null!==b.href?()=>{k(null),e.link(null)}:void 0,onCancel:I}):null]})})})})}function Ye({element:e}){const t=Z(null),n=Fe(t,()=>e(),e);/* @__PURE__ */
|
|
8
|
-
return q("div",{ref:t,"aria-hidden":"true",className:"es-canvas-outline is-typing",style:n?{position:"absolute",top:n.top,left:n.left,width:n.width,height:n.height}:{display:"none"}})}function qe({frame:t=!0,className:n,style:o,metadata:l,mirrorStyles:s,onDocument:a,height:c,title:d,nonce:u,hotkeys:f,frameWrapper:h,overlay:g,children:v,typing:y,passThrough:b}){const k=ye(),S=j(Ze),C=b??S,I=j(ge),E=m("canvas",e),x=f??I,[D,A]=H(void 0),M=we(e=>"node"===e.selection?.kind?e.selection.id:null),[O,z]=H(null),[R,B]=H(null),P=Z(null),[,N]=H(0),L=Z(y);L.current=y;const V=Z(null),$=Z(null),F=e=>{const t=$.current?.ownerDocument,n=t?.defaultView?.CustomEvent;t&&n&&t.dispatchEvent(new n(w,{detail:{typing:e}}))},T=(e,t)=>{P.current?.s.stop("stop");const n=e.element();if(!n)return!1;const o=k.group(),r=e.element,i=p({element:r,value:e.value,rules:e.rules,multiline:e.multiline,skip:e.skip,caret:Te(n,t,e.skip),write:e.write,remount:e.remount,onSelect:()=>N(e=>e+1),onEscape:()=>V.current?.escape()??!1,onLinkKey:()=>V.current?.link()??!1,end:e=>{o.close(),P.current?.element===r&&(P.current=null),B(null),F(!1),L.current?.onChange?.({typing:!1,why:e})}});if(!i)return o.close(),!1;const l=n.closest?.(`[${ke}]`)?.getAttribute(ke);return l&&k.select(l),P.current={s:i,element:r,target:e},B(()=>r),z(null),F(!0),L.current?.onChange?.({typing:!0,element:n}),!0};K(()=>()=>P.current?.s.stop("stop"),[]);const W=e=>{const t=P.current?.element();return Boolean(t&&t.contains(e))},Y=e=>{const t=e.closest?.(`[${ke}]`)?.getAttribute(ke);if(!t)return;const n=k.getState(),o="node"===n.selection?.kind?n.selection.id:null;return i(n.appState.data,k.config,t,o,C)??t},U=e=>{if("Enter"!==e.key||e.defaultPrevented||e.shiftKey||e.metaKey||e.ctrlKey||e.altKey)return;if(P.current)return;const t=e.target;if(t?.isContentEditable||t?.closest?.("input, textarea, select, button"))return;const n=L.current?.atSelection?.();n&&T(n,null)&&e.preventDefault()},J=/* @__PURE__ */X("div",{ref:$,className:"es-canvas-content",style:{position:"relative"},onClick:e=>{const t=e.target;if(t.closest?.("a[href]")&&e.preventDefault(),P.current){if(W(t))return;P.current.s.stop("outside")}const n=Y(t);void 0===n?t.hasAttribute?.(Se)||k.select(null):k.select(n)},onDoubleClick:e=>{const t=L.current;if(!t||W(e.target))return;const n=t.at(e.target);n&&T(n,{x:e.clientX,y:e.clientY})&&e.preventDefault()},onKeyDown:e=>U(e),onMouseOver:e=>{if(P.current)return;const t=Y(e.target)??null;t!==O&&z(t)},onMouseLeave:()=>z(null),children:[
|
|
9
|
-
/* @__PURE__ */q(Ae.Provider,{value:O,children:/* @__PURE__ */q(je,{metadata:l})}),
|
|
10
|
-
/* @__PURE__ */X("div",{className:"es-canvas-outlines",style:{position:"absolute",top:0,left:0,pointerEvents:"none"},children:[
|
|
11
|
-
/* @__PURE__ */q(He,{id:!R&&O&&O!==M?O:null,kind:"hover",overlay:g}),
|
|
12
|
-
/* @__PURE__ */q(He,{id:R?null:M,kind:"selected",overlay:g}),R?/* @__PURE__ */q(Ye,{element:R}):null]}),v]}),G=h?/* @__PURE__ */q(h,{document:D,children:J}):J;K(()=>{if(D&&x)return he(D,k)},[D,x,k]),K(()=>{if(!D)return;const e=e=>{if("Enter"===e.key)return void U(e);if("Escape"!==e.key||e.defaultPrevented)return;const t=e.target;if(t?.isContentEditable||t?.closest?.("input, textarea, select"))return;const n=k.getState();if("node"!==n.selection?.kind)return;const o=r(n.appState.data,k.config,n.selection);"node"===o?.kind&&k.select(o.id)};return D.addEventListener("keydown",e),()=>D.removeEventListener("keydown",e)},[D,k]);/* @__PURE__ */
|
|
13
|
-
return X("div",{className:"es-canvas"+(n?` ${n}`:""),style:o,"data-puck-preview":"","data-es-typing":R?"":void 0,children:[R&&P.current?.target.toolbar?/* @__PURE__ */q(We,{s:P.current.s,element:P.current.element,toolbar:P.current.target.toolbar,label:E.textTools,keys:V}):null,t?/* @__PURE__ */q(De,{mirrorStyles:s,onDocument:e=>{A(e??void 0),a?.(e)},height:c,title:d,nonce:u,children:G}):/* @__PURE__ */q("div",{id:"preview-frame","data-puck-entry":"",children:G})]})}function Xe(e={}){const t=ye(),n=we(e=>e.appState.data);return o({...e,data:n,config:t.config,commit:(e,{select:n})=>t.run({data:e,select:n})})}function Ue(){const e=ye(),t=we(e=>e.config),n=e.resolveCache,o=we(e=>e.selectedItem),r=we(e=>e.appState.data.root),i=o?o.props.id:"root",s=r.props??{},a=T(()=>o||{type:"root",props:s},[o,s]),c=o?t.components[o.type]:t.root,d=e.getState(),u=o?k(d.appState.data,t,i):null,p=u&&"root"!==u.place.parentId?u.place.parentId:null,f=p?d.getItemById(p)??null:null,{fields:h}=l({id:i,node:a,block:c,parent:f,appState:d.appState}),m=we(e=>!1===e.getPermissions(o?{item:o}:{root:!0}).edit),g=W(o=>{(async()=>{const r=e.getState();if("root"!==i){const l=r.getItemById(i),s=r.getSelectorForId(i);if(!l||!s)return;const a={...l,props:{...l.props,...o}},{node:c}=await B(a,t,{cache:n,trigger:"replace"}),d=e.getState().getSelectorForId(i);if(!d)return;return void e.dispatch({type:"replace",destinationZone:d.zone??"root:default-zone",destinationIndex:d.index,data:c})}const l=r.appState.data.root.props??{},{node:s}=await B({type:"root",props:{...l,...o}},t,{cache:n,trigger:"replace"});e.dispatch({type:"replaceRoot",root:{props:s.props,readOnly:s.readOnly},recordHistory:!0})})()},[e,t,n,i]),v=W((e,t)=>g({[e]:t}),[g]);return{id:i,node:a,fields:h,values:a.props,readOnly:m,onChange:v,onChangeMany:g}}export{De as CanvasFrame,Ze as CanvasPassThroughContext,de as DEFAULT_UI,qe as EaselCanvas,ve as EaselProvider,je as EditDocument,he as bindUndoKeys,fe as createEasel,be as createUseEasel,te as recordsByDefault,se as reduce,re as uiView,we as useEasel,ye as useEaselApi,Xe as useEaselNodeOps,Ue as useSelectedFields,ie as validSelection};
|
package/dist/chunk-NW4LJ4G4.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-VVPZMWJE.js";import{styleMenuItems as o}from"./chunk-V7U33NF2.js";import{createNodeClipboard as l,nodeMenuItems as r}from"./chunk-OSPUG6S6.js";import{DEFAULT_NODE_MENU_WORDS as i}from"./chunk-WK3AFPXY.js";import{ROOT_ZONE as c}from"./chunk-PLVEGYK6.js";import{EaselMenuItems as s,menuLabel as a}from"./chunk-EA2HTX37.js";import{isTypingTarget as u,useCanvasEvent as d,framePointToHost as p}from"./chunk-ILXP5VX5.js";import{zoneKey as f,ROOT_SLOT as m,ROOT_ID as h}from"./chunk-KRXQM65X.js";import{useState as y,useCallback as k,useRef as b,useEffect as v}from"react";import{ContextMenu as g}from"efficient-shell/ui";import{UndoIcon as w,RedoIcon as x,PasteIcon as C,SettingsIcon as P,LayersIcon as z,CopyIcon as O}from"efficient-shell/icons/efficient";import{jsx as A}from"react/jsx-runtime";function D(e,n){const t=[],o=/* @__PURE__ */new Set;let l={zone:n.zone,index:n.index};for(;l;){const n=e.nodeAt(l.zone,l.index);if(!n||o.has(n.props.id))break;if(o.add(n.props.id),t.push({zone:l.zone,index:l.index,node:n,parentType:null}),l.zone===c)break;const r=l.zone.lastIndexOf(":");if(r<=0)break;l=e.locate(l.zone.slice(0,r))}for(let e=0;e<t.length-1;e+=1)t[e].parentType=t[e+1].node.type;return t}var K=l(),X=/* @__PURE__ */new WeakMap;function j(e){if(e.claimsPage)return K;const n=e.registry;if(!n)return e.cache("easel:node-clipboard",l);let t=X.get(n);return t||(t=l(),X.set(n,t)),t}function M(){return j(e())}function S(e,n,t){if(n===c){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 T(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 E(e,n,t){const o=e.canPasteAt;if(!o)return f(n.from)===t.zone?S(e,t.zone,t.index+1):null;for(const l of D(e,t)){const t=S(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(u(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||"Backspace"===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 L(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=T(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 a=e.isPinned(l,t.zone)?null:E(e,s,t);return a?(e.nodeOps.paste(a),{done:"pasted",name:s.label}):(e.onPasteRefused(s),{done:"refused",name:s.label})}function I(e,n){const{zone:t,index:l}=n,i=e.nodeAt(t,l);if(!i)return[];const s=i.props.id,a=e.labelOf(i.type,t),u=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=T(e,i,t),k=D(e,n),b=d.held,v=b&&!p?E(e,b,n):null,g=!e.readOnly,w=e.style?o({held:g?e.style.held():null,canCopy:e.style.canCopy(i,t),onCopy:()=>e.style?.copy(i,t),onPaste:()=>e.style?.paste(t,l,i),words:e.words?.styleClipboard}):[];return r({title:a,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)},l=n.zone===c?null:e.slotRung?.(n.zone)??null;return l?[o,{label:l.label,checked:!1,onClick:l.select}]:[o]})},actions:{duplicate:g&&m&&h.duplicate?()=>d.duplicate(s):void 0,moveUp:g&&d.canStep(s,-1)?()=>d.step(s,-1):void 0,moveDown:g&&d.canStep(s,1)?()=>d.step(s,1):void 0,copy:y.copy?()=>d.copy(s,a):void 0,cut:g&&y.cut?()=>d.cut(s,a):void 0,paste:g&&b&&v?{label:b.label,run:()=>d.paste(v)}:void 0,rename:g&&e.renamePropOf(i,t)?()=>e.beginRename(t,l):void 0,hide:!g||f||p?void 0:{hidden:u,run:()=>d.setProps(s,{_hidden:!u})},delete:g&&m&&h.delete?()=>d.remove(s):void 0},style:w,extras:e.menuRows?.(i,t,l)??void 0,pinnedLine:p?R(e).pinned:void 0})}var R=e=>e.words?.screen??t.menu;function B(e){const n=R(e),o=!e.readOnly,l=[];o&&e.history.hasPast&&l.push({label:n.undo,icon:/* @__PURE__ */A(w,{}),shortcut:"⌘Z",onClick:e.history.back}),o&&e.history.hasFuture&&l.push({label:n.redo,icon:/* @__PURE__ */A(x,{}),shortcut:"⇧⌘Z",onClick:e.history.forward});const r=[],s=e.nodeOps.held,a=S(e,c,e.sectionBand().cap);if(o&&s&&(e.canPasteAt?e.canPasteAt(s,a):f(s.from)===c)){const n=a,t=e.words?.menu??i;r.push({label:t.pasteNamed({paste:t.paste,label:s.label}),icon:/* @__PURE__ */A(C,{}),shortcut:"⌘V",onClick:()=>e.nodeOps.paste(n)})}const u=[l,r,[{label:e.pageSettingsLabel??t.pageSettings,icon:/* @__PURE__ */A(P,{}),onClick:e.openPageSettings},{label:n.collapseAll,icon:/* @__PURE__ */A(z,{}),onClick:e.collapseAll}]].filter(e=>e.length>0),d={label:"—",onClick:()=>{}};return u.flatMap((e,n)=>n?[d,...e]:e)}function U(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}))},c=e.words?.menu??i,s=R(e),a=[];l&&(a.push({label:c.copy,icon:/* @__PURE__ */A(O,{}),shortcut:"⌘C",onClick:()=>navigator.clipboard?.writeText(l)}),a.push({label:c.cut,icon:/* @__PURE__ */A(O,{}),shortcut:"⌘X",onClick:()=>{navigator.clipboard?.writeText(l),r("")}})),a.push({label:c.paste,icon:/* @__PURE__ */A(C,{}),shortcut:"⌘V",onClick:()=>{navigator.clipboard?.readText().then(e=>{e&&r(e)}).catch(()=>e.onPasteRefused())}});const u=[a,n.value?[{label:s.selectAll,shortcut:"⌘A",onClick:()=>{n.focus(),n.select()}}]:[]].filter(e=>e.length>0),d={label:"—",onClick:()=>{}};return u.flatMap((e,n)=>n?[d,...e]:e)}function Y(e){return e.shiftKey}function N(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=L(n,o,l,{readOnly:t.readOnly,held:t.held()});r&&(e.preventDefault(),t.onDone?.(r))},[]),s=e.keys?.target??null;v(()=>{if(!s)return;const e=e=>c(e);return s.addEventListener("keydown",e),()=>s.removeEventListener("keydown",e)},[s,c]),d(t,"keydown",c);const a=k(n=>{if(Y(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(Y(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:a,menu:o?/* @__PURE__ */A(F,{host:e,target:o,onClose:r}):null,closeMenu:r}}function F({host:e,target:n,onClose:t}){const o="node"===n.kind?I(e,n):"input"===n.kind?U(e,n.el):B(e);return 0===o.length?null:/* @__PURE__ */A(g,{at:{x:n.x,y:n.y},owner:n.owner??null,onClose:t,"aria-label":a(o),children:/* @__PURE__ */A(s,{items:o,onClose:t})})}export{K as EASEL_NODE_CLIPBOARD,D as ancestorChain,j as nodeClipboardOf,T as nodeClipboardRules,I as nodeMenuItems,V as nodeShortcut,B as pageMenuItems,E as pastePlace,L as runNodeShortcut,U as textMenuItems,M as useNodeClipboard,N as useNodeContextMenu};
|