@sanity/code-input 2.30.2-shopify.2 → 3.0.0-studio-v3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +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/getMedia.js
DELETED
|
@@ -1,110 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.getMedia = getMedia;
|
|
7
|
-
|
|
8
|
-
var _react = _interopRequireDefault(require("react"));
|
|
9
|
-
|
|
10
|
-
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
11
|
-
|
|
12
|
-
function getMedia(language) {
|
|
13
|
-
if (language === 'jsx') {
|
|
14
|
-
return /*#__PURE__*/_react.default.createElement("svg", {
|
|
15
|
-
xmlns: "http://www.w3.org/2000/svg",
|
|
16
|
-
viewBox: "0 0 128 128"
|
|
17
|
-
}, /*#__PURE__*/_react.default.createElement("g", {
|
|
18
|
-
fill: "#61DAFB"
|
|
19
|
-
}, /*#__PURE__*/_react.default.createElement("circle", {
|
|
20
|
-
cx: "64",
|
|
21
|
-
cy: "64",
|
|
22
|
-
r: "11.4"
|
|
23
|
-
}), /*#__PURE__*/_react.default.createElement("path", {
|
|
24
|
-
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"
|
|
25
|
-
})));
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
if (language === 'javascript') {
|
|
29
|
-
return /*#__PURE__*/_react.default.createElement("svg", {
|
|
30
|
-
xmlns: "http://www.w3.org/2000/svg",
|
|
31
|
-
viewBox: "0 0 128 128"
|
|
32
|
-
}, /*#__PURE__*/_react.default.createElement("path", {
|
|
33
|
-
fill: "#F0DB4F",
|
|
34
|
-
d: "M1.408 1.408h125.184v125.185H1.408z"
|
|
35
|
-
}), /*#__PURE__*/_react.default.createElement("path", {
|
|
36
|
-
fill: "#323330",
|
|
37
|
-
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"
|
|
38
|
-
}));
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
if (language === 'php') {
|
|
42
|
-
return /*#__PURE__*/_react.default.createElement("svg", {
|
|
43
|
-
xmlns: "http://www.w3.org/2000/svg",
|
|
44
|
-
viewBox: "0 0 800 400"
|
|
45
|
-
}, /*#__PURE__*/_react.default.createElement("g", {
|
|
46
|
-
transform: "translate(-44.632 -141.55)"
|
|
47
|
-
}, /*#__PURE__*/_react.default.createElement("g", {
|
|
48
|
-
transform: "matrix(8.3528 0 0 8.3119 -727.13 -3759.5)"
|
|
49
|
-
}, /*#__PURE__*/_react.default.createElement("path", {
|
|
50
|
-
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"
|
|
51
|
-
}), /*#__PURE__*/_react.default.createElement("path", {
|
|
52
|
-
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"
|
|
53
|
-
}), /*#__PURE__*/_react.default.createElement("path", {
|
|
54
|
-
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"
|
|
55
|
-
}))));
|
|
56
|
-
}
|
|
57
|
-
|
|
58
|
-
if (language === 'json') {
|
|
59
|
-
return /*#__PURE__*/_react.default.createElement("svg", {
|
|
60
|
-
xmlns: "http://www.w3.org/2000/svg",
|
|
61
|
-
xmlnsXlink: "http://www.w3.org/1999/xlink",
|
|
62
|
-
viewBox: "0 0 160 160"
|
|
63
|
-
}, /*#__PURE__*/_react.default.createElement("defs", null, /*#__PURE__*/_react.default.createElement("linearGradient", {
|
|
64
|
-
id: "a"
|
|
65
|
-
}, /*#__PURE__*/_react.default.createElement("stop", {
|
|
66
|
-
offset: "0"
|
|
67
|
-
}), /*#__PURE__*/_react.default.createElement("stop", {
|
|
68
|
-
offset: "1",
|
|
69
|
-
stopColor: "#fff"
|
|
70
|
-
})), /*#__PURE__*/_react.default.createElement("linearGradient", {
|
|
71
|
-
x1: "-553.27",
|
|
72
|
-
y1: "525.908",
|
|
73
|
-
x2: "-666.116",
|
|
74
|
-
y2: "413.045",
|
|
75
|
-
id: "c",
|
|
76
|
-
xlinkHref: "#a",
|
|
77
|
-
gradientUnits: "userSpaceOnUse",
|
|
78
|
-
gradientTransform: "matrix(.99884 0 0 .9987 689.008 -388.844)"
|
|
79
|
-
}), /*#__PURE__*/_react.default.createElement("linearGradient", {
|
|
80
|
-
x1: "-666.117",
|
|
81
|
-
y1: "413.045",
|
|
82
|
-
x2: "-553.27",
|
|
83
|
-
y2: "525.908",
|
|
84
|
-
id: "b",
|
|
85
|
-
xlinkHref: "#a",
|
|
86
|
-
gradientUnits: "userSpaceOnUse",
|
|
87
|
-
gradientTransform: "matrix(.99884 0 0 .9987 689.008 -388.844)"
|
|
88
|
-
})), /*#__PURE__*/_react.default.createElement("path", {
|
|
89
|
-
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",
|
|
90
|
-
style: {
|
|
91
|
-
marker: 'none'
|
|
92
|
-
},
|
|
93
|
-
color: "#000",
|
|
94
|
-
fill: "url(#b)",
|
|
95
|
-
fillRule: "evenodd",
|
|
96
|
-
overflow: "visible"
|
|
97
|
-
}), /*#__PURE__*/_react.default.createElement("path", {
|
|
98
|
-
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",
|
|
99
|
-
style: {
|
|
100
|
-
marker: 'none'
|
|
101
|
-
},
|
|
102
|
-
color: "#000",
|
|
103
|
-
fill: "url(#c)",
|
|
104
|
-
fillRule: "evenodd",
|
|
105
|
-
overflow: "visible"
|
|
106
|
-
}));
|
|
107
|
-
}
|
|
108
|
-
|
|
109
|
-
return undefined;
|
|
110
|
-
}
|
package/lib/groq.js
DELETED
|
@@ -1,414 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
/* eslint-disable no-undef */
|
|
4
|
-
// Grammar from https://github.com/sanity-io/vscode-sanity
|
|
5
|
-
var rules = {
|
|
6
|
-
start: [{
|
|
7
|
-
include: '#query'
|
|
8
|
-
}, {
|
|
9
|
-
include: '#value'
|
|
10
|
-
}, {
|
|
11
|
-
include: '#pair'
|
|
12
|
-
}],
|
|
13
|
-
'#query': [{
|
|
14
|
-
include: '#nullary-access-operator'
|
|
15
|
-
}, {
|
|
16
|
-
include: '#arraylike'
|
|
17
|
-
}, {
|
|
18
|
-
include: '#pipe'
|
|
19
|
-
}, {
|
|
20
|
-
include: '#sort-order'
|
|
21
|
-
}, {
|
|
22
|
-
include: '#filter'
|
|
23
|
-
}],
|
|
24
|
-
'#variable': [{
|
|
25
|
-
token: 'variable.other.groq',
|
|
26
|
-
regex: /\$[_A-Za-z][_0-9A-Za-z]*/
|
|
27
|
-
}],
|
|
28
|
-
'#keyword': [{
|
|
29
|
-
token: 'keyword.other.groq',
|
|
30
|
-
regex: /\b(?:asc|desc|in|match)\b/
|
|
31
|
-
}],
|
|
32
|
-
'#comparison': [{
|
|
33
|
-
token: 'keyword.operator.comparison.groq',
|
|
34
|
-
// eslint-disable-next-line no-div-regex
|
|
35
|
-
regex: /==|!=|>=|<=|<!=>|<|>/
|
|
36
|
-
}],
|
|
37
|
-
'#operator': [{
|
|
38
|
-
token: 'keyword.operator.arithmetic.groq',
|
|
39
|
-
regex: /\+|-|\*{1,2}|\/|%/
|
|
40
|
-
}],
|
|
41
|
-
'#pipe': [{
|
|
42
|
-
token: 'keyword.operator.pipe.groq',
|
|
43
|
-
regex: /\|/
|
|
44
|
-
}],
|
|
45
|
-
'#logical': [{
|
|
46
|
-
token: 'keyword.operator.logical.groq',
|
|
47
|
-
regex: /!|&&|\|\|/
|
|
48
|
-
}],
|
|
49
|
-
'#reference': [{
|
|
50
|
-
token: 'keyword.operator.reference.groq',
|
|
51
|
-
regex: /->/
|
|
52
|
-
}],
|
|
53
|
-
'#pair': [{
|
|
54
|
-
include: '#identifier'
|
|
55
|
-
}, {
|
|
56
|
-
include: '#value'
|
|
57
|
-
}, {
|
|
58
|
-
include: '#filter'
|
|
59
|
-
}, {
|
|
60
|
-
token: 'keyword.operator.pair.groq',
|
|
61
|
-
regex: /[=]>/
|
|
62
|
-
}],
|
|
63
|
-
'#arraylike': [{
|
|
64
|
-
token: 'punctuation.definition.bracket.begin.groq',
|
|
65
|
-
regex: /\[/,
|
|
66
|
-
push: [{
|
|
67
|
-
token: ['text', 'keyword.operator.descendant.groq'],
|
|
68
|
-
regex: /(\])((?:\s*\.)?)/,
|
|
69
|
-
next: 'pop'
|
|
70
|
-
}, {
|
|
71
|
-
include: '#range'
|
|
72
|
-
}, {
|
|
73
|
-
include: '#filter'
|
|
74
|
-
}, {
|
|
75
|
-
include: '#array-values'
|
|
76
|
-
}]
|
|
77
|
-
}],
|
|
78
|
-
'#array': [{
|
|
79
|
-
token: 'punctuation.definition.bracket.begin.groq',
|
|
80
|
-
regex: /\[/,
|
|
81
|
-
push: [{
|
|
82
|
-
token: 'punctuation.definition.bracket.end.groq',
|
|
83
|
-
regex: /\]/,
|
|
84
|
-
next: 'pop'
|
|
85
|
-
}, {
|
|
86
|
-
include: '#array-values'
|
|
87
|
-
}, {
|
|
88
|
-
defaultToken: 'meta.structure.array.groq'
|
|
89
|
-
}]
|
|
90
|
-
}],
|
|
91
|
-
'#range': [{
|
|
92
|
-
token: ['meta.structure.range.groq', 'constant.numeric.groq', 'meta.structure.range.groq', 'keyword.operator.range.groq', 'meta.structure.range.groq', 'constant.numeric.groq', 'meta.structure.range.groq'],
|
|
93
|
-
regex: /(\s*)(\d+)(\s*)(\.{2,3})(\s*)(\d+)(\s*)/
|
|
94
|
-
}],
|
|
95
|
-
'#spread': [{
|
|
96
|
-
token: 'punctuation.definition.spread.begin.groq',
|
|
97
|
-
regex: /\.\.\./,
|
|
98
|
-
push: [{
|
|
99
|
-
include: '#array'
|
|
100
|
-
}, {
|
|
101
|
-
include: '#function-call'
|
|
102
|
-
}, {
|
|
103
|
-
include: '#projection'
|
|
104
|
-
}, {
|
|
105
|
-
token: 'punctuation.definition.spread.end.groq',
|
|
106
|
-
regex: /(?=.)/,
|
|
107
|
-
next: 'pop'
|
|
108
|
-
}, {
|
|
109
|
-
defaultToken: 'meta.structure.spread.groq'
|
|
110
|
-
}]
|
|
111
|
-
}],
|
|
112
|
-
'#array-values': [{
|
|
113
|
-
include: '#value'
|
|
114
|
-
}, {
|
|
115
|
-
include: '#spread'
|
|
116
|
-
}, {
|
|
117
|
-
token: 'punctuation.separator.array.groq',
|
|
118
|
-
regex: /,/
|
|
119
|
-
}, {
|
|
120
|
-
token: 'invalid.illegal.expected-array-separator.groq',
|
|
121
|
-
regex: /[^\s\]]/
|
|
122
|
-
}],
|
|
123
|
-
'#filter': [{
|
|
124
|
-
include: '#function-call'
|
|
125
|
-
}, {
|
|
126
|
-
include: '#keyword'
|
|
127
|
-
}, {
|
|
128
|
-
include: '#constant'
|
|
129
|
-
}, {
|
|
130
|
-
include: '#identifier'
|
|
131
|
-
}, {
|
|
132
|
-
include: '#value'
|
|
133
|
-
}, {
|
|
134
|
-
include: '#comparison'
|
|
135
|
-
}, {
|
|
136
|
-
include: '#operator'
|
|
137
|
-
}, {
|
|
138
|
-
include: '#logical'
|
|
139
|
-
}],
|
|
140
|
-
'#comments': [{
|
|
141
|
-
token: ['punctuation.definition.comment.groq', 'comment.line.double-slash.js'],
|
|
142
|
-
regex: /(\/\/)(.*$)/
|
|
143
|
-
}],
|
|
144
|
-
'#nullary-access-operator': [{
|
|
145
|
-
token: 'constant.language.groq',
|
|
146
|
-
regex: /[*@^]/
|
|
147
|
-
}],
|
|
148
|
-
'#constant': [{
|
|
149
|
-
token: 'constant.language.groq',
|
|
150
|
-
regex: /\b(?:true|false|null)\b/
|
|
151
|
-
}],
|
|
152
|
-
'#number': [{
|
|
153
|
-
token: 'constant.numeric.groq',
|
|
154
|
-
regex: /-?(?:0|[1-9]\d*)(?:(?:\.\d+)?(?:[eE][+-]?\d+)?)?/
|
|
155
|
-
}],
|
|
156
|
-
'#named-projection': [{
|
|
157
|
-
include: '#identifier'
|
|
158
|
-
}, {
|
|
159
|
-
include: '#objectkey'
|
|
160
|
-
}, {
|
|
161
|
-
include: '#projection'
|
|
162
|
-
}],
|
|
163
|
-
'#projection': [{
|
|
164
|
-
token: 'punctuation.definition.projection.begin.groq',
|
|
165
|
-
regex: /\{/,
|
|
166
|
-
push: [{
|
|
167
|
-
token: 'punctuation.definition.projection.end.groq',
|
|
168
|
-
regex: /\}/,
|
|
169
|
-
next: 'pop'
|
|
170
|
-
}, {
|
|
171
|
-
include: '#identifier'
|
|
172
|
-
}, {
|
|
173
|
-
include: '#objectkey'
|
|
174
|
-
}, {
|
|
175
|
-
include: '#named-projection'
|
|
176
|
-
}, {
|
|
177
|
-
include: '#comments'
|
|
178
|
-
}, {
|
|
179
|
-
include: '#spread'
|
|
180
|
-
}, {
|
|
181
|
-
include: '#pair'
|
|
182
|
-
}, {
|
|
183
|
-
token: 'punctuation.separator.projection.key-value.groq',
|
|
184
|
-
regex: /:/,
|
|
185
|
-
push: [{
|
|
186
|
-
token: 'punctuation.separator.projection.pair.groq',
|
|
187
|
-
regex: /,|(?=\})/,
|
|
188
|
-
next: 'pop'
|
|
189
|
-
}, {
|
|
190
|
-
include: '#nullary-access-operator'
|
|
191
|
-
}, {
|
|
192
|
-
include: '#arraylike'
|
|
193
|
-
}, {
|
|
194
|
-
include: '#value'
|
|
195
|
-
}, {
|
|
196
|
-
include: '#spread'
|
|
197
|
-
}, {
|
|
198
|
-
include: '#identifier'
|
|
199
|
-
}, {
|
|
200
|
-
include: '#operator'
|
|
201
|
-
}, {
|
|
202
|
-
include: '#comparison'
|
|
203
|
-
}, {
|
|
204
|
-
include: '#pair'
|
|
205
|
-
}, {
|
|
206
|
-
token: 'invalid.illegal.expected-projection-separator.groq',
|
|
207
|
-
regex: /[^\s,]/
|
|
208
|
-
}, {
|
|
209
|
-
defaultToken: 'meta.structure.projection.value.groq'
|
|
210
|
-
}]
|
|
211
|
-
}, {
|
|
212
|
-
token: 'invalid.illegal.expected-projection-separator.groq',
|
|
213
|
-
regex: /[^\s},]/
|
|
214
|
-
}, {
|
|
215
|
-
defaultToken: 'meta.structure.projection.groq'
|
|
216
|
-
}]
|
|
217
|
-
}],
|
|
218
|
-
'#string': [{
|
|
219
|
-
include: '#single-string'
|
|
220
|
-
}, {
|
|
221
|
-
include: '#double-string'
|
|
222
|
-
}],
|
|
223
|
-
'#double-string': [{
|
|
224
|
-
token: 'punctuation.definition.string.begin.groq',
|
|
225
|
-
regex: /"/,
|
|
226
|
-
push: [{
|
|
227
|
-
token: 'punctuation.definition.string.end.groq',
|
|
228
|
-
regex: /"/,
|
|
229
|
-
next: 'pop'
|
|
230
|
-
}, {
|
|
231
|
-
include: '#stringcontent'
|
|
232
|
-
}, {
|
|
233
|
-
defaultToken: 'string.quoted.double.groq'
|
|
234
|
-
}]
|
|
235
|
-
}],
|
|
236
|
-
'#single-string': [{
|
|
237
|
-
token: 'punctuation.definition.string.single.begin.groq',
|
|
238
|
-
regex: /'/,
|
|
239
|
-
push: [{
|
|
240
|
-
token: 'punctuation.definition.string.single.end.groq',
|
|
241
|
-
regex: /'/,
|
|
242
|
-
next: 'pop'
|
|
243
|
-
}, {
|
|
244
|
-
include: '#stringcontent'
|
|
245
|
-
}, {
|
|
246
|
-
defaultToken: 'string.quoted.single.groq'
|
|
247
|
-
}]
|
|
248
|
-
}],
|
|
249
|
-
'#objectkey': [{
|
|
250
|
-
include: '#string'
|
|
251
|
-
}],
|
|
252
|
-
'#stringcontent': [{
|
|
253
|
-
token: 'constant.character.escape.groq',
|
|
254
|
-
regex: /\\(?:["\\/bfnrt]|u[0-9a-fA-F]{4})/
|
|
255
|
-
}, {
|
|
256
|
-
token: 'invalid.illegal.unrecognized-string-escape.groq',
|
|
257
|
-
regex: /\\./
|
|
258
|
-
}],
|
|
259
|
-
'#sort-pair': [{
|
|
260
|
-
token: ['variable.other.readwrite.groq', 'text', 'keyword.other.groq'],
|
|
261
|
-
regex: /([_A-Za-z][_0-9A-Za-z]*)(?:(\s*)(asc|desc))?/
|
|
262
|
-
}, {
|
|
263
|
-
token: ['constant.language.groq', 'punctuation.definition.bracket.begin.groq'],
|
|
264
|
-
regex: /(@)(\[)/,
|
|
265
|
-
push: [{
|
|
266
|
-
token: ['punctuation.definition.bracket.begin.groq', 'text', 'keyword.other.groq'],
|
|
267
|
-
regex: /(\])(?:(\s*)(asc|desc))?/,
|
|
268
|
-
next: 'pop'
|
|
269
|
-
}, {
|
|
270
|
-
include: '#string'
|
|
271
|
-
}]
|
|
272
|
-
}],
|
|
273
|
-
'#sort-order': [{
|
|
274
|
-
token: 'support.function.sortorder.begin.groq',
|
|
275
|
-
regex: /\border\s*\(/,
|
|
276
|
-
push: [{
|
|
277
|
-
token: 'support.function.sortorder.end.groq',
|
|
278
|
-
regex: /\)/,
|
|
279
|
-
next: 'pop'
|
|
280
|
-
}, {
|
|
281
|
-
include: '#sort-pair'
|
|
282
|
-
}, {
|
|
283
|
-
token: 'punctuation.separator.array.groq',
|
|
284
|
-
regex: /,/
|
|
285
|
-
}, {
|
|
286
|
-
token: 'invalid.illegal.expected-sort-separator.groq',
|
|
287
|
-
regex: /[^\s\]]/
|
|
288
|
-
}, {
|
|
289
|
-
defaultToken: 'support.function.sortorder.groq'
|
|
290
|
-
}]
|
|
291
|
-
}],
|
|
292
|
-
'#function-call': [{
|
|
293
|
-
include: '#function-var-arg'
|
|
294
|
-
}, {
|
|
295
|
-
include: '#function-single-arg'
|
|
296
|
-
}, {
|
|
297
|
-
include: '#function-round'
|
|
298
|
-
}],
|
|
299
|
-
'#function-var-arg': [{
|
|
300
|
-
token: 'support.function.vararg.begin.groq',
|
|
301
|
-
regex: /\b(?:coalesce|select)\s*\(/,
|
|
302
|
-
push: [{
|
|
303
|
-
token: 'support.function.vararg.end.groq',
|
|
304
|
-
regex: /\)/,
|
|
305
|
-
next: 'pop'
|
|
306
|
-
}, {
|
|
307
|
-
include: '#value'
|
|
308
|
-
}, {
|
|
309
|
-
include: '#identifier'
|
|
310
|
-
}, {
|
|
311
|
-
include: '#filter'
|
|
312
|
-
}, {
|
|
313
|
-
include: '#pair'
|
|
314
|
-
}, {
|
|
315
|
-
token: 'punctuation.separator.array.groq',
|
|
316
|
-
regex: /,/
|
|
317
|
-
}, {
|
|
318
|
-
defaultToken: 'support.function.vararg.groq'
|
|
319
|
-
}]
|
|
320
|
-
}],
|
|
321
|
-
'#function-single-arg': [{
|
|
322
|
-
token: 'support.function.singlearg.begin.groq',
|
|
323
|
-
regex: /\b(?:count|defined|length|path|references)\s*\(/,
|
|
324
|
-
push: [{
|
|
325
|
-
token: 'support.function.singlearg.end.groq',
|
|
326
|
-
regex: /\)/,
|
|
327
|
-
next: 'pop'
|
|
328
|
-
}, {
|
|
329
|
-
include: '#query'
|
|
330
|
-
}, {
|
|
331
|
-
include: '#identifier'
|
|
332
|
-
}, {
|
|
333
|
-
include: '#value'
|
|
334
|
-
}, {
|
|
335
|
-
include: '#pair'
|
|
336
|
-
}, {
|
|
337
|
-
defaultToken: 'support.function.singlearg.groq'
|
|
338
|
-
}]
|
|
339
|
-
}],
|
|
340
|
-
'#identifier': [{
|
|
341
|
-
token: ['variable.other.readwrite.groq', 'text', 'punctuation.definition.block.js', 'text', 'keyword.operator.reference.groq'],
|
|
342
|
-
regex: /([_A-Za-z][_0-9A-Za-z]*)(\s*)((?:\[\s*\])?)(\s*)(->)/
|
|
343
|
-
}, {
|
|
344
|
-
token: ['variable.other.readwrite.groq', 'constant.language.groq', 'text', 'punctuation.definition.block.js', 'text', 'keyword.operator.descendant.groq'],
|
|
345
|
-
regex: /(?:([_A-Za-z][_0-9A-Za-z]*)|([@^]))(\s*)((?:\[\s*\])?)(\s*)(\.)/
|
|
346
|
-
}, {
|
|
347
|
-
token: 'variable.other.readwrite.groq',
|
|
348
|
-
regex: /[_A-Za-z][_0-9A-Za-z]*/
|
|
349
|
-
}],
|
|
350
|
-
'#value': [{
|
|
351
|
-
include: '#constant'
|
|
352
|
-
}, {
|
|
353
|
-
include: '#number'
|
|
354
|
-
}, {
|
|
355
|
-
include: '#string'
|
|
356
|
-
}, {
|
|
357
|
-
include: '#array'
|
|
358
|
-
}, {
|
|
359
|
-
include: '#variable'
|
|
360
|
-
}, {
|
|
361
|
-
include: '#projection'
|
|
362
|
-
}, {
|
|
363
|
-
include: '#comments'
|
|
364
|
-
}, {
|
|
365
|
-
include: '#function-call'
|
|
366
|
-
}]
|
|
367
|
-
};
|
|
368
|
-
ace.define('ace/mode/groq_highlight_rules', ['require', 'exports', 'module', 'ace/lib/oop', 'ace/mode/text_highlight_rules'], function (acequire, exports, _module) {
|
|
369
|
-
var oop = acequire('../lib/oop');
|
|
370
|
-
var TextHighlightRules = acequire('./text_highlight_rules').TextHighlightRules;
|
|
371
|
-
|
|
372
|
-
var GroqHighlightRules = function GroqHighlightRules() {
|
|
373
|
-
/* eslint-disable @typescript-eslint/ban-ts-comment */
|
|
374
|
-
// @ts-ignore
|
|
375
|
-
this.$rules = rules; // @ts-ignore
|
|
376
|
-
|
|
377
|
-
this.normalizeRules();
|
|
378
|
-
/* eslint-enable @typescript-eslint/ban-ts-comment */
|
|
379
|
-
};
|
|
380
|
-
|
|
381
|
-
oop.inherits(GroqHighlightRules, TextHighlightRules);
|
|
382
|
-
exports.GroqHighlightRules = GroqHighlightRules;
|
|
383
|
-
});
|
|
384
|
-
ace.define('ace/mode/groq', ['require', 'exports', 'module', 'ace/lib/oop', 'ace/mode/text', 'ace/tokenizer', 'ace/mode/groq_highlight_rules', 'ace/mode/folding/cstyle'], function (acequire, exports, _module) {
|
|
385
|
-
// eslint-disable-next-line strict
|
|
386
|
-
'use strict';
|
|
387
|
-
|
|
388
|
-
var oop = acequire('../lib/oop');
|
|
389
|
-
var TextMode = acequire('./text').Mode;
|
|
390
|
-
var Tokenizer = acequire('../tokenizer').Tokenizer;
|
|
391
|
-
var GroqHighlightRules = acequire('./groq_highlight_rules').GroqHighlightRules;
|
|
392
|
-
var FoldMode = acequire('./folding/cstyle').FoldMode;
|
|
393
|
-
|
|
394
|
-
var Mode = function Mode() {
|
|
395
|
-
/* eslint-disable @typescript-eslint/ban-ts-comment */
|
|
396
|
-
var highlighter = new GroqHighlightRules(); // @ts-ignore
|
|
397
|
-
|
|
398
|
-
this.foldingRules = new FoldMode(); // @ts-ignore
|
|
399
|
-
|
|
400
|
-
this.$tokenizer = new Tokenizer(highlighter.getRules()); // @ts-ignore
|
|
401
|
-
|
|
402
|
-
this.$keywordList = highlighter.$keywordList;
|
|
403
|
-
/* eslint-enable @typescript-eslint/ban-ts-comment */
|
|
404
|
-
};
|
|
405
|
-
|
|
406
|
-
oop.inherits(Mode, TextMode);
|
|
407
|
-
(function () {
|
|
408
|
-
/* eslint-disable @typescript-eslint/ban-ts-comment */
|
|
409
|
-
// @ts-ignore
|
|
410
|
-
this.lineCommentStart = "'";
|
|
411
|
-
/* eslint-enable @typescript-eslint/ban-ts-comment */
|
|
412
|
-
}).call(Mode.prototype);
|
|
413
|
-
exports.Mode = Mode;
|
|
414
|
-
});
|
package/lib/schema.js
DELETED
|
@@ -1,69 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.default = void 0;
|
|
7
|
-
|
|
8
|
-
var _react = _interopRequireDefault(require("react"));
|
|
9
|
-
|
|
10
|
-
var _icons = require("@sanity/icons");
|
|
11
|
-
|
|
12
|
-
var _CodeInput = _interopRequireDefault(require("./CodeInput"));
|
|
13
|
-
|
|
14
|
-
var _PreviewCode = _interopRequireDefault(require("./PreviewCode"));
|
|
15
|
-
|
|
16
|
-
var _getMedia = require("./getMedia");
|
|
17
|
-
|
|
18
|
-
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
19
|
-
|
|
20
|
-
var Preview = props => {
|
|
21
|
-
return /*#__PURE__*/_react.default.createElement(_PreviewCode.default, props);
|
|
22
|
-
};
|
|
23
|
-
|
|
24
|
-
var _default = {
|
|
25
|
-
name: 'code',
|
|
26
|
-
type: 'object',
|
|
27
|
-
title: 'Code',
|
|
28
|
-
inputComponent: _CodeInput.default,
|
|
29
|
-
icon: _icons.CodeBlockIcon,
|
|
30
|
-
fields: [{
|
|
31
|
-
name: 'language',
|
|
32
|
-
title: 'Language',
|
|
33
|
-
type: 'string'
|
|
34
|
-
}, {
|
|
35
|
-
name: 'filename',
|
|
36
|
-
title: 'Filename',
|
|
37
|
-
type: 'string'
|
|
38
|
-
}, {
|
|
39
|
-
title: 'Code',
|
|
40
|
-
name: 'code',
|
|
41
|
-
type: 'text'
|
|
42
|
-
}, {
|
|
43
|
-
title: 'Highlighted lines',
|
|
44
|
-
name: 'highlightedLines',
|
|
45
|
-
type: 'array',
|
|
46
|
-
of: [{
|
|
47
|
-
type: 'number',
|
|
48
|
-
title: 'Highlighted line'
|
|
49
|
-
}]
|
|
50
|
-
}],
|
|
51
|
-
preview: {
|
|
52
|
-
select: {
|
|
53
|
-
language: 'language',
|
|
54
|
-
code: 'code',
|
|
55
|
-
filename: 'filename',
|
|
56
|
-
highlightedLines: 'highlightedLines'
|
|
57
|
-
},
|
|
58
|
-
prepare: value => {
|
|
59
|
-
return {
|
|
60
|
-
title: value.filename || (value.language || 'unknown').toUpperCase(),
|
|
61
|
-
media: (0, _getMedia.getMedia)(value === null || value === void 0 ? void 0 : value.language),
|
|
62
|
-
extendedPreview: /*#__PURE__*/_react.default.createElement(Preview, {
|
|
63
|
-
value: value
|
|
64
|
-
})
|
|
65
|
-
};
|
|
66
|
-
}
|
|
67
|
-
}
|
|
68
|
-
};
|
|
69
|
-
exports.default = _default;
|
package/lib/types.js
DELETED
package/sanity.json
DELETED
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"paths": {
|
|
3
|
-
"source": "./src",
|
|
4
|
-
"compiled": "./lib"
|
|
5
|
-
},
|
|
6
|
-
"parts": [
|
|
7
|
-
{
|
|
8
|
-
"name": "part:@sanity/form-builder/input/code",
|
|
9
|
-
"description": "An editor for code in sanity"
|
|
10
|
-
},
|
|
11
|
-
{
|
|
12
|
-
"implements": "part:@sanity/form-builder/input/code",
|
|
13
|
-
"path": "CodeInput"
|
|
14
|
-
},
|
|
15
|
-
{
|
|
16
|
-
"name": "part:@sanity/form-builder/input/code/schema",
|
|
17
|
-
"description": "An editor for code in sanity"
|
|
18
|
-
},
|
|
19
|
-
{
|
|
20
|
-
"implements": "part:@sanity/base/schema-type",
|
|
21
|
-
"path": "schema"
|
|
22
|
-
},
|
|
23
|
-
{
|
|
24
|
-
"implements": "part:@sanity/form-builder/input/code/schema",
|
|
25
|
-
"path": "deprecatedSchema"
|
|
26
|
-
}
|
|
27
|
-
]
|
|
28
|
-
}
|
package/tsconfig.json
DELETED
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"extends": "../../../tsconfig",
|
|
3
|
-
"include": ["src"],
|
|
4
|
-
"compilerOptions": {
|
|
5
|
-
"composite": true,
|
|
6
|
-
"outDir": "./dist/dts",
|
|
7
|
-
"rootDir": "./src",
|
|
8
|
-
"checkJs": true,
|
|
9
|
-
"allowJs": true,
|
|
10
|
-
"jsx": "react"
|
|
11
|
-
},
|
|
12
|
-
"references": [
|
|
13
|
-
{
|
|
14
|
-
"path": "../base"
|
|
15
|
-
},
|
|
16
|
-
{
|
|
17
|
-
"path": "../form-builder"
|
|
18
|
-
},
|
|
19
|
-
{
|
|
20
|
-
"path": "../types"
|
|
21
|
-
},
|
|
22
|
-
{
|
|
23
|
-
"path": "../util"
|
|
24
|
-
}
|
|
25
|
-
]
|
|
26
|
-
}
|