@vanduo-oss/framework 1.3.9 → 1.4.1

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 (124) hide show
  1. package/README.md +89 -42
  2. package/css/components/affix.css +12 -12
  3. package/css/components/alerts.css +70 -70
  4. package/css/components/avatar.css +78 -78
  5. package/css/components/badges.css +67 -67
  6. package/css/components/breadcrumbs.css +32 -32
  7. package/css/components/bubble.css +40 -40
  8. package/css/components/button-group.css +2 -2
  9. package/css/components/buttons.css +157 -157
  10. package/css/components/cards.css +79 -79
  11. package/css/components/chips.css +50 -50
  12. package/css/components/code-snippet.css +132 -132
  13. package/css/components/collapsible.css +67 -67
  14. package/css/components/collections.css +68 -68
  15. package/css/components/datepicker.css +54 -54
  16. package/css/components/doc-search.css +96 -103
  17. package/css/components/doc-tabs.css +11 -11
  18. package/css/components/draggable.css +77 -77
  19. package/css/components/dropdown.css +50 -50
  20. package/css/components/expanding-cards.css +1 -1
  21. package/css/components/fab.css +61 -61
  22. package/css/components/flow.css +55 -55
  23. package/css/components/footer.css +62 -62
  24. package/css/components/forms.css +437 -425
  25. package/css/components/image-box.css +50 -54
  26. package/css/components/modals.css +51 -51
  27. package/css/components/music-player.css +150 -150
  28. package/css/components/navbar.css +80 -80
  29. package/css/components/pagination.css +51 -51
  30. package/css/components/preloader.css +19 -19
  31. package/css/components/progress.css +20 -20
  32. package/css/components/rating.css +19 -19
  33. package/css/components/ripple.css +10 -10
  34. package/css/components/sidenav.css +72 -72
  35. package/css/components/skeleton.css +17 -16
  36. package/css/components/spinner.css +33 -33
  37. package/css/components/spotlight.css +33 -33
  38. package/css/components/stepper.css +39 -39
  39. package/css/components/suggest.css +37 -37
  40. package/css/components/tabs.css +60 -60
  41. package/css/components/theme-customizer.css +154 -154
  42. package/css/components/timeline.css +50 -50
  43. package/css/components/timepicker.css +29 -29
  44. package/css/components/toast.css +53 -53
  45. package/css/components/tooltips.css +78 -78
  46. package/css/components/transfer.css +37 -37
  47. package/css/components/tree.css +28 -28
  48. package/css/components/waypoint.css +12 -12
  49. package/css/core/colors.css +640 -640
  50. package/css/core/grid.css +127 -132
  51. package/css/core/helpers.css +349 -349
  52. package/css/core/tokens.css +133 -67
  53. package/css/core/typography.css +105 -103
  54. package/css/effects/morph.css +21 -21
  55. package/css/effects/parallax.css +6 -6
  56. package/css/utilities/color-utilities.css +273 -273
  57. package/css/utilities/media.css +4 -4
  58. package/css/utilities/shadow.css +75 -75
  59. package/css/utilities/table.css +64 -64
  60. package/css/utilities/transitions.css +53 -41
  61. package/css/vanduo.css +14 -35
  62. package/dist/build-info.json +3 -3
  63. package/dist/vanduo.cjs.js +947 -307
  64. package/dist/vanduo.cjs.js.map +3 -3
  65. package/dist/vanduo.cjs.min.js +7 -7
  66. package/dist/vanduo.cjs.min.js.map +3 -3
  67. package/dist/vanduo.css +9650 -9656
  68. package/dist/vanduo.css.map +1 -1
  69. package/dist/vanduo.esm.js +947 -307
  70. package/dist/vanduo.esm.js.map +3 -3
  71. package/dist/vanduo.esm.min.js +7 -7
  72. package/dist/vanduo.esm.min.js.map +3 -3
  73. package/dist/vanduo.js +947 -307
  74. package/dist/vanduo.js.map +3 -3
  75. package/dist/vanduo.min.css +2 -2
  76. package/dist/vanduo.min.css.map +1 -1
  77. package/dist/vanduo.min.js +7 -7
  78. package/dist/vanduo.min.js.map +3 -3
  79. package/js/components/affix.js +4 -4
  80. package/js/components/bubble.js +3 -3
  81. package/js/components/code-snippet.js +129 -5
  82. package/js/components/collapsible.js +2 -3
  83. package/js/components/datepicker.js +2 -2
  84. package/js/components/doc-search.js +69 -11
  85. package/js/components/draggable.js +4 -4
  86. package/js/components/dropdown.js +2 -3
  87. package/js/components/expanding-cards.js +2 -2
  88. package/js/components/flow.js +2 -2
  89. package/js/components/font-switcher.js +23 -13
  90. package/js/components/glass.js +2 -2
  91. package/js/components/grid.js +19 -8
  92. package/js/components/image-box.js +51 -12
  93. package/js/components/lazy-load.js +81 -9
  94. package/js/components/modals.js +28 -12
  95. package/js/components/morph.js +3 -3
  96. package/js/components/music-player.js +13 -13
  97. package/js/components/navbar.js +3 -3
  98. package/js/components/pagination.js +2 -3
  99. package/js/components/parallax.js +9 -10
  100. package/js/components/preloader.js +15 -6
  101. package/js/components/rating.js +2 -2
  102. package/js/components/ripple.js +2 -2
  103. package/js/components/select.js +2 -3
  104. package/js/components/sidenav.js +43 -14
  105. package/js/components/spotlight.js +2 -2
  106. package/js/components/stepper.js +2 -2
  107. package/js/components/suggest.js +9 -3
  108. package/js/components/tabs.js +2 -2
  109. package/js/components/theme-customizer.js +155 -25
  110. package/js/components/theme-switcher.js +27 -16
  111. package/js/components/timeline.js +41 -12
  112. package/js/components/timepicker.js +2 -2
  113. package/js/components/toast.js +1 -1
  114. package/js/components/tooltips.js +4 -4
  115. package/js/components/transfer.js +2 -2
  116. package/js/components/tree.js +2 -2
  117. package/js/components/validate.js +2 -2
  118. package/js/components/vd-hex.js +10 -6
  119. package/js/components/waypoint.js +2 -2
  120. package/js/utils/helpers.js +7 -4
  121. package/js/utils/lifecycle.js +158 -83
  122. package/js/vanduo.js +203 -34
  123. package/package.json +2 -1
  124. package/css/core/vd-aliases.css +0 -60
