snice 2.2.2 → 2.3.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 (141) hide show
  1. package/README.md +17 -10
  2. package/dist/components/accordion/snice-accordion-item.js +3 -3
  3. package/dist/components/accordion/snice-accordion-item.js.map +1 -1
  4. package/dist/components/accordion/snice-accordion.js +1 -1
  5. package/dist/components/accordion/snice-accordion.js.map +1 -1
  6. package/dist/components/alert/snice-alert.js +5 -5
  7. package/dist/components/alert/snice-alert.js.map +1 -1
  8. package/dist/components/avatar/snice-avatar.js +7 -7
  9. package/dist/components/avatar/snice-avatar.js.map +1 -1
  10. package/dist/components/badge/snice-badge.js +10 -10
  11. package/dist/components/badge/snice-badge.js.map +1 -1
  12. package/dist/components/breadcrumbs/snice-breadcrumbs.js +3 -3
  13. package/dist/components/breadcrumbs/snice-breadcrumbs.js.map +1 -1
  14. package/dist/components/breadcrumbs/snice-crumb.js +5 -5
  15. package/dist/components/breadcrumbs/snice-crumb.js.map +1 -1
  16. package/dist/components/button/snice-button.js +12 -12
  17. package/dist/components/button/snice-button.js.map +1 -1
  18. package/dist/components/card/snice-card.js +5 -5
  19. package/dist/components/card/snice-card.js.map +1 -1
  20. package/dist/components/checkbox/snice-checkbox.js +9 -9
  21. package/dist/components/checkbox/snice-checkbox.js.map +1 -1
  22. package/dist/components/chip/snice-chip.js +8 -8
  23. package/dist/components/chip/snice-chip.js.map +1 -1
  24. package/dist/components/date-picker/snice-date-picker.js +18 -18
  25. package/dist/components/date-picker/snice-date-picker.js.map +1 -1
  26. package/dist/components/divider/snice-divider.js +8 -8
  27. package/dist/components/divider/snice-divider.js.map +1 -1
  28. package/dist/components/drawer/snice-drawer.js +9 -9
  29. package/dist/components/drawer/snice-drawer.js.map +1 -1
  30. package/dist/components/input/snice-input.js +24 -24
  31. package/dist/components/input/snice-input.js.map +1 -1
  32. package/dist/components/layout/snice-layout-card.js +2 -2
  33. package/dist/components/layout/snice-layout-card.js.map +1 -1
  34. package/dist/components/layout/snice-layout-centered.js +1 -1
  35. package/dist/components/layout/snice-layout-centered.js.map +1 -1
  36. package/dist/components/layout/snice-layout-fullscreen.js +1 -1
  37. package/dist/components/layout/snice-layout-fullscreen.js.map +1 -1
  38. package/dist/components/layout/snice-layout-sidebar.js +1 -1
  39. package/dist/components/layout/snice-layout-sidebar.js.map +1 -1
  40. package/dist/components/layout/snice-layout-split.js +2 -2
  41. package/dist/components/layout/snice-layout-split.js.map +1 -1
  42. package/dist/components/login/snice-login.js +8 -8
  43. package/dist/components/login/snice-login.js.map +1 -1
  44. package/dist/components/modal/snice-modal.js +7 -7
  45. package/dist/components/modal/snice-modal.js.map +1 -1
  46. package/dist/components/pagination/snice-pagination.js +9 -9
  47. package/dist/components/pagination/snice-pagination.js.map +1 -1
  48. package/dist/components/progress/snice-progress.js +11 -11
  49. package/dist/components/progress/snice-progress.js.map +1 -1
  50. package/dist/components/radio/snice-radio.js +8 -8
  51. package/dist/components/radio/snice-radio.js.map +1 -1
  52. package/dist/components/select/snice-option.js +5 -5
  53. package/dist/components/select/snice-option.js.map +1 -1
  54. package/dist/components/select/snice-select.js +14 -14
  55. package/dist/components/select/snice-select.js.map +1 -1
  56. package/dist/components/skeleton/snice-skeleton.js +6 -6
  57. package/dist/components/skeleton/snice-skeleton.js.map +1 -1
  58. package/dist/components/switch/snice-switch.js +10 -10
  59. package/dist/components/switch/snice-switch.js.map +1 -1
  60. package/dist/components/table/snice-cell-boolean.js +8 -8
  61. package/dist/components/table/snice-cell-boolean.js.map +1 -1
  62. package/dist/components/table/snice-cell-date.js +8 -8
  63. package/dist/components/table/snice-cell-date.js.map +1 -1
  64. package/dist/components/table/snice-cell-duration.js +3 -3
  65. package/dist/components/table/snice-cell-duration.js.map +1 -1
  66. package/dist/components/table/snice-cell-filesize.js +3 -3
  67. package/dist/components/table/snice-cell-filesize.js.map +1 -1
  68. package/dist/components/table/snice-cell-number.js +9 -9
  69. package/dist/components/table/snice-cell-number.js.map +1 -1
  70. package/dist/components/table/snice-cell-progress.js +3 -3
  71. package/dist/components/table/snice-cell-progress.js.map +1 -1
  72. package/dist/components/table/snice-cell-rating.js +3 -3
  73. package/dist/components/table/snice-cell-rating.js.map +1 -1
  74. package/dist/components/table/snice-cell-sparkline.js +13 -13
  75. package/dist/components/table/snice-cell-sparkline.js.map +1 -1
  76. package/dist/components/table/snice-cell-text.js +4 -4
  77. package/dist/components/table/snice-cell-text.js.map +1 -1
  78. package/dist/components/table/snice-cell.js +2 -2
  79. package/dist/components/table/snice-cell.js.map +1 -1
  80. package/dist/components/table/snice-column.js +10 -10
  81. package/dist/components/table/snice-column.js.map +1 -1
  82. package/dist/components/table/snice-header.js +5 -5
  83. package/dist/components/table/snice-header.js.map +1 -1
  84. package/dist/components/table/snice-row.js +5 -5
  85. package/dist/components/table/snice-row.js.map +1 -1
  86. package/dist/components/table/snice-table.js +7 -7
  87. package/dist/components/table/snice-table.js.map +1 -1
  88. package/dist/components/tabs/snice-tab-panel.js +5 -5
  89. package/dist/components/tabs/snice-tab-panel.js.map +1 -1
  90. package/dist/components/tabs/snice-tab.js +2 -2
  91. package/dist/components/tabs/snice-tab.js.map +1 -1
  92. package/dist/components/tabs/snice-tabs.js +4 -4
  93. package/dist/components/tabs/snice-tabs.js.map +1 -1
  94. package/dist/components/toast/snice-toast-container.js +1 -1
  95. package/dist/components/toast/snice-toast-container.js.map +1 -1
  96. package/dist/components/toast/snice-toast.js +4 -4
  97. package/dist/components/toast/snice-toast.js.map +1 -1
  98. package/dist/components/tooltip/snice-tooltip.js +11 -11
  99. package/dist/components/tooltip/snice-tooltip.js.map +1 -1
  100. package/dist/index.cjs +268 -215
  101. package/dist/index.cjs.map +1 -1
  102. package/dist/index.esm.js +268 -215
  103. package/dist/index.esm.js.map +1 -1
  104. package/dist/index.iife.js +268 -215
  105. package/dist/index.iife.js.map +1 -1
  106. package/dist/symbols.cjs.map +1 -1
  107. package/dist/symbols.esm.js +1 -1
  108. package/dist/symbols.esm.js.map +1 -1
  109. package/dist/transitions.cjs.map +1 -1
  110. package/dist/transitions.esm.js +1 -1
  111. package/dist/transitions.esm.js.map +1 -1
  112. package/dist/types/controller.d.ts +1 -7
  113. package/dist/types/element.d.ts +3 -44
  114. package/dist/types/events.d.ts +2 -26
  115. package/dist/types/global.d.ts +1 -5
  116. package/dist/types/index.d.ts +2 -8
  117. package/dist/types/observe.d.ts +1 -16
  118. package/dist/types/request-response.d.ts +2 -28
  119. package/dist/types/router.d.ts +2 -81
  120. package/dist/types/testing.d.ts +4 -0
  121. package/dist/types/transitions.d.ts +2 -30
  122. package/dist/types/types/DispatchOptions.d.ts +10 -0
  123. package/dist/types/types/IController.d.ts +8 -0
  124. package/dist/types/types/ObserveOptions.d.ts +16 -0
  125. package/dist/types/types/OnOptions.d.ts +16 -0
  126. package/dist/types/types/PageOptions.d.ts +30 -0
  127. package/dist/types/types/PartOptions.d.ts +4 -0
  128. package/dist/types/types/PropertyConverter.d.ts +4 -0
  129. package/dist/types/types/PropertyOptions.d.ts +8 -0
  130. package/dist/types/types/QueryOptions.d.ts +4 -0
  131. package/dist/types/types/RequestOptions.d.ts +18 -0
  132. package/dist/types/types/RespondOptions.d.ts +10 -0
  133. package/dist/types/types/RouterInstance.d.ts +10 -0
  134. package/dist/types/types/RouterOptions.d.ts +32 -0
  135. package/dist/types/types/SimpleArray.d.ts +17 -0
  136. package/dist/types/types/SniceElement.d.ts +8 -0
  137. package/dist/types/types/SniceGlobal.d.ts +5 -0
  138. package/dist/types/types/Transition.d.ts +33 -0
  139. package/dist/types/types/index.d.ts +17 -0
  140. package/dist/types/utils.d.ts +24 -0
  141. package/package.json +6 -3
