@moldable-ai/ui 0.2.26 → 0.2.31
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/dist/catalog/component-catalog.d.ts +9 -2
- package/dist/catalog/component-catalog.d.ts.map +1 -1
- package/dist/catalog/component-catalog.js +11 -7
- package/dist/catalog/core-control-stories.d.ts.map +1 -1
- package/dist/catalog/core-control-stories.js +1 -1
- package/dist/catalog/core-foundation-stories.d.ts.map +1 -1
- package/dist/catalog/core-foundation-stories.js +15 -3
- package/dist/components/ui/app-frame.d.ts +20 -1
- package/dist/components/ui/app-frame.d.ts.map +1 -1
- package/dist/components/ui/app-frame.js +37 -7
- package/dist/components/ui/badge.d.ts +1 -1
- package/dist/components/ui/badge.js +1 -1
- package/dist/components/ui/button.d.ts +5 -3
- package/dist/components/ui/button.d.ts.map +1 -1
- package/dist/components/ui/button.js +39 -10
- package/dist/components/ui/card.d.ts +12 -2
- package/dist/components/ui/card.d.ts.map +1 -1
- package/dist/components/ui/card.js +3 -2
- package/dist/components/ui/checkbox.d.ts +4 -1
- package/dist/components/ui/checkbox.d.ts.map +1 -1
- package/dist/components/ui/checkbox.js +4 -4
- package/dist/components/ui/context-menu.js +6 -6
- package/dist/components/ui/date-field.d.ts +1 -1
- package/dist/components/ui/dropdown-menu.js +6 -6
- package/dist/components/ui/icon-button.d.ts +1 -1
- package/dist/components/ui/icon-button.d.ts.map +1 -1
- package/dist/components/ui/icon-button.js +1 -0
- package/dist/components/ui/index.d.ts +1 -0
- package/dist/components/ui/index.d.ts.map +1 -1
- package/dist/components/ui/index.js +1 -0
- package/dist/components/ui/input-group.d.ts +2 -2
- package/dist/components/ui/input.d.ts +6 -2
- package/dist/components/ui/input.d.ts.map +1 -1
- package/dist/components/ui/input.js +2 -2
- package/dist/components/ui/material.d.ts +8 -3
- package/dist/components/ui/material.d.ts.map +1 -1
- package/dist/components/ui/material.js +2 -2
- package/dist/components/ui/search-field.d.ts +3 -1
- package/dist/components/ui/search-field.d.ts.map +1 -1
- package/dist/components/ui/search-field.js +16 -6
- package/dist/components/ui/segmented-control.d.ts +3 -1
- package/dist/components/ui/segmented-control.d.ts.map +1 -1
- package/dist/components/ui/segmented-control.js +23 -17
- package/dist/components/ui/select.js +2 -2
- package/dist/components/ui/sidebar.d.ts +5 -3
- package/dist/components/ui/sidebar.d.ts.map +1 -1
- package/dist/components/ui/sidebar.js +53 -15
- package/dist/components/ui/status.d.ts +1 -1
- package/dist/components/ui/status.js +1 -1
- package/dist/components/ui/switch.d.ts +3 -1
- package/dist/components/ui/switch.d.ts.map +1 -1
- package/dist/components/ui/switch.js +3 -2
- package/dist/components/ui/toolbar-controls.d.ts +49 -0
- package/dist/components/ui/toolbar-controls.d.ts.map +1 -0
- package/dist/components/ui/toolbar-controls.js +47 -0
- package/dist/components/ui/toolbar.d.ts +5 -4
- package/dist/components/ui/toolbar.d.ts.map +1 -1
- package/dist/components/ui/toolbar.js +3 -3
- package/dist/index.d.ts +2 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +3 -1
- package/dist/lib/frame-lifecycle.d.ts +1 -0
- package/dist/lib/frame-lifecycle.d.ts.map +1 -1
- package/dist/lib/frame-lifecycle.js +7 -0
- package/dist/lib/theme.d.ts +39 -5
- package/dist/lib/theme.d.ts.map +1 -1
- package/dist/lib/theme.js +105 -17
- package/dist/tokens/contracts.d.ts +79 -0
- package/dist/tokens/contracts.d.ts.map +1 -0
- package/dist/tokens/contracts.js +57 -0
- package/dist/tokens/index.d.ts +2 -0
- package/dist/tokens/index.d.ts.map +1 -0
- package/dist/tokens/index.js +1 -0
- package/docs/README.md +2 -0
- package/docs/adaptive-materials.md +14 -9
- package/docs/design-tokens.md +10 -6
- package/docs/foundations.md +3 -3
- package/docs/macos-design-audit.md +144 -0
- package/docs/native-integration.md +4 -4
- package/docs/platform-architecture.md +189 -0
- package/docs/standalone-app-windows.md +37 -0
- package/docs/visual-regression.md +6 -8
- package/package.json +13 -1
- package/src/components/ui/accordion.md +46 -0
- package/src/components/ui/alert.md +12 -4
- package/src/components/ui/app-frame.md +8 -5
- package/src/components/ui/aspect-ratio.md +37 -0
- package/src/components/ui/avatar.md +48 -0
- package/src/components/ui/breadcrumb.md +52 -0
- package/src/components/ui/button-group.md +43 -0
- package/src/components/ui/button.md +20 -4
- package/src/components/ui/calendar.md +42 -0
- package/src/components/ui/card.md +43 -0
- package/src/components/ui/carousel.md +47 -0
- package/src/components/ui/chart.md +52 -0
- package/src/components/ui/checkbox.md +36 -0
- package/src/components/ui/collapsible.md +2 -3
- package/src/components/ui/color-well.md +14 -4
- package/src/components/ui/combobox.md +3 -3
- package/src/components/ui/confirm-dialog.md +5 -4
- package/src/components/ui/context-menu.md +3 -2
- package/src/components/ui/date-field.md +6 -1
- package/src/components/ui/date-picker.md +6 -3
- package/src/components/ui/dialog.md +14 -12
- package/src/components/ui/drawer.md +58 -0
- package/src/components/ui/error-boundary-view.md +1 -1
- package/src/components/ui/field.md +2 -1
- package/src/components/ui/form.md +71 -0
- package/src/components/ui/grid.md +4 -3
- package/src/components/ui/icon-button.md +4 -1
- package/src/components/ui/input-group.md +49 -0
- package/src/components/ui/input-otp.md +56 -0
- package/src/components/ui/input.md +40 -0
- package/src/components/ui/inspector.md +47 -7
- package/src/components/ui/item.md +5 -3
- package/src/components/ui/kbd.md +30 -0
- package/src/components/ui/label.md +29 -0
- package/src/components/ui/list.md +2 -2
- package/src/components/ui/material.md +25 -12
- package/src/components/ui/menu-items.md +60 -0
- package/src/components/ui/menubar.md +58 -0
- package/src/components/ui/message-scroller-primitive.md +70 -0
- package/src/components/ui/message-scroller.md +86 -0
- package/src/components/ui/navigation-button-group.md +4 -3
- package/src/components/ui/navigation-menu.md +52 -0
- package/src/components/ui/number-input.md +8 -0
- package/src/components/ui/pagination.md +51 -0
- package/src/components/ui/panel.md +6 -0
- package/src/components/ui/popover.md +10 -7
- package/src/components/ui/progress.md +31 -0
- package/src/components/ui/radio-group.md +36 -0
- package/src/components/ui/resizable.md +2 -1
- package/src/components/ui/scroll-area.md +3 -1
- package/src/components/ui/search-field.md +6 -1
- package/src/components/ui/segmented-control.md +6 -1
- package/src/components/ui/separator.md +35 -0
- package/src/components/ui/sidebar.md +20 -3
- package/src/components/ui/skeleton.md +36 -0
- package/src/components/ui/slider.md +58 -0
- package/src/components/ui/spinner.md +41 -0
- package/src/components/ui/split-view.md +8 -4
- package/src/components/ui/switch.md +44 -0
- package/src/components/ui/table.md +7 -7
- package/src/components/ui/tabs.md +3 -1
- package/src/components/ui/textarea.md +41 -0
- package/src/components/ui/toggle-group.md +2 -2
- package/src/components/ui/toggle.md +9 -9
- package/src/components/ui/toolbar-controls.md +83 -0
- package/src/components/ui/toolbar.md +12 -6
- package/src/styles/index.css +199 -107
- package/src/tokens/contracts.ts +131 -0
- package/src/tokens/index.css +6 -0
- package/src/tokens/index.ts +23 -0
- package/src/tokens/macos-26/README.md +37 -0
- package/src/tokens/macos-26/aliases.css +53 -0
- package/src/tokens/macos-26/compatibility.css +7 -0
- package/src/tokens/macos-26/index.css +3 -0
- package/src/tokens/macos-26/source/provenance.generated.json +28 -0
- package/src/tokens/macos-26/source/sidebar.generated.css +29 -0
- package/src/tokens/macos-26/source.css +7 -0
- package/src/tokens/macos-26/web-adaptations.json +25 -0
- package/src/tokens/macos-26/web-adaptations.md +15 -0
- package/src/tokens/macos-27/accessibility.css +11 -0
- package/src/tokens/macos-27/aliases.css +304 -0
- package/src/tokens/macos-27/compatibility.css +212 -0
- package/src/tokens/macos-27/index.css +15 -0
- package/src/tokens/macos-27/recipes.css +23 -0
- package/src/tokens/macos-27/source/chrome.generated.css +338 -0
- package/src/tokens/macos-27/source/colors.generated.css +140 -0
- package/src/tokens/macos-27/source/context.generated.css +18 -0
- package/src/tokens/macos-27/source/controls.generated.css +764 -0
- package/src/tokens/macos-27/source/effects.generated.css +68 -0
- package/src/tokens/macos-27/source/kit.generated.css +50 -0
- package/src/tokens/macos-27/source/overlays-status.generated.css +931 -0
- package/src/tokens/macos-27/source/paint-styles.generated.css +81 -0
- package/src/tokens/macos-27/source/provenance.generated.json +62 -0
- package/src/tokens/macos-27/source/sizes.generated.css +385 -0
- package/src/tokens/macos-27/source/source.generated.json +554 -0
- package/src/tokens/macos-27/source/text-styles.generated.css +116 -0
- package/src/tokens/macos-27/source.css +17 -0
- package/src/tokens/macos-27/web-adaptations.css +98 -0
- package/src/tokens/macos-27/web-adaptations.json +163 -0
- package/src/tokens/macos-27/web-adaptations.md +117 -0
- package/src/tokens/moldable/brand.css +48 -0
- package/src/tokens/moldable/index.css +1 -0
- package/src/tokens/platform-contract.test.ts +290 -0
|
@@ -0,0 +1,290 @@
|
|
|
1
|
+
import {
|
|
2
|
+
PLATFORM_PACKS,
|
|
3
|
+
SIDEBAR_STYLES,
|
|
4
|
+
resolvePlatformPack,
|
|
5
|
+
} from './contracts'
|
|
6
|
+
import { readFileSync, readdirSync } from 'node:fs'
|
|
7
|
+
import { extname, join, resolve } from 'node:path'
|
|
8
|
+
import { describe, expect, it } from 'vitest'
|
|
9
|
+
|
|
10
|
+
interface WebAdaptationManifest {
|
|
11
|
+
source: string
|
|
12
|
+
target: string
|
|
13
|
+
schemaVersion: number
|
|
14
|
+
idConvention: string
|
|
15
|
+
adaptations: Array<{
|
|
16
|
+
id: string
|
|
17
|
+
status: string
|
|
18
|
+
overrides: Array<{
|
|
19
|
+
appearance?: 'light' | 'dark'
|
|
20
|
+
token: string
|
|
21
|
+
sourceValue: string
|
|
22
|
+
adaptedValue: string
|
|
23
|
+
}>
|
|
24
|
+
}>
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
function collectSourceFiles(directory: string): string[] {
|
|
28
|
+
return readdirSync(directory, { withFileTypes: true }).flatMap((entry) => {
|
|
29
|
+
const path = join(directory, entry.name)
|
|
30
|
+
if (entry.isDirectory()) return collectSourceFiles(path)
|
|
31
|
+
return ['.ts', '.tsx'].includes(extname(path)) ? [path] : []
|
|
32
|
+
})
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
describe('platform token contract', () => {
|
|
36
|
+
it('resolves exact versioned packs and an explicit web fallback', () => {
|
|
37
|
+
expect(resolvePlatformPack('macos', '27')).toBe(PLATFORM_PACKS['macos-27'])
|
|
38
|
+
expect(resolvePlatformPack('windows', 'future')).toBe(
|
|
39
|
+
PLATFORM_PACKS['web-default'],
|
|
40
|
+
)
|
|
41
|
+
})
|
|
42
|
+
|
|
43
|
+
it('keeps immutable platform variables out of universal components', () => {
|
|
44
|
+
const componentRoot = resolve(process.cwd(), 'src/components')
|
|
45
|
+
const violations = collectSourceFiles(componentRoot).filter((path) =>
|
|
46
|
+
/--m\d+-source-/.test(readFileSync(path, 'utf8')),
|
|
47
|
+
)
|
|
48
|
+
|
|
49
|
+
expect(violations).toEqual([])
|
|
50
|
+
})
|
|
51
|
+
|
|
52
|
+
it('registers semantic sidebar anatomy separately from the base pack', () => {
|
|
53
|
+
expect(SIDEBAR_STYLES).toMatchObject({
|
|
54
|
+
floating: {
|
|
55
|
+
sourcePlatform: 'macos',
|
|
56
|
+
sourceVersion: '26',
|
|
57
|
+
},
|
|
58
|
+
'edge-to-edge': {
|
|
59
|
+
sourcePlatform: 'macos',
|
|
60
|
+
sourceVersion: '27',
|
|
61
|
+
},
|
|
62
|
+
})
|
|
63
|
+
})
|
|
64
|
+
|
|
65
|
+
it('keeps the macOS 27 edge-to-edge sidebar canvas-owned', () => {
|
|
66
|
+
const aliases = readFileSync(
|
|
67
|
+
resolve(process.cwd(), 'src/tokens/macos-27/aliases.css'),
|
|
68
|
+
'utf8',
|
|
69
|
+
)
|
|
70
|
+
const compatibility = readFileSync(
|
|
71
|
+
resolve(process.cwd(), 'src/tokens/macos-27/compatibility.css'),
|
|
72
|
+
'utf8',
|
|
73
|
+
)
|
|
74
|
+
|
|
75
|
+
expect(aliases).toContain('--m-ui-sidebar-material-fill: transparent;')
|
|
76
|
+
expect(aliases).toContain('--m-ui-sidebar-glass-effect-radius: 0px;')
|
|
77
|
+
expect(aliases).toContain('--m-ui-sidebar-divider-width: 0px;')
|
|
78
|
+
expect(compatibility).toContain(
|
|
79
|
+
'--sidebar: var(--m-ui-sidebar-material-fill);',
|
|
80
|
+
)
|
|
81
|
+
expect(compatibility).toContain(
|
|
82
|
+
"[data-ui-sidebar-style='edge-to-edge'][data-slot='sidebar']",
|
|
83
|
+
)
|
|
84
|
+
expect(compatibility).toContain('--sidebar: transparent;')
|
|
85
|
+
expect(compatibility).toContain('--sidebar-border: transparent;')
|
|
86
|
+
})
|
|
87
|
+
|
|
88
|
+
it('preserves the macOS 26 floating-sidebar source values exactly', () => {
|
|
89
|
+
const source = readFileSync(
|
|
90
|
+
resolve(
|
|
91
|
+
process.cwd(),
|
|
92
|
+
'src/tokens/macos-26/source/sidebar.generated.css',
|
|
93
|
+
),
|
|
94
|
+
'utf8',
|
|
95
|
+
)
|
|
96
|
+
const requiredValues = [
|
|
97
|
+
'--m26-source-sidebar-width-reference: 240px;',
|
|
98
|
+
'--m26-source-sidebar-radius-shell: 18px;',
|
|
99
|
+
'--m26-source-sidebar-radius-item: 5px;',
|
|
100
|
+
'--m26-source-sidebar-radius-selection: 8px;',
|
|
101
|
+
'--m26-source-sidebar-corner-smoothing: 60%;',
|
|
102
|
+
'--m26-source-sidebar-shadow: 0 8px 40px rgb(0 0 0 / 12%);',
|
|
103
|
+
'--m26-source-sidebar-glass-effect-radius: 12px;',
|
|
104
|
+
'--m26-source-sidebar-padding-block: 10px;',
|
|
105
|
+
'--m26-source-sidebar-row-inset-inline: 10px;',
|
|
106
|
+
'--m26-source-sidebar-row-height-small: 24px;',
|
|
107
|
+
'--m26-source-sidebar-row-height-medium: 32px;',
|
|
108
|
+
'--m26-source-sidebar-row-height-large: 40px;',
|
|
109
|
+
'--m26-source-sidebar-section-height-small: 34px;',
|
|
110
|
+
'--m26-source-sidebar-section-height-medium: 39px;',
|
|
111
|
+
'--m26-source-sidebar-section-height-large: 43px;',
|
|
112
|
+
'--m26-source-sidebar-selection-light: rgb(0 0 0 / 11%);',
|
|
113
|
+
]
|
|
114
|
+
|
|
115
|
+
expect(source).toContain("[data-ui-platform-version='26']")
|
|
116
|
+
expect(source).toContain("[data-ui-sidebar-style='floating']")
|
|
117
|
+
for (const value of requiredValues) expect(source).toContain(value)
|
|
118
|
+
})
|
|
119
|
+
|
|
120
|
+
it('keeps floating dark overrides on their own profile boundary', () => {
|
|
121
|
+
const floatingAliases = readFileSync(
|
|
122
|
+
resolve(process.cwd(), 'src/tokens/macos-26/aliases.css'),
|
|
123
|
+
'utf8',
|
|
124
|
+
)
|
|
125
|
+
const moldableBrand = readFileSync(
|
|
126
|
+
resolve(process.cwd(), 'src/tokens/moldable/brand.css'),
|
|
127
|
+
'utf8',
|
|
128
|
+
)
|
|
129
|
+
const descendantDarkAppearance =
|
|
130
|
+
/\[data-ui-sidebar-style='floating'\]\s+\[data-ui-appearance='dark'\]/
|
|
131
|
+
|
|
132
|
+
expect(floatingAliases).toContain(
|
|
133
|
+
"[data-ui-sidebar-style='floating'][data-ui-appearance='dark']",
|
|
134
|
+
)
|
|
135
|
+
expect(floatingAliases).not.toMatch(descendantDarkAppearance)
|
|
136
|
+
expect(moldableBrand).not.toMatch(descendantDarkAppearance)
|
|
137
|
+
})
|
|
138
|
+
|
|
139
|
+
it('scopes every source stylesheet to its platform and version', () => {
|
|
140
|
+
const sourceRoot = resolve(process.cwd(), 'src/tokens/macos-27/source')
|
|
141
|
+
const stylesheets = readdirSync(sourceRoot)
|
|
142
|
+
.filter((name) => name.endsWith('.css'))
|
|
143
|
+
.map((name) => join(sourceRoot, name))
|
|
144
|
+
const violations = stylesheets.filter((path) => {
|
|
145
|
+
const source = readFileSync(path, 'utf8')
|
|
146
|
+
return (
|
|
147
|
+
source.includes(':root') ||
|
|
148
|
+
!source.includes("[data-ui-platform='macos']") ||
|
|
149
|
+
!source.includes("[data-ui-platform-version='27']")
|
|
150
|
+
)
|
|
151
|
+
})
|
|
152
|
+
|
|
153
|
+
expect(violations).toEqual([])
|
|
154
|
+
})
|
|
155
|
+
|
|
156
|
+
it('keeps web adaptations explicit, traceable, and outside the source export', () => {
|
|
157
|
+
const packRoot = resolve(process.cwd(), 'src/tokens/macos-27')
|
|
158
|
+
const index = readFileSync(join(packRoot, 'index.css'), 'utf8')
|
|
159
|
+
const sourceEntry = readFileSync(join(packRoot, 'source.css'), 'utf8')
|
|
160
|
+
const sourceStyles = readdirSync(join(packRoot, 'source'))
|
|
161
|
+
.filter((name) => name.endsWith('.css'))
|
|
162
|
+
.map((name) => readFileSync(join(packRoot, 'source', name), 'utf8'))
|
|
163
|
+
.join('\n')
|
|
164
|
+
const adaptationCss = readFileSync(
|
|
165
|
+
join(packRoot, 'web-adaptations.css'),
|
|
166
|
+
'utf8',
|
|
167
|
+
)
|
|
168
|
+
const manifest = JSON.parse(
|
|
169
|
+
readFileSync(join(packRoot, 'web-adaptations.json'), 'utf8'),
|
|
170
|
+
) as WebAdaptationManifest
|
|
171
|
+
const normalizeCss = (value: string) => value.replace(/\s+/g, ' ').trim()
|
|
172
|
+
const normalizedSourceStyles = normalizeCss(sourceStyles)
|
|
173
|
+
const normalizedAdaptationCss = normalizeCss(adaptationCss)
|
|
174
|
+
|
|
175
|
+
expect(index).toContain("@import './web-adaptations.css';")
|
|
176
|
+
expect(sourceEntry).not.toContain('web-adaptations')
|
|
177
|
+
expect(manifest).toMatchObject({
|
|
178
|
+
source: 'macOS 27',
|
|
179
|
+
target: 'web',
|
|
180
|
+
schemaVersion: 1,
|
|
181
|
+
idConvention: 'M27-WEB-{AREA}-{NNN}',
|
|
182
|
+
})
|
|
183
|
+
|
|
184
|
+
const ids = manifest.adaptations.map(({ id }) => id)
|
|
185
|
+
expect(new Set(ids).size).toBe(ids.length)
|
|
186
|
+
|
|
187
|
+
for (const adaptation of manifest.adaptations) {
|
|
188
|
+
expect(adaptation.status).toBe('intentional-divergence')
|
|
189
|
+
expect(adaptationCss).toContain(`@m27-divergence ${adaptation.id}`)
|
|
190
|
+
|
|
191
|
+
for (const override of adaptation.overrides) {
|
|
192
|
+
expect(normalizedSourceStyles).toContain(
|
|
193
|
+
`${override.token}: ${override.sourceValue};`,
|
|
194
|
+
)
|
|
195
|
+
expect(normalizedAdaptationCss).toContain(
|
|
196
|
+
`${override.token}: ${override.adaptedValue};`,
|
|
197
|
+
)
|
|
198
|
+
}
|
|
199
|
+
}
|
|
200
|
+
})
|
|
201
|
+
|
|
202
|
+
it('fully shadows the legacy Tailwind semantic environment per pack', () => {
|
|
203
|
+
const compatibility = readFileSync(
|
|
204
|
+
resolve(process.cwd(), 'src/tokens/macos-27/compatibility.css'),
|
|
205
|
+
'utf8',
|
|
206
|
+
)
|
|
207
|
+
const requiredVariables = [
|
|
208
|
+
'--font-family-ui',
|
|
209
|
+
'--type-display-size',
|
|
210
|
+
'--type-badge-size',
|
|
211
|
+
'--density-control-height-md',
|
|
212
|
+
'--density-badge-height',
|
|
213
|
+
'--shape-control',
|
|
214
|
+
'--background',
|
|
215
|
+
'--foreground',
|
|
216
|
+
'--card',
|
|
217
|
+
'--popover',
|
|
218
|
+
'--primary',
|
|
219
|
+
'--secondary',
|
|
220
|
+
'--muted',
|
|
221
|
+
'--accent',
|
|
222
|
+
'--destructive',
|
|
223
|
+
'--border',
|
|
224
|
+
'--input',
|
|
225
|
+
'--ring',
|
|
226
|
+
'--sidebar',
|
|
227
|
+
'--surface-canvas',
|
|
228
|
+
'--surface-toolbar',
|
|
229
|
+
'--control-hover',
|
|
230
|
+
'--toolbar-control-background',
|
|
231
|
+
'--material-medium-fill',
|
|
232
|
+
'--material-shadow-card',
|
|
233
|
+
'--material-shadow-window',
|
|
234
|
+
'--window-chrome-background',
|
|
235
|
+
]
|
|
236
|
+
|
|
237
|
+
expect(compatibility).toContain("[data-ui-platform='macos']")
|
|
238
|
+
expect(compatibility).toContain("[data-ui-platform-version='27']")
|
|
239
|
+
for (const variable of requiredVariables) {
|
|
240
|
+
expect(compatibility).toContain(`${variable}:`)
|
|
241
|
+
}
|
|
242
|
+
})
|
|
243
|
+
|
|
244
|
+
it('maps the macOS unified toolbar to its full 52px platform metric', () => {
|
|
245
|
+
const chromeSource = readFileSync(
|
|
246
|
+
resolve(process.cwd(), 'src/tokens/macos-27/source/chrome.generated.css'),
|
|
247
|
+
'utf8',
|
|
248
|
+
)
|
|
249
|
+
const compatibility = readFileSync(
|
|
250
|
+
resolve(process.cwd(), 'src/tokens/macos-27/compatibility.css'),
|
|
251
|
+
'utf8',
|
|
252
|
+
)
|
|
253
|
+
|
|
254
|
+
expect(chromeSource).toContain(
|
|
255
|
+
'--m27-source-chrome-toolbar-unified-height: 52px;',
|
|
256
|
+
)
|
|
257
|
+
expect(chromeSource).toContain(
|
|
258
|
+
'--m27-source-chrome-toolbar-unified-padding-block: 8px;',
|
|
259
|
+
)
|
|
260
|
+
expect(compatibility.replace(/\s+/g, ' ')).toContain(
|
|
261
|
+
'--density-toolbar-height: var(--m27-source-chrome-toolbar-unified-height);',
|
|
262
|
+
)
|
|
263
|
+
})
|
|
264
|
+
|
|
265
|
+
it('only applies Moldable deltas when the Moldable theme is selected', () => {
|
|
266
|
+
const brand = readFileSync(
|
|
267
|
+
resolve(process.cwd(), 'src/tokens/moldable/brand.css'),
|
|
268
|
+
'utf8',
|
|
269
|
+
)
|
|
270
|
+
|
|
271
|
+
expect(brand).toContain("[data-ui-theme='moldable']")
|
|
272
|
+
expect(brand).toContain(
|
|
273
|
+
"[data-ui-theme='moldable'][data-ui-sidebar-style='floating']",
|
|
274
|
+
)
|
|
275
|
+
expect(brand).toContain(
|
|
276
|
+
"[data-ui-theme='moldable'][data-ui-sidebar-style='floating'][data-ui-appearance='dark']",
|
|
277
|
+
)
|
|
278
|
+
expect(brand).not.toMatch(
|
|
279
|
+
/\[data-ui-sidebar-style='floating'\]\s+\[data-ui-appearance='dark'\]/,
|
|
280
|
+
)
|
|
281
|
+
expect(brand).toContain('--m-ui-surface-content: #1d1f1f;')
|
|
282
|
+
expect(brand).toContain('--m-ui-sidebar-material-fill: #1b1d1e;')
|
|
283
|
+
expect(brand).toContain('--m-ui-sidebar-border-color: #394043;')
|
|
284
|
+
expect(brand).toContain(
|
|
285
|
+
'--sidebar-accent-foreground: var(--m-ui-color-accent);',
|
|
286
|
+
)
|
|
287
|
+
expect(brand).toContain('0 4px 14px rgb(0 0 0 / 6%)')
|
|
288
|
+
expect(brand).not.toMatch(/(^|[,\s]):root(?=[\s,{])/)
|
|
289
|
+
})
|
|
290
|
+
})
|