@tamagui/use-controllable-state 2.7.7 → 3.0.0-beta.643.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.
@@ -1,20 +1,19 @@
1
+
1
2
  var __defProp = Object.defineProperty;
2
3
  var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
3
4
  var __getOwnPropNames = Object.getOwnPropertyNames;
4
5
  var __hasOwnProp = Object.prototype.hasOwnProperty;
5
6
  var __copyProps = (to, from, except, desc) => {
6
- if (from && typeof from === "object" || typeof from === "function") {
7
- for (let key of __getOwnPropNames(from)) if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {
8
- get: () => from[key],
9
- enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
10
- });
11
- }
12
- return to;
7
+ if (from && typeof from === "object" || typeof from === "function") {
8
+ for (let key of __getOwnPropNames(from)) if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {
9
+ get: () => from[key],
10
+ enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
11
+ });
12
+ }
13
+ return to;
13
14
  };
14
15
  var __reExport = (target, mod, secondTarget) => (__copyProps(target, mod, "default"), secondTarget && __copyProps(secondTarget, mod, "default"));
15
- var __toCommonJS = mod => __copyProps(__defProp({}, "__esModule", {
16
- value: true
17
- }), mod);
16
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
18
17
  var index_exports = {};
19
18
  module.exports = __toCommonJS(index_exports);
20
- __reExport(index_exports, require("./useControllableState.cjs"), module.exports);
19
+ __reExport(index_exports, require("./useControllableState.cjs"), module.exports);
@@ -0,0 +1,21 @@
1
+ "use strict";
2
+
3
+
4
+ var __defProp = Object.defineProperty;
5
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
6
+ var __getOwnPropNames = Object.getOwnPropertyNames;
7
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
8
+ var __copyProps = (to, from, except, desc) => {
9
+ if (from && typeof from === "object" || typeof from === "function") {
10
+ for (let key of __getOwnPropNames(from)) if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {
11
+ get: () => from[key],
12
+ enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
13
+ });
14
+ }
15
+ return to;
16
+ };
17
+ var __reExport = (target, mod, secondTarget) => (__copyProps(target, mod, "default"), secondTarget && __copyProps(secondTarget, mod, "default"));
18
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
+ var index_exports = {};
20
+ module.exports = __toCommonJS(index_exports);
21
+ __reExport(index_exports, require("./useControllableState.native.js"), module.exports);
@@ -1,23 +1,23 @@
1
1
  "use strict";
2
2
 
3
+
3
4
  var __defProp = Object.defineProperty;
4
5
  var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
6
  var __getOwnPropNames = Object.getOwnPropertyNames;
6
7
  var __hasOwnProp = Object.prototype.hasOwnProperty;
7
8
  var __copyProps = (to, from, except, desc) => {
8
- if (from && typeof from === "object" || typeof from === "function") {
9
- for (let key of __getOwnPropNames(from)) if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {
10
- get: () => from[key],
11
- enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
12
- });
13
- }
14
- return to;
9
+ if (from && typeof from === "object" || typeof from === "function") {
10
+ for (let key of __getOwnPropNames(from)) if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {
11
+ get: () => from[key],
12
+ enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
13
+ });
14
+ }
15
+ return to;
15
16
  };
16
17
  var __reExport = (target, mod, secondTarget) => (__copyProps(target, mod, "default"), secondTarget && __copyProps(secondTarget, mod, "default"));
17
- var __toCommonJS = mod => __copyProps(__defProp({}, "__esModule", {
18
- value: true
19
- }), mod);
18
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
20
19
  var index_exports = {};
21
20
  module.exports = __toCommonJS(index_exports);
22
21
  __reExport(index_exports, require("./useControllableState.native.js"), module.exports);
22
+
23
23
  //# sourceMappingURL=index.native.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["__toCommonJS","mod","__copyProps","__defProp","value","index_exports","module","exports"],"sources":["../../src/index.ts"],"sourcesContent":[null],"mappings":";;;;;;;;;;;;;;;;AAAA,IAAAA,YAAA,GAAAC,GAAA,IAAAC,WAAA,CAAAC,SAAA;EAAAC,KAAA;AAAA,IAAAH,GAAA;AAAA,IAAAI,aAAA;AAAAC,MAAA,CAAAC,OAAA,GAAAP,YAAc,CAAAK,aAAA","ignoreList":[]}
1
+ {"version":3,"file":"index.native.js","names":[],"sources":["cjs/index.native.js"],"sourcesContent":["\"use strict\";\nvar __defProp = Object.defineProperty;\nvar __getOwnPropDesc = Object.getOwnPropertyDescriptor;\nvar __getOwnPropNames = Object.getOwnPropertyNames;\nvar __hasOwnProp = Object.prototype.hasOwnProperty;\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 __reExport = (target, mod, secondTarget) => (__copyProps(target, mod, \"default\"), secondTarget && __copyProps(secondTarget, mod, \"default\"));\nvar __toCommonJS = (mod) => __copyProps(__defProp({}, \"__esModule\", { value: true }), mod);\nvar index_exports = {};\nmodule.exports = __toCommonJS(index_exports);\n__reExport(index_exports, require(\"./useControllableState\"), module.exports);\n//# sourceMappingURL=index.js.map\n"],"mappings":";;;;AACA,IAAI,YAAY,OAAO;AACvB,IAAI,mBAAmB,OAAO;AAC9B,IAAI,oBAAoB,OAAO;AAC/B,IAAI,eAAe,OAAO,UAAU;AACpC,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,cAAc,QAAQ,KAAK,kBAAkB,YAAY,QAAQ,KAAK,SAAS,GAAG,gBAAgB,YAAY,cAAc,KAAK,SAAS;AAC9I,IAAI,gBAAgB,QAAQ,YAAY,UAAU,CAAC,GAAG,cAAc,EAAE,OAAO,KAAK,CAAC,GAAG,GAAG;AACzF,IAAI,gBAAgB,CAAC;AACrB,OAAO,UAAU,aAAa,aAAa;AAC3C,WAAW,eAAe,QAAQ,kCAAwB,GAAG,OAAO,OAAO"}
@@ -1,3 +1,4 @@
1
+
1
2
  var __create = Object.create;
2
3
  var __defProp = Object.defineProperty;
3
4
  var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
@@ -5,80 +6,80 @@ var __getOwnPropNames = Object.getOwnPropertyNames;
5
6
  var __getProtoOf = Object.getPrototypeOf;
6
7
  var __hasOwnProp = Object.prototype.hasOwnProperty;
