@zylem/ui 0.8.8 → 0.8.9

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 (39) hide show
  1. package/dist/chunk-V47CGFWX.js +1 -0
  2. package/dist/index.css +1 -1
  3. package/dist/index.d.ts +15 -0
  4. package/dist/index.js +1 -1
  5. package/dist/styles.css +1 -1
  6. package/dist/styles.js +1 -1
  7. package/package.json +11 -2
  8. package/src/components/AddTile/AddTile.css.ts +78 -0
  9. package/src/components/AddTile/AddTile.tsx +37 -0
  10. package/src/components/BuildLabel/BuildLabel.css.ts +31 -0
  11. package/src/components/BuildLabel/BuildLabel.tsx +37 -0
  12. package/src/components/BuildLabel/mount-build-label.ts +77 -0
  13. package/src/components/BuildLabel/resolve-build-version.ts +47 -0
  14. package/src/components/ColorPalette/ColorPalette.css.ts +51 -0
  15. package/src/components/ColorPalette/ColorPalette.tsx +78 -0
  16. package/src/components/FrameStrip/FrameStrip.css.ts +132 -0
  17. package/src/components/FrameStrip/FrameStrip.tsx +118 -0
  18. package/src/components/PixelGrid/PixelGrid.css.ts +30 -0
  19. package/src/components/PixelGrid/PixelGrid.tsx +48 -0
  20. package/src/components/PlaybackControls/PlaybackControls.css.ts +53 -0
  21. package/src/components/PlaybackControls/PlaybackControls.tsx +80 -0
  22. package/src/components/SpriteSizePicker/SpriteSizePicker.css.ts +103 -0
  23. package/src/components/SpriteSizePicker/SpriteSizePicker.tsx +161 -0
  24. package/src/components/SpriteSizePicker/snap-size.ts +28 -0
  25. package/src/components/TimelineTrack/TimelineTrack.css.ts +163 -0
  26. package/src/components/TimelineTrack/TimelineTrack.tsx +90 -0
  27. package/src/components/TimelineTrack/timeline-math.ts +43 -0
  28. package/src/components/ToolButton/ToolButton.tsx +92 -0
  29. package/src/components/ToolGroup/ToolGroup.css.ts +35 -0
  30. package/src/components/ToolGroup/ToolGroup.tsx +29 -0
  31. package/src/components/ToolboxButton/ToolboxButton.css.ts +131 -0
  32. package/src/components/ToolboxButton/ToolboxButton.tsx +88 -0
  33. package/src/components/index.ts +68 -0
  34. package/src/global/hyperglass-base.css.ts +9 -6
  35. package/src/styles.ts +12 -0
  36. package/src/theme.css.ts +15 -0
  37. package/vite/collect-zylem-versions.ts +82 -0
  38. package/vite/index.ts +30 -0
  39. package/dist/chunk-3TP2SNNW.js +0 -1
@@ -95,3 +95,71 @@ export { SearchInput, type SearchInputProps } from './SearchInput/SearchInput';
95
95
  export { EmptyState, type EmptyStateProps } from './EmptyState/EmptyState';
96
96
  export { ScrollArea, type ScrollAreaProps } from './ScrollArea/ScrollArea';
97
97
  export { Kbd, type KbdProps } from './Kbd/Kbd';
