@maily-to/ui 2.0.0-beta.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.cjs ADDED
@@ -0,0 +1,765 @@
1
+ Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
2
+ //#region \0rolldown/runtime.js
3
+ var __create = Object.create;
4
+ var __defProp = Object.defineProperty;
5
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
6
+ var __getOwnPropNames = Object.getOwnPropertyNames;
7
+ var __getProtoOf = Object.getPrototypeOf;
8
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
9
+ var __exportAll = (all, no_symbols) => {
10
+ let target = {};
11
+ for (var name in all) __defProp(target, name, {
12
+ get: all[name],
13
+ enumerable: true
14
+ });
15
+ if (!no_symbols) __defProp(target, Symbol.toStringTag, { value: "Module" });
16
+ return target;
17
+ };
18
+ var __copyProps = (to, from, except, desc) => {
19
+ if (from && typeof from === "object" || typeof from === "function") for (var keys = __getOwnPropNames(from), i = 0, n = keys.length, key; i < n; i++) {
20
+ key = keys[i];
21
+ if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {
22
+ get: ((k) => from[k]).bind(null, key),
23
+ enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
24
+ });
25
+ }
26
+ return to;
27
+ };
28
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", {
29
+ value: mod,
30
+ enumerable: true
31
+ }) : target, mod));
32
+ //#endregion
33
+ let react_compiler_runtime = require("react/compiler-runtime");
34
+ let _base_ui_react_select = require("@base-ui/react/select");
35
+ let react = require("react");
36
+ react = __toESM(react);
37
+ let react_jsx_runtime = require("react/jsx-runtime");
38
+ let _base_ui_utils_useIsoLayoutEffect = require("@base-ui/utils/useIsoLayoutEffect");
39
+ let _base_ui_utils_useRefWithInit = require("@base-ui/utils/useRefWithInit");
40
+ let cromia = require("cromia");
41
+ let unit_field = require("unit-field");
42
+ let _maily_to_shared = require("@maily-to/shared");
43
+ //#region src/utils/constants.ts
44
+ const IS_PRODUCTION = process.env.NODE_ENV === "production";
45
+ const MAILY_UI_NAMESPACE = "[Maily UI]";
46
+ //#endregion
47
+ //#region src/components/condition-builder/condition-builder-context.ts
48
+ const ConditionBuilderContext = react.createContext(null);
49
+ function useConditionBuilderContext() {
50
+ const $ = (0, react_compiler_runtime.c)(1);
51
+ if ($[0] !== "e76481f4c4a69254449f5d2e778ae7cc8a2a6f071bacb0620046e0945c59f16e") {
52
+ for (let $i = 0; $i < 1; $i += 1) $[$i] = Symbol.for("react.memo_cache_sentinel");
53
+ $[0] = "e76481f4c4a69254449f5d2e778ae7cc8a2a6f071bacb0620046e0945c59f16e";
54
+ }
55
+ const context = react.useContext(ConditionBuilderContext);
56
+ if (!context) throw new Error(`${MAILY_UI_NAMESPACE}: ConditionBuilderContext is missing. ConditionBuilder parts must be placed within <ConditionBuilder.Root>.`);
57
+ return context;
58
+ }
59
+ //#endregion
60
+ //#region src/components/condition-builder/condition-builder-action.tsx
61
+ function ConditionBuilderAction(props) {
62
+ const $ = (0, react_compiler_runtime.c)(7);
63
+ if ($[0] !== "d08d32c6deb8aa1f1390c210068c58c5db068c2ac89003430f98be69a506271d") {
64
+ for (let $i = 0; $i < 7; $i += 1) $[$i] = Symbol.for("react.memo_cache_sentinel");
65
+ $[0] = "d08d32c6deb8aa1f1390c210068c58c5db068c2ac89003430f98be69a506271d";
66
+ }
67
+ const { action, onActionChange } = useConditionBuilderContext();
68
+ let t0;
69
+ if ($[1] !== onActionChange) {
70
+ t0 = (value) => onActionChange(value ?? "");
71
+ $[1] = onActionChange;
72
+ $[2] = t0;
73
+ } else t0 = $[2];
74
+ let t1;
75
+ if ($[3] !== action || $[4] !== props || $[5] !== t0) {
76
+ t1 = /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_base_ui_react_select.Select.Root, {
77
+ value: action,
78
+ onValueChange: t0,
79
+ ...props
80
+ });
81
+ $[3] = action;
82
+ $[4] = props;
83
+ $[5] = t0;
84
+ $[6] = t1;
85
+ } else t1 = $[6];
86
+ return t1;
87
+ }
88
+ //#endregion
89
+ //#region src/components/condition-builder/condition-builder-clear.tsx
90
+ function ConditionBuilderClear(props) {
91
+ const $ = (0, react_compiler_runtime.c)(10);
92
+ if ($[0] !== "1cac21208af192e735fc4eb5ff2846d8408ce73fb63e320bb1f11766dfeeeb15") {
93
+ for (let $i = 0; $i < 10; $i += 1) $[$i] = Symbol.for("react.memo_cache_sentinel");
94
+ $[0] = "1cac21208af192e735fc4eb5ff2846d8408ce73fb63e320bb1f11766dfeeeb15";
95
+ }
96
+ let onClick;
97
+ let rest;
98
+ if ($[1] !== props) {
99
+ ({onClick, ...rest} = props);
100
+ $[1] = props;
101
+ $[2] = onClick;
102
+ $[3] = rest;
103
+ } else {
104
+ onClick = $[2];
105
+ rest = $[3];
106
+ }
107
+ const { onClear } = useConditionBuilderContext();
108
+ let t0;
109
+ if ($[4] !== onClear || $[5] !== onClick) {
110
+ t0 = (e) => {
111
+ onClear();
112
+ onClick?.(e);
113
+ };
114
+ $[4] = onClear;
115
+ $[5] = onClick;
116
+ $[6] = t0;
117
+ } else t0 = $[6];
118
+ let t1;
119
+ if ($[7] !== rest || $[8] !== t0) {
120
+ t1 = /* @__PURE__ */ (0, react_jsx_runtime.jsx)("button", {
121
+ type: "button",
122
+ onClick: t0,
123
+ ...rest
124
+ });
125
+ $[7] = rest;
126
+ $[8] = t0;
127
+ $[9] = t1;
128
+ } else t1 = $[9];
129
+ return t1;
130
+ }
131
+ //#endregion
132
+ //#region src/components/condition-builder/condition-builder-field.tsx
133
+ function ConditionBuilderField(props) {
134
+ const $ = (0, react_compiler_runtime.c)(7);
135
+ if ($[0] !== "65f61e434d3a0487f21c2514a2a46f7bbaec4481e0a4464427eb92d218e125e7") {
136
+ for (let $i = 0; $i < 7; $i += 1) $[$i] = Symbol.for("react.memo_cache_sentinel");
137
+ $[0] = "65f61e434d3a0487f21c2514a2a46f7bbaec4481e0a4464427eb92d218e125e7";
138
+ }
139
+ const { field, onFieldChange } = useConditionBuilderContext();
140
+ let t0;
141
+ if ($[1] !== onFieldChange) {
142
+ t0 = (e) => {
143
+ onFieldChange(e.target.value);
144
+ };
145
+ $[1] = onFieldChange;
146
+ $[2] = t0;
147
+ } else t0 = $[2];
148
+ let t1;
149
+ if ($[3] !== field || $[4] !== props || $[5] !== t0) {
150
+ t1 = /* @__PURE__ */ (0, react_jsx_runtime.jsx)("input", {
151
+ type: "text",
152
+ value: field,
153
+ onChange: t0,
154
+ ...props
155
+ });
156
+ $[3] = field;
157
+ $[4] = props;
158
+ $[5] = t0;
159
+ $[6] = t1;
160
+ } else t1 = $[6];
161
+ return t1;
162
+ }
163
+ //#endregion
164
+ //#region src/components/condition-builder/condition-builder-operator.tsx
165
+ function ConditionBuilderOperator(props) {
166
+ const $ = (0, react_compiler_runtime.c)(7);
167
+ if ($[0] !== "15848c6c9f1237d887542146d4edef17bb30af01879a62b9f92afa55c2258423") {
168
+ for (let $i = 0; $i < 7; $i += 1) $[$i] = Symbol.for("react.memo_cache_sentinel");
169
+ $[0] = "15848c6c9f1237d887542146d4edef17bb30af01879a62b9f92afa55c2258423";
170
+ }
171
+ const { operator, onOperatorChange } = useConditionBuilderContext();
172
+ let t0;
173
+ if ($[1] !== onOperatorChange) {
174
+ t0 = (value) => {
175
+ if (value !== null) onOperatorChange(value);
176
+ };
177
+ $[1] = onOperatorChange;
178
+ $[2] = t0;
179
+ } else t0 = $[2];
180
+ let t1;
181
+ if ($[3] !== operator || $[4] !== props || $[5] !== t0) {
182
+ t1 = /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_base_ui_react_select.Select.Root, {
183
+ value: operator,
184
+ onValueChange: t0,
185
+ ...props
186
+ });
187
+ $[3] = operator;
188
+ $[4] = props;
189
+ $[5] = t0;
190
+ $[6] = t1;
191
+ } else t1 = $[6];
192
+ return t1;
193
+ }
194
+ //#endregion
195
+ //#region src/components/condition-builder/condition-builder-root.tsx
196
+ function ConditionBuilderRoot(props) {
197
+ const $ = (0, react_compiler_runtime.c)(29);
198
+ if ($[0] !== "649d0ac393f7051629f9e59097fe01b98ab390ea8389852e2f7b4463784a88a1") {
199
+ for (let $i = 0; $i < 29; $i += 1) $[$i] = Symbol.for("react.memo_cache_sentinel");
200
+ $[0] = "649d0ac393f7051629f9e59097fe01b98ab390ea8389852e2f7b4463784a88a1";
201
+ }
202
+ let action;
203
+ let field;
204
+ let onActionChange;
205
+ let onClear;
206
+ let onFieldChange;
207
+ let onOperatorChange;
208
+ let onValueChange;
209
+ let operator;
210
+ let operatorNeedsValue;
211
+ let rest;
212
+ let value;
213
+ if ($[1] !== props) {
214
+ ({action, field, operator, value, onActionChange, onFieldChange, onOperatorChange, onValueChange, onClear, operatorNeedsValue, ...rest} = props);
215
+ $[1] = props;
216
+ $[2] = action;
217
+ $[3] = field;
218
+ $[4] = onActionChange;
219
+ $[5] = onClear;
220
+ $[6] = onFieldChange;
221
+ $[7] = onOperatorChange;
222
+ $[8] = onValueChange;
223
+ $[9] = operator;
224
+ $[10] = operatorNeedsValue;
225
+ $[11] = rest;
226
+ $[12] = value;
227
+ } else {
228
+ action = $[2];
229
+ field = $[3];
230
+ onActionChange = $[4];
231
+ onClear = $[5];
232
+ onFieldChange = $[6];
233
+ onOperatorChange = $[7];
234
+ onValueChange = $[8];
235
+ operator = $[9];
236
+ operatorNeedsValue = $[10];
237
+ rest = $[11];
238
+ value = $[12];
239
+ }
240
+ let t0;
241
+ if ($[13] !== action || $[14] !== field || $[15] !== onActionChange || $[16] !== onClear || $[17] !== onFieldChange || $[18] !== onOperatorChange || $[19] !== onValueChange || $[20] !== operator || $[21] !== operatorNeedsValue || $[22] !== value) {
242
+ t0 = {
243
+ action,
244
+ field,
245
+ operator,
246
+ value,
247
+ onActionChange,
248
+ onFieldChange,
249
+ onOperatorChange,
250
+ onValueChange,
251
+ onClear,
252
+ operatorNeedsValue
253
+ };
254
+ $[13] = action;
255
+ $[14] = field;
256
+ $[15] = onActionChange;
257
+ $[16] = onClear;
258
+ $[17] = onFieldChange;
259
+ $[18] = onOperatorChange;
260
+ $[19] = onValueChange;
261
+ $[20] = operator;
262
+ $[21] = operatorNeedsValue;
263
+ $[22] = value;
264
+ $[23] = t0;
265
+ } else t0 = $[23];
266
+ const contextValue = t0;
267
+ let t1;
268
+ if ($[24] !== rest) {
269
+ t1 = /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", { ...rest });
270
+ $[24] = rest;
271
+ $[25] = t1;
272
+ } else t1 = $[25];
273
+ let t2;
274
+ if ($[26] !== contextValue || $[27] !== t1) {
275
+ t2 = /* @__PURE__ */ (0, react_jsx_runtime.jsx)(ConditionBuilderContext.Provider, {
276
+ value: contextValue,
277
+ children: t1
278
+ });
279
+ $[26] = contextValue;
280
+ $[27] = t1;
281
+ $[28] = t2;
282
+ } else t2 = $[28];
283
+ return t2;
284
+ }
285
+ //#endregion
286
+ //#region src/components/condition-builder/condition-builder-value.tsx
287
+ function ConditionBuilderValue(props) {
288
+ const $ = (0, react_compiler_runtime.c)(7);
289
+ if ($[0] !== "1c5d05cf80ecce6330f24480958c46cee1972d2dfa0a2e4f81cbb686dc4a7c53") {
290
+ for (let $i = 0; $i < 7; $i += 1) $[$i] = Symbol.for("react.memo_cache_sentinel");
291
+ $[0] = "1c5d05cf80ecce6330f24480958c46cee1972d2dfa0a2e4f81cbb686dc4a7c53";
292
+ }
293
+ const { value, onValueChange, operatorNeedsValue } = useConditionBuilderContext();
294
+ if (!operatorNeedsValue) return null;
295
+ let t0;
296
+ if ($[1] !== onValueChange) {
297
+ t0 = (e) => {
298
+ onValueChange(e.target.value);
299
+ };
300
+ $[1] = onValueChange;
301
+ $[2] = t0;
302
+ } else t0 = $[2];
303
+ let t1;
304
+ if ($[3] !== props || $[4] !== t0 || $[5] !== value) {
305
+ t1 = /* @__PURE__ */ (0, react_jsx_runtime.jsx)("input", {
306
+ type: "text",
307
+ value,
308
+ onChange: t0,
309
+ ...props
310
+ });
311
+ $[3] = props;
312
+ $[4] = t0;
313
+ $[5] = value;
314
+ $[6] = t1;
315
+ } else t1 = $[6];
316
+ return t1;
317
+ }
318
+ //#endregion
319
+ //#region src/components/condition-builder/condition-builder.tsx
320
+ var condition_builder_exports = /* @__PURE__ */ __exportAll({
321
+ ActionSelect: () => ConditionBuilderAction,
322
+ ClearButton: () => ConditionBuilderClear,
323
+ FieldInput: () => ConditionBuilderField,
324
+ OperatorSelect: () => ConditionBuilderOperator,
325
+ Root: () => ConditionBuilderRoot,
326
+ ValueInput: () => ConditionBuilderValue
327
+ });
328
+ //#endregion
329
+ //#region src/hooks/use-maily-id.ts
330
+ function useMailyId() {
331
+ const $ = (0, react_compiler_runtime.c)(1);
332
+ if ($[0] !== "e7fd377d7fd34be0a00159a2f30a6e7d07845a4be5f247194f973aa13ceb0754") {
333
+ for (let $i = 0; $i < 1; $i += 1) $[$i] = Symbol.for("react.memo_cache_sentinel");
334
+ $[0] = "e7fd377d7fd34be0a00159a2f30a6e7d07845a4be5f247194f973aa13ceb0754";
335
+ }
336
+ return `mly:${(0, react.useId)()}`;
337
+ }
338
+ //#endregion
339
+ //#region src/hooks/use-merge-refs.ts
340
+ /**
341
+ * This is a copy of the useMergeRefs hook from floating-ui.
342
+ * @see https://floating-ui.com/docs/react-utils#usemergerefs
343
+ */
344
+ function useMergeRefs(refs) {
345
+ const cleanupRef = react.useRef(void 0);
346
+ const refEffect = react.useCallback((instance) => {
347
+ const cleanups = refs.map((ref) => {
348
+ if (ref == null) return;
349
+ if (typeof ref === "function") {
350
+ const refCallback = ref;
351
+ const refCleanup = refCallback(instance);
352
+ return typeof refCleanup === "function" ? refCleanup : () => {
353
+ refCallback(null);
354
+ };
355
+ }
356
+ ref.current = instance;
357
+ return () => {
358
+ ref.current = null;
359
+ };
360
+ });
361
+ return () => {
362
+ cleanups.forEach((refCleanup_0) => refCleanup_0?.());
363
+ };
364
+ }, refs);
365
+ return react.useMemo(() => {
366
+ if (refs.every((ref_0) => ref_0 == null)) return null;
367
+ return (value) => {
368
+ if (cleanupRef.current) {
369
+ cleanupRef.current();
370
+ cleanupRef.current = void 0;
371
+ }
372
+ if (value != null) cleanupRef.current = refEffect(value);
373
+ };
374
+ }, refs);
375
+ }
376
+ //#endregion
377
+ //#region src/hooks/use-value-as-ref.ts
378
+ /**
379
+ * Untracks the provided value by turning it into a ref to remove its reactivity.
380
+ *
381
+ * Used to access the passed value inside `React.useEffect` without causing the effect to re-run when the value changes.
382
+ */
383
+ function useValueAsRef(value) {
384
+ const latest = (0, _base_ui_utils_useRefWithInit.useRefWithInit)(createLatestRef, value).current;
385
+ latest.next = value;
386
+ (0, _base_ui_utils_useIsoLayoutEffect.useIsoLayoutEffect)(latest.effect);
387
+ return latest;
388
+ }
389
+ function createLatestRef(value) {
390
+ const latest = {
391
+ current: value,
392
+ next: value,
393
+ effect: () => {
394
+ latest.current = latest.next;
395
+ }
396
+ };
397
+ return latest;
398
+ }
399
+ //#endregion
400
+ //#region src/components/settings-field/settings-field-group.tsx
401
+ function SettingsFieldGroup(props) {
402
+ const $ = (0, react_compiler_runtime.c)(3);
403
+ if ($[0] !== "f96beb346c18d66db1b9baf6b0e37f2dbf899325731ea0fa32d4085bd0d732da") {
404
+ for (let $i = 0; $i < 3; $i += 1) $[$i] = Symbol.for("react.memo_cache_sentinel");
405
+ $[0] = "f96beb346c18d66db1b9baf6b0e37f2dbf899325731ea0fa32d4085bd0d732da";
406
+ }
407
+ let t0;
408
+ if ($[1] !== props) {
409
+ t0 = /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
410
+ role: "group",
411
+ ...props
412
+ });
413
+ $[1] = props;
414
+ $[2] = t0;
415
+ } else t0 = $[2];
416
+ return t0;
417
+ }
418
+ //#endregion
419
+ //#region src/components/settings-field/settings-field-context.ts
420
+ const SettingsFieldContext = react.createContext(null);
421
+ function useSettingsFieldContext() {
422
+ const $ = (0, react_compiler_runtime.c)(1);
423
+ if ($[0] !== "c84888ed2e059806fa71c02f8df78e10d3bf08d4aff8faf09195ea9acca93d57") {
424
+ for (let $i = 0; $i < 1; $i += 1) $[$i] = Symbol.for("react.memo_cache_sentinel");
425
+ $[0] = "c84888ed2e059806fa71c02f8df78e10d3bf08d4aff8faf09195ea9acca93d57";
426
+ }
427
+ const context = react.useContext(SettingsFieldContext);
428
+ if (!context) throw new Error(`${MAILY_UI_NAMESPACE}: SettingsFieldContext is missing. SettingsField parts must be placed within <SettingsField.Root>.`);
429
+ return context;
430
+ }
431
+ //#endregion
432
+ //#region src/components/settings-field/settings-field-label.tsx
433
+ function SettingsFieldLabel(props) {
434
+ const $ = (0, react_compiler_runtime.c)(4);
435
+ if ($[0] !== "48addfe6a95d4090f4a39453e7afdeeb9b6a7e37fb38efeb94d80ff9d4b55268") {
436
+ for (let $i = 0; $i < 4; $i += 1) $[$i] = Symbol.for("react.memo_cache_sentinel");
437
+ $[0] = "48addfe6a95d4090f4a39453e7afdeeb9b6a7e37fb38efeb94d80ff9d4b55268";
438
+ }
439
+ const { id } = useSettingsFieldContext();
440
+ let t0;
441
+ if ($[1] !== id || $[2] !== props) {
442
+ t0 = /* @__PURE__ */ (0, react_jsx_runtime.jsx)("label", {
443
+ htmlFor: id,
444
+ ...props
445
+ });
446
+ $[1] = id;
447
+ $[2] = props;
448
+ $[3] = t0;
449
+ } else t0 = $[3];
450
+ return t0;
451
+ }
452
+ //#endregion
453
+ //#region src/components/settings-field/settings-field-root.tsx
454
+ function SettingsFieldRoot(props) {
455
+ const $ = (0, react_compiler_runtime.c)(8);
456
+ if ($[0] !== "e5a6123141e99863c76c6fad5e55fa860ed5c64951b70fb03c026a46051fb07a") {
457
+ for (let $i = 0; $i < 8; $i += 1) $[$i] = Symbol.for("react.memo_cache_sentinel");
458
+ $[0] = "e5a6123141e99863c76c6fad5e55fa860ed5c64951b70fb03c026a46051fb07a";
459
+ }
460
+ const id = useMailyId();
461
+ let t0;
462
+ if ($[1] !== id) {
463
+ t0 = { id };
464
+ $[1] = id;
465
+ $[2] = t0;
466
+ } else t0 = $[2];
467
+ let t1;
468
+ if ($[3] !== props) {
469
+ t1 = /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", { ...props });
470
+ $[3] = props;
471
+ $[4] = t1;
472
+ } else t1 = $[4];
473
+ let t2;
474
+ if ($[5] !== t0 || $[6] !== t1) {
475
+ t2 = /* @__PURE__ */ (0, react_jsx_runtime.jsx)(SettingsFieldContext, {
476
+ value: t0,
477
+ children: t1
478
+ });
479
+ $[5] = t0;
480
+ $[6] = t1;
481
+ $[7] = t2;
482
+ } else t2 = $[7];
483
+ return t2;
484
+ }
485
+ //#endregion
486
+ //#region src/components/settings-field/settings-field.ts
487
+ var settings_field_exports = /* @__PURE__ */ __exportAll({
488
+ Group: () => SettingsFieldGroup,
489
+ Label: () => SettingsFieldLabel,
490
+ Root: () => SettingsFieldRoot
491
+ });
492
+ //#endregion
493
+ //#region src/components/theme-settings/theme-settings-context.ts
494
+ const ThemeSettingsContext = react.createContext(null);
495
+ function useThemeSettingsContext() {
496
+ const $ = (0, react_compiler_runtime.c)(1);
497
+ if ($[0] !== "eb1d74541f2031116105c69fff970eb42461a996a1574647a03a15305ea130c6") {
498
+ for (let $i = 0; $i < 1; $i += 1) $[$i] = Symbol.for("react.memo_cache_sentinel");
499
+ $[0] = "eb1d74541f2031116105c69fff970eb42461a996a1574647a03a15305ea130c6";
500
+ }
501
+ const context = react.useContext(ThemeSettingsContext);
502
+ if (!context) throw new Error(`${MAILY_UI_NAMESPACE}: ThemeSettingsContext is missing. ThemeSettings parts must be placed within <ThemeSettings.Root>.`);
503
+ return context;
504
+ }
505
+ //#endregion
506
+ //#region src/components/theme-settings/theme-settings-root.tsx
507
+ function ThemeSettingsRoot(props) {
508
+ const $ = (0, react_compiler_runtime.c)(10);
509
+ if ($[0] !== "a184ea6f1dfc48722d8fdc9a8f09a5524a071912e4aa8ae645cda9b7e57ec275") {
510
+ for (let $i = 0; $i < 10; $i += 1) $[$i] = Symbol.for("react.memo_cache_sentinel");
511
+ $[0] = "a184ea6f1dfc48722d8fdc9a8f09a5524a071912e4aa8ae645cda9b7e57ec275";
512
+ }
513
+ let ref;
514
+ let rest;
515
+ if ($[1] !== props) {
516
+ ({ref, ...rest} = props);
517
+ $[1] = props;
518
+ $[2] = ref;
519
+ $[3] = rest;
520
+ } else {
521
+ ref = $[2];
522
+ rest = $[3];
523
+ }
524
+ const internalRef = react.useRef(null);
525
+ let t0;
526
+ if ($[4] !== ref) {
527
+ t0 = [ref, internalRef];
528
+ $[4] = ref;
529
+ $[5] = t0;
530
+ } else t0 = $[5];
531
+ const mergedRef = useMergeRefs(t0);
532
+ let t1;
533
+ if ($[6] === Symbol.for("react.memo_cache_sentinel")) {
534
+ t1 = { container: internalRef };
535
+ $[6] = t1;
536
+ } else t1 = $[6];
537
+ let t2;
538
+ if ($[7] !== mergedRef || $[8] !== rest) {
539
+ t2 = /* @__PURE__ */ (0, react_jsx_runtime.jsx)(ThemeSettingsContext, {
540
+ value: t1,
541
+ children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
542
+ ref: mergedRef,
543
+ ...rest
544
+ })
545
+ });
546
+ $[7] = mergedRef;
547
+ $[8] = rest;
548
+ $[9] = t2;
549
+ } else t2 = $[9];
550
+ return t2;
551
+ }
552
+ //#endregion
553
+ //#region src/components/theme-settings/theme-settings.ts
554
+ var theme_settings_exports = /* @__PURE__ */ __exportAll({ Root: () => ThemeSettingsRoot });
555
+ //#endregion
556
+ //#region src/hooks/use-controllable-state.ts
557
+ function useControllableState(options) {
558
+ const $ = (0, react_compiler_runtime.c)(6);
559
+ if ($[0] !== "9bf1fd7f815733e7696973745a8e997c6a7ca8f6801b793ddbbf659dec25e82e") {
560
+ for (let $i = 0; $i < 6; $i += 1) $[$i] = Symbol.for("react.memo_cache_sentinel");
561
+ $[0] = "9bf1fd7f815733e7696973745a8e997c6a7ca8f6801b793ddbbf659dec25e82e";
562
+ }
563
+ const { value: controlledValue, defaultValue, onChange } = options;
564
+ const [uncontrolledValue, setUncontrolledValue] = (0, react.useState)(defaultValue);
565
+ const resolvedValue = controlledValue ?? uncontrolledValue;
566
+ let t0;
567
+ if ($[1] !== onChange) {
568
+ t0 = (next) => {
569
+ onChange?.(next);
570
+ setUncontrolledValue(next);
571
+ };
572
+ $[1] = onChange;
573
+ $[2] = t0;
574
+ } else t0 = $[2];
575
+ const setValue = t0;
576
+ let t1;
577
+ if ($[3] !== resolvedValue || $[4] !== setValue) {
578
+ t1 = [resolvedValue, setValue];
579
+ $[3] = resolvedValue;
580
+ $[4] = setValue;
581
+ $[5] = t1;
582
+ } else t1 = $[5];
583
+ return t1;
584
+ }
585
+ //#endregion
586
+ //#region src/components/theme-provider/theme-context.ts
587
+ const ThemeContext = react.createContext(null);
588
+ function useThemeContext() {
589
+ const $ = (0, react_compiler_runtime.c)(1);
590
+ if ($[0] !== "155eb7018b255df057ebd1e9085e5555bc8dfdc5f9388a942a2a74ca7af39d00") {
591
+ for (let $i = 0; $i < 1; $i += 1) $[$i] = Symbol.for("react.memo_cache_sentinel");
592
+ $[0] = "155eb7018b255df057ebd1e9085e5555bc8dfdc5f9388a942a2a74ca7af39d00";
593
+ }
594
+ const context = react.useContext(ThemeContext);
595
+ if (!context) throw new Error(`${MAILY_UI_NAMESPACE}: ThemeContext is missing. Components must be placed within <ThemeProvider>.`);
596
+ return context;
597
+ }
598
+ //#endregion
599
+ //#region src/components/theme-provider/theme-provider.tsx
600
+ function ThemeProvider(props) {
601
+ const $ = (0, react_compiler_runtime.c)(11);
602
+ if ($[0] !== "4f864dcbb81a5f52bfb68ee984a4dafc7dc65a65b65f9581109b135fd829c1bf") {
603
+ for (let $i = 0; $i < 11; $i += 1) $[$i] = Symbol.for("react.memo_cache_sentinel");
604
+ $[0] = "4f864dcbb81a5f52bfb68ee984a4dafc7dc65a65b65f9581109b135fd829c1bf";
605
+ }
606
+ const { theme: themeProp, defaultTheme, onThemeChange, children } = props;
607
+ const t0 = defaultTheme ?? _maily_to_shared.DEFAULT_EDITOR_THEME;
608
+ let t1;
609
+ if ($[1] !== onThemeChange || $[2] !== t0 || $[3] !== themeProp) {
610
+ t1 = {
611
+ value: themeProp,
612
+ defaultValue: t0,
613
+ onChange: onThemeChange
614
+ };
615
+ $[1] = onThemeChange;
616
+ $[2] = t0;
617
+ $[3] = themeProp;
618
+ $[4] = t1;
619
+ } else t1 = $[4];
620
+ const [theme, setTheme] = useControllableState(t1);
621
+ let t2;
622
+ if ($[5] !== setTheme || $[6] !== theme) {
623
+ t2 = {
624
+ theme,
625
+ setTheme
626
+ };
627
+ $[5] = setTheme;
628
+ $[6] = theme;
629
+ $[7] = t2;
630
+ } else t2 = $[7];
631
+ let t3;
632
+ if ($[8] !== children || $[9] !== t2) {
633
+ t3 = /* @__PURE__ */ (0, react_jsx_runtime.jsx)(ThemeContext, {
634
+ value: t2,
635
+ children
636
+ });
637
+ $[8] = children;
638
+ $[9] = t2;
639
+ $[10] = t3;
640
+ } else t3 = $[10];
641
+ return t3;
642
+ }
643
+ //#endregion
644
+ //#region src/hooks/use-theme.ts
645
+ function useTheme() {
646
+ const $ = (0, react_compiler_runtime.c)(9);
647
+ if ($[0] !== "39e18c05e947e7b0928d17dadfbaca742c7fac0d68c52e61e21562ce30eb7bb7") {
648
+ for (let $i = 0; $i < 9; $i += 1) $[$i] = Symbol.for("react.memo_cache_sentinel");
649
+ $[0] = "39e18c05e947e7b0928d17dadfbaca742c7fac0d68c52e61e21562ce30eb7bb7";
650
+ }
651
+ const { theme: rawTheme, setTheme } = useThemeContext();
652
+ let t0;
653
+ if ($[1] !== rawTheme) {
654
+ t0 = (0, _maily_to_shared.deepMerge)(_maily_to_shared.DEFAULT_EDITOR_THEME, rawTheme);
655
+ $[1] = rawTheme;
656
+ $[2] = t0;
657
+ } else t0 = $[2];
658
+ const theme = t0;
659
+ let t1;
660
+ if ($[3] !== rawTheme || $[4] !== setTheme) {
661
+ t1 = (updater) => {
662
+ if (typeof updater === "function") {
663
+ setTheme(updater(rawTheme));
664
+ return;
665
+ }
666
+ setTheme((0, _maily_to_shared.deepMerge)(rawTheme, updater));
667
+ };
668
+ $[3] = rawTheme;
669
+ $[4] = setTheme;
670
+ $[5] = t1;
671
+ } else t1 = $[5];
672
+ const updateTheme = t1;
673
+ let t2;
674
+ if ($[6] !== theme || $[7] !== updateTheme) {
675
+ t2 = {
676
+ theme,
677
+ updateTheme
678
+ };
679
+ $[6] = theme;
680
+ $[7] = updateTheme;
681
+ $[8] = t2;
682
+ } else t2 = $[8];
683
+ return t2;
684
+ }
685
+ //#endregion
686
+ //#region src/utils/composite.ts
687
+ const ARROW_UP = "ArrowUp";
688
+ const ARROW_DOWN = "ArrowDown";
689
+ const ARROW_LEFT = "ArrowLeft";
690
+ const ARROW_RIGHT = "ArrowRight";
691
+ const HOME = "Home";
692
+ const END = "End";
693
+ const PAGE_UP = "PageUp";
694
+ const PAGE_DOWN = "PageDown";
695
+ const SHIFT = "Shift";
696
+ const ENTER = "Enter";
697
+ const HORIZONTAL_KEYS = new Set([ARROW_LEFT, ARROW_RIGHT]);
698
+ const HORIZONTAL_KEYS_WITH_EXTRA_KEYS = new Set([
699
+ ARROW_LEFT,
700
+ ARROW_RIGHT,
701
+ HOME,
702
+ "End"
703
+ ]);
704
+ const COMPOSITE_KEYS = new Set([
705
+ ARROW_UP,
706
+ ARROW_DOWN,
707
+ ARROW_LEFT,
708
+ ARROW_RIGHT,
709
+ HOME,
710
+ "End"
711
+ ]);
712
+ //#endregion
713
+ exports.ARROW_DOWN = ARROW_DOWN;
714
+ exports.ARROW_LEFT = ARROW_LEFT;
715
+ exports.ARROW_RIGHT = ARROW_RIGHT;
716
+ exports.ARROW_UP = ARROW_UP;
717
+ exports.COMPOSITE_KEYS = COMPOSITE_KEYS;
718
+ Object.defineProperty(exports, "ColorPicker", {
719
+ enumerable: true,
720
+ get: function() {
721
+ return cromia.ColorPicker;
722
+ }
723
+ });
724
+ Object.defineProperty(exports, "ConditionBuilder", {
725
+ enumerable: true,
726
+ get: function() {
727
+ return condition_builder_exports;
728
+ }
729
+ });
730
+ exports.END = END;
731
+ exports.ENTER = ENTER;
732
+ exports.HOME = HOME;
733
+ exports.HORIZONTAL_KEYS = HORIZONTAL_KEYS;
734
+ exports.HORIZONTAL_KEYS_WITH_EXTRA_KEYS = HORIZONTAL_KEYS_WITH_EXTRA_KEYS;
735
+ exports.IS_PRODUCTION = IS_PRODUCTION;
736
+ exports.MAILY_UI_NAMESPACE = MAILY_UI_NAMESPACE;
737
+ exports.PAGE_DOWN = PAGE_DOWN;
738
+ exports.PAGE_UP = PAGE_UP;
739
+ exports.SHIFT = SHIFT;
740
+ Object.defineProperty(exports, "SettingsField", {
741
+ enumerable: true,
742
+ get: function() {
743
+ return settings_field_exports;
744
+ }
745
+ });
746
+ exports.ThemeProvider = ThemeProvider;
747
+ Object.defineProperty(exports, "ThemeSettings", {
748
+ enumerable: true,
749
+ get: function() {
750
+ return theme_settings_exports;
751
+ }
752
+ });
753
+ Object.defineProperty(exports, "UnitField", {
754
+ enumerable: true,
755
+ get: function() {
756
+ return unit_field.UnitField;
757
+ }
758
+ });
759
+ exports.useMailyId = useMailyId;
760
+ exports.useMergeRefs = useMergeRefs;
761
+ exports.useSettingsFieldContext = useSettingsFieldContext;
762
+ exports.useTheme = useTheme;
763
+ exports.useThemeContext = useThemeContext;
764
+ exports.useThemeSettingsContext = useThemeSettingsContext;
765
+ exports.useValueAsRef = useValueAsRef;