@motion-proto/live-tokens 0.1.1 → 0.3.2

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 (224) hide show
  1. package/README.md +168 -21
  2. package/dist-plugin/index.cjs +823 -336
  3. package/dist-plugin/index.d.cts +9 -7
  4. package/dist-plugin/index.d.ts +9 -7
  5. package/dist-plugin/index.js +822 -335
  6. package/package.json +46 -20
  7. package/src/assets/newspaper.webp +0 -0
  8. package/src/assets/offering.webp +0 -0
  9. package/src/component-editor/BadgeEditor.svelte +170 -0
  10. package/src/component-editor/CalloutEditor.svelte +103 -0
  11. package/src/component-editor/CardEditor.svelte +184 -0
  12. package/src/component-editor/CollapsibleSectionEditor.svelte +167 -0
  13. package/src/component-editor/CornerBadgeEditor.svelte +207 -0
  14. package/src/component-editor/DialogEditor.svelte +172 -0
  15. package/src/component-editor/ImageEditor.svelte +72 -0
  16. package/src/component-editor/InlineEditActionsEditor.svelte +83 -0
  17. package/src/component-editor/NotificationEditor.svelte +160 -0
  18. package/src/component-editor/ProgressBarEditor.svelte +124 -0
  19. package/src/component-editor/RadioButtonEditor.svelte +140 -0
  20. package/src/component-editor/SectionDividerEditor.svelte +263 -0
  21. package/src/component-editor/SegmentedControlEditor.svelte +154 -0
  22. package/src/component-editor/StandardButtonsEditor.svelte +178 -0
  23. package/src/component-editor/TabBarEditor.svelte +137 -0
  24. package/src/component-editor/TableEditor.svelte +128 -0
  25. package/src/component-editor/TooltipEditor.svelte +122 -0
  26. package/src/component-editor/editorTokens.test.ts +93 -0
  27. package/src/component-editor/groupKeySlots.test.ts +67 -0
  28. package/src/component-editor/groupKeySnapshot.test.ts +52 -0
  29. package/src/component-editor/index.ts +5 -0
  30. package/src/component-editor/registry.ts +246 -0
  31. package/src/component-editor/scaffolding/AngleDial.svelte +185 -0
  32. package/src/component-editor/scaffolding/ComponentEditorBase.svelte +96 -0
  33. package/src/component-editor/scaffolding/ComponentFileManager.svelte +682 -0
  34. package/src/component-editor/scaffolding/ComponentFileMenu.svelte +312 -0
  35. package/src/component-editor/scaffolding/ComponentsTab.svelte +69 -0
  36. package/src/component-editor/scaffolding/CopyFromMenu.svelte +246 -0
  37. package/src/component-editor/scaffolding/DemoHeader.svelte +21 -0
  38. package/src/component-editor/scaffolding/DividerEditor.svelte +81 -0
  39. package/src/component-editor/scaffolding/FieldsetWrapper.svelte +46 -0
  40. package/src/component-editor/scaffolding/GradientCard.svelte +291 -0
  41. package/src/component-editor/scaffolding/LinkageChart.svelte +297 -0
  42. package/src/component-editor/scaffolding/LinkedBlock.svelte +418 -0
  43. package/src/component-editor/scaffolding/NonStylableConfig.svelte +57 -0
  44. package/src/component-editor/scaffolding/SaveAsDialog.svelte +177 -0
  45. package/src/component-editor/scaffolding/ShadowBackdrop.svelte +25 -0
  46. package/src/component-editor/scaffolding/ShadowBackdropControls.svelte +56 -0
  47. package/src/component-editor/scaffolding/StateBlock.svelte +115 -0
  48. package/src/component-editor/scaffolding/TokenLayout.svelte +511 -0
  49. package/src/component-editor/scaffolding/TypeEditor.svelte +82 -0
  50. package/src/component-editor/scaffolding/VariantGroup.svelte +277 -0
  51. package/src/component-editor/scaffolding/buildTypeGroupTokens.ts +97 -0
  52. package/src/component-editor/scaffolding/componentSectionType.ts +8 -0
  53. package/src/component-editor/scaffolding/componentSources.ts +9 -0
  54. package/src/component-editor/scaffolding/defaultSections.ts +16 -0
  55. package/src/component-editor/scaffolding/editorContext.ts +44 -0
  56. package/src/component-editor/scaffolding/linkedBlock.ts +226 -0
  57. package/src/component-editor/scaffolding/siblings.ts +33 -0
  58. package/src/component-editor/scaffolding/types.ts +39 -0
  59. package/src/components/Badge.svelte +231 -42
  60. package/src/components/Button.svelte +324 -124
  61. package/src/components/Callout.svelte +145 -0
  62. package/src/components/Card.svelte +123 -25
  63. package/src/components/CollapsibleSection.svelte +213 -35
  64. package/src/components/CornerBadge.svelte +224 -0
  65. package/src/components/Dialog.svelte +137 -114
  66. package/src/components/Image.svelte +43 -0
  67. package/src/components/InlineEditActions.svelte +74 -14
  68. package/src/components/Notification.svelte +184 -163
  69. package/src/components/ProgressBar.svelte +216 -22
  70. package/src/components/RadioButton.svelte +110 -40
  71. package/src/components/SectionDivider.svelte +428 -74
  72. package/src/components/SegmentedControl.svelte +203 -0
  73. package/src/components/TabBar.svelte +146 -21
  74. package/src/components/Table.svelte +102 -0
  75. package/src/components/Tooltip.svelte +45 -19
  76. package/src/components/types.ts +51 -0
  77. package/src/data/google-fonts.json +75 -0
  78. package/src/lib/ColumnsOverlay.svelte +20 -7
  79. package/src/lib/LiveEditorOverlay.svelte +257 -78
  80. package/src/lib/columnsOverlay.ts +21 -17
  81. package/src/lib/componentConfig.test.ts +204 -0
  82. package/src/lib/componentConfigKeys.ts +19 -0
  83. package/src/lib/componentConfigService.ts +88 -0
  84. package/src/lib/copyPopover.ts +30 -0
  85. package/src/lib/cssVarSync.ts +59 -7
  86. package/src/lib/editorConfigStore.ts +0 -10
  87. package/src/lib/editorCore.ts +402 -0
  88. package/src/lib/editorKeybindings.ts +52 -0
  89. package/src/lib/editorPersistence.ts +106 -0
  90. package/src/lib/editorRenderer.ts +74 -0
  91. package/src/lib/editorStore.test.ts +328 -0
  92. package/src/lib/editorStore.ts +412 -0
  93. package/src/lib/editorTypes.ts +100 -0
  94. package/src/lib/editorViewStore.ts +55 -0
  95. package/src/lib/files/versionedFileResource.ts +140 -0
  96. package/src/lib/fontLoader.ts +130 -0
  97. package/src/lib/fontMigration.ts +140 -0
  98. package/src/lib/fontParse.ts +168 -0
  99. package/src/lib/index.ts +48 -30
  100. package/src/lib/lazyConfig.test.ts +54 -0
  101. package/src/lib/migrations/2026-04-24-component-prefix-and-suffix-renames.ts +64 -0
  102. package/src/lib/migrations/2026-04-24-legacy-keys-and-bg-to-canvas.ts +71 -0
  103. package/src/lib/migrations/2026-04-27-segmentedcontrol-disabled-flatten.ts +43 -0
  104. package/src/lib/migrations/2026-05-08-collapsiblesection-frame-and-cleanup.ts +68 -0
  105. package/src/lib/migrations/2026-05-08-collapsiblesection-variant-namespace.ts +35 -0
  106. package/src/lib/migrations/2026-05-10-sectiondivider-gradient-stops.ts +50 -0
  107. package/src/lib/migrations/2026-05-13-primary-to-brand.ts +90 -0
  108. package/src/lib/migrations/index.ts +93 -0
  109. package/src/lib/migrations/migrations.test.ts +341 -0
  110. package/src/lib/navLinkTypes.ts +1 -0
  111. package/src/lib/overlayState.ts +3 -0
  112. package/src/lib/paletteDerivation.ts +300 -0
  113. package/src/lib/parentRouteStore.ts +42 -0
  114. package/src/lib/parsers/globalRootBlock.ts +32 -0
  115. package/src/lib/presetService.ts +94 -0
  116. package/src/lib/router.ts +42 -10
  117. package/src/lib/scrollSection.ts +45 -0
  118. package/src/lib/slices/columns.ts +59 -0
  119. package/src/lib/slices/components.ts +362 -0
  120. package/src/lib/slices/domainVars.ts +15 -0
  121. package/src/lib/slices/fonts.ts +30 -0
  122. package/src/lib/slices/gradients.ts +153 -0
  123. package/src/lib/slices/overlays.ts +132 -0
  124. package/src/lib/slices/palettes.ts +26 -0
  125. package/src/lib/slices/shadows.ts +123 -0
  126. package/src/lib/storage.ts +88 -0
  127. package/src/lib/themeInit.ts +74 -0
  128. package/src/lib/themeService.ts +101 -0
  129. package/src/lib/themeTypes.ts +146 -0
  130. package/src/lib/tokenRegistry.ts +148 -0
  131. package/src/pages/ComponentEditorPage.svelte +384 -0
  132. package/src/pages/ComponentEditorPage.svelte.d.ts +2 -0
  133. package/src/pages/Editor.svelte +98 -0
  134. package/src/pages/Editor.svelte.d.ts +2 -0
  135. package/src/pages/EditorShell.svelte +348 -0
  136. package/src/styles/_padding.scss +34 -0
  137. package/src/styles/fonts/Fraunces/Fraunces-italic-latin-ext.woff2 +0 -0
  138. package/src/styles/fonts/Fraunces/Fraunces-italic-latin.woff2 +0 -0
  139. package/src/styles/fonts/Fraunces/Fraunces-roman-latin-ext.woff2 +0 -0
  140. package/src/styles/fonts/Fraunces/Fraunces-roman-latin.woff2 +0 -0
  141. package/src/styles/fonts/Manrope/Manrope-latin-ext.woff2 +0 -0
  142. package/src/styles/fonts/Manrope/Manrope-latin.woff2 +0 -0
  143. package/src/styles/fonts.css +22 -10
  144. package/src/styles/form-controls.css +14 -16
  145. package/src/styles/tokens.css +1322 -0
  146. package/src/styles/ui-editor.css +126 -0
  147. package/src/{showcase → ui}/BezierCurveEditor.svelte +14 -14
  148. package/src/{showcase → ui}/ColorEditPanel.svelte +42 -36
  149. package/src/ui/EditorViewSwitcher.svelte +180 -0
  150. package/src/ui/FontStackEditor.svelte +360 -0
  151. package/src/ui/GradientEditor.svelte +461 -0
  152. package/src/ui/GradientStopPicker.svelte +74 -0
  153. package/src/ui/PaletteEditor.svelte +1590 -0
  154. package/src/ui/PaletteEditor.test.ts +108 -0
  155. package/src/ui/PresetFileManager.svelte +567 -0
  156. package/src/ui/ProjectFontsSection.svelte +645 -0
  157. package/src/{showcase → ui}/SurfacesTab.svelte +39 -39
  158. package/src/{showcase → ui}/TextTab.svelte +27 -27
  159. package/src/{showcase/TokenFileManager.svelte → ui/ThemeFileManager.svelte} +196 -112
  160. package/src/ui/Toggle.svelte +108 -0
  161. package/src/ui/UICopyPopover.svelte +78 -0
  162. package/src/{showcase/EditorDialog.svelte → ui/UIDialog.svelte} +66 -25
  163. package/src/ui/UIFontFamilySelector.svelte +309 -0
  164. package/src/ui/UIFontSizeSelector.svelte +165 -0
  165. package/src/ui/UIFontWeightSelector.svelte +52 -0
  166. package/src/ui/UILineHeightSelector.svelte +47 -0
  167. package/src/ui/UILinkToggle.svelte +60 -0
  168. package/src/ui/UIOptionItem.svelte +74 -0
  169. package/src/ui/UIOptionList.svelte +27 -0
  170. package/src/ui/UIPaddingSelector.svelte +661 -0
  171. package/src/ui/UIPaletteSelector.svelte +1084 -0
  172. package/src/ui/UIRadio.svelte +72 -0
  173. package/src/ui/UIRadioGroup.svelte +59 -0
  174. package/src/ui/UIRelinkConfirmPopover.svelte +235 -0
  175. package/src/ui/UITokenSelector.svelte +509 -0
  176. package/src/ui/UIVariantSelector.svelte +145 -0
  177. package/src/ui/VariablesTab.svelte +252 -0
  178. package/src/ui/index.ts +31 -0
  179. package/src/ui/keepInViewport.ts +84 -0
  180. package/src/ui/palette/GradientStopEditor.svelte +482 -0
  181. package/src/ui/palette/OverridesPanel.svelte +526 -0
  182. package/src/ui/palette/PaletteBase.svelte +165 -0
  183. package/src/ui/palette/ScaleCurveEditor.svelte +38 -0
  184. package/src/ui/palette/paletteEditorState.ts +89 -0
  185. package/src/ui/sections/ColumnsSection.svelte +273 -0
  186. package/src/ui/sections/GradientsSection.svelte +147 -0
  187. package/src/ui/sections/OverlaysSection.svelte +670 -0
  188. package/src/ui/sections/ShadowsSection.svelte +1250 -0
  189. package/src/ui/sections/TokenScaleTable.svelte +332 -0
  190. package/src/ui/sections/tokenScales.ts +81 -0
  191. package/src/ui/variantScales.ts +108 -0
  192. package/src/components/DetailNav.svelte +0 -78
  193. package/src/components/Toggle.svelte +0 -86
  194. package/src/lib/tokenInit.ts +0 -29
  195. package/src/lib/tokenService.ts +0 -144
  196. package/src/lib/tokenTypes.ts +0 -45
  197. package/src/pages/Admin.svelte +0 -100
  198. package/src/pages/ShowcasePage.svelte +0 -144
  199. package/src/showcase/BackupBrowser.svelte +0 -617
  200. package/src/showcase/ComponentsTab.svelte +0 -105
  201. package/src/showcase/PaletteEditor.svelte +0 -2579
  202. package/src/showcase/PaletteSelector.svelte +0 -627
  203. package/src/showcase/TokenMap.svelte +0 -54
  204. package/src/showcase/VariablesTab.svelte +0 -2655
  205. package/src/showcase/VisualsTab.svelte +0 -231
  206. package/src/showcase/demos/BadgeDemo.svelte +0 -56
  207. package/src/showcase/demos/CardDemo.svelte +0 -50
  208. package/src/showcase/demos/ChoiceButtonsDemo.svelte +0 -192
  209. package/src/showcase/demos/CollapsibleSectionDemo.svelte +0 -54
  210. package/src/showcase/demos/DialogDemo.svelte +0 -42
  211. package/src/showcase/demos/InlineEditActionsDemo.svelte +0 -25
  212. package/src/showcase/demos/NotificationDemo.svelte +0 -147
  213. package/src/showcase/demos/ProgressBarDemo.svelte +0 -54
  214. package/src/showcase/demos/RadioButtonDemo.svelte +0 -56
  215. package/src/showcase/demos/SectionDividerDemo.svelte +0 -77
  216. package/src/showcase/demos/StandardButtonsDemo.svelte +0 -455
  217. package/src/showcase/demos/TabBarDemo.svelte +0 -58
  218. package/src/showcase/demos/TooltipDemo.svelte +0 -52
  219. package/src/showcase/editor.css +0 -93
  220. package/src/showcase/index.ts +0 -17
  221. package/src/styles/fonts/Domine/Domine-VariableFont_wght.ttf +0 -0
  222. package/src/styles/fonts/Domine/OFL.txt +0 -97
  223. package/src/styles/fonts/Domine/README.txt +0 -66
  224. /package/src/{showcase → ui}/curveEngine.ts +0 -0