98
+ export {
99
+ BuildLabel,
100
+ type BuildLabelProps,
101
+ } from './BuildLabel/BuildLabel';
102
+ export {
103
+ mountBuildLabel,
104
+ BUILD_LABEL_ID,
105
+ type BuildLabelModel,
106
+ } from './BuildLabel/mount-build-label';
107
+ export {
108
+ formatBuildLabel,
109
+ resolveBuildVersion,
110
+ } from './BuildLabel/resolve-build-version';
111
+
112
+ // Art / Director (Creator sprite editor, director, toolbox)
113
+ export { PixelGrid, type PixelGridProps } from './PixelGrid/PixelGrid';
114
+ export {
115
+ SpriteSizePicker,
116
+ type SpriteSizePickerProps,
117
+ } from './SpriteSizePicker/SpriteSizePicker';
118
+ export {
119
+ snapSize,
120
+ SPRITE_SIZE_PRESETS,
121
+ type SnapOptions,
122
+ type SpriteSize,
123
+ } from './SpriteSizePicker/snap-size';
124
+ export { ToolGroup, type ToolGroupProps } from './ToolGroup/ToolGroup';
125
+ export {
126
+ ToolButton,
127
+ ART_TOOLS,
128
+ ART_TOOL_ICONS,
129
+ ART_TOOL_LABELS,
130
+ type ArtTool,
131
+ type ToolButtonProps,
132
+ } from './ToolButton/ToolButton';
133
+ export { AddTile, type AddTileProps } from './AddTile/AddTile';
134
+ export {
135
+ ColorPalette,
136
+ Swatch,
137
+ TRANSPARENT,
138
+ type ColorPaletteProps,
139
+ type SwatchProps,
140
+ } from './ColorPalette/ColorPalette';
141
+ export {
142
+ FrameStrip,
143
+ FrameThumb,
144
+ FrameActions,
145
+ type FrameStripProps,
146
+ type FrameThumbProps,
147
+ type FrameActionsProps,
148
+ } from './FrameStrip/FrameStrip';
149
+ export {
150
+ PlaybackControls,
151
+ type PlaybackControlsProps,
152
+ } from './PlaybackControls/PlaybackControls';
153
+ export { TimelineTrack, type TimelineTrackProps } from './TimelineTrack/TimelineTrack';
154
+ export {
155
+ formatSeconds,
156
+ intervalTicks,
157
+ markerPercent,
158
+ } from './TimelineTrack/timeline-math';
159
+ export {
160
+ ToolboxButton,
161
+ ToolboxGrid,
162
+ type ToolboxButtonProps,
163
+ type ToolboxGridProps,
164
+ type ToolboxSize,
165
+ } from './ToolboxButton/ToolboxButton';
@@ -46,12 +46,15 @@ globalStyle(
46
46
  // containing block for the sheen — don't override them to `relative` or they
47
47
  // stretch in flex parents. `.entity-grid-item` already sets `relative` in
48
48
  // editor-base.
49
- globalStyle('.zylem-button:not(.zylem-console-clear), .zylem-toolbar-btn', {
50
- position: 'relative',
51
- });
49
+ globalStyle(
50
+ '.zylem-button:not(.zylem-console-clear), .zylem-toolbar-btn, .zylem-toolbox-btn',
51
+ {
52
+ position: 'relative',
53
+ },
54
+ );
52
55
 
53
56
  globalStyle(
54
- '.zylem-button::before, .zylem-toolbar-btn::before, .entity-grid-item::before',
57
+ '.zylem-button::before, .zylem-toolbar-btn::before, .zylem-toolbox-btn::before, .entity-grid-item::before',
55
58
  {
56
59
  content: '""',
57
60
  position: 'absolute',
@@ -81,7 +84,7 @@ globalStyle(
81
84
  );
82
85
 
83
86
  globalStyle(
84
- '.zylem-button:hover:not([disabled])::before, .zylem-toolbar-btn:hover:not([disabled])::before, .entity-grid-item:hover::before',
87
+ '.zylem-button:hover:not([disabled])::before, .zylem-toolbar-btn:hover:not([disabled])::before, .zylem-toolbox-btn:hover:not([disabled])::before, .entity-grid-item:hover::before',
85
88
  {
86
89
  backgroundPosition: '25% 50%',
87
90
  opacity: 0.5,
@@ -94,7 +97,7 @@ globalStyle(
94
97
  );
95
98
 
96
99
  globalStyle(
97
- '.zylem-button:active:not([disabled])::before, .zylem-toolbar-btn:active:not([disabled])::before, .entity-grid-item:active::before',
100
+ '.zylem-button:active:not([disabled])::before, .zylem-toolbar-btn:active:not([disabled])::before, .zylem-toolbox-btn:active:not([disabled])::before, .entity-grid-item:active::before',
98
101
  {
99
102
  backgroundPosition: '50% 15%',
100
103
  opacity: 0.58,
package/src/styles.ts CHANGED
@@ -49,3 +49,15 @@ import './components/MenuButton/MenuButton.css';
49
49
  import './components/ItemPicker/ItemPicker.css';
50
50
  import './components/EmptyState/EmptyState.css';
51
51
  import './components/Kbd/Kbd.css';
52
+ import './components/BuildLabel/BuildLabel.css';
53
+
54
+ // Art / Director surfaces (Creator sprite editor, director, toolbox).
55
+ import './components/PixelGrid/PixelGrid.css';
56
+ import './components/SpriteSizePicker/SpriteSizePicker.css';
57
+ import './components/ToolGroup/ToolGroup.css';
58
+ import './components/AddTile/AddTile.css';
59
+ import './components/ColorPalette/ColorPalette.css';
60
+ import './components/FrameStrip/FrameStrip.css';
61
+ import './components/PlaybackControls/PlaybackControls.css';
62
+ import './components/TimelineTrack/TimelineTrack.css';
63
+ import './components/ToolboxButton/ToolboxButton.css';
package/src/theme.css.ts CHANGED
@@ -112,6 +112,16 @@ const tokens = {
112
112
  normal: '160ms',
113
113
  easeOut: 'cubic-bezier(.2,.8,.2,1)',
114
114
  },
115
+ /**
116
+ * Art / pixel-editor surfaces. The checker pair reads as "transparent"
117
+ * behind sprite pixels, so it sits lighter than the panel palette; canvas
118
+ * renderers can draw the same values from `tokenValues.art`.
119
+ */
120
+ art: {
121
+ checkerLight: '#4F5C72',
122
+ checkerDark: '#3C4759',
123
+ canvasBorder: 'rgba(150, 210, 255, 0.5)',
124
+ },
115
125
  /**
116
126
  * Stacking tiers. Declared in `layers/tiers.ts` because the runtime side of
117
127
  * the layer system reads the same ladder without loading this file.
@@ -212,6 +222,11 @@ const varNames = {
212
222
  normal: 'zylem-motion-normal',
213
223
  easeOut: 'zylem-motion-ease-out',
214
224
  },
225
+ art: {
226
+ checkerLight: 'zylem-art-checker-light',
227
+ checkerDark: 'zylem-art-checker-dark',
228
+ canvasBorder: 'zylem-art-canvas-border',
229
+ },
215
230
  layers: layerTierVarNames,
216
231
  } as const;
217
232
 
@@ -0,0 +1,82 @@
1
+ import { existsSync, readFileSync } from 'node:fs';
2
+ import { dirname, join } from 'node:path';
3
+
4
+ interface PackageManifest {
5
+ name?: string;
6
+ version?: string;
7
+ dependencies?: Record<string, string>;
8
+ devDependencies?: Record<string, string>;
9
+ }
10
+
11
+ function readManifest(dir: string): PackageManifest | null {
12
+ const pkgPath = join(dir, 'package.json');
13
+ try {
14
+ return JSON.parse(readFileSync(pkgPath, 'utf8')) as PackageManifest;
15
+ } catch {
16
+ return null;
17
+ }
18
+ }
19
+
20
+ /** Resolve an installed package directory from a declaring package's context. */
21
+ function resolvePackageDir(fromDir: string, name: string): string | null {
22
+ let dir = fromDir;
23
+ while (dir !== dirname(dir)) {
24
+ const candidate = join(dir, 'node_modules', name);
25
+ if (existsSync(join(candidate, 'package.json'))) {
26
+ return candidate;
27
+ }
28
+ dir = dirname(dir);
29
+ }
30
+ return null;
31
+ }
32
+
33
+ /**
34
+ * Walk the resolved `@zylem/*` dependency graph starting from `rootPkgDir`
35
+ * and return a sorted map of package name → installed version.
36
+ */
37
+ export function collectZylemPackageVersions(rootPkgDir: string): Record<string, string> {
38
+ const versions: Record<string, string> = {};
39
+ const seenNames = new Set<string>();
40
+ const visitedDirs = new Set<string>();
41
+ const queue: Array<{ dir: string; isRoot: boolean }> = [{ dir: rootPkgDir, isRoot: true }];
42
+
43
+ while (queue.length > 0) {
44
+ const { dir, isRoot } = queue.shift()!;
45
+ if (visitedDirs.has(dir)) continue;
46
+ visitedDirs.add(dir);
47
+
48
+ const manifest = readManifest(dir);
49
+ if (!manifest) continue;
50
+
51
+ if (typeof manifest.name === 'string' && manifest.name.startsWith('@zylem/')) {
52
+ versions[manifest.name] =
53
+ typeof manifest.version === 'string' ? manifest.version : '0.0.0';
54
+ }
55
+
56
+ const depFields: Array<'dependencies' | 'devDependencies'> = isRoot
57
+ ? ['dependencies', 'devDependencies']
58
+ : ['dependencies'];
59
+
60
+ for (const field of depFields) {
61
+ const deps = manifest[field] ?? {};
62
+ for (const name of Object.keys(deps)) {
63
+ if (!name.startsWith('@zylem/') || seenNames.has(name)) continue;
64
+ seenNames.add(name);
65
+
66
+ const resolvedDir = resolvePackageDir(dir, name);
67
+ if (!resolvedDir) continue;
68
+
69
+ const resolvedManifest = readManifest(resolvedDir);
70
+ if (!resolvedManifest) continue;
71
+
72
+ versions[name] =
73
+ typeof resolvedManifest.version === 'string'
74
+ ? resolvedManifest.version
75
+ : '0.0.0';
76
+ queue.push({ dir: resolvedDir, isRoot: false });
77
+ }
78
+ }
79
+ }
80
+
81
+ return Object.fromEntries(Object.entries(versions).sort(([a], [b]) => a.localeCompare(b)));
82
+ }
package/vite/index.ts ADDED
@@ -0,0 +1,30 @@
1
+ import type { Plugin } from 'vite';
2
+ import { collectZylemPackageVersions } from './collect-zylem-versions.ts';
3
+
4
+ export { collectZylemPackageVersions } from './collect-zylem-versions.ts';
5
+
6
+ export const VIRTUAL_ZYLEM_VERSIONS_ID = 'virtual:zylem-versions';
7
+ const RESOLVED_VIRTUAL_ZYLEM_VERSIONS_ID = `\0${VIRTUAL_ZYLEM_VERSIONS_ID}`;
8
+
9
+ /**
10
+ * Vite plugin that injects a `virtual:zylem-versions` module containing
11
+ * every resolved `@zylem/*` package version in `rootPkgDir`'s dependency
12
+ * graph. Demo/showcase apps mount that map as the top-right build HUD.
13
+ */
14
+ export function zylemVersionsPlugin(rootPkgDir: string): Plugin {
15
+ const versions = collectZylemPackageVersions(rootPkgDir);
16
+
17
+ return {
18
+ name: 'zylem-versions',
19
+ resolveId(id) {
20
+ if (id === VIRTUAL_ZYLEM_VERSIONS_ID) {
21
+ return RESOLVED_VIRTUAL_ZYLEM_VERSIONS_ID;
22
+ }
23
+ },
24
+ load(id) {
25
+ if (id === RESOLVED_VIRTUAL_ZYLEM_VERSIONS_ID) {
26
+ return `export const ZYLEM_PACKAGE_VERSIONS = ${JSON.stringify(versions)};`;
27
+ }
28
+ },
29
+ };
30
+ }
@@ -1 +0,0 @@
1
- var l={colors:{primary:"#61A6E8",primaryHover:"#3B8AD8",primaryActive:"#0C6EB8",accent:"#E64534",accentHover:"#C93A2C",accentActive:"#A82F24",background:"#11151C",backgroundTranslucent:"rgba(10, 20, 30, 0.46)",surface:"#1A1F27",surfaceHover:"#222831",border:"#2D3643",active:"rgba(20, 255, 60, 0.7)",activeHover:"rgba(20, 255, 60, 0.4)",successHover:"#2a6734b3",text:"#E6EBEF",textSecondary:"#88929E",consoleBackground:"rgba(20, 40, 60, 0.25)",consoleText:"#61A6E8"},spacing:{xxs:"0.125rem",xs:"0.25rem",sm:"0.5rem",md:"0.75rem",lg:"1rem",xl:"1.5rem",xxl:"2rem",xxxl:"3rem"},sizes:{icon:"28px",iconSm:"16px",iconLg:"96px"},typography:{fontFamily:"'Exo 2', sans-serif",fontSize:"14px"},borders:{radius:"12px",width:"1.5px"},material:{glassPanel:"linear-gradient(180deg, rgba(38, 76, 112, 0.74), rgba(10, 24, 38, 0.58))",glassPanelDark:"linear-gradient(180deg, rgba(26, 31, 39, 0.75), rgba(10, 20, 30, 0.68))",glossyBar:"linear-gradient(180deg, rgba(205, 232, 255, 0.55) 0%, rgba(97, 166, 232, 0.34) 38%, rgba(18, 54, 88, 0.86) 100%)",buttonGlass:"linear-gradient(180deg, rgba(178, 219, 255, 0.34), rgba(30, 94, 148, 0.72) 48%, rgba(9, 34, 58, 0.92))",buttonGlassHover:"linear-gradient(180deg, rgba(218, 242, 255, 0.58), rgba(48, 137, 220, 0.86) 48%, rgba(11, 62, 112, 0.96))",buttonGlassActive:"linear-gradient(180deg, rgba(190, 255, 203, 0.42), rgba(28, 174, 63, 0.78) 50%, rgba(9, 86, 31, 0.95))",buttonGlassDanger:"linear-gradient(180deg, rgba(255, 210, 202, 0.36), rgba(230, 69, 52, 0.82) 50%, rgba(96, 18, 13, 0.94))",fieldGlass:"linear-gradient(180deg, rgba(8, 19, 31, 0.82), rgba(15, 39, 62, 0.72))",panelHeaderGloss:"linear-gradient(180deg, rgba(190, 226, 255, 0.18), rgba(61, 118, 165, 0.16) 46%, rgba(10, 27, 44, 0.26))"},effects:{blurSm:"8px",blurMd:"14px",blurLg:"24px",shadowPanel:"0 22px 54px rgba(0, 0, 0, 0.48), inset 0 1px 0 rgba(255, 255, 255, 0.10)",shadowButton:"inset 0 1px 0 rgba(255,255,255,0.38), inset 0 -1px 0 rgba(0,0,0,0.45), 0 2px 7px rgba(0,0,0,0.35)",shadowInset:"inset 0 1px 2px rgba(0,0,0,0.42), inset 0 -1px 0 rgba(255,255,255,0.08)",glowPrimary:"0 0 18px rgba(97, 166, 232, 0.28)",glowActive:"0 0 20px rgba(20, 255, 60, 0.26)",glowDanger:"0 0 20px rgba(230, 69, 52, 0.24)",focusRing:"0 0 0 2px rgba(97, 166, 232, 0.38), 0 0 18px rgba(97, 166, 232, 0.22)"},radii:{window:"14px",panel:"12px",button:"7px",control:"6px",card:"10px"},motion:{fast:"120ms",normal:"160ms",easeOut:"cubic-bezier(.2,.8,.2,1)"},layers:{base:"0",panel:"1000",modal:"2000",popover:"3000",tooltip:"4000",menu:"5000"}},o={colors:{primary:"var(--zylem-color-primary)",primaryHover:"var(--zylem-color-primary-hover)",primaryActive:"var(--zylem-color-primary-active)",accent:"var(--zylem-color-accent)",accentHover:"var(--zylem-color-accent-hover)",accentActive:"var(--zylem-color-accent-active)",background:"var(--zylem-color-background)",backgroundTranslucent:"var(--zylem-color-background-translucent)",surface:"var(--zylem-color-surface)",surfaceHover:"var(--zylem-color-surface-hover)",border:"var(--zylem-color-border)",active:"var(--zylem-color-active)",activeHover:"var(--zylem-color-active-hover)",successHover:"var(--zylem-color-success-hover)",text:"var(--zylem-color-text)",textSecondary:"var(--zylem-color-text-secondary)",consoleBackground:"var(--zylem-color-console-background)",consoleText:"var(--zylem-color-console-text)"},spacing:{xxs:"var(--zylem-spacing-xxs)",xs:"var(--zylem-spacing-xs)",sm:"var(--zylem-spacing-sm)",md:"var(--zylem-spacing-md)",lg:"var(--zylem-spacing-lg)",xl:"var(--zylem-spacing-xl)",xxl:"var(--zylem-spacing-xxl)",xxxl:"var(--zylem-spacing-xxxl)"},sizes:{icon:"var(--zylem-size-icon)",iconSm:"var(--zylem-size-icon-sm)",iconLg:"var(--zylem-size-icon-lg)"},typography:{fontFamily:"var(--zylem-font-family)",fontSize:"var(--zylem-font-size)"},borders:{radius:"var(--zylem-radius)",width:"var(--zylem-border)"},material:{glassPanel:"var(--zylem-material-glass-panel)",glassPanelDark:"var(--zylem-material-glass-panel-dark)",glossyBar:"var(--zylem-material-glossy-bar)",buttonGlass:"var(--zylem-material-button-glass)",buttonGlassHover:"var(--zylem-material-button-glass-hover)",buttonGlassActive:"var(--zylem-material-button-glass-active)",buttonGlassDanger:"var(--zylem-material-button-glass-danger)",fieldGlass:"var(--zylem-material-field-glass)",panelHeaderGloss:"var(--zylem-material-panel-header-gloss)"},effects:{blurSm:"var(--zylem-effect-blur-sm)",blurMd:"var(--zylem-effect-blur-md)",blurLg:"var(--zylem-effect-blur-lg)",shadowPanel:"var(--zylem-effect-shadow-panel)",shadowButton:"var(--zylem-effect-shadow-button)",shadowInset:"var(--zylem-effect-shadow-inset)",glowPrimary:"var(--zylem-effect-glow-primary)",glowActive:"var(--zylem-effect-glow-active)",glowDanger:"var(--zylem-effect-glow-danger)",focusRing:"var(--zylem-effect-focus-ring)"},radii:{window:"var(--zylem-radius-window)",panel:"var(--zylem-radius-panel)",button:"var(--zylem-radius-button)",control:"var(--zylem-radius-control)",card:"var(--zylem-radius-card)"},motion:{fast:"var(--zylem-motion-fast)",normal:"var(--zylem-motion-normal)",easeOut:"var(--zylem-motion-ease-out)"},layers:{base:"var(--zylem-layer-base)",panel:"var(--zylem-layer-panel)",modal:"var(--zylem-layer-modal)",popover:"var(--zylem-layer-popover)",tooltip:"var(--zylem-layer-tooltip)",menu:"var(--zylem-layer-menu)"}};export{l as a,o as b};