@sanity/code-input 2.30.2-shopify.0 → 3.0.0-studio-v3.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +65 -9
- package/lib/cjs/index.js +1348 -0
- package/lib/cjs/index.js.map +1 -0
- package/lib/esm/index.js +1340 -0
- package/lib/esm/index.js.map +1 -0
- package/lib/types/index.d.ts +48 -0
- package/lib/types/index.d.ts.map +1 -0
- package/package.json +53 -15
- package/src/CodeInput.tsx +332 -0
- package/src/PreviewCode.tsx +88 -0
- package/src/config.ts +46 -0
- package/src/createHighlightMarkers.ts +24 -0
- package/src/editorSupport.ts +31 -0
- package/src/getMedia.tsx +95 -0
- package/src/groq.ts +630 -0
- package/src/index.ts +12 -0
- package/src/schema.tsx +69 -0
- package/src/types.ts +26 -0
- package/dist/dts/CodeInput.d.ts +0 -22
- package/dist/dts/CodeInput.d.ts.map +0 -1
- package/dist/dts/PreviewCode.d.ts +0 -9
- package/dist/dts/PreviewCode.d.ts.map +0 -1
- package/dist/dts/config.d.ts +0 -16
- package/dist/dts/config.d.ts.map +0 -1
- package/dist/dts/createHighlightMarkers.d.ts +0 -4
- package/dist/dts/createHighlightMarkers.d.ts.map +0 -1
- package/dist/dts/deprecatedSchema.d.ts +0 -12
- package/dist/dts/deprecatedSchema.d.ts.map +0 -1
- package/dist/dts/editorSupport.d.ts +0 -28
- package/dist/dts/editorSupport.d.ts.map +0 -1
- package/dist/dts/getMedia.d.ts +0 -3
- package/dist/dts/getMedia.d.ts.map +0 -1
- package/dist/dts/groq.d.ts +0 -376
- package/dist/dts/groq.d.ts.map +0 -1
- package/dist/dts/schema.d.ts +0 -44
- package/dist/dts/schema.d.ts.map +0 -1
- package/dist/dts/types.d.ts +0 -29
- package/dist/dts/types.d.ts.map +0 -1
- package/lib/@types/css.d.js +0 -1
- package/lib/CodeInput.js +0 -325
- package/lib/PreviewCode.js +0 -79
- package/lib/config.js +0 -103
- package/lib/createHighlightMarkers.js +0 -31
- package/lib/deprecatedSchema.js +0 -26
- package/lib/editorSupport.js +0 -55
- package/lib/getMedia.js +0 -110
- package/lib/groq.js +0 -414
- package/lib/schema.js +0 -69
- package/lib/types.js +0 -5
- package/sanity.json +0 -28
- package/tsconfig.json +0 -26
package/lib/cjs/index.js
ADDED
|
@@ -0,0 +1,1348 @@
|
|
|
1
|
+
var $k7rGe$sanity = require("sanity");
|
|
2
|
+
var $k7rGe$reactjsxruntime = require("react/jsx-runtime");
|
|
3
|
+
var $k7rGe$react = require("react");
|
|
4
|
+
var $k7rGe$sanityicons = require("@sanity/icons");
|
|
5
|
+
var $k7rGe$sanityform = require("sanity/form");
|
|
6
|
+
var $k7rGe$sanityui = require("@sanity/ui");
|
|
7
|
+
var $k7rGe$reactace = require("react-ace");
|
|
8
|
+
var $k7rGe$styledcomponents = require("styled-components");
|
|
9
|
+
require("ace-builds/src-noconflict/mode-batchfile");
|
|
10
|
+
require("ace-builds/src-noconflict/mode-csharp");
|
|
11
|
+
require("ace-builds/src-noconflict/mode-css");
|
|
12
|
+
require("ace-builds/src-noconflict/mode-golang");
|
|
13
|
+
require("ace-builds/src-noconflict/mode-html");
|
|
14
|
+
require("ace-builds/src-noconflict/mode-java");
|
|
15
|
+
require("ace-builds/src-noconflict/mode-javascript");
|
|
16
|
+
require("ace-builds/src-noconflict/mode-json");
|
|
17
|
+
require("ace-builds/src-noconflict/mode-jsx");
|
|
18
|
+
require("ace-builds/src-noconflict/mode-markdown");
|
|
19
|
+
require("ace-builds/src-noconflict/mode-mysql");
|
|
20
|
+
require("ace-builds/src-noconflict/mode-php");
|
|
21
|
+
require("ace-builds/src-noconflict/mode-python");
|
|
22
|
+
require("ace-builds/src-noconflict/mode-ruby");
|
|
23
|
+
require("ace-builds/src-noconflict/mode-sass");
|
|
24
|
+
require("ace-builds/src-noconflict/mode-scss");
|
|
25
|
+
require("ace-builds/src-noconflict/mode-sh");
|
|
26
|
+
require("ace-builds/src-noconflict/mode-text");
|
|
27
|
+
require("ace-builds/src-noconflict/mode-tsx");
|
|
28
|
+
require("ace-builds/src-noconflict/mode-typescript");
|
|
29
|
+
require("ace-builds/src-noconflict/mode-xml");
|
|
30
|
+
require("ace-builds/src-noconflict/mode-yaml");
|
|
31
|
+
require("ace-builds/src-noconflict/theme-github");
|
|
32
|
+
require("ace-builds/src-noconflict/theme-monokai");
|
|
33
|
+
require("ace-builds/src-noconflict/theme-terminal");
|
|
34
|
+
require("ace-builds/src-noconflict/theme-tomorrow");
|
|
35
|
+
|
|
36
|
+
function $parcel$export(e, n, v, s) {
|
|
37
|
+
Object.defineProperty(e, n, {get: v, set: s, enumerable: true, configurable: true});
|
|
38
|
+
}
|
|
39
|
+
function $parcel$interopDefault(a) {
|
|
40
|
+
return a && a.__esModule ? a.default : a;
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
$parcel$export(module.exports, "codeInput", () => $244e63ca53592e4d$export$d18430c17c97a000);
|
|
44
|
+
$parcel$export(module.exports, "PreviewCode", () => $15530f24e7c40879$export$2e2bcd8739ae039);
|
|
45
|
+
|
|
46
|
+
|
|
47
|
+
|
|
48
|
+
|
|
49
|
+
|
|
50
|
+
|
|
51
|
+
|
|
52
|
+
|
|
53
|
+
|
|
54
|
+
|
|
55
|
+
|
|
56
|
+
const $470a71f5fffbba1a$export$ac98e174937d3154 = (0, $k7rGe$styledcomponents.css)`
|
|
57
|
+
.ace_editor_markers_highlight {
|
|
58
|
+
position: absolute;
|
|
59
|
+
background-color: ${({ theme: theme })=>theme.sanity.color.solid.primary.enabled.bg};
|
|
60
|
+
opacity: 0.2;
|
|
61
|
+
width: 100% !important;
|
|
62
|
+
border-radius: 0 !important;
|
|
63
|
+
}
|
|
64
|
+
`;
|
|
65
|
+
function $470a71f5fffbba1a$export$2e2bcd8739ae039(rows) {
|
|
66
|
+
return rows.map((row)=>({
|
|
67
|
+
startRow: Number(row) - 1,
|
|
68
|
+
startCol: 0,
|
|
69
|
+
endRow: Number(row) - 1,
|
|
70
|
+
endCol: Infinity,
|
|
71
|
+
className: "ace_editor_markers_highlight",
|
|
72
|
+
type: "screenLine",
|
|
73
|
+
inFront: true
|
|
74
|
+
}));
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
|
|
78
|
+
// Grammar from https://github.com/sanity-io/vscode-sanity
|
|
79
|
+
const $d39e1144f2b19512$var$rules = {
|
|
80
|
+
start: [
|
|
81
|
+
{
|
|
82
|
+
include: "#query"
|
|
83
|
+
},
|
|
84
|
+
{
|
|
85
|
+
include: "#value"
|
|
86
|
+
},
|
|
87
|
+
{
|
|
88
|
+
include: "#pair"
|
|
89
|
+
},
|
|
90
|
+
],
|
|
91
|
+
"#query": [
|
|
92
|
+
{
|
|
93
|
+
include: "#nullary-access-operator"
|
|
94
|
+
},
|
|
95
|
+
{
|
|
96
|
+
include: "#arraylike"
|
|
97
|
+
},
|
|
98
|
+
{
|
|
99
|
+
include: "#pipe"
|
|
100
|
+
},
|
|
101
|
+
{
|
|
102
|
+
include: "#sort-order"
|
|
103
|
+
},
|
|
104
|
+
{
|
|
105
|
+
include: "#filter"
|
|
106
|
+
},
|
|
107
|
+
],
|
|
108
|
+
"#variable": [
|
|
109
|
+
{
|
|
110
|
+
token: "variable.other.groq",
|
|
111
|
+
regex: /\$[_A-Za-z][_0-9A-Za-z]*/
|
|
112
|
+
},
|
|
113
|
+
],
|
|
114
|
+
"#keyword": [
|
|
115
|
+
{
|
|
116
|
+
token: "keyword.other.groq",
|
|
117
|
+
regex: /\b(?:asc|desc|in|match)\b/
|
|
118
|
+
},
|
|
119
|
+
],
|
|
120
|
+
"#comparison": [
|
|
121
|
+
{
|
|
122
|
+
token: "keyword.operator.comparison.groq",
|
|
123
|
+
// eslint-disable-next-line no-div-regex
|
|
124
|
+
regex: /==|!=|>=|<=|<!=>|<|>/
|
|
125
|
+
},
|
|
126
|
+
],
|
|
127
|
+
"#operator": [
|
|
128
|
+
{
|
|
129
|
+
token: "keyword.operator.arithmetic.groq",
|
|
130
|
+
regex: /\+|-|\*{1,2}|\/|%/
|
|
131
|
+
},
|
|
132
|
+
],
|
|
133
|
+
"#pipe": [
|
|
134
|
+
{
|
|
135
|
+
token: "keyword.operator.pipe.groq",
|
|
136
|
+
regex: /\|/
|
|
137
|
+
},
|
|
138
|
+
],
|
|
139
|
+
"#logical": [
|
|
140
|
+
{
|
|
141
|
+
token: "keyword.operator.logical.groq",
|
|
142
|
+
regex: /!|&&|\|\|/
|
|
143
|
+
},
|
|
144
|
+
],
|
|
145
|
+
"#reference": [
|
|
146
|
+
{
|
|
147
|
+
token: "keyword.operator.reference.groq",
|
|
148
|
+
regex: /->/
|
|
149
|
+
},
|
|
150
|
+
],
|
|
151
|
+
"#pair": [
|
|
152
|
+
{
|
|
153
|
+
include: "#identifier"
|
|
154
|
+
},
|
|
155
|
+
{
|
|
156
|
+
include: "#value"
|
|
157
|
+
},
|
|
158
|
+
{
|
|
159
|
+
include: "#filter"
|
|
160
|
+
},
|
|
161
|
+
{
|
|
162
|
+
token: "keyword.operator.pair.groq",
|
|
163
|
+
regex: /[=]>/
|
|
164
|
+
},
|
|
165
|
+
],
|
|
166
|
+
"#arraylike": [
|
|
167
|
+
{
|
|
168
|
+
token: "punctuation.definition.bracket.begin.groq",
|
|
169
|
+
regex: /\[/,
|
|
170
|
+
push: [
|
|
171
|
+
{
|
|
172
|
+
token: [
|
|
173
|
+
"text",
|
|
174
|
+
"keyword.operator.descendant.groq"
|
|
175
|
+
],
|
|
176
|
+
regex: /(\])((?:\s*\.)?)/,
|
|
177
|
+
next: "pop"
|
|
178
|
+
},
|
|
179
|
+
{
|
|
180
|
+
include: "#range"
|
|
181
|
+
},
|
|
182
|
+
{
|
|
183
|
+
include: "#filter"
|
|
184
|
+
},
|
|
185
|
+
{
|
|
186
|
+
include: "#array-values"
|
|
187
|
+
},
|
|
188
|
+
]
|
|
189
|
+
},
|
|
190
|
+
],
|
|
191
|
+
"#array": [
|
|
192
|
+
{
|
|
193
|
+
token: "punctuation.definition.bracket.begin.groq",
|
|
194
|
+
regex: /\[/,
|
|
195
|
+
push: [
|
|
196
|
+
{
|
|
197
|
+
token: "punctuation.definition.bracket.end.groq",
|
|
198
|
+
regex: /\]/,
|
|
199
|
+
next: "pop"
|
|
200
|
+
},
|
|
201
|
+
{
|
|
202
|
+
include: "#array-values"
|
|
203
|
+
},
|
|
204
|
+
{
|
|
205
|
+
defaultToken: "meta.structure.array.groq"
|
|
206
|
+
},
|
|
207
|
+
]
|
|
208
|
+
},
|
|
209
|
+
],
|
|
210
|
+
"#range": [
|
|
211
|
+
{
|
|
212
|
+
token: [
|
|
213
|
+
"meta.structure.range.groq",
|
|
214
|
+
"constant.numeric.groq",
|
|
215
|
+
"meta.structure.range.groq",
|
|
216
|
+
"keyword.operator.range.groq",
|
|
217
|
+
"meta.structure.range.groq",
|
|
218
|
+
"constant.numeric.groq",
|
|
219
|
+
"meta.structure.range.groq",
|
|
220
|
+
],
|
|
221
|
+
regex: /(\s*)(\d+)(\s*)(\.{2,3})(\s*)(\d+)(\s*)/
|
|
222
|
+
},
|
|
223
|
+
],
|
|
224
|
+
"#spread": [
|
|
225
|
+
{
|
|
226
|
+
token: "punctuation.definition.spread.begin.groq",
|
|
227
|
+
regex: /\.\.\./,
|
|
228
|
+
push: [
|
|
229
|
+
{
|
|
230
|
+
include: "#array"
|
|
231
|
+
},
|
|
232
|
+
{
|
|
233
|
+
include: "#function-call"
|
|
234
|
+
},
|
|
235
|
+
{
|
|
236
|
+
include: "#projection"
|
|
237
|
+
},
|
|
238
|
+
{
|
|
239
|
+
token: "punctuation.definition.spread.end.groq",
|
|
240
|
+
regex: /(?=.)/,
|
|
241
|
+
next: "pop"
|
|
242
|
+
},
|
|
243
|
+
{
|
|
244
|
+
defaultToken: "meta.structure.spread.groq"
|
|
245
|
+
},
|
|
246
|
+
]
|
|
247
|
+
},
|
|
248
|
+
],
|
|
249
|
+
"#array-values": [
|
|
250
|
+
{
|
|
251
|
+
include: "#value"
|
|
252
|
+
},
|
|
253
|
+
{
|
|
254
|
+
include: "#spread"
|
|
255
|
+
},
|
|
256
|
+
{
|
|
257
|
+
token: "punctuation.separator.array.groq",
|
|
258
|
+
regex: /,/
|
|
259
|
+
},
|
|
260
|
+
{
|
|
261
|
+
token: "invalid.illegal.expected-array-separator.groq",
|
|
262
|
+
regex: /[^\s\]]/
|
|
263
|
+
},
|
|
264
|
+
],
|
|
265
|
+
"#filter": [
|
|
266
|
+
{
|
|
267
|
+
include: "#function-call"
|
|
268
|
+
},
|
|
269
|
+
{
|
|
270
|
+
include: "#keyword"
|
|
271
|
+
},
|
|
272
|
+
{
|
|
273
|
+
include: "#constant"
|
|
274
|
+
},
|
|
275
|
+
{
|
|
276
|
+
include: "#identifier"
|
|
277
|
+
},
|
|
278
|
+
{
|
|
279
|
+
include: "#value"
|
|
280
|
+
},
|
|
281
|
+
{
|
|
282
|
+
include: "#comparison"
|
|
283
|
+
},
|
|
284
|
+
{
|
|
285
|
+
include: "#operator"
|
|
286
|
+
},
|
|
287
|
+
{
|
|
288
|
+
include: "#logical"
|
|
289
|
+
},
|
|
290
|
+
],
|
|
291
|
+
"#comments": [
|
|
292
|
+
{
|
|
293
|
+
token: [
|
|
294
|
+
"punctuation.definition.comment.groq",
|
|
295
|
+
"comment.line.double-slash.js"
|
|
296
|
+
],
|
|
297
|
+
regex: /(\/\/)(.*$)/
|
|
298
|
+
},
|
|
299
|
+
],
|
|
300
|
+
"#nullary-access-operator": [
|
|
301
|
+
{
|
|
302
|
+
token: "constant.language.groq",
|
|
303
|
+
regex: /[*@^]/
|
|
304
|
+
},
|
|
305
|
+
],
|
|
306
|
+
"#constant": [
|
|
307
|
+
{
|
|
308
|
+
token: "constant.language.groq",
|
|
309
|
+
regex: /\b(?:true|false|null)\b/
|
|
310
|
+
},
|
|
311
|
+
],
|
|
312
|
+
"#number": [
|
|
313
|
+
{
|
|
314
|
+
token: "constant.numeric.groq",
|
|
315
|
+
regex: /-?(?:0|[1-9]\d*)(?:(?:\.\d+)?(?:[eE][+-]?\d+)?)?/
|
|
316
|
+
},
|
|
317
|
+
],
|
|
318
|
+
"#named-projection": [
|
|
319
|
+
{
|
|
320
|
+
include: "#identifier"
|
|
321
|
+
},
|
|
322
|
+
{
|
|
323
|
+
include: "#objectkey"
|
|
324
|
+
},
|
|
325
|
+
{
|
|
326
|
+
include: "#projection"
|
|
327
|
+
},
|
|
328
|
+
],
|
|
329
|
+
"#projection": [
|
|
330
|
+
{
|
|
331
|
+
token: "punctuation.definition.projection.begin.groq",
|
|
332
|
+
regex: /\{/,
|
|
333
|
+
push: [
|
|
334
|
+
{
|
|
335
|
+
token: "punctuation.definition.projection.end.groq",
|
|
336
|
+
regex: /\}/,
|
|
337
|
+
next: "pop"
|
|
338
|
+
},
|
|
339
|
+
{
|
|
340
|
+
include: "#identifier"
|
|
341
|
+
},
|
|
342
|
+
{
|
|
343
|
+
include: "#objectkey"
|
|
344
|
+
},
|
|
345
|
+
{
|
|
346
|
+
include: "#named-projection"
|
|
347
|
+
},
|
|
348
|
+
{
|
|
349
|
+
include: "#comments"
|
|
350
|
+
},
|
|
351
|
+
{
|
|
352
|
+
include: "#spread"
|
|
353
|
+
},
|
|
354
|
+
{
|
|
355
|
+
include: "#pair"
|
|
356
|
+
},
|
|
357
|
+
{
|
|
358
|
+
token: "punctuation.separator.projection.key-value.groq",
|
|
359
|
+
regex: /:/,
|
|
360
|
+
push: [
|
|
361
|
+
{
|
|
362
|
+
token: "punctuation.separator.projection.pair.groq",
|
|
363
|
+
regex: /,|(?=\})/,
|
|
364
|
+
next: "pop"
|
|
365
|
+
},
|
|
366
|
+
{
|
|
367
|
+
include: "#nullary-access-operator"
|
|
368
|
+
},
|
|
369
|
+
{
|
|
370
|
+
include: "#arraylike"
|
|
371
|
+
},
|
|
372
|
+
{
|
|
373
|
+
include: "#value"
|
|
374
|
+
},
|
|
375
|
+
{
|
|
376
|
+
include: "#spread"
|
|
377
|
+
},
|
|
378
|
+
{
|
|
379
|
+
include: "#identifier"
|
|
380
|
+
},
|
|
381
|
+
{
|
|
382
|
+
include: "#operator"
|
|
383
|
+
},
|
|
384
|
+
{
|
|
385
|
+
include: "#comparison"
|
|
386
|
+
},
|
|
387
|
+
{
|
|
388
|
+
include: "#pair"
|
|
389
|
+
},
|
|
390
|
+
{
|
|
391
|
+
token: "invalid.illegal.expected-projection-separator.groq",
|
|
392
|
+
regex: /[^\s,]/
|
|
393
|
+
},
|
|
394
|
+
{
|
|
395
|
+
defaultToken: "meta.structure.projection.value.groq"
|
|
396
|
+
},
|
|
397
|
+
]
|
|
398
|
+
},
|
|
399
|
+
{
|
|
400
|
+
token: "invalid.illegal.expected-projection-separator.groq",
|
|
401
|
+
regex: /[^\s},]/
|
|
402
|
+
},
|
|
403
|
+
{
|
|
404
|
+
defaultToken: "meta.structure.projection.groq"
|
|
405
|
+
},
|
|
406
|
+
]
|
|
407
|
+
},
|
|
408
|
+
],
|
|
409
|
+
"#string": [
|
|
410
|
+
{
|
|
411
|
+
include: "#single-string"
|
|
412
|
+
},
|
|
413
|
+
{
|
|
414
|
+
include: "#double-string"
|
|
415
|
+
},
|
|
416
|
+
],
|
|
417
|
+
"#double-string": [
|
|
418
|
+
{
|
|
419
|
+
token: "punctuation.definition.string.begin.groq",
|
|
420
|
+
regex: /"/,
|
|
421
|
+
push: [
|
|
422
|
+
{
|
|
423
|
+
token: "punctuation.definition.string.end.groq",
|
|
424
|
+
regex: /"/,
|
|
425
|
+
next: "pop"
|
|
426
|
+
},
|
|
427
|
+
{
|
|
428
|
+
include: "#stringcontent"
|
|
429
|
+
},
|
|
430
|
+
{
|
|
431
|
+
defaultToken: "string.quoted.double.groq"
|
|
432
|
+
},
|
|
433
|
+
]
|
|
434
|
+
},
|
|
435
|
+
],
|
|
436
|
+
"#single-string": [
|
|
437
|
+
{
|
|
438
|
+
token: "punctuation.definition.string.single.begin.groq",
|
|
439
|
+
regex: /'/,
|
|
440
|
+
push: [
|
|
441
|
+
{
|
|
442
|
+
token: "punctuation.definition.string.single.end.groq",
|
|
443
|
+
regex: /'/,
|
|
444
|
+
next: "pop"
|
|
445
|
+
},
|
|
446
|
+
{
|
|
447
|
+
include: "#stringcontent"
|
|
448
|
+
},
|
|
449
|
+
{
|
|
450
|
+
defaultToken: "string.quoted.single.groq"
|
|
451
|
+
},
|
|
452
|
+
]
|
|
453
|
+
},
|
|
454
|
+
],
|
|
455
|
+
"#objectkey": [
|
|
456
|
+
{
|
|
457
|
+
include: "#string"
|
|
458
|
+
},
|
|
459
|
+
],
|
|
460
|
+
"#stringcontent": [
|
|
461
|
+
{
|
|
462
|
+
token: "constant.character.escape.groq",
|
|
463
|
+
regex: /\\(?:["\\/bfnrt]|u[0-9a-fA-F]{4})/
|
|
464
|
+
},
|
|
465
|
+
{
|
|
466
|
+
token: "invalid.illegal.unrecognized-string-escape.groq",
|
|
467
|
+
regex: /\\./
|
|
468
|
+
},
|
|
469
|
+
],
|
|
470
|
+
"#sort-pair": [
|
|
471
|
+
{
|
|
472
|
+
token: [
|
|
473
|
+
"variable.other.readwrite.groq",
|
|
474
|
+
"text",
|
|
475
|
+
"keyword.other.groq"
|
|
476
|
+
],
|
|
477
|
+
regex: /([_A-Za-z][_0-9A-Za-z]*)(?:(\s*)(asc|desc))?/
|
|
478
|
+
},
|
|
479
|
+
{
|
|
480
|
+
token: [
|
|
481
|
+
"constant.language.groq",
|
|
482
|
+
"punctuation.definition.bracket.begin.groq"
|
|
483
|
+
],
|
|
484
|
+
regex: /(@)(\[)/,
|
|
485
|
+
push: [
|
|
486
|
+
{
|
|
487
|
+
token: [
|
|
488
|
+
"punctuation.definition.bracket.begin.groq",
|
|
489
|
+
"text",
|
|
490
|
+
"keyword.other.groq"
|
|
491
|
+
],
|
|
492
|
+
regex: /(\])(?:(\s*)(asc|desc))?/,
|
|
493
|
+
next: "pop"
|
|
494
|
+
},
|
|
495
|
+
{
|
|
496
|
+
include: "#string"
|
|
497
|
+
},
|
|
498
|
+
]
|
|
499
|
+
},
|
|
500
|
+
],
|
|
501
|
+
"#sort-order": [
|
|
502
|
+
{
|
|
503
|
+
token: "support.function.sortorder.begin.groq",
|
|
504
|
+
regex: /\border\s*\(/,
|
|
505
|
+
push: [
|
|
506
|
+
{
|
|
507
|
+
token: "support.function.sortorder.end.groq",
|
|
508
|
+
regex: /\)/,
|
|
509
|
+
next: "pop"
|
|
510
|
+
},
|
|
511
|
+
{
|
|
512
|
+
include: "#sort-pair"
|
|
513
|
+
},
|
|
514
|
+
{
|
|
515
|
+
token: "punctuation.separator.array.groq",
|
|
516
|
+
regex: /,/
|
|
517
|
+
},
|
|
518
|
+
{
|
|
519
|
+
token: "invalid.illegal.expected-sort-separator.groq",
|
|
520
|
+
regex: /[^\s\]]/
|
|
521
|
+
},
|
|
522
|
+
{
|
|
523
|
+
defaultToken: "support.function.sortorder.groq"
|
|
524
|
+
},
|
|
525
|
+
]
|
|
526
|
+
},
|
|
527
|
+
],
|
|
528
|
+
"#function-call": [
|
|
529
|
+
{
|
|
530
|
+
include: "#function-var-arg"
|
|
531
|
+
},
|
|
532
|
+
{
|
|
533
|
+
include: "#function-single-arg"
|
|
534
|
+
},
|
|
535
|
+
{
|
|
536
|
+
include: "#function-round"
|
|
537
|
+
},
|
|
538
|
+
],
|
|
539
|
+
"#function-var-arg": [
|
|
540
|
+
{
|
|
541
|
+
token: "support.function.vararg.begin.groq",
|
|
542
|
+
regex: /\b(?:coalesce|select)\s*\(/,
|
|
543
|
+
push: [
|
|
544
|
+
{
|
|
545
|
+
token: "support.function.vararg.end.groq",
|
|
546
|
+
regex: /\)/,
|
|
547
|
+
next: "pop"
|
|
548
|
+
},
|
|
549
|
+
{
|
|
550
|
+
include: "#value"
|
|
551
|
+
},
|
|
552
|
+
{
|
|
553
|
+
include: "#identifier"
|
|
554
|
+
},
|
|
555
|
+
{
|
|
556
|
+
include: "#filter"
|
|
557
|
+
},
|
|
558
|
+
{
|
|
559
|
+
include: "#pair"
|
|
560
|
+
},
|
|
561
|
+
{
|
|
562
|
+
token: "punctuation.separator.array.groq",
|
|
563
|
+
regex: /,/
|
|
564
|
+
},
|
|
565
|
+
{
|
|
566
|
+
defaultToken: "support.function.vararg.groq"
|
|
567
|
+
},
|
|
568
|
+
]
|
|
569
|
+
},
|
|
570
|
+
],
|
|
571
|
+
"#function-single-arg": [
|
|
572
|
+
{
|
|
573
|
+
token: "support.function.singlearg.begin.groq",
|
|
574
|
+
regex: /\b(?:count|defined|length|path|references)\s*\(/,
|
|
575
|
+
push: [
|
|
576
|
+
{
|
|
577
|
+
token: "support.function.singlearg.end.groq",
|
|
578
|
+
regex: /\)/,
|
|
579
|
+
next: "pop"
|
|
580
|
+
},
|
|
581
|
+
{
|
|
582
|
+
include: "#query"
|
|
583
|
+
},
|
|
584
|
+
{
|
|
585
|
+
include: "#identifier"
|
|
586
|
+
},
|
|
587
|
+
{
|
|
588
|
+
include: "#value"
|
|
589
|
+
},
|
|
590
|
+
{
|
|
591
|
+
include: "#pair"
|
|
592
|
+
},
|
|
593
|
+
{
|
|
594
|
+
defaultToken: "support.function.singlearg.groq"
|
|
595
|
+
},
|
|
596
|
+
]
|
|
597
|
+
},
|
|
598
|
+
],
|
|
599
|
+
"#identifier": [
|
|
600
|
+
{
|
|
601
|
+
token: [
|
|
602
|
+
"variable.other.readwrite.groq",
|
|
603
|
+
"text",
|
|
604
|
+
"punctuation.definition.block.js",
|
|
605
|
+
"text",
|
|
606
|
+
"keyword.operator.reference.groq",
|
|
607
|
+
],
|
|
608
|
+
regex: /([_A-Za-z][_0-9A-Za-z]*)(\s*)((?:\[\s*\])?)(\s*)(->)/
|
|
609
|
+
},
|
|
610
|
+
{
|
|
611
|
+
token: [
|
|
612
|
+
"variable.other.readwrite.groq",
|
|
613
|
+
"constant.language.groq",
|
|
614
|
+
"text",
|
|
615
|
+
"punctuation.definition.block.js",
|
|
616
|
+
"text",
|
|
617
|
+
"keyword.operator.descendant.groq",
|
|
618
|
+
],
|
|
619
|
+
regex: /(?:([_A-Za-z][_0-9A-Za-z]*)|([@^]))(\s*)((?:\[\s*\])?)(\s*)(\.)/
|
|
620
|
+
},
|
|
621
|
+
{
|
|
622
|
+
token: "variable.other.readwrite.groq",
|
|
623
|
+
regex: /[_A-Za-z][_0-9A-Za-z]*/
|
|
624
|
+
},
|
|
625
|
+
],
|
|
626
|
+
"#value": [
|
|
627
|
+
{
|
|
628
|
+
include: "#constant"
|
|
629
|
+
},
|
|
630
|
+
{
|
|
631
|
+
include: "#number"
|
|
632
|
+
},
|
|
633
|
+
{
|
|
634
|
+
include: "#string"
|
|
635
|
+
},
|
|
636
|
+
{
|
|
637
|
+
include: "#array"
|
|
638
|
+
},
|
|
639
|
+
{
|
|
640
|
+
include: "#variable"
|
|
641
|
+
},
|
|
642
|
+
{
|
|
643
|
+
include: "#projection"
|
|
644
|
+
},
|
|
645
|
+
{
|
|
646
|
+
include: "#comments"
|
|
647
|
+
},
|
|
648
|
+
{
|
|
649
|
+
include: "#function-call"
|
|
650
|
+
},
|
|
651
|
+
]
|
|
652
|
+
};
|
|
653
|
+
ace.define("ace/mode/groq_highlight_rules", [
|
|
654
|
+
"require",
|
|
655
|
+
"exports",
|
|
656
|
+
"module",
|
|
657
|
+
"ace/lib/oop",
|
|
658
|
+
"ace/mode/text_highlight_rules"
|
|
659
|
+
], (acequire, exports, _module)=>{
|
|
660
|
+
const oop = acequire("../lib/oop");
|
|
661
|
+
const TextHighlightRules = acequire("./text_highlight_rules").TextHighlightRules;
|
|
662
|
+
const GroqHighlightRules = function() {
|
|
663
|
+
/* eslint-disable @typescript-eslint/ban-ts-comment */ // @ts-ignore
|
|
664
|
+
this.$rules = $d39e1144f2b19512$var$rules;
|
|
665
|
+
// @ts-ignore
|
|
666
|
+
this.normalizeRules();
|
|
667
|
+
/* eslint-enable @typescript-eslint/ban-ts-comment */ };
|
|
668
|
+
oop.inherits(GroqHighlightRules, TextHighlightRules);
|
|
669
|
+
exports.GroqHighlightRules = GroqHighlightRules;
|
|
670
|
+
});
|
|
671
|
+
ace.define("ace/mode/groq", [
|
|
672
|
+
"require",
|
|
673
|
+
"exports",
|
|
674
|
+
"module",
|
|
675
|
+
"ace/lib/oop",
|
|
676
|
+
"ace/mode/text",
|
|
677
|
+
"ace/tokenizer",
|
|
678
|
+
"ace/mode/groq_highlight_rules",
|
|
679
|
+
"ace/mode/folding/cstyle",
|
|
680
|
+
], (acequire, exports, _module)=>{
|
|
681
|
+
// eslint-disable-next-line strict
|
|
682
|
+
"use strict";
|
|
683
|
+
const oop = acequire("../lib/oop");
|
|
684
|
+
const TextMode = acequire("./text").Mode;
|
|
685
|
+
const Tokenizer = acequire("../tokenizer").Tokenizer;
|
|
686
|
+
const GroqHighlightRules = acequire("./groq_highlight_rules").GroqHighlightRules;
|
|
687
|
+
const FoldMode = acequire("./folding/cstyle").FoldMode;
|
|
688
|
+
const Mode = function() {
|
|
689
|
+
/* eslint-disable @typescript-eslint/ban-ts-comment */ const highlighter = new GroqHighlightRules();
|
|
690
|
+
// @ts-ignore
|
|
691
|
+
this.foldingRules = new FoldMode();
|
|
692
|
+
// @ts-ignore
|
|
693
|
+
this.$tokenizer = new Tokenizer(highlighter.getRules());
|
|
694
|
+
// @ts-ignore
|
|
695
|
+
this.$keywordList = highlighter.$keywordList;
|
|
696
|
+
/* eslint-enable @typescript-eslint/ban-ts-comment */ };
|
|
697
|
+
oop.inherits(Mode, TextMode);
|
|
698
|
+
(function() {
|
|
699
|
+
/* eslint-disable @typescript-eslint/ban-ts-comment */ // @ts-ignore
|
|
700
|
+
this.lineCommentStart = "'";
|
|
701
|
+
/* eslint-enable @typescript-eslint/ban-ts-comment */ }).call(Mode.prototype);
|
|
702
|
+
exports.Mode = Mode;
|
|
703
|
+
});
|
|
704
|
+
|
|
705
|
+
|
|
706
|
+
|
|
707
|
+
|
|
708
|
+
|
|
709
|
+
|
|
710
|
+
|
|
711
|
+
|
|
712
|
+
|
|
713
|
+
|
|
714
|
+
|
|
715
|
+
|
|
716
|
+
|
|
717
|
+
|
|
718
|
+
|
|
719
|
+
|
|
720
|
+
|
|
721
|
+
|
|
722
|
+
|
|
723
|
+
|
|
724
|
+
|
|
725
|
+
|
|
726
|
+
|
|
727
|
+
|
|
728
|
+
|
|
729
|
+
|
|
730
|
+
|
|
731
|
+
|
|
732
|
+
|
|
733
|
+
|
|
734
|
+
const $8fdae771dbccc774$export$7c77c3a9bb93870d = [
|
|
735
|
+
{
|
|
736
|
+
title: "Batch file",
|
|
737
|
+
value: "batchfile"
|
|
738
|
+
},
|
|
739
|
+
{
|
|
740
|
+
title: "C#",
|
|
741
|
+
value: "csharp"
|
|
742
|
+
},
|
|
743
|
+
{
|
|
744
|
+
title: "CSS",
|
|
745
|
+
value: "css"
|
|
746
|
+
},
|
|
747
|
+
{
|
|
748
|
+
title: "Go",
|
|
749
|
+
value: "golang"
|
|
750
|
+
},
|
|
751
|
+
{
|
|
752
|
+
title: "GROQ",
|
|
753
|
+
value: "groq"
|
|
754
|
+
},
|
|
755
|
+
{
|
|
756
|
+
title: "HTML",
|
|
757
|
+
value: "html"
|
|
758
|
+
},
|
|
759
|
+
{
|
|
760
|
+
title: "Java",
|
|
761
|
+
value: "java"
|
|
762
|
+
},
|
|
763
|
+
{
|
|
764
|
+
title: "JavaScript",
|
|
765
|
+
value: "javascript"
|
|
766
|
+
},
|
|
767
|
+
{
|
|
768
|
+
title: "JSON",
|
|
769
|
+
value: "json"
|
|
770
|
+
},
|
|
771
|
+
{
|
|
772
|
+
title: "JSX",
|
|
773
|
+
value: "jsx"
|
|
774
|
+
},
|
|
775
|
+
{
|
|
776
|
+
title: "Markdown",
|
|
777
|
+
value: "markdown"
|
|
778
|
+
},
|
|
779
|
+
{
|
|
780
|
+
title: "MySQL",
|
|
781
|
+
value: "mysql"
|
|
782
|
+
},
|
|
783
|
+
{
|
|
784
|
+
title: "PHP",
|
|
785
|
+
value: "php"
|
|
786
|
+
},
|
|
787
|
+
{
|
|
788
|
+
title: "Plain text",
|
|
789
|
+
value: "text"
|
|
790
|
+
},
|
|
791
|
+
{
|
|
792
|
+
title: "Python",
|
|
793
|
+
value: "python"
|
|
794
|
+
},
|
|
795
|
+
{
|
|
796
|
+
title: "Ruby",
|
|
797
|
+
value: "ruby"
|
|
798
|
+
},
|
|
799
|
+
{
|
|
800
|
+
title: "SASS",
|
|
801
|
+
value: "sass"
|
|
802
|
+
},
|
|
803
|
+
{
|
|
804
|
+
title: "SCSS",
|
|
805
|
+
value: "scss"
|
|
806
|
+
},
|
|
807
|
+
{
|
|
808
|
+
title: "sh",
|
|
809
|
+
value: "sh"
|
|
810
|
+
},
|
|
811
|
+
{
|
|
812
|
+
title: "TSX",
|
|
813
|
+
value: "tsx"
|
|
814
|
+
},
|
|
815
|
+
{
|
|
816
|
+
title: "TypeScript",
|
|
817
|
+
value: "typescript"
|
|
818
|
+
},
|
|
819
|
+
{
|
|
820
|
+
title: "XML",
|
|
821
|
+
value: "xml"
|
|
822
|
+
},
|
|
823
|
+
{
|
|
824
|
+
title: "YAML",
|
|
825
|
+
value: "yaml"
|
|
826
|
+
},
|
|
827
|
+
];
|
|
828
|
+
const $8fdae771dbccc774$export$eee7619b712ad3ea = {
|
|
829
|
+
js: "javascript"
|
|
830
|
+
};
|
|
831
|
+
const $8fdae771dbccc774$export$b524d09a6fa74640 = [
|
|
832
|
+
"github",
|
|
833
|
+
"monokai",
|
|
834
|
+
"terminal",
|
|
835
|
+
"tomorrow"
|
|
836
|
+
];
|
|
837
|
+
const $8fdae771dbccc774$export$2faeed762aac6741 = "tomorrow";
|
|
838
|
+
const $8fdae771dbccc774$export$5932020c8339f18b = "monokai";
|
|
839
|
+
const $8fdae771dbccc774$export$1d910bb34606e145 = {
|
|
840
|
+
useSoftTabs: true,
|
|
841
|
+
navigateWithinSoftTabs: true
|
|
842
|
+
};
|
|
843
|
+
const $8fdae771dbccc774$export$24aa1be5d8c3cd08 = {
|
|
844
|
+
$blockScrolling: true
|
|
845
|
+
};
|
|
846
|
+
const $8fdae771dbccc774$export$ed1ca6559dfc13f7 = [
|
|
847
|
+
"language"
|
|
848
|
+
];
|
|
849
|
+
const $8fdae771dbccc774$export$e1d3cf7d57c23d0f = [
|
|
850
|
+
"code"
|
|
851
|
+
];
|
|
852
|
+
const $8fdae771dbccc774$export$4f74600301fa25db = [
|
|
853
|
+
"filename"
|
|
854
|
+
];
|
|
855
|
+
|
|
856
|
+
|
|
857
|
+
|
|
858
|
+
const $293e4fb68be52bc5$var$EditorContainer = (0, ($parcel$interopDefault($k7rGe$styledcomponents)))((0, $k7rGe$sanityui.Card))`
|
|
859
|
+
position: relative;
|
|
860
|
+
box-sizing: border-box;
|
|
861
|
+
overflow: hidden;
|
|
862
|
+
z-index: 0;
|
|
863
|
+
|
|
864
|
+
.ace_editor {
|
|
865
|
+
font-family: ${({ theme: theme })=>theme.sanity.fonts.code.family};
|
|
866
|
+
font-size: ${({ theme: theme })=>theme.sanity.fonts.code.sizes[1]};
|
|
867
|
+
line-height: inherit;
|
|
868
|
+
}
|
|
869
|
+
|
|
870
|
+
${(0, $470a71f5fffbba1a$export$ac98e174937d3154)}
|
|
871
|
+
|
|
872
|
+
&:not([disabled]):not([readonly]) {
|
|
873
|
+
&:focus,
|
|
874
|
+
&:focus-within {
|
|
875
|
+
box-shadow: 0 0 0 2px ${({ theme: theme })=>theme.sanity.color.base.focusRing};
|
|
876
|
+
background-color: ${({ theme: theme })=>theme.sanity.color.base.bg};
|
|
877
|
+
border-color: ${({ theme: theme })=>theme.sanity.color.base.focusRing};
|
|
878
|
+
}
|
|
879
|
+
}
|
|
880
|
+
`;
|
|
881
|
+
// Returns a string with the mode name if supported (because aliases), otherwise false
|
|
882
|
+
function $293e4fb68be52bc5$var$isSupportedLanguage(mode) {
|
|
883
|
+
const alias = (0, $8fdae771dbccc774$export$eee7619b712ad3ea)[mode];
|
|
884
|
+
if (alias) return alias;
|
|
885
|
+
const isSupported = (0, $8fdae771dbccc774$export$7c77c3a9bb93870d).find((lang)=>lang.value === mode);
|
|
886
|
+
if (isSupported) return mode;
|
|
887
|
+
return false;
|
|
888
|
+
}
|
|
889
|
+
function $293e4fb68be52bc5$export$20d4ca75cb144ab0(props) {
|
|
890
|
+
const { focusRef: focusRef , members: members , onBlur: onBlur , onChange: onChange , onFocusPath: onFocusPath , readOnly: readOnly , renderField: renderField , renderInput: renderInput , renderItem: renderItem , schemaType: type , value: value , } = props;
|
|
891
|
+
const aceEditorRef = (0, $k7rGe$react.useRef)();
|
|
892
|
+
const fieldMembers = (0, $k7rGe$react.useMemo)(()=>members.filter((member)=>member.kind === "field"), [
|
|
893
|
+
members
|
|
894
|
+
]);
|
|
895
|
+
const languageFieldMember = fieldMembers.find((member)=>member.name === "language");
|
|
896
|
+
const filenameMember = fieldMembers.find((member)=>member.name === "filename");
|
|
897
|
+
const codeFieldMember = fieldMembers.find((member)=>member.name === "code");
|
|
898
|
+
(0, $k7rGe$react.useImperativeHandle)(focusRef, ()=>({
|
|
899
|
+
focus: ()=>{
|
|
900
|
+
aceEditorRef?.current?.editor?.focus();
|
|
901
|
+
}
|
|
902
|
+
}));
|
|
903
|
+
const handleCodeFocus = (0, $k7rGe$react.useCallback)(()=>{
|
|
904
|
+
onFocusPath((0, $8fdae771dbccc774$export$e1d3cf7d57c23d0f));
|
|
905
|
+
}, [
|
|
906
|
+
onFocusPath
|
|
907
|
+
]);
|
|
908
|
+
const { scheme: scheme } = (0, $k7rGe$sanity.useColorScheme)();
|
|
909
|
+
const theme = (0, $k7rGe$react.useMemo)(()=>{
|
|
910
|
+
const isLight = scheme === "light";
|
|
911
|
+
const preferredTheme = isLight ? type.options?.theme : type.options?.darkTheme;
|
|
912
|
+
const defaultTheme = isLight ? (0, $8fdae771dbccc774$export$2faeed762aac6741) : (0, $8fdae771dbccc774$export$5932020c8339f18b);
|
|
913
|
+
return preferredTheme && (0, $8fdae771dbccc774$export$b524d09a6fa74640).find((t)=>t === preferredTheme) ? preferredTheme : defaultTheme;
|
|
914
|
+
}, [
|
|
915
|
+
type,
|
|
916
|
+
scheme
|
|
917
|
+
]);
|
|
918
|
+
const handleToggleSelectLine = (0, $k7rGe$react.useCallback)((lineNumber)=>{
|
|
919
|
+
const editorSession = aceEditorRef.current?.editor?.getSession();
|
|
920
|
+
const backgroundMarkers = editorSession?.getMarkers(true);
|
|
921
|
+
const currentHighlightedLines = Object.keys(backgroundMarkers).filter((key)=>backgroundMarkers[key].type === "screenLine").map((key)=>backgroundMarkers[key].range.start.row);
|
|
922
|
+
const currentIndex = currentHighlightedLines.indexOf(lineNumber);
|
|
923
|
+
if (currentIndex > -1) // toggle remove
|
|
924
|
+
currentHighlightedLines.splice(currentIndex, 1);
|
|
925
|
+
else {
|
|
926
|
+
// toggle add
|
|
927
|
+
currentHighlightedLines.push(lineNumber);
|
|
928
|
+
currentHighlightedLines.sort();
|
|
929
|
+
}
|
|
930
|
+
onChange((0, $k7rGe$sanityform.set)(currentHighlightedLines.map((line)=>// ace starts at line (row) 0, but we store it starting at line 1
|
|
931
|
+
line + 1), [
|
|
932
|
+
"highlightedLines"
|
|
933
|
+
]));
|
|
934
|
+
}, [
|
|
935
|
+
aceEditorRef,
|
|
936
|
+
onChange
|
|
937
|
+
]);
|
|
938
|
+
const handleGutterMouseDown = (0, $k7rGe$react.useCallback)((event)=>{
|
|
939
|
+
const target = event.domEvent.target;
|
|
940
|
+
if (target.classList.contains("ace_gutter-cell")) {
|
|
941
|
+
const row = event.getDocumentPosition().row;
|
|
942
|
+
handleToggleSelectLine(row);
|
|
943
|
+
}
|
|
944
|
+
}, [
|
|
945
|
+
handleToggleSelectLine
|
|
946
|
+
]);
|
|
947
|
+
(0, $k7rGe$react.useEffect)(()=>{
|
|
948
|
+
const editor = aceEditorRef?.current?.editor;
|
|
949
|
+
return ()=>{
|
|
950
|
+
editor?.session?.removeListener("guttermousedown", handleGutterMouseDown);
|
|
951
|
+
};
|
|
952
|
+
}, [
|
|
953
|
+
aceEditorRef,
|
|
954
|
+
handleGutterMouseDown
|
|
955
|
+
]);
|
|
956
|
+
const handleEditorLoad = (0, $k7rGe$react.useCallback)((editor)=>{
|
|
957
|
+
editor?.on("guttermousedown", handleGutterMouseDown);
|
|
958
|
+
}, [
|
|
959
|
+
handleGutterMouseDown
|
|
960
|
+
]);
|
|
961
|
+
const getLanguageAlternatives = (0, $k7rGe$react.useCallback)(()=>{
|
|
962
|
+
const languageAlternatives = type.options?.languageAlternatives;
|
|
963
|
+
if (!languageAlternatives) return 0, $8fdae771dbccc774$export$7c77c3a9bb93870d;
|
|
964
|
+
if (!Array.isArray(languageAlternatives)) throw new Error(`'options.languageAlternatives' should be an array, got ${typeof languageAlternatives}`);
|
|
965
|
+
return languageAlternatives.reduce((acc, { title: title , value: val , mode: mode })=>{
|
|
966
|
+
const alias = (0, $8fdae771dbccc774$export$eee7619b712ad3ea)[val];
|
|
967
|
+
if (alias) {
|
|
968
|
+
// eslint-disable-next-line no-console
|
|
969
|
+
console.warn(`'options.languageAlternatives' lists a language with value "%s", which is an alias of "%s" - please replace the value to read "%s"`, val, alias, alias);
|
|
970
|
+
return acc.concat({
|
|
971
|
+
title: title,
|
|
972
|
+
value: alias,
|
|
973
|
+
mode: mode
|
|
974
|
+
});
|
|
975
|
+
}
|
|
976
|
+
if (!mode && !(0, $8fdae771dbccc774$export$7c77c3a9bb93870d).find((lang)=>lang.value === val)) // eslint-disable-next-line no-console
|
|
977
|
+
console.warn(`'options.languageAlternatives' lists a language which is not supported: "%s", syntax highlighting will be disabled.`, val);
|
|
978
|
+
return acc.concat({
|
|
979
|
+
title: title,
|
|
980
|
+
value: val,
|
|
981
|
+
mode: mode
|
|
982
|
+
});
|
|
983
|
+
}, []);
|
|
984
|
+
}, [
|
|
985
|
+
type
|
|
986
|
+
]);
|
|
987
|
+
const handleCodeChange = (0, $k7rGe$react.useCallback)((code)=>{
|
|
988
|
+
const path = (0, $8fdae771dbccc774$export$e1d3cf7d57c23d0f);
|
|
989
|
+
const fixedLanguage = type.options?.language;
|
|
990
|
+
onChange([
|
|
991
|
+
(0, $k7rGe$sanityform.setIfMissing)({
|
|
992
|
+
_type: type.name,
|
|
993
|
+
language: fixedLanguage
|
|
994
|
+
}),
|
|
995
|
+
code ? (0, $k7rGe$sanityform.set)(code, path) : (0, $k7rGe$sanityform.unset)(path),
|
|
996
|
+
]);
|
|
997
|
+
}, [
|
|
998
|
+
onChange,
|
|
999
|
+
type
|
|
1000
|
+
]);
|
|
1001
|
+
const languages = getLanguageAlternatives().slice();
|
|
1002
|
+
const fixedLanguage1 = type.options?.language;
|
|
1003
|
+
const language = value?.language || fixedLanguage1;
|
|
1004
|
+
// the language config from the schema
|
|
1005
|
+
const configured = languages.find((entry)=>entry.value === language);
|
|
1006
|
+
// is the language officially supported (e.g. we import the mode by default)
|
|
1007
|
+
const supported = language && $293e4fb68be52bc5$var$isSupportedLanguage(language);
|
|
1008
|
+
const mode1 = configured?.mode || (supported ? language : "text");
|
|
1009
|
+
const renderLanguageInput = (0, $k7rGe$react.useCallback)((inputProps)=>{
|
|
1010
|
+
return /*#__PURE__*/ (0, $k7rGe$reactjsxruntime.jsx)((0, $k7rGe$sanityui.Select), {
|
|
1011
|
+
...inputProps,
|
|
1012
|
+
onChange: (e)=>{
|
|
1013
|
+
const newValue = e.currentTarget.value;
|
|
1014
|
+
inputProps.onChange(newValue ? (0, $k7rGe$sanityform.set)(newValue) : (0, $k7rGe$sanityform.unset)());
|
|
1015
|
+
},
|
|
1016
|
+
children: languages.map((lang)=>/*#__PURE__*/ (0, $k7rGe$reactjsxruntime.jsx)("option", {
|
|
1017
|
+
value: lang.value,
|
|
1018
|
+
children: lang.title
|
|
1019
|
+
}, lang.value))
|
|
1020
|
+
});
|
|
1021
|
+
}, [
|
|
1022
|
+
languages
|
|
1023
|
+
]);
|
|
1024
|
+
const renderCodeInput = (0, $k7rGe$react.useCallback)((inputProps)=>{
|
|
1025
|
+
return /*#__PURE__*/ (0, $k7rGe$reactjsxruntime.jsx)($293e4fb68be52bc5$var$EditorContainer, {
|
|
1026
|
+
radius: 1,
|
|
1027
|
+
shadow: 1,
|
|
1028
|
+
readOnly: readOnly,
|
|
1029
|
+
children: /*#__PURE__*/ (0, $k7rGe$reactjsxruntime.jsx)((0, ($parcel$interopDefault($k7rGe$reactace))), {
|
|
1030
|
+
ref: aceEditorRef,
|
|
1031
|
+
mode: mode1,
|
|
1032
|
+
theme: theme,
|
|
1033
|
+
width: "100%",
|
|
1034
|
+
onChange: handleCodeChange,
|
|
1035
|
+
name: inputProps.id,
|
|
1036
|
+
value: inputProps.value,
|
|
1037
|
+
markers: value && value.highlightedLines ? (0, $470a71f5fffbba1a$export$2e2bcd8739ae039)(value.highlightedLines) : undefined,
|
|
1038
|
+
onLoad: handleEditorLoad,
|
|
1039
|
+
readOnly: readOnly,
|
|
1040
|
+
tabSize: 2,
|
|
1041
|
+
wrapEnabled: true,
|
|
1042
|
+
setOptions: (0, $8fdae771dbccc774$export$1d910bb34606e145),
|
|
1043
|
+
editorProps: (0, $8fdae771dbccc774$export$24aa1be5d8c3cd08),
|
|
1044
|
+
onFocus: handleCodeFocus,
|
|
1045
|
+
onBlur: onBlur
|
|
1046
|
+
})
|
|
1047
|
+
});
|
|
1048
|
+
}, [
|
|
1049
|
+
theme,
|
|
1050
|
+
handleCodeChange,
|
|
1051
|
+
handleCodeFocus,
|
|
1052
|
+
handleEditorLoad,
|
|
1053
|
+
mode1,
|
|
1054
|
+
onBlur,
|
|
1055
|
+
readOnly,
|
|
1056
|
+
value
|
|
1057
|
+
]);
|
|
1058
|
+
return /*#__PURE__*/ (0, $k7rGe$reactjsxruntime.jsxs)((0, $k7rGe$sanityui.Stack), {
|
|
1059
|
+
space: 4,
|
|
1060
|
+
children: [
|
|
1061
|
+
languageFieldMember && /*#__PURE__*/ (0, $k7rGe$reactjsxruntime.jsx)((0, $k7rGe$sanityform.MemberField), {
|
|
1062
|
+
member: languageFieldMember,
|
|
1063
|
+
renderItem: renderItem,
|
|
1064
|
+
renderField: renderField,
|
|
1065
|
+
renderInput: renderLanguageInput
|
|
1066
|
+
}),
|
|
1067
|
+
type.options?.withFilename && filenameMember && /*#__PURE__*/ (0, $k7rGe$reactjsxruntime.jsx)((0, $k7rGe$sanityform.MemberField), {
|
|
1068
|
+
member: filenameMember,
|
|
1069
|
+
renderItem: renderItem,
|
|
1070
|
+
renderField: renderField,
|
|
1071
|
+
renderInput: renderInput
|
|
1072
|
+
}),
|
|
1073
|
+
codeFieldMember && /*#__PURE__*/ (0, $k7rGe$reactjsxruntime.jsx)((0, $k7rGe$sanityform.MemberField), {
|
|
1074
|
+
member: codeFieldMember,
|
|
1075
|
+
renderInput: renderCodeInput,
|
|
1076
|
+
renderItem: renderItem,
|
|
1077
|
+
renderField: renderField
|
|
1078
|
+
})
|
|
1079
|
+
]
|
|
1080
|
+
});
|
|
1081
|
+
}
|
|
1082
|
+
|
|
1083
|
+
|
|
1084
|
+
|
|
1085
|
+
|
|
1086
|
+
|
|
1087
|
+
|
|
1088
|
+
|
|
1089
|
+
|
|
1090
|
+
|
|
1091
|
+
|
|
1092
|
+
const $15530f24e7c40879$var$PreviewContainer = (0, ($parcel$interopDefault($k7rGe$styledcomponents)))((0, $k7rGe$sanityui.Box))`
|
|
1093
|
+
position: relative;
|
|
1094
|
+
`;
|
|
1095
|
+
const $15530f24e7c40879$var$PreviewInner = (0, ($parcel$interopDefault($k7rGe$styledcomponents)))((0, $k7rGe$sanityui.Box))`
|
|
1096
|
+
background-color: #272822;
|
|
1097
|
+
|
|
1098
|
+
.ace_editor {
|
|
1099
|
+
box-sizing: border-box;
|
|
1100
|
+
cursor: default;
|
|
1101
|
+
pointer-events: none;
|
|
1102
|
+
}
|
|
1103
|
+
|
|
1104
|
+
.ace_content {
|
|
1105
|
+
box-sizing: border-box;
|
|
1106
|
+
overflow: hidden;
|
|
1107
|
+
}
|
|
1108
|
+
`;
|
|
1109
|
+
function $15530f24e7c40879$export$2e2bcd8739ae039(props) {
|
|
1110
|
+
const aceEditorRef = (0, $k7rGe$react.useRef)();
|
|
1111
|
+
(0, $k7rGe$react.useEffect)(()=>{
|
|
1112
|
+
if (!aceEditorRef?.current) return;
|
|
1113
|
+
const editor = aceEditorRef.current?.editor;
|
|
1114
|
+
if (editor) {
|
|
1115
|
+
// Avoid cursor and focus tracking by Ace
|
|
1116
|
+
editor.renderer.$cursorLayer.element.style.opacity = 0;
|
|
1117
|
+
editor.textInput.getElement().disabled = true;
|
|
1118
|
+
}
|
|
1119
|
+
}, []);
|
|
1120
|
+
const handleEditorChange = (0, $k7rGe$react.useCallback)(()=>{
|
|
1121
|
+
// do nothing when the editor changes
|
|
1122
|
+
}, []);
|
|
1123
|
+
const { value: value , type: type } = props;
|
|
1124
|
+
const fixedLanguage = type?.options?.language;
|
|
1125
|
+
const mode = value?.language || fixedLanguage || "text";
|
|
1126
|
+
return /*#__PURE__*/ (0, $k7rGe$reactjsxruntime.jsx)($15530f24e7c40879$var$PreviewContainer, {
|
|
1127
|
+
children: /*#__PURE__*/ (0, $k7rGe$reactjsxruntime.jsx)($15530f24e7c40879$var$PreviewInner, {
|
|
1128
|
+
padding: 4,
|
|
1129
|
+
children: /*#__PURE__*/ (0, $k7rGe$reactjsxruntime.jsx)((0, ($parcel$interopDefault($k7rGe$reactace))), {
|
|
1130
|
+
ref: aceEditorRef,
|
|
1131
|
+
focus: false,
|
|
1132
|
+
mode: mode,
|
|
1133
|
+
theme: "monokai",
|
|
1134
|
+
width: "100%",
|
|
1135
|
+
onChange: handleEditorChange,
|
|
1136
|
+
maxLines: 200,
|
|
1137
|
+
readOnly: true,
|
|
1138
|
+
wrapEnabled: true,
|
|
1139
|
+
showPrintMargin: false,
|
|
1140
|
+
highlightActiveLine: false,
|
|
1141
|
+
cursorStart: -1,
|
|
1142
|
+
value: value && value.code || "",
|
|
1143
|
+
markers: value && value.highlightedLines ? (0, $470a71f5fffbba1a$export$2e2bcd8739ae039)(value.highlightedLines) : undefined,
|
|
1144
|
+
tabSize: 2,
|
|
1145
|
+
showGutter: false,
|
|
1146
|
+
setOptions: (0, $8fdae771dbccc774$export$1d910bb34606e145),
|
|
1147
|
+
editorProps: (0, $8fdae771dbccc774$export$24aa1be5d8c3cd08)
|
|
1148
|
+
})
|
|
1149
|
+
})
|
|
1150
|
+
});
|
|
1151
|
+
}
|
|
1152
|
+
|
|
1153
|
+
|
|
1154
|
+
|
|
1155
|
+
|
|
1156
|
+
function $c676b2e7a96a4665$export$a854ab43349813f2(language) {
|
|
1157
|
+
if (language === "jsx") return /*#__PURE__*/ (0, $k7rGe$reactjsxruntime.jsx)("svg", {
|
|
1158
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
1159
|
+
viewBox: "0 0 128 128",
|
|
1160
|
+
children: /*#__PURE__*/ (0, $k7rGe$reactjsxruntime.jsxs)("g", {
|
|
1161
|
+
fill: "#61DAFB",
|
|
1162
|
+
children: [
|
|
1163
|
+
/*#__PURE__*/ (0, $k7rGe$reactjsxruntime.jsx)("circle", {
|
|
1164
|
+
cx: "64",
|
|
1165
|
+
cy: "64",
|
|
1166
|
+
r: "11.4"
|
|
1167
|
+
}),
|
|
1168
|
+
/*#__PURE__*/ (0, $k7rGe$reactjsxruntime.jsx)("path", {
|
|
1169
|
+
d: "M107.3 45.2c-2.2-.8-4.5-1.6-6.9-2.3.6-2.4 1.1-4.8 1.5-7.1 2.1-13.2-.2-22.5-6.6-26.1-1.9-1.1-4-1.6-6.4-1.6-7 0-15.9 5.2-24.9 13.9-9-8.7-17.9-13.9-24.9-13.9-2.4 0-4.5.5-6.4 1.6-6.4 3.7-8.7 13-6.6 26.1.4 2.3.9 4.7 1.5 7.1-2.4.7-4.7 1.4-6.9 2.3C8.2 50 1.4 56.6 1.4 64s6.9 14 19.3 18.8c2.2.8 4.5 1.6 6.9 2.3-.6 2.4-1.1 4.8-1.5 7.1-2.1 13.2.2 22.5 6.6 26.1 1.9 1.1 4 1.6 6.4 1.6 7.1 0 16-5.2 24.9-13.9 9 8.7 17.9 13.9 24.9 13.9 2.4 0 4.5-.5 6.4-1.6 6.4-3.7 8.7-13 6.6-26.1-.4-2.3-.9-4.7-1.5-7.1 2.4-.7 4.7-1.4 6.9-2.3 12.5-4.8 19.3-11.4 19.3-18.8s-6.8-14-19.3-18.8zM92.5 14.7c4.1 2.4 5.5 9.8 3.8 20.3-.3 2.1-.8 4.3-1.4 6.6-5.2-1.2-10.7-2-16.5-2.5-3.4-4.8-6.9-9.1-10.4-13 7.4-7.3 14.9-12.3 21-12.3 1.3 0 2.5.3 3.5.9zM81.3 74c-1.8 3.2-3.9 6.4-6.1 9.6-3.7.3-7.4.4-11.2.4-3.9 0-7.6-.1-11.2-.4-2.2-3.2-4.2-6.4-6-9.6-1.9-3.3-3.7-6.7-5.3-10 1.6-3.3 3.4-6.7 5.3-10 1.8-3.2 3.9-6.4 6.1-9.6 3.7-.3 7.4-.4 11.2-.4 3.9 0 7.6.1 11.2.4 2.2 3.2 4.2 6.4 6 9.6 1.9 3.3 3.7 6.7 5.3 10-1.7 3.3-3.4 6.6-5.3 10zm8.3-3.3c1.5 3.5 2.7 6.9 3.8 10.3-3.4.8-7 1.4-10.8 1.9 1.2-1.9 2.5-3.9 3.6-6 1.2-2.1 2.3-4.2 3.4-6.2zM64 97.8c-2.4-2.6-4.7-5.4-6.9-8.3 2.3.1 4.6.2 6.9.2 2.3 0 4.6-.1 6.9-.2-2.2 2.9-4.5 5.7-6.9 8.3zm-18.6-15c-3.8-.5-7.4-1.1-10.8-1.9 1.1-3.3 2.3-6.8 3.8-10.3 1.1 2 2.2 4.1 3.4 6.1 1.2 2.2 2.4 4.1 3.6 6.1zm-7-25.5c-1.5-3.5-2.7-6.9-3.8-10.3 3.4-.8 7-1.4 10.8-1.9-1.2 1.9-2.5 3.9-3.6 6-1.2 2.1-2.3 4.2-3.4 6.2zM64 30.2c2.4 2.6 4.7 5.4 6.9 8.3-2.3-.1-4.6-.2-6.9-.2-2.3 0-4.6.1-6.9.2 2.2-2.9 4.5-5.7 6.9-8.3zm22.2 21l-3.6-6c3.8.5 7.4 1.1 10.8 1.9-1.1 3.3-2.3 6.8-3.8 10.3-1.1-2.1-2.2-4.2-3.4-6.2zM31.7 35c-1.7-10.5-.3-17.9 3.8-20.3 1-.6 2.2-.9 3.5-.9 6 0 13.5 4.9 21 12.3-3.5 3.8-7 8.2-10.4 13-5.8.5-11.3 1.4-16.5 2.5-.6-2.3-1-4.5-1.4-6.6zM7 64c0-4.7 5.7-9.7 15.7-13.4 2-.8 4.2-1.5 6.4-2.1 1.6 5 3.6 10.3 6 15.6-2.4 5.3-4.5 10.5-6 15.5C15.3 75.6 7 69.6 7 64zm28.5 49.3c-4.1-2.4-5.5-9.8-3.8-20.3.3-2.1.8-4.3 1.4-6.6 5.2 1.2 10.7 2 16.5 2.5 3.4 4.8 6.9 9.1 10.4 13-7.4 7.3-14.9 12.3-21 12.3-1.3 0-2.5-.3-3.5-.9zM96.3 93c1.7 10.5.3 17.9-3.8 20.3-1 .6-2.2.9-3.5.9-6 0-13.5-4.9-21-12.3 3.5-3.8 7-8.2 10.4-13 5.8-.5 11.3-1.4 16.5-2.5.6 2.3 1 4.5 1.4 6.6zm9-15.6c-2 .8-4.2 1.5-6.4 2.1-1.6-5-3.6-10.3-6-15.6 2.4-5.3 4.5-10.5 6-15.5 13.8 4 22.1 10 22.1 15.6 0 4.7-5.8 9.7-15.7 13.4z"
|
|
1170
|
+
})
|
|
1171
|
+
]
|
|
1172
|
+
})
|
|
1173
|
+
});
|
|
1174
|
+
if (language === "javascript") return /*#__PURE__*/ (0, $k7rGe$reactjsxruntime.jsxs)("svg", {
|
|
1175
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
1176
|
+
viewBox: "0 0 128 128",
|
|
1177
|
+
children: [
|
|
1178
|
+
/*#__PURE__*/ (0, $k7rGe$reactjsxruntime.jsx)("path", {
|
|
1179
|
+
fill: "#F0DB4F",
|
|
1180
|
+
d: "M1.408 1.408h125.184v125.185H1.408z"
|
|
1181
|
+
}),
|
|
1182
|
+
/*#__PURE__*/ (0, $k7rGe$reactjsxruntime.jsx)("path", {
|
|
1183
|
+
fill: "#323330",
|
|
1184
|
+
d: "M116.347 96.736c-.917-5.711-4.641-10.508-15.672-14.981-3.832-1.761-8.104-3.022-9.377-5.926-.452-1.69-.512-2.642-.226-3.665.821-3.32 4.784-4.355 7.925-3.403 2.023.678 3.938 2.237 5.093 4.724 5.402-3.498 5.391-3.475 9.163-5.879-1.381-2.141-2.118-3.129-3.022-4.045-3.249-3.629-7.676-5.498-14.756-5.355l-3.688.477c-3.534.893-6.902 2.748-8.877 5.235-5.926 6.724-4.236 18.492 2.975 23.335 7.104 5.332 17.54 6.545 18.873 11.531 1.297 6.104-4.486 8.08-10.234 7.378-4.236-.881-6.592-3.034-9.139-6.949-4.688 2.713-4.688 2.713-9.508 5.485 1.143 2.499 2.344 3.63 4.26 5.795 9.068 9.198 31.76 8.746 35.83-5.176.165-.478 1.261-3.666.38-8.581zM69.462 58.943H57.753l-.048 30.272c0 6.438.333 12.34-.714 14.149-1.713 3.558-6.152 3.117-8.175 2.427-2.059-1.012-3.106-2.451-4.319-4.485-.333-.584-.583-1.036-.667-1.071l-9.52 5.83c1.583 3.249 3.915 6.069 6.902 7.901 4.462 2.678 10.459 3.499 16.731 2.059 4.082-1.189 7.604-3.652 9.448-7.401 2.666-4.915 2.094-10.864 2.07-17.444.06-10.735.001-21.468.001-32.237z"
|
|
1185
|
+
})
|
|
1186
|
+
]
|
|
1187
|
+
});
|
|
1188
|
+
if (language === "php") return /*#__PURE__*/ (0, $k7rGe$reactjsxruntime.jsx)("svg", {
|
|
1189
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
1190
|
+
viewBox: "0 0 800 400",
|
|
1191
|
+
children: /*#__PURE__*/ (0, $k7rGe$reactjsxruntime.jsx)("g", {
|
|
1192
|
+
transform: "translate(-44.632 -141.55)",
|
|
1193
|
+
children: /*#__PURE__*/ (0, $k7rGe$reactjsxruntime.jsxs)("g", {
|
|
1194
|
+
transform: "matrix(8.3528 0 0 8.3119 -727.13 -3759.5)",
|
|
1195
|
+
children: [
|
|
1196
|
+
/*#__PURE__*/ (0, $k7rGe$reactjsxruntime.jsx)("path", {
|
|
1197
|
+
d: "m99.974 479.48h14.204c4.1693 0.0354 7.1903 1.2367 9.063 3.604 1.8726 2.3674 2.491 5.6004 1.855 9.699-0.24737 1.8727-0.79504 3.71-1.643 5.512-0.8127 1.802-1.9434 3.4273-3.392 4.876-1.7667 1.8373-3.657 3.0033-5.671 3.498-2.014 0.49467-4.0987 0.742-6.254 0.742h-6.36l-2.014 10.07h-7.367l7.579-38.001m6.201 6.042-3.18 15.9c0.21198 0.0353 0.42398 0.053 0.636 0.053h0.742c3.392 0.0353 6.2186-0.30033 8.48-1.007 2.2613-0.74199 3.7806-3.3213 4.558-7.738 0.63597-3.71-0.00003-5.8476-1.908-6.413-1.8727-0.56531-4.2224-0.83031-7.049-0.795-0.42402 0.0353-0.83035 0.053-1.219 0.053-0.35335 0.00002-0.72435 0.00002-1.113 0l0.053-0.053"
|
|
1198
|
+
}),
|
|
1199
|
+
/*#__PURE__*/ (0, $k7rGe$reactjsxruntime.jsx)("path", {
|
|
1200
|
+
d: "m133.49 469.36h7.314l-2.067 10.123h6.572c3.604 0.0707 6.2893 0.81269 8.056 2.226 1.802 1.4134 2.332 4.0987 1.59 8.056l-3.551 17.649h-7.42l3.392-16.854c0.35328-1.7666 0.2473-3.021-0.318-3.763-0.56536-0.74198-1.7844-1.113-3.657-1.113l-5.883-0.053-4.346 21.783h-7.314l7.632-38.054"
|
|
1201
|
+
}),
|
|
1202
|
+
/*#__PURE__*/ (0, $k7rGe$reactjsxruntime.jsx)("path", {
|
|
1203
|
+
d: "m162.81 479.48h14.204c4.1693 0.0354 7.1903 1.2367 9.063 3.604 1.8726 2.3674 2.491 5.6004 1.855 9.699-0.24737 1.8727-0.79503 3.71-1.643 5.512-0.8127 1.802-1.9434 3.4273-3.392 4.876-1.7667 1.8373-3.657 3.0033-5.671 3.498-2.014 0.49467-4.0987 0.742-6.254 0.742h-6.36l-2.014 10.07h-7.367l7.579-38.001m6.201 6.042-3.18 15.9c0.21199 0.0353 0.42399 0.053 0.636 0.053h0.742c3.392 0.0353 6.2186-0.30033 8.48-1.007 2.2613-0.74199 3.7806-3.3213 4.558-7.738 0.63597-3.71-0.00003-5.8476-1.908-6.413-1.8727-0.56531-4.2224-0.83031-7.049-0.795-0.42402 0.0353-0.83035 0.053-1.219 0.053-0.35335 0.00002-0.72435 0.00002-1.113 0l0.053-0.053"
|
|
1204
|
+
})
|
|
1205
|
+
]
|
|
1206
|
+
})
|
|
1207
|
+
})
|
|
1208
|
+
});
|
|
1209
|
+
if (language === "json") return /*#__PURE__*/ (0, $k7rGe$reactjsxruntime.jsxs)("svg", {
|
|
1210
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
1211
|
+
xmlnsXlink: "http://www.w3.org/1999/xlink",
|
|
1212
|
+
viewBox: "0 0 160 160",
|
|
1213
|
+
children: [
|
|
1214
|
+
/*#__PURE__*/ (0, $k7rGe$reactjsxruntime.jsxs)("defs", {
|
|
1215
|
+
children: [
|
|
1216
|
+
/*#__PURE__*/ (0, $k7rGe$reactjsxruntime.jsxs)("linearGradient", {
|
|
1217
|
+
id: "a",
|
|
1218
|
+
children: [
|
|
1219
|
+
/*#__PURE__*/ (0, $k7rGe$reactjsxruntime.jsx)("stop", {
|
|
1220
|
+
offset: "0"
|
|
1221
|
+
}),
|
|
1222
|
+
/*#__PURE__*/ (0, $k7rGe$reactjsxruntime.jsx)("stop", {
|
|
1223
|
+
offset: "1",
|
|
1224
|
+
stopColor: "#fff"
|
|
1225
|
+
})
|
|
1226
|
+
]
|
|
1227
|
+
}),
|
|
1228
|
+
/*#__PURE__*/ (0, $k7rGe$reactjsxruntime.jsx)("linearGradient", {
|
|
1229
|
+
x1: "-553.27",
|
|
1230
|
+
y1: "525.908",
|
|
1231
|
+
x2: "-666.116",
|
|
1232
|
+
y2: "413.045",
|
|
1233
|
+
id: "c",
|
|
1234
|
+
xlinkHref: "#a",
|
|
1235
|
+
gradientUnits: "userSpaceOnUse",
|
|
1236
|
+
gradientTransform: "matrix(.99884 0 0 .9987 689.008 -388.844)"
|
|
1237
|
+
}),
|
|
1238
|
+
/*#__PURE__*/ (0, $k7rGe$reactjsxruntime.jsx)("linearGradient", {
|
|
1239
|
+
x1: "-666.117",
|
|
1240
|
+
y1: "413.045",
|
|
1241
|
+
x2: "-553.27",
|
|
1242
|
+
y2: "525.908",
|
|
1243
|
+
id: "b",
|
|
1244
|
+
xlinkHref: "#a",
|
|
1245
|
+
gradientUnits: "userSpaceOnUse",
|
|
1246
|
+
gradientTransform: "matrix(.99884 0 0 .9987 689.008 -388.844)"
|
|
1247
|
+
})
|
|
1248
|
+
]
|
|
1249
|
+
}),
|
|
1250
|
+
/*#__PURE__*/ (0, $k7rGe$reactjsxruntime.jsx)("path", {
|
|
1251
|
+
d: "M79.865 119.1c35.397 48.255 70.04-13.469 69.988-50.587-.06-43.886-44.54-68.414-70.017-68.414C38.943.1 0 33.895 0 80.135 0 131.531 44.64 160 79.836 160c-7.965-1.147-34.507-6.834-34.863-67.967-.24-41.346 13.487-57.865 34.805-50.599.477.177 23.514 9.265 23.514 38.95 0 29.56-23.427 38.716-23.427 38.716z",
|
|
1252
|
+
style: {
|
|
1253
|
+
marker: "none"
|
|
1254
|
+
},
|
|
1255
|
+
color: "#000",
|
|
1256
|
+
fill: "url(#b)",
|
|
1257
|
+
fillRule: "evenodd",
|
|
1258
|
+
overflow: "visible"
|
|
1259
|
+
}),
|
|
1260
|
+
/*#__PURE__*/ (0, $k7rGe$reactjsxruntime.jsx)("path", {
|
|
1261
|
+
d: "M79.823 41.4C56.433 33.34 27.78 52.618 27.78 91.23c0 63.048 46.72 68.77 52.384 68.77C121.057 160 160 126.204 160 79.964 160 28.568 115.36.1 80.164.1c9.749-1.35 52.541 10.55 52.541 69.037 0 38.141-31.953 58.905-52.735 50.033-.478-.177-23.514-9.264-23.514-38.95 0-29.56 23.367-38.818 23.367-38.818z",
|
|
1262
|
+
style: {
|
|
1263
|
+
marker: "none"
|
|
1264
|
+
},
|
|
1265
|
+
color: "#000",
|
|
1266
|
+
fill: "url(#c)",
|
|
1267
|
+
fillRule: "evenodd",
|
|
1268
|
+
overflow: "visible"
|
|
1269
|
+
})
|
|
1270
|
+
]
|
|
1271
|
+
});
|
|
1272
|
+
return undefined;
|
|
1273
|
+
}
|
|
1274
|
+
|
|
1275
|
+
|
|
1276
|
+
const $fcd6ef024a3d4c8a$var$Preview = (props)=>{
|
|
1277
|
+
return /*#__PURE__*/ (0, $k7rGe$reactjsxruntime.jsx)((0, $15530f24e7c40879$export$2e2bcd8739ae039), {
|
|
1278
|
+
...props
|
|
1279
|
+
});
|
|
1280
|
+
};
|
|
1281
|
+
var $fcd6ef024a3d4c8a$export$2e2bcd8739ae039 = {
|
|
1282
|
+
name: "code",
|
|
1283
|
+
type: "object",
|
|
1284
|
+
title: "Code",
|
|
1285
|
+
components: {
|
|
1286
|
+
input: (0, $293e4fb68be52bc5$export$20d4ca75cb144ab0)
|
|
1287
|
+
},
|
|
1288
|
+
icon: (0, $k7rGe$sanityicons.CodeBlockIcon),
|
|
1289
|
+
fields: [
|
|
1290
|
+
{
|
|
1291
|
+
name: "language",
|
|
1292
|
+
title: "Language",
|
|
1293
|
+
type: "string"
|
|
1294
|
+
},
|
|
1295
|
+
{
|
|
1296
|
+
name: "filename",
|
|
1297
|
+
title: "Filename",
|
|
1298
|
+
type: "string"
|
|
1299
|
+
},
|
|
1300
|
+
{
|
|
1301
|
+
title: "Code",
|
|
1302
|
+
name: "code",
|
|
1303
|
+
type: "text"
|
|
1304
|
+
},
|
|
1305
|
+
{
|
|
1306
|
+
title: "Highlighted lines",
|
|
1307
|
+
name: "highlightedLines",
|
|
1308
|
+
type: "array",
|
|
1309
|
+
of: [
|
|
1310
|
+
{
|
|
1311
|
+
type: "number",
|
|
1312
|
+
title: "Highlighted line"
|
|
1313
|
+
},
|
|
1314
|
+
]
|
|
1315
|
+
},
|
|
1316
|
+
],
|
|
1317
|
+
preview: {
|
|
1318
|
+
select: {
|
|
1319
|
+
language: "language",
|
|
1320
|
+
code: "code",
|
|
1321
|
+
filename: "filename",
|
|
1322
|
+
highlightedLines: "highlightedLines"
|
|
1323
|
+
},
|
|
1324
|
+
prepare: (value)=>{
|
|
1325
|
+
return {
|
|
1326
|
+
title: value.filename || (value.language || "unknown").toUpperCase(),
|
|
1327
|
+
media: (0, $c676b2e7a96a4665$export$a854ab43349813f2)(value?.language),
|
|
1328
|
+
extendedPreview: /*#__PURE__*/ (0, $k7rGe$reactjsxruntime.jsx)($fcd6ef024a3d4c8a$var$Preview, {
|
|
1329
|
+
value: value
|
|
1330
|
+
})
|
|
1331
|
+
};
|
|
1332
|
+
}
|
|
1333
|
+
}
|
|
1334
|
+
};
|
|
1335
|
+
|
|
1336
|
+
|
|
1337
|
+
|
|
1338
|
+
const $244e63ca53592e4d$export$d18430c17c97a000 = (0, $k7rGe$sanity.createPlugin)({
|
|
1339
|
+
name: "@sanity/code-input",
|
|
1340
|
+
schema: {
|
|
1341
|
+
types: [
|
|
1342
|
+
(0, $fcd6ef024a3d4c8a$export$2e2bcd8739ae039)
|
|
1343
|
+
]
|
|
1344
|
+
}
|
|
1345
|
+
});
|
|
1346
|
+
|
|
1347
|
+
|
|
1348
|
+
//# sourceMappingURL=index.js.map
|