@multiplatform.one/config 7.65.2 → 7.67.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/design-lint.mjs CHANGED
@@ -136,6 +136,12 @@ export function mpoRoleOf(componentName) {
136
136
  return found && { role: found, stem };
137
137
  }
138
138
  // A spread of a knob bundle that carries surface paint (knobProps.surface).
139
+ // FZ-7680: on native every glyph must reach MPO's theme-ink IconBase, which
140
+ // the toolchain swaps in behind the bare `@phosphor-icons/react` import. A
141
+ // deep subpath or phosphor-react-native itself skips that swap and paints a
142
+ // missing or token colour black. Only the MPO icon shims may name them.
143
+ const phosphorBypass = /^(?:@phosphor-icons\/react\/.+|phosphor-react-native(?:\/.*)?)$/;
144
+ const phosphorShim = /(?:^|[\\/])shims[\\/][^\\/]*phosphor[^\\/]*$/i;
139
145
  const surfaceSpread = /\b(?:surface|elevation|containerRadius|radius|border|card|panel)\w*$/i;
140
146
  const rawPrimitive =
141
147
  /^(?:View|XStack|YStack|Stack|ZStack|HStack|VStack|SafeAreaView|ScrollView|Pressable|TouchableOpacity|TouchableHighlight|Text|SizableText|Paragraph|Animated\.View|div|section|nav|header|footer|aside|span|li|ul)$/;
@@ -149,6 +155,7 @@ export const designRules = [
149
155
  "geometry",
150
156
  "inline-spacing",
151
157
  "mpo-role",
158
+ "phosphor-import",
152
159
  "raw-control",
153
160
  "raw-icon",
154
161
  "styled-mpo",
@@ -458,7 +465,32 @@ export function inspectDesign(source, filename, projectRoot = process.cwd()) {
458
465
  }
459
466
  });
460
467
  }
