stimeo-ui 0.18.1 → 0.19.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.
- checksums.yaml +4 -4
- data/CHANGELOG.md +54 -0
- data/dist/cable/index.js +6 -5
- data/dist/controllers/alert_dialog_controller.js +324 -76
- data/dist/controllers/announcer_controller.js +22 -9
- data/dist/controllers/auto_submit_controller.js +103 -16
- data/dist/controllers/avatar_controller.js +29 -9
- data/dist/controllers/breadcrumb_controller.js +205 -17
- data/dist/controllers/bulk_select_controller.js +31 -13
- data/dist/controllers/calendar_controller.js +242 -7
- data/dist/controllers/carousel_controller.js +70 -15
- data/dist/controllers/character_counter_controller.js +103 -16
- data/dist/controllers/clipboard_controller.js +6 -5
- data/dist/controllers/collapsible_controller.js +35 -8
- data/dist/controllers/combobox_controller.js +155 -26
- data/dist/controllers/command_palette_controller.js +445 -117
- data/dist/controllers/conditional_fields_controller.js +84 -44
- data/dist/controllers/confirm_controller.js +303 -68
- data/dist/controllers/context_menu_controller.js +59 -30
- data/dist/controllers/countdown_controller.js +6 -5
- data/dist/controllers/currency_input_controller.js +72 -7
- data/dist/controllers/data_grid_controller.js +273 -51
- data/dist/controllers/date_range_picker_controller.js +27 -5
- data/dist/controllers/dialog_controller.js +330 -79
- data/dist/controllers/direct_upload_controller.js +6 -5
- data/dist/controllers/dismissible_controller.js +68 -18
- data/dist/controllers/drawer_controller.js +362 -92
- data/dist/controllers/dropdown_controller.js +64 -52
- data/dist/controllers/editable_controller.js +140 -12
- data/dist/controllers/empty_state_controller.js +193 -9
- data/dist/controllers/file_dropzone_controller.js +313 -23
- data/dist/controllers/filter_controller.js +194 -5
- data/dist/controllers/flash_controller.js +205 -17
- data/dist/controllers/focus_controller.js +273 -57
- data/dist/controllers/form_field_controller.js +71 -14
- data/dist/controllers/form_validation_controller.js +11 -7
- data/dist/controllers/frame_loading_controller.js +75 -20
- data/dist/controllers/hover_card_controller.js +108 -39
- data/dist/controllers/input_mask_controller.js +95 -37
- data/dist/controllers/intersection_controller.js +61 -29
- data/dist/controllers/lazy_frame_controller.js +61 -29
- data/dist/controllers/listbox_controller.js +174 -83
- data/dist/controllers/local_time_controller.js +1 -7
- data/dist/controllers/menu_controller.js +45 -24
- data/dist/controllers/menubar_controller.js +232 -52
- data/dist/controllers/meter_controller.js +31 -9
- data/dist/controllers/multi_select_controller.js +195 -62
- data/dist/controllers/navigation_menu_controller.js +1 -1
- data/dist/controllers/nested_form_controller.js +275 -21
- data/dist/controllers/network_status_controller.js +31 -9
- data/dist/controllers/number_input_controller.js +180 -71
- data/dist/controllers/otp_controller.js +97 -11
- data/dist/controllers/overflow_menu_controller.js +190 -24
- data/dist/controllers/pagination_controller.js +186 -24
- data/dist/controllers/password_reveal_controller.js +25 -4
- data/dist/controllers/password_strength_controller.js +6 -5
- data/dist/controllers/popover_controller.js +466 -42
- data/dist/controllers/progress_controller.js +31 -9
- data/dist/controllers/radio_group_controller.js +279 -88
- data/dist/controllers/range_slider_controller.js +72 -54
- data/dist/controllers/rating_controller.js +58 -10
- data/dist/controllers/read_more_controller.js +191 -25
- data/dist/controllers/relative_time_controller.js +1 -7
- data/dist/controllers/roving_controller.js +204 -8
- data/dist/controllers/scroll_area_controller.js +61 -19
- data/dist/controllers/scroll_visibility_controller.js +25 -4
- data/dist/controllers/scrollspy_controller.js +240 -32
- data/dist/controllers/separator_controller.js +97 -58
- data/dist/controllers/sidebar_controller.js +368 -127
- data/dist/controllers/skeleton_controller.js +75 -20
- data/dist/controllers/slider_controller.js +72 -54
- data/dist/controllers/sortable_controller.js +6 -5
- data/dist/controllers/spinner_controller.js +75 -20
- data/dist/controllers/step_indicator_controller.js +181 -6
- data/dist/controllers/stepper_controller.js +188 -6
- data/dist/controllers/sticky_observer_controller.js +86 -33
- data/dist/controllers/submit_once_controller.js +31 -9
- data/dist/controllers/switch_controller.js +84 -44
- data/dist/controllers/tabs_controller.js +189 -3
- data/dist/controllers/tags_input_controller.js +293 -29
- data/dist/controllers/theme_controller.js +192 -5
- data/dist/controllers/time_picker_controller.js +77 -42
- data/dist/controllers/toast_controller.js +478 -16
- data/dist/controllers/toggle_group_controller.js +282 -79
- data/dist/controllers/toolbar_controller.js +276 -15
- data/dist/controllers/tooltip_controller.js +244 -46
- data/dist/controllers/tree_view_controller.js +287 -57
- data/dist/index.js +2258 -1016
- data/lib/stimeo/ui/version.rb +1 -1
- metadata +2 -2
|
@@ -10,43 +10,66 @@ function setAttributeIfChanged(element, name, value, beforeWrite) {
|
|
|
10
10
|
|
|
11
11
|
var AuthoredMutationWatcher = class {
|
|
12
12
|
#onAuthored;
|
|
13
|
-
#
|
|
14
|
-
#observer = null;
|
|
13
|
+
#lifetime = null;
|
|
15
14
|
constructor(onAuthored) {
|
|
16
15
|
this.#onAuthored = onAuthored;
|
|
17
16
|
}
|
|
18
17
|
observe(root, options) {
|
|
19
|
-
this
|
|
20
|
-
const
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
}
|
|
25
|
-
this.#
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
18
|
+
const previous = this.#lifetime;
|
|
19
|
+
const lifetime = {
|
|
20
|
+
observer: null,
|
|
21
|
+
active: false,
|
|
22
|
+
claims: { attributes: /* @__PURE__ */ new Map(), children: /* @__PURE__ */ new Map() }
|
|
23
|
+
};
|
|
24
|
+
this.#lifetime = lifetime;
|
|
25
|
+
let observer = null;
|
|
26
|
+
try {
|
|
27
|
+
if (previous) this.#release(previous);
|
|
28
|
+
if (this.#lifetime !== lifetime) return;
|
|
29
|
+
const attributes = [...options.attributes];
|
|
30
|
+
const subtree = options.subtree ?? false;
|
|
31
|
+
const childList = options.childList ?? false;
|
|
32
|
+
const inherited = options.ancestorAttributes;
|
|
33
|
+
const ancestorAttributes = inherited ? [...inherited] : null;
|
|
34
|
+
if (this.#lifetime !== lifetime) return;
|
|
35
|
+
observer = new MutationObserver((records) => {
|
|
36
|
+
const authored = this.#filter(records, lifetime.claims);
|
|
37
|
+
if (this.#lifetime === lifetime && lifetime.active && authored.length > 0) {
|
|
38
|
+
this.#onAuthored(authored);
|
|
39
|
+
}
|
|
40
|
+
});
|
|
41
|
+
if (this.#lifetime !== lifetime) return;
|
|
42
|
+
lifetime.observer = observer;
|
|
43
|
+
observer.observe(root, { attributes: true, attributeFilter: attributes, subtree, childList });
|
|
44
|
+
if (this.#lifetime !== lifetime) {
|
|
45
|
+
this.#release(lifetime, observer);
|
|
46
|
+
return;
|
|
47
|
+
}
|
|
48
|
+
if (ancestorAttributes) {
|
|
49
|
+
let ancestor = root.parentElement;
|
|
50
|
+
while (ancestor) {
|
|
51
|
+
observer.observe(ancestor, { attributes: true, attributeFilter: ancestorAttributes });
|
|
52
|
+
if (this.#lifetime !== lifetime) {
|
|
53
|
+
this.#release(lifetime, observer);
|
|
54
|
+
return;
|
|
55
|
+
}
|
|
56
|
+
ancestor = ancestor.parentElement;
|
|
57
|
+
}
|
|
41
58
|
}
|
|
59
|
+
lifetime.active = true;
|
|
60
|
+
} catch (error) {
|
|
61
|
+
this.#release(lifetime, observer);
|
|
62
|
+
throw error;
|
|
42
63
|
}
|
|
43
64
|
}
|
|
44
65
|
claim(target, name, value) {
|
|
45
|
-
const
|
|
46
|
-
|
|
66
|
+
const lifetime = this.#lifetime;
|
|
67
|
+
if (!lifetime?.active) return;
|
|
68
|
+
const claims = lifetime.claims.attributes;
|
|
69
|
+
let attributes = claims.get(target);
|
|
47
70
|
if (!attributes) {
|
|
48
71
|
attributes = /* @__PURE__ */ new Map();
|
|
49
|
-
claims
|
|
72
|
+
claims.set(target, attributes);
|
|
50
73
|
}
|
|
51
74
|
const pending = attributes.get(name);
|
|
52
75
|
attributes.set(name, { value, count: (pending?.count ?? 0) + 1 });
|
|
@@ -55,37 +78,49 @@ var AuthoredMutationWatcher = class {
|
|
|
55
78
|
this.claim(target, name, target.getAttribute(name));
|
|
56
79
|
}
|
|
57
80
|
claimChildList(target, added, removed) {
|
|
58
|
-
const
|
|
59
|
-
|
|
81
|
+
const lifetime = this.#lifetime;
|
|
82
|
+
if (!lifetime?.active) return;
|
|
83
|
+
const claims = lifetime.claims.children;
|
|
84
|
+
const pending = claims.get(target) ?? { added: /* @__PURE__ */ new Map(), removed: /* @__PURE__ */ new Map() };
|
|
60
85
|
for (const node of added) pending.added.set(node, (pending.added.get(node) ?? 0) + 1);
|
|
61
86
|
for (const node of removed) pending.removed.set(node, (pending.removed.get(node) ?? 0) + 1);
|
|
62
|
-
claims
|
|
87
|
+
claims.set(target, pending);
|
|
63
88
|
}
|
|
64
89
|
take() {
|
|
65
|
-
|
|
90
|
+
const lifetime = this.#lifetime;
|
|
91
|
+
const observer = lifetime?.observer;
|
|
92
|
+
if (!lifetime?.active || !observer) return [];
|
|
93
|
+
const records = observer.takeRecords();
|
|
94
|
+
const authored = this.#filter(records, lifetime.claims);
|
|
95
|
+
return this.#lifetime === lifetime && lifetime.active ? authored : [];
|
|
66
96
|
}
|
|
67
97
|
disconnect() {
|
|
68
|
-
this.#
|
|
69
|
-
this.#
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
98
|
+
const lifetime = this.#lifetime;
|
|
99
|
+
if (lifetime) this.#release(lifetime);
|
|
100
|
+
}
|
|
101
|
+
#release(lifetime, observer = lifetime.observer) {
|
|
102
|
+
if (this.#lifetime === lifetime) this.#lifetime = null;
|
|
103
|
+
lifetime.claims.attributes.clear();
|
|
104
|
+
lifetime.claims.children.clear();
|
|
105
|
+
observer?.disconnect();
|
|
106
|
+
}
|
|
107
|
+
#filter(records, claims) {
|
|
108
|
+
const authored = records.filter((record) => !this.#consume(record, claims));
|
|
109
|
+
claims.attributes.clear();
|
|
110
|
+
claims.children.clear();
|
|
76
111
|
return authored;
|
|
77
112
|
}
|
|
78
|
-
#consume(record) {
|
|
113
|
+
#consume(record, claims) {
|
|
79
114
|
if (record.type === "attributes") {
|
|
80
115
|
const target = record.target;
|
|
81
|
-
const pending2 =
|
|
116
|
+
const pending2 = claims.attributes.get(target)?.get(record.attributeName);
|
|
82
117
|
if (!pending2 || pending2.count === 0 || target.getAttribute(record.attributeName) !== pending2.value) {
|
|
83
118
|
return false;
|
|
84
119
|
}
|
|
85
120
|
pending2.count -= 1;
|
|
86
121
|
return true;
|
|
87
122
|
}
|
|
88
|
-
const pending =
|
|
123
|
+
const pending = claims.children.get(record.target);
|
|
89
124
|
if (!pending) return false;
|
|
90
125
|
const added = [...record.addedNodes];
|
|
91
126
|
const removed = [...record.removedNodes];
|
|
@@ -103,11 +138,16 @@ function ownerIndex(candidates, node) {
|
|
|
103
138
|
return candidates.findIndex((candidate) => candidate.contains(node));
|
|
104
139
|
}
|
|
105
140
|
|
|
141
|
+
var HTML_NAMESPACE = "http://www.w3.org/1999/xhtml";
|
|
106
142
|
function inheritsFieldsetDisabled(control) {
|
|
107
143
|
let fieldset = control.closest("fieldset[disabled]");
|
|
108
144
|
while (fieldset) {
|
|
109
|
-
|
|
110
|
-
|
|
145
|
+
if (fieldset.namespaceURI === HTML_NAMESPACE && fieldset.localName === "fieldset") {
|
|
146
|
+
const legend = Array.from(fieldset.children).find(
|
|
147
|
+
(child) => child.namespaceURI === HTML_NAMESPACE && child.localName === "legend"
|
|
148
|
+
);
|
|
149
|
+
if (!legend?.contains(control)) return true;
|
|
150
|
+
}
|
|
111
151
|
fieldset = fieldset.parentElement?.closest("fieldset[disabled]") ?? null;
|
|
112
152
|
}
|
|
113
153
|
return false;
|