package/js/vanduo.js CHANGED
@@ -6,6 +6,7 @@
6
6
  'use strict';
7
7
 
8
8
  const VANDUO_VERSION = typeof __VANDUO_VERSION__ !== 'undefined' ? __VANDUO_VERSION__ : '0.0.0-dev';
9
+ const hasOwn = Object.prototype.hasOwnProperty;
9
10
 
10
11
  /**
11
12
  * Vanduo Framework Object
@@ -13,46 +14,193 @@
13
14
  const Vanduo = {
14
15
  version: VANDUO_VERSION,
15
16
  components: {},
17
+ aliases: {},
18
+ _decoratedComponents: new WeakSet(),
19
+
20
+ resolveComponentName: function (name) {
21
+ return this.aliases[name] || name;
22
+ },
23
+
24
+ _isRoot: function (root) {
25
+ if (typeof window.VanduoLifecycle !== 'undefined' && typeof window.VanduoLifecycle.isRoot === 'function') {
26
+ return window.VanduoLifecycle.isRoot(root);
27
+ }
28
+
29
+ return !!root && (root === document || root.nodeType === 1 || root.nodeType === 9 || root.nodeType === 11);
30
+ },
31
+
32
+ _normalizeRoot: function (root) {
33
+ return this._isRoot(root) ? root : document;
34
+ },
35
+
36
+ _queryAll: function (root, selector) {
37
+ const scope = this._normalizeRoot(root);
38
+ const matches = [];
39
+
40
+ if (scope instanceof Element && typeof scope.matches === 'function' && scope.matches(selector)) {
41
+ matches.push(scope);
42
+ }
43
+
44
+ if (typeof scope.querySelectorAll === 'function') {
45
+ const descendants = scope.querySelectorAll(selector);
46
+ for (let i = 0; i < descendants.length; i++) {
47
+ matches.push(descendants[i]);
48
+ }
49
+ }
50
+
51
+ return matches;
52
+ },
53
+
54
+ queryAll: function (root, selector) {
55
+ if (typeof selector === 'undefined') {
56
+ selector = root;
57
+ root = document;
58
+ }
59
+
60
+ return this._queryAll(root, selector);
61
+ },
62
+
63
+ queryOne: function (root, selector) {
64
+ const matches = this.queryAll(root, selector);
65
+ return matches.length ? matches[0] : null;
66
+ },
67
+
68
+ _isLifecycleManagedComponent: function (component) {
69
+ if (!component || typeof component !== 'object') return false;
70
+
71
+ for (const key in component) {
72
+ if (hasOwn.call(component, key) && component[key] instanceof Map) {
73
+ return true;
74
+ }
75
+ }
76
+
77
+ return false;
78
+ },
79
+
80
+ _syncComponentLifecycle: function (name, component, root) {
81
+ const lifecycle = window.VanduoLifecycle;
82
+ if (!lifecycle || !this._isLifecycleManagedComponent(component)) return;
83
+
84
+ const componentName = this.resolveComponentName(name);
85
+ const scope = this._normalizeRoot(root);
86
+
87
+ for (const key in component) {
88
+ if (!hasOwn.call(component, key) || !(component[key] instanceof Map)) {
89
+ continue;
90
+ }
91
+
92
+ component[key].forEach(function (instance, element) {
93
+ if (!(element instanceof Element) || !lifecycle.isInRoot(scope, element) || lifecycle.has(element, componentName)) {
94
+ return;
95
+ }
96
+
97
+ if (typeof component.destroy === 'function') {
98
+ lifecycle.register(element, componentName, [], function () {
99
+ component.destroy(element);
100
+ });
101
+ return;
102
+ }
103
+
104
+ const cleanup = instance && Array.isArray(instance.cleanup) ? instance.cleanup : [];
105
+ lifecycle.register(element, componentName, cleanup, function () {
106
+ component[key].delete(element);
107
+ });
108
+ });
109
+ }
110
+ },
111
+
112
+ _decorateComponent: function (name, component) {
113
+ const framework = this;
114
+ const lifecycle = window.VanduoLifecycle;
115
+ if (!component || typeof component !== 'object' || this._decoratedComponents.has(component)) {
116
+ return;
117
+ }
118
+
119
+ const originalInit = typeof component.init === 'function' ? component.init : null;
120
+ if (originalInit) {
121
+ component.init = function (...args) {
122
+ const scopedRoot = framework._isRoot(args[0]) ? args[0] : null;
123
+ const result = originalInit.apply(this, args);
124
+
125
+ if (window.Vanduo) {
126
+ const syncRoot = scopedRoot || document;
127
+ window.Vanduo._syncComponentLifecycle(name, this, syncRoot);
128
+ }
129
+
130
+ return result;
131
+ };
132
+ }
133
+
134
+ const originalDestroyAll = typeof component.destroyAll === 'function' ? component.destroyAll : null;
135
+ if (originalDestroyAll) {
136
+ component.destroyAll = function (...args) {
137
+ const scopedRoot = framework._isRoot(args[0]) ? args[0] : null;
138
+ const componentName = window.Vanduo ? window.Vanduo.resolveComponentName(name) : name;
139
+
140
+ if (lifecycle && window.Vanduo && window.Vanduo._isLifecycleManagedComponent(this)) {
141
+ if (scopedRoot && scopedRoot !== document) {
142
+ lifecycle.destroyAllInContainer(scopedRoot, componentName);
143
+ if (this.__vanduoScopedDestroyAll === true) {
144
+ return originalDestroyAll.apply(this, args);
145
+ }
146
+ return;
147
+ }
148
+
149
+ lifecycle.destroyAll(componentName);
150
+ }
151
+
152
+ return originalDestroyAll.apply(this, args);
153
+ };
154
+ }
155
+
156
+ this._decoratedComponents.add(component);
157
+ },
16
158
 
17
159
  /**
18
160
  * Initialize framework
19
161
  * Call this after DOM is ready and all components are loaded
20
162
  */
