@nurvus/ui 0.1.0-alpha.11 → 0.1.0-alpha.12

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 (127) hide show
  1. package/README.md +20 -9
  2. package/dist/index.js +1 -1
  3. package/dist/nurvus.css +14 -0
  4. package/dist/respawn.js +2 -0
  5. package/dist/respawn.js.LICENSE.txt +5 -0
  6. package/dist/theme.js +1 -0
  7. package/dist/themes/all.css +231 -0
  8. package/dist/themes/apollo-white.css +33 -0
  9. package/dist/themes/apollo-white.json +52 -0
  10. package/dist/themes/arcane.css +33 -0
  11. package/dist/themes/arcane.json +52 -0
  12. package/dist/themes/dopamine.css +33 -0
  13. package/dist/themes/dopamine.json +52 -0
  14. package/dist/themes/nether-neon.css +33 -0
  15. package/dist/themes/nether-neon.json +52 -0
  16. package/dist/themes/nether.css +33 -0
  17. package/dist/themes/nether.json +52 -0
  18. package/dist/themes/outworld.css +33 -0
  19. package/dist/themes/outworld.json +52 -0
  20. package/dist/themes/roles.json +29 -0
  21. package/dist/themes/tokyo-neon.css +33 -0
  22. package/dist/themes/tokyo-neon.json +52 -0
  23. package/dist/types/components/Button/Button.d.ts +19 -0
  24. package/dist/types/components/ButtonGroup/ButtonGroup.d.ts +12 -0
  25. package/dist/types/components/FullPageModal/FullPageModal.d.ts +15 -0
  26. package/dist/types/components/HistoryList/HistoryList.d.ts +40 -0
  27. package/dist/types/components/Layout/Layout.d.ts +27 -0
  28. package/dist/types/components/Link/Link.d.ts +9 -0
  29. package/dist/types/components/Menu/Menu.d.ts +35 -0
  30. package/dist/types/components/Panel/Panel.d.ts +19 -0
  31. package/dist/types/components/Progress/Progress.d.ts +15 -0
  32. package/dist/types/components/Table/Table.d.ts +25 -0
  33. package/dist/types/components/Tag/Tag.d.ts +15 -0
  34. package/dist/types/components/Text/Text.d.ts +28 -0
  35. package/dist/types/components/Title/Title.d.ts +288 -0
  36. package/dist/types/constants.d.ts +5 -0
  37. package/dist/types/index.d.ts +30 -0
  38. package/dist/types/respawn/Button.d.ts +16 -0
  39. package/dist/types/respawn/ButtonGroup.d.ts +8 -0
  40. package/dist/types/respawn/FullPageModal.d.ts +32 -0
  41. package/dist/types/respawn/HistoryList.d.ts +36 -0
  42. package/dist/types/respawn/Layout.d.ts +22 -0
  43. package/dist/types/respawn/Link.d.ts +12 -0
  44. package/dist/types/respawn/Menu.d.ts +33 -0
  45. package/dist/types/respawn/Panel.d.ts +15 -0
  46. package/dist/types/respawn/Progress.d.ts +15 -0
  47. package/dist/types/respawn/Table.d.ts +22 -0
  48. package/dist/types/respawn/Tag.d.ts +11 -0
  49. package/dist/types/respawn/Text.d.ts +19 -0
  50. package/dist/types/respawn/Title.d.ts +14 -0
  51. package/dist/types/respawn/index.d.ts +33 -0
  52. package/dist/types/respawn/spawn.d.ts +50 -0
  53. package/dist/types/respawn/update.d.ts +13 -0
  54. package/dist/types/spacing.d.ts +8 -0
  55. package/dist/types/theme.d.ts +32 -0
  56. package/dist/types/themes/index.d.ts +45 -0
  57. package/package.json +40 -12
  58. package/src/components/Button/Button.md +5 -5
  59. package/src/components/Button/Button.tsx +44 -0
  60. package/src/components/ButtonGroup/ButtonGroup.tsx +23 -0
  61. package/src/components/FullPageModal/FullPageModal.scss +9 -5
  62. package/src/components/FullPageModal/FullPageModal.tsx +74 -0
  63. package/src/components/HistoryList/{HistoryList.jsx → HistoryList.tsx} +45 -58
  64. package/src/components/Layout/Layout.md +4 -4
  65. package/src/components/Layout/Layout.scss +14 -47
  66. package/src/components/Layout/Layout.tsx +56 -0
  67. package/src/components/Link/Link.scss +9 -9
  68. package/src/components/Link/Link.tsx +23 -0
  69. package/src/components/Menu/Menu.tsx +90 -0
  70. package/src/components/Panel/{Panel.jsx → Panel.tsx} +17 -26
  71. package/src/components/Progress/Progress.md +5 -5
  72. package/src/components/Progress/Progress.tsx +36 -0
  73. package/src/components/Table/Table.tsx +59 -0
  74. package/src/components/Tag/{Tag.jsx → Tag.tsx} +13 -18
  75. package/src/components/Text/Text.md +13 -0
  76. package/src/components/Text/Text.scss +6 -0
  77. package/src/components/Text/Text.tsx +54 -0
  78. package/src/components/Title/Title.tsx +42 -0
  79. package/src/constants.ts +6 -0
  80. package/src/css.ts +16 -0
  81. package/src/global.d.ts +3 -0
  82. package/src/index.ts +40 -0
  83. package/src/respawn/Button.ts +31 -0
  84. package/src/respawn/ButtonGroup.ts +19 -0
  85. package/src/respawn/FullPageModal.ts +125 -0
  86. package/src/respawn/HistoryList.ts +100 -0
  87. package/src/respawn/Layout.ts +44 -0
  88. package/src/respawn/Link.ts +24 -0
  89. package/src/respawn/Menu.ts +86 -0
  90. package/src/respawn/Panel.ts +36 -0
  91. package/src/respawn/Progress.ts +29 -0
  92. package/src/respawn/Table.ts +54 -0
  93. package/src/respawn/Tag.ts +25 -0
  94. package/src/respawn/Text.ts +35 -0
  95. package/src/respawn/Title.ts +30 -0
  96. package/src/respawn/index.ts +57 -0
  97. package/src/respawn/spawn.ts +155 -0
  98. package/src/respawn/update.ts +49 -0
  99. package/src/spacing.ts +23 -0
  100. package/src/styles/theme.scss +6 -197
  101. package/src/styles/type.json +35 -5
  102. package/src/theme.ts +92 -0
  103. package/src/themes/css/all.css +231 -0
  104. package/src/themes/css/apollo-white.css +33 -0
  105. package/src/themes/css/arcane.css +33 -0
  106. package/src/themes/css/dopamine.css +33 -0
  107. package/src/themes/css/nether-neon.css +33 -0
  108. package/src/themes/css/nether.css +33 -0
  109. package/src/themes/css/outworld.css +33 -0
  110. package/src/themes/css/tokyo-neon.css +33 -0
  111. package/src/themes/index.ts +61 -0
  112. package/src/themes/roles.json +1 -1
  113. package/src/app.js +0 -29
  114. package/src/components/Button/Button.jsx +0 -59
  115. package/src/components/ButtonGroup/ButtonGroup.jsx +0 -28
  116. package/src/components/FullPageModal/FullPageModal.jsx +0 -106
  117. package/src/components/Layout/Layout.jsx +0 -68
  118. package/src/components/Link/Link.jsx +0 -39
  119. package/src/components/Menu/Menu.jsx +0 -120
  120. package/src/components/Progress/Progress.jsx +0 -56
  121. package/src/components/Table/Table.jsx +0 -94
  122. package/src/components/Text/Text.jsx +0 -54
  123. package/src/components/Title/Title.jsx +0 -48
  124. package/src/constants.js +0 -3
  125. package/src/index.js +0 -20
  126. package/src/theme.js +0 -64
  127. package/src/themes/index.js +0 -22
