tamagui 3.0.10 → 3.0.11

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/native.cjs CHANGED
@@ -15544,6 +15544,7 @@ function setNativeStyleEngine(next) {
15544
15544
  scopeMappings.clear();
15545
15545
  pendingHosts = [];
15546
15546
  pendingStates = [];
15547
+ resetNativeStyleDiscovery();
15547
15548
  }
15548
15549
  engine = next;
15549
15550
  if (next) {
@@ -15606,12 +15607,58 @@ function removeNativeStyleScope(scopeId) {
15606
15607
  });
15607
15608
  engine === null || engine === void 0 || engine.removeScope(scopeId);
15608
15609
  }
15610
+ function hostKey(host) {
15611
+ var _ref, _ref1;
15612
+ var _record___internalInstanceHandle;
15613
+ var record = host;
15614
+ var instance = (_ref = (_record___internalInstanceHandle = record.__internalInstanceHandle) === null || _record___internalInstanceHandle === void 0 ? void 0 : _record___internalInstanceHandle.stateNode) !== null && _ref !== void 0 ? _ref : record.stateNode;
15615
+ return (_ref1 = instance === null || instance === void 0 ? void 0 : instance.canonical) !== null && _ref1 !== void 0 ? _ref1 : host;
15616
+ }
15617
+ function resetNativeStyleDiscovery() {
15618
+ fiberRoot = null;
15619
+ needsDiscover = false;
15620
+ linkedHostState = /* @__PURE__ */ new WeakMap();
15621
+ }
15622
+ function discoverMountedHosts() {
15623
+ var root = fiberRoot === null || fiberRoot === void 0 ? void 0 : fiberRoot.current;
15624
+ if (!root || root.stateNode !== fiberRoot) return 0;
15625
+ var stack = [root];
15626
+ var found = 0;
15627
+ for (var guard = 0; stack.length && guard < 1e5; guard++) {
15628
+ var _fiber_memoizedProps, _fiber_stateNode;
15629
+ var fiber = stack.pop();
15630
+ if (fiber.sibling) stack.push(fiber.sibling);
15631
+ if (fiber.child) stack.push(fiber.child);
15632
+ var style = (_fiber_memoizedProps = fiber.memoizedProps) === null || _fiber_memoizedProps === void 0 ? void 0 : _fiber_memoizedProps.style;
15633
+ if (!style) continue;
15634
+ var state = stylesToState.get(style);
15635
+ if (!state || !((_fiber_stateNode = fiber.stateNode) === null || _fiber_stateNode === void 0 ? void 0 : _fiber_stateNode.node)) continue;
15636
+ found++;
15637
+ linkNativeStyleHost(fiber, state);
15638
+ }
15639
+ return found;
15640
+ }
15641
+ function idleFlush() {
15642
+ idleFlushQueued = false;
15643
+ flushNativeStyleLinks();
15644
+ }
15645
+ function queueIdleFlush() {
15646
+ if (idleFlushQueued) return;
15647
+ idleFlushQueued = true;
15648
+ requestIdleCallback(idleFlush);
15649
+ }
15609
15650
  function addScopeMapping(scopeId, compiled) {
15610
15651
  var linked = scopeMappings.get(scopeId);
15611
15652
  if (!linked) scopeMappings.set(scopeId, linked = /* @__PURE__ */ new Set());
15612
15653
  linked.add(compiled);
15613
15654
  }
15614
15655
  function flushNativeStyleLinks() {
15656
+ if (needsDiscover) {
15657
+ needsDiscover = false;
15658
+ var current = fiberRoot === null || fiberRoot === void 0 ? void 0 : fiberRoot.current;
15659
+ if (!current || current.stateNode !== fiberRoot) fiberRoot = null;
15660
+ else discoverMountedHosts();
15661
+ }
15615
15662
  if (!pendingHosts.length) return;
15616
15663
  var hosts = pendingHosts;
15617
15664
  var states = pendingStates;
@@ -15640,6 +15687,24 @@ function flushNativeStyleLinks() {
15640
15687
  }
15641
15688
  engine.linkTables(hosts, tableIds, scopeIndexes, scopes);
15642
15689
  }
