@marianmeres/stuic 2.66.0 → 3.0.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 (171) hide show
  1. package/README.md +292 -4
  2. package/dist/README.md +41 -18
  3. package/dist/actions/popover/README.md +19 -0
  4. package/dist/actions/popover/index.css +6 -9
  5. package/dist/actions/popover/popover.svelte.js +2 -2
  6. package/dist/actions/tooltip/README.md +18 -0
  7. package/dist/actions/tooltip/index.css +5 -8
  8. package/dist/actions/tooltip/tooltip.svelte.js +1 -1
  9. package/dist/components/AlertConfirmPrompt/AlertConfirmPrompt.svelte +9 -10
  10. package/dist/components/AlertConfirmPrompt/AlertConfirmPrompt.svelte.d.ts +3 -3
  11. package/dist/components/AlertConfirmPrompt/Current.svelte +15 -17
  12. package/dist/components/AlertConfirmPrompt/Current.svelte.d.ts +5 -3
  13. package/dist/components/AlertConfirmPrompt/acp-icons.js +5 -4
  14. package/dist/components/AlertConfirmPrompt/index.css +62 -0
  15. package/dist/components/AssetsPreview/AssetsPreview.svelte +92 -73
  16. package/dist/components/AssetsPreview/AssetsPreview.svelte.d.ts +1 -0
  17. package/dist/components/AssetsPreview/index.css +59 -0
  18. package/dist/components/Avatar/Avatar.svelte +32 -18
  19. package/dist/components/Avatar/Avatar.svelte.d.ts +1 -0
  20. package/dist/components/Avatar/README.md +166 -0
  21. package/dist/components/Avatar/index.css +128 -0
  22. package/dist/components/Backdrop/Backdrop.svelte +8 -2
  23. package/dist/components/Backdrop/Backdrop.svelte.d.ts +1 -0
  24. package/dist/components/Backdrop/README.md +71 -6
  25. package/dist/components/Backdrop/index.css +29 -0
  26. package/dist/components/Button/Button.svelte +117 -124
  27. package/dist/components/Button/Button.svelte.d.ts +35 -23
  28. package/dist/components/Button/README.md +87 -21
  29. package/dist/components/Button/index.css +473 -9
  30. package/dist/components/Button/index.d.ts +1 -1
  31. package/dist/components/Button/index.js +1 -1
  32. package/dist/components/ButtonGroupRadio/ButtonGroupRadio.svelte +7 -38
  33. package/dist/components/ButtonGroupRadio/README.md +82 -4
  34. package/dist/components/ButtonGroupRadio/index.css +152 -14
  35. package/dist/components/Collapsible/Collapsible.svelte +7 -7
  36. package/dist/components/Collapsible/Collapsible.svelte.d.ts +2 -2
  37. package/dist/components/Collapsible/README.md +34 -2
  38. package/dist/components/Collapsible/index.css +38 -0
  39. package/dist/components/CommandMenu/CommandMenu.svelte +13 -24
  40. package/dist/components/CommandMenu/README.md +39 -0
  41. package/dist/components/CommandMenu/index.css +45 -2
  42. package/dist/components/DismissibleMessage/DismissibleMessage.svelte +53 -50
  43. package/dist/components/DismissibleMessage/DismissibleMessage.svelte.d.ts +6 -5
  44. package/dist/components/DismissibleMessage/README.md +93 -11
  45. package/dist/components/DismissibleMessage/index.css +122 -8
  46. package/dist/components/DismissibleMessage/index.d.ts +1 -1
  47. package/dist/components/DropdownMenu/DropdownMenu.svelte +14 -50
  48. package/dist/components/DropdownMenu/DropdownMenu.svelte.d.ts +6 -6
  49. package/dist/components/DropdownMenu/README.md +132 -0
  50. package/dist/components/DropdownMenu/index.css +231 -27
  51. package/dist/components/Input/FieldAssets.svelte +8 -5
  52. package/dist/components/Input/FieldCheckbox.svelte +7 -44
  53. package/dist/components/Input/FieldFile.svelte +1 -6
  54. package/dist/components/Input/FieldInput.svelte +1 -1
  55. package/dist/components/Input/FieldOptions.svelte +41 -38
  56. package/dist/components/Input/FieldRadios.svelte +7 -16
  57. package/dist/components/Input/FieldSelect.svelte +1 -1
  58. package/dist/components/Input/FieldSwitch.svelte +1 -5
  59. package/dist/components/Input/FieldTextarea.svelte +1 -1
  60. package/dist/components/Input/README.md +194 -0
  61. package/dist/components/Input/_internal/FieldRadioInternal.svelte +2 -40
  62. package/dist/components/Input/_internal/InputWrap.svelte +8 -48
  63. package/dist/components/Input/index.css +522 -127
  64. package/dist/components/ListItemButton/ListItemButton.svelte +37 -73
  65. package/dist/components/ListItemButton/ListItemButton.svelte.d.ts +1 -9
  66. package/dist/components/ListItemButton/README.md +100 -45
  67. package/dist/components/ListItemButton/index.css +175 -56
  68. package/dist/components/ListItemButton/index.d.ts +1 -1
  69. package/dist/components/ListItemButton/index.js +1 -1
  70. package/dist/components/Modal/Modal.svelte +2 -8
  71. package/dist/components/Modal/Modal.svelte.d.ts +1 -0
  72. package/dist/components/Modal/README.md +29 -0
  73. package/dist/components/Modal/index.css +36 -0
  74. package/dist/components/ModalDialog/ModalDialog.svelte +2 -21
  75. package/dist/components/ModalDialog/README.md +35 -0
  76. package/dist/components/ModalDialog/index.css +57 -0
  77. package/dist/components/Notifications/Notifications.svelte +44 -128
  78. package/dist/components/Notifications/Notifications.svelte.d.ts +9 -17
  79. package/dist/components/Notifications/README.md +186 -70
  80. package/dist/components/Notifications/index.css +212 -15
  81. package/dist/components/Progress/README.md +15 -0
  82. package/dist/components/Progress/_internal/Bar.svelte +2 -2
  83. package/dist/components/Progress/index.css +4 -4
  84. package/dist/components/Skeleton/Skeleton.svelte +3 -2
  85. package/dist/components/Skeleton/index.css +11 -14
  86. package/dist/components/Spinner/Spinner.svelte +2 -2
  87. package/dist/components/Spinner/SpinnerCircle.svelte +1 -1
  88. package/dist/components/Switch/README.md +15 -0
  89. package/dist/components/Switch/Switch.svelte +4 -7
  90. package/dist/components/Switch/Switch.svelte.d.ts +1 -1
  91. package/dist/components/Switch/SwitchButton.svelte +4 -5
  92. package/dist/components/Switch/index.css +3 -4
  93. package/dist/components/TabbedMenu/README.md +26 -21
  94. package/dist/components/TabbedMenu/TabbedMenu.svelte +5 -5
  95. package/dist/components/TabbedMenu/index.css +7 -22
  96. package/dist/components/ThemePreview/README.md +289 -0
  97. package/dist/components/ThemePreview/ThemePreview.svelte +341 -0
  98. package/dist/components/ThemePreview/ThemePreview.svelte.d.ts +33 -0
  99. package/dist/components/ThemePreview/index.css +493 -0
  100. package/dist/components/ThemePreview/index.d.ts +1 -0
  101. package/dist/components/ThemePreview/index.js +1 -0
  102. package/dist/components/TwCheck/TwCheck.svelte +4 -4
  103. package/dist/components/TwCheck/index.css +3 -2
  104. package/dist/components/TypeaheadInput/TypeaheadInput.svelte +1 -1
  105. package/dist/components/X/X.svelte +12 -5
  106. package/dist/components/X/X.svelte.d.ts +1 -0
  107. package/dist/icons/index.d.ts +1 -0
  108. package/dist/icons/index.js +1 -0
  109. package/dist/index.css +31 -16
  110. package/dist/index.d.ts +1 -0
  111. package/dist/index.js +1 -0
  112. package/dist/themes/blue-orange.css +163 -0
  113. package/dist/themes/blue-orange.d.ts +6 -0
  114. package/dist/themes/blue-orange.js +151 -0
  115. package/dist/themes/cyan-red.css +163 -0
  116. package/dist/themes/cyan-red.d.ts +6 -0
  117. package/dist/themes/cyan-red.js +151 -0
  118. package/dist/themes/cyan-slate.css +163 -0
  119. package/dist/themes/cyan-slate.d.ts +6 -0
  120. package/dist/themes/cyan-slate.js +151 -0
  121. package/dist/themes/emerald-pink.css +163 -0
  122. package/dist/themes/emerald-pink.d.ts +6 -0
  123. package/dist/themes/emerald-pink.js +151 -0
  124. package/dist/themes/fuchsia-emerald.css +163 -0
  125. package/dist/themes/fuchsia-emerald.d.ts +6 -0
  126. package/dist/themes/fuchsia-emerald.js +151 -0
  127. package/dist/themes/gray.css +163 -0
  128. package/dist/themes/gray.d.ts +6 -0
  129. package/dist/themes/gray.js +151 -0
  130. package/dist/themes/indigo-amber.css +163 -0
  131. package/dist/themes/indigo-amber.d.ts +6 -0
  132. package/dist/themes/indigo-amber.js +151 -0
  133. package/dist/themes/neutral.css +163 -0
  134. package/dist/themes/neutral.d.ts +6 -0
  135. package/dist/themes/neutral.js +151 -0
  136. package/dist/themes/pink-emerald.css +163 -0
  137. package/dist/themes/pink-emerald.d.ts +6 -0
  138. package/dist/themes/pink-emerald.js +151 -0
  139. package/dist/themes/purple-yellow.css +163 -0
  140. package/dist/themes/purple-yellow.d.ts +6 -0
  141. package/dist/themes/purple-yellow.js +151 -0
  142. package/dist/themes/rainbow.css +163 -0
  143. package/dist/themes/rainbow.d.ts +6 -0
  144. package/dist/themes/rainbow.js +156 -0
  145. package/dist/themes/red-blue.css +163 -0
  146. package/dist/themes/red-blue.d.ts +6 -0
  147. package/dist/themes/red-blue.js +151 -0
  148. package/dist/themes/red-cyan.css +163 -0
  149. package/dist/themes/red-cyan.d.ts +6 -0
  150. package/dist/themes/red-cyan.js +151 -0
  151. package/dist/themes/rose-teal.css +163 -0
  152. package/dist/themes/rose-teal.d.ts +6 -0
  153. package/dist/themes/rose-teal.js +151 -0
  154. package/dist/themes/sky-amber.css +163 -0
  155. package/dist/themes/sky-amber.d.ts +6 -0
  156. package/dist/themes/sky-amber.js +151 -0
  157. package/dist/themes/slate-cyan.css +163 -0
  158. package/dist/themes/slate-cyan.d.ts +6 -0
  159. package/dist/themes/slate-cyan.js +151 -0
  160. package/dist/themes/tailwind-color-pairs.md +31 -0
  161. package/dist/themes/teal-rose.css +163 -0
  162. package/dist/themes/teal-rose.d.ts +6 -0
  163. package/dist/themes/teal-rose.js +151 -0
  164. package/dist/themes/violet-lime.css +163 -0
  165. package/dist/themes/violet-lime.d.ts +6 -0
  166. package/dist/themes/violet-lime.js +151 -0
  167. package/dist/utils/design-tokens.d.ts +43 -0
  168. package/dist/utils/design-tokens.js +100 -0
  169. package/dist/utils/index.d.ts +1 -0
  170. package/dist/utils/index.js +1 -0
  171. package/package.json +22 -2