@@ -254,27 +254,28 @@
254
254
  --nv-type-display-weight: 600;
255
255
  --nv-type-display-tracking: -0.02em;
256
256
  --nv-type-title-size: 22px;
257
- --nv-type-title-line: 1.3;
257
+ --nv-type-title-line: 28px;
258
258
  --nv-type-title-weight: 600;
259
259
  --nv-type-title-tracking: -0.01em;
260
260
  --nv-type-body-size: 16px;
261
- --nv-type-body-line: 1.55;
261
+ --nv-type-body-line: 24px;
262
262
  --nv-type-body-weight: 400;
263
263
  --nv-type-body-tracking: 0;
264
264
  --nv-type-caption-size: 14px;
265
- --nv-type-caption-line: 1.45;
265
+ --nv-type-caption-line: 20px;
266
266
  --nv-type-caption-weight: 400;
267
267
  --nv-type-caption-tracking: 0;
268
268
  --nv-type-mono-size: 13px;
269
- --nv-type-mono-line: 1.5;
269
+ --nv-type-mono-line: 20px;
270
270
  --nv-type-mono-weight: 400;
271
271
  --nv-type-mono-tracking: 0;
272
272
  }
273
273
 
274
274
  /* Apollo White: Bright. Refined. Minimal. (light, demo) */
275
- :root,
275
+ :where(:root),
276
276
  [data-theme="apollo-white"] {
277
277
  color-scheme: light;
278
+ --nv-theme-id: apollo-white;
278
279
  --nv-bg: #FFFFFF;
279
280
  --nv-bg-alt: #F5F6F8;
280
281
  --nv-bg-deep: #EEF0F4;
@@ -303,195 +304,3 @@
303
304
  --nv-syntax-string: #168367;
304
305
  --nv-syntax-number: #B04A00;
305
306
  }
