@sanity/themer 0.10.1 → 0.10.3
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/dist/{ResizableSidebar-C1nr3Ls2.js → ResizableSidebar-B5Px5VCf.js} +29 -29
- package/dist/{ResizableSidebar-C1nr3Ls2.js.map → ResizableSidebar-B5Px5VCf.js.map} +1 -1
- package/dist/bundle.css +109 -109
- package/dist/index.d.ts +4 -4
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -2
- package/dist/legacy.d.ts +12 -13
- package/dist/legacy.d.ts.map +1 -1
- package/dist/{themes-au1BLKmY.js → themes-sELelb-j.js} +29 -29
- package/dist/{themes-au1BLKmY.js.map → themes-sELelb-j.js.map} +1 -1
- package/dist/tool.d.ts +2 -2
- package/dist/tool.d.ts.map +1 -1
- package/dist/tool.js +27 -28
- package/dist/tool.js.map +1 -1
- package/package.json +10 -10
package/dist/legacy.d.ts
CHANGED
|
@@ -5,77 +5,76 @@ import * as themerLegacy from "@sanity/themer-legacy";
|
|
|
5
5
|
* in `@sanity/themer@1.0`.
|
|
6
6
|
* @public
|
|
7
7
|
*/
|
|
8
|
-
declare const buildThemeFromUrl: typeof themerLegacy.buildThemeFromUrl;
|
|
8
|
+
export declare const buildThemeFromUrl: typeof themerLegacy.buildThemeFromUrl;
|
|
9
9
|
/**
|
|
10
10
|
* @deprecated Import `createTheme` from `@sanity/themer-legacy` instead.
|
|
11
11
|
* `@sanity/themer/legacy` re-exports it unchanged for now and will be removed
|
|
12
12
|
* in `@sanity/themer@1.0`.
|
|
13
13
|
* @public
|
|
14
14
|
*/
|
|
15
|
-
declare const createTheme: typeof themerLegacy.createTheme;
|
|
15
|
+
export declare const createTheme: typeof themerLegacy.createTheme;
|
|
16
16
|
/**
|
|
17
17
|
* @deprecated Import `parseHuesFromUrl` from `@sanity/themer-legacy` instead.
|
|
18
18
|
* `@sanity/themer/legacy` re-exports it unchanged for now and will be removed
|
|
19
19
|
* in `@sanity/themer@1.0`.
|
|
20
20
|
* @public
|
|
21
21
|
*/
|
|
22
|
-
declare const parseHuesFromUrl: typeof themerLegacy.parseHuesFromUrl;
|
|
22
|
+
export declare const parseHuesFromUrl: typeof themerLegacy.parseHuesFromUrl;
|
|
23
23
|
/**
|
|
24
24
|
* @deprecated Import `hues` from `@sanity/themer-legacy` instead.
|
|
25
25
|
* `@sanity/themer/legacy` re-exports it unchanged for now and will be removed
|
|
26
26
|
* in `@sanity/themer@1.0`.
|
|
27
27
|
* @public
|
|
28
28
|
*/
|
|
29
|
-
declare const hues: typeof themerLegacy.hues;
|
|
29
|
+
export declare const hues: typeof themerLegacy.hues;
|
|
30
30
|
/**
|
|
31
31
|
* @deprecated Import `theme` from `@sanity/themer-legacy` instead.
|
|
32
32
|
* `@sanity/themer/legacy` re-exports it unchanged for now and will be removed
|
|
33
33
|
* in `@sanity/themer@1.0`.
|
|
34
34
|
* @public
|
|
35
35
|
*/
|
|
36
|
-
declare const theme: typeof themerLegacy.theme;
|
|
36
|
+
export declare const theme: typeof themerLegacy.theme;
|
|
37
37
|
/**
|
|
38
38
|
* @deprecated Import `presets` from `@sanity/themer-legacy` instead.
|
|
39
39
|
* `@sanity/themer/legacy` re-exports it unchanged for now and will be removed
|
|
40
40
|
* in `@sanity/themer@1.0`.
|
|
41
41
|
* @public
|
|
42
42
|
*/
|
|
43
|
-
declare const presets: typeof themerLegacy.presets;
|
|
43
|
+
export declare const presets: typeof themerLegacy.presets;
|
|
44
44
|
/**
|
|
45
45
|
* @deprecated Import `Hue` from `@sanity/themer-legacy` instead.
|
|
46
46
|
* `@sanity/themer/legacy` will be removed in `@sanity/themer@1.0`.
|
|
47
47
|
* @public
|
|
48
48
|
*/
|
|
49
|
-
type Hue = themerLegacy.Hue;
|
|
49
|
+
export type Hue = themerLegacy.Hue;
|
|
50
50
|
/**
|
|
51
51
|
* @deprecated Import `HueMidPoint` from `@sanity/themer-legacy` instead.
|
|
52
52
|
* `@sanity/themer/legacy` will be removed in `@sanity/themer@1.0`.
|
|
53
53
|
* @public
|
|
54
54
|
*/
|
|
55
|
-
type HueMidPoint = themerLegacy.HueMidPoint;
|
|
55
|
+
export type HueMidPoint = themerLegacy.HueMidPoint;
|
|
56
56
|
/**
|
|
57
57
|
* @deprecated Import `Hues` from `@sanity/themer-legacy` instead.
|
|
58
58
|
* `@sanity/themer/legacy` will be removed in `@sanity/themer@1.0`.
|
|
59
59
|
* @public
|
|
60
60
|
*/
|
|
61
|
-
type Hues = themerLegacy.Hues;
|
|
61
|
+
export type Hues = themerLegacy.Hues;
|
|
62
62
|
/**
|
|
63
63
|
* @deprecated Import `LegacyTheme` from `@sanity/themer-legacy` instead.
|
|
64
64
|
* `@sanity/themer/legacy` will be removed in `@sanity/themer@1.0`.
|
|
65
65
|
* @public
|
|
66
66
|
*/
|
|
67
|
-
type LegacyTheme = themerLegacy.LegacyTheme;
|
|
67
|
+
export type LegacyTheme = themerLegacy.LegacyTheme;
|
|
68
68
|
/**
|
|
69
69
|
* @deprecated Import `PartialHues` from `@sanity/themer-legacy` instead.
|
|
70
70
|
* `@sanity/themer/legacy` will be removed in `@sanity/themer@1.0`.
|
|
71
71
|
* @public
|
|
72
72
|
*/
|
|
73
|
-
type PartialHues = themerLegacy.PartialHues;
|
|
73
|
+
export type PartialHues = themerLegacy.PartialHues;
|
|
74
74
|
/**
|
|
75
75
|
* @deprecated Import `ThemePreset` from `@sanity/themer-legacy` instead.
|
|
76
76
|
* `@sanity/themer/legacy` will be removed in `@sanity/themer@1.0`.
|
|
77
77
|
* @public
|
|
78
78
|
*/
|
|
79
|
-
type ThemePreset = themerLegacy.ThemePreset;
|
|
80
|
-
export { Hue, HueMidPoint, Hues, LegacyTheme, PartialHues, ThemePreset, buildThemeFromUrl, createTheme, hues, parseHuesFromUrl, presets, theme };
|
|
79
|
+
export type ThemePreset = themerLegacy.ThemePreset;
|
|
81
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/index.ts"],"mappings":";;;;;;;
|
|
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"}
|
|
@@ -5,66 +5,66 @@ import { addTransitionType } from "react";
|
|
|
5
5
|
* test id is stable and unique to the navbar, unlike its `data-ui` name
|
|
6
6
|
*/
|
|
7
7
|
const NAVBAR_SELECTOR = "[data-testid=\"studio-navbar\"]";
|
|
8
|
-
var layout = "
|
|
8
|
+
var layout = "_1wgm57nj", layoutTransitionType = "sanity-themer", viewTransitionClasses = {
|
|
9
9
|
navbarButton: { update: {
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
10
|
+
_1wgm57n2: "none",
|
|
11
|
+
_1wgm57n3: "none",
|
|
12
|
+
_1wgm57n0: "_1wgm57n5",
|
|
13
|
+
_1wgm57n1: "_1wgm57n5",
|
|
14
|
+
_1wgm57n4: "_1wgm57n5",
|
|
15
15
|
default: "none"
|
|
16
16
|
} },
|
|
17
17
|
navbarButtonTooltip: { update: {
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
18
|
+
_1wgm57n2: "none",
|
|
19
|
+
_1wgm57n3: "none",
|
|
20
|
+
_1wgm57n0: "auto",
|
|
21
|
+
_1wgm57n1: "auto",
|
|
22
22
|
default: "none"
|
|
23
23
|
} },
|
|
24
24
|
sidebar: {
|
|
25
25
|
enter: {
|
|
26
|
-
|
|
26
|
+
_1wgm57n0: "_1wgm57ne",
|
|
27
27
|
default: "none"
|
|
28
28
|
},
|
|
29
29
|
update: {
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
30
|
+
_1wgm57n2: "none",
|
|
31
|
+
_1wgm57n3: "none",
|
|
32
|
+
_1wgm57n4: "auto",
|
|
33
33
|
default: "none"
|
|
34
34
|
},
|
|
35
35
|
exit: {
|
|
36
|
-
|
|
36
|
+
_1wgm57n1: "_1wgm57ng",
|
|
37
37
|
default: "none"
|
|
38
38
|
}
|
|
39
39
|
},
|
|
40
40
|
splitscreen: {
|
|
41
41
|
enter: {
|
|
42
|
-
|
|
42
|
+
_1wgm57n2: "_1wgm57nh",
|
|
43
43
|
default: "none"
|
|
44
44
|
},
|
|
45
45
|
update: {
|
|
46
|
-
|
|
46
|
+
_1wgm57n4: "auto",
|
|
47
47
|
default: "none"
|
|
48
48
|
},
|
|
49
49
|
exit: {
|
|
50
|
-
|
|
50
|
+
_1wgm57n3: "_1wgm57ni",
|
|
51
51
|
default: "none"
|
|
52
52
|
}
|
|
53
53
|
},
|
|
54
54
|
studio: { update: {
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
55
|
+
_1wgm57n0: "_1wgm57n6",
|
|
56
|
+
_1wgm57n1: "_1wgm57n6",
|
|
57
|
+
_1wgm57n2: "_1wgm57na",
|
|
58
|
+
_1wgm57n3: "_1wgm57na",
|
|
59
|
+
_1wgm57n4: "auto",
|
|
60
60
|
default: "none"
|
|
61
61
|
} }
|
|
62
62
|
}, viewTransitionTypes = {
|
|
63
|
-
open: "
|
|
64
|
-
close: "
|
|
65
|
-
"split-screen:open": "
|
|
66
|
-
"split-screen:close": "
|
|
67
|
-
crossfade: "
|
|
63
|
+
open: "_1wgm57n0",
|
|
64
|
+
close: "_1wgm57n1",
|
|
65
|
+
"split-screen:open": "_1wgm57n2",
|
|
66
|
+
"split-screen:close": "_1wgm57n3",
|
|
67
|
+
crossfade: "_1wgm57n4"
|
|
68
68
|
};
|
|
69
69
|
/**
|
|
70
70
|
* Adds the default sanity-themer transition type, which allows custom view transition overrides, as well as customization in userland
|
|
@@ -136,4 +136,4 @@ function randomId() {
|
|
|
136
136
|
}
|
|
137
137
|
export { displayTitle as a, resolveThemes as c, viewTransitionClasses as d, NAVBAR_SELECTOR as f, createCustomTheme as i, addThemerTransitionType as l, CONFIG_TITLE as n, duplicateTitle as o, UNTITLED_THEME as r, initialThemerState as s, CONFIG_SLUG as t, layout as u };
|
|
138
138
|
|
|
139
|
-
//# sourceMappingURL=themes-
|
|
139
|
+
//# sourceMappingURL=themes-sELelb-j.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"themes-au1BLKmY.js","names":["\"default\""],"sources":["../src/tool/constants.ts","../src/tool/ViewTransitions.css.ts","../src/tool/addThemerTransitionType.ts","../src/tool/themes.ts"],"sourcesContent":["/**\n * The largest media index (`useMediaIndex` of `@sanity/ui`) that is too small\n * for the sidebar: up to it the Studio is on a phone-sized screen, which the\n * tool has no layout for yet, so the sidebar stays closed\n */\nexport const MIN_MEDIA_INDEX_FOR_SIDEBAR = 2\n/** The largest media index that is too small for the split preview — two Studios side by side take room */\nexport const MIN_MEDIA_INDEX_FOR_SPLIT_SCREEN = 3\n/**\n * The Studio navbar's root, the `Card` that draws its bottom border — its\n * test id is stable and unique to the navbar, unlike its `data-ui` name\n */\nexport const NAVBAR_SELECTOR = '[data-testid=\"studio-navbar\"]'\n","import {\n createViewTransition,\n globalStyle,\n keyframes,\n style,\n type GlobalStyleRule,\n} from '@vanilla-extract/css'\nimport type {ViewTransitionClass} from 'react'\n\nfunction createViewTransitionType(\n rules: Partial<Record<'new' | 'old' | 'group' | 'imagePair', GlobalStyleRule>>,\n debugId?: string,\n) {\n const type = style({}, debugId)\n if (rules.new) {\n globalStyle(`::view-transition-new(.${type})`, rules.new)\n }\n if (rules.old) {\n globalStyle(`::view-transition-old(.${type})`, rules.old)\n }\n if (rules.group) {\n globalStyle(`::view-transition-group(.${type})`, rules.group)\n }\n if (rules.imagePair) {\n globalStyle(`::view-transition-image-pair(.${type})`, rules.imagePair)\n }\n return type\n}\n\n/**\n * The transition type of the layout's motions — what `ThemerLayout` adds to\n * every transition it starts, and React passes on to the view transition.\n * `:active-view-transition-type()` tells the layout's transitions from any\n * other on the page while they run.\n *\n * It's used on all transition types that userland might want to participate in, for example by setting their own:\n * ```tsx\n * <ViewTransition update={{'sanity-themer': 'auto', default: 'none'}}>\n * ```\n */\nexport const layoutTransitionType = 'sanity-themer'\n\n/**\n * Used with addTransitionType, and on `update` props on <ViewTransition> as the object key\n */\nexport const viewTransitionTypes = {\n 'open': createViewTransition('open'),\n 'close': createViewTransition('close'),\n 'split-screen:open': createViewTransition('split-screen-open'),\n 'split-screen:close': createViewTransition('split-screen-close'),\n 'crossfade': createViewTransition('crossfade'),\n}\n\nconst navbarButtonUpdateTransition = createViewTransitionType({\n new: {animation: 'none'},\n old: {display: 'none'},\n})\n\nconst resizeStudioRules = {inlineSize: '100%', blockSize: '100%', objectFit: 'fill'} as const\nconst resizeStudioTransition = createViewTransitionType(\n {old: resizeStudioRules, new: resizeStudioRules},\n 'resizeStudio',\n)\n\n/**\n * The Studio blurs out of its old width and into its new one as the split copy\n * comes and goes. The blur sits on the image pair that holds both snapshots,\n * not on the snapshots themselves: Safari (WebKit, as of Technology Preview\n * 253) paints a filtered snapshot as raw layer contents, losing the\n * `object-fit` stretch of `resizeStudioRules`, so the Studio scaled wrongly\n * while it resized there. One blur peaking at the cross-over, where the two\n * snapshots meet at half opacity, looks the same as the pair of 12px blurs\n * the snapshots carried before — their visible blur peaked at 6px there too\n */\nconst splitScreenFilter = 'blur(6px)'\nconst splitStudioTransition = createViewTransitionType({\n imagePair: {\n animationName: keyframes({'50%': {filter: splitScreenFilter}}),\n animationTimingFunction: 'inherit',\n },\n old: {...resizeStudioRules, animationName: keyframes({to: {opacity: 0}})},\n new: {...resizeStudioRules, animationName: keyframes({from: {opacity: 0}})},\n})\n/**\n * The split copy slides in from the side, or out to it — hidden for the first\n * quarter of the way in, and for the last quarter of the way out\n */\nconst splitScreenSlideIn = keyframes({\n 'from': {transform: 'translateX(-100%)', opacity: 0},\n '25%': {opacity: 0},\n})\nconst splitScreenSlideOut = keyframes({\n 'to': {transform: 'translateX(-100%)', opacity: 0},\n '75%': {opacity: 0},\n})\n\nexport const viewTransitionClasses = {\n navbarButton: {\n update: {\n [viewTransitionTypes['split-screen:open']]: 'none',\n [viewTransitionTypes['split-screen:close']]: 'none',\n [viewTransitionTypes.open]: navbarButtonUpdateTransition,\n [viewTransitionTypes.close]: navbarButtonUpdateTransition,\n [viewTransitionTypes.crossfade]: navbarButtonUpdateTransition,\n default: 'none',\n },\n } as const satisfies Record<string, ViewTransitionClass>,\n navbarButtonTooltip: {\n update: {\n [viewTransitionTypes['split-screen:open']]: 'none',\n [viewTransitionTypes['split-screen:close']]: 'none',\n [viewTransitionTypes.open]: 'auto',\n [viewTransitionTypes.close]: 'auto',\n default: 'none',\n },\n } as const satisfies Record<string, ViewTransitionClass>,\n sidebar: {\n enter: {\n [viewTransitionTypes.open]: createViewTransitionType(\n {new: {animationName: keyframes({from: {transform: 'translateX(100%)'}})}},\n 'panelSlideIn',\n ),\n default: 'none',\n },\n update: {\n [viewTransitionTypes['split-screen:open']]: 'none',\n [viewTransitionTypes['split-screen:close']]: 'none',\n [viewTransitionTypes.crossfade]: 'auto',\n default: 'none',\n },\n exit: {\n [viewTransitionTypes.close]: createViewTransitionType(\n {old: {animationName: keyframes({to: {transform: 'translateX(100%)'}})}},\n 'panelSlideOut',\n ),\n default: 'none',\n },\n } as const satisfies Record<string, ViewTransitionClass>,\n splitscreen: {\n enter: {\n [viewTransitionTypes['split-screen:open']]: createViewTransitionType({\n new: {animationName: splitScreenSlideIn},\n }),\n default: 'none',\n },\n update: {\n [viewTransitionTypes.crossfade]: 'auto',\n default: 'none',\n },\n exit: {\n [viewTransitionTypes['split-screen:close']]: createViewTransitionType({\n old: {animationName: splitScreenSlideOut},\n }),\n default: 'none',\n },\n } as const satisfies Record<string, ViewTransitionClass>,\n studio: {\n update: {\n [viewTransitionTypes['open']]: resizeStudioTransition,\n [viewTransitionTypes['close']]: resizeStudioTransition,\n [viewTransitionTypes['split-screen:open']]: splitStudioTransition,\n [viewTransitionTypes['split-screen:close']]: splitStudioTransition,\n [viewTransitionTypes.crossfade]: 'auto',\n default: 'none',\n },\n } as const satisfies Record<string, ViewTransitionClass>,\n}\n\n/**\n * Default animation timings for all Themer view transitions\n */\nglobalStyle(\n `:root:active-view-transition-type(${layoutTransitionType})::view-transition-group(*)`,\n {animationDuration: '320ms', animationTimingFunction: 'cubic-bezier(0.65, 0, 0.35, 1)'},\n)\n\nglobalStyle(\n [\n `:root:active-view-transition-type(${viewTransitionTypes['split-screen:open']})::view-transition-group(*)`,\n `:root:active-view-transition-type(${viewTransitionTypes['split-screen:close']})::view-transition-group(*)`,\n ].join(','),\n {animationDuration: '480ms'},\n)\n\n/** The layout's `Flex` positions the sidebar overlay on small screens */\nexport const layout = style({\n position: 'relative',\n})\n\n/**\n * Disable animations automatically for themer view transitions if the user signals to do so\n */\nglobalStyle(\n `:root:active-view-transition-type(${layoutTransitionType})::view-transition-group(*),:root:active-view-transition-type(${layoutTransitionType})::view-transition-old(*),:root:active-view-transition-type(${layoutTransitionType})::view-transition-new(*)`,\n {\n '@media': {\n '(prefers-reduced-motion: reduce)': {\n animationDuration: '0s !important',\n animationDelay: '0s !important',\n },\n },\n },\n)\n\n/**\n * Allow clicks and interactivity during themer animations\n */\nglobalStyle(`:root:active-view-transition-type(${layoutTransitionType})::view-transition`, {\n pointerEvents: 'none',\n})\n","import {addTransitionType} from 'react'\n\nimport {layoutTransitionType, viewTransitionTypes} from './ViewTransitions.css'\n\n/**\n * Adds the default sanity-themer transition type, which allows custom view transition overrides, as well as customization in userland\n */\nexport function addThemerTransitionType(type: keyof typeof viewTransitionTypes) {\n if (!(type in viewTransitionTypes)) {\n throw new Error(`Invalid transition type`, {cause: {type}})\n }\n addTransitionType(viewTransitionTypes[type])\n // Used to mark that a themer transition is happening, can be styled with vanilla css, but also by setting class props on <ViewTransition>\n addTransitionType(layoutTransitionType)\n}\n","import type {BuildThemeOptions} from '../theme/options'\nimport {presets} from '../theme/presets'\nimport type {ImagePalette} from './imagePalette'\n\n/**\n * Where a theme in the themer list comes from: the theme the Studio config\n * was generated from, one of the presets defined in code, or one the user\n * added in the tool. Only custom themes are editable — the others are\n * duplicated into a custom theme first.\n */\ntype ThemerThemeSource = 'config' | 'preset' | 'custom'\n\n/** A theme the themer tool lists @internal */\nexport interface ThemerTheme {\n slug: string\n title: string\n options: BuildThemeOptions\n source: ThemerThemeSource\n /** The palette of the image the theme's colors were taken from, for custom themes */\n palette?: ImagePalette\n}\n\n/** A theme the user added in the tool, as persisted @internal */\nexport interface CustomTheme {\n slug: string\n title: string\n options: BuildThemeOptions\n /** The palette of the image the theme's colors were taken from */\n palette?: ImagePalette\n}\n\n/** The persisted themer state @internal */\nexport interface ThemerState {\n /**\n * The slug of the applied theme — `null` applies nothing on top of the\n * Studio's configured theme\n */\n active: string | null\n /** The themes the user added */\n custom: CustomTheme[]\n /** The slugs of the themes the user removed from the list */\n removed: string[]\n /**\n * The slugs of the themes in the order the user arranged them — themes not\n * in it (new presets, themes added since) follow in their default order\n */\n order: string[]\n}\n\n/** The slug of the theme the Studio config was generated from @internal */\nexport const CONFIG_SLUG = 'config'\n\n/** The title of the theme the Studio config was generated from */\nexport const CONFIG_TITLE = 'Studio config'\n\n/** The title new themes start out with @internal */\nexport const UNTITLED_THEME = 'Untitled theme'\n\n/** @internal */\nexport const initialThemerState: ThemerState = {active: null, custom: [], removed: [], order: []}\n\n/** The themes the tool works with, derived from the persisted state @internal */\nexport interface ResolvedThemes {\n /** The themes to pick from, in list order */\n themes: ThemerTheme[]\n /** The removed themes, which can be restored */\n removed: ThemerTheme[]\n /** The applied theme */\n active: ThemerTheme | undefined\n}\n\nconst presetsWithSource = presets.map((preset) =>\n Object.assign({}, preset, {source: 'preset' as const}),\n)\n\n/**\n * Resolves the list of themes: the presets, then the user's own themes —\n * rearranged into the order the user dragged them into, with themes that\n * order does not know about kept in that default order after the ones it\n * does. Removed themes are set aside so they can be restored. The configured\n * theme is not in the list — `ThemeList` shows it ahead of it — and it is\n * what applies when no listed theme does: `active` is `undefined` for it, and\n * for an applied slug that no longer resolves.\n *\n * @internal\n */\nexport function resolveThemes(state: ThemerState): ResolvedThemes {\n const all: ThemerTheme[] = [...presetsWithSource]\n\n for (const theme of state.custom) {\n all.push({\n slug: theme.slug,\n title: theme.title,\n options: theme.options,\n source: 'custom',\n ...(theme.palette ? {palette: theme.palette} : {}),\n })\n }\n\n const position = new Map(state.order.map((slug, index) => [slug, index]))\n const rank = (theme: ThemerTheme) => position.get(theme.slug) ?? state.order.length\n\n // A stable sort: the themes the order does not know about keep their default order\n all.sort((a, b) => rank(a) - rank(b))\n\n const removedSlugs = new Set(state.removed)\n const themes = all.filter((theme) => !removedSlugs.has(theme.slug))\n const removed = all.filter((theme) => removedSlugs.has(theme.slug))\n const active = themes.find((theme) => theme.slug === state.active)\n\n return {themes, removed, active}\n}\n\n/**\n * Creates a custom theme with a slug that cannot collide with the presets or\n * the configured theme.\n *\n * @internal\n */\nexport function createCustomTheme(\n title: string,\n options: BuildThemeOptions,\n palette?: ImagePalette,\n): CustomTheme {\n return {slug: `custom-${randomId()}`, title, options, ...(palette ? {palette} : {})}\n}\n\n/** The title of a duplicated theme @internal */\nexport function duplicateTitle(title: string): string {\n return `${displayTitle(title)} copy`\n}\n\n/** The title to show for a theme, falling back when the user cleared it @internal */\nexport function displayTitle(title: string): string {\n return title.trim() || UNTITLED_THEME\n}\n\nfunction randomId(): string {\n if (typeof crypto !== 'undefined' && typeof crypto.randomUUID === 'function') {\n return crypto.randomUUID()\n }\n\n return `${Date.now().toString(36)}${Math.random().toString(36).slice(2, 10)}`\n}\n"],"mappings":";;;;;;AAYA,MAAa,kBAAkB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AEL/B,SAAgB,wBAAwB,MAAwC;CAC9E,IAAI,EAAE,QAAQ,sBACZ,MAAU,MAAM,2BAA2B,EAAC,OAAO,EAAC,KAAI,EAAC,CAAC;CAI5D,AAFA,kBAAkB,oBAAoB,KAAK,GAE3C,kBAAkB,oBAAoB;AACxC;;ACoCA,MAAa,cAAc,UAGd,eAAe,iBAGf,iBAAiB,kBAGjB,qBAAkC;CAAC,QAAQ;CAAM,QAAQ,CAAC;CAAG,SAAS,CAAC;CAAG,OAAO,CAAC;AAAC,GAY1F,oBAAoB,QAAQ,KAAK,WACrC,OAAO,OAAO,CAAC,GAAG,QAAQ,EAAC,QAAQ,SAAiB,CAAC,CACvD;;;;;;;;;;;;AAaA,SAAgB,cAAc,OAAoC;CAChE,IAAM,MAAqB,CAAC,GAAG,iBAAiB;CAEhD,KAAK,IAAM,SAAS,MAAM,QACxB,IAAI,KAAK;EACP,MAAM,MAAM;EACZ,OAAO,MAAM;EACb,SAAS,MAAM;EACf,QAAQ;EACR,GAAI,MAAM,UAAU,EAAC,SAAS,MAAM,QAAO,IAAI,CAAC;CAClD,CAAC;CAGH,IAAM,WAAW,IAAI,IAAI,MAAM,MAAM,KAAK,MAAM,UAAU,CAAC,MAAM,KAAK,CAAC,CAAC,GAClE,QAAQ,UAAuB,SAAS,IAAI,MAAM,IAAI,KAAK,MAAM,MAAM;CAG7E,IAAI,MAAM,GAAG,MAAM,KAAK,CAAC,IAAI,KAAK,CAAC,CAAC;CAEpC,IAAM,eAAe,IAAI,IAAI,MAAM,OAAO,GACpC,SAAS,IAAI,QAAQ,UAAU,CAAC,aAAa,IAAI,MAAM,IAAI,CAAC;CAIlE,OAAO;EAAC;EAAQ,SAHA,IAAI,QAAQ,UAAU,aAAa,IAAI,MAAM,IAAI,CAGjD;EAAS,QAFV,OAAO,MAAM,UAAU,MAAM,SAAS,MAAM,MAElC;CAAM;AACjC;;;;;;;AAQA,SAAgB,kBACd,OACA,SACA,SACa;CACb,OAAO;EAAC,MAAM,UAAU,SAAS;EAAK;EAAO;EAAS,GAAI,UAAU,EAAC,QAAO,IAAI,CAAC;CAAE;AACrF;;AAGA,SAAgB,eAAe,OAAuB;CACpD,OAAO,GAAG,aAAa,KAAK,EAAE;AAChC;;AAGA,SAAgB,aAAa,OAAuB;CAClD,OAAO,MAAM,KAAK,KAAA;AACpB;AAEA,SAAS,WAAmB;CAK1B,OAJI,OAAO,SAAW,OAAe,OAAO,OAAO,cAAe,aACzD,OAAO,WAAW,IAGpB,GAAG,KAAK,IAAI,CAAC,CAAC,SAAS,EAAE,IAAI,KAAK,OAAO,CAAC,CAAC,SAAS,EAAE,CAAC,CAAC,MAAM,GAAG,EAAE;AAC5E"}
|
|
1
|
+
{"version":3,"file":"themes-sELelb-j.js","names":["\"default\""],"sources":["../src/tool/constants.ts","../src/tool/ViewTransitions.css.ts","../src/tool/addThemerTransitionType.ts","../src/tool/themes.ts"],"sourcesContent":["/**\n * The largest media index (`useMediaIndex` of `@sanity/ui`) that is too small\n * for the sidebar: up to it the Studio is on a phone-sized screen, which the\n * tool has no layout for yet, so the sidebar stays closed\n */\nexport const MIN_MEDIA_INDEX_FOR_SIDEBAR = 2\n/** The largest media index that is too small for the split preview — two Studios side by side take room */\nexport const MIN_MEDIA_INDEX_FOR_SPLIT_SCREEN = 3\n/**\n * The Studio navbar's root, the `Card` that draws its bottom border — its\n * test id is stable and unique to the navbar, unlike its `data-ui` name\n */\nexport const NAVBAR_SELECTOR = '[data-testid=\"studio-navbar\"]'\n","import {\n createViewTransition,\n globalStyle,\n keyframes,\n style,\n type GlobalStyleRule,\n} from '@vanilla-extract/css'\nimport type {ViewTransitionClass} from 'react'\n\nfunction createViewTransitionType(\n rules: Partial<Record<'new' | 'old' | 'group' | 'imagePair', GlobalStyleRule>>,\n debugId?: string,\n) {\n const type = style({}, debugId)\n if (rules.new) {\n globalStyle(`::view-transition-new(.${type})`, rules.new)\n }\n if (rules.old) {\n globalStyle(`::view-transition-old(.${type})`, rules.old)\n }\n if (rules.group) {\n globalStyle(`::view-transition-group(.${type})`, rules.group)\n }\n if (rules.imagePair) {\n globalStyle(`::view-transition-image-pair(.${type})`, rules.imagePair)\n }\n return type\n}\n\n/**\n * The transition type of the layout's motions — what `ThemerLayout` adds to\n * every transition it starts, and React passes on to the view transition.\n * `:active-view-transition-type()` tells the layout's transitions from any\n * other on the page while they run.\n *\n * It's used on all transition types that userland might want to participate in, for example by setting their own:\n * ```tsx\n * <ViewTransition update={{'sanity-themer': 'auto', default: 'none'}}>\n * ```\n */\nexport const layoutTransitionType = 'sanity-themer'\n\n/**\n * Used with addTransitionType, and on `update` props on <ViewTransition> as the object key\n */\nexport const viewTransitionTypes = {\n 'open': createViewTransition('open'),\n 'close': createViewTransition('close'),\n 'split-screen:open': createViewTransition('split-screen-open'),\n 'split-screen:close': createViewTransition('split-screen-close'),\n 'crossfade': createViewTransition('crossfade'),\n}\n\nconst navbarButtonUpdateTransition = createViewTransitionType({\n new: {animation: 'none'},\n old: {display: 'none'},\n})\n\nconst resizeStudioRules = {inlineSize: '100%', blockSize: '100%', objectFit: 'fill'} as const\nconst resizeStudioTransition = createViewTransitionType(\n {old: resizeStudioRules, new: resizeStudioRules},\n 'resizeStudio',\n)\n\n/**\n * The Studio blurs out of its old width and into its new one as the split copy\n * comes and goes. The blur sits on the image pair that holds both snapshots,\n * not on the snapshots themselves: Safari (WebKit, as of Technology Preview\n * 253) paints a filtered snapshot as raw layer contents, losing the\n * `object-fit` stretch of `resizeStudioRules`, so the Studio scaled wrongly\n * while it resized there. One blur peaking at the cross-over, where the two\n * snapshots meet at half opacity, looks the same as the pair of 12px blurs\n * the snapshots carried before — their visible blur peaked at 6px there too\n */\nconst splitScreenFilter = 'blur(6px)'\nconst splitStudioTransition = createViewTransitionType({\n imagePair: {\n animationName: keyframes({'50%': {filter: splitScreenFilter}}),\n animationTimingFunction: 'inherit',\n },\n old: {...resizeStudioRules, animationName: keyframes({to: {opacity: 0}})},\n new: {...resizeStudioRules, animationName: keyframes({from: {opacity: 0}})},\n})\n/**\n * The split copy slides in from the side, or out to it — hidden for the first\n * quarter of the way in, and for the last quarter of the way out\n */\nconst splitScreenSlideIn = keyframes({\n 'from': {transform: 'translateX(-100%)', opacity: 0},\n '25%': {opacity: 0},\n})\nconst splitScreenSlideOut = keyframes({\n 'to': {transform: 'translateX(-100%)', opacity: 0},\n '75%': {opacity: 0},\n})\n\nexport const viewTransitionClasses = {\n navbarButton: {\n update: {\n [viewTransitionTypes['split-screen:open']]: 'none',\n [viewTransitionTypes['split-screen:close']]: 'none',\n [viewTransitionTypes.open]: navbarButtonUpdateTransition,\n [viewTransitionTypes.close]: navbarButtonUpdateTransition,\n [viewTransitionTypes.crossfade]: navbarButtonUpdateTransition,\n default: 'none',\n },\n } as const satisfies Record<string, ViewTransitionClass>,\n navbarButtonTooltip: {\n update: {\n [viewTransitionTypes['split-screen:open']]: 'none',\n [viewTransitionTypes['split-screen:close']]: 'none',\n [viewTransitionTypes.open]: 'auto',\n [viewTransitionTypes.close]: 'auto',\n default: 'none',\n },\n } as const satisfies Record<string, ViewTransitionClass>,\n sidebar: {\n enter: {\n [viewTransitionTypes.open]: createViewTransitionType(\n {new: {animationName: keyframes({from: {transform: 'translateX(100%)'}})}},\n 'panelSlideIn',\n ),\n default: 'none',\n },\n update: {\n [viewTransitionTypes['split-screen:open']]: 'none',\n [viewTransitionTypes['split-screen:close']]: 'none',\n [viewTransitionTypes.crossfade]: 'auto',\n default: 'none',\n },\n exit: {\n [viewTransitionTypes.close]: createViewTransitionType(\n {old: {animationName: keyframes({to: {transform: 'translateX(100%)'}})}},\n 'panelSlideOut',\n ),\n default: 'none',\n },\n } as const satisfies Record<string, ViewTransitionClass>,\n splitscreen: {\n enter: {\n [viewTransitionTypes['split-screen:open']]: createViewTransitionType({\n new: {animationName: splitScreenSlideIn},\n }),\n default: 'none',\n },\n update: {\n [viewTransitionTypes.crossfade]: 'auto',\n default: 'none',\n },\n exit: {\n [viewTransitionTypes['split-screen:close']]: createViewTransitionType({\n old: {animationName: splitScreenSlideOut},\n }),\n default: 'none',\n },\n } as const satisfies Record<string, ViewTransitionClass>,\n studio: {\n update: {\n [viewTransitionTypes['open']]: resizeStudioTransition,\n [viewTransitionTypes['close']]: resizeStudioTransition,\n [viewTransitionTypes['split-screen:open']]: splitStudioTransition,\n [viewTransitionTypes['split-screen:close']]: splitStudioTransition,\n [viewTransitionTypes.crossfade]: 'auto',\n default: 'none',\n },\n } as const satisfies Record<string, ViewTransitionClass>,\n}\n\n/**\n * Default animation timings for all Themer view transitions\n */\nglobalStyle(\n `:root:active-view-transition-type(${layoutTransitionType})::view-transition-group(*)`,\n {animationDuration: '320ms', animationTimingFunction: 'cubic-bezier(0.65, 0, 0.35, 1)'},\n)\n\nglobalStyle(\n [\n `:root:active-view-transition-type(${viewTransitionTypes['split-screen:open']})::view-transition-group(*)`,\n `:root:active-view-transition-type(${viewTransitionTypes['split-screen:close']})::view-transition-group(*)`,\n ].join(','),\n {animationDuration: '480ms'},\n)\n\n/** The layout's `Flex` positions the sidebar overlay on small screens */\nexport const layout = style({\n position: 'relative',\n})\n\n/**\n * Disable animations automatically for themer view transitions if the user signals to do so\n */\nglobalStyle(\n `:root:active-view-transition-type(${layoutTransitionType})::view-transition-group(*),:root:active-view-transition-type(${layoutTransitionType})::view-transition-old(*),:root:active-view-transition-type(${layoutTransitionType})::view-transition-new(*)`,\n {\n '@media': {\n '(prefers-reduced-motion: reduce)': {\n animationDuration: '0s !important',\n animationDelay: '0s !important',\n },\n },\n },\n)\n\n/**\n * Allow clicks and interactivity during themer animations\n */\nglobalStyle(`:root:active-view-transition-type(${layoutTransitionType})::view-transition`, {\n pointerEvents: 'none',\n})\n","import {addTransitionType} from 'react'\n\nimport {layoutTransitionType, viewTransitionTypes} from './ViewTransitions.css'\n\n/**\n * Adds the default sanity-themer transition type, which allows custom view transition overrides, as well as customization in userland\n */\nexport function addThemerTransitionType(type: keyof typeof viewTransitionTypes) {\n if (!(type in viewTransitionTypes)) {\n throw new Error(`Invalid transition type`, {cause: {type}})\n }\n addTransitionType(viewTransitionTypes[type])\n // Used to mark that a themer transition is happening, can be styled with vanilla css, but also by setting class props on <ViewTransition>\n addTransitionType(layoutTransitionType)\n}\n","import type {BuildThemeOptions} from '../theme/options'\nimport {presets} from '../theme/presets'\nimport type {ImagePalette} from './imagePalette'\n\n/**\n * Where a theme in the themer list comes from: the theme the Studio config\n * was generated from, one of the presets defined in code, or one the user\n * added in the tool. Only custom themes are editable — the others are\n * duplicated into a custom theme first.\n */\ntype ThemerThemeSource = 'config' | 'preset' | 'custom'\n\n/** A theme the themer tool lists @internal */\nexport interface ThemerTheme {\n slug: string\n title: string\n options: BuildThemeOptions\n source: ThemerThemeSource\n /** The palette of the image the theme's colors were taken from, for custom themes */\n palette?: ImagePalette\n}\n\n/** A theme the user added in the tool, as persisted @internal */\nexport interface CustomTheme {\n slug: string\n title: string\n options: BuildThemeOptions\n /** The palette of the image the theme's colors were taken from */\n palette?: ImagePalette\n}\n\n/** The persisted themer state @internal */\nexport interface ThemerState {\n /**\n * The slug of the applied theme — `null` applies nothing on top of the\n * Studio's configured theme\n */\n active: string | null\n /** The themes the user added */\n custom: CustomTheme[]\n /** The slugs of the themes the user removed from the list */\n removed: string[]\n /**\n * The slugs of the themes in the order the user arranged them — themes not\n * in it (new presets, themes added since) follow in their default order\n */\n order: string[]\n}\n\n/** The slug of the theme the Studio config was generated from @internal */\nexport const CONFIG_SLUG = 'config'\n\n/** The title of the theme the Studio config was generated from */\nexport const CONFIG_TITLE = 'Studio config'\n\n/** The title new themes start out with @internal */\nexport const UNTITLED_THEME = 'Untitled theme'\n\n/** @internal */\nexport const initialThemerState: ThemerState = {active: null, custom: [], removed: [], order: []}\n\n/** The themes the tool works with, derived from the persisted state @internal */\nexport interface ResolvedThemes {\n /** The themes to pick from, in list order */\n themes: ThemerTheme[]\n /** The removed themes, which can be restored */\n removed: ThemerTheme[]\n /** The applied theme */\n active: ThemerTheme | undefined\n}\n\nconst presetsWithSource = presets.map((preset) =>\n Object.assign({}, preset, {source: 'preset' as const}),\n)\n\n/**\n * Resolves the list of themes: the presets, then the user's own themes —\n * rearranged into the order the user dragged them into, with themes that\n * order does not know about kept in that default order after the ones it\n * does. Removed themes are set aside so they can be restored. The configured\n * theme is not in the list — `ThemeList` shows it ahead of it — and it is\n * what applies when no listed theme does: `active` is `undefined` for it, and\n * for an applied slug that no longer resolves.\n *\n * @internal\n */\nexport function resolveThemes(state: ThemerState): ResolvedThemes {\n const all: ThemerTheme[] = [...presetsWithSource]\n\n for (const theme of state.custom) {\n all.push({\n slug: theme.slug,\n title: theme.title,\n options: theme.options,\n source: 'custom',\n ...(theme.palette ? {palette: theme.palette} : {}),\n })\n }\n\n const position = new Map(state.order.map((slug, index) => [slug, index]))\n const rank = (theme: ThemerTheme) => position.get(theme.slug) ?? state.order.length\n\n // A stable sort: the themes the order does not know about keep their default order\n all.sort((a, b) => rank(a) - rank(b))\n\n const removedSlugs = new Set(state.removed)\n const themes = all.filter((theme) => !removedSlugs.has(theme.slug))\n const removed = all.filter((theme) => removedSlugs.has(theme.slug))\n const active = themes.find((theme) => theme.slug === state.active)\n\n return {themes, removed, active}\n}\n\n/**\n * Creates a custom theme with a slug that cannot collide with the presets or\n * the configured theme.\n *\n * @internal\n */\nexport function createCustomTheme(\n title: string,\n options: BuildThemeOptions,\n palette?: ImagePalette,\n): CustomTheme {\n return {slug: `custom-${randomId()}`, title, options, ...(palette ? {palette} : {})}\n}\n\n/** The title of a duplicated theme @internal */\nexport function duplicateTitle(title: string): string {\n return `${displayTitle(title)} copy`\n}\n\n/** The title to show for a theme, falling back when the user cleared it @internal */\nexport function displayTitle(title: string): string {\n return title.trim() || UNTITLED_THEME\n}\n\nfunction randomId(): string {\n if (typeof crypto !== 'undefined' && typeof crypto.randomUUID === 'function') {\n return crypto.randomUUID()\n }\n\n return `${Date.now().toString(36)}${Math.random().toString(36).slice(2, 10)}`\n}\n"],"mappings":";;;;;;AAYA,MAAa,kBAAkB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AEL/B,SAAgB,wBAAwB,MAAwC;CAC9E,IAAI,EAAE,QAAQ,sBACZ,MAAU,MAAM,2BAA2B,EAAC,OAAO,EAAC,KAAI,EAAC,CAAC;CAI5D,AAFA,kBAAkB,oBAAoB,KAAK,GAE3C,kBAAkB,oBAAoB;AACxC;;ACoCA,MAAa,cAAc,UAGd,eAAe,iBAGf,iBAAiB,kBAGjB,qBAAkC;CAAC,QAAQ;CAAM,QAAQ,CAAC;CAAG,SAAS,CAAC;CAAG,OAAO,CAAC;AAAC,GAY1F,oBAAoB,QAAQ,KAAK,WACrC,OAAO,OAAO,CAAC,GAAG,QAAQ,EAAC,QAAQ,SAAiB,CAAC,CACvD;;;;;;;;;;;;AAaA,SAAgB,cAAc,OAAoC;CAChE,IAAM,MAAqB,CAAC,GAAG,iBAAiB;CAEhD,KAAK,IAAM,SAAS,MAAM,QACxB,IAAI,KAAK;EACP,MAAM,MAAM;EACZ,OAAO,MAAM;EACb,SAAS,MAAM;EACf,QAAQ;EACR,GAAI,MAAM,UAAU,EAAC,SAAS,MAAM,QAAO,IAAI,CAAC;CAClD,CAAC;CAGH,IAAM,WAAW,IAAI,IAAI,MAAM,MAAM,KAAK,MAAM,UAAU,CAAC,MAAM,KAAK,CAAC,CAAC,GAClE,QAAQ,UAAuB,SAAS,IAAI,MAAM,IAAI,KAAK,MAAM,MAAM;CAG7E,IAAI,MAAM,GAAG,MAAM,KAAK,CAAC,IAAI,KAAK,CAAC,CAAC;CAEpC,IAAM,eAAe,IAAI,IAAI,MAAM,OAAO,GACpC,SAAS,IAAI,QAAQ,UAAU,CAAC,aAAa,IAAI,MAAM,IAAI,CAAC;CAIlE,OAAO;EAAC;EAAQ,SAHA,IAAI,QAAQ,UAAU,aAAa,IAAI,MAAM,IAAI,CAGjD;EAAS,QAFV,OAAO,MAAM,UAAU,MAAM,SAAS,MAAM,MAElC;CAAM;AACjC;;;;;;;AAQA,SAAgB,kBACd,OACA,SACA,SACa;CACb,OAAO;EAAC,MAAM,UAAU,SAAS;EAAK;EAAO;EAAS,GAAI,UAAU,EAAC,QAAO,IAAI,CAAC;CAAE;AACrF;;AAGA,SAAgB,eAAe,OAAuB;CACpD,OAAO,GAAG,aAAa,KAAK,EAAE;AAChC;;AAGA,SAAgB,aAAa,OAAuB;CAClD,OAAO,MAAM,KAAK,KAAA;AACpB;AAEA,SAAS,WAAmB;CAK1B,OAJI,OAAO,SAAW,OAAe,OAAO,OAAO,cAAe,aACzD,OAAO,WAAW,IAGpB,GAAG,KAAK,IAAI,CAAC,CAAC,SAAS,EAAE,IAAI,KAAK,OAAO,CAAC,CAAC,SAAS,EAAE,CAAC,CAAC,MAAM,GAAG,EAAE;AAC5E"}
|
package/dist/tool.d.ts
CHANGED
|
@@ -41,6 +41,6 @@ interface ThemerToolOptions {
|
|
|
41
41
|
*
|
|
42
42
|
* @alpha
|
|
43
43
|
*/
|
|
44
|
-
declare const themerTool: import("sanity").Plugin<void | ThemerToolOptions>;
|
|
45
|
-
export {
|
|
44
|
+
export declare const themerTool: import("sanity").Plugin<void | ThemerToolOptions>;
|
|
45
|
+
export type { ThemerToolOptions };
|
|
46
46
|
//# sourceMappingURL=tool.d.ts.map
|
package/dist/tool.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tool.d.ts","names":[],"sources":["../src/tool/plugin.tsx"],"mappings":"AAeA;;;;;;;;UAAiB;;;;;EAKf;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
|
1
|
+
{"version":3,"file":"tool.d.ts","names":[],"sources":["../src/tool/plugin.tsx"],"mappings":"AAeA;;;;;;;;UAAiB;;;;;EAKf;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;qBA+BW,6BAAU,cAAA"}
|
package/dist/tool.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import "@sanity/themer/bundle.css";
|
|
2
2
|
import { l as isColor, n as buildTheme, o as SCHEMES, t as presets } from "./presets-CqBgS3A-.js";
|
|
3
|
-
import { a as displayTitle, c as resolveThemes, d as viewTransitionClasses, f as NAVBAR_SELECTOR, i as createCustomTheme, l as addThemerTransitionType, n as CONFIG_TITLE, o as duplicateTitle, s as initialThemerState, u as layout } from "./themes-
|
|
3
|
+
import { a as displayTitle, c as resolveThemes, d as viewTransitionClasses, f as NAVBAR_SELECTOR, i as createCustomTheme, l as addThemerTransitionType, n as CONFIG_TITLE, o as duplicateTitle, s as initialThemerState, u as layout } from "./themes-sELelb-j.js";
|
|
4
4
|
import { c } from "react/compiler-runtime";
|
|
5
5
|
import { definePlugin, useColorSchemeValue } from "sanity";
|
|
6
6
|
import { ColorWheelIcon } from "@sanity/icons/ColorWheel";
|
|
@@ -932,34 +932,33 @@ function syncThemer(actorRef, options) {
|
|
|
932
932
|
channel && (channel.listen((data) => {
|
|
933
933
|
let message = parseMessage(data);
|
|
934
934
|
if (message) {
|
|
935
|
-
if (message.type === "hello")
|
|
936
|
-
|
|
937
|
-
|
|
938
|
-
|
|
939
|
-
|
|
940
|
-
|
|
941
|
-
|
|
942
|
-
|
|
943
|
-
|
|
944
|
-
|
|
945
|
-
|
|
946
|
-
|
|
947
|
-
|
|
935
|
+
if (message.type === "hello") leader ? answer(message.from) : unanswered.add(message.from);
|
|
936
|
+
else {
|
|
937
|
+
if (message.to !== void 0) {
|
|
938
|
+
if (message.to !== id) return;
|
|
939
|
+
if (!unchanged) {
|
|
940
|
+
if (origin === id) {
|
|
941
|
+
revision = Math.max(revision, message.revision) + 1, channel.post({
|
|
942
|
+
type: "state",
|
|
943
|
+
state: shared,
|
|
944
|
+
revision,
|
|
945
|
+
from: id
|
|
946
|
+
});
|
|
947
|
+
return;
|
|
948
|
+
}
|
|
949
|
+
if (!isNewer(message)) return;
|
|
950
|
+
}
|
|
951
|
+
} else if (!isNewer(message)) return;
|
|
952
|
+
if (revision = message.revision, origin = message.from, !dequal(message.state, shared)) {
|
|
953
|
+
shared = message.state, unchanged = !1, applying = !0;
|
|
954
|
+
try {
|
|
955
|
+
actorRef.send({
|
|
956
|
+
type: "themes.sync",
|
|
957
|
+
state: message.state
|
|
948
958
|
});
|
|
949
|
-
|
|
959
|
+
} finally {
|
|
960
|
+
applying = !1;
|
|
950
961
|
}
|
|
951
|
-
if (!isNewer(message)) return;
|
|
952
|
-
}
|
|
953
|
-
} else if (!isNewer(message)) return;
|
|
954
|
-
if (revision = message.revision, origin = message.from, !dequal(message.state, shared)) {
|
|
955
|
-
shared = message.state, unchanged = !1, applying = !0;
|
|
956
|
-
try {
|
|
957
|
-
actorRef.send({
|
|
958
|
-
type: "themes.sync",
|
|
959
|
-
state: message.state
|
|
960
|
-
});
|
|
961
|
-
} finally {
|
|
962
|
-
applying = !1;
|
|
963
962
|
}
|
|
964
963
|
}
|
|
965
964
|
}
|
|
@@ -994,7 +993,7 @@ function PersistActorSnapshot(t0) {
|
|
|
994
993
|
* the code loads, where an urgent render would suspend up to the Studio's
|
|
995
994
|
* own boundary and swap the whole Studio for its loading screen.
|
|
996
995
|
*/
|
|
997
|
-
const ResizableSidebar = lazy(() => import("./ResizableSidebar-
|
|
996
|
+
const ResizableSidebar = lazy(() => import("./ResizableSidebar-B5Px5VCf.js"));
|
|
998
997
|
/**
|
|
999
998
|
* Wraps the whole Studio to run the themer machine that the sidebar's flows
|
|
1000
999
|
* share — the user's themes, which one is applied and which flow the sidebar
|