@tamagui/adapt 1.113.1 → 1.113.2
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
|
@@ -3,57 +3,57 @@ 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
|
-
var AdaptParentContext = /* @__PURE__ */React.createContext(null),
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
6
|
+
var AdaptParentContext = /* @__PURE__ */ React.createContext(null), AdaptContents = function(props) {
|
|
7
|
+
var context = React.useContext(AdaptParentContext);
|
|
8
|
+
if (!context?.Contents)
|
|
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.");
|
|
10
|
+
return /* @__PURE__ */ React.createElement(context.Contents, props);
|
|
11
|
+
};
|
|
12
12
|
AdaptContents.shouldForwardSpace = !0;
|
|
13
|
-
var useAdaptParent = function
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
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
|
|
13
|
+
var useAdaptParent = function(param) {
|
|
14
|
+
var { Contents } = param, [when, setWhen] = React.useState(null), AdaptProvider = React.useMemo(function() {
|
|
15
|
+
var context = {
|
|
16
|
+
Contents,
|
|
17
|
+
setWhen
|
|
34
18
|
};
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
19
|
+
function AdaptProviderView(props) {
|
|
20
|
+
return /* @__PURE__ */ _jsx(AdaptParentContext.Provider, {
|
|
21
|
+
value: context,
|
|
22
|
+
children: props.children
|
|
23
|
+
});
|
|
24
|
+
}
|
|
25
|
+
return AdaptProviderView;
|
|
26
|
+
}, [
|
|
27
|
+
Contents
|
|
28
|
+
]);
|
|
29
|
+
return {
|
|
30
|
+
AdaptProvider,
|
|
31
|
+
when
|
|
32
|
+
};
|
|
33
|
+
}, Adapt = withStaticProperties(function(param) {
|
|
34
|
+
var { platform, when, children } = param, context = React.useContext(AdaptParentContext), media = useMedia(), enabled = !1;
|
|
35
|
+
return typeof when == "function" ? enabled = when({
|
|
36
|
+
media
|
|
37
|
+
}) : (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() {
|
|
38
|
+
if (enabled)
|
|
39
|
+
return context?.setWhen(when || enabled), function() {
|
|
49
40
|
context?.setWhen(null);
|
|
50
41
|
};
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
42
|
+
}, [
|
|
43
|
+
when,
|
|
44
|
+
context,
|
|
45
|
+
enabled
|
|
46
|
+
]), enabled ? typeof children == "function" ? children({
|
|
47
|
+
enabled,
|
|
48
|
+
media
|
|
49
|
+
}) : children : null;
|
|
50
|
+
}, {
|
|
51
|
+
Contents: AdaptContents
|
|
52
|
+
});
|
|
53
|
+
export {
|
|
54
|
+
Adapt,
|
|
55
|
+
AdaptContents,
|
|
56
|
+
AdaptParentContext,
|
|
57
|
+
useAdaptParent
|
|
58
|
+
};
|
|
59
|
+
//# sourceMappingURL=Adapt.js.map
|
|
@@ -1 +1,6 @@
|
|
|
1
|
-
{
|
|
1
|
+
{
|
|
2
|
+
"version": 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,CAACI,SAASE;AACZ,UAAM,IAAIC,MACRC,QAAQC,IAAIC,aAAa,eACrB,8CACA,0GAA0G;AAGlH,SAAOlB,sBAAMmB,cAAcP,QAAQE,UAAUH,KAAAA;AAC/C;AAEAD,cAAcU,qBAAqB;AAE5B,IAAMC,iBAAiB,SAAA,OAAA;MAAC,EAC7BP,SAAQ,IACsC,OACxC,CAACQ,MAAMC,OAAAA,IAAWvB,MAAMwB,SAAe,IAAA,GAEvCC,gBAAgBzB,MAAM0B,QAAQ,WAAA;AAClC,QAAMd,UAA+B;MACnCE;MACAS;IACF;AAEA,aAASI,kBAAkBhB,OAAyB;AAClD,aACE,qBAACH,mBAAmBoB,UAAQ;QAACC,OAAOjB;kBACjCD,MAAMmB;;IAGb;AAEA,WAAOH;EACT,GAAG;IAACb;GAAS;AAEb,SAAO;IACLW;IACAH;EACF;AACF,GAEaS,QAAQxB,qBACnB,SAAe,OAAwC;MAAxC,EAAEyB,UAAUV,MAAMQ,SAAQ,IAA1B,OACPlB,UAAUZ,MAAMa,WAAWL,kBAAAA,GAC3ByB,QAAQ3B,SAAAA,GAEV4B,UAAU;AAyBd,SAvBI,OAAOZ,QAAS,aAClBY,UAAUZ,KAAK;IAAEW;EAAM,CAAA,KAEnBD,aAAa,UAASE,UAAU/B,cAC3B6B,aAAa,WAAUE,UAAU,CAAC9B,QAClC4B,aAAa,QAAOE,UAAU9B,QAC9B4B,aAAa,QAAOE,UAAUhC,QAC9B8B,aAAa,cAAWE,UAAUjC,YAEvCqB,QAAQ,CAACW,MAAMX,IAAAA,MACjBY,UAAU,MAId7B,0BAA0B,WAAA;AACxB,QAAK6B;AACLtB,aAAAA,SAASW,QAASD,QAAQY,OAAAA,GAEnB,WAAA;AACLtB,QAAAA,SAASW,QAAQ,IAAA;MACnB;EACF,GAAG;IAACD;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
|
+
}
|
package/dist/esm/index.native.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export * from "./Adapt
|
|
2
|
-
//# sourceMappingURL=index.
|
|
1
|
+
export * from "./Adapt";
|
|
2
|
+
//# sourceMappingURL=index.js.map
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tamagui/adapt",
|
|
3
|
-
"version": "1.113.
|
|
3
|
+
"version": "1.113.2",
|
|
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.113.
|
|
32
|
-
"@tamagui/core": "1.113.
|
|
33
|
-
"@tamagui/helpers": "1.113.
|
|
31
|
+
"@tamagui/constants": "1.113.2",
|
|
32
|
+
"@tamagui/core": "1.113.2",
|
|
33
|
+
"@tamagui/helpers": "1.113.2"
|
|
34
34
|
},
|
|
35
35
|
"devDependencies": {
|
|
36
|
-
"@tamagui/build": "1.113.
|
|
36
|
+
"@tamagui/build": "1.113.2"
|
|
37
37
|
},
|
|
38
38
|
"publishConfig": {
|
|
39
39
|
"access": "public"
|