@loom-sdc/design-system 0.2.0 → 0.4.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.
- package/README.md +365 -73
- package/dist/Button.css-Cw8VRHOs.js +137 -0
- package/dist/Button.css-DO_uJ5ub.cjs +1 -0
- package/dist/core.cjs +1 -0
- package/dist/core.mjs +2 -0
- package/dist/elements.cjs +2 -0
- package/dist/elements.mjs +328 -0
- package/dist/index.cjs +1 -1
- package/dist/index.core.d.ts +3 -0
- package/dist/index.core.d.ts.map +1 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.elements.d.ts +6 -0
- package/dist/index.elements.d.ts.map +1 -0
- package/dist/index.mjs +66 -255
- package/dist/style.css +1 -1
- package/dist/theme/adapters/theme.angular.d.ts +3 -0
- package/dist/theme/adapters/theme.angular.d.ts.map +1 -0
- package/dist/theme/index.d.ts +3 -0
- package/dist/theme/index.d.ts.map +1 -0
- package/dist/theme/theme.d.ts +4 -0
- package/dist/theme/theme.d.ts.map +1 -0
- package/dist/theme-BhDSE6xP.js +307 -0
- package/dist/theme-Cw8nZ0K9.cjs +1 -0
- package/dist/tokens/color/color.tokens.css.d.ts +7 -0
- package/dist/tokens/color/color.tokens.css.d.ts.map +1 -1
- package/dist/tokens/index.d.ts +6 -0
- package/dist/tokens/index.d.ts.map +1 -1
- package/dist/tokens/letterSpacing/index.d.ts +3 -0
- package/dist/tokens/letterSpacing/index.d.ts.map +1 -0
- package/dist/tokens/letterSpacing/letterSpacing.tokens.css.d.ts +9 -0
- package/dist/tokens/letterSpacing/letterSpacing.tokens.css.d.ts.map +1 -0
- package/dist/tokens/letterSpacing/letterSpacing.types.d.ts +3 -0
- package/dist/tokens/letterSpacing/letterSpacing.types.d.ts.map +1 -0
- package/dist/tokens/lineHeight/lineHeight.tokens.css.d.ts +2 -0
- package/dist/tokens/lineHeight/lineHeight.tokens.css.d.ts.map +1 -1
- package/dist/tokens/motion/index.d.ts +3 -0
- package/dist/tokens/motion/index.d.ts.map +1 -0
- package/dist/tokens/motion/motion.tokens.css.d.ts +12 -0
- package/dist/tokens/motion/motion.tokens.css.d.ts.map +1 -0
- package/dist/tokens/motion/motion.types.d.ts +3 -0
- package/dist/tokens/motion/motion.types.d.ts.map +1 -0
- package/dist/tokens/palette/palette.tokens.css.d.ts +9 -0
- package/dist/tokens/palette/palette.tokens.css.d.ts.map +1 -1
- package/dist/tokens/typography/index.d.ts +3 -0
- package/dist/tokens/typography/index.d.ts.map +1 -0
- package/dist/tokens/typography/typography.tokens.css.d.ts +105 -0
- package/dist/tokens/typography/typography.tokens.css.d.ts.map +1 -0
- package/dist/tokens/typography/typography.types.d.ts +3 -0
- package/dist/tokens/typography/typography.types.d.ts.map +1 -0
- package/dist/ui/primitives/Box/Box.css.d.ts +3 -0
- package/dist/ui/primitives/Box/Box.css.d.ts.map +1 -1
- package/dist/ui/primitives/Box/adapters/Box.element.d.ts +24 -0
- package/dist/ui/primitives/Box/adapters/Box.element.d.ts.map +1 -0
- package/dist/ui/primitives/Button/Button.css.d.ts +5 -0
- package/dist/ui/primitives/Button/Button.css.d.ts.map +1 -0
- package/dist/ui/primitives/Button/Button.types.d.ts +13 -0
- package/dist/ui/primitives/Button/Button.types.d.ts.map +1 -0
- package/dist/ui/primitives/Button/adapters/Button.element.d.ts +31 -0
- package/dist/ui/primitives/Button/adapters/Button.element.d.ts.map +1 -0
- package/dist/ui/primitives/Button/adapters/Button.react.d.ts +4 -0
- package/dist/ui/primitives/Button/adapters/Button.react.d.ts.map +1 -0
- package/dist/ui/primitives/Button/index.d.ts +4 -0
- package/dist/ui/primitives/Button/index.d.ts.map +1 -0
- package/dist/ui/primitives/Inline/Inline.css.d.ts.map +1 -1
- package/dist/ui/primitives/Inline/Inline.types.d.ts +4 -2
- package/dist/ui/primitives/Inline/Inline.types.d.ts.map +1 -1
- package/dist/ui/primitives/Inline/adapters/Inline.element.d.ts +27 -0
- package/dist/ui/primitives/Inline/adapters/Inline.element.d.ts.map +1 -0
- package/dist/ui/primitives/Inline/index.d.ts +1 -0
- package/dist/ui/primitives/Inline/index.d.ts.map +1 -1
- package/dist/ui/primitives/Stack/Stack.css.d.ts.map +1 -1
- package/dist/ui/primitives/Stack/Stack.types.d.ts +4 -2
- package/dist/ui/primitives/Stack/Stack.types.d.ts.map +1 -1
- package/dist/ui/primitives/Stack/adapters/Stack.element.d.ts +25 -0
- package/dist/ui/primitives/Stack/adapters/Stack.element.d.ts.map +1 -0
- package/dist/ui/primitives/Stack/index.d.ts +1 -0
- package/dist/ui/primitives/Stack/index.d.ts.map +1 -1
- package/dist/ui/primitives/Text/Text.css.d.ts +3 -0
- package/dist/ui/primitives/Text/Text.css.d.ts.map +1 -0
- package/dist/ui/primitives/Text/Text.types.d.ts +10 -0
- package/dist/ui/primitives/Text/Text.types.d.ts.map +1 -0
- package/dist/ui/primitives/Text/adapters/Text.element.d.ts +20 -0
- package/dist/ui/primitives/Text/adapters/Text.element.d.ts.map +1 -0
- package/dist/ui/primitives/Text/adapters/Text.react.d.ts +4 -0
- package/dist/ui/primitives/Text/adapters/Text.react.d.ts.map +1 -0
- package/dist/ui/primitives/Text/index.d.ts +3 -0
- package/dist/ui/primitives/Text/index.d.ts.map +1 -0
- package/dist/ui/primitives/index.d.ts +4 -0
- package/dist/ui/primitives/index.d.ts.map +1 -1
- package/package.json +28 -8
package/README.md
CHANGED
|
@@ -1,73 +1,365 @@
|
|
|
1
|
-
#
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
- [
|
|
8
|
-
- [
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
1
|
+
# @loom-sdc/design-system
|
|
2
|
+
|
|
3
|
+
A framework-agnostic, token-driven component library built with React 19, TypeScript 6, Vite 8, and Vanilla Extract. It ships as a dual-format package (ESM + CJS) with full TypeScript declarations.
|
|
4
|
+
|
|
5
|
+
## Table of Contents
|
|
6
|
+
|
|
7
|
+
- [Installation](#installation)
|
|
8
|
+
- [Quick Start](#quick-start)
|
|
9
|
+
- [Available Scripts](#available-scripts)
|
|
10
|
+
- [Design Tokens](#design-tokens)
|
|
11
|
+
- [UI Primitives](#ui-primitives)
|
|
12
|
+
- [Architecture](#architecture)
|
|
13
|
+
- [Build & Distribution](#build--distribution)
|
|
14
|
+
- [Contributing](#contributing)
|
|
15
|
+
|
|
16
|
+
---
|
|
17
|
+
|
|
18
|
+
## Installation
|
|
19
|
+
|
|
20
|
+
```bash
|
|
21
|
+
npm install @loom-sdc/design-system
|
|
22
|
+
```
|
|
23
|
+
|
|
24
|
+
**Peer dependencies** (must be installed by the consumer):
|
|
25
|
+
|
|
26
|
+
```bash
|
|
27
|
+
npm install react@>=19 react-dom@>=19
|
|
28
|
+
```
|
|
29
|
+
|
|
30
|
+
---
|
|
31
|
+
|
|
32
|
+
## Quick Start
|
|
33
|
+
|
|
34
|
+
Import the global stylesheet once at the entry point of your application. Then import components and tokens as needed.
|
|
35
|
+
|
|
36
|
+
```tsx
|
|
37
|
+
// main.tsx
|
|
38
|
+
import '@loom-sdc/design-system/style.css';
|
|
39
|
+
import '@loom-sdc/design-system/fonts.css'; // optional: includes TWK Everett font
|
|
40
|
+
|
|
41
|
+
import { Box, Stack, Inline } from '@loom-sdc/design-system';
|
|
42
|
+
|
|
43
|
+
export default function App() {
|
|
44
|
+
return (
|
|
45
|
+
<Stack gap="md">
|
|
46
|
+
<Box padding="lg">
|
|
47
|
+
<Inline gap="sm" align="center">
|
|
48
|
+
<span>Hello</span>
|
|
49
|
+
<span>World</span>
|
|
50
|
+
</Inline>
|
|
51
|
+
</Box>
|
|
52
|
+
</Stack>
|
|
53
|
+
);
|
|
54
|
+
}
|
|
55
|
+
```
|
|
56
|
+
|
|
57
|
+
### CSS Exports
|
|
58
|
+
|
|
59
|
+
| Import path | Description |
|
|
60
|
+
|---|---|
|
|
61
|
+
| `@loom-sdc/design-system/style.css` | Base styles and CSS custom properties |
|
|
62
|
+
| `@loom-sdc/design-system/fonts.css` | TWK Everett font-face declarations |
|
|
63
|
+
|
|
64
|
+
---
|
|
65
|
+
|
|
66
|
+
## Available Scripts
|
|
67
|
+
|
|
68
|
+
| Command | Description |
|
|
69
|
+
|---|---|
|
|
70
|
+
| `npm run dev` | Start Vite dev server with hot module replacement |
|
|
71
|
+
| `npm run build` | Full TypeScript check + Vite app build |
|
|
72
|
+
| `npm run build:lib` | Build the distributable library package |
|
|
73
|
+
| `npm run release` | Build the library and publish to npm |
|
|
74
|
+
| `npm run lint` | Run ESLint across the entire project |
|
|
75
|
+
| `npm run storybook` | Start Storybook on port 6006 |
|
|
76
|
+
| `npm run build-storybook` | Build the static Storybook site |
|
|
77
|
+
|
|
78
|
+
---
|
|
79
|
+
|
|
80
|
+
## Design Tokens
|
|
81
|
+
|
|
82
|
+
All tokens are generated with Vanilla Extract's `createThemeContract` + `createGlobalTheme`. They resolve to CSS custom properties at runtime and are fully typed via their respective `*TokenKey` union types.
|
|
83
|
+
|
|
84
|
+
### Color Palette (`PaletteTokenKey`)
|
|
85
|
+
|
|
86
|
+
Raw color scales. Prefer semantic color tokens for styling components.
|
|
87
|
+
|
|
88
|
+
| Scale | Tones |
|
|
89
|
+
|---|---|
|
|
90
|
+
| `cyan` | `cyan100` – `cyan900` |
|
|
91
|
+
| `red` | `red100` – `red900` |
|
|
92
|
+
| `neutral` | `neutral100` – `neutral900` |
|
|
93
|
+
| `green` | `green100` – `green900` |
|
|
94
|
+
| `amber` | `amber100` – `amber900` |
|
|
95
|
+
|
|
96
|
+
### Semantic Colors (`ColorTokenKey`)
|
|
97
|
+
|
|
98
|
+
| Group | Tokens |
|
|
99
|
+
|---|---|
|
|
100
|
+
| **Surface** | `surfaceRaised`, `surfaceBase`, `surfaceSubtle`, `surfaceNeutral` |
|
|
101
|
+
| **Brand** | `brandPrimary`, `brandPrimarySubtle`, `brandAccent`, `brandAccentSubtle` |
|
|
102
|
+
| **Border** | `borderDefault`, `borderStrong`, `borderSubtle` |
|
|
103
|
+
| **Text** | `textPrimary`, `textSecondary`, `textDisabled`, `textInverse`, `textOnBrand` |
|
|
104
|
+
| **Feedback** | `feedbackSuccess`, `feedbackSuccessSubtle`, `feedbackWarning`, `feedbackWarningStrong`, `feedbackWarningSubtle`, `feedbackDanger`, `feedbackDangerSubtle` |
|
|
105
|
+
|
|
106
|
+
### Spacing (`SpacingTokenKey`)
|
|
107
|
+
|
|
108
|
+
| Token | Value |
|
|
109
|
+
|---|---|
|
|
110
|
+
| `none` | 0px |
|
|
111
|
+
| `px` | 1px |
|
|
112
|
+
| `xxs` | 2px |
|
|
113
|
+
| `xs` | 4px |
|
|
114
|
+
| `sm` | 8px |
|
|
115
|
+
| `md` | 16px |
|
|
116
|
+
| `lg` | 24px |
|
|
117
|
+
| `xl` | 32px |
|
|
118
|
+
| `xl2` | 48px |
|
|
119
|
+
| `xl3` | 64px |
|
|
120
|
+
| `xl4` | 96px |
|
|
121
|
+
| `xl5` | 128px |
|
|
122
|
+
| `xl6` | 192px |
|
|
123
|
+
| `xl7` | 256px |
|
|
124
|
+
| `xl8` | 384px |
|
|
125
|
+
|
|
126
|
+
### Font Size (`FontSizeTokenKey`)
|
|
127
|
+
|
|
128
|
+
`xxs` (10px) → `xl8` (96px), 13-step progressive scale.
|
|
129
|
+
|
|
130
|
+
### Font Family (`FontFamilyTokenKey`)
|
|
131
|
+
|
|
132
|
+
| Token | Stack |
|
|
133
|
+
|---|---|
|
|
134
|
+
| `sans` | TWK Everett, system-ui |
|
|
135
|
+
| `mono` | ui-monospace, Consolas |
|
|
136
|
+
|
|
137
|
+
### Font Weight (`FontWeightTokenKey`)
|
|
138
|
+
|
|
139
|
+
`thin` (100), `extralight` (200), `light` (300), `normal` (400), `medium` (500), `semibold` (600), `bold` (700), `extrabold` (800), `black` (900).
|
|
140
|
+
|
|
141
|
+
### Line Height (`LineHeightTokenKey`)
|
|
142
|
+
|
|
143
|
+
`none` (1), `tight` (1.25), `snug` (1.375), `normal` (1.5), `relaxed` (1.625), `loose` (2).
|
|
144
|
+
|
|
145
|
+
### Height (`HeightTokenKey`)
|
|
146
|
+
|
|
147
|
+
`xxs` (20px), `xs` (24px), `sm` (32px), `md` (48px), `lg` (56px), `xl` (72px).
|
|
148
|
+
|
|
149
|
+
### Icon Size (`IconSizeTokenKey`)
|
|
150
|
+
|
|
151
|
+
`xxs` (12px), `xs` (14px), `sm` (16px), `md` (24px), `lg` (32px).
|
|
152
|
+
|
|
153
|
+
### Border Radius (`RadiusTokenKey`)
|
|
154
|
+
|
|
155
|
+
`xxs` (2px), `xs` (4px), `sm` (6px), `md` (8px), `lg` (16px).
|
|
156
|
+
|
|
157
|
+
### Shadow (`ShadowTokenKey`)
|
|
158
|
+
|
|
159
|
+
`none`, `sm`, `base`, `md`, `lg`, `xl`, `xl2`, `inner`.
|
|
160
|
+
|
|
161
|
+
### Z-Index (`ZIndexTokenKey`)
|
|
162
|
+
|
|
163
|
+
`hide` (-1), `base` (0), `raised` (10), `dropdown` (20), `sticky` (30), `overlay` (40), `modal` (50).
|
|
164
|
+
|
|
165
|
+
---
|
|
166
|
+
|
|
167
|
+
## UI Primitives
|
|
168
|
+
|
|
169
|
+
Primitives are single-element polymorphic components. All of them support the `as` prop to render as any HTML element while preserving their typed props.
|
|
170
|
+
|
|
171
|
+
### `Box`
|
|
172
|
+
|
|
173
|
+
A generic container that applies spacing tokens via padding props.
|
|
174
|
+
|
|
175
|
+
```tsx
|
|
176
|
+
import { Box } from '@loom-sdc/design-system';
|
|
177
|
+
|
|
178
|
+
<Box padding="lg" paddingX="xl" as="section">
|
|
179
|
+
content
|
|
180
|
+
</Box>
|
|
181
|
+
```
|
|
182
|
+
|
|
183
|
+
| Prop | Type | Default | Description |
|
|
184
|
+
|---|---|---|---|
|
|
185
|
+
| `as` | `ElementType` | `'div'` | HTML element or component to render as |
|
|
186
|
+
| `padding` | `SpacingTokenKey` | — | Uniform padding on all sides |
|
|
187
|
+
| `paddingX` | `SpacingTokenKey` | — | Horizontal padding (left + right) |
|
|
188
|
+
| `paddingY` | `SpacingTokenKey` | — | Vertical padding (top + bottom) |
|
|
189
|
+
| `children` | `ReactNode` | — | |
|
|
190
|
+
| `...rest` | HTML attributes | — | Forwarded to the underlying element |
|
|
191
|
+
|
|
192
|
+
### `Inline`
|
|
193
|
+
|
|
194
|
+
A flex-row container for horizontally arranged items.
|
|
195
|
+
|
|
196
|
+
```tsx
|
|
197
|
+
import { Inline } from '@loom-sdc/design-system';
|
|
198
|
+
|
|
199
|
+
<Inline gap="sm" align="center" justify="between">
|
|
200
|
+
<span>Left</span>
|
|
201
|
+
<span>Right</span>
|
|
202
|
+
</Inline>
|
|
203
|
+
```
|
|
204
|
+
|
|
205
|
+
| Prop | Type | Default | Description |
|
|
206
|
+
|---|---|---|---|
|
|
207
|
+
| `as` | `ElementType` | `'div'` | HTML element or component to render as |
|
|
208
|
+
| `gap` | `SpacingTokenKey` | — | Gap between children |
|
|
209
|
+
| `align` | `'start' \| 'center' \| 'end' \| 'stretch' \| 'baseline'` | `'center'` | Cross-axis alignment (`align-items`) |
|
|
210
|
+
| `justify` | `'start' \| 'center' \| 'end' \| 'between' \| 'around' \| 'evenly'` | `'start'` | Main-axis distribution (`justify-content`) |
|
|
211
|
+
| `wrap` | `boolean` | `false` | Allow children to wrap |
|
|
212
|
+
| `className` | `string` | — | Additional class names |
|
|
213
|
+
| `...rest` | HTML attributes | — | Forwarded to the underlying element |
|
|
214
|
+
|
|
215
|
+
### `Stack`
|
|
216
|
+
|
|
217
|
+
A flex-column container for vertically stacked items.
|
|
218
|
+
|
|
219
|
+
```tsx
|
|
220
|
+
import { Stack } from '@loom-sdc/design-system';
|
|
221
|
+
|
|
222
|
+
<Stack gap="md" align="start">
|
|
223
|
+
<p>First</p>
|
|
224
|
+
<p>Second</p>
|
|
225
|
+
</Stack>
|
|
226
|
+
```
|
|
227
|
+
|
|
228
|
+
| Prop | Type | Default | Description |
|
|
229
|
+
|---|---|---|---|
|
|
230
|
+
| `as` | `ElementType` | `'div'` | HTML element or component to render as |
|
|
231
|
+
| `gap` | `SpacingTokenKey` | — | Gap between children |
|
|
232
|
+
| `align` | `'start' \| 'center' \| 'end' \| 'stretch' \| 'baseline'` | `'stretch'` | Cross-axis alignment (`align-items`) |
|
|
233
|
+
| `justify` | `'start' \| 'center' \| 'end' \| 'between' \| 'around' \| 'evenly'` | `'start'` | Main-axis distribution (`justify-content`) |
|
|
234
|
+
| `className` | `string` | — | Additional class names |
|
|
235
|
+
| `...rest` | HTML attributes | — | Forwarded to the underlying element |
|
|
236
|
+
|
|
237
|
+
---
|
|
238
|
+
|
|
239
|
+
## Architecture
|
|
240
|
+
|
|
241
|
+
```
|
|
242
|
+
src/design-system/package/
|
|
243
|
+
├── index.ts ← public API entry (re-exports tokens + primitives)
|
|
244
|
+
├── fonts/
|
|
245
|
+
│ └── fonts.css ← TWK Everett @font-face declarations
|
|
246
|
+
├── tokens/ ← Vanilla Extract theme contracts
|
|
247
|
+
│ ├── color/
|
|
248
|
+
│ ├── palette/
|
|
249
|
+
│ ├── spacing/
|
|
250
|
+
│ ├── fontSize/
|
|
251
|
+
│ ├── fontFamily/
|
|
252
|
+
│ ├── fontWeight/
|
|
253
|
+
│ ├── lineHeight/
|
|
254
|
+
│ ├── height/
|
|
255
|
+
│ ├── iconSize/
|
|
256
|
+
│ ├── radius/
|
|
257
|
+
│ ├── shadow/
|
|
258
|
+
│ └── zIndex/
|
|
259
|
+
└── ui/
|
|
260
|
+
├── primitives/ ← polymorphic single-element components
|
|
261
|
+
├── components/ ← composite / compound components
|
|
262
|
+
└── patterns/ ← layout-level compositions
|
|
263
|
+
```
|
|
264
|
+
|
|
265
|
+
### Component File Convention
|
|
266
|
+
|
|
267
|
+
Every component folder follows this structure:
|
|
268
|
+
|
|
269
|
+
```
|
|
270
|
+
[ComponentName]/
|
|
271
|
+
├── [ComponentName].types.ts ← framework-agnostic prop interfaces
|
|
272
|
+
├── [ComponentName].css.ts ← Vanilla Extract styles
|
|
273
|
+
├── [ComponentName].context.ts ← compound components only
|
|
274
|
+
├── adapters/
|
|
275
|
+
│ ├── [ComponentName].react.tsx ← React implementation
|
|
276
|
+
│ └── .gitkeep ← placeholder for Angular / Vue adapters
|
|
277
|
+
└── index.ts ← public API re-exports only
|
|
278
|
+
```
|
|
279
|
+
|
|
280
|
+
### Key Conventions
|
|
281
|
+
|
|
282
|
+
- **Named exports only** — no default exports anywhere in the package.
|
|
283
|
+
- **Type-only re-exports** use `export type { ... }` syntax.
|
|
284
|
+
- **No `enum`** — use `const` objects with `as const` and derive the union type from them.
|
|
285
|
+
- **No hardcoded CSS values** — always reference a token CSS custom property.
|
|
286
|
+
- **Imports inside the package include file extensions** (`.ts`, `.tsx`, `.css.ts`).
|
|
287
|
+
- **TypeScript verification**: `npx tsc -b --noEmit`
|
|
288
|
+
|
|
289
|
+
---
|
|
290
|
+
|
|
291
|
+
## Build & Distribution
|
|
292
|
+
|
|
293
|
+
The library is built with `vite build --config vite.lib.config.ts`.
|
|
294
|
+
|
|
295
|
+
| Output | Path |
|
|
296
|
+
|---|---|
|
|
297
|
+
| ES module | `dist/index.mjs` |
|
|
298
|
+
| CommonJS | `dist/index.cjs` |
|
|
299
|
+
| Type declarations | `dist/index.d.ts` |
|
|
300
|
+
| Base styles | `dist/style.css` |
|
|
301
|
+
| Font declarations | `dist/fonts.css` |
|
|
302
|
+
| Font assets | `dist/fonts/*.woff2` |
|
|
303
|
+
|
|
304
|
+
External dependencies excluded from the bundle: `react`, `react-dom`, `@vanilla-extract/css`.
|
|
305
|
+
|
|
306
|
+
---
|
|
307
|
+
|
|
308
|
+
## Contributing
|
|
309
|
+
|
|
310
|
+
### Prerequisites
|
|
311
|
+
|
|
312
|
+
- Node.js 22+
|
|
313
|
+
- npm 10+
|
|
314
|
+
|
|
315
|
+
### Local Setup
|
|
316
|
+
|
|
317
|
+
```bash
|
|
318
|
+
git clone <repo-url>
|
|
319
|
+
cd loom-design-system
|
|
320
|
+
npm install
|
|
321
|
+
```
|
|
322
|
+
|
|
323
|
+
### Development Workflow
|
|
324
|
+
|
|
325
|
+
```bash
|
|
326
|
+
npm run dev # preview the sandbox app
|
|
327
|
+
npm run storybook # browse components in Storybook
|
|
328
|
+
npm run lint # check for linting errors
|
|
329
|
+
npx tsc -b --noEmit # type check without emitting files
|
|
330
|
+
```
|
|
331
|
+
|
|
332
|
+
### Publishing
|
|
333
|
+
|
|
334
|
+
```bash
|
|
335
|
+
npm run release
|
|
336
|
+
```
|
|
337
|
+
|
|
338
|
+
This runs `build:lib` followed by `npm publish --access public`.
|
|
339
|
+
|
|
340
|
+
---
|
|
341
|
+
|
|
342
|
+
## AI Workflow (Claude + Copilot)
|
|
343
|
+
|
|
344
|
+
This repository uses a shared-contract model so Claude and Copilot behave consistently.
|
|
345
|
+
|
|
346
|
+
### Canonical Contracts
|
|
347
|
+
|
|
348
|
+
All generation laws live in `ai/contracts/`:
|
|
349
|
+
|
|
350
|
+
- `ai/contracts/token.contract.md`
|
|
351
|
+
- `ai/contracts/component.contract.md`
|
|
352
|
+
- `ai/contracts/adapter-web-component.contract.md`
|
|
353
|
+
- `ai/contracts/story.contract.md`
|
|
354
|
+
|
|
355
|
+
### Wrappers
|
|
356
|
+
|
|
357
|
+
- Claude wrappers live under `.claude/commands/` and `.claude/skills/`
|
|
358
|
+
- Copilot wrappers live under `.github/prompts/`
|
|
359
|
+
- Repo-level Copilot defaults are in `.github/copilot-instructions.md`
|
|
360
|
+
|
|
361
|
+
Wrappers should orchestrate flow only. Mandatory behavior changes must be done in contracts first.
|
|
362
|
+
|
|
363
|
+
### Execution Brief
|
|
364
|
+
|
|
365
|
+
Use `ai/templates/execution-brief.md` as the standard handoff format from planning to implementation. This reduces repeated context and keeps output stable across tools.
|
|
@@ -0,0 +1,137 @@
|
|
|
1
|
+
/* empty css */
|
|
2
|
+
//#region src/design-system/package/ui/primitives/Stack/Stack.css.ts
|
|
3
|
+
var e = "y5q6570", t = {
|
|
4
|
+
none: "y5q6571",
|
|
5
|
+
px: "y5q6572",
|
|
6
|
+
xxs: "y5q6573",
|
|
7
|
+
xs: "y5q6574",
|
|
8
|
+
sm: "y5q6575",
|
|
9
|
+
md: "y5q6576",
|
|
10
|
+
lg: "y5q6577",
|
|
11
|
+
xl: "y5q6578",
|
|
12
|
+
xl2: "y5q6579",
|
|
13
|
+
xl3: "y5q657a",
|
|
14
|
+
xl4: "y5q657b",
|
|
15
|
+
xl5: "y5q657c",
|
|
16
|
+
xl6: "y5q657d",
|
|
17
|
+
xl7: "y5q657e",
|
|
18
|
+
xl8: "y5q657f"
|
|
19
|
+
}, n = {
|
|
20
|
+
start: "y5q657g",
|
|
21
|
+
center: "y5q657h",
|
|
22
|
+
end: "y5q657i",
|
|
23
|
+
stretch: "y5q657j",
|
|
24
|
+
baseline: "y5q657k"
|
|
25
|
+
}, r = {
|
|
26
|
+
start: "y5q657l",
|
|
27
|
+
center: "y5q657m",
|
|
28
|
+
end: "y5q657n",
|
|
29
|
+
between: "y5q657o",
|
|
30
|
+
around: "y5q657p",
|
|
31
|
+
evenly: "y5q657q"
|
|
32
|
+
}, i = "_1wqyejm0", a = "_1wqyejm1", o = {
|
|
33
|
+
none: "_1wqyejm2",
|
|
34
|
+
px: "_1wqyejm3",
|
|
35
|
+
xxs: "_1wqyejm4",
|
|
36
|
+
xs: "_1wqyejm5",
|
|
37
|
+
sm: "_1wqyejm6",
|
|
38
|
+
md: "_1wqyejm7",
|
|
39
|
+
lg: "_1wqyejm8",
|
|
40
|
+
xl: "_1wqyejm9",
|
|
41
|
+
xl2: "_1wqyejma",
|
|
42
|
+
xl3: "_1wqyejmb",
|
|
43
|
+
xl4: "_1wqyejmc",
|
|
44
|
+
xl5: "_1wqyejmd",
|
|
45
|
+
xl6: "_1wqyejme",
|
|
46
|
+
xl7: "_1wqyejmf",
|
|
47
|
+
xl8: "_1wqyejmg"
|
|
48
|
+
}, s = {
|
|
49
|
+
start: "_1wqyejmh",
|
|
50
|
+
center: "_1wqyejmi",
|
|
51
|
+
end: "_1wqyejmj",
|
|
52
|
+
stretch: "_1wqyejmk",
|
|
53
|
+
baseline: "_1wqyejml"
|
|
54
|
+
}, c = {
|
|
55
|
+
start: "_1wqyejmm",
|
|
56
|
+
center: "_1wqyejmn",
|
|
57
|
+
end: "_1wqyejmo",
|
|
58
|
+
between: "_1wqyejmp",
|
|
59
|
+
around: "_1wqyejmq",
|
|
60
|
+
evenly: "_1wqyejmr"
|
|
61
|
+
}, l = "_1okjbro0", u = {
|
|
62
|
+
none: "_1okjbro1",
|
|
63
|
+
px: "_1okjbro2",
|
|
64
|
+
xxs: "_1okjbro3",
|
|
65
|
+
xs: "_1okjbro4",
|
|
66
|
+
sm: "_1okjbro5",
|
|
67
|
+
md: "_1okjbro6",
|
|
68
|
+
lg: "_1okjbro7",
|
|
69
|
+
xl: "_1okjbro8",
|
|
70
|
+
xl2: "_1okjbro9",
|
|
71
|
+
xl3: "_1okjbroa",
|
|
72
|
+
xl4: "_1okjbrob",
|
|
73
|
+
xl5: "_1okjbroc",
|
|
74
|
+
xl6: "_1okjbrod",
|
|
75
|
+
xl7: "_1okjbroe",
|
|
76
|
+
xl8: "_1okjbrof"
|
|
77
|
+
}, d = {
|
|
78
|
+
none: "_1okjbrog",
|
|
79
|
+
px: "_1okjbroh",
|
|
80
|
+
xxs: "_1okjbroi",
|
|
81
|
+
xs: "_1okjbroj",
|
|
82
|
+
sm: "_1okjbrok",
|
|
83
|
+
md: "_1okjbrol",
|
|
84
|
+
lg: "_1okjbrom",
|
|
85
|
+
xl: "_1okjbron",
|
|
86
|
+
xl2: "_1okjbroo",
|
|
87
|
+
xl3: "_1okjbrop",
|
|
88
|
+
xl4: "_1okjbroq",
|
|
89
|
+
xl5: "_1okjbror",
|
|
90
|
+
xl6: "_1okjbros",
|
|
91
|
+
xl7: "_1okjbrot",
|
|
92
|
+
xl8: "_1okjbrou"
|
|
93
|
+
}, f = {
|
|
94
|
+
none: "_1okjbrov",
|
|
95
|
+
px: "_1okjbrow",
|
|
96
|
+
xxs: "_1okjbrox",
|
|
97
|
+
xs: "_1okjbroy",
|
|
98
|
+
sm: "_1okjbroz",
|
|
99
|
+
md: "_1okjbro10",
|
|
100
|
+
lg: "_1okjbro11",
|
|
101
|
+
xl: "_1okjbro12",
|
|
102
|
+
xl2: "_1okjbro13",
|
|
103
|
+
xl3: "_1okjbro14",
|
|
104
|
+
xl4: "_1okjbro15",
|
|
105
|
+
xl5: "_1okjbro16",
|
|
106
|
+
xl6: "_1okjbro17",
|
|
107
|
+
xl7: "_1okjbro18",
|
|
108
|
+
xl8: "_1okjbro19"
|
|
109
|
+
}, p = "_1kk7qb30", m = {
|
|
110
|
+
bodyBase: "_1kk7qb31",
|
|
111
|
+
bodySm: "_1kk7qb32",
|
|
112
|
+
bodyLg: "_1kk7qb33",
|
|
113
|
+
labelBase: "_1kk7qb34",
|
|
114
|
+
labelSm: "_1kk7qb35",
|
|
115
|
+
labelLg: "_1kk7qb36",
|
|
116
|
+
headingH1: "_1kk7qb37",
|
|
117
|
+
headingH2: "_1kk7qb38",
|
|
118
|
+
headingH3: "_1kk7qb39",
|
|
119
|
+
headingH4: "_1kk7qb3a",
|
|
120
|
+
headingH5: "_1kk7qb3b",
|
|
121
|
+
headingH6: "_1kk7qb3c",
|
|
122
|
+
displayLg: "_1kk7qb3d",
|
|
123
|
+
displayXl: "_1kk7qb3e",
|
|
124
|
+
display2xl: "_1kk7qb3f",
|
|
125
|
+
overline: "_1kk7qb3g",
|
|
126
|
+
caption: "_1kk7qb3h"
|
|
127
|
+
}, h = "_1cu80s90", g = "_1cu80s91", _ = {
|
|
128
|
+
primary: "_1cu80s92",
|
|
129
|
+
outline: "_1cu80s93",
|
|
130
|
+
text: "_1cu80s94"
|
|
131
|
+
}, v = {
|
|
132
|
+
sm: "_1cu80s95",
|
|
133
|
+
md: "_1cu80s96",
|
|
134
|
+
lg: "_1cu80s97"
|
|
135
|
+
};
|
|
136
|
+
//#endregion
|
|
137
|
+
export { t as _, p as a, d as c, s as d, o as f, n as g, a as h, _ as i, f as l, i as m, g as n, m as o, c as p, v as r, u as s, h as t, l as u, r as v, e as y };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
;/* empty css */var e=`y5q6570`,t={none:`y5q6571`,px:`y5q6572`,xxs:`y5q6573`,xs:`y5q6574`,sm:`y5q6575`,md:`y5q6576`,lg:`y5q6577`,xl:`y5q6578`,xl2:`y5q6579`,xl3:`y5q657a`,xl4:`y5q657b`,xl5:`y5q657c`,xl6:`y5q657d`,xl7:`y5q657e`,xl8:`y5q657f`},n={start:`y5q657g`,center:`y5q657h`,end:`y5q657i`,stretch:`y5q657j`,baseline:`y5q657k`},r={start:`y5q657l`,center:`y5q657m`,end:`y5q657n`,between:`y5q657o`,around:`y5q657p`,evenly:`y5q657q`},i=`_1wqyejm0`,a=`_1wqyejm1`,o={none:`_1wqyejm2`,px:`_1wqyejm3`,xxs:`_1wqyejm4`,xs:`_1wqyejm5`,sm:`_1wqyejm6`,md:`_1wqyejm7`,lg:`_1wqyejm8`,xl:`_1wqyejm9`,xl2:`_1wqyejma`,xl3:`_1wqyejmb`,xl4:`_1wqyejmc`,xl5:`_1wqyejmd`,xl6:`_1wqyejme`,xl7:`_1wqyejmf`,xl8:`_1wqyejmg`},s={start:`_1wqyejmh`,center:`_1wqyejmi`,end:`_1wqyejmj`,stretch:`_1wqyejmk`,baseline:`_1wqyejml`},c={start:`_1wqyejmm`,center:`_1wqyejmn`,end:`_1wqyejmo`,between:`_1wqyejmp`,around:`_1wqyejmq`,evenly:`_1wqyejmr`},l=`_1okjbro0`,u={none:`_1okjbro1`,px:`_1okjbro2`,xxs:`_1okjbro3`,xs:`_1okjbro4`,sm:`_1okjbro5`,md:`_1okjbro6`,lg:`_1okjbro7`,xl:`_1okjbro8`,xl2:`_1okjbro9`,xl3:`_1okjbroa`,xl4:`_1okjbrob`,xl5:`_1okjbroc`,xl6:`_1okjbrod`,xl7:`_1okjbroe`,xl8:`_1okjbrof`},d={none:`_1okjbrog`,px:`_1okjbroh`,xxs:`_1okjbroi`,xs:`_1okjbroj`,sm:`_1okjbrok`,md:`_1okjbrol`,lg:`_1okjbrom`,xl:`_1okjbron`,xl2:`_1okjbroo`,xl3:`_1okjbrop`,xl4:`_1okjbroq`,xl5:`_1okjbror`,xl6:`_1okjbros`,xl7:`_1okjbrot`,xl8:`_1okjbrou`},f={none:`_1okjbrov`,px:`_1okjbrow`,xxs:`_1okjbrox`,xs:`_1okjbroy`,sm:`_1okjbroz`,md:`_1okjbro10`,lg:`_1okjbro11`,xl:`_1okjbro12`,xl2:`_1okjbro13`,xl3:`_1okjbro14`,xl4:`_1okjbro15`,xl5:`_1okjbro16`,xl6:`_1okjbro17`,xl7:`_1okjbro18`,xl8:`_1okjbro19`},p=`_1kk7qb30`,m={bodyBase:`_1kk7qb31`,bodySm:`_1kk7qb32`,bodyLg:`_1kk7qb33`,labelBase:`_1kk7qb34`,labelSm:`_1kk7qb35`,labelLg:`_1kk7qb36`,headingH1:`_1kk7qb37`,headingH2:`_1kk7qb38`,headingH3:`_1kk7qb39`,headingH4:`_1kk7qb3a`,headingH5:`_1kk7qb3b`,headingH6:`_1kk7qb3c`,displayLg:`_1kk7qb3d`,displayXl:`_1kk7qb3e`,display2xl:`_1kk7qb3f`,overline:`_1kk7qb3g`,caption:`_1kk7qb3h`},h=`_1cu80s90`,g=`_1cu80s91`,_={primary:`_1cu80s92`,outline:`_1cu80s93`,text:`_1cu80s94`},v={sm:`_1cu80s95`,md:`_1cu80s96`,lg:`_1cu80s97`};Object.defineProperty(exports,`_`,{enumerable:!0,get:function(){return t}}),Object.defineProperty(exports,`a`,{enumerable:!0,get:function(){return p}}),Object.defineProperty(exports,`c`,{enumerable:!0,get:function(){return d}}),Object.defineProperty(exports,`d`,{enumerable:!0,get:function(){return s}}),Object.defineProperty(exports,`f`,{enumerable:!0,get:function(){return o}}),Object.defineProperty(exports,`g`,{enumerable:!0,get:function(){return n}}),Object.defineProperty(exports,`h`,{enumerable:!0,get:function(){return a}}),Object.defineProperty(exports,`i`,{enumerable:!0,get:function(){return _}}),Object.defineProperty(exports,`l`,{enumerable:!0,get:function(){return f}}),Object.defineProperty(exports,`m`,{enumerable:!0,get:function(){return i}}),Object.defineProperty(exports,`n`,{enumerable:!0,get:function(){return g}}),Object.defineProperty(exports,`o`,{enumerable:!0,get:function(){return m}}),Object.defineProperty(exports,`p`,{enumerable:!0,get:function(){return c}}),Object.defineProperty(exports,`r`,{enumerable:!0,get:function(){return v}}),Object.defineProperty(exports,`s`,{enumerable:!0,get:function(){return u}}),Object.defineProperty(exports,`t`,{enumerable:!0,get:function(){return h}}),Object.defineProperty(exports,`u`,{enumerable:!0,get:function(){return l}}),Object.defineProperty(exports,`v`,{enumerable:!0,get:function(){return r}}),Object.defineProperty(exports,`y`,{enumerable:!0,get:function(){return e}});
|
package/dist/core.cjs
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require(`./theme-Cw8nZ0K9.cjs`);exports.applyTheme=e.t,exports.colorVars=e.g,exports.fontFamilyVars=e._,exports.fontSizeVars=e.d,exports.fontWeightVars=e.l,exports.getTheme=e.n,exports.heightVars=e.m,exports.iconSizeVars=e.p,exports.letterSpacingVars=e.a,exports.lineHeightVars=e.c,exports.motionVars=e.r,exports.paletteVars=e.h,exports.radiusVars=e.f,exports.shadowVars=e.s,exports.spacingVars=e.u,exports.typographyVars=e.i,exports.zIndexVars=e.o;
|
package/dist/core.mjs
ADDED
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import { _ as e, a as t, c as n, d as r, f as i, g as a, h as o, i as s, l as c, m as l, n as u, o as d, p as f, r as p, s as m, t as h, u as g } from "./theme-BhDSE6xP.js";
|
|
2
|
+
export { h as applyTheme, a as colorVars, e as fontFamilyVars, r as fontSizeVars, c as fontWeightVars, u as getTheme, l as heightVars, f as iconSizeVars, t as letterSpacingVars, n as lineHeightVars, p as motionVars, o as paletteVars, i as radiusVars, m as shadowVars, g as spacingVars, s as typographyVars, d as zIndexVars };
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require(`./Button.css-DO_uJ5ub.cjs`);var t=class extends HTMLElement{static observedAttributes=[`padding`,`padding-x`,`padding-y`];get padding(){return this.getAttribute(`padding`)}set padding(e){e==null?this.removeAttribute(`padding`):this.setAttribute(`padding`,e)}get paddingX(){return this.getAttribute(`padding-x`)}set paddingX(e){e==null?this.removeAttribute(`padding-x`):this.setAttribute(`padding-x`,e)}get paddingY(){return this.getAttribute(`padding-y`)}set paddingY(e){e==null?this.removeAttribute(`padding-y`):this.setAttribute(`padding-y`,e)}connectedCallback(){this.classList.add(e.u),this._sync()}attributeChangedCallback(){this._scheduleSync()}_syncScheduled=!1;_scheduleSync(){this._syncScheduled||(this._syncScheduled=!0,requestAnimationFrame(()=>{this._syncScheduled=!1,this._sync()}))}_prev={padding:null,paddingX:null,paddingY:null};_sync(){this._apply(`padding`,this.getAttribute(`padding`),e.s),this._apply(`paddingX`,this.getAttribute(`padding-x`),e.c),this._apply(`paddingY`,this.getAttribute(`padding-y`),e.l)}_apply(e,t,n){let r=t!=null&&t in n?n[t]:null,i=this._prev[e]??null;r!==i&&(i&&this.classList.remove(i),r&&this.classList.add(r),this._prev[e]=r)}};customElements.define(`loom-box`,t);var n=class extends HTMLElement{static observedAttributes=[`gap`,`align`,`justify`];get gap(){return this.getAttribute(`gap`)}set gap(e){e==null?this.removeAttribute(`gap`):this.setAttribute(`gap`,e)}get align(){return this.getAttribute(`align`)}set align(e){e==null?this.removeAttribute(`align`):this.setAttribute(`align`,e)}get justify(){return this.getAttribute(`justify`)}set justify(e){e==null?this.removeAttribute(`justify`):this.setAttribute(`justify`,e)}connectedCallback(){this.classList.add(e.y),this._sync()}attributeChangedCallback(){this._scheduleSync()}_syncScheduled=!1;_scheduleSync(){this._syncScheduled||(this._syncScheduled=!0,requestAnimationFrame(()=>{this._syncScheduled=!1,this._sync()}))}_prev={gap:null,align:null,justify:null};_sync(){this._apply(`gap`,this.getAttribute(`gap`),e._),this._apply(`align`,this.getAttribute(`align`)??`stretch`,e.g),this._apply(`justify`,this.getAttribute(`justify`)??`start`,e.v)}_apply(e,t,n){let r=t!=null&&t in n?n[t]:null,i=this._prev[e]??null;r!==i&&(i&&this.classList.remove(i),r&&this.classList.add(r),this._prev[e]=r)}};customElements.define(`loom-stack`,n);var r=class extends HTMLElement{static observedAttributes=[`gap`,`align`,`justify`,`wrap`];get gap(){return this.getAttribute(`gap`)}set gap(e){e==null?this.removeAttribute(`gap`):this.setAttribute(`gap`,e)}get align(){return this.getAttribute(`align`)}set align(e){e==null?this.removeAttribute(`align`):this.setAttribute(`align`,e)}get justify(){return this.getAttribute(`justify`)}set justify(e){e==null?this.removeAttribute(`justify`):this.setAttribute(`justify`,e)}get wrap(){return this.hasAttribute(`wrap`)}set wrap(e){this.toggleAttribute(`wrap`,e)}connectedCallback(){this.classList.add(e.m),this._sync()}attributeChangedCallback(){this._scheduleSync()}_syncScheduled=!1;_scheduleSync(){this._syncScheduled||(this._syncScheduled=!0,requestAnimationFrame(()=>{this._syncScheduled=!1,this._sync()}))}_prev={gap:null,align:null,justify:null,wrap:null};_sync(){this._apply(`gap`,this.getAttribute(`gap`),e.f),this._apply(`align`,this.getAttribute(`align`)??`center`,e.d),this._apply(`justify`,this.getAttribute(`justify`)??`start`,e.p),this._apply(`wrap`,this.hasAttribute(`wrap`)?`on`:null,{on:e.h})}_apply(e,t,n){let r=t!=null&&t in n?n[t]:null,i=this._prev[e]??null;r!==i&&(i&&this.classList.remove(i),r&&this.classList.add(r),this._prev[e]=r)}};customElements.define(`loom-inline`,r);var i=class extends HTMLElement{static observedAttributes=[`variant`];get variant(){return this.getAttribute(`variant`)}set variant(e){e==null?this.removeAttribute(`variant`):this.setAttribute(`variant`,e)}connectedCallback(){this.classList.add(e.a),this._sync()}attributeChangedCallback(){this._scheduleSync()}_syncScheduled=!1;_scheduleSync(){this._syncScheduled||(this._syncScheduled=!0,requestAnimationFrame(()=>{this._syncScheduled=!1,this._sync()}))}_prev={variant:null};_sync(){this._apply(`variant`,this.getAttribute(`variant`),e.o)}_apply(e,t,n){let r=t!=null&&t in n?n[t]:null,i=this._prev[e]??null;r!==i&&(i&&this.classList.remove(i),r&&this.classList.add(r),this._prev[e]=r)}};customElements.define(`loom-text`,i);var a={sm:`labelSm`,md:`labelBase`,lg:`labelLg`},o={};function s(e){try{let t=new CSSStyleSheet,n=Array.from(e.cssRules).map(e=>e.cssText).join(`
|
|
2
|
+
`);return t.replaceSync(n),t}catch{return null}}function c(e){if(e in o)return o[e];for(let t of Array.from(document.styleSheets))try{if(Array.from(t.cssRules).some(t=>t.cssText.includes(e)))return o[e]=s(t),o[e]}catch{}return o[e]=null,null}function l(){let t=[c(e.n),c(e.o[a.md])].filter(e=>e!=null);return Array.from(new Set(t))}var u=class extends HTMLElement{_inner=null;_label=null;static observedAttributes=[`variant`,`size`,`disabled`,`aria-label`,`aria-labelledby`,`aria-describedby`];get variant(){return this.getAttribute(`variant`)??`primary`}set variant(e){this.setAttribute(`variant`,e)}get size(){return this.getAttribute(`size`)??`md`}set size(e){this.setAttribute(`size`,e)}get disabled(){return this.hasAttribute(`disabled`)}set disabled(e){this.toggleAttribute(`disabled`,e)}_handleClick=e=>{e.stopPropagation(),this.dispatchEvent(new CustomEvent(`loom-click`,{bubbles:!0,composed:!0,detail:{}}))};_handleFocus=e=>{e.stopPropagation(),this.dispatchEvent(new CustomEvent(`loom-focus`,{bubbles:!0,composed:!0,detail:{}}))};_handleBlur=e=>{e.stopPropagation(),this.dispatchEvent(new CustomEvent(`loom-blur`,{bubbles:!0,composed:!0,detail:{}}))};_syncScheduled=!1;_scheduleSync(){this._syncScheduled||(this._syncScheduled=!0,requestAnimationFrame(()=>{this._syncScheduled=!1,this._sync()}))}connectedCallback(){if(!this.shadowRoot){let t=this.attachShadow({mode:`open`,delegatesFocus:!0}),n=l();n.length>0?t.adoptedStyleSheets=n:console.warn(`[loom-button] VE stylesheet not found - shadow styles will be missing.`),this._label=document.createElement(`span`),this._label.setAttribute(`part`,`label`),this._label.appendChild(document.createElement(`slot`)),this._inner=document.createElement(`button`),this._inner.type=`button`,this._inner.setAttribute(`part`,`button`),this._inner.appendChild(this._label),t.appendChild(this._inner),this.classList.add(e.t),this._inner.classList.add(e.n),this._inner.addEventListener(`click`,this._handleClick),this._inner.addEventListener(`focus`,this._handleFocus),this._inner.addEventListener(`blur`,this._handleBlur)}this._sync()}disconnectedCallback(){this._inner?.removeEventListener(`click`,this._handleClick),this._inner?.removeEventListener(`focus`,this._handleFocus),this._inner?.removeEventListener(`blur`,this._handleBlur)}attributeChangedCallback(e){if(e.startsWith(`aria-`)){this._syncA11y();return}this._scheduleSync()}_prev={variant:null,size:null,typographyKey:null};_sync(){if(!this._inner||!this._label)return;let t=this.getAttribute(`variant`)??`primary`,n=this.getAttribute(`size`)??`md`;this._apply(this._inner,`variant`,t,e.i),this._apply(this._inner,`size`,n,e.r),this._inner.disabled=this.hasAttribute(`disabled`);let r=n in a?a[n]:a.md;this._apply(this._label,`typographyKey`,r,e.o),this._syncA11y()}_syncA11y(){this._inner&&[`aria-label`,`aria-labelledby`,`aria-describedby`].forEach(e=>{let t=this.getAttribute(e);t?this._inner?.setAttribute(e,t):this._inner?.removeAttribute(e)})}_apply(e,t,n,r){let i=n!=null&&n in r?r[n]:null,a=this._prev[t]??null;i!==a&&(a&&e.classList.remove(a),i&&e.classList.add(i),this._prev[t]=i)}};customElements.define(`loom-button`,u),exports.LoomBox=t,exports.LoomButton=u,exports.LoomInline=r,exports.LoomStack=n,exports.LoomText=i;
|