468
+ function moduleImported(node) {
469
+ if (
470
+ (ts.isImportDeclaration(node) || ts.isExportDeclaration(node)) &&
471
+ node.moduleSpecifier &&
472
+ ts.isStringLiteralLike(node.moduleSpecifier)
473
+ )
474
+ return node.moduleSpecifier.text;
475
+ if (
476
+ ts.isCallExpression(node) &&
477
+ (node.expression.kind === ts.SyntaxKind.ImportKeyword ||
478
+ (ts.isIdentifier(node.expression) && node.expression.text === "require")) &&
479
+ node.arguments[0] &&
480
+ ts.isStringLiteralLike(node.arguments[0])
481
+ )
482
+ return node.arguments[0].text;
483
+ return undefined;
484
+ }
485
+ const phosphorShimFile = phosphorShim.test(filename);
461
486
  function visit(node) {
487
+ const imported = moduleImported(node);
488
+ if (imported && !phosphorShimFile && phosphorBypass.test(imported))
489
+ report(
490
+ node,
491
+ "phosphor-import",
492
+ `Import icons from "@phosphor-icons/react"; "${imported}" skips MPO's native theme-ink IconBase and paints black in dark mode (FZ-7680).`,
493
+ );
462
494
  const icon =
463
495
  ts.isJsxOpeningElement(node) || ts.isJsxSelfClosingElement(node)
464
496
  ? node.tagName
package/lib/index.js CHANGED
@@ -1,4 +1,4 @@
1
- import { t as createViteConfig } from "./vite-B4uRAr9Z.js";
1
+ import { t as createViteConfig } from "./vite-ByHQLuSq.js";
2
2
  import { i as phosphorTokenColorPlugin, n as tamaguiWorkspacePathsFile, t as ensureTamaguiWorkspacePaths } from "./tamaguiWorkspacePaths-DR3dud79.js";
3
3
  import { t as createStorybookViteConfig } from "./storybook-CT-nBzSF.js";
4
4
  import { createVitestConfig } from "./vitest.js";
@@ -796,9 +796,14 @@ function registerNativePhosphorIcons() {
796
796
  } catch {
797
797
  nativeEntry = null;
798
798
  }
799
+ const iconBase = nativeEntry ? phosphorNativeIconBase(nativeEntry) : null;
799
800
  g.__vxrnAddNativePlugins.push({
800
801
  name,
801
- resolveId(id) {
802
+ resolveId(id, importer) {
803
+ if (iconBase) {
804
+ const swapped = iconBase(id, importer);
805
+ if (swapped) return swapped;
806
+ }
802
807
  if (id !== "@phosphor-icons/react") return null;
803
808
  if (!nativeEntry) {
804
809
  console.warn("[config] @phosphor-icons/react imported in the native graph but phosphor-react-native is not installed — icons will crash Hermes. Add phosphor-react-native to your app dependencies.");
@@ -808,6 +813,28 @@ function registerNativePhosphorIcons() {
808
813
  }
809
814
  });
810
815
  }
816
+ const phosphorNativeIconBaseId = "#mpo/phosphor-native-icon-base";
817
+ /**
818
+ * Every phosphor-react-native glyph renders through its `lib/icon-base`, which
819
+ * paints a missing colour `#000` and a Tamagui token as no paint (black too).
820
+ * This resolver hands each icon module MPO's theme-ink IconBase instead
821
+ * (src/shims/phosphorIconBase.native.js), so no call site can draw a black
822
+ * glyph on the dark scheme (FZ-7680); the shim reaches the original through
823
+ * `phosphorNativeIconBaseId`. Null when the shim or the original is missing.
824
+ */
825
+ function phosphorNativeIconBase(nativeEntry) {
826
+ const here = path.dirname(new URL(import.meta.url).pathname);
827
+ const shim = [path.resolve(here, "shims/phosphorIconBase.native.js"), path.resolve(here, "../src/shims/phosphorIconBase.native.js")].find((candidate) => fs.existsSync(candidate));
828
+ const original = path.join(path.dirname(nativeEntry), "lib", "icon-base.js");
829
+ if (!shim || !fs.existsSync(original)) return null;
830
+ const packageDir = `${path.sep}phosphor-react-native${path.sep}`;
831
+ const iconBaseImport = /(?:^|[\\/])lib[\\/]icon-base(?:\.js)?$/;
832
+ return (id, importer) => {
833
+ if (id === "#mpo/phosphor-native-icon-base") return original;
834
+ if (!importer || importer === shim || !importer.includes(packageDir)) return null;
835
+ return iconBaseImport.test(id) ? shim : null;
836
+ };
837
+ }
811
838
  /**
812
839
  * package.json `exports` cannot branch on whether `dist/` exists. For workspace
813
840
  * packages, prefer `dist/esm/index.{mjs,js}` when built; otherwise fall back to
@@ -843,4 +870,4 @@ function preferBuiltWorkspaceEntryPlugin() {
843
870
  }
844
871
 
845
872
  //#endregion
846
- export { publicConfigPlugin as n, readPublicConfigKeys as r, createViteConfig as t };
873
+ export { readPublicConfigKeys as a, publicConfigPlugin as i, phosphorNativeIconBase as n, phosphorNativeIconBaseId as r, createViteConfig as t };
package/lib/vite.js CHANGED
@@ -1,5 +1,5 @@
1
- import { n as publicConfigPlugin, r as readPublicConfigKeys, t as createViteConfig } from "./vite-B4uRAr9Z.js";
1
+ import { a as readPublicConfigKeys, i as publicConfigPlugin, n as phosphorNativeIconBase, r as phosphorNativeIconBaseId, t as createViteConfig } from "./vite-ByHQLuSq.js";
2
2
  import { i as phosphorTokenColorPlugin } from "./tamaguiWorkspacePaths-DR3dud79.js";
3
3
  import { a as staleNativeDistSource, i as resolveWorkspaceNativeEntry, n as publicPackageViteSourceAliases, t as discoverPublicPackageRoots } from "./workspacePublicPackages-DltEXVBc.js";
4
4
 
5
- export { createViteConfig, discoverPublicPackageRoots, phosphorTokenColorPlugin, publicConfigPlugin, publicPackageViteSourceAliases, readPublicConfigKeys, resolveWorkspaceNativeEntry, staleNativeDistSource };
5
+ export { createViteConfig, discoverPublicPackageRoots, phosphorNativeIconBase, phosphorNativeIconBaseId, phosphorTokenColorPlugin, publicConfigPlugin, publicPackageViteSourceAliases, readPublicConfigKeys, resolveWorkspaceNativeEntry, staleNativeDistSource };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@multiplatform.one/config",
3
- "version": "7.65.2",
3
+ "version": "7.67.0",
4
4
  "description": "Shared build and test configuration presets for multiplatform.one",
5
5
  "keywords": [
6
6
  "config",
@@ -100,13 +100,21 @@
100
100
  "default": "./lint.mjs",
101
101
  "import": "./lint.mjs"
102
102
  },
103
- "./design-lint": "./design-lint.mjs"
103
+ "./design-lint": "./design-lint.mjs",
104
+ "./phosphor-theme-ink": {
105
+ "types": "./src/shims/phosphorThemeInk.d.ts",
106
+ "default": "./src/shims/phosphorThemeInk.js"
107
+ },
108
+ "./phosphor-native-probe": {
109
+ "types": "./src/shims/phosphorNativeProbe.d.ts",
110
+ "default": "./src/shims/phosphorNativeProbe.js"
111
+ }
104
112
  },
105
113
  "publishConfig": {
106
114
  "access": "public"
107
115
  },
108
116
  "dependencies": {
109
- "@multiplatform.one/utils": "^7.65.2",
117
+ "@multiplatform.one/utils": "^7.67.0",
110
118
  "@tamagui/vite-plugin": "2.7.6",
111
119
  "@vitejs/plugin-react": "^6.1.2",
112
120
  "dotenv": "^17.4.2",
@@ -123,7 +131,9 @@
123
131
  "peerDependencies": {
124
132
  "@playwright/test": ">=1.20.0",
125
133
  "one": "^1.4.10",
134
+ "react": ">=19.0.0",
126
135
  "react-native": ">=0.83.0",
136
+ "tamagui": ">=2.0.0",
127
137
  "vxrn": "^1.4.10"
128
138
  },
129
139
  "peerDependenciesMeta": {
@@ -133,9 +143,15 @@
133
143
  "one": {
134
144
  "optional": true
135
145
  },
146
+ "react": {
147
+ "optional": true
148
+ },
136
149
  "react-native": {
137
150
  "optional": true
138
151
  },
152
+ "tamagui": {
153
+ "optional": true
154
+ },
139
155
  "vxrn": {
140
156
  "optional": true
141
157
  }
@@ -0,0 +1,117 @@
1
+ /**
2
+ * FZ-7680: on native every phosphor glyph renders through MPO's theme-ink
3
+ * IconBase, so a missing colour, a token or `currentColor` takes the theme's
4
+ * ink instead of phosphor-react-native's `#000`. The render proof lives in
5
+ * public/components/src/icons/nativeIconInk.dark.spec.tsx; these hold the
6
+ * resolver and the toolchain swap that puts it in the native bundle.
7
+ */
8
+ import fs from "node:fs";
9
+ import Module from "node:module";
10
+ import path from "node:path";
11
+ import { fileURLToPath } from "node:url";
12
+ import { beforeEach, describe, expect, it } from "vitest";
13
+ import { isBlackPaint, nativePaint } from "./shims/phosphorNativeProbe.js";
14
+ import { resolveIconInk } from "./shims/phosphorThemeInk.js";
15
+ import { createViteConfig, phosphorNativeIconBase, phosphorNativeIconBaseId } from "./vite.js";
16
+
17
+ type Resolver = { name?: string; resolveId?: (id: string, importer?: string) => unknown };
18
+ const native = globalThis as unknown as { __vxrnAddNativePlugins?: Resolver[] };
19
+
20
+ const dark = {
21
+ color: { val: "#eeeeee" },
22
+ color10: { val: "#7a7a7a" },
23
+ color12: { val: "#ededed" },
24
+ textMuted: { val: "#a0a0a0" },
25
+ };
26
+
27
+ describe("resolveIconInk", () => {
28
+ it.each([
29
+ [undefined, "#eeeeee"],
30
+ [null, "#eeeeee"],
31
+ ["", "#eeeeee"],
32
+ ["currentColor", "#eeeeee"],
33
+ ["$textMuted", "#a0a0a0"],
34
+ ["textMuted", "#a0a0a0"],
35
+ ["$color12", "#ededed"],
36
+ ["$notInTheme", "#eeeeee"],
37
+ ["#ff0000", "#ff0000"],
38
+ ["rgb(1, 2, 3)", "rgb(1, 2, 3)"],
39
+ ])("%s paints %s on the dark theme", (color, paint) => {
40
+ expect(resolveIconInk(dark, color)).toBe(paint);
41
+ });
42
+
43
+ it("falls back down the ink ramp when the theme carries no `color`", () => {
44
+ expect(resolveIconInk({ color12: { val: "#ddd" } }, undefined)).toBe("#ddd");
45
+ expect(resolveIconInk({ color11: { val: "#ccc" } }, "$missing")).toBe("#ccc");
46
+ });
47
+
48
+ it("never hands back a token, so react-native-svg always gets a paint", () => {
49
+ for (const color of [undefined, "$color10", "$missing", "currentColor"])
50
+ expect(resolveIconInk(dark, color).startsWith("$")).toBe(false);
51
+ });
52
+ });
53
+
54
+ describe("native paint probe", () => {
55
+ it("paints what react-native-svg draws for a colour it cannot read: black", () => {
56
+ for (const color of [undefined, "", "currentColor", "$color12"])
57
+ expect(isBlackPaint(nativePaint(color))).toBe(true);
58
+ expect(isBlackPaint(nativePaint("#eeeeee"))).toBe(false);
59
+ });
60
+
61
+ it.each(["#000", "#000000", "#000f", "black", "rgb(0, 0, 0)", "rgba(0,0,0,1)"])(
62
+ "%s is black",
63
+ (paint) => expect(isBlackPaint(paint)).toBe(true),
64
+ );
65
+ it.each(["#111", "#eeeeee", "rgba(0,0,0,0.4)", "hsl(270, 6%, 93%)"])("%s is not black", (paint) =>
66
+ expect(isBlackPaint(paint)).toBe(false),
67
+ );
68
+ });
69
+
70
+ describe("phosphorNativeIconBase", () => {
71
+ const require = Module.createRequire(import.meta.url);
72
+ const cjsEntry = require.resolve("phosphor-react-native", {
73
+ paths: [path.resolve(path.dirname(fileURLToPath(import.meta.url)), "../../..")],
74
+ });
75
+ const entry = cjsEntry.replace(
76
+ `${path.sep}lib${path.sep}commonjs${path.sep}`,
77
+ `${path.sep}lib${path.sep}module${path.sep}`,
78
+ );
79
+ const icons = path.join(path.dirname(entry), "icons");
80
+ const original = path.join(path.dirname(entry), "lib", "icon-base.js");
81
+
82
+ it("hands every phosphor-react-native icon MPO's theme-ink IconBase", () => {
83
+ const swap = phosphorNativeIconBase(entry);
84
+ expect(swap).not.toBeNull();
85
+ const shim = swap!("../lib/icon-base", path.join(icons, "Clock.js")) as string;
86
+ expect(shim).toMatch(/shims[\\/]phosphorIconBase\.native\.js$/);
87
+ expect(fs.readFileSync(shim, "utf8")).toContain(phosphorNativeIconBaseId);
88
+ expect(swap!(phosphorNativeIconBaseId, shim)).toBe(original);
89
+ expect(fs.existsSync(original)).toBe(true);
90
+ });
91
+
92
+ it("leaves the original's own imports and everything outside phosphor alone", () => {
93
+ const swap = phosphorNativeIconBase(entry)!;
94
+ const shim = swap("../lib/icon-base", path.join(icons, "Clock.js")) as string;
95
+ expect(swap("../lib/icon-base", shim)).toBeNull();
96
+ expect(swap("../lib", original)).toBeNull();
97
+ expect(swap("../lib/icon-base", "/app/src/lib/icon-user.js")).toBeNull();
98
+ expect(swap("./lib/icon-base", undefined)).toBeNull();
99
+ });
100
+
101
+ describe("createViteConfig({ one: true })", () => {
102
+ beforeEach(() => {
103
+ delete native.__vxrnAddNativePlugins;
104
+ });
105
+
106
+ it("registers the swap in the native graph", () => {
107
+ createViteConfig({ one: true });
108
+ const plugin = native.__vxrnAddNativePlugins?.find(
109
+ (p) => p.name === "vxrn-phosphor-native-icons",
110
+ );
111
+ expect(plugin?.resolveId?.("@phosphor-icons/react")).toBe(entry);
112
+ expect(plugin?.resolveId?.("../lib/icon-base", path.join(icons, "Clock.js"))).toMatch(
113
+ /phosphorIconBase\.native\.js$/,
114
+ );
115
+ });
116
+ });
117
+ });
@@ -0,0 +1,5 @@
1
+ import IconBase from "#mpo/phosphor-native-icon-base";
2
+ import { useTheme } from "tamagui";
3
+ import { themeInkIconBase } from "./phosphorThemeInk.js";
4
+
5
+ export default themeInkIconBase(IconBase, useTheme);
@@ -0,0 +1,6 @@
1
+ export declare function nativePaint(color: unknown): string;
2
+ export declare function isBlackPaint(paint: unknown): boolean;
3
+ export declare function nativePhosphorModule<M extends Record<string, unknown>>(
4
+ real: M,
5
+ useTheme: () => unknown,
6
+ ): M;
@@ -0,0 +1,54 @@
1
+ import { createElement } from "react";
2
+ import { themeInkIconBase } from "./phosphorThemeInk.js";
3
+
4
+ /**
5
+ * What a phosphor-react-native glyph paints for the colour its IconBase is
6
+ * handed: react-native-svg has no colour inheritance, so no colour, a
7
+ * Tamagui token or `currentColor` all draw black.
8
+ *
9
+ * @param {unknown} color
10
+ * @returns {string}
11
+ */
12
+ export function nativePaint(color) {
13
+ if (typeof color !== "string" || color === "" || color === "currentColor") return "#000";
14
+ return color.charAt(0) === "$" ? "#000" : color;
15
+ }
16
+
17
+ /**
18
+ * @param {unknown} paint
19
+ * @returns {boolean}
20
+ */
21
+ export function isBlackPaint(paint) {
22
+ const value = String(paint).replace(/\s+/g, "").toLowerCase();
23
+ return (
24
+ value === "black" ||
25
+ /^#0{3}(?:f|ff)?$/.test(value) ||
26
+ /^#0{6}(?:ff)?$/.test(value) ||
27
+ /^rgba?\(0,0,0(?:,1(?:\.0+)?)?\)$/.test(value) ||
28
+ /^hsla?\(0(?:deg)?,0%?,0%(?:,1(?:\.0+)?)?\)$/.test(value)
29
+ );
30
+ }
31
+
32
+ function NativeIconProbe({ color, name }) {
33
+ return createElement("span", { "data-native-icon": name, "data-paint": nativePaint(color) });
34
+ }
35
+
36
+ /**
37
+ * A stand-in for `@phosphor-icons/react` as the native bundle sees it: every
38
+ * icon renders through MPO's theme-ink IconBase (the swap the toolchain makes,
39
+ * FZ-7680) onto a probe that records the paint react-native-svg would draw.
40
+ * Specs mock the module with it and assert no glyph comes out black.
41
+ *
42
+ * @param {Record<string, unknown>} real the real `@phosphor-icons/react` module
43
+ * @param {() => unknown} useTheme
44
+ */
45
+ export function nativePhosphorModule(real, useTheme) {
46
+ const Base = themeInkIconBase(NativeIconProbe, useTheme);
47
+ const icons = {};
48
+ for (const [key, value] of Object.entries(real)) {
49
+ if (!/^[A-Z]/.test(key) || /^(?:IconContext|IconBase|SSRBase)$/.test(key)) continue;
50
+ if (typeof value !== "function" && (typeof value !== "object" || value === null)) continue;
51
+ icons[key] = (props) => createElement(Base, { ...props, name: key });
52
+ }
53
+ return { ...real, ...icons };
54
+ }
@@ -0,0 +1,11 @@
1
+ import type { ComponentType } from "react";
2
+
3
+ export declare function resolveIconInk(
4
+ theme: Record<string, unknown> | null | undefined,
5
+ color: unknown,
6
+ ): string;
7
+
8
+ export declare function themeInkIconBase<P extends { color?: unknown }>(
9
+ IconBase: ComponentType<P>,
10
+ useTheme: () => unknown,
11
+ ): ComponentType<P>;
@@ -0,0 +1,50 @@
1
+ import { createElement } from "react";
2
+
3
+ const blank = (value) =>
4
+ value == null || value === "" || value === "undefined" || value === "currentColor";
5
+
6
+ function paintOf(entry) {
7
+ const value = entry != null && typeof entry === "object" ? entry.val : entry;
8
+ return typeof value === "string" && !blank(value) && value.charAt(0) !== "$" ? value : undefined;
9
+ }
10
+
11
+ /**
12
+ * The paint a phosphor glyph gets on native (FZ-7680). React Native has no
13
+ * colour inheritance: phosphor-react-native paints a glyph with no colour in
14
+ * its IconContext default, `#000`, and react-native-svg reads a Tamagui token
15
+ * or `currentColor` as no paint at all, which also draws black. So a token
16
+ * (`$color10`) or a bare theme key (`color10`) resolves through the theme in
17
+ * scope, a concrete paint passes through, and anything else takes the
18
+ * theme's ink. Never undefined, never a token, never `currentColor`.
19
+ *
20
+ * @param {Record<string, unknown> | null | undefined} theme
21
+ * @param {unknown} color
22
+ * @returns {string}
23
+ */
24
+ export function resolveIconInk(theme, color) {
25
+ const scope = theme ?? {};
26
+ if (typeof color === "string" && !blank(color)) {
27
+ const key = color.charAt(0) === "$" ? color.slice(1) : color;
28
+ const fromTheme = paintOf(scope[key]);
29
+ if (fromTheme) return fromTheme;
30
+ if (color.charAt(0) !== "$") return color;
31
+ }
32
+ return paintOf(scope.color) ?? paintOf(scope.color12) ?? paintOf(scope.color11) ?? "currentColor";
33
+ }
34
+
35
+ /**
36
+ * Wraps phosphor-react-native's IconBase so every glyph, whoever renders it
37
+ * and however its colour was (or was not) passed, paints from the theme.
38
+ *
39
+ * @template P
40
+ * @param {(props: P) => unknown} IconBase
41
+ * @param {() => unknown} useTheme
42
+ */
43
+ export function themeInkIconBase(IconBase, useTheme) {
44
+ function ThemeInkIconBase(props) {
45
+ const theme = useTheme();
46
+ return createElement(IconBase, { ...props, color: resolveIconInk(theme, props.color) });
47
+ }
48
+ ThemeInkIconBase.displayName = "IconBase";
49
+ return ThemeInkIconBase;
50
+ }
package/src/vite.ts CHANGED
@@ -1077,9 +1077,14 @@ function registerNativePhosphorIcons(): void {
1077
1077
  } catch {
1078
1078
  nativeEntry = null;
1079
1079
  }
1080
+ const iconBase = nativeEntry ? phosphorNativeIconBase(nativeEntry) : null;
1080
1081
  g.__vxrnAddNativePlugins.push({
1081
1082
  name,
1082
- resolveId(id: string): string | null {
1083
+ resolveId(id: string, importer?: string): string | null {
1084
+ if (iconBase) {
1085
+ const swapped = iconBase(id, importer);
1086
+ if (swapped) return swapped;
1087
+ }
1083
1088
  if (id !== "@phosphor-icons/react") return null;
1084
1089
  if (!nativeEntry) {
1085
1090
  console.warn(
@@ -1094,6 +1099,35 @@ function registerNativePhosphorIcons(): void {
1094
1099
  });
1095
1100
  }
1096
1101
 
1102
+ export const phosphorNativeIconBaseId = "#mpo/phosphor-native-icon-base";
1103
+
1104
+ /**
1105
+ * Every phosphor-react-native glyph renders through its `lib/icon-base`, which
1106
+ * paints a missing colour `#000` and a Tamagui token as no paint (black too).
1107
+ * This resolver hands each icon module MPO's theme-ink IconBase instead
1108
+ * (src/shims/phosphorIconBase.native.js), so no call site can draw a black
1109
+ * glyph on the dark scheme (FZ-7680); the shim reaches the original through
1110
+ * `phosphorNativeIconBaseId`. Null when the shim or the original is missing.
1111
+ */
1112
+ export function phosphorNativeIconBase(
1113
+ nativeEntry: string,
1114
+ ): ((id: string, importer?: string) => string | null) | null {
1115
+ const here = path.dirname(new URL(import.meta.url).pathname);
1116
+ const shim = [
1117
+ path.resolve(here, "shims/phosphorIconBase.native.js"),
1118
+ path.resolve(here, "../src/shims/phosphorIconBase.native.js"),
1119
+ ].find((candidate) => fs.existsSync(candidate));
1120
+ const original = path.join(path.dirname(nativeEntry), "lib", "icon-base.js");
1121
+ if (!shim || !fs.existsSync(original)) return null;
1122
+ const packageDir = `${path.sep}phosphor-react-native${path.sep}`;
1123
+ const iconBaseImport = /(?:^|[\\/])lib[\\/]icon-base(?:\.js)?$/;
1124
+ return (id, importer) => {
1125
+ if (id === phosphorNativeIconBaseId) return original;
1126
+ if (!importer || importer === shim || !importer.includes(packageDir)) return null;
1127
+ return iconBaseImport.test(id) ? shim : null;
1128
+ };
1129
+ }
1130
+
1097
1131
  /**
1098
1132
  * package.json `exports` cannot branch on whether `dist/` exists. For workspace
1099
1133
  * packages, prefer `dist/esm/index.{mjs,js}` when built; otherwise fall back to
package/types/vite.d.ts CHANGED
@@ -162,4 +162,14 @@ export declare function createViteConfig(options?: CreateViteConfigOptions): Use
162
162
  export { discoverPublicPackageRoots, publicPackageViteSourceAliases, resolveWorkspaceNativeEntry, staleNativeDistSource, } from "./workspacePublicPackages.js";
163
163
  export { publicConfigPlugin, readPublicConfigKeys, type PublicConfigPluginOptions, } from "./publicConfig.js";
164
164
  export { phosphorTokenColorPlugin } from "./phosphorTokenColor.js";
165
+ export declare const phosphorNativeIconBaseId = "#mpo/phosphor-native-icon-base";
166
+ /**
167
+ * Every phosphor-react-native glyph renders through its `lib/icon-base`, which
168
+ * paints a missing colour `#000` and a Tamagui token as no paint (black too).
169
+ * This resolver hands each icon module MPO's theme-ink IconBase instead
170
+ * (src/shims/phosphorIconBase.native.js), so no call site can draw a black
171
+ * glyph on the dark scheme (FZ-7680); the shim reaches the original through
172
+ * `phosphorNativeIconBaseId`. Null when the shim or the original is missing.
173
+ */
174
+ export declare function phosphorNativeIconBase(nativeEntry: string): ((id: string, importer?: string) => string | null) | null;
165
175
  //# sourceMapp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