@@ -0,0 +1,43 @@
1
+ /** Base color value with optional pseudo states */
2
+ type ColorValue = {
3
+ DEFAULT: string;
4
+ hover?: string;
5
+ active?: string;
6
+ };
7
+ /** Color pair enforcing the -foreground convention, with optional pseudo states */
8
+ type ColorPair = {
9
+ DEFAULT: string;
10
+ foreground: string;
11
+ hover?: string;
12
+ active?: string;
13
+ foregroundHover?: string;
14
+ foregroundActive?: string;
15
+ };
16
+ /** Single color: either a plain string or an object with pseudo states */
17
+ type SingleColor = string | ColorValue;
18
+ /** Known intent color keys */
19
+ export type IntentColorKey = "primary" | "accent" | "destructive" | "warning" | "success" | "info";
20
+ /** Known role color keys (paired) */
21
+ export type RolePairedKey = "background" | "surface" | "muted";
22
+ /** Known role color keys (single value) */
23
+ export type RoleSingleKey = "foreground" | "border" | "input" | "ring";
24
+ /** Helper: require known keys, allow additional */
25
+ export type WithRequired<TRequired extends string, TValue> = Record<TRequired, TValue> & Record<string, TValue>;
26
+ /** Helper: partial known keys, allow additional */
27
+ export type WithOptional<TKnown extends string, TValue> = Partial<Record<TKnown, TValue>> & Record<string, TValue>;
28
+ export type TokenSchema = {
29
+ colors: {
30
+ intent: WithRequired<IntentColorKey, ColorPair>;
31
+ role: {
32
+ paired: WithRequired<RolePairedKey, ColorPair>;
33
+ single: WithRequired<RoleSingleKey, SingleColor>;
34
+ };
35
+ };
36
+ };
37
+ export type GeneratedTokens = Record<string, string>;
38
+ export declare function generateCssTokens(schema: TokenSchema, prefix?: string): GeneratedTokens;
39
+ /** Convert tokens object to CSS :root declaration */
40
+ export declare function toCssString(tokens: GeneratedTokens, selector?: string): string;
41
+ /** Create dark mode override tokens */
42
+ export declare function createDarkOverride(baseTokens: GeneratedTokens, overrides: Partial<GeneratedTokens>): GeneratedTokens;
43
+ export {};
@@ -0,0 +1,100 @@
1
+ // ============================================================================
2
+ // Types
3
+ // ============================================================================
4
+ // ============================================================================
5
+ // Helpers
6
+ // ============================================================================
7
+ /** Check if a single color is an object with states or a plain string */
8
+ function isSingleColorObject(value) {
9
+ return typeof value === "object" && "DEFAULT" in value;
10
+ }
11
+ /** Generate color tokens for a paired color (with foreground) */
12
+ function generatePairedColorTokens(tokens, key, pair, prefix = "stuic-") {
13
+ // Main color
14
+ tokens[`${prefix}color-${key}`] = pair.DEFAULT;
15
+ tokens[`${prefix}color-${key}-hover`] = pair.hover ?? pair.DEFAULT;
16
+ tokens[`${prefix}color-${key}-active`] = pair.active ?? pair.DEFAULT;
17
+ // Foreground
18
+ tokens[`${prefix}color-${key}-foreground`] = pair.foreground;
19
+ tokens[`${prefix}color-${key}-foreground-hover`] =
20
+ pair.foregroundHover ?? pair.foreground;
21
+ tokens[`${prefix}color-${key}-foreground-active`] =
22
+ pair.foregroundActive ?? pair.foreground;
23
+ }
24
+ /** Generate color tokens for a single color */
25
+ function generateSingleColorTokens(tokens, key, color, prefix = "stuic-") {
26
+ if (isSingleColorObject(color)) {
27
+ tokens[`${prefix}color-${key}`] = color.DEFAULT;
28
+ tokens[`${prefix}color-${key}-hover`] = color.hover ?? color.DEFAULT;
29
+ tokens[`${prefix}color-${key}-active`] = color.active ?? color.DEFAULT;
30
+ }
31
+ else {
32
+ // Plain string: use same value for all states
33
+ tokens[`${prefix}color-${key}`] = color;
34
+ tokens[`${prefix}color-${key}-hover`] = color;
35
+ tokens[`${prefix}color-${key}-active`] = color;
36
+ }
37
+ }
38
+ // ============================================================================
39
+ // Generator
40
+ // ============================================================================
41
+ export function generateCssTokens(schema, prefix = "stuic-") {
42
+ const tokens = {};
43
+ // Intent colors
44
+ for (const [key, pair] of Object.entries(schema.colors.intent)) {
45
+ generatePairedColorTokens(tokens, key, pair, prefix);
46
+ }
47
+ // Role colors (paired)
48
+ for (const [key, pair] of Object.entries(schema.colors.role.paired)) {
49
+ generatePairedColorTokens(tokens, key, pair, prefix);
50
+ }
51
+ // Role colors (single)
52
+ for (const [key, color] of Object.entries(schema.colors.role.single)) {
53
+ generateSingleColorTokens(tokens, key, color, prefix);
54
+ }
55
+ return tokens;
56
+ }
57
+ // ============================================================================
58
+ // CSS Output Helpers
59
+ // ============================================================================
60
+ /** Convert tokens object to CSS :root declaration */
61
+ export function toCssString(tokens, selector = ":root") {
62
+ // Find max key length for padding
63
+ const maxLen = Math.max(...Object.keys(tokens).map((k) => `--${k}`.length));
64
+ // Helper to extract base color name from token key
65
+ const getBaseColor = (key) => {
66
+ // e.g., "stuic-color-primary-foreground-hover" → "primary"
67
+ const match = key.match(/^stuic-color-([^-]+)/);
68
+ return match ? match[1] : key;
69
+ };
70
+ // Group tokens by base color name (preserving order)
71
+ const groups = new Map();
72
+ for (const [key, value] of Object.entries(tokens)) {
73
+ const base = getBaseColor(key);
74
+ if (!groups.has(base)) {
75
+ groups.set(base, []);
76
+ }
77
+ groups.get(base).push([key, value]);
78
+ }
79
+ // Format a token with padding (include colon in key)
80
+ const formatVar = ([key, value]) => {
81
+ const cssKey = `--${key}:`;
82
+ return `\t${cssKey.padEnd(maxLen + 1)} ${value};`;
83
+ };
84
+ // Build output with empty lines between each color group
85
+ const parts = [];
86
+ for (const entries of groups.values()) {
87
+ parts.push(entries.map(formatVar).join("\n"));
88
+ }
89
+ return `${selector} {\n${parts.join("\n\n")}\n}\n`;
90
+ }
91
+ /** Create dark mode override tokens */
92
+ export function createDarkOverride(baseTokens, overrides) {
93
+ const darkTokens = {};
94
+ for (const [key, value] of Object.entries(overrides)) {
95
+ if (key in baseTokens && value !== undefined) {
96
+ darkTokens[key] = value;
97
+ }
98
+ }
99
+ return darkTokens;
100
+ }
@@ -3,6 +3,7 @@ export * from "./body-scroll-locker.js";
3
3
  export * from "./breakpoint.svelte.js";
