next-sanity 0.6.8 → 0.6.11
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/cjs/studio.js +98 -97
- package/lib/cjs/studio.js.map +1 -1
- package/lib/esm/studio.js +101 -184
- package/lib/esm/studio.js.map +1 -1
- package/package.json +30 -8
- package/src/studio/NextStudioHead.tsx +1 -1
package/lib/cjs/studio.js
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
var $
|
|
2
|
-
var $
|
|
3
|
-
var $
|
|
4
|
-
var $
|
|
5
|
-
var $
|
|
6
|
-
var $
|
|
7
|
-
var $
|
|
1
|
+
var $cerUD$reactjsxruntime = require("react/jsx-runtime");
|
|
2
|
+
var $cerUD$react = require("react");
|
|
3
|
+
var $cerUD$sanity = require("sanity");
|
|
4
|
+
var $cerUD$styledcomponents = require("styled-components");
|
|
5
|
+
var $cerUD$nexthead = require("next/head");
|
|
6
|
+
var $cerUD$nextdocument = require("next/document");
|
|
7
|
+
var $cerUD$nextrouter = require("next/router");
|
|
8
8
|
|
|
9
9
|
function $parcel$exportWildcard(dest, source) {
|
|
10
10
|
Object.keys(source).forEach(function(key) {
|
|
@@ -28,10 +28,10 @@ function $parcel$export(e, n, v, s) {
|
|
|
28
28
|
function $parcel$interopDefault(a) {
|
|
29
29
|
return a && a.__esModule ? a.default : a;
|
|
30
30
|
}
|
|
31
|
-
var $
|
|
32
|
-
var $
|
|
31
|
+
var $5aa79282f535e8b1$exports = {};
|
|
32
|
+
var $c8bf9e0a6313dcb9$exports = {};
|
|
33
33
|
|
|
34
|
-
$parcel$export($
|
|
34
|
+
$parcel$export($c8bf9e0a6313dcb9$exports, "NextStudio", () => $c8bf9e0a6313dcb9$export$eefb95cccd1bb6c5);
|
|
35
35
|
|
|
36
36
|
|
|
37
37
|
|
|
@@ -39,42 +39,39 @@ $parcel$export($53f899201c613ec3$exports, "NextStudio", () => $53f899201c613ec3$
|
|
|
39
39
|
/**
|
|
40
40
|
* Intended to render at the root of a page, letting the Studio own that page and render much like it would if you used `npx sanity start` to render
|
|
41
41
|
* It's a drop-in replacement for `import {Studio} from 'sanity'`
|
|
42
|
-
*/ const $
|
|
43
|
-
const theme = (0, $
|
|
44
|
-
const { themeColorLight: themeColorLight , themeColorDark: themeColorDark } = (0, $
|
|
45
|
-
return /*#__PURE__*/ (0, $
|
|
42
|
+
*/ const $c8bf9e0a6313dcb9$var$NextStudioComponent = ({ children: children , config: config , unstable__noGlobalStyle: unstable__noGlobalStyle , unstable__noTailwindSvgFix: unstable__noTailwindSvgFix , unstable__head: unstable__head , unstable__document_title: unstable__document_title , unstable__bg: unstable__bg , unstable__noFavicons: unstable__noFavicons , ...props })=>{
|
|
43
|
+
const theme = (0, $b07d91633f3d677b$export$93d4e7f90805808f)(config);
|
|
44
|
+
const { themeColorLight: themeColorLight , themeColorDark: themeColorDark } = (0, $b07d91633f3d677b$export$d3a2146a441ec034)(theme);
|
|
45
|
+
return /*#__PURE__*/ (0, $cerUD$reactjsxruntime.jsxs)((0, $cerUD$reactjsxruntime.Fragment), {
|
|
46
46
|
children: [
|
|
47
|
-
children || /*#__PURE__*/ (0, $
|
|
47
|
+
children || /*#__PURE__*/ (0, $cerUD$reactjsxruntime.jsx)((0, $cerUD$sanity.Studio), {
|
|
48
48
|
config: config,
|
|
49
49
|
...props
|
|
50
50
|
}),
|
|
51
|
-
/*#__PURE__*/ (0, $
|
|
51
|
+
/*#__PURE__*/ (0, $cerUD$reactjsxruntime.jsx)((0, $9a339c4a487c3478$export$79723eee2c1bf75e), {
|
|
52
52
|
themeColorLight: themeColorLight,
|
|
53
53
|
themeColorDark: themeColorDark,
|
|
54
54
|
title: unstable__document_title,
|
|
55
55
|
favicons: !unstable__noFavicons,
|
|
56
56
|
children: unstable__head
|
|
57
57
|
}),
|
|
58
|
-
!unstable__noGlobalStyle && /*#__PURE__*/ (0, $
|
|
58
|
+
!unstable__noGlobalStyle && /*#__PURE__*/ (0, $cerUD$reactjsxruntime.jsx)((0, $1ac20522861d7f1e$export$c8fda7ee7699d07e), {
|
|
59
59
|
bg: unstable__bg !== null && unstable__bg !== void 0 ? unstable__bg : themeColorLight,
|
|
60
60
|
unstable__tailwindSvgFix: !unstable__noTailwindSvgFix
|
|
61
61
|
})
|
|
62
62
|
]
|
|
63
63
|
});
|
|
64
64
|
};
|
|
65
|
-
const $
|
|
65
|
+
const $c8bf9e0a6313dcb9$export$eefb95cccd1bb6c5 = /*#__PURE__*/ (0, $cerUD$react.memo)($c8bf9e0a6313dcb9$var$NextStudioComponent);
|
|
66
66
|
|
|
67
67
|
|
|
68
|
-
var $
|
|
68
|
+
var $1ac20522861d7f1e$exports = {};
|
|
69
69
|
|
|
70
|
-
$parcel$export($
|
|
70
|
+
$parcel$export($1ac20522861d7f1e$exports, "NextStudioGlobalStyle", () => $1ac20522861d7f1e$export$c8fda7ee7699d07e);
|
|
71
71
|
|
|
72
|
-
|
|
73
|
-
$
|
|
74
|
-
|
|
75
|
-
background-color: ${bg};
|
|
76
|
-
}
|
|
77
|
-
` : ""}
|
|
72
|
+
let $1ac20522861d7f1e$var$_ = (t)=>t, $1ac20522861d7f1e$var$t, $1ac20522861d7f1e$var$t1, $1ac20522861d7f1e$var$t2;
|
|
73
|
+
const $1ac20522861d7f1e$export$c8fda7ee7699d07e = (0, $cerUD$styledcomponents.createGlobalStyle)($1ac20522861d7f1e$var$t2 || ($1ac20522861d7f1e$var$t2 = $1ac20522861d7f1e$var$_`
|
|
74
|
+
${0}
|
|
78
75
|
html,
|
|
79
76
|
body,
|
|
80
77
|
#__next {
|
|
@@ -85,56 +82,60 @@ body {
|
|
|
85
82
|
overscroll-behavior: none;
|
|
86
83
|
-webkit-font-smoothing: antialiased;
|
|
87
84
|
}
|
|
88
|
-
${({
|
|
85
|
+
${0}`), ({ bg: bg })=>bg ? (0, $cerUD$styledcomponents.css)($1ac20522861d7f1e$var$t || ($1ac20522861d7f1e$var$t = $1ac20522861d7f1e$var$_`
|
|
86
|
+
html {
|
|
87
|
+
background-color: ${0};
|
|
88
|
+
}
|
|
89
|
+
`), bg) : "", ({ unstable__tailwindSvgFix: unstable__tailwindSvgFix })=>unstable__tailwindSvgFix ? (0, $cerUD$styledcomponents.css)($1ac20522861d7f1e$var$t1 || ($1ac20522861d7f1e$var$t1 = $1ac20522861d7f1e$var$_`
|
|
89
90
|
/* override tailwind reset */
|
|
90
91
|
:root svg {
|
|
91
92
|
display: inline;
|
|
92
93
|
}
|
|
93
|
-
` : ""
|
|
94
|
+
`)) : "");
|
|
94
95
|
|
|
95
96
|
|
|
96
|
-
var $
|
|
97
|
+
var $9a339c4a487c3478$exports = {};
|
|
97
98
|
|
|
98
|
-
$parcel$export($
|
|
99
|
+
$parcel$export($9a339c4a487c3478$exports, "NextStudioHead", () => $9a339c4a487c3478$export$79723eee2c1bf75e);
|
|
99
100
|
|
|
100
101
|
|
|
101
102
|
|
|
102
|
-
var $
|
|
103
|
-
$
|
|
103
|
+
var $e95b353cb9780322$exports = {};
|
|
104
|
+
$e95b353cb9780322$exports = new URL("apple-touch-icon.abc4aca2.png", "file:" + __filename).toString();
|
|
104
105
|
|
|
105
106
|
|
|
106
|
-
var $
|
|
107
|
-
$
|
|
107
|
+
var $5c6cb25811c5a469$exports = {};
|
|
108
|
+
$5c6cb25811c5a469$exports = new URL("favicon.648fc2f2.ico", "file:" + __filename).toString();
|
|
108
109
|
|
|
109
110
|
|
|
110
|
-
var $
|
|
111
|
-
$
|
|
111
|
+
var $8f66672978de215e$exports = {};
|
|
112
|
+
$8f66672978de215e$exports = new URL("favicon.8f76876f.svg", "file:" + __filename).toString();
|
|
112
113
|
|
|
113
114
|
|
|
114
|
-
var $
|
|
115
|
-
$
|
|
115
|
+
var $4602cd4ce640093d$exports = {};
|
|
116
|
+
$4602cd4ce640093d$exports = new URL("favicon-192.40c8bab4.png", "file:" + __filename).toString();
|
|
116
117
|
|
|
117
118
|
|
|
118
|
-
var $
|
|
119
|
-
$
|
|
119
|
+
var $2018744a752e803e$exports = {};
|
|
120
|
+
$2018744a752e803e$exports = new URL("favicon-512.5e08f951.png", "file:" + __filename).toString();
|
|
120
121
|
|
|
121
122
|
|
|
122
|
-
var $
|
|
123
|
-
$
|
|
123
|
+
var $bfac0ea6ea7884f0$exports = {};
|
|
124
|
+
$bfac0ea6ea7884f0$exports = JSON.parse('{"icons":[{"src":"./favicon-192.png","type":"image/png","sizes":"192x192"},{"src":"./favicon-512.png","type":"image/png","sizes":"512x512"}]}');
|
|
124
125
|
|
|
125
126
|
|
|
126
127
|
// Interop between how Parcel and Next deals with asset imports
|
|
127
|
-
const $
|
|
128
|
-
const $
|
|
129
|
-
const inlineWebmanifest = (0, $
|
|
130
|
-
const manifest = JSON.parse(JSON.stringify((0, (/*@__PURE__*/$parcel$interopDefault($
|
|
128
|
+
const $9a339c4a487c3478$var$interop = (href)=>typeof href === "string" ? href : href.src;
|
|
129
|
+
const $9a339c4a487c3478$var$NextStudioHeadComponent = ({ children: children , themeColorDark: themeColorDark , themeColorLight: themeColorLight , title: title = "Sanity Studio" , favicons: favicons })=>{
|
|
130
|
+
const inlineWebmanifest = (0, $cerUD$react.useCallback)(()=>{
|
|
131
|
+
const manifest = JSON.parse(JSON.stringify((0, (/*@__PURE__*/$parcel$interopDefault($bfac0ea6ea7884f0$exports)))));
|
|
131
132
|
const icons = manifest.icons.map((icon)=>{
|
|
132
133
|
// Inline manifests works best when URLs are absolute
|
|
133
134
|
const src = // eslint-disable-next-line no-nested-ternary
|
|
134
|
-
icon.src === "./favicon-192.png" ? $
|
|
135
|
+
icon.src === "./favicon-192.png" ? $9a339c4a487c3478$var$interop((0, (/*@__PURE__*/$parcel$interopDefault($4602cd4ce640093d$exports)))) : icon.src === "./favicon-512.png" ? $9a339c4a487c3478$var$interop((0, (/*@__PURE__*/$parcel$interopDefault($2018744a752e803e$exports)))) : icon.src;
|
|
135
136
|
return {
|
|
136
137
|
...icon,
|
|
137
|
-
src:
|
|
138
|
+
src: src
|
|
138
139
|
};
|
|
139
140
|
});
|
|
140
141
|
return `data:application/manifest+json,${encodeURIComponent(JSON.stringify({
|
|
@@ -142,50 +143,50 @@ const $3e6cd9b42bc397c4$var$NextStudioHeadComponent = ({ children: children , th
|
|
|
142
143
|
icons: icons
|
|
143
144
|
}))}`;
|
|
144
145
|
}, []);
|
|
145
|
-
return /*#__PURE__*/ (0, $
|
|
146
|
+
return /*#__PURE__*/ (0, $cerUD$reactjsxruntime.jsxs)((0, ($parcel$interopDefault($cerUD$nexthead))), {
|
|
146
147
|
children: [
|
|
147
|
-
/*#__PURE__*/ (0, $
|
|
148
|
+
/*#__PURE__*/ (0, $cerUD$reactjsxruntime.jsx)("meta", {
|
|
148
149
|
name: "viewport",
|
|
149
150
|
// Studio implements display cutouts CSS (The iPhone Notch ™ ) and needs `viewport-fit=covered` for it to work correctly
|
|
150
151
|
content: "width=device-width, initial-scale=1, viewport-fit=cover"
|
|
151
152
|
}),
|
|
152
|
-
/*#__PURE__*/ (0, $
|
|
153
|
+
/*#__PURE__*/ (0, $cerUD$reactjsxruntime.jsx)("meta", {
|
|
153
154
|
name: "robots",
|
|
154
155
|
content: "noindex"
|
|
155
156
|
}),
|
|
156
|
-
/*#__PURE__*/ (0, $
|
|
157
|
+
/*#__PURE__*/ (0, $cerUD$reactjsxruntime.jsx)("meta", {
|
|
157
158
|
name: "referrer",
|
|
158
159
|
content: "same-origin"
|
|
159
160
|
}),
|
|
160
|
-
/*#__PURE__*/ (0, $
|
|
161
|
+
/*#__PURE__*/ (0, $cerUD$reactjsxruntime.jsx)("title", {
|
|
161
162
|
children: title
|
|
162
163
|
}),
|
|
163
|
-
favicons && /*#__PURE__*/ (0, $
|
|
164
|
+
favicons && /*#__PURE__*/ (0, $cerUD$reactjsxruntime.jsx)("link", {
|
|
164
165
|
rel: "icon",
|
|
165
|
-
href: $
|
|
166
|
+
href: $9a339c4a487c3478$var$interop((0, (/*@__PURE__*/$parcel$interopDefault($5c6cb25811c5a469$exports)))),
|
|
166
167
|
sizes: "any"
|
|
167
168
|
}),
|
|
168
|
-
favicons && /*#__PURE__*/ (0, $
|
|
169
|
+
favicons && /*#__PURE__*/ (0, $cerUD$reactjsxruntime.jsx)("link", {
|
|
169
170
|
rel: "icon",
|
|
170
|
-
href: $
|
|
171
|
+
href: $9a339c4a487c3478$var$interop((0, (/*@__PURE__*/$parcel$interopDefault($8f66672978de215e$exports)))),
|
|
171
172
|
type: "image/svg+xml"
|
|
172
173
|
}),
|
|
173
|
-
favicons && /*#__PURE__*/ (0, $
|
|
174
|
+
favicons && /*#__PURE__*/ (0, $cerUD$reactjsxruntime.jsx)("link", {
|
|
174
175
|
rel: "apple-touch-icon",
|
|
175
|
-
href: $
|
|
176
|
+
href: $9a339c4a487c3478$var$interop((0, (/*@__PURE__*/$parcel$interopDefault($e95b353cb9780322$exports))))
|
|
176
177
|
}),
|
|
177
|
-
favicons && /*#__PURE__*/ (0, $
|
|
178
|
+
favicons && /*#__PURE__*/ (0, $cerUD$reactjsxruntime.jsx)("link", {
|
|
178
179
|
rel: "manifest",
|
|
179
180
|
// eslint-disable-next-line no-warning-comments
|
|
180
181
|
// @TODO until parcel fixes https://github.com/parcel-bundler/parcel/issues/8025 and stops stripping process.env.NEXT_PUBLIC_VERCEL_URL from the compiled code, use the remove webmanifest
|
|
181
|
-
href:
|
|
182
|
+
href: "https://next.sanity.build/manifest.webmanifest"
|
|
182
183
|
}),
|
|
183
|
-
themeColorLight && /*#__PURE__*/ (0, $
|
|
184
|
+
themeColorLight && /*#__PURE__*/ (0, $cerUD$reactjsxruntime.jsx)("meta", {
|
|
184
185
|
name: "theme-color",
|
|
185
186
|
content: themeColorLight,
|
|
186
187
|
media: "(prefers-color-scheme: light)"
|
|
187
188
|
}, "theme-color-light"),
|
|
188
|
-
themeColorDark && /*#__PURE__*/ (0, $
|
|
189
|
+
themeColorDark && /*#__PURE__*/ (0, $cerUD$reactjsxruntime.jsx)("meta", {
|
|
189
190
|
name: "theme-color",
|
|
190
191
|
content: themeColorDark,
|
|
191
192
|
media: "(prefers-color-scheme: dark)"
|
|
@@ -194,26 +195,26 @@ const $3e6cd9b42bc397c4$var$NextStudioHeadComponent = ({ children: children , th
|
|
|
194
195
|
]
|
|
195
196
|
});
|
|
196
197
|
};
|
|
197
|
-
const $
|
|
198
|
+
const $9a339c4a487c3478$export$79723eee2c1bf75e = /*#__PURE__*/ (0, $cerUD$react.memo)($9a339c4a487c3478$var$NextStudioHeadComponent);
|
|
198
199
|
|
|
199
200
|
|
|
200
|
-
var $
|
|
201
|
+
var $4dc132240adf8d31$exports = {};
|
|
201
202
|
|
|
202
|
-
$parcel$export($
|
|
203
|
+
$parcel$export($4dc132240adf8d31$exports, "ServerStyleSheetDocument", () => $4dc132240adf8d31$export$f64e2f55a1dca172);
|
|
203
204
|
|
|
204
205
|
|
|
205
206
|
|
|
206
|
-
class $
|
|
207
|
+
class $4dc132240adf8d31$export$f64e2f55a1dca172 extends (0, ($parcel$interopDefault($cerUD$nextdocument))) {
|
|
207
208
|
static async getInitialProps(ctx) {
|
|
208
|
-
const sheet = new (0, $
|
|
209
|
+
const sheet = new (0, $cerUD$styledcomponents.ServerStyleSheet)();
|
|
209
210
|
const originalRenderPage = ctx.renderPage;
|
|
210
211
|
try {
|
|
211
212
|
ctx.renderPage = ()=>originalRenderPage({
|
|
212
|
-
enhanceApp: (App)=>(props)=>sheet.collectStyles(/*#__PURE__*/ (0, $
|
|
213
|
+
enhanceApp: (App)=>(props)=>sheet.collectStyles(/*#__PURE__*/ (0, $cerUD$reactjsxruntime.jsx)(App, {
|
|
213
214
|
...props
|
|
214
215
|
}))
|
|
215
216
|
});
|
|
216
|
-
const initialProps = await (0, ($parcel$interopDefault($
|
|
217
|
+
const initialProps = await (0, ($parcel$interopDefault($cerUD$nextdocument))).getInitialProps(ctx);
|
|
217
218
|
return {
|
|
218
219
|
...initialProps,
|
|
219
220
|
styles: [
|
|
@@ -228,52 +229,52 @@ class $db5d004cc2549fcd$export$f64e2f55a1dca172 extends (0, ($parcel$interopDefa
|
|
|
228
229
|
}
|
|
229
230
|
|
|
230
231
|
|
|
231
|
-
var $
|
|
232
|
+
var $b07d91633f3d677b$exports = {};
|
|
232
233
|
|
|
233
|
-
$parcel$export($
|
|
234
|
-
$parcel$export($
|
|
235
|
-
$parcel$export($
|
|
236
|
-
$parcel$export($
|
|
237
|
-
$parcel$export($
|
|
238
|
-
$parcel$export($
|
|
234
|
+
$parcel$export($b07d91633f3d677b$exports, "isWorkspaces", () => $b07d91633f3d677b$export$b7c6924067135ce);
|
|
235
|
+
$parcel$export($b07d91633f3d677b$exports, "isWorkspaceWithTheme", () => $b07d91633f3d677b$export$31236b9ee07dd150);
|
|
236
|
+
$parcel$export($b07d91633f3d677b$exports, "useTheme", () => $b07d91633f3d677b$export$93d4e7f90805808f);
|
|
237
|
+
$parcel$export($b07d91633f3d677b$exports, "useBackgroundColorsFromTheme", () => $b07d91633f3d677b$export$d3a2146a441ec034);
|
|
238
|
+
$parcel$export($b07d91633f3d677b$exports, "useBasePath", () => $b07d91633f3d677b$export$53bdd69a9f9bd75);
|
|
239
|
+
$parcel$export($b07d91633f3d677b$exports, "useConfigWithBasePath", () => $b07d91633f3d677b$export$297ba38aa0562c6e);
|
|
239
240
|
|
|
240
241
|
|
|
241
242
|
|
|
242
|
-
function $
|
|
243
|
+
function $b07d91633f3d677b$export$b7c6924067135ce(config) {
|
|
243
244
|
return Array.isArray(config);
|
|
244
245
|
}
|
|
245
|
-
function $
|
|
246
|
+
function $b07d91633f3d677b$export$31236b9ee07dd150(workspace) {
|
|
246
247
|
return Boolean(workspace.theme);
|
|
247
248
|
}
|
|
248
|
-
function $
|
|
249
|
-
const workspace = (0, $
|
|
249
|
+
function $b07d91633f3d677b$export$93d4e7f90805808f(config) {
|
|
250
|
+
const workspace = (0, $cerUD$react.useMemo)(()=>$b07d91633f3d677b$export$b7c6924067135ce(config) ? config[0] : config, [
|
|
250
251
|
config
|
|
251
252
|
]);
|
|
252
|
-
return (0, $
|
|
253
|
+
return (0, $cerUD$react.useMemo)(()=>$b07d91633f3d677b$export$31236b9ee07dd150(workspace) ? workspace.theme : (0, $cerUD$sanity.defaultTheme), [
|
|
253
254
|
workspace
|
|
254
255
|
]);
|
|
255
256
|
}
|
|
256
|
-
const $
|
|
257
|
-
return (0, $
|
|
257
|
+
const $b07d91633f3d677b$export$d3a2146a441ec034 = (theme)=>{
|
|
258
|
+
return (0, $cerUD$react.useMemo)(()=>({
|
|
258
259
|
themeColorLight: theme.color.light.default.base.bg,
|
|
259
260
|
themeColorDark: theme.color.dark.default.base.bg
|
|
260
261
|
}), [
|
|
261
262
|
theme
|
|
262
263
|
]);
|
|
263
264
|
};
|
|
264
|
-
function $
|
|
265
|
-
const router = (0, $
|
|
266
|
-
return (0, $
|
|
265
|
+
function $b07d91633f3d677b$export$53bdd69a9f9bd75() {
|
|
266
|
+
const router = (0, $cerUD$nextrouter.useRouter)();
|
|
267
|
+
return (0, $cerUD$react.useMemo)(()=>{
|
|
267
268
|
const [basePath = "/"] = router.route.split("/[");
|
|
268
269
|
return basePath;
|
|
269
270
|
}, [
|
|
270
271
|
router.route
|
|
271
272
|
]);
|
|
272
273
|
}
|
|
273
|
-
function $
|
|
274
|
-
const basePath = $
|
|
275
|
-
return (0, $
|
|
276
|
-
if ($
|
|
274
|
+
function $b07d91633f3d677b$export$297ba38aa0562c6e(config) {
|
|
275
|
+
const basePath = $b07d91633f3d677b$export$53bdd69a9f9bd75();
|
|
276
|
+
return (0, $cerUD$react.useMemo)(()=>{
|
|
277
|
+
if ($b07d91633f3d677b$export$b7c6924067135ce(config)) return config.map((workspace)=>({
|
|
277
278
|
...workspace,
|
|
278
279
|
basePath: workspace.basePath === "/" ? basePath : `${basePath}${workspace.basePath || ""}`
|
|
279
280
|
}));
|
|
@@ -288,14 +289,14 @@ function $c1f9915ed553476b$export$297ba38aa0562c6e(config) {
|
|
|
288
289
|
}
|
|
289
290
|
|
|
290
291
|
|
|
291
|
-
$parcel$exportWildcard($
|
|
292
|
-
$parcel$exportWildcard($
|
|
293
|
-
$parcel$exportWildcard($
|
|
294
|
-
$parcel$exportWildcard($
|
|
295
|
-
$parcel$exportWildcard($
|
|
292
|
+
$parcel$exportWildcard($5aa79282f535e8b1$exports, $c8bf9e0a6313dcb9$exports);
|
|
293
|
+
$parcel$exportWildcard($5aa79282f535e8b1$exports, $1ac20522861d7f1e$exports);
|
|
294
|
+
$parcel$exportWildcard($5aa79282f535e8b1$exports, $9a339c4a487c3478$exports);
|
|
295
|
+
$parcel$exportWildcard($5aa79282f535e8b1$exports, $4dc132240adf8d31$exports);
|
|
296
|
+
$parcel$exportWildcard($5aa79282f535e8b1$exports, $b07d91633f3d677b$exports);
|
|
296
297
|
|
|
297
298
|
|
|
298
|
-
$parcel$exportWildcard(module.exports, $
|
|
299
|
+
$parcel$exportWildcard(module.exports, $5aa79282f535e8b1$exports);
|
|
299
300
|
|
|
300
301
|
|
|
301
302
|
//# sourceMappingURL=studio.js.map
|
package/lib/cjs/studio.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AEAA;;;;AAmDA;;;GAGG,CACH,MAAM,yCAAmB,GAAG,CAAC,YAC3B,QAAQ,CAAA,UACR,MAAM,CAAA,2BACN,uBAAuB,CAAA,8BACvB,0BAA0B,CAAA,kBAC1B,cAAc,CAAA,4BACd,wBAAwB,CAAA,gBACxB,YAAY,CAAA,wBACZ,oBAAoB,CAAA,EACpB,GAAG,KAAK,EACQ,GAAK;IACrB,MAAM,KAAK,GAAG,CAAA,GAAA,yCAAQ,CAAA,CAAC,MAAM,CAAC;IAC9B,MAAM,mBAAC,eAAe,CAAA,kBAAE,cAAc,CAAA,EAAC,GAAG,CAAA,GAAA,yCAA4B,CAAA,CAAC,KAAK,CAAC;IAC7E,qBACE;;YACG,QAAQ,kBAAI,gCAAC,CAAA,GAAA,oBAAM,CAAA;gBAAC,MAAM,EAAE,MAAM;gB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AAQ,KAAK,GAAG,GAAG,QAAQ,GAAG,CAAC,EAAE,QAAQ,CAAC,EAAE,MAAM,CAAC,QAAQ,IAAI,EAAE,CAAC,CAAC;SACrF,CAAA;KACF,EAAE;QAAC,MAAM;QAAE,QAAQ;KAAC,CAAC,CAAA;CACvB;;;;;;;;;AZ5ED","sources":["src/studio.ts","src/studio/index.ts","src/studio/NextStudio.tsx","src/studio/NextStudioGlobalStyle.ts","src/studio/NextStudioHead.tsx","node_modules/@parcel/runtime-js/lib/runtime-31b9b830025f9bd9.js","node_modules/@parcel/runtime-js/lib/runtime-3ab4815ff78cfaf2.js","node_modules/@parcel/runtime-js/lib/runtime-a11a89b7de207d59.js","node_modules/@parcel/runtime-js/lib/runtime-dde0b28484ba060d.js","node_modules/@parcel/runtime-js/lib/runtime-e4ee6d7176747ac5.js","public/webmanifest.json","src/studio/ServerStyleSheetDocument.tsx","src/studio/utils.ts"],"sourcesContent":["export * from './studio/index'\n","export * from './NextStudio'\nexport * from './NextStudioGlobalStyle'\nexport * from './NextStudioHead'\nexport * from './ServerStyleSheetDocument'\nexport * from './utils'\n","import {memo} from 'react'\nimport {type StudioProps, Studio} from 'sanity'\n\nimport {\n type NextStudioHeadProps,\n NextStudioGlobalStyle,\n NextStudioGlobalStyleProps,\n NextStudioHead,\n useBackgroundColorsFromTheme,\n useTheme,\n} from '.'\n\nexport interface NextStudioProps extends StudioProps {\n /**\n * Override how the Studio renders by passing children.\n * This is useful for advanced use cases where you're using StudioProvider and StudioLayout instead of Studio:\n * import {StudioProvider, StudioLayout} from 'sanity'\n * import {NextStudio} from 'next-sanity/studio'\n * <NextStudio config={config}>\n * <StudioProvider config={config}>\n * <CustomComponentThatUsesContextFromStudioProvider />\n * <StudioLayout />\n * </StudioProvider>\n * </NextStudio>\n */\n children?: React.ReactNode\n /**\n * Turns off the default global styling\n */\n unstable__noGlobalStyle?: boolean\n /**\n * Apply fix with SVG icon centering that happens if TailwindCSS is loaded, on by defautl\n */\n unstable__noTailwindSvgFix?: NextStudioGlobalStyleProps['unstable__tailwindSvgFix']\n /**\n * Add stuff to the head with next/head\n */\n unstable__head?: NextStudioHeadProps['children']\n /**\n * Sets the document title\n */\n unstable__document_title?: NextStudioHeadProps['title']\n /**\n * Sets the background color of <html>\n */\n unstable__bg?: NextStudioGlobalStyleProps['bg']\n /**\n * Don't load the favicon meta tags\n */\n unstable__noFavicons?: boolean\n}\n/**\n * Intended to render at the root of a page, letting the Studio own that page and render much like it would if you used `npx sanity start` to render\n * It's a drop-in replacement for `import {Studio} from 'sanity'`\n */\nconst NextStudioComponent = ({\n children,\n config,\n unstable__noGlobalStyle,\n unstable__noTailwindSvgFix,\n unstable__head,\n unstable__document_title,\n unstable__bg,\n unstable__noFavicons,\n ...props\n}: NextStudioProps) => {\n const theme = useTheme(config)\n const {themeColorLight, themeColorDark} = useBackgroundColorsFromTheme(theme)\n return (\n <>\n {children || <Studio config={config} {...props} />}\n <NextStudioHead\n themeColorLight={themeColorLight}\n themeColorDark={themeColorDark}\n title={unstable__document_title}\n favicons={!unstable__noFavicons}\n >\n {unstable__head}\n </NextStudioHead>\n {!unstable__noGlobalStyle && (\n <NextStudioGlobalStyle\n bg={unstable__bg ?? themeColorLight}\n unstable__tailwindSvgFix={!unstable__noTailwindSvgFix}\n />\n )}\n </>\n )\n}\nexport const NextStudio = memo(NextStudioComponent)\n","import {createGlobalStyle, css} from 'styled-components'\n\nexport interface NextStudioGlobalStyleProps {\n bg?: string\n unstable__tailwindSvgFix?: boolean\n}\nexport const NextStudioGlobalStyle = createGlobalStyle<NextStudioGlobalStyleProps>`\n${({bg}) =>\n bg\n ? css`\n html {\n background-color: ${bg};\n }\n `\n : ''}\nhtml,\nbody,\n#__next {\n height: 100%;\n}\nbody {\n margin: 0;\n overscroll-behavior: none;\n -webkit-font-smoothing: antialiased;\n}\n${({unstable__tailwindSvgFix}) =>\n unstable__tailwindSvgFix\n ? css`\n /* override tailwind reset */\n :root svg {\n display: inline;\n }\n `\n : ''}`\n","/* eslint-disable no-process-env */\nimport Head from 'next/head'\nimport {type ComponentProps, memo, useCallback} from 'react'\n\nimport iconApple from '../../public/apple-touch-icon.png'\nimport iconIco from '../../public/favicon.ico'\nimport iconSvg from '../../public/favicon.svg'\nimport icon192 from '../../public/favicon-192.png'\nimport icon512 from '../../public/favicon-512.png'\nimport webmanifest from '../../public/webmanifest.json'\nimport type {MetaThemeColors} from './utils'\n\n// Interop between how Parcel and Next deals with asset imports\nconst interop = (href: string | {src: string}): string =>\n typeof href === 'string' ? href : href.src\n\nexport interface NextStudioHeadProps extends Partial<MetaThemeColors> {\n children?: ComponentProps<typeof Head>['children']\n title?: string\n favicons?: boolean\n}\nconst NextStudioHeadComponent = ({\n children,\n themeColorDark,\n themeColorLight,\n title = 'Sanity Studio',\n favicons,\n}: NextStudioHeadProps) => {\n const inlineWebmanifest = useCallback(() => {\n const manifest = JSON.parse(JSON.stringify(webmanifest))\n const icons = manifest.icons.map((icon: any) => {\n // Inline manifests works best when URLs are absolute\n const src =\n // eslint-disable-next-line no-nested-ternary\n icon.src === './favicon-192.png'\n ? interop(icon192)\n : icon.src === './favicon-512.png'\n ? interop(icon512)\n : icon.src\n return {\n ...icon,\n src: process.env.NEXT_PUBLIC_VERCEL_URL\n ? new URL(src, `https://${process.env.NEXT_PUBLIC_VERCEL_URL}`).toString()\n : src,\n }\n })\n return `data:application/manifest+json,${encodeURIComponent(\n JSON.stringify({...manifest, icons})\n )}`\n }, [])\n\n return (\n <Head>\n <meta\n name=\"viewport\"\n // Studio implements display cutouts CSS (The iPhone Notch ™ ) and needs `viewport-fit=covered` for it to work correctly\n content=\"width=device-width, initial-scale=1, viewport-fit=cover\"\n />\n <meta name=\"robots\" content=\"noindex\" />\n <meta name=\"referrer\" content=\"same-origin\" />\n <title>{title}</title>\n {favicons && <link rel=\"icon\" href={interop(iconIco)} sizes=\"any\" />}\n {favicons && <link rel=\"icon\" href={interop(iconSvg)} type=\"image/svg+xml\" />}\n {favicons && <link rel=\"apple-touch-icon\" href={interop(iconApple)} />}\n {favicons && (\n <link\n rel=\"manifest\"\n // eslint-disable-next-line no-warning-comments\n // @TODO until parcel fixes https://github.com/parcel-bundler/parcel/issues/8025 and stops stripping process.env.NEXT_PUBLIC_VERCEL_URL from the compiled code, use the remove webmanifest\n href={\n process.env.NEXT_PUBLIC_VERCEL_URL\n ? inlineWebmanifest()\n : 'https://next-studio-layout.sanity.build/manifest.webmanifest'\n }\n />\n )}\n {/* These theme-color tags makes the Studio look really really good on devices like iPads as the browser chrome adopts the Studio background */}\n {themeColorLight && (\n <meta\n key=\"theme-color-light\"\n name=\"theme-color\"\n content={themeColorLight}\n media=\"(prefers-color-scheme: light)\"\n />\n )}\n {themeColorDark && (\n <meta\n key=\"theme-color-dark\"\n name=\"theme-color\"\n content={themeColorDark}\n media=\"(prefers-color-scheme: dark)\"\n />\n )}\n {children}\n </Head>\n )\n}\n\nexport const NextStudioHead = memo(NextStudioHeadComponent)\n","module.exports = new __parcel__URL__(\"apple-touch-icon.abc4aca2.png\").toString();","module.exports = new __parcel__URL__(\"favicon.648fc2f2.ico\").toString();","module.exports = new __parcel__URL__(\"favicon.8f76876f.svg\").toString();","module.exports = new __parcel__URL__(\"favicon-192.40c8bab4.png\").toString();","module.exports = new __parcel__URL__(\"favicon-512.5e08f951.png\").toString();","{\n \"icons\": [\n {\n \"src\": \"./favicon-192.png\",\n \"type\": \"image/png\",\n \"sizes\": \"192x192\"\n },\n {\n \"src\": \"./favicon-512.png\",\n \"type\": \"image/png\",\n \"sizes\": \"512x512\"\n }\n ]\n}\n","// We can disable this rule safely as we're not trying to use it outside pages/document, we're shipping a wrapper\n// eslint-disable-next-line @next/next/no-document-import-in-page\nimport Document, {type DocumentContext} from 'next/document'\nimport {ServerStyleSheet} from 'styled-components'\n\n/**\n * Usage, from a pages/_document.tsx file:\n * import {ServerStyleSheetDocument} from 'next-sanity/studio'\n *\n * export default class MyDocument extends ServerStyleSheetDocument {}\n *\n * To do extra stuff in getInitialProps:\n * import {ServerStyleSheetDocument} from 'next-sanity/studio'\n * import { type DocumentContext } from 'next/document'\n *\n * export default class MyDocument extends ServerStyleSheetDocument {\n * static async getInitialProps(ctx: DocumentContext) {\n * // You can still override renderPage:\n * const originalRenderPage = ctx.renderPage\n * ctx.renderPage = () => originalRenderPage({\n * enhanceApp: (App) => (props) => <App {...props} />\n * })\n *\n * const initialProps = await ServerStyleSheetDocument.getInitialProps(ctx)\n * const extraStyles = await getStyles()\n * return {\n * ...initialProps,\n * styles: [initialProps.styles, extraStyles],\n * }\n * }\n * }\n */\n\nexport class ServerStyleSheetDocument extends Document {\n static async getInitialProps(ctx: DocumentContext) {\n const sheet = new ServerStyleSheet()\n const originalRenderPage = ctx.renderPage\n\n try {\n ctx.renderPage = () =>\n originalRenderPage({\n enhanceApp: (App) => (props) => sheet.collectStyles(<App {...props} />),\n })\n\n const initialProps = await Document.getInitialProps(ctx)\n return {\n ...initialProps,\n styles: [initialProps.styles, sheet.getStyleElement()],\n }\n } finally {\n sheet.seal()\n }\n }\n}\n","import {useRouter} from 'next/router'\nimport {useMemo} from 'react'\nimport {type Config, type StudioTheme, type WorkspaceOptions, defaultTheme} from 'sanity'\n\nexport function isWorkspaces(config: Config): config is WorkspaceOptions[] {\n return Array.isArray(config)\n}\n\nexport interface WorkspaceWithTheme extends Omit<WorkspaceOptions, 'theme'> {\n theme: StudioTheme\n}\n\nexport function isWorkspaceWithTheme(\n workspace: WorkspaceOptions\n): workspace is WorkspaceWithTheme {\n return Boolean(workspace.theme)\n}\n\nexport function useTheme(config: Config): StudioTheme {\n const workspace = useMemo<WorkspaceOptions>(\n () => (isWorkspaces(config) ? config[0] : config),\n [config]\n )\n return useMemo<StudioTheme>(\n () => (isWorkspaceWithTheme(workspace) ? workspace.theme : defaultTheme),\n [workspace]\n )\n}\n\nexport type MetaThemeColors = {\n themeColorLight: string\n themeColorDark: string\n}\nexport const useBackgroundColorsFromTheme = (theme: StudioTheme): MetaThemeColors => {\n return useMemo<MetaThemeColors>(\n () => ({\n themeColorLight: theme.color.light.default.base.bg,\n themeColorDark: theme.color.dark.default.base.bg,\n }),\n [theme]\n )\n}\n\n/**\n * Parses the next route to determine the what the base path for Sanity Studio should be\n */\nexport function useBasePath(): string {\n const router = useRouter()\n return useMemo(() => {\n const [basePath = '/'] = router.route.split('/[')\n return basePath\n }, [router.route])\n}\n\nexport interface WorkspaceWithBasePath extends Omit<WorkspaceOptions, 'basePath'> {\n basePath: string\n}\nexport type ConfigWithBasePath = WorkspaceWithBasePath | WorkspaceWithBasePath[]\n/**\n * Apply the base path from next to the config, prefixing any defined base path\n */\nexport function useConfigWithBasePath(config: Config): ConfigWithBasePath {\n const basePath = useBasePath()\n return useMemo(() => {\n if (isWorkspaces(config)) {\n return config.map((workspace) => ({\n ...workspace,\n basePath:\n workspace.basePath === '/' ? basePath : `${basePath}${workspace.basePath || ''}`,\n }))\n }\n return {\n ...config,\n basePath: config.basePath === '/' ? basePath : `${basePath}${config.basePath || ''}`,\n }\n }, [config, basePath])\n}\n"],"names":[],"version":3,"file":"studio.js.map","sourceRoot":"../../"}
|
|
1
|
+
{"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AEAA;;;;AAmDA;;;GAGG,CACH,MAAM,yCAAmB,GAAG,CAAC,YAC3B,QAAQ,CAAA,UACR,MAAM,CAAA,2BACN,uBAAuB,CAAA,8BACvB,0BAA0B,CAAA,kBAC1B,cAAc,CAAA,4BACd,wBAAwB,CAAA,gBACxB,YAAY,CAAA,wBACZ,oBAAoB,CAAA,EACpB,GAAG,KAAK,EACQ,GAAK;IACrB,MAAM,KAAK,GAAG,CAAA,GAAA,yCAAQ,CAAA,CAAC,MAAM,CAAC;IAC9B,MAAM,mBAAC,eAAe,CAAA,kBAAE,cAAc,CAAA,EAAC,GAAG,CAAA,GAAA,yCAA4B,CAAA,CAAC,KAAK,CAAC;IAC7E,qBACE;;YACG,QAAQ,kBAAI,gCAAC,CAAA,GAAA,oBAAM,CAAA;gB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["src/studio.ts","src/studio/index.ts","src/studio/NextStudio.tsx","src/studio/NextStudioGlobalStyle.ts","src/studio/NextStudioHead.tsx","node_modules/@parcel/runtime-js/lib/runtime-e0fba79b3250b098.js","node_modules/@parcel/runtime-js/lib/runtime-cba150197a105513.js","node_modules/@parcel/runtime-js/lib/runtime-fb9337d61eb56525.js","node_modules/@parcel/runtime-js/lib/runtime-a2553895c8f7ff00.js","node_modules/@parcel/runtime-js/lib/runtime-6179dded72eaa728.js","public/webmanifest.json","src/studio/ServerStyleSheetDocument.tsx","src/studio/utils.ts"],"sourcesContent":["export * from './studio/index'\n","export * from './NextStudio'\nexport * from './NextStudioGlobalStyle'\nexport * from './NextStudioHead'\nexport * from './ServerStyleSheetDocument'\nexport * from './utils'\n","import {memo} from 'react'\nimport {type StudioProps, Studio} from 'sanity'\n\nimport {\n type NextStudioHeadProps,\n NextStudioGlobalStyle,\n NextStudioGlobalStyleProps,\n NextStudioHead,\n useBackgroundColorsFromTheme,\n useTheme,\n} from '.'\n\nexport interface NextStudioProps extends StudioProps {\n /**\n * Override how the Studio renders by passing children.\n * This is useful for advanced use cases where you're using StudioProvider and StudioLayout instead of Studio:\n * import {StudioProvider, StudioLayout} from 'sanity'\n * import {NextStudio} from 'next-sanity/studio'\n * <NextStudio config={config}>\n * <StudioProvider config={config}>\n * <CustomComponentThatUsesContextFromStudioProvider />\n * <StudioLayout />\n * </StudioProvider>\n * </NextStudio>\n */\n children?: React.ReactNode\n /**\n * Turns off the default global styling\n */\n unstable__noGlobalStyle?: boolean\n /**\n * Apply fix with SVG icon centering that happens if TailwindCSS is loaded, on by defautl\n */\n unstable__noTailwindSvgFix?: NextStudioGlobalStyleProps['unstable__tailwindSvgFix']\n /**\n * Add stuff to the head with next/head\n */\n unstable__head?: NextStudioHeadProps['children']\n /**\n * Sets the document title\n */\n unstable__document_title?: NextStudioHeadProps['title']\n /**\n * Sets the background color of <html>\n */\n unstable__bg?: NextStudioGlobalStyleProps['bg']\n /**\n * Don't load the favicon meta tags\n */\n unstable__noFavicons?: boolean\n}\n/**\n * Intended to render at the root of a page, letting the Studio own that page and render much like it would if you used `npx sanity start` to render\n * It's a drop-in replacement for `import {Studio} from 'sanity'`\n */\nconst NextStudioComponent = ({\n children,\n config,\n unstable__noGlobalStyle,\n unstable__noTailwindSvgFix,\n unstable__head,\n unstable__document_title,\n unstable__bg,\n unstable__noFavicons,\n ...props\n}: NextStudioProps) => {\n const theme = useTheme(config)\n const {themeColorLight, themeColorDark} = useBackgroundColorsFromTheme(theme)\n return (\n <>\n {children || <Studio config={config} {...props} />}\n <NextStudioHead\n themeColorLight={themeColorLight}\n themeColorDark={themeColorDark}\n title={unstable__document_title}\n favicons={!unstable__noFavicons}\n >\n {unstable__head}\n </NextStudioHead>\n {!unstable__noGlobalStyle && (\n <NextStudioGlobalStyle\n bg={unstable__bg ?? themeColorLight}\n unstable__tailwindSvgFix={!unstable__noTailwindSvgFix}\n />\n )}\n </>\n )\n}\nexport const NextStudio = memo(NextStudioComponent)\n","import {createGlobalStyle, css} from 'styled-components'\n\nexport interface NextStudioGlobalStyleProps {\n bg?: string\n unstable__tailwindSvgFix?: boolean\n}\nexport const NextStudioGlobalStyle = createGlobalStyle<NextStudioGlobalStyleProps>`\n${({bg}) =>\n bg\n ? css`\n html {\n background-color: ${bg};\n }\n `\n : ''}\nhtml,\nbody,\n#__next {\n height: 100%;\n}\nbody {\n margin: 0;\n overscroll-behavior: none;\n -webkit-font-smoothing: antialiased;\n}\n${({unstable__tailwindSvgFix}) =>\n unstable__tailwindSvgFix\n ? css`\n /* override tailwind reset */\n :root svg {\n display: inline;\n }\n `\n : ''}`\n","/* eslint-disable no-process-env */\nimport Head from 'next/head'\nimport {type ComponentProps, memo, useCallback} from 'react'\n\nimport iconApple from '../../public/apple-touch-icon.png'\nimport iconIco from '../../public/favicon.ico'\nimport iconSvg from '../../public/favicon.svg'\nimport icon192 from '../../public/favicon-192.png'\nimport icon512 from '../../public/favicon-512.png'\nimport webmanifest from '../../public/webmanifest.json'\nimport type {MetaThemeColors} from './utils'\n\n// Interop between how Parcel and Next deals with asset imports\nconst interop = (href: string | {src: string}): string =>\n typeof href === 'string' ? href : href.src\n\nexport interface NextStudioHeadProps extends Partial<MetaThemeColors> {\n children?: ComponentProps<typeof Head>['children']\n title?: string\n favicons?: boolean\n}\nconst NextStudioHeadComponent = ({\n children,\n themeColorDark,\n themeColorLight,\n title = 'Sanity Studio',\n favicons,\n}: NextStudioHeadProps) => {\n const inlineWebmanifest = useCallback(() => {\n const manifest = JSON.parse(JSON.stringify(webmanifest))\n const icons = manifest.icons.map((icon: any) => {\n // Inline manifests works best when URLs are absolute\n const src =\n // eslint-disable-next-line no-nested-ternary\n icon.src === './favicon-192.png'\n ? interop(icon192)\n : icon.src === './favicon-512.png'\n ? interop(icon512)\n : icon.src\n return {\n ...icon,\n src: process.env.NEXT_PUBLIC_VERCEL_URL\n ? new URL(src, `https://${process.env.NEXT_PUBLIC_VERCEL_URL}`).toString()\n : src,\n }\n })\n return `data:application/manifest+json,${encodeURIComponent(\n JSON.stringify({...manifest, icons})\n )}`\n }, [])\n\n return (\n <Head>\n <meta\n name=\"viewport\"\n // Studio implements display cutouts CSS (The iPhone Notch ™ ) and needs `viewport-fit=covered` for it to work correctly\n content=\"width=device-width, initial-scale=1, viewport-fit=cover\"\n />\n <meta name=\"robots\" content=\"noindex\" />\n <meta name=\"referrer\" content=\"same-origin\" />\n <title>{title}</title>\n {favicons && <link rel=\"icon\" href={interop(iconIco)} sizes=\"any\" />}\n {favicons && <link rel=\"icon\" href={interop(iconSvg)} type=\"image/svg+xml\" />}\n {favicons && <link rel=\"apple-touch-icon\" href={interop(iconApple)} />}\n {favicons && (\n <link\n rel=\"manifest\"\n // eslint-disable-next-line no-warning-comments\n // @TODO until parcel fixes https://github.com/parcel-bundler/parcel/issues/8025 and stops stripping process.env.NEXT_PUBLIC_VERCEL_URL from the compiled code, use the remove webmanifest\n href={\n process.env.NEXT_PUBLIC_VERCEL_URL\n ? inlineWebmanifest()\n : 'https://next.sanity.build/manifest.webmanifest'\n }\n />\n )}\n {/* These theme-color tags makes the Studio look really really good on devices like iPads as the browser chrome adopts the Studio background */}\n {themeColorLight && (\n <meta\n key=\"theme-color-light\"\n name=\"theme-color\"\n content={themeColorLight}\n media=\"(prefers-color-scheme: light)\"\n />\n )}\n {themeColorDark && (\n <meta\n key=\"theme-color-dark\"\n name=\"theme-color\"\n content={themeColorDark}\n media=\"(prefers-color-scheme: dark)\"\n />\n )}\n {children}\n </Head>\n )\n}\n\nexport const NextStudioHead = memo(NextStudioHeadComponent)\n","module.exports = new __parcel__URL__(\"apple-touch-icon.abc4aca2.png\").toString();","module.exports = new __parcel__URL__(\"favicon.648fc2f2.ico\").toString();","module.exports = new __parcel__URL__(\"favicon.8f76876f.svg\").toString();","module.exports = new __parcel__URL__(\"favicon-192.40c8bab4.png\").toString();","module.exports = new __parcel__URL__(\"favicon-512.5e08f951.png\").toString();","{\n \"icons\": [\n {\n \"src\": \"./favicon-192.png\",\n \"type\": \"image/png\",\n \"sizes\": \"192x192\"\n },\n {\n \"src\": \"./favicon-512.png\",\n \"type\": \"image/png\",\n \"sizes\": \"512x512\"\n }\n ]\n}\n","// We can disable this rule safely as we're not trying to use it outside pages/document, we're shipping a wrapper\n// eslint-disable-next-line @next/next/no-document-import-in-page\nimport Document, {type DocumentContext} from 'next/document'\nimport {ServerStyleSheet} from 'styled-components'\n\n/**\n * Usage, from a pages/_document.tsx file:\n * import {ServerStyleSheetDocument} from 'next-sanity/studio'\n *\n * export default class MyDocument extends ServerStyleSheetDocument {}\n *\n * To do extra stuff in getInitialProps:\n * import {ServerStyleSheetDocument} from 'next-sanity/studio'\n * import { type DocumentContext } from 'next/document'\n *\n * export default class MyDocument extends ServerStyleSheetDocument {\n * static async getInitialProps(ctx: DocumentContext) {\n * // You can still override renderPage:\n * const originalRenderPage = ctx.renderPage\n * ctx.renderPage = () => originalRenderPage({\n * enhanceApp: (App) => (props) => <App {...props} />\n * })\n *\n * const initialProps = await ServerStyleSheetDocument.getInitialProps(ctx)\n * const extraStyles = await getStyles()\n * return {\n * ...initialProps,\n * styles: [initialProps.styles, extraStyles],\n * }\n * }\n * }\n */\n\nexport class ServerStyleSheetDocument extends Document {\n static async getInitialProps(ctx: DocumentContext) {\n const sheet = new ServerStyleSheet()\n const originalRenderPage = ctx.renderPage\n\n try {\n ctx.renderPage = () =>\n originalRenderPage({\n enhanceApp: (App) => (props) => sheet.collectStyles(<App {...props} />),\n })\n\n const initialProps = await Document.getInitialProps(ctx)\n return {\n ...initialProps,\n styles: [initialProps.styles, sheet.getStyleElement()],\n }\n } finally {\n sheet.seal()\n }\n }\n}\n","import {useRouter} from 'next/router'\nimport {useMemo} from 'react'\nimport {type Config, type StudioTheme, type WorkspaceOptions, defaultTheme} from 'sanity'\n\nexport function isWorkspaces(config: Config): config is WorkspaceOptions[] {\n return Array.isArray(config)\n}\n\nexport interface WorkspaceWithTheme extends Omit<WorkspaceOptions, 'theme'> {\n theme: StudioTheme\n}\n\nexport function isWorkspaceWithTheme(\n workspace: WorkspaceOptions\n): workspace is WorkspaceWithTheme {\n return Boolean(workspace.theme)\n}\n\nexport function useTheme(config: Config): StudioTheme {\n const workspace = useMemo<WorkspaceOptions>(\n () => (isWorkspaces(config) ? config[0] : config),\n [config]\n )\n return useMemo<StudioTheme>(\n () => (isWorkspaceWithTheme(workspace) ? workspace.theme : defaultTheme),\n [workspace]\n )\n}\n\nexport type MetaThemeColors = {\n themeColorLight: string\n themeColorDark: string\n}\nexport const useBackgroundColorsFromTheme = (theme: StudioTheme): MetaThemeColors => {\n return useMemo<MetaThemeColors>(\n () => ({\n themeColorLight: theme.color.light.default.base.bg,\n themeColorDark: theme.color.dark.default.base.bg,\n }),\n [theme]\n )\n}\n\n/**\n * Parses the next route to determine the what the base path for Sanity Studio should be\n */\nexport function useBasePath(): string {\n const router = useRouter()\n return useMemo(() => {\n const [basePath = '/'] = router.route.split('/[')\n return basePath\n }, [router.route])\n}\n\nexport interface WorkspaceWithBasePath extends Omit<WorkspaceOptions, 'basePath'> {\n basePath: string\n}\nexport type ConfigWithBasePath = WorkspaceWithBasePath | WorkspaceWithBasePath[]\n/**\n * Apply the base path from next to the config, prefixing any defined base path\n */\nexport function useConfigWithBasePath(config: Config): ConfigWithBasePath {\n const basePath = useBasePath()\n return useMemo(() => {\n if (isWorkspaces(config)) {\n return config.map((workspace) => ({\n ...workspace,\n basePath:\n workspace.basePath === '/' ? basePath : `${basePath}${workspace.basePath || ''}`,\n }))\n }\n return {\n ...config,\n basePath: config.basePath === '/' ? basePath : `${basePath}${config.basePath || ''}`,\n }\n }, [config, basePath])\n}\n"],"names":[],"version":3,"file":"studio.js.map"}
|
package/lib/esm/studio.js
CHANGED
|
@@ -1,14 +1,11 @@
|
|
|
1
|
-
import {jsxs as $
|
|
2
|
-
import {memo as $
|
|
3
|
-
import {Studio as $
|
|
4
|
-
import {createGlobalStyle as $
|
|
5
|
-
import $
|
|
6
|
-
import $
|
|
7
|
-
import {useRouter as $
|
|
1
|
+
import {jsxs as $4289s$jsxs, Fragment as $4289s$Fragment, jsx as $4289s$jsx} from "react/jsx-runtime";
|
|
2
|
+
import {memo as $4289s$memo, useCallback as $4289s$useCallback, useMemo as $4289s$useMemo} from "react";
|
|
3
|
+
import {Studio as $4289s$Studio, defaultTheme as $4289s$defaultTheme} from "sanity";
|
|
4
|
+
import {createGlobalStyle as $4289s$createGlobalStyle, css as $4289s$css, ServerStyleSheet as $4289s$ServerStyleSheet} from "styled-components";
|
|
5
|
+
import $4289s$nexthead from "next/head";
|
|
6
|
+
import $4289s$nextdocument from "next/document";
|
|
7
|
+
import {useRouter as $4289s$useRouter} from "next/router";
|
|
8
8
|
|
|
9
|
-
function $parcel$export(e, n, v, s) {
|
|
10
|
-
Object.defineProperty(e, n, {get: v, set: s, enumerable: true, configurable: true});
|
|
11
|
-
}
|
|
12
9
|
function $parcel$exportWildcard(dest, source) {
|
|
13
10
|
Object.keys(source).forEach(function(key) {
|
|
14
11
|
if (key === 'default' || key === '__esModule' || dest.hasOwnProperty(key)) {
|
|
@@ -25,92 +22,16 @@ function $parcel$exportWildcard(dest, source) {
|
|
|
25
22
|
|
|
26
23
|
return dest;
|
|
27
24
|
}
|
|
25
|
+
function $parcel$export(e, n, v, s) {
|
|
26
|
+
Object.defineProperty(e, n, {get: v, set: s, enumerable: true, configurable: true});
|
|
27
|
+
}
|
|
28
28
|
function $parcel$interopDefault(a) {
|
|
29
29
|
return a && a.__esModule ? a.default : a;
|
|
30
30
|
}
|
|
31
|
-
var $
|
|
32
|
-
|
|
33
|
-
? globalThis
|
|
34
|
-
: typeof self !== 'undefined'
|
|
35
|
-
? self
|
|
36
|
-
: typeof window !== 'undefined'
|
|
37
|
-
? window
|
|
38
|
-
: typeof global !== 'undefined'
|
|
39
|
-
? global
|
|
40
|
-
: {};
|
|
41
|
-
var $parcel$modules = {};
|
|
42
|
-
var $parcel$inits = {};
|
|
43
|
-
|
|
44
|
-
var parcelRequire = $parcel$global["parcelRequiree511"];
|
|
45
|
-
if (parcelRequire == null) {
|
|
46
|
-
parcelRequire = function(id) {
|
|
47
|
-
if (id in $parcel$modules) {
|
|
48
|
-
return $parcel$modules[id].exports;
|
|
49
|
-
}
|
|
50
|
-
if (id in $parcel$inits) {
|
|
51
|
-
var init = $parcel$inits[id];
|
|
52
|
-
delete $parcel$inits[id];
|
|
53
|
-
var module = {id: id, exports: {}};
|
|
54
|
-
$parcel$modules[id] = module;
|
|
55
|
-
init.call(module.exports, module, module.exports);
|
|
56
|
-
return module.exports;
|
|
57
|
-
}
|
|
58
|
-
var err = new Error("Cannot find module '" + id + "'");
|
|
59
|
-
err.code = 'MODULE_NOT_FOUND';
|
|
60
|
-
throw err;
|
|
61
|
-
};
|
|
31
|
+
var $2e0e6a6d8bb1bf3b$exports = {};
|
|
32
|
+
var $1512e3a8033a35cc$exports = {};
|
|
62
33
|
|
|
63
|
-
|
|
64
|
-
$parcel$inits[id] = init;
|
|
65
|
-
};
|
|
66
|
-
|
|
67
|
-
$parcel$global["parcelRequiree511"] = parcelRequire;
|
|
68
|
-
}
|
|
69
|
-
parcelRequire.register("ar2eu", function(module, exports) {
|
|
70
|
-
|
|
71
|
-
$parcel$export(module.exports, "getBundleURL", () => $798e2863ff79ee20$export$bdfd709ae4826697, (v) => $798e2863ff79ee20$export$bdfd709ae4826697 = v);
|
|
72
|
-
var $798e2863ff79ee20$export$bdfd709ae4826697;
|
|
73
|
-
var $798e2863ff79ee20$export$c9e73fbda7da57b6;
|
|
74
|
-
var $798e2863ff79ee20$export$5a759dc7a1cfb72a;
|
|
75
|
-
"use strict";
|
|
76
|
-
var $798e2863ff79ee20$var$bundleURL = {};
|
|
77
|
-
function $798e2863ff79ee20$var$getBundleURLCached(id) {
|
|
78
|
-
var value = $798e2863ff79ee20$var$bundleURL[id];
|
|
79
|
-
if (!value) {
|
|
80
|
-
value = $798e2863ff79ee20$var$getBundleURL();
|
|
81
|
-
$798e2863ff79ee20$var$bundleURL[id] = value;
|
|
82
|
-
}
|
|
83
|
-
return value;
|
|
84
|
-
}
|
|
85
|
-
function $798e2863ff79ee20$var$getBundleURL() {
|
|
86
|
-
try {
|
|
87
|
-
throw new Error();
|
|
88
|
-
} catch (err) {
|
|
89
|
-
var matches = ("" + err.stack).match(/(https?|file|ftp|(chrome|moz|safari-web)-extension):\/\/[^)\n]+/g);
|
|
90
|
-
if (matches) // The first two stack frames will be this function and getBundleURLCached.
|
|
91
|
-
// Use the 3rd one, which will be a runtime in the original bundle.
|
|
92
|
-
return $798e2863ff79ee20$var$getBaseURL(matches[2]);
|
|
93
|
-
}
|
|
94
|
-
return "/";
|
|
95
|
-
}
|
|
96
|
-
function $798e2863ff79ee20$var$getBaseURL(url) {
|
|
97
|
-
return ("" + url).replace(/^((?:https?|file|ftp|(chrome|moz|safari-web)-extension):\/\/.+)\/[^/]+$/, "$1") + "/";
|
|
98
|
-
} // TODO: Replace uses with `new URL(url).origin` when ie11 is no longer supported.
|
|
99
|
-
function $798e2863ff79ee20$var$getOrigin(url) {
|
|
100
|
-
var matches = ("" + url).match(/(https?|file|ftp|(chrome|moz|safari-web)-extension):\/\/[^/]+/);
|
|
101
|
-
if (!matches) throw new Error("Origin not found");
|
|
102
|
-
return matches[0];
|
|
103
|
-
}
|
|
104
|
-
$798e2863ff79ee20$export$bdfd709ae4826697 = $798e2863ff79ee20$var$getBundleURLCached;
|
|
105
|
-
$798e2863ff79ee20$export$c9e73fbda7da57b6 = $798e2863ff79ee20$var$getBaseURL;
|
|
106
|
-
$798e2863ff79ee20$export$5a759dc7a1cfb72a = $798e2863ff79ee20$var$getOrigin;
|
|
107
|
-
|
|
108
|
-
});
|
|
109
|
-
|
|
110
|
-
var $5fad48b1a984c979$exports = {};
|
|
111
|
-
var $0b1d95a703deb844$exports = {};
|
|
112
|
-
|
|
113
|
-
$parcel$export($0b1d95a703deb844$exports, "NextStudio", () => $0b1d95a703deb844$export$eefb95cccd1bb6c5);
|
|
34
|
+
$parcel$export($1512e3a8033a35cc$exports, "NextStudio", () => $1512e3a8033a35cc$export$eefb95cccd1bb6c5);
|
|
114
35
|
|
|
115
36
|
|
|
116
37
|
|
|
@@ -118,42 +39,39 @@ $parcel$export($0b1d95a703deb844$exports, "NextStudio", () => $0b1d95a703deb844$
|
|
|
118
39
|
/**
|
|
119
40
|
* Intended to render at the root of a page, letting the Studio own that page and render much like it would if you used `npx sanity start` to render
|
|
120
41
|
* It's a drop-in replacement for `import {Studio} from 'sanity'`
|
|
121
|
-
*/ const $
|
|
122
|
-
const theme = (0, $
|
|
123
|
-
const { themeColorLight: themeColorLight , themeColorDark: themeColorDark } = (0, $
|
|
124
|
-
return /*#__PURE__*/ (0, $
|
|
42
|
+
*/ const $1512e3a8033a35cc$var$NextStudioComponent = ({ children: children , config: config , unstable__noGlobalStyle: unstable__noGlobalStyle , unstable__noTailwindSvgFix: unstable__noTailwindSvgFix , unstable__head: unstable__head , unstable__document_title: unstable__document_title , unstable__bg: unstable__bg , unstable__noFavicons: unstable__noFavicons , ...props })=>{
|
|
43
|
+
const theme = (0, $47ea254c66a1f1fc$export$93d4e7f90805808f)(config);
|
|
44
|
+
const { themeColorLight: themeColorLight , themeColorDark: themeColorDark } = (0, $47ea254c66a1f1fc$export$d3a2146a441ec034)(theme);
|
|
45
|
+
return /*#__PURE__*/ (0, $4289s$jsxs)((0, $4289s$Fragment), {
|
|
125
46
|
children: [
|
|
126
|
-
children || /*#__PURE__*/ (0, $
|
|
47
|
+
children || /*#__PURE__*/ (0, $4289s$jsx)((0, $4289s$Studio), {
|
|
127
48
|
config: config,
|
|
128
49
|
...props
|
|
129
50
|
}),
|
|
130
|
-
/*#__PURE__*/ (0, $
|
|
51
|
+
/*#__PURE__*/ (0, $4289s$jsx)((0, $42e0ba93e8ca4228$export$79723eee2c1bf75e), {
|
|
131
52
|
themeColorLight: themeColorLight,
|
|
132
53
|
themeColorDark: themeColorDark,
|
|
133
54
|
title: unstable__document_title,
|
|
134
55
|
favicons: !unstable__noFavicons,
|
|
135
56
|
children: unstable__head
|
|
136
57
|
}),
|
|
137
|
-
!unstable__noGlobalStyle && /*#__PURE__*/ (0, $
|
|
58
|
+
!unstable__noGlobalStyle && /*#__PURE__*/ (0, $4289s$jsx)((0, $96bfa0bd9b2d4d7b$export$c8fda7ee7699d07e), {
|
|
138
59
|
bg: unstable__bg !== null && unstable__bg !== void 0 ? unstable__bg : themeColorLight,
|
|
139
60
|
unstable__tailwindSvgFix: !unstable__noTailwindSvgFix
|
|
140
61
|
})
|
|
141
62
|
]
|
|
142
63
|
});
|
|
143
64
|
};
|
|
144
|
-
const $
|
|
65
|
+
const $1512e3a8033a35cc$export$eefb95cccd1bb6c5 = /*#__PURE__*/ (0, $4289s$memo)($1512e3a8033a35cc$var$NextStudioComponent);
|
|
145
66
|
|
|
146
67
|
|
|
147
|
-
var $
|
|
68
|
+
var $96bfa0bd9b2d4d7b$exports = {};
|
|
148
69
|
|
|
149
|
-
$parcel$export($
|
|
70
|
+
$parcel$export($96bfa0bd9b2d4d7b$exports, "NextStudioGlobalStyle", () => $96bfa0bd9b2d4d7b$export$c8fda7ee7699d07e);
|
|
150
71
|
|
|
151
|
-
|
|
152
|
-
$
|
|
153
|
-
|
|
154
|
-
background-color: ${bg};
|
|
155
|
-
}
|
|
156
|
-
` : ""}
|
|
72
|
+
let $96bfa0bd9b2d4d7b$var$_ = (t)=>t, $96bfa0bd9b2d4d7b$var$t, $96bfa0bd9b2d4d7b$var$t1, $96bfa0bd9b2d4d7b$var$t2;
|
|
73
|
+
const $96bfa0bd9b2d4d7b$export$c8fda7ee7699d07e = (0, $4289s$createGlobalStyle)($96bfa0bd9b2d4d7b$var$t2 || ($96bfa0bd9b2d4d7b$var$t2 = $96bfa0bd9b2d4d7b$var$_`
|
|
74
|
+
${0}
|
|
157
75
|
html,
|
|
158
76
|
body,
|
|
159
77
|
#__next {
|
|
@@ -164,61 +82,60 @@ body {
|
|
|
164
82
|
overscroll-behavior: none;
|
|
165
83
|
-webkit-font-smoothing: antialiased;
|
|
166
84
|
}
|
|
167
|
-
${({
|
|
85
|
+
${0}`), ({ bg: bg })=>bg ? (0, $4289s$css)($96bfa0bd9b2d4d7b$var$t || ($96bfa0bd9b2d4d7b$var$t = $96bfa0bd9b2d4d7b$var$_`
|
|
86
|
+
html {
|
|
87
|
+
background-color: ${0};
|
|
88
|
+
}
|
|
89
|
+
`), bg) : "", ({ unstable__tailwindSvgFix: unstable__tailwindSvgFix })=>unstable__tailwindSvgFix ? (0, $4289s$css)($96bfa0bd9b2d4d7b$var$t1 || ($96bfa0bd9b2d4d7b$var$t1 = $96bfa0bd9b2d4d7b$var$_`
|
|
168
90
|
/* override tailwind reset */
|
|
169
91
|
:root svg {
|
|
170
92
|
display: inline;
|
|
171
93
|
}
|
|
172
|
-
` : ""
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
var $ce5bdc1b62c6b4b4$exports = {};
|
|
176
|
-
|
|
177
|
-
$parcel$export($ce5bdc1b62c6b4b4$exports, "NextStudioHead", () => $ce5bdc1b62c6b4b4$export$79723eee2c1bf75e);
|
|
178
|
-
|
|
179
|
-
|
|
94
|
+
`)) : "");
|
|
180
95
|
|
|
181
|
-
var $0108d71069fae04e$exports = {};
|
|
182
96
|
|
|
183
|
-
$
|
|
97
|
+
var $42e0ba93e8ca4228$exports = {};
|
|
184
98
|
|
|
99
|
+
$parcel$export($42e0ba93e8ca4228$exports, "NextStudioHead", () => $42e0ba93e8ca4228$export$79723eee2c1bf75e);
|
|
185
100
|
|
|
186
|
-
var $8077fdd2633d7a81$exports = {};
|
|
187
101
|
|
|
188
|
-
$8077fdd2633d7a81$exports = (parcelRequire("ar2eu")).getBundleURL("3LAn5") + "favicon.648fc2f2.ico";
|
|
189
102
|
|
|
103
|
+
var $45ea3ea7d12bce49$exports = {};
|
|
104
|
+
$45ea3ea7d12bce49$exports = new URL("apple-touch-icon.abc4aca2.png", import.meta.url).toString();
|
|
190
105
|
|
|
191
|
-
var $4db362cdaa35db70$exports = {};
|
|
192
106
|
|
|
193
|
-
$
|
|
107
|
+
var $16e4fc4e4072d1be$exports = {};
|
|
108
|
+
$16e4fc4e4072d1be$exports = new URL("favicon.648fc2f2.ico", import.meta.url).toString();
|
|
194
109
|
|
|
195
110
|
|
|
196
|
-
var $
|
|
111
|
+
var $cca9488c1d3c183d$exports = {};
|
|
112
|
+
$cca9488c1d3c183d$exports = new URL("favicon.8f76876f.svg", import.meta.url).toString();
|
|
197
113
|
|
|
198
|
-
$b4cbab8f868ac353$exports = (parcelRequire("ar2eu")).getBundleURL("3LAn5") + "favicon-192.40c8bab4.png";
|
|
199
114
|
|
|
115
|
+
var $cd594ef728029217$exports = {};
|
|
116
|
+
$cd594ef728029217$exports = new URL("favicon-192.40c8bab4.png", import.meta.url).toString();
|
|
200
117
|
|
|
201
|
-
var $148c4942f4e37da8$exports = {};
|
|
202
118
|
|
|
203
|
-
$
|
|
119
|
+
var $31faabdb2cb89886$exports = {};
|
|
120
|
+
$31faabdb2cb89886$exports = new URL("favicon-512.5e08f951.png", import.meta.url).toString();
|
|
204
121
|
|
|
205
122
|
|
|
206
|
-
var $
|
|
207
|
-
$
|
|
123
|
+
var $7b143ba4ac75c594$exports = {};
|
|
124
|
+
$7b143ba4ac75c594$exports = JSON.parse('{"icons":[{"src":"./favicon-192.png","type":"image/png","sizes":"192x192"},{"src":"./favicon-512.png","type":"image/png","sizes":"512x512"}]}');
|
|
208
125
|
|
|
209
126
|
|
|
210
127
|
// Interop between how Parcel and Next deals with asset imports
|
|
211
|
-
const $
|
|
212
|
-
const $
|
|
213
|
-
const inlineWebmanifest = (0, $
|
|
214
|
-
const manifest = JSON.parse(JSON.stringify((0, (/*@__PURE__*/$parcel$interopDefault($
|
|
128
|
+
const $42e0ba93e8ca4228$var$interop = (href)=>typeof href === "string" ? href : href.src;
|
|
129
|
+
const $42e0ba93e8ca4228$var$NextStudioHeadComponent = ({ children: children , themeColorDark: themeColorDark , themeColorLight: themeColorLight , title: title = "Sanity Studio" , favicons: favicons })=>{
|
|
130
|
+
const inlineWebmanifest = (0, $4289s$useCallback)(()=>{
|
|
131
|
+
const manifest = JSON.parse(JSON.stringify((0, (/*@__PURE__*/$parcel$interopDefault($7b143ba4ac75c594$exports)))));
|
|
215
132
|
const icons = manifest.icons.map((icon)=>{
|
|
216
133
|
// Inline manifests works best when URLs are absolute
|
|
217
134
|
const src = // eslint-disable-next-line no-nested-ternary
|
|
218
|
-
icon.src === "./favicon-192.png" ? $
|
|
135
|
+
icon.src === "./favicon-192.png" ? $42e0ba93e8ca4228$var$interop((0, (/*@__PURE__*/$parcel$interopDefault($cd594ef728029217$exports)))) : icon.src === "./favicon-512.png" ? $42e0ba93e8ca4228$var$interop((0, (/*@__PURE__*/$parcel$interopDefault($31faabdb2cb89886$exports)))) : icon.src;
|
|
219
136
|
return {
|
|
220
137
|
...icon,
|
|
221
|
-
src:
|
|
138
|
+
src: src
|
|
222
139
|
};
|
|
223
140
|
});
|
|
224
141
|
return `data:application/manifest+json,${encodeURIComponent(JSON.stringify({
|
|
@@ -226,50 +143,50 @@ const $ce5bdc1b62c6b4b4$var$NextStudioHeadComponent = ({ children: children , th
|
|
|
226
143
|
icons: icons
|
|
227
144
|
}))}`;
|
|
228
145
|
}, []);
|
|
229
|
-
return /*#__PURE__*/ (0, $
|
|
146
|
+
return /*#__PURE__*/ (0, $4289s$jsxs)((0, $4289s$nexthead), {
|
|
230
147
|
children: [
|
|
231
|
-
/*#__PURE__*/ (0, $
|
|
148
|
+
/*#__PURE__*/ (0, $4289s$jsx)("meta", {
|
|
232
149
|
name: "viewport",
|
|
233
150
|
// Studio implements display cutouts CSS (The iPhone Notch ™ ) and needs `viewport-fit=covered` for it to work correctly
|
|
234
151
|
content: "width=device-width, initial-scale=1, viewport-fit=cover"
|
|
235
152
|
}),
|
|
236
|
-
/*#__PURE__*/ (0, $
|
|
153
|
+
/*#__PURE__*/ (0, $4289s$jsx)("meta", {
|
|
237
154
|
name: "robots",
|
|
238
155
|
content: "noindex"
|
|
239
156
|
}),
|
|
240
|
-
/*#__PURE__*/ (0, $
|
|
157
|
+
/*#__PURE__*/ (0, $4289s$jsx)("meta", {
|
|
241
158
|
name: "referrer",
|
|
242
159
|
content: "same-origin"
|
|
243
160
|
}),
|
|
244
|
-
/*#__PURE__*/ (0, $
|
|
161
|
+
/*#__PURE__*/ (0, $4289s$jsx)("title", {
|
|
245
162
|
children: title
|
|
246
163
|
}),
|
|
247
|
-
favicons && /*#__PURE__*/ (0, $
|
|
164
|
+
favicons && /*#__PURE__*/ (0, $4289s$jsx)("link", {
|
|
248
165
|
rel: "icon",
|
|
249
|
-
href: $
|
|
166
|
+
href: $42e0ba93e8ca4228$var$interop((0, (/*@__PURE__*/$parcel$interopDefault($16e4fc4e4072d1be$exports)))),
|
|
250
167
|
sizes: "any"
|
|
251
168
|
}),
|
|
252
|
-
favicons && /*#__PURE__*/ (0, $
|
|
169
|
+
favicons && /*#__PURE__*/ (0, $4289s$jsx)("link", {
|
|
253
170
|
rel: "icon",
|
|
254
|
-
href: $
|
|
171
|
+
href: $42e0ba93e8ca4228$var$interop((0, (/*@__PURE__*/$parcel$interopDefault($cca9488c1d3c183d$exports)))),
|
|
255
172
|
type: "image/svg+xml"
|
|
256
173
|
}),
|
|
257
|
-
favicons && /*#__PURE__*/ (0, $
|
|
174
|
+
favicons && /*#__PURE__*/ (0, $4289s$jsx)("link", {
|
|
258
175
|
rel: "apple-touch-icon",
|
|
259
|
-
href: $
|
|
176
|
+
href: $42e0ba93e8ca4228$var$interop((0, (/*@__PURE__*/$parcel$interopDefault($45ea3ea7d12bce49$exports))))
|
|
260
177
|
}),
|
|
261
|
-
favicons && /*#__PURE__*/ (0, $
|
|
178
|
+
favicons && /*#__PURE__*/ (0, $4289s$jsx)("link", {
|
|
262
179
|
rel: "manifest",
|
|
263
180
|
// eslint-disable-next-line no-warning-comments
|
|
264
181
|
// @TODO until parcel fixes https://github.com/parcel-bundler/parcel/issues/8025 and stops stripping process.env.NEXT_PUBLIC_VERCEL_URL from the compiled code, use the remove webmanifest
|
|
265
|
-
href:
|
|
182
|
+
href: "https://next.sanity.build/manifest.webmanifest"
|
|
266
183
|
}),
|
|
267
|
-
themeColorLight && /*#__PURE__*/ (0, $
|
|
184
|
+
themeColorLight && /*#__PURE__*/ (0, $4289s$jsx)("meta", {
|
|
268
185
|
name: "theme-color",
|
|
269
186
|
content: themeColorLight,
|
|
270
187
|
media: "(prefers-color-scheme: light)"
|
|
271
188
|
}, "theme-color-light"),
|
|
272
|
-
themeColorDark && /*#__PURE__*/ (0, $
|
|
189
|
+
themeColorDark && /*#__PURE__*/ (0, $4289s$jsx)("meta", {
|
|
273
190
|
name: "theme-color",
|
|
274
191
|
content: themeColorDark,
|
|
275
192
|
media: "(prefers-color-scheme: dark)"
|
|
@@ -278,26 +195,26 @@ const $ce5bdc1b62c6b4b4$var$NextStudioHeadComponent = ({ children: children , th
|
|
|
278
195
|
]
|
|
279
196
|
});
|
|
280
197
|
};
|
|
281
|
-
const $
|
|
198
|
+
const $42e0ba93e8ca4228$export$79723eee2c1bf75e = /*#__PURE__*/ (0, $4289s$memo)($42e0ba93e8ca4228$var$NextStudioHeadComponent);
|
|
282
199
|
|
|
283
200
|
|
|
284
|
-
var $
|
|
201
|
+
var $056a6fa2cc4f79d2$exports = {};
|
|
285
202
|
|
|
286
|
-
$parcel$export($
|
|
203
|
+
$parcel$export($056a6fa2cc4f79d2$exports, "ServerStyleSheetDocument", () => $056a6fa2cc4f79d2$export$f64e2f55a1dca172);
|
|
287
204
|
|
|
288
205
|
|
|
289
206
|
|
|
290
|
-
class $
|
|
207
|
+
class $056a6fa2cc4f79d2$export$f64e2f55a1dca172 extends (0, $4289s$nextdocument) {
|
|
291
208
|
static async getInitialProps(ctx) {
|
|
292
|
-
const sheet = new (0, $
|
|
209
|
+
const sheet = new (0, $4289s$ServerStyleSheet)();
|
|
293
210
|
const originalRenderPage = ctx.renderPage;
|
|
294
211
|
try {
|
|
295
212
|
ctx.renderPage = ()=>originalRenderPage({
|
|
296
|
-
enhanceApp: (App)=>(props)=>sheet.collectStyles(/*#__PURE__*/ (0, $
|
|
213
|
+
enhanceApp: (App)=>(props)=>sheet.collectStyles(/*#__PURE__*/ (0, $4289s$jsx)(App, {
|
|
297
214
|
...props
|
|
298
215
|
}))
|
|
299
216
|
});
|
|
300
|
-
const initialProps = await (0, $
|
|
217
|
+
const initialProps = await (0, $4289s$nextdocument).getInitialProps(ctx);
|
|
301
218
|
return {
|
|
302
219
|
...initialProps,
|
|
303
220
|
styles: [
|
|
@@ -312,52 +229,52 @@ class $89005f9f22ebf103$export$f64e2f55a1dca172 extends (0, $3LAn5$nextdocument)
|
|
|
312
229
|
}
|
|
313
230
|
|
|
314
231
|
|
|
315
|
-
var $
|
|
232
|
+
var $47ea254c66a1f1fc$exports = {};
|
|
316
233
|
|
|
317
|
-
$parcel$export($
|
|
318
|
-
$parcel$export($
|
|
319
|
-
$parcel$export($
|
|
320
|
-
$parcel$export($
|
|
321
|
-
$parcel$export($
|
|
322
|
-
$parcel$export($
|
|
234
|
+
$parcel$export($47ea254c66a1f1fc$exports, "isWorkspaces", () => $47ea254c66a1f1fc$export$b7c6924067135ce);
|
|
235
|
+
$parcel$export($47ea254c66a1f1fc$exports, "isWorkspaceWithTheme", () => $47ea254c66a1f1fc$export$31236b9ee07dd150);
|
|
236
|
+
$parcel$export($47ea254c66a1f1fc$exports, "useTheme", () => $47ea254c66a1f1fc$export$93d4e7f90805808f);
|
|
237
|
+
$parcel$export($47ea254c66a1f1fc$exports, "useBackgroundColorsFromTheme", () => $47ea254c66a1f1fc$export$d3a2146a441ec034);
|
|
238
|
+
$parcel$export($47ea254c66a1f1fc$exports, "useBasePath", () => $47ea254c66a1f1fc$export$53bdd69a9f9bd75);
|
|
239
|
+
$parcel$export($47ea254c66a1f1fc$exports, "useConfigWithBasePath", () => $47ea254c66a1f1fc$export$297ba38aa0562c6e);
|
|
323
240
|
|
|
324
241
|
|
|
325
242
|
|
|
326
|
-
function $
|
|
243
|
+
function $47ea254c66a1f1fc$export$b7c6924067135ce(config) {
|
|
327
244
|
return Array.isArray(config);
|
|
328
245
|
}
|
|
329
|
-
function $
|
|
246
|
+
function $47ea254c66a1f1fc$export$31236b9ee07dd150(workspace) {
|
|
330
247
|
return Boolean(workspace.theme);
|
|
331
248
|
}
|
|
332
|
-
function $
|
|
333
|
-
const workspace = (0, $
|
|
249
|
+
function $47ea254c66a1f1fc$export$93d4e7f90805808f(config) {
|
|
250
|
+
const workspace = (0, $4289s$useMemo)(()=>$47ea254c66a1f1fc$export$b7c6924067135ce(config) ? config[0] : config, [
|
|
334
251
|
config
|
|
335
252
|
]);
|
|
336
|
-
return (0, $
|
|
253
|
+
return (0, $4289s$useMemo)(()=>$47ea254c66a1f1fc$export$31236b9ee07dd150(workspace) ? workspace.theme : (0, $4289s$defaultTheme), [
|
|
337
254
|
workspace
|
|
338
255
|
]);
|
|
339
256
|
}
|
|
340
|
-
const $
|
|
341
|
-
return (0, $
|
|
257
|
+
const $47ea254c66a1f1fc$export$d3a2146a441ec034 = (theme)=>{
|
|
258
|
+
return (0, $4289s$useMemo)(()=>({
|
|
342
259
|
themeColorLight: theme.color.light.default.base.bg,
|
|
343
260
|
themeColorDark: theme.color.dark.default.base.bg
|
|
344
261
|
}), [
|
|
345
262
|
theme
|
|
346
263
|
]);
|
|
347
264
|
};
|
|
348
|
-
function $
|
|
349
|
-
const router = (0, $
|
|
350
|
-
return (0, $
|
|
265
|
+
function $47ea254c66a1f1fc$export$53bdd69a9f9bd75() {
|
|
266
|
+
const router = (0, $4289s$useRouter)();
|
|
267
|
+
return (0, $4289s$useMemo)(()=>{
|
|
351
268
|
const [basePath = "/"] = router.route.split("/[");
|
|
352
269
|
return basePath;
|
|
353
270
|
}, [
|
|
354
271
|
router.route
|
|
355
272
|
]);
|
|
356
273
|
}
|
|
357
|
-
function $
|
|
358
|
-
const basePath = $
|
|
359
|
-
return (0, $
|
|
360
|
-
if ($
|
|
274
|
+
function $47ea254c66a1f1fc$export$297ba38aa0562c6e(config) {
|
|
275
|
+
const basePath = $47ea254c66a1f1fc$export$53bdd69a9f9bd75();
|
|
276
|
+
return (0, $4289s$useMemo)(()=>{
|
|
277
|
+
if ($47ea254c66a1f1fc$export$b7c6924067135ce(config)) return config.map((workspace)=>({
|
|
361
278
|
...workspace,
|
|
362
279
|
basePath: workspace.basePath === "/" ? basePath : `${basePath}${workspace.basePath || ""}`
|
|
363
280
|
}));
|
|
@@ -372,14 +289,14 @@ function $56e7c02732eb5790$export$297ba38aa0562c6e(config) {
|
|
|
372
289
|
}
|
|
373
290
|
|
|
374
291
|
|
|
375
|
-
$parcel$exportWildcard($
|
|
376
|
-
$parcel$exportWildcard($
|
|
377
|
-
$parcel$exportWildcard($
|
|
378
|
-
$parcel$exportWildcard($
|
|
379
|
-
$parcel$exportWildcard($
|
|
292
|
+
$parcel$exportWildcard($2e0e6a6d8bb1bf3b$exports, $1512e3a8033a35cc$exports);
|
|
293
|
+
$parcel$exportWildcard($2e0e6a6d8bb1bf3b$exports, $96bfa0bd9b2d4d7b$exports);
|
|
294
|
+
$parcel$exportWildcard($2e0e6a6d8bb1bf3b$exports, $42e0ba93e8ca4228$exports);
|
|
295
|
+
$parcel$exportWildcard($2e0e6a6d8bb1bf3b$exports, $056a6fa2cc4f79d2$exports);
|
|
296
|
+
$parcel$exportWildcard($2e0e6a6d8bb1bf3b$exports, $47ea254c66a1f1fc$exports);
|
|
380
297
|
|
|
381
298
|
|
|
382
299
|
|
|
383
300
|
|
|
384
|
-
export {$
|
|
301
|
+
export {$1512e3a8033a35cc$export$eefb95cccd1bb6c5 as NextStudio, $96bfa0bd9b2d4d7b$export$c8fda7ee7699d07e as NextStudioGlobalStyle, $42e0ba93e8ca4228$export$79723eee2c1bf75e as NextStudioHead, $056a6fa2cc4f79d2$export$f64e2f55a1dca172 as ServerStyleSheetDocument, $47ea254c66a1f1fc$export$b7c6924067135ce as isWorkspaces, $47ea254c66a1f1fc$export$31236b9ee07dd150 as isWorkspaceWithTheme, $47ea254c66a1f1fc$export$93d4e7f90805808f as useTheme, $47ea254c66a1f1fc$export$d3a2146a441ec034 as useBackgroundColorsFromTheme, $47ea254c66a1f1fc$export$53bdd69a9f9bd75 as useBasePath, $47ea254c66a1f1fc$export$297ba38aa0562c6e as useConfigWithBasePath};
|
|
385
302
|
//# sourceMappingURL=studio.js.map
|
package/lib/esm/studio.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA8CA,IAAA,yCAAyC;AACzC,IAAA,yCAA+B;AAC/B,IAAA,yCAA6B;AAhD7B,YAAY,CAAC;AAEb,IAAI,+BAAS,GAAG,EAAE,AAAC;AAEnB,SAAS,wCAAkB,CAAC,EAAE,EAAE;IAC9B,IAAI,KAAK,GAAG,+BAAS,CAAC,EAAE,CAAC,AAAC;IAE1B,I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AC,MAAM,CAAC,EACtB,OAAO,MAAM,CAAC,GAAG,CAAC,CAAC,SAAS,GAAM,CAAA;gBAChC,GAAG,SAAS;gBACZ,QAAQ,EACN,SAAS,CAAC,QAAQ,KAAK,GAAG,GAAG,QAAQ,GAAG,CAAC,EAAE,QAAQ,CAAC,EAAE,SAAS,CAAC,QAAQ,IAAI,EAAE,CAAC,CAAC;aACnF,CAAA,AAAC,CAAC,CAAA;QAEL,OAAO;YACL,GAAG,MAAM;YACT,QAAQ,EAAE,MAAM,CAAC,QAAQ,KAAK,GAAG,GAAG,QAAQ,GAAG,CAAC,EAAE,QAAQ,CAAC,EAAE,MAAM,CAAC,QAAQ,IAAI,EAAE,CAAC,CAAC;SACrF,CAAA;KACF,EAAE;QAAC,MAAM;QAAE,QAAQ;KAAC,CAAC,CAAA;CACvB;;;;;;;;;AZ5ED","sources":["node_modules/@parcel/runtime-js/lib/helpers/bundle-url.js","src/studio.ts","src/studio/index.ts","src/studio/NextStudio.tsx","src/studio/NextStudioGlobalStyle.ts","src/studio/NextStudioHead.tsx","node_modules/@parcel/runtime-js/lib/runtime-39b6a9773e50a940.js","node_modules/@parcel/runtime-js/lib/runtime-6fed184bd2a4e694.js","node_modules/@parcel/runtime-js/lib/runtime-2065057c0cdda248.js","node_modules/@parcel/runtime-js/lib/runtime-b68e209107fb72c4.js","node_modules/@parcel/runtime-js/lib/runtime-babf07d47aad2640.js","public/webmanifest.json","src/studio/ServerStyleSheetDocument.tsx","src/studio/utils.ts"],"sourcesContent":["\"use strict\";\n\nvar bundleURL = {};\n\nfunction getBundleURLCached(id) {\n var value = bundleURL[id];\n\n if (!value) {\n value = getBundleURL();\n bundleURL[id] = value;\n }\n\n return value;\n}\n\nfunction getBundleURL() {\n try {\n throw new Error();\n } catch (err) {\n var matches = ('' + err.stack).match(/(https?|file|ftp|(chrome|moz|safari-web)-extension):\\/\\/[^)\\n]+/g);\n\n if (matches) {\n // The first two stack frames will be this function and getBundleURLCached.\n // Use the 3rd one, which will be a runtime in the original bundle.\n return getBaseURL(matches[2]);\n }\n }\n\n return '/';\n}\n\nfunction getBaseURL(url) {\n return ('' + url).replace(/^((?:https?|file|ftp|(chrome|moz|safari-web)-extension):\\/\\/.+)\\/[^/]+$/, '$1') + '/';\n} // TODO: Replace uses with `new URL(url).origin` when ie11 is no longer supported.\n\n\nfunction getOrigin(url) {\n var matches = ('' + url).match(/(https?|file|ftp|(chrome|moz|safari-web)-extension):\\/\\/[^/]+/);\n\n if (!matches) {\n throw new Error('Origin not found');\n }\n\n return matches[0];\n}\n\nexports.getBundleURL = getBundleURLCached;\nexports.getBaseURL = getBaseURL;\nexports.getOrigin = getOrigin;","export * from './studio/index'\n","export * from './NextStudio'\nexport * from './NextStudioGlobalStyle'\nexport * from './NextStudioHead'\nexport * from './ServerStyleSheetDocument'\nexport * from './utils'\n","import {memo} from 'react'\nimport {type StudioProps, Studio} from 'sanity'\n\nimport {\n type NextStudioHeadProps,\n NextStudioGlobalStyle,\n NextStudioGlobalStyleProps,\n NextStudioHead,\n useBackgroundColorsFromTheme,\n useTheme,\n} from '.'\n\nexport interface NextStudioProps extends StudioProps {\n /**\n * Override how the Studio renders by passing children.\n * This is useful for advanced use cases where you're using StudioProvider and StudioLayout instead of Studio:\n * import {StudioProvider, StudioLayout} from 'sanity'\n * import {NextStudio} from 'next-sanity/studio'\n * <NextStudio config={config}>\n * <StudioProvider config={config}>\n * <CustomComponentThatUsesContextFromStudioProvider />\n * <StudioLayout />\n * </StudioProvider>\n * </NextStudio>\n */\n children?: React.ReactNode\n /**\n * Turns off the default global styling\n */\n unstable__noGlobalStyle?: boolean\n /**\n * Apply fix with SVG icon centering that happens if TailwindCSS is loaded, on by defautl\n */\n unstable__noTailwindSvgFix?: NextStudioGlobalStyleProps['unstable__tailwindSvgFix']\n /**\n * Add stuff to the head with next/head\n */\n unstable__head?: NextStudioHeadProps['children']\n /**\n * Sets the document title\n */\n unstable__document_title?: NextStudioHeadProps['title']\n /**\n * Sets the background color of <html>\n */\n unstable__bg?: NextStudioGlobalStyleProps['bg']\n /**\n * Don't load the favicon meta tags\n */\n unstable__noFavicons?: boolean\n}\n/**\n * Intended to render at the root of a page, letting the Studio own that page and render much like it would if you used `npx sanity start` to render\n * It's a drop-in replacement for `import {Studio} from 'sanity'`\n */\nconst NextStudioComponent = ({\n children,\n config,\n unstable__noGlobalStyle,\n unstable__noTailwindSvgFix,\n unstable__head,\n unstable__document_title,\n unstable__bg,\n unstable__noFavicons,\n ...props\n}: NextStudioProps) => {\n const theme = useTheme(config)\n const {themeColorLight, themeColorDark} = useBackgroundColorsFromTheme(theme)\n return (\n <>\n {children || <Studio config={config} {...props} />}\n <NextStudioHead\n themeColorLight={themeColorLight}\n themeColorDark={themeColorDark}\n title={unstable__document_title}\n favicons={!unstable__noFavicons}\n >\n {unstable__head}\n </NextStudioHead>\n {!unstable__noGlobalStyle && (\n <NextStudioGlobalStyle\n bg={unstable__bg ?? themeColorLight}\n unstable__tailwindSvgFix={!unstable__noTailwindSvgFix}\n />\n )}\n </>\n )\n}\nexport const NextStudio = memo(NextStudioComponent)\n","import {createGlobalStyle, css} from 'styled-components'\n\nexport interface NextStudioGlobalStyleProps {\n bg?: string\n unstable__tailwindSvgFix?: boolean\n}\nexport const NextStudioGlobalStyle = createGlobalStyle<NextStudioGlobalStyleProps>`\n${({bg}) =>\n bg\n ? css`\n html {\n background-color: ${bg};\n }\n `\n : ''}\nhtml,\nbody,\n#__next {\n height: 100%;\n}\nbody {\n margin: 0;\n overscroll-behavior: none;\n -webkit-font-smoothing: antialiased;\n}\n${({unstable__tailwindSvgFix}) =>\n unstable__tailwindSvgFix\n ? css`\n /* override tailwind reset */\n :root svg {\n display: inline;\n }\n `\n : ''}`\n","/* eslint-disable no-process-env */\nimport Head from 'next/head'\nimport {type ComponentProps, memo, useCallback} from 'react'\n\nimport iconApple from '../../public/apple-touch-icon.png'\nimport iconIco from '../../public/favicon.ico'\nimport iconSvg from '../../public/favicon.svg'\nimport icon192 from '../../public/favicon-192.png'\nimport icon512 from '../../public/favicon-512.png'\nimport webmanifest from '../../public/webmanifest.json'\nimport type {MetaThemeColors} from './utils'\n\n// Interop between how Parcel and Next deals with asset imports\nconst interop = (href: string | {src: string}): string =>\n typeof href === 'string' ? href : href.src\n\nexport interface NextStudioHeadProps extends Partial<MetaThemeColors> {\n children?: ComponentProps<typeof Head>['children']\n title?: string\n favicons?: boolean\n}\nconst NextStudioHeadComponent = ({\n children,\n themeColorDark,\n themeColorLight,\n title = 'Sanity Studio',\n favicons,\n}: NextStudioHeadProps) => {\n const inlineWebmanifest = useCallback(() => {\n const manifest = JSON.parse(JSON.stringify(webmanifest))\n const icons = manifest.icons.map((icon: any) => {\n // Inline manifests works best when URLs are absolute\n const src =\n // eslint-disable-next-line no-nested-ternary\n icon.src === './favicon-192.png'\n ? interop(icon192)\n : icon.src === './favicon-512.png'\n ? interop(icon512)\n : icon.src\n return {\n ...icon,\n src: process.env.NEXT_PUBLIC_VERCEL_URL\n ? new URL(src, `https://${process.env.NEXT_PUBLIC_VERCEL_URL}`).toString()\n : src,\n }\n })\n return `data:application/manifest+json,${encodeURIComponent(\n JSON.stringify({...manifest, icons})\n )}`\n }, [])\n\n return (\n <Head>\n <meta\n name=\"viewport\"\n // Studio implements display cutouts CSS (The iPhone Notch ™ ) and needs `viewport-fit=covered` for it to work correctly\n content=\"width=device-width, initial-scale=1, viewport-fit=cover\"\n />\n <meta name=\"robots\" content=\"noindex\" />\n <meta name=\"referrer\" content=\"same-origin\" />\n <title>{title}</title>\n {favicons && <link rel=\"icon\" href={interop(iconIco)} sizes=\"any\" />}\n {favicons && <link rel=\"icon\" href={interop(iconSvg)} type=\"image/svg+xml\" />}\n {favicons && <link rel=\"apple-touch-icon\" href={interop(iconApple)} />}\n {favicons && (\n <link\n rel=\"manifest\"\n // eslint-disable-next-line no-warning-comments\n // @TODO until parcel fixes https://github.com/parcel-bundler/parcel/issues/8025 and stops stripping process.env.NEXT_PUBLIC_VERCEL_URL from the compiled code, use the remove webmanifest\n href={\n process.env.NEXT_PUBLIC_VERCEL_URL\n ? inlineWebmanifest()\n : 'https://next-studio-layout.sanity.build/manifest.webmanifest'\n }\n />\n )}\n {/* These theme-color tags makes the Studio look really really good on devices like iPads as the browser chrome adopts the Studio background */}\n {themeColorLight && (\n <meta\n key=\"theme-color-light\"\n name=\"theme-color\"\n content={themeColorLight}\n media=\"(prefers-color-scheme: light)\"\n />\n )}\n {themeColorDark && (\n <meta\n key=\"theme-color-dark\"\n name=\"theme-color\"\n content={themeColorDark}\n media=\"(prefers-color-scheme: dark)\"\n />\n )}\n {children}\n </Head>\n )\n}\n\nexport const NextStudioHead = memo(NextStudioHeadComponent)\n","module.exports = require('./helpers/bundle-url').getBundleURL('3LAn5') + \"apple-touch-icon.abc4aca2.png\";","module.exports = require('./helpers/bundle-url').getBundleURL('3LAn5') + \"favicon.648fc2f2.ico\";","module.exports = require('./helpers/bundle-url').getBundleURL('3LAn5') + \"favicon.8f76876f.svg\";","module.exports = require('./helpers/bundle-url').getBundleURL('3LAn5') + \"favicon-192.40c8bab4.png\";","module.exports = require('./helpers/bundle-url').getBundleURL('3LAn5') + \"favicon-512.5e08f951.png\";","{\n \"icons\": [\n {\n \"src\": \"./favicon-192.png\",\n \"type\": \"image/png\",\n \"sizes\": \"192x192\"\n },\n {\n \"src\": \"./favicon-512.png\",\n \"type\": \"image/png\",\n \"sizes\": \"512x512\"\n }\n ]\n}\n","// We can disable this rule safely as we're not trying to use it outside pages/document, we're shipping a wrapper\n// eslint-disable-next-line @next/next/no-document-import-in-page\nimport Document, {type DocumentContext} from 'next/document'\nimport {ServerStyleSheet} from 'styled-components'\n\n/**\n * Usage, from a pages/_document.tsx file:\n * import {ServerStyleSheetDocument} from 'next-sanity/studio'\n *\n * export default class MyDocument extends ServerStyleSheetDocument {}\n *\n * To do extra stuff in getInitialProps:\n * import {ServerStyleSheetDocument} from 'next-sanity/studio'\n * import { type DocumentContext } from 'next/document'\n *\n * export default class MyDocument extends ServerStyleSheetDocument {\n * static async getInitialProps(ctx: DocumentContext) {\n * // You can still override renderPage:\n * const originalRenderPage = ctx.renderPage\n * ctx.renderPage = () => originalRenderPage({\n * enhanceApp: (App) => (props) => <App {...props} />\n * })\n *\n * const initialProps = await ServerStyleSheetDocument.getInitialProps(ctx)\n * const extraStyles = await getStyles()\n * return {\n * ...initialProps,\n * styles: [initialProps.styles, extraStyles],\n * }\n * }\n * }\n */\n\nexport class ServerStyleSheetDocument extends Document {\n static async getInitialProps(ctx: DocumentContext) {\n const sheet = new ServerStyleSheet()\n const originalRenderPage = ctx.renderPage\n\n try {\n ctx.renderPage = () =>\n originalRenderPage({\n enhanceApp: (App) => (props) => sheet.collectStyles(<App {...props} />),\n })\n\n const initialProps = await Document.getInitialProps(ctx)\n return {\n ...initialProps,\n styles: [initialProps.styles, sheet.getStyleElement()],\n }\n } finally {\n sheet.seal()\n }\n }\n}\n","import {useRouter} from 'next/router'\nimport {useMemo} from 'react'\nimport {type Config, type StudioTheme, type WorkspaceOptions, defaultTheme} from 'sanity'\n\nexport function isWorkspaces(config: Config): config is WorkspaceOptions[] {\n return Array.isArray(config)\n}\n\nexport interface WorkspaceWithTheme extends Omit<WorkspaceOptions, 'theme'> {\n theme: StudioTheme\n}\n\nexport function isWorkspaceWithTheme(\n workspace: WorkspaceOptions\n): workspace is WorkspaceWithTheme {\n return Boolean(workspace.theme)\n}\n\nexport function useTheme(config: Config): StudioTheme {\n const workspace = useMemo<WorkspaceOptions>(\n () => (isWorkspaces(config) ? config[0] : config),\n [config]\n )\n return useMemo<StudioTheme>(\n () => (isWorkspaceWithTheme(workspace) ? workspace.theme : defaultTheme),\n [workspace]\n )\n}\n\nexport type MetaThemeColors = {\n themeColorLight: string\n themeColorDark: string\n}\nexport const useBackgroundColorsFromTheme = (theme: StudioTheme): MetaThemeColors => {\n return useMemo<MetaThemeColors>(\n () => ({\n themeColorLight: theme.color.light.default.base.bg,\n themeColorDark: theme.color.dark.default.base.bg,\n }),\n [theme]\n )\n}\n\n/**\n * Parses the next route to determine the what the base path for Sanity Studio should be\n */\nexport function useBasePath(): string {\n const router = useRouter()\n return useMemo(() => {\n const [basePath = '/'] = router.route.split('/[')\n return basePath\n }, [router.route])\n}\n\nexport interface WorkspaceWithBasePath extends Omit<WorkspaceOptions, 'basePath'> {\n basePath: string\n}\nexport type ConfigWithBasePath = WorkspaceWithBasePath | WorkspaceWithBasePath[]\n/**\n * Apply the base path from next to the config, prefixing any defined base path\n */\nexport function useConfigWithBasePath(config: Config): ConfigWithBasePath {\n const basePath = useBasePath()\n return useMemo(() => {\n if (isWorkspaces(config)) {\n return config.map((workspace) => ({\n ...workspace,\n basePath:\n workspace.basePath === '/' ? basePath : `${basePath}${workspace.basePath || ''}`,\n }))\n }\n return {\n ...config,\n basePath: config.basePath === '/' ? basePath : `${basePath}${config.basePath || ''}`,\n }\n }, [config, basePath])\n}\n"],"names":[],"version":3,"file":"studio.js.map","sourceRoot":"../../"}
|
|
1
|
+
{"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AEAA;;;;AAmDA;;;GAGG,CACH,MAAM,yCAAmB,GAAG,CAAC,YAC3B,QAAQ,CAAA,UACR,MAAM,CAAA,2BACN,uBAAuB,CAAA,8BACvB,0BAA0B,CAAA,kBAC1B,cAAc,CAAA,4BACd,wBAAwB,CAAA,gBACxB,YAAY,CAAA,wBACZ,oBAAoB,CAAA,EACpB,GAAG,KAAK,EACQ,GAAK;IACrB,MAAM,KAAK,GAAG,CAAA,GAAA,yCAAQ,CAAA,CAAC,MAAM,CAAC;IAC9B,MAAM,mBAAC,eAAe,CAAA,kBAAE,cAAc,CAAA,EAAC,GAAG,CAAA,GAAA,yCAA4B,CAAA,CAAC,KAAK,CAAC;IAC7E,qBACE;;YACG,QAAQ,kBAAI,gBAAC,CAAA,GAAA,aAAM,CAAA;gBAAC,MAAM,EAAE,MAAM;gBAAG,GAAG,KAAK;cAAI;0BAClD,gBAAC,CAAA,GAAA,yCAAc,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parcel/runtime-js/lib/runtime-3051b1f8521cb443.js","node_modules/@parcel/runtime-js/lib/runtime-e73a94dce834bf1d.js","node_modules/@parcel/runtime-js/lib/runtime-e80cde120f8d97cf.js","node_modules/@parcel/runtime-js/lib/runtime-3f07be8b0dbc3762.js","node_modules/@parcel/runtime-js/lib/runtime-2be719da1e6d0852.js","public/webmanifest.json","src/studio/ServerStyleSheetDocument.tsx","src/studio/utils.ts"],"sourcesContent":["export * from './studio/index'\n","export * from './NextStudio'\nexport * from './NextStudioGlobalStyle'\nexport * from './NextStudioHead'\nexport * from './ServerStyleSheetDocument'\nexport * from './utils'\n","import {memo} from 'react'\nimport {type StudioProps, Studio} from 'sanity'\n\nimport {\n type NextStudioHeadProps,\n NextStudioGlobalStyle,\n NextStudioGlobalStyleProps,\n NextStudioHead,\n useBackgroundColorsFromTheme,\n useTheme,\n} from '.'\n\nexport interface NextStudioProps extends StudioProps {\n /**\n * Override how the Studio renders by passing children.\n * This is useful for advanced use cases where you're using StudioProvider and StudioLayout instead of Studio:\n * import {StudioProvider, StudioLayout} from 'sanity'\n * import {NextStudio} from 'next-sanity/studio'\n * <NextStudio config={config}>\n * <StudioProvider config={config}>\n * <CustomComponentThatUsesContextFromStudioProvider />\n * <StudioLayout />\n * </StudioProvider>\n * </NextStudio>\n */\n children?: React.ReactNode\n /**\n * Turns off the default global styling\n */\n unstable__noGlobalStyle?: boolean\n /**\n * Apply fix with SVG icon centering that happens if TailwindCSS is loaded, on by defautl\n */\n unstable__noTailwindSvgFix?: NextStudioGlobalStyleProps['unstable__tailwindSvgFix']\n /**\n * Add stuff to the head with next/head\n */\n unstable__head?: NextStudioHeadProps['children']\n /**\n * Sets the document title\n */\n unstable__document_title?: NextStudioHeadProps['title']\n /**\n * Sets the background color of <html>\n */\n unstable__bg?: NextStudioGlobalStyleProps['bg']\n /**\n * Don't load the favicon meta tags\n */\n unstable__noFavicons?: boolean\n}\n/**\n * Intended to render at the root of a page, letting the Studio own that page and render much like it would if you used `npx sanity start` to render\n * It's a drop-in replacement for `import {Studio} from 'sanity'`\n */\nconst NextStudioComponent = ({\n children,\n config,\n unstable__noGlobalStyle,\n unstable__noTailwindSvgFix,\n unstable__head,\n unstable__document_title,\n unstable__bg,\n unstable__noFavicons,\n ...props\n}: NextStudioProps) => {\n const theme = useTheme(config)\n const {themeColorLight, themeColorDark} = useBackgroundColorsFromTheme(theme)\n return (\n <>\n {children || <Studio config={config} {...props} />}\n <NextStudioHead\n themeColorLight={themeColorLight}\n themeColorDark={themeColorDark}\n title={unstable__document_title}\n favicons={!unstable__noFavicons}\n >\n {unstable__head}\n </NextStudioHead>\n {!unstable__noGlobalStyle && (\n <NextStudioGlobalStyle\n bg={unstable__bg ?? themeColorLight}\n unstable__tailwindSvgFix={!unstable__noTailwindSvgFix}\n />\n )}\n </>\n )\n}\nexport const NextStudio = memo(NextStudioComponent)\n","import {createGlobalStyle, css} from 'styled-components'\n\nexport interface NextStudioGlobalStyleProps {\n bg?: string\n unstable__tailwindSvgFix?: boolean\n}\nexport const NextStudioGlobalStyle = createGlobalStyle<NextStudioGlobalStyleProps>`\n${({bg}) =>\n bg\n ? css`\n html {\n background-color: ${bg};\n }\n `\n : ''}\nhtml,\nbody,\n#__next {\n height: 100%;\n}\nbody {\n margin: 0;\n overscroll-behavior: none;\n -webkit-font-smoothing: antialiased;\n}\n${({unstable__tailwindSvgFix}) =>\n unstable__tailwindSvgFix\n ? css`\n /* override tailwind reset */\n :root svg {\n display: inline;\n }\n `\n : ''}`\n","/* eslint-disable no-process-env */\nimport Head from 'next/head'\nimport {type ComponentProps, memo, useCallback} from 'react'\n\nimport iconApple from '../../public/apple-touch-icon.png'\nimport iconIco from '../../public/favicon.ico'\nimport iconSvg from '../../public/favicon.svg'\nimport icon192 from '../../public/favicon-192.png'\nimport icon512 from '../../public/favicon-512.png'\nimport webmanifest from '../../public/webmanifest.json'\nimport type {MetaThemeColors} from './utils'\n\n// Interop between how Parcel and Next deals with asset imports\nconst interop = (href: string | {src: string}): string =>\n typeof href === 'string' ? href : href.src\n\nexport interface NextStudioHeadProps extends Partial<MetaThemeColors> {\n children?: ComponentProps<typeof Head>['children']\n title?: string\n favicons?: boolean\n}\nconst NextStudioHeadComponent = ({\n children,\n themeColorDark,\n themeColorLight,\n title = 'Sanity Studio',\n favicons,\n}: NextStudioHeadProps) => {\n const inlineWebmanifest = useCallback(() => {\n const manifest = JSON.parse(JSON.stringify(webmanifest))\n const icons = manifest.icons.map((icon: any) => {\n // Inline manifests works best when URLs are absolute\n const src =\n // eslint-disable-next-line no-nested-ternary\n icon.src === './favicon-192.png'\n ? interop(icon192)\n : icon.src === './favicon-512.png'\n ? interop(icon512)\n : icon.src\n return {\n ...icon,\n src: process.env.NEXT_PUBLIC_VERCEL_URL\n ? new URL(src, `https://${process.env.NEXT_PUBLIC_VERCEL_URL}`).toString()\n : src,\n }\n })\n return `data:application/manifest+json,${encodeURIComponent(\n JSON.stringify({...manifest, icons})\n )}`\n }, [])\n\n return (\n <Head>\n <meta\n name=\"viewport\"\n // Studio implements display cutouts CSS (The iPhone Notch ™ ) and needs `viewport-fit=covered` for it to work correctly\n content=\"width=device-width, initial-scale=1, viewport-fit=cover\"\n />\n <meta name=\"robots\" content=\"noindex\" />\n <meta name=\"referrer\" content=\"same-origin\" />\n <title>{title}</title>\n {favicons && <link rel=\"icon\" href={interop(iconIco)} sizes=\"any\" />}\n {favicons && <link rel=\"icon\" href={interop(iconSvg)} type=\"image/svg+xml\" />}\n {favicons && <link rel=\"apple-touch-icon\" href={interop(iconApple)} />}\n {favicons && (\n <link\n rel=\"manifest\"\n // eslint-disable-next-line no-warning-comments\n // @TODO until parcel fixes https://github.com/parcel-bundler/parcel/issues/8025 and stops stripping process.env.NEXT_PUBLIC_VERCEL_URL from the compiled code, use the remove webmanifest\n href={\n process.env.NEXT_PUBLIC_VERCEL_URL\n ? inlineWebmanifest()\n : 'https://next.sanity.build/manifest.webmanifest'\n }\n />\n )}\n {/* These theme-color tags makes the Studio look really really good on devices like iPads as the browser chrome adopts the Studio background */}\n {themeColorLight && (\n <meta\n key=\"theme-color-light\"\n name=\"theme-color\"\n content={themeColorLight}\n media=\"(prefers-color-scheme: light)\"\n />\n )}\n {themeColorDark && (\n <meta\n key=\"theme-color-dark\"\n name=\"theme-color\"\n content={themeColorDark}\n media=\"(prefers-color-scheme: dark)\"\n />\n )}\n {children}\n </Head>\n )\n}\n\nexport const NextStudioHead = memo(NextStudioHeadComponent)\n","module.exports = new __parcel__URL__(\"apple-touch-icon.abc4aca2.png\").toString();","module.exports = new __parcel__URL__(\"favicon.648fc2f2.ico\").toString();","module.exports = new __parcel__URL__(\"favicon.8f76876f.svg\").toString();","module.exports = new __parcel__URL__(\"favicon-192.40c8bab4.png\").toString();","module.exports = new __parcel__URL__(\"favicon-512.5e08f951.png\").toString();","{\n \"icons\": [\n {\n \"src\": \"./favicon-192.png\",\n \"type\": \"image/png\",\n \"sizes\": \"192x192\"\n },\n {\n \"src\": \"./favicon-512.png\",\n \"type\": \"image/png\",\n \"sizes\": \"512x512\"\n }\n ]\n}\n","// We can disable this rule safely as we're not trying to use it outside pages/document, we're shipping a wrapper\n// eslint-disable-next-line @next/next/no-document-import-in-page\nimport Document, {type DocumentContext} from 'next/document'\nimport {ServerStyleSheet} from 'styled-components'\n\n/**\n * Usage, from a pages/_document.tsx file:\n * import {ServerStyleSheetDocument} from 'next-sanity/studio'\n *\n * export default class MyDocument extends ServerStyleSheetDocument {}\n *\n * To do extra stuff in getInitialProps:\n * import {ServerStyleSheetDocument} from 'next-sanity/studio'\n * import { type DocumentContext } from 'next/document'\n *\n * export default class MyDocument extends ServerStyleSheetDocument {\n * static async getInitialProps(ctx: DocumentContext) {\n * // You can still override renderPage:\n * const originalRenderPage = ctx.renderPage\n * ctx.renderPage = () => originalRenderPage({\n * enhanceApp: (App) => (props) => <App {...props} />\n * })\n *\n * const initialProps = await ServerStyleSheetDocument.getInitialProps(ctx)\n * const extraStyles = await getStyles()\n * return {\n * ...initialProps,\n * styles: [initialProps.styles, extraStyles],\n * }\n * }\n * }\n */\n\nexport class ServerStyleSheetDocument extends Document {\n static async getInitialProps(ctx: DocumentContext) {\n const sheet = new ServerStyleSheet()\n const originalRenderPage = ctx.renderPage\n\n try {\n ctx.renderPage = () =>\n originalRenderPage({\n enhanceApp: (App) => (props) => sheet.collectStyles(<App {...props} />),\n })\n\n const initialProps = await Document.getInitialProps(ctx)\n return {\n ...initialProps,\n styles: [initialProps.styles, sheet.getStyleElement()],\n }\n } finally {\n sheet.seal()\n }\n }\n}\n","import {useRouter} from 'next/router'\nimport {useMemo} from 'react'\nimport {type Config, type StudioTheme, type WorkspaceOptions, defaultTheme} from 'sanity'\n\nexport function isWorkspaces(config: Config): config is WorkspaceOptions[] {\n return Array.isArray(config)\n}\n\nexport interface WorkspaceWithTheme extends Omit<WorkspaceOptions, 'theme'> {\n theme: StudioTheme\n}\n\nexport function isWorkspaceWithTheme(\n workspace: WorkspaceOptions\n): workspace is WorkspaceWithTheme {\n return Boolean(workspace.theme)\n}\n\nexport function useTheme(config: Config): StudioTheme {\n const workspace = useMemo<WorkspaceOptions>(\n () => (isWorkspaces(config) ? config[0] : config),\n [config]\n )\n return useMemo<StudioTheme>(\n () => (isWorkspaceWithTheme(workspace) ? workspace.theme : defaultTheme),\n [workspace]\n )\n}\n\nexport type MetaThemeColors = {\n themeColorLight: string\n themeColorDark: string\n}\nexport const useBackgroundColorsFromTheme = (theme: StudioTheme): MetaThemeColors => {\n return useMemo<MetaThemeColors>(\n () => ({\n themeColorLight: theme.color.light.default.base.bg,\n themeColorDark: theme.color.dark.default.base.bg,\n }),\n [theme]\n )\n}\n\n/**\n * Parses the next route to determine the what the base path for Sanity Studio should be\n */\nexport function useBasePath(): string {\n const router = useRouter()\n return useMemo(() => {\n const [basePath = '/'] = router.route.split('/[')\n return basePath\n }, [router.route])\n}\n\nexport interface WorkspaceWithBasePath extends Omit<WorkspaceOptions, 'basePath'> {\n basePath: string\n}\nexport type ConfigWithBasePath = WorkspaceWithBasePath | WorkspaceWithBasePath[]\n/**\n * Apply the base path from next to the config, prefixing any defined base path\n */\nexport function useConfigWithBasePath(config: Config): ConfigWithBasePath {\n const basePath = useBasePath()\n return useMemo(() => {\n if (isWorkspaces(config)) {\n return config.map((workspace) => ({\n ...workspace,\n basePath:\n workspace.basePath === '/' ? basePath : `${basePath}${workspace.basePath || ''}`,\n }))\n }\n return {\n ...config,\n basePath: config.basePath === '/' ? basePath : `${basePath}${config.basePath || ''}`,\n }\n }, [config, basePath])\n}\n"],"names":[],"version":3,"file":"studio.js.map"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "next-sanity",
|
|
3
|
-
"version": "0.6.
|
|
3
|
+
"version": "0.6.11",
|
|
4
4
|
"description": "Sanity.io toolkit for Next.js",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"sanity",
|
|
@@ -26,10 +26,22 @@
|
|
|
26
26
|
"require": "./dist/index.js",
|
|
27
27
|
"default": "./dist/next-sanity.esm.js"
|
|
28
28
|
},
|
|
29
|
-
"./package.json": "./package.json"
|
|
29
|
+
"./package.json": "./package.json",
|
|
30
|
+
"./studio": {
|
|
31
|
+
"source": "./src/studio.ts",
|
|
32
|
+
"require": "./lib/cjs/studio.js",
|
|
33
|
+
"default": "./lib/esm/studio.js"
|
|
34
|
+
}
|
|
30
35
|
},
|
|
31
36
|
"main": "dist/index.js",
|
|
32
37
|
"module": "dist/next-sanity.esm.js",
|
|
38
|
+
"typesVersions": {
|
|
39
|
+
"*": {
|
|
40
|
+
"studio": [
|
|
41
|
+
"./dist/studio.d.ts"
|
|
42
|
+
]
|
|
43
|
+
}
|
|
44
|
+
},
|
|
33
45
|
"typings": "dist/index.d.ts",
|
|
34
46
|
"files": [
|
|
35
47
|
"dist",
|
|
@@ -48,7 +60,8 @@
|
|
|
48
60
|
"prettier": "npx prettier --ignore-path .gitignore",
|
|
49
61
|
"test": "jest",
|
|
50
62
|
"tsdx": "tsdx --tsconfig ./tsconfig.tsdx.json",
|
|
51
|
-
"type-check": "tsc --noEmit"
|
|
63
|
+
"type-check": "tsc --noEmit",
|
|
64
|
+
"update:icons": "cp node_modules/@sanity/server/lib/static/favicons/* public"
|
|
52
65
|
},
|
|
53
66
|
"browserslist": "chrome 59, safari 11, firefox 56, edge 14, ie 11",
|
|
54
67
|
"prettier": {
|
|
@@ -65,7 +78,6 @@
|
|
|
65
78
|
"devDependencies": {
|
|
66
79
|
"@async-fn/jest": "^1.5.3",
|
|
67
80
|
"@sanity/eslint-config-studio": "^2.0.0",
|
|
68
|
-
"@semantic-release/exec": "^6.0.3",
|
|
69
81
|
"@testing-library/react-hooks": "^7.0.2",
|
|
70
82
|
"@types/eventsource": "^1.1.9",
|
|
71
83
|
"@types/jest": "^28.1.6",
|
|
@@ -105,15 +117,25 @@
|
|
|
105
117
|
"targets": {
|
|
106
118
|
"cjs": {
|
|
107
119
|
"distDir": "./lib/cjs",
|
|
108
|
-
"isLibrary": true,
|
|
109
120
|
"source": "./src/studio.ts",
|
|
110
|
-
"outputFormat": "commonjs"
|
|
121
|
+
"outputFormat": "commonjs",
|
|
122
|
+
"isLibrary": true,
|
|
123
|
+
"context": "browser",
|
|
124
|
+
"engines": {
|
|
125
|
+
"browsers": "chrome 64, safari 12, firefox 62, edge 79"
|
|
126
|
+
},
|
|
127
|
+
"includeNodeModules": false
|
|
111
128
|
},
|
|
112
129
|
"esm": {
|
|
113
130
|
"distDir": "./lib/esm",
|
|
114
|
-
"isLibrary": true,
|
|
115
131
|
"source": "./src/studio.ts",
|
|
116
|
-
"outputFormat": "esmodule"
|
|
132
|
+
"outputFormat": "esmodule",
|
|
133
|
+
"isLibrary": true,
|
|
134
|
+
"context": "browser",
|
|
135
|
+
"engines": {
|
|
136
|
+
"browsers": "chrome 64, safari 12, firefox 62, edge 79"
|
|
137
|
+
},
|
|
138
|
+
"includeNodeModules": false
|
|
117
139
|
}
|
|
118
140
|
}
|
|
119
141
|
}
|