@multiplatform.one/theme 8.2.1 → 8.3.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.
Files changed (151) hide show
  1. package/dist/cjs/audit/constraintAudit.native.js.map +1 -1
  2. package/dist/cjs/audit/designTokens.native.js.map +1 -1
  3. package/dist/cjs/audit/diffReport.native.js.map +1 -1
  4. package/dist/cjs/audit/index.native.js.map +1 -1
  5. package/dist/cjs/audit/themeMatrix.native.js.map +1 -1
  6. package/dist/cjs/dates.native.js.map +1 -1
  7. package/dist/cjs/devWarn.native.js.map +1 -1
  8. package/dist/cjs/expo.native.js.map +1 -1
  9. package/dist/cjs/figma/figmaTokens.native.js.map +1 -1
  10. package/dist/cjs/font.native.js.map +1 -1
  11. package/dist/cjs/fonts/createFontLoader.native.js.map +1 -1
  12. package/dist/cjs/fonts/index.native.js.map +1 -1
  13. package/dist/cjs/fonts/interFaces.native.js.map +1 -1
  14. package/dist/cjs/fonts/types.native.js.map +1 -1
  15. package/dist/cjs/index.gnome.native.js.map +1 -1
  16. package/dist/cjs/index.native.js +1 -1
  17. package/dist/cjs/index.native.js.map +1 -1
  18. package/dist/cjs/keyboardFocusRing.native.js.map +1 -1
  19. package/dist/cjs/menuRow.native.js.map +1 -1
  20. package/dist/cjs/nativeTwins.native.js.map +1 -1
  21. package/dist/cjs/numbers.native.js.map +1 -1
  22. package/dist/cjs/theme/Heading.native.js.map +1 -1
  23. package/dist/cjs/theme/IconSlot.native.js.map +1 -1
  24. package/dist/cjs/theme/Intent.native.js.map +1 -1
  25. package/dist/cjs/theme/Preset.native.js.map +1 -1
  26. package/dist/cjs/theme/PresetContext.native.js.map +1 -1
  27. package/dist/cjs/theme/Surface.native.js.map +1 -1
  28. package/dist/cjs/theme/Text.native.js.map +1 -1
  29. package/dist/cjs/theme/Tint.native.js.map +1 -1
  30. package/dist/cjs/theme/accentInk.native.js.map +1 -1
  31. package/dist/cjs/theme/activateThemeConfig.native.js.map +1 -1
  32. package/dist/cjs/theme/animations/css.native.js.map +1 -1
  33. package/dist/cjs/theme/animations/index.native.js.map +1 -1
  34. package/dist/cjs/theme/animations/reactNative.native.js.map +1 -1
  35. package/dist/cjs/theme/chartPalette.native.js.map +1 -1
  36. package/dist/cjs/theme/colorRules.native.js.map +1 -1
  37. package/dist/cjs/theme/controlTiers.native.js.map +1 -1
  38. package/dist/cjs/theme/cookies.native.js.map +1 -1
  39. package/dist/cjs/theme/createDefaultThemeConfig.native.js.map +1 -1
  40. package/dist/cjs/theme/createThemes.native.js.map +1 -1
  41. package/dist/cjs/theme/dedupeInherited.native.js.map +1 -1
  42. package/dist/cjs/theme/defaults/accent.native.js.map +1 -1
  43. package/dist/cjs/theme/defaults/base.native.js.map +1 -1
  44. package/dist/cjs/theme/defaults/builderOptions.native.js.map +1 -1
  45. package/dist/cjs/theme/defaults/categoryFonts.native.js.map +1 -1
  46. package/dist/cjs/theme/defaults/fonts.native.js.map +1 -1
  47. package/dist/cjs/theme/defaults/house.native.js.map +1 -1
  48. package/dist/cjs/theme/defaults/index.native.js.map +1 -1
  49. package/dist/cjs/theme/devtools/ColorLineVisualizer.native.js.map +1 -1
  50. package/dist/cjs/theme/devtools/ThemeDevtoolsPanel.native.js.map +1 -1
  51. package/dist/cjs/theme/devtools/animationOptions.native.js.map +1 -1
  52. package/dist/cjs/theme/devtools/buildSnapshot.native.js.map +1 -1
  53. package/dist/cjs/theme/devtools/index.native.js.map +1 -1
  54. package/dist/cjs/theme/devtools/knobIcons.native.js.map +1 -1
  55. package/dist/cjs/theme/devtools/vizConstants.native.js.map +1 -1
  56. package/dist/cjs/theme/dynamicType.native.js.map +1 -1
  57. package/dist/cjs/theme/fieldFocus.native.js.map +1 -1
  58. package/dist/cjs/theme/fillContrast.native.js.map +1 -1
  59. package/dist/cjs/theme/focusState.native.js.map +1 -1
  60. package/dist/cjs/theme/fontCategoryMetrics.native.js.map +1 -1
  61. package/dist/cjs/theme/fontCategoryStacks.native.js.map +1 -1
  62. package/dist/cjs/theme/glyphPaint.native.js.map +1 -1
  63. package/dist/cjs/theme/glyphTint.native.js.map +1 -1
  64. package/dist/cjs/theme/groupGeometry.native.js.map +1 -1
  65. package/dist/cjs/theme/index.native.js.map +1 -1
  66. package/dist/cjs/theme/intents.native.js.map +1 -1
  67. package/dist/cjs/theme/knobs.native.js.map +1 -1
  68. package/dist/cjs/theme/layoutTokens.native.js.map +1 -1
  69. package/dist/cjs/theme/listRows.native.js.map +1 -1
  70. package/dist/cjs/theme/mergedTokens.native.js.map +1 -1
  71. package/dist/cjs/theme/motion.native.js.map +1 -1
  72. package/dist/cjs/theme/motionStops.native.js.map +1 -1
  73. package/dist/cjs/theme/motionTiming.native.js.map +1 -1
  74. package/dist/cjs/theme/nativeMonoFamily.native.js.map +1 -1
  75. package/dist/cjs/theme/nativePresetSwitch.native.js.map +1 -1
  76. package/dist/cjs/theme/nativeSchemePreference.cjs +2 -1
  77. package/dist/cjs/theme/nativeSchemePreference.native.js +2 -1
  78. package/dist/cjs/theme/nativeSchemePreference.native.js.map +1 -1
  79. package/dist/cjs/theme/nativeTheme.native.js.map +1 -1
  80. package/dist/cjs/theme/nativeTransitionProps.native.js.map +1 -1
  81. package/dist/cjs/theme/overlaySurfaces.cjs +2 -2
  82. package/dist/cjs/theme/overlaySurfaces.native.js +2 -2
  83. package/dist/cjs/theme/overlaySurfaces.native.js.map +1 -1
  84. package/dist/cjs/theme/pageGutter.native.js.map +1 -1
  85. package/dist/cjs/theme/preset.types.native.js.map +1 -1
  86. package/dist/cjs/theme/presetPreview.native.js.map +1 -1
  87. package/dist/cjs/theme/presetStore.native.js.map +1 -1
  88. package/dist/cjs/theme/presetUserSync.native.js.map +1 -1
  89. package/dist/cjs/theme/presets.native.js.map +1 -1
  90. package/dist/cjs/theme/radiusClass.native.js.map +1 -1
  91. package/dist/cjs/theme/radiusClassTable.generated.native.js.map +1 -1
  92. package/dist/cjs/theme/ramps.native.js.map +1 -1
  93. package/dist/cjs/theme/readableColor.native.js.map +1 -1
  94. package/dist/cjs/theme/recipeInputs.native.js.map +1 -1
  95. package/dist/cjs/theme/recipes.native.js.map +1 -1
  96. package/dist/cjs/theme/reducedMotion.cjs +49 -0
  97. package/dist/cjs/theme/reducedMotion.native.js +81 -0
  98. package/dist/cjs/theme/reducedMotion.native.js.map +1 -0
  99. package/dist/cjs/theme/resolveKnobs.native.js.map +1 -1
  100. package/dist/cjs/theme/scale/activeScale.native.js.map +1 -1
  101. package/dist/cjs/theme/scale/deriveRecipeInputs.native.js.map +1 -1
  102. package/dist/cjs/theme/scale/generateScale.native.js.map +1 -1
  103. package/dist/cjs/theme/scale/index.native.js.map +1 -1
  104. package/dist/cjs/theme/scale/scaleAttribute.native.js.map +1 -1
  105. package/dist/cjs/theme/scale/scaleCss.native.js.map +1 -1
  106. package/dist/cjs/theme/scale/scaleFonts.native.js.map +1 -1
  107. package/dist/cjs/theme/scale/scaleInputs.native.js.map +1 -1
  108. package/dist/cjs/theme/scale/themeScales.native.js.map +1 -1
  109. package/dist/cjs/theme/scale/useActiveScale.native.js.map +1 -1
  110. package/dist/cjs/theme/schemeStore.native.js.map +1 -1
  111. package/dist/cjs/theme/shared.native.js.map +1 -1
  112. package/dist/cjs/theme/sizeRecipes.native.js.map +1 -1
  113. package/dist/cjs/theme/subsetThemes.native.js.map +1 -1
  114. package/dist/cjs/theme/themeValue.native.js.map +1 -1
  115. package/dist/cjs/theme/tileSizes.native.js.map +1 -1
  116. package/dist/cjs/theme/tintHues.native.js.map +1 -1
  117. package/dist/cjs/theme/touchManipulation.native.js.map +1 -1
  118. package/dist/cjs/theme/useResolvedKnobs.cjs +2 -22
  119. package/dist/cjs/theme/useResolvedKnobs.native.js +2 -30
  120. package/dist/cjs/theme/useResolvedKnobs.native.js.map +1 -1
  121. package/dist/cjs/theme/useTouchSurface.native.js.map +1 -1
  122. package/dist/cjs/theme/v3TokenRoles.native.js.map +1 -1
  123. package/dist/esm/theme/nativeSchemePreference.mjs +2 -1
  124. package/dist/esm/theme/nativeSchemePreference.mjs.map +1 -1
  125. package/dist/esm/theme/nativeSchemePreference.native.js +2 -1
  126. package/dist/esm/theme/nativeSchemePreference.native.js.map +1 -1
  127. package/dist/esm/theme/overlaySurfaces.mjs +2 -2
  128. package/dist/esm/theme/overlaySurfaces.native.js +2 -2
  129. package/dist/esm/theme/reducedMotion.mjs +24 -0
  130. package/dist/esm/theme/reducedMotion.mjs.map +1 -0
  131. package/dist/esm/theme/reducedMotion.native.js +53 -0
  132. package/dist/esm/theme/reducedMotion.native.js.map +1 -0
  133. package/dist/esm/theme/useResolvedKnobs.mjs +2 -22
  134. package/dist/esm/theme/useResolvedKnobs.mjs.map +1 -1
  135. package/dist/esm/theme/useResolvedKnobs.native.js +2 -30
  136. package/dist/esm/theme/useResolvedKnobs.native.js.map +1 -1
  137. package/package.json +5 -5
  138. package/src/theme/nativeSchemePreference.ts +2 -1
  139. package/src/theme/overlaySurfaces.tsx +2 -2
  140. package/src/theme/reducedMotion.native.spec.ts +28 -0
  141. package/src/theme/reducedMotion.native.ts +36 -0
  142. package/src/theme/reducedMotion.ts +27 -0
  143. package/src/theme/sheetGrabber.spec.ts +4 -0
  144. package/src/theme/useResolvedKnobs.ts +2 -27
  145. package/types/theme/nativeSchemePreference.d.ts.map +1 -1
  146. package/types/theme/overlaySurfaces.d.ts +2 -2
  147. package/types/theme/reducedMotion.d.ts +3 -0
  148. package/types/theme/reducedMotion.d.ts.map +1 -0
  149. package/types/theme/reducedMotion.native.d.ts +3 -0
  150. package/types/theme/reducedMotion.native.d.ts.map +1 -0
  151. package/types/theme/useResolvedKnobs.d.ts.map +1 -1