21
- init: function () {
22
- // Initialize components when DOM is ready
163
+ init: function (root) {
164
+ const scope = this._normalizeRoot(root);
165
+
166
+ if (scope !== document) {
167
+ this.initComponents(scope);
168
+ return;
169
+ }
170
+
23
171
  if (typeof ready !== 'undefined') {
24
172
  ready(() => {
25
- this.initComponents();
173
+ this.initComponents(document);
26
174
  });
27
- } else {
28
- // Fallback if helpers.js is not loaded
29
- if (document.readyState === 'loading') {
30
- document.addEventListener('DOMContentLoaded', () => {
31
- this.initComponents();
32
- });
33
- } else {
34
- this.initComponents();
35
- }
175
+ return;
36
176
  }
177
+
178
+ if (document.readyState === 'loading') {
179
+ document.addEventListener('DOMContentLoaded', () => {
180
+ this.initComponents(document);
181
+ });
182
+ return;
183
+ }
184
+
185
+ this.initComponents(document);
37
186
  },
38
187
 
39
188
  /**
40
189
  * Initialize all components
41
190
  */
42
- initComponents: function () {
43
- // Initialize all registered components
191
+ initComponents: function (root) {
192
+ const scope = this._normalizeRoot(root);
193
+
44
194
  Object.keys(this.components).forEach((name) => {
45
195
  const component = this.components[name];
46
196
  if (component.init && typeof component.init === 'function') {
47
197
  try {
48
- component.init();
198
+ component.init(scope);
49
199
  } catch (e) {
50
200
  console.warn('[Vanduo] Failed to initialize component "' + name + '":', e);
51
201
  }
52
202
  }
53
203
  });
54
-
55
- console.log('Vanduo Framework v' + this.version + ' initialized');
56
204
  },
57
205
 
58
206
  /**
@@ -60,49 +208,69 @@
60
208
  * @param {string} name - Component name
61
209
  * @param {Object} component - Component object with init method
62
210
  */
63
- register: function (name, component) {
211
+ register: function (name, component, options) {
212
+ const opts = options || {};
213
+ this._decorateComponent(name, component);
64
214
  this.components[name] = component;
65
- // Note: Components are NOT auto-initialized on registration
66
- // Call Vanduo.init() explicitly after all components are registered
215
+
216
+ if (Array.isArray(opts.aliases)) {
217
+ opts.aliases.forEach((alias) => {
218
+ this.aliases[alias] = name;
219
+ });
220
+ }
221
+ },
222
+
223
+ registerAlias: function (alias, name) {
224
+ const canonicalName = this.resolveComponentName(name);
225
+ if (this.components[canonicalName]) {
226
+ this.aliases[alias] = canonicalName;
227
+ }
67
228
  },
68
229
 
69
230
  /**
70
231
  * Re-initialize a component (useful after dynamic DOM changes)
71
232
  * @param {string} name - Component name
72
233
  */
73
- reinit: function (name) {
74
- const component = this.components[name];
234
+ reinit: function (name, root) {
235
+ const scope = this._normalizeRoot(root);
236
+ const componentName = this.resolveComponentName(name);
237
+ const component = this.components[componentName];
75
238
  if (component && component.init && typeof component.init === 'function') {
76
239
  try {
77
- component.init();
240
+ if (component.destroyAll && typeof component.destroyAll === 'function') {
241
+ component.destroyAll(scope);
242
+ }
243
+ component.init(scope);
78
244
  } catch (e) {
79
- console.warn('[Vanduo] Failed to reinitialize component "' + name + '":', e);
245
+ console.warn('[Vanduo] Failed to reinitialize component "' + componentName + '":', e);
80
246
  }
81
247
  }
82
248
  },
83
249
 
84
250
  /**
85
- * Destroy all component instances and clean up event listeners
86
- * Uses lifecycle manager for memory leak prevention
251
+ * Destroy component instances within the provided root.
87
252
  */
88
- destroyAll: function () {
89
- // First, destroy components that have their own destroyAll
253
+ destroy: function (root) {
254
+ const scope = this._normalizeRoot(root);
90
255
  const names = Object.keys(this.components);
256
+
91
257
  for (let i = 0; i < names.length; i++) {
92
258
  const component = this.components[names[i]];
93
259
  if (component && component.destroyAll && typeof component.destroyAll === 'function') {
94
260
  try {
95
- component.destroyAll();
261
+ component.destroyAll(scope);
96
262
  } catch (e) {
97
263
  console.warn('[Vanduo] Failed to destroy component "' + names[i] + '":', e);
98
264
  }
99
265
  }
100
266
  }
267
+ },
101
268
 
102
- // Then, cleanup any remaining registered elements via lifecycle manager
103
- if (typeof window.VanduoLifecycle !== 'undefined') {
104
- window.VanduoLifecycle.destroyAll();
105
- }
269
+ /**
270
+ * Destroy all component instances and clean up event listeners.
271
+ */
272
+ destroyAll: function () {
273
+ this.destroy(document);
106
274
  },
107
275
 
108
276
  /**
@@ -111,7 +279,8 @@
111
279
  * @returns {Object|null}
112
280
  */
113
281
  getComponent: function (name) {
114
- return this.components[name] || null;
282
+ const componentName = this.resolveComponentName(name);
283
+ return this.components[componentName] || null;
115
284
  }
116
285
  };
117
286
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vanduo-oss/framework",
3
- "version": "1.3.9",
3
+ "version": "1.4.1",
4
4
  "description": "Zero-dependency CSS/JS framework built on Fibonacci/Golden Ratio design system with Open Color integration",
5
5
  "keywords": [
6
6
  "css",
@@ -56,6 +56,7 @@
56
56
  "build": "node scripts/build.js",
57
57
  "build:min": "node scripts/build.js --minify",
58
58
  "dev": "node scripts/build.js --development",
59
+ "stats:css": "node scripts/stats-css.js",
59
60
  "check:versions": "node scripts/check-version-consistency.js",
60
61
  "release:assets": "node scripts/upload-release-assets.js",
61
62
  "lint": "pnpm run lint:css && pnpm run lint:js",
@@ -1,60 +0,0 @@
1
- /**
2
- * Vanduo Framework - Legacy vd-* Token Aliases
3
- * Maps vd-* custom properties to the current token names.
4
- */
5
-
6
- :root {
7
- /* Colors */
8
- --vd-color-primary: var(--color-primary);
9
- --vd-color-secondary: var(--color-secondary);
10
- --vd-color-success: var(--color-success);
11
- --vd-color-warning: var(--color-warning);
12
- --vd-color-error: var(--color-error);
13
- --vd-color-info: var(--color-info);
14
- --vd-color-white: var(--color-white);
15
- --vd-color-black: var(--color-black);
16
- --vd-color-primary-alpha-10: var(--color-primary-alpha-10);
17
- --vd-color-primary-alpha-20: var(--color-primary-alpha-20);
18
-
19
- /* Backgrounds + Text */
20
- --vd-bg-primary: var(--bg-primary);
21
- --vd-bg-secondary: var(--bg-secondary);
22
- --vd-bg-tertiary: var(--bg-tertiary);
23
- --vd-text-primary: var(--text-primary);
24
- --vd-text-secondary: var(--text-secondary);
25
- --vd-text-muted: var(--text-muted);
26
-
27
- /* Borders */
28
- --vd-border-color: var(--border-color);
29
- --vd-border-color-light: var(--border-color-light);
30
-
31
- /* Shadows */
32
- --vd-shadow-sm: var(--shadow-sm);
33
- --vd-shadow-md: var(--shadow-md);
34
- --vd-shadow-lg: var(--shadow-lg);
35
-
36
- /* Glass */
37
- --vd-glass-blur: var(--glass-blur, 12px);
38
- --vd-glass-saturate: var(--glass-saturate, 1.8);
39
- --vd-glass-bg-opacity: var(--glass-bg-opacity, 0.65);
40
- --vd-glass-bg-light: var(--glass-bg-light, rgba(255, 255, 255, var(--vd-glass-bg-opacity)));
41
- --vd-glass-bg-dark: var(--glass-bg-dark, rgba(30, 30, 30, var(--vd-glass-bg-opacity)));
42
- --vd-glass-border-alpha: var(--glass-border-alpha, 0.18);
43
- --vd-glass-border-light: var(--glass-border-light, rgba(255, 255, 255, var(--vd-glass-border-alpha)));
44
- --vd-glass-border-dark: var(--glass-border-dark, rgba(255, 255, 255, 0.08));
45
- --vd-glass-highlight-alpha: var(--glass-highlight-alpha, 0.25);
46
- --vd-glass-shadow: var(--glass-shadow, 0 8px 32px rgba(0, 0, 0, 0.12));
47
- --vd-glass-noise-opacity: var(--glass-noise-opacity, 0.03);
48
-
49
- /* Typography */
50
- --vd-font-family-base: var(--font-family-sans);
51
- --vd-font-family-mono: var(--font-family-mono);
52
- --vd-font-size-xs: var(--font-size-xs);
53
- --vd-font-size-sm: var(--font-size-sm);
54
- --vd-font-size-base: var(--font-size-base);
55
-
56
- /* Radii */
57
- --vd-btn-border-radius: var(--btn-border-radius);
58
- --vd-btn-border-radius-sm: var(--btn-border-radius-sm);
59
- --vd-btn-border-radius-lg: var(--btn-border-radius-lg);
60
- }