@sanity/themer 0.3.14 → 0.3.16
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 -41
- 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/{presets-DWzYcsLg.js → presets-By3s-D-S.js} +15 -3
- package/dist/presets-By3s-D-S.js.map +1 -0
- package/dist/tool.js +1 -2
- package/dist/tool.js.map +1 -1
- package/package.json +4 -3
- package/dist/mix-BfV6_Ke4.js +0 -42
- package/dist/mix-BfV6_Ke4.js.map +0 -1
- package/dist/presets-DWzYcsLg.js.map +0 -1
package/README.md
CHANGED
|
@@ -63,51 +63,16 @@ If the Studio already uses a `buildTheme` theme, pass the same options so the to
|
|
|
63
63
|
|
|
64
64
|
## Migrating from themer.sanity.build
|
|
65
65
|
|
|
66
|
-
|
|
66
|
+
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.
|
|
67
67
|
|
|
68
|
-
`@sanity/themer/legacy`
|
|
68
|
+
`@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:
|
|
69
69
|
|
|
70
|
-
```
|
|
71
|
-
|
|
72
|
-
import {
|
|
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'
|
|
90
|
-
|
|
91
|
-
const hues = parseHuesFromUrl('https://themer.sanity.build/api/hues?preset=verdant')
|
|
92
|
-
|
|
93
|
-
export default defineConfig({
|
|
94
|
-
theme: createTheme({...hues, primary: {...hues.primary, mid: '#22fca8'}}),
|
|
95
|
-
// ...rest of the config
|
|
96
|
-
})
|
|
97
|
-
```
|
|
98
|
-
|
|
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')
|
|
70
|
+
```diff
|
|
71
|
+
-import {theme} from 'https://themer.sanity.build/api/hues?preset=verdant&primary=22fca8'
|
|
72
|
+
+import {buildThemeFromUrl} from '@sanity/themer-legacy'
|
|
73
|
+
+const theme = buildThemeFromUrl('https://themer.sanity.build/api/hues?preset=verdant&primary=22fca8')
|
|
105
74
|
```
|
|
106
75
|
|
|
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
76
|
## License
|
|
112
77
|
|
|
113
78
|
MIT © Sanity.io — see [LICENSE](https://github.com/sanity-io/ui/blob/main/LICENSE)
|
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-By3s-D-S.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"}
|