7
8
  var __export = (target, all) => {
8
- for (var name in all) __defProp(target, name, {
9
- get: all[name],
10
- enumerable: true
11
- });
9
+ for (var name in all) __defProp(target, name, {
10
+ get: all[name],
11
+ enumerable: true
12
+ });
12
13
  };
13
14
  var __copyProps = (to, from, except, desc) => {
14
- if (from && typeof from === "object" || typeof from === "function") {
15
- for (let key of __getOwnPropNames(from)) if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {
16
- get: () => from[key],
17
- enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
18
- });
19
- }
20
- return to;
15
+ if (from && typeof from === "object" || typeof from === "function") {
16
+ for (let key of __getOwnPropNames(from)) if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {
17
+ get: () => from[key],
18
+ enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
19
+ });
20
+ }
21
+ return to;
21
22
  };
22
- var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
23
- // If the importer is in node compatibility mode or this is not an ESM
24
- // file that has been converted to a CommonJS file using a Babel-
25
- // compatible transform (i.e. "__esModule" has not been set), then set
26
- // "default" to the CommonJS "module.exports" for node compatibility.
27
- isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", {
28
- value: mod,
29
- enumerable: true
23
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", {
24
+ value: mod,
25
+ enumerable: true
30
26
  }) : target, mod));
31
- var __toCommonJS = mod => __copyProps(__defProp({}, "__esModule", {
32
- value: true
33
- }), mod);
27
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
34
28
  var useControllableState_exports = {};
35
- __export(useControllableState_exports, {
36
- useControllableState: () => useControllableState
37
- });
29
+ __export(useControllableState_exports, { useControllableState: () => useControllableState });
38
30
  module.exports = __toCommonJS(useControllableState_exports);
39
31
  var import_use_event = require("@tamagui/use-event");
40
32
  var React = __toESM(require("react"), 1);
41
33
  var import_start_transition = require("@tamagui/start-transition");
42
- const emptyCallbackFn = _ => _();
43
- function useControllableState({
44
- prop,
45
- defaultProp,
46
- onChange,
47
- strategy = "prop-wins",
48
- preventUpdate,
49
- transition
50
- }) {
51
- const [state, setState] = React.useState(prop ?? defaultProp);
52
- const previous = React.useRef(state);
53
- const propWins = strategy === "prop-wins" && prop !== void 0;
54
- const value = propWins ? prop : state;
55
- const onChangeCb = (0, import_use_event.useEvent)(onChange || idFn);
56
- const transitionFn = transition ? import_start_transition.startTransition : emptyCallbackFn;
57
- React.useEffect(() => {
58
- if (prop === void 0) return;
59
- previous.current = prop;
60
- transitionFn(() => {
61
- setState(prop);
62
- });
63
- }, [prop]);
64
- React.useEffect(() => {
65
- if (propWins) return;
66
- if (state !== previous.current) {
67
- previous.current = state;
68
- onChangeCb(state);
69
- }
70
- }, [onChangeCb, state, propWins]);
71
- const setter = (0, import_use_event.useEvent)(next => {
72
- if (preventUpdate) return;
73
- if (propWins) {
74
- const nextValue = typeof next === "function" ? next(previous.current) : next;
75
- onChangeCb(nextValue);
76
- } else {
77
- transitionFn(() => {
78
- setState(next);
79
- });
80
- }
81
- });
82
- return [value, setter];
34
+ const emptyCallbackFn = (_) => _();
35
+ function useControllableState({ prop, defaultProp, onChange, strategy = "prop-wins", preventUpdate, transition }) {
36
+ const [state, setState] = React.useState(prop ?? defaultProp);
37
+ const previous = React.useRef(state);
38
+ const propWins = strategy === "prop-wins" && prop !== void 0;
39
+ const value = propWins ? prop : state;
40
+ const onChangeCb = (0, import_use_event.useEvent)(onChange || idFn);
41
+ const transitionFn = transition ? import_start_transition.startTransition : emptyCallbackFn;
42
+ React.useEffect(() => {
43
+ if (prop === void 0) return;
44
+ previous.current = prop;
45
+ transitionFn(() => {
46
+ setState(prop);
47
+ });
48
+ }, [prop]);
49
+ React.useEffect(() => {
50
+ if (propWins) return;
51
+ if (state !== previous.current) {
52
+ previous.current = state;
53
+ onChangeCb(state);
54
+ }
55
+ }, [
56
+ onChangeCb,
57
+ state,
58
+ propWins
59
+ ]);
60
+ const setter = (0, import_use_event.useEvent)((next, details) => {
61
+ if (preventUpdate) return;
62
+ if (details?.isCanceled) return;
63
+ if (details) {
64
+ const nextValue = typeof next === "function" ? next(previous.current) : next;
65
+ onChangeCb(nextValue, details);
66
+ if (details.isCanceled) return;
67
+ if (propWins) return;
68
+ previous.current = nextValue;
69
+ transitionFn(() => {
70
+ setState(nextValue);
71
+ });
72
+ return;
73
+ }
74
+ if (propWins) {
75
+ const nextValue = typeof next === "function" ? next(previous.current) : next;
76
+ onChangeCb(nextValue);
77
+ } else {
78
+ transitionFn(() => {
79
+ setState(next);
80
+ });
81
+ }
82
+ });
83
+ return [value, setter];
83
84
  }
84
- const idFn = () => {};
85
+ const idFn = () => {};
@@ -0,0 +1,90 @@
1
+ "use strict";
2
+
3
+
4
+ var __create = Object.create;
5
+ var __defProp = Object.defineProperty;
6
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
7
+ var __getOwnPropNames = Object.getOwnPropertyNames;
8
+ var __getProtoOf = Object.getPrototypeOf;
9
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
10
+ var __export = (target, all) => {
11
+ for (var name in all) __defProp(target, name, {
12
+ get: all[name],
13
+ enumerable: true
14
+ });
15
+ };
16
+ var __copyProps = (to, from, except, desc) => {
17
+ if (from && typeof from === "object" || typeof from === "function") {
18
+ for (let key of __getOwnPropNames(from)) if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {
19
+ get: () => from[key],
20
+ enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
21
+ });
22
+ }
23
+ return to;
24
+ };
25
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", {
26
+ value: mod,
27
+ enumerable: true
28
+ }) : target, mod));
29
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
30
+ var useControllableState_exports = {};
31
+ __export(useControllableState_exports, { useControllableState: () => useControllableState });
32
+ module.exports = __toCommonJS(useControllableState_exports);
33
+ var import_use_event = require("@tamagui/use-event");
34
+ var React = __toESM(require("react"), 1);
35
+ var import_start_transition = require("@tamagui/start-transition");
36
+ var emptyCallbackFn = function(_) {
37
+ return _();
38
+ };
39
+ function useControllableState(param) {
40
+ var { prop, defaultProp, onChange, strategy = "prop-wins", preventUpdate, transition } = param;
41
+ var [state, setState] = React.useState(prop !== null && prop !== void 0 ? prop : defaultProp);
42
+ var previous = React.useRef(state);
43
+ var propWins = strategy === "prop-wins" && prop !== void 0;
44
+ var value = propWins ? prop : state;
45
+ var onChangeCb = (0, import_use_event.useEvent)(onChange || idFn);
46
+ var transitionFn = transition ? import_start_transition.startTransition : emptyCallbackFn;
47
+ React.useEffect(function() {
48
+ if (prop === void 0) return;
49
+ previous.current = prop;
50
+ transitionFn(function() {
51
+ setState(prop);
52
+ });
53
+ }, [prop]);
54
+ React.useEffect(function() {
55
+ if (propWins) return;
56
+ if (state !== previous.current) {
57
+ previous.current = state;
58
+ onChangeCb(state);
59
+ }
60
+ }, [
61
+ onChangeCb,
62
+ state,
63
+ propWins
64
+ ]);
65
+ var setter = (0, import_use_event.useEvent)(function(next, details) {
66
+ if (preventUpdate) return;
67
+ if (details === null || details === void 0 ? void 0 : details.isCanceled) return;
68
+ if (details) {
69
+ var nextValue = typeof next === "function" ? next(previous.current) : next;
70
+ onChangeCb(nextValue, details);
71
+ if (details.isCanceled) return;
72
+ if (propWins) return;
73
+ previous.current = nextValue;
74
+ transitionFn(function() {
75
+ setState(nextValue);
76
+ });
77
+ return;
78
+ }
79
+ if (propWins) {
80
+ var nextValue1 = typeof next === "function" ? next(previous.current) : next;
81
+ onChangeCb(nextValue1);
82
+ } else {
83
+ transitionFn(function() {
84
+ setState(next);
85
+ });
86
+ }
87
+ });
88
+ return [value, setter];
89
+ }
90
+ var idFn = function() {};
@@ -1,5 +1,6 @@
1
1
  "use strict";