@@ -0,0 +1,33 @@
1
+ /**
2
+ * Generic transition system for animating between elements
3
+ */
4
+ export interface Transition {
5
+ /**
6
+ * Name of the transition (for identification)
7
+ */
8
+ name?: string;
9
+ /**
10
+ * Duration of the out transition in ms
11
+ */
12
+ outDuration?: number;
13
+ /**
14
+ * Duration of the in transition in ms
15
+ */
16
+ inDuration?: number;
17
+ /**
18
+ * CSS properties for the out transition (as string)
19
+ * Example: 'opacity: 0; transform: scale(0.9)'
20
+ */
21
+ out?: string;
22
+ /**
23
+ * CSS properties for the in transition (as string)
24
+ * Example: 'opacity: 1; transform: scale(1)'
25
+ */
26
+ in?: string;
27
+ /**
28
+ * Transition mode:
29
+ * - 'sequential': out transition completes before in transition starts
30
+ * - 'simultaneous': both transitions happen at the same time
31
+ */
32
+ mode?: 'sequential' | 'simultaneous';
33
+ }
@@ -0,0 +1,17 @@
1
+ export * from './QueryOptions';
2
+ export * from './PropertyOptions';
3
+ export * from './PropertyConverter';
4
+ export * from './SniceElement';
5
+ export * from './PartOptions';
6
+ export * from './SimpleArray';
7
+ export * from './RouterOptions';
8
+ export * from './PageOptions';
9
+ export * from './RouterInstance';
10
+ export * from './OnOptions';
11
+ export * from './DispatchOptions';
12
+ export * from './IController';
13
+ export * from './Transition';
14
+ export * from './ObserveOptions';
15
+ export * from './RequestOptions';
16
+ export * from './RespondOptions';
17
+ export * from './SniceGlobal';
@@ -0,0 +1,24 @@
1
+ import { PropertyOptions } from './types';
2
+ /**
3
+ * Detects the type constructor from an initial value
4
+ * @param initialValue - The default value assigned to a property field (e.g., `name = "default"` -> "default")
5
+ * @returns The constructor function (String, Number, Boolean, etc.) or undefined if type can't be determined
6
+ */
7
+ export declare function detectType(initialValue: any): any;
8
+ /**
9
+ * Parses an attribute value based on the property type
10
+ * @param attributeValue - The raw string value from the HTML attribute (e.g., "123", "true", "hello")
11
+ * @param propertyOptions - The options from @property decorator (contains explicit type, attribute name, etc.)
12
+ * @param currentValue - The current stored value of the property (used for type inference when no explicit type)
13
+ * @param initialValue - The default value assigned to the property field (used for type detection as fallback)
14
+ * @returns The parsed value in the correct JavaScript type
15
+ */
16
+ export declare function parseAttributeValue(attributeValue: string | null, propertyOptions: PropertyOptions, currentValue?: any, initialValue?: any): any;
17
+ /**
18
+ * Converts a property value to its attribute string representation
19
+ * @param value - The property value to convert
20
+ * @param propertyOptions - The options from @property decorator
21
+ * @param initialValue - The default value assigned to the property field (used for type detection)
22
+ * @returns The string representation for the HTML attribute, or null if value should remove attribute
23
+ */
24
+ export declare function valueToAttribute(value: any, propertyOptions: PropertyOptions, initialValue?: any): string | null;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "snice",
3
- "version": "2.2.2",
3
+ "version": "2.3.0",
4
4
  "type": "module",
5
5
  "description": "Imperative TypeScript framework for building vanilla web components with decorators, routing, and controllers. No virtual DOM, no build complexity.",
6
6
  "main": "dist/index.cjs",
@@ -78,13 +78,16 @@
78
78
  "dev": "vite",
79
79
  "build": "rm -rf dist && rollup -c && npm run build:types",
80
80
  "build:types": "tsc --project components/tsconfig.json --emitDeclarationOnly",
81
+ "build:test": "rollup -c rollup.config.test.js",
81
82
  "preview": "vite preview",
82
83
  "test": "vitest run",
83
84
  "test:watch": "vitest",
84
85
  "test:ui": "vitest --ui",
85
86
  "test:coverage": "vitest --coverage",
86
- "test:publish": "vitest run tests/package-integrity.test.ts tests/publish-validation.test.ts",
87
- "prerelease": "npm run build && npm run test:publish",
87
+ "test:src": "vitest run",
88
+ "test:built": "npm run build:test && TEST_BUILT=true vitest run",
89
+ "test:all": "npm run test:src && npm run test:built",
90
+ "prerelease": "npm run build",
88
91
  "release": "semantic-release --no-ci",
89
92
  "release:dry": "semantic-release --dry-run --no-ci"
90
93
  },