stimeo-ui 0.16.0 → 0.17.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 +31 -0
- data/README.md +8 -1
- data/dist/cable/index.js +363 -436
- data/dist/controllers/accordion_controller.js +166 -55
- data/dist/controllers/alert_dialog_controller.js +862 -221
- data/dist/controllers/announcer_controller.js +135 -198
- data/dist/controllers/aspect_ratio_controller.js +0 -10
- data/dist/controllers/auto_submit_controller.js +271 -127
- data/dist/controllers/avatar_controller.js +171 -105
- data/dist/controllers/breadcrumb_controller.js +0 -130
- data/dist/controllers/bulk_select_controller.js +262 -52
- data/dist/controllers/calendar_controller.js +175 -209
- data/dist/controllers/carousel_controller.js +461 -399
- data/dist/controllers/character_counter_controller.js +246 -156
- data/dist/controllers/checkbox_controller.js +32 -74
- data/dist/controllers/clipboard_controller.js +168 -147
- data/dist/controllers/collapsible_controller.js +301 -120
- data/dist/controllers/color_picker_controller.js +149 -139
- data/dist/controllers/combobox_controller.js +360 -133
- data/dist/controllers/command_palette_controller.js +970 -358
- data/dist/controllers/conditional_fields_controller.js +166 -124
- data/dist/controllers/confirm_controller.js +939 -248
- data/dist/controllers/context_menu_controller.js +256 -128
- data/dist/controllers/count_up_controller.js +73 -21
- data/dist/controllers/countdown_controller.js +183 -148
- data/dist/controllers/currency_input_controller.js +134 -158
- data/dist/controllers/data_grid_controller.js +114 -186
- data/dist/controllers/date_range_picker_controller.js +288 -206
- data/dist/controllers/dialog_controller.js +858 -223
- data/dist/controllers/direct_upload_controller.js +73 -153
- data/dist/controllers/dirty_form_controller.js +14 -48
- data/dist/controllers/dismissible_controller.js +175 -21
- data/dist/controllers/drawer_controller.js +933 -341
- data/dist/controllers/dropdown_controller.js +312 -82
- data/dist/controllers/editable_controller.js +158 -68
- data/dist/controllers/empty_state_controller.js +67 -53
- data/dist/controllers/file_dropzone_controller.js +311 -207
- data/dist/controllers/filter_controller.js +67 -39
- data/dist/controllers/flash_controller.js +172 -314
- data/dist/controllers/focus_controller.js +654 -240
- data/dist/controllers/form_field_controller.js +147 -132
- data/dist/controllers/form_validation_controller.js +13 -86
- data/dist/controllers/frame_loading_controller.js +264 -213
- data/dist/controllers/highlight_controller.js +107 -75
- data/dist/controllers/hover_card_controller.js +309 -118
- data/dist/controllers/idle_controller.js +267 -101
- data/dist/controllers/input_mask_controller.js +71 -72
- data/dist/controllers/intersection_controller.js +147 -106
- data/dist/controllers/lazy_frame_controller.js +9 -65
- data/dist/controllers/listbox_controller.js +306 -204
- data/dist/controllers/local_time_controller.js +54 -64
- data/dist/controllers/masonry_controller.js +70 -93
- data/dist/controllers/menu_controller.js +214 -156
- data/dist/controllers/menubar_controller.js +170 -329
- data/dist/controllers/meter_controller.js +151 -67
- data/dist/controllers/multi_select_controller.js +593 -358
- data/dist/controllers/navigation_menu_controller.js +124 -232
- data/dist/controllers/nested_form_controller.js +352 -182
- data/dist/controllers/network_status_controller.js +242 -54
- data/dist/controllers/number_input_controller.js +320 -263
- data/dist/controllers/optimistic_controller.js +16 -76
- data/dist/controllers/otp_controller.js +198 -193
- data/dist/controllers/overflow_indicator_controller.js +116 -113
- data/dist/controllers/overflow_menu_controller.js +343 -283
- data/dist/controllers/pagination_controller.js +295 -119
- data/dist/controllers/password_reveal_controller.js +389 -121
- data/dist/controllers/password_strength_controller.js +99 -153
- data/dist/controllers/persist_controller.js +237 -103
- data/dist/controllers/pointer_drag_controller.js +185 -165
- data/dist/controllers/popover_controller.js +236 -97
- data/dist/controllers/portal_controller.js +209 -76
- data/dist/controllers/preview_guard_controller.js +232 -116
- data/dist/controllers/progress_controller.js +125 -56
- data/dist/controllers/radio_group_controller.js +117 -137
- data/dist/controllers/range_slider_controller.js +192 -105
- data/dist/controllers/rating_controller.js +418 -207
- data/dist/controllers/read_more_controller.js +134 -63
- data/dist/controllers/reading_progress_controller.js +147 -135
- data/dist/controllers/relative_time_controller.js +145 -110
- data/dist/controllers/{reset_before_cache_controller.js → reset_on_restore_controller.js} +97 -38
- data/dist/controllers/resizable_controller.js +255 -139
- data/dist/controllers/roving_controller.js +39 -84
- data/dist/controllers/scroll_area_controller.js +428 -225
- data/dist/controllers/scroll_restore_controller.js +0 -53
- data/dist/controllers/scroll_visibility_controller.js +395 -145
- data/dist/controllers/scrollspy_controller.js +181 -242
- data/dist/controllers/separator_controller.js +267 -140
- data/dist/controllers/sidebar_controller.js +1023 -386
- data/dist/controllers/skeleton_controller.js +248 -97
- data/dist/controllers/slider_controller.js +159 -79
- data/dist/controllers/smart_sticky_header_controller.js +162 -63
- data/dist/controllers/sortable_controller.js +0 -112
- data/dist/controllers/spinner_controller.js +277 -169
- data/dist/controllers/step_indicator_controller.js +99 -46
- data/dist/controllers/stepper_controller.js +114 -73
- data/dist/controllers/stick_to_bottom_controller.js +262 -138
- data/dist/controllers/sticky_observer_controller.js +214 -49
- data/dist/controllers/submit_once_controller.js +294 -205
- data/dist/controllers/switch_controller.js +33 -60
- data/dist/controllers/tabs_controller.js +35 -29
- data/dist/controllers/tags_input_controller.js +136 -145
- data/dist/controllers/textarea_autosize_controller.js +71 -58
- data/dist/controllers/theme_controller.js +130 -112
- data/dist/controllers/time_picker_controller.js +146 -80
- data/dist/controllers/toast_controller.js +186 -297
- data/dist/controllers/toggle_group_controller.js +95 -136
- data/dist/controllers/toolbar_controller.js +68 -98
- data/dist/controllers/tooltip_controller.js +158 -124
- data/dist/controllers/transition_controller.js +123 -119
- data/dist/controllers/tree_view_controller.js +150 -345
- data/dist/index.js +6370 -9346
- data/dist/positioning/index.js +148 -47
- data/lib/stimeo/ui/version.rb +1 -1
- metadata +3 -3
|
@@ -1,8 +1,5 @@
|
|
|
1
1
|
import { Controller } from '@hotwired/stimulus';
|
|
2
2
|
|
|
3
|
-
// src/controllers/lazy_frame_controller.ts
|
|
4
|
-
|
|
5
|
-
// src/utils/declared_value.ts
|
|
6
3
|
function parseDeclared(raw, parse, fallback) {
|
|
7
4
|
try {
|
|
8
5
|
return parse(raw);
|
|
@@ -11,7 +8,6 @@ function parseDeclared(raw, parse, fallback) {
|
|
|
11
8
|
}
|
|
12
9
|
}
|
|
13
10
|
|
|
14
|
-
// src/utils/intersection_watcher.ts
|
|
15
11
|
function queryRoot(selector) {
|
|
16
12
|
if (!selector) return null;
|
|
17
13
|
return parseDeclared(selector, (raw) => document.querySelector(raw), null);
|
|
@@ -24,30 +20,12 @@ var IntersectionWatcher = class {
|
|
|
24
20
|
constructor(onEntries) {
|
|
25
21
|
this.#onEntries = onEntries;
|
|
26
22
|
}
|
|
27
|
-
/** Whether an observer is live (started, `IntersectionObserver` supported). */
|
|
28
23
|
get active() {
|
|
29
24
|
return this.#active;
|
|
30
25
|
}
|
|
31
|
-
/** Whether the live observer discarded configured options after construction failed. */
|
|
32
26
|
get usingPlatformDefaults() {
|
|
33
27
|
return this.#usingPlatformDefaults;
|
|
34
28
|
}
|
|
35
|
-
/**
|
|
36
|
-
* (Re)creates the observer and observes `targets`. Returns `false` — leaving
|
|
37
|
-
* the watcher inert — without `IntersectionObserver` support (very old
|
|
38
|
-
* browsers; the caller's no-JS fallback stays in charge) or with no targets.
|
|
39
|
-
* If initial construction with the configured options fails, the watcher
|
|
40
|
-
* warns and retries once with the same root and platform defaults. A
|
|
41
|
-
* `rootSelector` that does not parse resolves to the viewport (see
|
|
42
|
-
* {@link IntersectionWatchOptions.rootSelector}), so a typo never fails the
|
|
43
|
-
* call.
|
|
44
|
-
*
|
|
45
|
-
* @throws The fallback constructor error if both construction attempts fail,
|
|
46
|
-
* or whatever the platform throws from `observe()`. The exception is passed
|
|
47
|
-
* through unchanged, but the watcher rolls back first: every target observed
|
|
48
|
-
* so far is released and `active` stays `false`, so a caller that retries
|
|
49
|
-
* starts from a clean slate.
|
|
50
|
-
*/
|
|
51
29
|
start(targets, options = {}) {
|
|
52
30
|
this.stop();
|
|
53
31
|
if (typeof IntersectionObserver === "undefined") return false;
|
|
@@ -85,14 +63,6 @@ var IntersectionWatcher = class {
|
|
|
85
63
|
throw error;
|
|
86
64
|
}
|
|
87
65
|
}
|
|
88
|
-
/**
|
|
89
|
-
* Re-delivers `target`'s CURRENT intersection state: `IntersectionObserver`
|
|
90
|
-
* only reports *changes*, but `observe()` always reports the present state,
|
|
91
|
-
* so unobserve→observe turns "still intersecting" into a fresh callback.
|
|
92
|
-
*
|
|
93
|
-
* @throws Whatever `unobserve()`/`observe()` throws. The watcher is stopped
|
|
94
|
-
* first, so it never stays live with a half-rearmed target.
|
|
95
|
-
*/
|
|
96
66
|
rearm(target) {
|
|
97
67
|
if (!this.#observer) return;
|
|
98
68
|
try {
|
|
@@ -103,7 +73,6 @@ var IntersectionWatcher = class {
|
|
|
103
73
|
throw error;
|
|
104
74
|
}
|
|
105
75
|
}
|
|
106
|
-
/** Severs the observer; late queued callbacks become no-ops via the guard. */
|
|
107
76
|
stop() {
|
|
108
77
|
this.#active = false;
|
|
109
78
|
this.#observer?.disconnect();
|
|
@@ -112,7 +81,6 @@ var IntersectionWatcher = class {
|
|
|
112
81
|
}
|
|
113
82
|
};
|
|
114
83
|
|
|
115
|
-
// src/controllers/lazy_frame_controller.ts
|
|
116
84
|
var LazyFrameController = class extends Controller {
|
|
117
85
|
static values = {
|
|
118
86
|
url: { type: String, default: "" },
|
|
@@ -120,38 +88,28 @@ var LazyFrameController = class extends Controller {
|
|
|
120
88
|
once: { type: Boolean, default: true }
|
|
121
89
|
};
|
|
122
90
|
static events = ["load"];
|
|
123
|
-
/** Shared IO plumbing (support guard, active guard, teardown). */
|
|
124
91
|
#watcher = new IntersectionWatcher((entries) => this.#onIntersect(entries));
|
|
125
92
|
#connected = false;
|
|
126
93
|
#loaded = false;
|
|
127
|
-
/**
|
|
128
|
-
* Whether the observer last saw the frame inside the observed area — `null`
|
|
129
|
-
* until it has reported. A re-entry needs a frame that was seen inside and
|
|
130
|
-
* then left, so an unknown position is never a departure.
|
|
131
|
-
*/
|
|
132
94
|
#inside = null;
|
|
133
|
-
/**
|
|
134
|
-
* Focus reaching the frame starts the FIRST load before it intersects (keyboard / AT).
|
|
135
|
-
* `#load` releases this listener, so focus never reaches an already-loaded frame.
|
|
136
|
-
*/
|
|
137
95
|
#onFocus = () => this.#load();
|
|
138
|
-
/**
|
|
139
|
-
* Follows the held URL at runtime: one that arrives arms the frame, one that is
|
|
140
|
-
* taken away disarms it, so an empty `url` holds no triggers either way.
|
|
141
|
-
*
|
|
142
|
-
* Stimulus runs value callbacks before `connect()`, so the connected guard keeps
|
|
143
|
-
* arming in one place. A frame that already loaded keeps its held URL for the next
|
|
144
|
-
* re-entry instead of fetching on the spot.
|
|
145
|
-
*/
|
|
146
96
|
urlValueChanged() {
|
|
147
97
|
if (!this.#connected || this.#loaded) return;
|
|
148
98
|
if (this.urlValue) this.#arm();
|
|
149
99
|
else this.#stopObserving();
|
|
150
100
|
}
|
|
151
|
-
/** Rebuilds the observer when the early-load margin changes at runtime. */
|
|
152
101
|
rootMarginValueChanged() {
|
|
153
102
|
if (this.#connected && this.#watcher.active) this.#observe();
|
|
154
103
|
}
|
|
104
|
+
onceValueChanged() {
|
|
105
|
+
if (!this.#connected || !this.#loaded) return;
|
|
106
|
+
if (this.onceValue) {
|
|
107
|
+
this.#watcher.stop();
|
|
108
|
+
} else if (!this.#watcher.active) {
|
|
109
|
+
this.#inside = null;
|
|
110
|
+
this.#arm();
|
|
111
|
+
}
|
|
112
|
+
}
|
|
155
113
|
connect() {
|
|
156
114
|
this.#loaded = this.element.hasAttribute("data-lazy-loaded");
|
|
157
115
|
this.#inside = null;
|
|
@@ -163,7 +121,6 @@ var LazyFrameController = class extends Controller {
|
|
|
163
121
|
this.#connected = false;
|
|
164
122
|
this.#stopObserving();
|
|
165
123
|
}
|
|
166
|
-
/** Attaches the triggers that still have a job to do. */
|
|
167
124
|
#arm() {
|
|
168
125
|
if (!this.urlValue) return;
|
|
169
126
|
if (!this.#loaded) this.element.addEventListener("focusin", this.#onFocus);
|
|
@@ -183,7 +140,6 @@ var LazyFrameController = class extends Controller {
|
|
|
183
140
|
}
|
|
184
141
|
}
|
|
185
142
|
}
|
|
186
|
-
/** Applies an intersecting entry: the first one loads, a return re-fetches. */
|
|
187
143
|
#enter(returning) {
|
|
188
144
|
if (!this.#loaded) {
|
|
189
145
|
this.#load();
|
|
@@ -192,12 +148,6 @@ var LazyFrameController = class extends Controller {
|
|
|
192
148
|
if (this.onceValue || !returning) return;
|
|
193
149
|
this.#reload();
|
|
194
150
|
}
|
|
195
|
-
/**
|
|
196
|
-
* Starts the load by writing the held URL to `src`.
|
|
197
|
-
*
|
|
198
|
-
* @stimeoRuntimeOnly `url` is the address this one load fetches and `once` decides whether it
|
|
199
|
-
* stops the watcher.
|
|
200
|
-
*/
|
|
201
151
|
#load() {
|
|
202
152
|
if (!this.urlValue) return;
|
|
203
153
|
this.#loaded = true;
|
|
@@ -207,11 +157,6 @@ var LazyFrameController = class extends Controller {
|
|
|
207
157
|
this.element.removeEventListener("focusin", this.#onFocus);
|
|
208
158
|
if (this.onceValue) this.#watcher.stop();
|
|
209
159
|
}
|
|
210
|
-
/**
|
|
211
|
-
* Re-entry while `once` is off: fetch the held URL again.
|
|
212
|
-
*
|
|
213
|
-
* @stimeoRuntimeOnly `url` is the address this one re-entry reloads.
|
|
214
|
-
*/
|
|
215
160
|
#reload() {
|
|
216
161
|
const src = this.element.getAttribute("src");
|
|
217
162
|
if (this.urlValue && this.urlValue !== src) {
|
|
@@ -231,5 +176,4 @@ var LazyFrameController = class extends Controller {
|
|
|
231
176
|
};
|
|
232
177
|
|
|
233
178
|
export { LazyFrameController };
|
|
234
|
-
//# sourceMappingURL=lazy_frame_controller.js.map
|
|
235
179
|
//# sourceMappingURL=lazy_frame_controller.js.map
|