2
2
 
3
+
3
4
  var __create = Object.create;
4
5
  var __defProp = Object.defineProperty;
5
6
  var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
@@ -7,84 +8,85 @@ var __getOwnPropNames = Object.getOwnPropertyNames;
7
8
  var __getProtoOf = Object.getPrototypeOf;
8
9
  var __hasOwnProp = Object.prototype.hasOwnProperty;
9
10
  var __export = (target, all) => {
10
- for (var name in all) __defProp(target, name, {
11
- get: all[name],
12
- enumerable: true
13
- });
11
+ for (var name in all) __defProp(target, name, {
12
+ get: all[name],
13
+ enumerable: true
14
+ });
14
15
  };
15
16
  var __copyProps = (to, from, except, desc) => {
16
- if (from && typeof from === "object" || typeof from === "function") {
17
- for (let key of __getOwnPropNames(from)) if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {
18
- get: () => from[key],
19
- enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
20
- });
21
- }
22
- return to;
17
+ if (from && typeof from === "object" || typeof from === "function") {
18
+ for (let key of __getOwnPropNames(from)) if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {
19
+ get: () => from[key],
20
+ enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
21
+ });
22
+ }
23
+ return to;
23
24
  };
24
- var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
25
- // If the importer is in node compatibility mode or this is not an ESM
26
- // file that has been converted to a CommonJS file using a Babel-
27
- // compatible transform (i.e. "__esModule" has not been set), then set
28
- // "default" to the CommonJS "module.exports" for node compatibility.
29
- isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", {
30
- value: mod,
31
- enumerable: true
25
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", {
26
+ value: mod,
27
+ enumerable: true
32
28
  }) : target, mod));
33
- var __toCommonJS = mod => __copyProps(__defProp({}, "__esModule", {
34
- value: true
35
- }), mod);
29
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
36
30
  var useControllableState_exports = {};
37
- __export(useControllableState_exports, {
38
- useControllableState: () => useControllableState
39
- });
31
+ __export(useControllableState_exports, { useControllableState: () => useControllableState });
40
32
  module.exports = __toCommonJS(useControllableState_exports);
41
33
  var import_use_event = require("@tamagui/use-event");
42
34
  var React = __toESM(require("react"), 1);
43
35
  var import_start_transition = require("@tamagui/start-transition");
