snice 3.4.0 → 3.5.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 (177) hide show
  1. package/bin/templates/base/package.json +2 -2
  2. package/bin/templates/social/package.json +2 -2
  3. package/bin/templates/social/src/styles/global.css +56 -47
  4. package/dist/components/avatar/snice-avatar.d.ts +2 -2
  5. package/dist/components/avatar/snice-avatar.js +20 -21
  6. package/dist/components/avatar/snice-avatar.js.map +1 -1
  7. package/dist/components/calendar/snice-calendar.d.ts +8 -2
  8. package/dist/components/calendar/snice-calendar.js +160 -82
  9. package/dist/components/calendar/snice-calendar.js.map +1 -1
  10. package/dist/components/chart/snice-chart.js +50 -18
  11. package/dist/components/chart/snice-chart.js.map +1 -1
  12. package/dist/components/checkbox/snice-checkbox.d.ts +4 -1
  13. package/dist/components/checkbox/snice-checkbox.js +46 -17
  14. package/dist/components/checkbox/snice-checkbox.js.map +1 -1
  15. package/dist/components/code-block/highlighter.d.ts +5 -0
  16. package/dist/components/code-block/highlighter.js +137 -0
  17. package/dist/components/code-block/highlighter.js.map +1 -0
  18. package/dist/components/code-block/highlighters/highlight.d.ts +64 -0
  19. package/dist/components/code-block/highlighters/highlight.js +108 -0
  20. package/dist/components/code-block/highlighters/highlight.js.map +1 -0
  21. package/dist/components/code-block/highlighters/prism.d.ts +41 -0
  22. package/dist/components/code-block/highlighters/prism.js +73 -0
  23. package/dist/components/code-block/highlighters/prism.js.map +1 -0
  24. package/dist/components/code-block/snice-code-block.d.ts +19 -1
  25. package/dist/components/code-block/snice-code-block.js +128 -29
  26. package/dist/components/code-block/snice-code-block.js.map +1 -1
  27. package/dist/components/code-block/snice-code-block.types.d.ts +15 -1
  28. package/dist/components/color-picker/snice-color-picker.d.ts +1 -0
  29. package/dist/components/color-picker/snice-color-picker.js +17 -6
  30. package/dist/components/color-picker/snice-color-picker.js.map +1 -1
  31. package/dist/components/date-picker/snice-date-picker.d.ts +1 -0
  32. package/dist/components/date-picker/snice-date-picker.js +16 -5
  33. package/dist/components/date-picker/snice-date-picker.js.map +1 -1
  34. package/dist/components/doc/snice-doc.d.ts +27 -73
  35. package/dist/components/doc/snice-doc.js +385 -534
  36. package/dist/components/doc/snice-doc.js.map +1 -1
  37. package/dist/components/draw/snice-draw.d.ts +4 -0
  38. package/dist/components/draw/snice-draw.js +134 -14
  39. package/dist/components/draw/snice-draw.js.map +1 -1
  40. package/dist/components/draw/snice-draw.types.d.ts +5 -0
  41. package/dist/components/file-upload/snice-file-upload.js +1 -1
  42. package/dist/components/input/snice-input.d.ts +2 -0
  43. package/dist/components/input/snice-input.js +34 -9
  44. package/dist/components/input/snice-input.js.map +1 -1
  45. package/dist/components/kanban/snice-kanban.d.ts +13 -1
  46. package/dist/components/kanban/snice-kanban.js +191 -36
  47. package/dist/components/kanban/snice-kanban.js.map +1 -1
  48. package/dist/components/kanban/snice-kanban.types.d.ts +11 -1
  49. package/dist/components/kpi/snice-kpi.js +5 -1
  50. package/dist/components/kpi/snice-kpi.js.map +1 -1
  51. package/dist/components/layout/snice-layout-sidebar.js +1 -1
  52. package/dist/components/layout/snice-layout-sidebar.js.map +1 -1
  53. package/dist/components/layout/snice-layout.js +1 -1
  54. package/dist/components/layout/snice-layout.js.map +1 -1
  55. package/dist/components/location/snice-location.js +1 -1
  56. package/dist/components/location/snice-location.js.map +1 -1
  57. package/dist/components/radio/snice-radio.d.ts +1 -0
  58. package/dist/components/radio/snice-radio.js +17 -6
  59. package/dist/components/radio/snice-radio.js.map +1 -1
  60. package/dist/components/select/snice-select.d.ts +2 -0
  61. package/dist/components/select/snice-select.js +48 -19
  62. package/dist/components/select/snice-select.js.map +1 -1
  63. package/dist/components/slider/snice-slider.d.ts +2 -0
  64. package/dist/components/slider/snice-slider.js +34 -14
  65. package/dist/components/slider/snice-slider.js.map +1 -1
  66. package/dist/components/snice-cell-HZ2iIBIC.js +4 -0
  67. package/dist/components/snice-cell-HZ2iIBIC.js.map +1 -0
  68. package/dist/components/split-pane/snice-split-pane.js +1 -1
  69. package/dist/components/split-pane/snice-split-pane.js.map +1 -1
  70. package/dist/components/switch/snice-switch.d.ts +1 -0
  71. package/dist/components/switch/snice-switch.js +16 -6
  72. package/dist/components/switch/snice-switch.js.map +1 -1
  73. package/dist/components/table/snice-cell-actions.js +1 -1
  74. package/dist/components/table/snice-cell-actions.js.map +1 -1
  75. package/dist/components/table/snice-cell-boolean.js +1 -1
  76. package/dist/components/table/snice-cell-color.js +1 -1
  77. package/dist/components/table/snice-cell-color.js.map +1 -1
  78. package/dist/components/table/snice-cell-currency.js +1 -1
  79. package/dist/components/table/snice-cell-date.js +1 -1
  80. package/dist/components/table/snice-cell-duration.js +1 -1
  81. package/dist/components/table/snice-cell-email.js +1 -1
  82. package/dist/components/table/snice-cell-email.js.map +1 -1
  83. package/dist/components/table/snice-cell-filesize.js +1 -1
  84. package/dist/components/table/snice-cell-image.js +1 -1
  85. package/dist/components/table/snice-cell-image.js.map +1 -1
  86. package/dist/components/table/snice-cell-json.js +1 -1
  87. package/dist/components/table/snice-cell-json.js.map +1 -1
  88. package/dist/components/table/snice-cell-link.js +1 -1
  89. package/dist/components/table/snice-cell-link.js.map +1 -1
  90. package/dist/components/table/snice-cell-location.js +1 -1
  91. package/dist/components/table/snice-cell-location.js.map +1 -1
  92. package/dist/components/table/snice-cell-number.js +1 -1
  93. package/dist/components/table/snice-cell-percentage.js +1 -1
  94. package/dist/components/table/snice-cell-percentage.js.map +1 -1
  95. package/dist/components/table/snice-cell-phone.js +1 -1
  96. package/dist/components/table/snice-cell-phone.js.map +1 -1
  97. package/dist/components/table/snice-cell-progress.js +3 -3
  98. package/dist/components/table/snice-cell-progress.js.map +1 -1
  99. package/dist/components/table/snice-cell-rating.js +2 -2
  100. package/dist/components/table/snice-cell-rating.js.map +1 -1
  101. package/dist/components/table/snice-cell-sparkline.js +2 -2
  102. package/dist/components/table/snice-cell-sparkline.js.map +1 -1
  103. package/dist/components/table/snice-cell-status.js +1 -1
  104. package/dist/components/table/snice-cell-status.js.map +1 -1
  105. package/dist/components/table/snice-cell-tag.js +1 -1
  106. package/dist/components/table/snice-cell-tag.js.map +1 -1
  107. package/dist/components/table/snice-cell-text.js +1 -1
  108. package/dist/components/table/snice-cell.js +15 -10
  109. package/dist/components/table/snice-cell.js.map +1 -1
  110. package/dist/components/table/snice-header.js +1 -1
  111. package/dist/components/table/snice-header.js.map +1 -1
  112. package/dist/components/table/snice-row.js +2 -2
  113. package/dist/components/table/snice-row.js.map +1 -1
  114. package/dist/components/table/snice-table.d.ts +1 -0
  115. package/dist/components/table/snice-table.js +24 -4
  116. package/dist/components/table/snice-table.js.map +1 -1
  117. package/dist/components/terminal/snice-terminal.d.ts +40 -0
  118. package/dist/components/terminal/snice-terminal.js +371 -0
  119. package/dist/components/terminal/snice-terminal.js.map +1 -0
  120. package/dist/components/terminal/snice-terminal.types.d.ts +20 -24
  121. package/dist/components/textarea/snice-textarea.d.ts +2 -0
  122. package/dist/components/textarea/snice-textarea.js +25 -6
  123. package/dist/components/textarea/snice-textarea.js.map +1 -1
  124. package/dist/components/theme/theme.css +16 -0
  125. package/dist/components/tree/snice-tree-item.d.ts +18 -4
  126. package/dist/components/tree/snice-tree-item.js +271 -88
  127. package/dist/components/tree/snice-tree-item.js.map +1 -1
  128. package/dist/components/tree/snice-tree-item.types.d.ts +3 -0
  129. package/dist/components/tree/snice-tree.d.ts +18 -2
  130. package/dist/components/tree/snice-tree.js +422 -56
  131. package/dist/components/tree/snice-tree.js.map +1 -1
  132. package/dist/components/tree/snice-tree.types.d.ts +1 -0
  133. package/dist/components/virtual-scroller/snice-virtual-scroller.js +4 -2
  134. package/dist/components/virtual-scroller/snice-virtual-scroller.js.map +1 -1
  135. package/dist/index.cjs +42 -23
  136. package/dist/index.cjs.map +1 -1
  137. package/dist/index.esm.js +42 -23
  138. package/dist/index.esm.js.map +1 -1
  139. package/dist/index.iife.js +42 -23
  140. package/dist/index.iife.js.map +1 -1
  141. package/dist/render-tracker.d.ts +1 -0
  142. package/dist/symbols.cjs +13 -14
  143. package/dist/symbols.cjs.map +1 -1
  144. package/dist/symbols.esm.js +13 -14
  145. package/dist/symbols.esm.js.map +1 -1
  146. package/dist/template.d.ts +1 -0
  147. package/dist/transitions.cjs +1 -1
  148. package/dist/transitions.esm.js +1 -1
  149. package/docs/ai/api.md +37 -4
  150. package/docs/ai/components/doc.md +41 -106
  151. package/docs/ai/components/kanban.md +31 -9
  152. package/docs/ai/components/kpi.md +15 -0
  153. package/docs/components/doc.md +96 -212
  154. package/docs/components/kanban.md +119 -4
  155. package/docs/components/kpi.md +27 -0
  156. package/package.json +4 -1
  157. package/dist/components/actions/snice-actions.d.ts +0 -28
  158. package/dist/components/actions/snice-actions.js +0 -220
  159. package/dist/components/actions/snice-actions.js.map +0 -1
  160. package/dist/components/actions/snice-actions.types.d.ts +0 -27
  161. package/dist/components/doc/snice-doc.types.d.ts +0 -118
  162. package/dist/components/gantt/snice-gantt.d.ts +0 -29
  163. package/dist/components/gantt/snice-gantt.js +0 -268
  164. package/dist/components/gantt/snice-gantt.js.map +0 -1
  165. package/dist/components/gantt/snice-gantt.types.d.ts +0 -23
  166. package/dist/components/snice-cell-C0slgOpe.js +0 -4
  167. package/dist/components/snice-cell-C0slgOpe.js.map +0 -1
  168. package/dist/components/stat/snice-stat.d.ts +0 -14
  169. package/dist/components/stat/snice-stat.js +0 -140
  170. package/dist/components/stat/snice-stat.js.map +0 -1
  171. package/dist/components/stat/snice-stat.types.d.ts +0 -12
  172. package/docs/ai/components/actions.md +0 -81
  173. package/docs/ai/components/gantt.md +0 -95
  174. package/docs/ai/components/stat.md +0 -29
  175. package/docs/components/actions.md +0 -317
  176. package/docs/components/gantt.md +0 -347
  177. package/docs/components/stat.md +0 -45
