@revolist/ui 4.0.1-rc → 4.0.3-rc
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/LICENSE +21 -0
- package/README.md +345 -262
- package/_chunks/calendar-xpZ0v3xf.js +258 -0
- package/_chunks/chart-frame-Cmc7xU1i.js +130 -0
- package/_chunks/choice-chips-CHQTUdLs.js +110 -0
- package/_chunks/clock-BOhPNlW3.js +4 -0
- package/_chunks/{color-palette-BmZ7kH9R.js → color-palette-D8vyPfld.js} +41 -41
- package/_chunks/color-picker-CudqPYZo.js +138 -0
- package/_chunks/component-C_T2VN5u.js +863 -0
- package/_chunks/{component-metadata-BENbgTjU.js → component-metadata-BMOOmqx5.js} +0 -4
- package/_chunks/control-AHKXD5Eu.js +93 -0
- package/_chunks/{control-tooltip-BCNzQCXE.js → control-tooltip-uscKfAnV.js} +29 -29
- package/_chunks/{controller-CmLo-Ajc.js → controller-hRBm_Lfz.js} +15 -15
- package/_chunks/{controls-NEL5tDaz.js → controls-DsNi8V8I.js} +229 -214
- package/_chunks/{date-control-CYCkb1aQ.js → date-control-DrVFX13g.js} +21 -21
- package/_chunks/date-time-qIhp5vaX.js +768 -0
- package/_chunks/{delete-button-DnpmDNEJ.js → delete-button-CW9vjLnk.js} +7 -7
- package/_chunks/dialog.parts-CKGkC5zP.js +134 -0
- package/_chunks/duration-CL68Em0o.js +272 -0
- package/_chunks/editor-commit-Bq3wSgvr.js +12 -0
- package/_chunks/{editor-popup-B7fu_A_T.js → editor-popup-WDdtVDNA.js} +8 -8
- package/_chunks/field-context-D57PnBbH.js +5 -0
- package/_chunks/framework-mount--RTLIqE-.js +54 -0
- package/_chunks/history-controls-B3u3INEK.js +27 -0
- package/_chunks/hooks.module-CG3gN83z.js +157 -0
- package/_chunks/jsxRuntime.module-F6UFnpT-.js +30 -0
- package/_chunks/mount-DQ1cpppK.js +257 -0
- package/_chunks/native-control-C_yok8_-.js +605 -0
- package/_chunks/native.view-ByyZ1CT5.js +32 -0
- package/_chunks/{number-input-NnH57J4j.js → number-input-BKwA5FnM.js} +89 -89
- package/_chunks/picker-h1P5RUgp.js +122 -0
- package/_chunks/popup-CT2uD3go.js +367 -0
- package/_chunks/preact.module-BBM36DnO.js +290 -0
- package/_chunks/{rating-choice-CWAsNQNS.js → rating-choice-DZgmaic0.js} +10 -10
- package/_chunks/render-m5eMMwFR.js +83 -0
- package/_chunks/reorder-list-CSlqAGHw.js +59 -0
- package/_chunks/request-trail-DSlFix6i.js +618 -0
- package/_chunks/rich-text-CH7gIqOS.js +636 -0
- package/_chunks/rotate-right-Iha5ScJ1.js +4 -0
- package/_form.scss +1 -1
- package/_vendor/preact/LICENSE +21 -0
- package/_vendor/preact/compat/src/index.d.ts +353 -0
- package/_vendor/preact/compat/src/suspense-list.d.ts +16 -0
- package/_vendor/preact/compat/src/suspense.d.ts +19 -0
- package/_vendor/preact/hooks/src/index.d.ts +145 -0
- package/_vendor/preact/src/dom.d.ts +2548 -0
- package/_vendor/preact/src/index.d.ts +373 -0
- package/_vendor/preact/src/jsx.d.ts +2958 -0
- package/activity-message.d.ts +1 -1
- package/activity-message.js +16 -16
- package/ai/_chat.scss +195 -0
- package/ai/_style.scss +105 -34
- package/ai/chat.d.ts +63 -0
- package/ai/components.d.ts +20 -4
- package/ai/index.d.ts +2 -0
- package/ai/index.js +3 -3
- package/ai/mount.d.ts +30 -1
- package/ai/prompt-history.d.ts +13 -0
- package/ai/request-trail.d.ts +1 -1
- package/ai/transcript.d.ts +25 -0
- package/ai/translation-context.d.ts +1 -1
- package/ai/translations.d.ts +1 -1
- package/alert.d.ts +2 -2
- package/angular/angular.js +0 -3
- package/assignee/field.d.ts +2 -2
- package/assignee/index.js +86 -87
- package/assignee/layout.d.ts +2 -2
- package/assignee/picker.d.ts +1 -1
- package/avatar/index.js +25 -25
- package/avatar/index.view.d.ts +1 -1
- package/brush-range/component.d.ts +1 -1
- package/brush-range/component.js +30 -30
- package/buttons/delete-button.d.ts +2 -1
- package/buttons/delete-button.js +1 -1
- package/buttons/remove-button.d.ts +1 -1
- package/buttons/remove-button.js +3 -3
- package/buttons/svg-button.d.ts +2 -1
- package/buttons/svg-button.js +35 -35
- package/calendar/_calendar.scss +7 -2
- package/calendar/calendar.d.ts +1 -1
- package/calendar/calendar.js +1 -1
- package/calendar/caption.d.ts +1 -1
- package/calendar/day.d.ts +1 -1
- package/calendar/day.js +4 -4
- package/calendar/header.d.ts +1 -1
- package/calendar/header.js +35 -35
- package/calendar/index.js +2 -2
- package/calendar/month-grid.d.ts +1 -1
- package/calendar/month-grid.js +37 -37
- package/calendar/picker.d.ts +1 -1
- package/calendar/types.d.ts +1 -1
- package/calendar/year-grid.d.ts +1 -1
- package/calendar/year-grid.js +12 -12
- package/checkbox/index.d.ts +2 -2
- package/checkbox/index.js +9 -9
- package/choice-chips/index.d.ts +1 -1
- package/choice-chips/index.js +1 -1
- package/color-palette/color-palette.d.ts +1 -1
- package/color-palette/color-palette.js +1 -1
- package/color-palette/color-picker.d.ts +1 -1
- package/color-palette/color-picker.js +2 -2
- package/component-catalog.d.ts +34 -23
- package/control-attributes.js +7 -7
- package/control-presentation.js +18 -18
- package/controls.d.ts +12 -10
- package/controls.js +3 -3
- package/core/editor-commit.d.ts +1 -1
- package/core/editor-popup.d.ts +1 -1
- package/core/editor-popup.js +1 -1
- package/date-time/date-control.d.ts +1 -1
- package/date-time/field.d.ts +2 -2
- package/date-time/index.js +1 -1
- package/date-time/picker.d.ts +1 -1
- package/date-time/style.scss +4 -4
- package/date-time/time-control.d.ts +1 -1
- package/date-time/time-selection.d.ts +1 -1
- package/date-time/types.d.ts +1 -1
- package/dialog/dialog-action-footer.view.d.ts +1 -1
- package/dialog/dialog.dom.js +52 -52
- package/dialog/dialog.parts.d.ts +18 -18
- package/dialog/dialog.parts.js +1 -1
- package/dialog/dialog.preact.d.ts +1 -1
- package/dialog/dialog.preact.js +6 -6
- package/distribution-chart/area-chart.d.ts +1 -1
- package/distribution-chart/area-chart.js +25 -25
- package/distribution-chart/bar-chart.d.ts +6 -3
- package/distribution-chart/bar-chart.js +10 -6
- package/distribution-chart/chart-frame.d.ts +3 -2
- package/distribution-chart/index.d.ts +1 -1
- package/distribution-chart/index.js +6 -6
- package/distribution-chart/line-chart.d.ts +1 -1
- package/distribution-chart/line-chart.js +9 -9
- package/distribution-chart/types.d.ts +1 -1
- package/dropdown/content.d.ts +3 -2
- package/dropdown/content.js +1 -141
- package/dropdown/control.d.ts +14 -0
- package/dropdown/control.js +1 -0
- package/dropdown/control.view.d.ts +6 -0
- package/dropdown/dropdown.service.d.ts +1 -1
- package/dropdown/dropdown.service.js +9 -9
- package/dropdown/dropdown.types.d.ts +4 -0
- package/dropdown/editor-dropdown.style.scss +37 -9
- package/dropdown/index.d.ts +1 -1
- package/dropdown/index.js +3 -4
- package/dropdown/lookup-field.d.ts +1 -1
- package/dropdown/lookup-field.js +41 -41
- package/dropdown/popup.d.ts +1 -1
- package/dropdown/popup.js +1 -140
- package/duration/controls.d.ts +1 -1
- package/duration/index.d.ts +2 -2
- package/duration/index.js +1 -1
- package/duration/style.scss +1 -1
- package/editor-actions.d.ts +1 -1
- package/editor-actions.js +21 -20
- package/editor-layout/index.d.ts +1 -1
- package/editor-layout/index.js +27 -27
- package/field-configurator.d.ts +1 -1
- package/field-configurator.js +93 -93
- package/field-reorder.hook.js +32 -32
- package/fieldset.d.ts +3 -0
- package/filter/filters/slider/preact.js +3 -3
- package/filter/filters/slider/single.d.ts +1 -1
- package/filter/filters/slider/single.js +23 -23
- package/filter-badge.d.ts +1 -1
- package/filter-badge.js +23 -22
- package/filter-controls.d.ts +1 -1
- package/filter-controls.js +30 -30
- package/form-controls/field-context.d.ts +5 -0
- package/form-controls/index.js +16 -21
- package/form-controls/index.view.d.ts +2 -4
- package/form-controls/presentation.d.ts +1 -1
- package/form-controls/presentation.js +59 -51
- package/formatting/comparison-preview.d.ts +1 -1
- package/formatting/control-tooltip.d.ts +1 -1
- package/formatting/icon-controls.d.ts +1 -1
- package/formatting/index.js +105 -100
- package/formatting/inspector-section.d.ts +1 -1
- package/formatting/typography-controls.d.ts +1 -1
- package/framework-mount.d.ts +1 -1
- package/framework.js +215 -207
- package/history-controls.d.ts +14 -0
- package/history-controls.js +1 -0
- package/icons/icon.d.ts +1 -1
- package/icons/icon.js +1 -1
- package/legend.d.ts +1 -1
- package/legend.js +12 -12
- package/masked-input/index.d.ts +1 -1
- package/masked-input/index.js +109 -109
- package/native-control.d.ts +14 -12
- package/native-control.js +3 -26
- package/native-styles.css +1 -1
- package/native.js +40 -39
- package/number-input/index.d.ts +1 -1
- package/number-input/index.js +1 -1
- package/package.json +18 -14
- package/pagination.d.ts +3 -0
- package/pagination.js +43 -33
- package/pdf-viewer/component.d.ts +1 -1
- package/pdf-viewer/controller.js +1 -1
- package/pdf-viewer/header.d.ts +1 -1
- package/pdf-viewer/index.js +13 -13
- package/pdf-viewer/search-bar.d.ts +1 -1
- package/pdf-viewer/status.d.ts +1 -1
- package/pdf-viewer/style.scss +3 -4
- package/pdf-viewer/toolbar.d.ts +1 -1
- package/pickers.d.ts +1 -1
- package/preact-mount.d.ts +1 -1
- package/preact-mount.js +1 -1
- package/preact.d.ts +2 -0
- package/preact.js +62 -62
- package/rating-choice.d.ts +1 -1
- package/rating-choice.js +1 -1
- package/react-adapter.d.ts +1 -1
- package/react-control.d.ts +0 -1
- package/react-control.js +2 -2
- package/react.d.ts +13 -3
- package/react.js +71 -88
- package/reorder-list.d.ts +1 -1
- package/reorder-list.js +1 -1
- package/resource-picker/resource-picker-avatar.d.ts +1 -1
- package/resource-picker/resource-picker-avatar.js +14 -14
- package/resource-picker/resource-picker-option.d.ts +1 -1
- package/resource-picker/resource-picker-option.js +28 -28
- package/resource-picker/resource-picker-popup.d.ts +1 -1
- package/resource-picker/resource-picker-popup.js +3 -3
- package/resource-picker/resource-picker.d.ts +1 -1
- package/resource-picker/resource-picker.js +88 -88
- package/resource-picker/resource-picker.scss +6 -3
- package/rich-text/engine.d.ts +16 -19
- package/rich-text/index.d.ts +7 -7
- package/rich-text/index.js +1 -1
- package/rich-text/model.d.ts +4 -3
- package/rich-text/render-model.d.ts +4 -5
- package/rich-text/style.scss +3 -12
- package/rich-text/toolbar.d.ts +7 -7
- package/rich-text/translations.d.ts +3 -15
- package/search-input/index.js +12 -12
- package/segmented-switch/index.d.ts +1 -1
- package/segmented-switch/index.js +1 -1
- package/select.d.ts +20 -0
- package/select.js +1 -0
- package/status-feedback/exit-snapshot.js +4 -4
- package/status-feedback/index.js +2 -2
- package/status-feedback/popover.js +10 -10
- package/status-feedback/render.d.ts +2 -2
- package/status-feedback/render.js +3 -44
- package/status-feedback/status-feedback.scss +7 -0
- package/status-feedback/types.d.ts +4 -0
- package/status-feedback/use-auto-dismiss.d.ts +3 -0
- package/styles/_compositions.scss +3 -1
- package/styles/_control.scss +12 -4
- package/styles/_primitives.scss +9 -8
- package/styles.css +1 -1
- package/surfaces.js +49 -49
- package/svelte/UiComponent.server.js +1 -48
- package/svelte/UiComponent.svelte +0 -21
- package/svelte.js +33 -68
- package/switch/index.js +15 -15
- package/time-grid.d.ts +1 -1
- package/time-grid.js +58 -58
- package/timeline-track/component.d.ts +5 -1
- package/timeline-track/index.js +91 -74
- package/timeline-track/model.d.ts +9 -0
- package/timeline-track/model.js +10 -1
- package/ui.css +1 -1
- package/vue-adapter.d.ts +1 -1
- package/vue.d.ts +138 -119
- package/vue.js +150 -174
- package/_chunks/calendar-BsDxCYhI.js +0 -248
- package/_chunks/chart-frame-BvxbmEU9.js +0 -126
- package/_chunks/choice-chips-0HfOnK_4.js +0 -110
- package/_chunks/color-picker-BRv-__AM.js +0 -138
- package/_chunks/component-D4PH5UZT.js +0 -859
- package/_chunks/date-time-DjucJmbc.js +0 -769
- package/_chunks/dialog.parts-Dt3KinUz.js +0 -134
- package/_chunks/dropdown-CkGQBm1Q.js +0 -357
- package/_chunks/duration-BCaktcvz.js +0 -270
- package/_chunks/editor-commit-D6Rf5rGz.js +0 -12
- package/_chunks/framework-mount-BKIOsvY-.js +0 -54
- package/_chunks/mount-0-8opf1j.js +0 -90
- package/_chunks/native.view-8q_nwQ7x.js +0 -32
- package/_chunks/picker-oazJ7sO_.js +0 -121
- package/_chunks/reorder-list-BV3kZXso.js +0 -59
- package/_chunks/request-trail-D0oVzdRd.js +0 -347
- package/_chunks/rich-text-2Rla349o.js +0 -477
- package/react-native-select.d.ts +0 -6
- package/rich-text/syntax.d.ts +0 -2
- package/vue-native-select.d.ts +0 -9
package/masked-input/index.js
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
1
|
+
import { a as e, i as t, t as n } from "../_chunks/hooks.module-CG3gN83z.js";
|
|
2
|
+
import { t as r } from "../_chunks/jsxRuntime.module-F6UFnpT-.js";
|
|
3
|
+
import { n as i } from "../_chunks/native-control-C_yok8_-.js";
|
|
4
|
+
import { EditorActions as a } from "../editor-actions.js";
|
|
5
5
|
//#region src/masked-input/model.ts
|
|
6
|
-
function
|
|
6
|
+
function o(e) {
|
|
7
7
|
if (typeof e != "string") return;
|
|
8
8
|
let t = [], n = Array.from(e);
|
|
9
9
|
for (let e = 0; e < n.length; e++) {
|
|
@@ -15,14 +15,14 @@ function s(e) {
|
|
|
15
15
|
}
|
|
16
16
|
return t.some((e) => "token" in e) ? t : void 0;
|
|
17
17
|
}
|
|
18
|
-
function
|
|
18
|
+
function s(e, t) {
|
|
19
19
|
return e === "0" ? /^[0-9]$/.test(t) : e === "A" ? /^[A-Za-z]$/.test(t) : /^[A-Za-z0-9]$/.test(t);
|
|
20
20
|
}
|
|
21
|
-
function
|
|
21
|
+
function c(e, t) {
|
|
22
22
|
let n = "";
|
|
23
23
|
for (let r = 0; r < e.length; r++) {
|
|
24
24
|
let i = t[r];
|
|
25
|
-
if (!i || ("literal" in i ? e[r] !== i.literal : !
|
|
25
|
+
if (!i || ("literal" in i ? e[r] !== i.literal : !s(i.token, e[r]))) return {
|
|
26
26
|
complete: !1,
|
|
27
27
|
prefix: !1,
|
|
28
28
|
raw: n
|
|
@@ -35,14 +35,14 @@ function l(e, t) {
|
|
|
35
35
|
raw: n
|
|
36
36
|
};
|
|
37
37
|
}
|
|
38
|
-
function
|
|
38
|
+
function l(e, t) {
|
|
39
39
|
let n = (e) => ({
|
|
40
40
|
valid: !1,
|
|
41
41
|
value: null,
|
|
42
42
|
raw: null,
|
|
43
43
|
formatted: null,
|
|
44
44
|
error: e
|
|
45
|
-
}), r =
|
|
45
|
+
}), r = o(t.mask);
|
|
46
46
|
if (!r || t.store !== void 0 && t.store !== "raw" && t.store !== "formatted") return n("configuration");
|
|
47
47
|
if (e == null || e === "") return t.required ? n("required") : {
|
|
48
48
|
valid: !0,
|
|
@@ -51,9 +51,9 @@ function u(e, t) {
|
|
|
51
51
|
formatted: null
|
|
52
52
|
};
|
|
53
53
|
if (typeof e != "string") return n("invalid");
|
|
54
|
-
let i = Array.from(e), a =
|
|
55
|
-
if (!
|
|
56
|
-
let u =
|
|
54
|
+
let i = Array.from(e), a = c(i, r.filter((e) => "token" in e)), s = c(i, r), l = a.complete ? a : s.complete ? s : void 0;
|
|
55
|
+
if (!l) return n(a.prefix || s.prefix ? "incomplete" : "invalid");
|
|
56
|
+
let u = l.raw, d = Array.from(u), f = 0, p = r.map((e) => "literal" in e ? e.literal : d[f++]).join("");
|
|
57
57
|
return {
|
|
58
58
|
valid: !0,
|
|
59
59
|
raw: u,
|
|
@@ -61,24 +61,24 @@ function u(e, t) {
|
|
|
61
61
|
value: t.store === "formatted" ? p : u
|
|
62
62
|
};
|
|
63
63
|
}
|
|
64
|
-
function
|
|
65
|
-
let n =
|
|
64
|
+
function u(e, t) {
|
|
65
|
+
let n = l(e, t);
|
|
66
66
|
return n.valid ? n.formatted ?? "" : e == null ? "" : String(e);
|
|
67
67
|
}
|
|
68
68
|
//#endregion
|
|
69
69
|
//#region src/masked-input/edit.ts
|
|
70
|
-
var
|
|
71
|
-
function
|
|
70
|
+
var d = "_";
|
|
71
|
+
function f(e, t) {
|
|
72
72
|
let n = t.filter((e) => "token" in e), r = Array.from(e), i = n.map(() => "");
|
|
73
73
|
if (!r.length) return i;
|
|
74
74
|
if (r.length === t.length) {
|
|
75
75
|
let e = 0;
|
|
76
76
|
if (t.every((t, n) => {
|
|
77
77
|
let a = r[n];
|
|
78
|
-
return "literal" in t ? a === t.literal : a !==
|
|
78
|
+
return "literal" in t ? a === t.literal : a !== d && !s(t.token, a) ? !1 : (i[e++] = a === d ? "" : a, !0);
|
|
79
79
|
})) return i;
|
|
80
80
|
}
|
|
81
|
-
if (r.length <= n.length && r.every((e, t) => "token" in n[t] &&
|
|
81
|
+
if (r.length <= n.length && r.every((e, t) => "token" in n[t] && s(n[t].token, e))) return i.map((e, t) => r[t] ?? "");
|
|
82
82
|
let a = 0;
|
|
83
83
|
for (let e = 0; e < r.length; e++) {
|
|
84
84
|
let n = t[e], o = r[e];
|
|
@@ -86,125 +86,125 @@ function p(e, t) {
|
|
|
86
86
|
if ("literal" in n) {
|
|
87
87
|
if (o !== n.literal) return;
|
|
88
88
|
} else {
|
|
89
|
-
if (o !==
|
|
90
|
-
i[a++] = o ===
|
|
89
|
+
if (o !== d && !s(n.token, o)) return;
|
|
90
|
+
i[a++] = o === d ? "" : o;
|
|
91
91
|
}
|
|
92
92
|
}
|
|
93
93
|
return i;
|
|
94
94
|
}
|
|
95
|
-
function
|
|
95
|
+
function p(e, t) {
|
|
96
96
|
let n = "", r = 0, i = [], a = [];
|
|
97
|
-
for (let o of t) "literal" in o ? n += o.literal : (i.push(n.length), n += e[r++] ||
|
|
97
|
+
for (let o of t) "literal" in o ? n += o.literal : (i.push(n.length), n += e[r++] || d, a.push(n.length));
|
|
98
98
|
return {
|
|
99
99
|
value: n,
|
|
100
100
|
starts: i,
|
|
101
101
|
ends: a
|
|
102
102
|
};
|
|
103
103
|
}
|
|
104
|
-
function
|
|
105
|
-
let n =
|
|
104
|
+
function m(e, t) {
|
|
105
|
+
let n = o(t.mask);
|
|
106
106
|
if (!n) return e;
|
|
107
|
-
let r =
|
|
108
|
-
return r ?
|
|
107
|
+
let r = f(e, n);
|
|
108
|
+
return r ? p(r, n).value : e;
|
|
109
109
|
}
|
|
110
|
-
function
|
|
111
|
-
let n =
|
|
110
|
+
function h(e, t) {
|
|
111
|
+
let n = o(t.mask), r = n && f(e, n);
|
|
112
112
|
if (!n || !r) return e.length;
|
|
113
|
-
let i =
|
|
113
|
+
let i = p(r, n), a = r.indexOf("");
|
|
114
114
|
return i.starts[a] ?? i.value.length;
|
|
115
115
|
}
|
|
116
|
-
function
|
|
117
|
-
let n =
|
|
116
|
+
function g(e, t) {
|
|
117
|
+
let n = l("", t);
|
|
118
118
|
if (n.error === "configuration") return n;
|
|
119
|
-
let r =
|
|
119
|
+
let r = o(t.mask), i = f(e, r);
|
|
120
120
|
return i ? i.every((e) => !e) ? n : i.some((e) => !e) ? {
|
|
121
121
|
valid: !1,
|
|
122
122
|
value: null,
|
|
123
123
|
raw: null,
|
|
124
124
|
formatted: null,
|
|
125
125
|
error: "incomplete"
|
|
126
|
-
} :
|
|
126
|
+
} : l(p(i, r).value, t) : l(e, t);
|
|
127
127
|
}
|
|
128
|
-
function
|
|
129
|
-
let
|
|
128
|
+
function _(e, t, n, r, i, a) {
|
|
129
|
+
let c = {
|
|
130
130
|
value: e,
|
|
131
131
|
caret: t,
|
|
132
132
|
accepted: !1
|
|
133
|
-
}, l =
|
|
134
|
-
if (!l) return
|
|
135
|
-
let u =
|
|
133
|
+
}, l = o(a.mask);
|
|
134
|
+
if (!l) return c;
|
|
135
|
+
let u = f(e, l);
|
|
136
136
|
if (!u) {
|
|
137
|
-
if (t !== 0 || n !== e.length) return
|
|
137
|
+
if (t !== 0 || n !== e.length) return c;
|
|
138
138
|
u = l.filter((e) => "token" in e).map(() => "");
|
|
139
139
|
}
|
|
140
|
-
let d =
|
|
141
|
-
for (let e =
|
|
142
|
-
let _ =
|
|
140
|
+
let d = p(u, l), m = d.ends.filter((e) => e <= t).length, h = d.starts.filter((e) => e < n).length, g = [...u];
|
|
141
|
+
for (let e = m; e < h; e++) g[e] = "";
|
|
142
|
+
let _ = m;
|
|
143
143
|
if ([
|
|
144
144
|
"deleteContentBackward",
|
|
145
145
|
"deleteContentForward",
|
|
146
146
|
"deleteByCut"
|
|
147
|
-
].includes(r)) t === n && r !== "deleteByCut" && (_ = r === "deleteContentBackward" ? Math.max(0,
|
|
147
|
+
].includes(r)) t === n && r !== "deleteByCut" && (_ = r === "deleteContentBackward" ? Math.max(0, m - 1) : m, _ < g.length && (g[_] = ""));
|
|
148
148
|
else if (r.startsWith("insert") && i !== null) {
|
|
149
|
-
let e = l.flatMap((e, t) => "token" in e ? [t] : []), r = e[
|
|
150
|
-
if (u.length <=
|
|
149
|
+
let e = l.flatMap((e, t) => "token" in e ? [t] : []), r = e[m] ?? l.length, a = l.slice(m === 0 ? 0 : r), o = a.filter((e) => "token" in e), u = Array.from(i), p;
|
|
150
|
+
if (u.length <= o.length && u.every((e, t) => "token" in o[t] && s(o[t].token, e))) p = u;
|
|
151
151
|
else {
|
|
152
|
-
let o = l.slice(
|
|
152
|
+
let o = l.slice(m ? e[m - 1] + 1 : 0, r).map((e) => "literal" in e ? e.literal : "").join("");
|
|
153
153
|
if (t === n && i && o.includes(i)) return {
|
|
154
154
|
value: d.value,
|
|
155
|
-
caret: d.starts[
|
|
155
|
+
caret: d.starts[m] ?? d.value.length,
|
|
156
156
|
accepted: !0
|
|
157
157
|
};
|
|
158
|
-
let s =
|
|
158
|
+
let s = f(i, a);
|
|
159
159
|
if (s) {
|
|
160
160
|
let e = s.findLastIndex(Boolean) + 1;
|
|
161
|
-
s.slice(0, e).every(Boolean) && (
|
|
161
|
+
s.slice(0, e).every(Boolean) && (p = s.slice(0, e));
|
|
162
162
|
}
|
|
163
163
|
}
|
|
164
|
-
if (!
|
|
165
|
-
|
|
166
|
-
g[
|
|
167
|
-
}), _ =
|
|
168
|
-
} else return
|
|
169
|
-
let v =
|
|
164
|
+
if (!p || m + p.length > g.length) return c;
|
|
165
|
+
p.forEach((e, t) => {
|
|
166
|
+
g[m + t] = e;
|
|
167
|
+
}), _ = m + p.length;
|
|
168
|
+
} else return c;
|
|
169
|
+
let v = p(g, l);
|
|
170
170
|
return {
|
|
171
171
|
value: v.value,
|
|
172
172
|
caret: v.starts[_] ?? v.value.length,
|
|
173
173
|
accepted: !0
|
|
174
174
|
};
|
|
175
175
|
}
|
|
176
|
-
var
|
|
176
|
+
var v = /* @__PURE__ */ new WeakMap(), y = (e) => ({
|
|
177
177
|
value: e.value,
|
|
178
178
|
start: e.selectionStart ?? 0,
|
|
179
179
|
end: e.selectionEnd ?? 0
|
|
180
180
|
});
|
|
181
|
-
function
|
|
182
|
-
let i =
|
|
181
|
+
function b(e, t, n, r) {
|
|
182
|
+
let i = _(e.value, e.selectionStart ?? 0, e.selectionEnd ?? e.value.length, t, n, r);
|
|
183
183
|
if (i.accepted) {
|
|
184
184
|
if (i.value !== e.value) {
|
|
185
|
-
let t =
|
|
185
|
+
let t = v.get(e);
|
|
186
186
|
(!t || t.current !== e.value) && (t = {
|
|
187
187
|
current: e.value,
|
|
188
188
|
past: [],
|
|
189
189
|
future: []
|
|
190
|
-
},
|
|
190
|
+
}, v.set(e, t)), t.past.push(y(e)), t.past.length > 100 && t.past.shift(), t.future = [], t.current = i.value;
|
|
191
191
|
}
|
|
192
192
|
e.value = i.value, e.setSelectionRange(i.caret, i.caret);
|
|
193
193
|
}
|
|
194
194
|
return i.accepted;
|
|
195
195
|
}
|
|
196
|
-
function
|
|
197
|
-
let n =
|
|
196
|
+
function x(e, t) {
|
|
197
|
+
let n = m(e.value, t);
|
|
198
198
|
if (n === e.value) return;
|
|
199
|
-
let r =
|
|
199
|
+
let r = o(t.mask), i = f(e.value, r);
|
|
200
200
|
if (!i) return;
|
|
201
|
-
let a =
|
|
202
|
-
let i =
|
|
201
|
+
let a = p(i, r), s = (t) => {
|
|
202
|
+
let i = f(e.value.slice(0, t), r)?.filter(Boolean).length ?? 0;
|
|
203
203
|
return a.starts[i] ?? n.length;
|
|
204
|
-
}, c =
|
|
204
|
+
}, c = s(e.selectionStart ?? e.value.length), l = s(e.selectionEnd ?? e.value.length);
|
|
205
205
|
e.value = n, e.setSelectionRange(c, l);
|
|
206
206
|
}
|
|
207
|
-
function
|
|
207
|
+
function S(e, t, n) {
|
|
208
208
|
return t.isComposing || !t.cancelable || ![
|
|
209
209
|
"insertText",
|
|
210
210
|
"insertReplacementText",
|
|
@@ -212,91 +212,91 @@ function C(e, t, n) {
|
|
|
212
212
|
"deleteContentBackward",
|
|
213
213
|
"deleteContentForward",
|
|
214
214
|
"deleteByCut"
|
|
215
|
-
].includes(t.inputType) || t.inputType.startsWith("insert") && t.data === null ? !1 : (t.preventDefault(),
|
|
215
|
+
].includes(t.inputType) || t.inputType.startsWith("insert") && t.data === null ? !1 : (t.preventDefault(), b(e, t.inputType, t.data, n), !0);
|
|
216
216
|
}
|
|
217
|
-
function
|
|
218
|
-
return t.clipboardData ? (t.preventDefault(),
|
|
217
|
+
function C(e, t, n) {
|
|
218
|
+
return t.clipboardData ? (t.preventDefault(), b(e, "insertFromPaste", t.clipboardData.getData("text/plain"), n), !0) : !1;
|
|
219
219
|
}
|
|
220
|
-
function
|
|
220
|
+
function w(e, t) {
|
|
221
221
|
if (t.isComposing || !(t.ctrlKey || t.metaKey) || t.altKey) return !1;
|
|
222
222
|
let n = t.key.toLowerCase();
|
|
223
223
|
if (n !== "z" && n !== "y") return !1;
|
|
224
224
|
t.preventDefault(), t.stopPropagation();
|
|
225
|
-
let r =
|
|
225
|
+
let r = v.get(e);
|
|
226
226
|
if (!r || r.current !== e.value) return !0;
|
|
227
227
|
let i = n === "y" || t.shiftKey, a = (i ? r.future : r.past).pop();
|
|
228
|
-
return a && ((i ? r.past : r.future).push(
|
|
228
|
+
return a && ((i ? r.past : r.future).push(y(e)), r.current = e.value = a.value, e.setSelectionRange(a.start, a.end)), !0;
|
|
229
229
|
}
|
|
230
230
|
//#endregion
|
|
231
231
|
//#region src/masked-input/index.tsx
|
|
232
|
-
var
|
|
232
|
+
var T = {
|
|
233
233
|
required: "Enter a value.",
|
|
234
234
|
invalid: "Use only the characters and separators specified by the mask.",
|
|
235
235
|
incomplete: "Complete every position in the mask.",
|
|
236
236
|
configuration: "Configure a mask with 0, A, or * positions and valid escapes.",
|
|
237
237
|
preview: "Formatted value"
|
|
238
238
|
};
|
|
239
|
-
function
|
|
240
|
-
let [
|
|
241
|
-
...
|
|
242
|
-
...
|
|
243
|
-
},
|
|
244
|
-
|
|
239
|
+
function E({ value: o, options: s, apply: c, cancel: l }) {
|
|
240
|
+
let [u, d] = t(() => m(String(o ?? ""), s)), [f, p] = t(!1), [h, _] = t(!1), v = n(!1), y = e(), b = {
|
|
241
|
+
...T,
|
|
242
|
+
...s.text
|
|
243
|
+
}, E = g(u, s), D = f || E.error === "invalid" || E.error === "configuration", O = () => {
|
|
244
|
+
p(!0), !v.current && E.valid && c(E.value);
|
|
245
245
|
};
|
|
246
|
-
return /* @__PURE__ */
|
|
246
|
+
return /* @__PURE__ */ r("div", {
|
|
247
247
|
class: "rv-masked-draft",
|
|
248
248
|
onKeyDown: (e) => {
|
|
249
|
-
!
|
|
249
|
+
!v.current && e.target instanceof HTMLInputElement && w(e.target, e) ? d(e.target.value) : e.key === "Enter" && (e.ctrlKey || e.metaKey || e.target instanceof HTMLInputElement) && !e.isComposing && !v.current && (e.preventDefault(), O());
|
|
250
250
|
},
|
|
251
251
|
children: [
|
|
252
|
-
/* @__PURE__ */
|
|
252
|
+
/* @__PURE__ */ r(i, {
|
|
253
253
|
type: "text",
|
|
254
|
-
value:
|
|
255
|
-
"aria-label":
|
|
256
|
-
"aria-invalid":
|
|
257
|
-
"aria-describedby": `${
|
|
258
|
-
required:
|
|
259
|
-
placeholder:
|
|
254
|
+
value: u,
|
|
255
|
+
"aria-label": s.label ?? "Masked identifier",
|
|
256
|
+
"aria-invalid": D && !E.valid,
|
|
257
|
+
"aria-describedby": `${y}-hint${D && E.error ? ` ${y}-error` : ""}`,
|
|
258
|
+
required: s.required,
|
|
259
|
+
placeholder: s.placeholder ?? s.mask,
|
|
260
260
|
onBeforeInput: (e) => {
|
|
261
|
-
!
|
|
261
|
+
!v.current && S(e.currentTarget, e, s) && d(e.currentTarget.value);
|
|
262
262
|
},
|
|
263
263
|
onPaste: (e) => {
|
|
264
|
-
!
|
|
264
|
+
!v.current && C(e.currentTarget, e, s) && d(e.currentTarget.value);
|
|
265
265
|
},
|
|
266
266
|
onInput: (e) => {
|
|
267
|
-
|
|
267
|
+
v.current || x(e.currentTarget, s), d(e.currentTarget.value);
|
|
268
268
|
},
|
|
269
269
|
onCompositionStart: () => {
|
|
270
|
-
|
|
270
|
+
v.current = !0, _(!0);
|
|
271
271
|
},
|
|
272
272
|
onCompositionEnd: (e) => {
|
|
273
|
-
|
|
273
|
+
v.current = !1, _(!1), x(e.currentTarget, s), d(e.currentTarget.value);
|
|
274
274
|
}
|
|
275
275
|
}),
|
|
276
|
-
/* @__PURE__ */
|
|
277
|
-
id: `${
|
|
276
|
+
/* @__PURE__ */ r("span", {
|
|
277
|
+
id: `${y}-hint`,
|
|
278
278
|
class: "rv-masked-draft__preview",
|
|
279
279
|
children: [
|
|
280
|
-
|
|
280
|
+
b.preview,
|
|
281
281
|
": ",
|
|
282
|
-
/* @__PURE__ */
|
|
282
|
+
/* @__PURE__ */ r("output", { children: E.formatted ?? s.mask })
|
|
283
283
|
]
|
|
284
284
|
}),
|
|
285
|
-
|
|
286
|
-
id: `${
|
|
285
|
+
D && E.error && /* @__PURE__ */ r("span", {
|
|
286
|
+
id: `${y}-error`,
|
|
287
287
|
role: "alert",
|
|
288
288
|
class: "rv-editor-error",
|
|
289
|
-
children:
|
|
289
|
+
children: b[E.error]
|
|
290
290
|
}),
|
|
291
|
-
/* @__PURE__ */ a
|
|
292
|
-
text:
|
|
293
|
-
disabled: !
|
|
294
|
-
apply:
|
|
295
|
-
cancel:
|
|
296
|
-
clear:
|
|
291
|
+
/* @__PURE__ */ r(a, {
|
|
292
|
+
text: s.actions,
|
|
293
|
+
disabled: !E.valid || h,
|
|
294
|
+
apply: O,
|
|
295
|
+
cancel: l,
|
|
296
|
+
clear: s.required ? void 0 : () => d(m("", s))
|
|
297
297
|
})
|
|
298
298
|
]
|
|
299
299
|
});
|
|
300
300
|
}
|
|
301
301
|
//#endregion
|
|
302
|
-
export {
|
|
302
|
+
export { E as MaskedDraft, s as acceptsMaskToken, b as applyMaskedEdit, _ as editMaskedInput, m as formatMaskedDraft, u as formatMaskedValue, S as handleMaskedBeforeInput, w as handleMaskedHistory, C as handleMaskedPaste, o as maskParts, h as maskedDraftCaret, x as normalizeMaskedInput, g as parseMaskedDraft, l as parseMaskedInput };
|
package/native-control.d.ts
CHANGED
|
@@ -1,28 +1,30 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { Select as SharedSelect } from './select';
|
|
2
|
+
import { h, JSX } from './_vendor/preact/src/index';
|
|
2
3
|
type NativeAttributes<K extends keyof JSX.IntrinsicElements> = Omit<JSX.IntrinsicElements[K], 'class' | 'className' | 'ref'> & {
|
|
3
4
|
class?: JSX.IntrinsicElements[K]['class'] | Record<string, boolean | undefined>;
|
|
4
5
|
className?: JSX.IntrinsicElements[K]['className'];
|
|
5
6
|
};
|
|
6
7
|
/** Transparent adapters preserve native event signatures and DOM refs. */
|
|
7
|
-
export declare const Input: import('preact').FunctionalComponent<import('preact/compat').PropsWithoutRef<NativeAttributes<"input">> & {
|
|
8
|
-
ref?: import('preact').Ref<HTMLInputElement> | undefined;
|
|
8
|
+
export declare const Input: import('./_vendor/preact/src/index').FunctionalComponent<import('./_vendor/preact/compat/src/index').PropsWithoutRef<NativeAttributes<"input">> & {
|
|
9
|
+
ref?: import('./_vendor/preact/src/index').Ref<HTMLInputElement> | undefined;
|
|
9
10
|
}>;
|
|
10
|
-
export declare const
|
|
11
|
-
ref?: import('preact').Ref<
|
|
11
|
+
export declare const TextArea: import('./_vendor/preact/src/index').FunctionalComponent<import('./_vendor/preact/compat/src/index').PropsWithoutRef<NativeAttributes<"textarea">> & {
|
|
12
|
+
ref?: import('./_vendor/preact/src/index').Ref<HTMLTextAreaElement> | undefined;
|
|
12
13
|
}>;
|
|
13
|
-
export declare const
|
|
14
|
-
ref?: import('preact').Ref<HTMLTextAreaElement> | undefined;
|
|
15
|
-
}>;
|
|
16
|
-
export declare const ButtonControl: import('preact').FunctionalComponent<import('preact/compat').PropsWithoutRef<Omit<h.JSX.ButtonHTMLAttributes<HTMLButtonElement>, "className" | "class" | "ref"> & {
|
|
14
|
+
export declare const ButtonControl: import('./_vendor/preact/src/index').FunctionalComponent<import('./_vendor/preact/compat/src/index').PropsWithoutRef<Omit<h.JSX.ButtonHTMLAttributes<HTMLButtonElement>, "className" | "ref" | "class"> & {
|
|
17
15
|
class?: h.JSX.Signalish<string | undefined> | Record<string, boolean | undefined>;
|
|
18
16
|
className?: h.JSX.Signalish<string | undefined>;
|
|
19
17
|
} & {
|
|
20
18
|
unstyled?: boolean;
|
|
21
19
|
busy?: boolean;
|
|
20
|
+
rounded?: boolean;
|
|
22
21
|
}> & {
|
|
23
|
-
ref?: import('preact').Ref<HTMLButtonElement> | undefined;
|
|
22
|
+
ref?: import('./_vendor/preact/src/index').Ref<HTMLButtonElement> | undefined;
|
|
24
23
|
}>;
|
|
25
|
-
export declare const Summary: import('preact').FunctionalComponent<import('preact/compat').PropsWithoutRef<NativeAttributes<"summary">> & {
|
|
26
|
-
ref?: import('preact').Ref<HTMLElement> | undefined;
|
|
24
|
+
export declare const Summary: import('./_vendor/preact/src/index').FunctionalComponent<import('./_vendor/preact/compat/src/index').PropsWithoutRef<NativeAttributes<"summary">> & {
|
|
25
|
+
ref?: import('./_vendor/preact/src/index').Ref<HTMLElement> | undefined;
|
|
27
26
|
}>;
|
|
28
27
|
export { nativeControlTag } from './control-presentation';
|
|
28
|
+
/** Selection uses the shared Dropdown rather than browser-native UI. */
|
|
29
|
+
export declare const Select: typeof SharedSelect;
|
|
30
|
+
export { Fieldset } from './fieldset';
|
package/native-control.js
CHANGED
|
@@ -1,26 +1,3 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
|
|
4
|
-
//#region src/native-control.tsx
|
|
5
|
-
function a(e, t, ...i) {
|
|
6
|
-
let { onChange: a, ...o } = t, s = n(r, e, o, ...i);
|
|
7
|
-
return a && !(e === "button" && t.busy) && Object.assign(s.props, { onChange: a }), s;
|
|
8
|
-
}
|
|
9
|
-
var o = t(i((e, t) => a("input", {
|
|
10
|
-
...e,
|
|
11
|
-
ref: t
|
|
12
|
-
})), "input"), s = t(i(({ children: e, ...t }, n) => a("select", {
|
|
13
|
-
...t,
|
|
14
|
-
ref: n
|
|
15
|
-
}, e)), "select"), c = t(i(({ children: e, ...t }, n) => a("textarea", {
|
|
16
|
-
...t,
|
|
17
|
-
ref: n
|
|
18
|
-
}, e)), "textarea"), l = t(i(({ children: e, ...t }, n) => a("button", {
|
|
19
|
-
...t,
|
|
20
|
-
ref: n
|
|
21
|
-
}, e)), "button"), u = t(i(({ children: e, ...t }, n) => a("summary", {
|
|
22
|
-
...t,
|
|
23
|
-
ref: n
|
|
24
|
-
}, e)), "summary");
|
|
25
|
-
//#endregion
|
|
26
|
-
export { l as ButtonControl, o as Input, s as Select, u as Summary, c as TextArea, e as nativeControlTag };
|
|
1
|
+
import { a as e, i as t, n, o as r, r as i, t as a } from "./_chunks/native-control-C_yok8_-.js";
|
|
2
|
+
import { nativeControlTag as o } from "./control-presentation.js";
|
|
3
|
+
export { a as ButtonControl, r as Fieldset, n as Input, i as Select, t as Summary, e as TextArea, o as nativeControlTag };
|