@tamagui/animations-css 1.114.4 → 1.115.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.
@@ -2,32 +2,44 @@ var __create = Object.create;
2
2
  var __defProp = Object.defineProperty;
3
3
  var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
4
  var __getOwnPropNames = Object.getOwnPropertyNames;
5
- var __getProtoOf = Object.getPrototypeOf, __hasOwnProp = Object.prototype.hasOwnProperty;
5
+ var __getProtoOf = Object.getPrototypeOf,
6
+ __hasOwnProp = Object.prototype.hasOwnProperty;
6
7
  var __export = (target, all) => {
7
- for (var name in all)
8
- __defProp(target, name, { get: all[name], enumerable: !0 });
9
- }, __copyProps = (to, from, except, desc) => {
10
- if (from && typeof from == "object" || typeof from == "function")
11
- for (let key of __getOwnPropNames(from))
12
- !__hasOwnProp.call(to, key) && key !== except && __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
13
- return to;
14
- };
8
+ for (var name in all) __defProp(target, name, {
9
+ get: all[name],
10
+ enumerable: !0
11
+ });
12
+ },
13
+ __copyProps = (to, from, except, desc) => {
14
+ if (from && typeof from == "object" || typeof from == "function") for (let key of __getOwnPropNames(from)) !__hasOwnProp.call(to, key) && key !== except && __defProp(to, key, {
15
+ get: () => from[key],
16
+ enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
17
+ });
18
+ return to;
19
+ };
15
20
  var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
16
21
  // If the importer is in node compatibility mode or this is not an ESM
17
22
  // file that has been converted to a CommonJS file using a Babel-
18
23
  // compatible transform (i.e. "__esModule" has not been set), then set
19
24
  // "default" to the CommonJS "module.exports" for node compatibility.
20
- isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: !0 }) : target,
21
- mod
22
- )), __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: !0 }), mod);
25
+ isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", {
26
+ value: mod,
27
+ enumerable: !0
28
+ }) : target, mod)),
29
+ __toCommonJS = mod => __copyProps(__defProp({}, "__esModule", {
30
+ value: !0
31
+ }), mod);
23
32
  var createAnimations_exports = {};
24
33
  __export(createAnimations_exports, {
25
34
  createAnimations: () => createAnimations
26
35
  });
27
36
  module.exports = __toCommonJS(createAnimations_exports);
