@zylem/ui 0.1.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.
@@ -0,0 +1,40 @@
1
+ import { globalStyle } from '@vanilla-extract/css';
2
+ import { vars } from '../theme.css';
3
+
4
+ globalStyle('.zylem-menu', {
5
+ display: 'flex',
6
+ flexDirection: 'column',
7
+ height: '100%',
8
+ width: '100%',
9
+ background: vars.colors.backgroundTranslucent,
10
+ borderRadius: vars.borders.radius,
11
+ boxSizing: 'border-box',
12
+ overflowY: 'auto',
13
+ overflowX: 'hidden',
14
+ pointerEvents: 'auto',
15
+ fontFamily: vars.typography.fontFamily,
16
+ });
17
+
18
+ globalStyle('.zylem-menu::-webkit-scrollbar', {
19
+ display: 'none',
20
+ });
21
+
22
+ globalStyle('.zylem-menu-header', {
23
+ display: 'flex',
24
+ alignItems: 'center',
25
+ justifyContent: 'space-between',
26
+ gap: vars.spacing.sm,
27
+ borderBottom: `${vars.borders.width} solid ${vars.colors.primary}`,
28
+ });
29
+
30
+ globalStyle('.zylem-collapse-button', {
31
+ flexShrink: 0,
32
+ padding: vars.spacing.sm,
33
+ fontSize: '12px',
34
+ lineHeight: 1,
35
+ marginRight: vars.spacing.sm,
36
+ });
37
+
38
+ globalStyle('.zylem-menu h3, .zylem-menu h4', {
39
+ margin: 0,
40
+ });
@@ -0,0 +1,18 @@
1
+ import { globalStyle } from '@vanilla-extract/css';
2
+ import { vars } from '../theme.css';
3
+
4
+ globalStyle('.sidebar', {
5
+ background: vars.colors.surface,
6
+ borderRight: `1px solid ${vars.colors.border}`,
7
+ });
8
+
9
+ globalStyle('.sidebar-item:hover', {
10
+ background: vars.colors.surfaceHover,
11
+ });
12
+
13
+ globalStyle('.sidebar-item.is-active', {
14
+ background: vars.colors.primaryActive,
15
+ color: 'white',
16
+ fontWeight: 600,
17
+ boxShadow: 'inset 0 0 8px rgba(97, 166, 232, 0.4)',
18
+ });
@@ -0,0 +1,62 @@
1
+ import { globalStyle, keyframes } from '@vanilla-extract/css';
2
+ import { vars } from '../theme.css';
3
+
4
+ const tooltipEnter = keyframes({
5
+ from: { opacity: 0, transform: 'translateY(4px)' },
6
+ to: { opacity: 1, transform: 'translateY(0)' },
7
+ });
8
+
9
+ globalStyle('.zylem-toolbar', {
10
+ display: 'flex',
11
+ position: 'sticky',
12
+ top: 0,
13
+ gap: vars.spacing.md,
14
+ padding: vars.spacing.md,
15
+ zIndex: 1,
16
+ });
17
+
18
+ globalStyle('.zylem-toolbar.separator', {
19
+ borderBottom: `${vars.borders.width} solid ${vars.colors.primary}`,
20
+ });
21
+
22
+ globalStyle('.zylem-toolbar-btn', {
23
+ display: 'flex',
24
+ alignItems: 'center',
25
+ padding: vars.spacing.md,
26
+ cursor: 'pointer',
27
+ });
28
+
29
+ globalStyle('.zylem-toolbar-btn:hover svg', {
30
+ stroke: vars.colors.backgroundTranslucent,
31
+ });
32
+
33
+ globalStyle('.zylem-toolbar-btn.selected', {
34
+ background: vars.colors.active,
35
+ borderColor: vars.colors.active,
36
+ });
37
+
38
+ globalStyle('.zylem-toolbar-btn.selected svg', {
39
+ stroke: vars.colors.backgroundTranslucent,
40
+ });
41
+
42
+ globalStyle('.zylem-icon', {
43
+ width: vars.sizes.icon,
44
+ height: vars.sizes.icon,
45
+ stroke: vars.colors.primary,
46
+ });
47
+
48
+ globalStyle('.zylem-tooltip', {
49
+ background: vars.colors.backgroundTranslucent,
50
+ color: vars.colors.primary,
51
+ padding: `${vars.spacing.sm} ${vars.spacing.md}`,
52
+ marginTop: vars.spacing.sm,
53
+ borderRadius: vars.borders.radius,
54
+ border: `${vars.borders.width} solid ${vars.colors.primary}`,
55
+ fontSize: vars.typography.fontSize,
56
+ pointerEvents: 'none',
57
+ zIndex: 1000,
58
+ });
59
+
60
+ globalStyle('.zylem-tooltip[data-enter]', {
61
+ animation: `${tooltipEnter} 0.2s ease-out`,
62
+ });
package/src/index.ts ADDED
@@ -0,0 +1,14 @@
1
+ /**
2
+ * Public TypeScript surface for `@zylem/ui`.
3
+ *
4
+ * - `vars` — typed handles to every Zylem design token, resolving to the
5
+ * legacy `--zylem-*` CSS custom properties. Use inside `style()`,
6
+ * `globalStyle()`, or `sprinkles()` calls.
7
+ * - `sprinkles` — atomic-utility function generated from the same tokens.
8
+ * - `breakpoints` / `tokenValues` — documentation/tooling helpers.
9
+ *
10
+ * Consumers should also import the CSS bundle once at app entry:
11
+ * `import '@zylem/ui/styles.css'`.
12
+ */
13
+ export { vars, tokenValues } from './theme.css';
14
+ export { sprinkles, breakpoints, type Sprinkles } from './sprinkles.css';
@@ -0,0 +1,164 @@
1
+ import {
2
+ defineProperties,
3
+ createSprinkles,
4
+ } from '@vanilla-extract/sprinkles';
5
+ import { vars } from './theme.css';
6
+
7
+ /**
8
+ * Responsive conditions that mirror the breakpoints used across the
9
+ * legacy `*.module.css` files. `desktop` is the default; declare narrower
10
+ * overrides under `tablet` (≤900px) or `mobile` (≤720px).
11
+ */
12
+ const conditions = {
13
+ desktop: {},
14
+ tablet: { '@media': 'screen and (max-width: 900px)' },
15
+ mobile: { '@media': 'screen and (max-width: 720px)' },
16
+ } as const;
17
+
18
+ const spacingScale = {
19
+ ...vars.spacing,
20
+ none: '0',
21
+ auto: 'auto',
22
+ } as const;
23
+
24
+ const sizeScale = {
25
+ ...vars.spacing,
26
+ ...vars.sizes,
27
+ none: '0',
28
+ auto: 'auto',
29
+ full: '100%',
30
+ screen: '100dvh',
31
+ } as const;
32
+
33
+ const radiusScale = {
34
+ none: '0',
35
+ sm: '4px',
36
+ md: '8px',
37
+ default: vars.borders.radius,
38
+ lg: '16px',
39
+ xl: '20px',
40
+ pill: '999px',
41
+ } as const;
42
+
43
+ const responsive = defineProperties({
44
+ conditions,
45
+ defaultCondition: 'desktop',
46
+ properties: {
47
+ display: [
48
+ 'none',
49
+ 'block',
50
+ 'inline',
51
+ 'inline-block',
52
+ 'flex',
53
+ 'inline-flex',
54
+ 'grid',
55
+ 'inline-grid',
56
+ ],
57
+ position: ['static', 'relative', 'absolute', 'fixed', 'sticky'],
58
+ flexDirection: ['row', 'row-reverse', 'column', 'column-reverse'],
59
+ flexWrap: ['wrap', 'nowrap', 'wrap-reverse'],
60
+ alignItems: ['stretch', 'flex-start', 'center', 'flex-end', 'baseline'],
61
+ justifyContent: [
62
+ 'flex-start',
63
+ 'center',
64
+ 'flex-end',
65
+ 'space-between',
66
+ 'space-around',
67
+ 'space-evenly',
68
+ ],
69
+ flex: ['1', 'none', 'auto'],
70
+ textAlign: ['left', 'center', 'right', 'justify'],
71
+ textTransform: ['none', 'uppercase', 'lowercase', 'capitalize'],
72
+ fontWeight: ['400', '500', '600', '700', '800'],
73
+ boxSizing: ['border-box', 'content-box'],
74
+ overflow: ['hidden', 'auto', 'scroll', 'visible'],
75
+ overflowX: ['hidden', 'auto', 'scroll', 'visible'],
76
+ overflowY: ['hidden', 'auto', 'scroll', 'visible'],
77
+ padding: spacingScale,
78
+ paddingTop: spacingScale,
79
+ paddingRight: spacingScale,
80
+ paddingBottom: spacingScale,
81
+ paddingLeft: spacingScale,
82
+ paddingInline: spacingScale,
83
+ paddingBlock: spacingScale,
84
+ margin: spacingScale,
85
+ marginTop: spacingScale,
86
+ marginRight: spacingScale,
87
+ marginBottom: spacingScale,
88
+ marginLeft: spacingScale,
89
+ marginInline: spacingScale,
90
+ marginBlock: spacingScale,
91
+ gap: spacingScale,
92
+ rowGap: spacingScale,
93
+ columnGap: spacingScale,
94
+ width: sizeScale,
95
+ height: sizeScale,
96
+ minWidth: sizeScale,
97
+ minHeight: sizeScale,
98
+ maxWidth: sizeScale,
99
+ maxHeight: sizeScale,
100
+ },
101
+ shorthands: {
102
+ px: ['paddingLeft', 'paddingRight'],
103
+ py: ['paddingTop', 'paddingBottom'],
104
+ mx: ['marginLeft', 'marginRight'],
105
+ my: ['marginTop', 'marginBottom'],
106
+ placeItems: ['alignItems', 'justifyContent'],
107
+ size: ['width', 'height'],
108
+ },
109
+ });
110
+
111
+ const color = defineProperties({
112
+ properties: {
113
+ color: vars.colors,
114
+ background: vars.colors,
115
+ backgroundColor: vars.colors,
116
+ borderColor: vars.colors,
117
+ },
118
+ });
119
+
120
+ const visual = defineProperties({
121
+ properties: {
122
+ borderRadius: radiusScale,
123
+ borderWidth: {
124
+ none: '0',
125
+ hairline: '1px',
126
+ default: vars.borders.width,
127
+ bold: '2px',
128
+ },
129
+ borderStyle: ['solid', 'dashed', 'dotted', 'none'],
130
+ fontFamily: { default: vars.typography.fontFamily },
131
+ fontSize: { default: vars.typography.fontSize },
132
+ lineHeight: ['1', '1.2', '1.35', '1.45', '1.5'],
133
+ letterSpacing: {
134
+ tight: '-0.01em',
135
+ normal: '0',
136
+ wide: '0.04em',
137
+ wider: '0.08em',
138
+ widest: '0.2em',
139
+ },
140
+ },
141
+ });
142
+
143
+ /**
144
+ * Atomic-utility function generated from the Zylem token system.
145
+ *
146
+ * Usage:
147
+ * ```ts
148
+ * import { sprinkles } from '@zylem/ui';
149
+ *
150
+ * const card = style([
151
+ * sprinkles({ padding: 'lg', borderRadius: 'default', color: 'text' }),
152
+ * ]);
153
+ * ```
154
+ */
155
+ export const sprinkles = createSprinkles(responsive, color, visual);
156
+
157
+ /** Inferred prop type of the sprinkles function — accept it on components. */
158
+ export type Sprinkles = Parameters<typeof sprinkles>[0];
159
+
160
+ /** Responsive conditions exposed for documentation/tooling. */
161
+ export const breakpoints = {
162
+ tablet: '900px',
163
+ mobile: '720px',
164
+ } as const;
package/src/styles.ts ADDED
@@ -0,0 +1,20 @@
1
+ /**
2
+ * Side-effect entry that aggregates every vanilla-extract `globalStyle()`
3
+ * registration plus the plain-CSS font sidecar. tsup uses this as one of
4
+ * its entries so the resulting bundle ends up at `dist/styles.css` — the
5
+ * single self-contained file the editor's web component injects into its
6
+ * shadow DOM via `?raw` and that any consumer can import as plain CSS.
7
+ */
8
+ import './fonts.css';
9
+ import './theme.css';
10
+ import './global/logo.css';
11
+ import './global/common.css';
12
+ import './global/sidebar.css';
13
+ import './global/editor-base.css';
14
+ import './global/toolbar.css';
15
+ import './global/console.css';
16
+ import './global/accordion.css';
17
+ import './global/menu.css';
18
+ import './global/entities.css';
19
+ import './global/detached-panel.css';
20
+ import './global/checkbox.css';
@@ -0,0 +1,132 @@
1
+ import {
2
+ createGlobalTheme,
3
+ createGlobalThemeContract,
4
+ } from '@vanilla-extract/css';
5
+
6
+ /**
7
+ * Concrete design-token values for the Zylem UI.
8
+ *
9
+ * Each leaf in this object is paired with a CSS custom-property name in
10
+ * {@link varNames}. The two structures must stay in lock-step. Values feed
11
+ * `createGlobalTheme`; names feed `createGlobalThemeContract` so the
12
+ * generated CSS variables keep their legacy `--zylem-*` identifiers.
13
+ */
14
+ const tokens = {
15
+ colors: {
16
+ primary: '#61A6E8',
17
+ primaryHover: '#3B8AD8',
18
+ primaryActive: '#0C6EB8',
19
+
20
+ accent: '#E64534',
21
+ accentHover: '#C93A2C',
22
+ accentActive: '#A82F24',
23
+
24
+ background: '#11151C',
25
+ backgroundTranslucent: 'rgba(10, 20, 30, 0.46)',
26
+ surface: '#1A1F27',
27
+ surfaceHover: '#222831',
28
+ border: '#2D3643',
29
+
30
+ active: 'rgba(20, 255, 60, 0.7)',
31
+ activeHover: 'rgba(20, 255, 60, 0.4)',
32
+ successHover: '#2a6734b3',
33
+
34
+ text: '#E6EBEF',
35
+ textSecondary: '#88929E',
36
+
37
+ consoleBackground: 'rgba(20, 40, 60, 0.25)',
38
+ consoleText: '#61A6E8',
39
+ },
40
+ spacing: {
41
+ xxs: '0.125rem',
42
+ xs: '0.25rem',
43
+ sm: '0.5rem',
44
+ md: '0.75rem',
45
+ lg: '1rem',
46
+ xl: '1.5rem',
47
+ xxl: '2rem',
48
+ xxxl: '3rem',
49
+ },
50
+ sizes: {
51
+ icon: '28px',
52
+ iconSm: '16px',
53
+ iconLg: '96px',
54
+ },
55
+ typography: {
56
+ fontFamily: "'Exo 2', sans-serif",
57
+ fontSize: '14px',
58
+ },
59
+ borders: {
60
+ radius: '12px',
61
+ width: '1.5px',
62
+ },
63
+ } as const;
64
+
65
+ /**
66
+ * Mirror of {@link tokens} where each leaf is the CSS custom-property name
67
+ * (sans the leading `--`). Passed to `createGlobalThemeContract` so the
68
+ * generated `var(...)` references resolve to the legacy `--zylem-*`
69
+ * identifiers that the rest of the codebase already consumes.
70
+ */
71
+ const varNames = {
72
+ colors: {
73
+ primary: 'zylem-color-primary',
74
+ primaryHover: 'zylem-color-primary-hover',
75
+ primaryActive: 'zylem-color-primary-active',
76
+
77
+ accent: 'zylem-color-accent',
78
+ accentHover: 'zylem-color-accent-hover',
79
+ accentActive: 'zylem-color-accent-active',
80
+
81
+ background: 'zylem-color-background',
82
+ backgroundTranslucent: 'zylem-color-background-translucent',
83
+ surface: 'zylem-color-surface',
84
+ surfaceHover: 'zylem-color-surface-hover',
85
+ border: 'zylem-color-border',
86
+
87
+ active: 'zylem-color-active',
88
+ activeHover: 'zylem-color-active-hover',
89
+ successHover: 'zylem-color-success-hover',
90
+
91
+ text: 'zylem-color-text',
92
+ textSecondary: 'zylem-color-text-secondary',
93
+
94
+ consoleBackground: 'zylem-color-console-background',
95
+ consoleText: 'zylem-color-console-text',
96
+ },
97
+ spacing: {
98
+ xxs: 'zylem-spacing-xxs',
99
+ xs: 'zylem-spacing-xs',
100
+ sm: 'zylem-spacing-sm',
101
+ md: 'zylem-spacing-md',
102
+ lg: 'zylem-spacing-lg',
103
+ xl: 'zylem-spacing-xl',
104
+ xxl: 'zylem-spacing-xxl',
105
+ xxxl: 'zylem-spacing-xxxl',
106
+ },
107
+ sizes: {
108
+ icon: 'zylem-size-icon',
109
+ iconSm: 'zylem-size-icon-sm',
110
+ iconLg: 'zylem-size-icon-lg',
111
+ },
112
+ typography: {
113
+ fontFamily: 'zylem-font-family',
114
+ fontSize: 'zylem-font-size',
115
+ },
116
+ borders: {
117
+ radius: 'zylem-radius',
118
+ width: 'zylem-border',
119
+ },
120
+ } as const;
121
+
122
+ /**
123
+ * Typed `vars` contract — leaves resolve to `var(--zylem-*)` strings. Use
124
+ * inside `style()` / `globalStyle()` / `sprinkles()` to consume the design
125
+ * tokens with autocomplete and type safety.
126
+ */
127
+ export const vars = createGlobalThemeContract(varNames);
128
+
129
+ createGlobalTheme(':root', vars, tokens);
130
+
131
+ /** Token values as a plain readonly object, exported for downstream tooling. */
132
+ export const tokenValues = tokens;