306
-
307
- /* Dopamine: Vivid. Joyful. Addictive. (light, demo) */
308
- [data-theme="dopamine"] {
309
- color-scheme: light;
310
- --nv-bg: #FFFCF7;
311
- --nv-bg-alt: #FFF5EA;
312
- --nv-bg-deep: #FDEBDB;
313
- --nv-surface: #FFEFE4;
314
- --nv-surface-hover: #FFE3D4;
315
- --nv-border: #F3DACB;
316
- --nv-border-strong: #A67F72;
317
- --nv-text: #2B1B3D;
318
- --nv-text-muted: #55446A;
319
- --nv-text-subtle: #7D6A8F;
320
- --nv-accent: #C8186F;
321
- --nv-accent-fill: #D81B7A;
322
- --nv-on-accent: #FFFFFF;
323
- --nv-accent-soft: rgba(216, 27, 122, 0.10);
324
- --nv-selection: #FFD6EC;
325
- --nv-cursor: #D81B7A;
326
- --nv-success: #0B7A52;
327
- --nv-warning: #A35200;
328
- --nv-danger: #C71F37;
329
- --nv-info: #1A5FD0;
330
- --nv-syntax-comment: #76658A;
331
- --nv-syntax-keyword: #7B2FF7;
332
- --nv-syntax-function: #1A5FD0;
333
- --nv-syntax-tag: #C8186F;
334
- --nv-syntax-attr: #A35200;
335
- --nv-syntax-string: #0B7A52;
336
- --nv-syntax-number: #B8400A;
337
- }
338
-
339
- /* Tokyo Neon: Electric. Immersive. Futuristic. (dark, demo) */
340
- [data-theme="tokyo-neon"] {
341
- color-scheme: dark;
342
- --nv-bg: #141625;
343
- --nv-bg-alt: #10111F;
344
- --nv-bg-deep: #0C0D18;
345
- --nv-surface: #191B2E;
346
- --nv-surface-hover: #21243B;
347
- --nv-border: #262A45;
348
- --nv-border-strong: #5D6488;
349
- --nv-text: #D6DEFF;
350
- --nv-text-muted: #A9B1D6;
351
- --nv-text-subtle: #6B728E;
352
- --nv-accent: #8A89FA;
353
- --nv-accent-fill: #504FF6;
354
- --nv-on-accent: #FFFFFF;
355
- --nv-accent-soft: rgba(110, 109, 248, 0.16);
356
- --nv-selection: #2A2E52;
357
- --nv-cursor: #00F5FF;
358
- --nv-success: #9ECE6A;
359
- --nv-warning: #E0AF68;
360
- --nv-danger: #FF5C8A;
361
- --nv-info: #7AA2F7;
362
- --nv-syntax-comment: #8A92B2;
363
- --nv-syntax-keyword: #BB9AF7;
364
- --nv-syntax-function: #00D5FF;
365
- --nv-syntax-tag: #FF4FD8;
366
- --nv-syntax-attr: #FF9E64;
367
- --nv-syntax-string: #9ECE6A;
368
- --nv-syntax-number: #FF9E64;
369
- }
370
-
371
- /* Nether: Deep. Silent. Absolute. (dark, demo) */
372
- [data-theme="nether"] {
373
- color-scheme: dark;
374
- --nv-bg: #0B0C10;
375
- --nv-bg-alt: #0F1015;
376
- --nv-bg-deep: #08090C;
377
- --nv-surface: #17181F;
378
- --nv-surface-hover: #1F2129;
379
- --nv-border: #22242D;
380
- --nv-border-strong: #5E6272;
381
- --nv-text: #E7E9EE;
382
- --nv-text-muted: #B4B8C4;
383
- --nv-text-subtle: #8B90A0;
384
- --nv-accent: #8A89FA;
385
- --nv-accent-fill: #504FF6;
386
- --nv-on-accent: #FFFFFF;
387
- --nv-accent-soft: rgba(110, 109, 248, 0.16);
388
- --nv-selection: #26264A;
389
- --nv-cursor: #8A89FA;
390
- --nv-success: #5FD08A;
391
- --nv-warning: #F5B83D;
392
- --nv-danger: #FF6B6B;
393
- --nv-info: #8A89FA;
394
- --nv-syntax-comment: #8B90A0;
395
- --nv-syntax-keyword: #A5A4FB;
396
- --nv-syntax-function: #F5F6F8;
397
- --nv-syntax-tag: #8A89FA;
398
- --nv-syntax-attr: #C9CCD6;
399
- --nv-syntax-string: #B4B8C4;
400
- --nv-syntax-number: #F5B83D;
401
- }
402
-
403
- /* Nether Neon: Deep. Wired. Electric. (dark, demo) */
404
- [data-theme="nether-neon"] {
405
- color-scheme: dark;
406
- --nv-bg: #0B0C10;
407
- --nv-bg-alt: #0F1015;
408
- --nv-bg-deep: #08090C;
409
- --nv-surface: #17181F;
410
- --nv-surface-hover: #1F2129;
411
- --nv-border: #22242D;
412
- --nv-border-strong: #5E6272;
413
- --nv-text: #E7E9EE;
414
- --nv-text-muted: #B4B8C4;
415
- --nv-text-subtle: #8B90A0;
416
- --nv-accent: #8A89FA;
417
- --nv-accent-fill: #504FF6;
418
- --nv-on-accent: #FFFFFF;
419
- --nv-accent-soft: rgba(110, 109, 248, 0.16);
420
- --nv-selection: #26264A;
421
- --nv-cursor: #00F5FF;
422
- --nv-success: #5FD08A;
423
- --nv-warning: #F5B83D;
424
- --nv-danger: #FF6B6B;
425
- --nv-info: #00D5FF;
426
- --nv-syntax-comment: #8B90A0;
427
- --nv-syntax-keyword: #BB9AF7;
428
- --nv-syntax-function: #00D5FF;
429
- --nv-syntax-tag: #FF4FD8;
430
- --nv-syntax-attr: #FF9E64;
431
- --nv-syntax-string: #9ECE6A;
432
- --nv-syntax-number: #FF9E64;
433
- }
434
-
435
- /* Outworld: Alien. Molten. Untamed. (dark, demo) */
436
- [data-theme="outworld"] {
437
- color-scheme: dark;
438
- --nv-bg: #1A1020;
439
- --nv-bg-alt: #140C19;
440
- --nv-bg-deep: #0F0913;
441
- --nv-surface: #24172A;
442
- --nv-surface-hover: #2E1E35;
443
- --nv-border: #38253F;
444
- --nv-border-strong: #7D6385;
445
- --nv-text: #F3E6E0;
446
- --nv-text-muted: #CDB7BD;
447
- --nv-text-subtle: #9C8496;
448
- --nv-accent: #FF8A3D;
449
- --nv-accent-fill: #FF8A3D;
450
- --nv-on-accent: #1A1020;
451
- --nv-accent-soft: rgba(255, 138, 61, 0.14);
452
- --nv-selection: #3E2442;
453
- --nv-cursor: #FFB35C;
454
- --nv-success: #9BE564;
455
- --nv-warning: #FFC857;
456
- --nv-danger: #FF5470;
457
- --nv-info: #C792EA;
458
- --nv-syntax-comment: #A08A99;
459
- --nv-syntax-keyword: #C792EA;
460
- --nv-syntax-function: #FFB35C;
461
- --nv-syntax-tag: #FF6B5B;
462
- --nv-syntax-attr: #FFC857;
463
- --nv-syntax-string: #9BE564;
464
- --nv-syntax-number: #FF8A3D;
465
- }
466
-
467
- /* Arcane: Mystic. Charged. Forbidden. (dark, demo) */
468
- [data-theme="arcane"] {
469
- color-scheme: dark;
470
- --nv-bg: #120B1F;
471
- --nv-bg-alt: #0E0818;
472
- --nv-bg-deep: #0A0612;
473
- --nv-surface: #1C1230;
474
- --nv-surface-hover: #26193F;
475
- --nv-border: #2E2147;
476
- --nv-border-strong: #76619F;
477
- --nv-text: #ECE3FF;
478
- --nv-text-muted: #BFAEE3;
479
- --nv-text-subtle: #9381B8;
480
- --nv-accent: #C77DFF;
481
- --nv-accent-fill: #9D4EDD;
482
- --nv-on-accent: #FFFFFF;
483
- --nv-accent-soft: rgba(199, 125, 255, 0.16);
484
- --nv-selection: #3A2560;
485
- --nv-cursor: #FF4FD8;
486
- --nv-success: #7EE8C6;
487
- --nv-warning: #FFD166;
488
- --nv-danger: #FF4F8B;
489
- --nv-info: #7AA2F7;
490
- --nv-syntax-comment: #9D8CC2;
491
- --nv-syntax-keyword: #FF4FD8;
492
- --nv-syntax-function: #C77DFF;
493
- --nv-syntax-tag: #FF79C6;
494
- --nv-syntax-attr: #E0AAFF;
495
- --nv-syntax-string: #7EE8C6;
496
- --nv-syntax-number: #FFD166;
497
- }
@@ -4,10 +4,40 @@
4
4
  "mono": "'JetBrains Mono', ui-monospace, SFMono-Regular, Menlo, Consolas, monospace"
