rails-active-ui 0.1.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 (167) hide show
  1. checksums.yaml +7 -0
  2. data/Rakefile +6 -0
  3. data/app/assets/stylesheets.css +73555 -0
  4. data/app/components/accordion_component.rb +34 -0
  5. data/app/components/ad_component.rb +28 -0
  6. data/app/components/api_component.rb +24 -0
  7. data/app/components/breadcrumb_component.rb +26 -0
  8. data/app/components/button_component.rb +49 -0
  9. data/app/components/calendar_component.rb +34 -0
  10. data/app/components/card_component.rb +56 -0
  11. data/app/components/checkbox_component.rb +41 -0
  12. data/app/components/column_component.rb +62 -0
  13. data/app/components/comment_component.rb +45 -0
  14. data/app/components/concerns/alignable.rb +21 -0
  15. data/app/components/concerns/attachable.rb +16 -0
  16. data/app/components/concerns/orientable.rb +21 -0
  17. data/app/components/concerns/positionable.rb +21 -0
  18. data/app/components/concerns/sizeable.rb +18 -0
  19. data/app/components/container_component.rb +23 -0
  20. data/app/components/dimmer_component.rb +30 -0
  21. data/app/components/divider_component.rb +30 -0
  22. data/app/components/dropdown_component.rb +63 -0
  23. data/app/components/embed_component.rb +32 -0
  24. data/app/components/emoji_component.rb +15 -0
  25. data/app/components/feed_component.rb +22 -0
  26. data/app/components/flag_component.rb +15 -0
  27. data/app/components/flyout_component.rb +41 -0
  28. data/app/components/form_component.rb +39 -0
  29. data/app/components/grid_component.rb +85 -0
  30. data/app/components/h_stack_component.rb +67 -0
  31. data/app/components/header_component.rb +60 -0
  32. data/app/components/icon_component.rb +41 -0
  33. data/app/components/image_component.rb +46 -0
  34. data/app/components/input_component.rb +52 -0
  35. data/app/components/item_component.rb +39 -0
  36. data/app/components/item_group_component.rb +30 -0
  37. data/app/components/label_component.rb +49 -0
  38. data/app/components/link_component.rb +23 -0
  39. data/app/components/list_component.rb +39 -0
  40. data/app/components/loader_component.rb +33 -0
  41. data/app/components/menu_component.rb +64 -0
  42. data/app/components/menu_item_component.rb +52 -0
  43. data/app/components/message_component.rb +54 -0
  44. data/app/components/modal_component.rb +50 -0
  45. data/app/components/nag_component.rb +25 -0
  46. data/app/components/overlay_component.rb +16 -0
  47. data/app/components/placeholder_component.rb +39 -0
  48. data/app/components/popup_component.rb +31 -0
  49. data/app/components/progress_component.rb +48 -0
  50. data/app/components/pusher_component.rb +18 -0
  51. data/app/components/rail_component.rb +31 -0
  52. data/app/components/rating_component.rb +41 -0
  53. data/app/components/reset_component.rb +12 -0
  54. data/app/components/reveal_component.rb +39 -0
  55. data/app/components/row_component.rb +39 -0
  56. data/app/components/search_component.rb +44 -0
  57. data/app/components/segment_component.rb +57 -0
  58. data/app/components/segment_group_component.rb +36 -0
  59. data/app/components/shape_component.rb +25 -0
  60. data/app/components/sidebar_component.rb +33 -0
  61. data/app/components/site_component.rb +12 -0
  62. data/app/components/slider_component.rb +46 -0
  63. data/app/components/state_component.rb +25 -0
  64. data/app/components/statistic_component.rb +43 -0
  65. data/app/components/step_component.rb +56 -0
  66. data/app/components/step_group_component.rb +38 -0
  67. data/app/components/sticky_component.rb +22 -0
  68. data/app/components/sub_header_component.rb +15 -0
  69. data/app/components/sub_menu_component.rb +24 -0
  70. data/app/components/tab_component.rb +24 -0
  71. data/app/components/table_cell_component.rb +60 -0
  72. data/app/components/table_component.rb +160 -0
  73. data/app/components/table_row_component.rb +43 -0
  74. data/app/components/text_component.rb +73 -0
  75. data/app/components/toast_component.rb +36 -0
  76. data/app/components/transition_component.rb +32 -0
  77. data/app/components/v_stack_component.rb +31 -0
  78. data/app/components/visibility_component.rb +22 -0
  79. data/app/helpers/component_helper.rb +109 -0
  80. data/app/helpers/fui_helper.rb +53 -0
  81. data/app/javascript/accordion.js +547 -0
  82. data/app/javascript/accordion.min.js +11 -0
  83. data/app/javascript/api.js +1112 -0
  84. data/app/javascript/api.min.js +11 -0
  85. data/app/javascript/calendar.js +1960 -0
  86. data/app/javascript/calendar.min.js +11 -0
  87. data/app/javascript/checkbox.js +819 -0
  88. data/app/javascript/checkbox.min.js +11 -0
  89. data/app/javascript/dimmer.js +686 -0
  90. data/app/javascript/dimmer.min.js +11 -0
  91. data/app/javascript/dropdown.js +4019 -0
  92. data/app/javascript/dropdown.min.js +11 -0
  93. data/app/javascript/embed.js +646 -0
  94. data/app/javascript/embed.min.js +11 -0
  95. data/app/javascript/flyout.js +1405 -0
  96. data/app/javascript/flyout.min.js +11 -0
  97. data/app/javascript/form.js +2070 -0
  98. data/app/javascript/form.min.js +11 -0
  99. data/app/javascript/jquery.js +10716 -0
  100. data/app/javascript/jquery.min.js +2 -0
  101. data/app/javascript/modal.js +1507 -0
  102. data/app/javascript/modal.min.js +11 -0
  103. data/app/javascript/nag.js +522 -0
  104. data/app/javascript/nag.min.js +11 -0
  105. data/app/javascript/popup.js +1457 -0
  106. data/app/javascript/popup.min.js +11 -0
  107. data/app/javascript/progress.js +922 -0
  108. data/app/javascript/progress.min.js +11 -0
  109. data/app/javascript/rating.js +496 -0
  110. data/app/javascript/rating.min.js +11 -0
  111. data/app/javascript/search.js +1519 -0
  112. data/app/javascript/search.min.js +11 -0
  113. data/app/javascript/shape.js +721 -0
  114. data/app/javascript/shape.min.js +11 -0
  115. data/app/javascript/sidebar.js +952 -0
  116. data/app/javascript/sidebar.min.js +11 -0
  117. data/app/javascript/site.js +415 -0
  118. data/app/javascript/site.min.js +11 -0
  119. data/app/javascript/slider.js +1449 -0
  120. data/app/javascript/slider.min.js +11 -0
  121. data/app/javascript/state.js +653 -0
  122. data/app/javascript/state.min.js +11 -0
  123. data/app/javascript/sticky.js +852 -0
  124. data/app/javascript/sticky.min.js +11 -0
  125. data/app/javascript/tab.js +867 -0
  126. data/app/javascript/tab.min.js +11 -0
  127. data/app/javascript/toast.js +916 -0
  128. data/app/javascript/toast.min.js +11 -0
  129. data/app/javascript/transition.js +955 -0
  130. data/app/javascript/transition.min.js +11 -0
  131. data/app/javascript/ui/controllers/fui_accordion_controller.js +45 -0
  132. data/app/javascript/ui/controllers/fui_api_controller.js +80 -0
  133. data/app/javascript/ui/controllers/fui_calendar_controller.js +66 -0
  134. data/app/javascript/ui/controllers/fui_checkbox_controller.js +48 -0
  135. data/app/javascript/ui/controllers/fui_dimmer_controller.js +45 -0
  136. data/app/javascript/ui/controllers/fui_dropdown_controller.js +68 -0
  137. data/app/javascript/ui/controllers/fui_embed_controller.js +49 -0
  138. data/app/javascript/ui/controllers/fui_flyout_controller.js +49 -0
  139. data/app/javascript/ui/controllers/fui_form_controller.js +62 -0
  140. data/app/javascript/ui/controllers/fui_modal_controller.js +61 -0
  141. data/app/javascript/ui/controllers/fui_nag_controller.js +52 -0
  142. data/app/javascript/ui/controllers/fui_popup_controller.js +58 -0
  143. data/app/javascript/ui/controllers/fui_progress_controller.js +60 -0
  144. data/app/javascript/ui/controllers/fui_rating_controller.js +49 -0
  145. data/app/javascript/ui/controllers/fui_search_controller.js +76 -0
  146. data/app/javascript/ui/controllers/fui_shape_controller.js +45 -0
  147. data/app/javascript/ui/controllers/fui_sidebar_controller.js +48 -0
  148. data/app/javascript/ui/controllers/fui_site_controller.js +29 -0
  149. data/app/javascript/ui/controllers/fui_slider_controller.js +53 -0
  150. data/app/javascript/ui/controllers/fui_state_controller.js +63 -0
  151. data/app/javascript/ui/controllers/fui_sticky_controller.js +50 -0
  152. data/app/javascript/ui/controllers/fui_tab_controller.js +57 -0
  153. data/app/javascript/ui/controllers/fui_toast_controller.js +60 -0
  154. data/app/javascript/ui/controllers/fui_transition_controller.js +60 -0
  155. data/app/javascript/ui/controllers/fui_visibility_controller.js +55 -0
  156. data/app/javascript/ui/index.js +114 -0
  157. data/app/javascript/visibility.js +1196 -0
  158. data/app/javascript/visibility.min.js +11 -0
  159. data/app/lib/component.rb +63 -0
  160. data/config/importmap.rb +27 -0
  161. data/config/initializers/ruby_template_handler.rb +31 -0
  162. data/config/routes.rb +2 -0
  163. data/lib/tasks/ui_tasks.rake +4 -0
  164. data/lib/ui/engine.rb +27 -0
  165. data/lib/ui/version.rb +3 -0
  166. data/lib/ui.rb +6 -0
  167. metadata +220 -0
