efficient-easel 11.3.0 → 11.8.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 +20 -41
- package/dist/{canvas-typing-DvoqQINU.d.ts → canvas-typing-CC0wA-ys.d.ts} +16 -105
- package/dist/chrome/chrome.css +5 -5
- package/dist/{chunk-66LWADFP.js → chunk-2XMHLXMA.js} +1 -1
- package/dist/chunk-33C6ALT5.js +1 -0
- package/dist/{chunk-XJCMEEBH.js → chunk-36LVP5WD.js} +7 -7
- package/dist/{chunk-SJPKSE5G.js → chunk-5IUS6PM6.js} +12 -12
- package/dist/{chunk-FPAVNX3Y.js → chunk-5XUMLKQF.js} +3 -3
- package/dist/{chunk-PPL7GB7D.js → chunk-62VPYC7F.js} +1 -1
- package/dist/chunk-643PVCEG.js +1 -0
- package/dist/{chunk-TWFM6GNK.js → chunk-6IT5H37Y.js} +1 -1
- package/dist/{chunk-AFSSKGTD.js → chunk-6TJ2CIMY.js} +1 -1
- package/dist/{chunk-4ACVXF5V.js → chunk-7BRKNQF7.js} +1 -1
- package/dist/chunk-A6PY6C3C.js +1 -0
- package/dist/{chunk-XWK7WZQS.js → chunk-ATF2T5CI.js} +1 -1
- package/dist/chunk-AYWN5NRH.js +1 -0
- package/dist/chunk-DE35IQ4T.js +57 -0
- package/dist/{chunk-PPHUWGLZ.js → chunk-EC2I7SIY.js} +1 -1
- package/dist/{chunk-DGAXQTDW.js → chunk-FHLYUIJJ.js} +1 -1
- package/dist/{chunk-65Z5FSAW.js → chunk-G3GWAP5R.js} +5 -5
- package/dist/{chunk-2FZJWH24.js → chunk-H4UMY7QF.js} +1 -1
- package/dist/chunk-H6IXH4A3.js +1 -0
- package/dist/{chunk-EXKKLTXH.js → chunk-HRUMNRYI.js} +1 -1
- package/dist/chunk-JHYKRGRA.js +5 -0
- package/dist/chunk-JRRYFSCY.js +5 -0
- package/dist/chunk-KEWQZYUF.js +7 -0
- package/dist/{chunk-IFS5P7CO.js → chunk-LZS7JZK5.js} +1 -1
- package/dist/{chunk-FGJSCWUN.js → chunk-NY7HHUGB.js} +2 -2
- package/dist/chunk-PS5BWS4I.js +2 -0
- package/dist/{chunk-47RGVCPH.js → chunk-QFVRMARS.js} +12 -12
- package/dist/chunk-TBF5CVPA.js +1 -0
- package/dist/{chunk-26GHWMNN.js → chunk-UBAYMWCX.js} +19 -19
- package/dist/chunk-UMDQ6CLQ.js +2 -0
- package/dist/{chunk-ZXGQT75B.js → chunk-URC5Y5G2.js} +1 -1
- package/dist/chunk-VVPZMWJE.js +1 -0
- package/dist/chunk-WRFD4EXD.js +1 -0
- package/dist/chunk-YHZSBL2N.js +1 -0
- package/dist/copy/copy.css +8 -108
- package/dist/copy/index.d.ts +39 -9
- package/dist/copy/index.js +18 -19
- package/dist/drag/drag.css +8 -8
- package/dist/drag/index.js +1 -1
- package/dist/easel/index.d.ts +3 -3
- package/dist/easel/index.js +1 -1
- package/dist/fields/fields.css +8 -8
- package/dist/fields/index.js +1 -1
- package/dist/gold/index.d.ts +3 -3
- package/dist/gold/index.js +1 -1
- package/dist/icons/index.d.ts +1 -0
- package/dist/markup/index.d.ts +1 -629
- package/dist/markup/index.js +1 -1
- package/dist/menu/menu.css +1 -1
- package/dist/panel/index.js +1 -1
- package/dist/panel/panel.css +12 -12
- package/dist/pick/index.js +1 -1
- package/dist/pick/pick.css +7 -7
- 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.js +1 -1
- package/dist/screen/components/PageEditGuardNotices.js +1 -1
- package/dist/screen/components/PanelToggleIcon.d.ts +6 -5
- package/dist/screen/components/PanelToggleIcon.js +1 -1
- package/dist/screen/components/ScreenChrome.js +1 -1
- package/dist/screen/components/ScreenDocumentContext.js +1 -1
- package/dist/screen/components/ScreenMount.js +1 -1
- package/dist/screen/components/ScreenStoreProvider.js +1 -1
- package/dist/screen/components/SectionScreenShell.js +16 -16
- package/dist/screen/components/SidePanelHead.js +1 -1
- package/dist/screen/components/usePartBridge.js +1 -1
- package/dist/screen/index.js +1 -1
- package/dist/screen/lib/key-scope.js +1 -1
- package/dist/screen/lib/puck/device-fields.js +1 -1
- package/dist/screen/lib/puck/slot-child-name.js +1 -1
- package/dist/screen/lib/puck/style-clipboard.js +1 -1
- package/dist/screen/lib/puck/use-section-ops.js +1 -1
- package/dist/screen/lib/screen-parts.js +1 -1
- package/dist/screen/screen.css +16 -16
- package/dist/screen/words.js +1 -1
- package/dist/shell/shell.css +10 -8
- 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.d.ts +4 -231
- package/dist/text-styles/index.js +35 -35
- package/dist/text-styles/model.d.ts +259 -0
- package/dist/text-styles/model.js +1 -0
- package/dist/text-styles/text-styles.css +6 -6
- package/dist/{words-dsex49Jh.d.ts → words-CiuKuiy0.d.ts} +12 -6
- package/package.json +6 -1
- package/dist/chunk-546BBOPE.js +0 -1
- package/dist/chunk-AZOCY74V.js +0 -57
- package/dist/chunk-BHRC3ASL.js +0 -1
- package/dist/chunk-BPFPM3L4.js +0 -7
- package/dist/chunk-DD7A6RRL.js +0 -5
- package/dist/chunk-EQFBUNEB.js +0 -1
- package/dist/chunk-FAAZZXIS.js +0 -1
- package/dist/chunk-FFYXVAAL.js +0 -1
- package/dist/chunk-GCCBEY2W.js +0 -2
- package/dist/chunk-GG4FGBFR.js +0 -1
- package/dist/chunk-KQMML6JM.js +0 -4
- package/dist/chunk-Q6AM43CA.js +0 -1
- package/dist/chunk-U7KFFC7N.js +0 -5
- package/dist/chunk-VWXUMVCD.js +0 -1
- package/dist/chunk-ZAOM6PFH.js +0 -1
|
@@ -0,0 +1,259 @@
|
|
|
1
|
+
import { T as TextStylesWords } from '../words-gIDCeRv3.js';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* The text styles as data (plan step E6): what a style is, the list both
|
|
5
|
+
* editors start from, the design's ranges, and the pure changes the list
|
|
6
|
+
* makes. No React and no browser global, so P3 and S2 can use it where they
|
|
7
|
+
* read and write their own storage.
|
|
8
|
+
*
|
|
9
|
+
* What this does NOT know is where a host keeps its styles, or what its old
|
|
10
|
+
* values were called. Turning an email's "Label" into Body 5, or the website's
|
|
11
|
+
* "Tight" into 95 % / −0.01 em, is the host's (P3, S2). The units here are the
|
|
12
|
+
* panel's: px, and % for line spacing.
|
|
13
|
+
*/
|
|
14
|
+
|
|
15
|
+
type TextStyleKind = 'heading' | 'body';
|
|
16
|
+
/**
|
|
17
|
+
* The letter cases, in the panel's order: As typed · Uppercase · Capitalized ·
|
|
18
|
+
* Lowercase (Lewis 2026-10-15, S4: Capitalized is kept in both editors). This
|
|
19
|
+
* is the ONE list of them: the text styles, the text part panel and every host
|
|
20
|
+
* read it, so a case cannot be offered in one place and dropped in another.
|
|
21
|
+
* No value on a style = Auto where the host offers it, As typed where not.
|
|
22
|
+
*/
|
|
23
|
+
declare const TEXT_STYLE_CASES: readonly ["none", "upper", "capitalize", "lower"];
|
|
24
|
+
type TextStyleCase = (typeof TEXT_STYLE_CASES)[number];
|
|
25
|
+
/**
|
|
26
|
+
* The CSS `text-transform` each case draws. `none` is a real declaration, so a
|
|
27
|
+
* case can beat a built-in uppercase class. A host that stores the CSS word
|
|
28
|
+
* itself (the campaign designer's boxes) turns it back with
|
|
29
|
+
* {@link textStyleCaseOfCss}; it never keeps a table of its own.
|
|
30
|
+
*/
|
|
31
|
+
declare const TEXT_STYLE_CASE_CSS: {
|
|
32
|
+
readonly none: "none";
|
|
33
|
+
readonly upper: "uppercase";
|
|
34
|
+
readonly capitalize: "capitalize";
|
|
35
|
+
readonly lower: "lowercase";
|
|
36
|
+
};
|
|
37
|
+
type TextStyleCaseCss = (typeof TEXT_STYLE_CASE_CSS)[TextStyleCase];
|
|
38
|
+
/** True for one of the four cases, and for nothing else a document may hold. */
|
|
39
|
+
declare function isTextStyleCase(value: unknown): value is TextStyleCase;
|
|
40
|
+
/** The `text-transform` a case draws, or `undefined` for no case (or a word
|
|
41
|
+
* that is not one of the four). */
|
|
42
|
+
declare function textStyleCaseCss(value: unknown): TextStyleCaseCss | undefined;
|
|
43
|
+
/** The case a `text-transform` word is, or `undefined` for anything else
|
|
44
|
+
* (`full-width`, an empty string, junk). */
|
|
45
|
+
declare function textStyleCaseOfCss(css: unknown): TextStyleCase | undefined;
|
|
46
|
+
/**
|
|
47
|
+
* One style's own settings. A missing key has nothing of its own: it is Auto
|
|
48
|
+
* where the host offers Auto for that setting, and otherwise shows the host's
|
|
49
|
+
* `fallback`, grey.
|
|
50
|
+
*/
|
|
51
|
+
interface TextStyleValues {
|
|
52
|
+
/** A font's `value`, from the host's list. */
|
|
53
|
+
font?: string;
|
|
54
|
+
/** A theme colour's `key`, or a `#rrggbb`. */
|
|
55
|
+
color?: string;
|
|
56
|
+
/** px. */
|
|
57
|
+
size?: number;
|
|
58
|
+
/** 100–900. */
|
|
59
|
+
weight?: number;
|
|
60
|
+
italic?: boolean;
|
|
61
|
+
/** % of the font size; below 100 is tighter than the type. */
|
|
62
|
+
lineSpacing?: number;
|
|
63
|
+
/** px; may be negative. */
|
|
64
|
+
letterSpacing?: number;
|
|
65
|
+
/** px. */
|
|
66
|
+
paragraphSpacing?: number;
|
|
67
|
+
letterCase?: TextStyleCase;
|
|
68
|
+
/** px; headings only — the largest a heading is drawn anywhere on the site. */
|
|
69
|
+
largestSize?: number;
|
|
70
|
+
}
|
|
71
|
+
interface TextStyle {
|
|
72
|
+
/** The host's, stable: the list never renames an id. */
|
|
73
|
+
id: string;
|
|
74
|
+
kind: TextStyleKind;
|
|
75
|
+
/** Stored, so the host's words: "Heading 1", "Body 5". */
|
|
76
|
+
name: string;
|
|
77
|
+
values: TextStyleValues;
|
|
78
|
+
}
|
|
79
|
+
/** A font the host offers. */
|
|
80
|
+
interface TextStyleFont {
|
|
81
|
+
value: string;
|
|
82
|
+
label: string;
|
|
83
|
+
/** The CSS `font-family` the list draws the name and the preview in. */
|
|
84
|
+
family: string;
|
|
85
|
+
/** `false` when this font has no italic loaded: the Italic button is off. */
|
|
86
|
+
italic?: boolean;
|
|
87
|
+
}
|
|
88
|
+
/** A theme colour the host offers, stored by its key. */
|
|
89
|
+
interface TextStyleColour {
|
|
90
|
+
key: string;
|
|
91
|
+
name: string;
|
|
92
|
+
/** `#rrggbb`. */
|
|
93
|
+
value: string;
|
|
94
|
+
}
|
|
95
|
+
/** Every setting an open style can show, in the order it shows them. */
|
|
96
|
+
declare const TEXT_STYLE_SETTINGS: readonly ["font", "color", "size", "weight", "emphasis", "lineSpacing", "letterSpacing", "paragraphSpacing", "letterCase", "largestSize"];
|
|
97
|
+
type TextStyleSetting = (typeof TEXT_STYLE_SETTINGS)[number];
|
|
98
|
+
/** The settings an Email styles list shows — the campaign design page. */
|
|
99
|
+
declare const CAMPAIGN_TEXT_STYLE_SETTINGS: readonly TextStyleSetting[];
|
|
100
|
+
/** The settings that may be Auto, when the host says so (Site styles). */
|
|
101
|
+
type TextStyleAuto = 'size' | 'lineSpacing' | 'letterSpacing' | 'letterCase';
|
|
102
|
+
/** The kinds, in the order the list draws them. */
|
|
103
|
+
declare const TEXT_STYLE_KINDS: readonly TextStyleKind[];
|
|
104
|
+
/** At most this many of EACH kind (Lewis, 2026-10-02). */
|
|
105
|
+
declare const TEXT_STYLE_MAX = 7;
|
|
106
|
+
/** How many of each the list starts with: Heading 1–3, Body 1–5. */
|
|
107
|
+
declare const TEXT_STYLE_DEFAULT_COUNT: Readonly<Record<TextStyleKind, number>>;
|
|
108
|
+
/** A number setting's slider: its travel, the typed limits, the steps and the unit. */
|
|
109
|
+
interface TextStyleRange {
|
|
110
|
+
/** The lowest a typed value may be; `undefined` = no limit. */
|
|
111
|
+
min: number | undefined;
|
|
112
|
+
/** The highest a typed value may be; `undefined` = no limit. */
|
|
113
|
+
max: number | undefined;
|
|
114
|
+
sliderMin: number;
|
|
115
|
+
sliderMax: number;
|
|
116
|
+
step: number;
|
|
117
|
+
shiftStep: number;
|
|
118
|
+
unit: string;
|
|
119
|
+
}
|
|
120
|
+
/**
|
|
121
|
+
* The design's numbers (campaign page, "the three boxes' rules" and the slider
|
|
122
|
+
* ranges; website page §5). A typed value may go past the slider; only `min`
|
|
123
|
+
* and `max` hold it. Line spacing down to 50 % and letter spacing down to
|
|
124
|
+
* −10 px are Lewis's (2026-10-06).
|
|
125
|
+
*/
|
|
126
|
+
declare const TEXT_STYLE_RANGES: {
|
|
127
|
+
readonly size: TextStyleRange;
|
|
128
|
+
readonly weight: {
|
|
129
|
+
readonly min: 100;
|
|
130
|
+
readonly max: 900;
|
|
131
|
+
readonly sliderMin: 300;
|
|
132
|
+
readonly sliderMax: 900;
|
|
133
|
+
readonly step: 100;
|
|
134
|
+
readonly shiftStep: 100;
|
|
135
|
+
readonly unit: "";
|
|
136
|
+
};
|
|
137
|
+
readonly lineSpacing: {
|
|
138
|
+
readonly min: 50;
|
|
139
|
+
readonly max: 250;
|
|
140
|
+
readonly sliderMin: 50;
|
|
141
|
+
readonly sliderMax: 250;
|
|
142
|
+
readonly step: 1;
|
|
143
|
+
readonly shiftStep: 10;
|
|
144
|
+
readonly unit: "%";
|
|
145
|
+
};
|
|
146
|
+
readonly letterSpacing: {
|
|
147
|
+
readonly min: -10;
|
|
148
|
+
readonly max: undefined;
|
|
149
|
+
readonly sliderMin: -5;
|
|
150
|
+
readonly sliderMax: 10;
|
|
151
|
+
readonly step: 0.1;
|
|
152
|
+
readonly shiftStep: 1;
|
|
153
|
+
readonly unit: "px";
|
|
154
|
+
};
|
|
155
|
+
readonly paragraphSpacing: {
|
|
156
|
+
readonly min: 0;
|
|
157
|
+
readonly max: undefined;
|
|
158
|
+
readonly sliderMin: 0;
|
|
159
|
+
readonly sliderMax: 48;
|
|
160
|
+
readonly step: 1;
|
|
161
|
+
readonly shiftStep: 10;
|
|
162
|
+
readonly unit: "px";
|
|
163
|
+
};
|
|
164
|
+
readonly largestSize: TextStyleRange;
|
|
165
|
+
};
|
|
166
|
+
type TextStyleNumber = keyof typeof TEXT_STYLE_RANGES;
|
|
167
|
+
/** Heading 1–3 then Body 1–5, ids `heading-1` … `body-5`, no values: the host fills them. */
|
|
168
|
+
declare function defaultTextStyles(name?: (v: {
|
|
169
|
+
kind: TextStyleKind;
|
|
170
|
+
n: number;
|
|
171
|
+
}) => string): TextStyle[];
|
|
172
|
+
/** Whether another style of this kind fits under the cap. */
|
|
173
|
+
declare function canAddTextStyle(styles: readonly TextStyle[], kind: TextStyleKind, max?: number): boolean;
|
|
174
|
+
/**
|
|
175
|
+
* Whether a style is one the list starts with (Heading 1–3, Body 1–5), which
|
|
176
|
+
* can never be deleted. Decided by the fixed id (`heading-1` … `body-5`),
|
|
177
|
+
* never by the name: a host's words name the styles.
|
|
178
|
+
*/
|
|
179
|
+
declare function isDefaultTextStyle(style: TextStyle): boolean;
|
|
180
|
+
/**
|
|
181
|
+
* A new style of `kind`, after the last one of that kind: a copy of that
|
|
182
|
+
* one's values, named the next free number ("Heading 4"). `null` at the cap.
|
|
183
|
+
* The list given is not changed.
|
|
184
|
+
*
|
|
185
|
+
* The name and the id are chosen apart. The name is the next number after
|
|
186
|
+
* the styles of its kind, skipping a name already taken, so after a delete
|
|
187
|
+
* the names have no gap. The id is above every id of its kind
|
|
188
|
+
* (`heading-7` when `heading-6` is there), and the name's number when that
|
|
189
|
+
* is higher. So an id freed by a delete is used again only when it was the
|
|
190
|
+
* highest of its kind, and then the new style is a copy of the one that
|
|
191
|
+
* id's text was already drawn as (`resolveTextStyle`): nothing on the page
|
|
192
|
+
* jumps.
|
|
193
|
+
*
|
|
194
|
+
* `make` lets a host build the new style itself (its own ids); it gets the
|
|
195
|
+
* kind and the number the new style is called.
|
|
196
|
+
*/
|
|
197
|
+
declare function addTextStyle(styles: readonly TextStyle[], kind: TextStyleKind, options?: {
|
|
198
|
+
max?: number;
|
|
199
|
+
name?: (v: {
|
|
200
|
+
kind: TextStyleKind;
|
|
201
|
+
n: number;
|
|
202
|
+
}) => string;
|
|
203
|
+
make?: (kind: TextStyleKind, n: number) => TextStyle;
|
|
204
|
+
}): {
|
|
205
|
+
styles: TextStyle[];
|
|
206
|
+
added: TextStyle;
|
|
207
|
+
} | null;
|
|
208
|
+
/**
|
|
209
|
+
* The list without one ADDED style. `null` for a default (they are never
|
|
210
|
+
* deleted) or an id not in the list. The list given is not changed.
|
|
211
|
+
*
|
|
212
|
+
* The styles of its kind after it close the gap by NAME — "Heading 5" becomes
|
|
213
|
+
* "Heading 4" — when their name is still the number of their place. Their
|
|
214
|
+
* ids never change, so text on them stays on them. Text on the deleted one
|
|
215
|
+
* is not rewritten: `resolveTextStyle` draws it as the nearest earlier style
|
|
216
|
+
* of its kind.
|
|
217
|
+
*
|
|
218
|
+
* `name` is the host's words for a style's name, as `addTextStyle` takes it.
|
|
219
|
+
*/
|
|
220
|
+
declare function removeTextStyle(styles: readonly TextStyle[], id: string, options?: {
|
|
221
|
+
name?: (v: {
|
|
222
|
+
kind: TextStyleKind;
|
|
223
|
+
n: number;
|
|
224
|
+
}) => string;
|
|
225
|
+
}): {
|
|
226
|
+
styles: TextStyle[];
|
|
227
|
+
removed: TextStyle;
|
|
228
|
+
} | null;
|
|
229
|
+
/**
|
|
230
|
+
* The style text on `id` draws as: that style, or — when it was deleted —
|
|
231
|
+
* the nearest EARLIER style of its kind still in the list (`heading-5` gone:
|
|
232
|
+
* Heading 4's id, else `heading-3`). The defaults are never deleted, so an
|
|
233
|
+
* id the model made always finds one. `undefined` for an id the model did
|
|
234
|
+
* not make (a host's own, through `make`): that host resolves its own.
|
|
235
|
+
*
|
|
236
|
+
* Read every stored style id through this, so a deleted style's text keeps
|
|
237
|
+
* drawing — in a saved page and in a sent email alike — and nothing stored
|
|
238
|
+
* is rewritten.
|
|
239
|
+
*/
|
|
240
|
+
declare function resolveTextStyle(styles: readonly TextStyle[], id: string): TextStyle | undefined;
|
|
241
|
+
/**
|
|
242
|
+
* The list with one style's values changed. A key given as `undefined` is
|
|
243
|
+
* removed: the setting has nothing of its own again. Nothing is changed in
|
|
244
|
+
* place, and the other styles are the same objects.
|
|
245
|
+
*/
|
|
246
|
+
declare function updateTextStyle(styles: readonly TextStyle[], id: string, patch: Partial<TextStyleValues>): TextStyle[];
|
|
247
|
+
/** The size a style's NAME is drawn at in the list: half its size plus 6, kept within 12–20 px. */
|
|
248
|
+
declare function textStyleRowSize(px: number): number;
|
|
249
|
+
/** A weight's name, by the hundred it is nearest. */
|
|
250
|
+
declare function weightWord(weight: number, words: TextStylesWords): string;
|
|
251
|
+
/**
|
|
252
|
+
* A row's grey line, "Playfair Display · 28 px · Semibold". `autoSize`: a
|
|
253
|
+
* size with no number reads the Auto word. A weight with none is Regular.
|
|
254
|
+
*/
|
|
255
|
+
declare function describeTextStyle(values: TextStyleValues, fonts: readonly TextStyleFont[], words: TextStylesWords, options?: {
|
|
256
|
+
autoSize?: boolean;
|
|
257
|
+
}): string;
|
|
258
|
+
|
|
259
|
+
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, type TextStyle, type TextStyleAuto, type TextStyleCase, type TextStyleCaseCss, type TextStyleColour, type TextStyleFont, type TextStyleKind, type TextStyleNumber, type TextStyleRange, type TextStyleSetting, type TextStyleValues, addTextStyle, canAddTextStyle, defaultTextStyles, describeTextStyle, isDefaultTextStyle, isTextStyleCase, removeTextStyle, resolveTextStyle, textStyleCaseCss, textStyleCaseOfCss, textStyleRowSize, updateTextStyle, weightWord };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
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";
|
|
@@ -37,7 +37,7 @@
|
|
|
37
37
|
|
|
38
38
|
.es-ts-group {
|
|
39
39
|
margin: 0 0 var(--es-space-4, 4px);
|
|
40
|
-
font-size: 11px;
|
|
40
|
+
font-size: var(--text-2xs, 11px);
|
|
41
41
|
font-weight: 600;
|
|
42
42
|
letter-spacing: 0.06em;
|
|
43
43
|
text-transform: uppercase;
|
|
@@ -151,7 +151,7 @@
|
|
|
151
151
|
overflow: hidden;
|
|
152
152
|
text-overflow: ellipsis;
|
|
153
153
|
white-space: nowrap;
|
|
154
|
-
font-size: 12px;
|
|
154
|
+
font-size: var(--text-xs, 12px);
|
|
155
155
|
line-height: 1.4;
|
|
156
156
|
color: var(--es-muted, var(--ink-faint));
|
|
157
157
|
}
|
|
@@ -196,7 +196,7 @@
|
|
|
196
196
|
overflow: hidden;
|
|
197
197
|
text-overflow: ellipsis;
|
|
198
198
|
white-space: nowrap;
|
|
199
|
-
font-size: 12px;
|
|
199
|
+
font-size: var(--text-xs, 12px);
|
|
200
200
|
font-weight: 500;
|
|
201
201
|
color: var(--es-text-secondary, var(--ink));
|
|
202
202
|
}
|
|
@@ -240,7 +240,7 @@
|
|
|
240
240
|
.es-ts-icon--word {
|
|
241
241
|
width: auto;
|
|
242
242
|
padding: 0 var(--es-space-8, 8px);
|
|
243
|
-
font-size: 14px;
|
|
243
|
+
font-size: var(--text-sm, 14px);
|
|
244
244
|
font-weight: 500;
|
|
245
245
|
}
|
|
246
246
|
|
|
@@ -262,7 +262,7 @@
|
|
|
262
262
|
justify-content: space-between;
|
|
263
263
|
gap: var(--es-space-8, 8px);
|
|
264
264
|
padding: var(--es-space-12, 12px) 0 0;
|
|
265
|
-
font-size: 14px;
|
|
265
|
+
font-size: var(--text-sm, 14px);
|
|
266
266
|
font-weight: 500;
|
|
267
267
|
color: var(--es-accent, var(--accent-600, var(--submit-bg)));
|
|
268
268
|
cursor: pointer;
|
|
@@ -271,7 +271,7 @@
|
|
|
271
271
|
.es-ts-add:disabled,
|
|
272
272
|
.es-ts-add[aria-disabled='true'] { color: var(--es-disabled, var(--ink-faintest)); cursor: not-allowed; }
|
|
273
273
|
.es-ts-count {
|
|
274
|
-
font-size: 12px;
|
|
274
|
+
font-size: var(--text-xs, 12px);
|
|
275
275
|
font-weight: 400;
|
|
276
276
|
color: var(--es-field-placeholder, var(--ink-faintest));
|
|
277
277
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { MarkStyle, MarkPlaceholders } from '
|
|
1
|
+
import { MarkStyle, MarkPlaceholders } from 'efficient-shell/markup';
|
|
2
2
|
import { ReactNode } from 'react';
|
|
3
3
|
|
|
4
4
|
/**
|
|
@@ -100,7 +100,7 @@ declare function copyAlignOptions(allow: readonly CopyAlign[], labels?: Record<C
|
|
|
100
100
|
* catalogue's (`ShellStringsProvider`, `link`).
|
|
101
101
|
*
|
|
102
102
|
* NO REACT here, and no import but the grammar: the marks' names, tooltips and
|
|
103
|
-
* placeholders are READ from `efficient-
|
|
103
|
+
* placeholders are READ from `efficient-shell/markup` (`MARKUP_TOOLS`,
|
|
104
104
|
* `MARK_PLACEHOLDERS`) rather than typed a second time, so the English lives
|
|
105
105
|
* once, in the grammar, where the campaign designer's own toolbar reads it too.
|
|
106
106
|
*/
|
|
@@ -117,6 +117,10 @@ type CopyWords = {
|
|
|
117
117
|
* `name` is what the button is called; `title` its tooltip, which also says
|
|
118
118
|
* what the mark writes and its shortcut. A host's own descriptors
|
|
119
119
|
* (`MarkupTool[]`) are used as given and never read these.
|
|
120
|
+
*
|
|
121
|
+
* @deprecated Read by nothing since the copy box's one bar became the shell's
|
|
122
|
+
* `TextToolbar`, which names its buttons in the shell catalogue
|
|
123
|
+
* (`ShellStringsProvider`, `textToolbar`). Removed in 12.0.0.
|
|
120
124
|
*/
|
|
121
125
|
marks: Record<MarkStyle, {
|
|
122
126
|
name: string;
|
|
@@ -128,11 +132,13 @@ type CopyWords = {
|
|
|
128
132
|
* (E5a). Optional, so a host's words from before still type; English when
|
|
129
133
|
* left out. */
|
|
130
134
|
showMarks?: string;
|
|
131
|
-
/** Clear changes
|
|
132
|
-
*
|
|
133
|
-
*
|
|
134
|
-
*
|
|
135
|
+
/** "Clear changes": the Style list's item in the one text panel
|
|
136
|
+
* (`TextPartPanel`). It was also a button on the line under the box until
|
|
137
|
+
* Lewis took that out (2026-10-19). Optional, so a host's words from before
|
|
138
|
+
* still type; English when left out. */
|
|
135
139
|
clearStyle?: string;
|
|
140
|
+
/** @deprecated The tooltip of the button under the box, which is gone
|
|
141
|
+
* (2026-10-19). Read by nothing; removed in 12.0.0. */
|
|
136
142
|
clearStyleEmpty?: string;
|
|
137
143
|
/** The colour window: its name, the theme row's label, and Remove. */
|
|
138
144
|
colors?: {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "efficient-easel",
|
|
3
|
-
"version": "11.
|
|
3
|
+
"version": "11.8.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",
|
|
@@ -102,6 +102,11 @@
|
|
|
102
102
|
"import": "./dist/text-styles/index.js",
|
|
103
103
|
"default": "./dist/text-styles/index.js"
|
|
104
104
|
},
|
|
105
|
+
"./text-styles/model": {
|
|
106
|
+
"types": "./dist/text-styles/model.d.ts",
|
|
107
|
+
"import": "./dist/text-styles/model.js",
|
|
108
|
+
"default": "./dist/text-styles/model.js"
|
|
109
|
+
},
|
|
105
110
|
"./text-styles.css": "./dist/text-styles/text-styles.css",
|
|
106
111
|
"./easel": {
|
|
107
112
|
"types": "./dist/easel/index.d.ts",
|
package/dist/chunk-546BBOPE.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
var e={bold:{open:"**",close:"**",placeholder:"bold text"},italic:{open:"_",close:"_",placeholder:"italic text"},strike:{open:"~~",close:"~~",placeholder:"struck out"},code:{open:"`",close:"`",placeholder:"code"},highlight:{open:"==",close:"==",placeholder:"highlighted text"},quiet:{open:"^^",close:"^^",placeholder:"quiet text"},underline:{open:"[",close:"]{underline}",placeholder:"underlined text"},sup:{open:"[",close:"]{sup}",placeholder:"superscript"},sub:{open:"[",close:"]{sub}",placeholder:"subscript"}};function t(e){return/^[a-z][a-z0-9-]*$/.test(e)}function n(e){return t(e)||/^#[0-9a-fA-F]{6}$/.test(e)}function l(e){return n(e)?e.startsWith("#")?e.toLowerCase():e:null}function r(e,t){const n=/^\{(underline|sup|sub|color=([a-z][a-z0-9-]*|#[0-9a-fA-F]{6}))\}/.exec(e.slice(t,t+64));return n?void 0===n[2]?{kind:n[1],length:n[0].length}:{kind:"color",color:n[2],length:n[0].length}:null}var s={bold:e.bold.placeholder,italic:e.italic.placeholder,strike:e.strike.placeholder,code:e.code.placeholder,highlight:e.highlight.placeholder,quiet:e.quiet.placeholder,link:"link text",underline:e.underline.placeholder,sup:e.sup.placeholder,sub:e.sub.placeholder,color:"colored text"},i={bullet:()=>"- ",number:e=>`${e+1}. `,quote:()=>"> "};function o(t,n,l,r,o=k,c=s){if("clear"===r)return N(t,n,l,o);const u=t.slice(n,l);if("link"===r){const e=u||c.link,r=`[${e}](https://)`;return{text:t.slice(0,n)+r+t.slice(l),selectionStart:n+e.length+3,selectionEnd:n+r.length-1}}const h=i[r];if(h){const e=t.lastIndexOf("\n",Math.max(n-1,0))+1,r=t.indexOf("\n",l),s=-1===r?t.length:r,i=t.slice(e,s).split("\n"),o=i.every((e,t)=>e.startsWith(h(t))),c=i.map((e,t)=>o?e.slice(h(t).length):h(t)+e).join("\n");return{text:t.slice(0,e)+c+t.slice(s),selectionStart:e,selectionEnd:e+c.length}}const{open:f,close:d}=e[r],m=r,p=c[m]??s[m];if(a(t,n,l,r))return{text:t.slice(0,n-f.length)+u+t.slice(l+d.length),selectionStart:n-f.length,selectionEnd:n-f.length+u.length};const b=u||p;return{text:t.slice(0,n)+f+b+d+t.slice(l),selectionStart:n+f.length,selectionEnd:n+f.length+b.length}}function c(e,t,n,i,o=s){const c={text:e,selectionStart:t,selectionEnd:n};if(null!==i){const e=l(i);if(null===e)return c;i=e}const a=e.slice(t,n),u=t>=1&&"["===e[t-1]&&"]"===e[n]?r(e,n+1):null;if("color"===u?.kind){const l=t-1,r=e.slice(n+1+u.length);return null===i?{text:e.slice(0,l)+a+r,selectionStart:l,selectionEnd:l+a.length}:{text:`${e.slice(0,n)}]{color=${i}}${r}`,selectionStart:t,selectionEnd:n}}if(null===i)return c;const h=a||(o.color??s.color);return{text:`${e.slice(0,t)}[${h}]{color=${i}}${e.slice(n)}`,selectionStart:t+1,selectionEnd:t+1+h.length}}function a(t,n,l,r){const s=e[r];if(!s)return!1;const{open:i,close:o}=s;return n>=i.length&&t.slice(n-i.length,n)===i&&t.slice(l,l+o.length)===o}function u(e,t,n){const l=0===t?0:e.lastIndexOf("\n",t-1)+1;for(let r=e.lastIndexOf("[",t);r>=l;r=0===r?-1:e.lastIndexOf("[",r-1)){const t=B(e,r);if(t&&n<=t.end)return{start:r,end:t.end,label:t.label,href:t.href}}return null}function h(e,t,n,l){const r=u(e,t,n),s=r?r.start:t,i=r?r.end:n,o=`[${r?r.label:e.slice(t,n)||l}](${l})`,c=s+o.length;return{text:e.slice(0,s)+o+e.slice(i),selectionStart:c,selectionEnd:c}}function f(e,t){return{text:e.slice(0,t.start)+t.label+e.slice(t.end),selectionStart:t.start,selectionEnd:t.start+t.label.length}}var d=[{style:"bold",label:"B",name:"Strong",title:"Strong · **words** · ⌘B",shortcut:"b"},{style:"italic",label:"I",name:"Italic",title:"Italic · _words_ · ⌘I",shortcut:"i"},{style:"strike",label:"S",name:"Strikethrough",title:"Strikethrough · ~~words~~"},{style:"highlight",label:"◆",name:"Emphasis",title:"Emphasis · ==words=="},{style:"quiet",label:"a",name:"Quiet",title:"Quiet · ^^words^^"},{style:"code",label:"‹›",name:"Code",title:"Code"},{style:"link",label:"🔗",name:"Link",title:"Link · [words](https://…) · ⌘K",shortcut:"k"},{style:"bullet",label:"•",name:"Bulleted list",title:"Bulleted list"},{style:"number",label:"1.",name:"Numbered list",title:"Numbered list"},{style:"quote",label:"❝",name:"Quote",title:"Quote"},{style:"clear",label:"T×",name:"Clear marks",title:"Clear marks · ⌘⇧X",shortcut:"shift+x"}],m={bold:"Strong",highlight:"Emphasis",quiet:"Quiet"};function p(e){return d.filter(t=>e.includes(t.style))}var k=[{open:"**",close:"**",kind:"bold"},{open:"==",close:"==",kind:"highlight"},{open:"~~",close:"~~",kind:"strike"},{open:"_",close:"_",kind:"italic",wordBoundary:!0},{open:"^^",close:"^^",kind:"quiet"},{open:"@@",close:"@@",kind:"highlight"},{open:"++",close:"++",kind:"bold"}],b=["highlight","quiet"],g=d.map(e=>e.style).filter(e=>k.some(t=>t.kind===e)).filter(e=>!b.includes(e)),x=[...k,{open:"*",close:"*",kind:"accent"}],S=[...k,{open:"*",close:"*",kind:"accent"},{open:"#",close:"#",kind:"bold",notBefore:"0123456789"},{open:"[",close:"]",kind:"italic",notBefore:"(",notBeforeBlock:!0}];function v(e){return!/\s/.test(e)&&!/[!-\/:-@[-`{-~]/.test(e)}function w(e,t){const n=[];let l="",r=0;for(;r<e.length;){const s=E(e,r,t);s?(n.push({kind:"text",text:l}),l="",n.push({kind:s.rule.kind,text:s.inner}),r=s.end):(l+=e[r],r+=1)}return n.push({kind:"text",text:l}),n}function E(e,t,n){for(const l of n){if(!e.startsWith(l.open,t))continue;if(l.wordBoundary&&t>0&&v(e[t-1]))continue;const n=t+l.open.length,s=e.indexOf(l.close,n);if(s<n+1)continue;const i=e.slice(n,s);if(i.includes(l.close[0]))continue;if(i.includes("\n"))continue;const o=s+l.close.length,c=e[o];if((!l.notBefore||void 0===c||!l.notBefore.includes(c))&&!(l.notBeforeBlock&&r(e,o)||l.wordBoundary&&void 0!==c&&v(c)))return{rule:l,inner:i,end:o}}return null}function y(e,t){return w(e,t).map(e=>e.text).join("")}var M=["http","https","mailto","tel"];function $(e){if(""===e||/[\s\u0000-\u001f\u007f]/.test(e))return!1;const t=/^([a-zA-Z][a-zA-Z0-9+.-]*):/.exec(e);return!t||M.includes(t[1].toLowerCase())}function B(e,t){if("["!==e[t])return null;const n=e.indexOf("]",t+1);if(n<t+2||"("!==e[n+1])return null;const l=e.slice(t+1,n);if(l.includes("["))return null;const r=e.indexOf(")",n+2);if(-1===r)return null;const s=e.slice(n+2,r);return $(s)?{label:l,href:s,end:r+1}:null}function z(e,t){if("["!==e[t])return null;let n=0;for(let l=t;l<e.length;l+=1){const s=e[l];if("\n"===s)return null;if("["===s)n+=1;else if("]"===s){if(n-=1,n>0)continue;if(l===t+1)return null;const s=r(e,l+1);return s?{kind:s.kind,color:s.color,label:e.slice(t+1,l),close:e.slice(l,l+1+s.length),end:l+1+s.length}:null}}return null}var q=4;function I(e,t,n){const l=[];let r="";const s=()=>{r&&l.push({kind:"text",text:r}),r=""},i=e=>n+1<q?I(e,t,n+1):[{kind:"text",text:e}];let o=0;for(;o<e.length;){const n=B(e,o);if(n){s(),l.push({kind:"link",href:n.href,children:i(n.label)}),o=n.end;continue}const c=z(e,o);if(c){s(),l.push({kind:c.kind,open:"[",close:c.close,...void 0===c.color?{}:{color:c.color},children:i(c.label)}),o=c.end;continue}const a=E(e,o,t);a?(s(),l.push({kind:a.rule.kind,open:a.rule.open,close:a.rule.close,children:i(a.inner)}),o=a.end):(r+=e[o],o+=1)}return s(),l}function O(e,t){return e.split("\n").map(e=>{const{bullet:n,number:l,rest:r}=function(e){if(e.startsWith("- ")&&""!==e.slice(2).trim())return{bullet:!0,number:null,rest:e.slice(2)};const t=/^([0-9]{1,3})\. /.exec(e);return t&&""!==e.slice(t[0].length).trim()?{bullet:!1,number:t[1],rest:e.slice(t[0].length)}:{bullet:!1,number:null,rest:e}}(e);return{bullet:n,number:l,children:I(r,t,0)}})}function C(e){return null!=e.number?`${e.number}. `:e.bullet?"- ":""}function _(e){return e.map(e=>"text"===e.kind?e.text:"link"===e.kind?`[${_(e.children)}](${e.href})`:e.open+_(e.children)+e.close).join("")}function j(e){return e.map(e=>C(e)+_(e.children)).join("\n")}function Q(t,n,r){if("link"===n)return void 0===r?null:{id:t,kind:"link",open:"[",close:`](${r})`,href:r};if("color"===n){const e=void 0===r?null:l(r);return null===e?null:{id:t,kind:"color",open:"[",close:`]{color=${e}}`,color:e}}const s=e[n];return s&&"code"!==n?{id:t,kind:n,open:s.open,close:s.close}:null}function A(e,t){let n=0,l=0;return e.split("\n").map(e=>{const[r]=O(e,t);let s=l+C(r).length;l+=e.length+1;const i=[],o=(e,t)=>{for(const l of e){if("text"===l.kind){for(const e of l.text)i.push({ch:e,marks:t,at:s}),s+=e.length;continue}const e="link"===l.kind?Q(++n,"link",l.href):{id:++n,kind:l.kind,open:l.open,close:l.close,...void 0===l.color?{}:{color:l.color}};s+=e.open.length,o(l.children,[...t,e]),s+=e.close.length}};return o(r.children,[]),{bullet:r.bullet,number:r.number??null,chars:i}})}function L(e){let t="";const n=[];return e.forEach((e,l)=>{l>0&&(t+="\n"),t+=C(e);const r=[],s=[];for(const n of e.chars){let e=0;for(;e<r.length&&e<n.marks.length&&r[e].id===n.marks[e].id;)e+=1;for(;r.length>e;)t+=r.pop().close;for(let l=e;l<n.marks.length;l+=1)t+=n.marks[l].open,r.push(n.marks[l]);s.push(t.length),t+=n.ch}for(;r.length>0;)t+=r.pop().close;n.push(s)}),{text:t,at:n}}function W(e,t){return e.length===t.length&&e.every((e,n)=>{const l=t[n];return e.bullet===l.bullet&&(e.number??null)===(l.number??null)&&(e.chars.length===l.chars.length&&e.chars.every((e,t)=>{const n=l.chars[t];return e.ch===n.ch&&e.marks.length===n.marks.length&&e.marks.every((e,t)=>e.kind===n.marks[t].kind&&e.href===n.marks[t].href&&e.color===n.marks[t].color)}))})}function N(e,t,n,l=k){const r=A(e,l),s=r.flatMap(e=>e.chars),i={text:e,selectionStart:t,selectionEnd:n},o=e=>r.map(t=>({bullet:t.bullet,number:t.number,chars:t.chars.map(t=>({...t,marks:t.marks.filter(n=>"link"===n.kind||!e(t,n))}))})),c=e=>{const t=L(e);return W(e,A(t.text,l))?t:null},a=(e,t)=>{let n=s.indexOf(t);for(let t=0;t<e.at.length;t+=1){if(n<e.at[t].length)return e.at[t][n];n-=e.at[t].length}return 0};if(t===n){const e=[...s].reverse().find(e=>e.at<t),n=s.find(e=>e.at>=t),l=new Set([...e?.marks??[],...n?.marks??[]].map(e=>e.id));if(![...l].some(e=>s.some(t=>t.marks.some(t=>t.id===e&&"link"!==t.kind))))return i;const r=c(o((e,t)=>l.has(t.id)));if(!r)return i;const u=n?a(r,n):e?a(r,e)+e.ch.length:0;return{text:r.text,selectionStart:u,selectionEnd:u}}const u=new Set(s.filter(e=>e.at>=t&&e.at<n));if(0===u.size)return i;const h=new Set([...u].flatMap(e=>e.marks.map(e=>e.id))),f=c(T(o(e=>u.has(e)),h))??c(o((e,t)=>h.has(t.id)));if(!f)return i;const d=s.find(e=>u.has(e)),m=[...s].reverse().find(e=>u.has(e));return{text:f.text,selectionStart:a(f,d),selectionEnd:a(f,m)+m.ch.length}}function F(e,t,n,l=k){if(t===n)return{text:e,selectionStart:t,selectionEnd:n};const r=A(e,l),s=r.flatMap(e=>e.chars),i=new Set(s.filter(e=>e.at>=t&&e.at<n)),o=e=>"link"!==e.kind,c=new Set([...i].flatMap(e=>e.marks.filter(o).map(e=>e.id)));if(0===c.size)return{text:e,selectionStart:t,selectionEnd:n};const a=e=>r.map(t=>({bullet:t.bullet,number:t.number,chars:t.chars.map(t=>({...t,marks:e(t)}))})),u=a(e=>i.has(e)?e.marks.filter(e=>!o(e)):e.marks);u.forEach((e,t)=>{const n=e.chars,l=r[t].chars.map(e=>i.has(e)),s=e=>{n[e].marks=n[e].marks.filter(e=>!c.has(e.id))};n.forEach((e,t)=>{if(l[t]){if(0===t||!l[t-1])for(let e=t-1;e>=0&&/\s/.test(n[e].ch);e-=1)s(e);if(t===n.length-1||!l[t+1])for(let e=t+1;e<n.length&&/\s/.test(n[e].ch);e+=1)s(e)}})});const h=K(u,l)??K(a(e=>e.marks.filter(e=>!c.has(e.id))),l);return G(e,s,i,h,t,n)}function Z(e){return e.at.flat()}function K(e,t){const n=L(e);return W(e,A(n.text,t))?n:null}function T(e,t){return e.map(e=>{const n=e.chars.map(e=>({...e}));for(const e of t){const t=t=>t.marks.some(t=>t.id===e),l=n.flatMap((e,n)=>t(e)?[n]:[]),r=t=>{n[t].marks=n[t].marks.filter(t=>t.id!==e)};for(let e=0;e<l.length&&/\s/.test(n[l[e]].ch);e+=1)r(l[e]);for(let e=l.length-1;e>=0&&/\s/.test(n[l[e]].ch)&&t(n[l[e]]);e-=1)r(l[e])}return{bullet:e.bullet,number:e.number,chars:n}})}function X(e,t){return t.kind===e||"highlight"===e&&"accent"===t.kind}function D(e,t,n){const l=e.findIndex(e=>n(e.id));return-1===l?[...e,t]:[...e.slice(0,l),t,...e.slice(l)]}function G(e,t,n,l,r,s){if(!l)return{text:e,selectionStart:r,selectionEnd:s};const i=Z(l),o=t.flatMap((e,t)=>n.has(e)?[t]:[]),c=o[0],a=o[o.length-1];return{text:l.text,selectionStart:i[c],selectionEnd:i[a]+t[a].ch.length}}function H(e,t,n,l,r=k){if(t===n||!Q(0,l))return o(e,t,n,l,r);const s=A(e,r),i=s.flatMap(e=>e.chars),c=new Set(i.filter(e=>e.at>=t&&e.at<n));if(0===c.size)return{text:e,selectionStart:t,selectionEnd:n};const a=e=>s.map(t=>({bullet:t.bullet,number:t.number,chars:t.chars.map(t=>({...t,marks:e(t)}))}));if([...c].every(e=>e.marks.some(e=>X(l,e)))){const s=new Set([...c].flatMap(e=>e.marks.filter(e=>X(l,e)).map(e=>e.id))),o=K(T(a(e=>c.has(e)?e.marks.filter(e=>!X(l,e)):e.marks),s),r)??K(a(e=>e.marks.filter(e=>!s.has(e.id))),r);return G(e,i,c,o,t,n)}const u=new Set([...c].flatMap(e=>e.marks.filter(e=>X(l,e)).map(e=>e.id))),h=new Set(i.filter(e=>c.has(e)||e.marks.some(e=>u.has(e.id)))),f=Math.max(0,...i.flatMap(e=>e.marks.map(e=>e.id)))+1,d=Q(f,l),m=e=>i.every(t=>!t.marks.some(t=>t.id===e)||h.has(t)),p=K(T(a(e=>h.has(e)?D(e.marks.filter(e=>!X(l,e)),d,m):e.marks),/* @__PURE__ */new Set([f])),r);return G(e,i,c,p,t,n)}function J(e,t,n,l=k){const r=A(e,l).flatMap(e=>e.chars);let s;if(t===n){const n=[...r].reverse().find(n=>n.at<t&&!e.slice(n.at,t).includes("\n"));s=n?[n]:[]}else s=r.filter(e=>e.at>=t&&e.at<n);if(0===s.length)/* @__PURE__ */return new Set;const i=s.map(e=>new Set(e.marks.map(e=>e.kind)));return new Set([...i[0]].filter(e=>i.every(t=>t.has(e))))}function P(e,t,n){const l=t===n?[[...e].reverse().find(e=>e.at<t),e.find(e=>e.at>=t)]:e.filter(e=>e.at>=t&&e.at<n);for(const e of l){const t=e?.marks.find(e=>"link"===e.kind);if(t)return t.id}return null}function R(e,t,n,l,r=k){const s=A(e,r),i=s.flatMap(e=>e.chars),o=e=>s.map(t=>({bullet:t.bullet,number:t.number,chars:t.chars.map(t=>({...t,marks:e(t)}))})),c=(e,t,n)=>{const l=Z(e),r=i.reduce((e,n,l)=>t(n)?l:e,-1),s=l[r]+i[r].ch.length+n.close.length;return{text:e.text,selectionStart:s,selectionEnd:s}};if(t===n){const s=P(i,t,n);if(null===s)return h(e,t,n,l);const a=Q(s,"link",l),u=K(o(e=>e.marks.map(e=>e.id===s?a:e)),r);return u?c(u,e=>e.marks.some(e=>e.id===s),a):{text:e,selectionStart:t,selectionEnd:n}}const a=new Set(i.filter(e=>e.at>=t&&e.at<n));if(0===a.size)return h(e,t,n,l);const u=Q(Math.max(0,...i.flatMap(e=>e.marks.map(e=>e.id)))+1,"link",l),f=e=>i.every(t=>!t.marks.some(t=>t.id===e)||a.has(t)),d=K(o(e=>a.has(e)?D(e.marks.filter(e=>"link"!==e.kind),u,f):e.marks),r);return d?c(d,e=>a.has(e),u):{text:e,selectionStart:t,selectionEnd:n}}function U(e,t,n,l=k){const r=A(e,l),s=r.flatMap(e=>e.chars),i=P(s,t,n);if(null===i)return{text:e,selectionStart:t,selectionEnd:n};const o=new Set(s.filter(e=>e.marks.some(e=>e.id===i)));return G(e,s,o,K(r.map(e=>({bullet:e.bullet,number:e.number,chars:e.chars.map(e=>({...e,marks:e.marks.filter(e=>e.id!==i)}))})),l),t,n)}function V(e,t,l,r,s=k){const i={text:e,selectionStart:t,selectionEnd:l};if(t===l||null!==r&&!n(r))return i;const o=A(e,s),c=o.flatMap(e=>e.chars),a=new Set(c.filter(e=>e.at>=t&&e.at<l));if(0===a.size)return i;const u=e=>o.map(t=>({bullet:t.bullet,number:t.number,chars:t.chars.map(t=>({...t,marks:e(t)}))})),h=new Set([...a].flatMap(e=>e.marks.filter(e=>"color"===e.kind).map(e=>e.id)));if(null===r){const n=K(T(u(e=>a.has(e)?e.marks.filter(e=>"color"!==e.kind):e.marks),h),s)??K(u(e=>e.marks.filter(e=>!h.has(e.id))),s);return G(e,c,a,n,t,l)}const f=Math.max(0,...c.flatMap(e=>e.marks.map(e=>e.id)))+1,d=Q(f,"color",r),m=e=>c.every(t=>!t.marks.some(t=>t.id===e)||a.has(t)),p=K(T(u(e=>a.has(e)?D(e.marks.filter(e=>"color"!==e.kind),d,m):e.marks),/* @__PURE__ */new Set([f,...h])),s);return G(e,c,a,p,t,l)}function Y(e,t,n,l=k){const r=A(e,l).flatMap(e=>e.chars),s=t===n?[[...r].reverse().find(n=>n.at<t&&!e.slice(n.at,t).includes("\n"))].filter(e=>void 0!==e):r.filter(e=>e.at>=t&&e.at<n);if(0===s.length)return null;const i=e=>e.marks.filter(e=>"color"===e.kind).pop()?.color??null,o=i(s[0]);return null!==o&&s.every(e=>i(e)===o)?o:null}var ee=/^(?:- |([0-9]{1,3})\. )$/;function te(e,t,n){const l=e.split("\n"),r=[];let s=0;for(const e of l)r.push(s),s+=e.length+1;const i=e=>{let t=0;for(;t+1<r.length&&r[t+1]<=e;)t+=1;return t};return{first:i(t),last:i(Math.max(t,n)),starts:r}}function ne(e,t){if(null!=t.number)return"number";if(t.bullet)return"bullet";const n=ee.exec(e);return n?void 0===n[1]?"bullet":"number":null}function le(e,t,n,l,r=k){const s=e.split("\n"),i=A(e,r),{first:o,last:c}=te(e,t,n),a=i.map((e,t)=>null===ne(s[t],e)||e.bullet||null!=e.number?{bullet:e.bullet,number:e.number??null,chars:e.chars}:{bullet:!1,number:null,chars:[]});let u=0;if("number"===l&&o>0&&"number"===ne(s[o-1],i[o-1])){const e=i[o-1].number??ee.exec(s[o-1])?.[1]??"0";u=Number(e)}const h=L(a.map((e,t)=>t<o||t>c?e:"bullet"===l?{bullet:!0,number:null,chars:e.chars}:"number"===l?{bullet:!1,number:String(u+=1),chars:e.chars}:{bullet:!1,number:null,chars:e.chars})).text.split("\n").map((e,t)=>t<o||t>c?s[t]:e),f=h.join("\n"),{starts:d}=te(e,0,0),m=t=>{const{first:n}=te(e,t,t);let l=0;for(let e=0;e<n;e+=1)l+=h[e].length-s[e].length;const r=null===ne(s[o=n],i[o])||i[o].bullet||null!=i[o].number?C(i[o]).length:s[o].length;var o;const c=h[n].length-(s[n].length-r),a=t-d[n];return d[n]+l+(a<r?c:a-r+c)};return{text:f,selectionStart:m(t),selectionEnd:m(n)}}function re(e,t,n,l=k){const r=e.split("\n"),s=A(e,l),{first:i,last:o}=te(e,t,n),c=new Set(s.slice(i,o+1).map((e,t)=>ne(r[i+t],e)));return 1===c.size?[...c][0]:null}export{S as CAMPAIGN_MARKUP,g as COPY_FIELD_TOOLS,d as MARKUP_TOOLS,m as MARK_NAMES,s as MARK_PLACEHOLDERS,b as RETIRED_MARKS,k as STANDARD_MARKUP,x as STOREFRONT_MARKUP,c as applyColor,o as applyMark,N as clearMarks,F as clearStyle,Y as colorIn,V as colorOver,u as findLink,t as isColorName,n as isColorValue,$ as isSafeLinkHref,R as linkOver,re as listIn,a as markedAt,A as markedLines,J as marksIn,p as markupTools,O as parseMarkup,f as removeLink,W as sameMarks,j as serializeMarkup,le as setList,Q as spanFor,y as stripInline,H as toggleMark,w as tokenizeInline,U as unlinkAt,h as writeLink,L as writeMarkedLines};
|
package/dist/chunk-AZOCY74V.js
DELETED
|
@@ -1,57 +0,0 @@
|
|
|
1
|
-
import{cloneNodeWithFreshIds as e}from"./chunk-2GVCAIPX.js";import{dedupeSlotChildren as n}from"./chunk-26OOWIJJ.js";import{styleClipboardOf as t}from"./chunk-IFS5P7CO.js";import{markedTreeNodeId as o,revealSelectedTreeRow as r,sameSelector as i}from"./chunk-FGNR22NY.js";import{rootRowName as l,slotChildRowName as s,slotChildRenameProp as d,sectionRenameProp as c}from"./chunk-BHRC3ASL.js";import{scrollPreviewToSection as a,gotoPreviewSlide as p,scrollPreviewToTop as u}from"./chunk-4ES5JGGX.js";import{useEaselKeyTarget as f,useEaselUndoKeys as h,useEaselSaveKey as m,editorRootFocus as g}from"./chunk-EXKKLTXH.js";import{SlotChildActionsProvider as y}from"./chunk-KCBEE2MC.js";import{screenStorageKeys as S,DEFAULT_PANEL_W as k,clampPanelWidth as v}from"./chunk-TZIIRGVY.js";import{usePartBridge as b}from"./chunk-EQFBUNEB.js";import{useSectionOps as w}from"./chunk-XWK7WZQS.js";import{useNodeClipboard as x,useNodeContextMenu as z}from"./chunk-PPHUWGLZ.js";import{PageEditGuardNotices as C}from"./chunk-AFSSKGTD.js";import{ScreenSaveIcon as B,ScreenMainButton as I}from"./chunk-W4U4SHKW.js";import{useBrowserOffline as N}from"./chunk-RKTF5XLP.js";import{useScreenDocument as P}from"./chunk-GCCBEY2W.js";import{requestMediaPick as O}from"./chunk-KG7RJWOK.js";import{heldStyle as $,styleShortcut as j}from"./chunk-V7U33NF2.js";import{AddChildRow as M}from"./chunk-5545A3PC.js";import{AddSidePanel as T}from"./chunk-DD7A6RRL.js";import{SidePanelHead as A,PanelShowStrip as L}from"./chunk-PPL7GB7D.js";import{useEaselSession as E}from"./chunk-O7Q4DDJT.js";import{MediaSidePanel as R}from"./chunk-ZXGQT75B.js";import{useScreenSaveSwitch as V,useScreenNodeKeys as F,useScreenPinned as W,useScreenDocumentLabel as G,useScreenCanvasFrame as H,useScreenInspectorPanel as D,useScreenDevices as U,useScreenPickFollowsSelection as J,useScreenLeftView as X,SELECTION_MODE as K,sameInspectorMode as Y,useScreenBridges as q,useScreenBlockRules as Z,useScreenBlockLook as _,useScreenStorageNamespace as Q,useScreenNotify as ee,useScreenCanvasHead as ne,isSlotMode as te,useScreenStyleClipboard as oe,useScreenDocumentPass as re,useScreenCanvasDrag as ie,ScreenCanvasTargetProvider as le,isPinnedFirst as se,isPinnedLast as de,screenSlotsOf as ce}from"./chunk-U7KFFC7N.js";import{ROOT_ZONE as ae,blockNodeActions as pe,TREE_MAX_DEPTH as ue,childSlotsOf as fe,slotFieldsOf as he,slotChildrenIn as me,nestsInTree as ge,newNodeId as ye}from"./chunk-PLVEGYK6.js";import{useMediaPanel as Se,usePanelPick as ke,useCancelPanelPick as ve}from"./chunk-R6WTQWAC.js";import{useEaselHost as be,useHostEscape as we}from"./chunk-U3JP4VGF.js";import{DEFAULT_STYLE_CLIPBOARD_WORDS as xe}from"./chunk-6WY6ZXJG.js";import{DEFAULT_SCREEN_WORDS as ze}from"./chunk-VWXUMVCD.js";import{useEasel as Ce,useEaselApi as Be,CanvasPassThroughContext as Ie}from"./chunk-SJPKSE5G.js";import{TreeRow as Ne,Subtree as Pe,LayersTree as Oe,TreeGroupLabel as $e,TreeRowAction as je,TreeSeam as Me}from"./chunk-4JSBIW5H.js";import{DEFAULT_TREE_WORDS as Te}from"./chunk-K56YDHYQ.js";import{DEFAULT_NODE_MENU_WORDS as Ae}from"./chunk-WK3AFPXY.js";import{toItemSelector as Le,useNodeOps as Ee,clickPick as Re}from"./chunk-ECM5F6JJ.js";import{LayersIcon as Ve,MediaIcon as Fe}from"./chunk-4VJATVVR.js";import{EaselTopBar as We,TopBarRail as Ge,TopBarCluster as He,EaselIconButton as De,TopBarDivider as Ue,DeviceSwitch as Je,InspectorIconButton as Xe,PanelResizeHandle as Ke,MAX_PANEL_W as Ye,MIN_PANEL_W as qe,panelWidthVars as Ze}from"./chunk-IE55HNMA.js";import{DEFAULT_NOTICE_WORDS as _e,DEFAULT_CHROME_WORDS as Qe}from"./chunk-Z6PVRXVY.js";import{holderOf as en,nameOrSomeone as nn}from"./chunk-THWO5YVZ.js";import{DEFAULT_LOCK_WORDS as tn}from"./chunk-RE4LP46F.js";import{useWords as on}from"./chunk-MFIRYGHW.js";import{insertSeams as rn,CanvasDragLayer as ln,CanvasInsert as sn}from"./chunk-47RGVCPH.js";import{DEFAULT_DRAG_WORDS as dn}from"./chunk-GG4FGBFR.js";import{createDragSession as cn,useTreeDrag as an,gapToMoveIndex as pn}from"./chunk-67GNT6PF.js";import{useCanvasFrame as un,LIST_SELECTOR as fn,BLOCK_SELECTOR as hn,useCanvasEvent as mn,nodeIdAt as gn,frameRectToHost as yn,BLOCK_ATTRIBUTE as Sn,drawnBox as kn}from"./chunk-ILXP5VX5.js";import{ROOT_ID as vn,ROOT_SLOT as bn,zoneKey as wn,parseZoneKey as xn,find as zn,DataError as Cn}from"./chunk-KRXQM65X.js";import{useRef as Bn,useMemo as In,useState as Nn,useEffect as Pn,useCallback as On,useLayoutEffect as $n,Fragment as jn}from"react";import{ColoredBadge as Mn,toast as Tn,groupColors as An}from"efficient-shell/ui";import{UndoIcon as Ln,RedoIcon as En,RefreshIcon as Rn,AddIcon as Vn,TrashIcon as Fn,EyeOffIcon as Wn,EyeIcon as Gn,DuplicateIcon as Hn}from"efficient-shell/icons/efficient";import{jsx as Dn,jsxs as Un,Fragment as Jn}from"react/jsx-runtime";var Xn=/* @__PURE__ */new WeakSet;function Kn(e,n,t){const o=zn(e,n,t);if(!o)return null;const r=o.path.find(e=>"root"!==e.parentId);return r?r.parentId:t}function Yn({canvas:e,tabs:n,onSelect:t}){const o=Bn(null),[r,i]=Nn({}),l=n.map(e=>`${e.id}:${e.below?1:0}`).join("|");return $n(()=>{const t=e?.document,r=e?.window,l=e?.frame;if(!t||!r||!l||0===n.length)return void i({});let s=0;const d=()=>{s=0;const e=o.current;if(!e)return;const d=yn(l,{left:0,top:0,width:r.innerWidth,height:r.innerHeight},e),c={};for(const o of n){const n=t.querySelector(`[${Sn}="${r.CSS?.escape?r.CSS.escape(o.id):o.id}"]`),i=n?kn(n):null;if(!i||0===i.height){c[o.id]=null;continue}const s=yn(l,{left:i.left,top:i.top,width:i.width,height:i.height},e),a=s.top+s.height;if(a<d.top||s.top>d.top+d.height){c[o.id]=null;continue}const p=o.below?a+4:Math.max(s.top,d.top)+6;c[o.id]={left:Math.max(s.left,d.left)+6,top:p}}i(c)},c=()=>{s||(s=r.requestAnimationFrame(d))};d(),r.addEventListener("scroll",c,!0),r.addEventListener("resize",c);const a=new r.MutationObserver(c);return a.observe(t.body,{childList:!0,subtree:!0,attributes:!0}),()=>{s&&r.cancelAnimationFrame(s),r.removeEventListener("scroll",c,!0),r.removeEventListener("resize",c),a.disconnect()}},[e,l]),/* @__PURE__ */Dn("div",{ref:o,className:"es-band-tabs","aria-hidden":"true",children:n.map(e=>{const n=r[e.id];return n?/* @__PURE__ */Dn("span",{className:"es-band-tab","data-band-tab":e.id,style:{left:n.left,top:n.top},onClick:n=>{n.stopPropagation(),t(e.id)},children:/* @__PURE__ */Dn(Mn,{colorClass:An("info","solid"),size:"sm",children:e.label})},e.id):null})})}function qn({expand:e}){/* @__PURE__ */
|
|
2
|
-
return Dn("svg",{width:"15",height:"15",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:1.9,strokeLinecap:"round",strokeLinejoin:"round",children:/* @__PURE__ */Un(Jn,e?{children:[
|
|
3
|
-
/* @__PURE__ */Dn("path",{d:"M8 9l4-4 4 4"}),
|
|
4
|
-
/* @__PURE__ */Dn("path",{d:"M8 15l4 4 4-4"})]}:{children:[
|
|
5
|
-
/* @__PURE__ */Dn("path",{d:"M8 4l4 4 4-4"}),
|
|
6
|
-
/* @__PURE__ */Dn("path",{d:"M8 20l4-4 4 4"}),
|
|
7
|
-
/* @__PURE__ */Dn("path",{d:"M5 12h14"})]})})}var Zn=`${fn}, ${hn}`;function _n(e,n,t){const o=t-n;if(o<6)return null;if(o<24)return{top:Math.round((n+t)/2),height:Math.round(o)};return{top:Math.round(Math.min(Math.max(e,n+12),t-12))}}var Qn="__rungs";var et="screen:band",nt={duplicate:!0,delete:!0};function tt(){const fn=be(),{target:yn,docId:Sn,capabilities:kn,currentSlug:An,siteId:tt,onPublish:ot,saveState:rt,saveConflict:it,retrySave:lt,toggleAutoSave:st,flushSave:dt,access:ct,saveUnreachable:at=!1,readOnly:pt,readOnlyReason:ut=null}=P(),ft=V(),ht=F(),{mediaEditing:mt,hasEditGuard:gt,hasPinnedChrome:yt}=kn,{appState:St,dispatch:kt,history:vt,selectedItem:bt,getSelectorForId:wt,config:xt}=Ce(e=>e),zt=W(),{first:Ct,firstGroup:Bt,lastGroup:It,isSectionGroup:Nt,sectionGroupZone:Pt,panelOf:Ot}=zt,$t=Ot(Ct),jt=e=>se(zt,e),Mt=e=>de(zt,e),Tt="node"===zt.firstRow,At=zt.band??null,Lt=on("screen",ze),Et=on("tree",Te),Rt=on("drag",dn),Vt=on("notice",_e),Ft=on("lock",tn),Wt=on("menu",Ae),Gt=on("styleClipboard",xe),Ht=on("chrome",Qe),Dt=G()??`/${An}`,Ut=H(),Jt=D(),Xt=w({readOnly:pt}),Kt=w({readOnly:pt,foldIntoHistory:!0}),Yt=Bn(null),qt=Be(),Zt=In(()=>({...Xt,select:e=>{Yt.current=e,Xt.select(e)},commitDocument:(e,n)=>{if(void 0!==n){const t=qt.config;Yt.current=Le(e,t,n)}Xt.commitDocument(e,n)}}),[Xt,qt]),_t=St.ui,Qt=_t.leftSideBarVisible,eo=_t.rightSideBarVisible,{options:no,widths:to,initial:oo,fluid:ro,fit:io}=U(),[lo,so]=Nn(oo),co=Se(),ao=mt&&null!==co,po=ke(),uo=ve();J(bt?.props.id);const{read:fo,write:ho,forSelection:mo}=X(),[go,yo]=Nn(fo);Pn(()=>{ho(go)},[go]);const[So,ko]=Nn(0),vo=Bn(null),bo=Bn(null),wo=un(bo,{readySelector:Zn}),xo=f(bo);h(bo,wo);const zo=N(),Co=en(ct),Bo={state:rt,offline:zo||rt.failed&&at,readOnlyReason:ut,editing:Co?Vt.editing({name:nn(Co.name,Ft),noun:Lt.noun}):null,conflict:null!=it,notSaving:Lt.bar.notSaving},Io=()=>{pt||(rt.failed?lt():dt())};m(bo,wo,Io);const[No,Po]=Nn(!1),Oo=Bn(!1),$o=Bn(!1),[jo,Mo]=Nn(null),[To,Ao]=Nn([]),[Lo,Eo]=Nn(K),Ro="puck"===Lo.kind,Vo=o(Lo,bt?.props.id),[Fo,Wo]=Nn(null);Pn(()=>{Fo&&(r(),Wo(null))},[Fo]);const Go=Bn(wt);Go.current=wt;const Ho=On((e,{scroll:n})=>{yo(n=>mo(e,n)),n&&Wo(e);const t=[];let o=e;for(let e=0;e<4;e++){const e=Go.current(o)?.zone;if(!e||!e.includes(":"))break;const n=e.split(":")[0];t.push(n),t.push(e),o=n}0!==t.length&&kr(e=>{if(t.every(n=>!e.has(n)))return e;const n=new Set(e);return t.forEach(e=>n.delete(e)),n})},[]),Do=Bn(null);Pn(()=>{const e=Do.current;Do.current=null;const n=null==bt?.props.id?null:String(bt.props.id);Eo(t=>e&&e.id===n?e.mode:"part"===t.kind&&"nodeId"in t&&t.nodeId===n?t:Ot(bt?.type)??K);const t=bt?.props.id,o=Yt.current;if(Yt.current=null,!t)return;const r=wt(t);Ho(String(t),{scroll:!i(o,r??null,ae)})},[bt?.props.id,Ho]);const Uo=On(e=>{Eo(n=>Y(n,e)?n:e),kt({type:"setUi",ui:{rightSideBarVisible:!0}})},[kt]),Jo=Bn(()=>{});Jo.current=(e,n)=>{const t=e?ui(e.zone??ae)[e.index]?.props.id:null,o=null==t?null:String(t),r=null==bt?.props.id?null:String(bt.props.id);Eo(e=>Y(e,n)?e:n),o!==r&&(Do.current={id:o,mode:n},Zt.select(e))};const Xo=On((e,n)=>Jo.current(e,n),[]),Ko={kind:Lo.kind,mode:Lo,open:Uo,show:e=>Eo(e),reveal:()=>{eo||kt({type:"setUi",ui:{rightSideBarVisible:!0}})},select:Xo},Yo=q(Ko,{data:St.data,selected:bt??null,zoneOf:e=>wt(e)?.zone,readOnly:Boolean(pt),select:e=>{Eo(K),Zt.select({index:e})},replace:(e,n)=>Zt.replaceComponent(ae,e,n),scrollTo:e=>Ei(e)},{device:lo,refreshes:So},{setView:yo,reveal:()=>{Qt||kt({type:"setUi",ui:{leftSideBarVisible:!0}})}}),qo=Yo.pinnedSource??!1,Zo=Yo.resolveLeftView?Yo.resolveLeftView(go,ao):"media"===go&&ao?go:"sections",_o=Z(),{isLockedBlock:Qo,duplicateBlocked:er,nestDepth:nr,newSectionNode:tr,canAddTo:or,blockIsOffered:rr}=_o,ir=_(),{labelAtLevel:lr,Icon:sr,useProducts:dr}=ir,cr=ir.rowName?(e,n,t)=>ir.rowName(e,n,t):void 0,ar=On(e=>{kt({type:"setUi",ui:{rightSideBarVisible:!0}}),a(e),Ho(e,{scroll:!0})},[kt,Ho]),{selectNode:pr,openPartId:ur}=b({mode:Lo,setMode:Eo,onOpenPart:ar}),[fr,hr]=Nn(null);we(null!==fr,()=>hr(null));const mr=S(Q()),gr=mr.collapsed,yr=mr.panelWidths,[Sr,kr]=Nn(()=>{if("undefined"==typeof window)/* @__PURE__ */return new Set;try{const e=window.localStorage.getItem(gr);return new Set(e?JSON.parse(e):[])}catch{/* @__PURE__ */
|
|
8
|
-
return new Set}});Pn(()=>{try{window.localStorage.setItem(gr,JSON.stringify([...Sr]))}catch{}},[Sr]);const[vr,br]=Nn(()=>{if("undefined"==typeof window)return{...k};try{const e=window.localStorage.getItem(yr);if(!e)return{...k};const n=JSON.parse(e);return{left:v(Number(n.left)||k.left),right:v(Number(n.right)||k.right)}}catch{return{...k}}});Pn(()=>{const e=setTimeout(()=>{try{window.localStorage.setItem(yr,JSON.stringify(vr))}catch{}},300);return()=>clearTimeout(e)},[vr]);const wr=On((e,n)=>br(t=>{const o="function"==typeof n?n(t[e]):n;return t[e]===o?t:{...t,[e]:o}}),[]),xr=On(e=>wr("left",e),[wr]),zr=On(e=>wr("right",e),[wr]),Cr=e=>Sr.has(e),Br=e=>kr(n=>{const t=new Set(n);return t.has(e)?t.delete(e):t.add(e),t}),Ir=Bn(!1),Nr=Bn(null);Pn(()=>{if(Ir.current&&!No){const e=Nr.current,n=e&&e.isConnected&&!e.closest('[aria-hidden="true"]')?e:null;(n??bo.current?.querySelector(`button[aria-label="${CSS.escape(Lt.add.title)}"]`))?.focus(),Nr.current=null}Ir.current=No},[No]),Pn(()=>{if(!No||!xo)return;const e=e=>{"Escape"===e.key&&Ui()};return xo.addEventListener("keydown",e),()=>xo.removeEventListener("keydown",e)},[No,xo]),we(No,()=>Ui()),Pn(()=>{!Qt&&No&&(Po(!1),Mo(null),Oo.current=!1)},[Qt]),Pn(()=>{if(!po)return $o.current&&kt({type:"setUi",ui:{leftSideBarVisible:!1}}),void($o.current=!1);No&&(Po(!1),Mo(null),$o.current=Oo.current,Oo.current=!1),Qt||($o.current=!0,kt({type:"setUi",ui:{leftSideBarVisible:!0}}))},[po]),Pn(()=>{!Qt&&po&&($o.current=!1,uo())},[Qt]),Pn(()=>{if(!po||!xo)return;const e=e=>{"Escape"===e.key&&uo()};return xo.addEventListener("keydown",e),()=>xo.removeEventListener("keydown",e)},[po,xo]),we(null!==po,()=>uo());const Pr=ee(),Or=(e,n="success",t)=>{if(Pr)return void(t?Pr(e,"error"===n?"error":"info",t):Pr(e,"error"===n?"error":"info"));const o={sound:!1,action:t?.action,onClose:t?.onClose};"error"===n?Tn.error(e,{...o,duration:t?.duration??3200}):Tn.success(e,{...o,duration:t?.duration??1900})},$r=Bn(null),[jr,Mr]=Nn(0),[Tr,Ar]=Nn(0),Lr=ne(),Er=Bn(null),Rr=e=>Math.max(0,e.clientHeight-(Er.current?.offsetHeight??0));Pn(()=>{const e=$r.current;if(!e)return;const n=()=>{Mr(e.clientWidth),Ar(Rr(e))};n();const t=new ResizeObserver(n);return t.observe(e),Er.current&&t.observe(Er.current),()=>t.disconnect()},[]),$n(()=>{$r.current&&(Mr($r.current.clientWidth),Ar(Rr($r.current)))},[vr,Qt,eo]);const Vr=lo===ro?jr>0?jr:to[ro]:to[lo],Fr=jr>0?Math.min(jr/Vr,"shrink"===io?1:2):1,Wr=Vr*Fr,Gr=jr>0&&Wr>jr+1,Hr={width:Wr,height:Tr||"100%",flex:"none",position:"relative"},Dr={width:Vr,height:Tr?Tr/Fr:"100%",maxHeight:"none",transform:1!==Fr?`scale(${Fr})`:void 0,transformOrigin:"top left"},Ur=()=>kt({type:"setUi",ui:{leftSideBarVisible:!Qt}}),Jr=()=>kt({type:"setUi",ui:{rightSideBarVisible:!eo}}),Xr=e=>{No&&(Po(!1),Mo(null),Oo.current=!1,Qt&&go===e)||po&&($o.current=!1,uo(),Qt&&go===e)||(Qt&&go===e?Ur():(yo(e),Qt||kt({type:"setUi",ui:{leftSideBarVisible:!0}})))},Kr=()=>{O(fn,{accept:"image/*",title:Ht.mediaLibrary})},Yr=()=>{Eo(K),Zt.select(null),u()},qr=()=>{Eo($t??K),eo||kt({type:"setUi",ui:{rightSideBarVisible:!0}})},Zr=St.data.content??[],_r=()=>{const e=Zr.findIndex(jt),n=Zr.findIndex(Mt);return{floor:e>=0?e+1:0,cap:n>=0?n:Zr.length}},Qr=xt,ei=_o.stripCopy,ni=n=>e(n,ei),ti=x(),oi=Ee({data:St.data,config:Qr,readOnly:Boolean(pt),clipboard:ti,strip:ei?e=>ei(e):void 0,afterRemove:"none",stepBounds:(e,n)=>{if(e.parentId!==vn||e.slot!==bn)return{min:0,max:n-1};const{floor:t,cap:o}=_r();return{min:t,max:o-1}},commit:(e,{select:n})=>{void 0!==n&&Eo(K);const t=void 0===n||"node"===n?.kind?n:null;Zt.commitDocument(e,t)}}),ri=e=>{const n=zn(St.data,xt,e);if(!n)return!1;const t=wn(n.place),o=n.node,r=t===ae?ci(o):xi(o);return!!oi.remove(e)&&(Or(Lt.deleted({name:r}),"success",{duration:8e3,action:{label:Lt.bar.undo,onClick:()=>{oi.restore(n.node,n.place)}}}),!0)},ii={...oi,remove:ri},li=e=>lr(e,"block",xt.components[e]?.label??e),si=On(e=>xt.components[e]?.defaultProps??{},[xt]),di=e=>lr(e,"section",li(e)),ci=e=>l({type:e.type,props:e.props??{}},di(e.type),cr),{nodeAddresses:ai,zoneItems:pi}=In(()=>{const e=/* @__PURE__ */new Map,n=/* @__PURE__ */new Map,t=(o,r,i)=>{n.set(r,o),o.forEach((n,o)=>{const l=String(n.props?.id??"");if(l&&e.set(l,{zone:r,index:o}),i>=ue)return;const s=/* @__PURE__ */new Map;for(const{child:e,zone:t}of fe(xt,n))s.set(t,[...s.get(t)??[],e]);for(const[e,n]of s)t(n,e,i+1)})};return t(Zr,ae,0),{nodeAddresses:e,zoneItems:n}},[Zr,xt]),ui=On(e=>pi.get(e)??[],[pi]),fi=e=>{const n=ai.get(e);return n?ui(n.zone)[n.index]:void 0},hi=e=>ce(_o,xt,e),mi=e=>{if(!_o.slotsOf||e===ae)return null;const n=e.lastIndexOf(":");if(n<=0)return null;const t=fi(e.slice(0,n));if(!t)return null;const o=hi(t).filter(e=>e.rung),r=o.findIndex(t=>t.slot===e.slice(n+1));return r<0?null:{node:t,slot:o[r],position:r}},gi=(()=>{if(!te(Lo))return null;const e=`${Lo.nodeId}:${Lo.slot}`;return mi(e)?.slot.panel===Lo.kind?e:null})(),yi=Bn(null);Pn(()=>{const e=yi.current;if(yi.current=null,!gi||!te(Lo))return;const n=Lo.nodeId;Ho(n,{scroll:e!==gi}),kr(e=>{if(!e.has(n))return e;const t=new Set(e);return t.delete(n),t})},[Lo]);const Si=(e,n,t)=>{const o=String(e.props.id);if(!n.panel)return void(e=>{const n=ai.get(e);n&&(n.zone===ae?Ri(n.index):ul(n.zone,n.index,e,fi(n.zone.slice(0,n.zone.lastIndexOf(":")))?.type??""))})(o);const r={kind:n.panel,nodeId:o,slot:n.slot},i=`${o}:${n.slot}`;t&&gi!==i&&(yi.current=i),Xo(null,r),eo||kt({type:"setUi",ui:{rightSideBarVisible:!0}}),Ei(o)},ki=(e,n,t)=>{const o=`${e}:${n}`;if(kr(n=>{if(!n.has(o)&&!n.has(e))return n;const t=new Set(n);return t.delete(o),t.delete(e),t}),!t)return;gi!==o&&(yi.current=o);Xo(null,{kind:t,nodeId:e,slot:n})},vi=(e,n,t)=>{if(pt||!_o.moveSlot)return;const o=fi(e),r=o?hi(o).filter(e=>e.rung):[],i=r[n];if(!i)return;const l={parentId:e,slot:Qn,index:n},s=pn(l,{...l,index:Math.min(Math.max(t,0),r.length)});if(s===n)return;const d=_o.moveSlot(e,n,s);"string"==typeof d&&ki(e,d,i.panel)},bi=dr(),wi=In(()=>{const e=/* @__PURE__ */new Map;for(const n of bi??[])e.set(n.slug,n.name);return e},[bi]),xi=e=>s(e,li,ir.plainText,e=>wi.get(e),ir.rowName),zi=(e,n)=>{const t=xt.components[e.type]?.fields,o=n===ae||Ml(n)?"section":"block",r=n===ae&&(jt(e)||Mt(e)||Nt(e.type)),i="block"===o?d(t):r?null:c(t);return ir.renamePropOf?ir.renamePropOf(e,o,i):i},Ci=(e,n,t,o)=>{if(!(!pt&&fr?.zone===e&&fr.index===n))return;const r=(t,o)=>{hr(null),o&&((e,n,t)=>{const o=ui(e)[n];if(!o)return;const r=zi(o,e);r&&Zt.replaceComponent(e,n,{...o,props:{...o.props,[r]:t.trim()}})})(e,n,t)};/* @__PURE__ */
|
|
9
|
-
return Dn("input",{className:"es-tree-rename",defaultValue:o,autoFocus:!0,"aria-label":Lt.rename,onClick:e=>e.stopPropagation(),onBlur:e=>r(e.currentTarget.value,!0),onKeyDown:e=>{"Enter"===e.key?(e.preventDefault(),r(e.currentTarget.value,!0)):"Escape"===e.key&&(e.preventDefault(),r("",!1))}},t)},Bi=t(oe(),Gt),Ii=Bi.scope({target:yn,siteId:tt,docId:Sn}),Ni=xt,Pi=(e,n)=>n===ae?di(e):li(e),Oi=(e,n,t)=>{const o=Bi.plan(Ii,t,Pi(t.type,e),Ni);o&&(o.changed&&Zt.replaceComponent(e,n,{...t,props:{...o.props,id:t.props.id}}),Or(o.message))},$i=z({nodesIn:ui,nodeAt:(e,n)=>ui(e)[n]??null,labelOf:(e,n)=>n===ae?di(e):li(e),renamePropOf:zi,beginRename:(e,n)=>hr({zone:e,index:n}),history:{hasPast:vt.hasPast,hasFuture:vt.hasFuture,back:()=>vt.back(),forward:()=>vt.forward()},openPageSettings:()=>{Zt.select(null),Eo(K)},pageSettingsLabel:Lt.pageSettings,words:{menu:Wt,styleClipboard:Gt,screen:Lt.menu},readOnly:Boolean(pt),collapseAll:()=>kr(new Set(ui(ae).map(e=>String(e.props.id)))),onPasteRefused:e=>Or(e?Lt.pasteRefused({name:e.label}):Lt.menu.clipboardRefused,"error"),canPasteAt:(e,n)=>Ll(e,n),menuRows:Yo.menuRows,isLocked:e=>Qo(e.type),duplicateBlocked:e=>er(St.data,e),permits:e=>pe(xt,e.type),nodeOps:ii,isPinned:(e,n)=>n===ae&&(jt(e)||Mt(e)),sectionBand:_r,locate:e=>ai.get(e)??null,rowNameOf:(e,n)=>n===ae?ci(e):xi(e),selectAt:(e,n,t,o)=>{e===ae?Ri(n):ul(e,n,t,o??"")},slotRung:e=>{const n=mi(e);return n?.slot.panel?{label:n.slot.label,select:()=>Si(n.node,n.slot,!1)}:null},style:{held:()=>$(Ii),canCopy:e=>Bi.rows(Ni,e).some(e=>!1!==e.counted),copy:(e,n)=>Bi.copy(Ii,e,Pi(e.type,n),Ni),paste:(e,n,t)=>Oi(e,n,t)},keys:ht?{target:xo,selected:()=>{const e=St.ui.itemSelector;return e?{zone:e.zone??ae,index:e.index}:null},held:()=>ti.get(),readOnly:Boolean(pt),onDone:({done:e,name:n})=>{"copied"===e&&Or(Lt.copied({name:n}))}}:void 0},wo),ji=Bn({copy:(e,n)=>{},paste:(e,n,t)=>{},at:()=>null,readOnly:!1});Pn(()=>{ji.current={copy:(e,n)=>Bi.copy(Ii,e,Pi(e.type,n),Ni),paste:Oi,at:()=>{const e=St.ui.itemSelector;if(!e)return null;const n=e.zone??ae,t=ui(n)[e.index];return t?{zone:n,index:e.index,node:t}:null},readOnly:Boolean(pt)}});const Mi=On(e=>{const n=j(e);if(!n)return;const t=ji.current,o=t.at();o&&(e.preventDefault(),"copy"===n?t.copy(o.node,o.zone):t.readOnly||t.paste(o.zone,o.index,o.node))},[]);Pn(()=>{if(!xo)return;const e=e=>Mi(e);return xo.addEventListener("keydown",e),()=>xo.removeEventListener("keydown",e)},[Mi,xo]),mn(wo,"keydown",Mi);const Ti=Zr.map(e=>e.props.id).join("|");Pn(()=>{const e=wo?.document??null,n=wo?.window??null;let t=0;const o=[],r=()=>{if(!e)return void Ao(e=>e.length?[]:e);const n=Zr.findIndex(Mt),t=n>=0?n:Zr.length,o=n=>{const t=Zr[n]?.props?.id;return null==t?null:e.querySelector(`[data-puck-component="${CSS.escape(String(t))}"]`)},r=e=>e?[...e.querySelectorAll(hn)].map(e=>e.getBoundingClientRect()).filter(e=>e.width>0||e.height>0):[],i=[];for(let e=Zr.length>0&&!jt(Zr[0])?0:1;e<=t;e++){const n=o(e),t=o(e-1),l=n?.getBoundingClientRect()??null,s=t?.getBoundingClientRect()??null;if(!l&&!s)continue;const d=_n(l&&s?(s.bottom+l.top)/2:l?0===e?l.top+12:l.top:s.bottom,Math.max(0===e?0:-1/0,...r(t).map(e=>e.bottom)),Math.min(1/0,...r(n).map(e=>e.top)));d&&i.push({...d,index:e})}Ao(e=>function(e,n){if(e.length!==n.length)return!1;for(let t=0;t<e.length;t++)if(e[t].top!==n[t].top||e[t].index!==n[t].index||e[t].height!==n[t].height)return!1;return!0}(e,i)?e:i)},i=()=>{cancelAnimationFrame(t),t=requestAnimationFrame(r)};if(!e||!n)return void r();n.addEventListener("scroll",i,{passive:!0});const l=new ResizeObserver(i);return l.observe(e.documentElement),r(),o.push(setTimeout(r,150),setTimeout(r,450)),()=>{cancelAnimationFrame(t),o.forEach(clearTimeout),n.removeEventListener("scroll",i),l.disconnect()}},[wo,Ti,lo,Fr,Qt,eo,bt?.props.id]);const Ai=wo?.document??null,Li=wo?.window??null;Pn(()=>{const e=vo.current;if(!e||!Ai||!Li)return;const n=[],t=()=>{const n=Ai.querySelector(`[data-puck-component="${CSS.escape(e.id)}"]`);if(!n)return!1;const t=n.getBoundingClientRect().top-e.offset;return Math.abs(t)>1&&Li.scrollTo({left:Li.scrollX,top:Li.scrollY+t,behavior:"instant"}),!0};return vo.current=null,t()&&n.push(setTimeout(t,150),setTimeout(t,450)),()=>n.forEach(clearTimeout)},[Ai,Li]);const Ei=e=>{Yo.holdCanvasOn?Yo.holdCanvasOn(e):a(e)},Ri=e=>{Eo(K),Zt.select({index:e}),Yo.sectionPressed?.(Zr[e]);const n=Zr[e]?.props?.id;n&&Ei(n)},Vi=e=>{const{floor:n,cap:t}=_r(),o=e=>Math.min(Math.max(n,e),t);if("number"==typeof e)return o(e);const r=bt&&Lo.kind!==$t?.kind?Zr.findIndex(e=>e.props.id===bt.props.id):-1;return o(r>=0?r+1:t)},Fi=(e,n)=>{const{floor:t,cap:o}=_r(),r=Math.min(Math.max(n,t),o),i=e<r?r-1:r;return i===e?{moved:!1,dest:e}:(Zt.reorderComponent(ae,e,i),Zt.select({index:i}),{moved:!0,dest:i})},Wi=(e,n,t,o)=>{Eo(K),Zt.select(o?{index:o.index,zone:o.zone}:{index:e}),a(n),Or(Lt.sectionAdded({name:t}))},Gi=(e,n)=>{const t=Vi(n),o=tr(e,{nodeDefaults:si,newNodeId:ye,sectionLabel:di,blockIsOffered:rr}),r=o?Zt.insertNode(ae,t,o):Zt.insertSection(e,t);return Wi(t,r,di(e),o?((e,n,t)=>{if(e.type===t)return null;const o={at:null},r=(e,n,i)=>{const l=i.filter(n=>n===e.type).length;for(const{child:s,zone:d,index:c}of fe(xt,e)){if(s.type===t&&(!o.at||n>o.at.depth)){const r=or(e.type,l,d.slice(d.lastIndexOf(":")+1)),i=r?.choices??(r?.spec?[{type:r.spec.childType,label:r.spec.childType}]:[]);null!==r&&"footer"!==r.source&&`${e.props.id}:${r.slot}`===d&&i.some(e=>e.type===t)&&(o.at={zone:d,index:c,depth:n})}r(s,n+1,[...i,e.type])}};return r({type:e.type,props:{...e.props,id:n}},1,[]),o.at?{zone:o.at.zone,index:o.at.index}:null})(o,r,e):null),t},Hi=e=>Di(ae,e),Di=(e,n)=>{Nr.current=document.activeElement??null,po&&(Oo.current=$o.current,$o.current=!1,uo()),Mo(null===n?null:{zone:e,index:n}),Po(!0),Qt||(Oo.current=!0,kt({type:"setUi",ui:{leftSideBarVisible:!0}}))},Ui=()=>{Po(!1),Mo(null),Oo.current&&kt({type:"setUi",ui:{leftSideBarVisible:!1}}),Oo.current=!1},Ji=(e,n)=>ir.rowName?n?jt(e)?ir.rowName(e,"section",Lt.header):Mt(e)?ir.rowName(e,"section",Lt.footer):Nt(e.type)?ir.rowName(e,"section",li(e.type)):ci(e):xi(e):n?di(e.type):li(e.type),Xi=e=>n=>{e()},Ki=()=>Yo.editPinnedSource?.(),Yi=(e,n,t)=>{if(pt)return null;const o=ui(e)[n];return o&&!pe(xt,o.type).delete?null:/* @__PURE__ */Dn(je,{kind:"delete",label:Lt.deleteNamed({name:t}),onClick:()=>((e,n)=>{const t=ui(e)[n]?.props?.id;null!=t&&ri(String(t))})(e,n),children:/* @__PURE__ */Dn(Fn,{size:15})})},qi=e=>ir.rowPreview?.(e)||void 0,Zi=e=>ir.rowMarks?.(e)??void 0,_i=(e,n,t)=>ir.rowActions?.(e,n,t)??null,Qi=(e,n,t,o)=>{if(pt)return null;const r=Boolean(t.props._hidden);/* @__PURE__ */
|
|
10
|
-
return Dn(je,{kind:"eye",label:r?Lt.showNamed({name:o}):Lt.hideNamed({name:o}),onClick:()=>nl(e,n,t),children:/* @__PURE__ */Dn(r?Wn:Gn,{size:14,strokeWidth:1.8,strokeLinecap:void 0,strokeLinejoin:void 0})})},el=e=>us(ae,e),nl=(e,n,t)=>{Zt.replaceComponent(e,n,{...t,props:{...t.props,_hidden:!t.props._hidden}})},tl=e=>he(xt,e),ol=e=>fe(xt,e),rl=e=>_o.slotsOf?hi(e).map(n=>({slot:n.slot,rung:n.rung?n:null,kids:me(e,n.slot)})):[{slot:null,rung:null,kids:ol(e)}],il=e=>_o.slotsOf?rl(e).flatMap(e=>e.kids):ol(e),ll=e=>Boolean(_o.slotsOf)&&hi(e).some(e=>e.rung),sl=(e,n,t)=>null===t?void 0===n?or(e):or(e,n):or(e,n,t),dl=(e,n,t)=>{const o=ge(xt,e.type,n)&&(t||il(e).length>0||ll(e));return{collapsible:o,folded:o&&Cr(String(e.props.id))}},cl=(e,n,t)=>rl(e).flatMap(o=>{const r=o.rung?n+1:n,i=o.kids.flatMap(({child:e})=>dl(e,r,t(e.type)).collapsible?[String(e.props.id),...cl(e,r+1,t)]:[]);return o.rung?[`${e.props.id}:${o.rung.slot}`,...i]:i}),al=e=>il(e).length>0||ll(e)||Boolean(or(e.type)),pl=e=>Boolean(or(e)),ul=(e,n,t,o)=>{if(Eo(K),or(o)?.spec?.slider){const t=e.split(":")[0];p(t,n),Zt.select({index:n,zone:e}),a(t)}else Zt.select({index:n,zone:e}),Ei(t)},fl=(e,n,t,o,r)=>{const i=`${e}:${n}`;Zt.insertComponent(i,t,o),or(r)?.spec?.slider?requestAnimationFrame(()=>{p(e,o),Zt.select({index:o,zone:i})}):Zt.select({index:o,zone:i})},hl=Bn(/* @__PURE__ */new Set);Pn(()=>{Zr.forEach(e=>{const n=or(e.type)?.spec;if(!n)return;const t=e.props.id;if(hl.current.has(t))return;hl.current.add(t);if((Array.isArray(e.props[n.slot])?e.props[n.slot]:[]).length>0)return;if(n.skipSeed?.(e.props))return;const o=`${t}:${n.slot}`,r=n.legacy?.(e.props)??[];(r.length?r:n.seeds(si)).forEach((e,t)=>Kt.seedChild(o,t,n.childType,e))})},[Zr,Kt,si]);const ml=Bn(/* @__PURE__ */new Set);Pn(()=>{Zr.forEach((e,t)=>{const o=e.props.id;if(ml.current.has(o))return;const r=n(e,tl(e.type));ml.current.add(o),r&&Kt.replaceComponent(ae,t,{...e,props:r})})},[Zr,Kt]),re(Kt,xt);const gl=Zr.findIndex(Mt),yl=gl>=0?Zr[gl]:null,Sl=Tt?Zr.findIndex(jt):-1,kl=Sl>=0?Zr[Sl]:null,vl=zt.groupTab,bl=In(()=>vl?e=>Nt(e.type):void 0,[vl]),wl=Boolean(zt.groupBadge),xl=zt.groupBadge?/* @__PURE__ */Dn("span",{className:"es-tree-group-badge",children:/* @__PURE__ */Dn(Mn,{tone:"info",size:"xs",children:zt.groupBadge})}):void 0,zl=Zr.find(e=>e.type===Bt)??null,Cl=Zr.find(e=>e.type===It)??null,Bl=gl>=0?gl:Zr.length,Il=[];Zr.forEach(e=>{Mt(e)||(al(e)&&Il.push(String(e.props.id)),Il.push(...cl(e,1,pl)))}),yl&&(Il.push(String(yl.props.id)),Il.push(...cl(yl,1,pl)));const Nl=Il.length>0&&Il.every(e=>Sr.has(e)),Pl=e=>{const n=ir.blockRowName(e,li);return ir.rowName?ir.rowName(e,"block",n):n},Ol=(e,n,t,o)=>{const r=ui(e)[t];if(!r)return;const i={...xn(e),index:t},l={...xn(n),index:Math.min(Math.max(o,0),ui(n).length)},s=pn(i,l);if(e!==n||s!==t)try{oi.move(String(r.props.id),{...l,index:s})}catch(e){if(!(e instanceof Cn))throw e}},$l=e=>{const n=/* @__PURE__ */new Set,t=e=>{for(const{child:o,zone:r}of ol(e))n.add(r),t(o)};for(const t of tl(e.type))n.add(`${e.props.id}:${t}`);return t(e),n},jl=e=>{let n=e.slice(0,e.indexOf(":"));for(let e=0;e<64;e++){const e=ai.get(n);if(!e)return null;if(e.zone===ae)return n;n=e.zone.slice(0,e.zone.indexOf(":"))}return null},Ml=e=>{const n=e.slice(0,e.indexOf(":")),t=Zr.find(e=>Nt(e.type)&&String(e.props.id)===n);return t&&Pt(n)===e?t:null},Tl=(e,n)=>{const t=Ml(e);return!t||(!zt.groupAccepts||zt.groupAccepts(t.type,n,ui(e).length))},Al=(e,n,t)=>{if(e.rung){const t=fi(e.rung.nodeId),o=t?hi(t).filter(e=>e.rung).length:0;return n.parentId===e.rung.nodeId&&n.slot===Qn&&n.index>=0&&n.index<=o}if(n.slot===Qn)return!1;if(e.add)return Rl(e.add,n);const o=wn(n);if(Nt(e.type))return!1;const r=Ml(o),i=Ml(e.zone);if(r||i)return!(!r||!i)&&(!(r!==i&&!Tl(o,e.type))&&(n.index>=0&&n.index<=ui(o).length));if(e.zone===ae||o===ae){if(e.zone!==o)return!1;const{floor:t,cap:r}=_r();return n.index>=t&&n.index<=r}if(n.index<0||n.index>ui(o).length)return!1;if(e.zone===o)return!0;const l=yl&&!zt.lastIsOpen?String(yl.props.id):null;return(!l||jl(e.zone)!==l&&jl(o)!==l)&&((e,n,t,o)=>{if(e===n)return!0;const r=o??ui(e)[t];if(!r)return!1;const i=n.split(":")[0],l=ai.get(i),s=l?ui(l.zone)[l.index]:void 0;if(!s)return!1;if(!o&&$l(r).has(n))return!1;const d=or(s.type,nr(St?.data,s.type,i),n.slice(n.lastIndexOf(":")+1));return!!d&&(!!(d.choices?d.choices.some(e=>e.type===r.type):d.spec?.childType===r.type)&&!d.spec?.addBlocked?.(ui(n),r))})(e.zone,o,e.index,t)},Ll=(e,n)=>{const t=wn(e.from),o=e.node;return t===wn(n)?Tl(t,o.type):Al({id:String(o.props?.id??""),zone:t,index:-1,type:o.type},n,o)},El=e=>{const n=e.slice(0,e.indexOf(":")),t=ai.get(n),o=t?ui(t.zone)[t.index]:void 0;if(!t||!o)return null;const r=or(o.type,nr(St?.data,o.type,n),e.slice(e.lastIndexOf(":")+1));if(!r||`${n}:${r.slot}`!==e)return null;if("footer"===r.source)return null;const i=r.choices??(r.spec?[{type:r.spec.childType,label:li(r.spec.childType)}]:[]),l=mi(e);return{parent:o,parentId:n,target:r,choices:i,parentName:l?l.slot.label:Ji(o,t.zone===ae)}},Rl=(e,n)=>{const t=wn(n);if("block"!==e.kind){if(Ml(t)){const o="section"===e.kind?e.type:e.template.node.type;return Tl(t,o)&&n.index>=0&&n.index<=ui(t).length}if(t!==ae)return!1;const{floor:o,cap:r}=_r();return n.index>=o&&n.index<=r}if(t===ae)return!1;const o=El(t);return!(!o||!o.choices.some(n=>n.type===e.type))&&!o.target.spec?.addBlocked?.(ui(t))},Vl=(e,n)=>{if("block"!==e.kind&&Ml(wn(n)))return void((e,n,t)=>{const o="section"===e.kind?e.type:"template"===e.kind?e.template.node.type:null;if(o&&Tl(n,o)){if("section"===e.kind)Zt.insertComponent(n,e.type,t);else{if("template"!==e.kind)return;Zt.insertNode(n,t,ni(e.template.node))}Eo(K),Zt.select({index:t,zone:n})}})(e,wn(n),n.index);if("section"===e.kind)return void Gi(e.type,n.index);if("template"===e.kind)return void((e,n,t)=>{const o=Vi(t),r=Zt.insertNode(ae,o,n);Wi(o,r,e)})(e.template.name,ni(e.template.node),n.index);const t=wn(n),o=El(t);o&&(o.target.spec?fl(o.parentId,o.target.slot,e.type,n.index,o.parent.type):((e,n,t)=>{Zt.insertComponent(e,n,t),Eo(K),Zt.select({index:t,zone:e})})(t,e.type,n.index))},Fl=(e,n)=>{e.rung?vi(e.rung.nodeId,e.index,n.index):e.add?Vl(e.add,n):e.zone===ae?Fi(e.index,n.index):Ol(e.zone,wn(n),e.index,n.index)},[Wl]=Nn(()=>cn()),Gl=an({keyOf:e=>e.id,readOnly:Boolean(pt),session:Wl,canDrop:Al,onDrop:Fl,onStep:(e,n)=>{e.rung?vi(e.rung.nodeId,e.index,n<0?e.index-1:e.index+2):e.zone===ae?((e,n)=>{const t=di(Zr[e]?.type??""),o=Fi(e,n<0?e-1:e+2);if(!o.moved)return void Or(n<0?Lt.sectionFirst({name:t}):Lt.sectionLast({name:t}));const{floor:r,cap:i}=_r();Or(Lt.sectionMoved({name:t,n:o.dest-r+1,total:i-r}))})(e.index,n):Ol(e.zone,e.zone,e.index,n<0?e.index-1:e.index+2)}}),Hl=On(e=>{const{floor:n,cap:t}=_r(),o=[];for(const r of e.nodes){const e=wn(r.place),i=ui(e)[r.place.index];if(!i||String(i.props.id)!==r.id)continue;if(jt(i)||Mt(i)||Qo(i.type))continue;if(Nt(i.type))continue;const l=Boolean(Ml(e)),s=e===ae||l;e===ae&&t-n<2||o.push({key:r.id,item:{id:r.id,zone:e,index:r.place.index,type:i.type},box:r.box,label:s?di(i.type):xi(i),from:r.place})}const r=e.zones.flatMap(e=>{const n=wn(e.list);if(n===ae&&0===e.children.length)return[{...e,addLabel:Lt.addSection,addAlways:!0}];const t=El(n),o=t?.target.spec?.addLabel;return e.children.length>0||Boolean(t?.choices.length)||Boolean(Ml(n))?[o?{...e,addLabel:o}:e]:[]}),i=r.flatMap(e=>{const n=wn(e.list),t=n===ae||Ml(n)?null:El(n);return t?.choices.length?rn(e,t.target.spec?.addLabel??Lt.addBlockHere):[]});return{sources:o,zones:r,seams:i}},[St.data]),Dl=null==bt?.props.id?null:String(bt.props.id),Ul=On(e=>{const n=xt,t=e=>!e.item.rung&&null!==zn(St.data,n,e.item.id),o=e[e.length-1];if(!t(o))return o;const r=n=>e.find(e=>t(e)&&e.item.id===n),i=r(Dl);return i||(r(Re(St.data,n,o.item.id,Dl,bl))??o)},[St.data,xt,Dl,bl]),[Jl,Xl]=Nn(null);mn(wo,"mouseover",e=>{if(!vl)return;const n=gn(e.target),t=n?Kn(St.data,xt,n):null;t!==Jl&&Xl(t)}),mn(wo,"mouseout",e=>{vl&&!e.relatedTarget&&Xl(null)});const Kl=e=>jt(e)||Mt(e)||Nt(e.type),Yl=[];if(vl){const e=Dl?Kn(St.data,xt,Dl):null;for(const n of/* @__PURE__ */new Set([e,Jl])){const e=n?Zr.find(e=>String(e.props.id)===n):void 0;if(!e||!Kl(e))continue;const t=vl(e);t&&Yl.push({id:String(e.props.id),label:t,below:jt(e)||e.type===Bt})}}const ql=E(),Zl=Bn(null);Pn(()=>{const e=zt.changeNotice;if(!e)return;const n=JSON.stringify(Zr.filter(Kl)),t=Zl.current;if(Zl.current={doc:Sn,bands:n,index:vt.index},!t||t.doc!==Sn||t.bands===n)return;vt.hasPast&&vt.index>=t.index&&!Xn.has(ql)&&(Xn.add(ql),Or(e,"success",{action:{label:Lt.bar.undo,onClick:()=>vt.back()},duration:8e3}))},[Zr]);const _l=e=>{Eo(K),Zt.select(e.zone===ae?{index:e.index}:{index:e.index,zone:e.zone})},Ql=ie(),es=()=>({data:St.data,device:lo,ops:Zt,inspector:Ko}),ns=Ql?.model,ts=In(()=>ns?e=>ns(e,Hl(e),es()):Hl,[ns,Hl,lo]),os=Ql?.measure,rs=os?(e,n)=>os(e,n,es()):void 0,is=Ql?.canDrop,ls=is?(e,n)=>is(e,n,Al,es()):Al,ss=Ql?.drop,ds=ss?(e,n)=>ss(e,n,Fl,es()):Fl,cs=Ql?.pick,as=cs?e=>cs(e,_l,es()):_l,ps=e=>{const n=wn(e),t=mi(n);t&&Si(t.node,t.slot,!1),Di(n,e.index)},us=(e,n)=>/* @__PURE__ */Dn(Me,{...pt?{}:Gl.seam({place:{...xn(e),index:n}})},`seam:${e}:${n}`),fs={rowClick:Xi,isCollapsed:Cr,toggleCollapse:Br},hs=e=>{const n=String(e.props.id),t=Zr.findIndex(e=>String(e.props.id)===n),o=Pt(n),r=ui(o),i=Cr(n),l=li(e.type),s=ir.rowName?ir.rowName(e,"section",l):l,d=e=>us(o,e);/* @__PURE__ */
|
|
11
|
-
return Un(Jn,{children:[
|
|
12
|
-
/* @__PURE__ */Dn(Ne,{words:Et,icon:/* @__PURE__ */Dn(sr,{type:e.type,size:13}),name:s,preview:qi(e),marks:Zi(e),onSelect:()=>Ri(t),nameSlot:Ci(ae,t,n,s),selected:Vo===n,badge:xl,actions:_i(e,ae,t)??void 0,rowProps:{"data-node-id":n,onClick:Xi(()=>Ri(t))},fold:{open:!i,label:"section",onToggle:()=>Br(n)}}),!i&&/* @__PURE__ */Un(Pe,{children:[r.map((n,t)=>{const r=String(n.props.id),i=ci(n),l=al(n),s=l&&Cr(r),c=()=>ul(o,t,r,e.type),{rowProps:a,...p}=Gl.row({item:{id:r,zone:o,index:t,type:n.type},place:{...xn(o),index:t}},{"data-node-id":r,onClick:Xi(c)});/* @__PURE__ */
|
|
13
|
-
return Un(jn,{children:[d(t),
|
|
14
|
-
/* @__PURE__ */Dn(Ne,{words:Et,icon:/* @__PURE__ */Dn(sr,{type:n.type,size:13}),name:i,preview:qi(n),marks:Zi(n),onSelect:c,nameSlot:Ci(o,t,r,i),selected:Vo===r,hidden:Boolean(n.props._hidden),...p,fold:l?{open:!s,label:"section",onToggle:()=>Br(r)}:void 0,actions:/* @__PURE__ */Un(Jn,{children:[Yi(o,t,i),_i(n,o,t),Qi(o,t,n,i)]}),rowProps:a}),l&&!s&&/* @__PURE__ */Dn(Pe,{children:ys(n,2)})]},r)}),d(r.length)]})]})},ms=(e,n,t,o,r)=>{const i=String(e.props.id),l=`${i}:${n.slot}`,s=Gl.dragging,d=!Cr(l)&&s?.rung?.nodeId!==i,c={...xn(l),index:0},a=s&&!s.rung&&Al(s,c)?c:void 0,p=()=>Si(e,n,!0),{rowProps:u,...f}=Gl.row({item:{id:`rung:${l}`,zone:`${i}:${Qn}`,index:t,type:e.type,rung:{nodeId:i,slot:n.slot}},place:{parentId:i,slot:Qn,index:t},into:a,canDrag:Boolean(_o.moveSlot)&&!1!==n.movable&&o>1},{"data-slot-zone":l,onClick:Xi(p)}),h=pt?null:_o.slotActions?.(e,n.slot);/* @__PURE__ */
|
|
15
|
-
return Un(jn,{children:[n.heading,
|
|
16
|
-
/* @__PURE__ */Dn(Ne,{words:Et,icon:n.glyph??null,name:n.label,badge:n.badge,onSelect:p,selected:gi===l,...f,dragHint:n.dragHint,fold:{open:d,label:n.label,onToggle:()=>Br(l)},actions:h&&h.length>0?/* @__PURE__ */Dn(Jn,{children:h.map((t,o)=>/* @__PURE__ */Dn(je,{kind:"delete"===t.kind?"delete":"plain",label:t.label,disabled:t.disabled,onClick:()=>((e,n,t)=>{if(pt||t.disabled)return;const o=String(e.props.id),r=e=>{"string"==typeof e&&ki(o,e,n.panel)},i=t.run();i&&"function"==typeof i.then?i.then(r):r(i)})(e,n,t),children:"delete"===t.kind?/* @__PURE__ */Dn(Fn,{size:15}):/* @__PURE__ */Dn(Hn,{size:15})},`${o}:${t.kind}`))}):void 0,rowProps:u}),d&&/* @__PURE__ */Dn(Pe,{children:r})]},l)},gs=(e,n)=>{const t=rl(e),o=t.filter(e=>e.rung).length;let r=0;/* @__PURE__ */
|
|
17
|
-
return Dn(Jn,{children:t.map(t=>{const i=t.kids,l=t.rung?n+1:n,s=sl(e.type,void 0,t.slot),d=s?`${e.props.id}:${s.slot}`:null,c=null===t.slot?null:`${e.props.id}:${t.slot}`,a=(e,n)=>us(e,n),p=/* @__PURE__ */Un(Jn,{children:[i.map(({child:n,zone:t,index:o})=>{const r=Vo===String(n.props.id),{collapsible:i,folded:s}=dl(n,l,pl(n.type)),d=String(n.props.id),c=Pl(n),p=()=>ul(t,o,d,e.type),{rowProps:u,...f}=Gl.row({item:{id:d,zone:t,index:o,type:n.type},place:{...xn(t),index:o}},{"data-node-id":d,onClick:Xi(p)});/* @__PURE__ */
|
|
18
|
-
return Un(jn,{children:[0===o&&a(t,0),
|
|
19
|
-
/* @__PURE__ */Dn(Ne,{words:Et,icon:/* @__PURE__ */Dn(sr,{type:n.type,size:13}),name:c,preview:qi(n),marks:Zi(n),onSelect:p,nameSlot:Ci(t,o,d,c),selected:r,hidden:Boolean(n.props._hidden),...f,fold:i?{open:!s,label:"group",onToggle:()=>Br(d)}:void 0,actions:/* @__PURE__ */Un(Jn,{children:[Yi(t,o,c),_i(n,t,o),Qi(t,o,n,c)]}),rowProps:u}),i&&!s&&/* @__PURE__ */Dn(Pe,{children:gs(n,l+1)}),a(t,o+1)]},String(n.props.id??`${t}-${o}`))}),null===c?d&&!i.some(e=>e.zone===d)?a(d,0):null:0!==i.length||!t.rung&&d!==c?null:a(c,0)]});return t.rung?ms(e,t.rung,r++,o,p):/* @__PURE__ */Dn(jn,{children:p},t.slot??"")})})},ys=(e,n)=>{const t=nr(St?.data,e.type,String(e.props.id)),o=rl(e),r=o.filter(e=>e.rung).length;let i=0;/* @__PURE__ */
|
|
20
|
-
return Dn(Jn,{children:o.map(o=>{const l=o.kids,s=o.rung?n+1:n,d=sl(e.type,t,o.slot),c=d?.spec??null,a=c&&Array.isArray(e.props[c.slot])?e.props[c.slot]:[],p=d&&d.choices?{slot:d.slot,choices:d.choices}:null,u=String(e.props.id),f=c&&!c.fixed?`${u}:${c.slot}`:null,h=p?`${u}:${p.slot}`:null,m=(e,n)=>us(e,n),g=null===o.slot?null:`${u}:${o.slot}`,y=Boolean(c&&!c.fixed&&(null===g||g===f)),S=/* @__PURE__ */Un(Jn,{children:[l.map(({child:n,zone:t,index:o})=>{const r=Vo===String(n.props.id),i=xi(n),l=String(n.props.id),{collapsible:d,folded:c}=dl(n,s,pl(n.type)),a=tl(n.type),p=1===a.length?`${l}:${a[0]}`:null,u=p?{...xn(p),index:ui(p).length}:void 0,f=Gl.dragging,h=u&&f&&Al(f,u)?u:void 0,g=()=>ul(t,o,l,e.type),{rowProps:y,...S}=Gl.row({item:{id:l,zone:t,index:o,type:n.type},place:{...xn(t),index:o},into:h,canDrag:!Qo(n.type)},{"data-node-id":l,onClick:Xi(g)});/* @__PURE__ */
|
|
21
|
-
return Un(jn,{children:[0===o&&m(t,0),
|
|
22
|
-
/* @__PURE__ */Dn(Ne,{words:Et,icon:/* @__PURE__ */Dn(sr,{type:n.type,size:13}),name:i,preview:qi(n),marks:Zi(n),onSelect:g,nameSlot:Ci(t,o,l,i),selected:r,hidden:Boolean(n.props._hidden),...S,fold:d?{open:!c,label:"group",onToggle:()=>Br(l)}:void 0,actions:Qo(n.type)?_i(n,t,o)??void 0:/* @__PURE__ */Un(Jn,{children:[Yi(t,o,i),_i(n,t,o),Qi(t,o,n,i)]}),rowProps:y}),d&&!c&&/* @__PURE__ */Dn(Pe,{children:ys(n,s+1)}),m(t,o+1)]},String(n.props.id??`${t}-${o}`))}),y&&c&&
|
|
23
|
-
/* @__PURE__ */Dn(M,{small:!0,label:c.addLabel,blocked:c.addBlocked?.(a)??null,onAdd:()=>fl(e.props.id,c.slot,c.childType,a.length,e.type)}),null===g?h&&!l.some(e=>e.zone===h)?m(h,0):null:0!==l.length||(o.rung?y:g!==h)?null:m(g,0)]});return o.rung?ms(e,o.rung,i++,r,S):/* @__PURE__ */Dn(jn,{children:S},o.slot??"")})})},Ss=No||null!==po,ks=e=>"panel"in e?{id:e.id,label:e.label,icon:e.icon,active:Qt&&!Ss&&Zo===e.id,onSelect:()=>Xr(e.id)}:e,vs=[...(Yo.railLead??[]).map(ks),{id:"sections",label:Lt.layers,icon:/* @__PURE__ */Dn(Ve,{}),active:Qt&&!Ss&&"sections"===Zo,onSelect:()=>Xr("sections")},...(Yo.railTrail??[]).map(ks)];ao?vs.push({id:"media",label:Lt.railMedia,icon:/* @__PURE__ */Dn(Fe,{}),active:Qt&&!No&&(null!==po||"media"===Zo),onSelect:()=>Xr("media")}):mt&&vs.push({id:"media",label:Lt.railMedia,icon:/* @__PURE__ */Dn(Fe,{}),onSelect:Kr});const bs=[...Yo.railLead??[],...Yo.railTrail??[]].find(e=>"panel"in e&&e.id===Zo),ws=Boolean(At?.foldable)&&!qo,xs=At?.label??(gt?Lt.pageSections:Lt.templateSections),zs=ws&&Cr(et),Cs=/* @__PURE__ */Un(Jn,{children:[Zr.map((e,n)=>{if(jt(e)||Mt(e)||Nt(e.type))return null;const t=Vo===String(e.props.id),o=Boolean(e.props._hidden);ol(e);const r=String(e.props.id),i=Yo.hasOwnRows?.(e)??!1,l=al(e)||i,s=l&&Cr(r),d=tl(e.type),c=1===d.length?`${r}:${d[0]}`:null,a=c?{...xn(c),index:ui(c).length}:void 0,p=Gl.dragging,u=a&&p&&Al(p,a)?a:void 0,{rowProps:f,...h}=Gl.row({item:{id:r,zone:ae,index:n,type:e.type},place:{...xn(ae),index:n},into:u},{"data-node-id":r,onClick:Xi(()=>Ri(n))});/* @__PURE__ */
|
|
24
|
-
return Un(jn,{children:[n>0&&el(n),
|
|
25
|
-
/* @__PURE__ */Dn(Ne,{words:Et,icon:/* @__PURE__ */Dn(sr,{type:e.type,size:13}),name:ci(e),preview:qi(e),marks:Zi(e),onSelect:()=>Ri(n),nameSlot:Ci(ae,n,r,ci(e)),selected:t,hidden:o,...h,fold:l?{open:!s,label:"section",onToggle:()=>Br(r)}:void 0,actions:/* @__PURE__ */Un(Jn,{children:[Yi(ae,n,ci(e)),_i(e,ae,n),Qi(ae,n,e,ci(e))]}),rowProps:f}),al(e)&&!s&&/* @__PURE__ */Un(Pe,{children:[ys(e,1),Yo.partRows?.(e,fs)]}),i&&!s&&/* @__PURE__ */Dn(Pe,{children:Yo.ownRows?.(e,n,fs)})]},String(e.props.id??n))}),!qo&&Bl>0&&el(Bl)]}),Bs=(e,n,t)=>{const o=String(e.props.id),r=il(e).length>0||ll(e)||Boolean(or(e.type)),i=r&&Cr(o),l="header"===t?Lt.header:Lt.footer,s=ir.rowName?ir.rowName(e,"section",l):l;/* @__PURE__ */
|
|
26
|
-
return Un(Jn,{children:[
|
|
27
|
-
/* @__PURE__ */Dn(Ne,{words:Et,icon:/* @__PURE__ */Dn(sr,{type:t,size:13}),name:s,preview:qi(e),marks:Zi(e),badge:xl,onSelect:()=>Ri(n),nameSlot:Ci(ae,n,o,s),selected:Vo===String(e.props.id),fold:r?{open:!i,label:"section",onToggle:()=>Br(o)}:void 0,actions:_i(e,ae,n)??void 0,rowProps:{"data-node-id":o,onClick:Xi(()=>Ri(n))}}),r&&!i&&/* @__PURE__ */Dn(Pe,{children:gs(e,1)})]})};return(Yo.wrap??(e=>e))(
|
|
28
|
-
/* @__PURE__ */Dn(le,{target:wo,children:/* @__PURE__ */Un("div",{ref:bo,className:"sf-editor es-editor",style:Ze(vr),onContextMenu:$i.onEditorContextMenu,...g(fn),children:[
|
|
29
|
-
/* @__PURE__ */Un(We,{children:[
|
|
30
|
-
/* @__PURE__ */Dn(Ge,{items:vs,ariaLabel:Lt.bar.views}),
|
|
31
|
-
/* @__PURE__ */Un(He,{children:[
|
|
32
|
-
/* @__PURE__ */Dn(De,{label:Lt.bar.undo,disabled:Boolean(pt)||!vt.hasPast,onClick:()=>vt.back(),children:/* @__PURE__ */Dn(Ln,{})}),
|
|
33
|
-
/* @__PURE__ */Dn(De,{label:Lt.bar.redo,disabled:Boolean(pt)||!vt.hasFuture,onClick:()=>vt.forward(),children:/* @__PURE__ */Dn(En,{})}),
|
|
34
|
-
/* @__PURE__ */Dn(Ue,{}),
|
|
35
|
-
/* @__PURE__ */Dn(Je,{devices:no,value:lo,onChange:so}),
|
|
36
|
-
/* @__PURE__ */Dn(De,{label:Lt.bar.refresh,tip:Lt.bar.refreshTip,onClick:()=>{vo.current=(()=>{const e=wo?.document;if(!e)return null;const n=Zr.findIndex(Mt),t=n>=0?n:Zr.length;let o=null;for(let n=0;n<t;n++){const t=Zr[n]?.props?.id;if(null==t)continue;const r=e.querySelector(`[data-puck-component="${CSS.escape(String(t))}"]`);if(!r)continue;const i=r.getBoundingClientRect().top;i<=4&&(null===o||i>o.offset)&&(o={id:String(t),offset:i})}if(!o){const e=bt?.props?.id??Zr[0]?.props?.id;null!=e&&(o={id:String(e),offset:0})}return o})(),ko(e=>e+1)},children:/* @__PURE__ */Dn(Rn,{})})]}),
|
|
37
|
-
/* @__PURE__ */Un(He,{kind:"right",style:{minWidth:300},children:[
|
|
38
|
-
/* @__PURE__ */Dn(B,{input:Bo,words:Lt.saveStatus}),Yo.barLead?.(),Yo.barTrail?.(),Yo.mainAction||!Yo.barMain?/* @__PURE__ */Dn(I,{input:Bo,action:Yo.mainAction??{label:Lt.done,onPress:()=>{ot(St.data)}},readOnly:Boolean(pt),saveSwitch:ft,onToggleAutoSave:st,onSaveNow:Io,bar:Lt.bar,words:Lt.saveStatus}):Yo.barMain()]})]}),
|
|
39
|
-
/* @__PURE__ */Dn(C,{}),
|
|
40
|
-
/* @__PURE__ */Un("div",{className:"sf-body",children:[Qt?/* @__PURE__ */Un(Jn,{children:[
|
|
41
|
-
/* @__PURE__ */Dn("aside",{className:"es-sidepanel es-sidepanel--left sf-panel sf-panel--left","aria-label":Lt.leftPanel,children:No?/* @__PURE__ */Dn(T,{at:jo?{label:(e=>{const n=Ml(e.zone);if(n)return Lt.add.addingTo({name:ir.rowName?Ji(n,!0):li(n.type)});if(e.zone===ae){const n=Zr[e.index];return n&&!Mt(n)?Lt.add.addingBefore({name:Ji(n,!0)}):Lt.add.addingAtEnd}const t=El(e.zone);return t?Lt.add.addingTo({name:t.parentName}):Lt.add.addingHere})(jo),onClear:()=>Mo(null)}:void 0,placeBlocks:jo&&jo.zone!==ae?El(jo.zone)?.choices:void 0,canTake:jo?e=>{if(!jo)return null;const n={...xn(jo.zone),index:jo.index};if(Rl(e,n))return null;const t=Ml(jo.zone);if(t)return Lt.add.notInside({name:Ji(t,!0)});if(jo.zone===ae)return Lt.add.onlySections;const o=El(jo.zone);return o?Lt.add.notInside({name:o.parentName}):Lt.add.onlySections}:void 0,onPick:jo?e=>{if(!jo)return;const n={...xn(jo.zone),index:jo.index};Rl(e,n)&&(Vl(e,n),Ui())}:void 0,itemFor:e=>({id:`new:${e.kind}:${"template"===e.kind?e.template.id:e.type}`,zone:"",index:-1,type:"template"===e.kind?e.template.node.type:e.type,add:e}),session:Wl,siteWide:Yo.addPanelRow?.(Ui),onClose:Ui,onHide:Ur,readOnly:Boolean(pt)}):po&&co?
|
|
42
|
-
/* @__PURE__ */Dn(R,{panel:co,pick:po,onHide:Ur}):bs?bs.panel({onHide:Ur,notify:Or}):"media"===Zo&&co?/* @__PURE__ */Dn(R,{panel:co,pick:null,onHide:Ur}):/* @__PURE__ */Un(Jn,{children:[
|
|
43
|
-
/* @__PURE__ */Dn(A,{icon:/* @__PURE__ */Dn(Ve,{}),title:Lt.layers,context:Dt,actions:/* @__PURE__ */Un(Jn,{children:[!pt&&/* @__PURE__ */Dn(Xe,{label:Lt.add.title,onClick:()=>Hi(null),children:/* @__PURE__ */Dn(Vn,{size:15})}),
|
|
44
|
-
/* @__PURE__ */Dn(Xe,{label:Nl?Lt.expandAll:Lt.collapseAll,title:0===Il.length?Lt.nothingToFold:void 0,disabled:0===Il.length,onClick:()=>kr(e=>{const n=new Set(Il);return Nl?new Set([...e].filter(e=>!n.has(e))):/* @__PURE__ */new Set([...e,...Il])}),children:/* @__PURE__ */Dn(qn,{expand:Nl})})]}),onHide:Ur}),
|
|
45
|
-
/* @__PURE__ */Un(Oe,{className:"sf-tree sf-scroll",words:Et,children:[
|
|
46
|
-
/* @__PURE__ */Dn(Ne,{words:Et,icon:/* @__PURE__ */Dn(sr,{type:"page",size:13}),name:Lt.pageSettings,onSelect:Yr,selected:!bt&&Ro,rowProps:{onClick:Xi(Yr)}}),zl&&/* @__PURE__ */Un(Jn,{children:[!wl&&/* @__PURE__ */Dn($e,{children:Lt.header}),hs(zl)]}),!qo&&yt&&!(wl&&zl)&&/* @__PURE__ */Un(Jn,{children:[!wl&&/* @__PURE__ */Dn($e,{children:Lt.header}),!Tt&&/* @__PURE__ */Dn(Ne,{words:Et,icon:/* @__PURE__ */Dn(sr,{type:"header",size:13}),name:Lt.header,badge:xl,onSelect:qr,selected:Lo.kind===$t?.kind,rowProps:{onClick:Xi(qr)}})]}),!qo&&kl&&!(wl&&zl)&&Bs(kl,Sl,"header"),!qo&&!ws&&/* @__PURE__ */Dn($e,{children:xs}),ws?/* @__PURE__ */Un(Jn,{children:[
|
|
47
|
-
/* @__PURE__ */Dn(Ne,{words:Et,icon:null,name:xs,fold:{open:!zs,label:xs,onToggle:()=>Br(et)}}),!zs&&/* @__PURE__ */Dn(Pe,{children:Cs})]}):Cs,yt&&!wl&&/* @__PURE__ */Dn($e,{children:Lt.footer}),yl&&!(wl&&Cl)&&Bs(yl,gl,"footer"),!qo&&!yl&&yt&&!wl&&/* @__PURE__ */Dn(Ne,{words:Et,icon:/* @__PURE__ */Dn(sr,{type:"footer",size:13}),name:Lt.footer,onSelect:Ki,rowProps:{onClick:Xi(Ki),title:Lt.editFooter}}),Cl&&hs(Cl),Yo.treeFoot?.()]})]})}),
|
|
48
|
-
/* @__PURE__ */Dn(Ke,{side:"left",width:vr.left,min:qe,max:Ye,defaultWidth:k.left,label:Lt.resizeLeftPanel,onResize:xr})]}):/* @__PURE__ */Dn(L,{side:"left",onShow:Ur}),
|
|
49
|
-
/* @__PURE__ */Un("div",{ref:$r,className:"sf-center sf-scroll","data-sf-canvas-head":Lr?"":void 0,style:{overflowX:Gr?"auto":"hidden",overflowY:"hidden"},children:[Lr&&/* @__PURE__ */Dn("div",{ref:Er,className:"sf-canvas-head",children:/* @__PURE__ */Dn(Lr,{device:lo})}),
|
|
50
|
-
/* @__PURE__ */Un("div",{className:"sf-frame-scaler",style:Hr,children:[
|
|
51
|
-
/* @__PURE__ */Dn("div",{className:"sf-frame "+(lo===ro?"":`sf-frame--${lo}`),style:Dr,children:/* @__PURE__ */Un("div",{className:"sf-preview-host",children:[
|
|
52
|
-
/* @__PURE__ */Dn(Ie.Provider,{value:bl,children:/* @__PURE__ */Dn(Ut,{},So)}),
|
|
53
|
-
/* @__PURE__ */Dn(ln,{canvas:wo,session:Wl,model:ts,measure:rs,canDrop:ls,onDrop:ds,choose:Ul,onPick:as,onZoneAdd:ps,onSeamAdd:ps,zoneAddLabel:Lt.canvasAddBlock,words:Rt.canvas,readOnly:Boolean(pt),revision:St.data}),To.length>0&&/* @__PURE__ */Dn("div",{className:"sf-preview-gaps",children:To.map(e=>
|
|
54
|
-
/* @__PURE__ */Dn(sn,{index:e.index,label:Lt.addSectionHere,onInsert:()=>Hi(e.index),className:void 0===e.height?"sf-preview-gap":"sf-preview-gap sf-preview-gap--tight",style:void 0===e.height?{top:e.top}:{top:e.top,height:e.height}},e.index))})]})}),vl?/* @__PURE__ */Dn(Yn,{canvas:wo,tabs:Yl,onSelect:e=>{const n=Zr.findIndex(n=>String(n.props.id)===e);n>=0&&Ri(n)}}):null]})]}),eo?/* @__PURE__ */Un(Jn,{children:[
|
|
55
|
-
/* @__PURE__ */Dn(y,{value:{selectChild:ul,addChild:fl,childRowName:xi,blockRowName:Pl},children:/* @__PURE__ */Dn(Jt,{mode:Lo,onOpenWebsiteSettings:Yo.openSettings??(()=>{}),onOpenSiteStyles:Yo.openStyles,onSelectNode:pr,onNotify:Or,onHidePanel:Jr,nodeActions:bt?pe(xt,bt.type):nt})}),
|
|
56
|
-
/* @__PURE__ */Dn(Ke,{side:"right",width:vr.right,min:qe,max:Ye,defaultWidth:k.right,label:Lt.resizeSettingsPanel,onResize:zr})]}):
|
|
57
|
-
/* @__PURE__ */Dn(L,{side:"right",onShow:Jr})]}),$i.menu]})}))}export{tt as ScreenChrome};
|
package/dist/chunk-BHRC3ASL.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{hidableText as n}from"./chunk-6W7WLPZH.js";import{textFieldIdentifier as r}from"./chunk-DUVRZ456.js";function t(r,t){const o=n(r.props.name);if(o)return o;const e=n(r.props.altName);if(e)return e;const c=r.props.collection?.name;if(c)return c;const u=r.props.source?.title;if(u)return u;const s=r.props.code;return s?t?.(s)??s:""}function o(n,r,o,e,c){const u=o(t(n,e))||r(n.type);return c?c(n,"block",u):u}function e(n){if(!n)return null;for(const t of["name","altName"])if(r(n[t]))return t;return null}function c(n){const t=n?.name;return void 0===t||r(t)?"name":null}function u(r,t,o){const e=n(r.props?.name).trim()||t;return o?o(r,"section",e):e}export{u as rootRowName,c as sectionRenameProp,t as slotChildName,e as slotChildRenameProp,o as slotChildRowName};
|
package/dist/chunk-BPFPM3L4.js
DELETED
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
import{clientOnly as r}from"./chunk-GXQCZJOP.js";import{ScreenStoreProvider as n}from"./chunk-4ACVXF5V.js";import{ScreenChrome as e}from"./chunk-AZOCY74V.js";import{ScreenDocumentProvider as i,useScreenDocument as a}from"./chunk-GCCBEY2W.js";import{DEFAULT_SCREEN_WORDS as o}from"./chunk-VWXUMVCD.js";import{documentPermissions as s}from"./chunk-THWO5YVZ.js";import{useWords as c}from"./chunk-MFIRYGHW.js";import{useMemo as t,useState as d,useRef as l,useEffect as m,useCallback as g}from"react";import{Dialog as h,Button as f}from"efficient-shell/ui";import{jsx as u,jsxs as p,Fragment as v}from"react/jsx-runtime";var C=r(n),k=r(e);function j({onCancel:r,onDiscard:n,onSave:e}){const i=c("screen",o).leave,[a,s]=d(!1),t=l(!0);m(()=>(t.current=!0,()=>{t.current=!1}),[]);const C=g(async()=>{s(!0);try{await e()}finally{t.current&&s(!1)}},[e]);/* @__PURE__ */
|
|
2
|
-
return u(h,{open:!0,role:"alertdialog",size:"sm",title:i.title,onClose:r,footer:/* @__PURE__ */p(v,{children:[
|
|
3
|
-
/* @__PURE__ */u(f,{variant:"secondary",onClick:r,children:i.cancel}),
|
|
4
|
-
/* @__PURE__ */u(f,{variant:"ghost-danger",onClick:n,children:i.discard}),
|
|
5
|
-
/* @__PURE__ */u(f,{variant:"primary",loading:a,onClick:()=>{C()},children:i.save})]}),children:i.body})}function y({target:r,addressing:n,onHostMessage:e,children:a}){/* @__PURE__ */
|
|
6
|
-
return u(i,{target:r,addressing:n,onHostMessage:e,children:a})}var N=(r,n)=>/* @__PURE__ */p(v,{children:[r,n]});function V({config:r,parts:n,wrap:e=N}){const{data:i,error:d,redirecting:l,ready:m,readOnly:g,onChange:h,pendingNav:f,cancelPendingNav:p,discardAndNavigate:v,saveAndNavigate:y}=a(),V=t(()=>s(!g),[g]),A=c("screen",o);return l?/* @__PURE__ */u("div",{className:"sf-msg",children:A.loading}):d?/* @__PURE__ */u("div",{className:"sf-msg sf-msg--error",children:d}):m?i?e(
|
|
7
|
-
/* @__PURE__ */u(C,{config:r,data:i,onChange:h,permissions:V,parts:n,children:/* @__PURE__ */u(k,{})}),f&&/* @__PURE__ */u(j,{onCancel:p,onDiscard:v,onSave:y})):/* @__PURE__ */u("div",{className:"sf-msg",children:A.loading}):/* @__PURE__ */u("div",{className:"sf-msg",children:A.waitingForAuthorization})}export{V as DocumentScreen,y as ScreenMount};
|
package/dist/chunk-DD7A6RRL.js
DELETED
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
import{buildPaletteSections as e,pinnedSection as t,categoryLabel as o}from"./chunk-PA3PNTVV.js";import{blockTypesIn as n}from"./chunk-5ZBY24K7.js";import{sectionTemplatesOf as s}from"./chunk-BVN33R76.js";import{SidePanelHead as i,PanelModeExit as r}from"./chunk-PPL7GB7D.js";import{useEaselSession as l}from"./chunk-O7Q4DDJT.js";import{blockRuns as c}from"./chunk-HQ4VVRIC.js";import{useScreenBlockLook as a,useScreenBlockRules as p}from"./chunk-U7KFFC7N.js";import{DEFAULT_SCREEN_WORDS as m}from"./chunk-VWXUMVCD.js";import{useEasel as d}from"./chunk-SJPKSE5G.js";import{useWords as f}from"./chunk-MFIRYGHW.js";import{AddPanel as y}from"./chunk-47RGVCPH.js";import{DEFAULT_DRAG_WORDS as h}from"./chunk-GG4FGBFR.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 B=e=>`section:${e}`,F=e=>`block:${e}`,G=e=>`template:${e}`;function P({at:P,placeBlocks:$,canTake:w,onPick:C,itemFor:E,session:O,siteWide:R,onClose:x,onHide:D,readOnly:H}){const I=d(e=>e.config),L=a(),{labelAtLevel:N,categoryLabel:T,firstSection:A,Icon:S,Thumbnail:W}=L,{blockIsOffered:K,canAddTo:M}=p(),z=f("screen",m).add,J=f("drag",h).add,Q=l(),[U,Y]=u([]);k(()=>{let e=!1;const t=e=>K(e,Q);return s(Q).list().then(o=>{if(e)return;const s=I.components;Y(o.filter(e=>e.node?.type&&s[e.node.type]&&n(e.node).every(t)))}).catch(()=>{}),()=>{e=!0}},[I,Q]);const X=b(()=>e(I,L),[I]),Z=e=>({type:B(e.type),label:e.name,cover:/* @__PURE__ */j(W,{type:e.type}),title:e.desc?`${e.name} — ${e.desc}`:z.tile({name:e.name}),keywords:[e.alias??"",e.desc,e.type,e.catLabel].filter(Boolean)}),q=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=U.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(S,{type:e,size:26})}),ee=b(()=>{const e=t(X,A),n=/* @__PURE__ */new Map,s=e=>{!n.has(e.type)&&K(e.type,Q)&&n.set(e.type,e)};for(const t of e?[e]:X){const e=M(t.type)?.choices??[];e.forEach(s),e.forEach(e=>M(e.type,1)?.choices?.forEach(s))}$?.forEach(s);const i=new Set(X.map(e=>e.type)),r=[...n.values()].filter(e=>!i.has(e.type)),l=e=>({type:F(e.type),label:e.label,cover:_(e.type),title:z.tile({name:e.label}),keywords:[e.group??"",e.type].filter(Boolean)}),a=e=>n.has(e.type)?{...Z(e),cover:_(e.type)}:Z(e),p=[];U.length>0&&p.push({key:"templates",title:z.templates,tiles:U.map(e=>{return{type:G(e.id),label:e.name,cover:/* @__PURE__ */j(W,{type:e.node.type}),keywords:[(t=e.node.type,N(t,"section",I.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(I.categories??{})){const n=X.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(l)),d=!0),p.push({key:`category:${t}`,title:o(I,t,T),tiles:i})}const f=p.find(e=>e.key?.startsWith("category:"));if(!d&&f&&m.length>0&&(f.tiles=[...f.tiles,...m.map(l)],d=!0),c(r.filter(e=>e.group||!d)).forEach((e,t)=>{p.push({key:`blocks:${t}`,title:e.group??"",tiles:e.items.map(l)})}),!w)return p;const y=p.map(e=>({...e,tiles:e.tiles.map(e=>{const t=q(e.type),o=t?w(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))]},[U,X,I,z,w,$,Q]);/* @__PURE__ */
|
|
2
|
-
return v(V,{children:[
|
|
3
|
-
/* @__PURE__ */j(i,{icon:/* @__PURE__ */j(g,{size:15}),title:z.title,context:z.contextAll,actions:/* @__PURE__ */j(r,{label:z.done,description:z.doneDescription,onClick:x}),onHide:D}),
|
|
4
|
-
/* @__PURE__ */v("div",{className:"sf-addside sf-scroll",children:[
|
|
5
|
-
/* @__PURE__ */j(y,{groups:ee,session:O,itemFor:e=>E(q(e)??{kind:"section",type:e}),onInsert:C?e=>{const t=q(e);t&&C(t)}:void 0,at:P,hint:z.hint,searchLabel:z.search,readOnly:H,words:J}),R??null]})]})}export{P as AddSidePanel,F as blockKey,B as sectionKey,G as templateKey};
|