@multiplatform.one/cli 9.16.1 → 10.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/lib/bin/multiplatformOne.mjs +15 -0
- package/lib/commands/themeKeys.mjs +3 -0
- package/lib/source.json +2 -2
- package/lib/themeKeys-DUM-GCcW.mjs +1003 -0
- package/package.json +3 -3
- package/scripts/scaffold.sh +21 -11
- package/src/bin/multiplatformOne.ts +33 -0
- package/src/commands/themeKeyRenames.json +207 -0
- package/src/commands/themeKeys.spec.ts +403 -0
- package/src/commands/themeKeys.ts +1034 -0
- package/templates/AGENTS.md +78 -15
- package/templates/pieces/gnome/universal/README.md.partial +4 -4
- package/templates/pieces/gnome/universal/apps/__NAME__/gnome/anchor.tsx +5 -4
- package/templates/pieces/gnome/universal/apps/__NAME__/gnome/shims/forms.ts +1 -1
- package/templates/pieces/gnome/universal/apps/__NAME__/gnome/shims/theme.ts +4 -0
- package/templates/pieces/gnome/universal/apps/__NAME__/gnome/tamagui-barrel.ts +6 -6
- package/templates/pieces/gnome/universal/apps/__NAME__/package.json.partial +1 -1
- package/templates/pieces/vscode/universal/apps/__NAME__/package.json.partial +1 -1
- package/templates/pieces/webext/universal/apps/__NAME__/package.json.partial +2 -2
- package/types/bin/multiplatformOne.d.ts.map +1 -1
- package/types/commands/themeKeys.d.ts +77 -0
- package/types/commands/themeKeys.d.ts.map +1 -0
package/templates/AGENTS.md
CHANGED
|
@@ -15,6 +15,30 @@ semver range in each `package.json`. There is no copy of them here: a change to
|
|
|
15
15
|
one of them is made upstream, in the monorepo, and arrives with the next
|
|
16
16
|
`mpo update`.
|
|
17
17
|
|
|
18
|
+
## Moving to Tamagui 3
|
|
19
|
+
|
|
20
|
+
The MPO release on Tamagui 3 renames every theme key to kebab-case:
|
|
21
|
+
`borderColorControl` becomes `border-color-control`, `color12` becomes
|
|
22
|
+
`color-12`. Run three passes in this order. Commit each before the next,
|
|
23
|
+
because the last two edit the same lines.
|
|
24
|
+
|
|
25
|
+
1. `mpo update`, then `pnpm install`, then resolve and commit the merge.
|
|
26
|
+
Every line you never touched takes MPO's migrated text without a conflict.
|
|
27
|
+
2. Tamagui's flat-values codemod, at the same version as the project's
|
|
28
|
+
`tamagui`, over the tracked sources (a bare directory also sweeps `dist`
|
|
29
|
+
and `node_modules`):
|
|
30
|
+
`pnpm dlx @tamagui/codemod-flat-values@<version> --write --source-semantics v2-pixels --report flat-values-report.md $(git ls-files '*.ts' '*.tsx')`.
|
|
31
|
+
Fix every row its report flags. A style object with a `//` comment inside
|
|
32
|
+
can make the codemod stop with `ManipulationError` naming one file, and
|
|
33
|
+
then it writes nothing. Run it again without that file and migrate the
|
|
34
|
+
file by hand.
|
|
35
|
+
3. `mpo migrate theme-keys` prints what it would rename, file by file, and
|
|
36
|
+
every site that spells a theme key where it can't tell a theme is meant.
|
|
37
|
+
`mpo migrate theme-keys --write` applies the renames. Check the listed
|
|
38
|
+
sites by hand.
|
|
39
|
+
4. Grep for what neither pass reaches:
|
|
40
|
+
`rg "hoverStyle|pressStyle|focusStyle|enterStyle|exitStyle|styleable\(|useProps"`.
|
|
41
|
+
|
|
18
42
|
## MPO evolution contract (FZ-7572)
|
|
19
43
|
|
|
20
44
|
MPO improves through shared rules, never app-specific patches.
|
|
@@ -75,7 +99,7 @@ frappe config, scheme adapter).
|
|
|
75
99
|
2. **No `*.css` files in `apps/*`** (except ignored bench/vendor trees): styling
|
|
76
100
|
goes through Tamagui + knobs.
|
|
77
101
|
3. **No hex color literals in `apps/`, `packages/` or `features/`**: use
|
|
78
|
-
theme
|
|
102
|
+
theme keys (`color-10`, semantic ramps, knob recipes). A file no token
|
|
79
103
|
reaches (GTK widget CSS, a content script, Expo build config) opts out with
|
|
80
104
|
a `// hex-escape: <reason>` comment that says why.
|
|
81
105
|
4. **Nothing under `packages/` reaches `features/`**: no `@package/features`
|
|
@@ -102,14 +126,16 @@ const { knobProps, control, text, elevation } = useResolvedKnobs({
|
|
|
102
126
|
});
|
|
103
127
|
|
|
104
128
|
<View
|
|
105
|
-
{...
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
129
|
+
{...composeKnobs(
|
|
130
|
+
knobProps.surface,
|
|
131
|
+
knobProps.borderRadius,
|
|
132
|
+
knobProps.panelPadding,
|
|
133
|
+
knobProps.gap,
|
|
134
|
+
knobProps.body,
|
|
135
|
+
pickStates(control, "hover", "press"),
|
|
136
|
+
focusVisibleRing(control),
|
|
137
|
+
props,
|
|
138
|
+
)}
|
|
113
139
|
/>;
|
|
114
140
|
```
|
|
115
141
|
|
|
@@ -117,7 +143,18 @@ Rules:
|
|
|
117
143
|
|
|
118
144
|
- Always spread complete `knobProps.*` fragments; never cherry-pick resolved tokens.
|
|
119
145
|
- `resolveKnobs()` is the only canonical mapping from abstract knobs → Tamagui props.
|
|
120
|
-
-
|
|
146
|
+
- **State goes in the fragment, never a pseudo prop.** Tamagui 3 removed `hoverStyle`,
|
|
147
|
+
`pressStyle`, `focusStyle`, `focusVisibleStyle`, `enterStyle`, `exitStyle` and
|
|
148
|
+
`$sm={{…}}`. They still typecheck and still render, and they emit nothing, so neither
|
|
149
|
+
`tsc` nor a passing spec catches one — `pnpm lint` does. Conditions ride the property
|
|
150
|
+
they change, as a clause string or a typed object, which is what `composeKnobs`,
|
|
151
|
+
`stateFragment` and `pickStates` emit. Clause names are kebab: `focus-visible:`,
|
|
152
|
+
never `focusVisible:`, which is inert too.
|
|
153
|
+
- `focusVisibleRing(control, …)` is the keyboard ring. `pickStates(control, "focus-visible")`
|
|
154
|
+
alone drops it under a preset whose focus knob is empty.
|
|
155
|
+
- Consumer `props` go last **inside the one `composeKnobs` call**, not as a trailing
|
|
156
|
+
`{...props}`: a plain spread replaces a whole property, so a consumer's `borderColor`
|
|
157
|
+
wipes the component's hover and press border.
|
|
121
158
|
- Presets cascade (`<Preset preset="…" theme="…">`); nested `overrides` merge by key.
|
|
122
159
|
- One knob flip restyles the screen, or the knob is broken.
|
|
123
160
|
|
|
@@ -147,7 +184,7 @@ Rules:
|
|
|
147
184
|
Every screen-level data fetch, not only Frappe, MUST render loading, empty,
|
|
148
185
|
error and ready through `AsyncBoundary`, `EmptyState` and `Skeleton` from
|
|
149
186
|
`@multiplatform.one/components`. A bare
|
|
150
|
-
`error ? <Paragraph color="
|
|
187
|
+
`error ? <Paragraph color="color-11">` branch is a defect. Empty ≠ error ≠
|
|
151
188
|
loading.
|
|
152
189
|
|
|
153
190
|
## Tooling
|
|
@@ -193,7 +230,33 @@ build: an environment that needs more extends the image (`FROM` it) instead.
|
|
|
193
230
|
- Cross-platform: shared code first; `*.native.tsx` / `*.web.tsx` only when required.
|
|
194
231
|
- Stories and tests live next to the component / feature they cover.
|
|
195
232
|
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
233
|
+
## Tamagui 3
|
|
234
|
+
|
|
235
|
+
This project runs Tamagui 3.2.3 (`pnpm-workspace.yaml` overrides). Never lower
|
|
236
|
+
`minimumReleaseAge`; a newer Tamagui waits until it is five days old.
|
|
237
|
+
|
|
238
|
+
- Values are bare names: `p="4"`, `color="color-11"`, `bg="background"`.
|
|
239
|
+
No `$` sigil. A raw number is pixels.
|
|
240
|
+
- Theme keys are kebab-case: `background-hover`, `border-color-control`,
|
|
241
|
+
ramp steps `color-1` to `color-12`. A key you add takes the same rule.
|
|
242
|
+
Never apply Tamagui's v6 ramp table; MPO keeps all twelve steps.
|
|
243
|
+
- Conditions ride the property they change, as a clause string
|
|
244
|
+
(`bg="background hover:background-hover"`, what the codemod writes) or a
|
|
245
|
+
typed object (`{ default: …, hover: …, press: …, "focus-visible": … }`).
|
|
246
|
+
Media keys work the same way. There are no `hoverStyle`/`$sm` objects and
|
|
247
|
+
no `animation` prop (use `transition`).
|
|
248
|
+
- Gone in v3, so don't reach for them: `useProps`, `styleable` (use
|
|
249
|
+
`createStyledHOC`), `ThemeableStack`, `Unspaced`, `Sheet.Frame` (use
|
|
250
|
+
`Sheet.Container` + `Sheet.Background`), `@tamagui/lucide-icons-2`.
|
|
251
|
+
- Upgrading a project from before Tamagui 3: follow "Moving to Tamagui 3"
|
|
252
|
+
near the top of this file.
|
|
253
|
+
|
|
254
|
+
Icons are phosphor (`@phosphor-icons/react`; native swaps in
|
|
255
|
+
`phosphor-react-native`). Phosphor icons rendered directly must be wrapped once
|
|
256
|
+
at module scope with `themed` from `@multiplatform.one/components`. Pass
|
|
257
|
+
component references to MPO icon slots when possible. Shared slots resolve
|
|
258
|
+
native theme ink (LC-124); web keeps CSS inheritance. `mpo-design-lint` rejects
|
|
259
|
+
raw icon renders. The lucide re-exports `Eye`, `EyeOff`, `Github`, `Info`,
|
|
260
|
+
`Mail` and `Pencil` are gone: use `EyeIcon`, `EyeSlashIcon`, `GithubLogoIcon`,
|
|
261
|
+
`InfoIcon`, `EnvelopeIcon` and `PencilSimpleIcon`. `Menu` and `MenuIcon` stay
|
|
262
|
+
and now draw phosphor's `ListIcon`.
|
|
@@ -44,7 +44,7 @@ get a blank screenshot that looks like a broken app.
|
|
|
44
44
|
| --- | --- |
|
|
45
45
|
| `apps/__NAME__/gnome/main.tsx` | Entry — Gtk init, Yoga, providers, window |
|
|
46
46
|
| `apps/__NAME__/gnome/polyfills.ts` | Browser-API globals. **Must be the first import** |
|
|
47
|
-
| `apps/__NAME__/gnome/tamagui-barrel.ts` | The
|
|
47
|
+
| `apps/__NAME__/gnome/tamagui-barrel.ts` | The `@tamagui/*` primitives and `tamagui/<x>` skins this app reaches |
|
|
48
48
|
| `apps/__NAME__/gnome/anchor.tsx` | The meta-package's `Anchor`, replicated — it has no granular home |
|
|
49
49
|
| `apps/__NAME__/gnome/shims/` | Barrels narrowed to their GJS-safe subgraph |
|
|
50
50
|
| `apps/__NAME__/vite.config.gnome.ts` | Separate library build → `dist/gnome/main.js` |
|
|
@@ -63,6 +63,6 @@ swipe-back. Your screens do not change.
|
|
|
63
63
|
barrel pulls expo-asset, flash-list and phosphor; `theme` pulls
|
|
64
64
|
react-dom/server and node:fs. Those fail at module init, before a widget
|
|
65
65
|
exists. The shims re-export only the GJS-safe subgraph, so adding a
|
|
66
|
-
component is usually one line in a shim plus one
|
|
67
|
-
export in the barrel. A missing export is a build error
|
|
68
|
-
symbol.
|
|
66
|
+
component is usually one line in a shim plus one `@tamagui/*` or
|
|
67
|
+
`tamagui/<x>` export in the barrel. A missing export is a build error
|
|
68
|
+
naming the symbol.
|
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
// on press. Replicate exactly that — Linking comes from the react-native
|
|
8
8
|
// alias, where @react-gnome/react-native backs it with Gtk.show_uri.
|
|
9
9
|
|
|
10
|
-
import { styled } from "@tamagui/core";
|
|
10
|
+
import { createStyledHOC, styled } from "@tamagui/core";
|
|
11
11
|
import type { SizableTextProps } from "@tamagui/text";
|
|
12
12
|
import { SizableText } from "@tamagui/text";
|
|
13
13
|
import { Linking } from "react-native";
|
|
@@ -21,12 +21,13 @@ export interface AnchorExtraProps {
|
|
|
21
21
|
export type AnchorProps = SizableTextProps & AnchorExtraProps;
|
|
22
22
|
|
|
23
23
|
const AnchorFrame = styled(SizableText, {
|
|
24
|
-
|
|
24
|
+
displayName: "Anchor",
|
|
25
25
|
role: "link",
|
|
26
26
|
});
|
|
27
27
|
|
|
28
|
-
export const Anchor =
|
|
29
|
-
|
|
28
|
+
export const Anchor = createStyledHOC(
|
|
29
|
+
AnchorFrame,
|
|
30
|
+
({ href, target: _target, rel: _rel, ...props }: AnchorProps, ref) => (
|
|
30
31
|
<AnchorFrame
|
|
31
32
|
{...props}
|
|
32
33
|
onPress={(event) => {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
// GNOME-target shim for @multiplatform.one/forms.
|
|
2
2
|
//
|
|
3
3
|
// The real barrel reaches the whole field library, and with it phosphor
|
|
4
|
-
// icons
|
|
4
|
+
// icons and the expo surface (camera for the barcode field, the
|
|
5
5
|
// linear-gradient for the colour picker). None of those resolve under
|
|
6
6
|
// GJS.
|
|
7
7
|
//
|
|
@@ -45,6 +45,7 @@ export {
|
|
|
45
45
|
menuRowCheckGlyph,
|
|
46
46
|
menuRowCheckInk,
|
|
47
47
|
menuRowChecked,
|
|
48
|
+
menuRowCheckedFill,
|
|
48
49
|
menuRowFrame,
|
|
49
50
|
menuRowIconGlyph,
|
|
50
51
|
resolveMenuRowCheckInk,
|
|
@@ -87,9 +88,12 @@ export {
|
|
|
87
88
|
STATE_LAYER_PRESS,
|
|
88
89
|
ensureFocusVisibleRing,
|
|
89
90
|
focusRingColorMeetsContrast,
|
|
91
|
+
focusVisibleRing,
|
|
90
92
|
isSanctionedFocusRingOffset,
|
|
91
93
|
withDefaultStateLayer,
|
|
92
94
|
} from "@multiplatform.one/theme";
|
|
95
|
+
export { composeKnobs, knobStates, pickStates, stateFragment } from "@multiplatform.one/theme";
|
|
96
|
+
export type { Clauses, KnobPart, KnobState, StateFragment } from "@multiplatform.one/theme";
|
|
93
97
|
// Hairline width — resolves to hairline.native.ts (RN StyleSheet, which
|
|
94
98
|
// the react-native alias backs with the GTK compat package).
|
|
95
99
|
export {
|
|
@@ -21,6 +21,7 @@ export {
|
|
|
21
21
|
getVariable,
|
|
22
22
|
getVariableValue,
|
|
23
23
|
isWeb,
|
|
24
|
+
splitStyleProps,
|
|
24
25
|
styled,
|
|
25
26
|
TamaguiProvider,
|
|
26
27
|
Text,
|
|
@@ -28,7 +29,6 @@ export {
|
|
|
28
29
|
useDidFinishSSR,
|
|
29
30
|
useEvent,
|
|
30
31
|
useMedia,
|
|
31
|
-
useProps,
|
|
32
32
|
useStyle,
|
|
33
33
|
useTheme,
|
|
34
34
|
useThemeName,
|
|
@@ -36,7 +36,7 @@ export {
|
|
|
36
36
|
withStaticProperties,
|
|
37
37
|
} from "@tamagui/core";
|
|
38
38
|
export { H1, H2, H3, H4, H5, H6, Paragraph, SizableText } from "@tamagui/text";
|
|
39
|
-
export {
|
|
39
|
+
export { XStack, YStack, ZStack } from "@tamagui/stacks";
|
|
40
40
|
export { ScrollView } from "@tamagui/scroll-view";
|
|
41
41
|
export { Separator } from "@tamagui/separator";
|
|
42
42
|
export { Spacer } from "@tamagui/spacer";
|
|
@@ -47,7 +47,7 @@ export { Image } from "@tamagui/image";
|
|
|
47
47
|
// Starter form (features/__NAME__/src/ContactForm.tsx). Each stays inside
|
|
48
48
|
// the core + stacks + helpers subgraph — verified free of
|
|
49
49
|
// react-native/Libraries deep imports.
|
|
50
|
-
export { Button } from "
|
|
50
|
+
export { Button } from "tamagui/button";
|
|
51
51
|
export { Form } from "@tamagui/form";
|
|
52
52
|
export { Input, TextArea } from "@tamagui/input";
|
|
53
53
|
export { Label } from "@tamagui/label";
|
|
@@ -74,15 +74,15 @@ export type {
|
|
|
74
74
|
FontSizeTokens,
|
|
75
75
|
GenericFont,
|
|
76
76
|
GetProps,
|
|
77
|
-
ScrollViewProps,
|
|
78
77
|
SizeTokens,
|
|
79
78
|
TamaguiElement,
|
|
80
79
|
TextProps,
|
|
81
80
|
ThemeName,
|
|
82
81
|
ViewProps,
|
|
83
82
|
} from "@tamagui/core";
|
|
84
|
-
export type {
|
|
85
|
-
export type {
|
|
83
|
+
export type { XStackProps, YStackProps } from "@tamagui/stacks";
|
|
84
|
+
export type { ScrollViewProps } from "@tamagui/scroll-view";
|
|
85
|
+
export type { ButtonProps } from "tamagui/button";
|
|
86
86
|
export type { InputProps } from "@tamagui/input";
|
|
87
87
|
export type { LabelProps } from "@tamagui/label";
|
|
88
88
|
|
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
"@react-gnome/react-native": "^0.1.0",
|
|
10
10
|
"@react-gnome/react-native-svg": "^0.1.0",
|
|
11
11
|
"@react-gnome/renderer": "^0.1.0",
|
|
12
|
-
"@react-gnome/tamagui": "^0.1.
|
|
12
|
+
"@react-gnome/tamagui": "^0.1.1"
|
|
13
13
|
},
|
|
14
14
|
"devDependencies": {
|
|
15
15
|
"@multiplatform.one/vite-plugin-gnome": "__MPO_VERSION__",
|
|
@@ -10,7 +10,7 @@
|
|
|
10
10
|
},
|
|
11
11
|
"devDependencies": {
|
|
12
12
|
"@multiplatform.one/vite-plugin-vscode": "__MPO_VERSION__",
|
|
13
|
-
"@tamagui/vite-plugin": "2.
|
|
13
|
+
"@tamagui/vite-plugin": "3.2.3",
|
|
14
14
|
"@tomjs/vite-plugin-vscode": "^7.1.1",
|
|
15
15
|
"@types/node": "^25.6.0",
|
|
16
16
|
"@types/vscode": "^1.118.0",
|
|
@@ -13,8 +13,8 @@
|
|
|
13
13
|
"@multiplatform.one/config": "__MPO_VERSION__",
|
|
14
14
|
"@multiplatform.one/utils": "__MPO_VERSION__",
|
|
15
15
|
"@multiplatform.one/vite-plugin-webext": "__MPO_VERSION__",
|
|
16
|
-
"@tamagui/vite-plugin": "2.
|
|
17
|
-
"@tamagui/web": "2.
|
|
16
|
+
"@tamagui/vite-plugin": "3.2.3",
|
|
17
|
+
"@tamagui/web": "3.2.3",
|
|
18
18
|
"@types/chrome": "^0.2.5",
|
|
19
19
|
"@types/node": "^25.6.0",
|
|
20
20
|
"dotenv": "^17.4.2",
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"multiplatformOne.d.ts","sourceRoot":"","sources":["../../src/bin/multiplatformOne.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"multiplatformOne.d.ts","sourceRoot":"","sources":["../../src/bin/multiplatformOne.ts"],"names":[],"mappings":"AAwCA,gHAAgH;AAChH,MAAM,MAAM,wBAAwB,GAAG;IACrC,OAAO,EAAE,MAAM,CAAC;IAChB,YAAY,EAAE,MAAM,CAAC;IACrB,kGAAkG;IAClG,SAAS,EAAE,MAAM,GAAG,MAAM,CAAC;IAC3B,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,gGAAgG;IAChG,sBAAsB,CAAC,EAAE,OAAO,CAAC;CAClC,CAAC"}
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `mpo migrate theme-keys`: renames MPO's theme keys from Tamagui 2's camelCase
|
|
3
|
+
* (`borderColorControl`, `color12`) to Tamagui 3's kebab-case
|
|
4
|
+
* (`border-color-control`, `color-12`). It runs after `mpo update` and after
|
|
5
|
+
* Tamagui's flat-values codemod, so it reads both spellings: `"$color12"`
|
|
6
|
+
* (before the codemod) and a bare `color12` in a flat value (after it).
|
|
7
|
+
*
|
|
8
|
+
* The pass is syntactic (TypeScript's parser, no type checker). A site it can
|
|
9
|
+
* tie to a theme is rewritten; a site that spells a theme key somewhere it
|
|
10
|
+
* cannot tie to a theme is left alone and listed as unclassified.
|
|
11
|
+
*/
|
|
12
|
+
export type ThemeKeyForm = "token" | "css-var" | "flat" | "member" | "element" | "destructure" | "definition" | "key-list" | "call-arg" | "family";
|
|
13
|
+
export declare const themeKeyForms: readonly ThemeKeyForm[];
|
|
14
|
+
export type FormCounts = Partial<Record<ThemeKeyForm, number>>;
|
|
15
|
+
export type UnclassifiedSite = {
|
|
16
|
+
file: string;
|
|
17
|
+
line: number;
|
|
18
|
+
column: number;
|
|
19
|
+
key: string;
|
|
20
|
+
reason: string;
|
|
21
|
+
text: string;
|
|
22
|
+
};
|
|
23
|
+
export type SourceResult = {
|
|
24
|
+
output: string;
|
|
25
|
+
counts: FormCounts;
|
|
26
|
+
unclassified: UnclassifiedSite[];
|
|
27
|
+
error?: string;
|
|
28
|
+
};
|
|
29
|
+
export type FileReport = {
|
|
30
|
+
file: string;
|
|
31
|
+
counts: FormCounts;
|
|
32
|
+
total: number;
|
|
33
|
+
unclassified: UnclassifiedSite[];
|
|
34
|
+
error?: string;
|
|
35
|
+
};
|
|
36
|
+
export type ThemeKeysReport = {
|
|
37
|
+
root: string;
|
|
38
|
+
write: boolean;
|
|
39
|
+
scanned: number;
|
|
40
|
+
files: FileReport[];
|
|
41
|
+
skipped: {
|
|
42
|
+
file: string;
|
|
43
|
+
reason: string;
|
|
44
|
+
}[];
|
|
45
|
+
};
|
|
46
|
+
export type ThemeKeysOptions = {
|
|
47
|
+
paths?: string[];
|
|
48
|
+
exclude?: string[];
|
|
49
|
+
write?: boolean;
|
|
50
|
+
renames?: Record<string, string>;
|
|
51
|
+
};
|
|
52
|
+
export declare const themeKeysSkipMarker = "mpo-theme-keys: skip-file";
|
|
53
|
+
/** A prop or style key whose value is a colour or carries one. */
|
|
54
|
+
export declare function isStyleValueProp(name: string): boolean;
|
|
55
|
+
/** `var(--color12)` and `--color12:` in a CSS file or a CSS string. */
|
|
56
|
+
export declare function renameCssVars(text: string, renames?: Record<string, string>): {
|
|
57
|
+
text: string;
|
|
58
|
+
count: number;
|
|
59
|
+
};
|
|
60
|
+
/**
|
|
61
|
+
* Rewrites one source file's theme keys. `file` names the file in reports and
|
|
62
|
+
* picks the parser (TS, TSX, or JS with JSX).
|
|
63
|
+
*/
|
|
64
|
+
export declare function renameThemeKeysInSource(source: string, file: string, renames?: Record<string, string>): SourceResult;
|
|
65
|
+
/** Rewrites a CSS file's custom properties (`var(--color12)`, `--color12:`). */
|
|
66
|
+
export declare function renameThemeKeysInCss(source: string, renames?: Record<string, string>): SourceResult;
|
|
67
|
+
/**
|
|
68
|
+
* The files the pass reads: git's tracked and untracked-but-not-ignored files
|
|
69
|
+
* when `root` is a repository, else a walk that skips node_modules, dist and
|
|
70
|
+
* build caches. Paths come back relative to `root`, with forward slashes.
|
|
71
|
+
*/
|
|
72
|
+
export declare function listThemeKeyFiles(root: string, paths?: string[], exclude?: string[]): Promise<string[]>;
|
|
73
|
+
/** Runs the pass over `root`, or the given paths under it. Writes only with `write`. */
|
|
74
|
+
export declare function runThemeKeys(root: string, options?: ThemeKeysOptions): Promise<ThemeKeysReport>;
|
|
75
|
+
/** The console report: per-file counts, the totals, then every unclassified site. */
|
|
76
|
+
export declare function formatThemeKeysReport(report: ThemeKeysReport): string;
|
|
77
|
+
//# sourceMappingURL=themeKeys.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"themeKeys.d.ts","sourceRo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