@tamagui/adapt 1.114.3 → 1.115.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.
@@ -0,0 +1,93 @@
1
+ var __create = Object.create;
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __getProtoOf = Object.getPrototypeOf,
6
+ __hasOwnProp = Object.prototype.hasOwnProperty;
7
+ var __export = (target, all) => {
8
+ for (var name in all) __defProp(target, name, {
9
+ get: all[name],
10
+ enumerable: !0
11
+ });
12
+ },
13
+ __copyProps = (to, from, except, desc) => {
14
+ if (from && typeof from == "object" || typeof from == "function") for (let key of __getOwnPropNames(from)) !__hasOwnProp.call(to, key) && key !== except && __defProp(to, key, {
15
+ get: () => from[key],
16
+ enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
17
+ });
18
+ return to;
19
+ };
20
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
21
+ // If the importer is in node compatibility mode or this is not an ESM
22
+ // file that has been converted to a CommonJS file using a Babel-
23
+ // compatible transform (i.e. "__esModule" has not been set), then set
24
+ // "default" to the CommonJS "module.exports" for node compatibility.
25
+ isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", {
26
+ value: mod,
27
+ enumerable: !0
28
+ }) : target, mod)),
29
+ __toCommonJS = mod => __copyProps(__defProp({}, "__esModule", {
30
+ value: !0
31
+ }), mod);
32
+ var Adapt_exports = {};
33
+ __export(Adapt_exports, {
34
+ Adapt: () => Adapt,
35
+ AdaptContents: () => AdaptContents,
36
+ AdaptParentContext: () => AdaptParentContext,
37
+ useAdaptParent: () => useAdaptParent
38
+ });
39
+ module.exports = __toCommonJS(Adapt_exports);
40
+ var import_react = __toESM(require("react")),
41
+ import_constants = require("@tamagui/constants"),
42
+ import_core = require("@tamagui/core"),
43
+ import_helpers = require("@tamagui/helpers"),
44
+ import_jsx_runtime = require("react/jsx-runtime");
45
+ const AdaptParentContext = import_react.default.createContext(null),
46
+ AdaptContents = props => {
47
+ const context = import_react.default.useContext(AdaptParentContext);
48
+ 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.");
49
+ return import_react.default.createElement(context.Contents, props);
50
+ };
51
+ AdaptContents.shouldForwardSpace = !0;
52
+ const useAdaptParent = ({
53
+ Contents
54
+ }) => {
55
+ const [when, setWhen] = import_react.default.useState(null);
56
+ return {
57
+ AdaptProvider: import_react.default.useMemo(() => {
58
+ const context = {
59
+ Contents,
60
+ setWhen
61
+ };
62
+ function AdaptProviderView(props) {
63
+ return /* @__PURE__ */(0, import_jsx_runtime.jsx)(AdaptParentContext.Provider, {
64
+ value: context,
65
+ children: props.children
66
+ });
67
+ }
68
+ return AdaptProviderView;
69
+ }, [Contents]),
70
+ when
71
+ };
72
+ },
73
+ Adapt = (0, import_helpers.withStaticProperties)(function ({
74
+ platform,
75
+ when,
76
+ children
77
+ }) {
78
+ const context = import_react.default.useContext(AdaptParentContext),
79
+ media = (0, import_core.useMedia)();
80
+ let enabled = !1;
81
+ return typeof when == "function" ? enabled = when({
82
+ media
83
+ }) : (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)(() => {
84
+ if (enabled) return context?.setWhen(when || enabled), () => {
85
+ context?.setWhen(null);
86
+ };
87
+ }, [when, context, enabled]), enabled ? typeof children == "function" ? children({
88
+ enabled,
89
+ media
90
+ }) : children : null;
91
+ }, {
92
+ Contents: AdaptContents
93
+ });
@@ -0,0 +1,18 @@
1
+ var __defProp = Object.defineProperty;
2
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
3
+ var __getOwnPropNames = Object.getOwnPropertyNames;
4
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
5
+ var __copyProps = (to, from, except, desc) => {
6
+ if (from && typeof from == "object" || typeof from == "function") for (let key of __getOwnPropNames(from)) !__hasOwnProp.call(to, key) && key !== except && __defProp(to, key, {
7
+ get: () => from[key],
8
+ enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
9
+ });
10
+ return to;
11
+ },
12
+ __reExport = (target, mod, secondTarget) => (__copyProps(target, mod, "default"), secondTarget && __copyProps(secondTarget, mod, "default"));
13
+ var __toCommonJS = mod => __copyProps(__defProp({}, "__esModule", {
14
+ value: !0
15
+ }), mod);
16
+ var src_exports = {};
17
+ module.exports = __toCommonJS(src_exports);
18
+ __reExport(src_exports, require("./Adapt.cjs"), module.exports);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tamagui/adapt",
3
- "version": "1.114.3",
3
+ "version": "1.115.0",
4
4
  "types": "./types/index.d.ts",
5
5
  "main": "dist/cjs",
6
6
  "module": "dist/esm",
