efficient-easel 0.105.1 → 1.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 +103 -29
- package/dist/{LinkPicker-W2Rtxetz.d.ts → LinkPicker-hPEr1MJx.d.ts} +6 -4
- package/dist/autosave/index.d.ts +5 -5
- package/dist/chrome/chrome.css +50 -273
- package/dist/chrome/index.d.ts +61 -56
- package/dist/chrome/index.js +1 -1
- package/dist/chunk-2GVCAIPX.js +1 -0
- package/dist/chunk-4GNPKHV4.js +64 -0
- package/dist/chunk-5545A3PC.js +4 -0
- package/dist/chunk-7SQF6LZL.js +1 -0
- package/dist/chunk-BXMXTO36.js +1 -0
- package/dist/{chunk-NYKIQJT2.js → chunk-CKEPQNSQ.js} +1 -1
- package/dist/chunk-DJMMTWFP.js +1 -0
- package/dist/{chunk-PQXIFBDY.js → chunk-E2O2MRZR.js} +1 -1
- package/dist/chunk-EA2HTX37.js +5 -0
- package/dist/{chunk-SARZN4M7.js → chunk-FEK3S6HN.js} +1 -1
- package/dist/chunk-FPAVNX3Y.js +6 -0
- package/dist/chunk-HMJS344F.js +1 -0
- package/dist/chunk-JLTZQ4US.js +1 -0
- package/dist/chunk-JMGPPXNQ.js +24 -0
- package/dist/chunk-K56YDHYQ.js +1 -0
- package/dist/chunk-LOMEH6DG.js +1 -0
- package/dist/{chunk-V4LF7D4F.js → chunk-MAEXP3KE.js} +1 -1
- package/dist/chunk-MJM6SFD3.js +3 -0
- package/dist/chunk-NLRW4BGG.js +8 -0
- package/dist/chunk-OJAJVH7S.js +5 -0
- package/dist/chunk-ONRYLR2D.js +2 -0
- package/dist/chunk-ORR3Q4WV.js +1 -0
- package/dist/chunk-OTEXGJDU.js +5 -0
- package/dist/chunk-P2VEMZH5.js +1 -0
- package/dist/chunk-PT6V53OO.js +1 -0
- package/dist/chunk-PYCLHOSA.js +9 -0
- package/dist/chunk-Q27BB5ZC.js +14 -0
- package/dist/chunk-QLD57GBB.js +6 -0
- package/dist/{chunk-NWIW7AWH.js → chunk-QMNML7XH.js} +1 -1
- package/dist/chunk-QR4DLZ3P.js +5 -0
- package/dist/chunk-TJ7YIRWQ.js +21 -0
- package/dist/{chunk-3P6AMTOS.js → chunk-VPFNZ7TB.js} +1 -1
- package/dist/chunk-W3XX2CNW.js +16 -0
- package/dist/chunk-X6DQWK2C.js +1 -0
- package/dist/chunk-XWR5YVA7.js +9 -0
- package/dist/chunk-YABL4EWX.js +7 -0
- package/dist/chunk-ZNNATBDC.js +1 -0
- package/dist/chunk-ZP4G3X44.js +4 -0
- package/dist/copy/copy.css +66 -177
- package/dist/copy/index.d.ts +0 -2
- package/dist/copy/index.js +31 -32
- package/dist/drag/drag.css +31 -11
- package/dist/drag/index.d.ts +10 -0
- package/dist/drag/index.js +1 -1
- package/dist/easel/index.d.ts +10 -1
- package/dist/easel/index.js +1 -1
- package/dist/fields/fields.css +35 -304
- package/dist/fields/index.d.ts +87 -95
- package/dist/fields/index.js +1 -1
- package/dist/gold/gold.css +3 -3
- package/dist/gold/index.d.ts +6 -5
- package/dist/gold/index.js +1 -1
- package/dist/{host-BQ_b9Qzk.d.ts → host-CiuzZJXj.d.ts} +11 -1
- package/dist/index.d.ts +3 -3
- package/dist/index.js +1 -1
- package/dist/menu/index.d.ts +49 -93
- package/dist/menu/index.js +1 -1
- package/dist/menu/menu.css +37 -246
- package/dist/node-ops/index.d.ts +1 -1
- package/dist/panel/index.d.ts +46 -72
- package/dist/panel/index.js +17 -18
- package/dist/panel/panel.css +143 -372
- package/dist/pick/index.d.ts +52 -33
- package/dist/pick/index.js +7 -7
- package/dist/pick/pick.css +19 -150
- package/dist/rail/index.d.ts +48 -90
- package/dist/rail/index.js +1 -1
- package/dist/rail/rail.css +21 -108
- package/dist/screen/components/AddBlockRow.d.ts +8 -2
- package/dist/screen/components/AddBlockRow.js +1 -1
- package/dist/screen/components/AddChildRow.d.ts +4 -3
- package/dist/screen/components/AddChildRow.js +1 -1
- package/dist/screen/components/AddSidePanel.js +1 -1
- package/dist/screen/components/MediaSidePanel.d.ts +2 -2
- package/dist/screen/components/MediaSidePanel.js +1 -1
- package/dist/screen/components/NodeContextMenu.d.ts +31 -9
- package/dist/screen/components/NodeContextMenu.js +1 -1
- package/dist/screen/components/PageEditGuardNotices.js +1 -1
- package/dist/screen/components/ScreenChrome.js +1 -1
- package/dist/screen/components/ScreenDocumentContext.d.ts +2 -2
- package/dist/screen/components/ScreenDocumentContext.js +1 -1
- package/dist/screen/components/ScreenMount.d.ts +8 -8
- package/dist/screen/components/ScreenMount.js +1 -1
- package/dist/screen/components/ScreenStoreProvider.d.ts +8 -8
- package/dist/screen/components/ScreenStoreProvider.js +1 -1
- package/dist/screen/components/SectionScreenShell.js +16 -16
- package/dist/screen/components/SidePanelHead.d.ts +4 -2
- package/dist/screen/components/SidePanelHead.js +1 -1
- package/dist/screen/components/UiIcon.d.ts +10 -26
- package/dist/screen/components/UiIcon.js +2 -1
- package/dist/screen/components/panel-widths.d.ts +15 -1
- package/dist/screen/components/panel-widths.js +1 -1
- package/dist/screen/components/usePartBridge.d.ts +8 -8
- package/dist/screen/components/usePartBridge.js +1 -1
- package/dist/screen/index.d.ts +9 -9
- package/dist/screen/index.js +1 -1
- package/dist/screen/lib/admin-bridge.d.ts +1 -1
- package/dist/screen/lib/admin-bridge.js +1 -1
- package/dist/screen/lib/chrome-theme.d.ts +20 -12
- package/dist/screen/lib/chrome-theme.js +1 -1
- package/dist/screen/lib/document-addressing.d.ts +2 -2
- package/dist/screen/lib/host-chrome.d.ts +1 -1
- package/dist/screen/lib/host.d.ts +2 -2
- package/dist/screen/lib/key-scope.d.ts +31 -2
- package/dist/screen/lib/key-scope.js +1 -1
- package/dist/screen/lib/links/link-filters.d.ts +1 -1
- package/dist/screen/lib/media-panel.d.ts +2 -2
- package/dist/screen/lib/media-picker.d.ts +2 -2
- package/dist/screen/lib/page-lock.d.ts +1 -1
- package/dist/screen/lib/puck/section-doc.d.ts +5 -1
- package/dist/screen/lib/puck/section-doc.js +1 -1
- package/dist/screen/lib/puck/style-clipboard.d.ts +8 -8
- package/dist/screen/lib/puck/use-section-ops.js +1 -1
- package/dist/screen/lib/screen-parts.d.ts +47 -10
- package/dist/screen/lib/screen-parts.js +1 -1
- package/dist/screen/lib/section-templates.d.ts +1 -1
- package/dist/screen/lib/session-context.d.ts +1 -1
- package/dist/screen/lib/session.d.ts +1 -1
- package/dist/screen/screen.css +54 -206
- package/dist/screen/words.d.ts +17 -1
- package/dist/screen/words.js +1 -1
- package/dist/shell/index.d.ts +134 -118
- package/dist/shell/index.js +1 -1
- package/dist/shell/shell.css +130 -88
- package/dist/strings/catalogue.d.ts +5 -5
- package/dist/strings/catalogue.js +1 -1
- package/dist/strings/index.d.ts +5 -5
- package/dist/strings/index.js +1 -1
- package/dist/style-clipboard/index.d.ts +1 -1
- package/dist/text-styles/index.d.ts +12 -3
- package/dist/text-styles/index.js +33 -38
- package/dist/text-styles/text-styles.css +39 -71
- package/dist/tree/index.d.ts +49 -44
- package/dist/tree/index.js +1 -1
- package/dist/tree/tree.css +31 -653
- package/dist/{types-DJDBtdB2.d.ts → types-BqGnUVX5.d.ts} +32 -32
- package/dist/types-BsyPh6EW.d.ts +99 -0
- package/dist/{types-DWS-s9z-.d.ts → types-CsgMwHHa.d.ts} +14 -11
- package/dist/{types-CqY85foL.d.ts → types-Dt1CFR1S.d.ts} +4 -2
- package/dist/{wordFit-D4S36PvB.d.ts → wordFit-7XpmhcaW.d.ts} +3 -5
- package/dist/words-Cl9xMUYY.d.ts +41 -0
- package/dist/{words-D_Lnw1Gr.d.ts → words-CvFnwGSr.d.ts} +1 -1
- package/package.json +5 -1
- package/dist/chunk-2UX75JDP.js +0 -1
- package/dist/chunk-3EDSDPIP.js +0 -1
- package/dist/chunk-3QVB4AG2.js +0 -3
- package/dist/chunk-3WSPDAK2.js +0 -1
- package/dist/chunk-53G47SWO.js +0 -1
- package/dist/chunk-5MZ3RNQQ.js +0 -13
- package/dist/chunk-5ZBBXZPV.js +0 -6
- package/dist/chunk-7FBDZTUD.js +0 -2
- package/dist/chunk-7V5WZ46F.js +0 -2
- package/dist/chunk-BXZ6WLHC.js +0 -22
- package/dist/chunk-BZ5ASXOL.js +0 -1
- package/dist/chunk-EOJNJCMJ.js +0 -16
- package/dist/chunk-EWVJSRRY.js +0 -6
- package/dist/chunk-FMGFZNPW.js +0 -1
- package/dist/chunk-H24N5TMZ.js +0 -11
- package/dist/chunk-HLEET6NV.js +0 -65
- package/dist/chunk-IE4GFYKO.js +0 -1
- package/dist/chunk-KTVH2ZRL.js +0 -15
- package/dist/chunk-N7VRF7PR.js +0 -5
- package/dist/chunk-OWBO4WKA.js +0 -0
- package/dist/chunk-P67FP7PG.js +0 -9
- package/dist/chunk-P6O363EE.js +0 -6
- package/dist/chunk-Q4N7C6CT.js +0 -10
- package/dist/chunk-QH6LCNOX.js +0 -8
- package/dist/chunk-RW4XBUUW.js +0 -1
- package/dist/chunk-TTJ54QGG.js +0 -18
- package/dist/chunk-VSHV6KJQ.js +0 -5
- package/dist/chunk-VSOP4GUM.js +0 -1
- package/dist/chunk-WZ7TGAAT.js +0 -3
- package/dist/chunk-YC4TB3CJ.js +0 -25
- package/dist/chunk-ZFDCDJNZ.js +0 -16
- package/dist/chunk-ZNS7727Y.js +0 -12
- package/dist/chunk-ZTTWFAAC.js +0 -1
- package/dist/types-Djdq6Xkd.d.ts +0 -138
- package/dist/words-DgHcY5qB.d.ts +0 -33
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { ReactNode, HTMLAttributes
|
|
2
|
-
import { T as TreeWords } from './words-
|
|
1
|
+
import { ReactNode, HTMLAttributes } from 'react';
|
|
2
|
+
import { T as TreeWords } from './words-Cl9xMUYY.js';
|
|
3
3
|
|
|
4
4
|
type LayersTreeProps = {
|
|
5
5
|
/** Extra classes — a host's scroll-bar class, for instance. */
|
|
@@ -7,6 +7,10 @@ type LayersTreeProps = {
|
|
|
7
7
|
children?: ReactNode;
|
|
8
8
|
/** Attributes for the tree's root — `efficient-easel/drag`'s `rootProps()`. */
|
|
9
9
|
rootProps?: HTMLAttributes<HTMLDivElement>;
|
|
10
|
+
/** The tree's accessible name (`role="tree"`). Default `words.name`: "Layers". */
|
|
11
|
+
ariaLabel?: string;
|
|
12
|
+
/** The tree's words in the host's language: `useEaselStrings().tree`. Left out, English. */
|
|
13
|
+
words?: TreeWords;
|
|
10
14
|
};
|
|
11
15
|
type TreeGroupLabelProps = {
|
|
12
16
|
children: ReactNode;
|
|
@@ -22,7 +26,7 @@ type TreeRowFold = {
|
|
|
22
26
|
onToggle: () => void;
|
|
23
27
|
};
|
|
24
28
|
type TreeRowProps = {
|
|
25
|
-
/** A
|
|
29
|
+
/** A small glyph for the row's type. */
|
|
26
30
|
icon: ReactNode;
|
|
27
31
|
/** The row's name — the type's label, or a name the person gave it. */
|
|
28
32
|
name: ReactNode;
|
|
@@ -37,9 +41,8 @@ type TreeRowProps = {
|
|
|
37
41
|
hidden?: boolean;
|
|
38
42
|
/**
|
|
39
43
|
* The row can be picked up — whole, by `efficient-easel/drag` (0.74.0). It says
|
|
40
|
-
* so
|
|
41
|
-
*
|
|
42
|
-
* moves. A draggable row draws no `handle`: the row IS the handle.
|
|
44
|
+
* so with the grab cursor, a faint ⋮ at its left and a hint after 0.7 s ("Drag
|
|
45
|
+
* to move · ⌥↑ ⌥↓") on hover, and the row lifted while it moves (tree.css).
|
|
43
46
|
*/
|
|
44
47
|
draggable?: boolean;
|
|
45
48
|
/** The hint a draggable row shows after 0.7 s. Default `words.dragHint`: "Drag to move · ⌥↑ ⌥↓". */
|
|
@@ -48,61 +51,58 @@ type TreeRowProps = {
|
|
|
48
51
|
dragging?: boolean;
|
|
49
52
|
/** Where a drop would land relative to this row, while a drag is over it. */
|
|
50
53
|
drop?: 'before' | 'after' | 'into';
|
|
51
|
-
/** Present when the row folds; the row leads with its caret. Absent: the caret column is held open. */
|
|
52
|
-
fold?: TreeRowFold;
|
|
53
54
|
/**
|
|
54
|
-
*
|
|
55
|
-
*
|
|
56
|
-
* and never made unreachable.
|
|
57
|
-
*
|
|
58
|
-
* @deprecated since 0.74.0 — a row driven by `efficient-easel/drag` is picked
|
|
59
|
-
* up whole (`draggable`), and a draggable row draws no handle. Kept until both
|
|
60
|
-
* editors have moved (blueprint 3.3 / 3.4).
|
|
55
|
+
* Present when the row folds: `aria-expanded`, the caret, and ArrowRight /
|
|
56
|
+
* ArrowLeft open and close it. Absent: the caret column is held open.
|
|
61
57
|
*/
|
|
62
|
-
|
|
58
|
+
fold?: TreeRowFold;
|
|
63
59
|
/** `TreeRowAction`s — laid over the END of the name, shown on hover and focus. */
|
|
64
60
|
actions?: ReactNode;
|
|
65
|
-
/** Stands in for the name — a rename box.
|
|
61
|
+
/** Stands in for the name — a rename box (`es-tree-rename`). Keys typed in it are its own. */
|
|
66
62
|
nameSlot?: ReactNode;
|
|
67
63
|
/**
|
|
68
|
-
* Selects the row
|
|
69
|
-
*
|
|
70
|
-
*
|
|
64
|
+
* Selects the row: a click on it, Enter or Space while it has focus (the row
|
|
65
|
+
* is the `treeitem`; `aria-selected` says which is selected). With a
|
|
66
|
+
* `rowProps.onClick` as well, a click is that onClick's alone — one click,
|
|
67
|
+
* one selection.
|
|
71
68
|
*/
|
|
72
69
|
onSelect?: () => void;
|
|
73
70
|
/** Named state glyphs drawn right after the name — "Hidden on phones". */
|
|
74
71
|
marks?: ReadonlyArray<TreeRowMark>;
|
|
75
72
|
/** A count or position pill after the name — "1 of 2". */
|
|
76
73
|
badge?: ReactNode;
|
|
77
|
-
/** A non-interactive mark
|
|
74
|
+
/** A non-interactive named mark — the Lock on a pinned section. Drawn after the marks. */
|
|
78
75
|
trailing?: {
|
|
79
76
|
label: string;
|
|
80
77
|
icon: ReactNode;
|
|
81
78
|
};
|
|
82
|
-
/** Drawn
|
|
79
|
+
/** Drawn after the name, the marks and `trailing` — a count, say. The drop line is the row's own (`drop`). */
|
|
83
80
|
children?: ReactNode;
|
|
81
|
+
/** The depth, from 1 (`aria-level`). Left out: the nearest `Subtree`'s, counted. */
|
|
82
|
+
level?: number;
|
|
84
83
|
/** Attributes for the row itself: onClick, drag-over handlers, data-*. */
|
|
85
84
|
rowProps?: HTMLAttributes<HTMLDivElement> & Record<`data-${string}`, string | number | undefined>;
|
|
86
85
|
/**
|
|
87
|
-
* The row's own words — the drag hint
|
|
88
|
-
*
|
|
89
|
-
*
|
|
86
|
+
* The row's own words — the drag hint — in the host's language:
|
|
87
|
+
* `useEaselStrings().tree` (0.95.0). Left out, English. `dragHint` above still
|
|
88
|
+
* wins for its one line.
|
|
90
89
|
*/
|
|
91
90
|
words?: TreeWords;
|
|
92
91
|
};
|
|
93
92
|
type TreeRowMark = {
|
|
94
93
|
key: string;
|
|
95
|
-
/** Tooltip and accessible name — the mark is a picture of a state. */
|
|
94
|
+
/** Tooltip (the shell's) and accessible name — the mark is a picture of a state. */
|
|
96
95
|
label: string;
|
|
97
96
|
icon: ReactNode;
|
|
98
97
|
};
|
|
99
98
|
type TreeRowActionProps = {
|
|
100
99
|
/**
|
|
101
|
-
* `delete` is the
|
|
102
|
-
* (a phone toggle, "Duplicate
|
|
100
|
+
* `delete` is the trash, in the shell's danger tone (`ghost-danger`); `eye`
|
|
101
|
+
* shows or hides; `plain` is any other action (a phone toggle, "Duplicate
|
|
102
|
+
* column") in the neutral one.
|
|
103
103
|
*/
|
|
104
104
|
kind: 'delete' | 'eye' | 'plain';
|
|
105
|
-
/** For a toggle: whether it is on. Adds aria-pressed and keeps
|
|
105
|
+
/** For a toggle: whether it is on. Adds aria-pressed and keeps the row's actions showing at rest. */
|
|
106
106
|
pressed?: boolean;
|
|
107
107
|
disabled?: boolean;
|
|
108
108
|
/** Tooltip and accessible name — "Delete Text", "Show Section". */
|
|
@@ -111,7 +111,7 @@ type TreeRowActionProps = {
|
|
|
111
111
|
children: ReactNode;
|
|
112
112
|
};
|
|
113
113
|
type TreeEmptySlotProps = {
|
|
114
|
-
/** A drag is over the slot and may land in it: it lights up and says "Drop here". */
|
|
114
|
+
/** A drag is over the slot and may land in it: it lights up and says the shell's "Drop here". */
|
|
115
115
|
drop?: boolean;
|
|
116
116
|
/** Present: the box is a button that adds here (it opens the Add panel at this place). */
|
|
117
117
|
onAdd?: () => void;
|
|
@@ -123,10 +123,10 @@ type TreeEmptySlotProps = {
|
|
|
123
123
|
/**
|
|
124
124
|
* The drag handlers — `efficient-easel/drag`'s
|
|
125
125
|
* `seam({ place: { ...list, index: 0 } }).seamProps`: an empty list has one
|
|
126
|
-
* place, its start.
|
|
126
|
+
* place, its start. They go on the shell slot's root (`slotProps`).
|
|
127
127
|
*/
|
|
128
128
|
seamProps?: HTMLAttributes<HTMLDivElement>;
|
|
129
|
-
/** The box's
|
|
129
|
+
/** The box's words at rest in the host's language: `useEaselStrings().tree`. Left out, English. */
|
|
130
130
|
words?: TreeWords;
|
|
131
131
|
};
|
|
132
132
|
type TreeSeamProps = {
|
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
import { ReactNode, CSSProperties } from 'react';
|
|
2
|
+
|
|
3
|
+
/** One row of the menu.
|
|
4
|
+
*
|
|
5
|
+
* Carried over unchanged from `efficient-admin-portal`'s `RowContextMenuItem`
|
|
6
|
+
* (card 66039), because the campaign designer's registry is typed against it and
|
|
7
|
+
* what the menus OFFER is not this card's to move. A `label` of `'—'` renders a
|
|
8
|
+
* separator; `header: true` renders a caption, and the FIRST such caption names
|
|
9
|
+
* the menu for assistive tech. */
|
|
10
|
+
interface EaselContextMenuItem {
|
|
11
|
+
label: string;
|
|
12
|
+
onClick: () => void;
|
|
13
|
+
danger?: boolean;
|
|
14
|
+
header?: boolean;
|
|
15
|
+
/** A SUBMENU: this item opens a flyout of these instead of acting itself.
|
|
16
|
+
* One level only — a child carrying its own `children` is drawn as a plain
|
|
17
|
+
* item, which is all any caller has needed and keeps the flyout from becoming
|
|
18
|
+
* a tree nobody can navigate with a mouse. */
|
|
19
|
+
children?: EaselContextMenuItem[];
|
|
20
|
+
/** Draw a tick beside this item — for a submenu whose entries are STATES
|
|
21
|
+
* rather than actions, so it can say which one you are already on. */
|
|
22
|
+
checked?: boolean;
|
|
23
|
+
/**
|
|
24
|
+
* A glyph for the row, drawn before the label.
|
|
25
|
+
*
|
|
26
|
+
* ⚠️ A TYPE SLOT, NOT A LOOKUP. The box renders what it is handed and does
|
|
27
|
+
* not know what a glyph means — it must never import the icon set, or the
|
|
28
|
+
* leaf stops being a leaf (`tests/menu-leaf-safety.test.ts` (a) fails if it
|
|
29
|
+
* tries). Hosts pass an element from `efficient-easel/icons`, whose four
|
|
30
|
+
* menu glyphs — copy, paste, move-up, move-down — shipped in 0.30.0 for
|
|
31
|
+
* exactly this row.
|
|
32
|
+
*
|
|
33
|
+
* OMIT IT AND NOTHING IS DRAWN — not an empty span. That is what keeps the
|
|
34
|
+
* admin portal's three shipped surfaces byte-identical, and it is pinned by
|
|
35
|
+
* `tests/menu-layer.test.tsx` (g).
|
|
36
|
+
*/
|
|
37
|
+
icon?: ReactNode;
|
|
38
|
+
/**
|
|
39
|
+
* The keyboard shortcut, drawn right-aligned after the label (the `.k`
|
|
40
|
+
* column of the approved drawing).
|
|
41
|
+
*
|
|
42
|
+
* Display text, not a binding — the box neither registers nor honours it;
|
|
43
|
+
* the host owns the key handling. `aria-hidden`, like the tick and the
|
|
44
|
+
* chevron: "Duplicate ⌘D" read aloud is worse than "Duplicate".
|
|
45
|
+
*
|
|
46
|
+
* OMIT IT AND NOTHING IS DRAWN. Same guard as `icon`.
|
|
47
|
+
*/
|
|
48
|
+
shortcut?: string;
|
|
49
|
+
}
|
|
50
|
+
/**
|
|
51
|
+
* What the box was dressed in, up to 0.106.0.
|
|
52
|
+
*
|
|
53
|
+
* @deprecated since 1.0.0 (efficient-easel#199, harness UI-24): the box is the
|
|
54
|
+
* shell's `ContextMenu` and wears the shell's look, so a skin is accepted and
|
|
55
|
+
* IGNORED. The type stays so a host that still passes one compiles; delete
|
|
56
|
+
* the host's skin when it next touches the menu.
|
|
57
|
+
*/
|
|
58
|
+
interface EaselContextMenuSkin {
|
|
59
|
+
menu?: string;
|
|
60
|
+
menuSub?: string;
|
|
61
|
+
item?: string;
|
|
62
|
+
itemDanger?: string;
|
|
63
|
+
divider?: string;
|
|
64
|
+
header?: string;
|
|
65
|
+
label?: string;
|
|
66
|
+
labelSub?: string;
|
|
67
|
+
icon?: string;
|
|
68
|
+
shortcut?: string;
|
|
69
|
+
chevron?: string;
|
|
70
|
+
tick?: string;
|
|
71
|
+
surface?: CSSProperties;
|
|
72
|
+
itemStyle?: CSSProperties;
|
|
73
|
+
}
|
|
74
|
+
interface EaselContextMenuProps {
|
|
75
|
+
/** Where the pointer was, in the viewport. The shell's `ContextMenu` places
|
|
76
|
+
* the box from here and keeps it inside the owning window (UI-11). */
|
|
77
|
+
x: number;
|
|
78
|
+
y: number;
|
|
79
|
+
items: EaselContextMenuItem[];
|
|
80
|
+
onClose: () => void;
|
|
81
|
+
/**
|
|
82
|
+
* What was right-clicked (or the editor's root). The menu stays inside the
|
|
83
|
+
* shell window that holds it; left out, inside the viewport.
|
|
84
|
+
*/
|
|
85
|
+
owner?: Element | null;
|
|
86
|
+
/** @deprecated since 1.0.0 — ignored: the shell's menu scrolls when it is
|
|
87
|
+
* taller than its window. */
|
|
88
|
+
maxHeight?: number;
|
|
89
|
+
/** @deprecated since 1.0.0 — ignored: the menu wears the shell's look. */
|
|
90
|
+
skin?: EaselContextMenuSkin;
|
|
91
|
+
/**
|
|
92
|
+
* @deprecated since 1.0.0 — the menu is always portalled to `<body>` by the
|
|
93
|
+
* shell, and kept inside the window that holds this element, so it is read
|
|
94
|
+
* as `owner` when `owner` is not given.
|
|
95
|
+
*/
|
|
96
|
+
portalTo?: HTMLElement | null;
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
export type { EaselContextMenuItem as E, EaselContextMenuProps as a, EaselContextMenuSkin as b };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { W as WordFit } from './wordFit-
|
|
1
|
+
import { W as WordFit } from './wordFit-7XpmhcaW.js';
|
|
2
2
|
import { ReactNode } from 'react';
|
|
3
3
|
|
|
4
4
|
/**
|
|
@@ -17,7 +17,7 @@ import { ReactNode } from 'react';
|
|
|
17
17
|
interface EaselRailItem {
|
|
18
18
|
/** Stable identity — used as the React key and to correlate selection. */
|
|
19
19
|
id: string;
|
|
20
|
-
/** Accessible name; becomes both the `aria-label` and the
|
|
20
|
+
/** Accessible name; becomes both the `aria-label` and the button's `Tooltip`. */
|
|
21
21
|
label: string;
|
|
22
22
|
/**
|
|
23
23
|
* The glyph. Pass one of the icons this package ships
|
|
@@ -63,26 +63,29 @@ interface EaselRailProps {
|
|
|
63
63
|
*/
|
|
64
64
|
orientation?: EaselRailOrientation;
|
|
65
65
|
/**
|
|
66
|
-
*
|
|
67
|
-
*
|
|
68
|
-
*
|
|
69
|
-
*
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
*
|
|
66
|
+
* Told which words a ROW rail draws — `'all'`, `'chosen'` (the open panel's
|
|
67
|
+
* word) or `'none'` — once the shell has measured them and again when that
|
|
68
|
+
* changes (efficient-shell's `IconRail` `onLabelsShown`). A host whose longer
|
|
69
|
+
* language lost its words can say so.
|
|
70
|
+
*/
|
|
71
|
+
onLabelsShown?: (shown: 'all' | 'chosen' | 'none') => void;
|
|
72
|
+
/**
|
|
73
|
+
* @deprecated since 1.0.0 — accepted and ignored. A row rail's words are the
|
|
74
|
+
* shell's, measured by the shell (`IconRail` `labelsFit`).
|
|
74
75
|
*/
|
|
75
76
|
wordFit?: WordFit;
|
|
76
77
|
}
|
|
77
78
|
interface EaselRailButtonProps {
|
|
78
79
|
label: string;
|
|
79
|
-
/**
|
|
80
|
+
/** @deprecated since 1.0.0 — accepted and ignored: a worded row rail is the shell's (`EaselRail`). */
|
|
80
81
|
worded?: boolean;
|
|
81
82
|
icon: ReactNode;
|
|
82
83
|
active?: boolean;
|
|
83
84
|
disabled?: boolean;
|
|
84
85
|
onSelect?: () => void;
|
|
85
86
|
className?: string;
|
|
87
|
+
/** Where its tooltip goes: away from the rail. Default `right` (a column). */
|
|
88
|
+
tooltipSide?: 'top' | 'bottom' | 'left' | 'right';
|
|
86
89
|
}
|
|
87
90
|
|
|
88
91
|
export type { EaselRailButtonProps as E, EaselRailItem as a, EaselRailOrientation as b, EaselRailProps as c };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { a as EaselRailItem } from './types-
|
|
1
|
+
import { a as EaselRailItem } from './types-CsgMwHHa.js';
|
|
2
2
|
import { ReactNode, Ref, CSSProperties } from 'react';
|
|
3
3
|
import { EditAccess, SaveConflict } from './edit-lock/index.js';
|
|
4
4
|
import { P as PanelSide } from './panelWidths-D9hTLR25.js';
|
|
@@ -92,7 +92,9 @@ type PanelResizeHandleProps = {
|
|
|
92
92
|
defaultWidth: number;
|
|
93
93
|
/** What this grip resizes, for a screen reader. Required: a default can only lie. */
|
|
94
94
|
label: string;
|
|
95
|
-
/**
|
|
95
|
+
/** The new width, clamped to `min`–`max` and rounded. Since 1.0.0 it is
|
|
96
|
+
* always a number (the shell's handle); the updater form stays in the type
|
|
97
|
+
* so a host's handler written for both still compiles. */
|
|
96
98
|
onResize: (width: number | ((prev: number) => number)) => void;
|
|
97
99
|
};
|
|
98
100
|
type InspectorHeadProps = {
|
|
@@ -3,11 +3,9 @@
|
|
|
3
3
|
* about a strip whose words belong to the host, measured by whoever owns the
|
|
4
4
|
* words.
|
|
5
5
|
*
|
|
6
|
-
*
|
|
7
|
-
*
|
|
8
|
-
*
|
|
9
|
-
* the top-bar rail `TopBarRail` measures the words in the browser and
|
|
10
|
-
* hands `EaselRail` the result.
|
|
6
|
+
* `SettingsSegmented` uses it: the host passes its measured `fit`, and ONE
|
|
7
|
+
* rule (`panel.css`, "word fit") reads it. (The top-bar rail used it too until
|
|
8
|
+
* efficient-shell 4.165.0 measured a worded `IconRail` itself.)
|
|
11
9
|
*
|
|
12
10
|
* Both numbers are the width of TEXT ONLY, in the strip's own type, and neither
|
|
13
11
|
* includes any padding, glyph or gap: those are the strip's, and the sheet adds
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The Layers tree's own words (`efficient-easel/strings`, 0.95.0): its name, the
|
|
3
|
+
* drag hint and an empty slot's. A row's name, its marks and its actions are
|
|
4
|
+
* the host's.
|
|
5
|
+
*
|
|
6
|
+
* The tree does not read the strings provider: `LayersTree`, `TreeRow` and
|
|
7
|
+
* `TreeEmptySlot` take these as their `words` prop and a host passes
|
|
8
|
+
* `useEaselStrings().tree`.
|
|
9
|
+
*
|
|
10
|
+
* Since the rows became the shell's (UI-24) the caret is the shell's, silent
|
|
11
|
+
* (`aria-expanded` on the row says it), so `collapse` / `expand` and their
|
|
12
|
+
* `…Named` are no longer drawn; and an empty slot under a drag says the shell's
|
|
13
|
+
* own "Drop here", so `dropHere` is not either. They stay typed so a host's
|
|
14
|
+
* words still fit.
|
|
15
|
+
*/
|
|
16
|
+
type TreeWords = {
|
|
17
|
+
/** The tree's accessible name. Optional, so a host's words from before still type. */
|
|
18
|
+
name?: string;
|
|
19
|
+
/** What a draggable row says after 0.7 s on it. */
|
|
20
|
+
dragHint: string;
|
|
21
|
+
/** Not drawn since the rows are the shell's (above). */
|
|
22
|
+
collapse: string;
|
|
23
|
+
/** Not drawn since the rows are the shell's (above). */
|
|
24
|
+
expand: string;
|
|
25
|
+
/** Not drawn since the rows are the shell's (above). */
|
|
26
|
+
collapseNamed: (v: {
|
|
27
|
+
label: string;
|
|
28
|
+
}) => string;
|
|
29
|
+
/** Not drawn since the rows are the shell's (above). */
|
|
30
|
+
expandNamed: (v: {
|
|
31
|
+
label: string;
|
|
32
|
+
}) => string;
|
|
33
|
+
/** What an empty slot says when it offers nothing: a read-only tree. */
|
|
34
|
+
emptySlot?: string;
|
|
35
|
+
/** What an empty slot's button says. */
|
|
36
|
+
addBlock?: string;
|
|
37
|
+
/** Not drawn: the shell's slot says its own (above). */
|
|
38
|
+
dropHere?: string;
|
|
39
|
+
};
|
|
40
|
+
|
|
41
|
+
export type { TreeWords as T };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "efficient-easel",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "1.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",
|
|
@@ -517,18 +517,22 @@
|
|
|
517
517
|
"dist"
|
|
518
518
|
],
|
|
519
519
|
"peerDependencies": {
|
|
520
|
+
"efficient-shell": "^4.165.0",
|
|
520
521
|
"react": ">=18",
|
|
521
522
|
"react-dom": ">=18"
|
|
522
523
|
},
|
|
523
524
|
"devDependencies": {
|
|
525
|
+
"@tailwindcss/cli": "^4.2.4",
|
|
524
526
|
"@types/jsdom": "^28.0.3",
|
|
525
527
|
"@types/node": "^22.0.0",
|
|
526
528
|
"@types/react": "^18.2.0",
|
|
527
529
|
"@types/react-dom": "^18.2.0",
|
|
530
|
+
"efficient-shell": "^4.165.0",
|
|
528
531
|
"esbuild": "^0.27.0",
|
|
529
532
|
"jsdom": "^26.1.0",
|
|
530
533
|
"react": "^18.2.0",
|
|
531
534
|
"react-dom": "^18.2.0",
|
|
535
|
+
"tailwindcss": "^4.2.4",
|
|
532
536
|
"terser": "^5.51.2",
|
|
533
537
|
"tsup": "^8.0.0",
|
|
534
538
|
"typescript": "^5.3.0"
|
package/dist/chunk-2UX75JDP.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
var e={accent:"#2563eb",accentTint:"#eff6ff",accentTintStrong:"#dbeafe",accentLine:"#bfdbfe",accentText:"#1d4ed8",accentRing:"rgba(37, 99, 235, 0.25)",accentShadow:"rgba(37, 99, 235, 0.35)",onAccent:"#ffffff",appBg:"#f9fafb",previewBg:"#f3f4f6",panel:"#ffffff",raised:"#ffffff",topbarBg:"#ffffff",frameBg:"#ffffff",hover:"#f3f4f6",hatch:"rgba(0, 0, 0, 0.018)",addcardVeil:"rgba(248, 249, 250, 0.66)",fieldBg:"#ffffff",trackBg:"#f3f4f6",inputBorder:"#d1d5db",fieldText:"#1f2937",fieldPlaceholder:"#9ca3af",knob:"#ffffff",text:"#111827",textStrong:"#030712",textSecondary:"#374151",muted:"#6b7280",icon:"#6b7280",disabled:"#9ca3af",divider:"#e5e7eb",line:"#e5e7eb",btnBorder:"#d1d5db",btnText:"#374151",chipBg:"#f3f4f6",chipFg:"#6b7280",brandSquare:"#111827",deviceBorder:"#e5e7eb",toastBg:"#111827",toggleOff:"#d1d5db",scrollbar:"#d1d5db",scrollbarHover:"#9ca3af",danger:"#dc2626",dangerStrong:"#b91c1c",dangerTint:"#fef2f2",warning:"#b45309",previewTint:"#fef3c7",success:"#15803d",panelRadius:12,rowRadius:8,fieldRadius:6,panelGap:12,space2:2,space4:4,space8:8,space12:12,space16:16,space32:32,panelShadow:"0 1px 2px rgba(0, 0, 0, 0.05), 0 10px 30px rgba(0, 0, 0, 0.06)",topbarShadow:"0 1px 3px rgba(0, 0, 0, 0.06)",raisedShadow:"0 1px 2px rgba(16, 24, 40, 0.1)",font:'-apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, Arial, sans-serif'},a=[e.space2,e.space4,e.space8,e.space12,e.space16,e.space32],s={accent:"--es-accent",accentTint:"--es-accent-tint",accentTintStrong:"--es-accent-tint-strong",accentLine:"--es-accent-line",accentText:"--es-accent-text",accentRing:"--es-accent-ring",accentShadow:"--es-accent-shadow",onAccent:"--es-on-accent",appBg:"--es-app-bg",previewBg:"--es-preview-bg",panel:"--es-panel",raised:"--es-raised",topbarBg:"--es-topbar-bg",frameBg:"--es-frame-bg",hover:"--es-hover",hatch:"--es-hatch",addcardVeil:"--es-addcard-veil",fieldBg:"--es-field-bg",trackBg:"--es-track-bg",inputBorder:"--es-input-border",fieldText:"--es-field-text",fieldPlaceholder:"--es-field-placeholder",knob:"--es-knob",text:"--es-text",textStrong:"--es-text-strong",textSecondary:"--es-text-secondary",muted:"--es-muted",icon:"--es-icon",disabled:"--es-disabled",divider:"--es-divider",line:"--es-line",btnBorder:"--es-btn-border",btnText:"--es-btn-text",chipBg:"--es-chip-bg",chipFg:"--es-chip-fg",brandSquare:"--es-brand-square",deviceBorder:"--es-device-border",toastBg:"--es-toast-bg",toggleOff:"--es-toggle-off",scrollbar:"--es-scrollbar",scrollbarHover:"--es-scrollbar-hover",danger:"--es-danger",dangerStrong:"--es-danger-strong",dangerTint:"--es-danger-tint",warning:"--es-warning",previewTint:"--es-preview-tint",success:"--es-success",panelRadius:"--es-panel-radius",rowRadius:"--es-row-radius",fieldRadius:"--es-field-radius",panelGap:"--es-panel-gap",space2:"--es-space-2",space4:"--es-space-4",space8:"--es-space-8",space12:"--es-space-12",space16:"--es-space-16",space32:"--es-space-32",panelShadow:"--es-panel-shadow",topbarShadow:"--es-topbar-shadow",raisedShadow:"--es-raised-shadow",font:"--es-font"};export{a as SPACING_SCALE,s as shellCssVars,e as shellTokens};
|
package/dist/chunk-3EDSDPIP.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
var e={dragHint:"Drag to move · ⌥↑ ⌥↓",collapse:"Collapse",expand:"Expand",collapseNamed:({label:e})=>`Collapse ${e}`,expandNamed:({label:e})=>`Expand ${e}`,emptySlot:"No blocks yet",addBlock:"Add a block",dropHere:"Drop here"};export{e as DEFAULT_TREE_WORDS};
|
package/dist/chunk-3QVB4AG2.js
DELETED
|
@@ -1,3 +0,0 @@
|
|
|
1
|
-
import{jsxs as l,jsx as s}from"react/jsx-runtime";function e({label:e,blocked:t,onAdd:n,small:a=!1}){/* @__PURE__ */
|
|
2
|
-
return l("button",{type:"button",className:"sf-add-card",disabled:null!==t,title:t??void 0,onClick:n,children:[
|
|
3
|
-
/* @__PURE__ */s("span",{className:a?"sf-plus sf-plus--sm":"sf-plus",children:"+"}),e]})}export{e as AddChildRow};
|
package/dist/chunk-3WSPDAK2.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
function t(t){"undefined"!=typeof document&&document.documentElement.setAttribute("data-editor-theme","light")}export{t as applyEaselChromeTheme};
|
package/dist/chunk-53G47SWO.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{DEFAULT_TEXT_STYLES_WORDS as o}from"./chunk-M6F6LS3H.js";import{DEFAULT_STYLE_CLIPBOARD_WORDS as r}from"./chunk-6WY6ZXJG.js";import{DEFAULT_SCREEN_WORDS as t}from"./chunk-PQXIFBDY.js";import{DEFAULT_CANVAS_WORDS as m}from"./chunk-AELNNAFM.js";import{DEFAULT_TREE_WORDS as n}from"./chunk-3EDSDPIP.js";import{DEFAULT_PANEL_WORDS as c}from"./chunk-QTLAVDJE.js";import{DEFAULT_NODE_MENU_WORDS as s}from"./chunk-WK3AFPXY.js";import{DEFAULT_SAVE_WORDS as f}from"./chunk-H6DDIBQ4.js";import{DEFAULT_CHROME_WORDS as p,DEFAULT_NOTICE_WORDS as e}from"./chunk-ZJEBF4NB.js";import{DEFAULT_LOCK_WORDS as i}from"./chunk-RE4LP46F.js";import{DEFAULT_RAIL_WORDS as u}from"./chunk-2OAZYSWJ.js";import{DEFAULT_COPY_WORDS as k}from"./chunk-UH7IGZKF.js";import{DEFAULT_PICK_WORDS as j}from"./chunk-ZAOM6PFH.js";import{DEFAULT_FIELDS_WORDS as h}from"./chunk-FPOKPNO4.js";import{DEFAULT_DRAG_WORDS as l}from"./chunk-O2NLQBFX.js";var F={notice:e,lock:i,save:f,chrome:p,rail:u,tree:n,panel:c,fields:h,pick:j,drag:l,menu:s,styleClipboard:r,copy:k,canvas:m,textStyles:o,screen:t},a=o=>"object"==typeof o&&null!==o;function P(o,r){const t={};for(const m of Object.keys(o)){const n=o[m],c=r[m];null==c?t[m]=n:a(n)?t[m]=a(c)?P(n,c):n:t[m]=typeof c==typeof n?c:n}return t}function y(o,r){return r?P(o,r):o}export{F as DEFAULT_EASEL_STRINGS,y as mergeEaselStrings};
|
package/dist/chunk-5MZ3RNQQ.js
DELETED
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
import{jsx as e,jsxs as r,Fragment as a}from"react/jsx-runtime";var t={eye:/* @__PURE__ */r(a,{children:[
|
|
2
|
-
/* @__PURE__ */e("path",{d:"M2 12s3-7 10-7 10 7 10 7-3 7-10 7S2 12 2 12z"}),
|
|
3
|
-
/* @__PURE__ */e("circle",{cx:"12",cy:"12",r:"2.6"})]}),"eye-off":/* @__PURE__ */e("path",{d:"M3 3l18 18M10.6 10.6a2 2 0 002.8 2.8M9.4 5.2A9.7 9.7 0 0112 5c7 0 10 7 10 7a16 16 0 01-3.6 4.4M6.1 6.1A16 16 0 002 12s3 7 10 7a9.6 9.6 0 004.1-.9"}),search:/* @__PURE__ */r(a,{children:[
|
|
4
|
-
/* @__PURE__ */e("circle",{cx:"11",cy:"11",r:"7"}),
|
|
5
|
-
/* @__PURE__ */e("path",{d:"M21 21l-3.8-3.8"})]}),"external-link":/* @__PURE__ */r(a,{children:[
|
|
6
|
-
/* @__PURE__ */e("path",{d:"M14 4h6v6"}),
|
|
7
|
-
/* @__PURE__ */e("path",{d:"M20 4l-9 9"}),
|
|
8
|
-
/* @__PURE__ */e("path",{d:"M19 14v5a1 1 0 0 1-1 1H5a1 1 0 0 1-1-1V6a1 1 0 0 1 1-1h5"})]}),pencil:/* @__PURE__ */r(a,{children:[
|
|
9
|
-
/* @__PURE__ */e("path",{d:"M12 20h9"}),
|
|
10
|
-
/* @__PURE__ */e("path",{d:"M16.5 3.5a2.12 2.12 0 0 1 3 3L7 19l-4 1 1-4 12.5-12.5z"})]}),trash:/* @__PURE__ */r(a,{children:[
|
|
11
|
-
/* @__PURE__ */e("path",{d:"M3 6h18M8 6V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2m2 0v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6"}),
|
|
12
|
-
/* @__PURE__ */e("path",{d:"M10 11v6M14 11v6"})]}),"chevron-right":/* @__PURE__ */e("path",{d:"M9 6l6 6-6 6"})};function h({name:r,size:a,strokeWidth:h=1.8,rounded:d=!1,className:i,style:n}){/* @__PURE__ */
|
|
13
|
-
return e("svg",{width:a,height:a,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:h,strokeLinecap:d?"round":void 0,strokeLinejoin:d?"round":void 0,className:i,style:n,"aria-hidden":"true",children:t[r]})}export{h as UiIcon};
|
package/dist/chunk-5ZBBXZPV.js
DELETED
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
import{PanelToggleIcon as e}from"./chunk-KQMML6JM.js";import{InspectorHead as i,InspectorIconButton as n}from"./chunk-YC4TB3CJ.js";import{jsx as t,jsxs as l,Fragment as o}from"react/jsx-runtime";function d({icon:e,title:n,context:d,actions:s,side:a="left",onHide:c}){/* @__PURE__ */
|
|
2
|
-
return t(i,{icon:e,name:n,kind:d,actions:s||c?/* @__PURE__ */l(o,{children:[s,c?/* @__PURE__ */t(r,{side:a,onHide:c,divider:Boolean(s)}):null]}):void 0})}function r({side:i,onHide:d,divider:r=!1}){/* @__PURE__ */
|
|
3
|
-
return l(o,{children:[r?/* @__PURE__ */t("span",{className:"sf-head-divider","aria-hidden":"true"}):null,
|
|
4
|
-
/* @__PURE__ */t(n,{label:`Hide the ${i} panel`,title:"Hide panel",onClick:d,children:/* @__PURE__ */t(e,{side:i})})]})}function s({side:i,onShow:l}){/* @__PURE__ */
|
|
5
|
-
return t("div",{className:`es-sidepanel es-sidepanel--${i} sf-panel-strip`,children:/* @__PURE__ */t(n,{label:`Show the ${i} panel`,title:"Show panel",onClick:l,children:/* @__PURE__ */t(e,{side:i})})})}function a({label:e,onClick:i,description:n}){/* @__PURE__ */
|
|
6
|
-
return t("button",{type:"button",className:"es-btn-ghost sf-head-textbtn",onClick:i,title:n,children:e})}export{r as PanelHideButton,a as PanelModeExit,s as PanelShowStrip,d as SidePanelHead};
|
package/dist/chunk-7FBDZTUD.js
DELETED
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
import{styleMenuItems as e}from"./chunk-57DJOKXT.js";import{useEaselSession as n}from"./chunk-O7Q4DDJT.js";import{ROOT_ZONE as t}from"./chunk-PLVEGYK6.js";import{useHostEscape as o}from"./chunk-U3JP4VGF.js";import{EaselContextMenu as l}from"./chunk-KTVH2ZRL.js";import{createNodeClipboard as i,nodeMenuItems as r}from"./chunk-2LK54I4E.js";import{useCanvasEvent as c}from"./chunk-PAELDYYS.js";import{isTypingTarget as s,framePointToHost as a}from"./chunk-ZNCEOSXO.js";import{UndoIcon as u,RedoIcon as d,AddIcon as p,PasteIcon as f,SettingsIcon as m,LayersIcon as y,CopyIcon as h}from"./chunk-L5KW4HG5.js";import{zoneKey as k,ROOT_SLOT as b,ROOT_ID as v}from"./chunk-KRXQM65X.js";import{useState as x,useCallback as g,useRef as C,useEffect as P}from"react";import{jsx as z}from"react/jsx-runtime";function O(e,n){const o=[],l=/* @__PURE__ */new Set;let i={zone:n.zone,index:n.index};for(;i;){const n=e.nodeAt(i.zone,i.index);if(!n||l.has(n.props.id))break;if(l.add(n.props.id),o.push({zone:i.zone,index:i.index,node:n,parentType:null}),i.zone===t)break;const r=i.zone.lastIndexOf(":");if(r<=0)break;i=e.locate(i.zone.slice(0,r))}for(let e=0;e<o.length-1;e+=1)o[e].parentType=o[e+1].node.type;return o}var w=i(),A=/* @__PURE__ */new WeakMap;function K(e){if(e.claimsPage)return w;const n=e.registry;if(!n)return e.cache("easel:node-clipboard",i);let t=A.get(n);return t||(t=i(),A.set(n,t)),t}function D(){return K(n())}function T(e,n,o){if(n===t){const{floor:n,cap:t}=e.sectionBand();return{parentId:v,slot:b,index:Math.min(Math.max(o,n),t)}}const l=n.lastIndexOf(":");return{parentId:n.slice(0,l),slot:n.slice(l+1),index:o}}function j(e,n,t){const o=e.isPinned(n,t),l=!o&&!e.isLocked(n)&&!e.duplicateBlocked(n),i=e.permits?.(n)??{duplicate:!0,delete:!0};return{copy:!o&&i.duplicate,cut:l&&i.duplicate&&i.delete}}function E(e,n,t){const o=e.canPasteAt;if(!o)return k(n.from)===t.zone?T(e,t.zone,t.index+1):null;for(const l of O(e,t)){const t=T(e,l.zone,l.index+1);if(o(n,t))return t}return null}function L(e){if(e.defaultPrevented||e.altKey||e.shiftKey||!e.metaKey&&!e.ctrlKey)return null;if(s(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;const l=e.code||(1===e.key.length?`Key${e.key.toUpperCase()}`:"");return"KeyC"===l?"copy":"KeyX"===l?"cut":"KeyV"===l?"paste":null}function M(e,n,t,o){const l=e.nodeAt(t.zone,t.index);if(!l)return null;const i=l.props.id,r=e.labelOf(l.type,t.zone),c=j(e,l,t.zone);if("copy"===n)return c.copy?(e.nodeOps.copy(i,r),{done:"copied",name:r}):null;if(o.readOnly)return null;if("cut"===n)return c.cut?(e.nodeOps.cut(i,r),{done:"cut",name:r}):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 S(n,o){const{zone:l,index:i}=o,c=n.nodeAt(l,i);if(!c)return[];const s=c.props.id,a=n.labelOf(c.type,l),u=Boolean(c.props._hidden),d=n.nodeOps,p=n.isPinned(c,l),f=n.isLocked(c),m=!p&&!f&&!n.duplicateBlocked(c),y=n.permits?.(c)??{duplicate:!0,delete:!0},h=j(n,c,l),k=O(n,o),b=d.held,v=b&&!p?E(n,b,o):null,x=n.style?e({held:n.style.held(),canCopy:n.style.canCopy(c,l),onCopy:()=>n.style?.copy(c,l),onPaste:()=>n.style?.paste(l,i,c)}):[];return r({title:a,layer:{group:"pick",items:k.flatMap((e,o)=>{const l={label:n.rowNameOf(e.node,e.zone),checked:0===o,onClick:()=>n.selectAt(e.zone,e.index,e.node.props.id,e.parentType)},i=e.zone===t?null:n.slotRung?.(e.zone)??null;return i?[l,{label:i.label,checked:!1,onClick:i.select}]:[l]})},actions:{addInside:n.canAddTo(c.type)?()=>n.openAddInside(l,i):void 0,duplicate:m&&y.duplicate?()=>d.duplicate(s):void 0,moveUp:d.canStep(s,-1)?()=>d.step(s,-1):void 0,moveDown:d.canStep(s,1)?()=>d.step(s,1):void 0,copy:h.copy?()=>d.copy(s,a):void 0,cut:h.cut?()=>d.cut(s,a):void 0,paste:b&&v?{label:b.label,run:()=>d.paste(v)}:void 0,rename:n.renamePropOf(c,l)?()=>n.beginRename(l,i):void 0,hide:f||p?void 0:{hidden:u,run:()=>d.setProps(s,{_hidden:!u})},delete:m&&y.delete?()=>d.remove(s):void 0},style:x,extras:n.menuRows?.(c,l,i)??void 0,pinnedLine:p?"Pinned — can’t be moved or deleted":void 0})}function X(e){const n=[];e.history.hasPast&&n.push({label:"Undo",icon:/* @__PURE__ */z(u,{}),shortcut:"⌘Z",onClick:e.history.back}),e.history.hasFuture&&n.push({label:"Redo",icon:/* @__PURE__ */z(d,{}),shortcut:"⇧⌘Z",onClick:e.history.forward});const o=[{label:"Add section",icon:/* @__PURE__ */z(p,{}),onClick:e.openAddSection}],l=e.nodeOps.held,i=T(e,t,e.sectionBand().cap);if(l&&(e.canPasteAt?e.canPasteAt(l,i):k(l.from)===t)){const n=i;o.push({label:`Paste ${l.label}`,icon:/* @__PURE__ */z(f,{}),shortcut:"⌘V",onClick:()=>e.nodeOps.paste(n)})}const r=[n,o,[{label:"Page settings",icon:/* @__PURE__ */z(m,{}),onClick:e.openPageSettings},{label:"Collapse all layers",icon:/* @__PURE__ */z(y,{}),onClick:e.collapseAll}]].filter(e=>e.length>0),c={label:"—",onClick:()=>{}};return r.flatMap((e,n)=>n?[c,...e]:e)}function I(e,n){const t=n.selectionStart??0,o=n.selectionEnd??0,l=n.value.slice(t,o),i=e=>{n.focus(),n.setRangeText(e,t,o,"end"),n.dispatchEvent(new Event("input",{bubbles:!0}))},r=[];l&&(r.push({label:"Copy",icon:/* @__PURE__ */z(h,{}),shortcut:"⌘C",onClick:()=>navigator.clipboard?.writeText(l)}),r.push({label:"Cut",icon:/* @__PURE__ */z(h,{}),shortcut:"⌘X",onClick:()=>{navigator.clipboard?.writeText(l),i("")}})),r.push({label:"Paste",icon:/* @__PURE__ */z(f,{}),shortcut:"⌘V",onClick:()=>{navigator.clipboard?.readText().then(e=>{e&&i(e)}).catch(()=>e.onPasteRefused())}});const c=[r,n.value?[{label:"Select all",shortcut:"⌘A",onClick:()=>{n.focus(),n.select()}}]:[]].filter(e=>e.length>0),s={label:"—",onClick:()=>{}};return c.flatMap((e,n)=>n?[s,...e]:e)}function R(e){return e.shiftKey}function Y(e,n){const[t,l]=x(null),i=g(()=>l(null),[]);o(null!==t,i);const r=C(e);r.current=e;const s=g(e=>{const n=r.current,t=n.keys;if(!t)return;const o=L(e);if(!o)return;const l=t.selected();if(!l)return;const i=M(n,o,l,{readOnly:t.readOnly,held:t.held()});i&&(e.preventDefault(),t.onDone?.(i))},[]),u=e.keys?.target??null;P(()=>{if(!u)return;const e=e=>s(e);return u.addEventListener("keydown",e),()=>u.removeEventListener("keydown",e)},[u,s]),c(n,"keydown",s);const d=g(n=>{if(R(n))return;const t=n.target,o=function(e){const n=e?.closest?.("input, textarea");return n?n instanceof HTMLInputElement&&!["text","search","url","email","tel","number",""].includes(n.type)?null:n:null}(t);if(o)return n.preventDefault(),void l({kind:"input",x:n.clientX,y:n.clientY,el:o});const i=t?.closest?.("[data-node-id]")?.getAttribute("data-node-id"),r=i?e.locate(i):null;n.preventDefault(),l(r?{kind:"node",x:n.clientX,y:n.clientY,...r}:{kind:"empty",x:n.clientX,y:n.clientY})},[e]);c(n,"contextmenu",t=>{if(R(t)||!n)return;const o=t.target?.closest?.("[data-puck-component]")??null,i=o?.getAttribute("data-puck-component"),r=i?e.locate(i):null;t.preventDefault();const c=a(n.frame,t.clientX,t.clientY);l(r?{kind:"node",...c,...r}:{kind:"empty",...c})}),c(n,"mousedown",i),c(n,"scroll",i,{on:"window"});return{onEditorContextMenu:d,menu:t?/* @__PURE__ */z(V,{host:e,target:t,onClose:i}):null,closeMenu:i}}function V({host:e,target:n,onClose:t}){/* @__PURE__ */
|
|
2
|
-
return z(l,{x:n.x,y:n.y,items:"node"===n.kind?S(e,n):"input"===n.kind?I(e,n.el):X(e),onClose:t})}export{w as EASEL_NODE_CLIPBOARD,O as ancestorChain,K as nodeClipboardOf,j as nodeClipboardRules,S as nodeMenuItems,L as nodeShortcut,X as pageMenuItems,E as pastePlace,M as runNodeShortcut,I as textMenuItems,D as useNodeClipboard,Y as useNodeContextMenu};
|
package/dist/chunk-7V5WZ46F.js
DELETED
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
import{routeSharedHostMessage as e}from"./chunk-S4AWJX4Q.js";import{describeLoadFailure as r,hostLoadRefusal as n}from"./chunk-ERR437B5.js";import{editLockOf as t}from"./chunk-GMCZXMOV.js";import{NO_DOCUMENT_ADDRESSING as o}from"./chunk-RLBXE4EU.js";import{saveStatusOf as u,resetForDocumentSwitch as a}from"./chunk-HNKB2ZYR.js";import{isExpiredSession as s}from"./chunk-CLOS6SSX.js";import{useAdminBridge as i}from"./chunk-3P6AMTOS.js";import{useEaselSession as l}from"./chunk-O7Q4DDJT.js";import{backendOf as c,setSessionDocumentSite as d}from"./chunk-RSCMJIWS.js";import{useEaselHost as f}from"./chunk-U3JP4VGF.js";import{DEFAULT_SCREEN_WORDS as m}from"./chunk-PQXIFBDY.js";import{useAutosave as g}from"./chunk-BDTITTMW.js";import{canWriteDocument as k,newEaselClientId as v,reloadIfVersionMoved as p,openUnansweredClaim as h,FAIL_OPEN_RETRY_MS as y,CLAIM_FAIL_OPEN_MS as S,holderOf as w}from"./chunk-THWO5YVZ.js";import{useWords as b}from"./chunk-MFIRYGHW.js";import{createContext as I,useContext as P,useState as j,useMemo as T,useCallback as B,useEffect as O,useRef as R}from"react";import{jsx as C}from"react/jsx-runtime";var E={content:[],root:{},zones:{}};var H=I(null);function M(){const e=P(H);if(!e)throw new Error("useStorefrontDocument must be used within StorefrontDocumentProvider");return e}function A({target:I,addressing:P=o,onHostMessage:M,children:A}){const D=P,{homeSlug:F,entryMayBounce:L,entryBounce:V,onSwitch:W,tellsHost:N,adapterFor:X,migrateRenamedProps:Y,describeMissing:J,onLoadFailed:x}=D,[G,Q]=j(I),U=f(),Z=l(),K=T(()=>c(Z),[Z]),z=T(()=>t(Z),[Z]),_="template"===G.kind,q="template"===G.kind?G.id:null,$="template"===G.kind?G.pageSlug??F??"":"document"===G.kind?G.slug??"":G.slug,ee="page"===G.kind?G.siteId??null:null,re=Z.blocks,ne=T(()=>X(G,K,re),[X,K,re,G.kind,"template"===G.kind?G.id:"document"===G.kind?G.record:G.siteId]),te=ne.capabilities,oe=B(e=>Z.documentHooks?.stored?.(e)??e,[Z]),ue="page"===G.kind?G.originSlug??null:null;O(()=>{d(Z,ee)},[Z,ee]);const ae=R(G);O(()=>{ae.current=G},[G]);const{token:se,tokenRef:ie,capabilities:le}=i({onMessage:r=>{if(M?.(r)||e(r))return;const n=r;if("storefront-editor:navigate"===n?.type){const e=r;e?.target&&Pr(e.target)}}}),ce=!Z.usesBridgedToken||null!==se,de=ne.lock,fe=Boolean(K.lock),[me,ge]=j(null),[ke,ve]=j(null),[pe,he]=j(null),[ye,Se]=j(null),we=b("screen",m),be=ye?function(e,r){if(null!==e.sentence)return e.sentence;if(!e.missing)return r.loadFailed({cause:e.cause});switch(e.target.kind){case"template":return r.missingTemplatePage;case"document":return r.missingDocument;default:return r.missingPage({slug:e.slug})}}(ye,we):null,[Ie,Pe]=j(null),je=R(null),Te=R(null),[Be,Oe]=j(!1),Re=R(null),[Ce,Ee]=j(null),He=R(null),[Me,Ae]=j(null),De=R(null);O(()=>{De.current=Me},[Me]);const[Fe,Le]=j(te.hasEditLock?{kind:"checking"}:{kind:"editing"}),Ve=R(Fe);O(()=>{Ve.current=Fe},[Fe]);const We=R(()=>Promise.resolve(!1)),Ne=B(e=>{Te.current=e,Oe(!0)},[]),Xe=g({save:async({id:e,data:r})=>{if(k(Ve.current)){if(!await We.current(e,r)){if(!k(Ve.current))return void Ne({id:e,data:r});throw new Error("page save did not land")}}else Ne({id:e,data:r})},onFailure:(e,r)=>{0===r&&U.send("storefront-editor:save-failed")}}),{state:Ye,push:Je,flush:xe,pause:Ge,resume:Qe,stop:Ue,reset:Ze,retryNow:Ke,hasPending:ze}=Xe,_e=R(Ye);O(()=>{_e.current=Ye},[Ye]);const qe=u(Ye),$e=B(()=>{const e=Te.current;e&&(Te.current=null,Oe(!1),Je(e))},[Je]),er=R("");er.current||(er.current=v());const[rr,nr]=j(0),tr=R(!1),[or,ur]=j(L(I)),ar=R(!1);O(()=>{if(ar.current)return;ar.current=!0;const e=U.address.search(),r=V(I,e);r?U.address.load(r):L(I)&&ur(!1)},[I,U]);const sr=U.send;O(()=>{if(!ce)return;let e=!1;const t=ae.current,o=ne.resolve($),u=Z.documentHooks?.opening?.({slug:$,isTemplate:_,capabilities:te});return o.then(async r=>{if(e)return;if(!r)return"page"===t.kind&&null!==F&&$!==F?void U.address.load({kind:"page",slug:F,siteId:ee??void 0}):(Se({target:t,slug:$,missing:!0,sentence:J?.(t)??null}),void x?.(t,null));const n=r.readOnlyReason?r.readOnlyReason:null;je.current=n,Pe(n),ge(r.id),ve(r.kind??null),He.current=r.version??null;const o=r.layout,a=o&&Object.keys(o).length?o:E,s=Y(a),i=u?await u(s):s;e||he(i)}).catch(o=>{e||(console.error("[storefront-editor] document load failed",o),Se({target:t,slug:$,missing:!1,sentence:n(o,{slug:$},Z),cause:r(o,Z)}),x?.(t,o))}),()=>{e=!0}},[ce,se,_,ne,$]);const ir=B(e=>new Promise(r=>{const n=Date.now(),t=setInterval(()=>{const o=ie.current;o&&o!==e?(clearInterval(t),r(o)):Date.now()-n>6e3&&(clearInterval(t),r(null))},200)}),[]),lr=B(async e=>{const r=ie.current;if(!r&&Z.usesBridgedToken)return{ok:!1,error:new Error("no editor token")};try{return{ok:!0,value:await e(r??"")}}catch(n){if(s(n,Z)){sr("storefront-editor:auth-expired");const n=r?await ir(r):null;if(n)try{return{ok:!0,value:await e(n)}}catch(e){return{ok:!1,error:e}}}return{ok:!1,error:n}}},[sr,ir,Z]),cr=B(async e=>{const r=ie.current?await lr(e):{ok:!1};return r.ok||sr("storefront-editor:save-failed"),r.ok},[sr,lr]),dr=B(async(e,r,n=!1)=>{if(null!==je.current)return!1;if(!k(Ve.current))return!1;if(De.current)return!1;const t=await lr(()=>ne.saveLayout(e,r,He.current,er.current));if(t.ok)return He.current=t.value.version??He.current,!0;const o=z.readLockTaken(t.error);if(o){const e={kind:"takenover",holder:o};return Ve.current=e,Le(e),!1}const u=z.readSaveConflict(t.error);if(u){if(u.savedByYou&&!n&&ne.rereadVersion){const n=await lr(()=>ne.rereadVersion(e));if(n.ok&&n.value)return He.current=n.value,We.current(e,r,!0)}Ue(),De.current=u,Ae(u)}return!1},[ne,lr,Ue]);O(()=>{We.current=dr},[dr]);const fr=B(e=>{if(null!==je.current)return;if(sr("storefront-editor:dirty"),!me)return;const r=oe(e);Re.current=r,k(Ve.current)?Je({id:me,data:r}):Ne({id:me,data:r})},[me,sr,Ne,Je,oe]),mr=B(async()=>{k(Ve.current)&&$e();return await xe()&&null==Te.current},[$e,xe]),gr=R(mr);O(()=>{gr.current=mr},[mr]);const kr=R(lr);O(()=>{kr.current=lr},[lr]);const vr=B(()=>{U.address.reload()},[U]),pr=R(()=>Promise.resolve(!1));O(()=>{pr.current=()=>{const e=ne.rereadVersion;return me&&e?p({ours:He.current,stored:async()=>{const r=await kr.current(()=>e(me));return r.ok?r.value:null},hasPending:()=>null!=Te.current||ze(),reload:vr}):Promise.resolve(!1)}},[ne,me,ze,vr]);const hr=null!==Ie;O(()=>{if(!de||!me||!ce||hr)return;let e=!1,r=null,n=null;const t=er.current,o={claim:async e=>{const r=await kr.current(()=>de.claim(me,t,e));if(r.ok)return{heartbeat_seconds:r.value.heartbeatSeconds};throw r.error},cancelled:()=>e,currentAccess:()=>Ve.current,heldWrite:()=>({pending:null!=Te.current||ze(),autoSaveEnabled:!_e.current.paused,saveConflict:null!=De.current}),setAccess:e=>{Ve.current=e,Le(e)},releaseHeldWrite:()=>{gr.current()},startHeartbeat:e=>{r&&clearInterval(r),r=setInterval(()=>{u(!1)},e)},stopHeartbeat:()=>{r&&(clearInterval(r),r=null)},reloadIfMoved:()=>{pr.current()}},u=z.makeClaimBeat(o),a=tr.current;return tr.current=!1,a||(Le({kind:"checking"}),n=setTimeout(()=>{n=null,h(o)&&o.startHeartbeat(y)},S)),u(a).finally(()=>{n&&clearTimeout(n),n=null}),()=>{e=!0,n&&clearTimeout(n),r&&clearInterval(r),de.release(me,t).catch(()=>{})}},[me,de,ce,se,rr,hr]);const yr=B(()=>{de&&me&&(tr.current=!0,nr(e=>e+1))},[me,de]),Sr=B(()=>{Le(e=>{const r="blocked"===e.kind||"takenover"===e.kind?e.holder:null;return r?{kind:"readonly",holder:r}:e})},[]),wr=B(()=>{_e.current.paused?(k(Ve.current)&&$e(),Qe()):Ge()},[$e,Ge,Qe]),br=B(()=>{Ke()},[Ke]),Ir=B(e=>{Re.current=null,a("template"!==e.kind&&fe,{resetAutosave:()=>{Ze(),Te.current=null,Oe(!1)},setVersion:e=>{He.current=e},setSaveConflict:Ae,setAccess:Le}),W(e),Q(e),je.current=null,Pe(null),ge(null),ve(null),he(null),Se(null),U.address.show(e),"document"!==e.kind&&N(e)&&U.send("storefront-editor:navigated",{target:e})},[Ze,U,fe,W,N]),Pr=B(e=>{if(function(e,r,n){if(e.kind!==r.kind)return!1;if("template"===e.kind){const t=r;return e.id===t.id&&(e.pageSlug??n)===(t.pageSlug??n)}if("document"===e.kind){const n=r;return e.record===n.record&&(e.slug??"")===(n.slug??"")}const t=r;return e.slug===t.slug&&e.siteId===t.siteId}(e,ae.current,F))return;const r=null!=Te.current;if(!r&&!ze())return void Ir(e);const n=_e.current;r||n.paused||n.failed||n.stopped?Ee(e):xe().then(r=>{r?Ir(e):Ee(e)})},[Ir,ze,xe,F]),jr=B(()=>Ee(null),[]),Tr=B(()=>{Ee(e=>(e&&Ir(e),null))},[Ir]),Br=B(async()=>{const e=Ce;if(!e)return;await mr()&&(Ee(null),Ir(e))},[Ce,mr,Ir]),Or=B(async e=>{if(null!==je.current)return;if(!me)return;if(!k(Ve.current)||De.current)return;const r=oe(e);if(!await dr(me,r))return void(De.current||sr("storefront-editor:save-failed"));const n=ne.publish;if(!te.canPublish||!n)return void sr("storefront-editor:saved");const t=await lr(()=>n(me,He.current??void 0));t.ok?(He.current=t.value.version??He.current,sr("storefront-editor:published")):sr("storefront-editor:save-failed")},[me,ne,te.canPublish,sr,dr,lr,oe]);/* @__PURE__ */
|
|
2
|
-
return C(H.Provider,{value:{target:G,adapter:ne,capabilities:te,templateId:q,currentSlug:$,currentKind:ke,siteId:ee,ready:ce,token:se,tokenRef:ie,notifyParent:sr,bridgeCapabilities:le,runAuthed:cr,docId:me,data:pe,getLiveData:()=>Re.current??pe,footerOriginSlug:ue,error:be,redirecting:or,saveStatus:qe,saveState:Ye,autoSaveEnabled:!Ye.paused,autoSaveStoppedByConflict:Ye.stopped,hasUnsavedEdits:Ye.pending||Be,toggleAutoSave:wr,retrySave:br,onChange:fr,flushSave:mr,onPublish:Or,access:Fe,readOnly:null!==w(Fe)||null!==Ie,readOnlyReason:Ie,takeOverEditing:yr,viewReadOnly:Sr,saveConflict:Me,reloadFromServer:vr,navigate:Pr,pendingNav:Ce,cancelPendingNav:jr,discardAndNavigate:Tr,saveAndNavigate:Br},children:A})}export{H as ScreenDocumentContext,A as ScreenDocumentProvider,M as useScreenDocument};
|
package/dist/chunk-BXZ6WLHC.js
DELETED
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
import{FieldSelect as e}from"./chunk-EOJNJCMJ.js";import{TreeSeam as n}from"./chunk-ZFDCDJNZ.js";import{SettingsField as l,SETTINGS_BUCKETS as t,SettingsTabs as a,SettingsGroup as r}from"./chunk-ZNS7727Y.js";import{DEFAULT_TREE_WORDS as i}from"./chunk-3EDSDPIP.js";import{DEFAULT_PANEL_WORDS as o}from"./chunk-QTLAVDJE.js";import{EaselContextMenu as s}from"./chunk-KTVH2ZRL.js";import{FieldNumber as c}from"./chunk-EWVJSRRY.js";import{SettingsSegmented as u}from"./chunk-P6O363EE.js";import{DEFAULT_FIELDS_WORDS as d}from"./chunk-FPOKPNO4.js";import{useWords as m}from"./chunk-MFIRYGHW.js";import{useTreeDrag as p,gapToMoveIndex as h}from"./chunk-67GNT6PF.js";import{ChevronIcon as b,LockIcon as f,MoveUpIcon as v,MoveDownIcon as g,DuplicateIcon as y,TrashIcon as x}from"./chunk-L5KW4HG5.js";import{useRef as k,useState as N,useLayoutEffect as O,useId as w}from"react";import{jsx as C,jsxs as I}from"react/jsx-runtime";function S({id:e,value:n,onChange:l,placeholder:t,multiline:a=!1,rows:r=3,readOnly:i=!1,ariaLabel:o,ariaLabelledBy:s}){const c=n??"";return a?/* @__PURE__ */C("textarea",{id:e,className:"es-fin es-fin--area",value:c,rows:r,placeholder:t,readOnly:i,"aria-label":o,"aria-labelledby":s,onChange:e=>l(e.target.value)}):/* @__PURE__ */C("input",{id:e,type:"text",className:"es-fin",value:c,placeholder:t,readOnly:i,"aria-label":o,"aria-labelledby":s,onChange:e=>l(e.target.value)})}function D(e,n,l){const t=e.slice();return t.splice(Math.max(0,Math.min(n,t.length)),0,l),t}function j(e,n,l){const t=e.slice(),[a]=t.splice(n,1);return t.splice(Math.max(0,Math.min(l,t.length)),0,a),t}function $(e,n){return e.filter((e,l)=>l!==n)}function L(e){return null===e||"object"!=typeof e?e:JSON.parse(JSON.stringify(e))}var F='input, textarea, select, button, [contenteditable]:not([contenteditable="false"]), [tabindex]',P={parentId:"list",slot:"items"};function E({label:e,icon:l,noun:t,items:a,onChange:r,newItem:o,summary:c,itemName:u,thumb:w,min:S=0,max:E,readOnly:A=!1,open:M,onOpen:R,renderItem:T,renderRow:J,canRemove:z,lockedReason:H,fixed:K=!1,removeOnRow:B=!0,canDuplicate:V,above:W,head:Y=!0}){const Z=m("fields",d).list,q=m("tree",i),G=t??Z.item,U=!A&&!K&&("number"!=typeof E||a.length<E),Q=a.length<=S,X=e=>!!z&&!z(a[e],e),_=e=>!A&&!K&&B&&!Q&&!X(e),ee=e=>U&&(!V||V(a[e],e)),ne=(e,n)=>u?u(e,n):Z.itemName({noun:G,n:n+1}),le=k([]),te=k(null),[ae,re]=N(null),ie=k(null),[oe,se]=N(null),[ce,ue]=N("");O(()=>{for(const e of le.current){if(!e)continue;null!==e.querySelector(F)||A?e.removeAttribute("tabindex"):e.tabIndex=0}}),O(()=>{const e=te.current;if(!e)return;te.current=null;const n=le.current[e.index]?.querySelectorAll(F)[e.nth]??le.current[e.index];if(n?.focus(),n&&null!==e.start&&"setSelectionRange"in n)try{n.setSelectionRange(e.start,e.end)}catch{}});const de=(e,n)=>{if(n<0||n>=a.length||n===e)return;const l=le.current[e],t=l?.ownerDocument.activeElement;if(l&&t&&l.contains(t)){const e=[...l.querySelectorAll(F)].indexOf(t),a=t;te.current={index:n,nth:e,start:"number"==typeof a.selectionStart?a.selectionStart:null,end:"number"==typeof a.selectionEnd?a.selectionEnd:null}}r(j(a,e,n));const i=function(e,n,l){return null===e?null:e===n?l:n<e&&l>=e?e-1:n>e&&l<=e?e+1:e}(M,e,n);i!==M&&R(i),ue(Z.moved({n:n+1,total:a.length}))},me=e=>{U&&(r(D(a,e,o())),J?(te.current={index:e,nth:0,start:null,end:null},null!==M&&M>=e&&R(M+1)):R(e))},pe=e=>{_(e)&&(r($(a,e)),M===e?R(null):null!==M&&M>e&&R(M-1))},he=p({keyOf:e=>String(e),canDrop:(e,n)=>n.parentId===P.parentId&&n.slot===P.slot,onDrop:(e,n)=>{const l=h({...P,index:e},n);l!==e&&de(e,l)},onStep:(e,n)=>de(e,e+n),canStep:(e,n)=>e+n>=0&&e+n<a.length,readOnly:A}),be=e=>{const n=[];return e>0&&n.push({label:Z.moveUp,icon:/* @__PURE__ */C(v,{size:14}),shortcut:"⌥↑",onClick:()=>de(e,e-1)}),e<a.length-1&&n.push({label:Z.moveDown,icon:/* @__PURE__ */C(g,{size:14}),shortcut:"⌥↓",onClick:()=>de(e,e+1)}),ee(e)&&n.push({label:Z.duplicate,icon:/* @__PURE__ */C(y,{size:14}),onClick:()=>(e=>{ee(e)&&(r(D(a,e+1,L(a[e]))),null!==M&&M>e&&R(M+1))})(e)}),_(e)&&n.push({label:Z.delete,icon:/* @__PURE__ */C(x,{size:14}),danger:!0,onClick:()=>pe(e)}),n},fe=(e,n,l)=>{A||0===be(e).length||se({index:e,x:n,y:l})},ve=e=>n=>{const l=a.slice();l[e]=n,r(l)};/* @__PURE__ */
|
|
2
|
-
return I("div",{className:"es-list",children:[Y?/* @__PURE__ */I("div",{className:"es-list-head",children:[
|
|
3
|
-
/* @__PURE__ */I("span",{className:"es-list-label",children:[l?/* @__PURE__ */C("span",{className:"es-field-icon","aria-hidden":"true",children:l}):null,e]}),
|
|
4
|
-
/* @__PURE__ */C("span",{className:"es-list-count",children:a.length})]}):null,W?/* @__PURE__ */C("div",{className:"es-list-above",children:W}):null,a.length?/* @__PURE__ */I("div",{className:"es-list-rows",...he.rootProps(),children:[a.map((e,l)=>{const t=he.row({item:l,place:{...P,index:l}}),a=t.draggable&&ae!==l,r=!J&&M===l,i=!A&&!K&&B&&X(l),o=["es-list-row",J?"is-inline":"is-item",r?"is-open":"",a?"is-draggable":"",t.dragging?"is-dragging":"",t.drop?`is-drop-${t.drop}`:""].filter(Boolean).join(" ");/* @__PURE__ */
|
|
5
|
-
return I("div",{className:"es-list-entry",children:[l>0?/* @__PURE__ */C(n,{...he.seam({place:{...P,index:l}}),onAdd:U?()=>me(l):void 0,label:Z.addHere({noun:G})}):null,
|
|
6
|
-
/* @__PURE__ */I("div",{...t.rowProps,ref:e=>{le.current[l]=e},className:o,draggable:a||void 0,"aria-keyshortcuts":t.draggable?"Alt+ArrowUp Alt+ArrowDown":void 0,onPointerDown:e=>{const n=e.target.closest?.('input, textarea, select, [contenteditable]:not([contenteditable="false"])'),a=!!n&&n===n.ownerDocument.activeElement;e.currentTarget.draggable=t.draggable&&!a,ie.current=n&&!a?n:null,re(a?l:null)},onDragStart:e=>{const n=ie.current;ie.current=null,n&&n.ownerDocument.activeElement===n&&n.blur(),t.rowProps.onDragStart?.(e)},onContextMenu:e=>{A||(e.preventDefault(),e.stopPropagation(),fe(l,e.clientX,e.clientY))},onKeyDown:e=>{if("ContextMenu"===e.key||e.shiftKey&&"F10"===e.key){e.preventDefault();const n=e.currentTarget.ownerDocument,t=e=>e.preventDefault();n.addEventListener("contextmenu",t,{capture:!0,once:!0}),n.defaultView?.setTimeout(()=>n.removeEventListener("contextmenu",t,{capture:!0}),500);const a=e.currentTarget.getBoundingClientRect();return void fe(l,a.left+24,a.bottom)}t.rowProps.onKeyDown?.(e)},children:[a?/* @__PURE__ */C("span",{className:"es-list-hint","aria-hidden":"true",children:q.dragHint}):null,J?/* @__PURE__ */C("div",{className:"es-list-row-main",children:J(e,l,ve(l))}):/* @__PURE__ */I("button",{type:"button",className:"es-list-open","aria-expanded":r,onClick:()=>R(r?null:l),children:[w?/* @__PURE__ */C("span",{className:"es-list-thumb","aria-hidden":"true",children:w(e,l)}):null,
|
|
7
|
-
/* @__PURE__ */C("span",{className:"es-list-row-name",children:ne(e,l)}),/* @__PURE__ */C("span",c?{className:"es-list-row-summary",children:c(e,l)}:{className:"es-list-row-summary"}),
|
|
8
|
-
/* @__PURE__ */C(b,{size:14,className:"es-list-chev","aria-hidden":"true"})]}),A||K||!B?null:i?/* @__PURE__ */C("span",{className:"es-list-lock",role:"img","aria-label":H?H(e,l):Z.locked,title:H?H(e,l):Z.locked,children:/* @__PURE__ */C(f,{size:13})}):/* @__PURE__ */C("button",{type:"button",className:"es-list-x","aria-label":Z.deleteItem({noun:G}),title:Z.deleteItem({noun:G}),disabled:!_(l),onClick:()=>pe(l),children:"×"})]}),r?/* @__PURE__ */C("div",{className:"es-list-item",children:T(e,l,ve(l))}):null]},l)}),
|
|
9
|
-
/* @__PURE__ */C(n,{...he.seam({place:{...P,index:a.length}})})]}):null,A||K?null:/* @__PURE__ */C("button",{type:"button",className:"es-list-add",disabled:!U,onClick:()=>me(a.length),children:Z.add({noun:G})}),
|
|
10
|
-
/* @__PURE__ */C("span",{className:"es-list-said","aria-live":"polite",children:ce}),oe&&oe.index<a.length?/* @__PURE__ */C(s,{x:oe.x,y:oe.y,items:be(oe.index),onClose:()=>se(null)}):null]})}var A=(e,n)=>"string"==typeof e.label&&e.label?e.label:n;function M({field:e,name:n,id:l,value:t,onChange:a,readOnly:i,context:o,renderers:s}){const[c,u]=N(!0),d=t&&"object"==typeof t?t:{};/* @__PURE__ */
|
|
11
|
-
return C(r,{id:`${l}-group`,title:A(e,n),open:c,onToggle:u,children:Object.entries(e.objectFields).map(([e,t])=>/* @__PURE__ */C(T,{field:t,name:`${n}.${e}`,id:`${l}-${e}`,value:d[e],onChange:n=>a({...d,[e]:n}),readOnly:i,context:o,renderers:s},e))})}function R({field:e,name:n,id:l,value:t,onChange:a,readOnly:r,context:i,renderers:o,openItem:s,onOpenItem:c}){const[u,d]=N(null),m=c?s??null:u,p=c??d,h=Array.isArray(t)?t:[],b=e.getItemSummary;/* @__PURE__ */
|
|
12
|
-
return C(E,{label:A(e,n),icon:e.icon,noun:"string"==typeof e.noun?e.noun:void 0,items:h,onChange:a,newItem:()=>L({...e.defaultItemProps??{}}),summary:b?(e,n)=>b(e,n):void 0,min:e.min,max:e.max,readOnly:r,open:m,onOpen:p,renderItem:(t,a,s)=>Object.entries(e.arrayFields).map(([e,c])=>/* @__PURE__ */C(T,{field:c,name:`${n}[${a}].${e}`,id:`${l}-${a}-${e}`,value:t?.[e],onChange:n=>s({...t,[e]:n}),readOnly:r,context:i,renderers:o},e))})}function T(n){const{field:t,name:a,id:r,value:i,onChange:o,readOnly:s,context:d,renderers:m}=n;if(!t||t.marker||!1===t.visible)return null;const p=m?.[t.type];if(p)return p({field:t,name:a,id:r,value:i,onChange:o,readOnly:s});switch(t.type){case"custom":{const e={...d,field:t,name:a,id:r,value:i,onChange:o,readOnly:s};return t.render(e)}case"text":case"textarea":/* @__PURE__ */
|
|
13
|
-
return C(l,{label:A(t,a),htmlFor:r,icon:t.icon,hint:t.hint,children:/* @__PURE__ */C(S,{id:r,value:"string"==typeof i?i:null==i?"":String(i),onChange:o,placeholder:t.placeholder,multiline:"textarea"===t.type,readOnly:s})});case"number":/* @__PURE__ */
|
|
14
|
-
return C(l,{label:A(t,a),htmlFor:r,icon:t.icon,hint:t.hint,children:/* @__PURE__ */C(c,{id:r,value:"number"==typeof i?i:void 0,onChange:o,min:t.min,max:t.max,step:t.step,placeholder:t.placeholder,readOnly:s})});case"select":{const n=`${r}-label`;/* @__PURE__ */
|
|
15
|
-
return C(l,{label:A(t,a),labelId:n,htmlFor:r,icon:t.icon,hint:t.hint,children:/* @__PURE__ */C(e,{id:r,value:i,options:t.options,onChange:o,readOnly:s,ariaLabelledBy:n})})}case"radio":/* @__PURE__ */
|
|
16
|
-
return C(l,{label:A(t,a),icon:t.icon,hint:t.hint,children:/* @__PURE__ */C(u,{ariaLabel:A(t,a),value:i,options:t.options.map(e=>({id:e.value,label:e.label,icon:e.icon,disabled:e.disabled||s})),onChange:e=>{s||o(e)}})});case"object":/* @__PURE__ */
|
|
17
|
-
return C(M,{...n,field:t});case"array":/* @__PURE__ */
|
|
18
|
-
return C(R,{...n,field:t});case"slot":return null}}var J=e=>t.includes(e);function z(e){let n=t[0];const l=[],a=/* @__PURE__ */new Set;for(const[t,r]of Object.entries(e))r&&(J(r.bucket)&&(n=r.bucket),r.marker||!1===r.visible||(l.push({name:t,field:r,bucket:n}),"slot"!==r.type&&a.add(n)));return{rows:l,buckets:t.filter(e=>a.has(e))}}function H(e){return new Map(z(e).rows.map(e=>[e.name,e.bucket]))}function K({fields:e,values:n,onChange:l,readOnly:t=!1,context:r,tab:i,onTab:s,tabs:c=!0,tabIcons:u,renderers:d,idPrefix:p,ariaLabel:h,children:b}){const f=m("panel",o),v=w(),g=p??`es-insp${v.replace(/:/g,"")}`,y=z(e),[x,k]=N(void 0),O=i??x,S=O&&y.buckets.includes(O)?O:y.buckets[0],[D,j]=N(null),$=D&&D.panel===g&&y.rows.some(e=>e.name===D.name)?D:null,L=c&&y.buckets.length>1,F=`${g}-rows`,P=e=>`${g}-tab-${e.toLowerCase()}`;/* @__PURE__ */
|
|
19
|
-
return I("div",{className:"es-insp",children:[L?/* @__PURE__ */C("div",{className:"es-insp-tabs",children:/* @__PURE__ */C(a,{ariaLabel:h??f.settings,activeId:S,onSelect:e=>{const n=e;void 0===i&&k(n),s?.(n)},items:y.buckets.map(e=>({id:e,label:f.buckets[e],icon:u?.[e],htmlId:P(e),panelId:F}))})}):null,
|
|
20
|
-
/* @__PURE__ */I("div",{className:"es-insp-rows",id:F,role:L?"tabpanel":void 0,"aria-labelledby":L&&S?P(S):void 0,children:[y.rows.map(({name:e,field:a,bucket:i})=>/* @__PURE__ */C("div",{className:"es-insp-row","data-field":e,"data-bucket":i,hidden:!(!L||i===S)||void 0,children:/* @__PURE__ */C(T,{field:a,name:e,id:`${g}-${e}`,value:n[e],onChange:n=>l(e,n),readOnly:t,context:r,renderers:d,openItem:$&&$.name===e?$.index:null,onOpenItem:n=>j(null===n?null:{panel:g,name:e,index:n})})},e)),b]})]})}function B(e){return"select"===e.type?e.options:"groups"===e.type?e.groups.flatMap(e=>e.options):[]}function V({value:n,onChange:l,kinds:t,rules:a,filtersFor:r,label:i,readOnly:o}){const s=m("fields",d).link??d.link,[c,u]=N(null),[p,h]=N(null),b=c??a.kindOf(n),f=t.filter(e=>!e.hideWhenEmpty||B(e.target).length>0||e.value===b),v=f.find(e=>"text"===e.target.type),g=f.find(e=>e.value===b)??v??f[0];if(!g)return null;const y="text"!==g.target.type,x=y?a.targetOf(n):n,k=B(g.target),O=k.find(e=>e.value===x),w=e=>({value:e,label:s.unavailable({value:e})}),S="select"===g.target.type&&x&&r?r(x):null,D=S?a.readFilter(n):null,j=D?S?.find(e=>e.param===D.param):void 0,$=p&&p.against===n?p.text:n,L=!y&&""!==$.trim()&&!a.isSafe($),F=e=>{if(!e)return l("");const n=k.find(n=>n.value===e);l(e,n?.label)},P=(e,n)=>n&&!e.some(e=>e.value===n)?[w(n),...e]:[...e];let E;if("text"===g.target.type)E=/* @__PURE__ */C("input",{type:"text",className:"es-fin","aria-label":s.address,"aria-invalid":L||void 0,placeholder:s.addressPlaceholder,value:$,readOnly:o,onChange:e=>(e=>{const t=e.trim();t?a.isSafe(e)?(h({text:e,against:t}),l(t)):h({text:e,against:n}):(h({text:e,against:""}),l(""))})(e.target.value)});else{const n="groups"===g.target.type?g.target.groups.flatMap(e=>e.options.map(n=>({value:n.value,label:n.label,group:e.label}))):g.target.options.map(e=>({value:e.value,label:e.label}));E=/* @__PURE__ */C(e,{ariaLabel:g.label,value:x,options:[{value:"",label:g.target.placeholder},...P(n,x)],searchable:n.length>10,readOnly:o,onChange:F})}/* @__PURE__ */
|
|
21
|
-
return I("div",{className:"es-flink",role:i?"group":void 0,"aria-label":i,children:[
|
|
22
|
-
/* @__PURE__ */C(e,{ariaLabel:s.linkType,value:g.value,options:f.map(e=>({value:e.value,label:e.label})),readOnly:o,onChange:e=>{u(e),h(null);const n=f.find(n=>n.value===e);if(!n||"text"===n.target.type)return;const t=B(n.target)[0];t?l(t.value,t.label):l("")}}),E,S&&/* @__PURE__ */C(e,{ariaLabel:s.filter,value:D?.param??"",options:[{value:"",label:s.noFilter},...D&&!j?[w(D.param)]:[],...S.map(e=>({value:e.param,label:e.label}))],readOnly:o,onChange:e=>{if(!e)return l(x,O?.label);const n=S?.find(n=>n.param===e),t=n?.values[0];t&&l(a.withFilter(x,{param:e,value:t.value}),t.label)}}),S&&D&&/* @__PURE__ */C(e,{ariaLabel:s.value,value:D.value,options:P((j?.values??[]).map(e=>({value:e.value,label:e.label})),D.value),searchable:(j?.values.length??0)>10,readOnly:o,onChange:e=>{if(!D)return;const n=j?.values.find(n=>n.value===e);l(a.withFilter(x,{param:D.param,value:e}),n?.label)}}),L&&/* @__PURE__ */C("p",{className:"es-flink-error",role:"alert",children:s.unsafe}),g.hint&&/* @__PURE__ */C("p",{className:"es-flink-hint",children:g.hint}),S&&/* @__PURE__ */C("p",{className:"es-flink-hint",children:s.filterHint})]})}export{S as FieldText,K as Inspector,T as InspectorField,V as LinkPicker,E as ListField,H as bucketsOf,L as copyItem,D as insertAt,A as labelOf,j as moveTo,z as planFields,$ as removeAt};
|
package/dist/chunk-BZ5ASXOL.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
function e(e,t){return{"--es-fit-count":e,"--es-fit-labels":`${t.labelsPx}px`,"--es-fit-widest":`${t.widestLabelPx}px`}}export{e as wordFitVars};
|
package/dist/chunk-EOJNJCMJ.js
DELETED
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
import{useNumberEntry as e,clampNumber as l}from"./chunk-EWVJSRRY.js";import{DEFAULT_FIELDS_WORDS as a}from"./chunk-FPOKPNO4.js";import{useWords as r}from"./chunk-MFIRYGHW.js";import{useId as n,useState as s,useRef as t,useMemo as i,useEffect as o}from"react";import{jsx as u,jsxs as c,Fragment as d}from"react/jsx-runtime";function p(e,l){return e.find(e=>Object.is(e.value,l))}function h(e){const{id:l,options:h,placeholder:f,readOnly:m=!1,ariaLabel:v,ariaLabelledBy:b,searchable:g=!1,searchPlaceholder:y,groupCount:N=!1,inline:w=!1,renderOption:x}=e,k=r("fields",a),D=n(),C=n(),$=l??C,[O,A]=s(!1),[E,j]=s(0),[L,M]=s(""),S=t(null),V=t(null),K=t(null),F=t(null),P=y??k.search??a.search,I=!0===e.multiple,U=I&&Array.isArray(e.value)?e.value:[],R=e=>U.some(l=>Object.is(l,e.value)),W=I?void 0:p(h,e.value),H=W?h.indexOf(W):-1,Y=e=>I?R(h[e]):e===H,z=i(()=>{const e=g?L.trim().toLowerCase():"",l=[];return h.forEach((a,r)=>{e&&!a.label.toLowerCase().includes(e)||l.push(r)}),l},[h,L,g]),B=i(()=>new Set(z),[z]),G=z.filter(e=>!h[e].disabled),J=h.some(e=>void 0!==e.thumb),T=J||I||void 0!==x||h.some(e=>void 0!==e.meta),q=()=>{if(m||0===h.length)return;M("");const e=I?h.findIndex(e=>!e.disabled&&R(e)):H;j(e>=0?e:Math.max(h.findIndex(e=>!e.disabled),0)),A(!0)},Q=e=>{A(!1),M(""),e&&V.current?.focus()},X=l=>{const a=h[l];if(a&&!a.disabled){if(!0===e.multiple){const r=!R(a);return void e.onChange(h.filter((e,a)=>a===l?r:R(e)).map(e=>e.value))}Object.is(a.value,e.value)||e.onChange(a.value),Q(!0)}};o(()=>{if(!O)return;(g?F.current:K.current)?.focus();const e=S.current?.ownerDocument;if(!e)return;const l=e=>{S.current&&!S.current.contains(e.target)&&(A(!1),M(""))};return e.addEventListener("click",l,!0),()=>e.removeEventListener("click",l,!0)},[O,g]),o(()=>{O&&g&&j(G[0]??-1)},[L]);const Z=e=>{if(0===G.length)return;const l=G.indexOf(E),a=l<0?1===e?0:G.length-1:(l+e+G.length)%G.length;j(G[a])},_=e=>{switch(e.key){case"ArrowDown":return e.preventDefault(),Z(1),!0;case"ArrowUp":return e.preventDefault(),Z(-1),!0;case"Enter":return e.preventDefault(),B.has(E)&&X(E),!0;case"Escape":return e.preventDefault(),e.stopPropagation(),Q(!0),!0;case"Tab":return Q(!1),!0;default:return!1}},ee=(e,l)=>{if(!T)return e.label;const a={active:l===E,chosen:Y(l)};/* @__PURE__ */
|
|
2
|
-
return c(d,{children:[I?/* @__PURE__ */u("span",{className:"es-fsel-tick"+(a.chosen?" is-on":""),"aria-hidden":"true"}):null,J?/* @__PURE__ */u("span",{className:"es-fsel-thumb","aria-hidden":"true",children:e.thumb?/* @__PURE__ */u("img",{src:e.thumb,alt:"",loading:"lazy"}):null}):null,x?x(e,a):/* @__PURE__ */u("span",{className:"es-fsel-label",children:e.label}),void 0!==e.meta?/* @__PURE__ */u("span",{className:"es-fsel-meta","aria-hidden":"true",children:e.meta}):null]})},le=function(e,l){const a=[];return e.forEach((e,r)=>{if(!l.has(r))return;const n=a[a.length-1];n&&n.group===e.group?n.items.push({o:e,i:r}):a.push({group:e.group,items:[{o:e,i:r}]})}),a}(h,B),ae=le.map((e,l)=>{const a=e.items.map(({o:e,i:l})=>/* @__PURE__ */u("li",{id:`${D}-${l}`,role:"option","aria-selected":Y(l),"aria-disabled":e.disabled||void 0,className:`es-fsel-option${T?" es-fsel-option--rich":""}${l===E?" is-active":""}${Y(l)?" is-chosen":""}`,onMouseEnter:()=>j(l),onClick:()=>X(l),children:ee(e,l)},`${l}-${String(e.value)}`));if(void 0===e.group)return a;const r=`${D}-g${l}`;/* @__PURE__ */
|
|
3
|
-
return c("li",{role:"presentation",className:"es-fsel-group",children:[
|
|
4
|
-
/* @__PURE__ */c("div",{id:r,role:"presentation",className:"es-fsel-group-head",children:[e.group,N?/* @__PURE__ */u("span",{className:"es-fsel-group-count",children:e.items.length}):null]}),
|
|
5
|
-
/* @__PURE__ */u("ul",{role:"group","aria-labelledby":r,className:"es-fsel-group-list",children:a})]},`g${l}`)}),re=B.has(E)?`${D}-${E}`:void 0,ne=/* @__PURE__ */c("ul",{ref:K,id:D,role:"listbox",tabIndex:-1,className:"es-fsel-list","aria-multiselectable":I||void 0,"aria-activedescendant":g?void 0:re,"aria-labelledby":b??(v?void 0:$),"aria-label":b?void 0:v,onKeyDown:e=>{if(!_(e))switch(e.key){case"Home":return e.preventDefault(),void(G.length&&j(G[0]));case"End":return e.preventDefault(),void(G.length&&j(G[G.length-1]));case" ":return e.preventDefault(),void X(E);default:if(1===e.key.length&&/\S/.test(e.key)){const l=e.key.toLowerCase(),a=h.length;for(let e=1;e<=a;e++){const r=(E+e)%a;if(!h[r]?.disabled&&h[r]?.label.toLowerCase().startsWith(l))return void j(r)}}}},children:[ae,g&&0===z.length?/* @__PURE__ */u("li",{role:"presentation",className:"es-fsel-empty",children:k.noMatches??a.noMatches}):null]});let se,te;if(!0===e.multiple){const l=h.filter(R);te=0===l.length,se=e.renderValue?e.renderValue(l):te?f??k.choose:l.map(e=>e.label).join(", ")}else te=!W,se=e.renderValue?e.renderValue(W):W?W.label:f??k.choose;/* @__PURE__ */
|
|
6
|
-
return c("div",{className:"es-fsel"+(w?" es-fsel--inline":""),ref:S,children:[
|
|
7
|
-
/* @__PURE__ */c("button",{ref:V,id:$,type:"button",className:"es-fin es-fsel-button","aria-haspopup":"listbox","aria-expanded":O,"aria-controls":O?D:void 0,"aria-label":v,"aria-labelledby":b,disabled:m,onClick:()=>O?Q(!1):q(),onKeyDown:e=>{"ArrowDown"!==e.key&&"ArrowUp"!==e.key||(e.preventDefault(),q())},children:[
|
|
8
|
-
/* @__PURE__ */u("span",{className:te?"es-fsel-value is-empty":"es-fsel-value",children:se}),
|
|
9
|
-
/* @__PURE__ */u("span",{className:"es-fsel-chev","aria-hidden":"true"})]}),O?g?/* @__PURE__ */c("div",{className:"es-fsel-pop",children:[
|
|
10
|
-
/* @__PURE__ */u("input",{ref:F,type:"text",className:"es-fin es-fsel-search",value:L,placeholder:P,"aria-label":P,"aria-autocomplete":"list","aria-controls":D,"aria-activedescendant":re,onChange:e=>M(e.target.value),onKeyDown:e=>{_(e)}}),ne]}):ne:null]})}function f({id:a,label:r,value:s,onChange:t,min:i,max:o,step:d=1,shiftStep:p,styleValue:h,unit:f,sliderMin:m,sliderMax:v,auto:b,readOnly:g=!1}){const y=n(),N=a??y,{inputProps:w,set:x,isStyle:k}=e({value:s,onChange:t,min:i,max:o,step:d,shiftStep:p,styleValue:h,readOnly:g}),D="number"==typeof s&&Number.isFinite(s)?s:void 0,C=void 0!==b&&void 0===D,$=Number((m-d).toFixed(6)),O=void 0!==b?$:m,A=D??(void 0!==b?$:h??m);/* @__PURE__ */
|
|
11
|
-
return c("div",{className:"es-fslider"+(k||C?" is-style":""),children:[
|
|
12
|
-
/* @__PURE__ */c("div",{className:"es-fslider-top",children:[
|
|
13
|
-
/* @__PURE__ */u("label",{className:"es-fslider-name",htmlFor:N,children:r}),
|
|
14
|
-
/* @__PURE__ */c("span",{className:"es-fslider-read",children:[
|
|
15
|
-
/* @__PURE__ */u("input",{id:N,type:"text",inputMode:"decimal",className:"es-fslider-value",...w,placeholder:b??w.placeholder,onKeyDown:e=>{if(C&&("ArrowUp"===e.key||"ArrowDown"===e.key))return e.preventDefault(),void("ArrowUp"===e.key&&x(l(m,i,o)));w.onKeyDown(e)}}),f&&!C?/* @__PURE__ */u("span",{className:"es-fslider-unit",children:f}):null]})]}),
|
|
16
|
-
/* @__PURE__ */u("input",{type:"range",className:"es-fslider-range",min:O,max:v,step:d,value:l(A,O,v),disabled:g,"aria-label":r,"aria-valuetext":C?b:void 0,onChange:e=>{const l=Number(e.target.value);x(void 0!==b&&l<m?void 0:l)}})]})}export{h as FieldSelect,f as FieldSlider,p as optionFor};
|