@@ -1,29 +0,0 @@
1
- import { getActiveTokens, applyCssVariables } from './tokenService';
2
- import { activeFileName, loadedConfigs, configsLoadedFromFile } from './editorConfigStore';
3
-
4
- /**
5
- * Fetch the active token file from the server and apply its CSS variables
6
- * to :root before the app mounts. Also populates the loadedConfigs store
7
- * so PaletteEditors initialize from the token file instead of stale localStorage.
8
- */
9
- export async function initializeTokens(): Promise<void> {
10
- try {
11
- const tokens = await getActiveTokens();
12
- if (tokens) {
13
- if (tokens.cssVariables && Object.keys(tokens.cssVariables).length > 0) {
14
- applyCssVariables(tokens.cssVariables);
15
- }
16
- const fileName = (tokens as any)._fileName || 'default';
17
- activeFileName.set(fileName);
18
- // Push editor configs so PaletteEditors load from the token file on mount.
19
- // The store is left populated; PaletteEditors read on mount then
20
- // VisualsTab (or the mount lifecycle) clears it after tick().
21
- if (tokens.editorConfigs && Object.keys(tokens.editorConfigs).length > 0) {
22
- loadedConfigs.set(tokens.editorConfigs);
23
- configsLoadedFromFile.set(true);
24
- }
25
- }
26
- } catch {
27
- // Silent fallback — variables.css provides defaults
28
- }
29
- }
@@ -1,144 +0,0 @@
1
- import type { TokenFile, TokenFileMeta } from './tokenTypes';
2
- import {
3
- applyCssVariables as applyCssVariablesSync,
4
- clearAllCssVarOverrides as clearAllCssVarOverridesSync,
5
- scrapeCssVariables as scrapeCssVariablesSync,
6
- } from './cssVarSync';
7
-
8
- // ── API helpers ──────────────────────────────────────────────
9
-
10
- export async function listTokenFiles(): Promise<TokenFileMeta[]> {
11
- const res = await fetch('/api/tokens');
12
- const data = await res.json();
13
- return data.files;
14
- }
15
-
16
- export async function loadTokenFile(fileName: string): Promise<TokenFile> {
17
- const res = await fetch(`/api/tokens/${encodeURIComponent(fileName)}`);
18
- if (!res.ok) throw new Error(`Failed to load token file: ${fileName}`);
19
- return res.json();
20
- }
21
-
22
- export async function saveTokenFile(fileName: string, data: TokenFile): Promise<void> {
23
- const res = await fetch(`/api/tokens/${encodeURIComponent(fileName)}`, {
24
- method: 'PUT',
25
- headers: { 'Content-Type': 'application/json' },
26
- body: JSON.stringify(data),
27
- });
28
- if (!res.ok) {
29
- const err = await res.json().catch(() => ({ error: 'Unknown error' }));
30
- throw new Error(err.error || 'Save failed');
31
- }
32
- }
33
-
34
- export async function deleteTokenFile(fileName: string): Promise<void> {
35
- const res = await fetch(`/api/tokens/${encodeURIComponent(fileName)}`, {
36
- method: 'DELETE',
37
- });
38
- if (!res.ok) {
39
- const err = await res.json().catch(() => ({ error: 'Unknown error' }));
40
- throw new Error(err.error || 'Delete failed');
41
- }
42
- }
43
-
44
- export async function getActiveTokens(): Promise<TokenFile | null> {
45
- try {
46
- const res = await fetch('/api/tokens/active');
47
- if (!res.ok) return null;
48
- return res.json();
49
- } catch {
50
- return null;
51
- }
52
- }
53
-
54
- export async function setActiveFile(fileName: string): Promise<void> {
55
- await fetch('/api/tokens/active', {
56
- method: 'PUT',
57
- headers: { 'Content-Type': 'application/json' },
58
- body: JSON.stringify({ name: fileName }),
59
- });
60
- }
61
-
62
- // ── Production API helpers ─────────────────────────────────
63
-
64
- export interface ProductionInfo {
65
- fileName: string;
66
- name: string;
67
- updatedAt: string;
68
- cssVariables: Record<string, string>;
69
- }
70
-
71
- export async function getProductionInfo(): Promise<ProductionInfo> {
72
- const res = await fetch('/api/tokens/production');
73
- return res.json();
74
- }
75
-
76
- export async function setProductionFile(fileName: string): Promise<{ ok: boolean; fileName: string; name: string }> {
77
- const res = await fetch('/api/tokens/production', {
78
- method: 'PUT',
79
- headers: { 'Content-Type': 'application/json' },
80
- body: JSON.stringify({ name: fileName }),
81
- });
82
- if (!res.ok) {
83
- const err = await res.json().catch(() => ({ error: 'Unknown error' }));
84
- throw new Error(err.error || 'Update failed');
85
- }
86
- return res.json();
87
- }
88
-
89
- // ── Backup API helpers ──────────────────────────────────────
90
-
91
- export interface BackupEntry {
92
- type: 'tokens' | 'css';
93
- file: string;
94
- name: string;
95
- timestamp: string;
96
- size: number;
97
- }
98
-
99
- export async function listBackups(): Promise<BackupEntry[]> {
100
- const res = await fetch('/api/backups');
101
- const data = await res.json();
102
- return data.backups;
103
- }
104
-
105
- export async function getBackupContent(type: string, file: string): Promise<string> {
106
- const res = await fetch(`/api/backups/${type}/${encodeURIComponent(file)}`);
107
- if (!res.ok) throw new Error('Failed to load backup');
108
- const data = await res.json();
109
- return data.content;
110
- }
111
-
112
- export async function restoreBackup(type: string, file: string): Promise<void> {
113
- const res = await fetch(`/api/backups/${type}/${encodeURIComponent(file)}/restore`, {
114
- method: 'POST',
115
- });
116
- if (!res.ok) throw new Error('Restore failed');
117
- }
118
-
119
- export async function getCurrentCss(): Promise<string> {
120
- const res = await fetch('/api/current-css');
121
- const data = await res.json();
122
- return data.content;
123
- }
124
-
125
- // ── CSS variable utilities ───────────────────────────────────
126
- // Implementations live in cssVarSync.ts so writes can fan out to the
127
- // parent document when running inside the live-preview overlay iframe.
128
- // Re-exported here to preserve existing call sites.
129
-
130
- export const clearAllCssVarOverrides = clearAllCssVarOverridesSync;
131
- export const applyCssVariables = applyCssVariablesSync;
132
- export const scrapeCssVariables = scrapeCssVariablesSync;
133
-
134
- /** Sanitize a display name to a safe file name */
135
- export function sanitizeFileName(name: string): string {
136
- return name
137
- .toLowerCase()
138
- .trim()
139
- .replace(/\s+/g, '-')
140
- .replace(/[^a-z0-9\-_]/g, '')
141
- .replace(/-+/g, '-')
142
- .replace(/^-|-$/g, '')
143
- || 'unnamed';
144
- }
@@ -1,45 +0,0 @@
1
- import type { CurveAnchor } from '../showcase/curveEngine';
2
-
3
- export type GradientStyle = 'linear' | 'radial' | 'conic';
4
-
5
- export interface GradientStop {
6
- position: number;
7
- paletteLabel: string;
8
- }
9
-
10
- export interface PaletteConfig {
11
- baseColor: string;
12
- tintHue: number;
13
- tintChroma?: number;
14
- lightnessCurve: CurveAnchor[];
15
- saturationCurve: CurveAnchor[];
16
- grayLightnessCurve: CurveAnchor[];
17
- graySaturationCurve: CurveAnchor[];
18
- scaleCurves: Record<string, { lightness: CurveAnchor[]; saturation: CurveAnchor[] }>;
19
- curveOffset: Record<string, number>;
20
- overrides: Record<string, string>;
21
- snappedScales: string[];
22
- emptyMode?: 'solid' | 'gradient';
23
- emptyStep?: string;
24
- gradientStyle?: GradientStyle;
25
- gradientAngle?: number;
26
- gradientReverse?: boolean;
27
- gradientStops?: GradientStop[];
28
- gradientSize?: 'page' | 'window';
29
- anchorToBase?: boolean;
30
- }
31
-
32
- export interface TokenFile {
33
- name: string;
34
- createdAt: string;
35
- updatedAt: string;
36
- editorConfigs: Record<string, PaletteConfig>;
37
- cssVariables: Record<string, string>;
38
- }
39
-
40
- export interface TokenFileMeta {
41
- name: string;
42
- fileName: string;
43
- updatedAt: string;
44
- isActive: boolean;
45
- }
@@ -1,100 +0,0 @@
1
- <script lang="ts">
2
- import VisualsTab from '../showcase/VisualsTab.svelte';
3
-
4
- const inOverlay = typeof window !== 'undefined' && window.parent !== window;
5
-
6
- function closeOverlay() {
7
- try {
8
- window.parent.postMessage({ type: 'lt-overlay-close' }, window.location.origin);
9
- } catch {
10
- // cross-origin parent — shouldn't happen, but fall back to a noop
11
- }
12
- }
13
- </script>
14
-
15
- <div class="admin-page">
16
- <div class="admin-bar">
17
- <div class="bar-left">
18
- {#if inOverlay}
19
- <button class="back-link as-button" on:click={closeOverlay}>
20
- <i class="fas fa-times"></i>
21
- <span>Close</span>
22
- </button>
23
- {:else}
24
- <a href="/" class="back-link">
25
- <i class="fas fa-arrow-left"></i>
26
- <span>Back to site</span>
27
- </a>
28
- {/if}
29
- <span class="admin-label">Design System</span>
30
- </div>
31
-
32
- <div class="bar-right"></div>
33
- </div>
34
-
35
- <VisualsTab />
36
- </div>
37
-
38
- <style>
39
- @import '../showcase/editor.css';
40
-
41
- .admin-page {
42
- min-height: 100vh;
43
- background: black;
44
- }
45
-
46
- .admin-bar {
47
- display: flex;
48
- align-items: center;
49
- gap: var(--space-16);
50
- padding: var(--space-10) var(--space-16);
51
- background: black;
52
- border-bottom: 1px solid var(--ui-border-faint);
53
- min-height: 52px;
54
- }
55
-
56
- .bar-left {
57
- display: flex;
58
- align-items: center;
59
- gap: var(--space-16);
60
- min-width: 0;
61
- }
62
-
63
- .bar-right {
64
- /* Reserved for future right-aligned controls; keeps grid balanced. */
65
- }
66
-
67
- .back-link {
68
- display: flex;
69
- align-items: center;
70
- gap: var(--space-6);
71
- color: var(--ui-text-tertiary);
72
- text-decoration: none;
73
- font-size: var(--font-md);
74
- transition: color var(--transition-fast);
75
- }
76
-
77
- .back-link:hover {
78
- color: var(--ui-text-primary);
79
- }
80
-
81
- .back-link.as-button {
82
- background: none;
83
- border: none;
84
- padding: 0;
85
- cursor: pointer;
86
- font-family: inherit;
87
- }
88
-
89
- .admin-label {
90
- font-size: var(--font-md);
91
- font-weight: var(--font-weight-semibold);
92
- color: var(--ui-text-secondary);
93
- }
94
-
95
- @media (max-width: 1100px) {
96
- .admin-label {
97
- display: none;
98
- }
99
- }
100
- </style>
@@ -1,144 +0,0 @@
1
- <script lang="ts">
2
- import ComponentsTab from '../showcase/ComponentsTab.svelte';
3
-
4
- let selectedComponent = 'standardButtons';
5
-
6
- const componentNavItems = [
7
- { id: 'choiceButtons', label: 'Choice Sets', icon: 'fas fa-hand-pointer' },
8
- { id: 'standardButtons', label: 'Button', icon: 'fas fa-square' },
9
- { id: 'notifications', label: 'Notification', icon: 'fas fa-bell' },
10
- { id: 'dialog', label: 'Dialog', icon: 'fas fa-window-restore' },
11
- { id: 'radioButtons', label: 'Radio Button', icon: 'fas fa-dot-circle' },
12
- { id: 'cards', label: 'Card', icon: 'fas fa-id-card' },
13
- { id: 'traitBadges', label: 'Trait Badge', icon: 'fas fa-tag' },
14
- { id: 'inlineEdit', label: 'Inline Edit Actions', icon: 'fas fa-pen' },
15
- { id: 'sectionDivider', label: 'Section Divider', icon: 'fas fa-minus' },
16
- { id: 'collapsible', label: 'Collapsible Section', icon: 'fas fa-chevron-down' },
17
- { id: 'tabBar', label: 'Tab Bar', icon: 'fas fa-columns' },
18
- { id: 'tooltip', label: 'Tooltip', icon: 'fas fa-comment-dots' },
19
- { id: 'progressBar', label: 'Progress Bar', icon: 'fas fa-tasks' }
20
- ];
21
- </script>
22
-
23
- <!--
24
- Site-level Components showcase page. Wrapped in .admin-page so the
25
- ComponentsTab demo chrome (labels, section wrappers) can resolve its
26
- --ui-* custom properties from editor.css. The actual components inside
27
- still read the user's design tokens, so live edits in the overlay
28
- editor flow straight through to this page.
29
- -->
30
- <div class="admin-page components-shell">
31
- <nav class="sidebar">
32
- <div class="sidebar-header">Components</div>
33
- <div class="nav-items">
34
- {#each componentNavItems as item}
35
- {#if item.id.startsWith('divider-')}
36
- <div class="nav-divider-label"><span>{item.label}</span></div>
37
- {:else}
38
- <button
39
- class="nav-item"
40
- class:active={selectedComponent === item.id}
41
- on:click={() => selectedComponent = item.id}
42
- >
43
- <i class={item.icon}></i>
44
- <span>{item.label}</span>
45
- </button>
46
- {/if}
47
- {/each}
48
- </div>
49
- </nav>
50
-
51
- <main class="content">
52
- <ComponentsTab {selectedComponent} />
53
- </main>
54
- </div>
55
-
56
- <style>
57
- @import '../showcase/editor.css';
58
- .components-shell {
59
- display: grid;
60
- grid-template-columns: 240px minmax(0, 1fr);
61
- min-height: 100vh;
62
- width: 100%;
63
- background: black;
64
- }
65
-
66
- .sidebar {
67
- position: sticky;
68
- top: 0;
69
- height: 100vh;
70
- overflow: hidden;
71
- background: black;
72
- border-right: 1px solid var(--ui-border-faint);
73
- display: flex;
74
- flex-direction: column;
75
- min-width: 0;
76
- }
77
-
78
- .sidebar-header {
79
- padding: var(--space-16) var(--space-16) var(--space-12);
80
- font-size: var(--font-lg);
81
- font-weight: var(--font-weight-bold);
82
- color: var(--ui-text-primary);
83
- }
84
-
85
- .nav-items {
86
- display: flex;
87
- flex-direction: column;
88
- gap: var(--space-2);
89
- padding: 0 var(--space-8) var(--space-16);
90
- flex: 1;
91
- overflow-y: auto;
92
- min-height: 0;
93
- }
94
-
95
- .nav-item {
96
- display: flex;
97
- align-items: center;
98
- gap: var(--space-8);
99
- width: 100%;
100
- padding: var(--space-6) var(--space-12) var(--space-6) var(--space-16);
101
- background: none;
102
- border: none;
103
- border-radius: var(--radius-md);
104
- color: var(--ui-text-tertiary);
105
- font-size: var(--font-md);
106
- cursor: pointer;
107
- text-align: left;
108
- transition: all var(--transition-fast);
109
- }
110
-
111
- .nav-item:hover {
112
- color: var(--ui-text-secondary);
113
- background: var(--ui-hover);
114
- }
115
-
116
- .nav-item.active {
117
- color: var(--ui-text-primary);
118
- background: var(--ui-surface-high);
119
- }
120
-
121
- .nav-item i {
122
- width: 1.25rem;
123
- text-align: center;
124
- font-size: var(--font-md);
125
- opacity: 0.7;
126
- }
127
-
128
- .nav-divider-label {
129
- padding: var(--space-12) var(--space-12) var(--space-4);
130
- font-size: var(--font-xs);
131
- font-weight: var(--font-weight-semibold);
132
- color: var(--ui-text-tertiary);
133
- text-transform: uppercase;
134
- letter-spacing: 0.05em;
135
- }
136
-
137
- .content {
138
- padding: var(--space-24) var(--space-32);
139
- overflow-y: auto;
140
- background: black;
141
- min-width: 0;
142
- max-width: 1280px;
143
- }
144
- </style>