@tamagui/adapt 1.110.5 → 1.111.0

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.
@@ -29,49 +29,7 @@ __export(Adapt_exports, {
29
29
  useAdaptParent: () => useAdaptParent
30
30
  });
31
31
  module.exports = __toCommonJS(Adapt_exports);
32
- var import_jsx_runtime = require("react/jsx-runtime"), import_react = __toESM(require("react")), import_constants = require("@tamagui/constants"), import_core = require("@tamagui/core"), import_helpers = require("@tamagui/helpers");
33
- function _array_like_to_array(arr, len) {
34
- (len == null || len > arr.length) && (len = arr.length);
35
- for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i];
36
- return arr2;
37
- }
38
- function _array_with_holes(arr) {
39
- if (Array.isArray(arr)) return arr;
40
- }
41
- function _iterable_to_array_limit(arr, i) {
42
- var _i = arr == null ? null : typeof Symbol < "u" && arr[Symbol.iterator] || arr["@@iterator"];
43
- if (_i != null) {
44
- var _arr = [], _n = !0, _d = !1, _s, _e;
45
- try {
46
- for (_i = _i.call(arr); !(_n = (_s = _i.next()).done) && (_arr.push(_s.value), !(i && _arr.length === i)); _n = !0)
47
- ;
48
- } catch (err) {
49
- _d = !0, _e = err;
50
- } finally {
51
- try {
52
- !_n && _i.return != null && _i.return();
53
- } finally {
54
- if (_d) throw _e;
55
- }
56
- }
57
- return _arr;
58
- }
59
- }
60
- function _non_iterable_rest() {
61
- throw new TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
62
- }
63
- function _sliced_to_array(arr, i) {
64
- return _array_with_holes(arr) || _iterable_to_array_limit(arr, i) || _unsupported_iterable_to_array(arr, i) || _non_iterable_rest();
65
- }
66
- function _unsupported_iterable_to_array(o, minLen) {
67
- if (o) {
68
- if (typeof o == "string") return _array_like_to_array(o, minLen);
69
- var n = Object.prototype.toString.call(o).slice(8, -1);
70
- if (n === "Object" && o.constructor && (n = o.constructor.name), n === "Map" || n === "Set") return Array.from(n);
71
- if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _array_like_to_array(o, minLen);
72
- }
73
- }
74
- var AdaptParentContext = /* @__PURE__ */ import_react.default.createContext(null), AdaptContents = function(props) {
32
+ var import_jsx_runtime = require("react/jsx-runtime"), import_react = __toESM(require("react")), import_constants = require("@tamagui/constants"), import_core = require("@tamagui/core"), import_helpers = require("@tamagui/helpers"), AdaptParentContext = /* @__PURE__ */ import_react.default.createContext(null), AdaptContents = function(props) {
75
33
  var context = import_react.default.useContext(AdaptParentContext);
76
34
  if (!(context != null && context.Contents))
77
35
  throw new Error(process.env.NODE_ENV === "production" ? "tamagui.dev/docs/intro/errors#warning-002" : "You're rendering a Tamagui <Adapt /> component without nesting it inside a parent that is able to adapt.");
@@ -79,16 +37,17 @@ var AdaptParentContext = /* @__PURE__ */ import_react.default.createContext(null
79
37
  };
80
38
  AdaptContents.shouldForwardSpace = !0;
81
39
  var useAdaptParent = function(param) {
82
- var Contents = param.Contents, _React_useState = _sliced_to_array(import_react.default.useState(null), 2), when = _React_useState[0], setWhen = _React_useState[1], AdaptProvider = import_react.default.useMemo(function() {
83
- var AdaptProviderView = function(props) {
40
+ var { Contents } = param, [when, setWhen] = import_react.default.useState(null), AdaptProvider = import_react.default.useMemo(function() {
41
+ var context = {
42
+ Contents,
43
+ setWhen
44
+ };
45
+ function AdaptProviderView(props) {
84
46
  return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(AdaptParentContext.Provider, {
85
47
  value: context,
86
48
  children: props.children
87
49
  });
88
- }, context = {
89
- Contents,
90
- setWhen
91
- };
50
+ }
92
51
  return AdaptProviderView;
93
52
  }, [
94
53
  Contents
@@ -98,7 +57,7 @@ var useAdaptParent = function(param) {
98
57
  when
99
58
  };
100
59
  }, Adapt = (0, import_helpers.withStaticProperties)(function(param) {
101
- var platform = param.platform, when = param.when, children = param.children, context = import_react.default.useContext(AdaptParentContext), media = (0, import_core.useMedia)(), enabled = !1;
60
+ var { platform, when, children } = param, context = import_react.default.useContext(AdaptParentContext), media = (0, import_core.useMedia)(), enabled = !1;
102
61
  return typeof when == "function" ? enabled = when({
103
62
  media
104
63
  }) : (enabled = !platform, platform === "touch" && (enabled = import_constants.isTouchable), platform === "native" && (enabled = !import_constants.isWeb), platform === "web" && (enabled = import_constants.isWeb), platform === "ios" && (enabled = import_constants.isIos), platform === "android" && (enabled = import_constants.isAndroid), when && !media[when] && (enabled = !1)), (0, import_constants.useIsomorphicLayoutEffect)(function() {
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../src/Users/n8/tamagui/code/ui/adapt/src/Adapt.tsx"],
4
- "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;uDAAA,eAAkB,2BAClB,mBAMO,+BAEP,cAAyB,0BACzB,iBAAqC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAoB9B,IAAMA,qBAAqBC,6BAAAA,QAAMC,cAA0C,IAAA,GAGrEC,gBAAgB,SAACC,OAAAA;AAC5B,MAAMC,UAAUJ,aAAAA,QAAMK,WAAWN,kBAAAA;AACjC,MAAI,EAACK,WAAAA,QAAAA,QAASE;AACZ,UAAM,IAAIC,MACRC,QAAQC,IAAIC,aAAa,eACpB,8CACA,0GAAA;AAGT,SAAOV,6BAAAA,QAAMW,cAAcP,QAAQE,UAAUH,KAAAA;AAC/C;AAEAD,cAAcU,qBAAqB;AAE5B,IAAMC,iBAAiB,SAAA,OAAA;MAC5BP,WAAAA,MAAAA,UAEwBN,kBAAAA,iBAAAA,aAAAA,QAAMc,SAAe,IAAA,GAAA,CAAA,GAAtCC,OAAiBf,gBAAAA,CAAAA,GAAXgB,UAAWhB,gBAAAA,CAAAA,GAElBiB,gBAAgBjB,aAAAA,QAAMkB,QAAQ,WAAA;QAMzBC,oBAAT,SAA2BhB,OAAyB;AAClD,aACE,uCAAAiB,KAACrB,mBAAmBsB,UAAQ;QAACC,OAAOlB;kBACjCD,MAAMoB;;IAGb,GAXMnB,UAA+B;MACnCE;MACAU;IACF;AAUA,WAAOG;EACT,GAAG;IAACb;GAAS;AAEb,SAAO;IACLW;IACAF;EACF;AACF,GAEaS,YAAQC,qCACnB,SAAe,OAAwC;MAAtCC,WAAF,MAAEA,UAAUX,OAAZ,MAAYA,MAAMQ,WAAlB,MAAkBA,UACzBnB,UAAUJ,aAAAA,QAAMK,WAAWN,kBAAAA,GAC3B4B,YAAQC,sBAAAA,GAEVC,UAAU;AAuBd,SArBI,OAAOd,QAAS,aAClBc,UAAUd,KAAK;IAAEY;EAAM,CAAA,KAEvBE,UAAU,CAACH,UAEPA,aAAa,YAASG,UAAUC,+BAChCJ,aAAa,aAAUG,UAAU,CAACE,yBAClCL,aAAa,UAAOG,UAAUE,yBAC9BL,aAAa,UAAOG,UAAUG,yBAC9BN,aAAa,cAAWG,UAAUI,6BAElClB,QAAQ,CAACY,MAAMZ,IAAAA,MACjBc,UAAU,UAIdK,4CAA0B,WAAA;AACxB,IAAKL,YACLzB,WAAAA,QAAAA,QAASY,QAASD,QAAQc,OAAAA;EAC5B,GAAG;IAACd;IAAMX;IAASyB;GAAQ,GAEtBA,UAID,OAAON,YAAa,aACfA,SAAS;IAAEM;IAASF;EAAM,CAAA,IAG5BJ,WAPE;AAQX,GACA;EACEjB,UAAUJ;AACZ,CAAA;",
5
- "names": ["AdaptParentContext", "React", "createContext", "AdaptContents", "props", "context", "useContext", "Contents", "Error", "process", "env", "NODE_ENV", "createElement", "shouldForwardSpace", "useAdaptParent", "useState", "when", "setWhen", "AdaptProvider", "useMemo", "AdaptProviderView", "_jsx", "Provider", "value", "children", "Adapt", "withStaticProperties", "platform", "media", "useMedia", "enabled", "isTouchable", "isWeb", "isIos", "isAndroid", "useIsomorphicLayoutEffect"]
4
+ "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;uDAAA,eAAkB,2BAClB,mBAMO,+BAEP,cAAyB,0BAC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AA,QAAAA,QAASW,QAASD,QAAQe,OAAAA;EAC5B,GAAG;IAACf;IAAMV;IAASyB;GAAQ,GAEtBA,UAID,OAAON,YAAa,aACfA,SAAS;IAAEM;IAASF;EAAM,CAAA,IAG5BJ,WAPE;AAQX,GACA;EACEjB,UAAUJ;AACZ,CAAA;",
5
+ "names": ["AdaptParentContext", "React", "createContext", "AdaptContents", "props", "context", "useContext", "Contents", "Error", "process", "env", "NODE_ENV", "createElement", "shouldForwardSpace", "useAdaptParent", "when", "setWhen", "useState", "AdaptProvider", "useMemo", "AdaptProviderView", "_jsx", "Provider", "value", "children", "Adapt", "withStaticProperties", "platform", "media", "useMedia", "enabled", "isTouchable", "isWeb", "isIos", "isAndroid", "useIsomorphicLayoutEffect"]
6
6
  }
@@ -3,65 +3,25 @@ import React from "react";
3
3
  import { isAndroid, isIos, isTouchable, isWeb, useIsomorphicLayoutEffect } from "@tamagui/constants";
4
4
  import { useMedia } from "@tamagui/core";
5
5
  import { withStaticProperties } from "@tamagui/helpers";
6
- function _array_like_to_array(arr, len) {
7
- (len == null || len > arr.length) && (len = arr.length);
8
- for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i];
9
- return arr2;
10
- }
11
- function _array_with_holes(arr) {
12
- if (Array.isArray(arr)) return arr;
13
- }
14
- function _iterable_to_array_limit(arr, i) {
15
- var _i = arr == null ? null : typeof Symbol < "u" && arr[Symbol.iterator] || arr["@@iterator"];
16
- if (_i != null) {
17
- var _arr = [], _n = !0, _d = !1, _s, _e;
18
- try {
19
- for (_i = _i.call(arr); !(_n = (_s = _i.next()).done) && (_arr.push(_s.value), !(i && _arr.length === i)); _n = !0)
20
- ;
21
- } catch (err) {
22
- _d = !0, _e = err;
23
- } finally {
24
- try {
25
- !_n && _i.return != null && _i.return();
26
- } finally {
27
- if (_d) throw _e;
28
- }
29
- }
30
- return _arr;
31
- }
32
- }
33
- function _non_iterable_rest() {
34
- throw new TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
35
- }
36
- function _sliced_to_array(arr, i) {
37
- return _array_with_holes(arr) || _iterable_to_array_limit(arr, i) || _unsupported_iterable_to_array(arr, i) || _non_iterable_rest();
38
- }
39
- function _unsupported_iterable_to_array(o, minLen) {
40
- if (o) {
41
- if (typeof o == "string") return _array_like_to_array(o, minLen);
42
- var n = Object.prototype.toString.call(o).slice(8, -1);
43
- if (n === "Object" && o.constructor && (n = o.constructor.name), n === "Map" || n === "Set") return Array.from(n);
44
- if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _array_like_to_array(o, minLen);
45
- }
46
- }
47
6
  var AdaptParentContext = /* @__PURE__ */ React.createContext(null), AdaptContents = function(props) {
48
7
  var context = React.useContext(AdaptParentContext);
49
- if (!(context != null && context.Contents))
8
+ if (!context?.Contents)
50
9
  throw new Error(process.env.NODE_ENV === "production" ? "tamagui.dev/docs/intro/errors#warning-002" : "You're rendering a Tamagui <Adapt /> component without nesting it inside a parent that is able to adapt.");
51
10
  return /* @__PURE__ */ React.createElement(context.Contents, props);
52
11
  };
53
12
  AdaptContents.shouldForwardSpace = !0;
54
13
  var useAdaptParent = function(param) {
55
- var Contents = param.Contents, _React_useState = _sliced_to_array(React.useState(null), 2), when = _React_useState[0], setWhen = _React_useState[1], AdaptProvider = React.useMemo(function() {
56
- var AdaptProviderView = function(props) {
14
+ var { Contents } = param, [when, setWhen] = React.useState(null), AdaptProvider = React.useMemo(function() {
15
+ var context = {
16
+ Contents,
17
+ setWhen
18
+ };
19
+ function AdaptProviderView(props) {
57
20
  return /* @__PURE__ */ _jsx(AdaptParentContext.Provider, {
58
21
  value: context,
59
22
  children: props.children
60
23
  });
61
- }, context = {
62
- Contents,
63
- setWhen
64
- };
24
+ }
65
25
  return AdaptProviderView;
66
26
  }, [
67
27
  Contents
@@ -71,11 +31,11 @@ var useAdaptParent = function(param) {
71
31
  when
72
32
  };
73
33
  }, Adapt = withStaticProperties(function(param) {
74
- var platform = param.platform, when = param.when, children = param.children, context = React.useContext(AdaptParentContext), media = useMedia(), enabled = !1;
34
+ var { platform, when, children } = param, context = React.useContext(AdaptParentContext), media = useMedia(), enabled = !1;
75
35
  return typeof when == "function" ? enabled = when({
76
36
  media
77
37
  }) : (enabled = !platform, platform === "touch" && (enabled = isTouchable), platform === "native" && (enabled = !isWeb), platform === "web" && (enabled = isWeb), platform === "ios" && (enabled = isIos), platform === "android" && (enabled = isAndroid), when && !media[when] && (enabled = !1)), useIsomorphicLayoutEffect(function() {
78
- enabled && (context == null || context.setWhen(when || enabled));
38
+ enabled && context?.setWhen(when || enabled);
79
39
  }, [
80
40
  when,
81
41
  context,
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../src/Users/n8/tamagui/code/ui/adapt/src/Adapt.tsx"],
4
- "mappings": ";AAAA,OAAOA,WAAW;AAClB,SACEC,WACAC,OACAC,aACAC,OACAC,iCACK;AAEP,SAASC,gBAAgB;AACzB,SAASC,4BAA4B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAoB9B,IAAMC,qBAAqBR,sBAAMS,cAA0C,IAAA,GAGrEC,gBAAgB,SAACC,OAAAA;AAC5B,MAAMC,UAAUZ,MAAMa,WAAWL,kBAAAA;AACjC,MAAI,EAACI,WAAAA,QAAAA,QAASE;AACZ,UAAM,IAAIC,MACRC,QAAQC,IAAIC,aAAa,eACpB,8CACA,0GAAA;AAGT,SAAOlB,sBAAMmB,cAAcP,QAAQE,UAAUH,KAAAA;AAC/C;AAEAD,cAAcU,qBAAqB;AAE5B,IAAMC,iBAAiB,SAAA,OAAA;MAC5BP,WAAAA,MAAAA,UAEwBd,kBAAAA,iBAAAA,MAAMsB,SAAe,IAAA,GAAA,CAAA,GAAtCC,OAAiBvB,gBAAAA,CAAAA,GAAXwB,UAAWxB,gBAAAA,CAAAA,GAElByB,gBAAgBzB,MAAM0B,QAAQ,WAAA;QAMzBC,oBAAT,SAA2BhB,OAAyB;AAClD,aACE,qBAACH,mBAAmBoB,UAAQ;QAACC,OAAOjB;kBACjCD,MAAMmB;;IAGb,GAXMlB,UAA+B;MACnCE;MACAU;IACF;AAUA,WAAOG;EACT,GAAG;IAACb;GAAS;AAEb,SAAO;IACLW;IACAF;EACF;AACF,GAEaQ,QAAQxB,qBACnB,SAAe,OAAwC;MAAtCyB,WAAF,MAAEA,UAAUT,OAAZ,MAAYA,MAAMO,WAAlB,MAAkBA,UACzBlB,UAAUZ,MAAMa,WAAWL,kBAAAA,GAC3ByB,QAAQ3B,SAAAA,GAEV4B,UAAU;AAuBd,SArBI,OAAOX,QAAS,aAClBW,UAAUX,KAAK;IAAEU;EAAM,CAAA,KAEvBC,UAAU,CAACF,UAEPA,aAAa,YAASE,UAAU/B,cAChC6B,aAAa,aAAUE,UAAU,CAAC9B,QAClC4B,aAAa,UAAOE,UAAU9B,QAC9B4B,aAAa,UAAOE,UAAUhC,QAC9B8B,aAAa,cAAWE,UAAUjC,YAElCsB,QAAQ,CAACU,MAAMV,IAAAA,MACjBW,UAAU,MAId7B,0BAA0B,WAAA;AACxB,IAAK6B,YACLtB,WAAAA,QAAAA,QAASY,QAASD,QAAQW,OAAAA;EAC5B,GAAG;IAACX;IAAMX;IAASsB;GAAQ,GAEtBA,UAID,OAAOJ,YAAa,aACfA,SAAS;IAAEI;IAASD;EAAM,CAAA,IAG5BH,WAPE;AAQX,GACA;EACEhB,UAAUJ;AACZ,CAAA;",
5
- "names": ["React", "isAndroid", "isIos", "isTouchable", "isWeb", "useIsomorphicLayoutEffect", "useMedia", "withStaticProperties", "AdaptParentContext", "createContext", "AdaptContents", "props", "context", "useContext", "Contents", "Error", "process", "env", "NODE_ENV", "createElement", "shouldForwardSpace", "useAdaptParent", "useState", "when", "setWhen", "AdaptProvider", "useMemo", "AdaptProviderView", "Provider", "value", "children", "Adapt", "platform", "media", "enabled"]
4
+ "mappings": ";AAAA,OAAOA,WAAW;A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xB,IAAK6B,WACLtB,SAASW,QAASD,QAAQY,OAAAA;EAC5B,GAAG;IAACZ;IAAMV;IAASsB;GAAQ,GAEtBA,UAID,OAAOJ,YAAa,aACfA,SAAS;IAAEI;IAASD;EAAM,CAAA,IAG5BH,WAPE;AAQX,GACA;EACEhB,UAAUJ;AACZ,CAAA;",
5
+ "names": ["React", "isAndroid", "isIos", "isTouchable", "isWeb", "useIsomorphicLayoutEffect", "useMedia", "withStaticProperties", "AdaptParentContext", "createContext", "AdaptContents", "props", "context", "useContext", "Contents", "Error", "process", "env", "NODE_ENV", "createElement", "shouldForwardSpace", "useAdaptParent", "when", "setWhen", "useState", "AdaptProvider", "useMemo", "AdaptProviderView", "Provider", "value", "children", "Adapt", "platform", "media", "enabled"]
6
6
  }
@@ -0,0 +1,57 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ import React from "react";
3
+ import { isAndroid, isIos, isTouchable, isWeb, useIsomorphicLayoutEffect } from "@tamagui/constants";
4
+ import { useMedia } from "@tamagui/core";
5
+ import { withStaticProperties } from "@tamagui/helpers";
6
+ var AdaptParentContext = /* @__PURE__ */React.createContext(null),
7
+ AdaptContents = function (props) {
8
+ var context = React.useContext(AdaptParentContext);
9
+ if (!context?.Contents) throw new Error(process.env.NODE_ENV === "production" ? "tamagui.dev/docs/intro/errors#warning-002" : "You're rendering a Tamagui <Adapt /> component without nesting it inside a parent that is able to adapt.");
10
+ return /* @__PURE__ */React.createElement(context.Contents, props);
11
+ };
12
+ AdaptContents.shouldForwardSpace = !0;
13
+ var useAdaptParent = function (param) {
14
+ var {
15
+ Contents
16
+ } = param,
17
+ [when, setWhen] = React.useState(null),
18
+ AdaptProvider = React.useMemo(function () {
19
+ var context = {
20
+ Contents,
21
+ setWhen
22
+ };
23
+ function AdaptProviderView(props) {
24
+ return /* @__PURE__ */_jsx(AdaptParentContext.Provider, {
25
+ value: context,
26
+ children: props.children
27
+ });
28
+ }
29
+ return AdaptProviderView;
30
+ }, [Contents]);
31
+ return {
32
+ AdaptProvider,
33
+ when
34
+ };
35
+ },
36
+ Adapt = withStaticProperties(function (param) {
37
+ var {
38
+ platform,
39
+ when,
40
+ children
41
+ } = param,
42
+ context = React.useContext(AdaptParentContext),
43
+ media = useMedia(),
44
+ enabled = !1;
45
+ return typeof when == "function" ? enabled = when({
46
+ media
47
+ }) : (enabled = !platform, platform === "touch" && (enabled = isTouchable), platform === "native" && (enabled = !isWeb), platform === "web" && (enabled = isWeb), platform === "ios" && (enabled = isIos), platform === "android" && (enabled = isAndroid), when && !media[when] && (enabled = !1)), useIsomorphicLayoutEffect(function () {
48
+ enabled && context?.setWhen(when || enabled);
49
+ }, [when, context, enabled]), enabled ? typeof children == "function" ? children({
50
+ enabled,
51
+ media
52
+ }) : children : null;
53
+ }, {
54
+ Contents: AdaptContents
55
+ });
56
+ export { Adapt, AdaptContents, AdaptParentContext, useAdaptParent };
57
+ //# sourceMappingURL=Adapt.native.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["jsx","_jsx","React","isAndroid","isIos","isTouchable","isWeb","useIsomorphicLayoutEffect","useMedia","withStaticProperties","AdaptParentContext","createContext","AdaptContents","props","context","useContext","Contents","Error","process","env","NODE_ENV","createElement","shouldForwardSpace","useAdaptParent","param","when","setWhen","useState","AdaptProvider","useMemo","AdaptProviderView","Provider","value","children","Adapt","platform","media","enabled"],"sources":["../../src/Adapt.tsx"],"sourcesContent":[null],"mappings":"AAAA,SAAOA,GAAA,IAAAC,IAAW;AAClB,OAAAC,KAAA;AAAA,SACEC,SAAA,EAAAC,KAAA,EAAAC,WAAA,EAAAC,KAAA,EAAAC,yBAAA;AAAA,SACAC,QAAA;AAAA,SACAC,oBAAA;AAAA,IACAC,kBAAA,kBAAAR,KAAA,CAAAS,aAAA;EAAAC,aAAA,YAAAA,CAAAC,KAAA;IACA,IAAAC,OAAA,GAAAZ,KAAA,CAAAa,UAAA,CAAAL,kBAAA;IAAA,KACKI,OAAA,EAAAE,QAAA,EAEP,M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B,yBAAA;MAGW8B,OAAQ,IAAAvB,OAAA,EAAAY,OAAA,CAAAD,IAAA,IAAAY,OAAA;IACnB,IACEZ,IAAA,EAGAX,OAAI,EAuBJuB,OArBI,CAiBF,GAAKA,OAAA,UACLJ,QAAS,IAAS,UAAQ,GAAAA,QAAgB;MAC5CI,OAAI;MAWND;IACA,KAAAH,QAAA;EAAA;IAEAjB,QAAA,EAAAJ;EACF","ignoreList":[]}
@@ -0,0 +1,2 @@
1
+ export * from "./Adapt.mjs";
2
+ //# sourceMappingURL=index.native.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":[],"sources":["../../src/index.tsx"],"sourcesContent":[null],"mappings":"AAAA,cAAc","ignoreList":[]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tamagui/adapt",
3
- "version": "1.110.5",
3
+ "version": "1.111.0",
4
4
  "types": "./types/index.d.ts",
5
5
  "main": "dist/cjs",
6
6
  "module": "dist/esm",
@@ -28,12 +28,12 @@
28
28
  }
29
29
  },
30
30
  "dependencies": {
31
- "@tamagui/constants": "1.110.5",
32
- "@tamagui/core": "1.110.5",
33
- "@tamagui/helpers": "1.110.5"
31
+ "@tamagui/constants": "1.111.0",
32
+ "@tamagui/core": "1.111.0",
33
+ "@tamagui/helpers": "1.111.0"
34
34
  },
35
35
  "devDependencies": {
36
- "@tamagui/build": "1.110.5"
36
+ "@tamagui/build": "1.111.0"
37
37
  },
38
38
  "publishConfig": {
39
39
  "access": "public"