@tamagui/adapt 3.0.0-beta.922.1 → 3.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.
@@ -38,6 +38,7 @@ __export(Adapt_exports, {
38
38
  useAdaptContext: () => useAdaptContext,
39
39
  useAdaptIsActive: () => useAdaptIsActive,
40
40
  useAdaptTarget: () => useAdaptTarget,
41
+ useAdaptTargetScope: () => useAdaptTargetScope,
41
42
  useAdaptedCapabilities: () => useAdaptedCapabilities
42
43
  });
43
44
  module.exports = __toCommonJS(Adapt_exports);
@@ -97,13 +98,8 @@ var adaptContextKeys = [
97
98
  "Contents",
98
99
  "scopeName",
99
100
  "portalName",
100
- "platform",
101
- "setPlatform",
102
- "when",
103
- "setWhen",
104
101
  "active",
105
- "rawActive",
106
- "setRawActive",
102
+ "setAdaptConfig",
107
103
  "slot",
108
104
  "handoff",
109
105
  "targetFullyHidden",
@@ -118,13 +114,8 @@ var AdaptContext = (0, import_core.createStyledContext)({
118
114
  Contents: null,
119
115
  scopeName: "",
120
116
  portalName: "",
121
- platform: null,
122
- setPlatform: function(x) {},
123
- when: null,
124
- setWhen: function() {},
125
117
  active: false,
126
- rawActive: false,
127
- setRawActive: function() {},
118
+ setAdaptConfig: function() {},
128
119
  slot: null,
129
120
  handoff: {
130
121
  hidden: true,
@@ -140,6 +131,10 @@ var AdaptContext = (0, import_core.createStyledContext)({
140
131
  }, { keys: adaptContextKeys });
141
132
  var AdaptCapabilitiesContext = /* @__PURE__ */ (0, import_react.createContext)({});
142
133
  var LastAdaptContextScope = /* @__PURE__ */ (0, import_react.createContext)("");
134
+ var AdaptTargetScope = /* @__PURE__ */ (0, import_react.createContext)(null);
135
+ var useAdaptTargetScope = function() {
136
+ return (0, import_react.useContext)(AdaptTargetScope);
137
+ };
143
138
  var ProvideAdaptContext = function(param) {
144
139
  var { children, ...context } = param;
145
140
  var scope = context.scopeName || "";
@@ -159,17 +154,64 @@ var useAdaptContext = function(scope) {
159
154
  var adaptScope = scope !== null && scope !== void 0 ? scope : lastScope;
160
155
  return AdaptContext.useStyledContext(adaptScope);
161
156
  };
157
+ function findAdaptConfig(children, scope) {
158
+ var _iteratorNormalCompletion = true, _didIteratorError = false, _iteratorError = void 0;
159
+ try {
160
+ for (var _iterator = import_react.default.Children.toArray(children)[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) {
161
+ var child = _step.value;
162
+ if (!/* @__PURE__ */ import_react.default.isValidElement(child)) continue;
163
+ if (child.type === import_react.default.Fragment) {
164
+ var found = findAdaptConfig(child.props.children, scope);
165
+ if (found) return found;
166
+ continue;
167
+ }
168
+ if (child.type === Adapt) {
169
+ var childProps = child.props;
170
+ if (childProps.scope == null || childProps.scope === scope) {
171
+ return childProps;
172
+ }
173
+ }
174
+ }
175
+ } catch (err) {
176
+ _didIteratorError = true;
177
+ _iteratorError = err;
178
+ } finally {
179
+ try {
180
+ if (!_iteratorNormalCompletion && _iterator.return != null) {
181
+ _iterator.return();
182
+ }
183
+ } finally {
184
+ if (_didIteratorError) {
185
+ throw _iteratorError;
186
+ }
187
+ }
188
+ }
189
+ return null;
190
+ }
162
191
  var AdaptParent = function(param) {
163
- var { children, Contents, scope, open, onOpenChange, state } = param;
192
+ var { children, adaptChildren, Contents, scope, open, onOpenChange, state } = param;
164
193
  var id = (0, import_react.useId)();
165
194
  var portalName = `AdaptPortal${scope}${id}`;
166
195
  var slotRef = import_react.default.useRef(null);
167
196
  if (!slotRef.current) {
168
197
  slotRef.current = createAdaptSlotStore();
169
198
  }
170
- var [when, setWhen] = import_react.default.useState(null);
171
- var [platform, setPlatform] = import_react.default.useState(null);
172
- var [rawActive, setRawActive] = import_react.default.useState(false);
199
+ var staticConfig = import_react.default.useMemo(function() {
200
+ var _findAdaptConfig;
201
+ return (_findAdaptConfig = findAdaptConfig(adaptChildren, scope)) !== null && _findAdaptConfig !== void 0 ? _findAdaptConfig : findAdaptConfig(children, scope);
202
+ }, [
203
+ adaptChildren,
204
+ children,
205
+ scope
206
+ ]);
207
+ var [publishedConfig, setPublishedConfig] = import_react.default.useState(null);
208
+ var rawActive = useAdaptIsActiveGiven(staticConfig !== null && staticConfig !== void 0 ? staticConfig : publishedConfig);
209
+ var staticConfigRef = import_react.default.useRef(staticConfig);
210
+ staticConfigRef.current = staticConfig;
211
+ var setAdaptConfig = import_react.default.useCallback(function(config) {
212
+ if (staticConfigRef.current) return;
213
+ setPublishedConfig(config);
214
+ }, []);
173
215
  var [exiting, setExiting] = import_react.default.useState(false);
174
216
  var [present, setPresent] = import_react.default.useState(false);
175
217
  var [targetFullyHidden, setTargetFullyHidden] = import_react.default.useState(!open);
@@ -184,12 +226,6 @@ var AdaptParent = function(param) {
184
226
  var active = rawActive || exiting || shouldStartExit;
185
227
  var targetHidden = !rawActive;
186
228
  var skipNextAnimation = Boolean(rawActive && wasTargetHiddenRef.current && hasHadActiveTargetRef.current && open);
187
- rawActiveRef.current = rawActive;
188
- openRef.current = open;
189
- if (rawActive) {
190
- hasHadActiveTargetRef.current = true;
191
- }
192
- wasTargetHiddenRef.current = targetHidden;
193
229
  var releasePresenceLatch = import_react.default.useCallback(function() {
194
230
  setExiting(false);
195
231
  if (!rawActiveRef.current) {
@@ -202,6 +238,12 @@ var AdaptParent = function(param) {
202
238
  }
203
239
  }, [shouldStartExit]);
204
240
  (0, import_constants.useIsomorphicLayoutEffect)(function() {
241
+ rawActiveRef.current = rawActive;
242
+ openRef.current = open;
243
+ if (rawActive) {
244
+ hasHadActiveTargetRef.current = true;
245
+ }
246
+ wasTargetHiddenRef.current = targetHidden;
205
247
  if (open && rawActive) {
206
248
  setTargetFullyHidden(false);
207
249
  return;
@@ -212,7 +254,8 @@ var AdaptParent = function(param) {
212
254
  }, [
213
255
  active,
214
256
  open,
215
- rawActive
257
+ rawActive,
258
+ targetHidden
216
259
  ]);
217
260
  (0, import_constants.useIsomorphicLayoutEffect)(function() {
218
261
  if (rawActive) {
@@ -289,13 +332,8 @@ var AdaptParent = function(param) {
289
332
  value: scope,
290
333
  children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(ProvideAdaptContext, {
291
334
  Contents: FinalContents,
292
- when,
293
- platform,
294
- setPlatform,
295
- setWhen,
296
335
  active,
297
- rawActive,
298
- setRawActive,
336
+ setAdaptConfig,
299
337
  portalName,
300
338
  scopeName: scope,
301
339
  slot: slotRef.current,
@@ -331,31 +369,32 @@ var AdaptContents = function(param) {
331
369
  context.registerContents,
332
370
  context.unregisterContents
333
371
  ]);
334
- return /* @__PURE__ */ import_react.default.createElement(context.Contents, {
335
- ...rest,
336
- scope,
337
- key: `stable`
372
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(AdaptTargetScope.Provider, {
373
+ value: null,
374
+ children: /* @__PURE__ */ import_react.default.createElement(context.Contents, {
375
+ ...rest,
376
+ scope,
377
+ key: `stable`
378
+ })
338
379
  });
339
380
  };
340
- AdaptContents.shouldForwardSpace = true;
341
381
  var Adapt = (0, import_helpers.withStaticProperties)(function Adapt2(props) {
342
- var { platform, when, children, scope } = props;
382
+ var { children, platform, scope, when } = props;
343
383
  var context = useAdaptContext(scope);
344
- var rawEnabled = useAdaptIsActiveGiven(props);
345
- var enabled = rawEnabled || context.active;
384
+ var enabled = context.active;
346
385
  var isRenderCallback = typeof children === "function";
347
386
  (0, import_constants.useIsomorphicLayoutEffect)(function() {
348
- var _context_setWhen, _context_setPlatform, _context_setRawActive;
349
- context === null || context === void 0 ? void 0 : (_context_setWhen = context.setWhen) === null || _context_setWhen === void 0 ? void 0 : _context_setWhen.call(context, when || rawEnabled);
350
- context === null || context === void 0 ? void 0 : (_context_setPlatform = context.setPlatform) === null || _context_setPlatform === void 0 ? void 0 : _context_setPlatform.call(context, platform || null);
351
- context === null || context === void 0 ? void 0 : (_context_setRawActive = context.setRawActive) === null || _context_setRawActive === void 0 ? void 0 : _context_setRawActive.call(context, rawEnabled);
387
+ context.setAdaptConfig({
388
+ when,
389
+ platform
390
+ });
391
+ return function() {
392
+ context.setAdaptConfig(null);
393
+ };
352
394
  }, [
353
395
  when,
354
396
  platform,
355
- rawEnabled,
356
- context.setWhen,
357
- context.setPlatform,
358
- context.setRawActive
397
+ context.setAdaptConfig
359
398
  ]);
360
399
  (0, import_constants.useIsomorphicLayoutEffect)(function() {
361
400
  if (!enabled || !isRenderCallback) return;
@@ -369,14 +408,6 @@ var Adapt = (0, import_helpers.withStaticProperties)(function Adapt2(props) {
369
408
  context.registerRenderCallback,
370
409
  context.unregisterRenderCallback
371
410
  ]);
372
- (0, import_constants.useIsomorphicLayoutEffect)(function() {
373
- return function() {
374
- var _context_setWhen, _context_setPlatform, _context_setRawActive;
375
- context === null || context === void 0 ? void 0 : (_context_setWhen = context.setWhen) === null || _context_setWhen === void 0 ? void 0 : _context_setWhen.call(context, null);
376
- context === null || context === void 0 ? void 0 : (_context_setPlatform = context.setPlatform) === null || _context_setPlatform === void 0 ? void 0 : _context_setPlatform.call(context, null);
377
- context === null || context === void 0 ? void 0 : (_context_setRawActive = context.setRawActive) === null || _context_setRawActive === void 0 ? void 0 : _context_setRawActive.call(context, false);
378
- };
379
- }, []);
380
411
  var output;
381
412
  if (isRenderCallback) {
382
413
  var Component = context === null || context === void 0 ? void 0 : context.Contents;
@@ -384,7 +415,10 @@ var Adapt = (0, import_helpers.withStaticProperties)(function Adapt2(props) {
384
415
  } else {
385
416
  output = children;
386
417
  }
387
- return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_z_index_stack.StackZIndexContext, { children: !enabled ? null : output });
418
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(AdaptTargetScope.Provider, {
419
+ value: context.scopeName,
420
+ children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_z_index_stack.StackZIndexContext, { children: !enabled ? null : output })
421
+ });
388
422
  }, { Contents: AdaptContents });
389
423
  var AdaptPortalContents = function(props) {
390
424
  var isActive = useAdaptIsActive(props.scope);
@@ -405,25 +439,32 @@ function AdaptSlotContents(param) {
405
439
  }
406
440
  function AdaptSlotPublisher(param) {
407
441
  var { isActive, slot, children } = param;
408
- var publishedRef = import_react.default.useRef(false);
442
+ var publishedRef = import_react.default.useRef(null);
409
443
  (0, import_constants.useIsomorphicLayoutEffect)(function() {
410
444
  if (!slot) return;
445
+ var published = publishedRef.current;
446
+ if (published && published.isActive === isActive && published.element === children) {
447
+ return;
448
+ }
449
+ publishedRef.current = {
450
+ isActive,
451
+ element: children
452
+ };
411
453
  if (isActive) {
412
454
  slot.publish(children);
413
- publishedRef.current = true;
414
455
  } else {
415
456
  slot.clear();
416
- publishedRef.current = false;
417
457
  }
418
458
  slot.notify();
419
459
  });
420
460
  (0, import_constants.useIsomorphicLayoutEffect)(function() {
421
461
  return function() {
422
- if (publishedRef.current) {
462
+ var _publishedRef_current;
463
+ if ((_publishedRef_current = publishedRef.current) === null || _publishedRef_current === void 0 ? void 0 : _publishedRef_current.isActive) {
423
464
  slot === null || slot === void 0 ? void 0 : slot.clear();
424
465
  slot === null || slot === void 0 ? void 0 : slot.notify();
425
- publishedRef.current = false;
426
466
  }
467
+ publishedRef.current = null;
427
468
  };
428
469
  }, [slot]);
429
470
  return isActive ? null : /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_jsx_runtime.Fragment, { children });
@@ -434,15 +475,13 @@ var emptySubscribe = function() {
434
475
  var emptySnapshot = function() {
435
476
  return 0;
436
477
  };
437
- var useAdaptIsActiveGiven = function(param) {
438
- var { when, platform } = param;
478
+ var useAdaptIsActiveGiven = function(config) {
439
479
  var media = (0, import_core.useMedia)();
480
+ var when = config === null || config === void 0 ? void 0 : config.when;
481
+ var platform = config === null || config === void 0 ? void 0 : config.platform;
440
482
  if (when == null && platform == null) {
441
483
  return false;
442
484
  }
443
- if (when === true) {
444
- return true;
445
- }
446
485
  var enabled = false;
447
486
  if (platform === "touch") enabled = import_constants.isTouchable;
448
487
  else if (platform === "native") enabled = !import_constants.isWeb;
@@ -452,20 +491,23 @@ var useAdaptIsActiveGiven = function(param) {
452
491
  if (platform && enabled == false) {
453
492
  return false;
454
493
  }
494
+ if (when === true) {
495
+ return true;
496
+ }
455
497
  if (when && typeof when === "string") {
456
498
  enabled = media[when];
457
499
  }
458
500
  return enabled;
459
501
  };
460
502
  var useAdaptIsActive = function(scope) {
461
- var props = useAdaptContext(scope);
462
- var isActiveGiven = useAdaptIsActiveGiven(props);
463
- return props.active || isActiveGiven;
503
+ return useAdaptContext(scope).active;
464
504
  };
465
505
  function useAdaptTarget(scope) {
466
506
  var context = useAdaptContext(scope);
507
+ var targetScope = useAdaptTargetScope();
508
+ var isTarget = scope !== void 0 || targetScope === context.scopeName;
467
509
  (0, import_constants.useIsomorphicLayoutEffect)(function() {
468
- if (!context.active) return;
510
+ if (!context.active || !isTarget) return;
469
511
  context.registerTarget();
470
512
  return function() {
471
513
  context.unregisterTarget();
@@ -473,9 +515,10 @@ function useAdaptTarget(scope) {
473
515
  }, [
474
516
  context.active,
475
517
  context.registerTarget,
476
- context.unregisterTarget
518
+ context.unregisterTarget,
519
+ isTarget
477
520
  ]);
478
- if (!context.active) {
521
+ if (!context.active || !isTarget) {
479
522
  return null;
480
523
  }
481
524
  return {
@@ -1 +1 @@
1
- {"version":3,"file":"Adapt.native.js","names":[],"sources":["cjs/Adapt.native.js"],"sourcesContent":["\"use strict\";\nvar __create = Object.create;\nvar __defProp = Object.defineProperty;\nvar __getOwnPropDesc = Object.getOwnPropertyDescriptor;\nvar __getOwnPropNames = Object.getOwnPropertyNames;\nvar __getProtoOf = Object.getPrototypeOf;\nvar __hasOwnProp = Object.prototype.hasOwnProperty;\nvar __export = (target, all) => {\n for (var name in all)\n __defProp(target, name, { get: all[name], enumerable: true });\n};\nvar __copyProps = (to, from, except, desc) => {\n if (from && typeof from === \"object\" || typeof from === \"function\") {\n for (let key of __getOwnPropNames(from))\n if (!__hasOwnProp.call(to, key) && key !== except)\n __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });\n }\n return to;\n};\nvar __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(\n // If the importer is in node compatibility mode or this is not an ESM\n // file that has been converted to a CommonJS file using a Babel-\n // compatible transform (i.e. \"__esModule\" has not been set), then set\n // \"default\" to the CommonJS \"module.exports\" for node compatibility.\n isNodeMode || !mod || !mod.__esModule ? __defProp(target, \"default\", { value: mod, enumerable: true }) : target,\n mod\n));\nvar __toCommonJS = (mod) => __copyProps(__defProp({}, \"__esModule\", { value: true }), mod);\nvar Adapt_exports = {};\n__export(Adapt_exports, {\n Adapt: () => Adapt,\n AdaptCapabilities: () => AdaptCapabilities,\n AdaptContents: () => AdaptContents,\n AdaptContext: () => AdaptContext,\n AdaptParent: () => AdaptParent,\n AdaptPortalContents: () => AdaptPortalContents,\n ProvideAdaptContext: () => ProvideAdaptContext,\n useAdaptContext: () => useAdaptContext,\n useAdaptIsActive: () => useAdaptIsActive,\n useAdaptTarget: () => useAdaptTarget,\n useAdaptedCapabilities: () => useAdaptedCapabilities\n});\nmodule.exports = __toCommonJS(Adapt_exports);\nvar import_jsx_runtime = require(\"react/jsx-runtime\");\nvar import_constants = require(\"@tamagui/constants\");\nvar import_core = require(\"@tamagui/core\");\nvar import_helpers = require(\"@tamagui/helpers\");\nvar import_z_index_stack = require(\"@tamagui/z-index-stack\");\nvar import_react = __toESM(require(\"react\"), 1);\nfunction createAdaptSlotStore() {\n var listeners = /* @__PURE__ */ new Set();\n var store = {\n element: null,\n version: 0,\n publish(element) {\n store.element = element;\n },\n clear() {\n store.element = null;\n },\n notify() {\n store.version += 1;\n var _iteratorNormalCompletion = true, _didIteratorError = false, _iteratorError = void 0;\n try {\n for (var _iterator = listeners[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) {\n var listener = _step.value;\n listener();\n }\n } catch (err) {\n _didIteratorError = true;\n _iteratorError = err;\n } finally {\n try {\n if (!_iteratorNormalCompletion && _iterator.return != null) {\n _iterator.return();\n }\n } finally {\n if (_didIteratorError) {\n throw _iteratorError;\n }\n }\n }\n },\n getSnapshot() {\n return store.version;\n },\n subscribe(callback) {\n listeners.add(callback);\n return function() {\n listeners.delete(callback);\n };\n }\n };\n return store;\n}\nvar adaptContextKeys = [\n \"Contents\",\n \"scopeName\",\n \"portalName\",\n \"platform\",\n \"setPlatform\",\n \"when\",\n \"setWhen\",\n \"active\",\n \"rawActive\",\n \"setRawActive\",\n \"slot\",\n \"handoff\",\n \"targetFullyHidden\",\n \"registerTarget\",\n \"unregisterTarget\",\n \"registerContents\",\n \"unregisterContents\",\n \"registerRenderCallback\",\n \"unregisterRenderCallback\"\n];\nvar AdaptContext = (0, import_core.createStyledContext)({\n Contents: null,\n scopeName: \"\",\n portalName: \"\",\n platform: null,\n setPlatform: function(x) {\n },\n when: null,\n setWhen: function() {\n },\n active: false,\n rawActive: false,\n setRawActive: function() {\n },\n slot: null,\n handoff: {\n hidden: true,\n onTransition: function() {\n }\n },\n targetFullyHidden: true,\n registerTarget: function() {\n },\n unregisterTarget: function() {\n },\n registerContents: function() {\n },\n unregisterContents: function() {\n },\n registerRenderCallback: function() {\n },\n unregisterRenderCallback: function() {\n }\n}, {\n keys: adaptContextKeys\n});\nvar AdaptCapabilitiesContext = /* @__PURE__ */ (0, import_react.createContext)({});\nvar LastAdaptContextScope = /* @__PURE__ */ (0, import_react.createContext)(\"\");\nvar ProvideAdaptContext = function(param) {\n var { children, ...context } = param;\n var scope = context.scopeName || \"\";\n var lastScope = (0, import_react.useContext)(LastAdaptContextScope);\n return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(LastAdaptContextScope.Provider, {\n value: lastScope || context.lastScope || \"\",\n children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(AdaptContext.Provider, {\n scope,\n lastScope: lastScope || context.lastScope,\n ...context,\n children\n })\n });\n};\nvar useAdaptContext = function(scope) {\n var lastScope = (0, import_react.useContext)(LastAdaptContextScope);\n var adaptScope = scope !== null && scope !== void 0 ? scope : lastScope;\n return AdaptContext.useStyledContext(adaptScope);\n};\nvar AdaptParent = function(param) {\n var { children, Contents, scope, open, onOpenChange, state } = param;\n var id = (0, import_react.useId)();\n var portalName = `AdaptPortal${scope}${id}`;\n var slotRef = import_react.default.useRef(null);\n if (!slotRef.current) {\n slotRef.current = createAdaptSlotStore();\n }\n var [when, setWhen] = import_react.default.useState(null);\n var [platform, setPlatform] = import_react.default.useState(null);\n var [rawActive, setRawActive] = import_react.default.useState(false);\n var [exiting, setExiting] = import_react.default.useState(false);\n var [present, setPresent] = import_react.default.useState(false);\n var [targetFullyHidden, setTargetFullyHidden] = import_react.default.useState(!open);\n var targetCountRef = import_react.default.useRef(0);\n var contentsCountRef = import_react.default.useRef(0);\n var renderCallbackCountRef = import_react.default.useRef(0);\n var rawActiveRef = import_react.default.useRef(false);\n var openRef = import_react.default.useRef(open);\n var wasTargetHiddenRef = import_react.default.useRef(!rawActive);\n var hasHadActiveTargetRef = import_react.default.useRef(false);\n var shouldStartExit = !rawActive && present && Boolean(open);\n var active = rawActive || exiting || shouldStartExit;\n var targetHidden = !rawActive;\n var skipNextAnimation = Boolean(rawActive && wasTargetHiddenRef.current && hasHadActiveTargetRef.current && open);\n rawActiveRef.current = rawActive;\n openRef.current = open;\n if (rawActive) {\n hasHadActiveTargetRef.current = true;\n }\n wasTargetHiddenRef.current = targetHidden;\n var releasePresenceLatch = import_react.default.useCallback(function() {\n setExiting(false);\n if (!rawActiveRef.current) {\n setPresent(false);\n }\n }, []);\n (0, import_constants.useIsomorphicLayoutEffect)(function() {\n if (shouldStartExit) {\n setExiting(true);\n }\n }, [\n shouldStartExit\n ]);\n (0, import_constants.useIsomorphicLayoutEffect)(function() {\n if (open && rawActive) {\n setTargetFullyHidden(false);\n return;\n }\n if (!open && !active) {\n setTargetFullyHidden(true);\n }\n }, [\n active,\n open,\n rawActive\n ]);\n (0, import_constants.useIsomorphicLayoutEffect)(function() {\n if (rawActive) {\n setPresent(true);\n } else if (!active) {\n setPresent(false);\n }\n if (rawActive && exiting) {\n setExiting(false);\n }\n }, [\n active,\n exiting,\n rawActive\n ]);\n var handoff = import_react.default.useMemo(function() {\n return {\n hidden: targetHidden,\n skipNextAnimation,\n onTransition(e) {\n if (e.phase !== \"end\" || e.finished === false) return;\n if (e.cause !== \"close\") {\n setTargetFullyHidden(false);\n return;\n }\n if (openRef.current && rawActiveRef.current) {\n setTargetFullyHidden(false);\n return;\n }\n setTargetFullyHidden(true);\n releasePresenceLatch();\n }\n };\n }, [\n releasePresenceLatch,\n skipNextAnimation,\n targetHidden\n ]);\n var registerTarget = import_react.default.useCallback(function() {\n targetCountRef.current += 1;\n if (process.env.NODE_ENV === \"development\" && targetCountRef.current > 1) {\n console.error(`Adapt expected exactly one target in scope \"${scope}\", but ${targetCountRef.current} targets registered.`);\n }\n }, [\n scope\n ]);\n var unregisterTarget = import_react.default.useCallback(function() {\n targetCountRef.current = Math.max(0, targetCountRef.current - 1);\n }, []);\n var registerContents = import_react.default.useCallback(function() {\n contentsCountRef.current += 1;\n }, []);\n var unregisterContents = import_react.default.useCallback(function() {\n contentsCountRef.current = Math.max(0, contentsCountRef.current - 1);\n }, []);\n var registerRenderCallback = import_react.default.useCallback(function() {\n renderCallbackCountRef.current += 1;\n }, []);\n var unregisterRenderCallback = import_react.default.useCallback(function() {\n renderCallbackCountRef.current = Math.max(0, renderCallbackCountRef.current - 1);\n }, []);\n import_react.default.useEffect(function() {\n if (process.env.NODE_ENV !== \"development\") return;\n if (!active) return;\n var timer = setTimeout(function() {\n if (rawActiveRef.current && targetCountRef.current === 0 && contentsCountRef.current === 0 && renderCallbackCountRef.current === 0) {\n console.error(`Adapt is active in scope \"${scope}\" but no target registered with useAdaptTarget(), Adapt.Contents marker, or render callback consumed it.`);\n }\n });\n return function() {\n return clearTimeout(timer);\n };\n }, [\n active,\n scope\n ]);\n var FinalContents = Contents || AdaptSlotContents;\n return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(LastAdaptContextScope.Provider, {\n value: scope,\n children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(ProvideAdaptContext, {\n Contents: FinalContents,\n when,\n platform,\n setPlatform,\n setWhen,\n active,\n rawActive,\n setRawActive,\n portalName,\n scopeName: scope,\n slot: slotRef.current,\n open,\n onOpenChange,\n state,\n handoff,\n targetFullyHidden,\n registerTarget,\n unregisterTarget,\n registerContents,\n unregisterContents,\n registerRenderCallback,\n unregisterRenderCallback,\n children\n })\n });\n};\nvar AdaptContents = function(param) {\n var { scope, ...rest } = param;\n var context = useAdaptContext(scope);\n if (!(context === null || context === void 0 ? void 0 : context.Contents)) {\n 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.`);\n }\n (0, import_constants.useIsomorphicLayoutEffect)(function() {\n if (!context.active) return;\n context.registerContents();\n return function() {\n context.unregisterContents();\n };\n }, [\n context.active,\n context.registerContents,\n context.unregisterContents\n ]);\n return /* @__PURE__ */ import_react.default.createElement(context.Contents, {\n ...rest,\n scope,\n key: `stable`\n });\n};\nAdaptContents.shouldForwardSpace = true;\nvar Adapt = (0, import_helpers.withStaticProperties)(function Adapt2(props) {\n var { platform, when, children, scope } = props;\n var context = useAdaptContext(scope);\n var rawEnabled = useAdaptIsActiveGiven(props);\n var enabled = rawEnabled || context.active;\n var isRenderCallback = typeof children === \"function\";\n (0, import_constants.useIsomorphicLayoutEffect)(function() {\n var _context_setWhen, _context_setPlatform, _context_setRawActive;\n context === null || context === void 0 ? void 0 : (_context_setWhen = context.setWhen) === null || _context_setWhen === void 0 ? void 0 : _context_setWhen.call(context, when || rawEnabled);\n context === null || context === void 0 ? void 0 : (_context_setPlatform = context.setPlatform) === null || _context_setPlatform === void 0 ? void 0 : _context_setPlatform.call(context, platform || null);\n context === null || context === void 0 ? void 0 : (_context_setRawActive = context.setRawActive) === null || _context_setRawActive === void 0 ? void 0 : _context_setRawActive.call(context, rawEnabled);\n }, [\n when,\n platform,\n rawEnabled,\n context.setWhen,\n context.setPlatform,\n context.setRawActive\n ]);\n (0, import_constants.useIsomorphicLayoutEffect)(function() {\n if (!enabled || !isRenderCallback) return;\n context.registerRenderCallback();\n return function() {\n context.unregisterRenderCallback();\n };\n }, [\n enabled,\n isRenderCallback,\n context.registerRenderCallback,\n context.unregisterRenderCallback\n ]);\n (0, import_constants.useIsomorphicLayoutEffect)(function() {\n return function() {\n var _context_setWhen, _context_setPlatform, _context_setRawActive;\n context === null || context === void 0 ? void 0 : (_context_setWhen = context.setWhen) === null || _context_setWhen === void 0 ? void 0 : _context_setWhen.call(context, null);\n context === null || context === void 0 ? void 0 : (_context_setPlatform = context.setPlatform) === null || _context_setPlatform === void 0 ? void 0 : _context_setPlatform.call(context, null);\n context === null || context === void 0 ? void 0 : (_context_setRawActive = context.setRawActive) === null || _context_setRawActive === void 0 ? void 0 : _context_setRawActive.call(context, false);\n };\n }, []);\n var output;\n if (isRenderCallback) {\n var Component = context === null || context === void 0 ? void 0 : context.Contents;\n output = children(Component ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Component, {}) : null, getAdaptRenderState(context));\n } else {\n output = children;\n }\n return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_z_index_stack.StackZIndexContext, {\n children: !enabled ? null : output\n });\n}, {\n Contents: AdaptContents\n});\nvar AdaptPortalContents = function(props) {\n var isActive = useAdaptIsActive(props.scope);\n var { slot } = useAdaptContext(props.scope);\n return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(AdaptSlotPublisher, {\n isActive,\n slot,\n children: props.children\n });\n};\nfunction AdaptSlotContents(param) {\n var { scope } = param;\n var { slot } = useAdaptContext(scope);\n var _slot_subscribe, _slot_getSnapshot, _slot_getSnapshot1;\n import_react.default.useSyncExternalStore((_slot_subscribe = slot === null || slot === void 0 ? void 0 : slot.subscribe) !== null && _slot_subscribe !== void 0 ? _slot_subscribe : emptySubscribe, (_slot_getSnapshot = slot === null || slot === void 0 ? void 0 : slot.getSnapshot) !== null && _slot_getSnapshot !== void 0 ? _slot_getSnapshot : emptySnapshot, (_slot_getSnapshot1 = slot === null || slot === void 0 ? void 0 : slot.getSnapshot) !== null && _slot_getSnapshot1 !== void 0 ? _slot_getSnapshot1 : emptySnapshot);\n var _slot_element;\n return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_jsx_runtime.Fragment, {\n children: (_slot_element = slot === null || slot === void 0 ? void 0 : slot.element) !== null && _slot_element !== void 0 ? _slot_element : null\n });\n}\nfunction AdaptSlotPublisher(param) {\n var { isActive, slot, children } = param;\n var publishedRef = import_react.default.useRef(false);\n (0, import_constants.useIsomorphicLayoutEffect)(function() {\n if (!slot) return;\n if (isActive) {\n slot.publish(children);\n publishedRef.current = true;\n } else {\n slot.clear();\n publishedRef.current = false;\n }\n slot.notify();\n });\n (0, import_constants.useIsomorphicLayoutEffect)(function() {\n return function() {\n if (publishedRef.current) {\n slot === null || slot === void 0 ? void 0 : slot.clear();\n slot === null || slot === void 0 ? void 0 : slot.notify();\n publishedRef.current = false;\n }\n };\n }, [\n slot\n ]);\n return isActive ? null : /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_jsx_runtime.Fragment, {\n children\n });\n}\nvar emptySubscribe = function() {\n return function() {\n };\n};\nvar emptySnapshot = function() {\n return 0;\n};\nvar useAdaptIsActiveGiven = function(param) {\n var { when, platform } = param;\n var media = (0, import_core.useMedia)();\n if (when == null && platform == null) {\n return false;\n }\n if (when === true) {\n return true;\n }\n var enabled = false;\n if (platform === \"touch\") enabled = import_constants.isTouchable;\n else if (platform === \"native\") enabled = !import_constants.isWeb;\n else if (platform === \"web\") enabled = import_constants.isWeb;\n else if (platform === \"ios\") enabled = import_constants.isIos;\n else if (platform === \"android\") enabled = import_constants.isAndroid;\n if (platform && enabled == false) {\n return false;\n }\n if (when && typeof when === \"string\") {\n enabled = media[when];\n }\n return enabled;\n};\nvar useAdaptIsActive = function(scope) {\n var props = useAdaptContext(scope);\n var isActiveGiven = useAdaptIsActiveGiven(props);\n return props.active || isActiveGiven;\n};\nfunction useAdaptTarget(scope) {\n var context = useAdaptContext(scope);\n (0, import_constants.useIsomorphicLayoutEffect)(function() {\n if (!context.active) return;\n context.registerTarget();\n return function() {\n context.unregisterTarget();\n };\n }, [\n context.active,\n context.registerTarget,\n context.unregisterTarget\n ]);\n if (!context.active) {\n return null;\n }\n return {\n open: context.open,\n onOpenChange: context.onOpenChange,\n handoff: context.handoff,\n state: context.state\n };\n}\nvar AdaptCapabilities = function(param) {\n var { children, scroll, overlay, dismiss } = param;\n var parent = (0, import_react.useContext)(AdaptCapabilitiesContext);\n var value = import_react.default.useMemo(function() {\n return {\n scroll: scroll !== null && scroll !== void 0 ? scroll : parent.scroll,\n overlay: overlay !== null && overlay !== void 0 ? overlay : parent.overlay,\n dismiss: dismiss !== null && dismiss !== void 0 ? dismiss : parent.dismiss\n };\n }, [\n dismiss,\n overlay,\n parent.dismiss,\n parent.overlay,\n parent.scroll,\n scroll\n ]);\n return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(AdaptCapabilitiesContext.Provider, {\n value,\n children\n });\n};\nvar useAdaptedCapabilities = function() {\n return (0, import_react.useContext)(AdaptCapabilitiesContext);\n};\nfunction getAdaptRenderState(context) {\n return {\n active: context.active,\n open: context.open,\n onOpenChange: context.onOpenChange,\n state: context.state,\n handoff: context.handoff\n };\n}\n//# sourceMappingURL=Adapt.js.map\n"],"mappings":";;;AACA,IAAI,WAAW,OAAO;AACtB,IAAI,YAAY,OAAO;AACvB,IAAI,mBAAmB,OAAO;AAC9B,IAAI,oBAAoB,OAAO;AAC/B,IAAI,eAAe,OAAO;AAC1B,IAAI,eAAe,OAAO,UAAU;AACpC,IAAI,YAAY,QAAQ,QAAQ;CAC9B,KAAK,IAAI,QAAQ,KACf,UAAU,QAAQ,MAAM;EAAE,KAAK,IAAI;EAAO,YAAY;CAAK,CAAC;AAChE;AACA,IAAI,eAAe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,YAAY,QAAQ,YAAY,KAAK,IAAI,UAAU,OAAO;GACnE,SAAS,YAAY,QAAQ,YAAY,KAAK,IAAI,UAAU,OAAO;EACrE;CACF,GAAG;EACD;EACA;EACA,OAAO;EACP,OAAO;EACP,OAAO;EACP;CACF,CAAC;CACD,OAAuB,iBAAC,GAAG,mBAAmB,IAAG,CAAE,yBAAyB,UAAU;EACpF;EACA;CACF,CAAC;AACH;AACA,IAAI,yBAAyB,WAAW;CACtC,QAAQ,GAAG,aAAa,WAAU,CAAE,wBAAwB;AAC9D;AACA,SAAS,oBAAoB,SAAS;CACpC,OAAO;EACL,QAAQ,QAAQ;EAChB,MAAM,QAAQ;EACd,cAAc,QAAQ;EACtB,OAAO,QAAQ;EACf,SAAS,QAAQ;CACnB;AACF"}
1
+ {"version":3,"file":"Adapt.native.js","names":[],"sources":["cjs/Adapt.native.js"],"sourcesContent":["\"use strict\";\nvar __create = Object.create;\nvar __defProp = Object.defineProperty;\nvar __getOwnPropDesc = Object.getOwnPropertyDescriptor;\nvar __getOwnPropNames = Object.getOwnPropertyNames;\nvar __getProtoOf = Object.getPrototypeOf;\nvar __hasOwnProp = Object.prototype.hasOwnProperty;\nvar __export = (target, all) => {\n for (var name in all)\n __defProp(target, name, { get: all[name], enumerable: true });\n};\nvar __copyProps = (to, from, except, desc) => {\n if (from && typeof from === \"object\" || typeof from === \"function\") {\n for (let key of __getOwnPropNames(from))\n if (!__hasOwnProp.call(to, key) && key !== except)\n __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });\n }\n return to;\n};\nvar __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(\n // If the importer is in node compatibility mode or this is not an ESM\n // file that has been converted to a CommonJS file using a Babel-\n // compatible transform (i.e. \"__esModule\" has not been set), then set\n // \"default\" to the CommonJS \"module.exports\" for node compatibility.\n isNodeMode || !mod || !mod.__esModule ? __defProp(target, \"default\", { value: mod, enumerable: true }) : target,\n mod\n));\nvar __toCommonJS = (mod) => __copyProps(__defProp({}, \"__esModule\", { value: true }), mod);\nvar Adapt_exports = {};\n__export(Adapt_exports, {\n Adapt: () => Adapt,\n AdaptCapabilities: () => AdaptCapabilities,\n AdaptContents: () => AdaptContents,\n AdaptContext: () => AdaptContext,\n AdaptParent: () => AdaptParent,\n AdaptPortalContents: () => AdaptPortalContents,\n ProvideAdaptContext: () => ProvideAdaptContext,\n useAdaptContext: () => useAdaptContext,\n useAdaptIsActive: () => useAdaptIsActive,\n useAdaptTarget: () => useAdaptTarget,\n useAdaptTargetScope: () => useAdaptTargetScope,\n useAdaptedCapabilities: () => useAdaptedCapabilities\n});\nmodule.exports = __toCommonJS(Adapt_exports);\nvar import_jsx_runtime = require(\"react/jsx-runtime\");\nvar import_constants = require(\"@tamagui/constants\");\nvar import_core = require(\"@tamagui/core\");\nvar import_helpers = require(\"@tamagui/helpers\");\nvar import_z_index_stack = require(\"@tamagui/z-index-stack\");\nvar import_react = __toESM(require(\"react\"), 1);\nfunction createAdaptSlotStore() {\n var listeners = /* @__PURE__ */ new Set();\n var store = {\n element: null,\n version: 0,\n publish(element) {\n store.element = element;\n },\n clear() {\n store.element = null;\n },\n notify() {\n store.version += 1;\n var _iteratorNormalCompletion = true, _didIteratorError = false, _iteratorError = void 0;\n try {\n for (var _iterator = listeners[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) {\n var listener = _step.value;\n listener();\n }\n } catch (err) {\n _didIteratorError = true;\n _iteratorError = err;\n } finally {\n try {\n if (!_iteratorNormalCompletion && _iterator.return != null) {\n _iterator.return();\n }\n } finally {\n if (_didIteratorError) {\n throw _iteratorError;\n }\n }\n }\n },\n getSnapshot() {\n return store.version;\n },\n subscribe(callback) {\n listeners.add(callback);\n return function() {\n listeners.delete(callback);\n };\n }\n };\n return store;\n}\nvar adaptContextKeys = [\n \"Contents\",\n \"scopeName\",\n \"portalName\",\n \"active\",\n \"setAdaptConfig\",\n \"slot\",\n \"handoff\",\n \"targetFullyHidden\",\n \"registerTarget\",\n \"unregisterTarget\",\n \"registerContents\",\n \"unregisterContents\",\n \"registerRenderCallback\",\n \"unregisterRenderCallback\"\n];\nvar AdaptContext = (0, import_core.createStyledContext)({\n Contents: null,\n scopeName: \"\",\n portalName: \"\",\n active: false,\n setAdaptConfig: function() {\n },\n slot: null,\n handoff: {\n hidden: true,\n onTransition: function() {\n }\n },\n targetFullyHidden: true,\n registerTarget: function() {\n },\n unregisterTarget: function() {\n },\n registerContents: function() {\n },\n unregisterContents: function() {\n },\n registerRenderCallback: function() {\n },\n unregisterRenderCallback: function() {\n }\n}, {\n keys: adaptContextKeys\n});\nvar AdaptCapabilitiesContext = /* @__PURE__ */ (0, import_react.createContext)({});\nvar LastAdaptContextScope = /* @__PURE__ */ (0, import_react.createContext)(\"\");\nvar AdaptTargetScope = /* @__PURE__ */ (0, import_react.createContext)(null);\nvar useAdaptTargetScope = function() {\n return (0, import_react.useContext)(AdaptTargetScope);\n};\nvar ProvideAdaptContext = function(param) {\n var { children, ...context } = param;\n var scope = context.scopeName || \"\";\n var lastScope = (0, import_react.useContext)(LastAdaptContextScope);\n return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(LastAdaptContextScope.Provider, {\n value: lastScope || context.lastScope || \"\",\n children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(AdaptContext.Provider, {\n scope,\n lastScope: lastScope || context.lastScope,\n ...context,\n children\n })\n });\n};\nvar useAdaptContext = function(scope) {\n var lastScope = (0, import_react.useContext)(LastAdaptContextScope);\n var adaptScope = scope !== null && scope !== void 0 ? scope : lastScope;\n return AdaptContext.useStyledContext(adaptScope);\n};\nfunction findAdaptConfig(children, scope) {\n var _iteratorNormalCompletion = true, _didIteratorError = false, _iteratorError = void 0;\n try {\n for (var _iterator = import_react.default.Children.toArray(children)[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) {\n var child = _step.value;\n if (!/* @__PURE__ */ import_react.default.isValidElement(child)) continue;\n if (child.type === import_react.default.Fragment) {\n var found = findAdaptConfig(child.props.children, scope);\n if (found) return found;\n continue;\n }\n if (child.type === Adapt) {\n var childProps = child.props;\n if (childProps.scope == null || childProps.scope === scope) {\n return childProps;\n }\n }\n }\n } catch (err) {\n _didIteratorError = true;\n _iteratorError = err;\n } finally {\n try {\n if (!_iteratorNormalCompletion && _iterator.return != null) {\n _iterator.return();\n }\n } finally {\n if (_didIteratorError) {\n throw _iteratorError;\n }\n }\n }\n return null;\n}\nvar AdaptParent = function(param) {\n var { children, adaptChildren, Contents, scope, open, onOpenChange, state } = param;\n var id = (0, import_react.useId)();\n var portalName = `AdaptPortal${scope}${id}`;\n var slotRef = import_react.default.useRef(null);\n if (!slotRef.current) {\n slotRef.current = createAdaptSlotStore();\n }\n var staticConfig = import_react.default.useMemo(function() {\n var _findAdaptConfig;\n return (_findAdaptConfig = findAdaptConfig(adaptChildren, scope)) !== null && _findAdaptConfig !== void 0 ? _findAdaptConfig : findAdaptConfig(children, scope);\n }, [\n adaptChildren,\n children,\n scope\n ]);\n var [publishedConfig, setPublishedConfig] = import_react.default.useState(null);\n var rawActive = useAdaptIsActiveGiven(staticConfig !== null && staticConfig !== void 0 ? staticConfig : publishedConfig);\n var staticConfigRef = import_react.default.useRef(staticConfig);\n staticConfigRef.current = staticConfig;\n var setAdaptConfig = import_react.default.useCallback(function(config) {\n if (staticConfigRef.current) return;\n setPublishedConfig(config);\n }, []);\n var [exiting, setExiting] = import_react.default.useState(false);\n var [present, setPresent] = import_react.default.useState(false);\n var [targetFullyHidden, setTargetFullyHidden] = import_react.default.useState(!open);\n var targetCountRef = import_react.default.useRef(0);\n var contentsCountRef = import_react.default.useRef(0);\n var renderCallbackCountRef = import_react.default.useRef(0);\n var rawActiveRef = import_react.default.useRef(false);\n var openRef = import_react.default.useRef(open);\n var wasTargetHiddenRef = import_react.default.useRef(!rawActive);\n var hasHadActiveTargetRef = import_react.default.useRef(false);\n var shouldStartExit = !rawActive && present && Boolean(open);\n var active = rawActive || exiting || shouldStartExit;\n var targetHidden = !rawActive;\n var skipNextAnimation = Boolean(rawActive && wasTargetHiddenRef.current && hasHadActiveTargetRef.current && open);\n var releasePresenceLatch = import_react.default.useCallback(function() {\n setExiting(false);\n if (!rawActiveRef.current) {\n setPresent(false);\n }\n }, []);\n (0, import_constants.useIsomorphicLayoutEffect)(function() {\n if (shouldStartExit) {\n setExiting(true);\n }\n }, [\n shouldStartExit\n ]);\n (0, import_constants.useIsomorphicLayoutEffect)(function() {\n rawActiveRef.current = rawActive;\n openRef.current = open;\n if (rawActive) {\n hasHadActiveTargetRef.current = true;\n }\n wasTargetHiddenRef.current = targetHidden;\n if (open && rawActive) {\n setTargetFullyHidden(false);\n return;\n }\n if (!open && !active) {\n setTargetFullyHidden(true);\n }\n }, [\n active,\n open,\n rawActive,\n targetHidden\n ]);\n (0, import_constants.useIsomorphicLayoutEffect)(function() {\n if (rawActive) {\n setPresent(true);\n } else if (!active) {\n setPresent(false);\n }\n if (rawActive && exiting) {\n setExiting(false);\n }\n }, [\n active,\n exiting,\n rawActive\n ]);\n var handoff = import_react.default.useMemo(function() {\n return {\n hidden: targetHidden,\n skipNextAnimation,\n onTransition(e) {\n if (e.phase !== \"end\" || e.finished === false) return;\n if (e.cause !== \"close\") {\n setTargetFullyHidden(false);\n return;\n }\n if (openRef.current && rawActiveRef.current) {\n setTargetFullyHidden(false);\n return;\n }\n setTargetFullyHidden(true);\n releasePresenceLatch();\n }\n };\n }, [\n releasePresenceLatch,\n skipNextAnimation,\n targetHidden\n ]);\n var registerTarget = import_react.default.useCallback(function() {\n targetCountRef.current += 1;\n if (process.env.NODE_ENV === \"development\" && targetCountRef.current > 1) {\n console.error(`Adapt expected exactly one target in scope \"${scope}\", but ${targetCountRef.current} targets registered.`);\n }\n }, [\n scope\n ]);\n var unregisterTarget = import_react.default.useCallback(function() {\n targetCountRef.current = Math.max(0, targetCountRef.current - 1);\n }, []);\n var registerContents = import_react.default.useCallback(function() {\n contentsCountRef.current += 1;\n }, []);\n var unregisterContents = import_react.default.useCallback(function() {\n contentsCountRef.current = Math.max(0, contentsCountRef.current - 1);\n }, []);\n var registerRenderCallback = import_react.default.useCallback(function() {\n renderCallbackCountRef.current += 1;\n }, []);\n var unregisterRenderCallback = import_react.default.useCallback(function() {\n renderCallbackCountRef.current = Math.max(0, renderCallbackCountRef.current - 1);\n }, []);\n import_react.default.useEffect(function() {\n if (process.env.NODE_ENV !== \"development\") return;\n if (!active) return;\n var timer = setTimeout(function() {\n if (rawActiveRef.current && targetCountRef.current === 0 && contentsCountRef.current === 0 && renderCallbackCountRef.current === 0) {\n console.error(`Adapt is active in scope \"${scope}\" but no target registered with useAdaptTarget(), Adapt.Contents marker, or render callback consumed it.`);\n }\n });\n return function() {\n return clearTimeout(timer);\n };\n }, [\n active,\n scope\n ]);\n var FinalContents = Contents || AdaptSlotContents;\n return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(LastAdaptContextScope.Provider, {\n value: scope,\n children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(ProvideAdaptContext, {\n Contents: FinalContents,\n active,\n setAdaptConfig,\n portalName,\n scopeName: scope,\n slot: slotRef.current,\n open,\n onOpenChange,\n state,\n handoff,\n targetFullyHidden,\n registerTarget,\n unregisterTarget,\n registerContents,\n unregisterContents,\n registerRenderCallback,\n unregisterRenderCallback,\n children\n })\n });\n};\nvar AdaptContents = function(param) {\n var { scope, ...rest } = param;\n var context = useAdaptContext(scope);\n if (!(context === null || context === void 0 ? void 0 : context.Contents)) {\n 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.`);\n }\n (0, import_constants.useIsomorphicLayoutEffect)(function() {\n if (!context.active) return;\n context.registerContents();\n return function() {\n context.unregisterContents();\n };\n }, [\n context.active,\n context.registerContents,\n context.unregisterContents\n ]);\n return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(AdaptTargetScope.Provider, {\n value: null,\n children: /* @__PURE__ */ import_react.default.createElement(context.Contents, {\n ...rest,\n scope,\n key: `stable`\n })\n });\n};\nvar Adapt = (0, import_helpers.withStaticProperties)(function Adapt2(props) {\n var { children, platform, scope, when } = props;\n var context = useAdaptContext(scope);\n var enabled = context.active;\n var isRenderCallback = typeof children === \"function\";\n (0, import_constants.useIsomorphicLayoutEffect)(function() {\n context.setAdaptConfig({\n when,\n platform\n });\n return function() {\n context.setAdaptConfig(null);\n };\n }, [\n when,\n platform,\n context.setAdaptConfig\n ]);\n (0, import_constants.useIsomorphicLayoutEffect)(function() {\n if (!enabled || !isRenderCallback) return;\n context.registerRenderCallback();\n return function() {\n context.unregisterRenderCallback();\n };\n }, [\n enabled,\n isRenderCallback,\n context.registerRenderCallback,\n context.unregisterRenderCallback\n ]);\n var output;\n if (isRenderCallback) {\n var Component = context === null || context === void 0 ? void 0 : context.Contents;\n output = children(Component ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Component, {}) : null, getAdaptRenderState(context));\n } else {\n output = children;\n }\n return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(AdaptTargetScope.Provider, {\n value: context.scopeName,\n children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_z_index_stack.StackZIndexContext, {\n children: !enabled ? null : output\n })\n });\n}, {\n Contents: AdaptContents\n});\nvar AdaptPortalContents = function(props) {\n var isActive = useAdaptIsActive(props.scope);\n var { slot } = useAdaptContext(props.scope);\n return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(AdaptSlotPublisher, {\n isActive,\n slot,\n children: props.children\n });\n};\nfunction AdaptSlotContents(param) {\n var { scope } = param;\n var { slot } = useAdaptContext(scope);\n var _slot_subscribe, _slot_getSnapshot, _slot_getSnapshot1;\n import_react.default.useSyncExternalStore((_slot_subscribe = slot === null || slot === void 0 ? void 0 : slot.subscribe) !== null && _slot_subscribe !== void 0 ? _slot_subscribe : emptySubscribe, (_slot_getSnapshot = slot === null || slot === void 0 ? void 0 : slot.getSnapshot) !== null && _slot_getSnapshot !== void 0 ? _slot_getSnapshot : emptySnapshot, (_slot_getSnapshot1 = slot === null || slot === void 0 ? void 0 : slot.getSnapshot) !== null && _slot_getSnapshot1 !== void 0 ? _slot_getSnapshot1 : emptySnapshot);\n var _slot_element;\n return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_jsx_runtime.Fragment, {\n children: (_slot_element = slot === null || slot === void 0 ? void 0 : slot.element) !== null && _slot_element !== void 0 ? _slot_element : null\n });\n}\nfunction AdaptSlotPublisher(param) {\n var { isActive, slot, children } = param;\n var publishedRef = import_react.default.useRef(null);\n (0, import_constants.useIsomorphicLayoutEffect)(function() {\n if (!slot) return;\n var published = publishedRef.current;\n if (published && published.isActive === isActive && published.element === children) {\n return;\n }\n publishedRef.current = {\n isActive,\n element: children\n };\n if (isActive) {\n slot.publish(children);\n } else {\n slot.clear();\n }\n slot.notify();\n });\n (0, import_constants.useIsomorphicLayoutEffect)(function() {\n return function() {\n var _publishedRef_current;\n if ((_publishedRef_current = publishedRef.current) === null || _publishedRef_current === void 0 ? void 0 : _publishedRef_current.isActive) {\n slot === null || slot === void 0 ? void 0 : slot.clear();\n slot === null || slot === void 0 ? void 0 : slot.notify();\n }\n publishedRef.current = null;\n };\n }, [\n slot\n ]);\n return isActive ? null : /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_jsx_runtime.Fragment, {\n children\n });\n}\nvar emptySubscribe = function() {\n return function() {\n };\n};\nvar emptySnapshot = function() {\n return 0;\n};\nvar useAdaptIsActiveGiven = function(config) {\n var media = (0, import_core.useMedia)();\n var when = config === null || config === void 0 ? void 0 : config.when;\n var platform = config === null || config === void 0 ? void 0 : config.platform;\n if (when == null && platform == null) {\n return false;\n }\n var enabled = false;\n if (platform === \"touch\") enabled = import_constants.isTouchable;\n else if (platform === \"native\") enabled = !import_constants.isWeb;\n else if (platform === \"web\") enabled = import_constants.isWeb;\n else if (platform === \"ios\") enabled = import_constants.isIos;\n else if (platform === \"android\") enabled = import_constants.isAndroid;\n if (platform && enabled == false) {\n return false;\n }\n if (when === true) {\n return true;\n }\n if (when && typeof when === \"string\") {\n enabled = media[when];\n }\n return enabled;\n};\nvar useAdaptIsActive = function(scope) {\n return useAdaptContext(scope).active;\n};\nfunction useAdaptTarget(scope) {\n var context = useAdaptContext(scope);\n var targetScope = useAdaptTargetScope();\n var isTarget = scope !== void 0 || targetScope === context.scopeName;\n (0, import_constants.useIsomorphicLayoutEffect)(function() {\n if (!context.active || !isTarget) return;\n context.registerTarget();\n return function() {\n context.unregisterTarget();\n };\n }, [\n context.active,\n context.registerTarget,\n context.unregisterTarget,\n isTarget\n ]);\n if (!context.active || !isTarget) {\n return null;\n }\n return {\n open: context.open,\n onOpenChange: context.onOpenChange,\n handoff: context.handoff,\n state: context.state\n };\n}\nvar AdaptCapabilities = function(param) {\n var { children, scroll, overlay, dismiss } = param;\n var parent = (0, import_react.useContext)(AdaptCapabilitiesContext);\n var value = import_react.default.useMemo(function() {\n return {\n scroll: scroll !== null && scroll !== void 0 ? scroll : parent.scroll,\n overlay: overlay !== null && overlay !== void 0 ? overlay : parent.overlay,\n dismiss: dismiss !== null && dismiss !== void 0 ? dismiss : parent.dismiss\n };\n }, [\n dismiss,\n overlay,\n parent.dismiss,\n parent.overlay,\n parent.scroll,\n scroll\n ]);\n return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(AdaptCapabilitiesContext.Provider, {\n value,\n children\n });\n};\nvar useAdaptedCapabilities = function() {\n return (0, import_react.useContext)(AdaptCapabilitiesContext);\n};\nfunction getAdaptRenderState(context) {\n return {\n active: context.active,\n open: context.open,\n onOpenChange: context.onOpenChange,\n state: context.state,\n handoff: context.handoff\n };\n}\n//# sourceMappingURL=Adapt.js.map\n"],"mappings":";;;AACA,IAAI,WAAW,OAAO;AACtB,IAAI,YAAY,OAAO;AACvB,IAAI,mBAAmB,OAA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