44
- var emptyCallbackFn = function (_) {
45
- return _();
36
+ var emptyCallbackFn = function(_) {
37
+ return _();
46
38
  };
47
39
  function useControllableState(param) {
48
- var {
49
- prop,
50
- defaultProp,
51
- onChange,
52
- strategy = "prop-wins",
53
- preventUpdate,
54
- transition
55
- } = param;
56
- var [state, setState] = React.useState(prop !== null && prop !== void 0 ? prop : defaultProp);
57
- var previous = React.useRef(state);
58
- var propWins = strategy === "prop-wins" && prop !== void 0;
59
- var value = propWins ? prop : state;
60
- var onChangeCb = (0, import_use_event.useEvent)(onChange || idFn);
61
- var transitionFn = transition ? import_start_transition.startTransition : emptyCallbackFn;
62
- React.useEffect(function () {
63
- if (prop === void 0) return;
64
- previous.current = prop;
65
- transitionFn(function () {
66
- setState(prop);
67
- });
68
- }, [prop]);
69
- React.useEffect(function () {
70
- if (propWins) return;
71
- if (state !== previous.current) {
72
- previous.current = state;
73
- onChangeCb(state);
74
- }
75
- }, [onChangeCb, state, propWins]);
76
- var setter = (0, import_use_event.useEvent)(function (next) {
77
- if (preventUpdate) return;
78
- if (propWins) {
79
- var nextValue = typeof next === "function" ? next(previous.current) : next;
80
- onChangeCb(nextValue);
81
- } else {
82
- transitionFn(function () {
83
- setState(next);
84
- });
85
- }
86
- });
87
- return [value, setter];
40
+ var { prop, defaultProp, onChange, strategy = "prop-wins", preventUpdate, transition } = param;
41
+ var [state, setState] = React.useState(prop !== null && prop !== void 0 ? prop : defaultProp);
42
+ var previous = React.useRef(state);
43
+ var propWins = strategy === "prop-wins" && prop !== void 0;
44
+ var value = propWins ? prop : state;
45
+ var onChangeCb = (0, import_use_event.useEvent)(onChange || idFn);
46
+ var transitionFn = transition ? import_start_transition.startTransition : emptyCallbackFn;
47
+ React.useEffect(function() {
48
+ if (prop === void 0) return;
49
+ previous.current = prop;
50
+ transitionFn(function() {
51
+ setState(prop);
52
+ });
53
+ }, [prop]);
54
+ React.useEffect(function() {
55
+ if (propWins) return;
56
+ if (state !== previous.current) {
57
+ previous.current = state;
58
+ onChangeCb(state);
59
+ }
60
+ }, [
61
+ onChangeCb,
62
+ state,
63
+ propWins
64
+ ]);
65
+ var setter = (0, import_use_event.useEvent)(function(next, details) {
66
+ if (preventUpdate) return;
67
+ if (details === null || details === void 0 ? void 0 : details.isCanceled) return;
68
+ if (details) {
69
+ var nextValue = typeof next === "function" ? next(previous.current) : next;
70
+ onChangeCb(nextValue, details);
71
+ if (details.isCanceled) return;
72
+ if (propWins) return;
73
+ previous.current = nextValue;
74
+ transitionFn(function() {
75
+ setState(nextValue);
76
+ });
77
+ return;
78
+ }
79
+ if (propWins) {
80
+ var nextValue1 = typeof next === "function" ? next(previous.current) : next;
81
+ onChangeCb(nextValue1);
82
+ } else {
83
+ transitionFn(function() {
84
+ setState(next);
85
+ });
86
+ }
87
+ });
88
+ return [value, setter];
88
89
  }
89
- var idFn = function () {};
90
+ var idFn = function() {};
91
+
90
92
  //# sourceMappingURL=useControllableState.native.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["__toCommonJS","mod","__copyProps","__defProp","value","useControllableState_exports","__export","useControllableState","module","exports","import_use_event","require","React","__toESM","import_start_transition","emptyCallbackFn","_","param","prop","defaultProp","onChange","strategy","preventUpdate","transition","state","setState","useState","previous","useRef","propWins","onChangeCb","useEvent","idFn","transitionFn","startTransition","useEffect","current","setter","next","nextValue"],"sources":["../../src/useControllableState.ts"],"sourcesContent":[null],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,IAAAA,YAAA,GAAAC,GAAA,IAAAC,WAAA,CAAAC,SAAA;EAAAC,KAAA;AAAA,IAAAH,GAAA;AAAA,IAAAI,4BAAA;AAAAC,QAAA,CAAAD,4BAAA;EAAAE,oBAAA,EAAAA,CAAA,KAAAA;AAAA;AAAAC,MAAA,CAAAC,OAAA,GAAAT,YAAyB,CAAAK,4BAAA;AACzB,IAAAK,gBAAuB,GAAAC,OAAA;AACvB,IAAAC,KAAA,GAAAC,OAAA,CAAAF,OAAA,QAAgC;AAOhC,IAAAG,uBAAyB,GAAAH,OAAQ;AAE1B,IAAAI,eAAS,YAAAA,CAAwBC,CAAA;EACtC,OAAAA,CAAA;AA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AED;IACF;EAEA;EAAoB,Q","ignoreList":[]}
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,WA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W;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,UAAU,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,WAAW,CACtB"}
package/dist/esm/index.js CHANGED
@@ -1,2 +1 @@
1
- export * from "./useControllableState.mjs";
2
- //# sourceMappingURL=index.js.map
1
+ export * from "./useControllableState.mjs"
@@ -1,2 +1 @@
1
- export * from "./useControllableState.mjs";
2
- //# sourceMappingURL=index.mjs.map
1
+ export * from "./useControllableState.mjs"
@@ -1,2 +1 @@
1
- export * from "./useControllableState.native.js";
2
- //# sourceMappingURL=index.native.js.map
1
+ export * from "./useControllableState.native.js"
@@ -1,48 +1,59 @@
1
1
  import { useEvent } from "@tamagui/use-event";
2
2
  import * as React from "react";
3
3
  import { startTransition } from "@tamagui/start-transition";
4
- const emptyCallbackFn = _ => _();
5
- function useControllableState({
6
- prop,
7
- defaultProp,
8
- onChange,
9
- strategy = "prop-wins",
10
- preventUpdate,
11
- transition
12
- }) {
13
- const [state, setState] = React.useState(prop ?? defaultProp);
14
- const previous = React.useRef(state);
15
- const propWins = strategy === "prop-wins" && prop !== void 0;
16
- const value = propWins ? prop : state;
17
- const onChangeCb = useEvent(onChange || idFn);
18
- const transitionFn = transition ? startTransition : emptyCallbackFn;
19
- React.useEffect(() => {
20
- if (prop === void 0) return;
21
- previous.current = prop;
22
- transitionFn(() => {
23
- setState(prop);
24
- });
25
- }, [prop]);
26
- React.useEffect(() => {
27
- if (propWins) return;
28
- if (state !== previous.current) {
29
- previous.current = state;
30
- onChangeCb(state);
31
- }
32
- }, [onChangeCb, state, propWins]);
33
- const setter = useEvent(next => {
34
- if (preventUpdate) return;
35
- if (propWins) {
36
- const nextValue = typeof next === "function" ? next(previous.current) : next;
37
- onChangeCb(nextValue);
38
- } else {
39
- transitionFn(() => {
40
- setState(next);
41
- });
42
- }
43
- });
44
- return [value, setter];
4
+
5
+ const emptyCallbackFn = (_) => _();
6
+ function useControllableState({ prop, defaultProp, onChange, strategy = "prop-wins", preventUpdate, transition }) {
7
+ const [state, setState] = React.useState(prop ?? defaultProp);
8
+ const previous = React.useRef(state);
9
+ const propWins = strategy === "prop-wins" && prop !== void 0;
10
+ const value = propWins ? prop : state;
11
+ const onChangeCb = useEvent(onChange || idFn);
12
+ const transitionFn = transition ? startTransition : emptyCallbackFn;
13
+ React.useEffect(() => {
14
+ if (prop === void 0) return;
15
+ previous.current = prop;
16
+ transitionFn(() => {
17
+ setState(prop);
18
+ });
19
+ }, [prop]);
20
+ React.useEffect(() => {
21
+ if (propWins) return;
22
+ if (state !== previous.current) {
23
+ previous.current = state;
24
+ onChangeCb(state);
25
+ }
26
+ }, [
27
+ onChangeCb,
28
+ state,
29
+ propWins
30
+ ]);
31
+ const setter = useEvent((next, details) => {
32
+ if (preventUpdate) return;
33
+ if (details?.isCanceled) return;
34
+ if (details) {
35
+ const nextValue = typeof next === "function" ? next(previous.current) : next;
36
+ onChangeCb(nextValue, details);
37
+ if (details.isCanceled) return;
38
+ if (propWins) return;
39
+ previous.current = nextValue;
40
+ transitionFn(() => {
41
+ setState(nextValue);
42
+ });
43
+ return;
44
+ }
45
+ if (propWins) {
46
+ const nextValue = typeof next === "function" ? next(previous.current) : next;
47
+ onChangeCb(nextValue);
48
+ } else {
49
+ transitionFn(() => {
50
+ setState(next);
51
+ });
52
+ }
53
+ });
54
+ return [value, setter];
45
55
  }
46
56
  const idFn = () => {};
57
+
47
58
  export { useControllableState };
48
59
  //# sourceMappingURL=useControllableState.mjs.map
@@ -1 +1 @@
1
- {"version":3,"names":["useEvent","React","startTransition","emptyCallbackFn","_","useControllableState","prop","defaultProp","onChange","strategy","preventUpdate","transition","state","setState","useState","previous","useRef","propWins","value","onChangeCb","idFn","transitionFn","useEffect","current","setter","next","nextValue"],"sources":["../../src/useControllableState.ts"],"sourcesContent":[null],"mappings":"AAAA,SAASA,QAAA,QAAgB;AACzB,YAAYC,KAAA,MAAW;AACvB,SAASC,eAAA,QAAuB;AAOhC,MAAMC,eAAA,GAAmBC,CAAA,IAAMA,CAAA,CAAE;AAE1B,SAASC,qBAAwB;EACtCC,IAAA;EACAC,WAAA;EACAC,QAAA;EACAC,QAAA,GAAW;EACXC,aAAA;EACAC;AACF,GAOiD;EAC/C,MAAM,CAACC,KAAA,EAAOC,QAAQ,IAAIZ,KAAA,CAAMa,QAAA,CAASR,IAAA,IAAQC,WAAW;EAC5D,MAAMQ,QAAA,GAAWd,KAAA,CAAMe,MAAA,CAAYJ,KAAK;EACxC,MAAMK,QAAA,GAAWR,QAAA,KAAa,eAAeH,IAAA,KAAS;EACtD,MAAMY,KAAA,GAAQD,QAAA,GAAWX,IAAA,GAAOM,KAAA;EAChC,MAAMO,UAAA,GAAanB,QAAA,CAASQ,QAAA,IAAYY,IAAI;EAE5C,MAAMC,YAAA,GAAeV,UAAA,GAAaT,eAAA,GAAkBC,eAAA;EAEpDF,KAAA,CAAMqB,SAAA,CAAU,MAAM;IACpB,IAAIhB,IAAA,KAAS,QAAW;IACxBS,QAAA,CAASQ,OAAA,GAAUjB,IAAA;IACnBe,YAAA,CAAa,MAAM;MACjBR,QAAA,CAASP,IAAI;IACf,CAAC;EACH,GAAG,CAACA,IAAI,CAAC;EAETL,KAAA,CAAMqB,SAAA,CAAU,MAAM;IACpB,IAAIL,QAAA,EAAU;IACd,IAAIL,KAAA,KAAUG,QAAA,CAASQ,OAAA,EAAS;MAC9BR,QAAA,CAASQ,OAAA,GAAUX,KAAA;MACnBO,UAAA,CAAWP,KAAK;IAClB;EACF,GAAG,CAACO,UAAA,EAAYP,KAAA,EAAOK,QAAQ,CAAC;EAEhC,MAAMO,MAAA,GAASxB,QAAA,CAAUyB,IAAA,IAAS;IAChC,IAAIf,aAAA,EAAe;IACnB,IAAIO,QAAA,EAAU;MACZ,MAAMS,SAAA,GAAY,OAAOD,IAAA,KAAS,aAAaA,IAAA,CAAKV,QAAA,CAASQ,OAAO,IAAIE,IAAA;MACxEN,UAAA,CAAWO,SAAS;IACtB,OAAO;MACLL,YAAA,CAAa,MAAM;QACjBR,QAAA,CAASY,IAAI;MACf,CAAC;IACH;EACF,CAAC;EAED,OAAO,CAACP,KAAA,EAAYM,MAAM;AAC5B;AAEA,MAAMJ,IAAA,GAAOA,CAAA,KAAM,CAAC","ignoreList":[]}
1
+ {"version":3,"file":"useControllableState.js","names":[],"sources":["esm/useControllableState.js"],"sourcesContent":["import { useEvent } from \"@tamagui/use-event\";\nimport * as React from \"react\";\nimport { startTransition } from \"@tamagui/start-transition\";\nconst emptyCallbackFn = (_) => _();\nfunction useControllableState({\n prop,\n defaultProp,\n onChange,\n strategy = \"prop-wins\",\n preventUpdate,\n transition\n}) {\n const [state, setState] = React.useState(prop ?? defaultProp);\n const previous = React.useRef(state);\n const propWins = strategy === \"prop-wins\" && prop !== void 0;\n const value = propWins ? prop : state;\n const onChangeCb = useEvent(onChange || idFn);\n const transitionFn = transition ? startTransition : emptyCallbackFn;\n React.useEffect(() => {\n if (prop === void 0) return;\n previous.current = prop;\n transitionFn(() => {\n setState(prop);\n });\n }, [prop]);\n React.useEffect(() => {\n if (propWins) return;\n if (state !== previous.current) {\n previous.current = state;\n onChangeCb(state);\n }\n }, [onChangeCb, state, propWins]);\n const setter = useEvent((next, details) => {\n if (preventUpdate) return;\n if (details?.isCanceled) return;\n if (details) {\n const 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(() => {\n setState(nextValue);\n });\n return;\n }\n if (propWins) {\n const nextValue = typeof next === \"function\" ? next(previous.current) : next;\n onChangeCb(nextValue);\n } else {\n transitionFn(() => {\n setState(next);\n });\n }\n });\n return [value, setter];\n}\nconst idFn = () => {\n};\nexport {\n useControllableState\n};\n//# sourceMappingURL=useControllableState.js.map\n"],"mappings":";;;;;AAGA,MAAM,mBAAmB,MAAM,EAAE;AACjC,SAAS,qBAAqB,EAC5B,MACA,aACA,UACA,WAAW,aACX,eACA,cACC;CACD,MAAM,CAAC,OAAO,YAAY,MAAM,SAAS,QAAQ,WAAW;CAC5D,MAAM,WAAW,MAAM,OAAO,KAAK;CACnC,MAAM,WAAW,aAAa,eAAe,SAAS,KAAK;CAC3D,MAAM,QAAQ,WAAW,OAAO;CAChC,MAAM,aAAa,SAAS,YAAY,IAAI;CAC5C,MAAM,eAAe,aAAa,kBAAkB;CACpD,MAAM,gBAAgB;EACpB,IAAI,SAAS,KAAK,GAAG;EACrB,SAAS,UAAU;EACnB,mBAAmB;GACjB,SAAS,IAAI;EACf,CAAC;CACH,GAAG,CAAC,IAAI,CAAC;CACT,MAAM,gBAAgB;EACpB,IAAI,UAAU;EACd,IAAI,UAAU,SAAS,SAAS;GAC9B,SAAS,UAAU;GACnB,WAAW,KAAK;EAClB;CACF,GAAG;EAAC;EAAY;EAAO;CAAQ,CAAC;CAChC,MAAM,SAAS,UAAU,MAAM,YAAY;EACzC,IAAI,eAAe;EACnB,IAAI,SAAS,YAAY;EACzB,IAAI,SAAS;GACX,MAAM,YAAY,OAAO,SAAS,aAAa,KAAK,SAAS,OAAO,IAAI;GACxE,WAAW,WAAW,OAAO;GAC7B,IAAI,QAAQ,YAAY;GACxB,IAAI,UAAU;GACd,SAAS,UAAU;GACnB,mBAAmB;IACjB,SAAS,SAAS;GACpB,CAAC;GACD;EACF;EACA,IAAI,UAAU;GACZ,MAAM,YAAY,OAAO,SAAS,aAAa,KAAK,SAAS,OAAO,IAAI;GACxE,WAAW,SAAS;EACtB,OAAO;GACL,mBAAmB;IACjB,SAAS,IAAI;GACf,CAAC;EACH;CACF,CAAC;CACD,OAAO,CAAC,OAAO,MAAM;AACvB;AACA,MAAM,aAAa,CACnB"}
@@ -1,51 +1,62 @@
1
1
  import { useEvent } from "@tamagui/use-event";
2
2
  import * as React from "react";
3
3
  import { startTransition } from "@tamagui/start-transition";
4
- var emptyCallbackFn = function (_) {
5
- return _();
4
+
5
+ var emptyCallbackFn = function(_) {
6
+ return _();
6
7
  };
7
8
  function useControllableState(param) {
8
- var {
9
- prop,
10
- defaultProp,
11
- onChange,
12
- strategy = "prop-wins",
13
- preventUpdate,
14
- transition
15
- } = param;
16
- var [state, setState] = React.useState(prop !== null && prop !== void 0 ? prop : defaultProp);
17
- var previous = React.useRef(state);
18
- var propWins = strategy === "prop-wins" && prop !== void 0;
19
- var value = propWins ? prop : state;
20
- var onChangeCb = useEvent(onChange || idFn);
21
- var transitionFn = transition ? startTransition : emptyCallbackFn;
22
- React.useEffect(function () {
23
- if (prop === void 0) return;
24
- previous.current = prop;
25
- transitionFn(function () {
26
- setState(prop);
27
- });
28
- }, [prop]);
29
- React.useEffect(function () {
30
- if (propWins) return;
31
- if (state !== previous.current) {
32
- previous.current = state;
33
- onChangeCb(state);
34
- }
35
- }, [onChangeCb, state, propWins]);
36
- var setter = useEvent(function (next) {
37
- if (preventUpdate) return;
38
- if (propWins) {
39
- var nextValue = typeof next === "function" ? next(previous.current) : next;
40
- onChangeCb(nextValue);
41
- } else {
42
- transitionFn(function () {
43
- setState(next);
44
- });
45
- }
46
- });
47
- return [value, setter];
9
+ var { prop, defaultProp, onChange, strategy = "prop-wins", preventUpdate, transition } = param;
10
+ var [state, setState] = React.useState(prop !== null && prop !== void 0 ? prop : defaultProp);
11
+ var previous = React.useRef(state);
12
+ var propWins = strategy === "prop-wins" && prop !== void 0;
13
+ var value = propWins ? prop : state;
14
+ var onChangeCb = useEvent(onChange || idFn);
15
+ var transitionFn = transition ? startTransition : emptyCallbackFn;
16
+ React.useEffect(function() {
17
+ if (prop === void 0) return;
18
+ previous.current = prop;
19
+ transitionFn(function() {
20
+ setState(prop);
21
+ });
22
+ }, [prop]);
23
+ React.useEffect(function() {
24
+ if (propWins) return;
25
+ if (state !== previous.current) {
26
+ previous.current = state;
27
+ onChangeCb(state);
28
+ }
29
+ }, [
30
+ onChangeCb,
31
+ state,
32
+ propWins
33
+ ]);
34
+ var setter = useEvent(function(next, details) {
35
+ if (preventUpdate) return;
36
+ if (details === null || details === void 0 ? void 0 : details.isCanceled) return;
37
+ if (details) {
38
+ var nextValue = typeof next === "function" ? next(previous.current) : next;
39
+ onChangeCb(nextValue, details);
40
+ if (details.isCanceled) return;
41
+ if (propWins) return;
42
+ previous.current = nextValue;
43
+ transitionFn(function() {
44
+ setState(nextValue);
45
+ });
46
+ return;
47
+ }
48
+ if (propWins) {
49
+ var nextValue1 = typeof next === "function" ? next(previous.current) : next;
50
+ onChangeCb(nextValue1);
51
+ } else {
52
+ transitionFn(function() {
53
+ setState(next);
54
+ });
55
+ }
56
+ });
57
+ return [value, setter];
48
58
  }
49
- var idFn = function () {};
59
+ var idFn = function() {};
60
+
50
61
  export { useControllableState };
51
62
  //# sourceMappingURL=useControllableState.native.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["useEvent","React","startTransition","emptyCallbackFn","_","useControllableState","param","prop","defaultProp","onChange","strategy","preventUpdate","transition","state","setState","useState","previous","useRef","propWins","value","onChangeCb","idFn","transitionFn","useEffect","current","setter","next","nextValue"],"sources":["../../src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QAAA,CAAAQ,OAAA,IAAAE,IAAA;MACLN,UAAA,CAAAO,SAAmB;IACjB;MACFL,YAAC;QACHR,QAAA,CAAAY,IAAA;MACD;IAED;EACF;EAEA,OAAM,CAAcP,KAAA,E","ignoreList":[]}
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,kBAAkB,SAAS,GAAG;CAChC,OA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,CACtB"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tamagui/use-controllable-state",
3
- "version": "2.7.7",
3
+ "version": "3.0.0-beta.643.1",
4
4
  "gitHead": "a49cc7ea6b93ba384e77a4880ae48ac4a5635c14",
5
5
  "source": "src/index.ts",
6
6
  "files": [
@@ -35,11 +35,12 @@
35
35
  "clean:build": "tamagui-build clean:build"
36
36
  },
37
37
  "dependencies": {
38
- "@tamagui/start-transition": "2.7.7",
39
- "@tamagui/use-event": "2.7.7"
38
+ "@tamagui/core": "3.0.0-beta.643.1",
39
+ "@tamagui/start-transition": "3.0.0-beta.643.1",
40
+ "@tamagui/use-event": "3.0.0-beta.643.1"
40
41
  },
41
42
  "devDependencies": {
42
- "@tamagui/build": "2.7.7",
43
+ "@tamagui/build": "3.0.0-beta.643.1",
43
44
  "react": ">=19"
44
45
  },
45
46
  "peerDependencies": {
@@ -1,15 +1,30 @@
1
1
  import { useEvent } from '@tamagui/use-event'
2
2
  import * as React from 'react'
3
3
  import { startTransition } from '@tamagui/start-transition'
4
+ import type { TamaguiChangeEventDetails } from '@tamagui/core'
4
5
 
5
6
  // can configure to allow most-recent-wins or prop-wins
6
7
  // defaults to prop-wins
7
8
 
8
- type ChangeCb<T> = (next: T) => void
9
+ type ChangeCb<T, Details extends TamaguiChangeEventDetails> = (
10
+ next: T,
11
+ details?: Details
12
+ ) => void
13
+
14
+ export type ControllableStateSetter<
15
+ T,
16
+ Details extends TamaguiChangeEventDetails = TamaguiChangeEventDetails,
17
+ > = {
18
+ (next: React.SetStateAction<T>): void
19
+ (next: React.SetStateAction<T>, details: Details): void
20
+ }
9
21
 
10
22
  const emptyCallbackFn = (_) => _()
11
23
 
12
- export function useControllableState<T>({
24
+ export function useControllableState<
25
+ T,
26
+ Details extends TamaguiChangeEventDetails = TamaguiChangeEventDetails,
27
+ >({
13
28
  prop,
14
29
  defaultProp,
15
30
  onChange,
@@ -19,11 +34,11 @@ export function useControllableState<T>({
19
34
  }: {
20
35
  prop?: T | undefined
21
36
  defaultProp: T
22
- onChange?: ChangeCb<T>
37
+ onChange?: ChangeCb<T, Details>
23
38
  strategy?: 'prop-wins' | 'most-recent-wins'
24
39
  preventUpdate?: boolean
25
40
  transition?: boolean
26
- }): [T, React.Dispatch<React.SetStateAction<T>>] {
41
+ }): [T, ControllableStateSetter<T, Details>] {
27
42
  const [state, setState] = React.useState(prop ?? defaultProp)
28
43
  const previous = React.useRef<any>(state)
29
44
  const propWins = strategy === 'prop-wins' && prop !== undefined
@@ -48,8 +63,24 @@ export function useControllableState<T>({
48
63
  }
49
64
  }, [onChangeCb, state, propWins])
50
65
 
51
- const setter = useEvent((next) => {
66
+ const setter = useEvent((next, details?: Details) => {
52
67
  if (preventUpdate) return
68
+ if (details?.isCanceled) return
69
+
70
+ if (details) {
71
+ const nextValue = typeof next === 'function' ? next(previous.current) : next
72
+ onChangeCb(nextValue, details)
73
+ if (details.isCanceled) return
74
+
75
+ if (propWins) return
76
+
77
+ previous.current = nextValue
78
+ transitionFn(() => {
79
+ setState(nextValue)
80
+ })
81
+ return
82
+ }
83
+
53
84
  if (propWins) {
54
85
  const nextValue = typeof next === 'function' ? next(previous.current) : next
55
86
  onChangeCb(nextValue)
@@ -60,7 +91,7 @@ export function useControllableState<T>({
60
91
  }
61
92
  })
62
93
 
63
- return [value as T, setter]
94
+ return [value as T, setter as ControllableStateSetter<T, Details>]
64
95
  }
65
96
 
66
97
  const idFn = () => {}
package/types/index.d.ts CHANGED
@@ -1,2 +1,3 @@
1
- export * from './useControllableState';
1
+ export * from "./useControllableState";
2
+
2
3
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1,11 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,wBAAwB,CAAA"}
1
+ {
2
+ "mappings": "AAAA,cAAc",
3
+ "names": [],
4
+ "sources": [
5
+ "src/index.ts"
6
+ ],
7
+ "version": 3,
8
+ "sourcesContent": [
9
+ "export * from './useControllableState'\n"
10
+ ]
11
+ }
@@ -1,12 +1,27 @@
1
- import * as React from 'react';
2
- type ChangeCb<T> = (next: T) => void;
3
- export declare function useControllableState<T>({ prop, defaultProp, onChange, strategy, preventUpdate, transition, }: {
4
- prop?: T | undefined;
5
- defaultProp: T;
6
- onChange?: ChangeCb<T>;
7
- strategy?: 'prop-wins' | 'most-recent-wins';
8
- preventUpdate?: boolean;
9
- transition?: boolean;
10
- }): [T, React.Dispatch<React.SetStateAction<T>>];
1
+ import * as React from "react";
2
+ import type { TamaguiChangeEventDetails } from "@tamagui/core";
3
+ type ChangeCb<
4
+ T,
5
+ Details extends TamaguiChangeEventDetails
6
+ > = (next: T, details?: Details) => void;
7
+ export type ControllableStateSetter<
8
+ T,
9
+ Details extends TamaguiChangeEventDetails = TamaguiChangeEventDetails
10
+ > = {
11
+ (next: React.SetStateAction<T>): void;
12
+ (next: React.SetStateAction<T>, details: Details): void;
13
+ };
14
+ export declare function useControllableState<
15
+ T,
16
+ Details extends TamaguiChangeEventDetails = TamaguiChangeEventDetails
17
+ >({ prop, defaultProp, onChange, strategy, preventUpdate, transition }: {
18
+ prop?: T | undefined;
19
+ defaultProp: T;
20
+ onChange?: ChangeCb<T, Details>;
21
+ strategy?: "prop-wins" | "most-recent-wins";
22
+ preventUpdate?: boolean;
23
+ transition?: boolean;
24
+ }): [T, ControllableStateSetter<T, Details>];
11
25
  export {};
26
+
12
27
  //# sourceMappingURL=useControllableState.d.ts.map
@@ -1 +1,11 @@
1
- {"version":3,"file":"useControllableState.d.ts","sourceRoot":"","sources":["../src/useControllableState.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AAM9B,KAAK,QAAQ,CAAC,CAAC,IAAI,CAAC,IAAI,EAAE,CAAC,KAAK,IAAI,CAAA;AAIpC,wBAAgB,oBAAoB,CAAC,CAAC,EAAE,EACtC,IAAI,EACJ,WAAW,EACX,QAAQ,EACR,QAAsB,EACtB,aAAa,EACb,UAAU,GACX,EAAE;IACD,IAAI,CAAC,EAAE,CAAC,GAAG,SAAS,CAAA;IACpB,WAAW,EAAE,CAAC,CAAA;IACd,QAAQ,CAAC,EAAE,QAAQ,CAAC,CAAC,CAAC,CAAA;IACtB,QAAQ,CAAC,EAAE,WAAW,GAAG,kBAAkB,CAAA;IAC3C,aAAa,CAAC,EAAE,OAAO,CAAA;IACvB,UAAU,CAAC,EAAE,OAAO,CAAA;CACrB,GAAG,CAAC,CAAC,EAAE,KAAK,CAAC,QAAQ,CAAC,KAAK,CAAC,cAAc,CAAC,CAAC,CAAC,CAAC,CAAC,CAsC/C"}
1
+ {
2
+ "mappings": "AACA,YAAY,WAAW;AAEvB,cAAc,iCAAiC;KAK1C;CAAS;CAAG,gBAAgB;KAC/B,MAAM,GACN,UAAU;AAGZ,YAAY;CACV;CACA,gBAAgB,4BAA4B;IAC1C;EACD,MAAM,MAAM,eAAe;EAC3B,MAAM,MAAM,eAAe,IAAI,SAAS;;AAK3C,OAAO,iBAAS;CACd;CACA,gBAAgB,4BAA4B;EAC5C,EACA,MACA,aACA,UACA,UACA,eACA,cACC;CACD,OAAO;CACP,aAAa;CACb,WAAW,SAAS,GAAG;CACvB,WAAW,cAAc;CACzB;CACA;KACG,GAAG,wBAAwB,GAAG",
3
+ "names": [],
4
+ "sources": [
5
+ "src/useControllableState.ts"
6
+ ],
7
+ "version": 3,
8
+ "sourcesContent": [
9
+ "import { useEvent } from '@tamagui/use-event'\nimport * as React from 'react'\nimport { startTransition } from '@tamagui/start-transition'\nimport type { TamaguiChangeEventDetails } from '@tamagui/core'\n\n// can configure to allow most-recent-wins or prop-wins\n// defaults to prop-wins\n\ntype ChangeCb<T, Details extends TamaguiChangeEventDetails> = (\n next: T,\n details?: Details\n) => void\n\nexport type ControllableStateSetter<\n T,\n Details extends TamaguiChangeEventDetails = TamaguiChangeEventDetails,\n> = {\n (next: React.SetStateAction<T>): void\n (next: React.SetStateAction<T>, details: Details): void\n}\n\nconst emptyCallbackFn = (_) => _()\n\nexport function useControllableState<\n T,\n Details extends TamaguiChangeEventDetails = TamaguiChangeEventDetails,\n>({\n prop,\n defaultProp,\n onChange,\n strategy = 'prop-wins',\n preventUpdate,\n transition,\n}: {\n prop?: T | undefined\n defaultProp: T\n onChange?: ChangeCb<T, Details>\n strategy?: 'prop-wins' | 'most-recent-wins'\n preventUpdate?: boolean\n transition?: boolean\n}): [T, ControllableStateSetter<T, Details>] {\n const [state, setState] = React.useState(prop ?? defaultProp)\n const previous = React.useRef<any>(state)\n const propWins = strategy === 'prop-wins' && prop !== undefined\n const value = propWins ? prop : state\n const onChangeCb = useEvent(onChange || idFn)\n\n const transitionFn = transition ? startTransition : emptyCallbackFn\n\n React.useEffect(() => {\n if (prop === undefined) return\n previous.current = prop\n transitionFn(() => {\n setState(prop)\n })\n }, [prop])\n\n React.useEffect(() => {\n if (propWins) return\n if (state !== previous.current) {\n previous.current = state\n onChangeCb(state)\n }\n }, [onChangeCb, state, propWins])\n\n const setter = useEvent((next, details?: Details) => {\n if (preventUpdate) return\n if (details?.isCanceled) return\n\n if (details) {\n const nextValue = typeof next === 'function' ? next(previous.current) : next\n onChangeCb(nextValue, details)\n if (details.isCanceled) return\n\n if (propWins) return\n\n previous.current = nextValue\n transitionFn(() => {\n setState(nextValue)\n })\n return\n }\n\n if (propWins) {\n const nextValue = typeof next === 'function' ? next(previous.current) : next\n onChangeCb(nextValue)\n } else {\n transitionFn(() => {\n setState(next)\n })\n }\n })\n\n return [value as T, setter as ControllableStateSetter<T, Details>]\n}\n\nconst idFn = () => {}\n"
10
+ ]
11
+ }
@@ -1 +0,0 @@
1
- {"version":3,"names":[],"sources":["../../src/index.ts"],"sourcesContent":[null],"mappings":"AAAA,cAAc","ignoreList":[]}
@@ -1 +0,0 @@
1
- {"version":3,"names":[],"sources":["../../src/index.ts"],"sourcesContent":[null],"mappings":"AAAA,cAAc","ignoreList":[]}
@@ -1 +0,0 @@
1
- {"version":3,"names":[],"sources":["../../src/index.ts"],"sourcesContent":[null],"mappings":"AAAA,cAAc","ignoreList":[]}