@tamagui/style-grammar 3.0.0-beta.924.1 → 3.0.1
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/cjs/ast/payloadShape.cjs +45 -17
- package/dist/cjs/ast/payloadShape.native.cjs +45 -17
- package/dist/cjs/ast/payloadShape.native.js +45 -17
- package/dist/cjs/ast/payloadShape.native.js.map +1 -1
- package/dist/cjs/ast/resolvePayload.cjs +16 -9
- package/dist/cjs/ast/resolvePayload.native.cjs +16 -9
- package/dist/cjs/ast/resolvePayload.native.js +16 -9
- package/dist/cjs/ast/resolvePayload.native.js.map +1 -1
- package/dist/cjs/programs/lowerProgram.cjs +2 -2
- package/dist/cjs/programs/lowerProgram.native.cjs +2 -2
- package/dist/cjs/programs/lowerProgram.native.js +2 -2
- package/dist/cjs/programs/lowerProgram.native.js.map +1 -1
- package/dist/cjs/runtime/clauseIdentity.cjs +9 -28
- package/dist/cjs/runtime/clauseIdentity.native.cjs +9 -28
- package/dist/cjs/runtime/clauseIdentity.native.js +9 -28
- package/dist/cjs/runtime/clauseIdentity.native.js.map +1 -1
- package/dist/cjs/runtime/clausePrecedence.cjs +2 -2
- package/dist/cjs/runtime/clausePrecedence.native.cjs +3 -10
- package/dist/cjs/runtime/clausePrecedence.native.js +3 -10
- package/dist/cjs/runtime/clausePrecedence.native.js.map +1 -1
- package/dist/cjs/runtime/modifierVocabulary.native.cjs +1 -8
- package/dist/cjs/runtime/modifierVocabulary.native.js +1 -8
- package/dist/cjs/runtime/modifierVocabulary.native.js.map +1 -1
- package/dist/cjs/runtime/scanFlatValue.cjs +58 -7
- package/dist/cjs/runtime/scanFlatValue.native.cjs +58 -7
- package/dist/cjs/runtime/scanFlatValue.native.js +58 -7
- package/dist/cjs/runtime/scanFlatValue.native.js.map +1 -1
- package/dist/cjs/runtime/spring.cjs +123 -0
- package/dist/cjs/runtime/spring.native.cjs +131 -0
- package/dist/cjs/runtime/spring.native.js +133 -0
- package/dist/cjs/runtime/spring.native.js.map +1 -0
- package/dist/cjs/runtime/stateModifiers.cjs +23 -1
- package/dist/cjs/runtime/stateModifiers.native.cjs +23 -1
- package/dist/cjs/runtime/stateModifiers.native.js +23 -1
- package/dist/cjs/runtime/stateModifiers.native.js.map +1 -1
- package/dist/cjs/runtime/tokenCategories.cjs +3 -0
- package/dist/cjs/runtime/tokenCategories.native.cjs +3 -0
- package/dist/cjs/runtime/tokenCategories.native.js +3 -0
- package/dist/cjs/runtime/tokenCategories.native.js.map +1 -1
- package/dist/cjs/runtime/unitlessNumbers.cjs +0 -5
- package/dist/cjs/runtime/unitlessNumbers.native.cjs +0 -5
- package/dist/cjs/runtime/unitlessNumbers.native.js +0 -5
- package/dist/cjs/runtime/unitlessNumbers.native.js.map +1 -1
- package/dist/cjs/runtime.cjs +11 -0
- package/dist/cjs/runtime.native.cjs +11 -0
- package/dist/cjs/runtime.native.js +11 -0
- package/dist/cjs/runtime.native.js.map +1 -1
- package/dist/cjs/shorthands/transition.cjs +111 -36
- package/dist/cjs/shorthands/transition.native.cjs +113 -36
- package/dist/cjs/shorthands/transition.native.js +113 -36
- package/dist/cjs/shorthands/transition.native.js.map +1 -1
- package/dist/cjs/shorthands/transitionAlign.cjs +13 -10
- package/dist/cjs/shorthands/transitionAlign.native.cjs +14 -11
- package/dist/cjs/shorthands/transitionAlign.native.js +14 -11
- package/dist/cjs/shorthands/transitionAlign.native.js.map +1 -1
- package/dist/cjs/shorthands/transitionLegacy.cjs +263 -126
- package/dist/cjs/shorthands/transitionLegacy.native.cjs +333 -155
- package/dist/cjs/shorthands/transitionLegacy.native.js +333 -155
- package/dist/cjs/shorthands/transitionLegacy.native.js.map +1 -1
- package/dist/cjs/shorthands/transitionNative.cjs +5 -5
- package/dist/cjs/shorthands/transitionNative.native.cjs +8 -7
- package/dist/cjs/shorthands/transitionNative.native.js +8 -7
- package/dist/cjs/shorthands/transitionNative.native.js.map +1 -1
- package/dist/cjs/shorthands/transitionObject.cjs +302 -0
- package/dist/cjs/shorthands/transitionObject.native.cjs +347 -0
- package/dist/cjs/shorthands/transitionObject.native.js +349 -0
- package/dist/cjs/shorthands/transitionObject.native.js.map +1 -0
- package/dist/cjs/tooling/candidate.cjs +254 -15
- package/dist/cjs/tooling/candidate.native.cjs +314 -62
- package/dist/cjs/tooling/candidate.native.js +314 -62
- package/dist/cjs/tooling/candidate.native.js.map +1 -1
- package/dist/cjs/tooling/config.cjs +19 -9
- package/dist/cjs/tooling/config.native.cjs +25 -26
- package/dist/cjs/tooling/config.native.js +25 -26
- package/dist/cjs/tooling/config.native.js.map +1 -1
- package/dist/cjs/tooling/registry.cjs +579 -11
- package/dist/cjs/tooling/registry.native.cjs +579 -11
- package/dist/cjs/tooling/registry.native.js +579 -11
- package/dist/cjs/tooling/registry.native.js.map +1 -1
- package/dist/cjs/tooling/toolingDiagnostics.cjs +306 -10
- package/dist/cjs/tooling/toolingDiagnostics.native.cjs +408 -48
- package/dist/cjs/tooling/toolingDiagnostics.native.js +408 -48
- package/dist/cjs/tooling/toolingDiagnostics.native.js.map +1 -1
- package/dist/cjs/tooling/toolingRegistry.cjs +6 -1
- package/dist/cjs/tooling/toolingRegistry.native.cjs +9 -1
- package/dist/cjs/tooling/toolingRegistry.native.js +9 -1
- package/dist/cjs/tooling/toolingRegistry.native.js.map +1 -1
- package/dist/cjs/tooling.cjs +1 -0
- package/dist/cjs/tooling.native.cjs +1 -0
- package/dist/cjs/tooling.native.js +1 -0
- package/dist/cjs/tooling.native.js.map +1 -1
- package/dist/cjs/transitions.cjs +38 -0
- package/dist/cjs/transitions.native.cjs +40 -0
- package/dist/cjs/transitions.native.js +42 -0
- package/dist/cjs/transitions.native.js.map +1 -0
- package/dist/esm/ast/payloadShape.mjs +45 -17
- package/dist/esm/ast/payloadShape.mjs.map +1 -1
- package/dist/esm/ast/payloadShape.native.js +45 -17
- package/dist/esm/ast/payloadShape.native.js.map +1 -1
- package/dist/esm/ast/resolvePayload.mjs +16 -9
- package/dist/esm/ast/resolvePayload.mjs.map +1 -1
- package/dist/esm/ast/resolvePayload.native.js +16 -9
- package/dist/esm/ast/resolvePayload.native.js.map +1 -1
- package/dist/esm/programs/lowerProgram.mjs +2 -2
- package/dist/esm/programs/lowerProgram.mjs.map +1 -1
- package/dist/esm/programs/lowerProgram.native.js +2 -2
- package/dist/esm/programs/lowerProgram.native.js.map +1 -1
- package/dist/esm/runtime/clauseIdentity.mjs +2 -22
- package/dist/esm/runtime/clauseIdentity.mjs.map +1 -1
- package/dist/esm/runtime/clauseIdentity.native.js +2 -22
- package/dist/esm/runtime/clauseIdentity.native.js.map +1 -1
- package/dist/esm/runtime/clausePrecedence.mjs +2 -2
- package/dist/esm/runtime/clausePrecedence.mjs.map +1 -1
- package/dist/esm/runtime/clausePrecedence.native.js +3 -10
- package/dist/esm/runtime/clausePrecedence.native.js.map +1 -1
- package/dist/esm/runtime/modifierVocabulary.native.js +1 -8
- package/dist/esm/runtime/modifierVocabulary.native.js.map +1 -1
- package/dist/esm/runtime/scanFlatValue.mjs +59 -7
- package/dist/esm/runtime/scanFlatValue.mjs.map +1 -1
- package/dist/esm/runtime/scanFlatValue.native.js +59 -7
- package/dist/esm/runtime/scanFlatValue.native.js.map +1 -1
- package/dist/esm/runtime/spring.mjs +93 -0
- package/dist/esm/runtime/spring.mjs.map +1 -0
- package/dist/esm/runtime/spring.native.js +99 -0
- package/dist/esm/runtime/spring.native.js.map +1 -0
- package/dist/esm/runtime/stateModifiers.mjs +22 -2
- package/dist/esm/runtime/stateModifiers.mjs.map +1 -1
- package/dist/esm/runtime/stateModifiers.native.js +22 -2
- package/dist/esm/runtime/stateModifiers.native.js.map +1 -1
- package/dist/esm/runtime/tokenCategories.mjs +3 -0
- package/dist/esm/runtime/tokenCategories.mjs.map +1 -1
- package/dist/esm/runtime/tokenCategories.native.js +3 -0
- package/dist/esm/runtime/tokenCategories.native.js.map +1 -1
- package/dist/esm/runtime/unitlessNumbers.mjs +0 -5
- package/dist/esm/runtime/unitlessNumbers.mjs.map +1 -1
- package/dist/esm/runtime/unitlessNumbers.native.js +0 -5
- package/dist/esm/runtime/unitlessNumbers.native.js.map +1 -1
- package/dist/esm/runtime.mjs +4 -2
- package/dist/esm/runtime.native.js +4 -2
- package/dist/esm/shorthands/transition.mjs +111 -36
- package/dist/esm/shorthands/transition.mjs.map +1 -1
- package/dist/esm/shorthands/transition.native.js +113 -36
- package/dist/esm/shorthands/transition.native.js.map +1 -1
- package/dist/esm/shorthands/transitionAlign.mjs +13 -10
- package/dist/esm/shorthands/transitionAlign.mjs.map +1 -1
- package/dist/esm/shorthands/transitionAlign.native.js +14 -11
- package/dist/esm/shorthands/transitionAlign.native.js.map +1 -1
- package/dist/esm/shorthands/transitionLegacy.mjs +260 -126
- package/dist/esm/shorthands/transitionLegacy.mjs.map +1 -1
- package/dist/esm/shorthands/transitionLegacy.native.js +330 -155
- package/dist/esm/shorthands/transitionLegacy.native.js.map +1 -1
- package/dist/esm/shorthands/transitionNative.mjs +5 -5
- package/dist/esm/shorthands/transitionNative.mjs.map +1 -1
- package/dist/esm/shorthands/transitionNative.native.js +8 -7
- package/dist/esm/shorthands/transitionNative.native.js.map +1 -1
- package/dist/esm/shorthands/transitionObject.mjs +280 -0
- package/dist/esm/shorthands/transitionObject.mjs.map +1 -0
- package/dist/esm/shorthands/transitionObject.native.js +323 -0
- package/dist/esm/shorthands/transitionObject.native.js.map +1 -0
- package/dist/esm/tooling/candidate.mjs +250 -16
- package/dist/esm/tooling/candidate.mjs.map +1 -1
- package/dist/esm/tooling/candidate.native.js +310 -63
- package/dist/esm/tooling/candidate.native.js.map +1 -1
- package/dist/esm/tooling/config.mjs +18 -9
- package/dist/esm/tooling/config.mjs.map +1 -1
- package/dist/esm/tooling/config.native.js +24 -26
- package/dist/esm/tooling/config.native.js.map +1 -1
- package/dist/esm/tooling/registry.mjs +579 -11
- package/dist/esm/tooling/registry.mjs.map +1 -1
- package/dist/esm/tooling/registry.native.js +579 -11
- package/dist/esm/tooling/registry.native.js.map +1 -1
- package/dist/esm/tooling/toolingDiagnostics.mjs +306 -11
- package/dist/esm/tooling/toolingDiagnostics.mjs.map +1 -1
- package/dist/esm/tooling/toolingDiagnostics.native.js +408 -49
- package/dist/esm/tooling/toolingDiagnostics.native.js.map +1 -1
- package/dist/esm/tooling/toolingRegistry.mjs +6 -1
- package/dist/esm/tooling/toolingRegistry.mjs.map +1 -1
- package/dist/esm/tooling/toolingRegistry.native.js +9 -1
- package/dist/esm/tooling/toolingRegistry.native.js.map +1 -1
- package/dist/esm/tooling.mjs +2 -0
- package/dist/esm/tooling.native.js +2 -0
- package/dist/esm/transitions.mjs +5 -0
- package/dist/esm/transitions.native.js +5 -0
- package/package.json +21 -3
- package/src/ast/payloadShape.ts +44 -16
- package/src/ast/resolvePayload.ts +28 -13
- package/src/programs/lowerProgram.ts +9 -4
- package/src/runtime/clauseIdentity.ts +8 -31
- package/src/runtime/clausePrecedence.ts +2 -10
- package/src/runtime/scanFlatValue.ts +81 -9
- package/src/runtime/spring.ts +208 -0
- package/src/runtime/stateModifiers.ts +31 -1
- package/src/runtime/tokenCategories.ts +3 -0
- package/src/runtime/unitlessNumbers.ts +0 -5
- package/src/runtime.ts +13 -0
- package/src/shorthands/transition.ts +159 -44
- package/src/shorthands/transitionAlign.ts +22 -12
- package/src/shorthands/transitionLegacy.ts +376 -156
- package/src/shorthands/transitionNative.ts +8 -11
- package/src/shorthands/transitionObject.ts +369 -0
- package/src/tooling/candidate.ts +269 -14
- package/src/tooling/config.ts +25 -9
- package/src/tooling/registry.ts +339 -12
- package/src/tooling/toolingDiagnostics.ts +474 -9
- package/src/tooling/toolingRegistry.ts +6 -1
- package/src/tooling.ts +1 -0
- package/src/transitions.ts +42 -0
- package/types/ast/payloadShape.d.ts.map +2 -2
- package/types/ast/resolvePayload.d.ts +5 -4
- package/types/ast/resolvePayload.d.ts.map +2 -2
- package/types/programs/lowerProgram.d.ts +4 -2
- package/types/programs/lowerProgram.d.ts.map +2 -2
- package/types/runtime/clauseIdentity.d.ts +1 -4
- package/types/runtime/clauseIdentity.d.ts.map +2 -2
- package/types/runtime/clausePrecedence.d.ts.map +2 -2
- package/types/runtime/scanFlatValue.d.ts +1 -1
- package/types/runtime/scanFlatValue.d.ts.map +2 -2
- package/types/runtime/spring.d.ts +61 -0
- package/types/runtime/spring.d.ts.map +11 -0
- package/types/runtime/stateModifiers.d.ts +4 -0
- package/types/runtime/stateModifiers.d.ts.map +2 -2
- package/types/runtime/tokenCategories.d.ts.map +2 -2
- package/types/runtime/unitlessNumbers.d.ts.map +2 -2
- package/types/runtime.d.ts +3 -1
- package/types/runtime.d.ts.map +2 -2
- package/types/shorthands/transition.d.ts +26 -5
- package/types/shorthands/transition.d.ts.map +2 -2
- package/types/shorthands/transitionAlign.d.ts.map +2 -2
- package/types/shorthands/transitionLegacy.d.ts +19 -4
- package/types/shorthands/transitionLegacy.d.ts.map +2 -2
- package/types/shorthands/transitionNative.d.ts.map +1 -1
- package/types/shorthands/transitionObject.d.ts +49 -0
- package/types/shorthands/transitionObject.d.ts.map +11 -0
- package/types/tooling/candidate.d.ts +13 -0
- package/types/tooling/candidate.d.ts.map +2 -2
- package/types/tooling/config.d.ts +8 -1
- package/types/tooling/config.d.ts.map +2 -2
- package/types/tooling/registry.d.ts +4 -2
- package/types/tooling/registry.d.ts.map +2 -2
- package/types/tooling/toolingDiagnostics.d.ts +3 -1
- package/types/tooling/toolingDiagnostics.d.ts.map +2 -2
- package/types/tooling/toolingRegistry.d.ts.map +2 -2
- package/types/tooling.d.ts +1 -0
- package/types/tooling.d.ts.map +2 -2
- package/types/transitions.d.ts +5 -0
- package/types/transitions.d.ts.map +11 -0
|
@@ -24,6 +24,9 @@ var transitionAlign_exports = {};
|
|
|
24
24
|
__export(transitionAlign_exports, { alignTransitionContributions: () => alignTransitionContributions });
|
|
25
25
|
module.exports = __toCommonJS(transitionAlign_exports);
|
|
26
26
|
var import_transition = require("./transition.native.js");
|
|
27
|
+
function fusedLabel(fused) {
|
|
28
|
+
return fused.type === "preset" ? `"${fused.name}" preset` : `spring(${fused.duration}, ${fused.bounce})`;
|
|
29
|
+
}
|
|
27
30
|
var timingLonghands = /* @__PURE__ */ new Set(["transitionDuration", "transitionTimingFunction"]);
|
|
28
31
|
function listText(values) {
|
|
29
32
|
return values.join(", ");
|
|
@@ -31,7 +34,7 @@ function listText(values) {
|
|
|
31
34
|
function alignTransitionContributions(contributions, presetNames) {
|
|
32
35
|
var state = {
|
|
33
36
|
global: null,
|
|
34
|
-
|
|
37
|
+
fused: null,
|
|
35
38
|
lists: {}
|
|
36
39
|
};
|
|
37
40
|
var _iteratorNormalCompletion = true, _didIteratorError = false, _iteratorError = void 0;
|
|
@@ -42,18 +45,18 @@ function alignTransitionContributions(contributions, presetNames) {
|
|
|
42
45
|
var parsed = (0, import_transition.parseTransition)(contribution.value, presetNames);
|
|
43
46
|
if (!parsed.ok) return parsed;
|
|
44
47
|
state.global = null;
|
|
45
|
-
state.
|
|
48
|
+
state.fused = null;
|
|
46
49
|
state.lists = {};
|
|
47
50
|
if (parsed.value.kind === "global") {
|
|
48
51
|
state.global = parsed.value.value;
|
|
49
52
|
continue;
|
|
50
53
|
}
|
|
51
54
|
var entries = parsed.value.entries;
|
|
52
|
-
var
|
|
53
|
-
return entry.timing.type
|
|
55
|
+
var fusedEntry = entries.find(function(entry) {
|
|
56
|
+
return entry.timing.type !== "css";
|
|
54
57
|
});
|
|
55
|
-
if (
|
|
56
|
-
state.
|
|
58
|
+
if (fusedEntry) {
|
|
59
|
+
state.fused = fusedEntry.timing;
|
|
57
60
|
state.lists.transitionProperty = listText(entries.map(function(entry) {
|
|
58
61
|
return entry.property;
|
|
59
62
|
}));
|
|
@@ -92,13 +95,13 @@ function alignTransitionContributions(contributions, presetNames) {
|
|
|
92
95
|
}]
|
|
93
96
|
};
|
|
94
97
|
}
|
|
95
|
-
if (state.
|
|
98
|
+
if (state.fused && timingLonghands.has(contribution.prop)) {
|
|
96
99
|
return {
|
|
97
100
|
ok: false,
|
|
98
101
|
diagnostics: [{
|
|
99
102
|
code: "transition-invalid-list",
|
|
100
103
|
token: contribution.prop,
|
|
101
|
-
message: `"${contribution.prop}" cannot partially override
|
|
104
|
+
message: `"${contribution.prop}" cannot partially override ${fusedLabel(state.fused)}: its timing is not decomposable into CSS components. restate \`transition\` with CSS timing, or change the ${state.fused.type}`
|
|
102
105
|
}]
|
|
103
106
|
};
|
|
104
107
|
}
|
|
@@ -127,18 +130,18 @@ function alignTransitionContributions(contributions, presetNames) {
|
|
|
127
130
|
}
|
|
128
131
|
};
|
|
129
132
|
}
|
|
130
|
-
if (state.
|
|
133
|
+
if (state.fused) {
|
|
131
134
|
var zipped = (0, import_transition.parseTransitionLonghands)({
|
|
132
135
|
transitionProperty: state.lists.transitionProperty,
|
|
133
136
|
transitionDelay: state.lists.transitionDelay,
|
|
134
137
|
transitionBehavior: state.lists.transitionBehavior
|
|
135
138
|
});
|
|
136
139
|
if (!zipped.ok || zipped.value.kind !== "transition") return zipped;
|
|
137
|
-
var
|
|
140
|
+
var fused = state.fused;
|
|
138
141
|
var entries1 = zipped.value.entries.map(function(entry) {
|
|
139
142
|
return {
|
|
140
143
|
...entry,
|
|
141
|
-
timing:
|
|
144
|
+
timing: fused
|
|
142
145
|
};
|
|
143
146
|
});
|
|
144
147
|
return {
|
|
@@ -24,6 +24,9 @@ var transitionAlign_exports = {};
|
|
|
24
24
|
__export(transitionAlign_exports, { alignTransitionContributions: () => alignTransitionContributions });
|
|
25
25
|
module.exports = __toCommonJS(transitionAlign_exports);
|
|
26
26
|
var import_transition = require("./transition.native.js");
|
|
27
|
+
function fusedLabel(fused) {
|
|
28
|
+
return fused.type === "preset" ? `"${fused.name}" preset` : `spring(${fused.duration}, ${fused.bounce})`;
|
|
29
|
+
}
|
|
27
30
|
var timingLonghands = /* @__PURE__ */ new Set(["transitionDuration", "transitionTimingFunction"]);
|
|
28
31
|
function listText(values) {
|
|
29
32
|
return values.join(", ");
|
|
@@ -31,7 +34,7 @@ function listText(values) {
|
|
|
31
34
|
function alignTransitionContributions(contributions, presetNames) {
|
|
32
35
|
var state = {
|
|
33
36
|
global: null,
|
|
34
|
-
|
|
37
|
+
fused: null,
|
|
35
38
|
lists: {}
|
|
36
39
|
};
|
|
37
40
|
var _iteratorNormalCompletion = true, _didIteratorError = false, _iteratorError = void 0;
|
|
@@ -42,18 +45,18 @@ function alignTransitionContributions(contributions, presetNames) {
|
|
|
42
45
|
var parsed = (0, import_transition.parseTransition)(contribution.value, presetNames);
|
|
43
46
|
if (!parsed.ok) return parsed;
|
|
44
47
|
state.global = null;
|
|
45
|
-
state.
|
|
48
|
+
state.fused = null;
|
|
46
49
|
state.lists = {};
|
|
47
50
|
if (parsed.value.kind === "global") {
|
|
48
51
|
state.global = parsed.value.value;
|
|
49
52
|
continue;
|
|
50
53
|
}
|
|
51
54
|
var entries = parsed.value.entries;
|
|
52
|
-
var
|
|
53
|
-
return entry.timing.type
|
|
55
|
+
var fusedEntry = entries.find(function(entry) {
|
|
56
|
+
return entry.timing.type !== "css";
|
|
54
57
|
});
|
|
55
|
-
if (
|
|
56
|
-
state.
|
|
58
|
+
if (fusedEntry) {
|
|
59
|
+
state.fused = fusedEntry.timing;
|
|
57
60
|
state.lists.transitionProperty = listText(entries.map(function(entry) {
|
|
58
61
|
return entry.property;
|
|
59
62
|
}));
|
|
@@ -92,13 +95,13 @@ function alignTransitionContributions(contributions, presetNames) {
|
|
|
92
95
|
}]
|
|
93
96
|
};
|
|
94
97
|
}
|
|
95
|
-
if (state.
|
|
98
|
+
if (state.fused && timingLonghands.has(contribution.prop)) {
|
|
96
99
|
return {
|
|
97
100
|
ok: false,
|
|
98
101
|
diagnostics: [{
|
|
99
102
|
code: "transition-invalid-list",
|
|
100
103
|
token: contribution.prop,
|
|
101
|
-
message: `"${contribution.prop}" cannot partially override
|
|
104
|
+
message: `"${contribution.prop}" cannot partially override ${fusedLabel(state.fused)}: its timing is not decomposable into CSS components. restate \`transition\` with CSS timing, or change the ${state.fused.type}`
|
|
102
105
|
}]
|
|
103
106
|
};
|
|
104
107
|
}
|
|
@@ -127,18 +130,18 @@ function alignTransitionContributions(contributions, presetNames) {
|
|
|
127
130
|
}
|
|
128
131
|
};
|
|
129
132
|
}
|
|
130
|
-
if (state.
|
|
133
|
+
if (state.fused) {
|
|
131
134
|
var zipped = (0, import_transition.parseTransitionLonghands)({
|
|
132
135
|
transitionProperty: state.lists.transitionProperty,
|
|
133
136
|
transitionDelay: state.lists.transitionDelay,
|
|
134
137
|
transitionBehavior: state.lists.transitionBehavior
|
|
135
138
|
});
|
|
136
139
|
if (!zipped.ok || zipped.value.kind !== "transition") return zipped;
|
|
137
|
-
var
|
|
140
|
+
var fused = state.fused;
|
|
138
141
|
var entries1 = zipped.value.entries.map(function(entry) {
|
|
139
142
|
return {
|
|
140
143
|
...entry,
|
|
141
|
-
timing:
|
|
144
|
+
timing: fused
|
|
142
145
|
};
|
|
143
146
|
});
|
|
144
147
|
return {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"transitionAlign.native.js","names":[],"sources":["cjs/shorthands/transitionAlign.native.js"],"sourcesContent":["\"use strict\";\nvar __defProp = Object.defineProperty;\nvar __getOwnPropDesc = Object.getOwnPropertyDescriptor;\nvar __getOwnPropNames = Object.getOwnPropertyNames;\nvar __hasOwnProp = Object.prototype.hasOwnProperty;\nvar __export = (target, all) => {\n for (var name in all)\n __defProp(target, name, { get: all[name], enumerable: true });\n};\nvar __copyProps = (to, from, except, desc) => {\n if (from && typeof from === \"object\" || typeof from === \"function\") {\n for (let key of __getOwnPropNames(from))\n if (!__hasOwnProp.call(to, key) && key !== except)\n __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });\n }\n return to;\n};\nvar __toCommonJS = (mod) => __copyProps(__defProp({}, \"__esModule\", { value: true }), mod);\nvar transitionAlign_exports = {};\n__export(transitionAlign_exports, {\n alignTransitionContributions: () => alignTransitionContributions\n});\nmodule.exports = __toCommonJS(transitionAlign_exports);\nvar import_transition = require(\"./transition\");\nvar timingLonghands = /* @__PURE__ */ new Set([\n \"transitionDuration\",\n \"transitionTimingFunction\"\n]);\nfunction listText(values) {\n return values.join(\", \");\n}\nfunction alignTransitionContributions(contributions, presetNames) {\n var state = {\n global: null,\n
|
|
1
|
+
{"version":3,"file":"transitionAlign.native.js","names":[],"sources":["cjs/shorthands/transitionAlign.native.js"],"sourcesContent":["\"use strict\";\nvar __defProp = Object.defineProperty;\nvar __getOwnPropDesc = Object.getOwnPropertyDescriptor;\nvar __getOwnPropNames = Object.getOwnPropertyNames;\nvar __hasOwnProp = Object.prototype.hasOwnProperty;\nvar __export = (target, all) => {\n for (var name in all)\n __defProp(target, name, { get: all[name], enumerable: true });\n};\nvar __copyProps = (to, from, except, desc) => {\n if (from && typeof from === \"object\" || typeof from === \"function\") {\n for (let key of __getOwnPropNames(from))\n if (!__hasOwnProp.call(to, key) && key !== except)\n __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });\n }\n return to;\n};\nvar __toCommonJS = (mod) => __copyProps(__defProp({}, \"__esModule\", { value: true }), mod);\nvar transitionAlign_exports = {};\n__export(transitionAlign_exports, {\n alignTransitionContributions: () => alignTransitionContributions\n});\nmodule.exports = __toCommonJS(transitionAlign_exports);\nvar import_transition = require(\"./transition\");\nfunction fusedLabel(fused) {\n return fused.type === \"preset\" ? `\"${fused.name}\" preset` : `spring(${fused.duration}, ${fused.bounce})`;\n}\nvar timingLonghands = /* @__PURE__ */ new Set([\n \"transitionDuration\",\n \"transitionTimingFunction\"\n]);\nfunction listText(values) {\n return values.join(\", \");\n}\nfunction alignTransitionContributions(contributions, presetNames) {\n var state = {\n global: null,\n fused: null,\n lists: {}\n };\n var _iteratorNormalCompletion = true, _didIteratorError = false, _iteratorError = void 0;\n try {\n for (var _iterator = contributions[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) {\n var contribution = _step.value;\n if (contribution.prop === \"transition\") {\n var parsed = (0, import_transition.parseTransition)(contribution.value, presetNames);\n if (!parsed.ok) return parsed;\n state.global = null;\n state.fused = null;\n state.lists = {};\n if (parsed.value.kind === \"global\") {\n state.global = parsed.value.value;\n continue;\n }\n var entries = parsed.value.entries;\n var fusedEntry = entries.find(function(entry) {\n return entry.timing.type !== \"css\";\n });\n if (fusedEntry) {\n state.fused = fusedEntry.timing;\n state.lists.transitionProperty = listText(entries.map(function(entry) {\n return entry.property;\n }));\n state.lists.transitionDelay = listText(entries.map(function(entry) {\n return entry.delay;\n }));\n state.lists.transitionBehavior = listText(entries.map(function(entry) {\n return entry.behavior;\n }));\n continue;\n }\n state.lists.transitionProperty = listText(entries.map(function(entry) {\n return entry.property;\n }));\n state.lists.transitionDuration = listText(entries.map(function(entry) {\n return entry.timing.duration;\n }));\n state.lists.transitionTimingFunction = listText(entries.map(function(entry) {\n return entry.timing.timingFunction;\n }));\n state.lists.transitionDelay = listText(entries.map(function(entry) {\n return entry.delay;\n }));\n state.lists.transitionBehavior = listText(entries.map(function(entry) {\n return entry.behavior;\n }));\n continue;\n }\n if (state.global) {\n return {\n ok: false,\n diagnostics: [\n {\n code: \"transition-invalid-list\",\n token: contribution.prop,\n message: `\"${contribution.prop}\" cannot override the CSS-wide transition \"${state.global}\" per longhand; restate the whole transition`\n }\n ]\n };\n }\n if (state.fused && timingLonghands.has(contribution.prop)) {\n return {\n ok: false,\n diagnostics: [\n {\n code: \"transition-invalid-list\",\n token: contribution.prop,\n message: `\"${contribution.prop}\" cannot partially override ${fusedLabel(state.fused)}: its timing is not decomposable into CSS components. restate \\`transition\\` with CSS timing, or change the ${state.fused.type}`\n }\n ]\n };\n }\n state.lists[contribution.prop] = contribution.value;\n }\n } catch (err) {\n _didIteratorError = true;\n _iteratorError = err;\n } finally {\n try {\n if (!_iteratorNormalCompletion && _iterator.return != null) {\n _iterator.return();\n }\n } finally {\n if (_didIteratorError) {\n throw _iteratorError;\n }\n }\n }\n if (state.global) {\n return {\n ok: true,\n value: {\n kind: \"global\",\n value: state.global\n }\n };\n }\n if (state.fused) {\n var zipped = (0, import_transition.parseTransitionLonghands)({\n transitionProperty: state.lists.transitionProperty,\n transitionDelay: state.lists.transitionDelay,\n transitionBehavior: state.lists.transitionBehavior\n });\n if (!zipped.ok || zipped.value.kind !== \"transition\") return zipped;\n var fused = state.fused;\n var entries1 = zipped.value.entries.map(function(entry) {\n return {\n ...entry,\n timing: fused\n };\n });\n return {\n ok: true,\n value: {\n kind: \"transition\",\n entries: entries1\n }\n };\n }\n return (0, import_transition.parseTransitionLonghands)(state.lists);\n}\n//# sourceMappingURL=transitionAlign.js.map\n"],"mappings":"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"}
|
|
@@ -19,7 +19,10 @@ var __copyProps = (to, from, except, desc) => {
|
|
|
19
19
|
};
|
|
20
20
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
21
21
|
var transitionLegacy_exports = {};
|
|
22
|
-
__export(transitionLegacy_exports, {
|
|
22
|
+
__export(transitionLegacy_exports, {
|
|
23
|
+
migrateLegacyTransition: () => migrateLegacyTransition,
|
|
24
|
+
printMigratedTransition: () => printMigratedTransition
|
|
25
|
+
});
|
|
23
26
|
module.exports = __toCommonJS(transitionLegacy_exports);
|
|
24
27
|
var import_transition = require("./transition.cjs");
|
|
25
28
|
const legacyControlKeys = /* @__PURE__ */ new Set([
|
|
@@ -27,190 +30,324 @@ const legacyControlKeys = /* @__PURE__ */ new Set([
|
|
|
27
30
|
"enter",
|
|
28
31
|
"exit",
|
|
29
32
|
"delay",
|
|
33
|
+
"duration",
|
|
30
34
|
"stiffness",
|
|
31
35
|
"damping",
|
|
32
36
|
"mass",
|
|
33
|
-
"tension",
|
|
34
|
-
"friction",
|
|
35
37
|
"velocity",
|
|
36
38
|
"overshootClamping",
|
|
37
|
-
"
|
|
39
|
+
"restDisplacementThreshold",
|
|
40
|
+
"restSpeedThreshold",
|
|
41
|
+
"tension",
|
|
42
|
+
"friction",
|
|
38
43
|
"bounciness",
|
|
39
44
|
"speed"
|
|
40
45
|
]);
|
|
41
|
-
const
|
|
46
|
+
const springKeys = [
|
|
42
47
|
"stiffness",
|
|
43
48
|
"damping",
|
|
44
49
|
"mass",
|
|
45
|
-
"tension",
|
|
46
|
-
"friction",
|
|
47
50
|
"velocity",
|
|
48
51
|
"overshootClamping",
|
|
49
|
-
"
|
|
50
|
-
"
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
const
|
|
60
|
-
|
|
52
|
+
"restDisplacementThreshold",
|
|
53
|
+
"restSpeedThreshold"
|
|
54
|
+
];
|
|
55
|
+
function stiffnessFromOrigami(value) {
|
|
56
|
+
return (value - 30) * 3.62 + 194;
|
|
57
|
+
}
|
|
58
|
+
function dampingFromOrigami(value) {
|
|
59
|
+
return (value - 8) * 3 + 25;
|
|
60
|
+
}
|
|
61
|
+
function fromBouncinessAndSpeed(bounciness, speed) {
|
|
62
|
+
const normalize = (value, start, end) => (value - start) / (end - start);
|
|
63
|
+
const projectNormal = (n, start, end) => start + n * (end - start);
|
|
64
|
+
const linear = (t, start, end) => t * end + (1 - t) * start;
|
|
65
|
+
const quadraticOut = (t, start, end) => linear(2 * t - t * t, start, end);
|
|
66
|
+
const b3Nobounce = (tension) => {
|
|
67
|
+
if (tension <= 18) {
|
|
68
|
+
return 7e-4 * tension ** 3 - .031 * tension ** 2 + .64 * tension + 1.28;
|
|
69
|
+
}
|
|
70
|
+
if (tension <= 44) {
|
|
71
|
+
return 44e-6 * tension ** 3 - .006 * tension ** 2 + .36 * tension + 2;
|
|
72
|
+
}
|
|
73
|
+
return 45e-8 * tension ** 3 - 332e-6 * tension ** 2 + .1078 * tension + 5.84;
|
|
74
|
+
};
|
|
75
|
+
const b = projectNormal(normalize(bounciness / 1.7, 0, 20), 0, .8);
|
|
76
|
+
const s = normalize(speed / 1.7, 0, 20);
|
|
77
|
+
const bouncyTension = projectNormal(s, .5, 200);
|
|
78
|
+
const bouncyFriction = quadraticOut(b, b3Nobounce(bouncyTension), .01);
|
|
79
|
+
return {
|
|
80
|
+
stiffness: stiffnessFromOrigami(bouncyTension),
|
|
81
|
+
damping: dampingFromOrigami(bouncyFriction)
|
|
82
|
+
};
|
|
83
|
+
}
|
|
84
|
+
function round(value) {
|
|
85
|
+
return Math.round(value * 1e3) / 1e3;
|
|
86
|
+
}
|
|
87
|
+
function migrateSpring(options, label, diagnostics) {
|
|
88
|
+
const spring = {};
|
|
89
|
+
for (const key of springKeys) {
|
|
90
|
+
if (options[key] !== void 0) spring[key] = options[key];
|
|
91
|
+
}
|
|
92
|
+
const { tension, friction, bounciness, speed } = options;
|
|
93
|
+
if (tension !== void 0 || friction !== void 0) {
|
|
94
|
+
const converted = {
|
|
95
|
+
stiffness: stiffnessFromOrigami(tension ?? 40),
|
|
96
|
+
damping: dampingFromOrigami(friction ?? 7)
|
|
97
|
+
};
|
|
98
|
+
spring.stiffness = round(converted.stiffness);
|
|
99
|
+
spring.damping = round(converted.damping);
|
|
100
|
+
} else if (bounciness !== void 0 || speed !== void 0) {
|
|
101
|
+
const converted = fromBouncinessAndSpeed(bounciness ?? 8, speed ?? 12);
|
|
102
|
+
spring.stiffness = round(converted.stiffness);
|
|
103
|
+
spring.damping = round(converted.damping);
|
|
104
|
+
}
|
|
105
|
+
if (spring.damping !== void 0 && spring.stiffness === void 0) {
|
|
106
|
+
diagnostics.push({
|
|
107
|
+
code: "transition-invalid-spring",
|
|
108
|
+
token: label,
|
|
109
|
+
message: `${label}: damping without stiffness has no v3 spelling, give it a stiffness or a duration and bounce`
|
|
110
|
+
});
|
|
111
|
+
}
|
|
112
|
+
return Object.keys(spring).length ? spring : void 0;
|
|
113
|
+
}
|
|
114
|
+
function migrateDelay(value, diagnostics) {
|
|
115
|
+
if (value === void 0) return;
|
|
116
|
+
if (typeof value === "number" && Number.isFinite(value)) return value;
|
|
117
|
+
diagnostics.push({
|
|
118
|
+
code: "transition-invalid-token",
|
|
119
|
+
token: String(value),
|
|
120
|
+
message: "legacy transition delay must be a finite number of milliseconds"
|
|
121
|
+
});
|
|
122
|
+
return;
|
|
123
|
+
}
|
|
124
|
+
function stringToObject(value, label, presetNames, diagnostics) {
|
|
125
|
+
const parsed = (0, import_transition.parseTransition)(value, presetNames);
|
|
126
|
+
if (!parsed.ok) {
|
|
127
|
+
for (const diagnostic of parsed.diagnostics) {
|
|
128
|
+
diagnostics.push({
|
|
129
|
+
...diagnostic,
|
|
130
|
+
message: `${label}: ${diagnostic.message}`
|
|
131
|
+
});
|
|
132
|
+
}
|
|
133
|
+
return;
|
|
134
|
+
}
|
|
135
|
+
if (parsed.value.kind !== "transition" || parsed.value.entries.length !== 1) {
|
|
61
136
|
diagnostics.push({
|
|
62
137
|
code: "transition-invalid-token",
|
|
63
|
-
token:
|
|
64
|
-
message:
|
|
138
|
+
token: value,
|
|
139
|
+
message: `${label} must be a single preset or css timing value`
|
|
65
140
|
});
|
|
141
|
+
return;
|
|
66
142
|
}
|
|
67
|
-
const
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
143
|
+
const entry = parsed.value.entries[0];
|
|
144
|
+
if (entry.timing.type === "preset") return { preset: entry.timing.name };
|
|
145
|
+
if (entry.timing.type === "css") {
|
|
146
|
+
return entry.timing.timingFunction === "ease" ? { duration: entry.timing.duration } : {
|
|
147
|
+
duration: entry.timing.duration,
|
|
148
|
+
easing: entry.timing.timingFunction
|
|
149
|
+
};
|
|
150
|
+
}
|
|
151
|
+
diagnostics.push({
|
|
152
|
+
code: "transition-invalid-token",
|
|
153
|
+
token: value,
|
|
154
|
+
message: `${label} must be a single preset or css timing value`
|
|
155
|
+
});
|
|
156
|
+
return;
|
|
157
|
+
}
|
|
158
|
+
const baseTimingKeys = [
|
|
159
|
+
"preset",
|
|
160
|
+
"duration",
|
|
161
|
+
"bounce",
|
|
162
|
+
"easing",
|
|
163
|
+
"spring"
|
|
164
|
+
];
|
|
165
|
+
function applyAnimateOnly(value, animateOnly, presetNames, diagnostics) {
|
|
166
|
+
for (const state of ["enter", "exit"]) {
|
|
167
|
+
const nested = value[state];
|
|
168
|
+
if (typeof nested === "string") {
|
|
169
|
+
const asObject = stringToObject(nested, state, presetNames, diagnostics);
|
|
170
|
+
if (!asObject) continue;
|
|
171
|
+
applyAnimateOnly(asObject, animateOnly, presetNames, diagnostics);
|
|
172
|
+
value[state] = asObject;
|
|
173
|
+
} else if (nested && typeof nested === "object") {
|
|
174
|
+
applyAnimateOnly(nested, animateOnly, presetNames, diagnostics);
|
|
78
175
|
}
|
|
79
|
-
|
|
176
|
+
}
|
|
177
|
+
const allowed = new Set(animateOnly);
|
|
178
|
+
for (const key in value) {
|
|
179
|
+
if (TRANSITION_MIGRATION_RESERVED.has(key)) continue;
|
|
180
|
+
if (!allowed.has(key)) delete value[key];
|
|
181
|
+
}
|
|
182
|
+
if (baseTimingKeys.some((key) => value[key] !== void 0)) {
|
|
183
|
+
value.properties = animateOnly.join(", ");
|
|
184
|
+
}
|
|
185
|
+
}
|
|
186
|
+
const TRANSITION_MIGRATION_RESERVED = /* @__PURE__ */ new Set([
|
|
187
|
+
"preset",
|
|
188
|
+
"duration",
|
|
189
|
+
"bounce",
|
|
190
|
+
"easing",
|
|
191
|
+
"delay",
|
|
192
|
+
"behavior",
|
|
193
|
+
"properties",
|
|
194
|
+
"spring",
|
|
195
|
+
"enter",
|
|
196
|
+
"exit"
|
|
197
|
+
]);
|
|
198
|
+
function migrateLegacyTransition(input, presetNames, animateOnly) {
|
|
199
|
+
if (animateOnly?.length === 0) return {
|
|
200
|
+
ok: true,
|
|
201
|
+
value: "none"
|
|
202
|
+
};
|
|
203
|
+
if (typeof input === "string") {
|
|
204
|
+
if (!animateOnly) return {
|
|
205
|
+
ok: true,
|
|
206
|
+
value: input
|
|
207
|
+
};
|
|
208
|
+
const diagnostics2 = [];
|
|
209
|
+
const asObject = stringToObject(input, "transition", presetNames, diagnostics2);
|
|
210
|
+
if (!asObject) return {
|
|
211
|
+
ok: false,
|
|
212
|
+
diagnostics: diagnostics2
|
|
213
|
+
};
|
|
214
|
+
applyAnimateOnly(asObject, animateOnly, presetNames, diagnostics2);
|
|
215
|
+
if (diagnostics2.length) return {
|
|
216
|
+
ok: false,
|
|
217
|
+
diagnostics: diagnostics2
|
|
218
|
+
};
|
|
219
|
+
return {
|
|
220
|
+
ok: true,
|
|
221
|
+
value: asObject
|
|
222
|
+
};
|
|
223
|
+
}
|
|
224
|
+
const isTuple = Array.isArray(input);
|
|
225
|
+
const tuple = input;
|
|
226
|
+
const options = isTuple ? tuple[1] ?? {} : input;
|
|
227
|
+
const diagnostics = [];
|
|
228
|
+
const presetValue = isTuple ? tuple[0] : options.default;
|
|
229
|
+
let preset;
|
|
230
|
+
if (presetValue !== void 0) {
|
|
231
|
+
if (typeof presetValue === "string") preset = presetValue;
|
|
232
|
+
else {
|
|
80
233
|
diagnostics.push({
|
|
81
234
|
code: "transition-invalid-token",
|
|
82
|
-
token:
|
|
83
|
-
message:
|
|
235
|
+
token: String(presetValue),
|
|
236
|
+
message: "legacy transition default must be a preset or css timing value"
|
|
84
237
|
});
|
|
85
|
-
return;
|
|
86
238
|
}
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
239
|
+
}
|
|
240
|
+
const delay = migrateDelay(options.delay, diagnostics);
|
|
241
|
+
const spring = migrateSpring(options, "transition", diagnostics);
|
|
242
|
+
const value = {};
|
|
243
|
+
if (preset !== void 0) {
|
|
244
|
+
const asObject = presetNames.has(preset) ? { preset } : stringToObject(preset, "transition default", presetNames, diagnostics);
|
|
245
|
+
if (asObject) Object.assign(value, asObject);
|
|
246
|
+
}
|
|
247
|
+
if (options.duration !== void 0) {
|
|
248
|
+
if (value.duration !== void 0 && value.duration !== options.duration) {
|
|
94
249
|
diagnostics.push({
|
|
95
|
-
code: "transition-invalid-
|
|
96
|
-
token: String(
|
|
97
|
-
message: "
|
|
250
|
+
code: "transition-invalid-duration",
|
|
251
|
+
token: String(options.duration),
|
|
252
|
+
message: `transition sets both a "${value.duration}" timing and duration ${options.duration}; keep the one you meant`
|
|
98
253
|
});
|
|
99
254
|
}
|
|
255
|
+
value.duration = options.duration;
|
|
100
256
|
}
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
token: String(rawValue),
|
|
108
|
-
message: `legacy transition ${field} must be a preset or CSS timing value`
|
|
109
|
-
});
|
|
110
|
-
return;
|
|
111
|
-
};
|
|
112
|
-
const enter = resolveLifecycle("enter");
|
|
113
|
-
const exit = resolveLifecycle("exit");
|
|
114
|
-
const config = {};
|
|
115
|
-
for (const key of springConfigKeys) {
|
|
116
|
-
if (options[key] !== void 0) config[key] = options[key];
|
|
117
|
-
}
|
|
118
|
-
const hasConfig = Object.keys(config).length > 0;
|
|
119
|
-
const entries = [];
|
|
120
|
-
if (defaultTransition) {
|
|
121
|
-
if (defaultTransition.timing.type === "css" && hasConfig) {
|
|
257
|
+
if (delay !== void 0) value.delay = delay;
|
|
258
|
+
if (spring) value.spring = spring;
|
|
259
|
+
for (const state of ["enter", "exit"]) {
|
|
260
|
+
const raw = options[state];
|
|
261
|
+
if (raw === void 0) continue;
|
|
262
|
+
if (typeof raw !== "string") {
|
|
122
263
|
diagnostics.push({
|
|
123
264
|
code: "transition-invalid-token",
|
|
124
|
-
token: String(
|
|
125
|
-
message:
|
|
265
|
+
token: String(raw),
|
|
266
|
+
message: `legacy transition ${state} must be a preset or css timing value`
|
|
126
267
|
});
|
|
268
|
+
continue;
|
|
127
269
|
}
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
270
|
+
if (delay === void 0) {
|
|
271
|
+
value[state] = raw;
|
|
272
|
+
continue;
|
|
273
|
+
}
|
|
274
|
+
const asObject = stringToObject(raw, `legacy transition ${state}`, presetNames, diagnostics);
|
|
275
|
+
if (asObject) value[state] = {
|
|
276
|
+
...asObject,
|
|
277
|
+
delay
|
|
278
|
+
};
|
|
136
279
|
}
|
|
137
|
-
for (const [property,
|
|
280
|
+
for (const [property, raw] of Object.entries(options)) {
|
|
138
281
|
if (legacyControlKeys.has(property)) continue;
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
transition = resolveTiming(rawValue, property);
|
|
143
|
-
if (!transition) continue;
|
|
144
|
-
} else if (rawValue && typeof rawValue === "object" && !Array.isArray(rawValue)) {
|
|
145
|
-
propertyConfig = rawValue;
|
|
146
|
-
if (propertyConfig.type === void 0) {
|
|
147
|
-
transition = defaultTransition;
|
|
148
|
-
} else if (typeof propertyConfig.type === "string") {
|
|
149
|
-
transition = resolveTiming(propertyConfig.type, property);
|
|
150
|
-
if (!transition) continue;
|
|
151
|
-
} else {
|
|
152
|
-
diagnostics.push({
|
|
153
|
-
code: "transition-invalid-token",
|
|
154
|
-
token: property,
|
|
155
|
-
message: `legacy transition property "${property}" has a non-string type`
|
|
156
|
-
});
|
|
282
|
+
if (typeof raw === "string") {
|
|
283
|
+
if (delay === void 0) {
|
|
284
|
+
value[property] = raw;
|
|
157
285
|
continue;
|
|
158
286
|
}
|
|
159
|
-
|
|
287
|
+
const asObject2 = stringToObject(raw, `transition ${property}`, presetNames, diagnostics);
|
|
288
|
+
if (asObject2) value[property] = {
|
|
289
|
+
...asObject2,
|
|
290
|
+
delay
|
|
291
|
+
};
|
|
292
|
+
continue;
|
|
293
|
+
}
|
|
294
|
+
if (!raw || typeof raw !== "object" || Array.isArray(raw)) {
|
|
160
295
|
diagnostics.push({
|
|
161
296
|
code: "transition-invalid-token",
|
|
162
297
|
token: property,
|
|
163
|
-
message: `legacy transition property "${property}" needs a preset,
|
|
298
|
+
message: `legacy transition property "${property}" needs a preset, css timing value, or default`
|
|
164
299
|
});
|
|
165
300
|
continue;
|
|
166
301
|
}
|
|
167
|
-
|
|
302
|
+
const config = raw;
|
|
303
|
+
const entry = {};
|
|
304
|
+
const propertyPreset = config.type === void 0 ? preset : config.type;
|
|
305
|
+
if (propertyPreset === void 0) {
|
|
168
306
|
diagnostics.push({
|
|
169
307
|
code: "transition-invalid-token",
|
|
170
308
|
token: property,
|
|
171
|
-
message: `legacy transition property "${property}" needs a preset,
|
|
309
|
+
message: `legacy transition property "${property}" needs a preset, css timing value, or default`
|
|
172
310
|
});
|
|
173
311
|
continue;
|
|
174
312
|
}
|
|
175
|
-
|
|
176
|
-
const hasPropertyOverrides = propertyOverrides !== void 0 && Object.keys(propertyOverrides).length > 0;
|
|
177
|
-
if (hasPropertyOverrides && transition.timing.type === "css") {
|
|
313
|
+
if (typeof propertyPreset !== "string") {
|
|
178
314
|
diagnostics.push({
|
|
179
315
|
code: "transition-invalid-token",
|
|
180
316
|
token: property,
|
|
181
|
-
message: `legacy transition property "${property}"
|
|
317
|
+
message: `legacy transition property "${property}" has a non-string type`
|
|
182
318
|
});
|
|
183
319
|
continue;
|
|
184
320
|
}
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
321
|
+
const asObject = presetNames.has(propertyPreset) ? { preset: propertyPreset } : stringToObject(propertyPreset, `transition ${property}`, presetNames, diagnostics);
|
|
322
|
+
if (!asObject) continue;
|
|
323
|
+
Object.assign(entry, asObject);
|
|
324
|
+
if (config.duration !== void 0) entry.duration = config.duration;
|
|
325
|
+
const propertyDelay = migrateDelay(config.delay, diagnostics) ?? delay;
|
|
326
|
+
if (propertyDelay !== void 0) entry.delay = propertyDelay;
|
|
327
|
+
const propertySpring = migrateSpring(config, `transition ${property}`, diagnostics);
|
|
328
|
+
if (propertySpring) entry.spring = propertySpring;
|
|
329
|
+
value[property] = entry;
|
|
194
330
|
}
|
|
331
|
+
if (animateOnly) applyAnimateOnly(value, animateOnly, presetNames, diagnostics);
|
|
195
332
|
if (diagnostics.length) return {
|
|
196
333
|
ok: false,
|
|
197
334
|
diagnostics
|
|
198
335
|
};
|
|
199
|
-
const value = {
|
|
200
|
-
kind: "transition",
|
|
201
|
-
entries,
|
|
202
|
-
...enter ? { enter: {
|
|
203
|
-
...enter,
|
|
204
|
-
delay: delay ?? enter.delay
|
|
205
|
-
} } : {},
|
|
206
|
-
...exit ? { exit: {
|
|
207
|
-
...exit,
|
|
208
|
-
delay: delay ?? exit.delay
|
|
209
|
-
} } : {},
|
|
210
|
-
...hasConfig ? { config } : {}
|
|
211
|
-
};
|
|
212
336
|
return {
|
|
213
337
|
ok: true,
|
|
214
338
|
value
|
|
215
339
|
};
|
|
216
340
|
}
|
|
341
|
+
const identifierPattern = /^[A-Za-z_$][A-Za-z0-9_$]*$/;
|
|
342
|
+
function quote(value) {
|
|
343
|
+
return `'${value.replace(/\\/g, "\\\\").replace(/'/g, "\\'")}'`;
|
|
344
|
+
}
|
|
345
|
+
function printMigratedTransition(value) {
|
|
346
|
+
if (typeof value === "string") return quote(value);
|
|
347
|
+
const parts = [];
|
|
348
|
+
for (const [key, entry] of Object.entries(value)) {
|
|
349
|
+
const name = identifierPattern.test(key) ? key : quote(key);
|
|
350
|
+
parts.push(`${name}: ${typeof entry === "string" ? quote(entry) : entry !== null && typeof entry === "object" ? printMigratedTransition(entry) : String(entry)}`);
|
|
351
|
+
}
|
|
352
|
+
return `{ ${parts.join(", ")} }`;
|
|
353
|
+
}
|