@sanity/themer 0.3.15 → 0.4.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 +25 -54
- package/dist/index.d.ts +42 -27
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -1
- package/dist/legacy.d.ts +43 -118
- package/dist/legacy.d.ts.map +1 -1
- package/dist/legacy.js +5 -1205
- package/dist/legacy.js.map +1 -1
- package/dist/options-CU-emn_p.d.ts +69 -0
- package/dist/options-CU-emn_p.d.ts.map +1 -0
- package/dist/{presets-DWzYcsLg.js → presets-CqBgS3A-.js} +146 -99
- package/dist/presets-CqBgS3A-.js.map +1 -0
- package/dist/tool.d.ts +11 -7
- package/dist/tool.d.ts.map +1 -1
- package/dist/tool.js +2333 -514
- package/dist/tool.js.map +1 -1
- package/package.json +7 -4
- package/dist/mix-BfV6_Ke4.js +0 -42
- package/dist/mix-BfV6_Ke4.js.map +0 -1
- package/dist/options-BaqJJgRs.d.ts +0 -59
- package/dist/options-BaqJJgRs.d.ts.map +0 -1
- package/dist/presets-DWzYcsLg.js.map +0 -1
package/README.md
CHANGED
|
@@ -8,17 +8,23 @@ npm install @sanity/themer
|
|
|
8
8
|
|
|
9
9
|
## Usage
|
|
10
10
|
|
|
11
|
-
`buildTheme` builds the same type of theme as `buildTheme` from `@sanity/ui/theme` — ready for the `theme` property of a Studio config — but takes colors instead of design tokens. Under the hood it only swaps out the color palette that `@sanity/ui/theme` otherwise fills with [`@sanity/color`](https://www.sanity.io/docs/color):
|
|
11
|
+
`buildTheme` builds the same type of theme as `buildTheme` from `@sanity/ui/theme` — ready for the `theme` property of a Studio config — but takes a handful of colors per color scheme instead of design tokens. Under the hood it only swaps out the color palette that `@sanity/ui/theme` otherwise fills with [`@sanity/color`](https://www.sanity.io/docs/color), once for each scheme:
|
|
12
12
|
|
|
13
13
|
```ts
|
|
14
14
|
import {buildTheme} from '@sanity/themer'
|
|
15
15
|
import {defineConfig} from 'sanity'
|
|
16
16
|
|
|
17
17
|
export const theme = buildTheme({
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
18
|
+
light: {
|
|
19
|
+
accent: '#f00',
|
|
20
|
+
text: '#727892',
|
|
21
|
+
background: '#ffffff',
|
|
22
|
+
contrast: 85, // 15–100
|
|
23
|
+
},
|
|
24
|
+
dark: {
|
|
25
|
+
accent: '#f66',
|
|
26
|
+
background: '#0d0e12',
|
|
27
|
+
},
|
|
22
28
|
})
|
|
23
29
|
|
|
24
30
|
export default defineConfig({
|
|
@@ -27,16 +33,16 @@ export default defineConfig({
|
|
|
27
33
|
})
|
|
28
34
|
```
|
|
29
35
|
|
|
30
|
-
|
|
36
|
+
Everything is optional — both schemes, and every color in them. Whatever is omitted falls back to the stock Studio colors, so `buildTheme({})` matches `buildTheme()` from `@sanity/ui/theme` with no options exactly, and the two schemes are free to differ in every color rather than only their background:
|
|
37
|
+
|
|
38
|
+
- `accent` replaces the `blue` scale of the scheme's palette, which Sanity UI uses for primary buttons, focus rings and links.
|
|
31
39
|
- `text` replaces the `gray` scale — text, icons, borders and neutral surfaces. When omitted it is derived from `accent`: a mostly desaturated version of it, the way the stock gray carries a hint of the stock blue.
|
|
32
|
-
- `background
|
|
40
|
+
- `background` replaces `black` in the dark scheme and `white` in the light scheme — the background that every other color of the scheme blends onto.
|
|
33
41
|
- `contrast` controls how strongly text and borders separate from the accent. The default `85` uses the text color as-is; `100` removes its tint entirely (a high contrast scheme with no mixing of text and accent), and lower values blend more and more of the accent into the text scale, giving text and borders more color.
|
|
34
42
|
|
|
35
|
-
A few ground rules keep the generated
|
|
36
|
-
|
|
37
|
-
Called with the stock colors — like `text` and `background` in the example — the generated colors match `buildTheme()` from `@sanity/ui/theme` with no options exactly.
|
|
43
|
+
A few ground rules keep the generated palettes usable: the accent and text colors cannot be too dark or too light (they would mess with the rest of their scales), the dark background is made darker until it has enough contrast with both of them (it can never be lighter than either), and the light background can never be darker than either.
|
|
38
44
|
|
|
39
|
-
`buildPalette` returns the generated `@sanity/color`-shaped
|
|
45
|
+
`buildPalette` returns the generated `@sanity/color`-shaped palettes (`{light, dark}`) without building a theme from them, and `presets` ships the hosted Themer service presets translated to `buildTheme` options:
|
|
40
46
|
|
|
41
47
|
```ts
|
|
42
48
|
import {buildTheme, presets} from '@sanity/themer'
|
|
@@ -47,7 +53,7 @@ const theme = buildTheme(verdant.options)
|
|
|
47
53
|
|
|
48
54
|
## Studio tool
|
|
49
55
|
|
|
50
|
-
`@sanity/themer/tool` adds a themer sidebar to the Studio for these themes
|
|
56
|
+
`@sanity/themer/tool` adds a themer sidebar to the Studio for these themes. It lists the configured theme, the presets and your own themes, each previewed as a tiny Studio in both color schemes, and picking one applies it live to the whole Studio while you browse around. Your own themes are edited scheme by scheme — a light mode and a dark mode card with accent/text/background pickers and a contrast slider each, the one the Studio is showing marked as active — add one from scratch, duplicate a preset to start from it, or take the colors from an image: its palette is read on device (the image is drawn onto a canvas and its vibrant and muted colors extracted right there, nothing is uploaded), the vibrant color becomes the accent (adjusted until a button label reads on it), the muted one the text color and the light and dark muted colors tint the backgrounds, and a row of variants previews the theme built around each swatch instead — with an "I'm feeling lucky" button that picks an interesting one. Themes can be removed and restored, and a dialog shows the `buildTheme` snippet that makes the applied theme permanent:
|
|
51
57
|
|
|
52
58
|
```ts
|
|
53
59
|
import {themerTool} from '@sanity/themer/tool'
|
|
@@ -59,55 +65,20 @@ export default defineConfig({
|
|
|
59
65
|
})
|
|
60
66
|
```
|
|
61
67
|
|
|
62
|
-
If the Studio already uses a `buildTheme` theme, pass the same options so the tool starts editing from them: `themerTool({config: {accent: '#1cb485'}})`.
|
|
68
|
+
If the Studio already uses a `buildTheme` theme, pass the same options so the tool starts editing from them: `themerTool({config: {light: {accent: '#1cb485'}}})`.
|
|
63
69
|
|
|
64
70
|
## Migrating from themer.sanity.build
|
|
65
71
|
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
`@sanity/themer/legacy` generates the exact same colors as the hosted service, with the same `createTheme`, `hues` and `theme` exports that `https://themer.sanity.build/api/hues` served. Replace the URL import with `buildThemeFromUrl` and the URL as a string:
|
|
69
|
-
|
|
70
|
-
```ts
|
|
71
|
-
// Before:
|
|
72
|
-
import {theme} from 'https://themer.sanity.build/api/hues?preset=verdant&primary=22fca8'
|
|
73
|
-
|
|
74
|
-
// After:
|
|
75
|
-
import {buildThemeFromUrl} from '@sanity/themer/legacy'
|
|
76
|
-
|
|
77
|
-
const theme = buildThemeFromUrl(
|
|
78
|
-
'https://themer.sanity.build/api/hues?preset=verdant&primary=22fca8',
|
|
79
|
-
)
|
|
80
|
-
```
|
|
81
|
-
|
|
82
|
-
Configs that used `createTheme` and `hues` from the URL import work the same way with `parseHuesFromUrl`:
|
|
83
|
-
|
|
84
|
-
```ts
|
|
85
|
-
// Before:
|
|
86
|
-
// import {createTheme, hues} from 'https://themer.sanity.build/api/hues?preset=verdant'
|
|
87
|
-
|
|
88
|
-
// After:
|
|
89
|
-
import {createTheme, parseHuesFromUrl} from '@sanity/themer/legacy'
|
|
72
|
+
The npm migration path off the hosted Themer service ([themer.sanity.build](https://themer.sanity.build)) is [`@sanity/themer-legacy`](https://www.npmjs.com/package/@sanity/themer-legacy): the exact same generator, running locally.
|
|
90
73
|
|
|
91
|
-
|
|
74
|
+
`@sanity/themer/legacy` still works as a deprecated re-export of that package until `@sanity/themer@1.0` removes it; import from `@sanity/themer-legacy` instead. Migrating a hosted URL import looks like this:
|
|
92
75
|
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
76
|
+
```diff
|
|
77
|
+
-import {theme} from 'https://themer.sanity.build/api/hues?preset=verdant&primary=22fca8'
|
|
78
|
+
+import {buildThemeFromUrl} from '@sanity/themer-legacy'
|
|
79
|
+
+const theme = buildThemeFromUrl('https://themer.sanity.build/api/hues?preset=verdant&primary=22fca8')
|
|
97
80
|
```
|
|
98
81
|
|
|
99
|
-
The hosted presets are addressed by query, exactly like the service:
|
|
100
|
-
|
|
101
|
-
```ts
|
|
102
|
-
import {buildThemeFromUrl} from '@sanity/themer/legacy'
|
|
103
|
-
|
|
104
|
-
const theme = buildThemeFromUrl('?preset=verdant')
|
|
105
|
-
```
|
|
106
|
-
|
|
107
|
-
Once migrated, remove any `themer.d.ts` module declarations and `urlImports` config that the URL imports needed.
|
|
108
|
-
|
|
109
|
-
The generated theme carries no `__themer` flag, which is the one intentional difference from the hosted module. Sanity Studio uses that flag to throw away the fonts the hosted module bundled, because they had drifted from the Studio's own; here the fonts come from the `@sanity/ui` installed next to the Studio, so there is nothing to throw away.
|
|
110
|
-
|
|
111
82
|
## License
|
|
112
83
|
|
|
113
84
|
MIT © Sanity.io — see [LICENSE](https://github.com/sanity-io/ui/blob/main/LICENSE)
|
package/dist/index.d.ts
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { t as BuildThemeOptions } from "./options-
|
|
1
|
+
import { n as SchemeThemeOptions, t as BuildThemeOptions } from "./options-CU-emn_p.js";
|
|
2
2
|
import { ColorHueKey, ColorTintKey } from "@sanity/color";
|
|
3
|
-
import { RootTheme } from "@sanity/ui/theme";
|
|
3
|
+
import { RootTheme, ThemeColorSchemeKey } from "@sanity/ui/theme";
|
|
4
4
|
/**
|
|
5
|
-
*
|
|
6
|
-
*
|
|
5
|
+
* A color palette generated by {@link buildPalette}: the `palette` config of
|
|
6
|
+
* `buildTheme` from `@sanity/ui/theme`, with every color as a hex string.
|
|
7
7
|
*
|
|
8
8
|
* @public
|
|
9
9
|
*/
|
|
@@ -12,39 +12,53 @@ type GeneratedColorPalette = {
|
|
|
12
12
|
white: string;
|
|
13
13
|
} & Record<ColorHueKey, Record<ColorTintKey, string>>;
|
|
14
14
|
/**
|
|
15
|
-
*
|
|
16
|
-
*
|
|
17
|
-
*
|
|
18
|
-
|
|
19
|
-
|
|
15
|
+
* The palettes generated by {@link buildPalette} — one per color scheme.
|
|
16
|
+
*
|
|
17
|
+
* @public
|
|
18
|
+
*/
|
|
19
|
+
type GeneratedColorPalettes = Record<ThemeColorSchemeKey, GeneratedColorPalette>;
|
|
20
|
+
/**
|
|
21
|
+
* Generates a Sanity UI color palette for each color scheme from the theme
|
|
22
|
+
* options: in each palette the scheme's accent color replaces the `blue`
|
|
23
|
+
* scale, its text color the `gray` scale, and the backgrounds replace `black`
|
|
24
|
+
* and `white`. All other hues keep their stock `@sanity/color` values. Called
|
|
25
|
+
* with the stock colors, both palettes come back as the stock palette
|
|
26
|
+
* byte-for-byte.
|
|
20
27
|
*
|
|
21
28
|
* ```ts
|
|
22
29
|
* import {buildPalette} from '@sanity/themer'
|
|
23
30
|
*
|
|
24
|
-
* const
|
|
31
|
+
* const {light, dark} = buildPalette({light: {accent: '#556bfc'}})
|
|
25
32
|
* ```
|
|
26
33
|
*
|
|
27
34
|
* @public
|
|
28
35
|
*/
|
|
29
|
-
export declare function buildPalette(options
|
|
36
|
+
export declare function buildPalette(options?: BuildThemeOptions): GeneratedColorPalettes;
|
|
30
37
|
/**
|
|
31
|
-
* Generates a Studio theme from a handful of colors
|
|
32
|
-
* palette that the `buildTheme` from `@sanity/ui/theme`
|
|
33
|
-
* `@sanity/color`:
|
|
34
|
-
* buttons, focus rings, links), the
|
|
35
|
-
* (text, icons, borders), and the
|
|
36
|
-
*
|
|
37
|
-
*
|
|
38
|
+
* Generates a Studio theme from a handful of colors per color scheme, by
|
|
39
|
+
* replacing the color palette that the `buildTheme` from `@sanity/ui/theme`
|
|
40
|
+
* otherwise fills with `@sanity/color`: in each scheme the accent color
|
|
41
|
+
* replaces the `blue` scale (primary buttons, focus rings, links), the
|
|
42
|
+
* optional text color the `gray` scale (text, icons, borders), and the
|
|
43
|
+
* optional background replaces `black` (dark) or `white` (light). The result
|
|
44
|
+
* is the same type of theme that `@sanity/ui/theme` builds, ready for the
|
|
45
|
+
* `theme` property of a Studio config.
|
|
38
46
|
*
|
|
39
47
|
* ```ts
|
|
40
48
|
* import {buildTheme} from '@sanity/themer'
|
|
41
49
|
* import {defineConfig} from 'sanity'
|
|
42
50
|
*
|
|
43
51
|
* export const theme = buildTheme({
|
|
44
|
-
*
|
|
45
|
-
*
|
|
46
|
-
*
|
|
47
|
-
*
|
|
52
|
+
* light: {
|
|
53
|
+
* accent: '#556bfc',
|
|
54
|
+
* text: '#727892', // optional — derived from `accent` when omitted
|
|
55
|
+
* background: '#ffffff', // optional
|
|
56
|
+
* contrast: 85, // optional, 15–100
|
|
57
|
+
* },
|
|
58
|
+
* dark: {
|
|
59
|
+
* accent: '#556bfc',
|
|
60
|
+
* background: '#0d0e12',
|
|
61
|
+
* },
|
|
48
62
|
* })
|
|
49
63
|
*
|
|
50
64
|
* export default defineConfig({
|
|
@@ -53,12 +67,13 @@ export declare function buildPalette(options: BuildThemeOptions): GeneratedColor
|
|
|
53
67
|
* })
|
|
54
68
|
* ```
|
|
55
69
|
*
|
|
56
|
-
*
|
|
57
|
-
*
|
|
70
|
+
* Every option is optional and falls back to the stock Studio colors: called
|
|
71
|
+
* with the stock colors — like the example — or with no options at all, it
|
|
72
|
+
* returns the exact same colors as `buildTheme()` from `@sanity/ui/theme`.
|
|
58
73
|
*
|
|
59
74
|
* @public
|
|
60
75
|
*/
|
|
61
|
-
export declare function buildTheme(options
|
|
76
|
+
export declare function buildTheme(options?: BuildThemeOptions): RootTheme;
|
|
62
77
|
/**
|
|
63
78
|
* A preset theme: a named set of {@link BuildThemeOptions} ready to pass to
|
|
64
79
|
* `buildTheme`.
|
|
@@ -75,7 +90,7 @@ interface ThemePreset {
|
|
|
75
90
|
* Preset themes for `buildTheme`, carried over from the hosted Themer service
|
|
76
91
|
* (themer.sanity.build) presets: each one maps the legacy preset's primary
|
|
77
92
|
* hue to `accent`, its default hue to `text` and its lightest/darkest colors
|
|
78
|
-
* to the backgrounds.
|
|
93
|
+
* to the backgrounds of the light and dark scheme.
|
|
79
94
|
*
|
|
80
95
|
* ```ts
|
|
81
96
|
* import {buildTheme, presets} from '@sanity/themer'
|
|
@@ -87,5 +102,5 @@ interface ThemePreset {
|
|
|
87
102
|
* @public
|
|
88
103
|
*/
|
|
89
104
|
export declare const presets: ThemePreset[];
|
|
90
|
-
export type { BuildThemeOptions, GeneratedColorPalette, ThemePreset };
|
|
105
|
+
export type { BuildThemeOptions, GeneratedColorPalette, GeneratedColorPalettes, SchemeThemeOptions, ThemePreset };
|
|
91
106
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","names":[],"sources":["../src/theme/buildPalette.ts","../src/theme/buildTheme.ts","../src/theme/presets.ts"],"mappings":";;;;;;;;;
|
|
1
|
+
{"version":3,"file":"index.d.ts","names":[],"sources":["../src/theme/buildPalette.ts","../src/theme/buildTheme.ts","../src/theme/presets.ts"],"mappings":";;;;;;;;;KAuCY;EAAyB;EAAe;IAAiB,OACnE,aACA,OAAO;;;;;;KAQG,yBAAyB,OAAO,qBAAqB;;;;;;;;;;;;;;;;;wBAkBjD,aAAa,UAAS,oBAAyB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;wBCjB/C,WAAW,UAAS,oBAAyB;;;;;;;UC1C5C;EACf;EACA;;EAEA,SAAS;;;;;;;;;;;;;;;;;qBA6BE,SAAS"}
|
package/dist/index.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { n as buildTheme, r as buildPalette, t as presets } from "./presets-
|
|
1
|
+
import { n as buildTheme, r as buildPalette, t as presets } from "./presets-CqBgS3A-.js";
|
|
2
2
|
export { buildPalette, buildTheme, presets };
|
package/dist/legacy.d.ts
CHANGED
|
@@ -1,155 +1,80 @@
|
|
|
1
|
-
import
|
|
1
|
+
import * as themerLegacy from "@sanity/themer-legacy";
|
|
2
2
|
/**
|
|
3
|
-
*
|
|
4
|
-
*
|
|
3
|
+
* @deprecated Import `buildThemeFromUrl` from `@sanity/themer-legacy` instead.
|
|
4
|
+
* `@sanity/themer/legacy` re-exports it unchanged for now and will be removed
|
|
5
|
+
* in `@sanity/themer@1.0`.
|
|
5
6
|
* @public
|
|
6
7
|
*/
|
|
7
|
-
|
|
8
|
+
export declare const buildThemeFromUrl: typeof themerLegacy.buildThemeFromUrl;
|
|
8
9
|
/**
|
|
9
|
-
*
|
|
10
|
-
*
|
|
11
|
-
*
|
|
10
|
+
* @deprecated Import `createTheme` from `@sanity/themer-legacy` instead.
|
|
11
|
+
* `@sanity/themer/legacy` re-exports it unchanged for now and will be removed
|
|
12
|
+
* in `@sanity/themer@1.0`.
|
|
12
13
|
* @public
|
|
13
14
|
*/
|
|
14
|
-
|
|
15
|
-
/** The mid color of the hue's tint ramp, as a hex color */
|
|
16
|
-
mid: string;
|
|
17
|
-
/** The tint that `mid` is placed at — the rest of the ramp is interpolated */
|
|
18
|
-
midPoint: HueMidPoint;
|
|
19
|
-
/** The hex color that the ramp's lightest end interpolates towards */
|
|
20
|
-
lightest: string;
|
|
21
|
-
/** The hex color that the ramp's darkest end interpolates towards */
|
|
22
|
-
darkest: string;
|
|
23
|
-
}
|
|
15
|
+
export declare const createTheme: typeof themerLegacy.createTheme;
|
|
24
16
|
/**
|
|
25
|
-
*
|
|
26
|
-
*
|
|
17
|
+
* @deprecated Import `parseHuesFromUrl` from `@sanity/themer-legacy` instead.
|
|
18
|
+
* `@sanity/themer/legacy` re-exports it unchanged for now and will be removed
|
|
19
|
+
* in `@sanity/themer@1.0`.
|
|
27
20
|
* @public
|
|
28
21
|
*/
|
|
29
|
-
|
|
30
|
-
default: Hue;
|
|
31
|
-
transparent: Hue;
|
|
32
|
-
primary: Hue;
|
|
33
|
-
positive: Hue;
|
|
34
|
-
caution: Hue;
|
|
35
|
-
critical: Hue;
|
|
36
|
-
}
|
|
22
|
+
export declare const parseHuesFromUrl: typeof themerLegacy.parseHuesFromUrl;
|
|
37
23
|
/**
|
|
38
|
-
* `
|
|
39
|
-
*
|
|
40
|
-
*
|
|
24
|
+
* @deprecated Import `hues` from `@sanity/themer-legacy` instead.
|
|
25
|
+
* `@sanity/themer/legacy` re-exports it unchanged for now and will be removed
|
|
26
|
+
* in `@sanity/themer@1.0`.
|
|
41
27
|
* @public
|
|
42
28
|
*/
|
|
43
|
-
|
|
29
|
+
export declare const hues: typeof themerLegacy.hues;
|
|
44
30
|
/**
|
|
45
|
-
*
|
|
46
|
-
*
|
|
47
|
-
*
|
|
31
|
+
* @deprecated Import `theme` from `@sanity/themer-legacy` instead.
|
|
32
|
+
* `@sanity/themer/legacy` re-exports it unchanged for now and will be removed
|
|
33
|
+
* in `@sanity/themer@1.0`.
|
|
48
34
|
* @public
|
|
49
35
|
*/
|
|
50
|
-
|
|
51
|
-
/**
|
|
52
|
-
* Set to `undefined` so that `@sanity/ui` derives the v2 theme internally
|
|
53
|
-
* from the generated colors.
|
|
54
|
-
*/
|
|
55
|
-
v2: undefined;
|
|
56
|
-
};
|
|
36
|
+
export declare const theme: typeof themerLegacy.theme;
|
|
57
37
|
/**
|
|
58
|
-
*
|
|
59
|
-
*
|
|
38
|
+
* @deprecated Import `presets` from `@sanity/themer-legacy` instead.
|
|
39
|
+
* `@sanity/themer/legacy` re-exports it unchanged for now and will be removed
|
|
40
|
+
* in `@sanity/themer@1.0`.
|
|
60
41
|
* @public
|
|
61
42
|
*/
|
|
62
|
-
|
|
63
|
-
slug: string;
|
|
64
|
-
title: string;
|
|
65
|
-
/**
|
|
66
|
-
* The canonical search params for this preset — the same query that
|
|
67
|
-
* `https://themer.sanity.build/api/hues` served the preset for.
|
|
68
|
-
*/
|
|
69
|
-
searchParams: string;
|
|
70
|
-
/** The preset's resolved hues, ready to pass to `createTheme` */
|
|
71
|
-
hues: Hues;
|
|
72
|
-
}
|
|
43
|
+
export declare const presets: typeof themerLegacy.presets;
|
|
73
44
|
/**
|
|
74
|
-
*
|
|
75
|
-
*
|
|
76
|
-
*
|
|
77
|
-
* ```ts
|
|
78
|
-
* import {createTheme, hues} from '@sanity/themer/legacy'
|
|
79
|
-
* import {defineConfig} from 'sanity'
|
|
80
|
-
*
|
|
81
|
-
* export default defineConfig({
|
|
82
|
-
* theme: createTheme({...hues, primary: {...hues.primary, mid: '#22fca8'}}),
|
|
83
|
-
* // ...rest of the config
|
|
84
|
-
* })
|
|
85
|
-
* ```
|
|
86
|
-
*
|
|
45
|
+
* @deprecated Import `Hue` from `@sanity/themer-legacy` instead.
|
|
46
|
+
* `@sanity/themer/legacy` will be removed in `@sanity/themer@1.0`.
|
|
87
47
|
* @public
|
|
88
48
|
*/
|
|
89
|
-
export
|
|
49
|
+
export type Hue = themerLegacy.Hue;
|
|
90
50
|
/**
|
|
91
|
-
*
|
|
92
|
-
*
|
|
93
|
-
* presets and overrides included.
|
|
94
|
-
*
|
|
95
|
-
* ```ts
|
|
96
|
-
* import {createTheme, parseHuesFromUrl} from '@sanity/themer/legacy'
|
|
97
|
-
*
|
|
98
|
-
* const hues = parseHuesFromUrl(
|
|
99
|
-
* 'https://themer.sanity.build/api/hues?preset=verdant&primary=22fca8',
|
|
100
|
-
* )
|
|
101
|
-
* const theme = createTheme(hues)
|
|
102
|
-
* ```
|
|
103
|
-
*
|
|
51
|
+
* @deprecated Import `HueMidPoint` from `@sanity/themer-legacy` instead.
|
|
52
|
+
* `@sanity/themer/legacy` will be removed in `@sanity/themer@1.0`.
|
|
104
53
|
* @public
|
|
105
54
|
*/
|
|
106
|
-
export
|
|
55
|
+
export type HueMidPoint = themerLegacy.HueMidPoint;
|
|
107
56
|
/**
|
|
108
|
-
*
|
|
109
|
-
*
|
|
110
|
-
*
|
|
111
|
-
* ```ts
|
|
112
|
-
* // Before:
|
|
113
|
-
* // import {theme} from 'https://themer.sanity.build/api/hues?preset=verdant'
|
|
114
|
-
*
|
|
115
|
-
* // After:
|
|
116
|
-
* import {buildThemeFromUrl} from '@sanity/themer/legacy'
|
|
117
|
-
*
|
|
118
|
-
* const theme = buildThemeFromUrl(
|
|
119
|
-
* 'https://themer.sanity.build/api/hues?preset=verdant',
|
|
120
|
-
* )
|
|
121
|
-
* ```
|
|
122
|
-
*
|
|
57
|
+
* @deprecated Import `Hues` from `@sanity/themer-legacy` instead.
|
|
58
|
+
* `@sanity/themer/legacy` will be removed in `@sanity/themer@1.0`.
|
|
123
59
|
* @public
|
|
124
60
|
*/
|
|
125
|
-
export
|
|
61
|
+
export type Hues = themerLegacy.Hues;
|
|
126
62
|
/**
|
|
127
|
-
*
|
|
128
|
-
*
|
|
129
|
-
*
|
|
63
|
+
* @deprecated Import `LegacyTheme` from `@sanity/themer-legacy` instead.
|
|
64
|
+
* `@sanity/themer/legacy` will be removed in `@sanity/themer@1.0`.
|
|
130
65
|
* @public
|
|
131
66
|
*/
|
|
132
|
-
export
|
|
67
|
+
export type LegacyTheme = themerLegacy.LegacyTheme;
|
|
133
68
|
/**
|
|
134
|
-
*
|
|
135
|
-
*
|
|
136
|
-
*
|
|
69
|
+
* @deprecated Import `PartialHues` from `@sanity/themer-legacy` instead.
|
|
70
|
+
* `@sanity/themer/legacy` will be removed in `@sanity/themer@1.0`.
|
|
137
71
|
* @public
|
|
138
72
|
*/
|
|
139
|
-
export
|
|
73
|
+
export type PartialHues = themerLegacy.PartialHues;
|
|
140
74
|
/**
|
|
141
|
-
*
|
|
142
|
-
*
|
|
143
|
-
*
|
|
144
|
-
* ```ts
|
|
145
|
-
* import {createTheme, presets} from '@sanity/themer/legacy'
|
|
146
|
-
*
|
|
147
|
-
* const verdant = presets.find((preset) => preset.slug === 'verdant')
|
|
148
|
-
* const theme = createTheme(verdant.hues)
|
|
149
|
-
* ```
|
|
150
|
-
*
|
|
75
|
+
* @deprecated Import `ThemePreset` from `@sanity/themer-legacy` instead.
|
|
76
|
+
* `@sanity/themer/legacy` will be removed in `@sanity/themer@1.0`.
|
|
151
77
|
* @public
|
|
152
78
|
*/
|
|
153
|
-
export
|
|
154
|
-
export type { Hue, HueMidPoint, Hues, LegacyTheme, PartialHues, ThemePreset };
|
|
79
|
+
export type ThemePreset = themerLegacy.ThemePreset;
|
|
155
80
|
//# sourceMappingURL=legacy.d.ts.map
|
package/dist/legacy.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"legacy.d.ts","names":[],"sources":["../src/legacy/
|
|
1
|
+
{"version":3,"file":"legacy.d.ts","names":[],"sources":["../src/legacy/index.ts"],"mappings":";;;;;;;qBAYa,0BAA0B,aAAa;;;;;;;qBASvC,oBAAoB,aAAa;;;;;;;qBAQjC,yBAAyB,aAAa;;;;;;;qBAQtC,aAAa,aAAa;;;;;;;qBAQ1B,cAAc,aAAa;;;;;;;qBAQ3B,gBAAgB,aAAa;;;;;;YAO9B,MAAM,aAAa;;;;;;YAOnB,cAAc,aAAa;;;;;;YAO3B,OAAO,aAAa;;;;;;YAOpB,cAAc,aAAa;;;;;;YAO3B,cAAc,aAAa;;;;;;YAO3B,cAAc,aAAa"}
|