@@ -0,0 +1,36 @@
1
+ import { useSyncExternalStore } from "react";
2
+ import { AccessibilityInfo } from "react-native";
3
+
4
+ let reduced = false;
5
+ let primed = false;
6
+ const listeners = new Set<() => void>();
7
+
8
+ function set(value: boolean) {
9
+ if (value === reduced) return;
10
+ reduced = value;
11
+ for (const notify of listeners) notify();
12
+ }
13
+
14
+ function prime() {
15
+ if (primed) return;
16
+ primed = true;
17
+ AccessibilityInfo.isReduceMotionEnabled?.()
18
+ .then(set)
19
+ .catch(() => {});
20
+ AccessibilityInfo.addEventListener?.("reduceMotionChanged", set);
21
+ }
22
+
23
+ function subscribe(notify: () => void) {
24
+ prime();
25
+ listeners.add(notify);
26
+ return () => {
27
+ listeners.delete(notify);
28
+ };
29
+ }
30
+
31
+ const read = () => reduced;
32
+
33
+ /** iOS Reduce Motion and Android's remove-animations setting (LC-68 on native, FZ-8075). */
34
+ export function usePrefersReducedMotion(): boolean {
35
+ return useSyncExternalStore(subscribe, read, read);
36
+ }
@@ -0,0 +1,27 @@
1
+ import { useSyncExternalStore } from "react";
2
+
3
+ const reducedMotionQuery = "(prefers-reduced-motion: reduce)";
4
+ const serverReducedMotion = () => false;
5
+
6
+ function readReducedMotion(): boolean {
7
+ return typeof window !== "undefined" && !!window.matchMedia?.(reducedMotionQuery).matches;
8
+ }
9
+
10
+ function subscribeReducedMotion(notify: () => void) {
11
+ if (typeof window === "undefined" || !window.matchMedia) return () => {};
12
+ const mq = window.matchMedia(reducedMotionQuery);
13
+ if (typeof mq.addEventListener === "function") {
14
+ mq.addEventListener("change", notify);
15
+ return () => mq.removeEventListener("change", notify);
16
+ }
17
+ if (typeof mq.addListener === "function") {
18
+ mq.addListener(notify);
19
+ return () => mq.removeListener?.(notify);
20
+ }
21
+ return () => {};
22
+ }
23
+
24
+ /** Adopt the OS motion preference after matching the server's initial markup. */
25
+ export function usePrefersReducedMotion(): boolean {
26
+ return useSyncExternalStore(subscribeReducedMotion, readReducedMotion, serverReducedMotion);
27
+ }
@@ -6,6 +6,10 @@ describe("sheetGrabber (FZ-8648)", () => {
6
6
  expect(sheetGrabber).toMatchObject({ width: 36, height: 5, marginTop: 5, alignSelf: "center" });
7
7
  });
