@yahoo/uds-create-config 5.19.1 → 5.20.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/configs/documentation.js +1 -1
- package/dist/configs/system.d.ts +607 -2
- package/dist/configs/system.js +6 -0
- package/dist/entities/documentation/Documentation.d.ts +1 -1
- package/dist/entities/system/Component.js +1 -2
- package/dist/entities/system/LinkedSystem.d.ts +17 -2
- package/dist/entities/system/Modifier.d.ts +5 -2
- package/dist/entities/system/Modifier.js +5 -2
- package/dist/entities/system/Motion.d.ts +578 -4
- package/dist/entities/system/Motion.js +233 -70
- package/dist/entities/system/css-motion-reach.d.ts +62 -0
- package/dist/entities/system/css-motion-reach.js +195 -0
- package/dist/entities/system/css-motion.d.ts +55 -0
- package/dist/entities/system/css-motion.js +445 -0
- package/dist/entities/system/css-timing.d.ts +40 -0
- package/dist/entities/system/css-timing.js +247 -0
- package/dist/entities/system/easings.d.ts +29 -0
- package/dist/entities/system/easings.js +99 -0
- package/dist/entities/system/motion-convert.d.ts +42 -0
- package/dist/entities/system/motion-convert.js +517 -0
- package/dist/entities/system/motion-presets.d.ts +9 -1
- package/dist/entities/system/motion-presets.js +27 -38
- package/dist/entities/system/motion-variants.js +66 -49
- package/dist/entities/system/reduced-motion.d.ts +20 -0
- package/dist/entities/system/reduced-motion.js +42 -0
- package/dist/framework/Config.d.ts +7 -2
- package/dist/framework/Config.js +47 -5
- package/dist/framework/class-names.d.ts +2 -1
- package/dist/framework/class-names.js +31 -13
- package/dist/framework/defineEntity.d.ts +3 -1
- package/dist/framework/defineEntity.js +2 -0
- package/dist/framework/registered.d.ts +8 -1
- package/dist/framework/registry.d.ts +38 -1
- package/dist/framework/registry.js +3 -1
- package/dist/framework/render-spec.js +7 -2
- package/dist/framework/schema-version.d.ts +1 -1
- package/dist/framework/schema-version.js +5 -5
- package/dist/framework/signature.js +4 -2
- package/dist/index.d.ts +2 -2
- package/dist/index.js +1 -1
- package/dist/migrations/2.0.0/v1-artifact.d.ts +606 -2
- package/dist/migrations/20261009000514_css_motion_states.d.ts +11 -0
- package/dist/migrations/20261009000514_css_motion_states.js +10 -0
- package/dist/migrations/20261009022722_starting_style_modifier.d.ts +9 -0
- package/dist/migrations/20261009022722_starting_style_modifier.js +10 -0
- package/dist/migrations/20261009181635_css_motion_strict.d.ts +23 -0
- package/dist/migrations/20261009181635_css_motion_strict.js +152 -0
- package/dist/spec/motion.d.ts +7 -0
- package/dist/spec/motion.js +7 -0
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +6 -2
package/dist/configs/system.js
CHANGED
|
@@ -61,6 +61,9 @@ import { motionVariantsAndLayoutMigration } from "../migrations/20261006125609_m
|
|
|
61
61
|
import { systemScriptsMigration } from "../migrations/20261007182932_system_scripts.js";
|
|
62
62
|
import { styleNumbersNameNumericValuesMigration } from "../migrations/20261007210309_style_numbers_name_numeric_values.js";
|
|
63
63
|
import { buildReactMigration } from "../migrations/20261008181849_build_react.js";
|
|
64
|
+
import { cssMotionStatesMigration } from "../migrations/20261009000514_css_motion_states.js";
|
|
65
|
+
import { startingStyleModifierMigration } from "../migrations/20261009022722_starting_style_modifier.js";
|
|
66
|
+
import { cssMotionStrictMigration } from "../migrations/20261009181635_css_motion_strict.js";
|
|
64
67
|
const System = defineConfig({
|
|
65
68
|
name: WEB_CONFIG_NAME,
|
|
66
69
|
description: "A design system: the values, primitives and compositions an app is built from. A ref is written `{ \"__ref\": \"<kind>:<path>\" }`, so a token is `{ \"__ref\": \"token:<group>/<name>\" }` and a token group is `{ \"__ref\": \"token:<group>\" }`. Build it in this order. Tokens first, in groups by purpose (colors, spacing, radii, type sizes), since everything else names them. Then style properties, each with `values` holding one ref to the token group whose members it accepts (`{ \"__ref\": \"token:color\" }`), so a prop takes token names rather than raw CSS; add a string keyword only for a value no token holds. A style rule's bag holds a prop's values (`\"padding\": \"4\"`, `\"bg\": \"brand\"`), never raw CSS. Then a few primitive components, one layer each, whose props are style properties (a box for layout and surface, a text for type, a pressable for interaction). Then every other component composed from those primitives: its layers name a primitive or an element, its anatomy places them (a node renders a layer, a tag or `Slot` where a slot prop's content lands; `children` is the edge list; `visible` is `{ \"$state\": \"<prop>\" }`; a prop shown in a nested layer is a `forward` route, and `$state` never sits in a node's props), and its style rules set style-property values per layer, keyed by prop values when a variant changes them. Modes (a dark mode is `{ type: \"selector\", value: \".dark\" }`) change token values through a token's `overrides`, so a component never restyles for a mode; modifiers (hover, focus, disabled) name a state, and a style rule applies under one as a `_hover` block inside a layer bag. Composites bundle style values that recur. Last, register canvas roles: the canvas draws with them, one entity per tool (`frame` for the layout primitive, `text` for the text primitive, `image`) whose entries name the components that tool inserts, and a tool whose role is unregistered is disabled. Give each component a `preview` entry under `*` so it shows content, and never write a CSS property name where a style-property name belongs.",
|
|
@@ -133,5 +136,8 @@ if (!registeredSchemaMigrations().has(20261006125609)) registerSchemaMigrations(
|
|
|
133
136
|
if (!registeredSchemaMigrations().has(20261007182932)) registerSchemaMigrations(systemScriptsMigration);
|
|
134
137
|
if (!registeredSchemaMigrations().has(20261007210309)) registerSchemaMigrations(styleNumbersNameNumericValuesMigration);
|
|
135
138
|
if (!registeredSchemaMigrations().has(20261008181849)) registerSchemaMigrations(buildReactMigration);
|
|
139
|
+
if (!registeredSchemaMigrations().has(20261009000514)) registerSchemaMigrations(cssMotionStatesMigration);
|
|
140
|
+
if (!registeredSchemaMigrations().has(20261009022722)) registerSchemaMigrations(startingStyleModifierMigration);
|
|
141
|
+
if (!registeredSchemaMigrations().has(20261009181635)) registerSchemaMigrations(cssMotionStrictMigration);
|
|
136
142
|
//#endregion
|
|
137
143
|
export { System };
|
|
@@ -3,7 +3,7 @@ import { Named } from "../../framework/named.js";
|
|
|
3
3
|
import { z } from "zod";
|
|
4
4
|
|
|
5
5
|
//#region src/entities/documentation/Documentation.d.ts
|
|
6
|
-
/**
|
|
6
|
+
/** A page from Create's docs site, held independently of a user's system. */
|
|
7
7
|
declare const DocumentationDefinition: EntityClass<z.ZodObject<{
|
|
8
8
|
title: z.ZodString;
|
|
9
9
|
summary: z.ZodOptional<z.ZodString>;
|
|
@@ -15,7 +15,6 @@ import { Style, addBagKeyIssues, anatomyPropValue, bagNameEdges, bagRewriteName,
|
|
|
15
15
|
import { storedPreview } from "../../framework/preview-store.js";
|
|
16
16
|
import { glyphPropsOf, propOwner, propValueDomain, refListOf, resolveComponentProps, stylePropNumberUnit, stylePropValueLeaves, validateComponentProps } from "../../framework/projections.js";
|
|
17
17
|
import { carriesContent, intoName, isValueSlot, renderBoundProp, routedPropIn, routesContent } from "../../framework/prop-surface.js";
|
|
18
|
-
import { inlineJsMotion } from "./Motion.js";
|
|
19
18
|
import { slotAnatomyPropOf, slotTargetsOf, withoutTruthyTerm } from "../../framework/render-spec.js";
|
|
20
19
|
import { listSlots, namedSlots, slotHostedBy, slotOf, slotsFor } from "../../spec/slot.js";
|
|
21
20
|
import { cellAt } from "../../spec/cell.js";
|
|
@@ -734,7 +733,7 @@ function buildBagFor(config, layerElement) {
|
|
|
734
733
|
}).optional();
|
|
735
734
|
}
|
|
736
735
|
shape.as ??= z.string().optional();
|
|
737
|
-
|
|
736
|
+
for (const [key, owned] of config.layerKeys()) shape[key] = owned.schema(shape[key]).optional();
|
|
738
737
|
let bag;
|
|
739
738
|
const nested = z.lazy(() => bag).optional();
|
|
740
739
|
for (const mod of config.list("modifier")) shape[`_${mod.leaf}`] = nested;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { Ref } from "../../framework/utils/refs.js";
|
|
2
2
|
import { SourceResolver, SourceState } from "../../framework/sources.js";
|
|
3
3
|
import { ComputedInput } from "../../framework/registry.js";
|
|
4
|
-
import { RegisteredComponentContracts, RegisteredEntities } from "../../framework/registered.js";
|
|
4
|
+
import { RegisteredComponentContracts, RegisteredEntities, RegisteredMotionRuntimes } from "../../framework/registered.js";
|
|
5
5
|
import { EntityClass, ItemOf } from "../../framework/defineEntity.js";
|
|
6
6
|
import { PartialBodyOf } from "../../framework/defineConfig.js";
|
|
7
7
|
import { Named } from "../../framework/named.js";
|
|
@@ -243,7 +243,22 @@ type PinOptions = { [A in keyof RegisteredEntities]?: Record<string, PinAdjustme
|
|
|
243
243
|
*/
|
|
244
244
|
type PinOptionsInput<K extends string = string> = { [A in keyof RegisteredEntities]?: RegisteredEntities[A] extends {
|
|
245
245
|
readonly kind: 'component';
|
|
246
|
-
} ? { [P in K]?: PinComponentAdjustment<RegisteredEntities[A], P> } :
|
|
246
|
+
} ? { [P in K]?: PinComponentAdjustment<RegisteredEntities[A], P> } : RegisteredEntities[A] extends {
|
|
247
|
+
readonly kind: 'motion';
|
|
248
|
+
} ? { [P in K]?: PinMotionAdjustment<RegisteredEntities[A], P> } : Record<string, PinAdjustment<RegisteredEntities[A]>> };
|
|
249
|
+
/** A motion entry: an adjustment whose `runtime` is one the linked preset can be read as
|
|
250
|
+
* ({@link RegisteredMotionRuntimes}), so a swap the conversion would refuse doesn't type. */
|
|
251
|
+
type PinMotionAdjustment<E, P extends string> = {
|
|
252
|
+
override?: PinMotionBody<E, P>;
|
|
253
|
+
extend?: PinMotionBody<E, P>;
|
|
254
|
+
hidden?: boolean;
|
|
255
|
+
};
|
|
256
|
+
type PinMotionBody<E, P extends string> = Extract<StoredBodyOf<PartialBodyOf<E>>, {
|
|
257
|
+
runtime?: MotionRuntimeOf<P>;
|
|
258
|
+
}>;
|
|
259
|
+
/** The linked presets registered at `path`, from whichever source. */
|
|
260
|
+
type LinkedMotionKey<P extends string> = Extract<keyof RegisteredMotionRuntimes, `${P}@${string}`>;
|
|
261
|
+
type MotionRuntimeOf<P extends string> = [LinkedMotionKey<P>] extends [never] ? 'css' | 'js' : RegisteredMotionRuntimes[LinkedMotionKey<P>];
|
|
247
262
|
type PinComponentAdjustment<E, P extends string> = {
|
|
248
263
|
override?: PinComponentBody<E, P>;
|
|
249
264
|
extend?: PinComponentBody<E, P>;
|
|
@@ -11,8 +11,10 @@ import { z } from "zod";
|
|
|
11
11
|
declare const MODIFIER_CATEGORIES: readonly ["mode", "state"];
|
|
12
12
|
type ModifierCategory = (typeof MODIFIER_CATEGORIES)[number];
|
|
13
13
|
/** How a web modifier activates. A `media-query` is an at-rule the emitter wraps the block in;
|
|
14
|
-
* `selector` composes onto the element, or stands as an ancestor for a mode.
|
|
15
|
-
|
|
14
|
+
* `selector` composes onto the element, or stands as an ancestor for a mode. `starting-style` wraps
|
|
15
|
+
* the block in `@starting-style`: the style an element transitions from as it mounts or leaves
|
|
16
|
+
* `display: none`. It takes no condition, so its `value` is left empty. */
|
|
17
|
+
declare const WEB_ACTIVATIONS: readonly ["selector", "media-query", "composite", "starting-style"];
|
|
16
18
|
type WebActivation = (typeof WEB_ACTIVATIONS)[number];
|
|
17
19
|
/**
|
|
18
20
|
* A modifier group's own fields.
|
|
@@ -44,6 +46,7 @@ declare const ModifierDefinition: EntityClass<z.ZodObject<{
|
|
|
44
46
|
selector: "selector";
|
|
45
47
|
composite: "composite";
|
|
46
48
|
"media-query": "media-query";
|
|
49
|
+
"starting-style": "starting-style";
|
|
47
50
|
}>;
|
|
48
51
|
value: z.ZodUnion<readonly [z.ZodString, z.ZodLazy<CompositeClass>]>;
|
|
49
52
|
media: z.ZodOptional<z.ZodString>;
|
|
@@ -8,11 +8,14 @@ import { z } from "zod";
|
|
|
8
8
|
* plain modifiers that compose as fragments and that no surface treats specially. */
|
|
9
9
|
const MODIFIER_CATEGORIES = ["mode", "state"];
|
|
10
10
|
/** How a web modifier activates. A `media-query` is an at-rule the emitter wraps the block in;
|
|
11
|
-
* `selector` composes onto the element, or stands as an ancestor for a mode.
|
|
11
|
+
* `selector` composes onto the element, or stands as an ancestor for a mode. `starting-style` wraps
|
|
12
|
+
* the block in `@starting-style`: the style an element transitions from as it mounts or leaves
|
|
13
|
+
* `display: none`. It takes no condition, so its `value` is left empty. */
|
|
12
14
|
const WEB_ACTIVATIONS = [
|
|
13
15
|
"selector",
|
|
14
16
|
"media-query",
|
|
15
|
-
"composite"
|
|
17
|
+
"composite",
|
|
18
|
+
"starting-style"
|
|
16
19
|
];
|
|
17
20
|
/** A ref to a modifier, spelled out because the kind's own class is what this is a field of. */
|
|
18
21
|
const modifierRef = refTo("modifier");
|