@tamagui/adapt 2.0.0-rc.9 → 2.0.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.
- package/dist/cjs/Adapt.cjs +192 -188
- package/dist/cjs/Adapt.native.js +217 -207
- package/dist/cjs/Adapt.native.js.map +1 -1
- package/dist/cjs/index.cjs +7 -5
- package/dist/cjs/index.native.js +7 -5
- package/dist/cjs/index.native.js.map +1 -1
- package/dist/esm/Adapt.mjs +160 -158
- package/dist/esm/Adapt.mjs.map +1 -1
- package/dist/esm/Adapt.native.js +185 -178
- package/dist/esm/Adapt.native.js.map +1 -1
- package/dist/esm/index.js +1 -1
- package/dist/esm/index.js.map +1 -6
- package/package.json +9 -8
- package/src/Adapt.tsx +19 -21
- package/types/Adapt.d.ts +0 -1
- package/types/Adapt.d.ts.map +1 -1
- package/dist/cjs/Adapt.js +0 -188
- package/dist/cjs/Adapt.js.map +0 -6
- package/dist/cjs/index.js +0 -15
- package/dist/cjs/index.js.map +0 -6
- package/dist/esm/Adapt.js +0 -177
- package/dist/esm/Adapt.js.map +0 -6
package/src/Adapt.tsx
CHANGED
|
@@ -71,7 +71,6 @@ export type AdaptParentContextI = {
|
|
|
71
71
|
setPlatform: (when: AdaptPlatform) => any
|
|
72
72
|
when: AdaptWhen
|
|
73
73
|
setWhen: (when: AdaptWhen) => any
|
|
74
|
-
setChildren: (children: any) => any
|
|
75
74
|
portalName?: string
|
|
76
75
|
lastScope?: string
|
|
77
76
|
}
|
|
@@ -94,7 +93,6 @@ export const AdaptContext = createStyledContext<AdaptParentContextI>({
|
|
|
94
93
|
platform: null as any,
|
|
95
94
|
setPlatform: (x: AdaptPlatform) => {},
|
|
96
95
|
when: null as any,
|
|
97
|
-
setChildren: null as any,
|
|
98
96
|
setWhen: () => {},
|
|
99
97
|
})
|
|
100
98
|
|
|
@@ -152,14 +150,15 @@ export const AdaptParent = ({ children, Contents, scope, portal }: AdaptParentPr
|
|
|
152
150
|
childrenStoreRef.current = createAdaptChildrenStore()
|
|
153
151
|
}
|
|
154
152
|
|
|
155
|
-
const isTeleport =
|
|
153
|
+
const isTeleport =
|
|
154
|
+
process.env.TAMAGUI_TARGET === 'native' && getPortal().state.type === 'teleport'
|
|
156
155
|
|
|
157
156
|
const FinalContents = useMemo(() => {
|
|
158
157
|
if (Contents) {
|
|
159
158
|
return Contents
|
|
160
159
|
}
|
|
161
160
|
|
|
162
|
-
//
|
|
161
|
+
// when teleport is enabled, use store-based children passing to avoid
|
|
163
162
|
// nested teleport (inner PortalItem inside already-teleported Sheet)
|
|
164
163
|
// which breaks touch coordinate mapping on iOS.
|
|
165
164
|
if (isTeleport) {
|
|
@@ -169,6 +168,7 @@ export const AdaptParent = ({ children, Contents, scope, portal }: AdaptParentPr
|
|
|
169
168
|
if (AdaptPortals.has(portalName)) {
|
|
170
169
|
return AdaptPortals.get(portalName)
|
|
171
170
|
}
|
|
171
|
+
|
|
172
172
|
const element = () => {
|
|
173
173
|
return (
|
|
174
174
|
<PortalHost
|
|
@@ -178,7 +178,9 @@ export const AdaptParent = ({ children, Contents, scope, portal }: AdaptParentPr
|
|
|
178
178
|
/>
|
|
179
179
|
)
|
|
180
180
|
}
|
|
181
|
+
|
|
181
182
|
AdaptPortals.set(portalName, element)
|
|
183
|
+
|
|
182
184
|
return element
|
|
183
185
|
}, [portalName, Contents, isTeleport])
|
|
184
186
|
|
|
@@ -194,9 +196,6 @@ export const AdaptParent = ({ children, Contents, scope, portal }: AdaptParentPr
|
|
|
194
196
|
const [when, setWhen] = React.useState<AdaptWhen>(null)
|
|
195
197
|
const [platform, setPlatform] = React.useState<AdaptPlatform>(null)
|
|
196
198
|
|
|
197
|
-
// TODO for inline adapt
|
|
198
|
-
const [children2, setChildren] = React.useState(null)
|
|
199
|
-
|
|
200
199
|
return (
|
|
201
200
|
<AdaptChildrenStoreContext.Provider value={childrenStoreRef.current}>
|
|
202
201
|
<LastAdaptContextScope.Provider value={scope}>
|
|
@@ -206,7 +205,6 @@ export const AdaptParent = ({ children, Contents, scope, portal }: AdaptParentPr
|
|
|
206
205
|
platform={platform}
|
|
207
206
|
setPlatform={setPlatform}
|
|
208
207
|
setWhen={setWhen}
|
|
209
|
-
setChildren={setChildren}
|
|
210
208
|
portalName={portalName}
|
|
211
209
|
scopeName={scope}
|
|
212
210
|
>
|
|
@@ -265,14 +263,6 @@ export const Adapt = withStaticProperties(
|
|
|
265
263
|
output = children
|
|
266
264
|
}
|
|
267
265
|
|
|
268
|
-
// TODO this isn't ideal using an effect to set children, will cause double-renders
|
|
269
|
-
// on every change
|
|
270
|
-
useIsomorphicLayoutEffect(() => {
|
|
271
|
-
if (typeof children === 'function' && output !== undefined) {
|
|
272
|
-
context?.setChildren(output)
|
|
273
|
-
}
|
|
274
|
-
}, [output])
|
|
275
|
-
|
|
276
266
|
return <StackZIndexContext>{!enabled ? null : output}</StackZIndexContext>
|
|
277
267
|
},
|
|
278
268
|
{
|
|
@@ -290,9 +280,9 @@ export const AdaptPortalContents = (props: {
|
|
|
290
280
|
const childrenStore = useContext(AdaptChildrenStoreContext)
|
|
291
281
|
const isTeleport = !isWeb && getPortal().state.type === 'teleport'
|
|
292
282
|
|
|
293
|
-
//
|
|
283
|
+
// when teleport is enabled, bypass PortalItem to avoid nested teleport
|
|
294
284
|
// (inner portal inside already-teleported Sheet) which breaks touch
|
|
295
|
-
// coordinate mapping on iOS.
|
|
285
|
+
// coordinate mapping on iOS. children are passed via external store
|
|
296
286
|
// to TeleportAdaptContents rendered at Adapt.Contents.
|
|
297
287
|
if (isTeleport && childrenStore) {
|
|
298
288
|
return (
|
|
@@ -318,11 +308,19 @@ function AdaptPortalTeleport({
|
|
|
318
308
|
store: AdaptChildrenStore
|
|
319
309
|
children: React.ReactNode
|
|
320
310
|
}) {
|
|
311
|
+
// keep the teleport store in sync without clearing it between parent
|
|
312
|
+
// renders. clearing only on real unmount or inactive lets React reconcile
|
|
313
|
+
// sheet/dialog/popover contents instead of remounting the subtree.
|
|
321
314
|
useIsomorphicLayoutEffect(() => {
|
|
322
|
-
if (
|
|
323
|
-
|
|
324
|
-
|
|
315
|
+
if (isActive) {
|
|
316
|
+
store.set(children)
|
|
317
|
+
} else {
|
|
318
|
+
store.set(null)
|
|
319
|
+
}
|
|
325
320
|
})
|
|
321
|
+
useIsomorphicLayoutEffect(() => {
|
|
322
|
+
return () => store.set(null)
|
|
323
|
+
}, [store])
|
|
326
324
|
|
|
327
325
|
return isActive ? null : <>{children}</>
|
|
328
326
|
}
|
package/types/Adapt.d.ts
CHANGED
package/types/Adapt.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Adapt.d.ts","sourceRoot":"","sources":["../src/Adapt.tsx"],"names":[],"mappings":"AAOA,OAAO,KAAK,EAAE,YAAY,EAAE,aAAa,EAAE,MAAM,eAAe,CAAA;AAMhE,OAAO,KAAoD,MAAM,OAAO,CAAA;AA8CxE;;GAEG;AAEH,MAAM,MAAM,SAAS,GAAG,mBAAmB,GAAG,OAAO,GAAG,IAAI,CAAA;AAC5D,MAAM,MAAM,aAAa,GAAG,YAAY,GAAG,OAAO,GAAG,IAAI,CAAA;AAEzD,MAAM,MAAM,mBAAmB,GAAG;IAChC,QAAQ,EAAE,SAAS,CAAA;IACnB,SAAS,EAAE,MAAM,CAAA;IACjB,QAAQ,EAAE,aAAa,CAAA;IACvB,WAAW,EAAE,CAAC,IAAI,EAAE,aAAa,KAAK,GAAG,CAAA;IACzC,IAAI,EAAE,SAAS,CAAA;IACf,OAAO,EAAE,CAAC,IAAI,EAAE,SAAS,KAAK,GAAG,CAAA;IACjC,
|
|
1
|
+
{"version":3,"file":"Adapt.d.ts","sourceRoot":"","sources":["../src/Adapt.tsx"],"names":[],"mappings":"AAOA,OAAO,KAAK,EAAE,YAAY,EAAE,aAAa,EAAE,MAAM,eAAe,CAAA;AAMhE,OAAO,KAAoD,MAAM,OAAO,CAAA;AA8CxE;;GAEG;AAEH,MAAM,MAAM,SAAS,G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,CAAC,CAAA;IAC1C,KAAK,EAAE,MAAM,CAAA;IACb,MAAM,CAAC,EACH,OAAO,GACP;QACE,YAAY,CAAC,EAAE,GAAG,CAAA;KACnB,CAAA;CACN,CAAA;AAID,eAAO,MAAM,WAAW,GAAI,uCAAuC,gBAAgB,4CAwElF,CAAA;AAED;;GAEG;AAEH,eAAO,MAAM,aAAa;yBAAwB;QAAE,KAAK,CAAC,EAAE,MAAM,CAAA;KAAE;;CAanE,CAAA;AAID,eAAO,MAAM,KAAK,WACM,UAAU;;6BAlBgB;YAAE,KAAK,CAAC,EAAE,MAAM,CAAA;SAAE;;;CAiDnE,CAAA;AAED,eAAO,MAAM,mBAAmB,GAAI,OAAO;IACzC,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAA;IACzB,KAAK,CAAC,EAAE,MAAM,CAAA;IACd,WAAW,CAAC,EAAE,OAAO,CAAA;CACtB,4CAuBA,CAAA;AA6DD,eAAO,MAAM,gBAAgB,GAAI,QAAQ,MAAM,YAG9C,CAAA"}
|
package/dist/cjs/Adapt.js
DELETED
|
@@ -1,188 +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
|
-
AdaptContext: () => AdaptContext,
|
|
28
|
-
AdaptParent: () => AdaptParent,
|
|
29
|
-
AdaptPortalContents: () => AdaptPortalContents,
|
|
30
|
-
ProvideAdaptContext: () => ProvideAdaptContext,
|
|
31
|
-
useAdaptContext: () => useAdaptContext,
|
|
32
|
-
useAdaptIsActive: () => useAdaptIsActive
|
|
33
|
-
});
|
|
34
|
-
module.exports = __toCommonJS(Adapt_exports);
|
|
35
|
-
var import_constants = require("@tamagui/constants"), import_core = require("@tamagui/core"), import_helpers = require("@tamagui/helpers"), import_native = require("@tamagui/native"), import_portal = require("@tamagui/portal"), import_z_index_stack = require("@tamagui/z-index-stack"), import_react = __toESM(require("react"), 1), import_jsx_runtime = require("react/jsx-runtime");
|
|
36
|
-
function createAdaptChildrenStore() {
|
|
37
|
-
let children = null;
|
|
38
|
-
const listeners = /* @__PURE__ */ new Set();
|
|
39
|
-
return {
|
|
40
|
-
set(c) {
|
|
41
|
-
children = c;
|
|
42
|
-
for (const l of listeners) l();
|
|
43
|
-
},
|
|
44
|
-
get: () => children,
|
|
45
|
-
subscribe(callback) {
|
|
46
|
-
return listeners.add(callback), () => listeners.delete(callback);
|
|
47
|
-
}
|
|
48
|
-
};
|
|
49
|
-
}
|
|
50
|
-
const AdaptChildrenStoreContext = (0, import_react.createContext)(null), emptySubscribe = () => () => {
|
|
51
|
-
}, emptyGet = () => null;
|
|
52
|
-
function TeleportAdaptContents() {
|
|
53
|
-
const store = (0, import_react.useContext)(AdaptChildrenStoreContext), children = import_react.default.useSyncExternalStore(
|
|
54
|
-
store?.subscribe ?? emptySubscribe,
|
|
55
|
-
store?.get ?? emptyGet,
|
|
56
|
-
store?.get ?? emptyGet
|
|
57
|
-
);
|
|
58
|
-
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_jsx_runtime.Fragment, { children });
|
|
59
|
-
}
|
|
60
|
-
const AdaptContext = (0, import_core.createStyledContext)({
|
|
61
|
-
Contents: null,
|
|
62
|
-
scopeName: "",
|
|
63
|
-
portalName: "",
|
|
64
|
-
platform: null,
|
|
65
|
-
setPlatform: (x) => {
|
|
66
|
-
},
|
|
67
|
-
when: null,
|
|
68
|
-
setChildren: null,
|
|
69
|
-
setWhen: () => {
|
|
70
|
-
}
|
|
71
|
-
}), LastAdaptContextScope = (0, import_react.createContext)(""), ProvideAdaptContext = ({
|
|
72
|
-
children,
|
|
73
|
-
...context
|
|
74
|
-
}) => {
|
|
75
|
-
const scope = context.scopeName || "", lastScope = (0, import_react.useContext)(LastAdaptContextScope);
|
|
76
|
-
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(LastAdaptContextScope.Provider, { value: lastScope || context.lastScope || "", children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
77
|
-
AdaptContext.Provider,
|
|
78
|
-
{
|
|
79
|
-
scope,
|
|
80
|
-
lastScope: lastScope || context.lastScope,
|
|
81
|
-
...context,
|
|
82
|
-
children
|
|
83
|
-
}
|
|
84
|
-
) });
|
|
85
|
-
}, useAdaptContext = (scope) => {
|
|
86
|
-
const lastScope = (0, import_react.useContext)(LastAdaptContextScope), adaptScope = scope ?? lastScope;
|
|
87
|
-
return AdaptContext.useStyledContext(adaptScope);
|
|
88
|
-
}, AdaptPortals = /* @__PURE__ */ new Map(), AdaptParent = ({ children, Contents, scope, portal }) => {
|
|
89
|
-
const id = (0, import_react.useId)(), portalName = `AdaptPortal${scope}${id}`, childrenStoreRef = import_react.default.useRef(null);
|
|
90
|
-
childrenStoreRef.current || (childrenStoreRef.current = createAdaptChildrenStore());
|
|
91
|
-
const isTeleport = !import_constants.isWeb && (0, import_native.getPortal)().state.type === "teleport", FinalContents = (0, import_react.useMemo)(() => {
|
|
92
|
-
if (Contents)
|
|
93
|
-
return Contents;
|
|
94
|
-
if (isTeleport)
|
|
95
|
-
return TeleportAdaptContents;
|
|
96
|
-
if (AdaptPortals.has(portalName))
|
|
97
|
-
return AdaptPortals.get(portalName);
|
|
98
|
-
const element = () => /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
99
|
-
import_portal.PortalHost,
|
|
100
|
-
{
|
|
101
|
-
name: portalName,
|
|
102
|
-
forwardProps: typeof portal == "boolean" ? void 0 : portal?.forwardProps
|
|
103
|
-
},
|
|
104
|
-
id
|
|
105
|
-
);
|
|
106
|
-
return AdaptPortals.set(portalName, element), element;
|
|
107
|
-
}, [portalName, Contents, isTeleport]);
|
|
108
|
-
(0, import_constants.useIsomorphicLayoutEffect)(() => {
|
|
109
|
-
if (!isTeleport)
|
|
110
|
-
return AdaptPortals.set(portalName, FinalContents), () => {
|
|
111
|
-
AdaptPortals.delete(portalName);
|
|
112
|
-
};
|
|
113
|
-
}, [portalName, isTeleport]);
|
|
114
|
-
const [when, setWhen] = import_react.default.useState(null), [platform, setPlatform] = import_react.default.useState(null), [children2, setChildren] = import_react.default.useState(null);
|
|
115
|
-
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(AdaptChildrenStoreContext.Provider, { value: childrenStoreRef.current, children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(LastAdaptContextScope.Provider, { value: scope, children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
116
|
-
ProvideAdaptContext,
|
|
117
|
-
{
|
|
118
|
-
Contents: FinalContents,
|
|
119
|
-
when,
|
|
120
|
-
platform,
|
|
121
|
-
setPlatform,
|
|
122
|
-
setWhen,
|
|
123
|
-
setChildren,
|
|
124
|
-
portalName,
|
|
125
|
-
scopeName: scope,
|
|
126
|
-
children
|
|
127
|
-
}
|
|
128
|
-
) }) });
|
|
129
|
-
}, AdaptContents = ({ scope, ...rest }) => {
|
|
130
|
-
const context = useAdaptContext(scope);
|
|
131
|
-
if (!context?.Contents)
|
|
132
|
-
throw new Error(
|
|
133
|
-
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."
|
|
134
|
-
);
|
|
135
|
-
return import_react.default.createElement(context.Contents, { ...rest, key: "stable" });
|
|
136
|
-
};
|
|
137
|
-
AdaptContents.shouldForwardSpace = !0;
|
|
138
|
-
const Adapt = (0, import_helpers.withStaticProperties)(
|
|
139
|
-
function(props) {
|
|
140
|
-
const { platform, when, children, scope } = props, context = useAdaptContext(scope), enabled = useAdaptIsActiveGiven(props);
|
|
141
|
-
(0, import_constants.useIsomorphicLayoutEffect)(() => {
|
|
142
|
-
context?.setWhen?.(when || enabled), context?.setPlatform?.(platform || null);
|
|
143
|
-
}, [when, platform, enabled, context.setWhen, context.setPlatform]), (0, import_constants.useIsomorphicLayoutEffect)(() => () => {
|
|
144
|
-
context?.setWhen?.(null), context?.setPlatform?.(null);
|
|
145
|
-
}, []);
|
|
146
|
-
let output;
|
|
147
|
-
if (typeof children == "function") {
|
|
148
|
-
const Component = context?.Contents;
|
|
149
|
-
output = children(Component ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Component, {}) : null);
|
|
150
|
-
} else
|
|
151
|
-
output = children;
|
|
152
|
-
return (0, import_constants.useIsomorphicLayoutEffect)(() => {
|
|
153
|
-
typeof children == "function" && output !== void 0 && context?.setChildren(output);
|
|
154
|
-
}, [output]), /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_z_index_stack.StackZIndexContext, { children: enabled ? output : null });
|
|
155
|
-
},
|
|
156
|
-
{
|
|
157
|
-
Contents: AdaptContents
|
|
158
|
-
}
|
|
159
|
-
), AdaptPortalContents = (props) => {
|
|
160
|
-
const isActive = useAdaptIsActive(props.scope), { portalName } = useAdaptContext(props.scope), childrenStore = (0, import_react.useContext)(AdaptChildrenStoreContext);
|
|
161
|
-
return !import_constants.isWeb && (0, import_native.getPortal)().state.type === "teleport" && childrenStore ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(AdaptPortalTeleport, { isActive, store: childrenStore, children: props.children }) : /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_portal.PortalItem, { passThrough: !isActive, hostName: portalName, children: props.children });
|
|
162
|
-
};
|
|
163
|
-
function AdaptPortalTeleport({
|
|
164
|
-
isActive,
|
|
165
|
-
store,
|
|
166
|
-
children
|
|
167
|
-
}) {
|
|
168
|
-
return (0, import_constants.useIsomorphicLayoutEffect)(() => {
|
|
169
|
-
if (isActive)
|
|
170
|
-
return store.set(children), () => store.set(null);
|
|
171
|
-
}), isActive ? null : /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_jsx_runtime.Fragment, { children });
|
|
172
|
-
}
|
|
173
|
-
const useAdaptIsActiveGiven = ({
|
|
174
|
-
when,
|
|
175
|
-
platform
|
|
176
|
-
}) => {
|
|
177
|
-
const media = (0, import_core.useMedia)();
|
|
178
|
-
if (when == null && platform == null)
|
|
179
|
-
return !1;
|
|
180
|
-
if (when === !0)
|
|
181
|
-
return !0;
|
|
182
|
-
let enabled = !1;
|
|
183
|
-
return 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), platform && enabled == !1 ? !1 : (when && typeof when == "string" && (enabled = media[when]), enabled);
|
|
184
|
-
}, useAdaptIsActive = (scope) => {
|
|
185
|
-
const props = useAdaptContext(scope);
|
|
186
|
-
return useAdaptIsActiveGiven(props);
|
|
187
|
-
};
|
|
188
|
-
//# sourceMappingURL=Adapt.js.map
|
package/dist/cjs/Adapt.js.map
DELETED
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"version": 3,
|
|
3
|
-
"sources": ["../../src/Adapt.tsx"],
|
|
4
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,uBAMO,+BAEP,cAA8C,0BAC9C,iBAAqC,6BACrC,gBAA0B,4BAC1B,gBAAuC,4BACvC,uBAAmC,mCACnC,eAAiE,8BA2CxD;AA7BT,SAAS,2BAA+C;AACtD,MAAI,WAA4B;AAChC,QAAM,YAAY,oBAAI,IAAgB;AACtC,SAAO;AAAA,IACL,IAAI,GAAG;AACL,iBAAW;AACX,iBAAW,KAAK,UAAW,GAAE;AAAA,IAC/B;AAAA,IACA,KAAK,MAAM;AAAA,IACX,UAAU,UAAU;AAClB,uBAAU,IAAI,QAAQ,GACf,MAAM,UAAU,OAAO,QAAQ;AAAA,IACxC;AAAA,EACF;AACF;AAEA,MAAM,gCAA4B,4BAAyC,IAAI,GAEzE,iBAAiB,MAAM,MAAM;AAAC,GAC9B,WAAW,MAAM;AAGvB,SAAS,wBAAwB;AAC/B,QAAM,YAAQ,yBAAW,yBAAyB,GAC5C,WAAW,aAAAA,QAAM;AAAA,IACrB,OAAO,aAAa;AAAA,IACpB,OAAO,OAAO;AAAA,IACd,OAAO,OAAO;AAAA,EAChB;AACA,SAAO,2EAAG,UAAS;AACrB;AAgCO,MAAM,mBAAe,iCAAyC;AAAA,EACnE,UAAU;AAAA,EACV,WAAW;AAAA,EACX,YAAY;AAAA,EACZ,UAAU;AAAA,EACV,aAAa,CAAC,MAAqB;AAAA,EAAC;AAA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B,aAAa,QAAO,UAAU,yBAC9B,aAAa,cAAW,UAAU,6BAEvC,YAAY,WAAW,KAClB,MAGL,QAAQ,OAAO,QAAS,aAC1B,UAAU,MAAM,IAAI,IAGf;AACT,GAEa,mBAAmB,CAAC,UAAmB;AAClD,QAAM,QAAQ,gBAAgB,KAAK;AACnC,SAAO,sBAAsB,KAAK;AACpC;",
|
|
5
|
-
"names": ["React"]
|
|
6
|
-
}
|
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 index_exports = {};
|
|
13
|
-
module.exports = __toCommonJS(index_exports);
|
|
14
|
-
__reExport(index_exports, require("./Adapt"), module.exports);
|
|
15
|
-
//# sourceMappingURL=index.js.map
|
package/dist/cjs/index.js.map
DELETED
package/dist/esm/Adapt.js
DELETED
|
@@ -1,177 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
isAndroid,
|
|
3
|
-
isIos,
|
|
4
|
-
isTouchable,
|
|
5
|
-
isWeb,
|
|
6
|
-
useIsomorphicLayoutEffect
|
|
7
|
-
} from "@tamagui/constants";
|
|
8
|
-
import { createStyledContext, useMedia } from "@tamagui/core";
|
|
9
|
-
import { withStaticProperties } from "@tamagui/helpers";
|
|
10
|
-
import { getPortal } from "@tamagui/native";
|
|
11
|
-
import { PortalHost, PortalItem } from "@tamagui/portal";
|
|
12
|
-
import { StackZIndexContext } from "@tamagui/z-index-stack";
|
|
13
|
-
import React, { createContext, useContext, useId, useMemo } from "react";
|
|
14
|
-
import { Fragment, jsx } from "react/jsx-runtime";
|
|
15
|
-
function createAdaptChildrenStore() {
|
|
16
|
-
let children = null;
|
|
17
|
-
const listeners = /* @__PURE__ */ new Set();
|
|
18
|
-
return {
|
|
19
|
-
set(c) {
|
|
20
|
-
children = c;
|
|
21
|
-
for (const l of listeners) l();
|
|
22
|
-
},
|
|
23
|
-
get: () => children,
|
|
24
|
-
subscribe(callback) {
|
|
25
|
-
return listeners.add(callback), () => listeners.delete(callback);
|
|
26
|
-
}
|
|
27
|
-
};
|
|
28
|
-
}
|
|
29
|
-
const AdaptChildrenStoreContext = createContext(null), emptySubscribe = () => () => {
|
|
30
|
-
}, emptyGet = () => null;
|
|
31
|
-
function TeleportAdaptContents() {
|
|
32
|
-
const store = useContext(AdaptChildrenStoreContext), children = React.useSyncExternalStore(
|
|
33
|
-
store?.subscribe ?? emptySubscribe,
|
|
34
|
-
store?.get ?? emptyGet,
|
|
35
|
-
store?.get ?? emptyGet
|
|
36
|
-
);
|
|
37
|
-
return /* @__PURE__ */ jsx(Fragment, { children });
|
|
38
|
-
}
|
|
39
|
-
const AdaptContext = createStyledContext({
|
|
40
|
-
Contents: null,
|
|
41
|
-
scopeName: "",
|
|
42
|
-
portalName: "",
|
|
43
|
-
platform: null,
|
|
44
|
-
setPlatform: (x) => {
|
|
45
|
-
},
|
|
46
|
-
when: null,
|
|
47
|
-
setChildren: null,
|
|
48
|
-
setWhen: () => {
|
|
49
|
-
}
|
|
50
|
-
}), LastAdaptContextScope = createContext(""), ProvideAdaptContext = ({
|
|
51
|
-
children,
|
|
52
|
-
...context
|
|
53
|
-
}) => {
|
|
54
|
-
const scope = context.scopeName || "", lastScope = useContext(LastAdaptContextScope);
|
|
55
|
-
return /* @__PURE__ */ jsx(LastAdaptContextScope.Provider, { value: lastScope || context.lastScope || "", children: /* @__PURE__ */ jsx(
|
|
56
|
-
AdaptContext.Provider,
|
|
57
|
-
{
|
|
58
|
-
scope,
|
|
59
|
-
lastScope: lastScope || context.lastScope,
|
|
60
|
-
...context,
|
|
61
|
-
children
|
|
62
|
-
}
|
|
63
|
-
) });
|
|
64
|
-
}, useAdaptContext = (scope) => {
|
|
65
|
-
const lastScope = useContext(LastAdaptContextScope), adaptScope = scope ?? lastScope;
|
|
66
|
-
return AdaptContext.useStyledContext(adaptScope);
|
|
67
|
-
}, AdaptPortals = /* @__PURE__ */ new Map(), AdaptParent = ({ children, Contents, scope, portal }) => {
|
|
68
|
-
const id = useId(), portalName = `AdaptPortal${scope}${id}`, childrenStoreRef = React.useRef(null);
|
|
69
|
-
childrenStoreRef.current || (childrenStoreRef.current = createAdaptChildrenStore());
|
|
70
|
-
const isTeleport = !isWeb && getPortal().state.type === "teleport", FinalContents = useMemo(() => {
|
|
71
|
-
if (Contents)
|
|
72
|
-
return Contents;
|
|
73
|
-
if (isTeleport)
|
|
74
|
-
return TeleportAdaptContents;
|
|
75
|
-
if (AdaptPortals.has(portalName))
|
|
76
|
-
return AdaptPortals.get(portalName);
|
|
77
|
-
const element = () => /* @__PURE__ */ jsx(
|
|
78
|
-
PortalHost,
|
|
79
|
-
{
|
|
80
|
-
name: portalName,
|
|
81
|
-
forwardProps: typeof portal == "boolean" ? void 0 : portal?.forwardProps
|
|
82
|
-
},
|
|
83
|
-
id
|
|
84
|
-
);
|
|
85
|
-
return AdaptPortals.set(portalName, element), element;
|
|
86
|
-
}, [portalName, Contents, isTeleport]);
|
|
87
|
-
useIsomorphicLayoutEffect(() => {
|
|
88
|
-
if (!isTeleport)
|
|
89
|
-
return AdaptPortals.set(portalName, FinalContents), () => {
|
|
90
|
-
AdaptPortals.delete(portalName);
|
|
91
|
-
};
|
|
92
|
-
}, [portalName, isTeleport]);
|
|
93
|
-
const [when, setWhen] = React.useState(null), [platform, setPlatform] = React.useState(null), [children2, setChildren] = React.useState(null);
|
|
94
|
-
return /* @__PURE__ */ jsx(AdaptChildrenStoreContext.Provider, { value: childrenStoreRef.current, children: /* @__PURE__ */ jsx(LastAdaptContextScope.Provider, { value: scope, children: /* @__PURE__ */ jsx(
|
|
95
|
-
ProvideAdaptContext,
|
|
96
|
-
{
|
|
97
|
-
Contents: FinalContents,
|
|
98
|
-
when,
|
|
99
|
-
platform,
|
|
100
|
-
setPlatform,
|
|
101
|
-
setWhen,
|
|
102
|
-
setChildren,
|
|
103
|
-
portalName,
|
|
104
|
-
scopeName: scope,
|
|
105
|
-
children
|
|
106
|
-
}
|
|
107
|
-
) }) });
|
|
108
|
-
}, AdaptContents = ({ scope, ...rest }) => {
|
|
109
|
-
const context = useAdaptContext(scope);
|
|
110
|
-
if (!context?.Contents)
|
|
111
|
-
throw new Error(
|
|
112
|
-
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."
|
|
113
|
-
);
|
|
114
|
-
return React.createElement(context.Contents, { ...rest, key: "stable" });
|
|
115
|
-
};
|
|
116
|
-
AdaptContents.shouldForwardSpace = !0;
|
|
117
|
-
const Adapt = withStaticProperties(
|
|
118
|
-
function(props) {
|
|
119
|
-
const { platform, when, children, scope } = props, context = useAdaptContext(scope), enabled = useAdaptIsActiveGiven(props);
|
|
120
|
-
useIsomorphicLayoutEffect(() => {
|
|
121
|
-
context?.setWhen?.(when || enabled), context?.setPlatform?.(platform || null);
|
|
122
|
-
}, [when, platform, enabled, context.setWhen, context.setPlatform]), useIsomorphicLayoutEffect(() => () => {
|
|
123
|
-
context?.setWhen?.(null), context?.setPlatform?.(null);
|
|
124
|
-
}, []);
|
|
125
|
-
let output;
|
|
126
|
-
if (typeof children == "function") {
|
|
127
|
-
const Component = context?.Contents;
|
|
128
|
-
output = children(Component ? /* @__PURE__ */ jsx(Component, {}) : null);
|
|
129
|
-
} else
|
|
130
|
-
output = children;
|
|
131
|
-
return useIsomorphicLayoutEffect(() => {
|
|
132
|
-
typeof children == "function" && output !== void 0 && context?.setChildren(output);
|
|
133
|
-
}, [output]), /* @__PURE__ */ jsx(StackZIndexContext, { children: enabled ? output : null });
|
|
134
|
-
},
|
|
135
|
-
{
|
|
136
|
-
Contents: AdaptContents
|
|
137
|
-
}
|
|
138
|
-
), AdaptPortalContents = (props) => {
|
|
139
|
-
const isActive = useAdaptIsActive(props.scope), { portalName } = useAdaptContext(props.scope), childrenStore = useContext(AdaptChildrenStoreContext);
|
|
140
|
-
return !isWeb && getPortal().state.type === "teleport" && childrenStore ? /* @__PURE__ */ jsx(AdaptPortalTeleport, { isActive, store: childrenStore, children: props.children }) : /* @__PURE__ */ jsx(PortalItem, { passThrough: !isActive, hostName: portalName, children: props.children });
|
|
141
|
-
};
|
|
142
|
-
function AdaptPortalTeleport({
|
|
143
|
-
isActive,
|
|
144
|
-
store,
|
|
145
|
-
children
|
|
146
|
-
}) {
|
|
147
|
-
return useIsomorphicLayoutEffect(() => {
|
|
148
|
-
if (isActive)
|
|
149
|
-
return store.set(children), () => store.set(null);
|
|
150
|
-
}), isActive ? null : /* @__PURE__ */ jsx(Fragment, { children });
|
|
151
|
-
}
|
|
152
|
-
const useAdaptIsActiveGiven = ({
|
|
153
|
-
when,
|
|
154
|
-
platform
|
|
155
|
-
}) => {
|
|
156
|
-
const media = useMedia();
|
|
157
|
-
if (when == null && platform == null)
|
|
158
|
-
return !1;
|
|
159
|
-
if (when === !0)
|
|
160
|
-
return !0;
|
|
161
|
-
let enabled = !1;
|
|
162
|
-
return platform === "touch" ? enabled = isTouchable : platform === "native" ? enabled = !isWeb : platform === "web" ? enabled = isWeb : platform === "ios" ? enabled = isIos : platform === "android" && (enabled = isAndroid), platform && enabled == !1 ? !1 : (when && typeof when == "string" && (enabled = media[when]), enabled);
|
|
163
|
-
}, useAdaptIsActive = (scope) => {
|
|
164
|
-
const props = useAdaptContext(scope);
|
|
165
|
-
return useAdaptIsActiveGiven(props);
|
|
166
|
-
};
|
|
167
|
-
export {
|
|
168
|
-
Adapt,
|
|
169
|
-
AdaptContents,
|
|
170
|
-
AdaptContext,
|
|
171
|
-
AdaptParent,
|
|
172
|
-
AdaptPortalContents,
|
|
173
|
-
ProvideAdaptContext,
|
|
174
|
-
useAdaptContext,
|
|
175
|
-
useAdaptIsActive
|
|
176
|
-
};
|
|
177
|
-
//# sourceMappingURL=Adapt.js.map
|
package/dist/esm/Adapt.js.map
DELETED
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"version": 3,
|
|
3
|
-
"sources": ["../../src/Adapt.tsx"],
|
|
4
|
-
"mappings": "AAAA;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACK;AAEP,SAAS,qBAAqB,gBAAgB;AAC9C,SAAS,4BAA4B;AACrC,SAAS,iBAAiB;AAC1B,SAAS,YAAY,kBAAkB;AACvC,SAAS,0BAA0B;AACnC,OAAO,SAAS,eAAe,YAAY,OAAO,eAAe;AA2CxD;AA7BT,SAAS,2BAA+C;AACtD,MAAI,WAA4B;AAChC,QAAM,YAAY,oBAAI,IAAgB;AACtC,SAAO;AAAA,IACL,IAAI,GAAG;AACL,iBAAW;AACX,iBAAW,KAAK,UAAW,GAAE;AAAA,IAC/B;AAAA,IACA,KAAK,MAAM;AAAA,IACX,UAAU,UAAU;AAClB,uBAAU,IAAI,QAAQ,GACf,MAAM,UAAU,OAAO,QAAQ;AAAA,IACxC;AAAA,EACF;AACF;AAEA,MAAM,4BAA4B,cAAyC,IAAI,GAEzE,iBAAiB,MAAM,MAAM;AAAC,GAC9B,WAAW,MAAM;AAGvB,SAAS,wBAAwB;AAC/B,QAAM,QAAQ,WAAW,yBAAyB,GAC5C,WAAW,MAAM;A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