selective-ui 1.0.2 → 1.0.3

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 (67) hide show
  1. package/LICENSE +21 -21
  2. package/README.md +7 -2
  3. package/dist/selective-ui.css +567 -567
  4. package/dist/selective-ui.css.map +1 -1
  5. package/dist/selective-ui.esm.js +6046 -6046
  6. package/dist/selective-ui.esm.js.map +1 -1
  7. package/dist/selective-ui.esm.min.js +1 -1
  8. package/dist/selective-ui.esm.min.js.br +0 -0
  9. package/dist/selective-ui.min.js +1 -1
  10. package/dist/selective-ui.min.js.br +0 -0
  11. package/dist/selective-ui.umd.js +6046 -6046
  12. package/dist/selective-ui.umd.js.map +1 -1
  13. package/package.json +68 -68
  14. package/src/css/components/accessorybox.css +63 -63
  15. package/src/css/components/directive.css +19 -19
  16. package/src/css/components/empty-state.css +25 -25
  17. package/src/css/components/loading-state.css +25 -25
  18. package/src/css/components/optgroup.css +61 -61
  19. package/src/css/components/option-handle.css +33 -33
  20. package/src/css/components/option.css +129 -129
  21. package/src/css/components/placeholder.css +14 -14
  22. package/src/css/components/popup.css +38 -38
  23. package/src/css/components/searchbox.css +28 -28
  24. package/src/css/components/selectbox.css +53 -53
  25. package/src/css/index.css +74 -74
  26. package/src/js/adapter/mixed-adapter.js +434 -434
  27. package/src/js/components/accessorybox.js +124 -124
  28. package/src/js/components/directive.js +37 -37
  29. package/src/js/components/empty-state.js +67 -67
  30. package/src/js/components/loading-state.js +59 -59
  31. package/src/js/components/option-handle.js +113 -113
  32. package/src/js/components/placeholder.js +56 -56
  33. package/src/js/components/popup.js +470 -470
  34. package/src/js/components/searchbox.js +167 -167
  35. package/src/js/components/selectbox.js +692 -692
  36. package/src/js/core/base/adapter.js +162 -162
  37. package/src/js/core/base/model.js +59 -59
  38. package/src/js/core/base/recyclerview.js +82 -82
  39. package/src/js/core/base/view.js +62 -62
  40. package/src/js/core/model-manager.js +286 -286
  41. package/src/js/core/search-controller.js +521 -521
  42. package/src/js/index.js +136 -136
  43. package/src/js/models/group-model.js +142 -142
  44. package/src/js/models/option-model.js +236 -236
  45. package/src/js/services/dataset-observer.js +73 -73
  46. package/src/js/services/ea-observer.js +87 -87
  47. package/src/js/services/effector.js +403 -403
  48. package/src/js/services/refresher.js +39 -39
  49. package/src/js/services/resize-observer.js +151 -151
  50. package/src/js/services/select-observer.js +60 -60
  51. package/src/js/types/adapter.type.js +32 -32
  52. package/src/js/types/effector.type.js +23 -23
  53. package/src/js/types/ievents.type.js +10 -10
  54. package/src/js/types/libs.type.js +27 -27
  55. package/src/js/types/model.type.js +11 -11
  56. package/src/js/types/recyclerview.type.js +11 -11
  57. package/src/js/types/resize-observer.type.js +18 -18
  58. package/src/js/types/view.group.type.js +12 -12
  59. package/src/js/types/view.option.type.js +14 -14
  60. package/src/js/types/view.type.js +10 -10
  61. package/src/js/utils/guard.js +46 -46
  62. package/src/js/utils/ievents.js +83 -83
  63. package/src/js/utils/istorage.js +60 -60
  64. package/src/js/utils/libs.js +618 -618
  65. package/src/js/utils/selective.js +385 -385
  66. package/src/js/views/group-view.js +102 -102
  67. package/src/js/views/option-view.js +152 -152
