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.
- package/bin/templates/base/package.json +2 -2
- package/bin/templates/social/package.json +2 -2
- package/bin/templates/social/src/styles/global.css +56 -47
- package/dist/components/avatar/snice-avatar.d.ts +2 -2
- package/dist/components/avatar/snice-avatar.js +20 -21
- package/dist/components/avatar/snice-avatar.js.map +1 -1
- package/dist/components/calendar/snice-calendar.d.ts +8 -2
- package/dist/components/calendar/snice-calendar.js +160 -82
- package/dist/components/calendar/snice-calendar.js.map +1 -1
- package/dist/components/chart/snice-chart.js +50 -18
- package/dist/components/chart/snice-chart.js.map +1 -1
- package/dist/components/checkbox/snice-checkbox.d.ts +4 -1
- package/dist/components/checkbox/snice-checkbox.js +46 -17
- package/dist/components/checkbox/snice-checkbox.js.map +1 -1
- package/dist/components/code-block/highlighter.d.ts +5 -0
- package/dist/components/code-block/highlighter.js +137 -0
- package/dist/components/code-block/highlighter.js.map +1 -0
- package/dist/components/code-block/highlighters/highlight.d.ts +64 -0
- package/dist/components/code-block/highlighters/highlight.js +108 -0
- package/dist/components/code-block/highlighters/highlight.js.map +1 -0
- package/dist/components/code-block/highlighters/prism.d.ts +41 -0
- package/dist/components/code-block/highlighters/prism.js +73 -0
- package/dist/components/code-block/highlighters/prism.js.map +1 -0
- package/dist/components/code-block/snice-code-block.d.ts +19 -1
- package/dist/components/code-block/snice-code-block.js +128 -29
- package/dist/components/code-block/snice-code-block.js.map +1 -1
- package/dist/components/code-block/snice-code-block.types.d.ts +15 -1
- package/dist/components/color-picker/snice-color-picker.d.ts +1 -0
- package/dist/components/color-picker/snice-color-picker.js +17 -6
- package/dist/components/color-picker/snice-color-picker.js.map +1 -1
- package/dist/components/date-picker/snice-date-picker.d.ts +1 -0
- package/dist/components/date-picker/snice-date-picker.js +16 -5
- package/dist/components/date-picker/snice-date-picker.js.map +1 -1
- package/dist/components/doc/snice-doc.d.ts +27 -73
- package/dist/components/doc/snice-doc.js +385 -534
- package/dist/components/doc/snice-doc.js.map +1 -1
- package/dist/components/draw/snice-draw.d.ts +4 -0
- package/dist/components/draw/snice-draw.js +134 -14
- package/dist/components/draw/snice-draw.js.map +1 -1
- package/dist/components/draw/snice-draw.types.d.ts +5 -0
- package/dist/components/file-upload/snice-file-upload.js +1 -1
- package/dist/components/input/snice-input.d.ts +2 -0
- package/dist/components/input/snice-input.js +34 -9
- package/dist/components/input/snice-input.js.map +1 -1
- package/dist/components/kanban/snice-kanban.d.ts +13 -1
- package/dist/components/kanban/snice-kanban.js +191 -36
- package/dist/components/kanban/snice-kanban.js.map +1 -1
- package/dist/components/kanban/snice-kanban.types.d.ts +11 -1
- package/dist/components/kpi/snice-kpi.js +5 -1
- package/dist/components/kpi/snice-kpi.js.map +1 -1
- package/dist/components/layout/snice-layout-sidebar.js +1 -1
- package/dist/components/layout/snice-layout-sidebar.js.map +1 -1
- package/dist/components/layout/snice-layout.js +1 -1
- package/dist/components/layout/snice-layout.js.map +1 -1
- package/dist/components/location/snice-location.js +1 -1
- package/dist/components/location/snice-location.js.map +1 -1
- package/dist/components/radio/snice-radio.d.ts +1 -0
- package/dist/components/radio/snice-radio.js +17 -6
- package/dist/components/radio/snice-radio.js.map +1 -1
- package/dist/components/select/snice-select.d.ts +2 -0
- package/dist/components/select/snice-select.js +48 -19
- package/dist/components/select/snice-select.js.map +1 -1
- package/dist/components/slider/snice-slider.d.ts +2 -0
- package/dist/components/slider/snice-slider.js +34 -14
- package/dist/components/slider/snice-slider.js.map +1 -1
- package/dist/components/snice-cell-HZ2iIBIC.js +4 -0
- package/dist/components/snice-cell-HZ2iIBIC.js.map +1 -0
- package/dist/components/split-pane/snice-split-pane.js +1 -1
- package/dist/components/split-pane/snice-split-pane.js.map +1 -1
- package/dist/components/switch/snice-switch.d.ts +1 -0
- package/dist/components/switch/snice-switch.js +16 -6
- package/dist/components/switch/snice-switch.js.map +1 -1
- package/dist/components/table/snice-cell-actions.js +1 -1
- package/dist/components/table/snice-cell-actions.js.map +1 -1
- package/dist/components/table/snice-cell-boolean.js +1 -1
- package/dist/components/table/snice-cell-color.js +1 -1
- package/dist/components/table/snice-cell-color.js.map +1 -1
- package/dist/components/table/snice-cell-currency.js +1 -1
- package/dist/components/table/snice-cell-date.js +1 -1
- package/dist/components/table/snice-cell-duration.js +1 -1
- package/dist/components/table/snice-cell-email.js +1 -1
- package/dist/components/table/snice-cell-email.js.map +1 -1
- package/dist/components/table/snice-cell-filesize.js +1 -1
- package/dist/components/table/snice-cell-image.js +1 -1
- package/dist/components/table/snice-cell-image.js.map +1 -1
- package/dist/components/table/snice-cell-json.js +1 -1
- package/dist/components/table/snice-cell-json.js.map +1 -1
- package/dist/components/table/snice-cell-link.js +1 -1
- package/dist/components/table/snice-cell-link.js.map +1 -1
- package/dist/components/table/snice-cell-location.js +1 -1
- package/dist/components/table/snice-cell-location.js.map +1 -1
- package/dist/components/table/snice-cell-number.js +1 -1
- package/dist/components/table/snice-cell-percentage.js +1 -1
- package/dist/components/table/snice-cell-percentage.js.map +1 -1
- package/dist/components/table/snice-cell-phone.js +1 -1
- package/dist/components/table/snice-cell-phone.js.map +1 -1
- package/dist/components/table/snice-cell-progress.js +3 -3
- package/dist/components/table/snice-cell-progress.js.map +1 -1
- package/dist/components/table/snice-cell-rating.js +2 -2
- package/dist/components/table/snice-cell-rating.js.map +1 -1
- package/dist/components/table/snice-cell-sparkline.js +2 -2
- package/dist/components/table/snice-cell-sparkline.js.map +1 -1
- package/dist/components/table/snice-cell-status.js +1 -1
- package/dist/components/table/snice-cell-status.js.map +1 -1
- package/dist/components/table/snice-cell-tag.js +1 -1
- package/dist/components/table/snice-cell-tag.js.map +1 -1
- package/dist/components/table/snice-cell-text.js +1 -1
- package/dist/components/table/snice-cell.js +15 -10
- package/dist/components/table/snice-cell.js.map +1 -1
- package/dist/components/table/snice-header.js +1 -1
- package/dist/components/table/snice-header.js.map +1 -1
- package/dist/components/table/snice-row.js +2 -2
- package/dist/components/table/snice-row.js.map +1 -1
- package/dist/components/table/snice-table.d.ts +1 -0
- package/dist/components/table/snice-table.js +24 -4
- package/dist/components/table/snice-table.js.map +1 -1
- package/dist/components/terminal/snice-terminal.d.ts +40 -0
- package/dist/components/terminal/snice-terminal.js +371 -0
- package/dist/components/terminal/snice-terminal.js.map +1 -0
- package/dist/components/terminal/snice-terminal.types.d.ts +20 -24
- package/dist/components/textarea/snice-textarea.d.ts +2 -0
- package/dist/components/textarea/snice-textarea.js +25 -6
- package/dist/components/textarea/snice-textarea.js.map +1 -1
- package/dist/components/theme/theme.css +16 -0
- package/dist/components/tree/snice-tree-item.d.ts +18 -4
- package/dist/components/tree/snice-tree-item.js +271 -88
- package/dist/components/tree/snice-tree-item.js.map +1 -1
- package/dist/components/tree/snice-tree-item.types.d.ts +3 -0
- package/dist/components/tree/snice-tree.d.ts +18 -2
- package/dist/components/tree/snice-tree.js +422 -56
- package/dist/components/tree/snice-tree.js.map +1 -1
- package/dist/components/tree/snice-tree.types.d.ts +1 -0
- package/dist/components/virtual-scroller/snice-virtual-scroller.js +4 -2
- package/dist/components/virtual-scroller/snice-virtual-scroller.js.map +1 -1
- package/dist/index.cjs +42 -23
- package/dist/index.cjs.map +1 -1
- package/dist/index.esm.js +42 -23
- package/dist/index.esm.js.map +1 -1
- package/dist/index.iife.js +42 -23
- package/dist/index.iife.js.map +1 -1
- package/dist/render-tracker.d.ts +1 -0
- package/dist/symbols.cjs +13 -14
- package/dist/symbols.cjs.map +1 -1
- package/dist/symbols.esm.js +13 -14
- package/dist/symbols.esm.js.map +1 -1
- package/dist/template.d.ts +1 -0
- package/dist/transitions.cjs +1 -1
- package/dist/transitions.esm.js +1 -1
- package/docs/ai/api.md +37 -4
- package/docs/ai/components/doc.md +41 -106
- package/docs/ai/components/kanban.md +31 -9
- package/docs/ai/components/kpi.md +15 -0
- package/docs/components/doc.md +96 -212
- package/docs/components/kanban.md +119 -4
- package/docs/components/kpi.md +27 -0
- package/package.json +4 -1
- package/dist/components/actions/snice-actions.d.ts +0 -28
- package/dist/components/actions/snice-actions.js +0 -220
- package/dist/components/actions/snice-actions.js.map +0 -1
- package/dist/components/actions/snice-actions.types.d.ts +0 -27
- package/dist/components/doc/snice-doc.types.d.ts +0 -118
- package/dist/components/gantt/snice-gantt.d.ts +0 -29
- package/dist/components/gantt/snice-gantt.js +0 -268
- package/dist/components/gantt/snice-gantt.js.map +0 -1
- package/dist/components/gantt/snice-gantt.types.d.ts +0 -23
- package/dist/components/snice-cell-C0slgOpe.js +0 -4
- package/dist/components/snice-cell-C0slgOpe.js.map +0 -1
- package/dist/components/stat/snice-stat.d.ts +0 -14
- package/dist/components/stat/snice-stat.js +0 -140
- package/dist/components/stat/snice-stat.js.map +0 -1
- package/dist/components/stat/snice-stat.types.d.ts +0 -12
- package/docs/ai/components/actions.md +0 -81
- package/docs/ai/components/gantt.md +0 -95
- package/docs/ai/components/stat.md +0 -29
- package/docs/components/actions.md +0 -317
- package/docs/components/gantt.md +0 -347
- package/docs/components/stat.md +0 -45
package/dist/index.esm.js
CHANGED
|
@@ -1,28 +1,27 @@
|
|
|
1
1
|
/*!
|
|
2
|
-
* snice v3.
|
|
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
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
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
|
|
21
|
-
const snice =
|
|
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
|
-
|
|
709
|
-
const
|
|
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
|
-
|
|
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
|
-
|
|
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
|
|
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
|
-
|
|
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
|
-
|
|
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
|
/**
|