8
8
 
9
+ it("draws in the label ink at 30%, iOS's tertiary label, so it reads on a light and a dark sheet", () => {
10
+ expect(sheetGrabber).toMatchObject({ backgroundColor: "$color12", opacity: 0.3 });
11
+ });
12
+
9
13
  it("takes no height, so it lands the same above a frame and inside a grab zone", () => {
10
14
  expect(sheetGrabber.marginTop + sheetGrabber.height + sheetGrabber.marginBottom).toBe(0);
11
15
  });
@@ -1,4 +1,4 @@
1
- import { createContext, useContext, useMemo, useSyncExternalStore } from "react";
1
+ import { createContext, useContext, useMemo } from "react";
2
2
  import { type SizeTokens, useThemeName } from "tamagui";
3
3
  import { useTouchSurface } from "./useTouchSurface";
4
4
  import { defaultKnobs, type Knobs } from "./knobs";
@@ -8,6 +8,7 @@ import { resolveKnobs } from "./resolveKnobs";
8
8
  import { usePresetContext } from "./PresetContext";
9
9
  import { defaultIntents } from "./intents";
10
10
  import { clampSurfaceSize, SurfaceContext } from "./Surface";
11
+ import { usePrefersReducedMotion } from "./reducedMotion";
11
12
 
