An open source design system that's fully customizable and agent ready
TypeScript
revert(theme): restore local stacking contracts (#6031)
Cindy Zhang6e6b9b476713
diff --git a/packages/charts/src/ChartTooltip.test.tsx b/packages/charts/src/ChartTooltip.test.tsxindex 1afd71d21d..fe6c820ec3 100644--- a/packages/charts/src/ChartTooltip.test.tsx+++ b/packages/charts/src/ChartTooltip.test.tsx@@ -4,8 +4,8 @@* @file ChartTooltip.test.tsx* @input Uses vitest, @testing-library/react, ChartTooltip, ChartProvider,* d3-scale- * @output Functional tests for the grouped tooltip — owner-local popover- * lifecycle, pointer subscription, card content/visibility, hover dots, crosshair vs band+ * @output Functional tests for the grouped tooltip — portal lifecycle, pointer+ * subscription, card content/visibility, hover dots, crosshair vs band* highlight, and the custom render contract* @position Colocated test for ChartTooltip.tsx (issue #4295 viz coverage).* Renders under a hand-built ChartProvider so the pointer stream can@@ -97,7 +97,7 @@ function renderTooltip() {return render(<ChartProvider value={harness.ctx}>- <svg ref={harness.ctx.svgRef}>+ <svg><g><ChartTooltip series={[makeSeries()]} {...props} /></g>@@ -122,61 +122,17 @@ const pointerLeave: ChartPointerEvent = {const card = () => document.querySelector('[role="tooltip"]') as HTMLElement;-function cssDeclarationsOf(el: Element): string[] {- const classes = new Set(- (el as HTMLElement).className.split(/\s+/).filter(Boolean),- );- const declarations: string[] = [];-- for (const sheet of Array.from(document.styleSheets)) {- for (const rule of Array.from(sheet.cssRules)) {- const text = rule.cssText;- const brace = text.indexOf('{');- if (brace === -1) {- continue;- }- const selector = text.slice(0, brace).replaceAll(':not(#\\#)', '').trim();- const match = /^\.([\w-]+)(.*)$/.exec(selector);- if (!match || !classes.has(match[1])) {- continue;- }- declarations.push(- text- .slice(brace + 1, text.lastIndexOf('}'))- .trim()- .replace(/;$/, ''),- );- }- }-- return declarations;-}-describe('ChartTooltip card', () => {- it('hosts the manual popover beside its owning chart', () => {+ it('portals an initially empty tooltip card into document.body', () => {const harness = makeHarness();const {container} = renderTooltip(harness);expect(card()).not.toBeNull();- expect(card().parentElement).toBe(container);- expect(card()).toHaveAttribute('popover', 'manual');+ expect(card().parentElement).toBe(document.body);+ // The card lives outside the chart subtree.+ expect(container.querySelector('[role="tooltip"]')).toBeNull();expect(card().textContent).toBe('');});- it('resets native popover centering before applying fixed coordinates', () => {- const harness = makeHarness();- renderTooltip(harness);- const declarations = cssDeclarationsOf(card());- expect(declarations.some(value => value.startsWith('inset: auto'))).toBe(- true,- );- expect(- declarations.some(value => value.startsWith('margin-block: 0')),- ).toBe(true);- expect(- declarations.some(value => value.startsWith('margin-inline: 0')),- ).toBe(true);- });-it('shows the hovered x value and the bare value for a single series', () => {const harness = makeHarness();renderTooltip(harness);diff --git a/packages/charts/src/ChartTooltip.tsx b/packages/charts/src/ChartTooltip.tsxindex ed114edd0b..7ecf51cf1e 100644--- a/packages/charts/src/ChartTooltip.tsx+++ b/packages/charts/src/ChartTooltip.tsx@@ -4,8 +4,7 @@* @file ChartTooltip.tsx* @output Grouped chart tooltip — shows all series values at the hovered x-position.* Composable: drop into `<Chart tooltip>` or render directly inside a chart- * to take full control of props. The card stays beside its owning chart- * and uses a manual popover to escape clipping and nested layer stacks.+ * to take full control of props.* @position Reads from ChartContext — must render inside an <Chart>.** @example@@ -37,7 +36,6 @@ import {import {createPortal} from 'react-dom';import * as stylex from '@stylexjs/stylex';import {- appearanceVars,colorVars,radiusVars,shadowVars,@@ -94,13 +92,8 @@ export interface ChartTooltipProps {const styles = stylex.create({// Card chrome — static visual styles. Position (left/top/display) is updated// imperatively via ref to keep pointer-move cost free of React renders.- // The layer token is the reduced-browser fallback; supported browsers promote- // the owner-local manual popover into the native top layer.card: {position: 'fixed',- inset: 'auto',- marginBlock: 0,- marginInline: 0,backgroundColor: colorVars['--color-background-popover'],border: `1px solid ${colorVars['--color-border']}`,borderRadius: radiusVars['--radius-container'],@@ -109,7 +102,7 @@ const styles = stylex.create({boxShadow: shadowVars['--shadow-med'],pointerEvents: 'none',whiteSpace: 'nowrap',- zIndex: appearanceVars['--appearance-layer-nesting'],+ zIndex: 9999,display: 'none',},crosshair: {@@ -118,34 +111,6 @@ const styles = stylex.create({},});-function showCard(card: HTMLDivElement): void {- // The fallback display must be applied first: showPopover() rejects elements- // that are still display:none.- card.style.display = 'block';- if (typeof card.showPopover === 'function') {- try {- if (!card.matches(':popover-open')) {- card.showPopover();- }- } catch {- // The reduced browser path below still makes the card visible.- }- }-}--function hideCard(card: HTMLDivElement): void {- if (typeof card.hidePopover === 'function') {- try {- if (card.matches(':popover-open')) {- card.hidePopover();- }- } catch {- // The reduced browser path below still hides the card.- }- }- card.style.display = 'none';-}-/** Default tooltip body — used when `render` is not provided. */const DefaultTooltipContent = memo(function DefaultTooltipContent({xValue,@@ -207,7 +172,6 @@ export function ChartTooltip({height,} = useChart();const [hoveredIndex, setHoveredIndex] = useState<number | null>(null);- const [portalTarget, setPortalTarget] = useState<HTMLElement | null>(null);const cardRef = useRef<HTMLDivElement>(null);// Whether the card is currently suppressed (no content, or a custom `render`// opted out by returning null). positionCard reads this so a same-index@@ -219,13 +183,6 @@ export function ChartTooltip({// Recomputed only when the resolved map identity changes (per layout pass).const resolvedKeys = useMemo(() => new Set(resolved.keys()), [resolved]);- // Host the manual popover beside the chart rather than at document.body.- // Native top-layer promotion still escapes chart clipping, while the DOM- // position keeps nested theme variables and the owning Drawer relationship.- useEffect(() => {- setPortalTarget(svgRef.current?.parentElement ?? null);- }, [svgRef]);-// ─── Card positioning ──────────────────────────────────────────────────// Imperative — the card is portaled, and we don't want pointer-move to// trigger React renders.@@ -237,10 +194,9 @@ export function ChartTooltip({return;}if (!svg || !e.nearest || cardHiddenRef.current) {- hideCard(card);+ card.style.display = 'none';return;}- showCard(card);const svgRect = svg.getBoundingClientRect();const screenX = svgRect.left + margin.left + e.nearest.px;const screenY = svgRect.top + margin.top;@@ -281,6 +237,7 @@ export function ChartTooltip({card.style.left = `${x}px`;card.style.top = `${y}px`;+ card.style.display = 'block';},[svgRef, margin, placement],);@@ -432,7 +389,7 @@ export function ChartTooltip({if (hidden) {const card = cardRef.current;if (card) {- hideCard(card);+ card.style.display = 'none';}}}, [render, hoveredIndex, datum, xValue, seriesValues]);@@ -462,17 +419,12 @@ export function ChartTooltip({<>{hoverIndicatorElement}{dots}- {portalTarget != null &&- createPortal(- <div- ref={cardRef}- role="tooltip"- popover="manual"- {...stylex.props(styles.card)}>- {cardContent}- </div>,- portalTarget,- )}+ {createPortal(+ <div ref={cardRef} role="tooltip" {...stylex.props(styles.card)}>+ {cardContent}+ </div>,+ document.body,+ )}</>);}diff --git a/packages/cli/assets/docs/tokens.doc.mjs b/packages/cli/assets/docs/tokens.doc.mjsindex cb1988f16f..8991ae4734 100644--- a/packages/cli/assets/docs/tokens.doc.mjs+++ b/packages/cli/assets/docs/tokens.doc.mjs@@ -3,7 +3,7 @@// AUTO-GENERATED — do not edit manually.// Source: packages/core/src/theme/tokens.stylex.ts// Run: node scripts/generate-token-docs.mjs-// Total: 190 tokens across 14 categories.+// Total: 188 tokens across 13 categories./** @type {import('@astryxdesign/cli/authoring').ReferenceDoc} */@@ -693,32 +693,6 @@ export const docs = {],"previewType": "shadow-box"},- {- "title": "Appearance Tokens",- "content": [- {- "type": "prose",- "text": "Relative stacking steps for ordinary nested containers and floating layers. Native popovers and modal dialogs use the browser top layer instead."- },- {- "type": "table",- "headers": [- "Token",- "Value"- ],- "rows": [- [- "--appearance-container-nesting",- "10"- ],- [- "--appearance-layer-nesting",- "50"- ]- ]- }- ]- },{"title": "Duration Tokens","content": [diff --git a/packages/cli/assets/theme.template.ts b/packages/cli/assets/theme.template.tsindex 4d7ffd1df0..4215ef4c17 100644--- a/packages/cli/assets/theme.template.ts+++ b/packages/cli/assets/theme.template.ts@@ -202,7 +202,6 @@ export const myTheme = defineTheme({// --border-width hairline thickness shared by bordered surfaces// --radius-* none · inner · element · container · page · chat · full// --shadow-* low/med/high + inset-{hover,selected,success,warning,error}- // --appearance-* container-nesting · layer-nesting// --duration-* {fast,medium,slow} × {-min, base, -max}// --ease-standard// --font-family-* body · heading · codediff --git a/packages/core/src/AppShell/AppShell.tsx b/packages/core/src/AppShell/AppShell.tsxindex e1dc876fe0..a85c954110 100644--- a/packages/core/src/AppShell/AppShell.tsx+++ b/packages/core/src/AppShell/AppShell.tsx@@ -32,7 +32,6 @@ import {} from 'react';import * as stylex from '@stylexjs/stylex';import {- appearanceVars,colorVars,fontWeightVars,radiusVars,@@ -340,7 +339,7 @@ const styles = stylex.create({},backgroundColor: colorVars['--color-background-surface'],color: colorVars['--color-text-accent'],- zIndex: appearanceVars['--appearance-layer-nesting'],+ zIndex: 9999,textDecoration: 'none',fontWeight: fontWeightVars['--font-weight-semibold'],fontSize: typeScaleVars['--text-body-size'],@@ -401,7 +400,7 @@ const styles = stylex.create({headerSticky: {position: 'sticky',top: 0,- zIndex: appearanceVars['--appearance-container-nesting'],+ zIndex: 1,},// Sticky sideNav for auto height mode — sticks within the wrapper.// This div replaces the panel as the direct flex child of the middlediff --git a/packages/core/src/BottomSheet/BottomSheet.tsx b/packages/core/src/BottomSheet/BottomSheet.tsxindex 3d94c9d580..d7d6e20595 100644--- a/packages/core/src/BottomSheet/BottomSheet.tsx+++ b/packages/core/src/BottomSheet/BottomSheet.tsx@@ -38,12 +38,7 @@ import {import * as stylex from '@stylexjs/stylex';import type {BaseProps} from '../BaseProps';import type {DialogPurpose} from '../Dialog';-import {- appearanceVars,- colorVars,- durationVars,- easeVars,-} from '../theme/tokens.stylex';+import {colorVars, durationVars, easeVars} from '../theme/tokens.stylex';import {isImeKeyEvent, useDevWarning, useScrollLock} from '../hooks';import {BottomSheetPanel,@@ -81,7 +76,7 @@ const styles = stylex.create({},dialogNonModal: {pointerEvents: 'none',- zIndex: appearanceVars['--appearance-layer-nesting'],+ zIndex: 1000,width: '100%',height: '100%',},@@ -127,7 +122,7 @@ const styles = stylex.create({display: 'none',},positionerTop: {- zIndex: appearanceVars['--appearance-container-nesting'],+ zIndex: 1,},});diff --git a/packages/core/src/BottomSheet/BottomSheetEdgeTint.tsx b/packages/core/src/BottomSheet/BottomSheetEdgeTint.tsxindex 0fed83d367..1dfa5015d6 100644--- a/packages/core/src/BottomSheet/BottomSheetEdgeTint.tsx+++ b/packages/core/src/BottomSheet/BottomSheetEdgeTint.tsx@@ -34,7 +34,7 @@*/import * as stylex from '@stylexjs/stylex';-import {appearanceVars, colorVars} from '../theme/tokens.stylex';+import {colorVars} from '../theme/tokens.stylex';/*** WebKit ignores the declared `background-color` of a sampled box thinner than@@ -53,8 +53,7 @@ const styles = stylex.create({backgroundColor: colorVars['--color-background-surface'],// Above the panel so the edge hit test lands here, and never in the way of// a touch that was meant for the sheet.- zIndex:- `calc(${appearanceVars['--appearance-container-nesting']} + 1)` as unknown as number,+ zIndex: 2,pointerEvents: 'none',// Invisible to the user. WebKit's sampler checks `visibility` and// `opacity` — either would disqualify the element — but not `mask`, sodiff --git a/packages/core/src/BottomSheet/BottomSheetPanel.tsx b/packages/core/src/BottomSheet/BottomSheetPanel.tsxindex 787feb3600..836f72c7c5 100644--- a/packages/core/src/BottomSheet/BottomSheetPanel.tsx+++ b/packages/core/src/BottomSheet/BottomSheetPanel.tsx@@ -34,7 +34,6 @@ import * as stylex from '@stylexjs/stylex';import type {BaseProps} from '../BaseProps';import {useDevWarning} from '../hooks';import {- appearanceVars,borderVars,colorVars,durationVars,@@ -187,7 +186,7 @@ const styles = stylex.create({insetBlockStart: 0,insetInlineStart: 0,insetInlineEnd: 0,- zIndex: appearanceVars['--appearance-container-nesting'],+ zIndex: 1,display: 'flex',alignItems: 'center',justifyContent: 'center',diff --git a/packages/core/src/BottomSheet/BottomSheetSwitcher.tsx b/packages/core/src/BottomSheet/BottomSheetSwitcher.tsxindex 5a200949ac..3012c53b75 100644--- a/packages/core/src/BottomSheet/BottomSheetSwitcher.tsx+++ b/packages/core/src/BottomSheet/BottomSheetSwitcher.tsx@@ -44,12 +44,7 @@ import {import * as stylex from '@stylexjs/stylex';import type {BaseProps} from '../BaseProps';import type {DialogPurpose} from '../Dialog';-import {- appearanceVars,- colorVars,- durationVars,- easeVars,-} from '../theme/tokens.stylex';+import {colorVars, durationVars, easeVars} from '../theme/tokens.stylex';import {hasActiveFocusTrapEscape,isImeKeyEvent,@@ -91,7 +86,7 @@ const styles = stylex.create({// consumers of this non-modal mode must still avoid clipping ancestors.dialogNonModal: {pointerEvents: 'none',- zIndex: appearanceVars['--appearance-layer-nesting'],+ zIndex: 1000,width: '100%',height: '100%',},diff --git a/packages/core/src/Calendar/styles.ts b/packages/core/src/Calendar/styles.tsindex e8773082a2..0d8a5f9a6e 100644--- a/packages/core/src/Calendar/styles.ts+++ b/packages/core/src/Calendar/styles.ts@@ -15,7 +15,6 @@import * as stylex from '@stylexjs/stylex';import {- appearanceVars,colorVars,spacingVars,sizeVars,@@ -211,7 +210,7 @@ export const dayCellStyles = stylex.create({fontSize: typeScaleVars['--text-body-size'],padding: 0,position: 'relative',- zIndex: appearanceVars['--appearance-container-nesting'],+ zIndex: 1,transitionProperty: {default: 'background-color, color','@media (prefers-reduced-motion: reduce)': 'none',diff --git a/packages/core/src/Chat/ChatComposer.tsx b/packages/core/src/Chat/ChatComposer.tsxindex 0f695a2379..8776485f8a 100644--- a/packages/core/src/Chat/ChatComposer.tsx+++ b/packages/core/src/Chat/ChatComposer.tsx@@ -35,7 +35,6 @@ import React, {import type {BaseProps} from '../BaseProps';import * as stylex from '@stylexjs/stylex';import {- appearanceVars,colorVars,spacingVars,radiusVars,@@ -152,8 +151,7 @@ const styles = stylex.create({},body: {position: 'relative',- zIndex:- `calc(${appearanceVars['--appearance-container-nesting']} + 1)` as unknown as number,+ zIndex: 2,display: 'flex',flexDirection: 'column',padding: 'var(--_chat-composer-padding)',diff --git a/packages/core/src/Chat/ChatComposerDrawer.tsx b/packages/core/src/Chat/ChatComposerDrawer.tsxindex 3e626557d9..1988bb06bc 100644--- a/packages/core/src/Chat/ChatComposerDrawer.tsx+++ b/packages/core/src/Chat/ChatComposerDrawer.tsx@@ -21,7 +21,6 @@ import {useId, useState, type ReactNode} from 'react';import type {StyleXStyles} from '@stylexjs/stylex';import * as stylex from '@stylexjs/stylex';import {- appearanceVars,colorVars,spacingVars,radiusVars,@@ -85,7 +84,7 @@ export interface ChatComposerDrawerProps extends BaseProps<HTMLDivElement> {const styles = stylex.create({root: {position: 'relative',- zIndex: appearanceVars['--appearance-container-nesting'],+ zIndex: 1,display: 'flex',flexDirection: 'column',overflow: 'hidden',diff --git a/packages/core/src/Chat/ChatDictationButton.tsx b/packages/core/src/Chat/ChatDictationButton.tsxindex 440e4f7bf7..bea36aaed0 100644--- a/packages/core/src/Chat/ChatDictationButton.tsx+++ b/packages/core/src/Chat/ChatDictationButton.tsx@@ -21,7 +21,7 @@import React from 'react';import type {UseSpeechRecognitionReturn} from './useSpeechRecognition';import * as stylex from '@stylexjs/stylex';-import {appearanceVars, colorVars, radiusVars} from '../theme/tokens.stylex';+import {colorVars, radiusVars} from '../theme/tokens.stylex';import {Button} from '../Button';import {Icon} from '../Icon';import {mergeProps} from '../utils';@@ -62,7 +62,7 @@ const styles = stylex.create({alignItems: 'center',justifyContent: 'center',pointerEvents: 'none',- zIndex: appearanceVars['--appearance-container-nesting'],+ zIndex: 1,},bar: {borderRadius: radiusVars['--radius-full'],diff --git a/packages/core/src/Chat/ChatLayout.tsx b/packages/core/src/Chat/ChatLayout.tsxindex eefb777b07..d45a912992 100644--- a/packages/core/src/Chat/ChatLayout.tsx+++ b/packages/core/src/Chat/ChatLayout.tsx@@ -31,7 +31,7 @@import {type ReactNode, useMemo, useRef} from 'react';import * as stylex from '@stylexjs/stylex';-import {appearanceVars, spacingVars} from '../theme/tokens.stylex';+import {spacingVars} from '../theme/tokens.stylex';import type {BaseProps} from '../BaseProps';import {mergeProps} from '../utils';import {useChatStreamScroll} from './useChatStreamScroll';@@ -184,7 +184,7 @@ const styles = stylex.create({dock: {position: 'relative',- zIndex: appearanceVars['--appearance-container-nesting'],+ zIndex: 1,pointerEvents: 'auto',paddingInline: spacingVars['--spacing-3'],paddingBlockEnd: spacingVars['--spacing-3'],diff --git a/packages/core/src/CheckboxInput/CheckboxInput.tsx b/packages/core/src/CheckboxInput/CheckboxInput.tsxindex 9fda26a9b2..345e038b43 100644--- a/packages/core/src/CheckboxInput/CheckboxInput.tsx+++ b/packages/core/src/CheckboxInput/CheckboxInput.tsx@@ -29,7 +29,6 @@ import {} from 'react';import * as stylex from '@stylexjs/stylex';import {- appearanceVars,colorVars,spacingVars,radiusVars,@@ -87,7 +86,7 @@ const styles = stylex.create({default: 'pointer',':is(:disabled,[aria-disabled="true"])': 'default',},- zIndex: appearanceVars['--appearance-container-nesting'],+ zIndex: 1,},inputCoarse: {'@media (pointer: coarse)': {diff --git a/packages/core/src/CodeBlock/CodeBlock.tsx b/packages/core/src/CodeBlock/CodeBlock.tsxindex affbba5619..d8946d3d66 100644--- a/packages/core/src/CodeBlock/CodeBlock.tsx+++ b/packages/core/src/CodeBlock/CodeBlock.tsx@@ -22,7 +22,6 @@ import * as React from 'react';import type {BaseProps} from '../BaseProps';import * as stylex from '@stylexjs/stylex';import {- appearanceVars,colorVars,spacingVars,radiusVars,@@ -126,7 +125,7 @@ const styles = stylex.create({backgroundColor: 'var(--color-syntax-background)',position: 'sticky',top: 0,- zIndex: appearanceVars['--appearance-container-nesting'],+ zIndex: 1,},header: {display: 'flex',diff --git a/packages/core/src/Field/inputStyles.stylex.ts b/packages/core/src/Field/inputStyles.stylex.tsindex aa7a86f708..ac011dc05e 100644--- a/packages/core/src/Field/inputStyles.stylex.ts+++ b/packages/core/src/Field/inputStyles.stylex.ts@@ -15,7 +15,6 @@import * as stylex from '@stylexjs/stylex';import {- appearanceVars,colorVars,spacingVars,radiusVars,@@ -34,7 +33,7 @@ export const inputWrapperStyles = stylex.create({base: {boxSizing: 'border-box',position: 'relative',- zIndex: appearanceVars['--appearance-container-nesting'],+ zIndex: 1,display: 'flex',alignItems: 'center',gap: spacingVars['--spacing-2'],diff --git a/packages/core/src/FileInput/FileInput.tsx b/packages/core/src/FileInput/FileInput.tsxindex 0740b800ad..527f19cb86 100644--- a/packages/core/src/FileInput/FileInput.tsx+++ b/packages/core/src/FileInput/FileInput.tsx@@ -26,7 +26,6 @@ import {} from 'react';import * as stylex from '@stylexjs/stylex';import {- appearanceVars,colorVars,sizeVars,spacingVars,@@ -132,7 +131,7 @@ const styles = stylex.create({dropzone: {boxSizing: 'border-box',position: 'relative',- zIndex: appearanceVars['--appearance-container-nesting'],+ zIndex: 1,display: 'flex',flexDirection: 'column',alignItems: 'center',@@ -180,7 +179,7 @@ const styles = stylex.create({compact: {boxSizing: 'border-box',position: 'relative',- zIndex: appearanceVars['--appearance-container-nesting'],+ zIndex: 1,display: 'flex',alignItems: 'center',gap: spacingVars['--spacing-2'],diff --git a/packages/core/src/InputGroup/groupStyles.ts b/packages/core/src/InputGroup/groupStyles.tsindex d5494a701f..f3c341e867 100644--- a/packages/core/src/InputGroup/groupStyles.ts+++ b/packages/core/src/InputGroup/groupStyles.ts@@ -8,7 +8,7 @@*/import * as stylex from '@stylexjs/stylex';-import {appearanceVars, radiusVars, borderVars} from '../theme/tokens.stylex';+import {radiusVars, borderVars} from '../theme/tokens.stylex';// A grouped control may be followed by context-layer infrastructure rather// than another control. Neither the inert marker nor the popover is a visual@@ -41,7 +41,7 @@ export const groupStyles = stylex.create({[IS_LAST_ITEM]: radiusVars['--radius-element'],},':focus-within': {- zIndex: appearanceVars['--appearance-container-nesting'],+ zIndex: 1,},},});diff --git a/packages/core/src/Lightbox/Lightbox.tsx b/packages/core/src/Lightbox/Lightbox.tsxindex 13b25a923d..526b11f5d1 100644--- a/packages/core/src/Lightbox/Lightbox.tsx+++ b/packages/core/src/Lightbox/Lightbox.tsx@@ -27,12 +27,7 @@ import {type ReactNode,} from 'react';import * as stylex from '@stylexjs/stylex';-import {- appearanceVars,- colorVars,- spacingVars,- typeScaleVars,-} from '../theme/tokens.stylex';+import {colorVars, spacingVars, typeScaleVars} from '../theme/tokens.stylex';import {Icon} from '../Icon';import {IconButton} from '../IconButton';import {useAnnounce} from '../hooks/useAnnounce';@@ -218,7 +213,7 @@ const styles = stylex.create({position: 'absolute',top: spacingVars['--spacing-3'],insetInlineEnd: spacingVars['--spacing-3'],- zIndex: appearanceVars['--appearance-container-nesting'],+ zIndex: 1,},navButton: {position: 'absolute',@@ -229,7 +224,7 @@ const styles = stylex.create({// firing. `translate` composes with them, reproducing exactly what the// removed wrapper element did (wrapper translated, button scaled).translate: '0 -50%',- zIndex: appearanceVars['--appearance-container-nesting'],+ zIndex: 1,},navPrev: {insetInlineStart: spacingVars['--spacing-3'],@@ -244,7 +239,7 @@ const styles = stylex.create({color: colorVars['--color-on-dark'],fontSize: typeScaleVars['--text-body-size'],lineHeight: typeScaleVars['--text-body-leading'],- zIndex: appearanceVars['--appearance-container-nesting'],+ zIndex: 1,},controlButton: {color: colorVars['--color-on-dark'],diff --git a/packages/core/src/NumberInput/NumberInput.tsx b/packages/core/src/NumberInput/NumberInput.tsxindex 01004e09b2..be976c59bc 100644--- a/packages/core/src/NumberInput/NumberInput.tsx+++ b/packages/core/src/NumberInput/NumberInput.tsx@@ -30,7 +30,6 @@ import {} from 'react';import * as stylex from '@stylexjs/stylex';import {- appearanceVars,colorVars,sizeVars,spacingVars,@@ -85,7 +84,7 @@ const padBlockEnd = `var(--astryx-number-input-padding-block-end, ${padBlockAll}const styles = stylex.create({wrapper: {- zIndex: appearanceVars['--appearance-container-nesting'],+ zIndex: 1,// Applied per side rather than through the shared field base's// `paddingBlock`/`paddingInline` shorthands, because the stepper column// has to cancel the block padding edge by edge — an asymmetricdiff --git a/packages/core/src/Outline/Outline.tsx b/packages/core/src/Outline/Outline.tsxindex 5042e5f94f..280d236d71 100644--- a/packages/core/src/Outline/Outline.tsx+++ b/packages/core/src/Outline/Outline.tsx@@ -26,7 +26,6 @@import {useRef} from 'react';import * as stylex from '@stylexjs/stylex';import {- appearanceVars,colorVars,durationVars,easeVars,@@ -162,7 +161,7 @@ const styles = stylex.create({backgroundColor: colorVars['--color-icon-primary'],borderRadius: radiusVars['--radius-full'],pointerEvents: 'none',- zIndex: appearanceVars['--appearance-container-nesting'],+ zIndex: 1,positionAnchor: '--outline-active',top: 'anchor(--outline-active top, 0px)',height: 'anchor-size(--outline-active height, 0px)',diff --git a/packages/core/src/Popover/usePopover.tsx b/packages/core/src/Popover/usePopover.tsxindex c8f5cd1143..e0e04f774c 100644--- a/packages/core/src/Popover/usePopover.tsx+++ b/packages/core/src/Popover/usePopover.tsx@@ -22,7 +22,6 @@ import {useFocusTrap} from '../hooks/useFocusTrap';import {LayerDepthProvider} from '../Layer/LayerDepthContext';import type {StyleXStyles} from '@stylexjs/stylex';import {- appearanceVars,colorVars,spacingVars,radiusVars,@@ -86,7 +85,7 @@ const styles = stylex.create({closeButtonWrapper: {position: 'absolute',bottom: 0,- zIndex: appearanceVars['--appearance-container-nesting'],+ zIndex: 1,// sr-only by defaultwidth: {default: 1,diff --git a/packages/core/src/RadioList/RadioListItem.tsx b/packages/core/src/RadioList/RadioListItem.tsxindex adf47bea09..8faf9145a3 100644--- a/packages/core/src/RadioList/RadioListItem.tsx+++ b/packages/core/src/RadioList/RadioListItem.tsx@@ -20,7 +20,6 @@import React, {use, useId, useRef, type ReactNode} from 'react';import * as stylex from '@stylexjs/stylex';-import {appearanceVars} from '../theme/tokens.stylex';import type {StyleXStyles} from '@stylexjs/stylex';import type {BaseProps} from '../BaseProps';import {RadioListContext} from './RadioList';@@ -50,7 +49,7 @@ const styles = stylex.create({default: 'pointer',':is(:disabled,[aria-disabled="true"])': 'default',},- zIndex: appearanceVars['--appearance-container-nesting'],+ zIndex: 1,},inputCoarse: {'@media (pointer: coarse)': {diff --git a/packages/core/src/Resizable/ResizeHandle.tsx b/packages/core/src/Resizable/ResizeHandle.tsxindex 10e6e24910..bf30df658c 100644--- a/packages/core/src/Resizable/ResizeHandle.tsx+++ b/packages/core/src/Resizable/ResizeHandle.tsx@@ -38,7 +38,6 @@ import * as stylex from '@stylexjs/stylex';import type {BaseProps} from '../BaseProps';import {devWarn} from '../utils/devWarning';import {- appearanceVars,colorVars,durationVars,easeVars,@@ -128,8 +127,7 @@ const styles = stylex.create({// must stay within a parent's overflow: clip bounds.overlay: {position: 'absolute',- zIndex:- `calc(${appearanceVars['--appearance-container-nesting']} + 1)` as unknown as number,+ zIndex: 2,backgroundColor: 'transparent',},overlayHorizontal: {@@ -181,7 +179,7 @@ const styles = stylex.create({hitArea: {position: 'absolute',- zIndex: appearanceVars['--appearance-container-nesting'],+ zIndex: 1,touchAction: 'none',userSelect: 'none',},@@ -214,8 +212,7 @@ const styles = stylex.create({// Pill base — themes target .astryx-resize-handle-pill for size/shape.pill: {position: 'absolute',- zIndex:- `calc(${appearanceVars['--appearance-container-nesting']} + 1)` as unknown as number,+ zIndex: 2,pointerEvents: 'none',borderRadius: radiusVars['--radius-full'],backgroundColor: colorVars['--color-border'],diff --git a/packages/core/src/SideNav/SideNav.tsx b/packages/core/src/SideNav/SideNav.tsxindex 4c68b4a5e3..d5227cdc55 100644--- a/packages/core/src/SideNav/SideNav.tsx+++ b/packages/core/src/SideNav/SideNav.tsx@@ -25,7 +25,7 @@ import {useCallback, useImperativeHandle, useRef, type ReactNode} from 'react';import type {BaseProps} from '../BaseProps';import * as stylex from '@stylexjs/stylex';import type {StyleXStyles} from '@stylexjs/stylex';-import {appearanceVars, spacingVars} from '../theme/tokens.stylex';+import {spacingVars} from '../theme/tokens.stylex';import {mergeProps} from '../utils';import {SideNavCollapseContext,@@ -154,7 +154,7 @@ const styles = stylex.create({flexShrink: 0,position: 'sticky',top: 0,- zIndex: appearanceVars['--appearance-container-nesting'],+ zIndex: 1,backgroundColor: 'inherit',paddingBlockStart: spacingVars['--spacing-2'],paddingBlockEnd: spacingVars['--spacing-2'],diff --git a/packages/core/src/Slider/Slider.tsx b/packages/core/src/Slider/Slider.tsxindex b2dc47c7f1..5199a8da73 100644--- a/packages/core/src/Slider/Slider.tsx+++ b/packages/core/src/Slider/Slider.tsx@@ -28,7 +28,6 @@ import {} from 'react';import * as stylex from '@stylexjs/stylex';import {- appearanceVars,colorVars,spacingVars,radiusVars,@@ -268,7 +267,7 @@ const styles = stylex.create({default: 'grab',':is(:disabled,[aria-disabled="true"])': 'default',},- zIndex: appearanceVars['--appearance-container-nesting'],+ zIndex: 1,},thumbHorizontal: {top: '50%',diff --git a/packages/core/src/Switch/Switch.tsx b/packages/core/src/Switch/Switch.tsxindex a939166051..7e52e8f929 100644--- a/packages/core/src/Switch/Switch.tsx+++ b/packages/core/src/Switch/Switch.tsx@@ -26,7 +26,6 @@ import {} from 'react';import * as stylex from '@stylexjs/stylex';import {- appearanceVars,colorVars,spacingVars,radiusVars,@@ -168,7 +167,7 @@ const styles = stylex.create({default: 'pointer',':is(:disabled,[aria-disabled="true"])': 'default',},- zIndex: appearanceVars['--appearance-container-nesting'],+ zIndex: 1,},inputCoarse: {'@media (pointer: coarse)': {diff --git a/packages/core/src/Table/plugins/columnResize/useTableColumnResize.tsx b/packages/core/src/Table/plugins/columnResize/useTableColumnResize.tsxindex 5e37b76a65..12f744663e 100644--- a/packages/core/src/Table/plugins/columnResize/useTableColumnResize.tsx+++ b/packages/core/src/Table/plugins/columnResize/useTableColumnResize.tsx@@ -15,7 +15,7 @@import {useRef, useMemo, useCallback, useEffect, type ReactNode} from 'react';import * as stylex from '@stylexjs/stylex';-import {appearanceVars, colorVars} from '../../../theme/tokens.stylex';+import {colorVars} from '../../../theme/tokens.stylex';import type {TablePlugin,HeaderCellRenderProps,@@ -208,7 +208,7 @@ const handleStyles = stylex.create({default: 'ew-resize',':is(:disabled,[aria-disabled="true"])': 'default',},- zIndex: appearanceVars['--appearance-container-nesting'],+ zIndex: 1,touchAction: 'none',userSelect: 'none',// Drive the indicator color via a CSS variable that ::after reads.diff --git a/packages/core/src/Table/plugins/stickyColumns/useTableStickyColumns.tsx b/packages/core/src/Table/plugins/stickyColumns/useTableStickyColumns.tsxindex 012d3c75a7..a4f1cf708a 100644--- a/packages/core/src/Table/plugins/stickyColumns/useTableStickyColumns.tsx+++ b/packages/core/src/Table/plugins/stickyColumns/useTableStickyColumns.tsx@@ -15,12 +15,7 @@import {useCallback, useMemo, useRef, type CSSProperties} from 'react';import * as stylex from '@stylexjs/stylex';-import {- appearanceVars,- colorVars,- durationVars,- easeVars,-} from '../../../theme/tokens.stylex';+import {colorVars, durationVars, easeVars} from '../../../theme/tokens.stylex';import type {TableColumn,TablePlugin,@@ -203,11 +198,10 @@ const stickyStyles = stylex.create({},headerCell: {// Header cells stack above body cells; both stack above non-sticky cells.- zIndex:- `calc(${appearanceVars['--appearance-container-nesting']} + 2)` as unknown as number,+ zIndex: 3,},bodyCell: {- zIndex: appearanceVars['--appearance-container-nesting'],+ zIndex: 1,},});diff --git a/packages/core/src/TextArea/TextArea.tsx b/packages/core/src/TextArea/TextArea.tsxindex a1741dbb6d..0d1336b49a 100644--- a/packages/core/src/TextArea/TextArea.tsx+++ b/packages/core/src/TextArea/TextArea.tsx@@ -30,7 +30,6 @@ import {} from 'react';import * as stylex from '@stylexjs/stylex';import {- appearanceVars,colorVars,spacingVars,typographyVars,@@ -69,7 +68,7 @@ const styles = stylex.create({// container corners. This keeps the native resize grip in the true// bottom-right corner and lets the scrollbar represent the full input area.wrapper: {- zIndex: appearanceVars['--appearance-container-nesting'],+ zIndex: 1,display: 'block',// Zero the shared wrapper inset with matching longhands, not the `padding`// shorthand: StyleX ranks longhands above shorthands regardless of mergediff --git a/packages/core/src/Thumbnail/Thumbnail.tsx b/packages/core/src/Thumbnail/Thumbnail.tsxindex 45a04420f7..163943ba17 100644--- a/packages/core/src/Thumbnail/Thumbnail.tsx+++ b/packages/core/src/Thumbnail/Thumbnail.tsx@@ -28,7 +28,6 @@import {useState} from 'react';import * as stylex from '@stylexjs/stylex';import {- appearanceVars,colorVars,radiusVars,spacingVars,@@ -209,7 +208,7 @@ const styles = stylex.create({position: 'absolute',top: spacingVars['--spacing-1'],insetInlineEnd: spacingVars['--spacing-1'],- zIndex: appearanceVars['--appearance-container-nesting'],+ zIndex: 1,lineHeight: 0,},removeButtonOverrides: {@@ -244,7 +243,7 @@ const styles = stylex.create({justifyContent: 'center',backgroundColor: colorVars['--color-overlay'],borderRadius: 'inherit',- zIndex: appearanceVars['--appearance-container-nesting'],+ zIndex: 1,lineHeight: 0,},});diff --git a/packages/core/src/Toast/ToastViewport.tsx b/packages/core/src/Toast/ToastViewport.tsxindex fae89109d4..62dbde6729 100644--- a/packages/core/src/Toast/ToastViewport.tsx+++ b/packages/core/src/Toast/ToastViewport.tsx@@ -25,12 +25,7 @@ import {} from 'react';import type {ReactNode} from 'react';import * as stylex from '@stylexjs/stylex';-import {- appearanceVars,- spacingVars,- durationVars,- easeVars,-} from '../theme/tokens.stylex';+import {spacingVars, durationVars, easeVars} from '../theme/tokens.stylex';import {mergeProps} from '../utils';import {INTERACTIVE_SELECTORS} from '../hooks/useClickableContainer';import {useAnnounce} from '../hooks/useAnnounce';@@ -49,7 +44,7 @@ const TOAST_EDGE_DRIFT_NEGATIVE = `calc(-1 * ${TOAST_EDGE_DRIFT})`;const styles = stylex.create({viewport: {position: 'fixed',- zIndex: appearanceVars['--appearance-layer-nesting'],+ zIndex: 500,display: 'flex',boxSizing: 'border-box',flexDirection: 'column',diff --git a/packages/core/src/theme/defineTheme.test.ts b/packages/core/src/theme/defineTheme.test.tsindex 1eb523b985..ea9c065bf6 100644--- a/packages/core/src/theme/defineTheme.test.ts+++ b/packages/core/src/theme/defineTheme.test.ts@@ -29,19 +29,6 @@ describe('defineTheme', () => {expect(theme.tokens['--color-background-surface']).toBeUndefined();});- it('accepts appearance nesting token overrides', () => {- const theme = defineTheme({- name: 'nested-surfaces',- tokens: {- '--appearance-container-nesting': '20',- '--appearance-layer-nesting': '100',- },- });-- expect(theme.tokens['--appearance-container-nesting']).toBe('20');- expect(theme.tokens['--appearance-layer-nesting']).toBe('100');- });-it('converts [light, dark] tuples to light-dark()', () => {const theme = defineTheme({name: 'tuple-test',diff --git a/packages/core/src/theme/defineTheme.ts b/packages/core/src/theme/defineTheme.tsindex 956d2ca576..0e02addec8 100644--- a/packages/core/src/theme/defineTheme.ts+++ b/packages/core/src/theme/defineTheme.ts@@ -61,7 +61,6 @@ import {focusDefaults,radiusDefaults,shadowDefaults,- appearanceDefaults,durationDefaults,easeDefaults,typographyDefaults,@@ -98,7 +97,6 @@ export type CoreTokenName =| keyof typeof focusDefaults| keyof typeof radiusDefaults| keyof typeof shadowDefaults- | keyof typeof appearanceDefaults| keyof typeof durationDefaults| keyof typeof easeDefaults| keyof typeof typographyDefaults@@ -445,7 +443,6 @@ export const tokenDefaults: Record<string, string> = {...focusDefaults,...radiusDefaults,...shadowDefaults,- ...appearanceDefaults,...durationDefaults,...easeDefaults,...typographyDefaults,diff --git a/packages/core/src/theme/index.ts b/packages/core/src/theme/index.tsindex bbc8a974a2..5b59e3dee2 100644--- a/packages/core/src/theme/index.ts+++ b/packages/core/src/theme/index.ts@@ -93,7 +93,6 @@ export {focusDefaults,radiusDefaults,shadowDefaults,- appearanceDefaults,durationDefaults,easeDefaults,typographyDefaults,@@ -107,7 +106,6 @@ export {focusVars,radiusVars,shadowVars,- appearanceVars,durationVars,easeVars,typographyVars,@@ -124,7 +122,6 @@ export type {BorderVarName,RadiusVarName,ShadowVarName,- AppearanceVarName,DurationVarName,EaseVarName,TypographyVarName,diff --git a/packages/core/src/theme/tokens.stylex.ts b/packages/core/src/theme/tokens.stylex.tsindex d2ae2d6099..4ea09ea68e 100644--- a/packages/core/src/theme/tokens.stylex.ts+++ b/packages/core/src/theme/tokens.stylex.ts@@ -257,27 +257,6 @@ export const shadowDefaults = {export const shadowVars = stylex.defineVars(shadowDefaults);-// =============================================================================-// Appearance Tokens-// =============================================================================-// Relative stacking steps for ordinary DOM surfaces. Native popovers and modal-// dialogs use the browser top layer instead and do not need these values.--const APPEARANCE_CONTAINER_NESTING = 10;-const APPEARANCE_LAYER_NESTING = 50;--export const appearanceDefaults = {- '--appearance-container-nesting': `${APPEARANCE_CONTAINER_NESTING}`,- '--appearance-layer-nesting': `${APPEARANCE_LAYER_NESTING}`,-} as const;--export const appearanceVars = stylex.defineVars({- '--appearance-container-nesting': stylex.types.integer(- APPEARANCE_CONTAINER_NESTING,- ),- '--appearance-layer-nesting': stylex.types.integer(APPEARANCE_LAYER_NESTING),-});-// =============================================================================// Motion Tokens — Duration// =============================================================================@@ -371,7 +350,6 @@ export type SpacingVarName = keyof typeof spacingDefaults;export type SizeVarName = keyof typeof sizeDefaults;export type RadiusVarName = keyof typeof radiusDefaults;export type ShadowVarName = keyof typeof shadowDefaults;-export type AppearanceVarName = keyof typeof appearanceDefaults;export type TypographyVarName = keyof typeof typographyDefaults;export type TextSizeVarName = keyof typeof textSizeDefaults;export type FontWeightVarName = keyof typeof fontWeightDefaults;diff --git a/packages/core/src/theme/tokens.test.ts b/packages/core/src/theme/tokens.test.tsindex 5f0ed5a94a..ac8faf2651 100644--- a/packages/core/src/theme/tokens.test.ts+++ b/packages/core/src/theme/tokens.test.ts@@ -1,7 +1,6 @@// Copyright (c) Meta Platforms, Inc. and affiliates.import {describe, expect, it} from 'vitest';-import {appearanceVars} from './tokens.stylex';import {defineTheme} from './defineTheme';import {resolveThemeToken,@@ -33,18 +32,6 @@ describe('tokenVars', () => {it('contains var() references for known tokens', () => {expect(tokenVars['--color-text-primary']).toBe('var(--color-text-primary)');expect(tokenVars['--spacing-4']).toBe('var(--spacing-4)');- expect(tokenVars['--appearance-container-nesting']).toBe(- 'var(--appearance-container-nesting)',- );- expect(tokenVars['--appearance-layer-nesting']).toBe(- 'var(--appearance-layer-nesting)',- );- expect(appearanceVars['--appearance-container-nesting']).toBe(- 'var(--appearance-container-nesting)',- );- expect(appearanceVars['--appearance-layer-nesting']).toBe(- 'var(--appearance-layer-nesting)',- );});});@@ -54,8 +41,6 @@ describe('resolveThemeTokens', () => {expect(tokens['--color-text-primary']).toBe('#0A1317');expect(tokens['--spacing-1']).toBe('4px');expect(tokens['--border-width']).toBe('1px');- expect(tokens['--appearance-container-nesting']).toBe('10');- expect(tokens['--appearance-layer-nesting']).toBe('50');});it('resolves --border-width when overridden in defineTheme', () => {diff --git a/packages/lab/src/Chart/ChartZoom.tsx b/packages/lab/src/Chart/ChartZoom.tsxindex 81c598392e..d3b7de99f5 100644--- a/packages/lab/src/Chart/ChartZoom.tsx+++ b/packages/lab/src/Chart/ChartZoom.tsx@@ -13,7 +13,6 @@import {type CSSProperties, useCallback, useRef, useEffect} from 'react';import {createPortal} from 'react-dom';import {IconButton} from '@astryxdesign/core/IconButton';-import {appearanceVars} from '@astryxdesign/core/theme/tokens.stylex';import {useChart} from './ChartContext';import {isBandScale} from './utils';import type {ScaleLinear} from 'd3-scale';@@ -326,7 +325,7 @@ export function ChartZoom({display: 'flex',flexDirection: 'column',gap: 4,- zIndex: appearanceVars['--appearance-container-nesting'],+ zIndex: 1,};switch (pos) {case 'top-right':diff --git a/packages/lab/src/Drawer/Drawer.tsx b/packages/lab/src/Drawer/Drawer.tsxindex 7cb0786ecc..b78b6eb759 100644--- a/packages/lab/src/Drawer/Drawer.tsx+++ b/packages/lab/src/Drawer/Drawer.tsx@@ -54,7 +54,6 @@ import {import * as stylex from '@stylexjs/stylex';import type {BaseProps} from '@astryxdesign/core';import {- appearanceVars,borderVars,colorVars,durationVars,@@ -87,8 +86,9 @@ import {useDrawerDialogPresence} from './useDrawerDialogPresence';type DrawerRegistryEntry = {id: string; close: () => void};// Without the top layer (hasScrim={false} uses show(), not showModal())-// the panel uses the shared floating-layer band. Sibling offsets preserve LIFO-// paint order without creating another application-level stacking scale.+// the panel needs explicit stacking. No z-index token exists in the theme;+// 1000 matches the app-level drawer convention.+const NON_MODAL_BASE_Z = 1000;const openDrawerStack: DrawerRegistryEntry[] = [];let registrationCounter = 0;@@ -96,7 +96,7 @@ let registrationCounter = 0;function registerDrawer(id: string, close: () => void): number {openDrawerStack.push({id, close});registrationCounter += 1;- return registrationCounter - 1;+ return NON_MODAL_BASE_Z + registrationCounter - 1;}function unregisterDrawer(id: string): void {@@ -267,7 +267,7 @@ const styles = stylex.create({insetInlineEnd: spacingVars['--spacing-2'],display: 'flex',gap: spacingVars['--spacing-1'],- zIndex: appearanceVars['--appearance-container-nesting'],+ zIndex: 1,},});@@ -282,9 +282,8 @@ const dynamicStyles = stylex.create({},maxWidth: '100dvw',}),- stackZ: (offset: number) => ({- zIndex:- `calc(${appearanceVars['--appearance-layer-nesting']} + ${offset})` as unknown as number,+ stackZ: (z: number) => ({+ zIndex: z,}),});@@ -425,7 +424,7 @@ export function Drawer({onOpenChangeRef.current = onOpenChange;}, [onOpenChange]);// z-index assigned by the registry on open (non-modal stacking only).- const [stackZ, setStackZ] = useState(0);+ const [stackZ, setStackZ] = useState(NON_MODAL_BASE_Z);// Whether the panel paints: true while open and for the whole slide-out.const [isRendered, setIsRendered] = useState(isOpen);diff --git a/packages/lab/src/Schedule/shared.tsx b/packages/lab/src/Schedule/shared.tsxindex 2556b40b3c..6f3459d6a2 100644--- a/packages/lab/src/Schedule/shared.tsx+++ b/packages/lab/src/Schedule/shared.tsx@@ -13,7 +13,6 @@ import {type ReactNode} from 'react';import * as stylex from '@stylexjs/stylex';import type {Locale} from '@astryxdesign/core/i18n';import {- appearanceVars,borderVars,colorVars,fontWeightVars,@@ -778,7 +777,7 @@ export const styles = stylex.create({marginInlineEnd: `calc(${spacingVars['--spacing-0-5']} + ${borderVars['--border-width']})`,marginBlockStart: `${30 + level * 29}px`,pointerEvents: 'auto',- zIndex: appearanceVars['--appearance-container-nesting'],+ zIndex: 1,}),eventPill: {...baseText,@@ -1025,8 +1024,7 @@ export const styles = stylex.create({? spacingVars['--spacing-0-5']: `calc(${spacingVars['--spacing-0-5']} + ${level * 8}%)`,insetInlineEnd: spacingVars['--spacing-0-5'],- zIndex:- `calc(${appearanceVars['--appearance-container-nesting']} + ${level})` as unknown as number,+ zIndex: level + 1,}),currentTimeLine: (top: number) => ({position: 'absolute',@@ -1035,8 +1033,7 @@ export const styles = stylex.create({borderTopWidth: '2px',borderTopStyle: 'solid',borderTopColor: colorVars['--color-border-orange'],- zIndex:- `calc(${appearanceVars['--appearance-container-nesting']} + 19)` as unknown as number,+ zIndex: 20,pointerEvents: 'none','::before': {content: '""',diff --git a/packages/lab/src/reorderStyles.ts b/packages/lab/src/reorderStyles.tsindex 6e392c3a01..69da464dd3 100644--- a/packages/lab/src/reorderStyles.ts+++ b/packages/lab/src/reorderStyles.ts@@ -9,7 +9,6 @@import * as stylex from '@stylexjs/stylex';import {- appearanceVars,colorVars,durationVars,easeVars,@@ -25,8 +24,7 @@ const indicatorBase = {borderRadius: radiusVars['--radius-full'],backgroundColor: colorVars['--color-accent'],pointerEvents: 'none' as const,- zIndex:- `calc(${appearanceVars['--appearance-container-nesting']} + 1)` as unknown as number,+ zIndex: 2,};/**diff --git a/packages/richtext/src/RichTextEditor.tsx b/packages/richtext/src/RichTextEditor.tsxindex e0a0ce4670..9781c01226 100644--- a/packages/richtext/src/RichTextEditor.tsx+++ b/packages/richtext/src/RichTextEditor.tsx@@ -38,7 +38,6 @@ import {} from 'react';import * as stylex from '@stylexjs/stylex';import {- appearanceVars,colorVars,spacingVars,typographyVars,@@ -195,7 +194,7 @@ const styles = stylex.create({position: 'absolute',top: spacingVars['--spacing-2'],insetInlineEnd: spacingVars['--spacing-2'],- zIndex: appearanceVars['--appearance-container-nesting'],+ zIndex: 1,display: 'flex',alignItems: 'center',},diff --git a/scripts/check-appearance-nesting.test.mjs b/scripts/check-appearance-nesting.test.mjsdeleted file mode 100644index 1ec2deea47..0000000000--- a/scripts/check-appearance-nesting.test.mjs+++ /dev/null@@ -1,82 +0,0 @@-// Copyright (c) Meta Platforms, Inc. and affiliates.--/**- * @file Guard shared component source against component-local z-index scales.- * @input Tracked TypeScript implementation files in Core, Lab, Charts, and RichText.- * @output A failing test when component stacking bypasses appearance nesting tokens.- * @position Repository contract test for the portable appearance token family.- */--import {execFileSync} from 'node:child_process';-import {readFileSync} from 'node:fs';-import ts from 'typescript';-import {describe, expect, it} from 'vitest';--const SOURCE_ROOTS = [- 'packages/core/src',- 'packages/lab/src',- 'packages/charts/src',- 'packages/richtext/src',-];--function trackedImplementationFiles() {- return execFileSync('git', ['ls-files', ...SOURCE_ROOTS], {- encoding: 'utf8',- })- .trim()- .split('\n')- .filter(- file =>- /\.tsx?$/.test(file) &&- !/\.(?:test|stories)\.tsx?$/.test(file) &&- !file.includes('/__tests__/'),- );-}--function propertyName(node) {- if (ts.isIdentifier(node) || ts.isStringLiteral(node)) {- return node.text;- }- return null;-}--describe('appearance nesting token adoption', () => {- it('keeps component z-index values on the shared token bands', () => {- const violations = [];-- for (const file of trackedImplementationFiles()) {- const sourceText = readFileSync(file, 'utf8');- const source = ts.createSourceFile(- file,- sourceText,- ts.ScriptTarget.Latest,- true,- file.endsWith('.tsx') ? ts.ScriptKind.TSX : ts.ScriptKind.TS,- );-- function visit(node) {- if (- ts.isPropertyAssignment(node) &&- propertyName(node.name) === 'zIndex'- ) {- const value = node.initializer.getText(source);- if (- value !== '0' &&- value !== '-1' &&- !value.includes('appearanceVars[')- ) {- const {line} = source.getLineAndCharacterOfPosition(- node.getStart(source),- );- violations.push(`${file}:${line + 1}: zIndex: ${value}`);- }- }- ts.forEachChild(node, visit);- }-- visit(source);- }-- expect(violations).toEqual([]);- });-});diff --git a/scripts/generate-token-docs.mjs b/scripts/generate-token-docs.mjsindex 202b03b26f..ed861e2121 100644--- a/scripts/generate-token-docs.mjs+++ b/scripts/generate-token-docs.mjs@@ -28,13 +28,6 @@ const TOKENS_DOC = resolve(ROOT, 'packages/cli/assets/docs/tokens.doc.mjs');const src = readFileSync(TOKENS_SRC, 'utf-8');-const numericConstants = new Map(- Array.from(src.matchAll(/^const ([A-Z][A-Z0-9_]*) = (-?\d+);$/gm), match => [- match[1],- match[2],- ]),-);-/*** Extract key-value pairs from a `const xxxDefaults = { ... } as const;` block.* Returns array of [tokenName, defaultValue].@@ -50,19 +43,11 @@ function extractDefaults(name) {const body = m[1];const pairs = [];- // Match quoted values and numeric constants interpolated into template strings.- // The latter lets typed StyleX variables and plain theme defaults share one- // numeric source of truth (for example, z-index integer tokens).- const entryRe = /'(--[^']+)':\s*(?:'([^']*)'|`\$\{([A-Z][A-Z0-9_]*)\}`)/g;+ // Match quoted values from each defaults entry.+ const entryRe = /'(--[^']+)':\s*'([^']*)'/g;let em;while ((em = entryRe.exec(body)) !== null) {- const value = em[2] ?? numericConstants.get(em[3]);- if (value == null) {- throw new Error(- `Could not resolve ${em[3]} while reading ${name}.${em[1]}`,- );- }- pairs.push([em[1], value]);+ pairs.push([em[1], em[2]]);}return pairs;}@@ -141,15 +126,6 @@ const groups = [headers: ['Token', 'Value'],formatRow: (name, value) => [name, value],},- {- key: 'appearance',- exportName: 'appearanceDefaults',- title: 'Appearance Tokens',- description:- 'Relative stacking steps for ordinary nested containers and floating layers. Native popovers and modal dialogs use the browser top layer instead.',- headers: ['Token', 'Value'],- formatRow: (name, value) => [name, value],- },{key: 'duration',previewType: 'duration-bar',