@yahoo/uds-create-config 5.40.3 → 5.41.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/react-native-system.d.ts +970 -0
- package/dist/configs/react-native-system.js +18 -0
- package/dist/configs/system.d.ts +903 -536
- package/dist/configs/system.js +17 -1
- package/dist/entities/system/LinkedSystem.d.ts +2 -17
- package/dist/entities/system/Motion.d.ts +903 -536
- package/dist/entities/system/Motion.js +81 -101
- package/dist/entities/system/css-motion-reach.js +7 -2
- package/dist/entities/system/css-motion.js +8 -3
- package/dist/entities/system/motion-convert.d.ts +20 -14
- package/dist/entities/system/motion-convert.js +27 -58
- package/dist/entities/system/motion-presets.js +4 -3
- package/dist/entities/system/motion-types.d.ts +7 -0
- package/dist/entities/system/motion-types.js +132 -0
- package/dist/entities/system/motion-variants.js +28 -12
- package/dist/entities/system/reanimated-motion.d.ts +777 -0
- package/dist/entities/system/reanimated-motion.js +100 -0
- package/dist/framework/Config.d.ts +4 -4
- package/dist/framework/Config.js +4 -4
- package/dist/framework/class-names.js +4 -2
- package/dist/framework/registered.d.ts +1 -8
- package/dist/framework/registry.d.ts +1 -2
- package/dist/framework/schema-version.d.ts +1 -1
- package/dist/framework/schema-version.js +5 -5
- package/dist/framework/utils/field-schema.js +2 -2
- package/dist/index.d.ts +2 -2
- package/dist/index.js +1 -1
- package/dist/migrations/2.0.0/v1-artifact.d.ts +903 -536
- package/dist/migrations/20261015203142_shared_motion.d.ts +4 -0
- package/dist/migrations/20261015203142_shared_motion.js +8 -0
- package/dist/migrations/20261015205522_declarative_reanimated.d.ts +4 -0
- package/dist/migrations/20261015205522_declarative_reanimated.js +8 -0
- package/dist/migrations/20261015212352_native_motion.d.ts +4 -0
- package/dist/migrations/20261015212352_native_motion.js +10 -0
- package/dist/migrations/20261015212414_motion_types.d.ts +5 -0
- package/dist/migrations/20261015212414_motion_types.js +8 -0
- package/dist/migrations/20261015212722_reanimated_cubic_bezier.d.ts +4 -0
- package/dist/migrations/20261015212722_reanimated_cubic_bezier.js +8 -0
- package/dist/migrations/20261015221052_motion_json_schema.d.ts +7 -0
- package/dist/migrations/20261015221052_motion_json_schema.js +8 -0
- package/dist/migrations/20261016135620_motion_type_only.d.ts +9 -0
- package/dist/migrations/20261016135620_motion_type_only.js +9 -0
- package/dist/migrations/20261016164316_motion_compatibility.d.ts +8 -0
- package/dist/migrations/20261016164316_motion_compatibility.js +9 -0
- package/dist/migrations/motion-source-codemod.d.ts +3 -0
- package/dist/spec/motion.d.ts +3 -2
- package/dist/spec/motion.js +2 -1
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +2 -2
|
@@ -2,6 +2,7 @@ import { reject } from "../../framework/rejection.js";
|
|
|
2
2
|
import { isRef, kindOf, pathOf } from "../../framework/utils/refs.js";
|
|
3
3
|
import { isPlainObject } from "../../framework/utils/field-path.js";
|
|
4
4
|
import { createSliceMemo } from "../../framework/memo.js";
|
|
5
|
+
import { webMotionBody } from "./motion-types.js";
|
|
5
6
|
import { inlineJsMotion } from "./Motion.js";
|
|
6
7
|
//#region src/entities/system/motion-variants.ts
|
|
7
8
|
/** The id an in-place preset goes by — `Btn.root inline [disabled=true]`. Never a preset path, since a
|
|
@@ -43,7 +44,7 @@ const inlineMotions = createSliceMemo({
|
|
|
43
44
|
layer,
|
|
44
45
|
body: {
|
|
45
46
|
...value,
|
|
46
|
-
|
|
47
|
+
type: "motion/react"
|
|
47
48
|
}
|
|
48
49
|
});
|
|
49
50
|
}
|
|
@@ -56,8 +57,8 @@ const inlineMotions = createSliceMemo({
|
|
|
56
57
|
});
|
|
57
58
|
/** A JS preset's body by its path, or an in-place one's by its id; `undefined` for anything else. */
|
|
58
59
|
function jsMotionBody(config, preset) {
|
|
59
|
-
const named = config
|
|
60
|
-
if (named) return named.
|
|
60
|
+
const named = motionBodyAt(config, preset);
|
|
61
|
+
if (named) return named.type === "motion/react" ? named : void 0;
|
|
61
62
|
return inlineMotions(config).valid.find((entry) => entry.id === preset)?.body;
|
|
62
63
|
}
|
|
63
64
|
/** The states a preset names a variant in. */
|
|
@@ -71,11 +72,6 @@ const MOTION_VARIANT_STATES = [
|
|
|
71
72
|
"whileDrag"
|
|
72
73
|
];
|
|
73
74
|
const jsBody = (config, path) => jsMotionBody(config, path);
|
|
74
|
-
/** A named CSS preset's body. */
|
|
75
|
-
const cssBody = (config, path) => {
|
|
76
|
-
const body = config.resolve("motion", path)?.toJSON();
|
|
77
|
-
return body?.runtime === "css" ? body : void 0;
|
|
78
|
-
};
|
|
79
75
|
/** The variant names one state holds: a name, a list of names, or none (values, `false`). */
|
|
80
76
|
function stateVariantNames(value) {
|
|
81
77
|
if (typeof value === "string") return [value];
|
|
@@ -202,13 +198,16 @@ const mentions = (body, name) => declaredVariants(body).includes(name) || namedV
|
|
|
202
198
|
* variant.
|
|
203
199
|
*/
|
|
204
200
|
function renameMotionVariant(config, { path, from, to, groupOf }) {
|
|
205
|
-
const css =
|
|
206
|
-
const bodyOf = css ?
|
|
201
|
+
const css = config.resolve("motion", path)?.toJSON().runtime === "css";
|
|
202
|
+
const bodyOf = css ? (c, p) => {
|
|
203
|
+
const body = motionBodyAt(c, p);
|
|
204
|
+
return body?.runtime === "css" ? body : void 0;
|
|
205
|
+
} : jsBody;
|
|
207
206
|
const own = bodyOf(config, path);
|
|
208
207
|
if (!own) reject("NOT_FOUND", `"${path}" is not a motion preset.`);
|
|
209
208
|
if (!declaredVariants(own).includes(from)) reject("NOT_FOUND", `"${path}" declares no variant "${from}".`);
|
|
210
209
|
if (from === to) return config;
|
|
211
|
-
const group = [...css
|
|
210
|
+
const group = [...css ? groupOf?.(config, path) ?? new Set([path]) : motionVariantGroupOf(config, path)];
|
|
212
211
|
const taken = group.filter((preset) => declaredVariants(bodyOf(config, preset)).includes(to));
|
|
213
212
|
if (taken.length > 0) reject("ALREADY_EXISTS", `"${to}" is already a variant of ${taken.map((preset) => `"${preset}"`).join(", ")}, which animate${taken.length === 1 ? "s" : ""} with "${path}". Renaming "${from}" onto it would make the two one variant.`);
|
|
214
213
|
let next = config;
|
|
@@ -221,7 +220,7 @@ function renameMotionVariant(config, { path, from, to, groupOf }) {
|
|
|
221
220
|
kind: "motion",
|
|
222
221
|
operation: "replace",
|
|
223
222
|
path: preset,
|
|
224
|
-
data:
|
|
223
|
+
data: renamePresetBody(next, preset, body, from, to)
|
|
225
224
|
});
|
|
226
225
|
continue;
|
|
227
226
|
}
|
|
@@ -283,5 +282,22 @@ function orphanedMotionVariants(config) {
|
|
|
283
282
|
}
|
|
284
283
|
return out;
|
|
285
284
|
}
|
|
285
|
+
function motionBodyAt(config, path) {
|
|
286
|
+
const body = config.resolve("motion", path)?.toJSON();
|
|
287
|
+
return body ? webMotionBody(body) : void 0;
|
|
288
|
+
}
|
|
289
|
+
function renamePresetBody(config, path, body, from, to) {
|
|
290
|
+
const stored = config.resolve("motion", path)?.toJSON();
|
|
291
|
+
const renamed = renamedBody(body, from, to);
|
|
292
|
+
if (stored?.type === "motion/react") {
|
|
293
|
+
const { type: _type, runtime: _runtime, ...value } = renamed;
|
|
294
|
+
return {
|
|
295
|
+
...stored,
|
|
296
|
+
value
|
|
297
|
+
};
|
|
298
|
+
}
|
|
299
|
+
const { type: _type, ...legacy } = renamed;
|
|
300
|
+
return legacy;
|
|
301
|
+
}
|
|
286
302
|
//#endregion
|
|
287
303
|
export { MOTION_VARIANT_STATES, declaredVariants, inlineMotionId, inlineMotions, isInlineMotion, jsMotionBody, motionVariantGroups, orphanedMotionVariants, placedMotions, renameMotionVariant, stateVariantNames, variantGroupsOf };
|