package/dist/index.esm.js CHANGED
@@ -1,28 +1,27 @@
1
1
  /*!
2
- * snice v3.3.1
2
+ * snice v3.4.1
3
3
  * Imperative TypeScript framework for building vanilla web components with decorators, differential rendering, routing, and controllers. No virtual DOM, no build complexity.
4
4
  * (c) 2024
5
5
  * Released under the MIT License.
6
6
  */
7
7
  // Global namespace for Snice framework
8
8
  // Ensures all registries and symbols are shared across different JS files/modules
9
- // Initialize or get the global Snice namespace
10
- function initGlobalNamespace() {
11
- if (!globalThis.snice) {
12
- globalThis.snice = {
13
- controllerRegistry: new Map(),
14
- controllerIdCounter: 0,
15
- symbols: new Map()
16
- };
17
- }
18
- return globalThis.snice;
9
+ // Initialize the global Snice namespace on globalThis
10
+ // This ensures all module instances share the same registry
11
+ if (!globalThis.snice) {
12
+ globalThis.snice = {
13
+ controllerRegistry: new Map(),
14
+ controllerIdCounter: 0,
15
+ symbols: new Map()
16
+ };
19
17
  }
20
- // Export the global namespace
21
- const snice = initGlobalNamespace();
18
+ // Export direct reference to globalThis.snice
19
+ const snice = globalThis.snice;
22
20
  // Helper function to get or create a global symbol
21
+ // Uses Symbol.for() to ensure symbols are shared across multiple Snice instances
23
22
  function getSymbol(name) {
24
23
  if (!snice.symbols.has(name)) {
25
- snice.symbols.set(name, Symbol(name));
24
+ snice.symbols.set(name, Symbol.for(`snice:${name}`));
26
25
  }
27
26
  return snice.symbols.get(name);
28
27
  }
@@ -705,8 +704,9 @@ function cleanupResponseHandlers(instance) {
705
704
  * Provides html`` and css`` tagged template processors with differential rendering
706
705
  */
707
706
  // Unique symbols for type checking
708
- const HTML_RESULT = Symbol('html-result');
709
- const CSS_RESULT = Symbol('css-result');
707
+ // Use Symbol.for() to ensure symbols are shared across multiple Snice instances
708
+ const HTML_RESULT = Symbol.for('snice:html-result');
709
+ const CSS_RESULT = Symbol.for('snice:css-result');
710
710
  /**
711
711
  * Tagged template function for creating HTML templates
712
712
  *
@@ -775,10 +775,12 @@ function isCSSResult(value) {
775
775
  /**
776
776
  * Nothing - represents no value (different from null/undefined)
777
777
  * Used to remove content from templates
778
+ * Use Symbol.for() to ensure symbols are shared across multiple Snice instances
778
779
  */
779
- const nothing = Symbol('nothing');
780
+ const nothing = Symbol.for('snice:nothing');
780
781
  // Unique symbol for unsafe HTML
781
- const UNSAFE_HTML = Symbol('unsafe-html');
782
+ // Use Symbol.for() to ensure symbols are shared across multiple Snice instances
783
+ const UNSAFE_HTML = Symbol.for('snice:unsafe-html');
782
784
  /**
783
785
  * Mark a string as raw HTML that should not be escaped
784
786
  * WARNING: Only use with sanitized content - using user input can lead to XSS!
@@ -1643,8 +1645,9 @@ function on(eventName, selectorOrOptions, options) {
1643
1645
  context.addInitializer(function () {
1644
1646
  const constructor = this.constructor;
1645
1647
  // Only initialize once per class, not per instance
1646
- if (constructor[initKey])
1648
+ if (constructor[initKey]) {
1647
1649
  return;
1650
+ }
1648
1651
  constructor[initKey] = true;
1649
1652
  if (!constructor[ON_HANDLERS]) {
1650
1653
  constructor[ON_HANDLERS] = [];
@@ -1832,7 +1835,10 @@ function setupEventHandlers(instance, targetElement) {
1832
1835
  // If element has shadow root, listen on both shadow root AND host element
1833
1836
  // to catch events from inside shadow DOM (with correct target) and on host itself
1834
1837
  const shadowRoot = targetElement.shadowRoot;
1835
- const handledSymbol = Symbol('snice-event-handled');
1838
+ // Use Symbol.for() with method name to ensure symbols are shared across Snice instances
1839
+ // Method names are unique within a class, so this prevents double-firing of the same handler
1840
+ // while allowing multiple different handlers on the same event
1841
+ const handledSymbol = Symbol.for(`snice:event-handled:${handler.methodName}`);
1836
1842
  const wrappedMethod = (event) => {
1837
1843
  // Prevent double-triggering when listening on both shadow root and host
1838
1844
  if (event[handledSymbol]) {
@@ -1939,7 +1945,12 @@ class ControllerScope {
1939
1945
  */
1940
1946
  function controller(name) {
1941
1947
  return function (constructor, _context) {
1942
- snice.controllerRegistry.set(name, constructor);
1948
+ // Access globalThis.snice directly to ensure consistency
1949
+ const registry = globalThis.snice?.controllerRegistry;
1950
+ if (!registry) {
1951
+ throw new Error('Snice global registry not initialized');
1952
+ }
1953
+ registry.set(name, constructor);
1943
1954
  // Mark as controller class for channel decorator detection
1944
1955
  constructor.prototype[IS_CONTROLLER_CLASS] = true;
1945
1956
  return constructor;
@@ -1967,8 +1978,15 @@ async function attachController(element, controllerName) {
1967
1978
  if (existingController) {
1968
1979
  await detachController(element);
1969
1980
  }
1970
- const ControllerClass = snice.controllerRegistry.get(controllerName);
1981
+ // Access globalThis.snice directly to ensure consistency
1982
+ const registry = globalThis.snice?.controllerRegistry;
1983
+ if (!registry) {
1984
+ throw new Error('Snice global registry not initialized');
1985
+ }
1986
+ const ControllerClass = registry.get(controllerName);
1971
1987
  if (!ControllerClass) {
1988
+ // Debug: log what's actually in the registry
1989
+ console.error(`Controller "${controllerName}" not found. Available:`, Array.from(registry.keys()));
1972
1990
  throw new Error(`Controller "${controllerName}" not found in registry`);
1973
1991
  }
1974
1992
  // Create controller instance with unique ID and scope
@@ -2338,7 +2356,8 @@ class SimpleArray {
2338
2356
 
2339
2357
  var _a, _b, _c;
2340
2358
  // Symbol for storing the Set of elements
2341
- const REGISTERED_ELEMENTS_SET = Symbol('registered-elements-set');
2359
+ // Use Symbol.for() to ensure symbols are shared across multiple Snice instances
2360
+ const REGISTERED_ELEMENTS_SET = Symbol.for('snice:registered-elements-set');
2342
2361
  // Counter for generating unique context IDs
2343
2362
  let contextIdCounter = 0;
2344
2363
  /**