@astryxdesign/core 0.7.5-canary.daab0b6 → 0.7.5-canary.dae1747
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/Icon/Icon.d.ts +8 -0
- package/dist/Icon/Icon.d.ts.map +1 -1
- package/dist/Icon/Icon.js +41 -2
- package/dist/Icon/IconSize.stylex.d.ts +16 -11
- package/dist/Icon/IconSize.stylex.d.ts.map +1 -1
- package/dist/Icon/IconSize.stylex.js +27 -11
- package/dist/Icon/globalIconRegistry.d.ts +9 -6
- package/dist/Icon/globalIconRegistry.d.ts.map +1 -1
- package/dist/Icon/globalIconRegistry.js +9 -2
- package/dist/Icon/index.d.ts +24 -1
- package/dist/Icon/index.d.ts.map +1 -1
- package/dist/Icon/index.js +23 -1
- package/dist/astryx.css +12 -0
- package/dist/theme/defineTheme.d.ts +71 -10
- package/dist/theme/defineTheme.d.ts.map +1 -1
- package/dist/theme/defineTheme.js +36 -3
- package/dist/theme/derivedVarRegistry.d.ts.map +1 -1
- package/dist/theme/derivedVarRegistry.js +9 -0
- package/package.json +3 -3
- package/src/Icon/Icon.doc.mjs +41 -3
- package/src/Icon/Icon.test.tsx +120 -8
- package/src/Icon/Icon.tsx +40 -6
- package/src/Icon/IconSize.stylex.ts +27 -11
- package/src/Icon/globalIconRegistry.test.tsx +52 -1
- package/src/Icon/globalIconRegistry.tsx +24 -11
- package/src/Icon/index.ts +26 -1
- package/src/IconButton/IconButton.test.tsx +5 -2
- package/src/List/List.spec.md +2 -2
- package/src/__tests__/unthemedLength.ts +34 -0
- package/src/theme/defineTheme.test.ts +180 -2
- package/src/theme/defineTheme.ts +110 -15
- package/src/theme/derivedVarRegistry.test.ts +15 -0
- package/src/theme/derivedVarRegistry.ts +4 -0
package/dist/Icon/Icon.d.ts
CHANGED
|
@@ -11,6 +11,11 @@
|
|
|
11
11
|
* theme's icon registry (or built-in fallback SVGs) and wrapped in a styled span.
|
|
12
12
|
* A function registry entry receives `{size}`, the size resolved by ORD1.
|
|
13
13
|
*
|
|
14
|
+
* Both modes size the glyph from the `icon` target's private size vars
|
|
15
|
+
* (`iconSizeStyles` in IconSize.stylex.ts, `registrySizeStyles` below), so a
|
|
16
|
+
* theme's `width` and `height` on that target's size selector set the size's
|
|
17
|
+
* glyph dimension, including the font size 1em-based registry artwork follows.
|
|
18
|
+
*
|
|
14
19
|
* SYNC: When modified, update these files to stay in sync:
|
|
15
20
|
* - /packages/core/src/Icon/Icon.doc.mjs (props table, features, implementation notes)
|
|
16
21
|
* - /packages/core/src/Icon/Icon.test.tsx (tests for new/changed behavior)
|
|
@@ -119,6 +124,9 @@ export interface IconProps extends Omit<SVGProps<SVGSVGElement>, 'ref' | 'color'
|
|
|
119
124
|
* - 'md': 1.25rem (20px at a 16px root)
|
|
120
125
|
* - 'lg': 1.5rem (24px at a 16px root)
|
|
121
126
|
*
|
|
127
|
+
* A theme sets a size's glyph dimension with `width` and `height`, in `px`
|
|
128
|
+
* or `rem`, on `components.icon['size:sm']` (and the other sizes).
|
|
129
|
+
*
|
|
122
130
|
* An explicit value wins. When omitted, Icon uses the nearest default supplied
|
|
123
131
|
* by an owning Astryx component for its icon slot, then falls back to 'md'.
|
|
124
132
|
*/
|
package/dist/Icon/Icon.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Icon.d.ts","sourceRoot":"","sources":["../../src/Icon/Icon.tsx"],"names":[],"mappings":"AAIA
|
|
1
|
+
{"version":3,"file":"Icon.d.ts","sourceRoot":"","sources":["../../src/Icon/Icon.tsx"],"names":[],"mappings":"AAIA;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AAEH,OAAO,KAAK,EAAE,EAAC,KAAK,aAAa,EAAE,KAAK,QAAQ,EAAC,MAAM,OAAO,CAAC;AAC/D,OAAO,KAAK,MAAM,MAAM,kBAAkB,CAAC;AAC3C,OAAO,KAAK,EAAC,YAAY,EAAC,MAAM,kBAAkB,CAAC;AAInD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E,KAAK,CAAC,SAAS,GAAG,QAAQ,EAChC,KAAK,CAAC,EAAE;IAAC,IAAI,CAAC,EAAE,QAAQ,CAAC;IAAC,KAAK,CAAC,EAAE,SAAS,CAAA;CAAC,GAC3C,KAAK,CAAC,SAAS,CAYjB"}
|
package/dist/Icon/Icon.js
CHANGED
|
@@ -15,6 +15,11 @@
|
|
|
15
15
|
* theme's icon registry (or built-in fallback SVGs) and wrapped in a styled span.
|
|
16
16
|
* A function registry entry receives `{size}`, the size resolved by ORD1.
|
|
17
17
|
*
|
|
18
|
+
* Both modes size the glyph from the `icon` target's private size vars
|
|
19
|
+
* (`iconSizeStyles` in IconSize.stylex.ts, `registrySizeStyles` below), so a
|
|
20
|
+
* theme's `width` and `height` on that target's size selector set the size's
|
|
21
|
+
* glyph dimension, including the font size 1em-based registry artwork follows.
|
|
22
|
+
*
|
|
18
23
|
* SYNC: When modified, update these files to stay in sync:
|
|
19
24
|
* - /packages/core/src/Icon/Icon.doc.mjs (props table, features, implementation notes)
|
|
20
25
|
* - /packages/core/src/Icon/Icon.test.tsx (tests for new/changed behavior)
|
|
@@ -31,7 +36,7 @@ import { resolveIcon } from "./globalIconRegistry.js";
|
|
|
31
36
|
import { mergeProps } from "../utils/index.js";
|
|
32
37
|
import { themeProps } from "../utils/themeProps.js";
|
|
33
38
|
import { useIconSize } from "./IconDefaultSizeContext.js";
|
|
34
|
-
import {
|
|
39
|
+
import { iconSizeStyles } from "./IconSize.stylex.js";
|
|
35
40
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
36
41
|
// =============================================================================
|
|
37
42
|
// Styles
|
|
@@ -50,6 +55,40 @@ const styles = {
|
|
|
50
55
|
$$css: true
|
|
51
56
|
}
|
|
52
57
|
};
|
|
58
|
+
|
|
59
|
+
/**
|
|
60
|
+
* Size styles for string-based registry icons: the glyph dimensions
|
|
61
|
+
* `iconSizeStyles` reads from the `icon` target's private vars, plus a
|
|
62
|
+
* `fontSize`, because registry artwork is 1em-based. `fontSize` is the smaller
|
|
63
|
+
* side, which fits square artwork into a non-square box the way an SVG viewBox
|
|
64
|
+
* does.
|
|
65
|
+
*/
|
|
66
|
+
const registrySizeStyles = {
|
|
67
|
+
xsm: {
|
|
68
|
+
kzqmXN: "x13u0t82",
|
|
69
|
+
kZKoxP: "x89eeu2",
|
|
70
|
+
kGuDYH: "x1uq1jy3",
|
|
71
|
+
$$css: true
|
|
72
|
+
},
|
|
73
|
+
sm: {
|
|
74
|
+
kzqmXN: "xomy6nw",
|
|
75
|
+
kZKoxP: "x14eyxzr",
|
|
76
|
+
kGuDYH: "x1qzu985",
|
|
77
|
+
$$css: true
|
|
78
|
+
},
|
|
79
|
+
md: {
|
|
80
|
+
kzqmXN: "x1vvatio",
|
|
81
|
+
kZKoxP: "x1jxzzob",
|
|
82
|
+
kGuDYH: "xhhwgqx",
|
|
83
|
+
$$css: true
|
|
84
|
+
},
|
|
85
|
+
lg: {
|
|
86
|
+
kzqmXN: "x1gbskz6",
|
|
87
|
+
kZKoxP: "xol4r8t",
|
|
88
|
+
kGuDYH: "x14nqahd",
|
|
89
|
+
$$css: true
|
|
90
|
+
}
|
|
91
|
+
};
|
|
53
92
|
const colorStyles = {
|
|
54
93
|
primary: {
|
|
55
94
|
kMwMTN: "xtbr613",
|
|
@@ -268,7 +307,7 @@ function IconFromRegistry({
|
|
|
268
307
|
...mergeProps(themeProps('icon', {
|
|
269
308
|
size,
|
|
270
309
|
color
|
|
271
|
-
}), stylex.props(styles.span, colorStyles[color],
|
|
310
|
+
}), stylex.props(styles.span, colorStyles[color], registrySizeStyles[size], xstyle), className ?? undefined, style),
|
|
272
311
|
children: resolvedIcon
|
|
273
312
|
});
|
|
274
313
|
}
|
|
@@ -1,8 +1,13 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* @file IconSize.stylex.ts
|
|
3
|
-
* @input Defines the Icon size scale
|
|
3
|
+
* @input Defines the Icon size scale and reads the `icon` target's private
|
|
4
|
+
* `--_icon-width` / `--_icon-height` vars
|
|
4
5
|
* @output Exports shared Icon size types and StyleX styles
|
|
5
6
|
* @position Internal Icon sizing source; consumed by Icon and icon-slot owners
|
|
7
|
+
*
|
|
8
|
+
* SYNC: When the private vars change, update Icon.tsx (registrySizeStyles),
|
|
9
|
+
* derivedVarRegistry.ts, and the `theming.vars` / `theming.derived` entries in
|
|
10
|
+
* Icon.doc.mjs.
|
|
6
11
|
*/
|
|
7
12
|
import * as stylex from '@stylexjs/stylex';
|
|
8
13
|
/**
|
|
@@ -19,25 +24,25 @@ export type IconSize = keyof typeof iconSizeValues;
|
|
|
19
24
|
/** Size styles for direct SVG icon components. */
|
|
20
25
|
export declare const iconSizeStyles: Readonly<{
|
|
21
26
|
readonly xsm: Readonly<{
|
|
22
|
-
readonly width: stylex.StyleXClassNameFor<"width", "0.75rem">;
|
|
23
|
-
readonly height: stylex.StyleXClassNameFor<"height", "0.75rem">;
|
|
27
|
+
readonly width: stylex.StyleXClassNameFor<"width", "var(--_icon-width, 0.75rem)">;
|
|
28
|
+
readonly height: stylex.StyleXClassNameFor<"height", "var(--_icon-height, 0.75rem)">;
|
|
24
29
|
}>;
|
|
25
30
|
readonly sm: Readonly<{
|
|
26
|
-
readonly width: stylex.StyleXClassNameFor<"width", "1rem">;
|
|
27
|
-
readonly height: stylex.StyleXClassNameFor<"height", "1rem">;
|
|
31
|
+
readonly width: stylex.StyleXClassNameFor<"width", "var(--_icon-width, 1rem)">;
|
|
32
|
+
readonly height: stylex.StyleXClassNameFor<"height", "var(--_icon-height, 1rem)">;
|
|
28
33
|
}>;
|
|
29
34
|
readonly md: Readonly<{
|
|
30
|
-
readonly width: stylex.StyleXClassNameFor<"width", "1.25rem">;
|
|
31
|
-
readonly height: stylex.StyleXClassNameFor<"height", "1.25rem">;
|
|
35
|
+
readonly width: stylex.StyleXClassNameFor<"width", "var(--_icon-width, 1.25rem)">;
|
|
36
|
+
readonly height: stylex.StyleXClassNameFor<"height", "var(--_icon-height, 1.25rem)">;
|
|
32
37
|
}>;
|
|
33
38
|
readonly lg: Readonly<{
|
|
34
|
-
readonly width: stylex.StyleXClassNameFor<"width", "1.5rem">;
|
|
35
|
-
readonly height: stylex.StyleXClassNameFor<"height", "1.5rem">;
|
|
39
|
+
readonly width: stylex.StyleXClassNameFor<"width", "var(--_icon-width, 1.5rem)">;
|
|
40
|
+
readonly height: stylex.StyleXClassNameFor<"height", "var(--_icon-height, 1.5rem)">;
|
|
36
41
|
}>;
|
|
37
42
|
}>;
|
|
38
43
|
/**
|
|
39
|
-
* Size styles for icon boxes
|
|
40
|
-
*
|
|
44
|
+
* Size styles for component-owned icon boxes. `fontSize` keeps 1em-based icons
|
|
45
|
+
* in step with the box.
|
|
41
46
|
*/
|
|
42
47
|
export declare const iconBoxSizeStyles: Readonly<{
|
|
43
48
|
readonly xsm: Readonly<{
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"IconSize.stylex.d.ts","sourceRoot":"","sources":["../../src/Icon/IconSize.stylex.ts"],"names":[],"mappings":"AAEA
|
|
1
|
+
{"version":3,"file":"IconSize.stylex.d.ts","sourceRoot":"","sources":["../../src/Icon/IconSize.stylex.ts"],"names":[],"mappings":"AAEA;;;;;;;;;;GAUG;AAEH,OAAO,KAAK,MAAM,MAAM,kBAAkB,CAAC;AAE3C;;;GAGG;AACH,QAAA,MAAM,cAAc;;;;;CAKV,CAAC;AAEX,MAAM,MAAM,QAAQ,GAAG,MAAM,OAAO,cAAc,CAAC;AAanD,kDAAkD;AAClD,eAAO,MAAM,cAAc;;;;;;;;;;;;;;;;;EAiBzB,CAAC;AAEH;;;GAGG;AACH,eAAO,MAAM,iBAAiB;;;;;;;;;;;;;;;;;;;;;EAqB5B,CAAC"}
|
|
@@ -2,9 +2,14 @@
|
|
|
2
2
|
|
|
3
3
|
/**
|
|
4
4
|
* @file IconSize.stylex.ts
|
|
5
|
-
* @input Defines the Icon size scale
|
|
5
|
+
* @input Defines the Icon size scale and reads the `icon` target's private
|
|
6
|
+
* `--_icon-width` / `--_icon-height` vars
|
|
6
7
|
* @output Exports shared Icon size types and StyleX styles
|
|
7
8
|
* @position Internal Icon sizing source; consumed by Icon and icon-slot owners
|
|
9
|
+
*
|
|
10
|
+
* SYNC: When the private vars change, update Icon.tsx (registrySizeStyles),
|
|
11
|
+
* derivedVarRegistry.ts, and the `theming.vars` / `theming.derived` entries in
|
|
12
|
+
* Icon.doc.mjs.
|
|
8
13
|
*/
|
|
9
14
|
|
|
10
15
|
import * as stylex from '@stylexjs/stylex';
|
|
@@ -19,33 +24,44 @@ const iconSizeValues = {
|
|
|
19
24
|
md: '1.25rem',
|
|
20
25
|
lg: '1.5rem'
|
|
21
26
|
};
|
|
27
|
+
/*
|
|
28
|
+
* Icon's own glyph dimensions (these and the registry size styles in Icon.tsx)
|
|
29
|
+
* read private vars rather than being plain declarations. A theme writes
|
|
30
|
+
* `width`/`height` on the `icon` target's size selector
|
|
31
|
+
* (`components.icon['size:sm']`), and the derived-var registry emits them as
|
|
32
|
+
* `--_icon-width` / `--_icon-height` instead of as competing properties.
|
|
33
|
+
* Nothing else declares the dimensions, so the theme value lands however the
|
|
34
|
+
* consumer layers StyleX; with no theme value, each size falls back to its own
|
|
35
|
+
* rem value.
|
|
36
|
+
*/
|
|
37
|
+
|
|
22
38
|
/** Size styles for direct SVG icon components. */
|
|
23
39
|
export const iconSizeStyles = {
|
|
24
40
|
xsm: {
|
|
25
|
-
kzqmXN: "
|
|
26
|
-
kZKoxP: "
|
|
41
|
+
kzqmXN: "x13u0t82",
|
|
42
|
+
kZKoxP: "x89eeu2",
|
|
27
43
|
$$css: true
|
|
28
44
|
},
|
|
29
45
|
sm: {
|
|
30
|
-
kzqmXN: "
|
|
31
|
-
kZKoxP: "
|
|
46
|
+
kzqmXN: "xomy6nw",
|
|
47
|
+
kZKoxP: "x14eyxzr",
|
|
32
48
|
$$css: true
|
|
33
49
|
},
|
|
34
50
|
md: {
|
|
35
|
-
kzqmXN: "
|
|
36
|
-
kZKoxP: "
|
|
51
|
+
kzqmXN: "x1vvatio",
|
|
52
|
+
kZKoxP: "x1jxzzob",
|
|
37
53
|
$$css: true
|
|
38
54
|
},
|
|
39
55
|
lg: {
|
|
40
|
-
kzqmXN: "
|
|
41
|
-
kZKoxP: "
|
|
56
|
+
kzqmXN: "x1gbskz6",
|
|
57
|
+
kZKoxP: "xol4r8t",
|
|
42
58
|
$$css: true
|
|
43
59
|
}
|
|
44
60
|
};
|
|
45
61
|
|
|
46
62
|
/**
|
|
47
|
-
* Size styles for icon boxes
|
|
48
|
-
*
|
|
63
|
+
* Size styles for component-owned icon boxes. `fontSize` keeps 1em-based icons
|
|
64
|
+
* in step with the box.
|
|
49
65
|
*/
|
|
50
66
|
export const iconBoxSizeStyles = {
|
|
51
67
|
xsm: {
|
|
@@ -18,6 +18,7 @@
|
|
|
18
18
|
*/
|
|
19
19
|
import type { ReactNode } from 'react';
|
|
20
20
|
import type { IconSize } from './IconSize.stylex.js';
|
|
21
|
+
import type { IconVariant } from './index.js';
|
|
21
22
|
import type { DefinedTheme } from '../theme/defineTheme.js';
|
|
22
23
|
/**
|
|
23
24
|
* Semantic icon names used internally by Astryx components.
|
|
@@ -55,13 +56,15 @@ export type ExtendedIconName = IconName | (string & {});
|
|
|
55
56
|
export type IconRegistry = Record<IconName, ReactNode>;
|
|
56
57
|
/**
|
|
57
58
|
* What `Icon` asks a function icon entry for: the final Icon size, resolved
|
|
58
|
-
* explicit `size` → owning component's default → `'md'
|
|
59
|
+
* explicit `size` → owning component's default → `'md'`, and a variant name
|
|
60
|
+
* or `undefined`.
|
|
59
61
|
*
|
|
60
|
-
* `
|
|
62
|
+
* Inside `defineTheme`, `Variant` is the theme's listed `iconVariants`; a
|
|
63
|
+
* process-wide registration receives {@link IconVariant}.
|
|
61
64
|
*/
|
|
62
|
-
export type IconRequest = Readonly<{
|
|
65
|
+
export type IconRequest<Variant extends string = IconVariant> = Readonly<{
|
|
63
66
|
size: IconSize;
|
|
64
|
-
variant?:
|
|
67
|
+
variant?: Variant;
|
|
65
68
|
}>;
|
|
66
69
|
/**
|
|
67
70
|
* A theme or process-wide icon entry: a React node, or a pure synchronous
|
|
@@ -82,14 +85,14 @@ export type IconRequest = Readonly<{
|
|
|
82
85
|
* });
|
|
83
86
|
* ```
|
|
84
87
|
*/
|
|
85
|
-
export type IconEntry = ReactNode | ((request: IconRequest) => ReactNode);
|
|
88
|
+
export type IconEntry<Variant extends string = IconVariant> = ReactNode | ((request: IconRequest<Variant>) => ReactNode);
|
|
86
89
|
export type IconRegistrySource = DefinedTheme | string | null | undefined;
|
|
87
90
|
/**
|
|
88
91
|
* Resolve a key for an Icon request. `Icon` is the caller: it passes the size
|
|
89
92
|
* it resolved. Public reads use {@link getIcon} instead.
|
|
90
93
|
* @internal
|
|
91
94
|
*/
|
|
92
|
-
export declare function resolveIcon(name: ExtendedIconName, source: IconRegistrySource, request: IconRequest): ReactNode;
|
|
95
|
+
export declare function resolveIcon(name: ExtendedIconName, source: IconRegistrySource, request: IconRequest<never>): ReactNode;
|
|
93
96
|
/**
|
|
94
97
|
* Register icons at the module level. Works in both server and client
|
|
95
98
|
* environments. Call once at app initialization (e.g. root layout).
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"globalIconRegistry.d.ts","sourceRoot":"","sources":["../../src/Icon/globalIconRegistry.tsx"],"names":[],"mappings":"AAEA;;;;;;;;;;;;;;;;;GAiBG;AAEH,OAAO,KAAK,EAAC,SAAS,EAAC,MAAM,OAAO,CAAC;AAErC,OAAO,KAAK,EAAC,QAAQ,EAAC,MAAM,mBAAmB,CAAC;AAChD,OAAO,KAAK,EAAC,YAAY,EAAC,MAAM,sBAAsB,CAAC;AAQvD;;;;;GAKG;AAEH,MAAM,MAAM,QAAQ,GAChB,OAAO,GACP,aAAa,GACb,aAAa,GACb,cAAc,GACd,cAAc,GACd,eAAe,GACf,OAAO,GACP,SAAS,GACT,OAAO,GACP,SAAS,GACT,MAAM,GACN,UAAU,GACV,OAAO,GACP,cAAc,GACd,MAAM,GACN,gBAAgB,GAChB,QAAQ,GACR,QAAQ,GACR,SAAS,GACT,WAAW,GACX,cAAc,GACd,QAAQ,GACR,UAAU,GACV,aAAa,GACb,MAAM,GACN,aAAa,GACb,QAAQ,GACR,MAAM,GACN,YAAY,CAAC;AAEjB;;;;;;;;;;;GAWG;AACH,MAAM,MAAM,kBAAkB,GAAG,GAAG,MAAM,IAAI,MAAM,EAAE,CAAC;AAEvD;;;;;;;;GAQG;AACH,MAAM,MAAM,gBAAgB,GAAG,QAAQ,GAAG,CAAC,MAAM,GAAG,EAAE,CAAC,CAAC;AAExD;;GAEG;AACH,MAAM,MAAM,YAAY,GAAG,MAAM,CAAC,QAAQ,EAAE,SAAS,CAAC,CAAC;AAEvD
|
|
1
|
+
{"version":3,"file":"globalIconRegistry.d.ts","sourceRoot":"","sources":["../../src/Icon/globalIconRegistry.tsx"],"names":[],"mappings":"AAEA;;;;;;;;;;;;;;;;;GAiBG;AAEH,OAAO,KAAK,EAAC,SAAS,EAAC,MAAM,OAAO,CAAC;AAErC,OAAO,KAAK,EAAC,QAAQ,EAAC,MAAM,mBAAmB,CAAC;AAChD,OAAO,KAAK,EAAC,WAAW,EAAC,MAAM,SAAS,CAAC;AACzC,OAAO,KAAK,EAAC,YAAY,EAAC,MAAM,sBAAsB,CAAC;AAQvD;;;;;GAKG;AAEH,MAAM,MAAM,QAAQ,GAChB,OAAO,GACP,aAAa,GACb,aAAa,GACb,cAAc,GACd,cAAc,GACd,eAAe,GACf,OAAO,GACP,SAAS,GACT,OAAO,GACP,SAAS,GACT,MAAM,GACN,UAAU,GACV,OAAO,GACP,cAAc,GACd,MAAM,GACN,gBAAgB,GAChB,QAAQ,GACR,QAAQ,GACR,SAAS,GACT,WAAW,GACX,cAAc,GACd,QAAQ,GACR,UAAU,GACV,aAAa,GACb,MAAM,GACN,aAAa,GACb,QAAQ,GACR,MAAM,GACN,YAAY,CAAC;AAEjB;;;;;;;;;;;GAWG;AACH,MAAM,MAAM,kBAAkB,G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AAkB,GAC1B,SAAS,CAEX;AAED;;;;;;;;;;;;;;;;;GAiBG;AACH,wBAAgB,eAAe,CAC7B,IAAI,EAAE,gBAAgB,EACtB,QAAQ,CAAC,EAAE,SAAS,EACpB,MAAM,CAAC,EAAE,kBAAkB,GAC1B,SAAS,CAKX;AAED;;;GAGG;AACH,wBAAgB,UAAU,IAAI,IAAI,CAEjC"}
|
|
@@ -64,9 +64,11 @@ import { warnOnce } from "../utils/devWarning.js";
|
|
|
64
64
|
|
|
65
65
|
/**
|
|
66
66
|
* What `Icon` asks a function icon entry for: the final Icon size, resolved
|
|
67
|
-
* explicit `size` → owning component's default → `'md'
|
|
67
|
+
* explicit `size` → owning component's default → `'md'`, and a variant name
|
|
68
|
+
* or `undefined`.
|
|
68
69
|
*
|
|
69
|
-
* `
|
|
70
|
+
* Inside `defineTheme`, `Variant` is the theme's listed `iconVariants`; a
|
|
71
|
+
* process-wide registration receives {@link IconVariant}.
|
|
70
72
|
*/
|
|
71
73
|
|
|
72
74
|
/**
|
|
@@ -89,6 +91,11 @@ import { warnOnce } from "../utils/devWarning.js";
|
|
|
89
91
|
* ```
|
|
90
92
|
*/
|
|
91
93
|
|
|
94
|
+
/**
|
|
95
|
+
* How resolution holds any entry: an entry typed for some variant names
|
|
96
|
+
* accepts a request with none of them.
|
|
97
|
+
*/
|
|
98
|
+
|
|
92
99
|
/** The request every public, one-argument read uses. */
|
|
93
100
|
const PUBLIC_READ_REQUEST = {
|
|
94
101
|
size: 'md'
|
package/dist/Icon/index.d.ts
CHANGED
|
@@ -2,11 +2,34 @@
|
|
|
2
2
|
* @file index.ts
|
|
3
3
|
* @input Imports Icon component/types, icon registry, and global registration
|
|
4
4
|
* @output Exports Icon, icon registry helpers, registerIcons, getIconRegistry, getIcon,
|
|
5
|
-
*
|
|
5
|
+
* the IconEntry/IconRequest types for theme and registered entries, and the
|
|
6
|
+
* augmentable IconVariantMap with its IconVariant names
|
|
6
7
|
* @position Component entry point; re-exported by /packages/core/src/index.ts
|
|
7
8
|
*
|
|
8
9
|
* SYNC: When modified, update this header and /packages/core/src/Icon/Icon.doc.mjs
|
|
9
10
|
*/
|
|
11
|
+
/**
|
|
12
|
+
* Icon variant names an application uses. Astryx defines none: a theme lists
|
|
13
|
+
* the names it supports in `defineTheme({iconVariants})`, and an application
|
|
14
|
+
* augments this map with the names it requests.
|
|
15
|
+
*
|
|
16
|
+
* A theme icon entry receives a requested variant only when the active theme
|
|
17
|
+
* lists it; any other request renders the entry's normal artwork.
|
|
18
|
+
*
|
|
19
|
+
* @example
|
|
20
|
+
* ```
|
|
21
|
+
* declare module '@astryxdesign/core/Icon' {
|
|
22
|
+
* interface IconVariantMap {
|
|
23
|
+
* outline: true;
|
|
24
|
+
* filled: true;
|
|
25
|
+
* }
|
|
26
|
+
* }
|
|
27
|
+
* ```
|
|
28
|
+
*/
|
|
29
|
+
export interface IconVariantMap {
|
|
30
|
+
}
|
|
31
|
+
/** A variant name from the augmentable {@link IconVariantMap}. */
|
|
32
|
+
export type IconVariant = keyof IconVariantMap & string;
|
|
10
33
|
export { Icon, renderIconSlot } from './Icon.js';
|
|
11
34
|
export { useIcon } from './useIcon.js';
|
|
12
35
|
export type { IconProps, IconColor, IconSize, IconType } from './Icon.js';
|
package/dist/Icon/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/Icon/index.ts"],"names":[],"mappings":"AAIA
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/Icon/index.ts"],"names":[],"mappings":"AAIA;;;;;;;;;GASG;AAEH;;;;;;;;;;;;;;;;;GAiBG;AAEH,MAAM,WAAW,cAAc;CAAG;AAElC,kEAAkE;AAClE,MAAM,MAAM,WAAW,GAAG,MAAM,cAAc,GAAG,MAAM,CAAC;AAExD,OAAO,EAAC,IAAI,EAAE,cAAc,EAAC,MAAM,QAAQ,CAAC;AAC5C,OAAO,EAAC,OAAO,EAAC,MAAM,WAAW,CAAC;AAClC,YAAY,EAAC,SAAS,EAAE,SAAS,EAAE,QAAQ,EAAE,QAAQ,EAAC,MAAM,QAAQ,CAAC;AAGrE,OAAO,EACL,aAAa,EACb,eAAe,EACf,OAAO,EACP,eAAe,EACf,UAAU,GACX,MAAM,sBAAsB,CAAC;AAC9B,YAAY,EACV,QAAQ,EACR,gBAAgB,EAChB,kBAAkB,EAClB,YAAY,EACZ,kBAAkB,EAClB,SAAS,EACT,WAAW,GACZ,MAAM,sBAAsB,CAAC"}
|
package/dist/Icon/index.js
CHANGED
|
@@ -6,11 +6,33 @@
|
|
|
6
6
|
* @file index.ts
|
|
7
7
|
* @input Imports Icon component/types, icon registry, and global registration
|
|
8
8
|
* @output Exports Icon, icon registry helpers, registerIcons, getIconRegistry, getIcon,
|
|
9
|
-
*
|
|
9
|
+
* the IconEntry/IconRequest types for theme and registered entries, and the
|
|
10
|
+
* augmentable IconVariantMap with its IconVariant names
|
|
10
11
|
* @position Component entry point; re-exported by /packages/core/src/index.ts
|
|
11
12
|
*
|
|
12
13
|
* SYNC: When modified, update this header and /packages/core/src/Icon/Icon.doc.mjs
|
|
13
14
|
*/
|
|
15
|
+
|
|
16
|
+
/**
|
|
17
|
+
* Icon variant names an application uses. Astryx defines none: a theme lists
|
|
18
|
+
* the names it supports in `defineTheme({iconVariants})`, and an application
|
|
19
|
+
* augments this map with the names it requests.
|
|
20
|
+
*
|
|
21
|
+
* A theme icon entry receives a requested variant only when the active theme
|
|
22
|
+
* lists it; any other request renders the entry's normal artwork.
|
|
23
|
+
*
|
|
24
|
+
* @example
|
|
25
|
+
* ```
|
|
26
|
+
* declare module '@astryxdesign/core/Icon' {
|
|
27
|
+
* interface IconVariantMap {
|
|
28
|
+
* outline: true;
|
|
29
|
+
* filled: true;
|
|
30
|
+
* }
|
|
31
|
+
* }
|
|
32
|
+
* ```
|
|
33
|
+
*/
|
|
34
|
+
// eslint-disable-next-line @typescript-eslint/no-empty-object-type -- augmentation point
|
|
35
|
+
/** A variant name from the augmentable {@link IconVariantMap}. */
|
|
14
36
|
export { Icon, renderIconSlot } from "./Icon.js";
|
|
15
37
|
export { useIcon } from "./useIcon.js";
|
|
16
38
|
// Global registry (RSC-compatible, no 'use client')
|
package/dist/astryx.css
CHANGED
|
@@ -1010,6 +1010,10 @@
|
|
|
1010
1010
|
.xif65rj:not(#\#):not(#\#):not(#\#){font-size:14px}
|
|
1011
1011
|
.x1jchvi3:not(#\#):not(#\#):not(#\#){font-size:1rem}
|
|
1012
1012
|
.x1qlqyl8:not(#\#):not(#\#):not(#\#){font-size:inherit}
|
|
1013
|
+
.x1uq1jy3:not(#\#):not(#\#):not(#\#){font-size:min(var(--_icon-width,.75rem),var(--_icon-height,.75rem))}
|
|
1014
|
+
.xhhwgqx:not(#\#):not(#\#):not(#\#){font-size:min(var(--_icon-width,1.25rem),var(--_icon-height,1.25rem))}
|
|
1015
|
+
.x14nqahd:not(#\#):not(#\#):not(#\#){font-size:min(var(--_icon-width,1.5rem),var(--_icon-height,1.5rem))}
|
|
1016
|
+
.x1qzu985:not(#\#):not(#\#):not(#\#){font-size:min(var(--_icon-width,1rem),var(--_icon-height,1rem))}
|
|
1013
1017
|
.xhs0kqb:not(#\#):not(#\#):not(#\#){font-size:var(--font-size-2xl)}
|
|
1014
1018
|
.x16a80zy:not(#\#):not(#\#):not(#\#){font-size:var(--font-size-2xs)}
|
|
1015
1019
|
.x10srzze:not(#\#):not(#\#):not(#\#){font-size:var(--font-size-3xl)}
|
|
@@ -1803,6 +1807,10 @@
|
|
|
1803
1807
|
.xw1wawg:not(#\#):not(#\#):not(#\#):not(#\#){height:calc(44px - 8px)}
|
|
1804
1808
|
.xg7h5cd:not(#\#):not(#\#):not(#\#):not(#\#){height:fit-content}
|
|
1805
1809
|
.xsbjeu0:not(#\#):not(#\#):not(#\#):not(#\#){height:min(var(--spacing-6),40px)}
|
|
1810
|
+
.x89eeu2:not(#\#):not(#\#):not(#\#):not(#\#){height:var(--_icon-height,.75rem)}
|
|
1811
|
+
.x1jxzzob:not(#\#):not(#\#):not(#\#):not(#\#){height:var(--_icon-height,1.25rem)}
|
|
1812
|
+
.xol4r8t:not(#\#):not(#\#):not(#\#):not(#\#){height:var(--_icon-height,1.5rem)}
|
|
1813
|
+
.x14eyxzr:not(#\#):not(#\#):not(#\#):not(#\#){height:var(--_icon-height,1rem)}
|
|
1806
1814
|
.xhovv34:not(#\#):not(#\#):not(#\#):not(#\#){height:var(--_progressbar-mark-height,8px)}
|
|
1807
1815
|
.x7yyq19:not(#\#):not(#\#):not(#\#):not(#\#){height:var(--_spinner-box-size)}
|
|
1808
1816
|
.xsyqizj:not(#\#):not(#\#):not(#\#):not(#\#){height:var(--border-width)}
|
|
@@ -2069,6 +2077,10 @@
|
|
|
2069
2077
|
.x1qwjaml:not(#\#):not(#\#):not(#\#):not(#\#){width:max(0px,calc(-1 * calc(var(--_item-swipe-travel,0px) * var(--_item-swipe-dir,1))))}
|
|
2070
2078
|
.x96shys:not(#\#):not(#\#):not(#\#):not(#\#){width:max(0px,calc(var(--_item-swipe-travel,0px) * var(--_item-swipe-dir,1)))}
|
|
2071
2079
|
.x17cz0of:not(#\#):not(#\#):not(#\#):not(#\#){width:min(var(--spacing-6),40px)}
|
|
2080
|
+
.x13u0t82:not(#\#):not(#\#):not(#\#):not(#\#){width:var(--_icon-width,.75rem)}
|
|
2081
|
+
.x1vvatio:not(#\#):not(#\#):not(#\#):not(#\#){width:var(--_icon-width,1.25rem)}
|
|
2082
|
+
.x1gbskz6:not(#\#):not(#\#):not(#\#):not(#\#){width:var(--_icon-width,1.5rem)}
|
|
2083
|
+
.xomy6nw:not(#\#):not(#\#):not(#\#):not(#\#){width:var(--_icon-width,1rem)}
|
|
2072
2084
|
.x63cpjl:not(#\#):not(#\#):not(#\#):not(#\#){width:var(--_progressbar-mark-width,2px)}
|
|
2073
2085
|
.x6v0vjy:not(#\#):not(#\#):not(#\#):not(#\#){width:var(--_spinner-box-size)}
|
|
2074
2086
|
.xjk4fl7:not(#\#):not(#\#):not(#\#):not(#\#){width:var(--border-width)}
|
|
@@ -41,9 +41,29 @@ import type { IconEntry, IconName, NamespacedIconName } from '../Icon/globalIcon
|
|
|
41
41
|
/**
|
|
42
42
|
* Icon overrides a theme may declare: any built-in semantic name, plus the
|
|
43
43
|
* namespaced keys components and libraries own (`'richtext:bold'`). Each entry
|
|
44
|
-
* is a React node or a pure synchronous function of `{size, variant}
|
|
44
|
+
* is a React node or a pure synchronous function of `{size, variant}`, where
|
|
45
|
+
* `variant` is one of `Variant` or `undefined`.
|
|
45
46
|
*/
|
|
46
|
-
type ThemeIconEntries = Partial<Record<IconName | NamespacedIconName, IconEntry
|
|
47
|
+
type ThemeIconEntries<Variant extends string> = Partial<Record<IconName | NamespacedIconName, IconEntry<Variant>>>;
|
|
48
|
+
/**
|
|
49
|
+
* The variant names a base theme lists: exact for a theme from `defineTheme`,
|
|
50
|
+
* any string for another `DefinedTheme`, none without a base.
|
|
51
|
+
*/
|
|
52
|
+
type BaseThemeIconVariant<Base> = Base extends DefinedTheme ? '__iconVariant' extends keyof Base ? Base extends {
|
|
53
|
+
name: string;
|
|
54
|
+
__iconVariant?(variant: infer Variant): void;
|
|
55
|
+
} ? Extract<Variant, string> : string : string : never;
|
|
56
|
+
/**
|
|
57
|
+
* The variant names a theme lists: its own `iconVariants` when it sets the
|
|
58
|
+
* field, otherwise the list it inherits from `extends`.
|
|
59
|
+
*/
|
|
60
|
+
type ThemeIconVariant<IconVariants extends ReadonlyArray<string> | undefined, Base> = [IconVariants] extends [ReadonlyArray<infer Variant extends string>] ? Variant : BaseThemeIconVariant<Base>;
|
|
61
|
+
/**
|
|
62
|
+
* The same names, as a type `defineTheme` does not infer from: only
|
|
63
|
+
* `iconVariants` and `extends` decide a theme's names, never the parameter
|
|
64
|
+
* types of its icon entry functions.
|
|
65
|
+
*/
|
|
66
|
+
type ThemeIconEntryVariant<IconVariants extends ReadonlyArray<string> | undefined, Base> = [ThemeIconVariant<IconVariants, Base>][IconVariants extends unknown ? 0 : never];
|
|
47
67
|
/** The node-valued view of a theme's icons that public reads return. */
|
|
48
68
|
type ThemeIconOverrides = Partial<Record<IconName | NamespacedIconName, ReactNode>>;
|
|
49
69
|
import type { IndicatorRegistry } from '../Indicator/types.js';
|
|
@@ -125,8 +145,14 @@ export type StyleOverrides = Record<string, string | Record<string, string>>;
|
|
|
125
145
|
* ```
|
|
126
146
|
*/
|
|
127
147
|
export type ComponentStyleMap = Record<string, Record<string, StyleOverrides>>;
|
|
128
|
-
/**
|
|
129
|
-
|
|
148
|
+
/**
|
|
149
|
+
* Input to defineTheme.
|
|
150
|
+
*
|
|
151
|
+
* `IconVariants` is the theme's own `iconVariants` list and `Base` its
|
|
152
|
+
* `extends` theme; together they type the `variant` an icon entry function
|
|
153
|
+
* receives. `defineTheme` infers both.
|
|
154
|
+
*/
|
|
155
|
+
export interface DefineThemeInput<IconVariants extends ReadonlyArray<string> | undefined = ReadonlyArray<string> | undefined, Base extends DefinedTheme | undefined = DefinedTheme | undefined> {
|
|
130
156
|
/** Theme name — used for data-astryx-theme attribute and identification */
|
|
131
157
|
name: string;
|
|
132
158
|
/**
|
|
@@ -154,7 +180,7 @@ export interface DefineThemeInput {
|
|
|
154
180
|
* });
|
|
155
181
|
* ```
|
|
156
182
|
*/
|
|
157
|
-
extends?:
|
|
183
|
+
extends?: Base;
|
|
158
184
|
/**
|
|
159
185
|
* Unified typography configuration — fonts, scale, and weights.
|
|
160
186
|
*
|
|
@@ -298,8 +324,27 @@ export interface DefineThemeInput {
|
|
|
298
324
|
* info: ({size}) => <InfoIcon weight={size === 'sm' ? 'bold' : 'regular'} />,
|
|
299
325
|
* }
|
|
300
326
|
* ```
|
|
327
|
+
*
|
|
328
|
+
* `variant` is typed as the names in `iconVariants` (or the inherited list).
|
|
329
|
+
*/
|
|
330
|
+
icons?: ThemeIconEntries<ThemeIconEntryVariant<IconVariants, Base>>;
|
|
331
|
+
/**
|
|
332
|
+
* The icon variant names this theme supports, listed once for the whole
|
|
333
|
+
* theme — never per icon. Icon entry functions receive `variant` typed as
|
|
334
|
+
* these names.
|
|
335
|
+
*
|
|
336
|
+
* A theme that sets `iconVariants` replaces the list it would inherit from
|
|
337
|
+
* `extends`; a theme that omits it inherits the base's list.
|
|
338
|
+
*
|
|
339
|
+
* @example
|
|
340
|
+
* ```
|
|
341
|
+
* iconVariants: ['outline', 'filled'],
|
|
342
|
+
* icons: {
|
|
343
|
+
* info: ({variant}) => (variant === 'filled' ? <InfoFilled /> : <InfoOutline />),
|
|
344
|
+
* },
|
|
345
|
+
* ```
|
|
301
346
|
*/
|
|
302
|
-
|
|
347
|
+
iconVariants?: IconVariants;
|
|
303
348
|
/**
|
|
304
349
|
* Indicator overrides — replaces the components that draw stateful control
|
|
305
350
|
* visuals with the theme's own, by name.
|
|
@@ -398,7 +443,12 @@ export interface DefinedTheme {
|
|
|
398
443
|
* Only Astryx icon resolution reads it.
|
|
399
444
|
* @internal
|
|
400
445
|
*/
|
|
401
|
-
__icons?: ThemeIconEntries
|
|
446
|
+
__icons?: ThemeIconEntries<never>;
|
|
447
|
+
/**
|
|
448
|
+
* The icon variant names this theme supports: its own `iconVariants`, or
|
|
449
|
+
* the list it inherited. Absent when no theme in its lineage lists any.
|
|
450
|
+
*/
|
|
451
|
+
iconVariants?: ReadonlyArray<string>;
|
|
402
452
|
/** Indicator overrides for stateful control visuals, keyed by name */
|
|
403
453
|
indicators?: IndicatorRegistry;
|
|
404
454
|
/** Whether this theme has been pre-compiled by theme build CLI */
|
|
@@ -437,10 +487,21 @@ export interface DefinedTheme {
|
|
|
437
487
|
/** Effective root generative-axis metadata used to resolve child rules. @internal */
|
|
438
488
|
__axes?: ThemeGenerativeAxes;
|
|
439
489
|
}
|
|
440
|
-
/**
|
|
441
|
-
|
|
490
|
+
/**
|
|
491
|
+
* A theme produced by the current defineTheme implementation. `IconVariant`
|
|
492
|
+
* is the names in its `iconVariants` list.
|
|
493
|
+
*/
|
|
494
|
+
export type ResolvedDefinedTheme<IconVariant extends string = string> = DefinedTheme & {
|
|
442
495
|
__adaptations: NormalizedThemeAdaptations;
|
|
443
496
|
__axes: ThemeGenerativeAxes;
|
|
497
|
+
/**
|
|
498
|
+
* Type-only: the names in `iconVariants`, so a theme that `extends` this
|
|
499
|
+
* one types its icon entries by the list it inherits. Never set. Method
|
|
500
|
+
* syntax keeps resolved themes with different lists assignable to each
|
|
501
|
+
* other, as they were before the list existed.
|
|
502
|
+
* @internal
|
|
503
|
+
*/
|
|
504
|
+
__iconVariant?(variant: IconVariant): void;
|
|
444
505
|
};
|
|
445
506
|
/** All Astryx token defaults as a flat map. Useful for resolving full token sets. */
|
|
446
507
|
export declare const tokenDefaults: Record<string, string>;
|
|
@@ -454,7 +515,7 @@ export declare const tokenDefaults: Record<string, string>;
|
|
|
454
515
|
* that are merged into the token map. Explicit `tokens` entries take
|
|
455
516
|
* precedence over generated values.
|
|
456
517
|
*/
|
|
457
|
-
export declare function defineTheme(input: DefineThemeInput): ResolvedDefinedTheme
|
|
518
|
+
export declare function defineTheme<const IconVariants extends ReadonlyArray<string> | undefined = undefined, Base extends DefinedTheme | undefined = undefined>(input: DefineThemeInput<IconVariants, Base>): ResolvedDefinedTheme<ThemeIconVariant<IconVariants, Base>>;
|
|
458
519
|
export { generateThemeRules, generateThemeRulesSplit, generateOnMediaCSS, generateAdaptationCSS, generateThemeCSS, type ThemeRulesSplit, type ThemeCSSOutput, } from './generateThemeRules.js';
|
|
459
520
|
/** Check if a theme object was created with defineTheme */
|
|
460
521
|
export declare function isDefinedTheme(theme: unknown): theme is DefinedTheme;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"defineTheme.d.ts","sourceRoot":"","sources":["../../src/theme/defineTheme.ts"],"names":[],"mappings":"AAEA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAqCG;AAEH,OAAO,KAAK,EAAC,SAAS,EAAC,MAAM,OAAO,CAAC;AACrC,OAAO,KAAK,E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