@tamagui/use-controllable-state 3.0.7 → 3.0.9

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.
@@ -32,7 +32,7 @@ module.exports = __toCommonJS(useControllableState_exports);
32
32
  var import_use_event = require("@tamagui/use-event");
33
33
  var React = __toESM(require("react"), 1);
34
34
  var import_start_transition = require("@tamagui/start-transition");
35
- var emptyCallbackFn = function(_) {
35
+ var emptyCallbackFn = function emptyCallbackFn2(_) {
36
36
  return _();
37
37
  };
38
38
  function useControllableState(param) {
@@ -86,4 +86,4 @@ function useControllableState(param) {
86
86
  });
87
87
  return [value, setter];
88
88
  }
89
- var idFn = function() {};
89
+ var idFn = function idFn2() {};
@@ -32,7 +32,7 @@ module.exports = __toCommonJS(useControllableState_exports);
32
32
  var import_use_event = require("@tamagui/use-event");
33
33
  var React = __toESM(require("react"), 1);
34
34
  var import_start_transition = require("@tamagui/start-transition");
35
- var emptyCallbackFn = function(_) {
35
+ var emptyCallbackFn = function emptyCallbackFn2(_) {
36
36
  return _();
37
37
  };
38
38
  function useControllableState(param) {
@@ -86,6 +86,6 @@ function useControllableState(param) {
86
86
  });
87
87
  return [value, setter];
88
88
  }
89
- var idFn = function() {};
89
+ var idFn = function idFn2() {};
90
90
 
91
91
  //# sourceMappingURL=useControllableState.native.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"useControllableState.native.js","names":[],"sources":["cjs/useControllableState.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 useControllableState_exports = {};\n__export(useControllableState_exports, {\n useControllableState: () => useControllableState\n});\nmodule.exports = __toCommonJS(useControllableState_exports);\nvar import_use_event = require(\"@tamagui/use-event\");\nvar React = __toESM(require(\"react\"), 1);\nvar import_start_transition = require(\"@tamagui/start-transition\");\nvar emptyCallbackFn = function(_) {\n return _();\n};\nfunction useControllableState(param) {\n var { prop, defaultProp, onChange, strategy = \"prop-wins\", preventUpdate, transition } = param;\n var [state, setState] = React.useState(prop !== null && prop !== void 0 ? prop : defaultProp);\n var previous = React.useRef(state);\n var propWins = strategy === \"prop-wins\" && prop !== void 0;\n var value = propWins ? prop : state;\n var onChangeCb = (0, import_use_event.useEvent)(onChange || idFn);\n var transitionFn = transition ? import_start_transition.startTransition : emptyCallbackFn;\n React.useEffect(function() {\n if (prop === void 0) return;\n previous.current = prop;\n transitionFn(function() {\n setState(prop);\n });\n }, [\n prop\n ]);\n React.useEffect(function() {\n if (propWins) return;\n if (state !== previous.current) {\n previous.current = state;\n onChangeCb(state);\n }\n }, [\n onChangeCb,\n state,\n propWins\n ]);\n var setter = (0, import_use_event.useEvent)(function(next, details) {\n if (preventUpdate) return;\n if (details === null || details === void 0 ? void 0 : details.isCanceled) return;\n if (details) {\n var nextValue = typeof next === \"function\" ? next(previous.current) : next;\n onChangeCb(nextValue, details);\n if (details.isCanceled) return;\n if (propWins) return;\n previous.current = nextValue;\n transitionFn(function() {\n setState(nextValue);\n });\n return;\n }\n if (propWins) {\n var nextValue1 = typeof next === \"function\" ? next(previous.current) : next;\n onChangeCb(nextValue1);\n } else {\n transitionFn(function() {\n setState(next);\n });\n }\n });\n return [\n value,\n setter\n ];\n}\nvar idFn = function() {\n};\n//# sourceMappingURL=useControllableState.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,OAAO,SAAS,aAAa,GAAG,CAAC,IAAI,CAAC,GAAG,YAKnG,cAAc,CAAC,OAAO,CAAC,IAAI,aAAa,UAAU,QAAQ,WAAW;CAAE,OAAO;CAAK,YAAY;AAAK,CAAC,IAAI,QACzG,GACF;AACA,IAAI,gBAAgB,QAAQ,YAAY,UAAU,CAAC,GAAG,cAAc,EAAE,OAAO,KAAK,CAAC,GAAG,GAAG;AACzF,IAAI,+BAA+B,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I,UAAU;GACd,SAAS,UAAU;GACnB,aAAa,WAAW;IACtB,SAAS,SAAS;GACpB,CAAC;GACD;EACF;EACA,IAAI,UAAU;GACZ,IAAI,aAAa,OAAO,SAAS,aAAa,KAAK,SAAS,OAAO,IAAI;GACvE,WAAW,UAAU;EACvB,OAAO;GACL,aAAa,WAAW;IACtB,SAAS,IAAI;GACf,CAAC;EACH;CACF,CAAC;CACD,OAAO,CACL,OACA,MACF;AACF;AACA,IAAI,OAAO,WAAW,CACtB"}
