motionary 10.5.0 → 10.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.
Files changed (100) hide show
  1. package/CHANGELOG.md +12 -0
  2. package/README.md +60 -0
  3. package/dist/chunks/{anim-image-DuxvYhq6.cjs → anim-image-DECLkPH4.cjs} +2 -2
  4. package/dist/chunks/{anim-image-DuxvYhq6.cjs.map → anim-image-DECLkPH4.cjs.map} +1 -1
  5. package/dist/chunks/{anim-image-BlNPv4JG.js → anim-image-DNghy017.js} +2 -2
  6. package/dist/chunks/{anim-image-BlNPv4JG.js.map → anim-image-DNghy017.js.map} +1 -1
  7. package/dist/chunks/{keyframes-Ce1s05n3.cjs → keyframes-CbUZjD_5.cjs} +2 -2
  8. package/dist/chunks/{keyframes-Ce1s05n3.cjs.map → keyframes-CbUZjD_5.cjs.map} +1 -1
  9. package/dist/chunks/{keyframes-B8ITIAVa.js → keyframes-F6vp6tZZ.js} +2 -2
  10. package/dist/chunks/{keyframes-B8ITIAVa.js.map → keyframes-F6vp6tZZ.js.map} +1 -1
  11. package/dist/chunks/{registry-DXdFb2fJ.js → registry-D8LAoXI-.js} +2 -2
  12. package/dist/chunks/{registry-DXdFb2fJ.js.map → registry-D8LAoXI-.js.map} +1 -1
  13. package/dist/chunks/{registry-VhfPSI0v.cjs → registry-dr1CPTk1.cjs} +2 -2
  14. package/dist/chunks/{registry-VhfPSI0v.cjs.map → registry-dr1CPTk1.cjs.map} +1 -1
  15. package/dist/chunks/{ticker-DvmC6WLS.cjs → ticker-DaAlEyOd.cjs} +2 -2
  16. package/dist/chunks/{ticker-DvmC6WLS.cjs.map → ticker-DaAlEyOd.cjs.map} +1 -1
  17. package/dist/chunks/{ticker-C5RMHMW7.js → ticker-Do9bGsaV.js} +2 -2
  18. package/dist/chunks/{ticker-C5RMHMW7.js.map → ticker-Do9bGsaV.js.map} +1 -1
  19. package/dist/chunks/{tween-CPtm-EdT.js → tween-BzCGq_Ba.js} +2 -2
  20. package/dist/chunks/{tween-CPtm-EdT.js.map → tween-BzCGq_Ba.js.map} +1 -1
  21. package/dist/chunks/{tween-_BGIl6hK.cjs → tween-CmkdSyaC.cjs} +2 -2
  22. package/dist/chunks/{tween-_BGIl6hK.cjs.map → tween-CmkdSyaC.cjs.map} +1 -1
  23. package/dist/components/lite.cjs +179 -0
  24. package/dist/components/lite.cjs.map +1 -1
  25. package/dist/components/lite.js +176 -1
  26. package/dist/components/lite.js.map +1 -1
  27. package/dist/components/tokens.cjs +179 -0
  28. package/dist/components/tokens.cjs.map +1 -1
  29. package/dist/components/tokens.d.cts +36 -1
  30. package/dist/components/tokens.d.ts +36 -1
  31. package/dist/components/tokens.js +176 -1
  32. package/dist/components/tokens.js.map +1 -1
  33. package/dist/components/widgets.cjs +611 -219
  34. package/dist/components/widgets.cjs.map +1 -1
  35. package/dist/components/widgets.d.cts +201 -2
  36. package/dist/components/widgets.d.ts +201 -2
  37. package/dist/components/widgets.js +605 -220
  38. package/dist/components/widgets.js.map +1 -1
  39. package/dist/components.cjs +4 -0
  40. package/dist/components.cjs.map +1 -1
  41. package/dist/components.d.cts +36 -1
  42. package/dist/components.d.ts +36 -1
  43. package/dist/components.js +1 -1
  44. package/dist/components.umd.js +2 -2
  45. package/dist/components.umd.js.map +1 -1
  46. package/dist/index.umd.js.map +1 -1
  47. package/dist/llms-full.txt +124 -1
  48. package/dist/llms.txt +7 -2
  49. package/dist/manifest.json +343 -1
  50. package/dist/runtime/format-apng.cjs +4 -4
  51. package/dist/runtime/format-apng.js +4 -4
  52. package/dist/runtime/format-css.cjs +4 -4
  53. package/dist/runtime/format-css.js +4 -4
  54. package/dist/runtime/format-gif.cjs +4 -4
  55. package/dist/runtime/format-gif.js +4 -4
  56. package/dist/runtime/format-gltf.cjs +1 -1
  57. package/dist/runtime/format-gltf.js +1 -1
  58. package/dist/runtime/format-motion.cjs +4 -4
  59. package/dist/runtime/format-motion.js +4 -4
  60. package/dist/runtime/format-obj.cjs +1 -1
  61. package/dist/runtime/format-obj.js +1 -1
  62. package/dist/runtime/format-sprite.cjs +3 -3
  63. package/dist/runtime/format-sprite.js +3 -3
  64. package/dist/runtime/format-svg.cjs +3 -3
  65. package/dist/runtime/format-svg.js +3 -3
  66. package/dist/runtime/format-webp.cjs +4 -4
  67. package/dist/runtime/format-webp.js +4 -4
  68. package/dist/runtime/gl.cjs +1 -1
  69. package/dist/runtime/gl.js +1 -1
  70. package/dist/runtime/scroll.cjs +2 -2
  71. package/dist/runtime/scroll.js +2 -2
  72. package/dist/runtime/smooth.cjs +1 -1
  73. package/dist/runtime/smooth.js +1 -1
  74. package/dist/runtime/text.cjs +1 -1
  75. package/dist/runtime/text.js +1 -1
  76. package/dist/runtime/vector.cjs +704 -0
  77. package/dist/runtime/vector.cjs.map +1 -0
  78. package/dist/runtime/vector.d.cts +306 -0
  79. package/dist/runtime/vector.d.ts +306 -0
  80. package/dist/runtime/vector.iife.js +2 -0
  81. package/dist/runtime/vector.iife.js.map +1 -0
  82. package/dist/runtime/vector.js +692 -0
  83. package/dist/runtime/vector.js.map +1 -0
  84. package/dist/runtime.cjs +3 -3
  85. package/dist/runtime.d.cts +1 -1
  86. package/dist/runtime.d.ts +1 -1
  87. package/dist/runtime.iife.js +1 -1
  88. package/dist/runtime.iife.js.map +1 -1
  89. package/dist/runtime.js +5 -5
  90. package/dist/widgets.umd.js +1 -1
  91. package/dist/widgets.umd.js.map +1 -1
  92. package/docs/ROADMAP.md +1 -1
  93. package/docs/components/README.md +4 -1
  94. package/docs/components/usa-lottie-player.md +60 -0
  95. package/docs/components/usa-rive.md +57 -0
  96. package/docs/components/usa-token-editor.md +32 -0
  97. package/docs/components.md +72 -0
  98. package/docs/runtime/rive.md +55 -0
  99. package/docs/runtime/vector.md +67 -0
  100. package/package.json +16 -2