12
13
  export const IntentContext = createContext<string | null>(null);
13
14
 
@@ -15,32 +16,6 @@ export function useIntentContext(): string | null {
15
16
  return useContext(IntentContext);
16
17
  }
17
18
 
18
- const reducedMotionQuery = "(prefers-reduced-motion: reduce)";
19
- const serverReducedMotion = () => false;
20
-
21
- function readReducedMotion(): boolean {
22
- return typeof window !== "undefined" && !!window.matchMedia?.(reducedMotionQuery).matches;
23
- }
24
-
25
- function subscribeReducedMotion(notify: () => void) {
26
- if (typeof window === "undefined" || !window.matchMedia) return () => {};
27
- const mq = window.matchMedia(reducedMotionQuery);
28
- if (typeof mq.addEventListener === "function") {
29
- mq.addEventListener("change", notify);
30
- return () => mq.removeEventListener("change", notify);
31
- }
32
- if (typeof mq.addListener === "function") {
33
- mq.addListener(notify);
34
- return () => mq.removeListener?.(notify);
35
- }
36
- return () => {};
37
- }
38
-
39
- /** Adopt the OS motion preference after matching the server's initial markup. */
40
- function usePrefersReducedMotion(): boolean {
41
- return useSyncExternalStore(subscribeReducedMotion, readReducedMotion, serverReducedMotion);
42
- }
43
-
44
19
  export interface UseResolvedKnobsOptions {
45
20
  intent?: string;
46
21
  component?: string;
@@ -1 +1 @@
1
- {"version":3,"file":"nativeSchemePreference.d.ts","sourceRoot":"","sources":["../../src/theme/nativeSchemePreference.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,YAAY,CAAC;AAE9C,MAAM,WAAW,gBAAgB;IAC/B,OAAO,EAAE,WAAW,CAAC;IACrB,KAAK,EAAE,OAAO,GAAG,MAAM,CAAC;IACxB,GAAG,CAAC,MAAM,EAAE,WAAW,GAAG,IAAI,CAAC;CAChC;AAgCD,wBAAgB,mBAAmB,IAAI,gBAAgB,CActD"}
1
+ {"version":3,"file":"nativeSchemePreference.d.ts","sourceRoot":"","sources":["../../src/theme/nativeSchemePreference.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,YAAY,CAAC;AAE9C,MAAM,WAAW,gBAAgB;IAC/B,OAAO,EAAE,WAAW,CAAC;IACrB,KAAK,EAAE,OAAO,GAAG,MAAM,CAAC;IACxB,GAAG,CAAC,MAAM,EAAE,WAAW,GAAG,IAAI,CAAC;CAChC;AAgCD,wBAAgB,mBAAmB,IAAI,gBAAgB,CAetD"}
@@ -18,8 +18,8 @@ export declare const sheetGrabber: {
18
18
  readonly width: 36;
19
19
  readonly height: 5;
20
20
  readonly borderRadius: 100;
21
- readonly backgroundColor: "$color8";
22
- readonly opacity: 0.45;
21
+ readonly backgroundColor: "$color12";
22
+ readonly opacity: 0.3;
23
23
  readonly alignSelf: "center";
24
24
  readonly marginHorizontal: 0;
25
25
  readonly marginTop: 5;
@@ -0,0 +1,3 @@
1
+ /** Adopt the OS motion preference after matching the server's initial markup. */
2
+ export declare function usePrefersReducedMotion(): boolean;
3
+ //# sourceMappingURL=reducedMotion.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"reducedMotion.d.ts","sourceRoot":"","sources":["../../src/theme/reducedMotion.ts"],"names":[],"mappings":"AAuBA,iFAAiF;AACjF,wBAAgB,uBAAuB,IAAI,OAAO,CAEjD"}
@@ -0,0 +1,3 @@
1
+ /** iOS Reduce Motion and Android's remove-animations setting (LC-68 on native, FZ-8075). */
2
+ export declare function usePrefersReducedMotion(): boolean;
3
+ //# sourceMappingURL=reducedMotion.native.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"reducedMotion.native.d.ts","sourceRoot":"","sources":["../../src/theme/reducedMotion.native.ts"],"names":[],"mappings":"AAgCA,4FAA4F;AAC5F,wBAAgB,uBAAuB,IAAI,OAAO,CAEjD"}
@@ -1 +1 @@
1
- {"version":3,"file":"useResolvedKnobs.d.ts","sourceRoot":"","sources":["../../src/theme/useResolvedKnobs.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,KAAK,UAAU,EAAgB,MAAM,SAAS,CAAC;AAIxD,OAAO,KAAK,EAAE,iBAAiB,EAAE,aAAa,EAAE,MAAM,WAAW,CAAC;AAMlE,eAAO,MAAM,aAAa,wCAAqC,CAAC;AAEhE,wBAAgB,gBAAgB,IAAI,MAAM,GAAG,IAAI,CAEhD;AA4BD,MAAM,WAAW,uBAAuB;IACtC,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,QAAQ,CAAC,EAAE,iBAAiB,CAAC;IAC7B;;;;OAIG;IACH,IAAI,CAAC,EAAE,UAAU,CAAC;IAClB;;;OAGG;IACH,OAAO,CAAC,EAAE,OAAO,CAAC;CACnB;AAED,eAAO,MAAM,kBAAkB,aAA2C,CAAC;AAE3E;;;;;GAKG;AACH,eAAO,MAAM,kBAAkB,aAAsB,CAAC;AAEtD;;;;;;;;;;;;GAYG;AACH,wBAAgB,gBAAgB,CAAC,OAAO,CAAC,EAAE,uBAAuB,GAAG,aAAa,CAgFjF"}
1
+ {"version":3,"file":"useResolvedKnobs.d.ts","sourceRoot":"","sources":["../../src/theme/useResolvedKnobs.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,KAAK,UAAU,EAAgB,MAAM,SAAS,CAAC;AAIxD,OAAO,KAAK,EAAE,iBAAiB,EAAE,aAAa,EAAE,MAAM,WAAW,CAAC;AAOlE,eAAO,MAAM,aAAa,wCAAqC,CAAC;AAEhE,wBAAgB,gBAAgB,IAAI,MAAM,GAAG,IAAI,CAEhD;AAED,MAAM,WAAW,uBAAuB;IACtC,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,QAAQ,CAAC,EAAE,iBAAiB,CAAC;IAC7B;;;;OAIG;IACH,IAAI,CAAC,EAAE,UAAU,CAAC;IAClB;;;OAGG;IACH,OAAO,CAAC,EAAE,OAAO,CAAC;CACnB;AAED,eAAO,MAAM,kBAAkB,aAA2C,CAAC;AAE3E;;;;;GAKG;AACH,eAAO,MAAM,kBAAkB,aAAsB,CAAC;AAEtD;;;;;;;;;;;;GAYG;AACH,wBAAgB,gBAAgB,CAAC,OAAO,CAAC,EAAE,uBAAuB,GAAG,aAAa,CAgFjF"}