@multiplatform.one/theme 10.27.3 → 11.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +6 -4
- package/dist/cjs/index.gnome.cjs +0 -1
- package/dist/cjs/index.gnome.native.cjs +0 -1
- package/dist/cjs/index.gnome.native.js +0 -1
- package/dist/cjs/index.gnome.native.js.map +1 -1
- package/dist/cjs/theme/createThemes.cjs +0 -4
- package/dist/cjs/theme/createThemes.native.cjs +0 -4
- package/dist/cjs/theme/createThemes.native.js +0 -4
- package/dist/cjs/theme/createThemes.native.js.map +1 -1
- package/dist/cjs/theme/overlaySurfaces.cjs +0 -21
- package/dist/cjs/theme/overlaySurfaces.native.cjs +0 -22
- package/dist/cjs/theme/overlaySurfaces.native.js +0 -22
- package/dist/cjs/theme/overlaySurfaces.native.js.map +1 -1
- package/dist/cjs/theme/unknownTokenGuard.cjs +32 -1
- package/dist/cjs/theme/unknownTokenGuard.native.cjs +70 -1
- package/dist/cjs/theme/unknownTokenGuard.native.js +70 -1
- package/dist/cjs/theme/unknownTokenGuard.native.js.map +1 -1
- package/dist/esm/index.gnome.mjs +2 -2
- package/dist/esm/index.gnome.native.js +2 -2
- package/dist/esm/theme/createThemes.mjs +0 -4
- package/dist/esm/theme/createThemes.mjs.map +1 -1
- package/dist/esm/theme/createThemes.native.js +0 -4
- package/dist/esm/theme/createThemes.native.js.map +1 -1
- package/dist/esm/theme/overlaySurfaces.mjs +4 -24
- package/dist/esm/theme/overlaySurfaces.mjs.map +1 -1
- package/dist/esm/theme/overlaySurfaces.native.js +4 -25
- package/dist/esm/theme/overlaySurfaces.native.js.map +1 -1
- package/dist/esm/theme/unknownTokenGuard.mjs +32 -1
- package/dist/esm/theme/unknownTokenGuard.mjs.map +1 -1
- package/dist/esm/theme/unknownTokenGuard.native.js +70 -1
- package/dist/esm/theme/unknownTokenGuard.native.js.map +1 -1
- package/package.json +5 -5
- package/src/index.gnome.ts +0 -1
- package/src/theme/controlEdges.spec.ts +2 -2
- package/src/theme/createDefaultThemeConfig.spec.ts +6 -14
- package/src/theme/createThemes.ts +0 -4
- package/src/theme/overlaySurfaces.focus.spec.tsx +0 -48
- package/src/theme/overlaySurfaces.tsx +4 -46
- package/src/theme/rampRoles.spec.ts +1 -1
- package/src/theme/rowStates.spec.ts +1 -1
- package/src/theme/selectedState.spec.ts +1 -2
- package/src/theme/subsetThemes.spec.ts +3 -3
- package/src/theme/unknownTokenGuard.spec.tsx +35 -1
- package/src/theme/unknownTokenGuard.ts +54 -3
- package/types/index.gnome.d.ts +1 -1
- package/types/index.gnome.d.ts.map +1 -1
- package/types/theme/createThemes.d.ts +0 -12
- package/types/theme/createThemes.d.ts.map +1 -1
- package/types/theme/overlaySurfaces.d.ts +1 -10
- package/types/theme/overlaySurfaces.d.ts.map +1 -1
- package/types/theme/unknownTokenGuard.d.ts +3 -2
- package/types/theme/unknownTokenGuard.d.ts.map +1 -1
|
@@ -1,13 +1,12 @@
|
|
|
1
|
-
import { focusOnOpen
|
|
1
|
+
import { focusOnOpen } from "../keyboardFocusRing.mjs";
|
|
2
2
|
import { scrimFor } from "./motion.mjs";
|
|
3
3
|
import { transitionProps } from "./transitionProps.mjs";
|
|
4
4
|
import { Surface } from "./Surface.mjs";
|
|
5
5
|
import { useResolvedKnobs } from "./useResolvedKnobs.mjs";
|
|
6
6
|
import { ALERT_READABLE_WIDTH } from "./layoutTokens.mjs";
|
|
7
7
|
import { panelPaddingPx } from "./resolveKnobs.mjs";
|
|
8
|
-
import { createContext, forwardRef, useContext
|
|
9
|
-
import {
|
|
10
|
-
import { AlertDialog, Dialog, YStack, isWeb, useDialogContext, useWindowDimensions } from "tamagui";
|
|
8
|
+
import { createContext, forwardRef, useContext } from "react";
|
|
9
|
+
import { AlertDialog, Dialog, YStack, useDialogContext, useWindowDimensions } from "tamagui";
|
|
11
10
|
import { jsx } from "react/jsx-runtime";
|
|
12
11
|
|
|
13
12
|
const dialogScrim = "$scrim-dialog";
|
|
@@ -100,22 +99,6 @@ function contentById(contentId) {
|
|
|
100
99
|
if (!contentId || typeof document === "undefined") return null;
|
|
101
100
|
return document.getElementById(contentId);
|
|
102
101
|
}
|
|
103
|
-
function useDialogShowFocus(onOpenAutoFocus) {
|
|
104
|
-
const { open, contentId } = useDialogContext();
|
|
105
|
-
useEffect(() => {
|
|
106
|
-
if (!open || !contentId || !isWeb || typeof document === "undefined") return;
|
|
107
|
-
const content = document.getElementById(contentId);
|
|
108
|
-
const focused = document.activeElement;
|
|
109
|
-
if (!content || typeof HTMLElement === "undefined" || !(focused instanceof HTMLElement)) return;
|
|
110
|
-
if (!content.contains(focused) || focused.tabIndex >= 0 && wasKeyboardFocus()) return;
|
|
111
|
-
onOpenAutoFocus(createChangeEventDetails("trigger-focus"));
|
|
112
|
-
}, [open, contentId]);
|
|
113
|
-
}
|
|
114
|
-
function DialogShowFocus({ onOpenAutoFocus }) {
|
|
115
|
-
const { contentId } = useDialogContext();
|
|
116
|
-
useDialogShowFocus(withHouseOpenFocus(onOpenAutoFocus, contentId));
|
|
117
|
-
return null;
|
|
118
|
-
}
|
|
119
102
|
const DialogRegionContext = createContext({ inDialogRegion: false });
|
|
120
103
|
function useDialogRegionContext() {
|
|
121
104
|
return useContext(DialogRegionContext);
|
|
@@ -194,7 +177,6 @@ const DialogContentInner = forwardRef(function DialogContentInner2({ children, o
|
|
|
194
177
|
const { knobProps } = useResolvedKnobs({ component: "DialogContent" });
|
|
195
178
|
const { contentId } = useDialogContext();
|
|
196
179
|
const openFocus = withHouseOpenFocus(onOpenAutoFocus, contentId);
|
|
197
|
-
useDialogShowFocus(openFocus);
|
|
198
180
|
const windowFit = useWindowFit(props);
|
|
199
181
|
return /* @__PURE__ */ jsx(Dialog.Content, {
|
|
200
182
|
ref,
|
|
@@ -251,8 +233,6 @@ const AlertDialogContent = forwardRef(function AlertDialogContent2({ children, s
|
|
|
251
233
|
});
|
|
252
234
|
const AlertDialogContentInner = forwardRef(function AlertDialogContentInner2({ children, ...props }, ref) {
|
|
253
235
|
const { knobProps } = useResolvedKnobs({ component: "AlertDialogContent" });
|
|
254
|
-
const { contentId } = useDialogContext();
|
|
255
|
-
useDialogShowFocus(withHouseOpenFocus(props.onOpenAutoFocus, contentId));
|
|
256
236
|
const windowFit = useWindowFit(props, ALERT_READABLE_WIDTH);
|
|
257
237
|
return /* @__PURE__ */ jsx(AlertDialog.Content, {
|
|
258
238
|
ref,
|
|
@@ -310,5 +290,5 @@ const PopoverContent = forwardRef(function PopoverContent2({ children, onOpenAut
|
|
|
310
290
|
});
|
|
311
291
|
});
|
|
312
292
|
|
|
313
|
-
export { AlertDialogContent, AlertDialogOverlay, DialogContent, DialogOverlay, DialogRegionContext, DialogSheetFaceProvider,
|
|
293
|
+
export { AlertDialogContent, AlertDialogOverlay, DialogContent, DialogOverlay, DialogRegionContext, DialogSheetFaceProvider, PopoverContent, SheetBodyProvider, dialogScrim, overlayScrim, sheetGrabber, sheetGrabberClearance, sheetGrabberZone, sheetHandle, sheetHandleTone, sheetHandleWidthRatio, sheetHandleZone, sheetScrim, useDialogRegionContext, useDialogSheetFace, useIsInDialogRegion, useIsInSheetBody };
|
|
314
294
|
//# sourceMappingURL=overlaySurfaces.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"overlaySurfaces.js","names":[],"sources":["esm/theme/overlaySurfaces.js"],"sourcesContent":["import { focusOnOpen, wasKeyboardFocus } from \"../keyboardFocusRing\";\nimport { scrimFor } from \"./motion\";\nimport { transitionProps } from \"./transitionProps\";\nimport { Surface } from \"./Surface\";\nimport { useResolvedKnobs } from \"./useResolvedKnobs\";\nimport { ALERT_READABLE_WIDTH } from \"./layoutTokens\";\nimport { panelPaddingPx } from \"./resolveKnobs\";\nimport { createContext, forwardRef, useContext, useEffect } from \"react\";\nimport { createChangeEventDetails } from \"@tamagui/web\";\nimport {\n AlertDialog,\n Dialog,\n isWeb,\n useDialogContext,\n useWindowDimensions,\n YStack\n} from \"tamagui\";\nimport { jsx } from \"react/jsx-runtime\";\nconst dialogScrim = \"$scrim-dialog\";\nconst sheetScrim = \"$scrim-sheet\";\nconst overlayScrim = dialogScrim;\nconst sheetGrabber = {\n width: 36,\n height: 5,\n borderRadius: 100,\n backgroundColor: \"$color-12\",\n opacity: 0.3,\n alignSelf: \"center\",\n marginHorizontal: 0,\n marginTop: 5,\n marginBottom: -10,\n zIndex: 10\n};\nconst sheetGrabberClearance = 16;\nconst sheetGrabberZone = {\n alignSelf: \"stretch\",\n alignItems: \"center\",\n height: 21\n};\nconst sheetHandleWidthRatio = 0.3;\nconst sheetHandle = {\n width: \"30%\",\n height: 10,\n borderRadius: 100,\n backgroundColor: \"$color-5\",\n opacity: 1,\n alignSelf: \"center\",\n marginHorizontal: 0,\n marginTop: 0,\n marginBottom: 8,\n zIndex: 10\n};\nconst sheetHandleZone = {\n alignSelf: \"stretch\",\n alignItems: \"center\",\n paddingTop: 8\n};\nconst sheetHandleToneOpen = { backgroundColor: \"$color-5\", opacity: 1 };\nfunction sheetHandleTone(_scheme) {\n return sheetHandleToneOpen;\n}\nconst overlayFrameFocus = {\n outlineWidth: { default: 0, focus: 0, \"focus-visible\": 0 },\n outlineStyle: { default: \"none\", focus: \"none\", \"focus-visible\": \"none\" }\n};\nfunction isTabbableWithin(node, container) {\n if (node.tabIndex < 0 || node.hidden || node.tagName === \"A\") return false;\n if (node.disabled) return false;\n if (typeof HTMLInputElement !== \"undefined\" && node instanceof HTMLInputElement && node.type === \"hidden\") {\n return false;\n }\n if (getComputedStyle(node).visibility === \"hidden\") return false;\n for (let el = node; el && el !== container; el = el.parentElement) {\n if (getComputedStyle(el).display === \"none\") return false;\n }\n return true;\n}\nfunction focusFirstTabbableOnOpen(details, container) {\n if (typeof HTMLElement === \"undefined\" || !(container instanceof HTMLElement)) return;\n const first = Array.from(container.querySelectorAll(\"*\")).find(\n (node) => isTabbableWithin(node, container)\n );\n if (!first) return;\n details.cancel();\n const focused = focusOnOpen(first, container);\n if (typeof HTMLInputElement !== \"undefined\" && focused instanceof HTMLInputElement) {\n focused.select();\n }\n}\nfunction withHouseOpenFocus(onOpenAutoFocus, contentId) {\n return (details) => {\n onOpenAutoFocus?.(details);\n if (!details.isCanceled) focusFirstTabbableOnOpen(details, contentById(contentId));\n };\n}\nfunction contentById(contentId) {\n if (!contentId || typeof document === \"undefined\") return null;\n return document.getElementById(contentId);\n}\nfunction useDialogShowFocus(onOpenAutoFocus) {\n const { open, contentId } = useDialogContext();\n useEffect(() => {\n if (!open || !contentId || !isWeb || typeof document === \"undefined\") return;\n const content = document.getElementById(contentId);\n const focused = document.activeElement;\n if (!content || typeof HTMLElement === \"undefined\" || !(focused instanceof HTMLElement)) return;\n if (!content.contains(focused) || focused.tabIndex >= 0 && wasKeyboardFocus()) return;\n onOpenAutoFocus(createChangeEventDetails(\"trigger-focus\"));\n }, [open, contentId]);\n}\nfunction DialogShowFocus({ onOpenAutoFocus }) {\n const { contentId } = useDialogContext();\n useDialogShowFocus(withHouseOpenFocus(onOpenAutoFocus, contentId));\n return null;\n}\nconst DialogRegionContext = createContext({\n inDialogRegion: false\n});\nfunction useDialogRegionContext() {\n return useContext(DialogRegionContext);\n}\nfunction useIsInDialogRegion() {\n return useDialogRegionContext().inDialogRegion;\n}\nconst IN_DIALOG_REGION = { inDialogRegion: true };\nconst SheetBodyContext = createContext(false);\nconst SheetBodyProvider = SheetBodyContext.Provider;\nfunction useIsInSheetBody() {\n return useContext(SheetBodyContext);\n}\nconst DialogSheetFaceContext = createContext(false);\nconst DialogSheetFaceProvider = DialogSheetFaceContext.Provider;\nfunction useDialogSheetFace() {\n return useContext(DialogSheetFaceContext);\n}\nconst DialogSheetBody = forwardRef(\n function DialogSheetBody2({ children }, ref) {\n const { knobProps } = useResolvedKnobs({ component: \"DialogContent\" });\n return /* @__PURE__ */ jsx(YStack, { ref, ...knobProps.gap, ...{ \"data-mp-dialog-face\": \"sheet\" }, children: /* @__PURE__ */ jsx(DialogSheetFaceContext.Provider, { value: false, children: /* @__PURE__ */ jsx(DialogRegionContext.Provider, { value: IN_DIALOG_REGION, children }) }) });\n }\n);\nconst overlayEnterExit = {\n opacity: { enter: 0, exit: 0 },\n y: { enter: -4, exit: -4 },\n scale: { enter: 0.97, exit: 0.97 }\n};\nconst DialogContent = forwardRef(function DialogContent2({ children, size = \"4\", ...props }, ref) {\n if (useDialogSheetFace()) return /* @__PURE__ */ jsx(DialogSheetBody, { ref, children });\n return /* @__PURE__ */ jsx(Surface, { size, painted: false, elevated: true, children: /* @__PURE__ */ jsx(DialogContentInner, { ref, ...props, children }) });\n});\nfunction useWindowFit(props, fallbackMaxWidth) {\n const { width: windowWidth } = useWindowDimensions();\n const room = windowWidth > 0 ? Math.max(0, windowWidth - 2 * panelPaddingPx()) : void 0;\n const fit = (value) => room != null && typeof value === \"number\" ? Math.min(value, room) : value;\n if (room == null) return fallbackMaxWidth == null ? void 0 : { maxWidth: fallbackMaxWidth };\n return {\n maxWidth: fit(props.maxWidth ?? fallbackMaxWidth ?? room),\n ...props.minWidth != null ? { minWidth: fit(props.minWidth) } : void 0,\n ...props.width != null ? { width: fit(props.width) } : void 0\n };\n}\nconst DialogContentInner = forwardRef(function DialogContentInner2({ children, onOpenAutoFocus, ...props }, ref) {\n const { knobProps } = useResolvedKnobs({ component: \"DialogContent\" });\n const { contentId } = useDialogContext();\n const openFocus = withHouseOpenFocus(onOpenAutoFocus, contentId);\n useDialogShowFocus(openFocus);\n const windowFit = useWindowFit(props);\n return /* @__PURE__ */ jsx(\n Dialog.Content,\n {\n ref,\n position: \"relative\",\n pointerEvents: \"auto\",\n ...knobProps.elevatedSurface,\n ...knobProps.containerRadius,\n ...knobProps.panelPadding,\n ...knobProps.gap,\n elevate: false,\n ...transitionProps(knobProps.motion.overlay),\n ...overlayEnterExit,\n ...overlayFrameFocus,\n onOpenAutoFocus: openFocus,\n ...props,\n ...windowFit,\n children: /* @__PURE__ */ jsx(DialogRegionContext.Provider, { value: IN_DIALOG_REGION, children: /* @__PURE__ */ jsx(SheetBodyContext.Provider, { value: false, children }) })\n }\n );\n});\nconst scrimFade = { opacity: { enter: 0, exit: 0 } };\nconst DialogOverlay = forwardRef(function DialogOverlay2({ children, ...props }, ref) {\n const { knobProps } = useResolvedKnobs();\n const sheetFace = useDialogSheetFace();\n if (sheetFace) return null;\n return /* @__PURE__ */ jsx(\n Dialog.Overlay,\n {\n ref,\n backgroundColor: dialogScrim,\n ...transitionProps(scrimFor(knobProps.motion.overlay)),\n ...scrimFade,\n ...props,\n children\n }\n );\n});\nconst AlertDialogContent = forwardRef(\n function AlertDialogContent2({ children, size = \"4\", ...props }, ref) {\n return /* @__PURE__ */ jsx(Surface, { size, painted: false, elevated: true, children: /* @__PURE__ */ jsx(AlertDialogContentInner, { ref, ...props, children }) });\n }\n);\nconst AlertDialogContentInner = forwardRef(function AlertDialogContentInner2({ children, ...props }, ref) {\n const { knobProps } = useResolvedKnobs({ component: \"AlertDialogContent\" });\n const { contentId } = useDialogContext();\n useDialogShowFocus(withHouseOpenFocus(props.onOpenAutoFocus, contentId));\n const windowFit = useWindowFit(props, ALERT_READABLE_WIDTH);\n return /* @__PURE__ */ jsx(\n AlertDialog.Content,\n {\n ref,\n ...knobProps.elevatedSurface,\n ...knobProps.containerRadius,\n ...knobProps.panelPadding,\n ...knobProps.gap,\n elevate: false,\n ...transitionProps(knobProps.motion.overlay),\n ...overlayEnterExit,\n ...overlayFrameFocus,\n ...props,\n ...windowFit,\n children: /* @__PURE__ */ jsx(DialogRegionContext.Provider, { value: IN_DIALOG_REGION, children: /* @__PURE__ */ jsx(SheetBodyContext.Provider, { value: false, children }) })\n }\n );\n});\nconst AlertDialogOverlay = forwardRef(function AlertDialogOverlay2({ children, ...props }, ref) {\n const { knobProps } = useResolvedKnobs();\n return /* @__PURE__ */ jsx(\n AlertDialog.Overlay,\n {\n ref,\n backgroundColor: dialogScrim,\n ...transitionProps(scrimFor(knobProps.motion.overlay)),\n ...scrimFade,\n ...props,\n children\n }\n );\n});\nconst PopoverContent = forwardRef(\n function PopoverContent2({ children, onOpenAutoFocus: _onOpenAutoFocus, ...props }, ref) {\n const { knobProps } = useResolvedKnobs({ component: \"PopoverContent\", painted: false });\n return /* @__PURE__ */ jsx(\n YStack,\n {\n ref,\n ...knobProps.elevatedSurface,\n ...knobProps.containerRadius,\n ...transitionProps(knobProps.motion.overlay),\n ...overlayEnterExit,\n ...overlayFrameFocus,\n ...props,\n children: /* @__PURE__ */ jsx(Surface, { painted: false, elevated: true, children: /* @__PURE__ */ jsx(SheetBodyContext.Provider, { value: false, children }) })\n }\n );\n }\n);\nexport {\n AlertDialogContent,\n AlertDialogOverlay,\n DialogContent,\n DialogOverlay,\n DialogRegionContext,\n DialogSheetFaceProvider,\n DialogShowFocus,\n PopoverContent,\n SheetBodyProvider,\n dialogScrim,\n overlayScrim,\n sheetGrabber,\n sheetGrabberClearance,\n sheetGrabberZone,\n sheetHandle,\n sheetHandleTone,\n sheetHandleWidthRatio,\n sheetHandleZone,\n sheetScrim,\n useDialogRegionContext,\n useDialogSheetFace,\n useIsInDialogRegion,\n useIsInSheetBody\n};\n//# sourceMappingURL=overlaySurfaces.js.map\n"],"mappings":";;;;;;;;;;;;;AAkBA,MAAM,cAAc;AACpB,MAAM,aAAa;AACnB,MAAM,eAAe;AACrB,MAAM,eAAe;CACnB,OAAO;CACP,QAAQ;CACR,cAAc;CACd,iBAAiB;CACjB,SAAS;CACT,WAAW;CACX,kBAAkB;CAClB,WAAW;CACX,cAAc,CAAC;CACf,QAAQ;AACV;AACA,MAAM,wBAAwB;AAC9B,MAAM,mBAAmB;CACvB,WAAW;CACX,YAAY;CACZ,QAAQ;AACV;AACA,MAAM,wBAAwB;AAC9B,MAAM,cAAc;CAClB,OAAO;CACP,QAAQ;CACR,cAAc;CACd,iBAAiB;CACjB,SAAS;CACT,WAAW;CACX,kBAAkB;CAClB,WAAW;CACX,cAAc;CACd,QAAQ;AACV;AACA,MAAM,kBAAkB;CACtB,WAAW;CACX,Y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AACF,CACF"}
|
|
1
|
+
{"version":3,"file":"overlaySurfaces.js","names":[],"sources":["esm/theme/overlaySurfaces.js"],"sourcesContent":["import { focusOnOpen } from \"../keyboardFocusRing\";\nimport { scrimFor } from \"./motion\";\nimport { transitionProps } from \"./transitionProps\";\nimport { Surface } from \"./Surface\";\nimport { useResolvedKnobs } from \"./useResolvedKnobs\";\nimport { ALERT_READABLE_WIDTH } from \"./layoutTokens\";\nimport { panelPaddingPx } from \"./resolveKnobs\";\nimport { createContext, forwardRef, useContext } from \"react\";\nimport {\n AlertDialog,\n Dialog,\n useDialogContext,\n useWindowDimensions,\n YStack\n} from \"tamagui\";\nimport { jsx } from \"react/jsx-runtime\";\nconst dialogScrim = \"$scrim-dialog\";\nconst sheetScrim = \"$scrim-sheet\";\nconst overlayScrim = dialogScrim;\nconst sheetGrabber = {\n width: 36,\n height: 5,\n borderRadius: 100,\n backgroundColor: \"$color-12\",\n opacity: 0.3,\n alignSelf: \"center\",\n marginHorizontal: 0,\n marginTop: 5,\n marginBottom: -10,\n zIndex: 10\n};\nconst sheetGrabberClearance = 16;\nconst sheetGrabberZone = {\n alignSelf: \"stretch\",\n alignItems: \"center\",\n height: 21\n};\nconst sheetHandleWidthRatio = 0.3;\nconst sheetHandle = {\n width: \"30%\",\n height: 10,\n borderRadius: 100,\n backgroundColor: \"$color-5\",\n opacity: 1,\n alignSelf: \"center\",\n marginHorizontal: 0,\n marginTop: 0,\n marginBottom: 8,\n zIndex: 10\n};\nconst sheetHandleZone = {\n alignSelf: \"stretch\",\n alignItems: \"center\",\n paddingTop: 8\n};\nconst sheetHandleToneOpen = { backgroundColor: \"$color-5\", opacity: 1 };\nfunction sheetHandleTone(_scheme) {\n return sheetHandleToneOpen;\n}\nconst overlayFrameFocus = {\n outlineWidth: { default: 0, focus: 0, \"focus-visible\": 0 },\n outlineStyle: { default: \"none\", focus: \"none\", \"focus-visible\": \"none\" }\n};\nfunction isTabbableWithin(node, container) {\n if (node.tabIndex < 0 || node.hidden || node.tagName === \"A\") return false;\n if (node.disabled) return false;\n if (typeof HTMLInputElement !== \"undefined\" && node instanceof HTMLInputElement && node.type === \"hidden\") {\n return false;\n }\n if (getComputedStyle(node).visibility === \"hidden\") return false;\n for (let el = node; el && el !== container; el = el.parentElement) {\n if (getComputedStyle(el).display === \"none\") return false;\n }\n return true;\n}\nfunction focusFirstTabbableOnOpen(details, container) {\n if (typeof HTMLElement === \"undefined\" || !(container instanceof HTMLElement)) return;\n const first = Array.from(container.querySelectorAll(\"*\")).find(\n (node) => isTabbableWithin(node, container)\n );\n if (!first) return;\n details.cancel();\n const focused = focusOnOpen(first, container);\n if (typeof HTMLInputElement !== \"undefined\" && focused instanceof HTMLInputElement) {\n focused.select();\n }\n}\nfunction withHouseOpenFocus(onOpenAutoFocus, contentId) {\n return (details) => {\n onOpenAutoFocus?.(details);\n if (!details.isCanceled) focusFirstTabbableOnOpen(details, contentById(contentId));\n };\n}\nfunction contentById(contentId) {\n if (!contentId || typeof document === \"undefined\") return null;\n return document.getElementById(contentId);\n}\nconst DialogRegionContext = createContext({\n inDialogRegion: false\n});\nfunction useDialogRegionContext() {\n return useContext(DialogRegionContext);\n}\nfunction useIsInDialogRegion() {\n return useDialogRegionContext().inDialogRegion;\n}\nconst IN_DIALOG_REGION = { inDialogRegion: true };\nconst SheetBodyContext = createContext(false);\nconst SheetBodyProvider = SheetBodyContext.Provider;\nfunction useIsInSheetBody() {\n return useContext(SheetBodyContext);\n}\nconst DialogSheetFaceContext = createContext(false);\nconst DialogSheetFaceProvider = DialogSheetFaceContext.Provider;\nfunction useDialogSheetFace() {\n return useContext(DialogSheetFaceContext);\n}\nconst DialogSheetBody = forwardRef(\n function DialogSheetBody2({ children }, ref) {\n const { knobProps } = useResolvedKnobs({ component: \"DialogContent\" });\n return /* @__PURE__ */ jsx(YStack, { ref, ...knobProps.gap, ...{ \"data-mp-dialog-face\": \"sheet\" }, children: /* @__PURE__ */ jsx(DialogSheetFaceContext.Provider, { value: false, children: /* @__PURE__ */ jsx(DialogRegionContext.Provider, { value: IN_DIALOG_REGION, children }) }) });\n }\n);\nconst overlayEnterExit = {\n opacity: { enter: 0, exit: 0 },\n y: { enter: -4, exit: -4 },\n scale: { enter: 0.97, exit: 0.97 }\n};\nconst DialogContent = forwardRef(function DialogContent2({ children, size = \"4\", ...props }, ref) {\n if (useDialogSheetFace()) return /* @__PURE__ */ jsx(DialogSheetBody, { ref, children });\n return /* @__PURE__ */ jsx(Surface, { size, painted: false, elevated: true, children: /* @__PURE__ */ jsx(DialogContentInner, { ref, ...props, children }) });\n});\nfunction useWindowFit(props, fallbackMaxWidth) {\n const { width: windowWidth } = useWindowDimensions();\n const room = windowWidth > 0 ? Math.max(0, windowWidth - 2 * panelPaddingPx()) : void 0;\n const fit = (value) => room != null && typeof value === \"number\" ? Math.min(value, room) : value;\n if (room == null) return fallbackMaxWidth == null ? void 0 : { maxWidth: fallbackMaxWidth };\n return {\n maxWidth: fit(props.maxWidth ?? fallbackMaxWidth ?? room),\n ...props.minWidth != null ? { minWidth: fit(props.minWidth) } : void 0,\n ...props.width != null ? { width: fit(props.width) } : void 0\n };\n}\nconst DialogContentInner = forwardRef(function DialogContentInner2({ children, onOpenAutoFocus, ...props }, ref) {\n const { knobProps } = useResolvedKnobs({ component: \"DialogContent\" });\n const { contentId } = useDialogContext();\n const openFocus = withHouseOpenFocus(onOpenAutoFocus, contentId);\n const windowFit = useWindowFit(props);\n return /* @__PURE__ */ jsx(\n Dialog.Content,\n {\n ref,\n position: \"relative\",\n pointerEvents: \"auto\",\n ...knobProps.elevatedSurface,\n ...knobProps.containerRadius,\n ...knobProps.panelPadding,\n ...knobProps.gap,\n elevate: false,\n ...transitionProps(knobProps.motion.overlay),\n ...overlayEnterExit,\n ...overlayFrameFocus,\n onOpenAutoFocus: openFocus,\n ...props,\n ...windowFit,\n children: /* @__PURE__ */ jsx(DialogRegionContext.Provider, { value: IN_DIALOG_REGION, children: /* @__PURE__ */ jsx(SheetBodyContext.Provider, { value: false, children }) })\n }\n );\n});\nconst scrimFade = { opacity: { enter: 0, exit: 0 } };\nconst DialogOverlay = forwardRef(function DialogOverlay2({ children, ...props }, ref) {\n const { knobProps } = useResolvedKnobs();\n const sheetFace = useDialogSheetFace();\n if (sheetFace) return null;\n return /* @__PURE__ */ jsx(\n Dialog.Overlay,\n {\n ref,\n backgroundColor: dialogScrim,\n ...transitionProps(scrimFor(knobProps.motion.overlay)),\n ...scrimFade,\n ...props,\n children\n }\n );\n});\nconst AlertDialogContent = forwardRef(\n function AlertDialogContent2({ children, size = \"4\", ...props }, ref) {\n return /* @__PURE__ */ jsx(Surface, { size, painted: false, elevated: true, children: /* @__PURE__ */ jsx(AlertDialogContentInner, { ref, ...props, children }) });\n }\n);\nconst AlertDialogContentInner = forwardRef(function AlertDialogContentInner2({ children, ...props }, ref) {\n const { knobProps } = useResolvedKnobs({ component: \"AlertDialogContent\" });\n const windowFit = useWindowFit(props, ALERT_READABLE_WIDTH);\n return /* @__PURE__ */ jsx(\n AlertDialog.Content,\n {\n ref,\n ...knobProps.elevatedSurface,\n ...knobProps.containerRadius,\n ...knobProps.panelPadding,\n ...knobProps.gap,\n elevate: false,\n ...transitionProps(knobProps.motion.overlay),\n ...overlayEnterExit,\n ...overlayFrameFocus,\n ...props,\n ...windowFit,\n children: /* @__PURE__ */ jsx(DialogRegionContext.Provider, { value: IN_DIALOG_REGION, children: /* @__PURE__ */ jsx(SheetBodyContext.Provider, { value: false, children }) })\n }\n );\n});\nconst AlertDialogOverlay = forwardRef(function AlertDialogOverlay2({ children, ...props }, ref) {\n const { knobProps } = useResolvedKnobs();\n return /* @__PURE__ */ jsx(\n AlertDialog.Overlay,\n {\n ref,\n backgroundColor: dialogScrim,\n ...transitionProps(scrimFor(knobProps.motion.overlay)),\n ...scrimFade,\n ...props,\n children\n }\n );\n});\nconst PopoverContent = forwardRef(\n function PopoverContent2({ children, onOpenAutoFocus: _onOpenAutoFocus, ...props }, ref) {\n const { knobProps } = useResolvedKnobs({ component: \"PopoverContent\", painted: false });\n return /* @__PURE__ */ jsx(\n YStack,\n {\n ref,\n ...knobProps.elevatedSurface,\n ...knobProps.containerRadius,\n ...transitionProps(knobProps.motion.overlay),\n ...overlayEnterExit,\n ...overlayFrameFocus,\n ...props,\n children: /* @__PURE__ */ jsx(Surface, { painted: false, elevated: true, children: /* @__PURE__ */ jsx(SheetBodyContext.Provider, { value: false, children }) })\n }\n );\n }\n);\nexport {\n AlertDialogContent,\n AlertDialogOverlay,\n DialogContent,\n DialogOverlay,\n DialogRegionContext,\n DialogSheetFaceProvider,\n PopoverContent,\n SheetBodyProvider,\n dialogScrim,\n overlayScrim,\n sheetGrabber,\n sheetGrabberClearance,\n sheetGrabberZone,\n sheetHandle,\n sheetHandleTone,\n sheetHandleWidthRatio,\n sheetHandleZone,\n sheetScrim,\n useDialogRegionContext,\n useDialogSheetFace,\n useIsInDialogRegion,\n useIsInSheetBody\n};\n//# sourceMappingURL=overlaySurfaces.js.map\n"],"mappings":";;;;;;;;;;;;AAgBA,MAAM,cAAc;AACpB,MAAM,aAAa;AACnB,MAAM,eAAe;AACrB,MAAM,eAAe;CACnB,OAAO;CACP,QAAQ;CACR,cAAc;CACd,iBAAiB;CACjB,SAAS;CACT,WAAW;CACX,kBAAkB;CAClB,WAAW;CACX,cAAc,CAAC;CACf,QAAQ;AACV;AACA,MAAM,wBAAwB;AAC9B,MAAM,mBAAmB;CACvB,WAAW;CACX,YAAY;CACZ,QAAQ;AACV;AACA,MAAM,wBAAwB;AAC9B,MAAM,cAAc;CAClB,OAAO;CACP,QAAQ;CACR,cAAc;CACd,iBAAiB;CACjB,SAAS;CACT,WAAW;CACX,kBAAkB;CAClB,WAAW;CACX,cAAc;CACd,QAAQ;AACV;AACA,MAAM,kBAAkB;CACtB,WAAW;CACX,YAAY;CACZ,YAAY;AACd;AACA,MAAM,sBAAsB;CAAE,iBAAiB;CAAY,SAAS;AAAE;AACtE,SAAS,gBAAgB,SAAS;CAChC,OAAO;AACT;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ACH;CACF,CACF;AACF,CAAC;AACD,MAAM,iBAAiB,WACrB,SAAS,gBAAgB,EAAE,UAAU,iBAAiB,kBAAkB,GAAG,SAAS,KAAK;CACvF,MAAM,EAAE,cAAc,iBAAiB;EAAE,WAAW;EAAkB,SAAS;CAAM,CAAC;CACtF,OAAuB,oBACrB,QACA;EACE;EACA,GAAG,UAAU;EACb,GAAG,UAAU;EACb,GAAG,gBAAgB,UAAU,OAAO,OAAO;EAC3C,GAAG;EACH,GAAG;EACH,GAAG;EACH,UAA0B,oBAAI,SAAS;GAAE,SAAS;GAAO,UAAU;GAAM,UAA0B,oBAAI,iBAAiB,UAAU;IAAE,OAAO;IAAO;GAAS,CAAC;EAAE,CAAC;CACjK,CACF;AACF,CACF"}
|
|
@@ -1,14 +1,13 @@
|
|
|
1
1
|
import { jsx } from "react/jsx-runtime";
|
|
2
|
-
import { focusOnOpen
|
|
2
|
+
import { focusOnOpen } from "../keyboardFocusRing.native.js";
|
|
3
3
|
import { scrimFor } from "./motion.native.js";
|
|
4
4
|
import { transitionProps } from "./transitionProps.native.js";
|
|
5
5
|
import { Surface } from "./Surface.native.js";
|
|
6
6
|
import { useResolvedKnobs } from "./useResolvedKnobs.native.js";
|
|
7
7
|
import { ALERT_READABLE_WIDTH } from "./layoutTokens.native.js";
|
|
8
8
|
import { panelPaddingPx } from "./resolveKnobs.native.js";
|
|
9
|
-
import { createContext, forwardRef, useContext
|
|
10
|
-
import {
|
|
11
|
-
import { AlertDialog, Dialog, YStack, isWeb, useDialogContext, useWindowDimensions } from "tamagui";
|
|
9
|
+
import { createContext, forwardRef, useContext } from "react";
|
|
10
|
+
import { AlertDialog, Dialog, YStack, useDialogContext, useWindowDimensions } from "tamagui";
|
|
12
11
|
|
|
13
12
|
var dialogScrim = "$scrim-dialog";
|
|
14
13
|
var sheetScrim = "$scrim-sheet";
|
|
@@ -102,23 +101,6 @@ function contentById(contentId) {
|
|
|
102
101
|
if (!contentId || typeof document === "undefined") return null;
|
|
103
102
|
return document.getElementById(contentId);
|
|
104
103
|
}
|
|
105
|
-
function useDialogShowFocus(onOpenAutoFocus) {
|
|
106
|
-
var { open, contentId } = useDialogContext();
|
|
107
|
-
useEffect(function() {
|
|
108
|
-
if (!open || !contentId || !isWeb || typeof document === "undefined") return;
|
|
109
|
-
var content = document.getElementById(contentId);
|
|
110
|
-
var focused = document.activeElement;
|
|
111
|
-
if (!content || typeof HTMLElement === "undefined" || !(focused instanceof HTMLElement)) return;
|
|
112
|
-
if (!content.contains(focused) || focused.tabIndex >= 0 && wasKeyboardFocus()) return;
|
|
113
|
-
onOpenAutoFocus(createChangeEventDetails("trigger-focus"));
|
|
114
|
-
}, [open, contentId]);
|
|
115
|
-
}
|
|
116
|
-
function DialogShowFocus(param) {
|
|
117
|
-
var { onOpenAutoFocus } = param;
|
|
118
|
-
var { contentId } = useDialogContext();
|
|
119
|
-
useDialogShowFocus(withHouseOpenFocus(onOpenAutoFocus, contentId));
|
|
120
|
-
return null;
|
|
121
|
-
}
|
|
122
104
|
var DialogRegionContext = /* @__PURE__ */ createContext({ inDialogRegion: false });
|
|
123
105
|
function useDialogRegionContext() {
|
|
124
106
|
return useContext(DialogRegionContext);
|
|
@@ -203,7 +185,6 @@ var DialogContentInner = /* @__PURE__ */ forwardRef(function DialogContentInner2
|
|
|
203
185
|
var { knobProps } = useResolvedKnobs({ component: "DialogContent" });
|
|
204
186
|
var { contentId } = useDialogContext();
|
|
205
187
|
var openFocus = withHouseOpenFocus(onOpenAutoFocus, contentId);
|
|
206
|
-
useDialogShowFocus(openFocus);
|
|
207
188
|
var windowFit = useWindowFit(props);
|
|
208
189
|
return /* @__PURE__ */ jsx(Dialog.Content, {
|
|
209
190
|
ref,
|
|
@@ -263,8 +244,6 @@ var AlertDialogContent = /* @__PURE__ */ forwardRef(function AlertDialogContent2
|
|
|
263
244
|
var AlertDialogContentInner = /* @__PURE__ */ forwardRef(function AlertDialogContentInner2(param, ref) {
|
|
264
245
|
var { children, ...props } = param;
|
|
265
246
|
var { knobProps } = useResolvedKnobs({ component: "AlertDialogContent" });
|
|
266
|
-
var { contentId } = useDialogContext();
|
|
267
|
-
useDialogShowFocus(withHouseOpenFocus(props.onOpenAutoFocus, contentId));
|
|
268
247
|
var windowFit = useWindowFit(props, ALERT_READABLE_WIDTH);
|
|
269
248
|
return /* @__PURE__ */ jsx(AlertDialog.Content, {
|
|
270
249
|
ref,
|
|
@@ -324,5 +303,5 @@ var PopoverContent = /* @__PURE__ */ forwardRef(function PopoverContent2(param,
|
|
|
324
303
|
});
|
|
325
304
|
});
|
|
326
305
|
|
|
327
|
-
export { AlertDialogContent, AlertDialogOverlay, DialogContent, DialogOverlay, DialogRegionContext, DialogSheetFaceProvider,
|
|
306
|
+
export { AlertDialogContent, AlertDialogOverlay, DialogContent, DialogOverlay, DialogRegionContext, DialogSheetFaceProvider, PopoverContent, SheetBodyProvider, dialogScrim, overlayScrim, sheetGrabber, sheetGrabberClearance, sheetGrabberZone, sheetHandle, sheetHandleTone, sheetHandleWidthRatio, sheetHandleZone, sheetScrim, useDialogRegionContext, useDialogSheetFace, useIsInDialogRegion, useIsInSheetBody };
|
|
328
307
|
//# sourceMappingURL=overlaySurfaces.native.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"overlaySurfaces.native.js","names":[],"sources":["esm/theme/overlaySurfaces.native.js"],"sourcesContent":["import { jsx as _jsx } from \"react/jsx-runtime\";\nimport { focusOnOpen, wasKeyboardFocus } from \"../keyboardFocusRing\";\nimport { scrimFor } from \"./motion\";\nimport { transitionProps } from \"./transitionProps\";\nimport { Surface } from \"./Surface\";\nimport { useResolvedKnobs } from \"./useResolvedKnobs\";\nimport { ALERT_READABLE_WIDTH } from \"./layoutTokens\";\nimport { panelPaddingPx } from \"./resolveKnobs\";\nimport { createContext, forwardRef, useContext, useEffect } from \"react\";\nimport { createChangeEventDetails } from \"@tamagui/web\";\nimport { AlertDialog, Dialog, isWeb, useDialogContext, useWindowDimensions, YStack } from \"tamagui\";\nvar dialogScrim = \"$scrim-dialog\";\nvar sheetScrim = \"$scrim-sheet\";\nvar overlayScrim = dialogScrim;\nvar sheetGrabber = {\n width: 36,\n height: 5,\n borderRadius: 100,\n backgroundColor: \"$color-12\",\n opacity: 0.3,\n alignSelf: \"center\",\n marginHorizontal: 0,\n marginTop: 5,\n marginBottom: -10,\n zIndex: 10\n};\nvar sheetGrabberClearance = 16;\nvar sheetGrabberZone = {\n alignSelf: \"stretch\",\n alignItems: \"center\",\n height: 21\n};\nvar sheetHandleWidthRatio = 0.3;\nvar sheetHandle = {\n width: \"30%\",\n height: 10,\n borderRadius: 100,\n backgroundColor: \"$color-5\",\n opacity: 1,\n alignSelf: \"center\",\n marginHorizontal: 0,\n marginTop: 0,\n marginBottom: 8,\n zIndex: 10\n};\nvar sheetHandleZone = {\n alignSelf: \"stretch\",\n alignItems: \"center\",\n paddingTop: 8\n};\nvar sheetHandleToneOpen = {\n backgroundColor: \"$color-5\",\n opacity: 1\n};\nfunction sheetHandleTone(_scheme) {\n return sheetHandleToneOpen;\n}\nvar overlayFrameFocus = {\n outlineWidth: {\n default: 0,\n focus: 0,\n \"focus-visible\": 0\n },\n outlineStyle: {\n default: \"none\",\n focus: \"none\",\n \"focus-visible\": \"none\"\n }\n};\nfunction isTabbableWithin(node, container) {\n if (node.tabIndex < 0 || node.hidden || node.tagName === \"A\") return false;\n if (node.disabled) return false;\n if (typeof HTMLInputElement !== \"undefined\" && node instanceof HTMLInputElement && node.type === \"hidden\") {\n return false;\n }\n if (getComputedStyle(node).visibility === \"hidden\") return false;\n for (var el = node; el && el !== container; el = el.parentElement) {\n if (getComputedStyle(el).display === \"none\") return false;\n }\n return true;\n}\nfunction focusFirstTabbableOnOpen(details, container) {\n if (typeof HTMLElement === \"undefined\" || !(container instanceof HTMLElement)) return;\n var first = Array.from(container.querySelectorAll(\"*\")).find(function(node) {\n return isTabbableWithin(node, container);\n });\n if (!first) return;\n details.cancel();\n var focused = focusOnOpen(first, container);\n if (typeof HTMLInputElement !== \"undefined\" && focused instanceof HTMLInputElement) {\n focused.select();\n }\n}\nfunction withHouseOpenFocus(onOpenAutoFocus, contentId) {\n return function(details) {\n onOpenAutoFocus === null || onOpenAutoFocus === void 0 ? void 0 : onOpenAutoFocus(details);\n if (!details.isCanceled) focusFirstTabbableOnOpen(details, contentById(contentId));\n };\n}\nfunction contentById(contentId) {\n if (!contentId || typeof document === \"undefined\") return null;\n return document.getElementById(contentId);\n}\nfunction useDialogShowFocus(onOpenAutoFocus) {\n var { open, contentId } = useDialogContext();\n useEffect(function() {\n if (!open || !contentId || !isWeb || typeof document === \"undefined\") return;\n var content = document.getElementById(contentId);\n var focused = document.activeElement;\n if (!content || typeof HTMLElement === \"undefined\" || !(focused instanceof HTMLElement)) return;\n if (!content.contains(focused) || focused.tabIndex >= 0 && wasKeyboardFocus()) return;\n onOpenAutoFocus(createChangeEventDetails(\"trigger-focus\"));\n }, [\n open,\n contentId\n ]);\n}\nfunction DialogShowFocus(param) {\n var { onOpenAutoFocus } = param;\n var { contentId } = useDialogContext();\n useDialogShowFocus(withHouseOpenFocus(onOpenAutoFocus, contentId));\n return null;\n}\nvar DialogRegionContext = /* @__PURE__ */ createContext({\n inDialogRegion: false\n});\nfunction useDialogRegionContext() {\n return useContext(DialogRegionContext);\n}\nfunction useIsInDialogRegion() {\n return useDialogRegionContext().inDialogRegion;\n}\nvar IN_DIALOG_REGION = {\n inDialogRegion: true\n};\nvar SheetBodyContext = /* @__PURE__ */ createContext(false);\nvar SheetBodyProvider = SheetBodyContext.Provider;\nfunction useIsInSheetBody() {\n return useContext(SheetBodyContext);\n}\nvar DialogSheetFaceContext = /* @__PURE__ */ createContext(false);\nvar DialogSheetFaceProvider = DialogSheetFaceContext.Provider;\nfunction useDialogSheetFace() {\n return useContext(DialogSheetFaceContext);\n}\nvar DialogSheetBody = /* @__PURE__ */ forwardRef(function DialogSheetBody2(param, ref) {\n var { children } = param;\n var { knobProps } = useResolvedKnobs({\n component: \"DialogContent\"\n });\n return /* @__PURE__ */ _jsx(YStack, {\n ref,\n ...knobProps.gap,\n ...{\n \"data-mp-dialog-face\": \"sheet\"\n },\n children: /* @__PURE__ */ _jsx(DialogSheetFaceContext.Provider, {\n value: false,\n children: /* @__PURE__ */ _jsx(DialogRegionContext.Provider, {\n value: IN_DIALOG_REGION,\n children\n })\n })\n });\n});\nvar overlayEnterExit = {\n opacity: {\n enter: 0,\n exit: 0\n },\n y: {\n enter: -4,\n exit: -4\n },\n scale: {\n enter: 0.97,\n exit: 0.97\n }\n};\nvar DialogContent = /* @__PURE__ */ forwardRef(function DialogContent2(param, ref) {\n var { children, size = \"4\", ...props } = param;\n if (useDialogSheetFace()) return /* @__PURE__ */ _jsx(DialogSheetBody, {\n ref,\n children\n });\n return /* @__PURE__ */ _jsx(Surface, {\n size,\n painted: false,\n elevated: true,\n children: /* @__PURE__ */ _jsx(DialogContentInner, {\n ref,\n ...props,\n children\n })\n });\n});\nfunction useWindowFit(props, fallbackMaxWidth) {\n var _ref, _props_maxWidth;\n var { width: windowWidth } = useWindowDimensions();\n var room = windowWidth > 0 ? Math.max(0, windowWidth - 2 * panelPaddingPx()) : void 0;\n var fit = function fit2(value) {\n return room != null && typeof value === \"number\" ? Math.min(value, room) : value;\n };\n if (room == null) return fallbackMaxWidth == null ? void 0 : {\n maxWidth: fallbackMaxWidth\n };\n return {\n maxWidth: fit((_ref = (_props_maxWidth = props.maxWidth) !== null && _props_maxWidth !== void 0 ? _props_maxWidth : fallbackMaxWidth) !== null && _ref !== void 0 ? _ref : room),\n ...props.minWidth != null ? {\n minWidth: fit(props.minWidth)\n } : void 0,\n ...props.width != null ? {\n width: fit(props.width)\n } : void 0\n };\n}\nvar DialogContentInner = /* @__PURE__ */ forwardRef(function DialogContentInner2(param, ref) {\n var { children, onOpenAutoFocus, ...props } = param;\n var { knobProps } = useResolvedKnobs({\n component: \"DialogContent\"\n });\n var { contentId } = useDialogContext();\n var openFocus = withHouseOpenFocus(onOpenAutoFocus, contentId);\n useDialogShowFocus(openFocus);\n var windowFit = useWindowFit(props);\n return /* @__PURE__ */ _jsx(Dialog.Content, {\n ref,\n position: \"relative\",\n pointerEvents: \"auto\",\n ...knobProps.elevatedSurface,\n ...knobProps.containerRadius,\n ...knobProps.panelPadding,\n ...knobProps.gap,\n elevate: false,\n ...transitionProps(knobProps.motion.overlay),\n ...overlayEnterExit,\n ...overlayFrameFocus,\n onOpenAutoFocus: openFocus,\n ...props,\n ...windowFit,\n children: /* @__PURE__ */ _jsx(DialogRegionContext.Provider, {\n value: IN_DIALOG_REGION,\n children: /* @__PURE__ */ _jsx(SheetBodyContext.Provider, {\n value: false,\n children\n })\n })\n });\n});\nvar scrimFade = {\n opacity: {\n enter: 0,\n exit: 0\n }\n};\nvar DialogOverlay = /* @__PURE__ */ forwardRef(function DialogOverlay2(param, ref) {\n var { children, ...props } = param;\n var { knobProps } = useResolvedKnobs();\n var sheetFace = useDialogSheetFace();\n if (sheetFace) return null;\n return /* @__PURE__ */ _jsx(Dialog.Overlay, {\n ref,\n backgroundColor: dialogScrim,\n ...transitionProps(scrimFor(knobProps.motion.overlay)),\n ...scrimFade,\n ...props,\n children\n });\n});\nvar AlertDialogContent = /* @__PURE__ */ forwardRef(function AlertDialogContent2(param, ref) {\n var { children, size = \"4\", ...props } = param;\n return /* @__PURE__ */ _jsx(Surface, {\n size,\n painted: false,\n elevated: true,\n children: /* @__PURE__ */ _jsx(AlertDialogContentInner, {\n ref,\n ...props,\n children\n })\n });\n});\nvar AlertDialogContentInner = /* @__PURE__ */ forwardRef(function AlertDialogContentInner2(param, ref) {\n var { children, ...props } = param;\n var { knobProps } = useResolvedKnobs({\n component: \"AlertDialogContent\"\n });\n var { contentId } = useDialogContext();\n useDialogShowFocus(withHouseOpenFocus(props.onOpenAutoFocus, contentId));\n var windowFit = useWindowFit(props, ALERT_READABLE_WIDTH);\n return /* @__PURE__ */ _jsx(AlertDialog.Content, {\n ref,\n ...knobProps.elevatedSurface,\n ...knobProps.containerRadius,\n ...knobProps.panelPadding,\n ...knobProps.gap,\n elevate: false,\n ...transitionProps(knobProps.motion.overlay),\n ...overlayEnterExit,\n ...overlayFrameFocus,\n ...props,\n ...windowFit,\n children: /* @__PURE__ */ _jsx(DialogRegionContext.Provider, {\n value: IN_DIALOG_REGION,\n children: /* @__PURE__ */ _jsx(SheetBodyContext.Provider, {\n value: false,\n children\n })\n })\n });\n});\nvar AlertDialogOverlay = /* @__PURE__ */ forwardRef(function AlertDialogOverlay2(param, ref) {\n var { children, ...props } = param;\n var { knobProps } = useResolvedKnobs();\n return /* @__PURE__ */ _jsx(AlertDialog.Overlay, {\n ref,\n backgroundColor: dialogScrim,\n ...transitionProps(scrimFor(knobProps.motion.overlay)),\n ...scrimFade,\n ...props,\n children\n });\n});\nvar PopoverContent = /* @__PURE__ */ forwardRef(function PopoverContent2(param, ref) {\n var { children, onOpenAutoFocus: _onOpenAutoFocus, ...props } = param;\n var { knobProps } = useResolvedKnobs({\n component: \"PopoverContent\",\n painted: false\n });\n return /* @__PURE__ */ _jsx(YStack, {\n ref,\n ...knobProps.elevatedSurface,\n ...knobProps.containerRadius,\n ...transitionProps(knobProps.motion.overlay),\n ...overlayEnterExit,\n ...overlayFrameFocus,\n ...props,\n children: /* @__PURE__ */ _jsx(Surface, {\n painted: false,\n elevated: true,\n children: /* @__PURE__ */ _jsx(SheetBodyContext.Provider, {\n value: false,\n children\n })\n })\n });\n});\nexport {\n AlertDialogContent,\n AlertDialogOverlay,\n DialogContent,\n DialogOverlay,\n DialogRegionContext,\n DialogSheetFaceProvider,\n DialogShowFocus,\n PopoverContent,\n SheetBodyProvider,\n dialogScrim,\n overlayScrim,\n sheetGrabber,\n sheetGrabberClearance,\n sheetGrabberZone,\n sheetHandle,\n sheetHandleTone,\n sheetHandleWidthRatio,\n sheetHandleZone,\n sheetScrim,\n useDialogRegionContext,\n useDialogSheetFace,\n useIsInDialogRegion,\n useIsInSheetBody\n};\n//# sourceMappingURL=overlaySurfaces.js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,UAA0B,oBAAK,iBAAiB,UAAU;IACxD,OAAO;IACP;GACF,CAAC;EACH,CAAC;CACH,CAAC;AACH,CAAC;AACD,IAAI,qBAAqC,2BAAW,SAAS,oBAAoB,OAAO,KAAK;CAC3F,IAAI,EAAE,UAAU,GAAG,UAAU;CAC7B,IAAI,EAAE,cAAc,iBAAiB;CACrC,OAAuB,oBAAK,YAAY,SAAS;EAC/C;EACA,iBAAiB;EACjB,GAAG,gBAAgB,SAAS,UAAU,OAAO,OAAO,CAAC;EACrD,GAAG;EACH,GAAG;EACH;CACF,CAAC;AACH,CAAC;AACD,IAAI,iBAAiC,2BAAW,SAAS,gBAAgB,OAAO,KAAK;CACnF,IAAI,EAAE,UAAU,iBAAiB,kBAAkB,GAAG,UAAU;CAChE,IAAI,EAAE,cAAc,iBAAiB;EACnC,WAAW;EACX,SAAS;CACX,CAAC;CACD,OAAuB,oBAAK,QAAQ;EAClC;EACA,GAAG,UAAU;EACb,GAAG,UAAU;EACb,GAAG,gBAAgB,UAAU,OAAO,OAAO;EAC3C,GAAG;EACH,GAAG;EACH,GAAG;EACH,UAA0B,oBAAK,SAAS;GACtC,SAAS;GACT,UAAU;GACV,UAA0B,oBAAK,iBAAiB,UAAU;IACxD,OAAO;IACP;GACF,CAAC;EACH,CAAC;CACH,CAAC;AACH,CAAC"}
|
|
1
|
+
{"version":3,"file":"overlaySurfaces.native.js","names":[],"sources":["esm/theme/overlaySurfaces.native.js"],"sourcesContent":["import { jsx as _jsx } from \"react/jsx-runtime\";\nimport { focusOnOpen } from \"../keyboardFocusRing\";\nimport { scrimFor } from \"./motion\";\nimport { transitionProps } from \"./transitionProps\";\nimport { Surface } from \"./Surface\";\nimport { useResolvedKnobs } from \"./useResolvedKnobs\";\nimport { ALERT_READABLE_WIDTH } from \"./layoutTokens\";\nimport { panelPaddingPx } from \"./resolveKnobs\";\nimport { createContext, forwardRef, useContext } from \"react\";\nimport { AlertDialog, Dialog, useDialogContext, useWindowDimensions, YStack } from \"tamagui\";\nvar dialogScrim = \"$scrim-dialog\";\nvar sheetScrim = \"$scrim-sheet\";\nvar overlayScrim = dialogScrim;\nvar sheetGrabber = {\n width: 36,\n height: 5,\n borderRadius: 100,\n backgroundColor: \"$color-12\",\n opacity: 0.3,\n alignSelf: \"center\",\n marginHorizontal: 0,\n marginTop: 5,\n marginBottom: -10,\n zIndex: 10\n};\nvar sheetGrabberClearance = 16;\nvar sheetGrabberZone = {\n alignSelf: \"stretch\",\n alignItems: \"center\",\n height: 21\n};\nvar sheetHandleWidthRatio = 0.3;\nvar sheetHandle = {\n width: \"30%\",\n height: 10,\n borderRadius: 100,\n backgroundColor: \"$color-5\",\n opacity: 1,\n alignSelf: \"center\",\n marginHorizontal: 0,\n marginTop: 0,\n marginBottom: 8,\n zIndex: 10\n};\nvar sheetHandleZone = {\n alignSelf: \"stretch\",\n alignItems: \"center\",\n paddingTop: 8\n};\nvar sheetHandleToneOpen = {\n backgroundColor: \"$color-5\",\n opacity: 1\n};\nfunction sheetHandleTone(_scheme) {\n return sheetHandleToneOpen;\n}\nvar overlayFrameFocus = {\n outlineWidth: {\n default: 0,\n focus: 0,\n \"focus-visible\": 0\n },\n outlineStyle: {\n default: \"none\",\n focus: \"none\",\n \"focus-visible\": \"none\"\n }\n};\nfunction isTabbableWithin(node, container) {\n if (node.tabIndex < 0 || node.hidden || node.tagName === \"A\") return false;\n if (node.disabled) return false;\n if (typeof HTMLInputElement !== \"undefined\" && node instanceof HTMLInputElement && node.type === \"hidden\") {\n return false;\n }\n if (getComputedStyle(node).visibility === \"hidden\") return false;\n for (var el = node; el && el !== container; el = el.parentElement) {\n if (getComputedStyle(el).display === \"none\") return false;\n }\n return true;\n}\nfunction focusFirstTabbableOnOpen(details, container) {\n if (typeof HTMLElement === \"undefined\" || !(container instanceof HTMLElement)) return;\n var first = Array.from(container.querySelectorAll(\"*\")).find(function(node) {\n return isTabbableWithin(node, container);\n });\n if (!first) return;\n details.cancel();\n var focused = focusOnOpen(first, container);\n if (typeof HTMLInputElement !== \"undefined\" && focused instanceof HTMLInputElement) {\n focused.select();\n }\n}\nfunction withHouseOpenFocus(onOpenAutoFocus, contentId) {\n return function(details) {\n onOpenAutoFocus === null || onOpenAutoFocus === void 0 ? void 0 : onOpenAutoFocus(details);\n if (!details.isCanceled) focusFirstTabbableOnOpen(details, contentById(contentId));\n };\n}\nfunction contentById(contentId) {\n if (!contentId || typeof document === \"undefined\") return null;\n return document.getElementById(contentId);\n}\nvar DialogRegionContext = /* @__PURE__ */ createContext({\n inDialogRegion: false\n});\nfunction useDialogRegionContext() {\n return useContext(DialogRegionContext);\n}\nfunction useIsInDialogRegion() {\n return useDialogRegionContext().inDialogRegion;\n}\nvar IN_DIALOG_REGION = {\n inDialogRegion: true\n};\nvar SheetBodyContext = /* @__PURE__ */ createContext(false);\nvar SheetBodyProvider = SheetBodyContext.Provider;\nfunction useIsInSheetBody() {\n return useContext(SheetBodyContext);\n}\nvar DialogSheetFaceContext = /* @__PURE__ */ createContext(false);\nvar DialogSheetFaceProvider = DialogSheetFaceContext.Provider;\nfunction useDialogSheetFace() {\n return useContext(DialogSheetFaceContext);\n}\nvar DialogSheetBody = /* @__PURE__ */ forwardRef(function DialogSheetBody2(param, ref) {\n var { children } = param;\n var { knobProps } = useResolvedKnobs({\n component: \"DialogContent\"\n });\n return /* @__PURE__ */ _jsx(YStack, {\n ref,\n ...knobProps.gap,\n ...{\n \"data-mp-dialog-face\": \"sheet\"\n },\n children: /* @__PURE__ */ _jsx(DialogSheetFaceContext.Provider, {\n value: false,\n children: /* @__PURE__ */ _jsx(DialogRegionContext.Provider, {\n value: IN_DIALOG_REGION,\n children\n })\n })\n });\n});\nvar overlayEnterExit = {\n opacity: {\n enter: 0,\n exit: 0\n },\n y: {\n enter: -4,\n exit: -4\n },\n scale: {\n enter: 0.97,\n exit: 0.97\n }\n};\nvar DialogContent = /* @__PURE__ */ forwardRef(function DialogContent2(param, ref) {\n var { children, size = \"4\", ...props } = param;\n if (useDialogSheetFace()) return /* @__PURE__ */ _jsx(DialogSheetBody, {\n ref,\n children\n });\n return /* @__PURE__ */ _jsx(Surface, {\n size,\n painted: false,\n elevated: true,\n children: /* @__PURE__ */ _jsx(DialogContentInner, {\n ref,\n ...props,\n children\n })\n });\n});\nfunction useWindowFit(props, fallbackMaxWidth) {\n var _ref, _props_maxWidth;\n var { width: windowWidth } = useWindowDimensions();\n var room = windowWidth > 0 ? Math.max(0, windowWidth - 2 * panelPaddingPx()) : void 0;\n var fit = function fit2(value) {\n return room != null && typeof value === \"number\" ? Math.min(value, room) : value;\n };\n if (room == null) return fallbackMaxWidth == null ? void 0 : {\n maxWidth: fallbackMaxWidth\n };\n return {\n maxWidth: fit((_ref = (_props_maxWidth = props.maxWidth) !== null && _props_maxWidth !== void 0 ? _props_maxWidth : fallbackMaxWidth) !== null && _ref !== void 0 ? _ref : room),\n ...props.minWidth != null ? {\n minWidth: fit(props.minWidth)\n } : void 0,\n ...props.width != null ? {\n width: fit(props.width)\n } : void 0\n };\n}\nvar DialogContentInner = /* @__PURE__ */ forwardRef(function DialogContentInner2(param, ref) {\n var { children, onOpenAutoFocus, ...props } = param;\n var { knobProps } = useResolvedKnobs({\n component: \"DialogContent\"\n });\n var { contentId } = useDialogContext();\n var openFocus = withHouseOpenFocus(onOpenAutoFocus, contentId);\n var windowFit = useWindowFit(props);\n return /* @__PURE__ */ _jsx(Dialog.Content, {\n ref,\n position: \"relative\",\n pointerEvents: \"auto\",\n ...knobProps.elevatedSurface,\n ...knobProps.containerRadius,\n ...knobProps.panelPadding,\n ...knobProps.gap,\n elevate: false,\n ...transitionProps(knobProps.motion.overlay),\n ...overlayEnterExit,\n ...overlayFrameFocus,\n onOpenAutoFocus: openFocus,\n ...props,\n ...windowFit,\n children: /* @__PURE__ */ _jsx(DialogRegionContext.Provider, {\n value: IN_DIALOG_REGION,\n children: /* @__PURE__ */ _jsx(SheetBodyContext.Provider, {\n value: false,\n children\n })\n })\n });\n});\nvar scrimFade = {\n opacity: {\n enter: 0,\n exit: 0\n }\n};\nvar DialogOverlay = /* @__PURE__ */ forwardRef(function DialogOverlay2(param, ref) {\n var { children, ...props } = param;\n var { knobProps } = useResolvedKnobs();\n var sheetFace = useDialogSheetFace();\n if (sheetFace) return null;\n return /* @__PURE__ */ _jsx(Dialog.Overlay, {\n ref,\n backgroundColor: dialogScrim,\n ...transitionProps(scrimFor(knobProps.motion.overlay)),\n ...scrimFade,\n ...props,\n children\n });\n});\nvar AlertDialogContent = /* @__PURE__ */ forwardRef(function AlertDialogContent2(param, ref) {\n var { children, size = \"4\", ...props } = param;\n return /* @__PURE__ */ _jsx(Surface, {\n size,\n painted: false,\n elevated: true,\n children: /* @__PURE__ */ _jsx(AlertDialogContentInner, {\n ref,\n ...props,\n children\n })\n });\n});\nvar AlertDialogContentInner = /* @__PURE__ */ forwardRef(function AlertDialogContentInner2(param, ref) {\n var { children, ...props } = param;\n var { knobProps } = useResolvedKnobs({\n component: \"AlertDialogContent\"\n });\n var windowFit = useWindowFit(props, ALERT_READABLE_WIDTH);\n return /* @__PURE__ */ _jsx(AlertDialog.Content, {\n ref,\n ...knobProps.elevatedSurface,\n ...knobProps.containerRadius,\n ...knobProps.panelPadding,\n ...knobProps.gap,\n elevate: false,\n ...transitionProps(knobProps.motion.overlay),\n ...overlayEnterExit,\n ...overlayFrameFocus,\n ...props,\n ...windowFit,\n children: /* @__PURE__ */ _jsx(DialogRegionContext.Provider, {\n value: IN_DIALOG_REGION,\n children: /* @__PURE__ */ _jsx(SheetBodyContext.Provider, {\n value: false,\n children\n })\n })\n });\n});\nvar AlertDialogOverlay = /* @__PURE__ */ forwardRef(function AlertDialogOverlay2(param, ref) {\n var { children, ...props } = param;\n var { knobProps } = useResolvedKnobs();\n return /* @__PURE__ */ _jsx(AlertDialog.Overlay, {\n ref,\n backgroundColor: dialogScrim,\n ...transitionProps(scrimFor(knobProps.motion.overlay)),\n ...scrimFade,\n ...props,\n children\n });\n});\nvar PopoverContent = /* @__PURE__ */ forwardRef(function PopoverContent2(param, ref) {\n var { children, onOpenAutoFocus: _onOpenAutoFocus, ...props } = param;\n var { knobProps } = useResolvedKnobs({\n component: \"PopoverContent\",\n painted: false\n });\n return /* @__PURE__ */ _jsx(YStack, {\n ref,\n ...knobProps.elevatedSurface,\n ...knobProps.containerRadius,\n ...transitionProps(knobProps.motion.overlay),\n ...overlayEnterExit,\n ...overlayFrameFocus,\n ...props,\n children: /* @__PURE__ */ _jsx(Surface, {\n painted: false,\n elevated: true,\n children: /* @__PURE__ */ _jsx(SheetBodyContext.Provider, {\n value: false,\n children\n })\n })\n });\n});\nexport {\n AlertDialogContent,\n AlertDialogOverlay,\n DialogContent,\n DialogOverlay,\n DialogRegionContext,\n DialogSheetFaceProvider,\n PopoverContent,\n SheetBodyProvider,\n dialogScrim,\n overlayScrim,\n sheetGrabber,\n sheetGrabberClearance,\n sheetGrabberZone,\n sheetHandle,\n sheetHandleTone,\n sheetHandleWidthRatio,\n sheetHandleZone,\n sheetScrim,\n useDialogRegionContext,\n useDialogSheetFace,\n useIsInDialogRegion,\n useIsInSheetBody\n};\n//# sourceMappingURL=overlaySurfaces.js.map\n"],"mappings":";;;;;;;;;;;;AAUA,IAAI,cAAc;AAClB,IAAI,aAAa;AACjB,IAAI,eAAe;AACnB,IAAI,eAAe;CACjB,OAAO;CACP,QAAQ;CACR,cAAc;CACd,iBAAiB;CACjB,SAAS;CACT,WAAW;CACX,kBAAkB;CAClB,WAAW;CACX,cAAc,CAAC;CACf,QAAQ;AACV;AACA,IAAI,wBAAwB;AAC5B,IAAI,mBAAmB;CACrB,WAAW;CACX,YAAY;CACZ,QAAQ;AACV;AACA,IAAI,wBAAwB;AAC5B,IAAI,cAAc;CAChB,OAAO;CACP,QAAQ;CACR,cAAc;CACd,iBAAiB;CACjB,SAAS;CACT,WAAW;CACX,kBAAkB;CAClB,WAAW;CACX,cAAc;CACd,QAAQ;AACV;AACA,IAAI,kBAAkB;CACpB,WAAW;CACX,YAAY;CACZ,YAAY;AAC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;GAC3D,OAAO;GACP,UAA0B,oBAAK,iBAAiB,UAAU;IACxD,OAAO;IACP;GACF,CAAC;EACH,CAAC;CACH,CAAC;AACH,CAAC;AACD,IAAI,qBAAqC,2BAAW,SAAS,oBAAoB,OAAO,KAAK;CAC3F,IAAI,EAAE,UAAU,GAAG,UAAU;CAC7B,IAAI,EAAE,cAAc,iBAAiB;CACrC,OAAuB,oBAAK,YAAY,SAAS;EAC/C;EACA,iBAAiB;EACjB,GAAG,gBAAgB,SAAS,UAAU,OAAO,OAAO,CAAC;EACrD,GAAG;EACH,GAAG;EACH;CACF,CAAC;AACH,CAAC;AACD,IAAI,iBAAiC,2BAAW,SAAS,gBAAgB,OAAO,KAAK;CACnF,IAAI,EAAE,UAAU,iBAAiB,kBAAkB,GAAG,UAAU;CAChE,IAAI,EAAE,cAAc,iBAAiB;EACnC,WAAW;EACX,SAAS;CACX,CAAC;CACD,OAAuB,oBAAK,QAAQ;EAClC;EACA,GAAG,UAAU;EACb,GAAG,UAAU;EACb,GAAG,gBAAgB,UAAU,OAAO,OAAO;EAC3C,GAAG;EACH,GAAG;EACH,GAAG;EACH,UAA0B,oBAAK,SAAS;GACtC,SAAS;GACT,UAAU;GACV,UAA0B,oBAAK,iBAAiB,UAAU;IACxD,OAAO;IACP;GACF,CAAC;EACH,CAAC;CACH,CAAC;AACH,CAAC"}
|
|
@@ -42,14 +42,45 @@ function guardTable(table) {
|
|
|
42
42
|
guarded.add(proxy);
|
|
43
43
|
return proxy;
|
|
44
44
|
}
|
|
45
|
+
function kebabThemeKey(key) {
|
|
46
|
+
return key.replace(/([a-z0-9])([A-Z])/g, "$1-$2").replace(/([A-Za-z])(\d)/g, "$1-$2").toLowerCase();
|
|
47
|
+
}
|
|
48
|
+
function themeKeysOf(themes) {
|
|
49
|
+
const keys = /* @__PURE__ */ new Set();
|
|
50
|
+
for (const theme of Object.values(themes ?? {})) {
|
|
51
|
+
for (const key of Object.keys(theme)) keys.add(key);
|
|
52
|
+
}
|
|
53
|
+
return keys;
|
|
54
|
+
}
|
|
55
|
+
function guardColorTable(table, themes) {
|
|
56
|
+
if (guarded.has(table)) return table;
|
|
57
|
+
let keys;
|
|
58
|
+
const proxy = new Proxy(table, { get(target, key, receiver) {
|
|
59
|
+
const value = Reflect.get(target, key, receiver);
|
|
60
|
+
if (value !== void 0 || typeof key !== "string" || key in target) return value;
|
|
61
|
+
const meant = kebabThemeKey(key);
|
|
62
|
+
if (meant === key) return value;
|
|
63
|
+
keys ??= themes();
|
|
64
|
+
if (keys.has(key) || !keys.has(meant)) return value;
|
|
65
|
+
devWarn("unknown-token", {
|
|
66
|
+
component: renderingComponent(),
|
|
67
|
+
value: `$${key}`,
|
|
68
|
+
suggest: `$${meant}`
|
|
69
|
+
});
|
|
70
|
+
return value;
|
|
71
|
+
} });
|
|
72
|
+
guarded.add(proxy);
|
|
73
|
+
return proxy;
|
|
74
|
+
}
|
|
45
75
|
function guardUnknownTokens(config) {
|
|
46
76
|
if (process.env.NODE_ENV === "production") return config;
|
|
47
|
-
const tables = config
|
|
77
|
+
const { tokensParsed: tables, themes } = config;
|
|
48
78
|
if (!tables) return config;
|
|
49
79
|
for (const category of guardedCategories) {
|
|
50
80
|
const table = tables[category];
|
|
51
81
|
if (table) tables[category] = guardTable(table);
|
|
52
82
|
}
|
|
83
|
+
if (tables.color) tables.color = guardColorTable(tables.color, () => themeKeysOf(themes));
|
|
53
84
|
return config;
|
|
54
85
|
}
|
|
55
86
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"unknownTokenGuard.js","names":[],"sources":["esm/theme/unknownTokenGuard.js"],"sourcesContent":["import * as React from \"react\";\nimport { devWarn } from \"../devWarn\";\nconst guardedCategories = [\"size\", \"space\"];\nconst scaleStep = /^-?\\d+(?:[.-]\\d+)?$/;\nconst guarded = /* @__PURE__ */ new WeakSet();\nfunction ownerNames(stack) {\n const names = [];\n for (const line of stack?.split(\"\\n\") ?? []) {\n const frame = /^\\s*at (?:new )?([\\w$.<>]+) \\(/.exec(line) ?? /^\\s*([\\w$.<>]+)@/.exec(line);\n if (frame) names.push(frame[1]);\n }\n return names;\n}\nfunction ownerName(stack) {\n const [owner, outer] = ownerNames(stack);\n if (!owner) return void 0;\n return outer && /^[A-Z]\\w*$/.test(outer) ? `${owner} in ${outer}` : owner;\n}\nfunction renderingComponent() {\n const capture = React.captureOwnerStack;\n try {\n return ownerName(capture?.()) ?? \"unknown\";\n } catch {\n return \"unknown\";\n }\n}\nfunction guardTable(table) {\n if (guarded.has(table)) return table;\n const proxy = new Proxy(table, {\n get(target, key, receiver) {\n const value = Reflect.get(target, key, receiver);\n if (value === void 0 && typeof key === \"string\" && scaleStep.test(key) && !(key in target)) {\n const meant = key.replace(\".\", \"-\");\n devWarn(\"unknown-token\", {\n component: renderingComponent(),\n value: `$${key}`,\n suggest: meant !== key && meant in target ? `$${meant}` : void 0\n });\n }\n return value;\n }\n });\n guarded.add(proxy);\n return proxy;\n}\nfunction guardUnknownTokens(config) {\n if (process.env.NODE_ENV === \"production\") return config;\n const tables = config
|
|
1
|
+
{"version":3,"file":"unknownTokenGuard.js","names":[],"sources":["esm/theme/unknownTokenGuard.js"],"sourcesContent":["import * as React from \"react\";\nimport { devWarn } from \"../devWarn\";\nconst guardedCategories = [\"size\", \"space\"];\nconst scaleStep = /^-?\\d+(?:[.-]\\d+)?$/;\nconst guarded = /* @__PURE__ */ new WeakSet();\nfunction ownerNames(stack) {\n const names = [];\n for (const line of stack?.split(\"\\n\") ?? []) {\n const frame = /^\\s*at (?:new )?([\\w$.<>]+) \\(/.exec(line) ?? /^\\s*([\\w$.<>]+)@/.exec(line);\n if (frame) names.push(frame[1]);\n }\n return names;\n}\nfunction ownerName(stack) {\n const [owner, outer] = ownerNames(stack);\n if (!owner) return void 0;\n return outer && /^[A-Z]\\w*$/.test(outer) ? `${owner} in ${outer}` : owner;\n}\nfunction renderingComponent() {\n const capture = React.captureOwnerStack;\n try {\n return ownerName(capture?.()) ?? \"unknown\";\n } catch {\n return \"unknown\";\n }\n}\nfunction guardTable(table) {\n if (guarded.has(table)) return table;\n const proxy = new Proxy(table, {\n get(target, key, receiver) {\n const value = Reflect.get(target, key, receiver);\n if (value === void 0 && typeof key === \"string\" && scaleStep.test(key) && !(key in target)) {\n const meant = key.replace(\".\", \"-\");\n devWarn(\"unknown-token\", {\n component: renderingComponent(),\n value: `$${key}`,\n suggest: meant !== key && meant in target ? `$${meant}` : void 0\n });\n }\n return value;\n }\n });\n guarded.add(proxy);\n return proxy;\n}\nfunction kebabThemeKey(key) {\n return key.replace(/([a-z0-9])([A-Z])/g, \"$1-$2\").replace(/([A-Za-z])(\\d)/g, \"$1-$2\").toLowerCase();\n}\nfunction themeKeysOf(themes) {\n const keys = /* @__PURE__ */ new Set();\n for (const theme of Object.values(themes ?? {})) {\n for (const key of Object.keys(theme)) keys.add(key);\n }\n return keys;\n}\nfunction guardColorTable(table, themes) {\n if (guarded.has(table)) return table;\n let keys;\n const proxy = new Proxy(table, {\n get(target, key, receiver) {\n const value = Reflect.get(target, key, receiver);\n if (value !== void 0 || typeof key !== \"string\" || key in target) return value;\n const meant = kebabThemeKey(key);\n if (meant === key) return value;\n keys ??= themes();\n if (keys.has(key) || !keys.has(meant)) return value;\n devWarn(\"unknown-token\", {\n component: renderingComponent(),\n value: `$${key}`,\n suggest: `$${meant}`\n });\n return value;\n }\n });\n guarded.add(proxy);\n return proxy;\n}\nfunction guardUnknownTokens(config) {\n if (process.env.NODE_ENV === \"production\") return config;\n const { tokensParsed: tables, themes } = config;\n if (!tables) return config;\n for (const category of guardedCategories) {\n const table = tables[category];\n if (table) tables[category] = guardTable(table);\n }\n if (tables.color) tables.color = guardColorTable(tables.color, () => themeKeysOf(themes));\n return config;\n}\nexport {\n guardUnknownTokens\n};\n//# sourceMappingURL=unknownTokenGuard.js.map\n"],"mappings":";;;;AAEA,MAAM,oBAAoB,CAAC,QAAQ,OAAO;AAC1C,MAAM,YAAY;AAClB,MAAM,0BAA0B,IAAI,Q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66
|
+
return key.replace(/([a-z0-9])([A-Z])/g, "$1-$2").replace(/([A-Za-z])(\d)/g, "$1-$2").toLowerCase();
|
|
67
|
+
}
|
|
68
|
+
function themeKeysOf(themes) {
|
|
69
|
+
var keys = /* @__PURE__ */ new Set();
|
|
70
|
+
var _iteratorNormalCompletion = true, _didIteratorError = false, _iteratorError = void 0;
|
|
71
|
+
try {
|
|
72
|
+
for (var _iterator = Object.values(themes !== null && themes !== void 0 ? themes : {})[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) {
|
|
73
|
+
var theme = _step.value;
|
|
74
|
+
var _iteratorNormalCompletion1 = true, _didIteratorError1 = false, _iteratorError1 = void 0;
|
|
75
|
+
try {
|
|
76
|
+
for (var _iterator1 = Object.keys(theme)[Symbol.iterator](), _step1; !(_iteratorNormalCompletion1 = (_step1 = _iterator1.next()).done); _iteratorNormalCompletion1 = true) {
|
|
77
|
+
var key = _step1.value;
|
|
78
|
+
keys.add(key);
|
|
79
|
+
}
|
|
80
|
+
} catch (err) {
|
|
81
|
+
_didIteratorError1 = true;
|
|
82
|
+
_iteratorError1 = err;
|
|
83
|
+
} finally {
|
|
84
|
+
try {
|
|
85
|
+
if (!_iteratorNormalCompletion1 && _iterator1.return != null) {
|
|
86
|
+
_iterator1.return();
|
|
87
|
+
}
|
|
88
|
+
} finally {
|
|
89
|
+
if (_didIteratorError1) {
|
|
90
|
+
throw _iteratorError1;
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
} catch (err) {
|
|
96
|
+
_didIteratorError = true;
|
|
97
|
+
_iteratorError = err;
|
|
98
|
+
} finally {
|
|
99
|
+
try {
|
|
100
|
+
if (!_iteratorNormalCompletion && _iterator.return != null) {
|
|
101
|
+
_iterator.return();
|
|
102
|
+
}
|
|
103
|
+
} finally {
|
|
104
|
+
if (_didIteratorError) {
|
|
105
|
+
throw _iteratorError;
|
|
106
|
+
}
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
return keys;
|
|
110
|
+
}
|
|
111
|
+
function guardColorTable(table, themes) {
|
|
112
|
+
if (guarded.has(table)) return table;
|
|
113
|
+
var keys;
|
|
114
|
+
var proxy = new Proxy(table, { get(target, key, receiver) {
|
|
115
|
+
var value = Reflect.get(target, key, receiver);
|
|
116
|
+
if (value !== void 0 || typeof key !== "string" || key in target) return value;
|
|
117
|
+
var meant = kebabThemeKey(key);
|
|
118
|
+
if (meant === key) return value;
|
|
119
|
+
keys !== null && keys !== void 0 ? keys : keys = themes();
|
|
120
|
+
if (keys.has(key) || !keys.has(meant)) return value;
|
|
121
|
+
devWarn("unknown-token", {
|
|
122
|
+
component: renderingComponent(),
|
|
123
|
+
value: `$${key}`,
|
|
124
|
+
suggest: `$${meant}`
|
|
125
|
+
});
|
|
126
|
+
return value;
|
|
127
|
+
} });
|
|
128
|
+
guarded.add(proxy);
|
|
129
|
+
return proxy;
|
|
130
|
+
}
|
|
65
131
|
function guardUnknownTokens(config) {
|
|
66
132
|
if (process.env.NODE_ENV === "production") return config;
|
|
67
|
-
var tables = config
|
|
133
|
+
var { tokensParsed: tables, themes } = config;
|
|
68
134
|
if (!tables) return config;
|
|
69
135
|
var _iteratorNormalCompletion = true, _didIteratorError = false, _iteratorError = void 0;
|
|
70
136
|
try {
|
|
@@ -87,6 +153,9 @@ function guardUnknownTokens(config) {
|
|
|
87
153
|
}
|
|
88
154
|
}
|
|
89
155
|
}
|
|
156
|
+
if (tables.color) tables.color = guardColorTable(tables.color, function() {
|
|
157
|
+
return themeKeysOf(themes);
|
|
158
|
+
});
|
|
90
159
|
return config;
|
|
91
160
|
}
|
|
92
161
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"unknownTokenGuard.native.js","names":[],"sources":["esm/theme/unknownTokenGuard.native.js"],"sourcesContent":["import * as React from \"react\";\nimport { devWarn } from \"../devWarn\";\nvar guardedCategories = [\n \"size\",\n \"space\"\n];\nvar scaleStep = /^-?\\d+(?:[.-]\\d+)?$/;\nvar guarded = /* @__PURE__ */ new WeakSet();\nfunction ownerNames(stack) {\n var _ref;\n var names = [];\n var _iteratorNormalCompletion = true, _didIteratorError = false, _iteratorError = void 0;\n try {\n for (var _iterator = ((_ref = stack === null || stack === void 0 ? void 0 : stack.split(\"\\n\")) !== null && _ref !== void 0 ? _ref : [])[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) {\n var line = _step.value;\n var _exec;\n var frame = (_exec = /^\\s*at (?:new )?([\\w$.<>]+) \\(/.exec(line)) !== null && _exec !== void 0 ? _exec : /^\\s*([\\w$.<>]+)@/.exec(line);\n if (frame) names.push(frame[1]);\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 names;\n}\nfunction ownerName(stack) {\n var [owner, outer] = ownerNames(stack);\n if (!owner) return void 0;\n return outer && /^[A-Z]\\w*$/.test(outer) ? `${owner} in ${outer}` : owner;\n}\nfunction renderingComponent() {\n var capture = React.captureOwnerStack;\n try {\n var _ownerName;\n return (_ownerName = ownerName(capture === null || capture === void 0 ? void 0 : capture())) !== null && _ownerName !== void 0 ? _ownerName : \"unknown\";\n } catch (unused) {\n return \"unknown\";\n }\n}\nfunction guardTable(table) {\n if (guarded.has(table)) return table;\n var proxy = new Proxy(table, {\n get(target, key, receiver) {\n var value = Reflect.get(target, key, receiver);\n if (value === void 0 && typeof key === \"string\" && scaleStep.test(key) && !(key in target)) {\n var meant = key.replace(\".\", \"-\");\n devWarn(\"unknown-token\", {\n component: renderingComponent(),\n value: `$${key}`,\n suggest: meant !== key && meant in target ? `$${meant}` : void 0\n });\n }\n return value;\n }\n });\n guarded.add(proxy);\n return proxy;\n}\nfunction guardUnknownTokens(config) {\n if (process.env.NODE_ENV === \"production\") return config;\n var tables = config
|
|
1
|
+
{"version":3,"file":"unknownTokenGuard.native.js","names":[],"sources":["esm/theme/unknownTokenGuard.native.js"],"sourcesContent":["import * as React from \"react\";\nimport { devWarn } from \"../devWarn\";\nvar guardedCategories = [\n \"size\",\n \"space\"\n];\nvar scaleStep = /^-?\\d+(?:[.-]\\d+)?$/;\nvar guarded = /* @__PURE__ */ new WeakSet();\nfunction ownerNames(stack) {\n var _ref;\n var names = [];\n var _iteratorNormalCompletion = true, _didIteratorError = false, _iteratorError = void 0;\n try {\n for (var _iterator = ((_ref = stack === null || stack === void 0 ? void 0 : stack.split(\"\\n\")) !== null && _ref !== void 0 ? _ref : [])[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) {\n var line = _step.value;\n var _exec;\n var frame = (_exec = /^\\s*at (?:new )?([\\w$.<>]+) \\(/.exec(line)) !== null && _exec !== void 0 ? _exec : /^\\s*([\\w$.<>]+)@/.exec(line);\n if (frame) names.push(frame[1]);\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 names;\n}\nfunction ownerName(stack) {\n var [owner, outer] = ownerNames(stack);\n if (!owner) return void 0;\n return outer && /^[A-Z]\\w*$/.test(outer) ? `${owner} in ${outer}` : owner;\n}\nfunction renderingComponent() {\n var capture = React.captureOwnerStack;\n try {\n var _ownerName;\n return (_ownerName = ownerName(capture === null || capture === void 0 ? void 0 : capture())) !== null && _ownerName !== void 0 ? _ownerName : \"unknown\";\n } catch (unused) {\n return \"unknown\";\n }\n}\nfunction guardTable(table) {\n if (guarded.has(table)) return table;\n var proxy = new Proxy(table, {\n get(target, key, receiver) {\n var value = Reflect.get(target, key, receiver);\n if (value === void 0 && typeof key === \"string\" && scaleStep.test(key) && !(key in target)) {\n var meant = key.replace(\".\", \"-\");\n devWarn(\"unknown-token\", {\n component: renderingComponent(),\n value: `$${key}`,\n suggest: meant !== key && meant in target ? `$${meant}` : void 0\n });\n }\n return value;\n }\n });\n guarded.add(proxy);\n return proxy;\n}\nfunction kebabThemeKey(key) {\n return key.replace(/([a-z0-9])([A-Z])/g, \"$1-$2\").replace(/([A-Za-z])(\\d)/g, \"$1-$2\").toLowerCase();\n}\nfunction themeKeysOf(themes) {\n var keys = /* @__PURE__ */ new Set();\n var _iteratorNormalCompletion = true, _didIteratorError = false, _iteratorError = void 0;\n try {\n for (var _iterator = Object.values(themes !== null && themes !== void 0 ? themes : {})[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) {\n var theme = _step.value;\n var _iteratorNormalCompletion1 = true, _didIteratorError1 = false, _iteratorError1 = void 0;\n try {\n for (var _iterator1 = Object.keys(theme)[Symbol.iterator](), _step1; !(_iteratorNormalCompletion1 = (_step1 = _iterator1.next()).done); _iteratorNormalCompletion1 = true) {\n var key = _step1.value;\n keys.add(key);\n }\n } catch (err) {\n _didIteratorError1 = true;\n _iteratorError1 = err;\n } finally {\n try {\n if (!_iteratorNormalCompletion1 && _iterator1.return != null) {\n _iterator1.return();\n }\n } finally {\n if (_didIteratorError1) {\n throw _iteratorError1;\n }\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 keys;\n}\nfunction guardColorTable(table, themes) {\n if (guarded.has(table)) return table;\n var keys;\n var proxy = new Proxy(table, {\n get(target, key, receiver) {\n var value = Reflect.get(target, key, receiver);\n if (value !== void 0 || typeof key !== \"string\" || key in target) return value;\n var meant = kebabThemeKey(key);\n if (meant === key) return value;\n keys !== null && keys !== void 0 ? keys : keys = themes();\n if (keys.has(key) || !keys.has(meant)) return value;\n devWarn(\"unknown-token\", {\n component: renderingComponent(),\n value: `$${key}`,\n suggest: `$${meant}`\n });\n return value;\n }\n });\n guarded.add(proxy);\n return proxy;\n}\nfunction guardUnknownTokens(config) {\n if (process.env.NODE_ENV === \"production\") return config;\n var { tokensParsed: tables, themes } = config;\n if (!tables) return config;\n var _iteratorNormalCompletion = true, _didIteratorError = false, _iteratorError = void 0;\n try {\n for (var _iterator = guardedCategories[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) {\n var category = _step.value;\n var table = tables[category];\n if (table) tables[category] = guardTable(table);\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 if (tables.color) tables.color = guardColorTable(tables.color, function() {\n return themeKeysOf(themes);\n });\n return config;\n}\nexport {\n guardUnknownTokens\n};\n//# sourceMappingURL=unknownTokenGuard.js.map\n"],"mappings":";;;;AAEA,IAAI,oBAAoB,CACtB,QACA,OACF;AACA,IAAI,YAAY;AAChB,IAAI,0BAA0B,IAAI,QAAQ;AAC1C,SAAS,WAAW,OAAO;CACzB,IAAI;CACJ,IAAI,QAAQ,CAAC;CACb,IAAI,4BAA4B,MAAM,oBAAoB,OAAO,iBAAiB,KAAK;CACvF,IAAI;EACF,KAAK,IAAI,cAAc,OAAO,UAAU,QAAQ,UAAU,KAAK,IAAI,KAAK,IAAI,MAAM,MAAM,IAAI,OAAO,QAAQ,SAAS,KAAK,IAAI,OAAO,CAAC,EAAC,CAAE,OAAO,SAAS,CAAC,GAAG,OAAO,EAAE,6BAA6B,QAAQ,UAAU,KAAK,EAAC,CAAE,OAAO,4BAA4B,MAAM;GACnQ,IAAI,OAAO,MAAM;GACjB,IAAI;GACJ,IAAI,SAAS,QAAQ,iCAAiC,KAAK,IAAI,OAAO,QAAQ,UAAU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O,YAAY,MAAM;CAC3B,CAAC;CACD,OAAO;AACT"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@multiplatform.one/theme",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "11.0.0",
|
|
4
4
|
"description": "Tamagui theme system for multiplatform.one",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"multiplatform",
|
|
@@ -163,8 +163,8 @@
|
|
|
163
163
|
"access": "public"
|
|
164
164
|
},
|
|
165
165
|
"dependencies": {
|
|
166
|
-
"@multiplatform.one/platform": "^
|
|
167
|
-
"@multiplatform.one/store": "^
|
|
166
|
+
"@multiplatform.one/platform": "^11.0.0",
|
|
167
|
+
"@multiplatform.one/store": "^11.0.0",
|
|
168
168
|
"@tamagui/animations-react-native": "3.2.3",
|
|
169
169
|
"@tamagui/colors": "3.2.3",
|
|
170
170
|
"@tamagui/config": "3.2.3",
|
|
@@ -178,8 +178,8 @@
|
|
|
178
178
|
},
|
|
179
179
|
"devDependencies": {
|
|
180
180
|
"@expo/prebuild-config": "58.0.19",
|
|
181
|
-
"@multiplatform.one/config": "
|
|
182
|
-
"@multiplatform.one/test-utils": "
|
|
181
|
+
"@multiplatform.one/config": "11.0.0",
|
|
182
|
+
"@multiplatform.one/test-utils": "11.0.0",
|
|
183
183
|
"@tamagui/animations-css": "3.2.3",
|
|
184
184
|
"@tamagui/animations-reanimated": "3.2.3",
|
|
185
185
|
"@tamagui/build": "3.2.3",
|
package/src/index.gnome.ts
CHANGED
|
@@ -41,7 +41,7 @@ describe("LC-299 CONTROL-EDGE: control edges clear WCAG 1.4.11's 3:1", () => {
|
|
|
41
41
|
for (const scope of hueScopes) {
|
|
42
42
|
it(`${scope}: field edges hold 3:1 on the page and on their own fill`, () => {
|
|
43
43
|
const page = resolve(scope);
|
|
44
|
-
for (const control of ["Input", "TextArea", "
|
|
44
|
+
for (const control of ["Input", "TextArea", "InputContainerFrame"]) {
|
|
45
45
|
const field = resolve(`${scope}_${control}`);
|
|
46
46
|
for (const key of ["border-color-field", "border-color-field-hover"]) {
|
|
47
47
|
expect(
|
|
@@ -81,7 +81,7 @@ describe("LC-299 CONTROL-EDGE: control edges clear WCAG 1.4.11's 3:1", () => {
|
|
|
81
81
|
const scheme = scope.split("_")[0]!;
|
|
82
82
|
const own = Array.from({ length: 12 }, (_, index) => themes[scope]![`color-${index + 1}`]);
|
|
83
83
|
const pages = hueScopes.filter((name) => name.startsWith(`${scheme}_`)).concat(scheme);
|
|
84
|
-
for (const control of ["Input", "TextArea", "
|
|
84
|
+
for (const control of ["Input", "TextArea", "InputContainerFrame"]) {
|
|
85
85
|
const field = resolve(`${scope}_${control}`);
|
|
86
86
|
for (const key of ["border-color-field", "border-color-field-hover"]) {
|
|
87
87
|
expect(own, `${control} ${key}`).toContain(field[key]);
|
|
@@ -403,21 +403,13 @@ describe("the v5 theme matrix", () => {
|
|
|
403
403
|
const config = createDefaultThemeConfig();
|
|
404
404
|
const themes = config.tamagui.themes as unknown as RawThemes;
|
|
405
405
|
|
|
406
|
-
// LC-151 SURFACE-LADDER: the grouped step. Light lifts cards
|
|
406
|
+
// LC-151 SURFACE-LADDER: the grouped step. Light lifts cards
|
|
407
407
|
// and fields to white on the grey page; dark drops the page to $color1 and
|
|
408
408
|
// lifts them to $color4, iOS's grouped step (FZ-8400). The grouped step is
|
|
409
409
|
// surface1 itself, so it costs no CSS; tracks move to surface2 to stay off
|
|
410
410
|
// a white card.
|
|
411
|
-
it("puts cards
|
|
412
|
-
for (const component of [
|
|
413
|
-
"Card",
|
|
414
|
-
"ListItem",
|
|
415
|
-
"Input",
|
|
416
|
-
"TextArea",
|
|
417
|
-
"InputContainerFrame",
|
|
418
|
-
"SelectTrigger",
|
|
419
|
-
"SelectItem",
|
|
420
|
-
]) {
|
|
411
|
+
it("puts cards and fields on the grouped step", () => {
|
|
412
|
+
for (const component of ["Card", "Input", "TextArea", "InputContainerFrame"]) {
|
|
421
413
|
expect(themes[`light_${component}`].background, `light_${component}`).toBe(
|
|
422
414
|
themes.light["color-1"],
|
|
423
415
|
);
|
|
@@ -438,7 +430,7 @@ describe("the v5 theme matrix", () => {
|
|
|
438
430
|
expect(themes.light_orange_Card.background).toBe(themes.light_orange["color-1"]);
|
|
439
431
|
});
|
|
440
432
|
|
|
441
|
-
const edgeSurfaces = ["_Card", "
|
|
433
|
+
const edgeSurfaces = ["_Card", "_Input", "_TextArea"];
|
|
442
434
|
|
|
443
435
|
// FZ-9281 / LC-148: iOS's dark opaqueSeparator #38383A over its grouped cell
|
|
444
436
|
// #1C1C1E is 1.454:1. Every dark ramp theme's hairline clears that against
|
|
@@ -654,10 +646,10 @@ describe("the v5 theme matrix", () => {
|
|
|
654
646
|
// blocks, which moved it to 424 KB.
|
|
655
647
|
// FZ-9260 adds the sky and plum scopes ocean and paper wear (76 themes,
|
|
656
648
|
// +34,881 bytes when measured on 2026-11-03), and the budget moves to 492 KB.
|
|
657
|
-
it("ships
|
|
649
|
+
it("ships 634 themes and the heading-scope category fonts in under 584 KB of CSS (the v4 matrix and stock spread shipped 913 KB)", async () => {
|
|
658
650
|
const { createTamagui: build } = await vi.importActual<typeof import("tamagui")>("tamagui");
|
|
659
651
|
const css = build(config.tamagui).getCSS();
|
|
660
|
-
expect(Object.keys(themes)).toHaveLength(
|
|
652
|
+
expect(Object.keys(themes)).toHaveLength(634);
|
|
661
653
|
expect(Buffer.byteLength(css, "utf8")).toBeLessThan(584_000);
|
|
662
654
|
});
|
|
663
655
|
});
|
|
@@ -213,13 +213,9 @@ export const houseComponentThemes = {
|
|
|
213
213
|
Progress: { template: "surface2" },
|
|
214
214
|
ProgressIndicator: { template: "surface3" },
|
|
215
215
|
Slider: { template: "surface2" },
|
|
216
|
-
SliderActive: { template: "surface3" },
|
|
217
216
|
SliderThumb: { template: "surface1" },
|
|
218
217
|
Switch: { template: "surface2" },
|
|
219
218
|
Card: { template: "surface1" },
|
|
220
|
-
ListItem: { template: "surface1" },
|
|
221
|
-
SelectTrigger: { template: "surface1" },
|
|
222
|
-
SelectItem: { template: "surface1" },
|
|
223
219
|
InputContainerFrame: { template: "surface1" },
|
|
224
220
|
} as const;
|
|
225
221
|
|