@tamagui/animations-css 3.0.0-beta.765.1 → 3.0.0-beta.804.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/createAnimations.cjs +2 -2
- package/dist/cjs/createAnimations.native.cjs +2 -2
- package/dist/cjs/createAnimations.native.js +2 -2
- package/dist/cjs/createAnimations.native.js.map +1 -1
- package/dist/esm/createAnimations.mjs +1 -1
- package/dist/esm/createAnimations.mjs.map +1 -1
- package/dist/esm/createAnimations.native.js +1 -1
- package/dist/esm/createAnimations.native.js.map +1 -1
- package/package.json +7 -7
- package/src/createAnimations.tsx +1 -1
- package/types/createAnimations.d.ts.map +1 -1
|
@@ -30,7 +30,7 @@ module.exports = __toCommonJS(createAnimations_exports);
|
|
|
30
30
|
var import_animation_helpers = require("@tamagui/animation-helpers");
|
|
31
31
|
var import_constants = require("@tamagui/constants");
|
|
32
32
|
var import_use_presence = require("@tamagui/use-presence");
|
|
33
|
-
var
|
|
33
|
+
var import_internal_runtime = require("@tamagui/web/internal-runtime");
|
|
34
34
|
var import_react = __toESM(require("react"), 1);
|
|
35
35
|
const hasRAF = typeof requestAnimationFrame !== "undefined";
|
|
36
36
|
function waitForAnimations(node) {
|
|
@@ -354,7 +354,7 @@ function createAnimations(animations) {
|
|
|
354
354
|
return null;
|
|
355
355
|
}
|
|
356
356
|
if (Array.isArray(style.transform)) {
|
|
357
|
-
style.transform = (0,
|
|
357
|
+
style.transform = (0, import_internal_runtime.transformsToString)(style.transform);
|
|
358
358
|
}
|
|
359
359
|
style.transition = getTransition();
|
|
360
360
|
if (process.env.NODE_ENV === "development" && props["debug"] === "verbose") {
|
|
@@ -32,7 +32,7 @@ module.exports = __toCommonJS(createAnimations_exports);
|
|
|
32
32
|
var import_animation_helpers = require("@tamagui/animation-helpers");
|
|
33
33
|
var import_constants = require("@tamagui/constants");
|
|
34
34
|
var import_use_presence = require("@tamagui/use-presence");
|
|
35
|
-
var
|
|
35
|
+
var import_internal_runtime = require("@tamagui/web/internal-runtime");
|
|
36
36
|
var import_react = __toESM(require("react"), 1);
|
|
37
37
|
var hasRAF = typeof requestAnimationFrame !== "undefined";
|
|
38
38
|
function waitForAnimations(node) {
|
|
@@ -443,7 +443,7 @@ function createAnimations(animations) {
|
|
|
443
443
|
return null;
|
|
444
444
|
}
|
|
445
445
|
if (Array.isArray(style.transform)) {
|
|
446
|
-
style.transform = (0,
|
|
446
|
+
style.transform = (0, import_internal_runtime.transformsToString)(style.transform);
|
|
447
447
|
}
|
|
448
448
|
style.transition = getTransition();
|
|
449
449
|
if (process.env.NODE_ENV === "development" && props["debug"] === "verbose") {
|
|
@@ -32,7 +32,7 @@ module.exports = __toCommonJS(createAnimations_exports);
|
|
|
32
32
|
var import_animation_helpers = require("@tamagui/animation-helpers");
|
|
33
33
|
var import_constants = require("@tamagui/constants");
|
|
34
34
|
var import_use_presence = require("@tamagui/use-presence");
|
|
35
|
-
var
|
|
35
|
+
var import_internal_runtime = require("@tamagui/web/internal-runtime");
|
|
36
36
|
var import_react = __toESM(require("react"), 1);
|
|
37
37
|
var hasRAF = typeof requestAnimationFrame !== "undefined";
|
|
38
38
|
function waitForAnimations(node) {
|
|
@@ -443,7 +443,7 @@ function createAnimations(animations) {
|
|
|
443
443
|
return null;
|
|
444
444
|
}
|
|
445
445
|
if (Array.isArray(style.transform)) {
|
|
446
|
-
style.transform = (0,
|
|
446
|
+
style.transform = (0, import_internal_runtime.transformsToString)(style.transform);
|
|
447
447
|
}
|
|
448
448
|
style.transition = getTransition();
|
|
449
449
|
if (process.env.NODE_ENV === "development" && props["debug"] === "verbose") {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"createAnimations.native.js","names":[],"sources":["cjs/createAnimations.native.js"],"sourcesContent":["\"use strict\";\nvar __create = Object.create;\nvar __defProp = Object.defineProperty;\nvar __getOwnPropDesc = Object.getOwnPropertyDescriptor;\nvar __getOwnPropNames = Object.getOwnPropertyNames;\nvar __getProtoOf = Object.getPrototypeOf;\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 __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(\n // If the importer is in node compatibility mode or this is not an ESM\n // file that has been converted to a CommonJS file using a Babel-\n // compatible transform (i.e. \"__esModule\" has not been set), then set\n // \"default\" to the CommonJS \"module.exports\" for node compatibility.\n isNodeMode || !mod || !mod.__esModule ? __defProp(target, \"default\", { value: mod, enumerable: true }) : target,\n mod\n));\nvar __toCommonJS = (mod) => __copyProps(__defProp({}, \"__esModule\", { value: true }), mod);\nvar createAnimations_exports = {};\n__export(createAnimations_exports, {\n createAnimations: () => createAnimations\n});\nmodule.exports = __toCommonJS(createAnimations_exports);\nvar import_animation_helpers = require(\"@tamagui/animation-helpers\");\nvar import_constants = require(\"@tamagui/constants\");\nvar import_use_presence = require(\"@tamagui/use-presence\");\nvar import_web = require(\"@tamagui/web\");\nvar import_react = __toESM(require(\"react\"), 1);\nvar hasRAF = typeof requestAnimationFrame !== \"undefined\";\nfunction waitForAnimations(node) {\n if (typeof node.getAnimations !== \"function\") {\n return Promise.resolve(true);\n }\n return new Promise(function(resolve) {\n var check = function() {\n var animations = node.getAnimations();\n if (animations.length === 0) {\n resolve(true);\n return;\n }\n Promise.all(animations.map(function(a) {\n return a.finished;\n })).then(function() {\n return resolve(true);\n }).catch(function() {\n var remaining = node.getAnimations();\n if (remaining.some(function(a) {\n return a.playState === \"running\" || a.pending;\n })) {\n check();\n return;\n }\n resolve(false);\n });\n };\n if (hasRAF) {\n requestAnimationFrame(check);\n } else {\n check();\n }\n });\n}\nvar DURATION_REGEX = /(\\d+(?:\\.\\d+)?)\\s*(?:ms|s(?!tiffness))/;\nfunction applyDurationOverride(animation, durationMs) {\n var replaced = animation.replace(DURATION_REGEX, `${durationMs}ms`);\n return replaced === animation ? `${durationMs}ms ${animation}` : replaced;\n}\nvar CSS_TRANSFORM_PROPERTIES = {\n transform: [\n \"translate\",\n \"scale\",\n \"rotate\",\n \"transform\"\n ],\n x: [\n \"translate\"\n ],\n y: [\n \"translate\"\n ],\n scale: [\n \"scale\"\n ],\n scaleX: [\n \"scale\"\n ],\n scaleY: [\n \"scale\"\n ],\n rotate: [\n \"rotate\"\n ],\n rotateX: [\n \"transform\"\n ],\n rotateY: [\n \"transform\"\n ],\n rotateZ: [\n \"transform\"\n ],\n skewX: [\n \"transform\"\n ],\n skewY: [\n \"transform\"\n ]\n};\nvar getCSSProperties = function(key) {\n return CSS_TRANSFORM_PROPERTIES[key] || [\n key\n ];\n};\nvar hyphenatedPropertyCache = {};\nvar emptyProperties = [];\nfunction hyphenateProperty(property) {\n var _hyphenatedPropertyCache, _property;\n if (property.startsWith(\"--\")) return property;\n return (_hyphenatedPropertyCache = hyphenatedPropertyCache)[_property = property] || (_hyphenatedPropertyCache[_property] = property.replace(/[A-Z]/g, function(letter) {\n return `-${letter.toLowerCase()}`;\n }));\n}\nfunction getLifecycleCSSProperties(keys) {\n if (!(keys === null || keys === void 0 ? void 0 : keys.size)) return emptyProperties;\n var properties = /* @__PURE__ */ new Set();\n var _iteratorNormalCompletion = true, _didIteratorError = false, _iteratorError = void 0;\n try {\n for (var _iterator = keys[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) {\n var key = _step.value;\n var _iteratorNormalCompletion1 = true, _didIteratorError1 = false, _iteratorError1 = void 0;\n try {\n for (var _iterator1 = getCSSProperties(key)[Symbol.iterator](), _step1; !(_iteratorNormalCompletion1 = (_step1 = _iterator1.next()).done); _iteratorNormalCompletion1 = true) {\n var property = _step1.value;\n properties.add(hyphenateProperty(property));\n }\n } catch (err) {\n _didIteratorError1 = true;\n _iteratorError1 = err;\n } finally {\n try {\n if (!_iteratorNormalCompletion1 && _iterator1.return != null) {\n _iterator1.return();\n }\n } finally {\n if (_didIteratorError1) {\n throw _iteratorError1;\n }\n }\n }\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 return [\n ...properties\n ].sort();\n}\nfunction readComputedProperties(node, properties) {\n var computed = getComputedStyle(node);\n var values = {};\n var _iteratorNormalCompletion = true, _didIteratorError = false, _iteratorError = void 0;\n try {\n for (var _iterator = properties[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) {\n var property = _step.value;\n var value = computed.getPropertyValue(property);\n if (value) values[property] = 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 return values;\n}\nfunction applyCSSProperties(node, values) {\n for (var property in values) {\n node.style.setProperty(property, values[property]);\n }\n}\nfunction clearCSSProperties(node, properties) {\n var _iteratorNormalCompletion = true, _didIteratorError = false, _iteratorError = void 0;\n try {\n for (var _iterator = properties[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) {\n var property = _step.value;\n node.style.removeProperty(property);\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}\nfunction createAnimations(animations) {\n return {\n animations,\n usePresence: import_use_presence.usePresence,\n ResetPresence: import_use_presence.ResetPresence,\n inputStyle: \"css\",\n outputStyle: \"css\",\n // @ts-ignore - styleState is added by createComponent\n useAnimations: function(param) {\n var { props, presence, style, componentState, stateRef, styleState, onTransition } = param;\n var _styleState_programLifecycleStyleKeys;\n var isHydrating = componentState.unmounted === true;\n var isEntering = !!componentState.unmounted;\n var isExiting = (presence === null || presence === void 0 ? void 0 : presence[0]) === false;\n var sendExitComplete = presence === null || presence === void 0 ? void 0 : presence[1];\n var onTransitionRef = import_react.default.useRef(onTransition);\n onTransitionRef.current = onTransition;\n var emit = function(phase, cause, finished) {\n var _onTransitionRef_current;\n (_onTransitionRef_current = onTransitionRef.current) === null || _onTransitionRef_current === void 0 ? void 0 : _onTransitionRef_current.call(onTransitionRef, phase === \"end\" ? {\n phase,\n cause,\n finished\n } : {\n phase,\n cause\n });\n };\n var wasEnteringRef = import_react.default.useRef(isEntering);\n var justFinishedEntering = wasEnteringRef.current && !isEntering;\n import_react.default.useEffect(function() {\n wasEnteringRef.current = isEntering;\n });\n var exitCycleIdRef = import_react.default.useRef(0);\n var exitCompletedRef = import_react.default.useRef(false);\n var wasExitingRef = import_react.default.useRef(false);\n var sendExitCompleteRef = import_react.default.useRef(sendExitComplete);\n var lastMountedStyleRef = import_react.default.useRef({});\n sendExitCompleteRef.current = sendExitComplete;\n var exitCSSProperties = getLifecycleCSSProperties(styleState === null || styleState === void 0 ? void 0 : (_styleState_programLifecycleStyleKeys = styleState.programLifecycleStyleKeys) === null || _styleState_programLifecycleStyleKeys === void 0 ? void 0 : _styleState_programLifecycleStyleKeys.exit);\n var exitCSSPropertiesSignature = exitCSSProperties.join(\"\\0\");\n var enterCycleIdRef = import_react.default.useRef(0);\n var enterStartedRef = import_react.default.useRef(false);\n var updateCycleIdRef = import_react.default.useRef(0);\n var updateInFlightRef = import_react.default.useRef(false);\n var prevUpdateSigRef = import_react.default.useRef(null);\n var exitStartedRef = import_react.default.useRef(false);\n var justStartedExiting = isExiting && !wasExitingRef.current;\n var justStoppedExiting = !isExiting && wasExitingRef.current;\n if (justStartedExiting) {\n exitCycleIdRef.current++;\n exitCompletedRef.current = false;\n }\n if (justStoppedExiting) {\n exitCycleIdRef.current++;\n }\n import_react.default.useEffect(function() {\n wasExitingRef.current = isExiting;\n });\n (0, import_constants.useIsomorphicLayoutEffect)(function() {\n if (isExiting) return;\n var host = stateRef.current.host;\n if (!host || !exitCSSProperties.length) {\n lastMountedStyleRef.current = {};\n return;\n }\n var node = host;\n var capture = function() {\n if (stateRef.current.host !== node || wasExitingRef.current) return;\n lastMountedStyleRef.current = readComputedProperties(node, exitCSSProperties);\n };\n if (justFinishedEntering) {\n void waitForAnimations(node).then(capture);\n } else {\n capture();\n }\n }, [\n isExiting,\n justFinishedEntering,\n exitCSSPropertiesSignature\n ]);\n var _styleState_effectiveTransition;\n var effectiveTransition = (_styleState_effectiveTransition = styleState === null || styleState === void 0 ? void 0 : styleState.effectiveTransition) !== null && _styleState_effectiveTransition !== void 0 ? _styleState_effectiveTransition : props.transition;\n var normalized = (0, import_animation_helpers.normalizeTransition)(effectiveTransition);\n var animationState = isExiting ? \"exit\" : isEntering || justFinishedEntering ? \"enter\" : \"default\";\n var effectiveAnimationKey = (0, import_animation_helpers.getEffectiveAnimation)(normalized, animationState);\n var defaultAnimation = effectiveAnimationKey ? animations[effectiveAnimationKey] : null;\n var animatedProperties = (0, import_animation_helpers.getAnimatedProperties)(normalized);\n var hasDefault = normalized.default !== null || normalized.enter !== null || normalized.exit !== null;\n var hasPerPropertyConfigs = animatedProperties.length > 0;\n var keys;\n if (props.animateOnly) {\n keys = props.animateOnly;\n } else if (hasPerPropertyConfigs && !hasDefault) {\n keys = animatedProperties;\n } else if (hasPerPropertyConfigs && hasDefault) {\n keys = [\n \"all\",\n ...animatedProperties\n ];\n } else {\n keys = [\n \"all\"\n ];\n }\n var transition;\n var getTransition = function() {\n var _normalized_config;\n if (transition !== void 0) return transition;\n var delay = normalized.delay ? ` ${normalized.delay}ms` : \"\";\n var duration = (_normalized_config = normalized.config) === null || _normalized_config === void 0 ? void 0 : _normalized_config.duration;\n transition = keys.flatMap(function(key) {\n var propertyAnimation = normalized.properties[key];\n var animation = defaultAnimation;\n if (typeof propertyAnimation === \"string\") {\n animation = animations[propertyAnimation];\n } else if (propertyAnimation === null || propertyAnimation === void 0 ? void 0 : propertyAnimation.type) {\n animation = animations[propertyAnimation.type];\n }\n if (animation && duration) {\n animation = applyDurationOverride(animation, duration);\n }\n return animation ? getCSSProperties(key).map(function(property) {\n return `${property} ${animation}${delay}`;\n }) : [];\n }).join(\", \");\n return transition;\n };\n (0, import_constants.useIsomorphicLayoutEffect)(function() {\n var host = stateRef.current.host;\n if (!sendExitComplete || !isExiting || !host) return;\n var node = host;\n var cycleId = exitCycleIdRef.current;\n if (!exitStartedRef.current) {\n exitStartedRef.current = true;\n emit(\"start\", \"exit\");\n }\n var completeExit = function() {\n var finished = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : true;\n var _sendExitCompleteRef_current;\n if (cycleId !== exitCycleIdRef.current) return;\n if (exitCompletedRef.current) return;\n exitCompletedRef.current = true;\n if (exitStartedRef.current) {\n exitStartedRef.current = false;\n emit(\"end\", \"exit\", finished);\n }\n (_sendExitCompleteRef_current = sendExitCompleteRef.current) === null || _sendExitCompleteRef_current === void 0 ? void 0 : _sendExitCompleteRef_current.call(sendExitCompleteRef);\n };\n if (keys.length === 0) {\n completeExit();\n return;\n }\n var rafId;\n var disposed = false;\n var mountedStyle = lastMountedStyleRef.current;\n var canRestart = exitCSSProperties.length > 0 && Object.keys(mountedStyle).length > 0;\n var exitTarget;\n if (canRestart) {\n node.style.transition = \"none\";\n exitTarget = readComputedProperties(node, exitCSSProperties);\n applyCSSProperties(node, mountedStyle);\n void node.offsetHeight;\n rafId = requestAnimationFrame(function() {\n if (cycleId !== exitCycleIdRef.current) return;\n node.style.transition = getTransition();\n void node.offsetHeight;\n applyCSSProperties(node, exitTarget);\n });\n }\n void waitForAnimations(node).then(function(finished) {\n if (!disposed) completeExit(finished);\n });\n return function() {\n disposed = true;\n if (rafId !== void 0) cancelAnimationFrame(rafId);\n clearCSSProperties(node, exitCSSProperties);\n node.style.transition = \"\";\n };\n }, [\n isExiting,\n exitCSSPropertiesSignature\n ]);\n var styleSignature = onTransition ? (function() {\n var { transition: _t, ...rest } = style;\n var _styleState_classNames;\n return `${JSON.stringify((_styleState_classNames = styleState === null || styleState === void 0 ? void 0 : styleState.classNames) !== null && _styleState_classNames !== void 0 ? _styleState_classNames : null)}|${JSON.stringify(rest)}`;\n })() : \"\";\n (0, import_constants.useIsomorphicLayoutEffect)(function() {\n var host = stateRef.current.host;\n if (!onTransitionRef.current || isExiting || !justFinishedEntering || !host) {\n return;\n }\n var node = host;\n var cycleId = ++enterCycleIdRef.current;\n enterStartedRef.current = true;\n emit(\"start\", \"enter\");\n void waitForAnimations(node).then(function(finished) {\n if (cycleId !== enterCycleIdRef.current || !enterStartedRef.current) return;\n enterStartedRef.current = false;\n emit(\"end\", \"enter\", finished);\n });\n }, [\n justFinishedEntering,\n isExiting\n ]);\n (0, import_constants.useIsomorphicLayoutEffect)(function() {\n var host = stateRef.current.host;\n if (!onTransitionRef.current || isEntering || justFinishedEntering || isExiting || !host) {\n prevUpdateSigRef.current = styleSignature;\n return;\n }\n if (prevUpdateSigRef.current === null) {\n prevUpdateSigRef.current = styleSignature;\n return;\n }\n if (styleSignature === prevUpdateSigRef.current) return;\n prevUpdateSigRef.current = styleSignature;\n var node = host;\n if (updateInFlightRef.current) {\n emit(\"end\", \"update\", false);\n }\n updateInFlightRef.current = true;\n var cycleId = ++updateCycleIdRef.current;\n emit(\"start\", \"update\");\n void waitForAnimations(node).then(function(finished) {\n if (cycleId !== updateCycleIdRef.current) return;\n updateInFlightRef.current = false;\n emit(\"end\", \"update\", finished);\n });\n }, [\n styleSignature,\n isEntering,\n justFinishedEntering,\n isExiting\n ]);\n (0, import_constants.useIsomorphicLayoutEffect)(function() {\n if (justStartedExiting && enterStartedRef.current) {\n enterCycleIdRef.current++;\n enterStartedRef.current = false;\n emit(\"end\", \"enter\", false);\n }\n if (justStoppedExiting && exitStartedRef.current && !exitCompletedRef.current) {\n exitStartedRef.current = false;\n emit(\"end\", \"exit\", false);\n }\n }, [\n justStartedExiting,\n justStoppedExiting\n ]);\n if (isHydrating) {\n return null;\n }\n if (!(0, import_animation_helpers.hasAnimation)(normalized)) {\n return null;\n }\n if (Array.isArray(style.transform)) {\n style.transform = (0, import_web.transformsToString)(style.transform);\n }\n style.transition = getTransition();\n if (process.env.NODE_ENV === \"development\" && props[\"debug\"] === \"verbose\") {\n console.info(\"CSS animation\", {\n props,\n animations,\n normalized,\n defaultAnimation,\n style,\n isEntering,\n isExiting\n });\n }\n return {\n style,\n className: isEntering ? \"t_unmounted\" : \"\"\n };\n }\n };\n}\n//# sourceMappingURL=createAnimations.js.map\n"],"mappings":";;;AACA,IAAI,WAAW,OAAO;AACtB,IAAI,YAAY,OAAO;AACvB,IAAI,mBAAmB,OAAO;AAC9B,IAAI,oBAAoB,OAAO;AAC/B,IAAI,eAAe,OAAO;AAC1B,IAAI,eAAe,OAAO,UAAU;AACpC,IAAI,YAAY,QAAQ,QAAQ;CAC9B,KAAK,IAAI,QAAQ,KACf,UAAU,QAAQ,MAAM;EAAE,KAAK,IAAI;EAAO,YAAY;CAAK,CAAC;AAChE;AACA,IAAI,eAAe,IAAI,MAAM,QAAQ,SAAS;CAC5C,IAAI,QAAQ,OAAO,SAAS,YAAY,OAAO,SAAS,YAAY;EAClE,KAAK,IAAI,OAAO,kBAAkB,IAAI,GACpC,IAAI,CAAC,aAAa,KAAK,IAAI,GAAG,KAAK,QAAQ,QACzC,UAAU,IAAI,KAAK;GAAE,WAAW,KAAK;GAAM,YAAY,EAAE,OAAO,iBAAiB,MAAM,GAAG,MAAM,KAAK;EAAW,CAAC;CACvH;CACA,OAAO;AACT;AACA,IAAI,WAAW,KAAK,YAAY,YAAY,SAAS,OAAO,O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G,CACD,oBACA,kBACF,CAAC;GACD,IAAI,aAAa;IACf,OAAO;GACT;GACA,IAAI,EAAE,GAAG,yBAAyB,aAAY,CAAE,UAAU,GAAG;IAC3D,OAAO;GACT;GACA,IAAI,MAAM,QAAQ,MAAM,SAAS,GAAG;IAClC,MAAM,aAAa,GAAG,WAAW,mBAAkB,CAAE,MAAM,SAAS;GACtE;GACA,MAAM,aAAa,cAAc;GACjC,IAAI,QAAQ,IAAI,aAAa,iBAAiB,MAAM,aAAa,WAAW;IAC1E,QAAQ,KAAK,iBAAiB;KAC5B;KACA;KACA;KACA;KACA;KACA;KACA;IACF,CAAC;GACH;GACA,OAAO;IACL;IACA,WAAW,aAAa,gBAAgB;GAC1C;EACF;CACF;AACF"}
|
|
1
|
+
{"version":3,"file":"createAnimations.native.js","names":[],"sources":["cjs/createAnimations.native.js"],"sourcesContent":["\"use strict\";\nvar __create = Object.create;\nvar __defProp = Object.defineProperty;\nvar __getOwnPropDesc = Object.getOwnPropertyDescriptor;\nvar __getOwnPropNames = Object.getOwnPropertyNames;\nvar __getProtoOf = Object.getPrototypeOf;\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 __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(\n // If the importer is in node compatibility mode or this is not an ESM\n // file that has been converted to a CommonJS file using a Babel-\n // compatible transform (i.e. \"__esModule\" has not been set), then set\n // \"default\" to the CommonJS \"module.exports\" for node compatibility.\n isNodeMode || !mod || !mod.__esModule ? __defProp(target, \"default\", { value: mod, enumerable: true }) : target,\n mod\n));\nvar __toCommonJS = (mod) => __copyProps(__defProp({}, \"__esModule\", { value: true }), mod);\nvar createAnimations_exports = {};\n__export(createAnimations_exports, {\n createAnimations: () => createAnimations\n});\nmodule.exports = __toCommonJS(createAnimations_exports);\nvar import_animation_helpers = require(\"@tamagui/animation-helpers\");\nvar import_constants = require(\"@tamagui/constants\");\nvar import_use_presence = require(\"@tamagui/use-presence\");\nvar import_internal_runtime = require(\"@tamagui/web/internal-runtime\");\nvar import_react = __toESM(require(\"react\"), 1);\nvar hasRAF = typeof requestAnimationFrame !== \"undefined\";\nfunction waitForAnimations(node) {\n if (typeof node.getAnimations !== \"function\") {\n return Promise.resolve(true);\n }\n return new Promise(function(resolve) {\n var check = function() {\n var animations = node.getAnimations();\n if (animations.length === 0) {\n resolve(true);\n return;\n }\n Promise.all(animations.map(function(a) {\n return a.finished;\n })).then(function() {\n return resolve(true);\n }).catch(function() {\n var remaining = node.getAnimations();\n if (remaining.some(function(a) {\n return a.playState === \"running\" || a.pending;\n })) {\n check();\n return;\n }\n resolve(false);\n });\n };\n if (hasRAF) {\n requestAnimationFrame(check);\n } else {\n check();\n }\n });\n}\nvar DURATION_REGEX = /(\\d+(?:\\.\\d+)?)\\s*(?:ms|s(?!tiffness))/;\nfunction applyDurationOverride(animation, durationMs) {\n var replaced = animation.replace(DURATION_REGEX, `${durationMs}ms`);\n return replaced === animation ? `${durationMs}ms ${animation}` : replaced;\n}\nvar CSS_TRANSFORM_PROPERTIES = {\n transform: [\n \"translate\",\n \"scale\",\n \"rotate\",\n \"transform\"\n ],\n x: [\n \"translate\"\n ],\n y: [\n \"translate\"\n ],\n scale: [\n \"scale\"\n ],\n scaleX: [\n \"scale\"\n ],\n scaleY: [\n \"scale\"\n ],\n rotate: [\n \"rotate\"\n ],\n rotateX: [\n \"transform\"\n ],\n rotateY: [\n \"transform\"\n ],\n rotateZ: [\n \"transform\"\n ],\n skewX: [\n \"transform\"\n ],\n skewY: [\n \"transform\"\n ]\n};\nvar getCSSProperties = function(key) {\n return CSS_TRANSFORM_PROPERTIES[key] || [\n key\n ];\n};\nvar hyphenatedPropertyCache = {};\nvar emptyProperties = [];\nfunction hyphenateProperty(property) {\n var _hyphenatedPropertyCache, _property;\n if (property.startsWith(\"--\")) return property;\n return (_hyphenatedPropertyCache = hyphenatedPropertyCache)[_property = property] || (_hyphenatedPropertyCache[_property] = property.replace(/[A-Z]/g, function(letter) {\n return `-${letter.toLowerCase()}`;\n }));\n}\nfunction getLifecycleCSSProperties(keys) {\n if (!(keys === null || keys === void 0 ? void 0 : keys.size)) return emptyProperties;\n var properties = /* @__PURE__ */ new Set();\n var _iteratorNormalCompletion = true, _didIteratorError = false, _iteratorError = void 0;\n try {\n for (var _iterator = keys[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) {\n var key = _step.value;\n var _iteratorNormalCompletion1 = true, _didIteratorError1 = false, _iteratorError1 = void 0;\n try {\n for (var _iterator1 = getCSSProperties(key)[Symbol.iterator](), _step1; !(_iteratorNormalCompletion1 = (_step1 = _iterator1.next()).done); _iteratorNormalCompletion1 = true) {\n var property = _step1.value;\n properties.add(hyphenateProperty(property));\n }\n } catch (err) {\n _didIteratorError1 = true;\n _iteratorError1 = err;\n } finally {\n try {\n if (!_iteratorNormalCompletion1 && _iterator1.return != null) {\n _iterator1.return();\n }\n } finally {\n if (_didIteratorError1) {\n throw _iteratorError1;\n }\n }\n }\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 return [\n ...properties\n ].sort();\n}\nfunction readComputedProperties(node, properties) {\n var computed = getComputedStyle(node);\n var values = {};\n var _iteratorNormalCompletion = true, _didIteratorError = false, _iteratorError = void 0;\n try {\n for (var _iterator = properties[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) {\n var property = _step.value;\n var value = computed.getPropertyValue(property);\n if (value) values[property] = 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 return values;\n}\nfunction applyCSSProperties(node, values) {\n for (var property in values) {\n node.style.setProperty(property, values[property]);\n }\n}\nfunction clearCSSProperties(node, properties) {\n var _iteratorNormalCompletion = true, _didIteratorError = false, _iteratorError = void 0;\n try {\n for (var _iterator = properties[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) {\n var property = _step.value;\n node.style.removeProperty(property);\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}\nfunction createAnimations(animations) {\n return {\n animations,\n usePresence: import_use_presence.usePresence,\n ResetPresence: import_use_presence.ResetPresence,\n inputStyle: \"css\",\n outputStyle: \"css\",\n // @ts-ignore - styleState is added by createComponent\n useAnimations: function(param) {\n var { props, presence, style, componentState, stateRef, styleState, onTransition } = param;\n var _styleState_programLifecycleStyleKeys;\n var isHydrating = componentState.unmounted === true;\n var isEntering = !!componentState.unmounted;\n var isExiting = (presence === null || presence === void 0 ? void 0 : presence[0]) === false;\n var sendExitComplete = presence === null || presence === void 0 ? void 0 : presence[1];\n var onTransitionRef = import_react.default.useRef(onTransition);\n onTransitionRef.current = onTransition;\n var emit = function(phase, cause, finished) {\n var _onTransitionRef_current;\n (_onTransitionRef_current = onTransitionRef.current) === null || _onTransitionRef_current === void 0 ? void 0 : _onTransitionRef_current.call(onTransitionRef, phase === \"end\" ? {\n phase,\n cause,\n finished\n } : {\n phase,\n cause\n });\n };\n var wasEnteringRef = import_react.default.useRef(isEntering);\n var justFinishedEntering = wasEnteringRef.current && !isEntering;\n import_react.default.useEffect(function() {\n wasEnteringRef.current = isEntering;\n });\n var exitCycleIdRef = import_react.default.useRef(0);\n var exitCompletedRef = import_react.default.useRef(false);\n var wasExitingRef = import_react.default.useRef(false);\n var sendExitCompleteRef = import_react.default.useRef(sendExitComplete);\n var lastMountedStyleRef = import_react.default.useRef({});\n sendExitCompleteRef.current = sendExitComplete;\n var exitCSSProperties = getLifecycleCSSProperties(styleState === null || styleState === void 0 ? void 0 : (_styleState_programLifecycleStyleKeys = styleState.programLifecycleStyleKeys) === null || _styleState_programLifecycleStyleKeys === void 0 ? void 0 : _styleState_programLifecycleStyleKeys.exit);\n var exitCSSPropertiesSignature = exitCSSProperties.join(\"\\0\");\n var enterCycleIdRef = import_react.default.useRef(0);\n var enterStartedRef = import_react.default.useRef(false);\n var updateCycleIdRef = import_react.default.useRef(0);\n var updateInFlightRef = import_react.default.useRef(false);\n var prevUpdateSigRef = import_react.default.useRef(null);\n var exitStartedRef = import_react.default.useRef(false);\n var justStartedExiting = isExiting && !wasExitingRef.current;\n var justStoppedExiting = !isExiting && wasExitingRef.current;\n if (justStartedExiting) {\n exitCycleIdRef.current++;\n exitCompletedRef.current = false;\n }\n if (justStoppedExiting) {\n exitCycleIdRef.current++;\n }\n import_react.default.useEffect(function() {\n wasExitingRef.current = isExiting;\n });\n (0, import_constants.useIsomorphicLayoutEffect)(function() {\n if (isExiting) return;\n var host = stateRef.current.host;\n if (!host || !exitCSSProperties.length) {\n lastMountedStyleRef.current = {};\n return;\n }\n var node = host;\n var capture = function() {\n if (stateRef.current.host !== node || wasExitingRef.current) return;\n lastMountedStyleRef.current = readComputedProperties(node, exitCSSProperties);\n };\n if (justFinishedEntering) {\n void waitForAnimations(node).then(capture);\n } else {\n capture();\n }\n }, [\n isExiting,\n justFinishedEntering,\n exitCSSPropertiesSignature\n ]);\n var _styleState_effectiveTransition;\n var effectiveTransition = (_styleState_effectiveTransition = styleState === null || styleState === void 0 ? void 0 : styleState.effectiveTransition) !== null && _styleState_effectiveTransition !== void 0 ? _styleState_effectiveTransition : props.transition;\n var normalized = (0, import_animation_helpers.normalizeTransition)(effectiveTransition);\n var animationState = isExiting ? \"exit\" : isEntering || justFinishedEntering ? \"enter\" : \"default\";\n var effectiveAnimationKey = (0, import_animation_helpers.getEffectiveAnimation)(normalized, animationState);\n var defaultAnimation = effectiveAnimationKey ? animations[effectiveAnimationKey] : null;\n var animatedProperties = (0, import_animation_helpers.getAnimatedProperties)(normalized);\n var hasDefault = normalized.default !== null || normalized.enter !== null || normalized.exit !== null;\n var hasPerPropertyConfigs = animatedProperties.length > 0;\n var keys;\n if (props.animateOnly) {\n keys = props.animateOnly;\n } else if (hasPerPropertyConfigs && !hasDefault) {\n keys = animatedProperties;\n } else if (hasPerPropertyConfigs && hasDefault) {\n keys = [\n \"all\",\n ...animatedProperties\n ];\n } else {\n keys = [\n \"all\"\n ];\n }\n var transition;\n var getTransition = function() {\n var _normalized_config;\n if (transition !== void 0) return transition;\n var delay = normalized.delay ? ` ${normalized.delay}ms` : \"\";\n var duration = (_normalized_config = normalized.config) === null || _normalized_config === void 0 ? void 0 : _normalized_config.duration;\n transition = keys.flatMap(function(key) {\n var propertyAnimation = normalized.properties[key];\n var animation = defaultAnimation;\n if (typeof propertyAnimation === \"string\") {\n animation = animations[propertyAnimation];\n } else if (propertyAnimation === null || propertyAnimation === void 0 ? void 0 : propertyAnimation.type) {\n animation = animations[propertyAnimation.type];\n }\n if (animation && duration) {\n animation = applyDurationOverride(animation, duration);\n }\n return animation ? getCSSProperties(key).map(function(property) {\n return `${property} ${animation}${delay}`;\n }) : [];\n }).join(\", \");\n return transition;\n };\n (0, import_constants.useIsomorphicLayoutEffect)(function() {\n var host = stateRef.current.host;\n if (!sendExitComplete || !isExiting || !host) return;\n var node = host;\n var cycleId = exitCycleIdRef.current;\n if (!exitStartedRef.current) {\n exitStartedRef.current = true;\n emit(\"start\", \"exit\");\n }\n var completeExit = function() {\n var finished = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : true;\n var _sendExitCompleteRef_current;\n if (cycleId !== exitCycleIdRef.current) return;\n if (exitCompletedRef.current) return;\n exitCompletedRef.current = true;\n if (exitStartedRef.current) {\n exitStartedRef.current = false;\n emit(\"end\", \"exit\", finished);\n }\n (_sendExitCompleteRef_current = sendExitCompleteRef.current) === null || _sendExitCompleteRef_current === void 0 ? void 0 : _sendExitCompleteRef_current.call(sendExitCompleteRef);\n };\n if (keys.length === 0) {\n completeExit();\n return;\n }\n var rafId;\n var disposed = false;\n var mountedStyle = lastMountedStyleRef.current;\n var canRestart = exitCSSProperties.length > 0 && Object.keys(mountedStyle).length > 0;\n var exitTarget;\n if (canRestart) {\n node.style.transition = \"none\";\n exitTarget = readComputedProperties(node, exitCSSProperties);\n applyCSSProperties(node, mountedStyle);\n void node.offsetHeight;\n rafId = requestAnimationFrame(function() {\n if (cycleId !== exitCycleIdRef.current) return;\n node.style.transition = getTransition();\n void node.offsetHeight;\n applyCSSProperties(node, exitTarget);\n });\n }\n void waitForAnimations(node).then(function(finished) {\n if (!disposed) completeExit(finished);\n });\n return function() {\n disposed = true;\n if (rafId !== void 0) cancelAnimationFrame(rafId);\n clearCSSProperties(node, exitCSSProperties);\n node.style.transition = \"\";\n };\n }, [\n isExiting,\n exitCSSPropertiesSignature\n ]);\n var styleSignature = onTransition ? (function() {\n var { transition: _t, ...rest } = style;\n var _styleState_classNames;\n return `${JSON.stringify((_styleState_classNames = styleState === null || styleState === void 0 ? void 0 : styleState.classNames) !== null && _styleState_classNames !== void 0 ? _styleState_classNames : null)}|${JSON.stringify(rest)}`;\n })() : \"\";\n (0, import_constants.useIsomorphicLayoutEffect)(function() {\n var host = stateRef.current.host;\n if (!onTransitionRef.current || isExiting || !justFinishedEntering || !host) {\n return;\n }\n var node = host;\n var cycleId = ++enterCycleIdRef.current;\n enterStartedRef.current = true;\n emit(\"start\", \"enter\");\n void waitForAnimations(node).then(function(finished) {\n if (cycleId !== enterCycleIdRef.current || !enterStartedRef.current) return;\n enterStartedRef.current = false;\n emit(\"end\", \"enter\", finished);\n });\n }, [\n justFinishedEntering,\n isExiting\n ]);\n (0, import_constants.useIsomorphicLayoutEffect)(function() {\n var host = stateRef.current.host;\n if (!onTransitionRef.current || isEntering || justFinishedEntering || isExiting || !host) {\n prevUpdateSigRef.current = styleSignature;\n return;\n }\n if (prevUpdateSigRef.current === null) {\n prevUpdateSigRef.current = styleSignature;\n return;\n }\n if (styleSignature === prevUpdateSigRef.current) return;\n prevUpdateSigRef.current = styleSignature;\n var node = host;\n if (updateInFlightRef.current) {\n emit(\"end\", \"update\", false);\n }\n updateInFlightRef.current = true;\n var cycleId = ++updateCycleIdRef.current;\n emit(\"start\", \"update\");\n void waitForAnimations(node).then(function(finished) {\n if (cycleId !== updateCycleIdRef.current) return;\n updateInFlightRef.current = false;\n emit(\"end\", \"update\", finished);\n });\n }, [\n styleSignature,\n isEntering,\n justFinishedEntering,\n isExiting\n ]);\n (0, import_constants.useIsomorphicLayoutEffect)(function() {\n if (justStartedExiting && enterStartedRef.current) {\n enterCycleIdRef.current++;\n enterStartedRef.current = false;\n emit(\"end\", \"enter\", false);\n }\n if (justStoppedExiting && exitStartedRef.current && !exitCompletedRef.current) {\n exitStartedRef.current = false;\n emit(\"end\", \"exit\", false);\n }\n }, [\n justStartedExiting,\n justStoppedExiting\n ]);\n if (isHydrating) {\n return null;\n }\n if (!(0, import_animation_helpers.hasAnimation)(normalized)) {\n return null;\n }\n if (Array.isArray(style.transform)) {\n style.transform = (0, import_internal_runtime.transformsToString)(style.transform);\n }\n style.transition = getTransition();\n if (process.env.NODE_ENV === \"development\" && props[\"debug\"] === \"verbose\") {\n console.info(\"CSS animation\", {\n props,\n animations,\n normalized,\n defaultAnimation,\n style,\n isEntering,\n isExiting\n });\n }\n return {\n style,\n className: isEntering ? \"t_unmounted\" : \"\"\n };\n }\n };\n}\n//# sourceMappingURL=createAnimations.js.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"@tamagui/animation-helpers";
|
|
2
2
|
import { useIsomorphicLayoutEffect } from "@tamagui/constants";
|
|
3
3
|
import { ResetPresence, usePresence } from "@tamagui/use-presence";
|
|
4
|
-
import { transformsToString } from "@tamagui/web";
|
|
4
|
+
import { transformsToString } from "@tamagui/web/internal-runtime";
|
|
5
5
|
import React from "react";
|
|
6
6
|
|
|
7
7
|
const hasRAF = typeof requestAnimationFrame !== "undefined";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"createAnimations.js","names":["hasNormalizedAnimation"],"sources":["esm/createAnimations.js"],"sourcesContent":["import {\n normalizeTransition,\n getAnimatedProperties,\n hasAnimation as hasNormalizedAnimation,\n getEffectiveAnimation\n} from \"@tamagui/animation-helpers\";\nimport { useIsomorphicLayoutEffect } from \"@tamagui/constants\";\nimport { ResetPresence, usePresence } from \"@tamagui/use-presence\";\nimport { transformsToString } from \"@tamagui/web\";\nimport React from \"react\";\nconst hasRAF = typeof requestAnimationFrame !== \"undefined\";\nfunction waitForAnimations(node) {\n if (typeof node.getAnimations !== \"function\") {\n return Promise.resolve(true);\n }\n return new Promise((resolve) => {\n const check = () => {\n const animations = node.getAnimations();\n if (animations.length === 0) {\n resolve(true);\n return;\n }\n Promise.all(animations.map((a) => a.finished)).then(() => resolve(true)).catch(() => {\n const remaining = node.getAnimations();\n if (remaining.some((a) => a.playState === \"running\" || a.pending)) {\n check();\n return;\n }\n resolve(false);\n });\n };\n if (hasRAF) {\n requestAnimationFrame(check);\n } else {\n check();\n }\n });\n}\nconst DURATION_REGEX = /(\\d+(?:\\.\\d+)?)\\s*(?:ms|s(?!tiffness))/;\nfunction applyDurationOverride(animation, durationMs) {\n const replaced = animation.replace(DURATION_REGEX, `${durationMs}ms`);\n return replaced === animation ? `${durationMs}ms ${animation}` : replaced;\n}\nconst CSS_TRANSFORM_PROPERTIES = {\n transform: [\"translate\", \"scale\", \"rotate\", \"transform\"],\n x: [\"translate\"],\n y: [\"translate\"],\n scale: [\"scale\"],\n scaleX: [\"scale\"],\n scaleY: [\"scale\"],\n rotate: [\"rotate\"],\n rotateX: [\"transform\"],\n rotateY: [\"transform\"],\n rotateZ: [\"transform\"],\n skewX: [\"transform\"],\n skewY: [\"transform\"]\n};\nconst getCSSProperties = (key) => {\n return CSS_TRANSFORM_PROPERTIES[key] || [key];\n};\nconst hyphenatedPropertyCache = {};\nconst emptyProperties = [];\nfunction hyphenateProperty(property) {\n if (property.startsWith(\"--\")) return property;\n return hyphenatedPropertyCache[property] ||= property.replace(\n /[A-Z]/g,\n (letter) => `-${letter.toLowerCase()}`\n );\n}\nfunction getLifecycleCSSProperties(keys) {\n if (!keys?.size) return emptyProperties;\n const properties = /* @__PURE__ */ new Set();\n for (const key of keys) {\n for (const property of getCSSProperties(key)) {\n properties.add(hyphenateProperty(property));\n }\n }\n return [...properties].sort();\n}\nfunction readComputedProperties(node, properties) {\n const computed = getComputedStyle(node);\n const values = {};\n for (const property of properties) {\n const value = computed.getPropertyValue(property);\n if (value) values[property] = value;\n }\n return values;\n}\nfunction applyCSSProperties(node, values) {\n for (const property in values) {\n node.style.setProperty(property, values[property]);\n }\n}\nfunction clearCSSProperties(node, properties) {\n for (const property of properties) {\n node.style.removeProperty(property);\n }\n}\nfunction createAnimations(animations) {\n return {\n animations,\n usePresence,\n ResetPresence,\n inputStyle: \"css\",\n outputStyle: \"css\",\n // @ts-ignore - styleState is added by createComponent\n useAnimations: ({\n props,\n presence,\n style,\n componentState,\n stateRef,\n styleState,\n onTransition\n }) => {\n const isHydrating = componentState.unmounted === true;\n const isEntering = !!componentState.unmounted;\n const isExiting = presence?.[0] === false;\n const sendExitComplete = presence?.[1];\n const onTransitionRef = React.useRef(onTransition);\n onTransitionRef.current = onTransition;\n const emit = (phase, cause, finished) => {\n onTransitionRef.current?.(\n phase === \"end\" ? { phase, cause, finished } : { phase, cause }\n );\n };\n const wasEnteringRef = React.useRef(isEntering);\n const justFinishedEntering = wasEnteringRef.current && !isEntering;\n React.useEffect(() => {\n wasEnteringRef.current = isEntering;\n });\n const exitCycleIdRef = React.useRef(0);\n const exitCompletedRef = React.useRef(false);\n const wasExitingRef = React.useRef(false);\n const sendExitCompleteRef = React.useRef(sendExitComplete);\n const lastMountedStyleRef = React.useRef({});\n sendExitCompleteRef.current = sendExitComplete;\n const exitCSSProperties = getLifecycleCSSProperties(\n styleState?.programLifecycleStyleKeys?.exit\n );\n const exitCSSPropertiesSignature = exitCSSProperties.join(\"\\0\");\n const enterCycleIdRef = React.useRef(0);\n const enterStartedRef = React.useRef(false);\n const updateCycleIdRef = React.useRef(0);\n const updateInFlightRef = React.useRef(false);\n const prevUpdateSigRef = React.useRef(null);\n const exitStartedRef = React.useRef(false);\n const justStartedExiting = isExiting && !wasExitingRef.current;\n const justStoppedExiting = !isExiting && wasExitingRef.current;\n if (justStartedExiting) {\n exitCycleIdRef.current++;\n exitCompletedRef.current = false;\n }\n if (justStoppedExiting) {\n exitCycleIdRef.current++;\n }\n React.useEffect(() => {\n wasExitingRef.current = isExiting;\n });\n useIsomorphicLayoutEffect(() => {\n if (isExiting) return;\n const host = stateRef.current.host;\n if (!host || !exitCSSProperties.length) {\n lastMountedStyleRef.current = {};\n return;\n }\n const node = host;\n const capture = () => {\n if (stateRef.current.host !== node || wasExitingRef.current) return;\n lastMountedStyleRef.current = readComputedProperties(node, exitCSSProperties);\n };\n if (justFinishedEntering) {\n void waitForAnimations(node).then(capture);\n } else {\n capture();\n }\n }, [isExiting, justFinishedEntering, exitCSSPropertiesSignature]);\n const effectiveTransition = styleState?.effectiveTransition ?? props.transition;\n const normalized = normalizeTransition(effectiveTransition);\n const animationState = isExiting ? \"exit\" : isEntering || justFinishedEntering ? \"enter\" : \"default\";\n const effectiveAnimationKey = getEffectiveAnimation(normalized, animationState);\n const defaultAnimation = effectiveAnimationKey ? animations[effectiveAnimationKey] : null;\n const animatedProperties = getAnimatedProperties(normalized);\n const hasDefault = normalized.default !== null || normalized.enter !== null || normalized.exit !== null;\n const hasPerPropertyConfigs = animatedProperties.length > 0;\n let keys;\n if (props.animateOnly) {\n keys = props.animateOnly;\n } else if (hasPerPropertyConfigs && !hasDefault) {\n keys = animatedProperties;\n } else if (hasPerPropertyConfigs && hasDefault) {\n keys = [\"all\", ...animatedProperties];\n } else {\n keys = [\"all\"];\n }\n let transition;\n const getTransition = () => {\n if (transition !== void 0) return transition;\n const delay = normalized.delay ? ` ${normalized.delay}ms` : \"\";\n const duration = normalized.config?.duration;\n transition = keys.flatMap((key) => {\n const propertyAnimation = normalized.properties[key];\n let animation = defaultAnimation;\n if (typeof propertyAnimation === \"string\") {\n animation = animations[propertyAnimation];\n } else if (propertyAnimation?.type) {\n animation = animations[propertyAnimation.type];\n }\n if (animation && duration) {\n animation = applyDurationOverride(animation, duration);\n }\n return animation ? getCSSProperties(key).map(\n (property) => `${property} ${animation}${delay}`\n ) : [];\n }).join(\", \");\n return transition;\n };\n useIsomorphicLayoutEffect(() => {\n const host = stateRef.current.host;\n if (!sendExitComplete || !isExiting || !host) return;\n const node = host;\n const cycleId = exitCycleIdRef.current;\n if (!exitStartedRef.current) {\n exitStartedRef.current = true;\n emit(\"start\", \"exit\");\n }\n const completeExit = (finished = true) => {\n if (cycleId !== exitCycleIdRef.current) return;\n if (exitCompletedRef.current) return;\n exitCompletedRef.current = true;\n if (exitStartedRef.current) {\n exitStartedRef.current = false;\n emit(\"end\", \"exit\", finished);\n }\n sendExitCompleteRef.current?.();\n };\n if (keys.length === 0) {\n completeExit();\n return;\n }\n let rafId;\n let disposed = false;\n const mountedStyle = lastMountedStyleRef.current;\n const canRestart = exitCSSProperties.length > 0 && Object.keys(mountedStyle).length > 0;\n let exitTarget;\n if (canRestart) {\n node.style.transition = \"none\";\n exitTarget = readComputedProperties(node, exitCSSProperties);\n applyCSSProperties(node, mountedStyle);\n void node.offsetHeight;\n rafId = requestAnimationFrame(() => {\n if (cycleId !== exitCycleIdRef.current) return;\n node.style.transition = getTransition();\n void node.offsetHeight;\n applyCSSProperties(node, exitTarget);\n });\n }\n void waitForAnimations(node).then((finished) => {\n if (!disposed) completeExit(finished);\n });\n return () => {\n disposed = true;\n if (rafId !== void 0) cancelAnimationFrame(rafId);\n clearCSSProperties(node, exitCSSProperties);\n node.style.transition = \"\";\n };\n }, [isExiting, exitCSSPropertiesSignature]);\n const styleSignature = onTransition ? (() => {\n const { transition: _t, ...rest } = style;\n return `${JSON.stringify(styleState?.classNames ?? null)}|${JSON.stringify(rest)}`;\n })() : \"\";\n useIsomorphicLayoutEffect(() => {\n const host = stateRef.current.host;\n if (!onTransitionRef.current || isExiting || !justFinishedEntering || !host) {\n return;\n }\n const node = host;\n const cycleId = ++enterCycleIdRef.current;\n enterStartedRef.current = true;\n emit(\"start\", \"enter\");\n void waitForAnimations(node).then((finished) => {\n if (cycleId !== enterCycleIdRef.current || !enterStartedRef.current) return;\n enterStartedRef.current = false;\n emit(\"end\", \"enter\", finished);\n });\n }, [justFinishedEntering, isExiting]);\n useIsomorphicLayoutEffect(() => {\n const host = stateRef.current.host;\n if (!onTransitionRef.current || isEntering || justFinishedEntering || isExiting || !host) {\n prevUpdateSigRef.current = styleSignature;\n return;\n }\n if (prevUpdateSigRef.current === null) {\n prevUpdateSigRef.current = styleSignature;\n return;\n }\n if (styleSignature === prevUpdateSigRef.current) return;\n prevUpdateSigRef.current = styleSignature;\n const node = host;\n if (updateInFlightRef.current) {\n emit(\"end\", \"update\", false);\n }\n updateInFlightRef.current = true;\n const cycleId = ++updateCycleIdRef.current;\n emit(\"start\", \"update\");\n void waitForAnimations(node).then((finished) => {\n if (cycleId !== updateCycleIdRef.current) return;\n updateInFlightRef.current = false;\n emit(\"end\", \"update\", finished);\n });\n }, [styleSignature, isEntering, justFinishedEntering, isExiting]);\n useIsomorphicLayoutEffect(() => {\n if (justStartedExiting && enterStartedRef.current) {\n enterCycleIdRef.current++;\n enterStartedRef.current = false;\n emit(\"end\", \"enter\", false);\n }\n if (justStoppedExiting && exitStartedRef.current && !exitCompletedRef.current) {\n exitStartedRef.current = false;\n emit(\"end\", \"exit\", false);\n }\n }, [justStartedExiting, justStoppedExiting]);\n if (isHydrating) {\n return null;\n }\n if (!hasNormalizedAnimation(normalized)) {\n return null;\n }\n if (Array.isArray(style.transform)) {\n style.transform = transformsToString(style.transform);\n }\n style.transition = getTransition();\n if (process.env.NODE_ENV === \"development\" && props[\"debug\"] === \"verbose\") {\n console.info(\"CSS animation\", {\n props,\n animations,\n normalized,\n defaultAnimation,\n style,\n isEntering,\n isExiting\n });\n }\n return { style, className: isEntering ? \"t_unmounted\" : \"\" };\n }\n };\n}\nexport {\n createAnimations\n};\n//# sourceMappingURL=createAnimations.js.map\n"],"mappings":";;;;;;;AAUA,MAAM,SAAS,OAAO,0BAA0B;AAChD,SAAS,kBAAkB,MAAM;CAC/B,IAAI,OAAO,KAAK,kBAAkB,YAAY;EAC5C,OAAO,QAAQ,QAAQ,IAAI;CAC7B;CACA,OAAO,IAAI,SAAS,YAAY;EAC9B,MAAM,cAAc;GAClB,MAAM,aAAa,KAAK,cAAc;GACtC,IAAI,WAAW,WAAW,GAAG;IAC3B,QAAQ,IAAI;IACZ;GACF;GACA,QAAQ,IAAI,WAAW,KAAK,MAAM,EAAE,QAAQ,CAAC,CAAC,CAAC,WAAW,QAAQ,IAAI,CAAC,CAAC,CAAC,YAAY;IACnF,MAAM,YAAY,KAAK,cAAc;IACrC,IAAI,UAAU,MAAM,MAAM,EAAE,cAAc,aAAa,EAAE,OAAO,GAAG;KACjE,MAAM;KACN;IACF;IACA,QAAQ,KAAK;GACf,CAAC;EACH;EACA,IAAI,QAAQ;GACV,sBAAsB,KAAK;EAC7B,OAAO;GACL,MAAM;EACR;CACF,CAAC;AACH;AACA,MAAM,iBAAiB;AACvB,SAAS,sBAAsB,WAAW,YAAY;CACpD,MAAM,WAAW,UAAU,QAAQ,gBAAgB,GAAG,WAAW,GAAG;CACpE,OAAO,aAAa,YAAY,GAAG,WAAW,KAAK,cAAc;AACnE;AACA,MAAM,2BAA2B;CAC/B,WAA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B;IACF;IACA,IAAI,mBAAmB,iBAAiB,SAAS;IACjD,iBAAiB,UAAU;IAC3B,MAAM,OAAO;IACb,IAAI,kBAAkB,SAAS;KAC7B,KAAK,OAAO,UAAU,KAAK;IAC7B;IACA,kBAAkB,UAAU;IAC5B,MAAM,UAAU,EAAE,iBAAiB;IACnC,KAAK,SAAS,QAAQ;IACtB,KAAK,kBAAkB,IAAI,CAAC,CAAC,MAAM,aAAa;KAC9C,IAAI,YAAY,iBAAiB,SAAS;KAC1C,kBAAkB,UAAU;KAC5B,KAAK,OAAO,UAAU,QAAQ;IAChC,CAAC;GACH,GAAG;IAAC;IAAgB;IAAY;IAAsB;GAAS,CAAC;GAChE,gCAAgC;IAC9B,IAAI,sBAAsB,gBAAgB,SAAS;KACjD,gBAAgB;KAChB,gBAAgB,UAAU;KAC1B,KAAK,OAAO,SAAS,KAAK;IAC5B;IACA,IAAI,sBAAsB,eAAe,WAAW,CAAC,iBAAiB,SAAS;KAC7E,eAAe,UAAU;KACzB,KAAK,OAAO,QAAQ,KAAK;IAC3B;GACF,GAAG,CAAC,oBAAoB,kBAAkB,CAAC;GAC3C,IAAI,aAAa;IACf,OAAO;GACT;GACA,IAAI,CAACA,aAAuB,UAAU,GAAG;IACvC,OAAO;GACT;GACA,IAAI,MAAM,QAAQ,MAAM,SAAS,GAAG;IAClC,MAAM,YAAY,mBAAmB,MAAM,SAAS;GACtD;GACA,MAAM,aAAa,cAAc;GACjC,IAAI,QAAQ,IAAI,aAAa,iBAAiB,MAAM,aAAa,WAAW;IAC1E,QAAQ,KAAK,iBAAiB;KAC5B;KACA;KACA;KACA;KACA;KACA;KACA;IACF,CAAC;GACH;GACA,OAAO;IAAE;IAAO,WAAW,aAAa,gBAAgB;GAAG;EAC7D;CACF;AACF"}
|
|
1
|
+
{"version":3,"file":"createAnimations.js","names":["hasNormalizedAnimation"],"sources":["esm/createAnimations.js"],"sourcesContent":["import {\n normalizeTransition,\n getAnimatedProperties,\n hasAnimation as hasNormalizedAnimation,\n getEffectiveAnimation\n} from \"@tamagui/animation-helpers\";\nimport { useIsomorphicLayoutEffect } from \"@tamagui/constants\";\nimport { ResetPresence, usePresence } from \"@tamagui/use-presence\";\nimport { transformsToString } from \"@tamagui/web/internal-runtime\";\nimport React from \"react\";\nconst hasRAF = typeof requestAnimationFrame !== \"undefined\";\nfunction waitForAnimations(node) {\n if (typeof node.getAnimations !== \"function\") {\n return Promise.resolve(true);\n }\n return new Promise((resolve) => {\n const check = () => {\n const animations = node.getAnimations();\n if (animations.length === 0) {\n resolve(true);\n return;\n }\n Promise.all(animations.map((a) => a.finished)).then(() => resolve(true)).catch(() => {\n const remaining = node.getAnimations();\n if (remaining.some((a) => a.playState === \"running\" || a.pending)) {\n check();\n return;\n }\n resolve(false);\n });\n };\n if (hasRAF) {\n requestAnimationFrame(check);\n } else {\n check();\n }\n });\n}\nconst DURATION_REGEX = /(\\d+(?:\\.\\d+)?)\\s*(?:ms|s(?!tiffness))/;\nfunction applyDurationOverride(animation, durationMs) {\n const replaced = animation.replace(DURATION_REGEX, `${durationMs}ms`);\n return replaced === animation ? `${durationMs}ms ${animation}` : replaced;\n}\nconst CSS_TRANSFORM_PROPERTIES = {\n transform: [\"translate\", \"scale\", \"rotate\", \"transform\"],\n x: [\"translate\"],\n y: [\"translate\"],\n scale: [\"scale\"],\n scaleX: [\"scale\"],\n scaleY: [\"scale\"],\n rotate: [\"rotate\"],\n rotateX: [\"transform\"],\n rotateY: [\"transform\"],\n rotateZ: [\"transform\"],\n skewX: [\"transform\"],\n skewY: [\"transform\"]\n};\nconst getCSSProperties = (key) => {\n return CSS_TRANSFORM_PROPERTIES[key] || [key];\n};\nconst hyphenatedPropertyCache = {};\nconst emptyProperties = [];\nfunction hyphenateProperty(property) {\n if (property.startsWith(\"--\")) return property;\n return hyphenatedPropertyCache[property] ||= property.replace(\n /[A-Z]/g,\n (letter) => `-${letter.toLowerCase()}`\n );\n}\nfunction getLifecycleCSSProperties(keys) {\n if (!keys?.size) return emptyProperties;\n const properties = /* @__PURE__ */ new Set();\n for (const key of keys) {\n for (const property of getCSSProperties(key)) {\n properties.add(hyphenateProperty(property));\n }\n }\n return [...properties].sort();\n}\nfunction readComputedProperties(node, properties) {\n const computed = getComputedStyle(node);\n const values = {};\n for (const property of properties) {\n const value = computed.getPropertyValue(property);\n if (value) values[property] = value;\n }\n return values;\n}\nfunction applyCSSProperties(node, values) {\n for (const property in values) {\n node.style.setProperty(property, values[property]);\n }\n}\nfunction clearCSSProperties(node, properties) {\n for (const property of properties) {\n node.style.removeProperty(property);\n }\n}\nfunction createAnimations(animations) {\n return {\n animations,\n usePresence,\n ResetPresence,\n inputStyle: \"css\",\n outputStyle: \"css\",\n // @ts-ignore - styleState is added by createComponent\n useAnimations: ({\n props,\n presence,\n style,\n componentState,\n stateRef,\n styleState,\n onTransition\n }) => {\n const isHydrating = componentState.unmounted === true;\n const isEntering = !!componentState.unmounted;\n const isExiting = presence?.[0] === false;\n const sendExitComplete = presence?.[1];\n const onTransitionRef = React.useRef(onTransition);\n onTransitionRef.current = onTransition;\n const emit = (phase, cause, finished) => {\n onTransitionRef.current?.(\n phase === \"end\" ? { phase, cause, finished } : { phase, cause }\n );\n };\n const wasEnteringRef = React.useRef(isEntering);\n const justFinishedEntering = wasEnteringRef.current && !isEntering;\n React.useEffect(() => {\n wasEnteringRef.current = isEntering;\n });\n const exitCycleIdRef = React.useRef(0);\n const exitCompletedRef = React.useRef(false);\n const wasExitingRef = React.useRef(false);\n const sendExitCompleteRef = React.useRef(sendExitComplete);\n const lastMountedStyleRef = React.useRef({});\n sendExitCompleteRef.current = sendExitComplete;\n const exitCSSProperties = getLifecycleCSSProperties(\n styleState?.programLifecycleStyleKeys?.exit\n );\n const exitCSSPropertiesSignature = exitCSSProperties.join(\"\\0\");\n const enterCycleIdRef = React.useRef(0);\n const enterStartedRef = React.useRef(false);\n const updateCycleIdRef = React.useRef(0);\n const updateInFlightRef = React.useRef(false);\n const prevUpdateSigRef = React.useRef(null);\n const exitStartedRef = React.useRef(false);\n const justStartedExiting = isExiting && !wasExitingRef.current;\n const justStoppedExiting = !isExiting && wasExitingRef.current;\n if (justStartedExiting) {\n exitCycleIdRef.current++;\n exitCompletedRef.current = false;\n }\n if (justStoppedExiting) {\n exitCycleIdRef.current++;\n }\n React.useEffect(() => {\n wasExitingRef.current = isExiting;\n });\n useIsomorphicLayoutEffect(() => {\n if (isExiting) return;\n const host = stateRef.current.host;\n if (!host || !exitCSSProperties.length) {\n lastMountedStyleRef.current = {};\n return;\n }\n const node = host;\n const capture = () => {\n if (stateRef.current.host !== node || wasExitingRef.current) return;\n lastMountedStyleRef.current = readComputedProperties(node, exitCSSProperties);\n };\n if (justFinishedEntering) {\n void waitForAnimations(node).then(capture);\n } else {\n capture();\n }\n }, [isExiting, justFinishedEntering, exitCSSPropertiesSignature]);\n const effectiveTransition = styleState?.effectiveTransition ?? props.transition;\n const normalized = normalizeTransition(effectiveTransition);\n const animationState = isExiting ? \"exit\" : isEntering || justFinishedEntering ? \"enter\" : \"default\";\n const effectiveAnimationKey = getEffectiveAnimation(normalized, animationState);\n const defaultAnimation = effectiveAnimationKey ? animations[effectiveAnimationKey] : null;\n const animatedProperties = getAnimatedProperties(normalized);\n const hasDefault = normalized.default !== null || normalized.enter !== null || normalized.exit !== null;\n const hasPerPropertyConfigs = animatedProperties.length > 0;\n let keys;\n if (props.animateOnly) {\n keys = props.animateOnly;\n } else if (hasPerPropertyConfigs && !hasDefault) {\n keys = animatedProperties;\n } else if (hasPerPropertyConfigs && hasDefault) {\n keys = [\"all\", ...animatedProperties];\n } else {\n keys = [\"all\"];\n }\n let transition;\n const getTransition = () => {\n if (transition !== void 0) return transition;\n const delay = normalized.delay ? ` ${normalized.delay}ms` : \"\";\n const duration = normalized.config?.duration;\n transition = keys.flatMap((key) => {\n const propertyAnimation = normalized.properties[key];\n let animation = defaultAnimation;\n if (typeof propertyAnimation === \"string\") {\n animation = animations[propertyAnimation];\n } else if (propertyAnimation?.type) {\n animation = animations[propertyAnimation.type];\n }\n if (animation && duration) {\n animation = applyDurationOverride(animation, duration);\n }\n return animation ? getCSSProperties(key).map(\n (property) => `${property} ${animation}${delay}`\n ) : [];\n }).join(\", \");\n return transition;\n };\n useIsomorphicLayoutEffect(() => {\n const host = stateRef.current.host;\n if (!sendExitComplete || !isExiting || !host) return;\n const node = host;\n const cycleId = exitCycleIdRef.current;\n if (!exitStartedRef.current) {\n exitStartedRef.current = true;\n emit(\"start\", \"exit\");\n }\n const completeExit = (finished = true) => {\n if (cycleId !== exitCycleIdRef.current) return;\n if (exitCompletedRef.current) return;\n exitCompletedRef.current = true;\n if (exitStartedRef.current) {\n exitStartedRef.current = false;\n emit(\"end\", \"exit\", finished);\n }\n sendExitCompleteRef.current?.();\n };\n if (keys.length === 0) {\n completeExit();\n return;\n }\n let rafId;\n let disposed = false;\n const mountedStyle = lastMountedStyleRef.current;\n const canRestart = exitCSSProperties.length > 0 && Object.keys(mountedStyle).length > 0;\n let exitTarget;\n if (canRestart) {\n node.style.transition = \"none\";\n exitTarget = readComputedProperties(node, exitCSSProperties);\n applyCSSProperties(node, mountedStyle);\n void node.offsetHeight;\n rafId = requestAnimationFrame(() => {\n if (cycleId !== exitCycleIdRef.current) return;\n node.style.transition = getTransition();\n void node.offsetHeight;\n applyCSSProperties(node, exitTarget);\n });\n }\n void waitForAnimations(node).then((finished) => {\n if (!disposed) completeExit(finished);\n });\n return () => {\n disposed = true;\n if (rafId !== void 0) cancelAnimationFrame(rafId);\n clearCSSProperties(node, exitCSSProperties);\n node.style.transition = \"\";\n };\n }, [isExiting, exitCSSPropertiesSignature]);\n const styleSignature = onTransition ? (() => {\n const { transition: _t, ...rest } = style;\n return `${JSON.stringify(styleState?.classNames ?? null)}|${JSON.stringify(rest)}`;\n })() : \"\";\n useIsomorphicLayoutEffect(() => {\n const host = stateRef.current.host;\n if (!onTransitionRef.current || isExiting || !justFinishedEntering || !host) {\n return;\n }\n const node = host;\n const cycleId = ++enterCycleIdRef.current;\n enterStartedRef.current = true;\n emit(\"start\", \"enter\");\n void waitForAnimations(node).then((finished) => {\n if (cycleId !== enterCycleIdRef.current || !enterStartedRef.current) return;\n enterStartedRef.current = false;\n emit(\"end\", \"enter\", finished);\n });\n }, [justFinishedEntering, isExiting]);\n useIsomorphicLayoutEffect(() => {\n const host = stateRef.current.host;\n if (!onTransitionRef.current || isEntering || justFinishedEntering || isExiting || !host) {\n prevUpdateSigRef.current = styleSignature;\n return;\n }\n if (prevUpdateSigRef.current === null) {\n prevUpdateSigRef.current = styleSignature;\n return;\n }\n if (styleSignature === prevUpdateSigRef.current) return;\n prevUpdateSigRef.current = styleSignature;\n const node = host;\n if (updateInFlightRef.current) {\n emit(\"end\", \"update\", false);\n }\n updateInFlightRef.current = true;\n const cycleId = ++updateCycleIdRef.current;\n emit(\"start\", \"update\");\n void waitForAnimations(node).then((finished) => {\n if (cycleId !== updateCycleIdRef.current) return;\n updateInFlightRef.current = false;\n emit(\"end\", \"update\", finished);\n });\n }, [styleSignature, isEntering, justFinishedEntering, isExiting]);\n useIsomorphicLayoutEffect(() => {\n if (justStartedExiting && enterStartedRef.current) {\n enterCycleIdRef.current++;\n enterStartedRef.current = false;\n emit(\"end\", \"enter\", false);\n }\n if (justStoppedExiting && exitStartedRef.current && !exitCompletedRef.current) {\n exitStartedRef.current = false;\n emit(\"end\", \"exit\", false);\n }\n }, [justStartedExiting, justStoppedExiting]);\n if (isHydrating) {\n return null;\n }\n if (!hasNormalizedAnimation(normalized)) {\n return null;\n }\n if (Array.isArray(style.transform)) {\n style.transform = transformsToString(style.transform);\n }\n style.transition = getTransition();\n if (process.env.NODE_ENV === \"development\" && props[\"debug\"] === \"verbose\") {\n console.info(\"CSS animation\", {\n props,\n animations,\n normalized,\n defaultAnimation,\n style,\n isEntering,\n isExiting\n });\n }\n return { style, className: isEntering ? \"t_unmounted\" : \"\" };\n }\n };\n}\nexport {\n createAnimations\n};\n//# sourceMappingURL=createAnimations.js.map\n"],"mappings":";;;;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AAS,CAAC;GAChE,gCAAgC;IAC9B,IAAI,sBAAsB,gBAAgB,SAAS;KACjD,gBAAgB;KAChB,gBAAgB,UAAU;KAC1B,KAAK,OAAO,SAAS,KAAK;IAC5B;IACA,IAAI,sBAAsB,eAAe,WAAW,CAAC,iBAAiB,SAAS;KAC7E,eAAe,UAAU;KACzB,KAAK,OAAO,QAAQ,KAAK;IAC3B;GACF,GAAG,CAAC,oBAAoB,kBAAkB,CAAC;GAC3C,IAAI,aAAa;IACf,OAAO;GACT;GACA,IAAI,CAACA,aAAuB,UAAU,GAAG;IACvC,OAAO;GACT;GACA,IAAI,MAAM,QAAQ,MAAM,SAAS,GAAG;IAClC,MAAM,YAAY,mBAAmB,MAAM,SAAS;GACtD;GACA,MAAM,aAAa,cAAc;GACjC,IAAI,QAAQ,IAAI,aAAa,iBAAiB,MAAM,aAAa,WAAW;IAC1E,QAAQ,KAAK,iBAAiB;KAC5B;KACA;KACA;KACA;KACA;KACA;KACA;IACF,CAAC;GACH;GACA,OAAO;IAAE;IAAO,WAAW,aAAa,gBAAgB;GAAG;EAC7D;CACF;AACF"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { getAnimatedProperties, getEffectiveAnimation, hasAnimation, normalizeTransition } from "@tamagui/animation-helpers";
|
|
2
2
|
import { useIsomorphicLayoutEffect } from "@tamagui/constants";
|
|
3
3
|
import { ResetPresence, usePresence } from "@tamagui/use-presence";
|
|
4
|
-
import { transformsToString } from "@tamagui/web";
|
|
4
|
+
import { transformsToString } from "@tamagui/web/internal-runtime";
|
|
5
5
|
import React from "react";
|
|
6
6
|
|
|
7
7
|
var hasRAF = typeof requestAnimationFrame !== "undefined";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"createAnimations.native.js","names":["hasNormalizedAnimation"],"sources":["esm/createAnimations.native.js"],"sourcesContent":["import { normalizeTransition, getAnimatedProperties, hasAnimation as hasNormalizedAnimation, getEffectiveAnimation } from \"@tamagui/animation-helpers\";\nimport { useIsomorphicLayoutEffect } from \"@tamagui/constants\";\nimport { ResetPresence, usePresence } from \"@tamagui/use-presence\";\nimport { transformsToString } from \"@tamagui/web\";\nimport React from \"react\";\nvar hasRAF = typeof requestAnimationFrame !== \"undefined\";\nfunction waitForAnimations(node) {\n if (typeof node.getAnimations !== \"function\") {\n return Promise.resolve(true);\n }\n return new Promise(function(resolve) {\n var check = function() {\n var animations = node.getAnimations();\n if (animations.length === 0) {\n resolve(true);\n return;\n }\n Promise.all(animations.map(function(a) {\n return a.finished;\n })).then(function() {\n return resolve(true);\n }).catch(function() {\n var remaining = node.getAnimations();\n if (remaining.some(function(a) {\n return a.playState === \"running\" || a.pending;\n })) {\n check();\n return;\n }\n resolve(false);\n });\n };\n if (hasRAF) {\n requestAnimationFrame(check);\n } else {\n check();\n }\n });\n}\nvar DURATION_REGEX = /(\\d+(?:\\.\\d+)?)\\s*(?:ms|s(?!tiffness))/;\nfunction applyDurationOverride(animation, durationMs) {\n var replaced = animation.replace(DURATION_REGEX, `${durationMs}ms`);\n return replaced === animation ? `${durationMs}ms ${animation}` : replaced;\n}\nvar CSS_TRANSFORM_PROPERTIES = {\n transform: [\n \"translate\",\n \"scale\",\n \"rotate\",\n \"transform\"\n ],\n x: [\n \"translate\"\n ],\n y: [\n \"translate\"\n ],\n scale: [\n \"scale\"\n ],\n scaleX: [\n \"scale\"\n ],\n scaleY: [\n \"scale\"\n ],\n rotate: [\n \"rotate\"\n ],\n rotateX: [\n \"transform\"\n ],\n rotateY: [\n \"transform\"\n ],\n rotateZ: [\n \"transform\"\n ],\n skewX: [\n \"transform\"\n ],\n skewY: [\n \"transform\"\n ]\n};\nvar getCSSProperties = function(key) {\n return CSS_TRANSFORM_PROPERTIES[key] || [\n key\n ];\n};\nvar hyphenatedPropertyCache = {};\nvar emptyProperties = [];\nfunction hyphenateProperty(property) {\n var _hyphenatedPropertyCache, _property;\n if (property.startsWith(\"--\")) return property;\n return (_hyphenatedPropertyCache = hyphenatedPropertyCache)[_property = property] || (_hyphenatedPropertyCache[_property] = property.replace(/[A-Z]/g, function(letter) {\n return `-${letter.toLowerCase()}`;\n }));\n}\nfunction getLifecycleCSSProperties(keys) {\n if (!(keys === null || keys === void 0 ? void 0 : keys.size)) return emptyProperties;\n var properties = /* @__PURE__ */ new Set();\n var _iteratorNormalCompletion = true, _didIteratorError = false, _iteratorError = void 0;\n try {\n for (var _iterator = keys[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) {\n var key = _step.value;\n var _iteratorNormalCompletion1 = true, _didIteratorError1 = false, _iteratorError1 = void 0;\n try {\n for (var _iterator1 = getCSSProperties(key)[Symbol.iterator](), _step1; !(_iteratorNormalCompletion1 = (_step1 = _iterator1.next()).done); _iteratorNormalCompletion1 = true) {\n var property = _step1.value;\n properties.add(hyphenateProperty(property));\n }\n } catch (err) {\n _didIteratorError1 = true;\n _iteratorError1 = err;\n } finally {\n try {\n if (!_iteratorNormalCompletion1 && _iterator1.return != null) {\n _iterator1.return();\n }\n } finally {\n if (_didIteratorError1) {\n throw _iteratorError1;\n }\n }\n }\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 return [\n ...properties\n ].sort();\n}\nfunction readComputedProperties(node, properties) {\n var computed = getComputedStyle(node);\n var values = {};\n var _iteratorNormalCompletion = true, _didIteratorError = false, _iteratorError = void 0;\n try {\n for (var _iterator = properties[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) {\n var property = _step.value;\n var value = computed.getPropertyValue(property);\n if (value) values[property] = 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 return values;\n}\nfunction applyCSSProperties(node, values) {\n for (var property in values) {\n node.style.setProperty(property, values[property]);\n }\n}\nfunction clearCSSProperties(node, properties) {\n var _iteratorNormalCompletion = true, _didIteratorError = false, _iteratorError = void 0;\n try {\n for (var _iterator = properties[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) {\n var property = _step.value;\n node.style.removeProperty(property);\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}\nfunction createAnimations(animations) {\n return {\n animations,\n usePresence,\n ResetPresence,\n inputStyle: \"css\",\n outputStyle: \"css\",\n // @ts-ignore - styleState is added by createComponent\n useAnimations: function(param) {\n var { props, presence, style, componentState, stateRef, styleState, onTransition } = param;\n var _styleState_programLifecycleStyleKeys;\n var isHydrating = componentState.unmounted === true;\n var isEntering = !!componentState.unmounted;\n var isExiting = (presence === null || presence === void 0 ? void 0 : presence[0]) === false;\n var sendExitComplete = presence === null || presence === void 0 ? void 0 : presence[1];\n var onTransitionRef = React.useRef(onTransition);\n onTransitionRef.current = onTransition;\n var emit = function(phase, cause, finished) {\n var _onTransitionRef_current;\n (_onTransitionRef_current = onTransitionRef.current) === null || _onTransitionRef_current === void 0 ? void 0 : _onTransitionRef_current.call(onTransitionRef, phase === \"end\" ? {\n phase,\n cause,\n finished\n } : {\n phase,\n cause\n });\n };\n var wasEnteringRef = React.useRef(isEntering);\n var justFinishedEntering = wasEnteringRef.current && !isEntering;\n React.useEffect(function() {\n wasEnteringRef.current = isEntering;\n });\n var exitCycleIdRef = React.useRef(0);\n var exitCompletedRef = React.useRef(false);\n var wasExitingRef = React.useRef(false);\n var sendExitCompleteRef = React.useRef(sendExitComplete);\n var lastMountedStyleRef = React.useRef({});\n sendExitCompleteRef.current = sendExitComplete;\n var exitCSSProperties = getLifecycleCSSProperties(styleState === null || styleState === void 0 ? void 0 : (_styleState_programLifecycleStyleKeys = styleState.programLifecycleStyleKeys) === null || _styleState_programLifecycleStyleKeys === void 0 ? void 0 : _styleState_programLifecycleStyleKeys.exit);\n var exitCSSPropertiesSignature = exitCSSProperties.join(\"\\0\");\n var enterCycleIdRef = React.useRef(0);\n var enterStartedRef = React.useRef(false);\n var updateCycleIdRef = React.useRef(0);\n var updateInFlightRef = React.useRef(false);\n var prevUpdateSigRef = React.useRef(null);\n var exitStartedRef = React.useRef(false);\n var justStartedExiting = isExiting && !wasExitingRef.current;\n var justStoppedExiting = !isExiting && wasExitingRef.current;\n if (justStartedExiting) {\n exitCycleIdRef.current++;\n exitCompletedRef.current = false;\n }\n if (justStoppedExiting) {\n exitCycleIdRef.current++;\n }\n React.useEffect(function() {\n wasExitingRef.current = isExiting;\n });\n useIsomorphicLayoutEffect(function() {\n if (isExiting) return;\n var host = stateRef.current.host;\n if (!host || !exitCSSProperties.length) {\n lastMountedStyleRef.current = {};\n return;\n }\n var node = host;\n var capture = function() {\n if (stateRef.current.host !== node || wasExitingRef.current) return;\n lastMountedStyleRef.current = readComputedProperties(node, exitCSSProperties);\n };\n if (justFinishedEntering) {\n void waitForAnimations(node).then(capture);\n } else {\n capture();\n }\n }, [\n isExiting,\n justFinishedEntering,\n exitCSSPropertiesSignature\n ]);\n var _styleState_effectiveTransition;\n var effectiveTransition = (_styleState_effectiveTransition = styleState === null || styleState === void 0 ? void 0 : styleState.effectiveTransition) !== null && _styleState_effectiveTransition !== void 0 ? _styleState_effectiveTransition : props.transition;\n var normalized = normalizeTransition(effectiveTransition);\n var animationState = isExiting ? \"exit\" : isEntering || justFinishedEntering ? \"enter\" : \"default\";\n var effectiveAnimationKey = getEffectiveAnimation(normalized, animationState);\n var defaultAnimation = effectiveAnimationKey ? animations[effectiveAnimationKey] : null;\n var animatedProperties = getAnimatedProperties(normalized);\n var hasDefault = normalized.default !== null || normalized.enter !== null || normalized.exit !== null;\n var hasPerPropertyConfigs = animatedProperties.length > 0;\n var keys;\n if (props.animateOnly) {\n keys = props.animateOnly;\n } else if (hasPerPropertyConfigs && !hasDefault) {\n keys = animatedProperties;\n } else if (hasPerPropertyConfigs && hasDefault) {\n keys = [\n \"all\",\n ...animatedProperties\n ];\n } else {\n keys = [\n \"all\"\n ];\n }\n var transition;\n var getTransition = function() {\n var _normalized_config;\n if (transition !== void 0) return transition;\n var delay = normalized.delay ? ` ${normalized.delay}ms` : \"\";\n var duration = (_normalized_config = normalized.config) === null || _normalized_config === void 0 ? void 0 : _normalized_config.duration;\n transition = keys.flatMap(function(key) {\n var propertyAnimation = normalized.properties[key];\n var animation = defaultAnimation;\n if (typeof propertyAnimation === \"string\") {\n animation = animations[propertyAnimation];\n } else if (propertyAnimation === null || propertyAnimation === void 0 ? void 0 : propertyAnimation.type) {\n animation = animations[propertyAnimation.type];\n }\n if (animation && duration) {\n animation = applyDurationOverride(animation, duration);\n }\n return animation ? getCSSProperties(key).map(function(property) {\n return `${property} ${animation}${delay}`;\n }) : [];\n }).join(\", \");\n return transition;\n };\n useIsomorphicLayoutEffect(function() {\n var host = stateRef.current.host;\n if (!sendExitComplete || !isExiting || !host) return;\n var node = host;\n var cycleId = exitCycleIdRef.current;\n if (!exitStartedRef.current) {\n exitStartedRef.current = true;\n emit(\"start\", \"exit\");\n }\n var completeExit = function() {\n var finished = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : true;\n var _sendExitCompleteRef_current;\n if (cycleId !== exitCycleIdRef.current) return;\n if (exitCompletedRef.current) return;\n exitCompletedRef.current = true;\n if (exitStartedRef.current) {\n exitStartedRef.current = false;\n emit(\"end\", \"exit\", finished);\n }\n (_sendExitCompleteRef_current = sendExitCompleteRef.current) === null || _sendExitCompleteRef_current === void 0 ? void 0 : _sendExitCompleteRef_current.call(sendExitCompleteRef);\n };\n if (keys.length === 0) {\n completeExit();\n return;\n }\n var rafId;\n var disposed = false;\n var mountedStyle = lastMountedStyleRef.current;\n var canRestart = exitCSSProperties.length > 0 && Object.keys(mountedStyle).length > 0;\n var exitTarget;\n if (canRestart) {\n node.style.transition = \"none\";\n exitTarget = readComputedProperties(node, exitCSSProperties);\n applyCSSProperties(node, mountedStyle);\n void node.offsetHeight;\n rafId = requestAnimationFrame(function() {\n if (cycleId !== exitCycleIdRef.current) return;\n node.style.transition = getTransition();\n void node.offsetHeight;\n applyCSSProperties(node, exitTarget);\n });\n }\n void waitForAnimations(node).then(function(finished) {\n if (!disposed) completeExit(finished);\n });\n return function() {\n disposed = true;\n if (rafId !== void 0) cancelAnimationFrame(rafId);\n clearCSSProperties(node, exitCSSProperties);\n node.style.transition = \"\";\n };\n }, [\n isExiting,\n exitCSSPropertiesSignature\n ]);\n var styleSignature = onTransition ? (function() {\n var { transition: _t, ...rest } = style;\n var _styleState_classNames;\n return `${JSON.stringify((_styleState_classNames = styleState === null || styleState === void 0 ? void 0 : styleState.classNames) !== null && _styleState_classNames !== void 0 ? _styleState_classNames : null)}|${JSON.stringify(rest)}`;\n })() : \"\";\n useIsomorphicLayoutEffect(function() {\n var host = stateRef.current.host;\n if (!onTransitionRef.current || isExiting || !justFinishedEntering || !host) {\n return;\n }\n var node = host;\n var cycleId = ++enterCycleIdRef.current;\n enterStartedRef.current = true;\n emit(\"start\", \"enter\");\n void waitForAnimations(node).then(function(finished) {\n if (cycleId !== enterCycleIdRef.current || !enterStartedRef.current) return;\n enterStartedRef.current = false;\n emit(\"end\", \"enter\", finished);\n });\n }, [\n justFinishedEntering,\n isExiting\n ]);\n useIsomorphicLayoutEffect(function() {\n var host = stateRef.current.host;\n if (!onTransitionRef.current || isEntering || justFinishedEntering || isExiting || !host) {\n prevUpdateSigRef.current = styleSignature;\n return;\n }\n if (prevUpdateSigRef.current === null) {\n prevUpdateSigRef.current = styleSignature;\n return;\n }\n if (styleSignature === prevUpdateSigRef.current) return;\n prevUpdateSigRef.current = styleSignature;\n var node = host;\n if (updateInFlightRef.current) {\n emit(\"end\", \"update\", false);\n }\n updateInFlightRef.current = true;\n var cycleId = ++updateCycleIdRef.current;\n emit(\"start\", \"update\");\n void waitForAnimations(node).then(function(finished) {\n if (cycleId !== updateCycleIdRef.current) return;\n updateInFlightRef.current = false;\n emit(\"end\", \"update\", finished);\n });\n }, [\n styleSignature,\n isEntering,\n justFinishedEntering,\n isExiting\n ]);\n useIsomorphicLayoutEffect(function() {\n if (justStartedExiting && enterStartedRef.current) {\n enterCycleIdRef.current++;\n enterStartedRef.current = false;\n emit(\"end\", \"enter\", false);\n }\n if (justStoppedExiting && exitStartedRef.current && !exitCompletedRef.current) {\n exitStartedRef.current = false;\n emit(\"end\", \"exit\", false);\n }\n }, [\n justStartedExiting,\n justStoppedExiting\n ]);\n if (isHydrating) {\n return null;\n }\n if (!hasNormalizedAnimation(normalized)) {\n return null;\n }\n if (Array.isArray(style.transform)) {\n style.transform = transformsToString(style.transform);\n }\n style.transition = getTransition();\n if (process.env.NODE_ENV === \"development\" && props[\"debug\"] === \"verbose\") {\n console.info(\"CSS animation\", {\n props,\n animations,\n normalized,\n defaultAnimation,\n style,\n isEntering,\n isExiting\n });\n }\n return {\n style,\n className: isEntering ? \"t_unmounted\" : \"\"\n };\n }\n };\n}\nexport {\n createAnimations\n};\n//# sourceMappingURL=createAnimations.js.map\n"],"mappings":";;;;;;;AAKA,IAAI,SAAS,OAAO,0BAA0B;AAC9C,SAAS,kBAAkB,MAAM;CAC/B,IAAI,OAAO,KAAK,kBAAkB,YAAY;EAC5C,OAAO,QAAQ,QAAQ,IAAI;CAC7B;CACA,OAAO,IAAI,QAAQ,SAAS,SAAS;EACnC,IAAI,QAAQ,WAAW;GACrB,IAAI,aAAa,KAAK,cAAc;GACpC,IAAI,WAAW,WAAW,GAAG;IAC3B,QAAQ,IAAI;IACZ;GACF;GACA,QAAQ,IAAI,WAAW,IAAI,SAAS,GAAG;IACrC,OAAO,EAAE;GACX,CAAC,CAAC,CAAC,CAAC,KAAK,WAA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,OAAO;GACT;GACA,IAAI,CAACA,aAAuB,UAAU,GAAG;IACvC,OAAO;GACT;GACA,IAAI,MAAM,QAAQ,MAAM,SAAS,GAAG;IAClC,MAAM,YAAY,mBAAmB,MAAM,SAAS;GACtD;GACA,MAAM,aAAa,cAAc;GACjC,IAAI,QAAQ,IAAI,aAAa,iBAAiB,MAAM,aAAa,WAAW;IAC1E,QAAQ,KAAK,iBAAiB;KAC5B;KACA;KACA;KACA;KACA;KACA;KACA;IACF,CAAC;GACH;GACA,OAAO;IACL;IACA,WAAW,aAAa,gBAAgB;GAC1C;EACF;CACF;AACF"}
|
|
1
|
+
{"version":3,"file":"createAnimations.native.js","names":["hasNormalizedAnimation"],"sources":["esm/createAnimations.native.js"],"sourcesContent":["import { normalizeTransition, getAnimatedProperties, hasAnimation as hasNormalizedAnimation, getEffectiveAnimation } from \"@tamagui/animation-helpers\";\nimport { useIsomorphicLayoutEffect } from \"@tamagui/constants\";\nimport { ResetPresence, usePresence } from \"@tamagui/use-presence\";\nimport { transformsToString } from \"@tamagui/web/internal-runtime\";\nimport React from \"react\";\nvar hasRAF = typeof requestAnimationFrame !== \"undefined\";\nfunction waitForAnimations(node) {\n if (typeof node.getAnimations !== \"function\") {\n return Promise.resolve(true);\n }\n return new Promise(function(resolve) {\n var check = function() {\n var animations = node.getAnimations();\n if (animations.length === 0) {\n resolve(true);\n return;\n }\n Promise.all(animations.map(function(a) {\n return a.finished;\n })).then(function() {\n return resolve(true);\n }).catch(function() {\n var remaining = node.getAnimations();\n if (remaining.some(function(a) {\n return a.playState === \"running\" || a.pending;\n })) {\n check();\n return;\n }\n resolve(false);\n });\n };\n if (hasRAF) {\n requestAnimationFrame(check);\n } else {\n check();\n }\n });\n}\nvar DURATION_REGEX = /(\\d+(?:\\.\\d+)?)\\s*(?:ms|s(?!tiffness))/;\nfunction applyDurationOverride(animation, durationMs) {\n var replaced = animation.replace(DURATION_REGEX, `${durationMs}ms`);\n return replaced === animation ? `${durationMs}ms ${animation}` : replaced;\n}\nvar CSS_TRANSFORM_PROPERTIES = {\n transform: [\n \"translate\",\n \"scale\",\n \"rotate\",\n \"transform\"\n ],\n x: [\n \"translate\"\n ],\n y: [\n \"translate\"\n ],\n scale: [\n \"scale\"\n ],\n scaleX: [\n \"scale\"\n ],\n scaleY: [\n \"scale\"\n ],\n rotate: [\n \"rotate\"\n ],\n rotateX: [\n \"transform\"\n ],\n rotateY: [\n \"transform\"\n ],\n rotateZ: [\n \"transform\"\n ],\n skewX: [\n \"transform\"\n ],\n skewY: [\n \"transform\"\n ]\n};\nvar getCSSProperties = function(key) {\n return CSS_TRANSFORM_PROPERTIES[key] || [\n key\n ];\n};\nvar hyphenatedPropertyCache = {};\nvar emptyProperties = [];\nfunction hyphenateProperty(property) {\n var _hyphenatedPropertyCache, _property;\n if (property.startsWith(\"--\")) return property;\n return (_hyphenatedPropertyCache = hyphenatedPropertyCache)[_property = property] || (_hyphenatedPropertyCache[_property] = property.replace(/[A-Z]/g, function(letter) {\n return `-${letter.toLowerCase()}`;\n }));\n}\nfunction getLifecycleCSSProperties(keys) {\n if (!(keys === null || keys === void 0 ? void 0 : keys.size)) return emptyProperties;\n var properties = /* @__PURE__ */ new Set();\n var _iteratorNormalCompletion = true, _didIteratorError = false, _iteratorError = void 0;\n try {\n for (var _iterator = keys[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) {\n var key = _step.value;\n var _iteratorNormalCompletion1 = true, _didIteratorError1 = false, _iteratorError1 = void 0;\n try {\n for (var _iterator1 = getCSSProperties(key)[Symbol.iterator](), _step1; !(_iteratorNormalCompletion1 = (_step1 = _iterator1.next()).done); _iteratorNormalCompletion1 = true) {\n var property = _step1.value;\n properties.add(hyphenateProperty(property));\n }\n } catch (err) {\n _didIteratorError1 = true;\n _iteratorError1 = err;\n } finally {\n try {\n if (!_iteratorNormalCompletion1 && _iterator1.return != null) {\n _iterator1.return();\n }\n } finally {\n if (_didIteratorError1) {\n throw _iteratorError1;\n }\n }\n }\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 return [\n ...properties\n ].sort();\n}\nfunction readComputedProperties(node, properties) {\n var computed = getComputedStyle(node);\n var values = {};\n var _iteratorNormalCompletion = true, _didIteratorError = false, _iteratorError = void 0;\n try {\n for (var _iterator = properties[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) {\n var property = _step.value;\n var value = computed.getPropertyValue(property);\n if (value) values[property] = 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 return values;\n}\nfunction applyCSSProperties(node, values) {\n for (var property in values) {\n node.style.setProperty(property, values[property]);\n }\n}\nfunction clearCSSProperties(node, properties) {\n var _iteratorNormalCompletion = true, _didIteratorError = false, _iteratorError = void 0;\n try {\n for (var _iterator = properties[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) {\n var property = _step.value;\n node.style.removeProperty(property);\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}\nfunction createAnimations(animations) {\n return {\n animations,\n usePresence,\n ResetPresence,\n inputStyle: \"css\",\n outputStyle: \"css\",\n // @ts-ignore - styleState is added by createComponent\n useAnimations: function(param) {\n var { props, presence, style, componentState, stateRef, styleState, onTransition } = param;\n var _styleState_programLifecycleStyleKeys;\n var isHydrating = componentState.unmounted === true;\n var isEntering = !!componentState.unmounted;\n var isExiting = (presence === null || presence === void 0 ? void 0 : presence[0]) === false;\n var sendExitComplete = presence === null || presence === void 0 ? void 0 : presence[1];\n var onTransitionRef = React.useRef(onTransition);\n onTransitionRef.current = onTransition;\n var emit = function(phase, cause, finished) {\n var _onTransitionRef_current;\n (_onTransitionRef_current = onTransitionRef.current) === null || _onTransitionRef_current === void 0 ? void 0 : _onTransitionRef_current.call(onTransitionRef, phase === \"end\" ? {\n phase,\n cause,\n finished\n } : {\n phase,\n cause\n });\n };\n var wasEnteringRef = React.useRef(isEntering);\n var justFinishedEntering = wasEnteringRef.current && !isEntering;\n React.useEffect(function() {\n wasEnteringRef.current = isEntering;\n });\n var exitCycleIdRef = React.useRef(0);\n var exitCompletedRef = React.useRef(false);\n var wasExitingRef = React.useRef(false);\n var sendExitCompleteRef = React.useRef(sendExitComplete);\n var lastMountedStyleRef = React.useRef({});\n sendExitCompleteRef.current = sendExitComplete;\n var exitCSSProperties = getLifecycleCSSProperties(styleState === null || styleState === void 0 ? void 0 : (_styleState_programLifecycleStyleKeys = styleState.programLifecycleStyleKeys) === null || _styleState_programLifecycleStyleKeys === void 0 ? void 0 : _styleState_programLifecycleStyleKeys.exit);\n var exitCSSPropertiesSignature = exitCSSProperties.join(\"\\0\");\n var enterCycleIdRef = React.useRef(0);\n var enterStartedRef = React.useRef(false);\n var updateCycleIdRef = React.useRef(0);\n var updateInFlightRef = React.useRef(false);\n var prevUpdateSigRef = React.useRef(null);\n var exitStartedRef = React.useRef(false);\n var justStartedExiting = isExiting && !wasExitingRef.current;\n var justStoppedExiting = !isExiting && wasExitingRef.current;\n if (justStartedExiting) {\n exitCycleIdRef.current++;\n exitCompletedRef.current = false;\n }\n if (justStoppedExiting) {\n exitCycleIdRef.current++;\n }\n React.useEffect(function() {\n wasExitingRef.current = isExiting;\n });\n useIsomorphicLayoutEffect(function() {\n if (isExiting) return;\n var host = stateRef.current.host;\n if (!host || !exitCSSProperties.length) {\n lastMountedStyleRef.current = {};\n return;\n }\n var node = host;\n var capture = function() {\n if (stateRef.current.host !== node || wasExitingRef.current) return;\n lastMountedStyleRef.current = readComputedProperties(node, exitCSSProperties);\n };\n if (justFinishedEntering) {\n void waitForAnimations(node).then(capture);\n } else {\n capture();\n }\n }, [\n isExiting,\n justFinishedEntering,\n exitCSSPropertiesSignature\n ]);\n var _styleState_effectiveTransition;\n var effectiveTransition = (_styleState_effectiveTransition = styleState === null || styleState === void 0 ? void 0 : styleState.effectiveTransition) !== null && _styleState_effectiveTransition !== void 0 ? _styleState_effectiveTransition : props.transition;\n var normalized = normalizeTransition(effectiveTransition);\n var animationState = isExiting ? \"exit\" : isEntering || justFinishedEntering ? \"enter\" : \"default\";\n var effectiveAnimationKey = getEffectiveAnimation(normalized, animationState);\n var defaultAnimation = effectiveAnimationKey ? animations[effectiveAnimationKey] : null;\n var animatedProperties = getAnimatedProperties(normalized);\n var hasDefault = normalized.default !== null || normalized.enter !== null || normalized.exit !== null;\n var hasPerPropertyConfigs = animatedProperties.length > 0;\n var keys;\n if (props.animateOnly) {\n keys = props.animateOnly;\n } else if (hasPerPropertyConfigs && !hasDefault) {\n keys = animatedProperties;\n } else if (hasPerPropertyConfigs && hasDefault) {\n keys = [\n \"all\",\n ...animatedProperties\n ];\n } else {\n keys = [\n \"all\"\n ];\n }\n var transition;\n var getTransition = function() {\n var _normalized_config;\n if (transition !== void 0) return transition;\n var delay = normalized.delay ? ` ${normalized.delay}ms` : \"\";\n var duration = (_normalized_config = normalized.config) === null || _normalized_config === void 0 ? void 0 : _normalized_config.duration;\n transition = keys.flatMap(function(key) {\n var propertyAnimation = normalized.properties[key];\n var animation = defaultAnimation;\n if (typeof propertyAnimation === \"string\") {\n animation = animations[propertyAnimation];\n } else if (propertyAnimation === null || propertyAnimation === void 0 ? void 0 : propertyAnimation.type) {\n animation = animations[propertyAnimation.type];\n }\n if (animation && duration) {\n animation = applyDurationOverride(animation, duration);\n }\n return animation ? getCSSProperties(key).map(function(property) {\n return `${property} ${animation}${delay}`;\n }) : [];\n }).join(\", \");\n return transition;\n };\n useIsomorphicLayoutEffect(function() {\n var host = stateRef.current.host;\n if (!sendExitComplete || !isExiting || !host) return;\n var node = host;\n var cycleId = exitCycleIdRef.current;\n if (!exitStartedRef.current) {\n exitStartedRef.current = true;\n emit(\"start\", \"exit\");\n }\n var completeExit = function() {\n var finished = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : true;\n var _sendExitCompleteRef_current;\n if (cycleId !== exitCycleIdRef.current) return;\n if (exitCompletedRef.current) return;\n exitCompletedRef.current = true;\n if (exitStartedRef.current) {\n exitStartedRef.current = false;\n emit(\"end\", \"exit\", finished);\n }\n (_sendExitCompleteRef_current = sendExitCompleteRef.current) === null || _sendExitCompleteRef_current === void 0 ? void 0 : _sendExitCompleteRef_current.call(sendExitCompleteRef);\n };\n if (keys.length === 0) {\n completeExit();\n return;\n }\n var rafId;\n var disposed = false;\n var mountedStyle = lastMountedStyleRef.current;\n var canRestart = exitCSSProperties.length > 0 && Object.keys(mountedStyle).length > 0;\n var exitTarget;\n if (canRestart) {\n node.style.transition = \"none\";\n exitTarget = readComputedProperties(node, exitCSSProperties);\n applyCSSProperties(node, mountedStyle);\n void node.offsetHeight;\n rafId = requestAnimationFrame(function() {\n if (cycleId !== exitCycleIdRef.current) return;\n node.style.transition = getTransition();\n void node.offsetHeight;\n applyCSSProperties(node, exitTarget);\n });\n }\n void waitForAnimations(node).then(function(finished) {\n if (!disposed) completeExit(finished);\n });\n return function() {\n disposed = true;\n if (rafId !== void 0) cancelAnimationFrame(rafId);\n clearCSSProperties(node, exitCSSProperties);\n node.style.transition = \"\";\n };\n }, [\n isExiting,\n exitCSSPropertiesSignature\n ]);\n var styleSignature = onTransition ? (function() {\n var { transition: _t, ...rest } = style;\n var _styleState_classNames;\n return `${JSON.stringify((_styleState_classNames = styleState === null || styleState === void 0 ? void 0 : styleState.classNames) !== null && _styleState_classNames !== void 0 ? _styleState_classNames : null)}|${JSON.stringify(rest)}`;\n })() : \"\";\n useIsomorphicLayoutEffect(function() {\n var host = stateRef.current.host;\n if (!onTransitionRef.current || isExiting || !justFinishedEntering || !host) {\n return;\n }\n var node = host;\n var cycleId = ++enterCycleIdRef.current;\n enterStartedRef.current = true;\n emit(\"start\", \"enter\");\n void waitForAnimations(node).then(function(finished) {\n if (cycleId !== enterCycleIdRef.current || !enterStartedRef.current) return;\n enterStartedRef.current = false;\n emit(\"end\", \"enter\", finished);\n });\n }, [\n justFinishedEntering,\n isExiting\n ]);\n useIsomorphicLayoutEffect(function() {\n var host = stateRef.current.host;\n if (!onTransitionRef.current || isEntering || justFinishedEntering || isExiting || !host) {\n prevUpdateSigRef.current = styleSignature;\n return;\n }\n if (prevUpdateSigRef.current === null) {\n prevUpdateSigRef.current = styleSignature;\n return;\n }\n if (styleSignature === prevUpdateSigRef.current) return;\n prevUpdateSigRef.current = styleSignature;\n var node = host;\n if (updateInFlightRef.current) {\n emit(\"end\", \"update\", false);\n }\n updateInFlightRef.current = true;\n var cycleId = ++updateCycleIdRef.current;\n emit(\"start\", \"update\");\n void waitForAnimations(node).then(function(finished) {\n if (cycleId !== updateCycleIdRef.current) return;\n updateInFlightRef.current = false;\n emit(\"end\", \"update\", finished);\n });\n }, [\n styleSignature,\n isEntering,\n justFinishedEntering,\n isExiting\n ]);\n useIsomorphicLayoutEffect(function() {\n if (justStartedExiting && enterStartedRef.current) {\n enterCycleIdRef.current++;\n enterStartedRef.current = false;\n emit(\"end\", \"enter\", false);\n }\n if (justStoppedExiting && exitStartedRef.current && !exitCompletedRef.current) {\n exitStartedRef.current = false;\n emit(\"end\", \"exit\", false);\n }\n }, [\n justStartedExiting,\n justStoppedExiting\n ]);\n if (isHydrating) {\n return null;\n }\n if (!hasNormalizedAnimation(normalized)) {\n return null;\n }\n if (Array.isArray(style.transform)) {\n style.transform = transformsToString(style.transform);\n }\n style.transition = getTransition();\n if (process.env.NODE_ENV === \"development\" && props[\"debug\"] === \"verbose\") {\n console.info(\"CSS animation\", {\n props,\n animations,\n normalized,\n defaultAnimation,\n style,\n isEntering,\n isExiting\n });\n }\n return {\n style,\n className: isEntering ? \"t_unmounted\" : \"\"\n };\n }\n };\n}\nexport {\n createAnimations\n};\n//# sourceMappingURL=createAnimations.js.map\n"],"mappings":";;;;;;;AAKA,IAAI,SAAS,OAAO,0BAA0B;AAC9C,SAAS,kBAAkB,MAAM;CAC/B,IAAI,OAAO,KAAK,kBAAkB,YAAY;EAC5C,OAAO,QAAQ,QAAQ,IAAI;CAC7B;CACA,OAAO,IAAI,QAAQ,SAAS,SAAS;EACnC,IAAI,QAAQ,WAAW;GACrB,IAAI,aAAa,KAAK,cAAc;GACpC,IAAI,WAAW,WAAW,GAAG;IAC3B,QAAQ,IAAI;IACZ;GACF;GACA,QAAQ,IAAI,WAAW,IAAI,SAAS,GAAG;IACrC,OAAO,EAAE;GACX,CAAC,CAAC,CAAC,CAAC,KAAK,WAAW;IAClB,OAAO,QAAQ,IAAI;GACrB,CAAC,CAAC,CAAC,MAAM,WAAW;IAClB,IAAI,YAAY,KAAK,cAAc;IACnC,IAAI,UAAU,KAAK,SAAS,GAAG;KAC7B,OAAO,EAAE,cAAc,aAAa,EAAE;IACxC,CAAC,GAAG;KACF,MAAM;KACN;IACF;IACA,QAAQ,KAAK;GACf,CAAC;EACH;EACA,IAAI,QAAQ;GACV,sBAAsB,KAAK;EAC7B,OAAO;GACL,MAAM;EACR;CACF,CAAC;AACH;AACA,IAAI,iBAAiB;AACrB,SAAS,sBAAsB,WAAW,YAAY;CACpD,IAAI,WAAW,UAAU,QAAQ,gBAAgB,GAAG,WAAW,GAAG;CAClE,OAAO,aAAa,YAAY,GAAG,WAAW,KAAK,cAAc;AACnE;AACA,IAAI,2BAA2B;CAC7B,WAAW;EACT;EACA;EACA;EACA;CACF;CACA,GAAG,CACD,WACF;CACA,GAAG,CACD,WACF;CACA,OAAO,CACL,OACF;CACA,QAAQ,CACN,OACF;CACA,QAAQ,CACN,OACF;CACA,QAAQ,CACN,QACF;CACA,SA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AkB,UAAU;IAC5B,IAAI,UAAU,EAAE,iBAAiB;IACjC,KAAK,SAAS,QAAQ;IACtB,KAAK,kBAAkB,IAAI,CAAC,CAAC,KAAK,SAAS,UAAU;KACnD,IAAI,YAAY,iBAAiB,SAAS;KAC1C,kBAAkB,UAAU;KAC5B,KAAK,OAAO,UAAU,QAAQ;IAChC,CAAC;GACH,GAAG;IACD;IACA;IACA;IACA;GACF,CAAC;GACD,0BAA0B,WAAW;IACnC,IAAI,sBAAsB,gBAAgB,SAAS;KACjD,gBAAgB;KAChB,gBAAgB,UAAU;KAC1B,KAAK,OAAO,SAAS,KAAK;IAC5B;IACA,IAAI,sBAAsB,eAAe,WAAW,CAAC,iBAAiB,SAAS;KAC7E,eAAe,UAAU;KACzB,KAAK,OAAO,QAAQ,KAAK;IAC3B;GACF,GAAG,CACD,oBACA,kBACF,CAAC;GACD,IAAI,aAAa;IACf,OAAO;GACT;GACA,IAAI,CAACA,aAAuB,UAAU,GAAG;IACvC,OAAO;GACT;GACA,IAAI,MAAM,QAAQ,MAAM,SAAS,GAAG;IAClC,MAAM,YAAY,mBAAmB,MAAM,SAAS;GACtD;GACA,MAAM,aAAa,cAAc;GACjC,IAAI,QAAQ,IAAI,aAAa,iBAAiB,MAAM,aAAa,WAAW;IAC1E,QAAQ,KAAK,iBAAiB;KAC5B;KACA;KACA;KACA;KACA;KACA;KACA;IACF,CAAC;GACH;GACA,OAAO;IACL;IACA,WAAW,aAAa,gBAAgB;GAC1C;EACF;CACF;AACF"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tamagui/animations-css",
|
|
3
|
-
"version": "3.0.0-beta.
|
|
3
|
+
"version": "3.0.0-beta.804.1",
|
|
4
4
|
"gitHead": "a49cc7ea6b93ba384e77a4880ae48ac4a5635c14",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"source": "src/index.ts",
|
|
@@ -54,14 +54,14 @@
|
|
|
54
54
|
"clean:build": "tamagui-build clean:build"
|
|
55
55
|
},
|
|
56
56
|
"dependencies": {
|
|
57
|
-
"@tamagui/animation-helpers": "3.0.0-beta.
|
|
58
|
-
"@tamagui/constants": "3.0.0-beta.
|
|
59
|
-
"@tamagui/cubic-bezier-animator": "3.0.0-beta.
|
|
60
|
-
"@tamagui/use-presence": "3.0.0-beta.
|
|
61
|
-
"@tamagui/web": "3.0.0-beta.
|
|
57
|
+
"@tamagui/animation-helpers": "3.0.0-beta.804.1",
|
|
58
|
+
"@tamagui/constants": "3.0.0-beta.804.1",
|
|
59
|
+
"@tamagui/cubic-bezier-animator": "3.0.0-beta.804.1",
|
|
60
|
+
"@tamagui/use-presence": "3.0.0-beta.804.1",
|
|
61
|
+
"@tamagui/web": "3.0.0-beta.804.1"
|
|
62
62
|
},
|
|
63
63
|
"devDependencies": {
|
|
64
|
-
"@tamagui/build": "3.0.0-beta.
|
|
64
|
+
"@tamagui/build": "3.0.0-beta.804.1",
|
|
65
65
|
"react": "19.2.3",
|
|
66
66
|
"react-dom": "19.2.3"
|
|
67
67
|
},
|
package/src/createAnimations.tsx
CHANGED
|
@@ -7,7 +7,7 @@ import {
|
|
|
7
7
|
import { useIsomorphicLayoutEffect } from '@tamagui/constants'
|
|
8
8
|
import { ResetPresence, usePresence } from '@tamagui/use-presence'
|
|
9
9
|
import type { AnimationDriver } from '@tamagui/web'
|
|
10
|
-
import { transformsToString } from '@tamagui/web'
|
|
10
|
+
import { transformsToString } from '@tamagui/web/internal-runtime'
|
|
11
11
|
import React from 'react'
|
|
12
12
|
|
|
13
13
|
// rAF-driven animated number is browser-only. read (don't call) at module scope
|
|
@@ -6,6 +6,6 @@
|
|
|
6
6
|
],
|
|
7
7
|
"version": 3,
|
|
8
8
|
"sourcesContent": [
|
|
9
|
-
"import {\n normalizeTransition,\n getAnimatedProperties,\n hasAnimation as hasNormalizedAnimation,\n getEffectiveAnimation,\n} from '@tamagui/animation-helpers'\nimport { useIsomorphicLayoutEffect } from '@tamagui/constants'\nimport { ResetPresence, usePresence } from '@tamagui/use-presence'\nimport type { AnimationDriver } from '@tamagui/web'\nimport { transformsToString } from '@tamagui/web'\nimport React from 'react'\n\n// rAF-driven animated number is browser-only. read (don't call) at module scope\n// so ssr never touches requestAnimationFrame.\nconst hasRAF = typeof requestAnimationFrame !== 'undefined'\n\n// resolve once all WAAPI animations on `node` finish. mirrors base-ui's\n// useAnimationsFinished: resolves immediately when the browser exposes no\n// animations (zero-animation elements), and re-checks after an aborted\n// animation in case a property it depended on changed mid-flight and started a\n// new one. falls back to immediate resolve when getAnimations is unavailable\n// (ssr / older webviews). resolves `false` when animations were canceled with\n// nothing left running (interruption).\nfunction waitForAnimations(node: HTMLElement): Promise<boolean> {\n if (typeof node.getAnimations !== 'function') {\n return Promise.resolve(true)\n }\n return new Promise<boolean>((resolve) => {\n const check = () => {\n const animations = node.getAnimations()\n if (animations.length === 0) {\n resolve(true)\n return\n }\n Promise.all(animations.map((a) => a.finished))\n .then(() => resolve(true))\n .catch(() => {\n const remaining = node.getAnimations()\n if (remaining.some((a) => a.playState === 'running' || a.pending)) {\n check()\n return\n }\n resolve(false)\n })\n }\n // css transitions register as pending until the next style recalc, so give\n // the browser one frame to start them before we read getAnimations.\n if (hasRAF) {\n requestAnimationFrame(check)\n } else {\n check()\n }\n })\n}\n\nconst DURATION_REGEX = /(\\d+(?:\\.\\d+)?)\\s*(?:ms|s(?!tiffness))/\n\n/**\n * Apply duration override to a CSS animation string\n * Replaces the existing duration with the override value\n */\nfunction applyDurationOverride(animation: string, durationMs: number): string {\n const replaced = animation.replace(DURATION_REGEX, `${durationMs}ms`)\n return replaced === animation ? `${durationMs}ms ${animation}` : replaced\n}\n\nconst CSS_TRANSFORM_PROPERTIES: Record<string, string[]> = {\n transform: ['translate', 'scale', 'rotate', 'transform'],\n x: ['translate'],\n y: ['translate'],\n scale: ['scale'],\n scaleX: ['scale'],\n scaleY: ['scale'],\n rotate: ['rotate'],\n rotateX: ['transform'],\n rotateY: ['transform'],\n rotateZ: ['transform'],\n skewX: ['transform'],\n skewY: ['transform'],\n}\n\nconst getCSSProperties = (key: string) => {\n return CSS_TRANSFORM_PROPERTIES[key] || [key]\n}\n\nconst hyphenatedPropertyCache: Record<string, string> = {}\nconst emptyProperties: string[] = []\n\nfunction hyphenateProperty(property: string): string {\n if (property.startsWith('--')) return property\n return (hyphenatedPropertyCache[property] ||= property.replace(\n /[A-Z]/g,\n (letter) => `-${letter.toLowerCase()}`\n ))\n}\n\nfunction getLifecycleCSSProperties(keys: Set<string> | undefined): string[] {\n if (!keys?.size) return emptyProperties\n const properties = new Set<string>()\n for (const key of keys) {\n for (const property of getCSSProperties(key)) {\n properties.add(hyphenateProperty(property))\n }\n }\n return [...properties].sort()\n}\n\nfunction readComputedProperties(\n node: HTMLElement,\n properties: readonly string[]\n): Record<string, string> {\n const computed = getComputedStyle(node)\n const values: Record<string, string> = {}\n for (const property of properties) {\n const value = computed.getPropertyValue(property)\n if (value) values[property] = value\n }\n return values\n}\n\nfunction applyCSSProperties(node: HTMLElement, values: Record<string, string>): void {\n for (const property in values) {\n node.style.setProperty(property, values[property])\n }\n}\n\nfunction clearCSSProperties(node: HTMLElement, properties: readonly string[]): void {\n for (const property of properties) {\n node.style.removeProperty(property)\n }\n}\n\nexport function createAnimations<A extends object>(animations: A): AnimationDriver<A> {\n return {\n animations,\n usePresence,\n ResetPresence,\n inputStyle: 'css',\n outputStyle: 'css',\n\n // @ts-ignore - styleState is added by createComponent\n useAnimations: ({\n props,\n presence,\n style,\n componentState,\n stateRef,\n styleState,\n onTransition,\n }: any) => {\n const isHydrating = componentState.unmounted === true\n const isEntering = !!componentState.unmounted\n const isExiting = presence?.[0] === false\n const sendExitComplete = presence?.[1]\n const onTransitionRef = React.useRef(onTransition)\n onTransitionRef.current = onTransition\n const emit = (\n phase: 'start' | 'end',\n cause: 'enter' | 'exit' | 'update',\n finished?: boolean\n ) => {\n onTransitionRef.current?.(\n phase === 'end' ? { phase, cause, finished } : { phase, cause }\n )\n }\n\n // Track if we just finished entering (transition from entering to not entering)\n // This is needed because the CSS transition happens on the render AFTER t_unmounted is removed\n const wasEnteringRef = React.useRef(isEntering)\n const justFinishedEntering = wasEnteringRef.current && !isEntering\n React.useEffect(() => {\n wasEnteringRef.current = isEntering\n })\n\n // exit cycle guards to prevent stale/duplicate completion\n const exitCycleIdRef = React.useRef(0)\n const exitCompletedRef = React.useRef(false)\n const wasExitingRef = React.useRef(false)\n const sendExitCompleteRef = React.useRef(sendExitComplete)\n const lastMountedStyleRef = React.useRef<Record<string, string>>({})\n sendExitCompleteRef.current = sendExitComplete\n\n const exitCSSProperties = getLifecycleCSSProperties(\n styleState?.programLifecycleStyleKeys?.exit\n )\n const exitCSSPropertiesSignature = exitCSSProperties.join('\\0')\n\n // onTransition lifecycle bookkeeping (independent from presence completion)\n const enterCycleIdRef = React.useRef(0)\n const enterStartedRef = React.useRef(false)\n const updateCycleIdRef = React.useRef(0)\n const updateInFlightRef = React.useRef(false)\n const prevUpdateSigRef = React.useRef<string | null>(null)\n const exitStartedRef = React.useRef(false)\n\n // detect transition into/out of exiting state\n const justStartedExiting = isExiting && !wasExitingRef.current\n const justStoppedExiting = !isExiting && wasExitingRef.current\n\n // start new exit cycle only on transition INTO exiting\n if (justStartedExiting) {\n exitCycleIdRef.current++\n exitCompletedRef.current = false\n }\n if (justStoppedExiting) {\n exitCycleIdRef.current++\n }\n\n // track previous exiting state\n React.useEffect(() => {\n wasExitingRef.current = isExiting\n })\n\n // Snapshot the actual mounted CSS values for every property with an exit\n // clause. Most program values live in generated classes rather than the\n // inline `style` object, so computed style is the only complete source.\n // The snapshot becomes the reset point for normal and interrupted exits.\n useIsomorphicLayoutEffect(() => {\n if (isExiting) return\n const host = stateRef.current.host\n if (!host || !exitCSSProperties.length) {\n lastMountedStyleRef.current = {}\n return\n }\n const node = host as HTMLElement\n const capture = () => {\n if (stateRef.current.host !== node || wasExitingRef.current) return\n lastMountedStyleRef.current = readComputedProperties(node, exitCSSProperties)\n }\n\n // The first mounted layout effect can run while an enter clause is still\n // active. Capture again after that concrete transition settles so a later\n // exit restarts from the mounted value, not the enter value.\n if (justFinishedEntering) {\n void waitForAnimations(node).then(capture)\n } else {\n capture()\n }\n }, [isExiting, justFinishedEntering, exitCSSPropertiesSignature])\n\n // use effectiveTransition computed by createComponent (single source of truth)\n const effectiveTransition = styleState?.effectiveTransition ?? props.transition\n\n // Normalize the transition prop to a consistent format\n const normalized = normalizeTransition(effectiveTransition)\n\n // Determine animation state and get effective animation\n // Use 'enter' if we're entering OR if we just finished entering (transition is happening)\n const animationState = isExiting\n ? 'exit'\n : isEntering || justFinishedEntering\n ? 'enter'\n : 'default'\n const effectiveAnimationKey = getEffectiveAnimation(normalized, animationState)\n const defaultAnimation = effectiveAnimationKey\n ? animations[effectiveAnimationKey]\n : null\n const animatedProperties = getAnimatedProperties(normalized)\n\n // Determine which properties to animate\n // - animateOnly prop is an exclusive filter (only animate those properties)\n // - per-property configs WITHOUT a default = only animate those specific properties\n // - per-property configs WITH a default = per-property overrides + default for rest\n const hasDefault =\n normalized.default !== null ||\n normalized.enter !== null ||\n normalized.exit !== null\n const hasPerPropertyConfigs = animatedProperties.length > 0\n\n let keys: string[]\n if (props.animateOnly) {\n // animateOnly is explicit filter\n keys = props.animateOnly\n } else if (hasPerPropertyConfigs && !hasDefault) {\n // object format without default: { opacity: '200ms' } = only animate opacity\n keys = animatedProperties\n } else if (hasPerPropertyConfigs && hasDefault) {\n // array format or object with default: 'all' first, then per-property overrides\n // CSS transition specificity: later declarations override earlier ones for the same property\n keys = ['all', ...animatedProperties]\n } else {\n // simple string format: 'quick' = animate all\n keys = ['all']\n }\n\n let transition: string | undefined\n const getTransition = () => {\n if (transition !== undefined) return transition\n const delay = normalized.delay ? ` ${normalized.delay}ms` : ''\n const duration = normalized.config?.duration\n transition = keys\n .flatMap((key) => {\n const propertyAnimation = normalized.properties[key]\n let animation = defaultAnimation\n if (typeof propertyAnimation === 'string') {\n animation = animations[propertyAnimation]\n } else if (propertyAnimation?.type) {\n animation = animations[propertyAnimation.type]\n }\n if (animation && duration) {\n animation = applyDurationOverride(animation, duration)\n }\n return animation\n ? getCSSProperties(key).map(\n (property) => `${property} ${animation}${delay}`\n )\n : []\n })\n .join(', ')\n return transition\n }\n\n useIsomorphicLayoutEffect(() => {\n const host = stateRef.current.host\n if (!sendExitComplete || !isExiting || !host) return\n const node = host as HTMLElement\n\n // capture current cycle id for this effect\n const cycleId = exitCycleIdRef.current\n\n // emit exit start once per cycle\n if (!exitStartedRef.current) {\n exitStartedRef.current = true\n emit('start', 'exit')\n }\n\n // helper to complete exit with guards. the exit 'end' event fires\n // immediately before presence safeToRemove so users can observe exit\n // completion without reaching into presence internals.\n const completeExit = (finished = true) => {\n if (cycleId !== exitCycleIdRef.current) return\n if (exitCompletedRef.current) return\n exitCompletedRef.current = true\n if (exitStartedRef.current) {\n exitStartedRef.current = false\n emit('end', 'exit', finished)\n }\n sendExitCompleteRef.current?.()\n }\n\n // if no properties to animate (animateOnly=[]), complete immediately\n if (keys.length === 0) {\n completeExit()\n return\n }\n\n // React can apply the exit class in the same render batch as the\n // transition. Restart from the last mounted computed values so normal\n // and interrupted exits both produce a concrete browser transition.\n let rafId: number | undefined\n let disposed = false\n\n const mountedStyle = lastMountedStyleRef.current\n const canRestart =\n exitCSSProperties.length > 0 && Object.keys(mountedStyle).length > 0\n let exitTarget: Record<string, string> | undefined\n if (canRestart) {\n node.style.transition = 'none'\n // With transitions disabled, the exit classes expose their final\n // targets immediately. Capture those, then restore the mounted values.\n exitTarget = readComputedProperties(node, exitCSSProperties)\n applyCSSProperties(node, mountedStyle)\n void node.offsetHeight\n rafId = requestAnimationFrame(() => {\n if (cycleId !== exitCycleIdRef.current) return\n node.style.transition = getTransition()\n void node.offsetHeight\n applyCSSProperties(node, exitTarget!)\n })\n }\n\n // wait for the browser's concrete animations. this covers `all`,\n // transform aliases, delays, and concurrent WAAPI animations without\n // guessing property names or maintaining a duration timer.\n void waitForAnimations(node).then((finished) => {\n if (!disposed) completeExit(finished)\n })\n\n return () => {\n disposed = true\n if (rafId !== undefined) cancelAnimationFrame(rafId)\n clearCSSProperties(node, exitCSSProperties)\n // restore transition: the exit handling sets node.style.transition='none'\n // directly on the DOM (bypassing React). if exit is interrupted (e.g. same-key\n // re-entry in AnimatePresence), React won't re-apply its managed transition\n // value because it hasn't changed in the virtual DOM. clearing the inline\n // override lets React's value take effect again.\n node.style.transition = ''\n }\n }, [isExiting, exitCSSPropertiesSignature])\n\n // signature of the animatable style, so the update effect can detect\n // in-place style changes. the css driver applies most style values as\n // atomic classNames (not inline style), so the signature must include the\n // className map. only computed when a listener is attached.\n const styleSignature = onTransition\n ? (() => {\n const { transition: _t, ...rest } = style\n return `${JSON.stringify(styleState?.classNames ?? null)}|${JSON.stringify(rest)}`\n })()\n : ''\n\n // enter lifecycle: emit start when the enter transition kicks off, end\n // once every animation on the node finishes (getAnimations-based, resolves\n // immediately for zero-animation elements). the promise outlives benign\n // re-renders because it keys off the cycle id, not the effect lifetime.\n useIsomorphicLayoutEffect(() => {\n const host = stateRef.current.host\n if (!onTransitionRef.current || isExiting || !justFinishedEntering || !host) {\n return\n }\n const node = host as HTMLElement\n const cycleId = ++enterCycleIdRef.current\n enterStartedRef.current = true\n emit('start', 'enter')\n void waitForAnimations(node).then((finished) => {\n if (cycleId !== enterCycleIdRef.current || !enterStartedRef.current) return\n enterStartedRef.current = false\n emit('end', 'enter', finished)\n })\n }, [justFinishedEntering, isExiting])\n\n // update lifecycle: a style change while mounted (not entering or exiting).\n // a new update that supersedes an in-flight one emits end(finished:false).\n useIsomorphicLayoutEffect(() => {\n const host = stateRef.current.host\n if (\n !onTransitionRef.current ||\n isEntering ||\n justFinishedEntering ||\n isExiting ||\n !host\n ) {\n // keep the signature current so leaving enter/exit isn't seen as an update\n prevUpdateSigRef.current = styleSignature\n return\n }\n if (prevUpdateSigRef.current === null) {\n prevUpdateSigRef.current = styleSignature\n return\n }\n if (styleSignature === prevUpdateSigRef.current) return\n prevUpdateSigRef.current = styleSignature\n\n const node = host as HTMLElement\n if (updateInFlightRef.current) {\n emit('end', 'update', false)\n }\n updateInFlightRef.current = true\n const cycleId = ++updateCycleIdRef.current\n emit('start', 'update')\n void waitForAnimations(node).then((finished) => {\n if (cycleId !== updateCycleIdRef.current) return\n updateInFlightRef.current = false\n emit('end', 'update', finished)\n })\n }, [styleSignature, isEntering, justFinishedEntering, isExiting])\n\n // interruption: emit a finished:false end for an enter canceled by an exit,\n // or an exit canceled by a re-enter (before its own completion fired).\n useIsomorphicLayoutEffect(() => {\n if (justStartedExiting && enterStartedRef.current) {\n enterCycleIdRef.current++\n enterStartedRef.current = false\n emit('end', 'enter', false)\n }\n if (justStoppedExiting && exitStartedRef.current && !exitCompletedRef.current) {\n exitStartedRef.current = false\n emit('end', 'exit', false)\n }\n }, [justStartedExiting, justStoppedExiting])\n\n // tamagui doesnt even use animation output during hydration\n if (isHydrating) {\n return null\n }\n\n // Check if we have any animation to apply\n if (!hasNormalizedAnimation(normalized)) {\n return null\n }\n\n if (Array.isArray(style.transform)) {\n style.transform = transformsToString(style.transform)\n }\n\n style.transition = getTransition()\n\n if (process.env.NODE_ENV === 'development' && props['debug'] === 'verbose') {\n console.info('CSS animation', {\n props,\n animations,\n normalized,\n defaultAnimation,\n style,\n isEntering,\n isExiting,\n })\n }\n\n return { style, className: isEntering ? 't_unmounted' : '' }\n },\n }\n}\n"
|
|
9
|
+
"import {\n normalizeTransition,\n getAnimatedProperties,\n hasAnimation as hasNormalizedAnimation,\n getEffectiveAnimation,\n} from '@tamagui/animation-helpers'\nimport { useIsomorphicLayoutEffect } from '@tamagui/constants'\nimport { ResetPresence, usePresence } from '@tamagui/use-presence'\nimport type { AnimationDriver } from '@tamagui/web'\nimport { transformsToString } from '@tamagui/web/internal-runtime'\nimport React from 'react'\n\n// rAF-driven animated number is browser-only. read (don't call) at module scope\n// so ssr never touches requestAnimationFrame.\nconst hasRAF = typeof requestAnimationFrame !== 'undefined'\n\n// resolve once all WAAPI animations on `node` finish. mirrors base-ui's\n// useAnimationsFinished: resolves immediately when the browser exposes no\n// animations (zero-animation elements), and re-checks after an aborted\n// animation in case a property it depended on changed mid-flight and started a\n// new one. falls back to immediate resolve when getAnimations is unavailable\n// (ssr / older webviews). resolves `false` when animations were canceled with\n// nothing left running (interruption).\nfunction waitForAnimations(node: HTMLElement): Promise<boolean> {\n if (typeof node.getAnimations !== 'function') {\n return Promise.resolve(true)\n }\n return new Promise<boolean>((resolve) => {\n const check = () => {\n const animations = node.getAnimations()\n if (animations.length === 0) {\n resolve(true)\n return\n }\n Promise.all(animations.map((a) => a.finished))\n .then(() => resolve(true))\n .catch(() => {\n const remaining = node.getAnimations()\n if (remaining.some((a) => a.playState === 'running' || a.pending)) {\n check()\n return\n }\n resolve(false)\n })\n }\n // css transitions register as pending until the next style recalc, so give\n // the browser one frame to start them before we read getAnimations.\n if (hasRAF) {\n requestAnimationFrame(check)\n } else {\n check()\n }\n })\n}\n\nconst DURATION_REGEX = /(\\d+(?:\\.\\d+)?)\\s*(?:ms|s(?!tiffness))/\n\n/**\n * Apply duration override to a CSS animation string\n * Replaces the existing duration with the override value\n */\nfunction applyDurationOverride(animation: string, durationMs: number): string {\n const replaced = animation.replace(DURATION_REGEX, `${durationMs}ms`)\n return replaced === animation ? `${durationMs}ms ${animation}` : replaced\n}\n\nconst CSS_TRANSFORM_PROPERTIES: Record<string, string[]> = {\n transform: ['translate', 'scale', 'rotate', 'transform'],\n x: ['translate'],\n y: ['translate'],\n scale: ['scale'],\n scaleX: ['scale'],\n scaleY: ['scale'],\n rotate: ['rotate'],\n rotateX: ['transform'],\n rotateY: ['transform'],\n rotateZ: ['transform'],\n skewX: ['transform'],\n skewY: ['transform'],\n}\n\nconst getCSSProperties = (key: string) => {\n return CSS_TRANSFORM_PROPERTIES[key] || [key]\n}\n\nconst hyphenatedPropertyCache: Record<string, string> = {}\nconst emptyProperties: string[] = []\n\nfunction hyphenateProperty(property: string): string {\n if (property.startsWith('--')) return property\n return (hyphenatedPropertyCache[property] ||= property.replace(\n /[A-Z]/g,\n (letter) => `-${letter.toLowerCase()}`\n ))\n}\n\nfunction getLifecycleCSSProperties(keys: Set<string> | undefined): string[] {\n if (!keys?.size) return emptyProperties\n const properties = new Set<string>()\n for (const key of keys) {\n for (const property of getCSSProperties(key)) {\n properties.add(hyphenateProperty(property))\n }\n }\n return [...properties].sort()\n}\n\nfunction readComputedProperties(\n node: HTMLElement,\n properties: readonly string[]\n): Record<string, string> {\n const computed = getComputedStyle(node)\n const values: Record<string, string> = {}\n for (const property of properties) {\n const value = computed.getPropertyValue(property)\n if (value) values[property] = value\n }\n return values\n}\n\nfunction applyCSSProperties(node: HTMLElement, values: Record<string, string>): void {\n for (const property in values) {\n node.style.setProperty(property, values[property])\n }\n}\n\nfunction clearCSSProperties(node: HTMLElement, properties: readonly string[]): void {\n for (const property of properties) {\n node.style.removeProperty(property)\n }\n}\n\nexport function createAnimations<A extends object>(animations: A): AnimationDriver<A> {\n return {\n animations,\n usePresence,\n ResetPresence,\n inputStyle: 'css',\n outputStyle: 'css',\n\n // @ts-ignore - styleState is added by createComponent\n useAnimations: ({\n props,\n presence,\n style,\n componentState,\n stateRef,\n styleState,\n onTransition,\n }: any) => {\n const isHydrating = componentState.unmounted === true\n const isEntering = !!componentState.unmounted\n const isExiting = presence?.[0] === false\n const sendExitComplete = presence?.[1]\n const onTransitionRef = React.useRef(onTransition)\n onTransitionRef.current = onTransition\n const emit = (\n phase: 'start' | 'end',\n cause: 'enter' | 'exit' | 'update',\n finished?: boolean\n ) => {\n onTransitionRef.current?.(\n phase === 'end' ? { phase, cause, finished } : { phase, cause }\n )\n }\n\n // Track if we just finished entering (transition from entering to not entering)\n // This is needed because the CSS transition happens on the render AFTER t_unmounted is removed\n const wasEnteringRef = React.useRef(isEntering)\n const justFinishedEntering = wasEnteringRef.current && !isEntering\n React.useEffect(() => {\n wasEnteringRef.current = isEntering\n })\n\n // exit cycle guards to prevent stale/duplicate completion\n const exitCycleIdRef = React.useRef(0)\n const exitCompletedRef = React.useRef(false)\n const wasExitingRef = React.useRef(false)\n const sendExitCompleteRef = React.useRef(sendExitComplete)\n const lastMountedStyleRef = React.useRef<Record<string, string>>({})\n sendExitCompleteRef.current = sendExitComplete\n\n const exitCSSProperties = getLifecycleCSSProperties(\n styleState?.programLifecycleStyleKeys?.exit\n )\n const exitCSSPropertiesSignature = exitCSSProperties.join('\\0')\n\n // onTransition lifecycle bookkeeping (independent from presence completion)\n const enterCycleIdRef = React.useRef(0)\n const enterStartedRef = React.useRef(false)\n const updateCycleIdRef = React.useRef(0)\n const updateInFlightRef = React.useRef(false)\n const prevUpdateSigRef = React.useRef<string | null>(null)\n const exitStartedRef = React.useRef(false)\n\n // detect transition into/out of exiting state\n const justStartedExiting = isExiting && !wasExitingRef.current\n const justStoppedExiting = !isExiting && wasExitingRef.current\n\n // start new exit cycle only on transition INTO exiting\n if (justStartedExiting) {\n exitCycleIdRef.current++\n exitCompletedRef.current = false\n }\n if (justStoppedExiting) {\n exitCycleIdRef.current++\n }\n\n // track previous exiting state\n React.useEffect(() => {\n wasExitingRef.current = isExiting\n })\n\n // Snapshot the actual mounted CSS values for every property with an exit\n // clause. Most program values live in generated classes rather than the\n // inline `style` object, so computed style is the only complete source.\n // The snapshot becomes the reset point for normal and interrupted exits.\n useIsomorphicLayoutEffect(() => {\n if (isExiting) return\n const host = stateRef.current.host\n if (!host || !exitCSSProperties.length) {\n lastMountedStyleRef.current = {}\n return\n }\n const node = host as HTMLElement\n const capture = () => {\n if (stateRef.current.host !== node || wasExitingRef.current) return\n lastMountedStyleRef.current = readComputedProperties(node, exitCSSProperties)\n }\n\n // The first mounted layout effect can run while an enter clause is still\n // active. Capture again after that concrete transition settles so a later\n // exit restarts from the mounted value, not the enter value.\n if (justFinishedEntering) {\n void waitForAnimations(node).then(capture)\n } else {\n capture()\n }\n }, [isExiting, justFinishedEntering, exitCSSPropertiesSignature])\n\n // use effectiveTransition computed by createComponent (single source of truth)\n const effectiveTransition = styleState?.effectiveTransition ?? props.transition\n\n // Normalize the transition prop to a consistent format\n const normalized = normalizeTransition(effectiveTransition)\n\n // Determine animation state and get effective animation\n // Use 'enter' if we're entering OR if we just finished entering (transition is happening)\n const animationState = isExiting\n ? 'exit'\n : isEntering || justFinishedEntering\n ? 'enter'\n : 'default'\n const effectiveAnimationKey = getEffectiveAnimation(normalized, animationState)\n const defaultAnimation = effectiveAnimationKey\n ? animations[effectiveAnimationKey]\n : null\n const animatedProperties = getAnimatedProperties(normalized)\n\n // Determine which properties to animate\n // - animateOnly prop is an exclusive filter (only animate those properties)\n // - per-property configs WITHOUT a default = only animate those specific properties\n // - per-property configs WITH a default = per-property overrides + default for rest\n const hasDefault =\n normalized.default !== null ||\n normalized.enter !== null ||\n normalized.exit !== null\n const hasPerPropertyConfigs = animatedProperties.length > 0\n\n let keys: string[]\n if (props.animateOnly) {\n // animateOnly is explicit filter\n keys = props.animateOnly\n } else if (hasPerPropertyConfigs && !hasDefault) {\n // object format without default: { opacity: '200ms' } = only animate opacity\n keys = animatedProperties\n } else if (hasPerPropertyConfigs && hasDefault) {\n // array format or object with default: 'all' first, then per-property overrides\n // CSS transition specificity: later declarations override earlier ones for the same property\n keys = ['all', ...animatedProperties]\n } else {\n // simple string format: 'quick' = animate all\n keys = ['all']\n }\n\n let transition: string | undefined\n const getTransition = () => {\n if (transition !== undefined) return transition\n const delay = normalized.delay ? ` ${normalized.delay}ms` : ''\n const duration = normalized.config?.duration\n transition = keys\n .flatMap((key) => {\n const propertyAnimation = normalized.properties[key]\n let animation = defaultAnimation\n if (typeof propertyAnimation === 'string') {\n animation = animations[propertyAnimation]\n } else if (propertyAnimation?.type) {\n animation = animations[propertyAnimation.type]\n }\n if (animation && duration) {\n animation = applyDurationOverride(animation, duration)\n }\n return animation\n ? getCSSProperties(key).map(\n (property) => `${property} ${animation}${delay}`\n )\n : []\n })\n .join(', ')\n return transition\n }\n\n useIsomorphicLayoutEffect(() => {\n const host = stateRef.current.host\n if (!sendExitComplete || !isExiting || !host) return\n const node = host as HTMLElement\n\n // capture current cycle id for this effect\n const cycleId = exitCycleIdRef.current\n\n // emit exit start once per cycle\n if (!exitStartedRef.current) {\n exitStartedRef.current = true\n emit('start', 'exit')\n }\n\n // helper to complete exit with guards. the exit 'end' event fires\n // immediately before presence safeToRemove so users can observe exit\n // completion without reaching into presence internals.\n const completeExit = (finished = true) => {\n if (cycleId !== exitCycleIdRef.current) return\n if (exitCompletedRef.current) return\n exitCompletedRef.current = true\n if (exitStartedRef.current) {\n exitStartedRef.current = false\n emit('end', 'exit', finished)\n }\n sendExitCompleteRef.current?.()\n }\n\n // if no properties to animate (animateOnly=[]), complete immediately\n if (keys.length === 0) {\n completeExit()\n return\n }\n\n // React can apply the exit class in the same render batch as the\n // transition. Restart from the last mounted computed values so normal\n // and interrupted exits both produce a concrete browser transition.\n let rafId: number | undefined\n let disposed = false\n\n const mountedStyle = lastMountedStyleRef.current\n const canRestart =\n exitCSSProperties.length > 0 && Object.keys(mountedStyle).length > 0\n let exitTarget: Record<string, string> | undefined\n if (canRestart) {\n node.style.transition = 'none'\n // With transitions disabled, the exit classes expose their final\n // targets immediately. Capture those, then restore the mounted values.\n exitTarget = readComputedProperties(node, exitCSSProperties)\n applyCSSProperties(node, mountedStyle)\n void node.offsetHeight\n rafId = requestAnimationFrame(() => {\n if (cycleId !== exitCycleIdRef.current) return\n node.style.transition = getTransition()\n void node.offsetHeight\n applyCSSProperties(node, exitTarget!)\n })\n }\n\n // wait for the browser's concrete animations. this covers `all`,\n // transform aliases, delays, and concurrent WAAPI animations without\n // guessing property names or maintaining a duration timer.\n void waitForAnimations(node).then((finished) => {\n if (!disposed) completeExit(finished)\n })\n\n return () => {\n disposed = true\n if (rafId !== undefined) cancelAnimationFrame(rafId)\n clearCSSProperties(node, exitCSSProperties)\n // restore transition: the exit handling sets node.style.transition='none'\n // directly on the DOM (bypassing React). if exit is interrupted (e.g. same-key\n // re-entry in AnimatePresence), React won't re-apply its managed transition\n // value because it hasn't changed in the virtual DOM. clearing the inline\n // override lets React's value take effect again.\n node.style.transition = ''\n }\n }, [isExiting, exitCSSPropertiesSignature])\n\n // signature of the animatable style, so the update effect can detect\n // in-place style changes. the css driver applies most style values as\n // atomic classNames (not inline style), so the signature must include the\n // className map. only computed when a listener is attached.\n const styleSignature = onTransition\n ? (() => {\n const { transition: _t, ...rest } = style\n return `${JSON.stringify(styleState?.classNames ?? null)}|${JSON.stringify(rest)}`\n })()\n : ''\n\n // enter lifecycle: emit start when the enter transition kicks off, end\n // once every animation on the node finishes (getAnimations-based, resolves\n // immediately for zero-animation elements). the promise outlives benign\n // re-renders because it keys off the cycle id, not the effect lifetime.\n useIsomorphicLayoutEffect(() => {\n const host = stateRef.current.host\n if (!onTransitionRef.current || isExiting || !justFinishedEntering || !host) {\n return\n }\n const node = host as HTMLElement\n const cycleId = ++enterCycleIdRef.current\n enterStartedRef.current = true\n emit('start', 'enter')\n void waitForAnimations(node).then((finished) => {\n if (cycleId !== enterCycleIdRef.current || !enterStartedRef.current) return\n enterStartedRef.current = false\n emit('end', 'enter', finished)\n })\n }, [justFinishedEntering, isExiting])\n\n // update lifecycle: a style change while mounted (not entering or exiting).\n // a new update that supersedes an in-flight one emits end(finished:false).\n useIsomorphicLayoutEffect(() => {\n const host = stateRef.current.host\n if (\n !onTransitionRef.current ||\n isEntering ||\n justFinishedEntering ||\n isExiting ||\n !host\n ) {\n // keep the signature current so leaving enter/exit isn't seen as an update\n prevUpdateSigRef.current = styleSignature\n return\n }\n if (prevUpdateSigRef.current === null) {\n prevUpdateSigRef.current = styleSignature\n return\n }\n if (styleSignature === prevUpdateSigRef.current) return\n prevUpdateSigRef.current = styleSignature\n\n const node = host as HTMLElement\n if (updateInFlightRef.current) {\n emit('end', 'update', false)\n }\n updateInFlightRef.current = true\n const cycleId = ++updateCycleIdRef.current\n emit('start', 'update')\n void waitForAnimations(node).then((finished) => {\n if (cycleId !== updateCycleIdRef.current) return\n updateInFlightRef.current = false\n emit('end', 'update', finished)\n })\n }, [styleSignature, isEntering, justFinishedEntering, isExiting])\n\n // interruption: emit a finished:false end for an enter canceled by an exit,\n // or an exit canceled by a re-enter (before its own completion fired).\n useIsomorphicLayoutEffect(() => {\n if (justStartedExiting && enterStartedRef.current) {\n enterCycleIdRef.current++\n enterStartedRef.current = false\n emit('end', 'enter', false)\n }\n if (justStoppedExiting && exitStartedRef.current && !exitCompletedRef.current) {\n exitStartedRef.current = false\n emit('end', 'exit', false)\n }\n }, [justStartedExiting, justStoppedExiting])\n\n // tamagui doesnt even use animation output during hydration\n if (isHydrating) {\n return null\n }\n\n // Check if we have any animation to apply\n if (!hasNormalizedAnimation(normalized)) {\n return null\n }\n\n if (Array.isArray(style.transform)) {\n style.transform = transformsToString(style.transform)\n }\n\n style.transition = getTransition()\n\n if (process.env.NODE_ENV === 'development' && props['debug'] === 'verbose') {\n console.info('CSS animation', {\n props,\n animations,\n normalized,\n defaultAnimation,\n style,\n isEntering,\n isExiting,\n })\n }\n\n return { style, className: isEntering ? 't_unmounted' : '' }\n },\n }\n}\n"
|
|
10
10
|
]
|
|
11
11
|
}
|