1
+ {"version":3,"file":"useControllableState.native.js","names":[],"sources":["cjs/useControllableState.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 useControllableState_exports = {};\n__export(useControllableState_exports, {\n useControllableState: () => useControllableState\n});\nmodule.exports = __toCommonJS(useControllableState_exports);\nvar import_use_event = require(\"@tamagui/use-event\");\nvar React = __toESM(require(\"react\"), 1);\nvar import_start_transition = require(\"@tamagui/start-transition\");\nvar emptyCallbackFn = function emptyCallbackFn2(_) {\n return _();\n};\nfunction useControllableState(param) {\n var { prop, defaultProp, onChange, strategy = \"prop-wins\", preventUpdate, transition } = param;\n var [state, setState] = React.useState(prop !== null && prop !== void 0 ? prop : defaultProp);\n var previous = React.useRef(state);\n var propWins = strategy === \"prop-wins\" && prop !== void 0;\n var value = propWins ? prop : state;\n var onChangeCb = (0, import_use_event.useEvent)(onChange || idFn);\n var transitionFn = transition ? import_start_transition.startTransition : emptyCallbackFn;\n React.useEffect(function() {\n if (prop === void 0) return;\n previous.current = prop;\n transitionFn(function() {\n setState(prop);\n });\n }, [\n prop\n ]);\n React.useEffect(function() {\n if (propWins) return;\n if (state !== previous.current) {\n previous.current = state;\n onChangeCb(state);\n }\n }, [\n onChangeCb,\n state,\n propWins\n ]);\n var setter = (0, import_use_event.useEvent)(function(next, details) {\n if (preventUpdate) return;\n if (details === null || details === void 0 ? void 0 : details.isCanceled) return;\n if (details) {\n var nextValue = typeof next === \"function\" ? next(previous.current) : next;\n onChangeCb(nextValue, details);\n if (details.isCanceled) return;\n if (propWins) return;\n previous.current = nextValue;\n transitionFn(function() {\n setState(nextValue);\n });\n return;\n }\n if (propWins) {\n var nextValue1 = typeof next === \"function\" ? next(previous.current) : next;\n onChangeCb(nextValue1);\n } else {\n transitionFn(function() {\n setState(next);\n });\n }\n });\n return [\n value,\n setter\n ];\n}\nvar idFn = function idFn2() {\n};\n//# sourceMappingURL=useControllableState.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,U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S,KAAK;CACzD,IAAI,QAAQ,WAAW,OAAO;CAC9B,IAAI,cAAc,GAAG,iBAAiB,SAAQ,CAAE,YAAY,IAAI;CAChE,IAAI,eAAe,aAAa,wBAAwB,kBAAkB;CAC1E,MAAM,UAAU,WAAW;EACzB,IAAI,SAAS,KAAK,GAAG;EACrB,SAAS,UAAU;EACnB,aAAa,WAAW;GACtB,SAAS,IAAI;EACf,CAAC;CACH,GAAG,CACD,IACF,CAAC;CACD,MAAM,UAAU,WAAW;EACzB,IAAI,UAAU;EACd,IAAI,UAAU,SAAS,SAAS;GAC9B,SAAS,UAAU;GACnB,WAAW,KAAK;EAClB;CACF,GAAG;EACD;EACA;EACA;CACF,CAAC;CACD,IAAI,UAAU,GAAG,iBAAiB,SAAQ,CAAE,SAAS,MAAM,SAAS;EAClE,IAAI,eAAe;EACnB,IAAI,YAAY,QAAQ,YAAY,KAAK,IAAI,KAAK,IAAI,QAAQ,YAAY;EAC1E,IAAI,SAAS;GACX,IAAI,YAAY,OAAO,SAAS,aAAa,KAAK,SAAS,OAAO,IAAI;GACtE,WAAW,WAAW,OAAO;GAC7B,IAAI,QAAQ,YAAY;GACxB,IAAI,UAAU;GACd,SAAS,UAAU;GACnB,aAAa,WAAW;IACtB,SAAS,SAAS;GACpB,CAAC;GACD;EACF;EACA,IAAI,UAAU;GACZ,IAAI,aAAa,OAAO,SAAS,aAAa,KAAK,SAAS,OAAO,IAAI;GACvE,WAAW,UAAU;EACvB,OAAO;GACL,aAAa,WAAW;IACtB,SAAS,IAAI;GACf,CAAC;EACH;CACF,CAAC;CACD,OAAO,CACL,OACA,MACF;AACF;AACA,IAAI,OAAO,SAAS,QAAQ,CAC5B"}
@@ -2,7 +2,7 @@ import { useEvent } from "@tamagui/use-event";
2
2
  import * as React from "react";
3
3
  import { startTransition } from "@tamagui/start-transition";
4
4
 
5
- var emptyCallbackFn = function(_) {
5
+ var emptyCallbackFn = function emptyCallbackFn2(_) {
6
6
  return _();
7
7
  };
8
8
  function useControllableState(param) {
@@ -56,7 +56,7 @@ function useControllableState(param) {
56
56
  });
57
57
  return [value, setter];
58
58
  }
59
- var idFn = function() {};
59
+ var idFn = function idFn2() {};
60
60
 
61
61
  export { useControllableState };
62
62
  //# sourceMappingURL=useControllableState.native.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"useControllableState.native.js","names":[],"sources":["esm/useControllableState.native.js"],"sourcesContent":["import { useEvent } from \"@tamagui/use-event\";\nimport * as React from \"react\";\nimport { startTransition } from \"@tamagui/start-transition\";\nvar emptyCallbackFn = function(_) {\n return _();\n};\nfunction useControllableState(param) {\n var { prop, defaultProp, onChange, strategy = \"prop-wins\", preventUpdate, transition } = param;\n var [state, setState] = React.useState(prop !== null && prop !== void 0 ? prop : defaultProp);\n var previous = React.useRef(state);\n var propWins = strategy === \"prop-wins\" && prop !== void 0;\n var value = propWins ? prop : state;\n var onChangeCb = useEvent(onChange || idFn);\n var transitionFn = transition ? startTransition : emptyCallbackFn;\n React.useEffect(function() {\n if (prop === void 0) return;\n previous.current = prop;\n transitionFn(function() {\n setState(prop);\n });\n }, [\n prop\n ]);\n React.useEffect(function() {\n if (propWins) return;\n if (state !== previous.current) {\n previous.current = state;\n onChangeCb(state);\n }\n }, [\n onChangeCb,\n state,\n propWins\n ]);\n var setter = useEvent(function(next, details) {\n if (preventUpdate) return;\n if (details === null || details === void 0 ? void 0 : details.isCanceled) return;\n if (details) {\n var nextValue = typeof next === \"function\" ? next(previous.current) : next;\n onChangeCb(nextValue, details);\n if (details.isCanceled) return;\n if (propWins) return;\n previous.current = nextValue;\n transitionFn(function() {\n setState(nextValue);\n });\n return;\n }\n if (propWins) {\n var nextValue1 = typeof next === \"function\" ? next(previous.current) : next;\n onChangeCb(nextValue1);\n } else {\n transitionFn(function() {\n setState(next);\n });\n }\n });\n return [\n value,\n setter\n ];\n}\nvar idFn = function() {\n};\nexport {\n useControllableState\n};\n//# sourceMappingURL=useControllableState.js.map\n"],"mappings":";;;;;AAGA,IAAI,kB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AACF;AACA,IAAI,OAAO,WAAW,CACtB"}
1
+ {"version":3,"file":"useControllableState.native.js","names":[],"sources":["esm/useControllableState.native.js"],"sourcesContent":["import { useEvent } from \"@tamagui/use-event\";\nimport * as React from \"react\";\nimport { startTransition } from \"@tamagui/start-transition\";\nvar emptyCallbackFn = function emptyCallbackFn2(_) {\n return _();\n};\nfunction useControllableState(param) {\n var { prop, defaultProp, onChange, strategy = \"prop-wins\", preventUpdate, transition } = param;\n var [state, setState] = React.useState(prop !== null && prop !== void 0 ? prop : defaultProp);\n var previous = React.useRef(state);\n var propWins = strategy === \"prop-wins\" && prop !== void 0;\n var value = propWins ? prop : state;\n var onChangeCb = useEvent(onChange || idFn);\n var transitionFn = transition ? startTransition : emptyCallbackFn;\n React.useEffect(function() {\n if (prop === void 0) return;\n previous.current = prop;\n transitionFn(function() {\n setState(prop);\n });\n }, [\n prop\n ]);\n React.useEffect(function() {\n if (propWins) return;\n if (state !== previous.current) {\n previous.current = state;\n onChangeCb(state);\n }\n }, [\n onChangeCb,\n state,\n propWins\n ]);\n var setter = useEvent(function(next, details) {\n if (preventUpdate) return;\n if (details === null || details === void 0 ? void 0 : details.isCanceled) return;\n if (details) {\n var nextValue = typeof next === \"function\" ? next(previous.current) : next;\n onChangeCb(nextValue, details);\n if (details.isCanceled) return;\n if (propWins) return;\n previous.current = nextValue;\n transitionFn(function() {\n setState(nextValue);\n });\n return;\n }\n if (propWins) {\n var nextValue1 = typeof next === \"function\" ? next(previous.current) : next;\n onChangeCb(nextValue1);\n } else {\n transitionFn(function() {\n setState(next);\n });\n }\n });\n return [\n value,\n setter\n ];\n}\nvar idFn = function idFn2() {\n};\nexport {\n useControllableState\n};\n//# sourceMappingURL=useControllableState.js.map\n"],"mappings":";;;;;AAGA,IAAI,kBAAkB,SAAS,iBAAiB,GAAG;CACjD,OAAO,EAAE;AACX;AACA,SAAS,qBAAqB,OAAO;CACnC,IAAI,EAAE,MAAM,aAAa,UAAU,WAAW,aAAa,eAAe,eA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3.0.7",
3
+ "version": "3.0.9",
4
4
  "license": "MIT",
5
5
  "gitHead": "a49cc7ea6b93ba384e77a4880ae48ac4a5635c14",
6
6
  "source": "src/index.ts",
@@ -36,12 +36,12 @@
36
36
  "clean:build": "tamagui-build clean:build"
37
37
  },
38
38
  "dependencies": {
39
- "@tamagui/core": "3.0.7",
40
- "@tamagui/start-transition": "3.0.7",
41
- "@tamagui/use-event": "3.0.7"
39
+ "@tamagui/core": "3.0.9",
40
+ "@tamagui/start-transition": "3.0.9",
41
+ "@tamagui/use-event": "3.0.9"
42
42
  },
43
43
  "devDependencies": {
44
- "@tamagui/build": "3.0.7",
44
+ "@tamagui/build": "3.0.9",
45
45
  "react": "19.2.3"
46
46
  },
47
47
  "peerDependencies": {
@@ -52,5 +52,5 @@
52
52
  "url": "git+https://github.com/tamagui/tamagui.git",
53
53
  "directory": "code/core/use-controllable-state"
54
54
  },
55
- "releaseSourceCommit": "96f8bc1f222af0381729a2e2202370aa4a9808ef"
55
+ "releaseSourceCommit": "1971272fa9915450004c84ea48188100fdf278ff"
56
56
  }