4
4
  export * from "./colors.js";
5
5
  export * from "./debounce.js";
6
+ export * from "./design-tokens.js";
6
7
  export * from "./device-pointer.svelte.js";
7
8
  export * from "./escape-regex.js";
8
9
  export * from "./event-emitter.js";
@@ -3,6 +3,7 @@ export * from "./body-scroll-locker.js";
3
3
  export * from "./breakpoint.svelte.js";
4
4
  export * from "./colors.js";
5
5
  export * from "./debounce.js";
6
+ export * from "./design-tokens.js";
6
7
  export * from "./device-pointer.svelte.js";
7
8
  export * from "./escape-regex.js";
8
9
  export * from "./event-emitter.js";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@marianmeres/stuic",
3
- "version": "2.66.0",
3
+ "version": "3.0.0",
4
4
  "files": [
5
5
  "dist",
6
6
  "!dist/**/*.test.*",
@@ -43,6 +43,7 @@
43
43
  "svelte": "^5.46.4",
44
44
  "svelte-check": "^4.3.5",
45
45
  "tailwindcss": "^4.1.18",
46
+ "tsx": "^4.21.0",
46
47
  "typescript": "^5.9.3",
47
48
  "typescript-eslint": "^8.53.0",
48
49
  "vite": "^6.4.1",
@@ -71,6 +72,25 @@
71
72
  "svelte-check": "svelte-check",
72
73
  "svelte-package": "svelte-package",
73
74
  "rp": "pnpm run build && ./release.sh patch",
74
- "rpm": "pnpm run build && ./release.sh minor"
75
+ "rpm": "pnpm run build && ./release.sh minor",
76
+ "build:theme": "tsx scripts/generate-theme.ts",
77
+ "build:theme:rainbow": "pnpm run build:theme --infile=src/lib/themes/rainbow.ts --outfile=src/lib/themes/rainbow.css",
78
+ "build:theme:neutral": "pnpm run build:theme --infile=src/lib/themes/neutral.ts --outfile=src/lib/themes/neutral.css",
79
+ "build:theme:gray": "pnpm run build:theme --infile=src/lib/themes/gray.ts --outfile=src/lib/themes/gray.css",
80
+ "build:theme:indigo-amber": "pnpm run build:theme --infile=src/lib/themes/indigo-amber.ts --outfile=src/lib/themes/indigo-amber.css",
81
+ "build:theme:teal-rose": "pnpm run build:theme --infile=src/lib/themes/teal-rose.ts --outfile=src/lib/themes/teal-rose.css",
82
+ "build:theme:violet-lime": "pnpm run build:theme --infile=src/lib/themes/violet-lime.ts --outfile=src/lib/themes/violet-lime.css",
83
+ "build:theme:blue-orange": "pnpm run build:theme --infile=src/lib/themes/blue-orange.ts --outfile=src/lib/themes/blue-orange.css",
84
+ "build:theme:emerald-pink": "pnpm run build:theme --infile=src/lib/themes/emerald-pink.ts --outfile=src/lib/themes/emerald-pink.css",
85
+ "build:theme:sky-amber": "pnpm run build:theme --infile=src/lib/themes/sky-amber.ts --outfile=src/lib/themes/sky-amber.css",
86
+ "build:theme:fuchsia-emerald": "pnpm run build:theme --infile=src/lib/themes/fuchsia-emerald.ts --outfile=src/lib/themes/fuchsia-emerald.css",
87
+ "build:theme:slate-cyan": "pnpm run build:theme --infile=src/lib/themes/slate-cyan.ts --outfile=src/lib/themes/slate-cyan.css",
88
+ "build:theme:purple-yellow": "pnpm run build:theme --infile=src/lib/themes/purple-yellow.ts --outfile=src/lib/themes/purple-yellow.css",
89
+ "build:theme:cyan-red": "pnpm run build:theme --infile=src/lib/themes/cyan-red.ts --outfile=src/lib/themes/cyan-red.css",
90
+ "build:theme:rose-teal": "pnpm run build:theme --infile=src/lib/themes/rose-teal.ts --outfile=src/lib/themes/rose-teal.css",
91
+ "build:theme:red-cyan": "pnpm run build:theme --infile=src/lib/themes/red-cyan.ts --outfile=src/lib/themes/red-cyan.css",
92
+ "build:theme:cyan-slate": "pnpm run build:theme --infile=src/lib/themes/cyan-slate.ts --outfile=src/lib/themes/cyan-slate.css",
93
+ "build:theme:pink-emerald": "pnpm run build:theme --infile=src/lib/themes/pink-emerald.ts --outfile=src/lib/themes/pink-emerald.css",
94
+ "build:theme:red-blue": "pnpm run build:theme --infile=src/lib/themes/red-blue.ts --outfile=src/lib/themes/red-blue.css"
75
95
  }
76
96
  }