@@ -0,0 +1,653 @@
1
+ /*!
2
+ * # Fomantic-UI 2.9.4 - State
3
+ * https://github.com/fomantic/Fomantic-UI/
4
+ *
5
+ *
6
+ * Released under the MIT license
7
+ * https://opensource.org/licenses/MIT
8
+ *
9
+ */
10
+
11
+ (function ($, window, document) {
12
+ 'use strict';
13
+
14
+ function isFunction(obj) {
15
+ return typeof obj === 'function' && typeof obj.nodeType !== 'number';
16
+ }
17
+
18
+ window = window !== undefined && window.Math === Math
19
+ ? window
20
+ : globalThis;
21
+
22
+ $.fn.state = function (...args) {
23
+ const $allModules = $(this);
24
+
25
+ let time = Date.now();
26
+ let performance = [];
27
+
28
+ const parameters = args[0];
29
+ const methodInvoked = typeof parameters === 'string';
30
+ const queryArguments = args.slice(1);
31
+ const contextCheck = function (context, win) {
32
+ let $context;
33
+ if ([window, document].includes(context)) {
34
+ $context = $(context);
35
+ } else {
36
+ $context = $(win.document).find(context);
37
+ if ($context.length === 0) {
38
+ $context = win.frameElement ? contextCheck(context, win.parent) : window;
39
+ }
40
+ }
41
+
42
+ return $context;
43
+ };
44
+ let returnedValue;
45
+ $allModules.each(function () {
46
+ const settings = $.isPlainObject(parameters)
47
+ ? $.extend(true, {}, $.fn.state.settings, parameters)
48
+ : $.extend({}, $.fn.state.settings);
49
+
50
+ const error = settings.error;
51
+ const metadata = settings.metadata;
52
+ const className = settings.className;
53
+ const namespace = settings.namespace;
54
+ const states = settings.states;
55
+ const text = settings.text;
56
+
57
+ const eventNamespace = '.' + namespace;
58
+ const moduleNamespace = namespace + '-module';
59
+
60
+ let $module = $(this);
61
+ const $context = settings.context ? contextCheck(settings.context, window) : $module;
62
+
63
+ const element = this;
64
+ let instance = $module.data(moduleNamespace);
65
+
66
+ const module = {
67
+
68
+ initialize: function () {
69
+ module.verbose('Initializing module');
70
+
71
+ // allow module to guess the desired state based on the element
72
+ if (settings.automatic) {
73
+ module.add.defaults();
74
+ }
75
+
76
+ // bind events with delegated events
77
+ $context
78
+ .on('mouseenter' + eventNamespace, module.change.text)
79
+ .on('mouseleave' + eventNamespace, module.reset.text)
80
+ .on('click' + eventNamespace, module.toggle.state);
81
+ module.instantiate();
82
+ },
83
+
84
+ instantiate: function () {
85
+ module.verbose('Storing instance of module', module);
86
+ instance = module;
87
+ $module
88
+ .data(moduleNamespace, module);
89
+ },
90
+
91
+ destroy: function () {
92
+ module.verbose('Destroying previous module', instance);
93
+ $context
94
+ .off(eventNamespace);
95
+ $module
96
+ .removeData(metadata.storedText)
97
+ .removeData(moduleNamespace);
98
+ },
99
+
100
+ refresh: function () {
101
+ module.verbose('Refreshing selector cache');
102
+ $module = $(element);
103
+ },
104
+
105
+ add: {
106
+ defaults: function () {
107
+ const userStates = parameters && $.isPlainObject(parameters.states)
108
+ ? parameters.states
109
+ : {};
110
+ $.each(settings.defaults, function (type, typeStates) {
111
+ if (module.is[type] !== undefined && module.is[type]()) {
112
+ module.verbose('Adding default states', type, element);
113
+ $.extend(settings.states, typeStates, userStates);
114
+ }
115
+ });
116
+ },
117
+ },
118
+
119
+ is: {
120
+
121
+ active: function () {
122
+ return $module.hasClass(className.active);
123
+ },
124
+ loading: function () {
125
+ return $module.hasClass(className.loading);
126
+ },
127
+ inactive: function () {
128
+ return !$module.hasClass(className.active);
129
+ },
130
+ state: function (state) {
131
+ if (className[state] === undefined) {
132
+ return false;
133
+ }
134
+
135
+ return $module.hasClass(className[state]);
136
+ },
137
+
138
+ enabled: function () {
139
+ return !$module.is(settings.filter.active);
140
+ },
141
+ disabled: function () {
142
+ return $module.is(settings.filter.active);
143
+ },
144
+ textEnabled: function () {
145
+ return !$module.is(settings.filter.text);
146
+ },
147
+
148
+ // definitions for automatic type detection
149
+ button: function () {
150
+ return $module.is('.button:not(a, .submit)');
151
+ },
152
+ input: function () {
153
+ return $module.is('input');
154
+ },
155
+ progress: function () {
156
+ return $module.is('.ui.progress');
157
+ },
158
+ },
159
+
160
+ allow: function (state) {
161
+ module.debug('Now allowing state', state);
162
+ states[state] = true;
163
+ },
164
+ disallow: function (state) {
165
+ module.debug('No longer allowing', state);
166
+ states[state] = false;
167
+ },
168
+
169
+ allows: function (state) {
170
+ return states[state] || false;
171
+ },
172
+
173
+ enable: function () {
174
+ $module.removeClass(className.disabled);
175
+ },
176
+
177
+ disable: function () {
178
+ $module.addClass(className.disabled);
179
+ },
180
+
181
+ setState: function (state) {
182
+ if (module.allows(state)) {
183
+ $module.addClass(className[state]);
184
+ }
185
+ },
186
+
187
+ removeState: function (state) {
188
+ if (module.allows(state)) {
189
+ $module.removeClass(className[state]);
190
+ }
191
+ },
192
+
193
+ toggle: {
194
+ state: function () {
195
+ let apiRequest;
196
+ let requestCancelled;
197
+ if (module.allows('active') && module.is.enabled()) {
198
+ module.refresh();
199
+ if ($.fn.api !== undefined) {
200
+ apiRequest = $module.api('get request');
201
+ requestCancelled = $module.api('was cancelled');
202
+ if (requestCancelled) {
203
+ module.debug('API Request cancelled by beforesend');
204
+ settings.activateTest = function () {
205
+ return false;
206
+ };
207
+ settings.deactivateTest = function () {
208
+ return false;
209
+ };
210
+ } else if (apiRequest) {
211
+ module.listenTo(apiRequest);
212
+
213
+ return;
214
+ }
215
+ }
216
+ module.change.state();
217
+ }
218
+ },
219
+ },
220
+
221
+ listenTo: function (apiRequest) {
222
+ module.debug('API request detected, waiting for state signal', apiRequest);
223
+ if (apiRequest) {
224
+ if (text.loading) {
225
+ module.update.text(text.loading);
226
+ }
227
+ $.when(apiRequest)
228
+ .then(function () {
229
+ if (apiRequest.state() === 'resolved') {
230
+ module.debug('API request succeeded');
231
+ settings.activateTest = function () {
232
+ return true;
233
+ };
234
+ settings.deactivateTest = function () {
235
+ return true;
236
+ };
237
+ } else {
238
+ module.debug('API request failed');
239
+ settings.activateTest = function () {
240
+ return false;
241
+ };
242
+ settings.deactivateTest = function () {
243
+ return false;
244
+ };
245
+ }
246
+ module.change.state();
247
+ });
248
+ }
249
+ },
250
+
251
+ // checks whether active/inactive state can be given
252
+ change: {
253
+
254
+ state: function () {
255
+ module.debug('Determining state change direction');
256
+ // inactive to active change
257
+ if (module.is.inactive()) {
258
+ module.activate();
259
+ } else {
260
+ module.deactivate();
261
+ }
262
+ if (settings.sync) {
263
+ module.sync();
264
+ }
265
+ settings.onChange.call(element);
266
+ },
267
+
268
+ text: function () {
269
+ if (module.is.textEnabled()) {
270
+ if (module.is.disabled()) {
271
+ module.verbose('Changing text to disabled text', text.hover);
272
+ module.update.text(text.disabled);
273
+ } else if (module.is.active()) {
274
+ if (text.hover) {
275
+ module.verbose('Changing text to hover text', text.hover);
276
+ module.update.text(text.hover);
277
+ } else if (text.deactivate) {
278
+ module.verbose('Changing text to deactivating text', text.deactivate);
279
+ module.update.text(text.deactivate);
280
+ }
281
+ } else if (text.hover) {
282
+ module.verbose('Changing text to hover text', text.hover);
283
+ module.update.text(text.hover);
284
+ } else if (text.activate) {
285
+ module.verbose('Changing text to activating text', text.activate);
286
+ module.update.text(text.activate);
287
+ }
288
+ }
289
+ },
290
+
291
+ },
292
+
293
+ activate: function () {
294
+ if (settings.activateTest.call(element)) {
295
+ module.debug('Setting state to active');
296
+ $module
297
+ .addClass(className.active);
298
+ module.update.text(text.active);
299
+ settings.onActivate.call(element);
300
+ }
301
+ },
302
+
303
+ deactivate: function () {
304
+ if (settings.deactivateTest.call(element)) {
305
+ module.debug('Setting state to inactive');
306
+ $module
307
+ .removeClass(className.active);
308
+ module.update.text(text.inactive);
309
+ settings.onDeactivate.call(element);
310
+ }
311
+ },
312
+
313
+ sync: function () {
314
+ module.verbose('Syncing other buttons to current state');
315
+ if (module.is.active()) {
316
+ $allModules
317
+ .not($module)
318
+ .state('activate');
319
+ } else {
320
+ $allModules
321
+ .not($module)
322
+ .state('deactivate');
323
+ }
324
+ },
325
+
326
+ get: {
327
+ text: function () {
328
+ return settings.selector.text
329
+ ? $module.find(settings.selector.text).text()
330
+ : $module.html();
331
+ },
332
+ textFor: function (state) {
333
+ return text[state] || false;
334
+ },
335
+ },
336
+
337
+ flash: {
338
+ text: function (text = settings.text.flash, duration = settings.flashDuration, callback = function () {}) {
339
+ const previousText = module.get.text();
340
+ module.debug('Flashing text message', text, duration);
341
+ module.update.text(text);
342
+ setTimeout(function () {
343
+ module.update.text(previousText);
344
+ callback.call(element);
345
+ }, duration);
346
+ },
347
+ },
348
+
349
+ reset: {
350
+ // on mouseout sets text to previous value
351
+ text: function () {
352
+ const activeText = text.active || $module.data(metadata.storedText);
353
+ const inactiveText = text.inactive || $module.data(metadata.storedText);
354
+ if (module.is.textEnabled()) {
355
+ if (module.is.active() && activeText) {
356
+ module.verbose('Resetting active text', activeText);
357
+ module.update.text(activeText);
358
+ } else if (inactiveText) {
359
+ module.verbose('Resetting inactive text', activeText);
360
+ module.update.text(inactiveText);
361
+ }
362
+ }
363
+ },
364
+ },
365
+
366
+ update: {
367
+ text: function (text) {
368
+ const currentText = module.get.text();
369
+ if (text && text !== currentText) {
370
+ module.debug('Updating text', text);
371
+ if (settings.selector.text) {
372
+ $module
373
+ .data(metadata.storedText, text)
374
+ .find(settings.selector.text)
375
+ .text(text);
376
+ } else {
377
+ $module
378
+ .data(metadata.storedText, text)
379
+ .html(text);
380
+ }
381
+ } else {
382
+ module.debug('Text is already set, ignoring update', text);
383
+ }
384
+ },
385
+ },
386
+
387
+ setting: function (name, value) {
388
+ module.debug('Changing setting', name, value);
389
+ if ($.isPlainObject(name)) {
390
+ $.extend(true, settings, name);
391
+ } else if (value !== undefined) {
392
+ if ($.isPlainObject(settings[name])) {
393
+ $.extend(true, settings[name], value);
394
+ } else {
395
+ settings[name] = value;
396
+ }
397
+ } else {
398
+ return settings[name];
399
+ }
400
+ },
401
+ internal: function (name, value) {
402
+ if ($.isPlainObject(name)) {
403
+ $.extend(true, module, name);
404
+ } else if (value !== undefined) {
405
+ module[name] = value;
406
+ } else {
407
+ return module[name];
408
+ }
409
+ },
410
+ debug: function (...args) {
411
+ if (!settings.silent && settings.debug) {
412
+ if (settings.performance) {
413
+ module.performance.log(args);
414
+ } else {
415
+ module.debug = Function.prototype.bind.call(console.info, console, settings.name + ':');
416
+ module.debug.apply(console, args);
417
+ }
418
+ }
419
+ },
420
+ verbose: function (...args) {
421
+ if (!settings.silent && settings.verbose && settings.debug) {
422
+ if (settings.performance) {
423
+ module.performance.log(args);
424
+ } else {
425
+ module.verbose = Function.prototype.bind.call(console.info, console, settings.name + ':');
426
+ module.verbose.apply(console, args);
427
+ }
428
+ }
429
+ },
430
+ error: function (...args) {
431
+ if (!settings.silent) {
432
+ module.error = Function.prototype.bind.call(console.error, console, settings.name + ':');
433
+ module.error.apply(console, args);
434
+ }
435
+ },
436
+ performance: {
437
+ log: function (message) {
438
+ let currentTime;
439
+ let executionTime;
440
+ let previousTime;
441
+ if (settings.performance) {
442
+ currentTime = Date.now();
443
+ previousTime = time || currentTime;
444
+ executionTime = currentTime - previousTime;
445
+ time = currentTime;
446
+ performance.push({
447
+ Name: message[0],
448
+ Arguments: message.slice(1),
449
+ Element: element,
450
+ 'Execution Time': executionTime,
451
+ });
452
+ }
453
+ clearTimeout(module.performance.timer);
454
+ module.performance.timer = setTimeout(function () {
455
+ module.performance.display();
456
+ }, 500);
457
+ },
458
+ display: function () {
459
+ let title = settings.name + ':';
460
+ let totalTime = 0;
461
+ time = false;
462
+ clearTimeout(module.performance.timer);
463
+ $.each(performance, function (index, data) {
464
+ totalTime += data['Execution Time'];
465
+ });
466
+ title += ' ' + totalTime + 'ms';
467
+ if (performance.length > 0) {
468
+ console.groupCollapsed(title);
469
+ console.table(performance);
470
+ console.groupEnd();
471
+ }
472
+ performance = [];
473
+ },
474
+ },
475
+ invoke: function (query, passedArguments = queryArguments, context = element) {
476
+ let object = instance;
477
+ let maxDepth;
478
+ let found;
479
+ let response;
480
+ if (typeof query === 'string' && object !== undefined) {
481
+ query = query.split(/[ .]/);
482
+ maxDepth = query.length - 1;
483
+ $.each(query, function (depth, value) {
484
+ const camelCaseValue = depth !== maxDepth
485
+ ? value + query[depth + 1].charAt(0).toUpperCase() + query[depth + 1].slice(1)
486
+ : query;
487
+ if ($.isPlainObject(object[camelCaseValue]) && (depth !== maxDepth)) {
488
+ object = object[camelCaseValue];
489
+ } else if (object[camelCaseValue] !== undefined) {
490
+ found = object[camelCaseValue];
491
+
492
+ return false;
493
+ } else if ($.isPlainObject(object[value]) && (depth !== maxDepth)) {
494
+ object = object[value];
495
+ } else if (object[value] !== undefined) {
496
+ found = object[value];
497
+
498
+ return false;
499
+ } else {
500
+ module.error(error.method, query);
501
+
502
+ return false;
503
+ }
504
+ });
505
+ }
506
+ if (isFunction(found)) {
507
+ response = found.apply(context, passedArguments);
508
+ } else if (found !== undefined) {
509
+ response = found;
510
+ }
511
+ if (Array.isArray(returnedValue)) {
512
+ returnedValue.push(response);
513
+ } else if (returnedValue !== undefined) {
514
+ returnedValue = [returnedValue, response];
515
+ } else if (response !== undefined) {
516
+ returnedValue = response;
517
+ }
518
+
519
+ return found;
520
+ },
521
+ };
522
+
523
+ if (methodInvoked) {
524
+ if (instance === undefined) {
525
+ module.initialize();
526
+ }
527
+ module.invoke(parameters);
528
+ } else {
529
+ if (instance !== undefined) {
530
+ instance.invoke('destroy');
531
+ }
532
+ module.initialize();
533
+ }
534
+ });
535
+
536
+ return returnedValue !== undefined
537
+ ? returnedValue
538
+ : this;
539
+ };
540
+
541
+ $.fn.state.settings = {
542
+
543
+ // module info
544
+ name: 'State',
545
+
546
+ // debug output
547
+ debug: false,
548
+
549
+ // verbose debug output
550
+ verbose: false,
551
+
552
+ // namespace for events
553
+ namespace: 'state',
554
+
555
+ // debug data includes performance
556
+ performance: true,
557
+
558
+ // callback occurs on state change
559
+ onActivate: function () {},
560
+ onDeactivate: function () {},
561
+ onChange: function () {},
562
+
563
+ // state test functions
564
+ activateTest: function () {
565
+ return true;
566
+ },
567
+ deactivateTest: function () {
568
+ return true;
569
+ },
570
+
571
+ // whether to automatically map default states
572
+ automatic: true,
573
+
574
+ // activate / deactivate changes all elements instantiated at the same time
575
+ sync: false,
576
+
577
+ // default flash text duration, used for temporarily changing text of an element
578
+ flashDuration: 1000,
579
+
580
+ // selector filter
581
+ filter: {
582
+ text: '.loading, .disabled',
583
+ active: '.disabled',
584
+ },
585
+
586
+ context: false,
587
+
588
+ // error
589
+ error: {
590
+ method: 'The method you called is not defined.',
591
+ },
592
+
593
+ // metadata
594
+ metadata: {
595
+ promise: 'promise',
596
+ storedText: 'stored-text',
597
+ },
598
+
599
+ // change class on state
600
+ className: {
601
+ active: 'active',
602
+ disabled: 'disabled',
603
+ error: 'error',
604
+ loading: 'loading',
605
+ success: 'success',
606
+ warning: 'warning',
607
+ },
608
+
609
+ selector: {
610
+ // selector for text node
611
+ text: false,
612
+ },
613
+
614
+ defaults: {
615
+ input: {
616
+ disabled: true,
617
+ loading: true,
618
+ active: true,
619
+ },
620
+ button: {
621
+ disabled: true,
622
+ loading: true,
623
+ active: true,
624
+ },
625
+ progress: {
626
+ active: true,
627
+ success: true,
628
+ warning: true,
629
+ error: true,
630
+ },
631
+ },
632
+
633
+ states: {
634
+ active: true,
635
+ disabled: true,
636
+ error: true,
637
+ loading: true,
638
+ success: true,
639
+ warning: true,
640
+ },
641
+
642
+ text: {
643
+ disabled: false,
644
+ flash: false,
645
+ hover: false,
646
+ active: false,
647
+ inactive: false,
648
+ activate: false,
649
+ deactivate: false,
650
+ },
651
+
652
+ };
653
+ })(jQuery, window, document);
@@ -0,0 +1,11 @@
1
+ /*
2
+ * # Fomantic UI - 2.9.4
3
+ * https://github.com/fomantic/Fomantic-UI
4
+ * https://fomantic-ui.com/
5
+ *
6
+ * Copyright 2026 Contributors
7
+ * Released under the MIT license
8
+ * https://opensource.org/licenses/MIT
9
+ *
10
+ */
11
+ !function(w,C,i){"use strict";C=void 0!==C&&C.Math===Math?C:globalThis,w.fn.state=function(...e){const g=w(this);let b=Date.now(),p=[];const x=e[0],m="string"==typeof x,h=e.slice(1),y=function(e,t){let n;return[C,i].includes(e)?n=w(e):0===(n=w(t.document).find(e)).length&&(n=t.frameElement?y(e,t.parent):C),n};let T;return g.each(function(){const a=w.isPlainObject(x)?w.extend(!0,{},w.fn.state.settings,x):w.extend({},w.fn.state.settings),c=a.error,n=a.metadata,t=a.className;var e=a.namespace;const i=a.states,o=a.text,s="."+e,r=e+"-module";let l=w(this);const d=a.context?y(a.context,C):l,u=this;let f=l.data(r);const v={initialize:function(){v.verbose("Initializing module"),a.automatic&&v.add.defaults(),d.on("mouseenter"+s,v.change.text).on("mouseleave"+s,v.reset.text).on("click"+s,v.toggle.state),v.instantiate()},instantiate:function(){v.verbose("Storing instance of module",v),f=v,l.data(r,v)},destroy:function(){v.verbose("Destroying previous module",f),d.off(s),l.removeData(n.storedText).removeData(r)},refresh:function(){v.verbose("Refreshing selector cache"),l=w(u)},add:{defaults:function(){const n=x&&w.isPlainObject(x.states)?x.states:{};w.each(a.defaults,function(e,t){void 0!==v.is[e]&&v.is[e]()&&(v.verbose("Adding default states",e,u),w.extend(a.states,t,n))})}},is:{active:function(){return l.hasClass(t.active)},loading:function(){return l.hasClass(t.loading)},inactive:function(){return!l.hasClass(t.active)},state:function(e){return void 0!==t[e]&&l.hasClass(t[e])},enabled:function(){return!l.is(a.filter.active)},disabled:function(){return l.is(a.filter.active)},textEnabled:function(){return!l.is(a.filter.text)},button:function(){return l.is(".button:not(a, .submit)")},input:function(){return l.is("input")},progress:function(){return l.is(".ui.progress")}},allow:function(e){v.debug("Now allowing state",e),i[e]=!0},disallow:function(e){v.debug("No longer allowing",e),i[e]=!1},allows:function(e){return i[e]||!1},enable:function(){l.removeClass(t.disabled)},disable:function(){l.addClass(t.disabled)},setState:function(e){v.allows(e)&&l.addClass(t[e])},removeState:function(e){v.allows(e)&&l.removeClass(t[e])},toggle:{state:function(){var e;if(v.allows("active")&&v.is.enabled()){if(v.refresh(),void 0!==w.fn.api)if(e=l.api("get request"),l.api("was cancelled"))v.debug("API Request cancelled by beforesend"),a.activateTest=function(){return!1},a.deactivateTest=function(){return!1};else if(e)return void v.listenTo(e);v.change.state()}}},listenTo:function(e){v.debug("API request detected, waiting for state signal",e),e&&(o.loading&&v.update.text(o.loading),w.when(e).then(function(){"resolved"===e.state()?(v.debug("API request succeeded"),a.activateTest=function(){return!0},a.deactivateTest=function(){return!0}):(v.debug("API request failed"),a.activateTest=function(){return!1},a.deactivateTest=function(){return!1}),v.change.state()}))},change:{state:function(){v.debug("Determining state change direction"),v.is.inactive()?v.activate():v.deactivate(),a.sync&&v.sync(),a.onChange.call(u)},text:function(){v.is.textEnabled()&&(v.is.disabled()?(v.verbose("Changing text to disabled text",o.hover),v.update.text(o.disabled)):v.is.active()?o.hover?(v.verbose("Changing text to hover text",o.hover),v.update.text(o.hover)):o.deactivate&&(v.verbose("Changing text to deactivating text",o.deactivate),v.update.text(o.deactivate)):o.hover?(v.verbose("Changing text to hover text",o.hover),v.update.text(o.hover)):o.activate&&(v.verbose("Changing text to activating text",o.activate),v.update.text(o.activate)))}},activate:function(){a.activateTest.call(u)&&(v.debug("Setting state to active"),l.addClass(t.active),v.update.text(o.active),a.onActivate.call(u))},deactivate:function(){a.deactivateTest.call(u)&&(v.debug("Setting state to inactive"),l.removeClass(t.active),v.update.text(o.inactive),a.onDeactivate.call(u))},sync:function(){v.verbose("Syncing other buttons to current state"),v.is.active()?g.not(l).state("activate"):g.not(l).state("deactivate")},get:{text:function(){return a.selector.text?l.find(a.selector.text).text():l.html()},textFor:function(e){return o[e]||!1}},flash:{text:function(e=a.text.flash,t=a.flashDuration,n=function(){}){const i=v.get.text();v.debug("Flashing text message",e,t),v.update.text(e),setTimeout(function(){v.update.text(i),n.call(u)},t)}},reset:{text:function(){var e=o.active||l.data(n.storedText),t=o.inactive||l.data(n.storedText);v.is.textEnabled()&&(v.is.active()&&e?(v.verbose("Resetting active text",e),v.update.text(e)):t&&(v.verbose("Resetting inactive text",e),v.update.text(t)))}},update:{text:function(e){var t=v.get.text();e&&e!==t?(v.debug("Updating text",e),a.selector.text?l.data(n.storedText,e).find(a.selector.text).text(e):l.data(n.storedText,e).html(e)):v.debug("Text is already set, ignoring update",e)}},setting:function(e,t){if(v.debug("Changing setting",e,t),w.isPlainObject(e))w.extend(!0,a,e);else{if(void 0===t)return a[e];w.isPlainObject(a[e])?w.extend(!0,a[e],t):a[e]=t}},internal:function(e,t){if(w.isPlainObject(e))w.extend(!0,v,e);else{if(void 0===t)return v[e];v[e]=t}},debug:function(...e){!a.silent&&a.debug&&(a.performance?v.performance.log(e):(v.debug=Function.prototype.bind.call(console.info,console,a.name+":"),v.debug.apply(console,e)))},verbose:function(...e){!a.silent&&a.verbose&&a.debug&&(a.performance?v.performance.log(e):(v.verbose=Function.prototype.bind.call(console.info,console,a.name+":"),v.verbose.apply(console,e)))},error:function(...e){a.silent||(v.error=Function.prototype.bind.call(console.error,console,a.name+":"),v.error.apply(console,e))},performance:{log:function(e){var t,n;a.performance&&(n=(t=Date.now())-(b||t),b=t,p.push({Name:e[0],Arguments:e.slice(1),Element:u,"Execution Time":n})),clearTimeout(v.performance.timer),v.performance.timer=setTimeout(function(){v.performance.display()},500)},display:function(){var e=a.name+":";let n=0;b=!1,clearTimeout(v.performance.timer),w.each(p,function(e,t){n+=t["Execution Time"]}),e+=" "+n+"ms",0<p.length&&(console.groupCollapsed(e),console.table(p),console.groupEnd()),p=[]}},invoke:function(i,e=h,t=u){let a=f,o,s,n;var r;return"string"==typeof i&&void 0!==a&&(i=i.split(/[ .]/),o=i.length-1,w.each(i,function(e,t){var n=e!==o?t+i[e+1].charAt(0).toUpperCase()+i[e+1].slice(1):i;if(w.isPlainObject(a[n])&&e!==o)a=a[n];else{if(void 0!==a[n])return s=a[n],!1;{if(!w.isPlainObject(a[t])||e===o)return void 0!==a[t]?s=a[t]:v.error(c.method,i),!1;a=a[t]}}})),"function"==typeof(r=s)&&"number"!=typeof r.nodeType?n=s.apply(t,e):void 0!==s&&(n=s),Array.isArray(T)?T.push(n):void 0!==T?T=[T,n]:void 0!==n&&(T=n),s}};m?(void 0===f&&v.initialize(),v.invoke(x)):(void 0!==f&&f.invoke("destroy"),v.initialize())}),void 0!==T?T:this},w.fn.state.settings={name:"State",debug:!1,verbose:!1,namespace:"state",performance:!0,onActivate:function(){},onDeactivate:function(){},onChange:function(){},activateTest:function(){return!0},deactivateTest:function(){return!0},automatic:!0,sync:!1,flashDuration:1e3,filter:{text:".loading, .disabled",active:".disabled"},context:!1,error:{method:"The method you called is not defined."},metadata:{promise:"promise",storedText:"stored-text"},className:{active:"active",disabled:"disabled",error:"error",loading:"loading",success:"success",warning:"warning"},selector:{text:!1},defaults:{input:{disabled:!0,loading:!0,active:!0},button:{disabled:!0,loading:!0,active:!0},progress:{active:!0,success:!0,warning:!0,error:!0}},states:{active:!0,disabled:!0,error:!0,loading:!0,success:!0,warning:!0},text:{disabled:!1,flash:!1,hover:!1,active:!1,inactive:!1,activate:!1,deactivate:!1}}}(jQuery,window,document);