@tamagui/adapt 1.88.21 → 1.88.23
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/esm/Adapt.native.js
CHANGED
|
@@ -1,56 +1,38 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
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
|
-
};
|
|
15
|
-
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: !0 }), mod);
|
|
16
|
-
var Adapt_exports = {};
|
|
17
|
-
__export(Adapt_exports, {
|
|
18
|
-
Adapt: () => Adapt,
|
|
19
|
-
AdaptContents: () => AdaptContents,
|
|
20
|
-
AdaptParentContext: () => AdaptParentContext,
|
|
21
|
-
useAdaptParent: () => useAdaptParent
|
|
22
|
-
});
|
|
23
|
-
module.exports = __toCommonJS(Adapt_exports);
|
|
24
|
-
var import_constants = require("@tamagui/constants"), import_constants2 = require("@tamagui/constants"), import_core = require("@tamagui/core"), import_helpers = require("@tamagui/helpers"), import_react = require("react"), import_jsx_runtime = require("react/jsx-runtime");
|
|
25
|
-
const AdaptParentContext = (0, import_react.createContext)(null), AdaptContents = (props) => {
|
|
26
|
-
const context = (0, import_react.useContext)(AdaptParentContext);
|
|
1
|
+
import { isWeb, useIsomorphicLayoutEffect } from "@tamagui/constants";
|
|
2
|
+
import { isTouchable } from "@tamagui/constants";
|
|
3
|
+
import { useMedia } from "@tamagui/core";
|
|
4
|
+
import { withStaticProperties } from "@tamagui/helpers";
|
|
5
|
+
import { createContext, createElement, useContext, useMemo, useState } from "react";
|
|
6
|
+
import { jsx } from "react/jsx-runtime";
|
|
7
|
+
const AdaptParentContext = createContext(null), AdaptContents = (props) => {
|
|
8
|
+
const context = useContext(AdaptParentContext);
|
|
27
9
|
if (!(context != null && context.Contents))
|
|
28
10
|
throw new Error("Adapt not supported by this component");
|
|
29
|
-
return
|
|
11
|
+
return createElement(context.Contents, props);
|
|
30
12
|
};
|
|
31
13
|
AdaptContents.shouldForwardSpace = !0;
|
|
32
14
|
const useAdaptParent = ({
|
|
33
15
|
Contents
|
|
34
16
|
}) => {
|
|
35
|
-
const [when, setWhen] =
|
|
17
|
+
const [when, setWhen] = useState(null);
|
|
36
18
|
return {
|
|
37
|
-
AdaptProvider:
|
|
19
|
+
AdaptProvider: useMemo(() => {
|
|
38
20
|
const context = {
|
|
39
21
|
Contents,
|
|
40
22
|
setWhen
|
|
41
23
|
};
|
|
42
24
|
function AdaptProviderView(props) {
|
|
43
|
-
return /* @__PURE__ */
|
|
25
|
+
return /* @__PURE__ */ jsx(AdaptParentContext.Provider, { value: context, children: props.children });
|
|
44
26
|
}
|
|
45
27
|
return AdaptProviderView;
|
|
46
28
|
}, [Contents]),
|
|
47
29
|
when
|
|
48
30
|
};
|
|
49
|
-
}, Adapt =
|
|
31
|
+
}, Adapt = withStaticProperties(
|
|
50
32
|
function({ platform, when, children }) {
|
|
51
|
-
const context =
|
|
33
|
+
const context = useContext(AdaptParentContext), media = useMedia();
|
|
52
34
|
let enabled = !platform;
|
|
53
|
-
return platform === "touch" && (enabled =
|
|
35
|
+
return platform === "touch" && (enabled = isTouchable), platform === "native" && (enabled = !isWeb), platform === "web" && (enabled = isWeb), when && !media[when] && (enabled = !1), useIsomorphicLayoutEffect(() => {
|
|
54
36
|
enabled && (context == null || context.setWhen(when || enabled));
|
|
55
37
|
}, [when, context, enabled]), enabled ? children : null;
|
|
56
38
|
},
|
|
@@ -58,11 +40,10 @@ const useAdaptParent = ({
|
|
|
58
40
|
Contents: AdaptContents
|
|
59
41
|
}
|
|
60
42
|
);
|
|
61
|
-
|
|
62
|
-
0 && (module.exports = {
|
|
43
|
+
export {
|
|
63
44
|
Adapt,
|
|
64
45
|
AdaptContents,
|
|
65
46
|
AdaptParentContext,
|
|
66
47
|
useAdaptParent
|
|
67
|
-
}
|
|
48
|
+
};
|
|
68
49
|
//# sourceMappingURL=Adapt.js.map
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../src/Adapt.tsx"],
|
|
4
|
-
"mappings": "
|
|
5
|
-
"names": [
|
|
4
|
+
"mappings": "AAAA,SAAS,OAAO,iCAAiC;AACjD,SAAS,mBAAmB;AAE5B,SAAS,gBAAgB;AACzB,SAAS,4BAA4B;AACrC,SAAS,eAAe,eAAe,YAAY,SAAS,gBAAgB;AA8CpE;AA5BD,MAAM,qBAAqB,cAA0C,IAAI,GAGnE,gBAAgB,CAAC,UAAe;AAC3C,QAAM,UAAU,WAAW,kBAAkB;AAC7C,MAAI,EAAC,2BAAS;AACZ,UAAM,IAAI,MAAM,uCAAuC;AAEzD,SAAO,cAAc,QAAQ,UAAU,KAAK;AAC9C;AAEA,cAAc,qBAAqB;AAE5B,MAAM,iBAAiB,CAAC;AAAA,EAC7B;AACF,MAEM;AACJ,QAAM,CAAC,MAAM,OAAO,IAAI,SAAe,IAAI;AAmB3C,SAAO;AAAA,IACL,eAlBoB,QAAQ,MAAM;AAClC,YAAM,UAA+B;AAAA,QACnC;AAAA,QACA;AAAA,MACF;AAEA,eAAS,kBAAkB,OAA2B;AACpD,eACE,oBAAC,mBAAmB,UAAnB,EAA4B,OAAO,SACjC,gBAAM,UACT;AAAA,MAEJ;AAEA,aAAO;AAAA,IACT,GAAG,CAAC,QAAQ,CAAC;AAAA,IAIX;AAAA,EACF;AACF,GAEa,QAAQ;AAAA,EACnB,SAAe,EAAE,UAAU,MAAM,SAAS,GAAe;AACvD,UAAM,UAAU,WAAW,kBAAkB,GACvC,QAAQ,SAAS;AAEvB,QAAI,UAAU,CAAC;AAcf,WAbI,aAAa,YAAS,UAAU,cAChC,aAAa,aAAU,UAAU,CAAC,QAClC,aAAa,UAAO,UAAU,QAE9B,QAAQ,CAAC,MAAM,IAAI,MACrB,UAAU,KAGZ,0BAA0B,MAAM;AAC9B,MAAK,YACL,2BAAS,QAAS,QAAQ;AAAA,IAC5B,GAAG,CAAC,MAAM,SAAS,OAAO,CAAC,GAEtB,UAIE,WAHE;AAAA,EAIX;AAAA,EACA;AAAA,IACE,UAAU;AAAA,EACZ;AACF;",
|
|
5
|
+
"names": []
|
|
6
6
|
}
|
package/dist/esm/index.native.js
CHANGED
|
@@ -1,20 +1,2 @@
|
|
|
1
|
-
|
|
2
|
-
var __defProp = Object.defineProperty;
|
|
3
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
-
var __copyProps = (to, from, except, desc) => {
|
|
7
|
-
if (from && typeof from == "object" || typeof from == "function")
|
|
8
|
-
for (let key of __getOwnPropNames(from))
|
|
9
|
-
!__hasOwnProp.call(to, key) && key !== except && __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
10
|
-
return to;
|
|
11
|
-
}, __reExport = (target, mod, secondTarget) => (__copyProps(target, mod, "default"), secondTarget && __copyProps(secondTarget, mod, "default"));
|
|
12
|
-
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: !0 }), mod);
|
|
13
|
-
var src_exports = {};
|
|
14
|
-
module.exports = __toCommonJS(src_exports);
|
|
15
|
-
__reExport(src_exports, require("./Adapt"), module.exports);
|
|
16
|
-
// Annotate the CommonJS export names for ESM import in node:
|
|
17
|
-
0 && (module.exports = {
|
|
18
|
-
...require("./Adapt")
|
|
19
|
-
});
|
|
1
|
+
export * from "./Adapt";
|
|
20
2
|
//# sourceMappingURL=index.js.map
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tamagui/adapt",
|
|
3
|
-
"version": "1.88.
|
|
3
|
+
"version": "1.88.23",
|
|
4
4
|
"types": "./types/index.d.ts",
|
|
5
5
|
"main": "dist/cjs",
|
|
6
6
|
"module": "dist/esm",
|
|
@@ -27,12 +27,12 @@
|
|
|
27
27
|
}
|
|
28
28
|
},
|
|
29
29
|
"dependencies": {
|
|
30
|
-
"@tamagui/constants": "1.88.
|
|
31
|
-
"@tamagui/core": "1.88.
|
|
32
|
-
"@tamagui/helpers": "1.88.
|
|
30
|
+
"@tamagui/constants": "1.88.23",
|
|
31
|
+
"@tamagui/core": "1.88.23",
|
|
32
|
+
"@tamagui/helpers": "1.88.23"
|
|
33
33
|
},
|
|
34
34
|
"devDependencies": {
|
|
35
|
-
"@tamagui/build": "1.88.
|
|
35
|
+
"@tamagui/build": "1.88.23"
|
|
36
36
|
},
|
|
37
37
|
"publishConfig": {
|
|
38
38
|
"access": "public"
|