@@ -1,88 +1,88 @@
1
- /**
2
- * @class
3
- */
4
- export class ElementAdditionObserver {
5
- #isActive = false;
6
- /** @type {MutationObserver} */
7
- #observer = null;
8
-
9
- /** @type {Function[]} */
10
- #actions = [];
11
-
12
- /**
13
- * Registers a callback to be invoked whenever a matching element is detected being added to the DOM.
14
- *
15
- * @param {(el: HTMLSelectElement) => void} action - Function executed with the newly added element.
16
- */
17
- onDetect(action) {
18
- this.#actions.push(action);
19
- }
20
-
21
- /**
22
- * Clears all previously registered detection callbacks.
23
- */
24
- clearDetect() {
25
- this.#actions = [];
26
- }
27
-
28
- /**
29
- * Starts observing the document for additions of elements matching the given tag.
30
- * Detects both direct additions and nested matches within added subtrees.
31
- *
32
- * @param {string} tag - The tag name to watch for (e.g., "select", "div").
33
- */
34
- start(tag) {
35
- if (this.#isActive) {
36
- return;
37
- }
38
- this.#isActive = true;
39
- const upperTag = tag.toUpperCase();
40
- const lowerTag = tag.toLowerCase();
41
- this.#observer = new MutationObserver((mutations) => {
42
- mutations.forEach((mutation) => {
43
- mutation.addedNodes.forEach((node) => {
44
- const subnode = /** @type {HTMLElement} */ (node);
45
- if (subnode.nodeType === 1) {
46
- if (subnode.tagName === upperTag) {
47
- this.#handle(subnode);
48
- }
49
-
50
- const selects = subnode.querySelectorAll(lowerTag);
51
- selects.forEach((select) => {
52
- this.#handle(select);
53
- });
54
- }
55
- });
56
- });
57
- });
58
-
59
- this.#observer.observe(document.body, {
60
- childList: true,
61
- subtree: true
62
- });
63
- }
64
-
65
- /**
66
- * Stops observing for element additions and releases internal resources.
67
- * No-ops if the observer is not active.
68
- */
69
- stop() {
70
- if (!this.#isActive) {
71
- return;
72
- }
73
- this.#isActive = false;
74
- this.#observer.disconnect();
75
- this.#observer = null;
76
- }
77
-
78
- /**
79
- * Internal handler that invokes all registered detection callbacks for the provided element.
80
- *
81
- * @param {Element} element - The element that was detected as added to the DOM.
82
- */
83
- #handle(element) {
84
- this.#actions.forEach(action => {
85
- action(element);
86
- });
87
- }
1
+ /**
2
+ * @class
3
+ */
4
+ export class ElementAdditionObserver {
5
+ #isActive = false;
6
+ /** @type {MutationObserver} */
7
+ #observer = null;
8
+
9
+ /** @type {Function[]} */
10
+ #actions = [];
11
+
12
+ /**
13
+ * Registers a callback to be invoked whenever a matching element is detected being added to the DOM.
14
+ *
15
+ * @param {(el: HTMLSelectElement) => void} action - Function executed with the newly added element.
16
+ */
17
+ onDetect(action) {
18
+ this.#actions.push(action);
19
+ }
20
+
21
+ /**
22
+ * Clears all previously registered detection callbacks.
23
+ */
24
+ clearDetect() {
25
+ this.#actions = [];
26
+ }
27
+
28
+ /**
29
+ * Starts observing the document for additions of elements matching the given tag.
30
+ * Detects both direct additions and nested matches within added subtrees.
31
+ *
32
+ * @param {string} tag - The tag name to watch for (e.g., "select", "div").
33
+ */
34
+ start(tag) {
35
+ if (this.#isActive) {
36
+ return;
37
+ }
38
+ this.#isActive = true;
39
+ const upperTag = tag.toUpperCase();
40
+ const lowerTag = tag.toLowerCase();
41
+ this.#observer = new MutationObserver((mutations) => {
42
+ mutations.forEach((mutation) => {
43
+ mutation.addedNodes.forEach((node) => {
44
+ const subnode = /** @type {HTMLElement} */ (node);
45
+ if (subnode.nodeType === 1) {
46
+ if (subnode.tagName === upperTag) {
47
+ this.#handle(subnode);
48
+ }
49
+
50
+ const selects = subnode.querySelectorAll(lowerTag);
51
+ selects.forEach((select) => {
52
+ this.#handle(select);
53
+ });
54
+ }
55
+ });
56
+ });
57
+ });
58
+
59
+ this.#observer.observe(document.body, {
60
+ childList: true,
61
+ subtree: true
62
+ });
63
+ }
64
+
65
+ /**
66
+ * Stops observing for element additions and releases internal resources.
67
+ * No-ops if the observer is not active.
68
+ */
69
+ stop() {
70
+ if (!this.#isActive) {
71
+ return;
72
+ }
73
+ this.#isActive = false;
74
+ this.#observer.disconnect();
75
+ this.#observer = null;
76
+ }
77
+
78
+ /**
79
+ * Internal handler that invokes all registered detection callbacks for the provided element.
80
+ *
81
+ * @param {Element} element - The element that was detected as added to the DOM.
82
+ */
83
+ #handle(element) {
84
+ this.#actions.forEach(action => {
85
+ action(element);
86
+ });
87
+ }
88
88
  }