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.
Files changed (115) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +31 -0
  3. data/README.md +8 -1
  4. data/dist/cable/index.js +363 -436
  5. data/dist/controllers/accordion_controller.js +166 -55
  6. data/dist/controllers/alert_dialog_controller.js +862 -221
  7. data/dist/controllers/announcer_controller.js +135 -198
  8. data/dist/controllers/aspect_ratio_controller.js +0 -10
  9. data/dist/controllers/auto_submit_controller.js +271 -127
  10. data/dist/controllers/avatar_controller.js +171 -105
  11. data/dist/controllers/breadcrumb_controller.js +0 -130
  12. data/dist/controllers/bulk_select_controller.js +262 -52
  13. data/dist/controllers/calendar_controller.js +175 -209
  14. data/dist/controllers/carousel_controller.js +461 -399
  15. data/dist/controllers/character_counter_controller.js +246 -156
  16. data/dist/controllers/checkbox_controller.js +32 -74
  17. data/dist/controllers/clipboard_controller.js +168 -147
  18. data/dist/controllers/collapsible_controller.js +301 -120
  19. data/dist/controllers/color_picker_controller.js +149 -139
  20. data/dist/controllers/combobox_controller.js +360 -133
  21. data/dist/controllers/command_palette_controller.js +970 -358
  22. data/dist/controllers/conditional_fields_controller.js +166 -124
  23. data/dist/controllers/confirm_controller.js +939 -248
  24. data/dist/controllers/context_menu_controller.js +256 -128
  25. data/dist/controllers/count_up_controller.js +73 -21
  26. data/dist/controllers/countdown_controller.js +183 -148
  27. data/dist/controllers/currency_input_controller.js +134 -158
  28. data/dist/controllers/data_grid_controller.js +114 -186
  29. data/dist/controllers/date_range_picker_controller.js +288 -206
  30. data/dist/controllers/dialog_controller.js +858 -223
  31. data/dist/controllers/direct_upload_controller.js +73 -153
  32. data/dist/controllers/dirty_form_controller.js +14 -48
  33. data/dist/controllers/dismissible_controller.js +175 -21
  34. data/dist/controllers/drawer_controller.js +933 -341
  35. data/dist/controllers/dropdown_controller.js +312 -82
  36. data/dist/controllers/editable_controller.js +158 -68
  37. data/dist/controllers/empty_state_controller.js +67 -53
  38. data/dist/controllers/file_dropzone_controller.js +311 -207
  39. data/dist/controllers/filter_controller.js +67 -39
  40. data/dist/controllers/flash_controller.js +172 -314
  41. data/dist/controllers/focus_controller.js +654 -240
  42. data/dist/controllers/form_field_controller.js +147 -132
  43. data/dist/controllers/form_validation_controller.js +13 -86
  44. data/dist/controllers/frame_loading_controller.js +264 -213
  45. data/dist/controllers/highlight_controller.js +107 -75
  46. data/dist/controllers/hover_card_controller.js +309 -118
  47. data/dist/controllers/idle_controller.js +267 -101
  48. data/dist/controllers/input_mask_controller.js +71 -72
  49. data/dist/controllers/intersection_controller.js +147 -106
  50. data/dist/controllers/lazy_frame_controller.js +9 -65
  51. data/dist/controllers/listbox_controller.js +306 -204
  52. data/dist/controllers/local_time_controller.js +54 -64
  53. data/dist/controllers/masonry_controller.js +70 -93
  54. data/dist/controllers/menu_controller.js +214 -156
  55. data/dist/controllers/menubar_controller.js +170 -329
  56. data/dist/controllers/meter_controller.js +151 -67
  57. data/dist/controllers/multi_select_controller.js +593 -358
  58. data/dist/controllers/navigation_menu_controller.js +124 -232
  59. data/dist/controllers/nested_form_controller.js +352 -182
  60. data/dist/controllers/network_status_controller.js +242 -54
  61. data/dist/controllers/number_input_controller.js +320 -263
  62. data/dist/controllers/optimistic_controller.js +16 -76
  63. data/dist/controllers/otp_controller.js +198 -193
  64. data/dist/controllers/overflow_indicator_controller.js +116 -113
  65. data/dist/controllers/overflow_menu_controller.js +343 -283
  66. data/dist/controllers/pagination_controller.js +295 -119
  67. data/dist/controllers/password_reveal_controller.js +389 -121
  68. data/dist/controllers/password_strength_controller.js +99 -153
  69. data/dist/controllers/persist_controller.js +237 -103
  70. data/dist/controllers/pointer_drag_controller.js +185 -165
  71. data/dist/controllers/popover_controller.js +236 -97
  72. data/dist/controllers/portal_controller.js +209 -76
  73. data/dist/controllers/preview_guard_controller.js +232 -116
  74. data/dist/controllers/progress_controller.js +125 -56
  75. data/dist/controllers/radio_group_controller.js +117 -137
  76. data/dist/controllers/range_slider_controller.js +192 -105
  77. data/dist/controllers/rating_controller.js +418 -207
  78. data/dist/controllers/read_more_controller.js +134 -63
  79. data/dist/controllers/reading_progress_controller.js +147 -135
  80. data/dist/controllers/relative_time_controller.js +145 -110
  81. data/dist/controllers/{reset_before_cache_controller.js → reset_on_restore_controller.js} +97 -38
  82. data/dist/controllers/resizable_controller.js +255 -139
  83. data/dist/controllers/roving_controller.js +39 -84
  84. data/dist/controllers/scroll_area_controller.js +428 -225
  85. data/dist/controllers/scroll_restore_controller.js +0 -53
  86. data/dist/controllers/scroll_visibility_controller.js +395 -145
  87. data/dist/controllers/scrollspy_controller.js +181 -242
  88. data/dist/controllers/separator_controller.js +267 -140
  89. data/dist/controllers/sidebar_controller.js +1023 -386
  90. data/dist/controllers/skeleton_controller.js +248 -97
  91. data/dist/controllers/slider_controller.js +159 -79
  92. data/dist/controllers/smart_sticky_header_controller.js +162 -63
  93. data/dist/controllers/sortable_controller.js +0 -112
  94. data/dist/controllers/spinner_controller.js +277 -169
  95. data/dist/controllers/step_indicator_controller.js +99 -46
  96. data/dist/controllers/stepper_controller.js +114 -73
  97. data/dist/controllers/stick_to_bottom_controller.js +262 -138
  98. data/dist/controllers/sticky_observer_controller.js +214 -49
  99. data/dist/controllers/submit_once_controller.js +294 -205
  100. data/dist/controllers/switch_controller.js +33 -60
  101. data/dist/controllers/tabs_controller.js +35 -29
  102. data/dist/controllers/tags_input_controller.js +136 -145
  103. data/dist/controllers/textarea_autosize_controller.js +71 -58
  104. data/dist/controllers/theme_controller.js +130 -112
  105. data/dist/controllers/time_picker_controller.js +146 -80
  106. data/dist/controllers/toast_controller.js +186 -297
  107. data/dist/controllers/toggle_group_controller.js +95 -136
  108. data/dist/controllers/toolbar_controller.js +68 -98
  109. data/dist/controllers/tooltip_controller.js +158 -124
  110. data/dist/controllers/transition_controller.js +123 -119
  111. data/dist/controllers/tree_view_controller.js +150 -345
  112. data/dist/index.js +6370 -9346
  113. data/dist/positioning/index.js +148 -47
  114. data/lib/stimeo/ui/version.rb +1 -1
  115. metadata +3 -3
