@astryxdesign/core 0.7.5-canary.dae1747 → 0.7.5-canary.dc5a8cf
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 +23 -3
- package/dist/Icon/Icon.d.ts.map +1 -1
- package/dist/Icon/Icon.js +13 -5
- package/dist/Icon/globalIconRegistry.d.ts +6 -3
- package/dist/Icon/globalIconRegistry.d.ts.map +1 -1
- package/dist/Icon/globalIconRegistry.js +65 -9
- package/dist/motion/animatedLayout.d.ts +75 -0
- package/dist/motion/animatedLayout.d.ts.map +1 -1
- package/dist/motion/animatedLayout.js +529 -38
- package/dist/motion/transientCopy.d.ts +33 -0
- package/dist/motion/transientCopy.d.ts.map +1 -0
- package/dist/motion/transientCopy.js +314 -0
- package/dist/theme/defineTheme.d.ts +7 -0
- package/dist/theme/defineTheme.d.ts.map +1 -1
- package/dist/theme/defineTheme.js +31 -0
- package/package.json +3 -3
- package/src/ClickableCard/ClickableCard.spec.md +124 -128
- package/src/Icon/Icon.doc.mjs +14 -0
- package/src/Icon/Icon.test.tsx +282 -0
- package/src/Icon/Icon.tsx +31 -5
- package/src/Icon/globalIconRegistry.test.tsx +69 -0
- package/src/Icon/globalIconRegistry.tsx +65 -18
- package/src/RadioList/RadioList.spec.md +227 -0
- package/src/RadioList/RadioListItem.spec.md +223 -0
- package/src/SelectableCard/SelectableCard.spec.md +230 -0
- package/src/Tooltip/Tooltip.spec.md +161 -36
- package/src/motion/__tests__/animatedLayout.interaction.browser.spec.ts +533 -0
- package/src/motion/animatedLayout.boundary.test.ts +29 -10
- package/src/motion/animatedLayout.swap.test.ts +827 -0
- package/src/motion/animatedLayout.test.ts +303 -2
- package/src/motion/animatedLayout.ts +655 -39
- package/src/motion/transientCopy.ts +374 -0
- package/src/theme/defineTheme.ts +54 -0
- package/src/theme/extensibleAxes.test.ts +74 -29
package/dist/Icon/Icon.d.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* @file Icon.tsx
|
|
3
|
-
* @input Uses ReactSVGProps, icon components or semantic icon names
|
|
3
|
+
* @input Uses ReactSVGProps, icon components or semantic icon names, and an
|
|
4
|
+
* optional IconVariant request
|
|
4
5
|
* @output Exports Icon component, IconProps, IconColor, IconSize, IconType types
|
|
5
6
|
* @position Core implementation; consumed by index.ts, tested by Icon.test.tsx
|
|
6
7
|
*
|
|
@@ -9,7 +10,8 @@
|
|
|
9
10
|
* directly with and spread SVG props.
|
|
10
11
|
* - String mode: Pass a semantic name (e.g. 'close', 'chevronDown') — resolved from the
|
|
11
12
|
* theme's icon registry (or built-in fallback SVGs) and wrapped in a styled span.
|
|
12
|
-
* A function registry entry receives `{size}
|
|
13
|
+
* A function registry entry receives `{size, variant}`: the size resolved by
|
|
14
|
+
* ORD1 and the requested variant when the entry can receive it.
|
|
13
15
|
*
|
|
14
16
|
* Both modes size the glyph from the `icon` target's private size vars
|
|
15
17
|
* (`iconSizeStyles` in IconSize.stylex.ts, `registrySizeStyles` below), so a
|
|
@@ -27,6 +29,7 @@ import React, { type ComponentType, type SVGProps } from 'react';
|
|
|
27
29
|
import * as stylex from '@stylexjs/stylex';
|
|
28
30
|
import type { StyleXStyles } from '@stylexjs/stylex';
|
|
29
31
|
import type { IconName, NamespacedIconName } from './globalIconRegistry.js';
|
|
32
|
+
import type { IconVariant } from './index.js';
|
|
30
33
|
import { type IconSize } from './IconSize.stylex.js';
|
|
31
34
|
export type { IconSize } from './IconSize.stylex.js';
|
|
32
35
|
declare const colorStyles: Readonly<{
|
|
@@ -131,6 +134,23 @@ export interface IconProps extends Omit<SVGProps<SVGSVGElement>, 'ref' | 'color'
|
|
|
131
134
|
* by an owning Astryx component for its icon slot, then falls back to 'md'.
|
|
132
135
|
*/
|
|
133
136
|
size?: IconSize;
|
|
137
|
+
/**
|
|
138
|
+
* Requests the active theme's alternate artwork for a semantic icon name,
|
|
139
|
+
* such as `'filled'`. Names come from the augmentable `IconVariantMap`.
|
|
140
|
+
*
|
|
141
|
+
* The theme's icon entry receives the variant only when the active theme
|
|
142
|
+
* lists it in `iconVariants` and, for an entry a theme supplied, the theme
|
|
143
|
+
* that defined the entry lists it too. Otherwise the entry receives
|
|
144
|
+
* `undefined` and draws its normal artwork. An icon component passed
|
|
145
|
+
* directly renders as given and never receives `variant`, and `variant` is
|
|
146
|
+
* never written to the DOM or reflected on the `icon` theming target.
|
|
147
|
+
*
|
|
148
|
+
* @example
|
|
149
|
+
* ```
|
|
150
|
+
* <Icon icon="info" variant="filled" />
|
|
151
|
+
* ```
|
|
152
|
+
*/
|
|
153
|
+
variant?: IconVariant;
|
|
134
154
|
/**
|
|
135
155
|
* Accessible name for the icon. Set this only when the icon is MEANINGFUL on
|
|
136
156
|
* its own — a standalone status glyph or an icon-only indicator with no
|
|
@@ -183,7 +203,7 @@ export interface IconProps extends Omit<SVGProps<SVGSVGElement>, 'ref' | 'color'
|
|
|
183
203
|
* <Icon icon="close" size="md" color="primary" />
|
|
184
204
|
* ```
|
|
185
205
|
*/
|
|
186
|
-
export declare function Icon({ icon, color, size: sizeProp, label, ref, className, style, xstyle, ...props }: IconProps): React.JSX.Element;
|
|
206
|
+
export declare function Icon({ icon, color, size: sizeProp, variant, label, ref, className, style, xstyle, ...props }: IconProps): React.JSX.Element;
|
|
187
207
|
export declare namespace Icon {
|
|
188
208
|
var displayName: string;
|
|
189
209
|
}
|
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;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG;AAEH,OAAO,KAAK,EAAE,EAAC,KAAK,aAAa,EAAE,KAAK,QAAQ,EAAC,MAAM,OAAO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B,IAAI,CAAC,EACnB,IAAI,EACJ,KAAiB,EACjB,IAAI,EAAE,QAAQ,EACd,OAAO,EACP,KAAK,EACL,GAAG,EACH,SAAS,EACT,KAAK,EACL,MAAM,EACN,GAAG,KAAK,EACT,EAAE,SAAS,qBAoDX;yBA/De,IAAI;;;AA2IpB;;;;;;GAMG;AACH,wBAAgB,cAAc,CAC5B,IAAI,EAAE,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
|
@@ -4,7 +4,8 @@
|
|
|
4
4
|
|
|
5
5
|
/**
|
|
6
6
|
* @file Icon.tsx
|
|
7
|
-
* @input Uses ReactSVGProps, icon components or semantic icon names
|
|
7
|
+
* @input Uses ReactSVGProps, icon components or semantic icon names, and an
|
|
8
|
+
* optional IconVariant request
|
|
8
9
|
* @output Exports Icon component, IconProps, IconColor, IconSize, IconType types
|
|
9
10
|
* @position Core implementation; consumed by index.ts, tested by Icon.test.tsx
|
|
10
11
|
*
|
|
@@ -13,7 +14,8 @@
|
|
|
13
14
|
* directly with and spread SVG props.
|
|
14
15
|
* - String mode: Pass a semantic name (e.g. 'close', 'chevronDown') — resolved from the
|
|
15
16
|
* theme's icon registry (or built-in fallback SVGs) and wrapped in a styled span.
|
|
16
|
-
* A function registry entry receives `{size}
|
|
17
|
+
* A function registry entry receives `{size, variant}`: the size resolved by
|
|
18
|
+
* ORD1 and the requested variant when the entry can receive it.
|
|
17
19
|
*
|
|
18
20
|
* Both modes size the glyph from the `icon` target's private size vars
|
|
19
21
|
* (`iconSizeStyles` in IconSize.stylex.ts, `registrySizeStyles` below), so a
|
|
@@ -222,6 +224,7 @@ export function Icon({
|
|
|
222
224
|
icon,
|
|
223
225
|
color = 'inherit',
|
|
224
226
|
size: sizeProp,
|
|
227
|
+
variant,
|
|
225
228
|
label,
|
|
226
229
|
ref,
|
|
227
230
|
className,
|
|
@@ -240,6 +243,7 @@ export function Icon({
|
|
|
240
243
|
name: icon,
|
|
241
244
|
color: color,
|
|
242
245
|
size: size,
|
|
246
|
+
variant: variant,
|
|
243
247
|
a11yProps: a11yProps,
|
|
244
248
|
className: className,
|
|
245
249
|
style: style,
|
|
@@ -248,7 +252,8 @@ export function Icon({
|
|
|
248
252
|
});
|
|
249
253
|
}
|
|
250
254
|
|
|
251
|
-
// Component mode: render SVG component directly with ref forwarding
|
|
255
|
+
// Component mode: render SVG component directly with ref forwarding. A
|
|
256
|
+
// supplied component never receives `variant`; it was destructured above.
|
|
252
257
|
const IconComponent = icon;
|
|
253
258
|
return /*#__PURE__*/_jsx(IconComponent, {
|
|
254
259
|
ref: ref
|
|
@@ -275,12 +280,14 @@ Icon.displayName = 'Icon';
|
|
|
275
280
|
* and renders it in a styled span with proper sizing.
|
|
276
281
|
*
|
|
277
282
|
* Extracted as a separate component so the registry is only read when the
|
|
278
|
-
* icon prop is a string. A function entry receives the resolved size
|
|
283
|
+
* icon prop is a string. A function entry receives the resolved size and the
|
|
284
|
+
* requested variant when the entry can receive it.
|
|
279
285
|
*/
|
|
280
286
|
function IconFromRegistry({
|
|
281
287
|
name,
|
|
282
288
|
color,
|
|
283
289
|
size,
|
|
290
|
+
variant,
|
|
284
291
|
a11yProps,
|
|
285
292
|
className,
|
|
286
293
|
style,
|
|
@@ -289,7 +296,8 @@ function IconFromRegistry({
|
|
|
289
296
|
}) {
|
|
290
297
|
const themeName = useThemeName();
|
|
291
298
|
const resolvedIcon = resolveIcon(name, themeName, {
|
|
292
|
-
size
|
|
299
|
+
size,
|
|
300
|
+
variant
|
|
293
301
|
});
|
|
294
302
|
if (resolvedIcon == null) {
|
|
295
303
|
return null;
|
|
@@ -14,7 +14,9 @@
|
|
|
14
14
|
* {@link IconRequest}. Resolution picks one source — theme entry, then
|
|
15
15
|
* process-wide registration, then built-in default; a nullish static entry
|
|
16
16
|
* falls through — and a selected function's result is final. `Icon` passes
|
|
17
|
-
* its resolved size
|
|
17
|
+
* its resolved size and a variant the entry can receive (listed by the active
|
|
18
|
+
* theme and, for a theme entry, by the theme that defined it), otherwise
|
|
19
|
+
* `undefined`; the public reads below pass `{size: 'md'}`.
|
|
18
20
|
*/
|
|
19
21
|
import type { ReactNode } from 'react';
|
|
20
22
|
import type { IconSize } from './IconSize.stylex.js';
|
|
@@ -89,10 +91,11 @@ export type IconEntry<Variant extends string = IconVariant> = ReactNode | ((requ
|
|
|
89
91
|
export type IconRegistrySource = DefinedTheme | string | null | undefined;
|
|
90
92
|
/**
|
|
91
93
|
* Resolve a key for an Icon request. `Icon` is the caller: it passes the size
|
|
92
|
-
* it resolved. Public reads use
|
|
94
|
+
* it resolved and the variant it was asked for. Public reads use
|
|
95
|
+
* {@link getIcon} instead.
|
|
93
96
|
* @internal
|
|
94
97
|
*/
|
|
95
|
-
export declare function resolveIcon(name: ExtendedIconName, source: IconRegistrySource, request: IconRequest<
|
|
98
|
+
export declare function resolveIcon(name: ExtendedIconName, source: IconRegistrySource, request: IconRequest<string>): ReactNode;
|
|
96
99
|
/**
|
|
97
100
|
* Register icons at the module level. Works in both server and client
|
|
98
101
|
* 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
|
|
1
|
+
{"version":3,"file":"globalIconRegistry.d.ts","sourceRoot":"","sources":["../../src/Icon/globalIconRegistry.tsx"],"names":[],"mappings":"AAEA;;;;;;;;;;;;;;;;;;;GAmBG;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;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AM,EAAE,kBAAkB,EAC1B,OAAO,EAAE,WAAW,CAAC,MAAM,CAAC,GAC3B,SAAS,CAEX;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6BG;AACH,wBAAgB,aAAa,CAC3B,KAAK,EAAE,OAAO,CAAC,MAAM,CAAC,gBAAgB,EAAE,SAAS,CAAC,CAAC,GAClD,IAAI,CAON;AAED;;;;;;;;;;GAUG;AACH,wBAAgB,eAAe,CAC7B,MAAM,CAAC,EAAE,kBAAkB,GAC1B,QAAQ,CAAC,MAAM,CAAC,QAAQ,EAAE,SAAS,CAAC,CAAC,CAsBvC;AAED;;;;;;;;;;;;;GAaG;AACH,wBAAgB,OAAO,CACrB,IAAI,EAAE,gBAAgB,EACtB,MAAM,CAAC,EAAE,kBAAkB,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"}
|
|
@@ -16,7 +16,9 @@
|
|
|
16
16
|
* {@link IconRequest}. Resolution picks one source — theme entry, then
|
|
17
17
|
* process-wide registration, then built-in default; a nullish static entry
|
|
18
18
|
* falls through — and a selected function's result is final. `Icon` passes
|
|
19
|
-
* its resolved size
|
|
19
|
+
* its resolved size and a variant the entry can receive (listed by the active
|
|
20
|
+
* theme and, for a theme entry, by the theme that defined it), otherwise
|
|
21
|
+
* `undefined`; the public reads below pass `{size: 'md'}`.
|
|
20
22
|
*/
|
|
21
23
|
|
|
22
24
|
import { defaultIcons } from "./defaultIcons.js";
|
|
@@ -116,38 +118,92 @@ let globalRegistry = {};
|
|
|
116
118
|
function isNamespacedKey(name) {
|
|
117
119
|
return name.includes(':');
|
|
118
120
|
}
|
|
121
|
+
function getTheme(source) {
|
|
122
|
+
return typeof source === 'string' ? getRegisteredTheme(source) : source ?? null;
|
|
123
|
+
}
|
|
119
124
|
|
|
120
125
|
/**
|
|
121
126
|
* The theme's icon entries, functions included. A theme from `defineTheme`
|
|
122
127
|
* keeps them in `__icons` when any entry is a function (its public `icons`
|
|
123
128
|
* is the node view); otherwise `icons` already holds them.
|
|
124
129
|
*/
|
|
125
|
-
function getThemeIconEntries(
|
|
126
|
-
const theme = typeof source === 'string' ? getRegisteredTheme(source) : source;
|
|
130
|
+
function getThemeIconEntries(theme) {
|
|
127
131
|
if (theme == null) {
|
|
128
132
|
return null;
|
|
129
133
|
}
|
|
130
134
|
return theme.__icons ?? theme.icons ?? null;
|
|
131
135
|
}
|
|
132
136
|
|
|
137
|
+
/**
|
|
138
|
+
* The selected entry, with every variant list a requested variant must be in
|
|
139
|
+
* for the entry to receive it. No lists: the entry receives no variant.
|
|
140
|
+
*/
|
|
141
|
+
|
|
133
142
|
/**
|
|
134
143
|
* Pick the one source that answers `name`: the theme entry, then the
|
|
135
144
|
* process-wide registration, then the built-in default, then `fallback`. A
|
|
136
145
|
* nullish static entry falls through; a function is returned as-is, because
|
|
137
146
|
* its result is final.
|
|
147
|
+
*
|
|
148
|
+
* A theme entry may receive a variant listed by the active theme and by the
|
|
149
|
+
* theme that defined the entry (an inherited entry keeps its defining
|
|
150
|
+
* theme's list). A process-wide registration may receive a variant the
|
|
151
|
+
* active theme lists.
|
|
138
152
|
*/
|
|
139
153
|
function selectIconEntry(name, source, fallback) {
|
|
140
|
-
|
|
154
|
+
const theme = getTheme(source);
|
|
155
|
+
const activeVariants = theme?.iconVariants;
|
|
156
|
+
const themeEntry = getThemeIconEntries(theme)?.[name];
|
|
157
|
+
if (theme != null && themeEntry != null) {
|
|
158
|
+
const definingVariants = theme.__iconEntryVariants != null && Object.hasOwn(theme.__iconEntryVariants, name) ? theme.__iconEntryVariants[name] : activeVariants;
|
|
159
|
+
return {
|
|
160
|
+
entry: themeEntry,
|
|
161
|
+
variantLists: [activeVariants, definingVariants]
|
|
162
|
+
};
|
|
163
|
+
}
|
|
164
|
+
const globalEntry = globalRegistry[name];
|
|
165
|
+
if (globalEntry != null) {
|
|
166
|
+
return {
|
|
167
|
+
entry: globalEntry,
|
|
168
|
+
variantLists: [activeVariants]
|
|
169
|
+
};
|
|
170
|
+
}
|
|
171
|
+
return {
|
|
172
|
+
entry: defaultIcons[name] ?? fallback,
|
|
173
|
+
variantLists: []
|
|
174
|
+
};
|
|
141
175
|
}
|
|
142
176
|
|
|
143
|
-
/**
|
|
144
|
-
|
|
145
|
-
|
|
177
|
+
/**
|
|
178
|
+
* Read a selected entry for a request: call a function, return a node as-is.
|
|
179
|
+
* The function receives the requested variant only when every list of the
|
|
180
|
+
* selection contains it; otherwise it receives `undefined`.
|
|
181
|
+
*/
|
|
182
|
+
function readIconEntry({
|
|
183
|
+
entry,
|
|
184
|
+
variantLists
|
|
185
|
+
}, {
|
|
186
|
+
size,
|
|
187
|
+
variant
|
|
188
|
+
}) {
|
|
189
|
+
if (typeof entry !== 'function') {
|
|
190
|
+
return entry;
|
|
191
|
+
}
|
|
192
|
+
const receivable = variant !== undefined && variantLists.length > 0 && variantLists.every(list => list?.includes(variant) === true);
|
|
193
|
+
// A receivable variant is one the entry's theme lists, which is the type
|
|
194
|
+
// the entry was written against.
|
|
195
|
+
return entry(receivable ? {
|
|
196
|
+
size,
|
|
197
|
+
variant
|
|
198
|
+
} : {
|
|
199
|
+
size
|
|
200
|
+
});
|
|
146
201
|
}
|
|
147
202
|
|
|
148
203
|
/**
|
|
149
204
|
* Resolve a key for an Icon request. `Icon` is the caller: it passes the size
|
|
150
|
-
* it resolved. Public reads use
|
|
205
|
+
* it resolved and the variant it was asked for. Public reads use
|
|
206
|
+
* {@link getIcon} instead.
|
|
151
207
|
* @internal
|
|
152
208
|
*/
|
|
153
209
|
export function resolveIcon(name, source, request) {
|
|
@@ -211,7 +267,7 @@ export function getIconRegistry(source) {
|
|
|
211
267
|
// resolved via getIcon/getExtendedIcon and intentionally kept out of the
|
|
212
268
|
// typed IconRegistry snapshot.
|
|
213
269
|
const names = new Set(Object.keys(defaultIcons));
|
|
214
|
-
for (const name of Object.keys(getThemeIconEntries(source) ?? {})) {
|
|
270
|
+
for (const name of Object.keys(getThemeIconEntries(getTheme(source)) ?? {})) {
|
|
215
271
|
names.add(name);
|
|
216
272
|
}
|
|
217
273
|
for (const name of names) {
|
|
@@ -80,6 +80,81 @@ export declare function holdLayoutExit(handle: AnimatedLayout | null | undefined
|
|
|
80
80
|
* mid-exit.
|
|
81
81
|
*/
|
|
82
82
|
export declare function releaseLayoutExit(element: HTMLElement): void;
|
|
83
|
+
/**
|
|
84
|
+
* Old content held as one transient copy while new content enters in its
|
|
85
|
+
* place (`spec:AST-105` FR8): inert, hidden from assistive technology, and
|
|
86
|
+
* removed when the swap ends (`architecture:component-style-authoring` INV7).
|
|
87
|
+
*/
|
|
88
|
+
export interface LayoutSwap {
|
|
89
|
+
readonly area: Element;
|
|
90
|
+
readonly copy: HTMLElement;
|
|
91
|
+
/** Where the old content showed, in viewport coordinates. */
|
|
92
|
+
readonly rect: DOMRect;
|
|
93
|
+
}
|
|
94
|
+
/** How far a ridden element has moved since the swap began. */
|
|
95
|
+
export interface LayoutRide {
|
|
96
|
+
readonly x: number;
|
|
97
|
+
readonly y: number;
|
|
98
|
+
}
|
|
99
|
+
/**
|
|
100
|
+
* How a swap plays, as frames over its progress (0 → 1) and, with
|
|
101
|
+
* `rideWith`, the ridden element's travel so far.
|
|
102
|
+
*/
|
|
103
|
+
export interface LayoutSwapMotion {
|
|
104
|
+
/** The box the copy is laid out in, over the old content's place. */
|
|
105
|
+
readonly host: Element;
|
|
106
|
+
/** The copy's frames while it travels. */
|
|
107
|
+
readonly copy: (p: number, ride: LayoutRide) => Keyframe;
|
|
108
|
+
/** Its text's opacity, on its own curve, when that differs from the copy's. */
|
|
109
|
+
readonly copyText?: (p: number) => number;
|
|
110
|
+
/** The copy paints above its neighbours, in the background it shows. */
|
|
111
|
+
readonly isOpaque?: boolean;
|
|
112
|
+
/**
|
|
113
|
+
* An element the glide moves, such as the column the old content sat in.
|
|
114
|
+
* Every part plays over its glide, frame by frame, and is told how far it
|
|
115
|
+
* has moved; the copy rides it unless `isCopyMoved` is false. Without a
|
|
116
|
+
* glide (it lands silently) the ride is the whole `travel` at once (its
|
|
117
|
+
* old place less its new).
|
|
118
|
+
*/
|
|
119
|
+
readonly rideWith?: {
|
|
120
|
+
readonly element: Element;
|
|
121
|
+
readonly travel: LayoutRide;
|
|
122
|
+
readonly isCopyMoved?: boolean;
|
|
123
|
+
};
|
|
124
|
+
/** Called once when the swap ends, however it ends. */
|
|
125
|
+
readonly onEnd?: () => void;
|
|
126
|
+
/** Elements the page already renders, entering with the swap. */
|
|
127
|
+
readonly incoming: ReadonlyArray<{
|
|
128
|
+
readonly element: Element;
|
|
129
|
+
readonly frames: (p: number, ride: LayoutRide) => Keyframe;
|
|
130
|
+
}>;
|
|
131
|
+
}
|
|
132
|
+
/**
|
|
133
|
+
* Before a change commits: hold `element`'s old content as one transient copy
|
|
134
|
+
* (`spec:AST-105` FR8). With `isVisiblePart`, the copy is the element's
|
|
135
|
+
* visible part, its content scrolled as it was (a scroll container). Returns
|
|
136
|
+
* null without a handle, outside its area, under an immediate change, or for
|
|
137
|
+
* content too large to copy.
|
|
138
|
+
*/
|
|
139
|
+
export declare function holdLayoutSwap(handle: AnimatedLayout | null | undefined, element: HTMLElement, { isVisiblePart }?: {
|
|
140
|
+
isVisiblePart?: boolean;
|
|
141
|
+
}): LayoutSwap | null;
|
|
142
|
+
/**
|
|
143
|
+
* After the change commits, before paint: the copy leaves while the incoming
|
|
144
|
+
* elements enter, on FR4's one motion, every part started on the same
|
|
145
|
+
* timeline time. Under Reduce Motion with a coarse pointer, only opacity
|
|
146
|
+
* changes (`design:reduced-motion` DR2). Returns what ends the swap at once;
|
|
147
|
+
* it also ends when its motion does, and the copy is removed.
|
|
148
|
+
*/
|
|
149
|
+
export declare function playLayoutSwap(swap: LayoutSwap, how: LayoutSwapMotion): () => void;
|
|
150
|
+
/**
|
|
151
|
+
* After a change commits, before paint: elements the page already renders
|
|
152
|
+
* play frames over the change's progress on FR4's one motion, with no copy,
|
|
153
|
+
* such as a surface reaching over a gap a glide opens. Under Reduce Motion
|
|
154
|
+
* with a coarse pointer, only opacity changes; under an immediate change,
|
|
155
|
+
* nothing plays. Returns what ends them at once.
|
|
156
|
+
*/
|
|
157
|
+
export declare function playLayoutFrames(handle: AnimatedLayout | null | undefined, parts: LayoutSwapMotion['incoming']): () => void;
|
|
83
158
|
/**
|
|
84
159
|
* A disclosure's indicator (its chevron) turns on the same motion as the
|
|
85
160
|
* glide: its CSS transition takes the spring as a `linear()` easing, and an
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"animatedLayout.d.ts","sourceRoot":"","sources":["../../src/motion/animatedLayout.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"animatedLayout.d.ts","sourceRoot":"","sources":["../../src/motion/animatedLayout.ts"],"names":[],"mappings":"AA6FA,sDAAsD;AACtD,KAAK,YAAY,GACb;IAAC,QAAQ,CAAC,IAAI,EAAE,QAAQ,CAAC;IAAC,QAAQ,CAAC,QAAQ,EAAE,cAAc,CAAA;CAAC,GAC5D;IACE,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,UAAU,EAAE,MAAM,CAAC;IAC5B,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;CACzB,GACD;IAAC,QAAQ,CAAC,IAAI,EAAE,SAAS,CAAA;CAAC,CAAC;AAE/B,yEAAyE;AACzE,UAAU,cAAc;IACtB,QAAQ,CAAC,UAAU,EAAE,MAAM,CAAC;IAC5B,gDAAgD;IAChD,SAAS,CAAC,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC;CAC9B;AAmLD,QAAA,MAAM,IAAI,eAAuC,CAAC;AAElD;;;;GAIG;AACH,MAAM,WAAW,cAAc;IAC7B,QAAQ,CA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