15690
+ function linkNativeStyleHost(host, state) {
15691
+ if (!engine || host == null) return;
15692
+ var key = hostKey(host);
15693
+ var linked = linkedHostState.get(key);
15694
+ if (linked && linked.mapping === state.mapping && linked.scopeId === state.scopeId) return;
15695
+ linkedHostState.set(key, state);
15696
+ var live = scopeStates.get(state.scopeId);
15697
+ if (live && (live.name !== state.stateName || live.theme !== state.theme)) {
15698
+ var compiled = getCompiledMapping(state.mapping);
15699
+ syncTableState(compiled, live.name, live.theme);
15700
+ addScopeMapping(state.scopeId, compiled);
15701
+ engine.link(host, compiled.tableId, state.scopeId, true);
15702
+ return;
15703
+ }
15704
+ pendingHosts.push(host);
15705
+ pendingStates.push(state);
15706
+ if (pendingHosts.length >= maxPendingHosts) queueIdleFlush();
15707
+ }
15643
15708
  function updateNativeStyleLink(ref, host) {
15644
15709
  if (ref.nativeLink) {
15645
15710
  ref.nativeLink.unlink();
@@ -15672,7 +15737,7 @@ function supersedeNativeViewStates(id) {
15672
15737
  if (!pending) return;
15673
15738
  (superseded || (superseded = /* @__PURE__ */ new Map())).set(id, pending.length);
15674
15739
  }
15675
- var nativeTextInputColorProps, nativeOutlineProps, nativeIntrinsicSizeProps, engine, scopeStates, mappingKeys, compiledMappings, scopeMappings, nextTableId, pendingHosts, pendingStates, pending, flushListener, superseded;
15740
+ var nativeTextInputColorProps, nativeOutlineProps, nativeIntrinsicSizeProps, engine, scopeStates, mappingKeys, compiledMappings, scopeMappings, nextTableId, pendingHosts, pendingStates, maxPendingHosts, idleFlushQueued, stylesToState, linkedHostState, fiberRoot, needsDiscover, pending, flushListener, superseded;
15676
15741
  var init_nativeStyleEngine_native = __esmMin((() => {
15677
15742
  init_createVariable_native();
15678
15743
  init_objectSpread2();
@@ -15704,6 +15769,12 @@ var init_nativeStyleEngine_native = __esmMin((() => {
15704
15769
  nextTableId = 1;
15705
15770
  pendingHosts = [];
15706
15771
  pendingStates = [];
15772
+ maxPendingHosts = 4096;
15773
+ idleFlushQueued = false;
15774
+ stylesToState = /* @__PURE__ */ new WeakMap();
15775
+ linkedHostState = /* @__PURE__ */ new WeakMap();
15776
+ fiberRoot = null;
15777
+ needsDiscover = false;
15707
15778
  pending = null;
15708
15779
  flushListener = null;
15709
15780
  superseded = null;
@@ -20208,8 +20279,8 @@ function createComponent(staticConfig) {
20208
20279
  var childrenFromHooks = hooks.useChildren ? hooks.useChildren(elementType, children, viewProps, isPassthrough) : void 0;
20209
20280
  if (isPassthrough) content = /* @__PURE__ */ react$1.default.createElement(BaseComponent, { style: { display: "contents" } }, propsIn.children);
20210
20281
  else {
20211
- if (childrenFromHooks) content = childrenFromHooks;
20212
20282
  var isRenderPropString = typeof renderProp === "string";
20283
+ if (childrenFromHooks && (!renderProp || isRenderPropString)) content = childrenFromHooks;
20213
20284
  if (renderProp && !isRenderPropString) {
20214
20285
  var out = getCustomRender(renderProp, content || children, viewProps, componentState);
20215
20286
  if (out) {
package/dist/test.cjs CHANGED
@@ -15747,6 +15747,7 @@ function setNativeStyleEngine(next) {
15747
15747
  scopeMappings.clear();
15748
15748
  pendingHosts = [];
15749
15749
  pendingStates = [];
15750
+ resetNativeStyleDiscovery();
15750
15751
  }
15751
15752
  engine = next;
15752
15753
  if (next) {
@@ -15809,12 +15810,58 @@ function removeNativeStyleScope(scopeId) {
15809
15810
  });
15810
15811
  engine === null || engine === void 0 || engine.removeScope(scopeId);
15811
15812
  }
15813
+ function hostKey(host) {
15814
+ var _ref, _ref1;
15815
+ var _record___internalInstanceHandle;
15816
+ var record = host;
15817
+ var instance = (_ref = (_record___internalInstanceHandle = record.__internalInstanceHandle) === null || _record___internalInstanceHandle === void 0 ? void 0 : _record___internalInstanceHandle.stateNode) !== null && _ref !== void 0 ? _ref : record.stateNode;
15818
+ return (_ref1 = instance === null || instance === void 0 ? void 0 : instance.canonical) !== null && _ref1 !== void 0 ? _ref1 : host;
15819
+ }
15820
+ function resetNativeStyleDiscovery() {
15821
+ fiberRoot = null;
15822
+ needsDiscover = false;
15823
+ linkedHostState = /* @__PURE__ */ new WeakMap();
15824
+ }
15825
+ function discoverMountedHosts() {
15826
+ var root = fiberRoot === null || fiberRoot === void 0 ? void 0 : fiberRoot.current;
15827
+ if (!root || root.stateNode !== fiberRoot) return 0;
15828
+ var stack = [root];
15829
+ var found = 0;
15830
+ for (var guard = 0; stack.length && guard < 1e5; guard++) {
15831
+ var _fiber_memoizedProps, _fiber_stateNode;
15832
+ var fiber = stack.pop();
15833
+ if (fiber.sibling) stack.push(fiber.sibling);
15834
+ if (fiber.child) stack.push(fiber.child);
15835
+ var style = (_fiber_memoizedProps = fiber.memoizedProps) === null || _fiber_memoizedProps === void 0 ? void 0 : _fiber_memoizedProps.style;
15836
+ if (!style) continue;
15837
+ var state = stylesToState.get(style);
15838
+ if (!state || !((_fiber_stateNode = fiber.stateNode) === null || _fiber_stateNode === void 0 ? void 0 : _fiber_stateNode.node)) continue;
15839
+ found++;
15840
+ linkNativeStyleHost(fiber, state);
15841
+ }
15842
+ return found;
15843
+ }
15844
+ function idleFlush() {
15845
+ idleFlushQueued = false;
15846
+ flushNativeStyleLinks();
15847
+ }
15848
+ function queueIdleFlush() {
15849
+ if (idleFlushQueued) return;
15850
+ idleFlushQueued = true;
15851
+ requestIdleCallback(idleFlush);
15852
+ }
15812
15853
  function addScopeMapping(scopeId, compiled) {
15813
15854
  var linked = scopeMappings.get(scopeId);
15814
15855
  if (!linked) scopeMappings.set(scopeId, linked = /* @__PURE__ */ new Set());
15815
15856
  linked.add(compiled);
15816
15857
  }
15817
15858
  function flushNativeStyleLinks() {
15859
+ if (needsDiscover) {
15860
+ needsDiscover = false;
15861
+ var current = fiberRoot === null || fiberRoot === void 0 ? void 0 : fiberRoot.current;
15862
+ if (!current || current.stateNode !== fiberRoot) fiberRoot = null;
15863
+ else discoverMountedHosts();
15864
+ }
15818
15865
  if (!pendingHosts.length) return;
15819
15866
  var hosts = pendingHosts;
15820
15867
  var states = pendingStates;
@@ -15843,6 +15890,24 @@ function flushNativeStyleLinks() {
15843
15890
  }
15844
15891
  engine.linkTables(hosts, tableIds, scopeIndexes, scopes);
15845
15892
  }
15893
+ function linkNativeStyleHost(host, state) {
15894
+ if (!engine || host == null) return;
15895
+ var key = hostKey(host);
15896
+ var linked = linkedHostState.get(key);
15897
+ if (linked && linked.mapping === state.mapping && linked.scopeId === state.scopeId) return;
15898
+ linkedHostState.set(key, state);
15899
+ var live = scopeStates.get(state.scopeId);
15900
+ if (live && (live.name !== state.stateName || live.theme !== state.theme)) {
15901
+ var compiled = getCompiledMapping(state.mapping);
15902
+ syncTableState(compiled, live.name, live.theme);
15903
+ addScopeMapping(state.scopeId, compiled);
15904
+ engine.link(host, compiled.tableId, state.scopeId, true);
15905
+ return;
15906
+ }
15907
+ pendingHosts.push(host);
15908
+ pendingStates.push(state);
15909
+ if (pendingHosts.length >= maxPendingHosts) queueIdleFlush();
15910
+ }
15846
15911
  function updateNativeStyleLink(ref, host) {
15847
15912
  if (ref.nativeLink) {
15848
15913
  ref.nativeLink.unlink();
@@ -15875,7 +15940,7 @@ function supersedeNativeViewStates(id) {
15875
15940
  if (!pending) return;
15876
15941
  (superseded || (superseded = /* @__PURE__ */ new Map())).set(id, pending.length);
15877
15942
  }
15878
- var nativeTextInputColorProps, nativeOutlineProps, nativeIntrinsicSizeProps, engine, scopeStates, mappingKeys, compiledMappings, scopeMappings, nextTableId, pendingHosts, pendingStates, pending, flushListener, superseded;
15943
+ var nativeTextInputColorProps, nativeOutlineProps, nativeIntrinsicSizeProps, engine, scopeStates, mappingKeys, compiledMappings, scopeMappings, nextTableId, pendingHosts, pendingStates, maxPendingHosts, idleFlushQueued, stylesToState, linkedHostState, fiberRoot, needsDiscover, pending, flushListener, superseded;
15879
15944
  var init_nativeStyleEngine_native = __esmMin((() => {
15880
15945
  init_createVariable_native();
15881
15946
  init_objectSpread2();
@@ -15907,6 +15972,12 @@ var init_nativeStyleEngine_native = __esmMin((() => {
15907
15972
  nextTableId = 1;
15908
15973
  pendingHosts = [];
15909
15974
  pendingStates = [];
15975
+ maxPendingHosts = 4096;
15976
+ idleFlushQueued = false;
15977
+ stylesToState = /* @__PURE__ */ new WeakMap();
15978
+ linkedHostState = /* @__PURE__ */ new WeakMap();
15979
+ fiberRoot = null;
15980
+ needsDiscover = false;
15910
15981
  pending = null;
15911
15982
  flushListener = null;
15912
15983
  superseded = null;
@@ -20435,8 +20506,8 @@ function createComponent(staticConfig) {
20435
20506
  var childrenFromHooks = hooks.useChildren ? hooks.useChildren(elementType, children, viewProps, isPassthrough) : void 0;
20436
20507
  if (isPassthrough) content = /* @__PURE__ */ react$1.default.createElement(BaseComponent, { style: { display: "contents" } }, propsIn.children);
20437
20508
  else {
20438
- if (childrenFromHooks) content = childrenFromHooks;
20439
20509
  var isRenderPropString = typeof renderProp === "string";
20510
+ if (childrenFromHooks && (!renderProp || isRenderPropString)) content = childrenFromHooks;
20440
20511
  if (renderProp && !isRenderPropString) {
20441
20512
  var out = getCustomRender(renderProp, content || children, viewProps, componentState);
20442
20513
  if (out) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "tamagui",
3
- "version": "3.0.10",
3
+ "version": "3.0.11",
4
4
  "license": "MIT",
5
5
  "gitHead": "a49cc7ea6b93ba384e77a4880ae48ac4a5635c14",
6
6
  "description": "Style and UI for React (web and native) meet an optimizing compiler",
@@ -315,73 +315,73 @@
315
315
  "check-circular-deps": "npx madge --circular ./src/index.ts"
316
316
  },
317
317
  "dependencies": {
318
- "@tamagui/accordion": "3.0.10",
319
- "@tamagui/adapt": "3.0.10",
320
- "@tamagui/alert-dialog": "3.0.10",
321
- "@tamagui/animate": "3.0.10",
322
- "@tamagui/animate-presence": "3.0.10",
323
- "@tamagui/avatar": "3.0.10",
324
- "@tamagui/button": "3.0.10",
325
- "@tamagui/card": "3.0.10",
326
- "@tamagui/checkbox": "3.0.10",
327
- "@tamagui/collapsible": "3.0.10",
328
- "@tamagui/compose-refs": "3.0.10",
329
- "@tamagui/constants": "3.0.10",
330
- "@tamagui/context-menu": "3.0.10",
331
- "@tamagui/core": "3.0.10",
332
- "@tamagui/create-context": "3.0.10",
333
- "@tamagui/create-menu": "3.0.10",
334
- "@tamagui/dialog": "3.0.10",
335
- "@tamagui/element": "3.0.10",
336
- "@tamagui/fake-react-native": "3.0.10",
337
- "@tamagui/field": "3.0.10",
338
- "@tamagui/focusable": "3.0.10",
339
- "@tamagui/font-size": "3.0.10",
340
- "@tamagui/form": "3.0.10",
341
- "@tamagui/get-font-sized": "3.0.10",
342
- "@tamagui/get-token": "3.0.10",
343
- "@tamagui/group": "3.0.10",
344
- "@tamagui/helpers-tamagui": "3.0.10",
345
- "@tamagui/image": "3.0.10",
346
- "@tamagui/input": "3.0.10",
347
- "@tamagui/label": "3.0.10",
348
- "@tamagui/linear-gradient": "3.0.10",
349
- "@tamagui/list-item": "3.0.10",
350
- "@tamagui/menu": "3.0.10",
351
- "@tamagui/polyfill-dev": "3.0.10",
352
- "@tamagui/popover": "3.0.10",
353
- "@tamagui/popper": "3.0.10",
354
- "@tamagui/portal": "3.0.10",
355
- "@tamagui/progress": "3.0.10",
356
- "@tamagui/radio-group": "3.0.10",
357
- "@tamagui/react-native-media-driver": "3.0.10",
358
- "@tamagui/react-native-types": "3.0.10",
359
- "@tamagui/scroll-view": "3.0.10",
360
- "@tamagui/select": "3.0.10",
361
- "@tamagui/separator": "3.0.10",
362
- "@tamagui/shapes": "3.0.10",
363
- "@tamagui/sheet": "3.0.10",
364
- "@tamagui/slider": "3.0.10",
365
- "@tamagui/spacer": "3.0.10",
366
- "@tamagui/spinner": "3.0.10",
367
- "@tamagui/stacks": "3.0.10",
368
- "@tamagui/switch": "3.0.10",
369
- "@tamagui/tabs": "3.0.10",
370
- "@tamagui/text": "3.0.10",
371
- "@tamagui/theme": "3.0.10",
372
- "@tamagui/toast": "3.0.10",
373
- "@tamagui/toggle-group": "3.0.10",
374
- "@tamagui/tooltip": "3.0.10",
375
- "@tamagui/ui": "3.0.10",
376
- "@tamagui/use-controllable-state": "3.0.10",
377
- "@tamagui/use-debounce": "3.0.10",
378
- "@tamagui/use-force-update": "3.0.10",
379
- "@tamagui/use-window-dimensions": "3.0.10",
380
- "@tamagui/visually-hidden": "3.0.10",
381
- "@tamagui/z-index-stack": "3.0.10"
318
+ "@tamagui/accordion": "3.0.11",
319
+ "@tamagui/adapt": "3.0.11",
320
+ "@tamagui/alert-dialog": "3.0.11",
321
+ "@tamagui/animate": "3.0.11",
322
+ "@tamagui/animate-presence": "3.0.11",
323
+ "@tamagui/avatar": "3.0.11",
324
+ "@tamagui/button": "3.0.11",
325
+ "@tamagui/card": "3.0.11",
326
+ "@tamagui/checkbox": "3.0.11",
327
+ "@tamagui/collapsible": "3.0.11",
328
+ "@tamagui/compose-refs": "3.0.11",
329
+ "@tamagui/constants": "3.0.11",
330
+ "@tamagui/context-menu": "3.0.11",
331
+ "@tamagui/core": "3.0.11",
332
+ "@tamagui/create-context": "3.0.11",
333
+ "@tamagui/create-menu": "3.0.11",
334
+ "@tamagui/dialog": "3.0.11",
335
+ "@tamagui/element": "3.0.11",
336
+ "@tamagui/fake-react-native": "3.0.11",
337
+ "@tamagui/field": "3.0.11",
338
+ "@tamagui/focusable": "3.0.11",
339
+ "@tamagui/font-size": "3.0.11",
340
+ "@tamagui/form": "3.0.11",
341
+ "@tamagui/get-font-sized": "3.0.11",
342
+ "@tamagui/get-token": "3.0.11",
343
+ "@tamagui/group": "3.0.11",
344
+ "@tamagui/helpers-tamagui": "3.0.11",
345
+ "@tamagui/image": "3.0.11",
346
+ "@tamagui/input": "3.0.11",
347
+ "@tamagui/label": "3.0.11",
348
+ "@tamagui/linear-gradient": "3.0.11",
349
+ "@tamagui/list-item": "3.0.11",
350
+ "@tamagui/menu": "3.0.11",
351
+ "@tamagui/polyfill-dev": "3.0.11",
352
+ "@tamagui/popover": "3.0.11",
353
+ "@tamagui/popper": "3.0.11",
354
+ "@tamagui/portal": "3.0.11",
355
+ "@tamagui/progress": "3.0.11",
356
+ "@tamagui/radio-group": "3.0.11",
357
+ "@tamagui/react-native-media-driver": "3.0.11",
358
+ "@tamagui/react-native-types": "3.0.11",
359
+ "@tamagui/scroll-view": "3.0.11",
360
+ "@tamagui/select": "3.0.11",
361
+ "@tamagui/separator": "3.0.11",
362
+ "@tamagui/shapes": "3.0.11",
363
+ "@tamagui/sheet": "3.0.11",
364
+ "@tamagui/slider": "3.0.11",
365
+ "@tamagui/spacer": "3.0.11",
366
+ "@tamagui/spinner": "3.0.11",
367
+ "@tamagui/stacks": "3.0.11",
368
+ "@tamagui/switch": "3.0.11",
369
+ "@tamagui/tabs": "3.0.11",
370
+ "@tamagui/text": "3.0.11",
371
+ "@tamagui/theme": "3.0.11",
372
+ "@tamagui/toast": "3.0.11",
373
+ "@tamagui/toggle-group": "3.0.11",
374
+ "@tamagui/tooltip": "3.0.11",
375
+ "@tamagui/ui": "3.0.11",
376
+ "@tamagui/use-controllable-state": "3.0.11",
377
+ "@tamagui/use-debounce": "3.0.11",
378
+ "@tamagui/use-force-update": "3.0.11",
379
+ "@tamagui/use-window-dimensions": "3.0.11",
380
+ "@tamagui/visually-hidden": "3.0.11",
381
+ "@tamagui/z-index-stack": "3.0.11"
382
382
  },
383
383
  "devDependencies": {
384
- "@tamagui/build": "3.0.10",
384
+ "@tamagui/build": "3.0.11",
385
385
  "react": "19.2.3",
386
386
  "react-native": "0.87.1",
387
387
  "react-native-web": "~0.21.0"
@@ -400,5 +400,5 @@
400
400
  ],
401
401
  "module:jsx": "dist/jsx",
402
402
  "removeSideEffects": true,
403
- "releaseSourceCommit": "bd0af4e3ff768a30f8214da3d44eb0e4ceb21731"
403
+ "releaseSourceCommit": "2126db6e1f5389c724e21f06ce7d7e7d9f49f4aa"
404
404
  }