@spectral_labs/ui 1.5.2 → 1.6.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/dist/components/__tests__/overlay-scrim-source.test.js +134 -0
- package/dist/components/command/__tests__/CommandTest.svelte +24 -2
- package/dist/components/command/__tests__/command-item-passthrough.test.svelte.js +284 -0
- package/dist/components/command/components/command-item.svelte +49 -12
- package/dist/components/command/components/command-item.svelte.d.ts.map +1 -1
- package/dist/components/command/types.d.ts +27 -2
- package/dist/components/command/types.d.ts.map +1 -1
- package/dist/components/context-menu/index.d.ts +3 -0
- package/dist/components/context-menu/index.d.ts.map +1 -1
- package/dist/components/context-menu/index.js +2 -0
- package/dist/components/dropdown-menu/__tests__/DropdownMenuRadioTest.svelte +90 -0
- package/dist/components/dropdown-menu/__tests__/dropdown-menu-radio-group.test.svelte.js +306 -0
- package/dist/components/dropdown-menu/components/dropdown-menu-radio-group.svelte +45 -0
- package/dist/components/dropdown-menu/components/dropdown-menu-radio-group.svelte.d.ts +5 -0
- package/dist/components/dropdown-menu/components/dropdown-menu-radio-group.svelte.d.ts.map +1 -0
- package/dist/components/dropdown-menu/components/dropdown-menu-radio-item.svelte +143 -0
- package/dist/components/dropdown-menu/components/dropdown-menu-radio-item.svelte.d.ts +5 -0
- package/dist/components/dropdown-menu/components/dropdown-menu-radio-item.svelte.d.ts.map +1 -0
- package/dist/components/dropdown-menu/dropdown-menu.svelte.d.ts +18 -0
- package/dist/components/dropdown-menu/dropdown-menu.svelte.d.ts.map +1 -1
- package/dist/components/dropdown-menu/dropdown-menu.svelte.js +16 -0
- package/dist/components/dropdown-menu/index.d.ts +3 -1
- package/dist/components/dropdown-menu/index.d.ts.map +1 -1
- package/dist/components/dropdown-menu/index.js +2 -0
- package/dist/components/dropdown-menu/types.d.ts +35 -1
- package/dist/components/dropdown-menu/types.d.ts.map +1 -1
- package/dist/components/menubar/index.d.ts +3 -1
- package/dist/components/menubar/index.d.ts.map +1 -1
- package/dist/components/menubar/index.js +2 -0
- package/package.json +1 -1
- package/src/themes/__tests__/generated-css-drift.test.ts +53 -0
- package/src/themes/__tests__/scrim-opaque.test.ts +52 -0
- package/src/themes/carbon.css +1 -2
- package/src/themes/day.css +1 -2
- package/src/themes/docs.css +1 -1
- package/src/themes/iris-ocr.css +1 -2
- package/src/themes/midnight.css +1 -2
- package/src/themes/spectral.css +1 -3
- package/src/tokens.css +1 -1
|
@@ -2,11 +2,13 @@ export { default as CheckboxItem } from './components/dropdown-menu-checkbox-ite
|
|
|
2
2
|
export { default as Content } from './components/dropdown-menu-content.svelte';
|
|
3
3
|
export { default as Item } from './components/dropdown-menu-item.svelte';
|
|
4
4
|
export { default as Label } from './components/dropdown-menu-label.svelte';
|
|
5
|
+
export { default as RadioGroup } from './components/dropdown-menu-radio-group.svelte';
|
|
6
|
+
export { default as RadioItem } from './components/dropdown-menu-radio-item.svelte';
|
|
5
7
|
export { default as Root } from './components/dropdown-menu-root.svelte';
|
|
6
8
|
export { default as Separator } from './components/dropdown-menu-separator.svelte';
|
|
7
9
|
export { default as SubContent } from './components/dropdown-menu-sub-content.svelte';
|
|
8
10
|
export { default as SubTrigger } from './components/dropdown-menu-sub-trigger.svelte';
|
|
9
11
|
export { default as Sub } from './components/dropdown-menu-sub.svelte';
|
|
10
12
|
export { default as Trigger } from './components/dropdown-menu-trigger.svelte';
|
|
11
|
-
export type { DropdownMenuCheckboxItemProps, DropdownMenuContentProps, DropdownMenuItemProps, DropdownMenuLabelProps, DropdownMenuProps, DropdownMenuSeparatorProps, DropdownMenuSubContentProps, DropdownMenuSubProps, DropdownMenuSubTriggerProps, DropdownMenuTriggerProps, } from './types.js';
|
|
13
|
+
export type { DropdownMenuCheckboxItemProps, DropdownMenuContentProps, DropdownMenuItemProps, DropdownMenuLabelProps, DropdownMenuProps, DropdownMenuRadioGroupProps, DropdownMenuRadioItemProps, DropdownMenuSeparatorProps, DropdownMenuSubContentProps, DropdownMenuSubProps, DropdownMenuSubTriggerProps, DropdownMenuTriggerProps, } from './types.js';
|
|
12
14
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/lib/components/dropdown-menu/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,IAAI,YAAY,EAAE,MAAM,iDAAiD,CAAA;AACzF,OAAO,EAAE,OAAO,IAAI,OAAO,EAAE,MAAM,2CAA2C,CAAA;AAC9E,OAAO,EAAE,OAAO,IAAI,IAAI,EAAE,MAAM,wCAAwC,CAAA;AACxE,OAAO,EAAE,OAAO,IAAI,KAAK,EAAE,MAAM,yCAAyC,CAAA;AAC1E,OAAO,EAAE,OAAO,IAAI,IAAI,EAAE,MAAM,wCAAwC,CAAA;AACxE,OAAO,EAAE,OAAO,IAAI,SAAS,EAAE,MAAM,6CAA6C,CAAA;AAClF,OAAO,EAAE,OAAO,IAAI,UAAU,EAAE,MAAM,+CAA+C,CAAA;AACrF,OAAO,EAAE,OAAO,IAAI,UAAU,EAAE,MAAM,+CAA+C,CAAA;AACrF,OAAO,EAAE,OAAO,IAAI,GAAG,EAAE,MAAM,uCAAuC,CAAA;AACtE,OAAO,EAAE,OAAO,IAAI,OAAO,EAAE,MAAM,2CAA2C,CAAA;AAC9E,YAAY,EACV,6BAA6B,EAC7B,wBAAwB,EACxB,qBAAqB,EACrB,sBAAsB,EACtB,iBAAiB,EACjB,0BAA0B,EAC1B,2BAA2B,EAC3B,oBAAoB,EACpB,2BAA2B,EAC3B,wBAAwB,GACzB,MAAM,YAAY,CAAA"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/lib/components/dropdown-menu/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,IAAI,YAAY,EAAE,MAAM,iDAAiD,CAAA;AACzF,OAAO,EAAE,OAAO,IAAI,OAAO,EAAE,MAAM,2CAA2C,CAAA;AAC9E,OAAO,EAAE,OAAO,IAAI,IAAI,EAAE,MAAM,wCAAwC,CAAA;AACxE,OAAO,EAAE,OAAO,IAAI,KAAK,EAAE,MAAM,yCAAyC,CAAA;AAC1E,OAAO,EAAE,OAAO,IAAI,UAAU,EAAE,MAAM,+CAA+C,CAAA;AACrF,OAAO,EAAE,OAAO,IAAI,SAAS,EAAE,MAAM,8CAA8C,CAAA;AACnF,OAAO,EAAE,OAAO,IAAI,IAAI,EAAE,MAAM,wCAAwC,CAAA;AACxE,OAAO,EAAE,OAAO,IAAI,SAAS,EAAE,MAAM,6CAA6C,CAAA;AAClF,OAAO,EAAE,OAAO,IAAI,UAAU,EAAE,MAAM,+CAA+C,CAAA;AACrF,OAAO,EAAE,OAAO,IAAI,UAAU,EAAE,MAAM,+CAA+C,CAAA;AACrF,OAAO,EAAE,OAAO,IAAI,GAAG,EAAE,MAAM,uCAAuC,CAAA;AACtE,OAAO,EAAE,OAAO,IAAI,OAAO,EAAE,MAAM,2CAA2C,CAAA;AAC9E,YAAY,EACV,6BAA6B,EAC7B,wBAAwB,EACxB,qBAAqB,EACrB,sBAAsB,EACtB,iBAAiB,EACjB,2BAA2B,EAC3B,0BAA0B,EAC1B,0BAA0B,EAC1B,2BAA2B,EAC3B,oBAAoB,EACpB,2BAA2B,EAC3B,wBAAwB,GACzB,MAAM,YAAY,CAAA"}
|
|
@@ -2,6 +2,8 @@ export { default as CheckboxItem } from './components/dropdown-menu-checkbox-ite
|
|
|
2
2
|
export { default as Content } from './components/dropdown-menu-content.svelte';
|
|
3
3
|
export { default as Item } from './components/dropdown-menu-item.svelte';
|
|
4
4
|
export { default as Label } from './components/dropdown-menu-label.svelte';
|
|
5
|
+
export { default as RadioGroup } from './components/dropdown-menu-radio-group.svelte';
|
|
6
|
+
export { default as RadioItem } from './components/dropdown-menu-radio-item.svelte';
|
|
5
7
|
export { default as Root } from './components/dropdown-menu-root.svelte';
|
|
6
8
|
export { default as Separator } from './components/dropdown-menu-separator.svelte';
|
|
7
9
|
export { default as SubContent } from './components/dropdown-menu-sub-content.svelte';
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { Snippet } from 'svelte';
|
|
2
|
-
import type { HTMLButtonAttributes } from 'svelte/elements';
|
|
2
|
+
import type { HTMLAttributes, HTMLButtonAttributes } from 'svelte/elements';
|
|
3
3
|
import type { Align, Side } from '../../internal/floating-layer/types.js';
|
|
4
4
|
export interface DropdownMenuProps {
|
|
5
5
|
open?: boolean;
|
|
@@ -55,6 +55,40 @@ export interface DropdownMenuCheckboxItemProps {
|
|
|
55
55
|
class?: string;
|
|
56
56
|
children?: Snippet;
|
|
57
57
|
}
|
|
58
|
+
/**
|
|
59
|
+
* Extends the native div attributes so the real `role="group"` node can be
|
|
60
|
+
* named: several radio groups in one menu each need their own `aria-label` /
|
|
61
|
+
* `aria-labelledby`, and consumers need `id` / `data-testid` on the group
|
|
62
|
+
* itself.
|
|
63
|
+
*/
|
|
64
|
+
export interface DropdownMenuRadioGroupProps extends Omit<HTMLAttributes<HTMLDivElement>, 'class' | 'children'> {
|
|
65
|
+
/** The selected value. Bindable. */
|
|
66
|
+
value?: string;
|
|
67
|
+
/** Called whenever the selection changes. Never fired for a re-selection. */
|
|
68
|
+
onValueChange?: (value: string) => void;
|
|
69
|
+
class?: string;
|
|
70
|
+
children?: Snippet;
|
|
71
|
+
}
|
|
72
|
+
/**
|
|
73
|
+
* Extends the native div attributes: unlike the older menu rows, a consumer's
|
|
74
|
+
* `data-testid`, `aria-*` and event handlers reach the DOM node
|
|
75
|
+
* (spectral-ui#201 is not reproduced here). Consumer handlers COMPOSE with the
|
|
76
|
+
* built-in ones — they run first, and calling `preventDefault()` cancels the
|
|
77
|
+
* built-in behaviour.
|
|
78
|
+
*/
|
|
79
|
+
export interface DropdownMenuRadioItemProps extends Omit<HTMLAttributes<HTMLDivElement>, 'class' | 'children'> {
|
|
80
|
+
/** Value identifying this row within its `RadioGroup`. */
|
|
81
|
+
value: string;
|
|
82
|
+
disabled?: boolean;
|
|
83
|
+
/** Override textContent for typeahead matching. */
|
|
84
|
+
textValue?: string;
|
|
85
|
+
/** Close the menu after selection (default true). */
|
|
86
|
+
closeOnSelect?: boolean;
|
|
87
|
+
/** Callback on selection, after the group's value has moved. */
|
|
88
|
+
onSelect?: (event: Event) => void;
|
|
89
|
+
class?: string;
|
|
90
|
+
children?: Snippet;
|
|
91
|
+
}
|
|
58
92
|
export interface DropdownMenuSubProps {
|
|
59
93
|
/** Whether the submenu is open. */
|
|
60
94
|
open?: boolean;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/lib/components/dropdown-menu/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,QAAQ,CAAA;AACrC,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,iBAAiB,CAAA;
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/lib/components/dropdown-menu/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,QAAQ,CAAA;AACrC,OAAO,KAAK,EAAE,cAAc,EAAE,oBAAoB,EAAE,MAAM,iBAAiB,CAAA;AAC3E,OAAO,KAAK,EAAE,KAAK,EAAE,IAAI,EAAE,MAAM,wCAAwC,CAAA;AAEzE,MAAM,WAAW,iBAAiB;IAChC,IAAI,CAAC,EAAE,OAAO,CAAA;IACd,uFAAuF;IACvF,YAAY,CAAC,EAAE,CAAC,IAAI,EAAE,OAAO,KAAK,IAAI,CAAA;IACtC,KAAK,CAAC,EAAE,MAAM,CAAA;IACd,QAAQ,CAAC,EAAE,OAAO,CAAA;CACnB;AAED,MAAM,WAAW,wBAAyB,SAAQ,IAAI,CAAC,oBAAoB,EAAE,OAAO,CAAC;IACnF,QAAQ,CAAC,EAAE,OAAO,CAAA;IAClB,KAAK,CAAC,EAAE,MAAM,CAAA;IACd,QAAQ,CAAC,EAAE,OAAO,CAAA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ropdown-menu-checkbox-item.svelte';
|
|
2
2
|
export { default as Item } from '../dropdown-menu/components/dropdown-menu-item.svelte';
|
|
3
3
|
export { default as Label } from '../dropdown-menu/components/dropdown-menu-label.svelte';
|
|
4
|
+
export { default as RadioGroup } from '../dropdown-menu/components/dropdown-menu-radio-group.svelte';
|
|
5
|
+
export { default as RadioItem } from '../dropdown-menu/components/dropdown-menu-radio-item.svelte';
|
|
4
6
|
export { default as Separator } from '../dropdown-menu/components/dropdown-menu-separator.svelte';
|
|
5
7
|
export { default as SubContent } from '../dropdown-menu/components/dropdown-menu-sub-content.svelte';
|
|
6
8
|
export { default as SubTrigger } from '../dropdown-menu/components/dropdown-menu-sub-trigger.svelte';
|
|
7
9
|
export { default as Sub } from '../dropdown-menu/components/dropdown-menu-sub.svelte';
|
|
8
|
-
export type { DropdownMenuCheckboxItemProps as MenubarCheckboxItemProps, DropdownMenuItemProps as MenubarItemProps, DropdownMenuLabelProps as MenubarLabelProps, DropdownMenuSeparatorProps as MenubarSeparatorProps, DropdownMenuSubContentProps as MenubarSubContentProps, DropdownMenuSubProps as MenubarSubProps, DropdownMenuSubTriggerProps as MenubarSubTriggerProps, } from '../dropdown-menu/types.js';
|
|
10
|
+
export type { DropdownMenuCheckboxItemProps as MenubarCheckboxItemProps, DropdownMenuItemProps as MenubarItemProps, DropdownMenuLabelProps as MenubarLabelProps, DropdownMenuRadioGroupProps as MenubarRadioGroupProps, DropdownMenuRadioItemProps as MenubarRadioItemProps, DropdownMenuSeparatorProps as MenubarSeparatorProps, DropdownMenuSubContentProps as MenubarSubContentProps, DropdownMenuSubProps as MenubarSubProps, DropdownMenuSubTriggerProps as MenubarSubTriggerProps, } from '../dropdown-menu/types.js';
|
|
9
11
|
export { default as Content } from './components/menubar-content.svelte';
|
|
10
12
|
export { default as Menu } from './components/menubar-menu.svelte';
|
|
11
13
|
export { default as Root } from './components/menubar-root.svelte';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/lib/components/menubar/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,OAAO,IAAI,YAAY,EAAE,MAAM,gEAAgE,CAAA;AACxG,OAAO,EAAE,OAAO,IAAI,IAAI,EAAE,MAAM,uDAAuD,CAAA;AACvF,OAAO,EAAE,OAAO,IAAI,KAAK,EAAE,MAAM,wDAAwD,CAAA;AACzF,OAAO,EAAE,OAAO,IAAI,SAAS,EAAE,MAAM,4DAA4D,CAAA;AAEjG,OAAO,EAAE,OAAO,IAAI,UAAU,EAAE,MAAM,8DAA8D,CAAA;AACpG,OAAO,EAAE,OAAO,IAAI,UAAU,EAAE,MAAM,8DAA8D,CAAA;AACpG,OAAO,EAAE,OAAO,IAAI,GAAG,EAAE,MAAM,sDAAsD,CAAA;AAErF,YAAY,EACV,6BAA6B,IAAI,wBAAwB,EACzD,qBAAqB,IAAI,gBAAgB,EACzC,sBAAsB,IAAI,iBAAiB,EAC3C,0BAA0B,IAAI,qBAAqB,EACnD,2BAA2B,IAAI,sBAAsB,EACrD,oBAAoB,IAAI,eAAe,EACvC,2BAA2B,IAAI,sBAAsB,GACtD,MAAM,2BAA2B,CAAA;AAElC,OAAO,EAAE,OAAO,IAAI,OAAO,EAAE,MAAM,qCAAqC,CAAA;AACxE,OAAO,EAAE,OAAO,IAAI,IAAI,EAAE,MAAM,kCAAkC,CAAA;AAClE,OAAO,EAAE,OAAO,IAAI,IAAI,EAAE,MAAM,kCAAkC,CAAA;AAElE,OAAO,EAAE,OAAO,IAAI,OAAO,EAAE,MAAM,qCAAqC,CAAA;AAExE,YAAY,EACV,mBAAmB,EACnB,gBAAgB,EAChB,YAAY,EACZ,mBAAmB,GACpB,MAAM,YAAY,CAAA"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/lib/components/menubar/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,OAAO,IAAI,YAAY,EAAE,MAAM,gEAAgE,CAAA;AACxG,OAAO,EA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{ default as Item } from '../dropdown-menu/components/dropdown-menu-item.svelte';
|
|
4
4
|
export { default as Label } from '../dropdown-menu/components/dropdown-menu-label.svelte';
|
|
5
|
+
export { default as RadioGroup } from '../dropdown-menu/components/dropdown-menu-radio-group.svelte';
|
|
6
|
+
export { default as RadioItem } from '../dropdown-menu/components/dropdown-menu-radio-item.svelte';
|
|
5
7
|
export { default as Separator } from '../dropdown-menu/components/dropdown-menu-separator.svelte';
|
|
6
8
|
export { default as SubContent } from '../dropdown-menu/components/dropdown-menu-sub-content.svelte';
|
|
7
9
|
export { default as SubTrigger } from '../dropdown-menu/components/dropdown-menu-sub-trigger.svelte';
|
package/package.json
CHANGED
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
import { readFileSync } from 'node:fs'
|
|
2
|
+
import { createRequire } from 'node:module'
|
|
3
|
+
import { dirname, resolve } from 'node:path'
|
|
4
|
+
import { fileURLToPath } from 'node:url'
|
|
5
|
+
import { describe, expect, it } from 'vitest'
|
|
6
|
+
import { generateThemeCSS, generateTokensCSS, themes } from '../../../../../scripts/generate-themes'
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
* Durable control between `scripts/generate-themes.ts` and the six committed
|
|
10
|
+
* theme files (+ `tokens.css`): the committed file must be exactly what the
|
|
11
|
+
* generator emits once formatted by the repo's Prettier config. A hand edit
|
|
12
|
+
* of a generated file, or a generator change without regeneration, turns this
|
|
13
|
+
* RED — the two can no longer drift apart silently (spectral-ui#206).
|
|
14
|
+
*
|
|
15
|
+
* Importing the generator must not write anything: `main()` only runs when
|
|
16
|
+
* the script is executed directly.
|
|
17
|
+
*/
|
|
18
|
+
|
|
19
|
+
const here = dirname(fileURLToPath(import.meta.url))
|
|
20
|
+
const themesDir = resolve(here, '..')
|
|
21
|
+
|
|
22
|
+
// Vitest resolves `prettier` with the `browser` condition (standalone build,
|
|
23
|
+
// no `resolveConfig`); the Node build is what the repo's `prettier --write`
|
|
24
|
+
// runs, so load exactly that one.
|
|
25
|
+
const require = createRequire(import.meta.url)
|
|
26
|
+
const prettier = require('prettier') as typeof import('prettier')
|
|
27
|
+
|
|
28
|
+
async function formatted(css: string, filepath: string): Promise<string> {
|
|
29
|
+
const config = (await prettier.resolveConfig(filepath)) ?? {}
|
|
30
|
+
return prettier.format(css, { ...config, filepath })
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
describe('generated theme CSS matches the generator (#206)', () => {
|
|
34
|
+
it('exposes the six themes', () => {
|
|
35
|
+
expect(themes.map((t) => t.name).sort()).toEqual(
|
|
36
|
+
['carbon', 'day', 'docs', 'iris-ocr', 'midnight', 'spectral'].sort(),
|
|
37
|
+
)
|
|
38
|
+
})
|
|
39
|
+
|
|
40
|
+
for (const theme of themes) {
|
|
41
|
+
it(`${theme.name}.css is prettier(generateThemeCSS)`, async () => {
|
|
42
|
+
const filepath = resolve(themesDir, `${theme.name}.css`)
|
|
43
|
+
const committed = readFileSync(filepath, 'utf8')
|
|
44
|
+
expect(committed).toBe(await formatted(generateThemeCSS(theme), filepath))
|
|
45
|
+
})
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
it('tokens.css is prettier(generateTokensCSS)', async () => {
|
|
49
|
+
const filepath = resolve(themesDir, '..', 'tokens.css')
|
|
50
|
+
const committed = readFileSync(filepath, 'utf8')
|
|
51
|
+
expect(committed).toBe(await formatted(generateTokensCSS(), filepath))
|
|
52
|
+
})
|
|
53
|
+
})
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import { readFileSync } from 'node:fs'
|
|
2
|
+
import { dirname, resolve } from 'node:path'
|
|
3
|
+
import { fileURLToPath } from 'node:url'
|
|
4
|
+
import { describe, expect, it } from 'vitest'
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* spectral-ui#206 — `--sp-sys-color-scrim` is an OPAQUE colour in every theme
|
|
8
|
+
* and every mode. The veil's intensity belongs to the component's opacity
|
|
9
|
+
* token (`--sp-comp-*-overlay-opacity`, default 0.32) — never to the token,
|
|
10
|
+
* and never to both at once.
|
|
11
|
+
*
|
|
12
|
+
* This is a SOURCE pin: every `--sp-sys-color-scrim` declaration in the six
|
|
13
|
+
* generated theme files must be the opaque reference tone, and the generator
|
|
14
|
+
* must carry no hand-tuned scrim override that could re-introduce an alpha.
|
|
15
|
+
* The cascade itself (which declaration wins in `.dark`) is proven in a real
|
|
16
|
+
* Chromium by `tests/e2e/scrim-alpha.spec.ts`; jsdom cannot be that oracle.
|
|
17
|
+
*/
|
|
18
|
+
|
|
19
|
+
const here = dirname(fileURLToPath(import.meta.url))
|
|
20
|
+
const THEMES = ['spectral', 'day', 'midnight', 'carbon', 'iris-ocr', 'docs'] as const
|
|
21
|
+
const OPAQUE = 'var(--sp-ref-palette-neutral-0)'
|
|
22
|
+
|
|
23
|
+
describe('--sp-sys-color-scrim is opaque in every theme and mode (#206)', () => {
|
|
24
|
+
for (const theme of THEMES) {
|
|
25
|
+
it(`${theme}.css declares the scrim as the opaque reference tone only`, () => {
|
|
26
|
+
const css = readFileSync(resolve(here, `../${theme}.css`), 'utf8')
|
|
27
|
+
const declarations = [...css.matchAll(/--sp-sys-color-scrim:([^;]+);/g)].map((m) =>
|
|
28
|
+
m[1].trim(),
|
|
29
|
+
)
|
|
30
|
+
// One in the generated light block, one in the generated dark block —
|
|
31
|
+
// nothing else, so no hand-tuned block can shadow them with an alpha.
|
|
32
|
+
// This single equality subsumes "never translucent": ANY other value, in
|
|
33
|
+
// any spelling (`rgba()`, `color-mix()`, `#RRGGBBAA`, `oklch(… / a)`),
|
|
34
|
+
// and any extra or missing declaration, fails here.
|
|
35
|
+
expect(declarations).toEqual([OPAQUE, OPAQUE])
|
|
36
|
+
})
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
it('the generator carries no hand-tuned color-scrim override', () => {
|
|
40
|
+
const generator = readFileSync(
|
|
41
|
+
resolve(here, '../../../../../scripts/generate-themes.ts'),
|
|
42
|
+
'utf8',
|
|
43
|
+
)
|
|
44
|
+
// A hand-tuned override is a `'color-scrim': '<value>'` entry (the
|
|
45
|
+
// `SystemColorTokens` interface field `'color-scrim': string` is not one).
|
|
46
|
+
const overrides = generator.match(/['"]color-scrim['"]\s*:\s*['"]/g) ?? []
|
|
47
|
+
expect(overrides).toEqual([])
|
|
48
|
+
// The two generated declarations (light + dark) still exist and are opaque.
|
|
49
|
+
const emitted = [...generator.matchAll(/--sp-sys-color-scrim:\s*\$\{ref\('neutral', 0\)\};/g)]
|
|
50
|
+
expect(emitted).toHaveLength(2)
|
|
51
|
+
})
|
|
52
|
+
})
|
package/src/themes/carbon.css
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
* Grey charcoal theme (#5c7cfa) for Refero/AutomaticBook.
|
|
4
4
|
*
|
|
5
5
|
* Generated by scripts/generate-themes.ts
|
|
6
|
-
* Do not edit manually — regenerate with:
|
|
6
|
+
* Do not edit manually — regenerate with: pnpm generate:themes
|
|
7
7
|
*/
|
|
8
8
|
|
|
9
9
|
/* ═══ REFERENCE TOKENS ═══ */
|
|
@@ -265,7 +265,6 @@
|
|
|
265
265
|
--sp-sys-color-success: #34c759;
|
|
266
266
|
--sp-sys-color-warning: #ff9f0a;
|
|
267
267
|
--sp-sys-color-error: #ff3b30;
|
|
268
|
-
--sp-sys-color-scrim: rgba(0, 0, 0, 0.3);
|
|
269
268
|
--sp-sys-color-inverse-surface: #2c2c2e;
|
|
270
269
|
--sp-sys-color-inverse-on-surface: #f5f5f7;
|
|
271
270
|
}
|
package/src/themes/day.css
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
* Light macOS-like theme (#f5f5f7), transversal for all apps.
|
|
4
4
|
*
|
|
5
5
|
* Generated by scripts/generate-themes.ts
|
|
6
|
-
* Do not edit manually — regenerate with:
|
|
6
|
+
* Do not edit manually — regenerate with: pnpm generate:themes
|
|
7
7
|
*/
|
|
8
8
|
|
|
9
9
|
/* ═══ REFERENCE TOKENS ═══ */
|
|
@@ -265,7 +265,6 @@
|
|
|
265
265
|
--sp-sys-color-success: #34c759;
|
|
266
266
|
--sp-sys-color-warning: #ff9f0a;
|
|
267
267
|
--sp-sys-color-error: #ff3b30;
|
|
268
|
-
--sp-sys-color-scrim: rgba(0, 0, 0, 0.3);
|
|
269
268
|
--sp-sys-color-inverse-surface: #2c2c2e;
|
|
270
269
|
--sp-sys-color-inverse-on-surface: #f5f5f7;
|
|
271
270
|
}
|
package/src/themes/docs.css
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
* Grey + warm orange theme (#ce9178) for SpectralDocs/Status.
|
|
4
4
|
*
|
|
5
5
|
* Generated by scripts/generate-themes.ts
|
|
6
|
-
* Do not edit manually — regenerate with:
|
|
6
|
+
* Do not edit manually — regenerate with: pnpm generate:themes
|
|
7
7
|
*/
|
|
8
8
|
|
|
9
9
|
/* ═══ REFERENCE TOKENS ═══ */
|
package/src/themes/iris-ocr.css
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
* Hybrid theme for Iris-OCR: day light mode + neon dark mode.
|
|
4
4
|
*
|
|
5
5
|
* Generated by scripts/generate-themes.ts
|
|
6
|
-
* Do not edit manually — regenerate with:
|
|
6
|
+
* Do not edit manually — regenerate with: pnpm generate:themes
|
|
7
7
|
*/
|
|
8
8
|
|
|
9
9
|
/* ═══ REFERENCE TOKENS ═══ */
|
|
@@ -265,7 +265,6 @@
|
|
|
265
265
|
--sp-sys-color-success: #34c759;
|
|
266
266
|
--sp-sys-color-warning: #ff9f0a;
|
|
267
267
|
--sp-sys-color-error: #ff3b30;
|
|
268
|
-
--sp-sys-color-scrim: rgba(0, 0, 0, 0.3);
|
|
269
268
|
--sp-sys-color-inverse-surface: #2c2c2e;
|
|
270
269
|
--sp-sys-color-inverse-on-surface: #f5f5f7;
|
|
271
270
|
|
package/src/themes/midnight.css
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
* Blue-black Catppuccin-inspired theme (#89b4fa) for Translator/Preparo.
|
|
4
4
|
*
|
|
5
5
|
* Generated by scripts/generate-themes.ts
|
|
6
|
-
* Do not edit manually — regenerate with:
|
|
6
|
+
* Do not edit manually — regenerate with: pnpm generate:themes
|
|
7
7
|
*/
|
|
8
8
|
|
|
9
9
|
/* ═══ REFERENCE TOKENS ═══ */
|
|
@@ -265,7 +265,6 @@
|
|
|
265
265
|
--sp-sys-color-success: #34c759;
|
|
266
266
|
--sp-sys-color-warning: #ff9f0a;
|
|
267
267
|
--sp-sys-color-error: #ff3b30;
|
|
268
|
-
--sp-sys-color-scrim: rgba(0, 0, 0, 0.3);
|
|
269
268
|
--sp-sys-color-inverse-surface: #2c2c2e;
|
|
270
269
|
--sp-sys-color-inverse-on-surface: #f5f5f7;
|
|
271
270
|
}
|
package/src/themes/spectral.css
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
* Spectral hybrid theme: day light mode + iris-ocr dark mode.
|
|
4
4
|
*
|
|
5
5
|
* Generated by scripts/generate-themes.ts
|
|
6
|
-
* Do not edit manually — regenerate with:
|
|
6
|
+
* Do not edit manually — regenerate with: pnpm generate:themes
|
|
7
7
|
*/
|
|
8
8
|
|
|
9
9
|
/* ═══ REFERENCE TOKENS ═══ */
|
|
@@ -265,7 +265,6 @@
|
|
|
265
265
|
--sp-sys-color-success: #34c759;
|
|
266
266
|
--sp-sys-color-warning: #ff9f0a;
|
|
267
267
|
--sp-sys-color-error: #ff3b30;
|
|
268
|
-
--sp-sys-color-scrim: rgba(0, 0, 0, 0.3);
|
|
269
268
|
--sp-sys-color-inverse-surface: #2c2c2e;
|
|
270
269
|
--sp-sys-color-inverse-on-surface: #f5f5f7;
|
|
271
270
|
|
|
@@ -307,7 +306,6 @@
|
|
|
307
306
|
--sp-sys-color-success: #69f0ae;
|
|
308
307
|
--sp-sys-color-warning: #ffab40;
|
|
309
308
|
--sp-sys-color-error: #ff5252;
|
|
310
|
-
--sp-sys-color-scrim: rgba(0, 0, 0, 0.6);
|
|
311
309
|
|
|
312
310
|
/* ═══ EXTENSION TOKENS (--sp-ext-*) — Internal, theme-specific ═══ */
|
|
313
311
|
--sp-ext-glow-color: #00ffe0;
|
package/src/tokens.css
CHANGED