5
5
  },
6
6
  "roles": {
7
- "display": { "size": "clamp(30px, 4vw, 44px)", "line": "1.08", "weight": "600", "tracking": "-0.02em", "use": "The one big headline on a page." },
8
- "title": { "size": "22px", "line": "1.3", "weight": "600", "tracking": "-0.01em", "use": "Section headings and panel titles." },
9
- "body": { "size": "16px", "line": "1.55", "weight": "400", "tracking": "0", "use": "Running text." },
10
- "caption": { "size": "14px", "line": "1.45", "weight": "400", "tracking": "0", "use": "Labels, captions, table cells, notes." },
11
- "mono": { "size": "13px", "line": "1.5", "weight": "400", "tracking": "0", "use": "Values: hex codes, tokens, numbers, code." }
7
+ "display": {
8
+ "size": "clamp(30px, 4vw, 44px)",
9
+ "line": "1.08",
10
+ "weight": "600",
11
+ "tracking": "-0.02em",
12
+ "use": "The one big headline on a page."
13
+ },
14
+ "title": {
15
+ "size": "22px",
16
+ "line": "28px",
17
+ "weight": "600",
18
+ "tracking": "-0.01em",
19
+ "use": "Section headings and panel titles."
20
+ },
21
+ "body": {
22
+ "size": "16px",
23
+ "line": "24px",
24
+ "weight": "400",
25
+ "tracking": "0",
26
+ "use": "Running text."
27
+ },
28
+ "caption": {
29
+ "size": "14px",
30
+ "line": "20px",
31
+ "weight": "400",
32
+ "tracking": "0",
33
+ "use": "Labels, captions, table cells, notes."
34
+ },
35
+ "mono": {
36
+ "size": "13px",
37
+ "line": "20px",
38
+ "weight": "400",
39
+ "tracking": "0",
40
+ "use": "Values: hex codes, tokens, numbers, code."
41
+ }
12
42
  }
13
43
  }