@@ -1,15 +1,7 @@
1
1
  import { Controller } from '@hotwired/stimulus';
2
2
 
3
- // src/controllers/scroll_restore_controller.ts
4
-
5
- // src/utils/frame_coalescer.ts
6
3
  var FrameCoalescer = class {
7
4
  #frame = null;
8
- /**
9
- * Runs `run` on the next frame, unless a frame is already pending — the first
10
- * request of a burst wins and the rest are dropped. The pending frame is
11
- * released before `run`, so `run` may request the next one.
12
- */
13
5
  schedule(run) {
14
6
  if (this.#frame !== null) return;
15
7
  this.#frame = requestAnimationFrame(() => {
@@ -17,14 +9,6 @@ var FrameCoalescer = class {
17
9
  run();
18
10
  });
19
11
  }
20
- /**
21
- * Drops the pending frame, and reaches the platform only when there is one.
22
- *
23
- * There is no handle value that stands for "nothing pending":
24
- * `cancelAnimationFrame` takes an `unsigned long`, so a negative placeholder
25
- * arrives as a large positive number that the same allocator can hand out, and
26
- * an idle cancel would then drop a frame belonging to someone else.
27
- */
28
12
  cancel() {
29
13
  if (this.#frame === null) return;
30
14
  cancelAnimationFrame(this.#frame);
@@ -32,7 +16,6 @@ var FrameCoalescer = class {
32
16
  }
33
17
  };
34
18
 
35
- // src/controllers/scroll_restore_controller.ts
36
19
  function parseStored(raw) {
37
20
  if (raw === null) return null;
38
21
  try {
@@ -49,32 +32,15 @@ var ScrollRestoreController = class extends Controller {
49
32
  key: { type: String, default: "" },
50
33
  axis: { type: String, default: "vertical" }
51
34
  };
52
- /** Coalesces scroll bursts into one save per frame. */
53
35
  #frames = new FrameCoalescer();
54
- /** Resolved storage key; empty disables persistence (no key and no id). */
55
36
  #storageKey = "";
56
- /** Last offset captured while the element was live; persisted as-is on teardown. */
57
37
  #lastTop = 0;
58
38
  #lastLeft = 0;
59
- /**
60
- * The offsets this controller's own restore produced, awaiting the `scroll`
61
- * the engine fires for them. A restore the layout cannot reach yet lands short,
62
- * so treating that echo as the reader's position would cut the saved offset
63
- * down to whatever the unfinished layout allowed.
64
- */
65
39
  #echoTop = null;
66
40
  #echoLeft = null;
67
- /** Offsets stored for an axis that is not tracked, carried through saves. */
68
41
  #carried = {};
69
- /**
70
- * Whether each axis holds an offset worth saving — one this namespace restored
71
- * or the reader moved. A save writes only the axes that are marked, so an
72
- * offset taken under a different key or axis is never re-published as if the
73
- * reader had left it there.
74
- */
75
42
  #capturedTop = false;
76
43
  #capturedLeft = false;
77
- /** Whether the controller is connected; Value callbacks outside that window do not resync. */
78
44
  #connected = false;
79
45
  #onScroll = () => {
80
46
  this.#capture();
@@ -92,15 +58,12 @@ var ScrollRestoreController = class extends Controller {
92
58
  this.#frames.cancel();
93
59
  this.#persist();
94
60
  }
95
- /** Re-derives the namespace when application code or a Turbo morph moves `key`. */
96
61
  keyValueChanged() {
97
62
  this.#resync();
98
63
  }
99
- /** Re-derives the tracked axes when application code or a Turbo morph moves `axis`. */
100
64
  axisValueChanged() {
101
65
  this.#resync();
102
66
  }
103
- /** Rebuilds the persistence state around the Values as they now read. */
104
67
  #resync() {
105
68
  if (!this.#connected) return;
106
69
  this.#frames.cancel();
@@ -112,15 +75,6 @@ var ScrollRestoreController = class extends Controller {
112
75
  this.#capturedLeft = false;
113
76
  if (this.#storageKey) this.#restore();
114
77
  }
115
- /**
116
- * Records the live scroll offset for the configured axis.
117
- *
118
- * An axis holds its echo until that axis actually moves. A scroll event names
119
- * no axis, so consuming both on the first one to arrive would leave the other
120
- * unguarded: on `both`, moving one axis would take the clamped reading of the
121
- * untouched axis as the reader's own position and save it, cutting the stored
122
- * offset down to whatever the layout could reach at restore time.
123
- */
124
78
  #capture() {
125
79
  if (this.#tracksVertical) {
126
80
  const top = this.element.scrollTop;
@@ -139,10 +93,6 @@ var ScrollRestoreController = class extends Controller {
139
93
  }
140
94
  }
141
95
  }
142
- /**
143
- * Writes the marked axes, carrying through any offset held for an untracked one.
144
- * Without a key, or with neither axis marked, it writes nothing.
145
- */
146
96
  #persist() {
147
97
  if (!this.#storageKey || !(this.#capturedTop || this.#capturedLeft)) return;
148
98
  const data = { ...this.#carried };
@@ -153,7 +103,6 @@ var ScrollRestoreController = class extends Controller {
153
103
  } catch {
154
104
  }
155
105
  }
156
- /** Applies the persisted scroll offset, if any, without moving focus. */
157
106
  #restore() {
158
107
  let raw;
159
108
  try {
@@ -196,7 +145,6 @@ var ScrollRestoreController = class extends Controller {
196
145
  if (this.element.scrollTop !== beforeTop) this.#echoTop = this.element.scrollTop;
197
146
  if (this.element.scrollLeft !== beforeLeft) this.#echoLeft = this.element.scrollLeft;
198
147
  }
199
- /** The `sessionStorage` key: explicit `key`, else the element `id`, else none. */
200
148
  #resolveKey() {
201
149
  const base = this.keyValue || this.element.id;
202
150
  return base ? `stimeo--scroll-restore:${base}` : "";
@@ -210,5 +158,4 @@ var ScrollRestoreController = class extends Controller {
210
158
  };
211
159
 
212
160
  export { ScrollRestoreController };
213
- //# sourceMappingURL=scroll_restore_controller.js.map
214
161
  //# sourceMappingURL=scroll_restore_controller.js.map