@@ -1035,6 +1035,181 @@ function defineTypewriter(tag = 'usa-typewriter') {
1035
1035
 
1036
1036
  var css$$ = "";
1037
1037
 
1038
+ /**
1039
+ * Motion design tokens 2.0 (10.6): the W3C Design Tokens Community Group
1040
+ * format (DTCG, stable 2025.10) — import with alias resolution and
1041
+ * validation, export in the stable or the earlier draft shape.
1042
+ *
1043
+ * - `resolveTokenAliases(json)` — replaces `{group.token}` references
1044
+ * (whole values and inside composite values), detects cycles and
1045
+ * unknown references;
1046
+ * - `validateDesignTokens(json)` — problems (unknown `$type`, malformed
1047
+ * durations / cubic béziers, broken aliases) without throwing;
1048
+ * - `importDesignTokens(json)` — resolve + import into `MotionTokens`
1049
+ * (durations, easings, `transition` composites, springs from
1050
+ * `$extensions["org.motionary"]`);
1051
+ * - `exportDesignTokens(tokens, { format })` — `2025.10` writes durations
1052
+ * as `{ value, unit: "ms" }`, `draft` as `"150ms"`; springs travel in
1053
+ * `$extensions["org.motionary"].spring` (springs are not a DTCG type).
1054
+ */
1055
+ const REF = /^\{([^{}]+)\}$/;
1056
+ const isTok = (o) => o && typeof o === 'object' && '$value' in o;
1057
+ function lookup(root, path) {
1058
+ let n = root;
1059
+ for (const k of path.split('.'))
1060
+ n = n?.[k];
1061
+ return n;
1062
+ }
1063
+ /** Inherit `$type` from parent groups (DTCG) and resolve `{a.b}` aliases. Throws on cycles / missing targets. */
1064
+ function resolveTokenAliases(json) {
1065
+ const root = JSON.parse(JSON.stringify(json));
1066
+ const resolving = new Set();
1067
+ const val = (v, at) => {
1068
+ if (typeof v === 'string') {
1069
+ const m = REF.exec(v.trim());
1070
+ if (!m)
1071
+ return v;
1072
+ const target = lookup(root, m[1]);
1073
+ if (!isTok(target))
1074
+ throw new Error(`[motionary] tokens: ${at} references {${m[1]}}, which is not a token`);
1075
+ if (resolving.has(m[1]))
1076
+ throw new Error(`[motionary] tokens: alias cycle through {${m[1]}}`);
1077
+ resolving.add(m[1]);
1078
+ const out = val(target.$value, m[1]);
1079
+ resolving.delete(m[1]);
1080
+ if (!target.$type && target.__type)
1081
+ target.$type = target.__type;
1082
+ return out;
1083
+ }
1084
+ if (Array.isArray(v))
1085
+ return v.map((x, i) => val(x, `${at}[${i}]`));
1086
+ if (v && typeof v === 'object')
1087
+ return Object.fromEntries(Object.entries(v).map(([k, x]) => [k, val(x, `${at}.${k}`)]));
1088
+ return v;
1089
+ };
1090
+ const walk = (node, path, inherited) => {
1091
+ if (!node || typeof node !== 'object')
1092
+ return;
1093
+ const type = node.$type || inherited;
1094
+ if (isTok(node)) {
1095
+ if (!node.$type && type)
1096
+ node.$type = type;
1097
+ if (typeof node.$value === 'string' && REF.exec(node.$value.trim()) && !node.$type) {
1098
+ const t = lookup(root, REF.exec(node.$value.trim())[1]);
1099
+ if (t?.$type)
1100
+ node.$type = t.$type;
1101
+ }
1102
+ return;
1103
+ }
1104
+ for (const [k, v] of Object.entries(node))
1105
+ if (!k.startsWith('$'))
1106
+ walk(v, [...path, k], type);
1107
+ };
1108
+ walk(root, []);
1109
+ const resolveAll = (node, path) => {
1110
+ if (!node || typeof node !== 'object')
1111
+ return;
1112
+ if (isTok(node)) {
1113
+ node.$value = val(node.$value, path.join('.'));
1114
+ return;
1115
+ }
1116
+ for (const [k, v] of Object.entries(node))
1117
+ if (!k.startsWith('$'))
1118
+ resolveAll(v, [...path, k]);
1119
+ };
1120
+ resolveAll(root, []);
1121
+ return root;
1122
+ }
1123
+ const TYPES = ['color', 'dimension', 'fontFamily', 'fontWeight', 'duration', 'cubicBezier', 'number', 'strokeStyle', 'border', 'transition', 'shadow', 'gradient', 'typography', 'string'];
1124
+ /** Problems in a DTCG file (empty array = valid for motion purposes). */
1125
+ function validateDesignTokens(json) {
1126
+ const out = [];
1127
+ let resolved;
1128
+ try {
1129
+ resolved = resolveTokenAliases(json);
1130
+ }
1131
+ catch (e) {
1132
+ return [String(e.message).replace('[motionary] tokens: ', '')];
1133
+ }
1134
+ const dur = (v) => (typeof v === 'object' && v && typeof v.value === 'number' && (v.unit === 'ms' || v.unit === 's')) || /^\d*\.?\d+(ms|s)$/.test(String(v));
1135
+ const walk = (node, path) => {
1136
+ if (!node || typeof node !== 'object')
1137
+ return;
1138
+ if (isTok(node)) {
1139
+ const p = path.join('.'), t = node.$type, v = node.$value;
1140
+ if (!t)
1141
+ out.push(`${p}: no $type (on the token or a parent group)`);
1142
+ else if (!TYPES.includes(t))
1143
+ out.push(`${p}: unknown $type "${t}"`);
1144
+ else if (t === 'duration' && !dur(v))
1145
+ out.push(`${p}: duration must be { value, unit: "ms" | "s" } (or "150ms" in the draft format)`);
1146
+ else if (t === 'cubicBezier' && !(Array.isArray(v) && v.length === 4 && v.every((n) => typeof n === 'number') && v[0] >= 0 && v[0] <= 1 && v[2] >= 0 && v[2] <= 1))
1147
+ out.push(`${p}: cubicBezier must be [x1, y1, x2, y2] with x in 0–1`);
1148
+ else if (t === 'transition' && !(v && dur(v.duration) && dur(v.delay ?? '0ms') && v.timingFunction))
1149
+ out.push(`${p}: transition needs duration, delay and timingFunction`);
1150
+ return;
1151
+ }
1152
+ for (const [k, v] of Object.entries(node))
1153
+ if (!k.startsWith('$'))
1154
+ walk(v, [...path, k]);
1155
+ };
1156
+ walk(resolved, []);
1157
+ return out;
1158
+ }
1159
+ /** Resolve aliases, then import (merged over `base`). Springs come from `$extensions["org.motionary"].spring`. */
1160
+ function importDesignTokens(json, base = MOTION_TOKENS) {
1161
+ const r = resolveTokenAliases(json);
1162
+ const springs = {};
1163
+ const walk = (node, path) => {
1164
+ if (!node || typeof node !== 'object')
1165
+ return;
1166
+ const ext = node.$extensions?.['org.motionary'];
1167
+ if (ext?.spring)
1168
+ springs[path[path.length - 1]] = ext.spring;
1169
+ if (isTok(node))
1170
+ return;
1171
+ for (const [k, v] of Object.entries(node))
1172
+ if (!k.startsWith('$'))
1173
+ walk(v, [...path, k]);
1174
+ };
1175
+ walk(r, []);
1176
+ const t = importMotionTokens(r, base);
1177
+ for (const [k, s] of Object.entries(springs))
1178
+ t.spring[k] = { stiffness: +s.stiffness || 170, damping: +s.damping || 26, mass: +s.mass || 1 };
1179
+ return t;
1180
+ }
1181
+ /** Export motion tokens as a DTCG document. */
1182
+ function exportDesignTokens(tokens = getMotionTokens(), o = {}) {
1183
+ const stable = (o.format || '2025.10') === '2025.10';
1184
+ const g = o.group || 'motion';
1185
+ const d = (ms) => (stable ? { value: ms, unit: 'ms' } : `${ms}ms`);
1186
+ const bez = (e) => {
1187
+ const m = /^cubic-bezier\(([^)]+)\)$/.exec(e.trim());
1188
+ if (m)
1189
+ return m[1].split(',').map(Number);
1190
+ return { linear: [0, 0, 1, 1], ease: [0.25, 0.1, 0.25, 1], 'ease-in': [0.42, 0, 1, 1], 'ease-out': [0, 0, 0.58, 1], 'ease-in-out': [0.42, 0, 0.58, 1] }[e.trim()] || null;
1191
+ };
1192
+ const doc = { $schema: 'https://www.designtokens.org/schemas/2025.10/format.json', [g]: { $description: 'Motion tokens exported by Motionary', duration: { $type: 'duration' }, easing: { $type: 'cubicBezier' } } };
1193
+ for (const [k, v] of Object.entries(tokens.duration))
1194
+ doc[g].duration[k] = { $value: d(v) };
1195
+ for (const [k, v] of Object.entries(tokens.easing)) {
1196
+ const b = bez(v);
1197
+ if (b)
1198
+ doc[g].easing[k] = { $value: b };
1199
+ }
1200
+ if (Object.keys(tokens.spring).length) {
1201
+ doc[g].spring = { $description: 'Spring parameters (not a DTCG type; carried in $extensions)' };
1202
+ for (const [k, v] of Object.entries(tokens.spring))
1203
+ doc[g].spring[k] = { $extensions: { 'org.motionary': { spring: { ...v } } } };
1204
+ }
1205
+ if (o.transitions?.length) {
1206
+ doc[g].transition = { $type: 'transition' };
1207
+ for (const [name, dur, ease] of o.transitions)
1208
+ doc[g].transition[name] = { $value: { duration: `{${g}.duration.${dur}}`, delay: d(0), timingFunction: `{${g}.easing.${ease}}` } };
1209
+ }
1210
+ return doc;
1211
+ }
1212
+
1038
1213
  /**
1039
1214
  * motionary/components/tokens — motion design tokens (4.2).
1040
1215
  *
@@ -10800,6 +10975,7 @@ exports.deviceTilt = deviceTilt;
10800
10975
  exports.drawLines = drawLines;
10801
10976
  exports.easeOutExpo = easeOutExpo;
10802
10977
  exports.enableMpaTransitions = enableMpaTransitions;
10978
+ exports.exportDesignTokens = exportDesignTokens;
10803
10979
  exports.flip = flip;
10804
10980
  exports.flipFrames = flipFrames;
10805
10981
  exports.fluentPreset = fluentPreset;
@@ -10817,6 +10993,7 @@ exports.glQuad = glQuad;
10817
10993
  exports.graphemes = graphemes;
10818
10994
  exports.haptic = haptic;
10819
10995
  exports.hasEffect = hasEffect;
10996
+ exports.importDesignTokens = importDesignTokens;
10820
10997
  exports.importMotionTokens = importMotionTokens;
10821
10998
  exports.interpolatePath = interpolatePath;
10822
10999
  exports.linearEasing = linearEasing;
@@ -10859,6 +11036,7 @@ exports.resolveDurationToken = resolveDurationToken;
10859
11036
  exports.resolveEasingToken = resolveEasingToken;
10860
11037
  exports.resolvePosition = resolvePosition;
10861
11038
  exports.resolveSpring = resolveSpring;
11039
+ exports.resolveTokenAliases = resolveTokenAliases;
10862
11040
  exports.restoreMotionIntensity = restoreMotionIntensity;
10863
11041
  exports.restoreMotionSensitivity = restoreMotionSensitivity;
10864
11042
  exports.revealKeyframes = revealKeyframes;
@@ -10893,6 +11071,7 @@ exports.swipeDirection = swipeDirection;
10893
11071
  exports.themeTransition = themeTransition;
10894
11072
  exports.timeline = timeline;
10895
11073
  exports.toast = toast;
11074
+ exports.validateDesignTokens = validateDesignTokens;
10896
11075
  exports.viewTransition = viewTransition;
10897
11076
  exports.warnBaseline = warnBaseline;
10898
11077
  exports.watchPowerSaver = watchPowerSaver;