package/src/theme.ts ADDED
@@ -0,0 +1,92 @@
1
+ import { themes, DEFAULT_THEME, Theme } from './themes';
2
+
3
+ /** localStorage key that remembers the chosen theme. */
4
+ export const THEME_STORAGE_KEY = 'nurvus.theme';
5
+
6
+ /** Fired on the themed element (bubbles) after setTheme; detail = the theme. */
7
+ export const THEME_CHANGE_EVENT = 'nurvus:themechange';
8
+
9
+ export interface SetThemeOptions {
10
+ /** The element to theme. Defaults to <html>; any element themes just that part of the page. */
11
+ root?: HTMLElement;
12
+ /** Save it as the visitor's choice (localStorage). Defaults to true. */
13
+ persist?: boolean;
14
+ }
15
+
16
+ /** A theme object by id, or undefined. */
17
+ export function getTheme(id: string | null | undefined): Theme | undefined {
18
+ return themes.find((theme) => theme.id === id);
19
+ }
20
+
21
+ /** The theme currently applied to `root` (defaults to <html>). */
22
+ export function currentTheme(root: HTMLElement = document.documentElement): Theme {
23
+ return (getTheme(root.getAttribute('data-theme')) || getTheme(DEFAULT_THEME)) as Theme;
24
+ }
25
+
26
+ const warned = new Set<string>();
27
+
28
+ /**
29
+ * Only Apollo White ships in the core CSS; every other theme is its own file
30
+ * (`import '@nurvus/ui/themes/tokyo-neon.css'`). Each theme block sets
31
+ * --nv-theme-id, so after applying a theme we can tell whether its CSS is on
32
+ * the page, and say which file to import when it isn't.
33
+ */
34
+ function warnIfNotLoaded(root: HTMLElement, id: string) {
35
+ if (warned.has(id) || typeof getComputedStyle !== 'function') return;
36
+ const applied = getComputedStyle(root).getPropertyValue('--nv-theme-id').trim();
37
+ if (applied && applied !== id) {
38
+ warned.add(id);
39
+ // eslint-disable-next-line no-console
40
+ console.warn(`@nurvus/ui: the "${id}" theme's CSS isn't loaded, so the page still shows "${applied}". Add: import '@nurvus/ui/themes/${id}.css';`);
41
+ }
42
+ }
43
+
44
+ /**
45
+ * Apply a theme. Sets data-theme on `root` (default <html>), which swaps every
46
+ * --nv-* custom property underneath it. Pass any element as `root` to theme
47
+ * just that part of the page; themes nest.
48
+ *
49
+ * setTheme('tokyo-neon');
50
+ * setTheme('apollo-white', { root: sidebarEl, persist: false });
51
+ */
52
+ export function setTheme(id: string, { root = document.documentElement, persist = true }: SetThemeOptions = {}): Theme {
53
+ const theme = getTheme(id);
54
+ if (!theme) throw new Error(`@nurvus/ui: unknown theme "${id}". Known: ${themes.map((t) => t.id).join(', ')}`);
55
+ root.setAttribute('data-theme', theme.id);
56
+ if (persist) {
57
+ try { window.localStorage.setItem(THEME_STORAGE_KEY, theme.id); } catch (e) { /* storage blocked */ }
58
+ }
59
+ warnIfNotLoaded(root, theme.id);
60
+ root.dispatchEvent(new CustomEvent(THEME_CHANGE_EVENT, { detail: theme, bubbles: true }));
61
+ return theme;
62
+ }
63
+
64
+ /**
65
+ * Apply the saved theme, or `fallback` when nothing (valid) is saved. Only
66
+ * needed for a default other than Apollo White set from code: the package
67
+ * already restores a saved theme by itself when it loads.
68
+ */
69
+ export function initTheme(fallback: string = DEFAULT_THEME, options: SetThemeOptions = {}): Theme {
70
+ let saved: string | null = null;
71
+ try { saved = window.localStorage.getItem(THEME_STORAGE_KEY); } catch (e) { /* storage blocked */ }
72
+ return setTheme(getTheme(saved) ? (saved as string) : fallback, { persist: false, ...options });
73
+ }
74
+
75
+ /**
76
+ * Runs once, when the package is imported: brings back the visitor's saved
77
+ * theme (whatever setTheme saved last time), so an app needs no theme code at
78
+ * all. Nothing saved: nothing changes, and the page shows its own data-theme,
79
+ * or Apollo White when it has none (the CSS default). Skipped outside a
80
+ * browser (server rendering).
81
+ */
82
+ function restoreSavedTheme() {
83
+ if (typeof window === 'undefined' || typeof document === 'undefined') return;
84
+ let saved: string | null = null;
85
+ try { saved = window.localStorage.getItem(THEME_STORAGE_KEY); } catch (e) { return; /* storage blocked */ }
86
+ if (saved && getTheme(saved)) document.documentElement.setAttribute('data-theme', saved);
87
+ }
88
+
89
+ restoreSavedTheme();
90
+
91
+ export { themes, DEFAULT_THEME };
92
+ export type { Theme };
@@ -0,0 +1,231 @@
1
+ /* GENERATED by tools/build-tokens.js from src/themes/*.json. Do not edit. */
2
+ /* Apollo White: Bright. Refined. Minimal. (light, demo) */
3
+ [data-theme="apollo-white"] {
4
+ color-scheme: light;
5
+ --nv-theme-id: apollo-white;
6
+ --nv-bg: #FFFFFF;
7
+ --nv-bg-alt: #F5F6F8;
8
+ --nv-bg-deep: #EEF0F4;
9
+ --nv-surface: #F0F2F5;
10
+ --nv-surface-hover: #E6E9EF;
11
+ --nv-border: #E2E5EB;
12
+ --nv-border-strong: #868E9E;
13
+ --nv-text: #242938;
14
+ --nv-text-muted: #4A5163;
15
+ --nv-text-subtle: #687080;
16
+ --nv-accent: #245CC7;
17
+ --nv-accent-fill: #245CC7;
18
+ --nv-on-accent: #FFFFFF;
19
+ --nv-accent-soft: rgba(36, 92, 199, 0.10);
20
+ --nv-selection: #E5EDFF;
21
+ --nv-cursor: #245CC7;
22
+ --nv-success: #168367;
23
+ --nv-warning: #9A5B00;
24
+ --nv-danger: #C42B3B;
25
+ --nv-info: #245CC7;
26
+ --nv-syntax-comment: #687080;
27
+ --nv-syntax-keyword: #8952BD;
28
+ --nv-syntax-function: #245CC7;
29
+ --nv-syntax-tag: #C44067;
30
+ --nv-syntax-attr: #9A5B00;
31
+ --nv-syntax-string: #168367;
32
+ --nv-syntax-number: #B04A00;
33
+ }
34
+
35
+ /* Dopamine: Vivid. Joyful. Addictive. (light, demo) */
36
+ [data-theme="dopamine"] {
37
+ color-scheme: light;
38
+ --nv-theme-id: dopamine;
39
+ --nv-bg: #FFFCF7;
40
+ --nv-bg-alt: #FFF5EA;
41
+ --nv-bg-deep: #FDEBDB;
42
+ --nv-surface: #FFEFE4;
43
+ --nv-surface-hover: #FFE3D4;
44
+ --nv-border: #F3DACB;
45
+ --nv-border-strong: #A67F72;
46
+ --nv-text: #2B1B3D;
47
+ --nv-text-muted: #55446A;
48
+ --nv-text-subtle: #7D6A8F;
49
+ --nv-accent: #C8186F;
50
+ --nv-accent-fill: #D81B7A;
51
+ --nv-on-accent: #FFFFFF;
52
+ --nv-accent-soft: rgba(216, 27, 122, 0.10);
53
+ --nv-selection: #FFD6EC;
54
+ --nv-cursor: #D81B7A;
55
+ --nv-success: #0B7A52;
56
+ --nv-warning: #A35200;
57
+ --nv-danger: #C71F37;
58
+ --nv-info: #1A5FD0;
59
+ --nv-syntax-comment: #76658A;
60
+ --nv-syntax-keyword: #7B2FF7;
61
+ --nv-syntax-function: #1A5FD0;
62
+ --nv-syntax-tag: #C8186F;
63
+ --nv-syntax-attr: #A35200;
64
+ --nv-syntax-string: #0B7A52;
65
+ --nv-syntax-number: #B8400A;
66
+ }
67
+
68
+ /* Tokyo Neon: Electric. Immersive. Futuristic. (dark, demo) */
69
+ [data-theme="tokyo-neon"] {
70
+ color-scheme: dark;
71
+ --nv-theme-id: tokyo-neon;
72
+ --nv-bg: #141625;
73
+ --nv-bg-alt: #10111F;
74
+ --nv-bg-deep: #0C0D18;
75
+ --nv-surface: #191B2E;
76
+ --nv-surface-hover: #21243B;
77
+ --nv-border: #262A45;
78
+ --nv-border-strong: #5D6488;
79
+ --nv-text: #D6DEFF;
80
+ --nv-text-muted: #A9B1D6;
81
+ --nv-text-subtle: #6B728E;
82
+ --nv-accent: #8A89FA;
83
+ --nv-accent-fill: #504FF6;
84
+ --nv-on-accent: #FFFFFF;
85
+ --nv-accent-soft: rgba(110, 109, 248, 0.16);
86
+ --nv-selection: #2A2E52;
87
+ --nv-cursor: #00F5FF;
88
+ --nv-success: #9ECE6A;
89
+ --nv-warning: #E0AF68;
90
+ --nv-danger: #FF5C8A;
91
+ --nv-info: #7AA2F7;
92
+ --nv-syntax-comment: #8A92B2;
93
+ --nv-syntax-keyword: #BB9AF7;
94
+ --nv-syntax-function: #00D5FF;
95
+ --nv-syntax-tag: #FF4FD8;
96
+ --nv-syntax-attr: #FF9E64;
97
+ --nv-syntax-string: #9ECE6A;
98
+ --nv-syntax-number: #FF9E64;
99
+ }
100
+
101
+ /* Nether: Deep. Silent. Absolute. (dark, demo) */
102
+ [data-theme="nether"] {
103
+ color-scheme: dark;
104
+ --nv-theme-id: nether;
105
+ --nv-bg: #0B0C10;
106
+ --nv-bg-alt: #0F1015;
107
+ --nv-bg-deep: #08090C;
108
+ --nv-surface: #17181F;
109
+ --nv-surface-hover: #1F2129;
110
+ --nv-border: #22242D;
111
+ --nv-border-strong: #5E6272;
112
+ --nv-text: #E7E9EE;
113
+ --nv-text-muted: #B4B8C4;
114
+ --nv-text-subtle: #8B90A0;
115
+ --nv-accent: #8A89FA;
116
+ --nv-accent-fill: #504FF6;
117
+ --nv-on-accent: #FFFFFF;
118
+ --nv-accent-soft: rgba(110, 109, 248, 0.16);
119
+ --nv-selection: #26264A;
120
+ --nv-cursor: #8A89FA;
121
+ --nv-success: #5FD08A;
122
+ --nv-warning: #F5B83D;
123
+ --nv-danger: #FF6B6B;
124
+ --nv-info: #8A89FA;
125
+ --nv-syntax-comment: #8B90A0;
126
+ --nv-syntax-keyword: #A5A4FB;
127
+ --nv-syntax-function: #F5F6F8;
128
+ --nv-syntax-tag: #8A89FA;
129
+ --nv-syntax-attr: #C9CCD6;
130
+ --nv-syntax-string: #B4B8C4;
131
+ --nv-syntax-number: #F5B83D;
132
+ }
133
+
134
+ /* Nether Neon: Deep. Wired. Electric. (dark, demo) */
135
+ [data-theme="nether-neon"] {
136
+ color-scheme: dark;
137
+ --nv-theme-id: nether-neon;
138
+ --nv-bg: #0B0C10;
139
+ --nv-bg-alt: #0F1015;
140
+ --nv-bg-deep: #08090C;
141
+ --nv-surface: #17181F;
142
+ --nv-surface-hover: #1F2129;
143
+ --nv-border: #22242D;
144
+ --nv-border-strong: #5E6272;
145
+ --nv-text: #E7E9EE;
146
+ --nv-text-muted: #B4B8C4;
147
+ --nv-text-subtle: #8B90A0;
148
+ --nv-accent: #8A89FA;
149
+ --nv-accent-fill: #504FF6;
150
+ --nv-on-accent: #FFFFFF;
151
+ --nv-accent-soft: rgba(110, 109, 248, 0.16);
152
+ --nv-selection: #26264A;
153
+ --nv-cursor: #00F5FF;
154
+ --nv-success: #5FD08A;
155
+ --nv-warning: #F5B83D;
156
+ --nv-danger: #FF6B6B;
157
+ --nv-info: #00D5FF;
158
+ --nv-syntax-comment: #8B90A0;
159
+ --nv-syntax-keyword: #BB9AF7;
160
+ --nv-syntax-function: #00D5FF;
161
+ --nv-syntax-tag: #FF4FD8;
162
+ --nv-syntax-attr: #FF9E64;
163
+ --nv-syntax-string: #9ECE6A;
164
+ --nv-syntax-number: #FF9E64;
165
+ }
166
+
167
+ /* Outworld: Alien. Molten. Untamed. (dark, demo) */
168
+ [data-theme="outworld"] {
169
+ color-scheme: dark;
170
+ --nv-theme-id: outworld;
171
+ --nv-bg: #1A1020;
172
+ --nv-bg-alt: #140C19;
173
+ --nv-bg-deep: #0F0913;
174
+ --nv-surface: #24172A;
175
+ --nv-surface-hover: #2E1E35;
176
+ --nv-border: #38253F;
177
+ --nv-border-strong: #7D6385;
178
+ --nv-text: #F3E6E0;
179
+ --nv-text-muted: #CDB7BD;
180
+ --nv-text-subtle: #9C8496;
181
+ --nv-accent: #FF8A3D;
182
+ --nv-accent-fill: #FF8A3D;
183
+ --nv-on-accent: #1A1020;
184
+ --nv-accent-soft: rgba(255, 138, 61, 0.14);
185
+ --nv-selection: #3E2442;
186
+ --nv-cursor: #FFB35C;
187
+ --nv-success: #9BE564;
188
+ --nv-warning: #FFC857;
189
+ --nv-danger: #FF5470;
190
+ --nv-info: #C792EA;
191
+ --nv-syntax-comment: #A08A99;
192
+ --nv-syntax-keyword: #C792EA;
193
+ --nv-syntax-function: #FFB35C;
194
+ --nv-syntax-tag: #FF6B5B;
195
+ --nv-syntax-attr: #FFC857;
196
+ --nv-syntax-string: #9BE564;
197
+ --nv-syntax-number: #FF8A3D;
198
+ }
199
+
200
+ /* Arcane: Mystic. Charged. Forbidden. (dark, demo) */
201
+ [data-theme="arcane"] {
202
+ color-scheme: dark;
203
+ --nv-theme-id: arcane;
204
+ --nv-bg: #120B1F;
205
+ --nv-bg-alt: #0E0818;
206
+ --nv-bg-deep: #0A0612;
207
+ --nv-surface: #1C1230;
208
+ --nv-surface-hover: #26193F;
209
+ --nv-border: #2E2147;
210
+ --nv-border-strong: #76619F;
211
+ --nv-text: #ECE3FF;
212
+ --nv-text-muted: #BFAEE3;
213
+ --nv-text-subtle: #9381B8;
214
+ --nv-accent: #C77DFF;
215
+ --nv-accent-fill: #9D4EDD;
216
+ --nv-on-accent: #FFFFFF;
217
+ --nv-accent-soft: rgba(199, 125, 255, 0.16);
218
+ --nv-selection: #3A2560;
219
+ --nv-cursor: #FF4FD8;
220
+ --nv-success: #7EE8C6;
221
+ --nv-warning: #FFD166;
222
+ --nv-danger: #FF4F8B;
223
+ --nv-info: #7AA2F7;
224
+ --nv-syntax-comment: #9D8CC2;
225
+ --nv-syntax-keyword: #FF4FD8;
226
+ --nv-syntax-function: #C77DFF;
227
+ --nv-syntax-tag: #FF79C6;
228
+ --nv-syntax-attr: #E0AAFF;
229
+ --nv-syntax-string: #7EE8C6;
230
+ --nv-syntax-number: #FFD166;
231
+ }
@@ -0,0 +1,33 @@
1
+ /* GENERATED by tools/build-tokens.js from src/themes/*.json. Do not edit. */
2
+ /* Apollo White: Bright. Refined. Minimal. (light, demo) */
3
+ [data-theme="apollo-white"] {
4
+ color-scheme: light;
5
+ --nv-theme-id: apollo-white;
6
+ --nv-bg: #FFFFFF;
7
+ --nv-bg-alt: #F5F6F8;
8
+ --nv-bg-deep: #EEF0F4;
9
+ --nv-surface: #F0F2F5;
10
+ --nv-surface-hover: #E6E9EF;
11
+ --nv-border: #E2E5EB;
12
+ --nv-border-strong: #868E9E;
13
+ --nv-text: #242938;
14
+ --nv-text-muted: #4A5163;
15
+ --nv-text-subtle: #687080;
16
+ --nv-accent: #245CC7;
17
+ --nv-accent-fill: #245CC7;
18
+ --nv-on-accent: #FFFFFF;
19
+ --nv-accent-soft: rgba(36, 92, 199, 0.10);
20
+ --nv-selection: #E5EDFF;
21
+ --nv-cursor: #245CC7;
22
+ --nv-success: #168367;
23
+ --nv-warning: #9A5B00;
24
+ --nv-danger: #C42B3B;
25
+ --nv-info: #245CC7;
26
+ --nv-syntax-comment: #687080;
27
+ --nv-syntax-keyword: #8952BD;
28
+ --nv-syntax-function: #245CC7;
29
+ --nv-syntax-tag: #C44067;
30
+ --nv-syntax-attr: #9A5B00;
31
+ --nv-syntax-string: #168367;
32
+ --nv-syntax-number: #B04A00;
33
+ }
@@ -0,0 +1,33 @@
1
+ /* GENERATED by tools/build-tokens.js from src/themes/*.json. Do not edit. */
2
+ /* Arcane: Mystic. Charged. Forbidden. (dark, demo) */
3
+ [data-theme="arcane"] {
4
+ color-scheme: dark;
5
+ --nv-theme-id: arcane;
6
+ --nv-bg: #120B1F;
7
+ --nv-bg-alt: #0E0818;
8
+ --nv-bg-deep: #0A0612;
9
+ --nv-surface: #1C1230;
10
+ --nv-surface-hover: #26193F;
11
+ --nv-border: #2E2147;
12
+ --nv-border-strong: #76619F;
13
+ --nv-text: #ECE3FF;
14
+ --nv-text-muted: #BFAEE3;
15
+ --nv-text-subtle: #9381B8;
16
+ --nv-accent: #C77DFF;
17
+ --nv-accent-fill: #9D4EDD;
18
+ --nv-on-accent: #FFFFFF;
19
+ --nv-accent-soft: rgba(199, 125, 255, 0.16);
20
+ --nv-selection: #3A2560;
21
+ --nv-cursor: #FF4FD8;
22
+ --nv-success: #7EE8C6;
23
+ --nv-warning: #FFD166;
24
+ --nv-danger: #FF4F8B;
25
+ --nv-info: #7AA2F7;
26
+ --nv-syntax-comment: #9D8CC2;
27
+ --nv-syntax-keyword: #FF4FD8;
28
+ --nv-syntax-function: #C77DFF;
29
+ --nv-syntax-tag: #FF79C6;
30
+ --nv-syntax-attr: #E0AAFF;
31
+ --nv-syntax-string: #7EE8C6;
32
+ --nv-syntax-number: #FFD166;
33
+ }
@@ -0,0 +1,33 @@
1
+ /* GENERATED by tools/build-tokens.js from src/themes/*.json. Do not edit. */
2
+ /* Dopamine: Vivid. Joyful. Addictive. (light, demo) */
3
+ [data-theme="dopamine"] {
4
+ color-scheme: light;
5
+ --nv-theme-id: dopamine;
6
+ --nv-bg: #FFFCF7;
7
+ --nv-bg-alt: #FFF5EA;
8
+ --nv-bg-deep: #FDEBDB;
9
+ --nv-surface: #FFEFE4;
10
+ --nv-surface-hover: #FFE3D4;
11
+ --nv-border: #F3DACB;
12
+ --nv-border-strong: #A67F72;
13
+ --nv-text: #2B1B3D;
14
+ --nv-text-muted: #55446A;
15
+ --nv-text-subtle: #7D6A8F;
16
+ --nv-accent: #C8186F;
17
+ --nv-accent-fill: #D81B7A;
18
+ --nv-on-accent: #FFFFFF;
19
+ --nv-accent-soft: rgba(216, 27, 122, 0.10);
20
+ --nv-selection: #FFD6EC;
21
+ --nv-cursor: #D81B7A;
22
+ --nv-success: #0B7A52;
23
+ --nv-warning: #A35200;
24
+ --nv-danger: #C71F37;
25
+ --nv-info: #1A5FD0;
26
+ --nv-syntax-comment: #76658A;
27
+ --nv-syntax-keyword: #7B2FF7;
28
+ --nv-syntax-function: #1A5FD0;
29
+ --nv-syntax-tag: #C8186F;
30
+ --nv-syntax-attr: #A35200;
31
+ --nv-syntax-string: #0B7A52;
32
+ --nv-syntax-number: #B8400A;
33
+ }