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
@@ -1,5 +1,5 @@
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.
@@ -9,23 +9,22 @@ var Snice = (function (exports) {
9
9
 
10
10
  // Global namespace for Snice framework
11
11
  // Ensures all registries and symbols are shared across different JS files/modules
12
- // Initialize or get the global Snice namespace
13
- function initGlobalNamespace() {
14
- if (!globalThis.snice) {
15
- globalThis.snice = {
16
- controllerRegistry: new Map(),
17
- controllerIdCounter: 0,
18
- symbols: new Map()
19
- };
20
- }
21
- return globalThis.snice;
12
+ // Initialize the global Snice namespace on globalThis
13
+ // This ensures all module instances share the same registry
14
+ if (!globalThis.snice) {
15
+ globalThis.snice = {
16
+ controllerRegistry: new Map(),
17
+ controllerIdCounter: 0,
18
+ symbols: new Map()
19
+ };
22
20
  }
23
- // Export the global namespace
24
- const snice = initGlobalNamespace();
21
+ // Export direct reference to globalThis.snice
22
+ const snice = globalThis.snice;
25
23
  // Helper function to get or create a global symbol
24
+ // Uses Symbol.for() to ensure symbols are shared across multiple Snice instances
26
25
  function getSymbol(name) {
27
26
  if (!snice.symbols.has(name)) {
28
- snice.symbols.set(name, Symbol(name));
27
+ snice.symbols.set(name, Symbol.for(`snice:${name}`));
29
28
  }
30
29
  return snice.symbols.get(name);
31
30
  }
@@ -708,8 +707,9 @@ var Snice = (function (exports) {
708
707
  * Provides html`` and css`` tagged template processors with differential rendering
709
708
  */
710
709
  // Unique symbols for type checking
711
- const HTML_RESULT = Symbol('html-result');
712
- const CSS_RESULT = Symbol('css-result');
710
+ // Use Symbol.for() to ensure symbols are shared across multiple Snice instances
711
+ const HTML_RESULT = Symbol.for('snice:html-result');
712
+ const CSS_RESULT = Symbol.for('snice:css-result');
713
713
  /**
714
714
  * Tagged template function for creating HTML templates
715
715
  *
@@ -778,10 +778,12 @@ var Snice = (function (exports) {
778
778
  /**
779
779
  * Nothing - represents no value (different from null/undefined)
780
780
  * Used to remove content from templates
781
+ * Use Symbol.for() to ensure symbols are shared across multiple Snice instances
781
782
  */
782
- const nothing = Symbol('nothing');
783
+ const nothing = Symbol.for('snice:nothing');
783
784
  // Unique symbol for unsafe HTML
784
- const UNSAFE_HTML = Symbol('unsafe-html');
785
+ // Use Symbol.for() to ensure symbols are shared across multiple Snice instances
786
+ const UNSAFE_HTML = Symbol.for('snice:unsafe-html');
785
787
  /**
786
788
  * Mark a string as raw HTML that should not be escaped
787
789
  * WARNING: Only use with sanitized content - using user input can lead to XSS!
@@ -1646,8 +1648,9 @@ var Snice = (function (exports) {
1646
1648
  context.addInitializer(function () {
1647
1649
  const constructor = this.constructor;
1648
1650
  // Only initialize once per class, not per instance
1649
- if (constructor[initKey])
1651
+ if (constructor[initKey]) {
1650
1652
  return;
1653
+ }
1651
1654
  constructor[initKey] = true;
1652
1655
  if (!constructor[ON_HANDLERS]) {
1653
1656
  constructor[ON_HANDLERS] = [];
@@ -1835,7 +1838,10 @@ var Snice = (function (exports) {
1835
1838
  // If element has shadow root, listen on both shadow root AND host element
1836
1839
  // to catch events from inside shadow DOM (with correct target) and on host itself
1837
1840
  const shadowRoot = targetElement.shadowRoot;
1838
- const handledSymbol = Symbol('snice-event-handled');
1841
+ // Use Symbol.for() with method name to ensure symbols are shared across Snice instances
1842
+ // Method names are unique within a class, so this prevents double-firing of the same handler
1843
+ // while allowing multiple different handlers on the same event
1844
+ const handledSymbol = Symbol.for(`snice:event-handled:${handler.methodName}`);
1839
1845
  const wrappedMethod = (event) => {
1840
1846
  // Prevent double-triggering when listening on both shadow root and host
1841
1847
  if (event[handledSymbol]) {
@@ -1942,7 +1948,12 @@ var Snice = (function (exports) {
1942
1948
  */
1943
1949
  function controller(name) {
1944
1950
  return function (constructor, _context) {
1945
- snice.controllerRegistry.set(name, constructor);
1951
+ // Access globalThis.snice directly to ensure consistency
1952
+ const registry = globalThis.snice?.controllerRegistry;
1953
+ if (!registry) {
1954
+ throw new Error('Snice global registry not initialized');
1955
+ }
1956
+ registry.set(name, constructor);
1946
1957
  // Mark as controller class for channel decorator detection
1947
1958
  constructor.prototype[IS_CONTROLLER_CLASS] = true;
1948
1959
  return constructor;
@@ -1970,8 +1981,15 @@ var Snice = (function (exports) {
1970
1981
  if (existingController) {
1971
1982
  await detachController(element);
1972
1983
  }
1973
- const ControllerClass = snice.controllerRegistry.get(controllerName);
1984
+ // Access globalThis.snice directly to ensure consistency
1985
+ const registry = globalThis.snice?.controllerRegistry;
1986
+ if (!registry) {
1987
+ throw new Error('Snice global registry not initialized');
1988
+ }
1989
+ const ControllerClass = registry.get(controllerName);
1974
1990
  if (!ControllerClass) {
1991
+ // Debug: log what's actually in the registry
1992
+ console.error(`Controller "${controllerName}" not found. Available:`, Array.from(registry.keys()));
1975
1993
  throw new Error(`Controller "${controllerName}" not found in registry`);
1976
1994
  }
1977
1995
  // Create controller instance with unique ID and scope
@@ -2341,7 +2359,8 @@ var Snice = (function (exports) {
2341
2359
 
2342
2360
  var _a, _b, _c;
2343
2361
  // Symbol for storing the Set of elements
2344
- const REGISTERED_ELEMENTS_SET = Symbol('registered-elements-set');
2362
+ // Use Symbol.for() to ensure symbols are shared across multiple Snice instances
2363
+ const REGISTERED_ELEMENTS_SET = Symbol.for('snice:registered-elements-set');
2345
2364
  // Counter for generating unique context IDs
2346
2365
  let contextIdCounter = 0;
2347
2366
  /**