stimeo-ui 0.15.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 +209 -0
  3. data/README.md +128 -1
  4. data/dist/cable/index.js +392 -417
  5. data/dist/controllers/accordion_controller.js +228 -28
  6. data/dist/controllers/alert_dialog_controller.js +862 -221
  7. data/dist/controllers/announcer_controller.js +135 -191
  8. data/dist/controllers/aspect_ratio_controller.js +0 -10
  9. data/dist/controllers/auto_submit_controller.js +295 -110
  10. data/dist/controllers/avatar_controller.js +172 -106
  11. data/dist/controllers/breadcrumb_controller.js +0 -129
  12. data/dist/controllers/bulk_select_controller.js +264 -53
  13. data/dist/controllers/calendar_controller.js +346 -180
  14. data/dist/controllers/carousel_controller.js +587 -300
  15. data/dist/controllers/character_counter_controller.js +271 -143
  16. data/dist/controllers/checkbox_controller.js +77 -75
  17. data/dist/controllers/clipboard_controller.js +187 -108
  18. data/dist/controllers/collapsible_controller.js +374 -108
  19. data/dist/controllers/color_picker_controller.js +183 -127
  20. data/dist/controllers/combobox_controller.js +426 -109
  21. data/dist/controllers/command_palette_controller.js +994 -350
  22. data/dist/controllers/conditional_fields_controller.js +212 -125
  23. data/dist/controllers/confirm_controller.js +939 -245
  24. data/dist/controllers/context_menu_controller.js +275 -127
  25. data/dist/controllers/count_up_controller.js +73 -21
  26. data/dist/controllers/countdown_controller.js +235 -97
  27. data/dist/controllers/currency_input_controller.js +241 -118
  28. data/dist/controllers/data_grid_controller.js +229 -135
  29. data/dist/controllers/date_range_picker_controller.js +359 -165
  30. data/dist/controllers/dialog_controller.js +887 -225
  31. data/dist/controllers/direct_upload_controller.js +80 -142
  32. data/dist/controllers/dirty_form_controller.js +26 -47
  33. data/dist/controllers/dismissible_controller.js +175 -20
  34. data/dist/controllers/drawer_controller.js +963 -336
  35. data/dist/controllers/dropdown_controller.js +342 -85
  36. data/dist/controllers/editable_controller.js +182 -58
  37. data/dist/controllers/empty_state_controller.js +67 -53
  38. data/dist/controllers/file_dropzone_controller.js +426 -229
  39. data/dist/controllers/filter_controller.js +78 -36
  40. data/dist/controllers/flash_controller.js +328 -211
  41. data/dist/controllers/focus_controller.js +654 -239
  42. data/dist/controllers/form_field_controller.js +153 -136
  43. data/dist/controllers/form_validation_controller.js +29 -96
  44. data/dist/controllers/frame_loading_controller.js +263 -198
  45. data/dist/controllers/highlight_controller.js +119 -70
  46. data/dist/controllers/hover_card_controller.js +335 -118
  47. data/dist/controllers/idle_controller.js +316 -65
  48. data/dist/controllers/input_mask_controller.js +116 -61
  49. data/dist/controllers/intersection_controller.js +147 -103
  50. data/dist/controllers/lazy_frame_controller.js +9 -56
  51. data/dist/controllers/listbox_controller.js +413 -153
  52. data/dist/controllers/local_time_controller.js +54 -64
  53. data/dist/controllers/masonry_controller.js +70 -95
  54. data/dist/controllers/menu_controller.js +254 -167
  55. data/dist/controllers/menubar_controller.js +206 -331
  56. data/dist/controllers/meter_controller.js +159 -71
  57. data/dist/controllers/multi_select_controller.js +797 -388
  58. data/dist/controllers/navigation_menu_controller.js +156 -231
  59. data/dist/controllers/nested_form_controller.js +373 -174
  60. data/dist/controllers/network_status_controller.js +241 -45
  61. data/dist/controllers/number_input_controller.js +387 -227
  62. data/dist/controllers/optimistic_controller.js +28 -75
  63. data/dist/controllers/otp_controller.js +344 -196
  64. data/dist/controllers/overflow_indicator_controller.js +167 -93
  65. data/dist/controllers/overflow_menu_controller.js +408 -277
  66. data/dist/controllers/pagination_controller.js +342 -120
  67. data/dist/controllers/password_reveal_controller.js +424 -99
  68. data/dist/controllers/password_strength_controller.js +99 -153
  69. data/dist/controllers/persist_controller.js +252 -96
  70. data/dist/controllers/pointer_drag_controller.js +263 -164
  71. data/dist/controllers/popover_controller.js +267 -94
  72. data/dist/controllers/portal_controller.js +209 -72
  73. data/dist/controllers/preview_guard_controller.js +243 -112
  74. data/dist/controllers/progress_controller.js +132 -59
  75. data/dist/controllers/radio_group_controller.js +138 -133
  76. data/dist/controllers/range_slider_controller.js +245 -112
  77. data/dist/controllers/rating_controller.js +429 -194
  78. data/dist/controllers/read_more_controller.js +185 -47
  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 +294 -118
  83. data/dist/controllers/roving_controller.js +39 -84
  84. data/dist/controllers/scroll_area_controller.js +428 -221
  85. data/dist/controllers/scroll_restore_controller.js +0 -53
  86. data/dist/controllers/scroll_visibility_controller.js +395 -146
  87. data/dist/controllers/scrollspy_controller.js +181 -236
  88. data/dist/controllers/separator_controller.js +288 -132
  89. data/dist/controllers/sidebar_controller.js +1071 -375
  90. data/dist/controllers/skeleton_controller.js +248 -92
  91. data/dist/controllers/slider_controller.js +211 -96
  92. data/dist/controllers/smart_sticky_header_controller.js +163 -54
  93. data/dist/controllers/sortable_controller.js +13 -110
  94. data/dist/controllers/spinner_controller.js +277 -161
  95. data/dist/controllers/step_indicator_controller.js +107 -53
  96. data/dist/controllers/stepper_controller.js +171 -48
  97. data/dist/controllers/stick_to_bottom_controller.js +310 -116
  98. data/dist/controllers/sticky_observer_controller.js +214 -49
  99. data/dist/controllers/submit_once_controller.js +294 -192
  100. data/dist/controllers/switch_controller.js +107 -43
  101. data/dist/controllers/tabs_controller.js +50 -25
  102. data/dist/controllers/tags_input_controller.js +290 -149
  103. data/dist/controllers/textarea_autosize_controller.js +71 -58
  104. data/dist/controllers/theme_controller.js +148 -80
  105. data/dist/controllers/time_picker_controller.js +162 -81
  106. data/dist/controllers/toast_controller.js +365 -193
  107. data/dist/controllers/toggle_group_controller.js +194 -99
  108. data/dist/controllers/toolbar_controller.js +92 -90
  109. data/dist/controllers/tooltip_controller.js +185 -125
  110. data/dist/controllers/transition_controller.js +123 -115
  111. data/dist/controllers/tree_view_controller.js +248 -290
  112. data/dist/index.js +8649 -8572
  113. data/dist/positioning/index.js +148 -45
  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