@@ -24,16 +24,17 @@
24
24
  "react-native": "./dist/cjs/index.native.js",
25
25
  "types": "./types/index.d.ts",
26
26
  "import": "./dist/esm/index.mjs",
27
- "require": "./dist/cjs/index.js"
27
+ "require": "./dist/cjs/index.cjs",
28
+ "default": "./dist/cjs/index.native.js"
28
29
  }
29
30
  },
30
31
  "dependencies": {
31
- "@tamagui/constants": "1.114.3",
32
- "@tamagui/core": "1.114.3",
33
- "@tamagui/helpers": "1.114.3"
32
+ "@tamagui/constants": "1.115.0",
33
+ "@tamagui/core": "1.115.0",
34
+ "@tamagui/helpers": "1.115.0"
34
35
  },
35
36
  "devDependencies": {
36
- "@tamagui/build": "1.114.3"
37
+ "@tamagui/build": "1.115.0"
37
38
  },
38
39
  "publishConfig": {
39
40
  "access": "public"
package/dist/cjs/Adapt.js DELETED
@@ -1,73 +0,0 @@
1
- var __create = Object.create;
2
- var __defProp = Object.defineProperty;
3
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
- var __getOwnPropNames = Object.getOwnPropertyNames;
5
- var __getProtoOf = Object.getPrototypeOf, __hasOwnProp = Object.prototype.hasOwnProperty;
6
- var __export = (target, all) => {
7
- for (var name in all)
8
- __defProp(target, name, { get: all[name], enumerable: !0 });
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 __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
16
- // If the importer is in node compatibility mode or this is not an ESM
17
- // file that has been converted to a CommonJS file using a Babel-
18
- // compatible transform (i.e. "__esModule" has not been set), then set
19
- // "default" to the CommonJS "module.exports" for node compatibility.
20
- isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: !0 }) : target,
21
- mod
22
- )), __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: !0 }), mod);
23
- var Adapt_exports = {};
24
- __export(Adapt_exports, {
25
- Adapt: () => Adapt,
26
- AdaptContents: () => AdaptContents,
27
- AdaptParentContext: () => AdaptParentContext,
28
- useAdaptParent: () => useAdaptParent
29
- });
30
- module.exports = __toCommonJS(Adapt_exports);
31
- var import_react = __toESM(require("react")), import_constants = require("@tamagui/constants"), import_core = require("@tamagui/core"), import_helpers = require("@tamagui/helpers"), import_jsx_runtime = require("react/jsx-runtime");
32
- const AdaptParentContext = import_react.default.createContext(null), AdaptContents = (props) => {
33
- const context = import_react.default.useContext(AdaptParentContext);
34
- if (!context?.Contents)
35
- throw new Error(
36
- 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."
37
- );
38
- return import_react.default.createElement(context.Contents, props);
39
- };
40
- AdaptContents.shouldForwardSpace = !0;
41
- const useAdaptParent = ({
42
- Contents
43
- }) => {
44
- const [when, setWhen] = import_react.default.useState(null);
45
- return {
46
- AdaptProvider: import_react.default.useMemo(() => {
47
- const context = {
48
- Contents,
49
- setWhen
50
- };
51
- function AdaptProviderView(props) {
52
- return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(AdaptParentContext.Provider, { value: context, children: props.children });
53
- }
54
- return AdaptProviderView;
55
- }, [Contents]),
56
- when
57
- };
58
- }, Adapt = (0, import_helpers.withStaticProperties)(
59
- function({ platform, when, children }) {
60
- const context = import_react.default.useContext(AdaptParentContext), media = (0, import_core.useMedia)();
61
- let enabled = !1;
62
- return typeof when == "function" ? enabled = when({ media }) : (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)(() => {
63
- if (enabled)
64
- return context?.setWhen(when || enabled), () => {
65
- context?.setWhen(null);
66
- };
67
- }, [when, context, enabled]), enabled ? typeof children == "function" ? children({ enabled, media }) : children : null;
68
- },
69
- {
70
- Contents: AdaptContents
71
- }
72
- );
73
- //# sourceMappingURL=Adapt.js.map
package/dist/cjs/index.js DELETED
@@ -1,15 +0,0 @@
1
- var __defProp = Object.defineProperty;
2
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
3
- var __getOwnPropNames = Object.getOwnPropertyNames;
4
- var __hasOwnProp = Object.prototype.hasOwnProperty;
5
- var __copyProps = (to, from, except, desc) => {
6
- if (from && typeof from == "object" || typeof from == "function")
7
- for (let key of __getOwnPropNames(from))
8
- !__hasOwnProp.call(to, key) && key !== except && __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
9
- return to;
10
- }, __reExport = (target, mod, secondTarget) => (__copyProps(target, mod, "default"), secondTarget && __copyProps(secondTarget, mod, "default"));
11
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: !0 }), mod);
12
- var src_exports = {};
13
- module.exports = __toCommonJS(src_exports);
14
- __reExport(src_exports, require("./Adapt"), module.exports);
15
- //# sourceMappingURL=index.js.map
File without changes
File without changes