28
- var import_react = __toESM(require("react")), import_constants = require("@tamagui/constants"), import_web = require("@tamagui/web"), import_use_presence = require("@tamagui/use-presence");
37
+ var import_react = __toESM(require("react")),
38
+ import_constants = require("@tamagui/constants"),
39
+ import_web = require("@tamagui/web"),
40
+ import_use_presence = require("@tamagui/use-presence");
29
41
  function createAnimations(animations) {
30
- const reactionListeners = /* @__PURE__ */ new WeakMap();
42
+ const reactionListeners = /* @__PURE__ */new WeakMap();
31
43
  return {
32
44
  animations,
33
45
  usePresence: import_use_presence.usePresence,
@@ -45,18 +57,19 @@ function createAnimations(animations) {
45
57
  setValue(next, config, onFinish) {
46
58
  setVal(next);
47
59
  const listeners = reactionListeners.get(setVal);
48
- listeners && listeners.forEach((cb) => cb(next)), onFinish?.();
60
+ listeners && listeners.forEach(cb => cb(next)), onFinish?.();
49
61
  },
50
- stop() {
51
- }
62
+ stop() {}
52
63
  };
53
64
  },
54
- useAnimatedNumberReaction({ value }, onValue) {
65
+ useAnimatedNumberReaction({
66
+ value
67
+ }, onValue) {
55
68
  import_react.default.useEffect(() => {
56
69
  const instance = value.getInstance();
57
70
  let queue = reactionListeners.get(instance);
58
71
  if (!queue) {
59
- const next = /* @__PURE__ */ new Set();
72
+ const next = /* @__PURE__ */new Set();
60
73
  reactionListeners.set(instance, next), queue = next;
61
74
  }
62
75
  return queue.add(onValue), () => {
@@ -67,18 +80,30 @@ function createAnimations(animations) {
67
80
  useAnimatedNumberStyle(val, getStyle) {
68
81
  return getStyle(val.getValue());
69
82
  },
70
- useAnimations: ({ props, presence, style, componentState, stateRef }) => {
71
- const isEntering = !!componentState.unmounted, isExiting = presence?.[0] === !1, sendExitComplete = presence?.[1], [animationKey, animationConfig] = Array.isArray(props.animation) ? props.animation : [props.animation], animation = animations[animationKey], keys = props.animateOnly ?? ["all"];
83
+ useAnimations: ({
84
+ props,
85
+ presence,
86
+ style,
87
+ componentState,
88
+ stateRef
89
+ }) => {
90
+ const isEntering = !!componentState.unmounted,
91
+ isExiting = presence?.[0] === !1,
92
+ sendExitComplete = presence?.[1],
93
+ [animationKey, animationConfig] = Array.isArray(props.animation) ? props.animation : [props.animation],
94
+ animation = animations[animationKey],
95
+ keys = props.animateOnly ?? ["all"];
72
96
  return (0, import_constants.useIsomorphicLayoutEffect)(() => {
73
97
  const host = stateRef.current.host;
74
98
  if (!sendExitComplete || !isExiting || !host) return;
75
- const node = host, onFinishAnimation = () => {
76
- sendExitComplete?.();
77
- };
99
+ const node = host,
100
+ onFinishAnimation = () => {
101
+ sendExitComplete?.();
102
+ };
78
103
  return node.addEventListener("transitionend", onFinishAnimation), node.addEventListener("transitioncancel", onFinishAnimation), () => {
79
104
  node.removeEventListener("transitionend", onFinishAnimation), node.removeEventListener("transitioncancel", onFinishAnimation);
80
105
  };
81
- }, [sendExitComplete, isExiting]), animation && (Array.isArray(style.transform) && (style.transform = (0, import_web.transformsToString)(style.transform)), style.transition = keys.map((key) => {
106
+ }, [sendExitComplete, isExiting]), animation && (Array.isArray(style.transform) && (style.transform = (0, import_web.transformsToString)(style.transform)), style.transition = keys.map(key => {
82
107
  const override = animations[animationConfig?.[key]] ?? animation;
83
108
  return `${key} ${override}`;
84
109
  }).join(", ")), process.env.NODE_ENV === "development" && props.debug === "verbose" && console.info("CSS animation", {
@@ -89,8 +114,10 @@ function createAnimations(animations) {
89
114
  style,
90
115
  isEntering,
91
116
  isExiting
92
- }), animation ? { style, className: isEntering ? "t_unmounted" : "" } : null;
117
+ }), animation ? {
118
+ style,
119
+ className: isEntering ? "t_unmounted" : ""
120
+ } : null;
93
121
  }
94
122
  };
95
- }
96
- //# sourceMappingURL=createAnimations.js.map
123
+ }
@@ -0,0 +1,18 @@
1
+ var __defProp = Object.defineProperty;
2
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
3
+ var __getOwnPropNames = Object.getOwnPropertyNames;
4
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
5
+ var __copyProps = (to, from, except, desc) => {
6
+ if (from && typeof from == "object" || typeof from == "function") for (let key of __getOwnPropNames(from)) !__hasOwnProp.call(to, key) && key !== except && __defProp(to, key, {
7
+ get: () => from[key],
8
+ enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
9
+ });
10
+ return to;
11
+ },
12
+ __reExport = (target, mod, secondTarget) => (__copyProps(target, mod, "default"), secondTarget && __copyProps(secondTarget, mod, "default"));
13
+ var __toCommonJS = mod => __copyProps(__defProp({}, "__esModule", {
14
+ value: !0
15
+ }), mod);
16
+ var src_exports = {};
17
+ module.exports = __toCommonJS(src_exports);
18
+ __reExport(src_exports, require("./createAnimations.cjs"), module.exports);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tamagui/animations-css",
3
- "version": "1.114.4",
3
+ "version": "1.115.1",
4
4
  "source": "src/index.ts",
5
5
  "sideEffects": false,
6
6
  "license": "MIT",
@@ -19,17 +19,18 @@
19
19
  "react-native": "./dist/cjs/index.native.js",
20
20
  "types": "./types/index.d.ts",
21
21
  "import": "./dist/esm/index.mjs",
22
- "require": "./dist/cjs/index.js"
22
+ "require": "./dist/cjs/index.cjs",
23
+ "default": "./dist/cjs/index.native.js"
23
24
  }
24
25
  },
25
26
  "dependencies": {
26
- "@tamagui/constants": "1.114.4",
27
- "@tamagui/cubic-bezier-animator": "1.114.4",
28
- "@tamagui/use-presence": "1.114.4",
29
- "@tamagui/web": "1.114.4"
27
+ "@tamagui/constants": "1.115.1",
28
+ "@tamagui/cubic-bezier-animator": "1.115.1",
29
+ "@tamagui/use-presence": "1.115.1",
30
+ "@tamagui/web": "1.115.1"
30
31
  },
31
32
  "devDependencies": {
32
- "@tamagui/build": "1.114.4",
33
+ "@tamagui/build": "1.115.1",
33
34
  "react": "^18.2.0 || ^19.0.0"
34
35
  },
35
36
  "scripts": {
package/dist/cjs/index.js DELETED
@@ -1,15 +0,0 @@
1
- var __defProp = Object.defineProperty;
2
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
3
- var __getOwnPropNames = Object.getOwnPropertyNames;
4
- var __hasOwnProp = Object.prototype.hasOwnProperty;
5
- var __copyProps = (to, from, except, desc) => {
6
- if (from && typeof from == "object" || typeof from == "function")
7
- for (let key of __getOwnPropNames(from))
8
- !__hasOwnProp.call(to, key) && key !== except && __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
9
- return to;
10
- }, __reExport = (target, mod, secondTarget) => (__copyProps(target, mod, "default"), secondTarget && __copyProps(secondTarget, mod, "default"));
11
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: !0 }), mod);
12
- var src_exports = {};
13
- module.exports = __toCommonJS(src_exports);
14
- __reExport(src_exports, require("./createAnimations"), module.exports);
15
- //# sourceMappingURL=index.js.map
File without changes