@sanity/code-input 3.0.0-v3-studio.12 → 3.0.0-v3-studio.14

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 CHANGED
@@ -35,7 +35,7 @@ Add it as a plugin in sanity.config.ts (or .js):
35
35
  ```js
36
36
  import { codeInput } from "@sanity/code-input";
37
37
 
38
- export default createConfig({
38
+ export default defineConfig({
39
39
  // ...
40
40
  plugins: [
41
41
  codeInput(),
@@ -179,18 +179,9 @@ with default configuration for build & watch scripts.
179
179
  See [Testing a plugin in Sanity Studio](https://github.com/sanity-io/plugin-kit#testing-a-plugin-in-sanity-studio)
180
180
  on how to run this plugin with hotreload in the studio.
181
181
 
182
- ### Dev note on parcel + vite in dev mode:
183
- Vite will emit a warning when using yalc add + link in a Studio running with
184
- vite dev server.
185
- It happens because parcel appends ?currentTimestamp to the import statement for
186
- cache busting, which is [not supported by vite](https://github.com/rollup/plugins/tree/master/packages/dynamic-import-vars#limitations).
182
+ ### Release new version
187
183
 
188
- However, the code _works_, and when building for production this is not an issue, as parcel
189
- will not suffix the timestamp in the prod bundle.
190
-
191
- ## Release new version
192
-
193
- Run ["CI & Release" workflow](https://github.com/sanity-io/code-input/actions).
184
+ Run ["CI & Release" workflow](https://github.com/sanity-io/code-input/actions/workflows/main.yml).
194
185
  Make sure to select the main branch and check "Release new version".
195
186
 
196
187
  Semantic release will only release on configured branches, so it is safe to run release on any branch.
@@ -0,0 +1,2 @@
1
+ import e from"react-ace";export{default}from"react-ace";import"ace-builds/src-noconflict/mode-batchfile";import"ace-builds/src-noconflict/mode-csharp";import"ace-builds/src-noconflict/mode-css";import"ace-builds/src-noconflict/mode-golang";import"ace-builds/src-noconflict/mode-html";import"ace-builds/src-noconflict/mode-java";import"ace-builds/src-noconflict/mode-javascript";import"ace-builds/src-noconflict/mode-json";import"ace-builds/src-noconflict/mode-jsx";import"ace-builds/src-noconflict/mode-markdown";import"ace-builds/src-noconflict/mode-mysql";import"ace-builds/src-noconflict/mode-php";import"ace-builds/src-noconflict/mode-python";import"ace-builds/src-noconflict/mode-ruby";import"ace-builds/src-noconflict/mode-sass";import"ace-builds/src-noconflict/mode-scss";import"ace-builds/src-noconflict/mode-sh";import"ace-builds/src-noconflict/mode-text";import"ace-builds/src-noconflict/mode-tsx";import"ace-builds/src-noconflict/mode-typescript";import"ace-builds/src-noconflict/mode-xml";import"ace-builds/src-noconflict/mode-yaml";import"ace-builds/src-noconflict/theme-github";import"ace-builds/src-noconflict/theme-monokai";import"ace-builds/src-noconflict/theme-terminal";import"ace-builds/src-noconflict/theme-tomorrow";const o={start:[{include:"#query"},{include:"#value"},{include:"#pair"}],"#query":[{include:"#nullary-access-operator"},{include:"#arraylike"},{include:"#pipe"},{include:"#sort-order"},{include:"#filter"}],"#variable":[{token:"variable.other.groq",regex:/\$[_A-Za-z][_0-9A-Za-z]*/}],"#keyword":[{token:"keyword.other.groq",regex:/\b(?:asc|desc|in|match)\b/}],"#comparison":[{token:"keyword.operator.comparison.groq",regex:/==|!=|>=|<=|<!=>|<|>/}],"#operator":[{token:"keyword.operator.arithmetic.groq",regex:/\+|-|\*{1,2}|\/|%/}],"#pipe":[{token:"keyword.operator.pipe.groq",regex:/\|/}],"#logical":[{token:"keyword.operator.logical.groq",regex:/!|&&|\|\|/}],"#reference":[{token:"keyword.operator.reference.groq",regex:/->/}],"#pair":[{include:"#identifier"},{include:"#value"},{include:"#filter"},{token:"keyword.operator.pair.groq",regex:/[=]>/}],"#arraylike":[{token:"punctuation.definition.bracket.begin.groq",regex:/\[/,push:[{token:["text","keyword.operator.descendant.groq"],regex:/(\])((?:\s*\.)?)/,next:"pop"},{include:"#range"},{include:"#filter"},{include:"#array-values"}]}],"#array":[{token:"punctuation.definition.bracket.begin.groq",regex:/\[/,push:[{token:"punctuation.definition.bracket.end.groq",regex:/\]/,next:"pop"},{include:"#array-values"},{defaultToken:"meta.structure.array.groq"}]}],"#range":[{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"],regex:/(\s*)(\d+)(\s*)(\.{2,3})(\s*)(\d+)(\s*)/}],"#spread":[{token:"punctuation.definition.spread.begin.groq",regex:/\.\.\./,push:[{include:"#array"},{include:"#function-call"},{include:"#projection"},{token:"punctuation.definition.spread.end.groq",regex:/(?=.)/,next:"pop"},{defaultToken:"meta.structure.spread.groq"}]}],"#array-values":[{include:"#value"},{include:"#spread"},{token:"punctuation.separator.array.groq",regex:/,/},{token:"invalid.illegal.expected-array-separator.groq",regex:/[^\s\]]/}],"#filter":[{include:"#function-call"},{include:"#keyword"},{include:"#constant"},{include:"#identifier"},{include:"#value"},{include:"#comparison"},{include:"#operator"},{include:"#logical"}],"#comments":[{token:["punctuation.definition.comment.groq","comment.line.double-slash.js"],regex:/(\/\/)(.*$)/}],"#nullary-access-operator":[{token:"constant.language.groq",regex:/[*@^]/}],"#constant":[{token:"constant.language.groq",regex:/\b(?:true|false|null)\b/}],"#number":[{token:"constant.numeric.groq",regex:/-?(?:0|[1-9]\d*)(?:(?:\.\d+)?(?:[eE][+-]?\d+)?)?/}],"#named-projection":[{include:"#identifier"},{include:"#objectkey"},{include:"#projection"}],"#projection":[{token:"punctuation.definition.projection.begin.groq",regex:/\{/,push:[{token:"punctuation.definition.projection.end.groq",regex:/\}/,next:"pop"},{include:"#identifier"},{include:"#objectkey"},{include:"#named-projection"},{include:"#comments"},{include:"#spread"},{include:"#pair"},{token:"punctuation.separator.projection.key-value.groq",regex:/:/,push:[{token:"punctuation.separator.projection.pair.groq",regex:/,|(?=\})/,next:"pop"},{include:"#nullary-access-operator"},{include:"#arraylike"},{include:"#value"},{include:"#spread"},{include:"#identifier"},{include:"#operator"},{include:"#comparison"},{include:"#pair"},{token:"invalid.illegal.expected-projection-separator.groq",regex:/[^\s,]/},{defaultToken:"meta.structure.projection.value.groq"}]},{token:"invalid.illegal.expected-projection-separator.groq",regex:/[^\s},]/},{defaultToken:"meta.structure.projection.groq"}]}],"#string":[{include:"#single-string"},{include:"#double-string"}],"#double-string":[{token:"punctuation.definition.string.begin.groq",regex:/"/,push:[{token:"punctuation.definition.string.end.groq",regex:/"/,next:"pop"},{include:"#stringcontent"},{defaultToken:"string.quoted.double.groq"}]}],"#single-string":[{token:"punctuation.definition.string.single.begin.groq",regex:/'/,push:[{token:"punctuation.definition.string.single.end.groq",regex:/'/,next:"pop"},{include:"#stringcontent"},{defaultToken:"string.quoted.single.groq"}]}],"#objectkey":[{include:"#string"}],"#stringcontent":[{token:"constant.character.escape.groq",regex:/\\(?:["\\/bfnrt]|u[0-9a-fA-F]{4})/},{token:"invalid.illegal.unrecognized-string-escape.groq",regex:/\\./}],"#sort-pair":[{token:["variable.other.readwrite.groq","text","keyword.other.groq"],regex:/([_A-Za-z][_0-9A-Za-z]*)(?:(\s*)(asc|desc))?/},{token:["constant.language.groq","punctuation.definition.bracket.begin.groq"],regex:/(@)(\[)/,push:[{token:["punctuation.definition.bracket.begin.groq","text","keyword.other.groq"],regex:/(\])(?:(\s*)(asc|desc))?/,next:"pop"},{include:"#string"}]}],"#sort-order":[{token:"support.function.sortorder.begin.groq",regex:/\border\s*\(/,push:[{token:"support.function.sortorder.end.groq",regex:/\)/,next:"pop"},{include:"#sort-pair"},{token:"punctuation.separator.array.groq",regex:/,/},{token:"invalid.illegal.expected-sort-separator.groq",regex:/[^\s\]]/},{defaultToken:"support.function.sortorder.groq"}]}],"#function-call":[{include:"#function-var-arg"},{include:"#function-single-arg"},{include:"#function-round"}],"#function-var-arg":[{token:"support.function.vararg.begin.groq",regex:/\b(?:coalesce|select)\s*\(/,push:[{token:"support.function.vararg.end.groq",regex:/\)/,next:"pop"},{include:"#value"},{include:"#identifier"},{include:"#filter"},{include:"#pair"},{token:"punctuation.separator.array.groq",regex:/,/},{defaultToken:"support.function.vararg.groq"}]}],"#function-single-arg":[{token:"support.function.singlearg.begin.groq",regex:/\b(?:count|defined|length|path|references)\s*\(/,push:[{token:"support.function.singlearg.end.groq",regex:/\)/,next:"pop"},{include:"#query"},{include:"#identifier"},{include:"#value"},{include:"#pair"},{defaultToken:"support.function.singlearg.groq"}]}],"#identifier":[{token:["variable.other.readwrite.groq","text","punctuation.definition.block.js","text","keyword.operator.reference.groq"],regex:/([_A-Za-z][_0-9A-Za-z]*)(\s*)((?:\[\s*\])?)(\s*)(->)/},{token:["variable.other.readwrite.groq","constant.language.groq","text","punctuation.definition.block.js","text","keyword.operator.descendant.groq"],regex:/(?:([_A-Za-z][_0-9A-Za-z]*)|([@^]))(\s*)((?:\[\s*\])?)(\s*)(\.)/},{token:"variable.other.readwrite.groq",regex:/[_A-Za-z][_0-9A-Za-z]*/}],"#value":[{include:"#constant"},{include:"#number"},{include:"#string"},{include:"#array"},{include:"#variable"},{include:"#projection"},{include:"#comments"},{include:"#function-call"}]};ace.define("ace/mode/groq_highlight_rules",["require","exports","module","ace/lib/oop","ace/mode/text_highlight_rules"],((e,r,n)=>{const t=e("../lib/oop"),i=e("./text_highlight_rules").TextHighlightRules,c=function(){this.$rules=o,this.normalizeRules()};t.inherits(c,i),r.GroqHighlightRules=c})),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"],((e,o,r)=>{const n=e("../lib/oop"),t=e("./text").Mode,i=e("../tokenizer").Tokenizer,c=e("./groq_highlight_rules").GroqHighlightRules,a=e("./folding/cstyle").FoldMode,l=function(){const e=new c;this.foldingRules=new a,this.$tokenizer=new i(e.getRules()),this.$keywordList=e.$keywordList};n.inherits(l,t),function(){this.lineCommentStart="'"}.call(l.prototype),o.Mode=l}));
2
+ //# sourceMappingURL=editorSupport-895caf32.esm.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"editorSupport-895caf32.esm.js","sources":["../../src/ace-editor/groq.ts"],"sourcesContent":["/* eslint-disable no-undef */\n\nexport {}\n\n// Grammar from https://github.com/sanity-io/vscode-sanity\nconst rules = {\n start: [\n {\n include: '#query',\n },\n {\n include: '#value',\n },\n {\n include: '#pair',\n },\n ],\n '#query': [\n {\n include: '#nullary-access-operator',\n },\n {\n include: '#arraylike',\n },\n {\n include: '#pipe',\n },\n {\n include: '#sort-order',\n },\n {\n include: '#filter',\n },\n ],\n '#variable': [\n {\n token: 'variable.other.groq',\n regex: /\\$[_A-Za-z][_0-9A-Za-z]*/,\n },\n ],\n '#keyword': [\n {\n token: 'keyword.other.groq',\n regex: /\\b(?:asc|desc|in|match)\\b/,\n },\n ],\n '#comparison': [\n {\n token: 'keyword.operator.comparison.groq',\n // eslint-disable-next-line no-div-regex\n regex: /==|!=|>=|<=|<!=>|<|>/,\n },\n ],\n '#operator': [\n {\n token: 'keyword.operator.arithmetic.groq',\n regex: /\\+|-|\\*{1,2}|\\/|%/,\n },\n ],\n '#pipe': [\n {\n token: 'keyword.operator.pipe.groq',\n regex: /\\|/,\n },\n ],\n '#logical': [\n {\n token: 'keyword.operator.logical.groq',\n regex: /!|&&|\\|\\|/,\n },\n ],\n '#reference': [\n {\n token: 'keyword.operator.reference.groq',\n regex: /->/,\n },\n ],\n '#pair': [\n {\n include: '#identifier',\n },\n {\n include: '#value',\n },\n {\n include: '#filter',\n },\n {\n token: 'keyword.operator.pair.groq',\n regex: /[=]>/,\n },\n ],\n '#arraylike': [\n {\n token: 'punctuation.definition.bracket.begin.groq',\n regex: /\\[/,\n push: [\n {\n token: ['text', 'keyword.operator.descendant.groq'],\n regex: /(\\])((?:\\s*\\.)?)/,\n next: 'pop',\n },\n {\n include: '#range',\n },\n {\n include: '#filter',\n },\n {\n include: '#array-values',\n },\n ],\n },\n ],\n '#array': [\n {\n token: 'punctuation.definition.bracket.begin.groq',\n regex: /\\[/,\n push: [\n {\n token: 'punctuation.definition.bracket.end.groq',\n regex: /\\]/,\n next: 'pop',\n },\n {\n include: '#array-values',\n },\n {\n defaultToken: 'meta.structure.array.groq',\n },\n ],\n },\n ],\n '#range': [\n {\n token: [\n 'meta.structure.range.groq',\n 'constant.numeric.groq',\n 'meta.structure.range.groq',\n 'keyword.operator.range.groq',\n 'meta.structure.range.groq',\n 'constant.numeric.groq',\n 'meta.structure.range.groq',\n ],\n regex: /(\\s*)(\\d+)(\\s*)(\\.{2,3})(\\s*)(\\d+)(\\s*)/,\n },\n ],\n '#spread': [\n {\n token: 'punctuation.definition.spread.begin.groq',\n regex: /\\.\\.\\./,\n push: [\n {\n include: '#array',\n },\n {\n include: '#function-call',\n },\n {\n include: '#projection',\n },\n {\n token: 'punctuation.definition.spread.end.groq',\n regex: /(?=.)/,\n next: 'pop',\n },\n {\n defaultToken: 'meta.structure.spread.groq',\n },\n ],\n },\n ],\n '#array-values': [\n {\n include: '#value',\n },\n {\n include: '#spread',\n },\n {\n token: 'punctuation.separator.array.groq',\n regex: /,/,\n },\n {\n token: 'invalid.illegal.expected-array-separator.groq',\n regex: /[^\\s\\]]/,\n },\n ],\n '#filter': [\n {\n include: '#function-call',\n },\n {\n include: '#keyword',\n },\n {\n include: '#constant',\n },\n {\n include: '#identifier',\n },\n {\n include: '#value',\n },\n {\n include: '#comparison',\n },\n {\n include: '#operator',\n },\n {\n include: '#logical',\n },\n ],\n '#comments': [\n {\n token: ['punctuation.definition.comment.groq', 'comment.line.double-slash.js'],\n regex: /(\\/\\/)(.*$)/,\n },\n ],\n '#nullary-access-operator': [\n {\n token: 'constant.language.groq',\n regex: /[*@^]/,\n },\n ],\n '#constant': [\n {\n token: 'constant.language.groq',\n regex: /\\b(?:true|false|null)\\b/,\n },\n ],\n '#number': [\n {\n token: 'constant.numeric.groq',\n regex: /-?(?:0|[1-9]\\d*)(?:(?:\\.\\d+)?(?:[eE][+-]?\\d+)?)?/,\n },\n ],\n '#named-projection': [\n {\n include: '#identifier',\n },\n {\n include: '#objectkey',\n },\n {\n include: '#projection',\n },\n ],\n '#projection': [\n {\n token: 'punctuation.definition.projection.begin.groq',\n regex: /\\{/,\n push: [\n {\n token: 'punctuation.definition.projection.end.groq',\n regex: /\\}/,\n next: 'pop',\n },\n {\n include: '#identifier',\n },\n {\n include: '#objectkey',\n },\n {\n include: '#named-projection',\n },\n {\n include: '#comments',\n },\n {\n include: '#spread',\n },\n {\n include: '#pair',\n },\n {\n token: 'punctuation.separator.projection.key-value.groq',\n regex: /:/,\n push: [\n {\n token: 'punctuation.separator.projection.pair.groq',\n regex: /,|(?=\\})/,\n next: 'pop',\n },\n {\n include: '#nullary-access-operator',\n },\n {\n include: '#arraylike',\n },\n {\n include: '#value',\n },\n {\n include: '#spread',\n },\n {\n include: '#identifier',\n },\n {\n include: '#operator',\n },\n {\n include: '#comparison',\n },\n {\n include: '#pair',\n },\n {\n token: 'invalid.illegal.expected-projection-separator.groq',\n regex: /[^\\s,]/,\n },\n {\n defaultToken: 'meta.structure.projection.value.groq',\n },\n ],\n },\n {\n token: 'invalid.illegal.expected-projection-separator.groq',\n regex: /[^\\s},]/,\n },\n {\n defaultToken: 'meta.structure.projection.groq',\n },\n ],\n },\n ],\n '#string': [\n {\n include: '#single-string',\n },\n {\n include: '#double-string',\n },\n ],\n '#double-string': [\n {\n token: 'punctuation.definition.string.begin.groq',\n regex: /\"/,\n push: [\n {\n token: 'punctuation.definition.string.end.groq',\n regex: /\"/,\n next: 'pop',\n },\n {\n include: '#stringcontent',\n },\n {\n defaultToken: 'string.quoted.double.groq',\n },\n ],\n },\n ],\n '#single-string': [\n {\n token: 'punctuation.definition.string.single.begin.groq',\n regex: /'/,\n push: [\n {\n token: 'punctuation.definition.string.single.end.groq',\n regex: /'/,\n next: 'pop',\n },\n {\n include: '#stringcontent',\n },\n {\n defaultToken: 'string.quoted.single.groq',\n },\n ],\n },\n ],\n '#objectkey': [\n {\n include: '#string',\n },\n ],\n '#stringcontent': [\n {\n token: 'constant.character.escape.groq',\n regex: /\\\\(?:[\"\\\\/bfnrt]|u[0-9a-fA-F]{4})/,\n },\n {\n token: 'invalid.illegal.unrecognized-string-escape.groq',\n regex: /\\\\./,\n },\n ],\n '#sort-pair': [\n {\n token: ['variable.other.readwrite.groq', 'text', 'keyword.other.groq'],\n regex: /([_A-Za-z][_0-9A-Za-z]*)(?:(\\s*)(asc|desc))?/,\n },\n {\n token: ['constant.language.groq', 'punctuation.definition.bracket.begin.groq'],\n regex: /(@)(\\[)/,\n push: [\n {\n token: ['punctuation.definition.bracket.begin.groq', 'text', 'keyword.other.groq'],\n regex: /(\\])(?:(\\s*)(asc|desc))?/,\n next: 'pop',\n },\n {\n include: '#string',\n },\n ],\n },\n ],\n '#sort-order': [\n {\n token: 'support.function.sortorder.begin.groq',\n regex: /\\border\\s*\\(/,\n push: [\n {\n token: 'support.function.sortorder.end.groq',\n regex: /\\)/,\n next: 'pop',\n },\n {\n include: '#sort-pair',\n },\n {\n token: 'punctuation.separator.array.groq',\n regex: /,/,\n },\n {\n token: 'invalid.illegal.expected-sort-separator.groq',\n regex: /[^\\s\\]]/,\n },\n {\n defaultToken: 'support.function.sortorder.groq',\n },\n ],\n },\n ],\n '#function-call': [\n {\n include: '#function-var-arg',\n },\n {\n include: '#function-single-arg',\n },\n {\n include: '#function-round',\n },\n ],\n '#function-var-arg': [\n {\n token: 'support.function.vararg.begin.groq',\n regex: /\\b(?:coalesce|select)\\s*\\(/,\n push: [\n {\n token: 'support.function.vararg.end.groq',\n regex: /\\)/,\n next: 'pop',\n },\n {\n include: '#value',\n },\n {\n include: '#identifier',\n },\n {\n include: '#filter',\n },\n {\n include: '#pair',\n },\n {\n token: 'punctuation.separator.array.groq',\n regex: /,/,\n },\n {\n defaultToken: 'support.function.vararg.groq',\n },\n ],\n },\n ],\n '#function-single-arg': [\n {\n token: 'support.function.singlearg.begin.groq',\n regex: /\\b(?:count|defined|length|path|references)\\s*\\(/,\n push: [\n {\n token: 'support.function.singlearg.end.groq',\n regex: /\\)/,\n next: 'pop',\n },\n {\n include: '#query',\n },\n {\n include: '#identifier',\n },\n {\n include: '#value',\n },\n {\n include: '#pair',\n },\n {\n defaultToken: 'support.function.singlearg.groq',\n },\n ],\n },\n ],\n '#identifier': [\n {\n token: [\n 'variable.other.readwrite.groq',\n 'text',\n 'punctuation.definition.block.js',\n 'text',\n 'keyword.operator.reference.groq',\n ],\n regex: /([_A-Za-z][_0-9A-Za-z]*)(\\s*)((?:\\[\\s*\\])?)(\\s*)(->)/,\n },\n {\n token: [\n 'variable.other.readwrite.groq',\n 'constant.language.groq',\n 'text',\n 'punctuation.definition.block.js',\n 'text',\n 'keyword.operator.descendant.groq',\n ],\n regex: /(?:([_A-Za-z][_0-9A-Za-z]*)|([@^]))(\\s*)((?:\\[\\s*\\])?)(\\s*)(\\.)/,\n },\n {\n token: 'variable.other.readwrite.groq',\n regex: /[_A-Za-z][_0-9A-Za-z]*/,\n },\n ],\n '#value': [\n {\n include: '#constant',\n },\n {\n include: '#number',\n },\n {\n include: '#string',\n },\n {\n include: '#array',\n },\n {\n include: '#variable',\n },\n {\n include: '#projection',\n },\n {\n include: '#comments',\n },\n {\n include: '#function-call',\n },\n ],\n}\n\ndeclare let ace: any\n\nace.define(\n 'ace/mode/groq_highlight_rules',\n ['require', 'exports', 'module', 'ace/lib/oop', 'ace/mode/text_highlight_rules'],\n (acequire: (id: string) => any, exports: Record<string, unknown>, _module: any) => {\n const oop = acequire('../lib/oop')\n const TextHighlightRules = acequire('./text_highlight_rules').TextHighlightRules\n\n const GroqHighlightRules = function () {\n /* eslint-disable @typescript-eslint/ban-ts-comment */\n // @ts-ignore\n this.$rules = rules\n // @ts-ignore\n this.normalizeRules()\n /* eslint-enable @typescript-eslint/ban-ts-comment */\n }\n\n oop.inherits(GroqHighlightRules, TextHighlightRules)\n\n exports.GroqHighlightRules = GroqHighlightRules\n }\n)\n\nace.define(\n 'ace/mode/groq',\n [\n 'require',\n 'exports',\n 'module',\n 'ace/lib/oop',\n 'ace/mode/text',\n 'ace/tokenizer',\n 'ace/mode/groq_highlight_rules',\n 'ace/mode/folding/cstyle',\n ],\n (acequire: (id: string) => any, exports: Record<string, unknown>, _module: any) => {\n // eslint-disable-next-line strict\n 'use strict'\n const oop = acequire('../lib/oop')\n const TextMode = acequire('./text').Mode\n const Tokenizer = acequire('../tokenizer').Tokenizer\n const GroqHighlightRules = acequire('./groq_highlight_rules').GroqHighlightRules\n const FoldMode = acequire('./folding/cstyle').FoldMode\n\n const Mode = function () {\n /* eslint-disable @typescript-eslint/ban-ts-comment */\n const highlighter = new GroqHighlightRules()\n // @ts-ignore\n this.foldingRules = new FoldMode()\n // @ts-ignore\n this.$tokenizer = new Tokenizer(highlighter.getRules())\n // @ts-ignore\n this.$keywordList = highlighter.$keywordList\n /* eslint-enable @typescript-eslint/ban-ts-comment */\n }\n oop.inherits(Mode, TextMode)\n ;(function () {\n /* eslint-disable @typescript-eslint/ban-ts-comment */\n // @ts-ignore\n this.lineCommentStart = \"'\"\n /* eslint-enable @typescript-eslint/ban-ts-comment */\n }.call(Mode.prototype))\n\n exports.Mode = Mode\n }\n)\n"],"names":["rules","start","include","token","regex","push","next","defaultToken","ace","define","acequire","exports","_module","oop","TextHighlightRules","GroqHighlightRules","this","$rules","normalizeRules","inherits","TextMode","Mode","Tokenizer","FoldMode","highlighter","foldingRules","$tokenizer","getRules","$keywordList","lineCommentStart","call","prototype"],"mappings":"stCAKA,MAAMA,EAAQ,CACZC,MAAO,CACL,CACEC,QAAS,UAEX,CACEA,QAAS,UAEX,CACEA,QAAS,UAGb,SAAU,CACR,CACEA,QAAS,4BAEX,CACEA,QAAS,cAEX,CACEA,QAAS,SAEX,CACEA,QAAS,eAEX,CACEA,QAAS,YAGb,YAAa,CACX,CACEC,MAAO,sBACPC,MAAO,6BAGX,WAAY,CACV,CACED,MAAO,qBACPC,MAAO,8BAGX,cAAe,CACb,CACED,MAAO,mCAEPC,MAAO,yBAGX,YAAa,CACX,CACED,MAAO,mCACPC,MAAO,sBAGX,QAAS,CACP,CACED,MAAO,6BACPC,MAAO,OAGX,WAAY,CACV,CACED,MAAO,gCACPC,MAAO,cAGX,aAAc,CACZ,CACED,MAAO,kCACPC,M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UACA,SACA,cACA,gBACA,gBACA,gCACA,4BAEF,CAACC,EAA+BC,EAAkCC,KAG1D,MAAAC,EAAMH,EAAS,cACfU,EAAWV,EAAS,UAAUW,KAC9BC,EAAYZ,EAAS,gBAAgBY,UACrCP,EAAqBL,EAAS,0BAA0BK,mBACxDQ,EAAWb,EAAS,oBAAoBa,SAExCF,EAAO,WAEL,MAAAG,EAAc,IAAIT,EAEnBC,KAAAS,aAAe,IAAIF,EAExBP,KAAKU,WAAa,IAAIJ,EAAUE,EAAYG,YAE5CX,KAAKY,aAAeJ,EAAYI,YAAA,EAG9Bf,EAAAM,SAASE,EAAMD,GAClB,WAGCJ,KAAKa,iBAAmB,GAE1B,EAAEC,KAAKT,EAAKU,WAEZpB,EAAQU,KAAOA,CAAA"}
@@ -0,0 +1,2 @@
1
+ "use strict";var e=require("react-ace");function r(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}require("ace-builds/src-noconflict/mode-batchfile"),require("ace-builds/src-noconflict/mode-csharp"),require("ace-builds/src-noconflict/mode-css"),require("ace-builds/src-noconflict/mode-golang"),require("ace-builds/src-noconflict/mode-html"),require("ace-builds/src-noconflict/mode-java"),require("ace-builds/src-noconflict/mode-javascript"),require("ace-builds/src-noconflict/mode-json"),require("ace-builds/src-noconflict/mode-jsx"),require("ace-builds/src-noconflict/mode-markdown"),require("ace-builds/src-noconflict/mode-mysql"),require("ace-builds/src-noconflict/mode-php"),require("ace-builds/src-noconflict/mode-python"),require("ace-builds/src-noconflict/mode-ruby"),require("ace-builds/src-noconflict/mode-sass"),require("ace-builds/src-noconflict/mode-scss"),require("ace-builds/src-noconflict/mode-sh"),require("ace-builds/src-noconflict/mode-text"),require("ace-builds/src-noconflict/mode-tsx"),require("ace-builds/src-noconflict/mode-typescript"),require("ace-builds/src-noconflict/mode-xml"),require("ace-builds/src-noconflict/mode-yaml"),require("ace-builds/src-noconflict/theme-github"),require("ace-builds/src-noconflict/theme-monokai"),require("ace-builds/src-noconflict/theme-terminal"),require("ace-builds/src-noconflict/theme-tomorrow");var n=r(e);const o={start:[{include:"#query"},{include:"#value"},{include:"#pair"}],"#query":[{include:"#nullary-access-operator"},{include:"#arraylike"},{include:"#pipe"},{include:"#sort-order"},{include:"#filter"}],"#variable":[{token:"variable.other.groq",regex:/\$[_A-Za-z][_0-9A-Za-z]*/}],"#keyword":[{token:"keyword.other.groq",regex:/\b(?:asc|desc|in|match)\b/}],"#comparison":[{token:"keyword.operator.comparison.groq",regex:/==|!=|>=|<=|<!=>|<|>/}],"#operator":[{token:"keyword.operator.arithmetic.groq",regex:/\+|-|\*{1,2}|\/|%/}],"#pipe":[{token:"keyword.operator.pipe.groq",regex:/\|/}],"#logical":[{token:"keyword.operator.logical.groq",regex:/!|&&|\|\|/}],"#reference":[{token:"keyword.operator.reference.groq",regex:/->/}],"#pair":[{include:"#identifier"},{include:"#value"},{include:"#filter"},{token:"keyword.operator.pair.groq",regex:/[=]>/}],"#arraylike":[{token:"punctuation.definition.bracket.begin.groq",regex:/\[/,push:[{token:["text","keyword.operator.descendant.groq"],regex:/(\])((?:\s*\.)?)/,next:"pop"},{include:"#range"},{include:"#filter"},{include:"#array-values"}]}],"#array":[{token:"punctuation.definition.bracket.begin.groq",regex:/\[/,push:[{token:"punctuation.definition.bracket.end.groq",regex:/\]/,next:"pop"},{include:"#array-values"},{defaultToken:"meta.structure.array.groq"}]}],"#range":[{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"],regex:/(\s*)(\d+)(\s*)(\.{2,3})(\s*)(\d+)(\s*)/}],"#spread":[{token:"punctuation.definition.spread.begin.groq",regex:/\.\.\./,push:[{include:"#array"},{include:"#function-call"},{include:"#projection"},{token:"punctuation.definition.spread.end.groq",regex:/(?=.)/,next:"pop"},{defaultToken:"meta.structure.spread.groq"}]}],"#array-values":[{include:"#value"},{include:"#spread"},{token:"punctuation.separator.array.groq",regex:/,/},{token:"invalid.illegal.expected-array-separator.groq",regex:/[^\s\]]/}],"#filter":[{include:"#function-call"},{include:"#keyword"},{include:"#constant"},{include:"#identifier"},{include:"#value"},{include:"#comparison"},{include:"#operator"},{include:"#logical"}],"#comments":[{token:["punctuation.definition.comment.groq","comment.line.double-slash.js"],regex:/(\/\/)(.*$)/}],"#nullary-access-operator":[{token:"constant.language.groq",regex:/[*@^]/}],"#constant":[{token:"constant.language.groq",regex:/\b(?:true|false|null)\b/}],"#number":[{token:"constant.numeric.groq",regex:/-?(?:0|[1-9]\d*)(?:(?:\.\d+)?(?:[eE][+-]?\d+)?)?/}],"#named-projection":[{include:"#identifier"},{include:"#objectkey"},{include:"#projection"}],"#projection":[{token:"punctuation.definition.projection.begin.groq",regex:/\{/,push:[{token:"punctuation.definition.projection.end.groq",regex:/\}/,next:"pop"},{include:"#identifier"},{include:"#objectkey"},{include:"#named-projection"},{include:"#comments"},{include:"#spread"},{include:"#pair"},{token:"punctuation.separator.projection.key-value.groq",regex:/:/,push:[{token:"punctuation.separator.projection.pair.groq",regex:/,|(?=\})/,next:"pop"},{include:"#nullary-access-operator"},{include:"#arraylike"},{include:"#value"},{include:"#spread"},{include:"#identifier"},{include:"#operator"},{include:"#comparison"},{include:"#pair"},{token:"invalid.illegal.expected-projection-separator.groq",regex:/[^\s,]/},{defaultToken:"meta.structure.projection.value.groq"}]},{token:"invalid.illegal.expected-projection-separator.groq",regex:/[^\s},]/},{defaultToken:"meta.structure.projection.groq"}]}],"#string":[{include:"#single-string"},{include:"#double-string"}],"#double-string":[{token:"punctuation.definition.string.begin.groq",regex:/"/,push:[{token:"punctuation.definition.string.end.groq",regex:/"/,next:"pop"},{include:"#stringcontent"},{defaultToken:"string.quoted.double.groq"}]}],"#single-string":[{token:"punctuation.definition.string.single.begin.groq",regex:/'/,push:[{token:"punctuation.definition.string.single.end.groq",regex:/'/,next:"pop"},{include:"#stringcontent"},{defaultToken:"string.quoted.single.groq"}]}],"#objectkey":[{include:"#string"}],"#stringcontent":[{token:"constant.character.escape.groq",regex:/\\(?:["\\/bfnrt]|u[0-9a-fA-F]{4})/},{token:"invalid.illegal.unrecognized-string-escape.groq",regex:/\\./}],"#sort-pair":[{token:["variable.other.readwrite.groq","text","keyword.other.groq"],regex:/([_A-Za-z][_0-9A-Za-z]*)(?:(\s*)(asc|desc))?/},{token:["constant.language.groq","punctuation.definition.bracket.begin.groq"],regex:/(@)(\[)/,push:[{token:["punctuation.definition.bracket.begin.groq","text","keyword.other.groq"],regex:/(\])(?:(\s*)(asc|desc))?/,next:"pop"},{include:"#string"}]}],"#sort-order":[{token:"support.function.sortorder.begin.groq",regex:/\border\s*\(/,push:[{token:"support.function.sortorder.end.groq",regex:/\)/,next:"pop"},{include:"#sort-pair"},{token:"punctuation.separator.array.groq",regex:/,/},{token:"invalid.illegal.expected-sort-separator.groq",regex:/[^\s\]]/},{defaultToken:"support.function.sortorder.groq"}]}],"#function-call":[{include:"#function-var-arg"},{include:"#function-single-arg"},{include:"#function-round"}],"#function-var-arg":[{token:"support.function.vararg.begin.groq",regex:/\b(?:coalesce|select)\s*\(/,push:[{token:"support.function.vararg.end.groq",regex:/\)/,next:"pop"},{include:"#value"},{include:"#identifier"},{include:"#filter"},{include:"#pair"},{token:"punctuation.separator.array.groq",regex:/,/},{defaultToken:"support.function.vararg.groq"}]}],"#function-single-arg":[{token:"support.function.singlearg.begin.groq",regex:/\b(?:count|defined|length|path|references)\s*\(/,push:[{token:"support.function.singlearg.end.groq",regex:/\)/,next:"pop"},{include:"#query"},{include:"#identifier"},{include:"#value"},{include:"#pair"},{defaultToken:"support.function.singlearg.groq"}]}],"#identifier":[{token:["variable.other.readwrite.groq","text","punctuation.definition.block.js","text","keyword.operator.reference.groq"],regex:/([_A-Za-z][_0-9A-Za-z]*)(\s*)((?:\[\s*\])?)(\s*)(->)/},{token:["variable.other.readwrite.groq","constant.language.groq","text","punctuation.definition.block.js","text","keyword.operator.descendant.groq"],regex:/(?:([_A-Za-z][_0-9A-Za-z]*)|([@^]))(\s*)((?:\[\s*\])?)(\s*)(\.)/},{token:"variable.other.readwrite.groq",regex:/[_A-Za-z][_0-9A-Za-z]*/}],"#value":[{include:"#constant"},{include:"#number"},{include:"#string"},{include:"#array"},{include:"#variable"},{include:"#projection"},{include:"#comments"},{include:"#function-call"}]};ace.define("ace/mode/groq_highlight_rules",["require","exports","module","ace/lib/oop","ace/mode/text_highlight_rules"],((e,r,n)=>{const t=e("../lib/oop"),i=e("./text_highlight_rules").TextHighlightRules,c=function(){this.$rules=o,this.normalizeRules()};t.inherits(c,i),r.GroqHighlightRules=c})),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"],((e,r,n)=>{const o=e("../lib/oop"),t=e("./text").Mode,i=e("../tokenizer").Tokenizer,c=e("./groq_highlight_rules").GroqHighlightRules,a=e("./folding/cstyle").FoldMode,u=function(){const e=new c;this.foldingRules=new a,this.$tokenizer=new i(e.getRules()),this.$keywordList=e.$keywordList};o.inherits(u,t),function(){this.lineCommentStart="'"}.call(u.prototype),r.Mode=u})),Object.defineProperty(exports,"default",{enumerable:!0,get:function(){return n.default}});
2
+ //# sourceMappingURL=editorSupport-bda3d360.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"editorSupport-bda3d360.js","sources":["../../src/ace-editor/groq.ts"],"sourcesContent":["/* eslint-disable no-undef */\n\nexport {}\n\n// Grammar from https://github.com/sanity-io/vscode-sanity\nconst rules = {\n start: [\n {\n include: '#query',\n },\n {\n include: '#value',\n },\n {\n include: '#pair',\n },\n ],\n '#query': [\n {\n include: '#nullary-access-operator',\n },\n {\n include: '#arraylike',\n },\n {\n include: '#pipe',\n },\n {\n include: '#sort-order',\n },\n {\n include: '#filter',\n },\n ],\n '#variable': [\n {\n token: 'variable.other.groq',\n regex: /\\$[_A-Za-z][_0-9A-Za-z]*/,\n },\n ],\n '#keyword': [\n {\n token: 'keyword.other.groq',\n regex: /\\b(?:asc|desc|in|match)\\b/,\n },\n ],\n '#comparison': [\n {\n token: 'keyword.operator.comparison.groq',\n // eslint-disable-next-line no-div-regex\n regex: /==|!=|>=|<=|<!=>|<|>/,\n },\n ],\n '#operator': [\n {\n token: 'keyword.operator.arithmetic.groq',\n regex: /\\+|-|\\*{1,2}|\\/|%/,\n },\n ],\n '#pipe': [\n {\n token: 'keyword.operator.pipe.groq',\n regex: /\\|/,\n },\n ],\n '#logical': [\n {\n token: 'keyword.operator.logical.groq',\n regex: /!|&&|\\|\\|/,\n },\n ],\n '#reference': [\n {\n token: 'keyword.operator.reference.groq',\n regex: /->/,\n },\n ],\n '#pair': [\n {\n include: '#identifier',\n },\n {\n include: '#value',\n },\n {\n include: '#filter',\n },\n {\n token: 'keyword.operator.pair.groq',\n regex: /[=]>/,\n },\n ],\n '#arraylike': [\n {\n token: 'punctuation.definition.bracket.begin.groq',\n regex: /\\[/,\n push: [\n {\n token: ['text', 'keyword.operator.descendant.groq'],\n regex: /(\\])((?:\\s*\\.)?)/,\n next: 'pop',\n },\n {\n include: '#range',\n },\n {\n include: '#filter',\n },\n {\n include: '#array-values',\n },\n ],\n },\n ],\n '#array': [\n {\n token: 'punctuation.definition.bracket.begin.groq',\n regex: /\\[/,\n push: [\n {\n token: 'punctuation.definition.bracket.end.groq',\n regex: /\\]/,\n next: 'pop',\n },\n {\n include: '#array-values',\n },\n {\n defaultToken: 'meta.structure.array.groq',\n },\n ],\n },\n ],\n '#range': [\n {\n token: [\n 'meta.structure.range.groq',\n 'constant.numeric.groq',\n 'meta.structure.range.groq',\n 'keyword.operator.range.groq',\n 'meta.structure.range.groq',\n 'constant.numeric.groq',\n 'meta.structure.range.groq',\n ],\n regex: /(\\s*)(\\d+)(\\s*)(\\.{2,3})(\\s*)(\\d+)(\\s*)/,\n },\n ],\n '#spread': [\n {\n token: 'punctuation.definition.spread.begin.groq',\n regex: /\\.\\.\\./,\n push: [\n {\n include: '#array',\n },\n {\n include: '#function-call',\n },\n {\n include: '#projection',\n },\n {\n token: 'punctuation.definition.spread.end.groq',\n regex: /(?=.)/,\n next: 'pop',\n },\n {\n defaultToken: 'meta.structure.spread.groq',\n },\n ],\n },\n ],\n '#array-values': [\n {\n include: '#value',\n },\n {\n include: '#spread',\n },\n {\n token: 'punctuation.separator.array.groq',\n regex: /,/,\n },\n {\n token: 'invalid.illegal.expected-array-separator.groq',\n regex: /[^\\s\\]]/,\n },\n ],\n '#filter': [\n {\n include: '#function-call',\n },\n {\n include: '#keyword',\n },\n {\n include: '#constant',\n },\n {\n include: '#identifier',\n },\n {\n include: '#value',\n },\n {\n include: '#comparison',\n },\n {\n include: '#operator',\n },\n {\n include: '#logical',\n },\n ],\n '#comments': [\n {\n token: ['punctuation.definition.comment.groq', 'comment.line.double-slash.js'],\n regex: /(\\/\\/)(.*$)/,\n },\n ],\n '#nullary-access-operator': [\n {\n token: 'constant.language.groq',\n regex: /[*@^]/,\n },\n ],\n '#constant': [\n {\n token: 'constant.language.groq',\n regex: /\\b(?:true|false|null)\\b/,\n },\n ],\n '#number': [\n {\n token: 'constant.numeric.groq',\n regex: /-?(?:0|[1-9]\\d*)(?:(?:\\.\\d+)?(?:[eE][+-]?\\d+)?)?/,\n },\n ],\n '#named-projection': [\n {\n include: '#identifier',\n },\n {\n include: '#objectkey',\n },\n {\n include: '#projection',\n },\n ],\n '#projection': [\n {\n token: 'punctuation.definition.projection.begin.groq',\n regex: /\\{/,\n push: [\n {\n token: 'punctuation.definition.projection.end.groq',\n regex: /\\}/,\n next: 'pop',\n },\n {\n include: '#identifier',\n },\n {\n include: '#objectkey',\n },\n {\n include: '#named-projection',\n },\n {\n include: '#comments',\n },\n {\n include: '#spread',\n },\n {\n include: '#pair',\n },\n {\n token: 'punctuation.separator.projection.key-value.groq',\n regex: /:/,\n push: [\n {\n token: 'punctuation.separator.projection.pair.groq',\n regex: /,|(?=\\})/,\n next: 'pop',\n },\n {\n include: '#nullary-access-operator',\n },\n {\n include: '#arraylike',\n },\n {\n include: '#value',\n },\n {\n include: '#spread',\n },\n {\n include: '#identifier',\n },\n {\n include: '#operator',\n },\n {\n include: '#comparison',\n },\n {\n include: '#pair',\n },\n {\n token: 'invalid.illegal.expected-projection-separator.groq',\n regex: /[^\\s,]/,\n },\n {\n defaultToken: 'meta.structure.projection.value.groq',\n },\n ],\n },\n {\n token: 'invalid.illegal.expected-projection-separator.groq',\n regex: /[^\\s},]/,\n },\n {\n defaultToken: 'meta.structure.projection.groq',\n },\n ],\n },\n ],\n '#string': [\n {\n include: '#single-string',\n },\n {\n include: '#double-string',\n },\n ],\n '#double-string': [\n {\n token: 'punctuation.definition.string.begin.groq',\n regex: /\"/,\n push: [\n {\n token: 'punctuation.definition.string.end.groq',\n regex: /\"/,\n next: 'pop',\n },\n {\n include: '#stringcontent',\n },\n {\n defaultToken: 'string.quoted.double.groq',\n },\n ],\n },\n ],\n '#single-string': [\n {\n token: 'punctuation.definition.string.single.begin.groq',\n regex: /'/,\n push: [\n {\n token: 'punctuation.definition.string.single.end.groq',\n regex: /'/,\n next: 'pop',\n },\n {\n include: '#stringcontent',\n },\n {\n defaultToken: 'string.quoted.single.groq',\n },\n ],\n },\n ],\n '#objectkey': [\n {\n include: '#string',\n },\n ],\n '#stringcontent': [\n {\n token: 'constant.character.escape.groq',\n regex: /\\\\(?:[\"\\\\/bfnrt]|u[0-9a-fA-F]{4})/,\n },\n {\n token: 'invalid.illegal.unrecognized-string-escape.groq',\n regex: /\\\\./,\n },\n ],\n '#sort-pair': [\n {\n token: ['variable.other.readwrite.groq', 'text', 'keyword.other.groq'],\n regex: /([_A-Za-z][_0-9A-Za-z]*)(?:(\\s*)(asc|desc))?/,\n },\n {\n token: ['constant.language.groq', 'punctuation.definition.bracket.begin.groq'],\n regex: /(@)(\\[)/,\n push: [\n {\n token: ['punctuation.definition.bracket.begin.groq', 'text', 'keyword.other.groq'],\n regex: /(\\])(?:(\\s*)(asc|desc))?/,\n next: 'pop',\n },\n {\n include: '#string',\n },\n ],\n },\n ],\n '#sort-order': [\n {\n token: 'support.function.sortorder.begin.groq',\n regex: /\\border\\s*\\(/,\n push: [\n {\n token: 'support.function.sortorder.end.groq',\n regex: /\\)/,\n next: 'pop',\n },\n {\n include: '#sort-pair',\n },\n {\n token: 'punctuation.separator.array.groq',\n regex: /,/,\n },\n {\n token: 'invalid.illegal.expected-sort-separator.groq',\n regex: /[^\\s\\]]/,\n },\n {\n defaultToken: 'support.function.sortorder.groq',\n },\n ],\n },\n ],\n '#function-call': [\n {\n include: '#function-var-arg',\n },\n {\n include: '#function-single-arg',\n },\n {\n include: '#function-round',\n },\n ],\n '#function-var-arg': [\n {\n token: 'support.function.vararg.begin.groq',\n regex: /\\b(?:coalesce|select)\\s*\\(/,\n push: [\n {\n token: 'support.function.vararg.end.groq',\n regex: /\\)/,\n next: 'pop',\n },\n {\n include: '#value',\n },\n {\n include: '#identifier',\n },\n {\n include: '#filter',\n },\n {\n include: '#pair',\n },\n {\n token: 'punctuation.separator.array.groq',\n regex: /,/,\n },\n {\n defaultToken: 'support.function.vararg.groq',\n },\n ],\n },\n ],\n '#function-single-arg': [\n {\n token: 'support.function.singlearg.begin.groq',\n regex: /\\b(?:count|defined|length|path|references)\\s*\\(/,\n push: [\n {\n token: 'support.function.singlearg.end.groq',\n regex: /\\)/,\n next: 'pop',\n },\n {\n include: '#query',\n },\n {\n include: '#identifier',\n },\n {\n include: '#value',\n },\n {\n include: '#pair',\n },\n {\n defaultToken: 'support.function.singlearg.groq',\n },\n ],\n },\n ],\n '#identifier': [\n {\n token: [\n 'variable.other.readwrite.groq',\n 'text',\n 'punctuation.definition.block.js',\n 'text',\n 'keyword.operator.reference.groq',\n ],\n regex: /([_A-Za-z][_0-9A-Za-z]*)(\\s*)((?:\\[\\s*\\])?)(\\s*)(->)/,\n },\n {\n token: [\n 'variable.other.readwrite.groq',\n 'constant.language.groq',\n 'text',\n 'punctuation.definition.block.js',\n 'text',\n 'keyword.operator.descendant.groq',\n ],\n regex: /(?:([_A-Za-z][_0-9A-Za-z]*)|([@^]))(\\s*)((?:\\[\\s*\\])?)(\\s*)(\\.)/,\n },\n {\n token: 'variable.other.readwrite.groq',\n regex: /[_A-Za-z][_0-9A-Za-z]*/,\n },\n ],\n '#value': [\n {\n include: '#constant',\n },\n {\n include: '#number',\n },\n {\n include: '#string',\n },\n {\n include: '#array',\n },\n {\n include: '#variable',\n },\n {\n include: '#projection',\n },\n {\n include: '#comments',\n },\n {\n include: '#function-call',\n },\n ],\n}\n\ndeclare let ace: any\n\nace.define(\n 'ace/mode/groq_highlight_rules',\n ['require', 'exports', 'module', 'ace/lib/oop', 'ace/mode/text_highlight_rules'],\n (acequire: (id: string) => any, exports: Record<string, unknown>, _module: any) => {\n const oop = acequire('../lib/oop')\n const TextHighlightRules = acequire('./text_highlight_rules').TextHighlightRules\n\n const GroqHighlightRules = function () {\n /* eslint-disable @typescript-eslint/ban-ts-comment */\n // @ts-ignore\n this.$rules = rules\n // @ts-ignore\n this.normalizeRules()\n /* eslint-enable @typescript-eslint/ban-ts-comment */\n }\n\n oop.inherits(GroqHighlightRules, TextHighlightRules)\n\n exports.GroqHighlightRules = GroqHighlightRules\n }\n)\n\nace.define(\n 'ace/mode/groq',\n [\n 'require',\n 'exports',\n 'module',\n 'ace/lib/oop',\n 'ace/mode/text',\n 'ace/tokenizer',\n 'ace/mode/groq_highlight_rules',\n 'ace/mode/folding/cstyle',\n ],\n (acequire: (id: string) => any, exports: Record<string, unknown>, _module: any) => {\n // eslint-disable-next-line strict\n 'use strict'\n const oop = acequire('../lib/oop')\n const TextMode = acequire('./text').Mode\n const Tokenizer = acequire('../tokenizer').Tokenizer\n const GroqHighlightRules = acequire('./groq_highlight_rules').GroqHighlightRules\n const FoldMode = acequire('./folding/cstyle').FoldMode\n\n const Mode = function () {\n /* eslint-disable @typescript-eslint/ban-ts-comment */\n const highlighter = new GroqHighlightRules()\n // @ts-ignore\n this.foldingRules = new FoldMode()\n // @ts-ignore\n this.$tokenizer = new Tokenizer(highlighter.getRules())\n // @ts-ignore\n this.$keywordList = highlighter.$keywordList\n /* eslint-enable @typescript-eslint/ban-ts-comment */\n }\n oop.inherits(Mode, TextMode)\n ;(function () {\n /* eslint-disable @typescript-eslint/ban-ts-comment */\n // @ts-ignore\n this.lineCommentStart = \"'\"\n /* eslint-enable @typescript-eslint/ban-ts-comment */\n }.call(Mode.prototype))\n\n exports.Mode = Mode\n }\n)\n"],"names":["rules","start","include","token","regex","push","next","defaultToken","ace","define","acequire","exports","_module","oop","TextHighlightRules","GroqHighlightRules","this","$rules","normalizeRules","inherits","TextMode","Mode","Tokenizer","FoldMode","highlighter","foldingRules","$tokenizer","getRules","$keywordList","lineCommentStart","call","prototype"],"mappings":"u2CAKA,MAAMA,EAAQ,CACZC,MAAO,CACL,CACEC,QAAS,UAEX,CACEA,QAAS,UAEX,CACEA,QAAS,UAGb,SAAU,CACR,CACEA,QAAS,4BAEX,CACEA,QAAS,cAEX,CACEA,QAAS,SAEX,CACEA,QAAS,eAEX,CACEA,QAAS,YAGb,YAAa,CACX,CACEC,MAAO,sBACPC,MAAO,6BAGX,WAAY,CACV,CACED,MAAO,qBACPC,MAAO,8BAGX,cAAe,CACb,CACED,MAAO,mCAEPC,MAAO,yBAGX,YAAa,CACX,CACED,MAAO,mCACPC,MAAO,sBAGX,QAAS,CACP,CACED,MAAO,6BACPC,MAAO,OAGX,WAAY,CACV,CACED,MAAO,gCACPC,MAAO,cAGX,aAAc,CACZ,CACED,MAAO,kCACPC,MAAO,OAGX,QAAS,CACP,CACEF,QAAS,eAEX,CACEA,QAAS,UAEX,CACEA,QAAS,WAEX,CACEC,MAAO,6BACPC,MAAO,SAGX,aAAc,CACZ,CACED,MAAO,4CACPC,MAAO,KACPC,KAAM,CACJ,CACEF,MAAO,CAAC,OAAQ,oCAChBC,MAAO,mBACPE,KAAM,OAER,CACEJ,QAAS,UAEX,CACEA,QAAS,WAEX,CACEA,QAAS,oBAKjB,SAAU,CACR,CACEC,MAAO,4CACPC,MAA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EAAUE,EAAYG,YAE5CX,KAAKY,aAAeJ,EAAYI,YAAA,EAG9Bf,EAAAM,SAASE,EAAMD,GAClB,WAGCJ,KAAKa,iBAAmB,GAE1B,EAAEC,KAAKT,EAAKU,WAEZpB,EAAQU,KAAOA,CAAA"}
@@ -0,0 +1,2 @@
1
+ var e,n,t,r;function i(e,n){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);n&&(r=r.filter((function(n){return Object.getOwnPropertyDescriptor(e,n).enumerable}))),t.push.apply(t,r)}return t}function l(e){for(var n=1;n<arguments.length;n++){var t=null!=arguments[n]?arguments[n]:{};n%2?i(Object(t),!0).forEach((function(n){o(e,n,t[n])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):i(Object(t)).forEach((function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(t,n))}))}return e}function o(e,n,t){return n in e?Object.defineProperty(e,n,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[n]=t,e}function a(e,n){return n||(n=e.slice(0)),Object.freeze(Object.defineProperties(e,{raw:{value:Object.freeze(n)}}))}import{useColorScheme as s,set as c,setIfMissing as d,unset as u,MemberField as h,defineType as g,definePlugin as m}from"sanity";import{CodeBlockIcon as v}from"@sanity/icons";import{jsx as p,jsxs as f}from"react/jsx-runtime";import b,{useState as w,useEffect as y,useRef as x,useMemo as O,useImperativeHandle as z,useCallback as j,Suspense as k}from"react";import{Card as S,Select as P,Stack as L,Box as M}from"@sanity/ui";import C,{css as F}from"styled-components";const _=F(e||(e=a(["\n .ace_editor_markers_highlight {\n position: absolute;\n background-color: ",";\n opacity: 0.2;\n width: 100% !important;\n border-radius: 0 !important;\n }\n"])),(e=>{let{theme:n}=e;return n.sanity.color.solid.primary.enabled.bg}));function A(e){return e.map((e=>({startRow:Number(e)-1,startCol:0,endRow:Number(e)-1,endCol:1/0,className:"ace_editor_markers_highlight",type:"screenLine",inFront:!0})))}const B=[{title:"Batch file",value:"batchfile"},{title:"C#",value:"csharp"},{title:"CSS",value:"css"},{title:"Go",value:"golang"},{title:"GROQ",value:"groq"},{title:"HTML",value:"html"},{title:"Java",value:"java"},{title:"JavaScript",value:"javascript"},{title:"JSON",value:"json"},{title:"JSX",value:"jsx"},{title:"Markdown",value:"markdown"},{title:"MySQL",value:"mysql"},{title:"PHP",value:"php"},{title:"Plain text",value:"text"},{title:"Python",value:"python"},{title:"Ruby",value:"ruby"},{title:"SASS",value:"sass"},{title:"SCSS",value:"scss"},{title:"sh",value:"sh"},{title:"TSX",value:"tsx"},{title:"TypeScript",value:"typescript"},{title:"XML",value:"xml"},{title:"YAML",value:"yaml"}],T={js:"javascript"},I=["github","monokai","terminal","tomorrow"],H={useSoftTabs:!0,navigateWithinSoftTabs:!0},R={$blockScrolling:!0},D=["code"],E=b.lazy((()=>import("./_chunks/editorSupport-895caf32.esm.js")));function G(){const[e,n]=w(!1);return y((()=>{requestAnimationFrame((()=>n(!0)))}),[]),e?E:null}const U=C(S)(n||(n=a(["\n position: relative;\n box-sizing: border-box;\n overflow: hidden;\n z-index: 0;\n\n .ace_editor {\n font-family: ",";\n font-size: ",";\n line-height: inherit;\n }\n\n ","\n\n &:not([disabled]):not([readonly]) {\n &:focus,\n &:focus-within {\n box-shadow: 0 0 0 2px ",";\n background-color: ",";\n border-color: ",";\n }\n }\n"])),(e=>{let{theme:n}=e;return n.sanity.fonts.code.family}),(e=>{let{theme:n}=e;return n.sanity.fonts.code.sizes[1]}),_,(e=>{let{theme:n}=e;return n.sanity.color.base.focusRing}),(e=>{let{theme:n}=e;return n.sanity.color.base.bg}),(e=>{let{theme:n}=e;return n.sanity.color.base.focusRing}));const J=C(M)(t||(t=a(["\n position: relative;\n"]))),N=C(M)(r||(r=a(["\n background-color: #272822;\n\n .ace_editor {\n box-sizing: border-box;\n cursor: default;\n pointer-events: none;\n }\n\n .ace_content {\n box-sizing: border-box;\n overflow: hidden;\n }\n"])));function X(e){var n;const t=x();y((()=>{var e;if(!(null==t?void 0:t.current))return;const n=null==(e=t.current)?void 0:e.editor;n&&(n.renderer.$cursorLayer.element.style.opacity=0,n.textInput.getElement().disabled=!0)}),[]);const r=j((()=>{}),[]),{value:i,type:l}=e,o=null==(n=null==l?void 0:l.options)?void 0:n.language,a=null==i?void 0:i.selection,s=(null==a?void 0:a.language)||o||"text",c=G();return p(J,{children:p(N,{padding:4,children:c&&p(k,{fallback:p("div",{children:"Loading code preview..."}),children:p(c,{ref:t,focus:!1,mode:s,theme:"monokai",width:"100%",onChange:r,maxLines:200,readOnly:!0,wrapEnabled:!0,showPrintMargin:!1,highlightActiveLine:!1,cursorStart:-1,value:(null==a?void 0:a.code)||"",markers:(null==a?void 0:a.highlightedLines)?A(a.highlightedLines):void 0,tabSize:2,showGutter:!1,setOptions:H,editorProps:R})})})})}const q="code",Q=g(l(l({name:"code",type:"object",title:"Code"},{components:{input:function(e){var n,t;const{members:r,elementProps:i,onChange:o,readOnly:a,renderField:g,renderInput:m,renderItem:v,renderPreview:b,schemaType:w,value:S,onPathFocus:M}=e,C=x(),F=O((()=>r.filter((e=>"field"===e.kind))),[r]),_=F.find((e=>"language"===e.name)),E=F.find((e=>"filename"===e.name)),J=F.find((e=>"code"===e.name));z(i.ref,(()=>({focus:()=>{var e,n;null==(n=null==(e=null==C?void 0:C.current)?void 0:e.editor)||n.focus()}})));const N=j((()=>{M(D)}),[M]),{scheme:X}=s(),q=O((()=>{var e,n;const t="light"===X,r=t?null==(e=w.options)?void 0:e.theme:null==(n=w.options)?void 0:n.darkTheme,i=t?"tomorrow":"monokai";return r&&I.find((e=>e===r))?r:i}),[w,X]),Q=j((e=>{var n,t;const r=null==(t=null==(n=C.current)?void 0:n.editor)?void 0:t.getSession(),i=null==r?void 0:r.getMarkers(!0),l=Object.keys(i).filter((e=>"screenLine"===i[e].type)).map((e=>i[e].range.start.row)),a=l.indexOf(e);a>-1?l.splice(a,1):(l.push(e),l.sort()),o(c(l.map((e=>e+1)),["highlightedLines"]))}),[C,o]),$=j((e=>{if(e.domEvent.target.classList.contains("ace_gutter-cell")){const n=e.getDocumentPosition().row;Q(n)}}),[Q]);y((()=>{var e;const n=null==(e=null==C?void 0:C.current)?void 0:e.editor;return()=>{var e;null==(e=null==n?void 0:n.session)||e.removeListener("guttermousedown",$)}}),[C,$]);const W=j((e=>{null==e||e.on("guttermousedown",$)}),[$]),Y=j((()=>{var e;const n=null==(e=w.options)?void 0:e.languageAlternatives;if(!n)return B;if(!Array.isArray(n))throw new Error("'options.languageAlternatives' should be an array, got ".concat(typeof n));return n.reduce(((e,n)=>{let{title:t,value:r,mode:i}=n;const l=T[r];return l?(console.warn('\'options.languageAlternatives\' lists a language with value "%s", which is an alias of "%s" - please replace the value to read "%s"',r,l,l),e.concat({title:t,value:l,mode:i})):(i||B.find((e=>e.value===r))||console.warn("'options.languageAlternatives' lists a language which is not supported: \"%s\", syntax highlighting will be disabled.",r),e.concat({title:t,value:r,mode:i}))}),[])}),[w]),K=j((e=>{var n;const t=D,r=null==(n=w.options)?void 0:n.language;o([d({_type:w.name,language:r}),e?c(e,t):u(t)])}),[o,w]),V=Y().slice(),Z=null==(n=w.options)?void 0:n.language,ee=(null==S?void 0:S.language)||Z,ne=V.find((e=>e.value===ee)),te=ee&&function(e){const n=T[e];return n||!!B.find((n=>n.value===e))&&e}(ee),re=(null==ne?void 0:ne.mode)||(te?ee:"text"),ie=j((e=>p(P,l(l({},e),{},{onChange:n=>{const t=n.currentTarget.value;e.onChange(t?c(t):u())},children:V.map((e=>p("option",{value:e.value,children:e.title},e.value)))}))),[V]),le=G(),oe=j((e=>p(U,{radius:1,shadow:1,readOnly:a,children:le&&p(k,{fallback:p("div",{children:"Loading code editor..."}),children:p(le,{ref:C,mode:re,theme:q,width:"100%",onChange:K,name:e.id,value:e.value,markers:S&&S.highlightedLines?A(S.highlightedLines):void 0,onLoad:W,readOnly:a,tabSize:2,wrapEnabled:!0,setOptions:H,editorProps:R,onFocus:N,onBlur:i.onBlur})})})),[le,q,K,N,W,re,i.onBlur,a,S]);return f(L,{space:4,children:[_&&p(h,{member:_,renderItem:v,renderField:g,renderInput:ie,renderPreview:b}),(null==(t=w.options)?void 0:t.withFilename)&&E&&p(h,{member:E,renderItem:v,renderField:g,renderInput:m,renderPreview:b}),J&&p(h,{member:J,renderInput:oe,renderItem:v,renderField:g,renderPreview:b})]})},preview:X}}),{},{icon:v,fields:[{name:"language",title:"Language",type:"string"},{name:"filename",title:"Filename",type:"string"},{title:"Code",name:"code",type:"text"},{title:"Highlighted lines",name:"highlightedLines",type:"array",of:[{type:"number",title:"Highlighted line"}]}],preview:{select:{language:"language",code:"code",filename:"filename",highlightedLines:"highlightedLines"},prepare:e=>{return{title:e.filename||(e.language||"unknown").toUpperCase(),media:(n=null==e?void 0:e.language,"jsx"===n?p("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 128 128",children:f("g",{fill:"#61DAFB",children:[p("circle",{cx:"64",cy:"64",r:"11.4"}),p("path",{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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 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"})]})}):"javascript"===n?f("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 128 128",children:[p("path",{fill:"#F0DB4F",d:"M1.408 1.408h125.184v125.185H1.408z"}),p("path",{fill:"#323330",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"})]}):"php"===n?p("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 800 400",children:p("g",{transform:"translate(-44.632 -141.55)",children:f("g",{transform:"matrix(8.3528 0 0 8.3119 -727.13 -3759.5)",children:[p("path",{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"}),p("path",{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"}),p("path",{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"})]})})}):"json"===n?f("svg",{xmlns:"http://www.w3.org/2000/svg",xmlnsXlink:"http://www.w3.org/1999/xlink",viewBox:"0 0 160 160",children:[f("defs",{children:[f("linearGradient",{id:"a",children:[p("stop",{offset:"0"}),p("stop",{offset:"1",stopColor:"#fff"})]}),p("linearGradient",{x1:"-553.27",y1:"525.908",x2:"-666.116",y2:"413.045",id:"c",xlinkHref:"#a",gradientUnits:"userSpaceOnUse",gradientTransform:"matrix(.99884 0 0 .9987 689.008 -388.844)"}),p("linearGradient",{x1:"-666.117",y1:"413.045",x2:"-553.27",y2:"525.908",id:"b",xlinkHref:"#a",gradientUnits:"userSpaceOnUse",gradientTransform:"matrix(.99884 0 0 .9987 689.008 -388.844)"})]}),p("path",{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",style:{marker:"none"},color:"#000",fill:"url(#b)",fillRule:"evenodd",overflow:"visible"}),p("path",{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",style:{marker:"none"},color:"#000",fill:"url(#c)",fillRule:"evenodd",overflow:"visible"})]}):void 0),selection:e};var n}}})),$=m({name:"@sanity/code-input",schema:{types:[Q]}});export{X as PreviewCode,$ as codeInput,Q as codeSchema,q as codeTypeName};
2
+ //# sourceMappingURL=index.esm.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.esm.js","sources":["../src/createHighlightMarkers.ts","../src/config.ts","../src/ace-editor/AceEditorLazy.tsx","../src/CodeInput.tsx","../src/PreviewCode.tsx","../src/schema.tsx","../src/getMedia.tsx","../src/index.ts"],"sourcesContent":["import type {IMarker} from 'react-ace'\nimport {css} from 'styled-components'\n\nexport const highlightMarkersCSS = css`\n .ace_editor_markers_highlight {\n position: absolute;\n background-color: ${({theme}) => theme.sanity.color.solid.primary.enabled.bg};\n opacity: 0.2;\n width: 100% !important;\n border-radius: 0 !important;\n }\n`\n\nexport default function createHighlightMarkers(rows: number[]): IMarker[] {\n return rows.map((row) => ({\n startRow: Number(row) - 1,\n startCol: 0,\n endRow: Number(row) - 1,\n endCol: +Infinity,\n className: 'ace_editor_markers_highlight',\n type: 'screenLine',\n inFront: true,\n }))\n}\n","import {CodeInputLanguage} from './types'\n\n// NOTE: MAKE SURE THESE ALIGN WITH IMPORTS IN ./ace-editor/editorSupport\nexport const SUPPORTED_LANGUAGES: CodeInputLanguage[] = [\n {title: 'Batch file', value: 'batchfile'},\n {title: 'C#', value: 'csharp'},\n {title: 'CSS', value: 'css'},\n {title: 'Go', value: 'golang'},\n {title: 'GROQ', value: 'groq'},\n {title: 'HTML', value: 'html'},\n {title: 'Java', value: 'java'},\n {title: 'JavaScript', value: 'javascript'},\n {title: 'JSON', value: 'json'},\n {title: 'JSX', value: 'jsx'},\n {title: 'Markdown', value: 'markdown'},\n {title: 'MySQL', value: 'mysql'},\n {title: 'PHP', value: 'php'},\n {title: 'Plain text', value: 'text'},\n {title: 'Python', value: 'python'},\n {title: 'Ruby', value: 'ruby'},\n {title: 'SASS', value: 'sass'},\n {title: 'SCSS', value: 'scss'},\n {title: 'sh', value: 'sh'},\n {title: 'TSX', value: 'tsx'},\n {title: 'TypeScript', value: 'typescript'},\n {title: 'XML', value: 'xml'},\n {title: 'YAML', value: 'yaml'},\n]\n\nexport const LANGUAGE_ALIASES: Record<string, string | undefined> = {js: 'javascript'}\n\nexport const SUPPORTED_THEMES = ['github', 'monokai', 'terminal', 'tomorrow']\n\nexport const DEFAULT_THEME = 'tomorrow'\nexport const DEFAULT_DARK_THEME = 'monokai'\n\nexport const ACE_SET_OPTIONS = {\n useSoftTabs: true,\n navigateWithinSoftTabs: true /* note only supported by ace v1.2.7 or higher */,\n}\n\nexport const ACE_EDITOR_PROPS = {$blockScrolling: true}\n\nexport const PATH_LANGUAGE = ['language']\nexport const PATH_CODE = ['code']\nexport const PATH_FILENAME = ['filename']\n","import React, {useEffect, useState} from 'react'\n\n/**\n * AceEditor loads window global directly when imported, which crashes in node envs.\n * This works around the issue by only importing ace-dependencies when window is defined.\n *\n * We only set the ace lazy component after mounting, to allow us to render null on the server,\n * and use suspense on the client. This will make hydration work correctly.\n */\nexport const AceEditorLazy = React.lazy(() => import('./editorSupport'))\n\nexport function useAceEditor() {\n const [mounted, setMounted] = useState(false)\n useEffect(() => {\n requestAnimationFrame(() => setMounted(true))\n }, [])\n\n return mounted ? AceEditorLazy : null\n}\n","/* eslint-disable react/jsx-handler-names */\nimport React, {Suspense, useCallback, useEffect, useImperativeHandle, useMemo, useRef} from 'react'\nimport {\n InputProps,\n ObjectSchemaType,\n StringInputProps,\n useColorScheme,\n FieldMember,\n MemberField,\n ObjectInputProps,\n set,\n setIfMissing,\n unset,\n RenderInputCallback,\n} from 'sanity'\nimport {Card, Select, Stack, ThemeColorSchemeKey} from '@sanity/ui'\nimport styled from 'styled-components'\nimport createHighlightMarkers, {highlightMarkersCSS} from './createHighlightMarkers'\nimport {CodeInputLanguage, CodeInputValue} from './types'\nimport {\n ACE_EDITOR_PROPS,\n ACE_SET_OPTIONS,\n DEFAULT_DARK_THEME,\n DEFAULT_THEME,\n LANGUAGE_ALIASES,\n PATH_CODE,\n SUPPORTED_LANGUAGES,\n SUPPORTED_THEMES,\n} from './config'\nimport {useAceEditor} from './ace-editor/AceEditorLazy'\n\nexport type {CodeInputLanguage, CodeInputValue} from './types'\n\nconst EditorContainer = styled(Card)`\n position: relative;\n box-sizing: border-box;\n overflow: hidden;\n z-index: 0;\n\n .ace_editor {\n font-family: ${({theme}) => theme.sanity.fonts.code.family};\n font-size: ${({theme}) => theme.sanity.fonts.code.sizes[1]};\n line-height: inherit;\n }\n\n ${highlightMarkersCSS}\n\n &:not([disabled]):not([readonly]) {\n &:focus,\n &:focus-within {\n box-shadow: 0 0 0 2px ${({theme}) => theme.sanity.color.base.focusRing};\n background-color: ${({theme}) => theme.sanity.color.base.bg};\n border-color: ${({theme}) => theme.sanity.color.base.focusRing};\n }\n }\n`\n\n/**\n * @public\n */\nexport interface CodeOptions {\n theme?: string\n darkTheme?: string\n languageAlternatives?: CodeInputLanguage[]\n language?: string\n withFilename?: boolean\n}\n\n/**\n * @public\n */\nexport type CodeSchemaType = Omit<ObjectSchemaType, 'options'> & {\n options?: CodeOptions\n}\n\n/**\n * @public\n */\nexport type CodeInputProps = ObjectInputProps<CodeInputValue, CodeSchemaType> & {\n /** @internal */\n colorScheme?: ThemeColorSchemeKey\n}\n\n// Returns a string with the mode name if supported (because aliases), otherwise false\nfunction isSupportedLanguage(mode: string) {\n const alias = LANGUAGE_ALIASES[mode]\n\n if (alias) {\n return alias\n }\n\n const isSupported = SUPPORTED_LANGUAGES.find((lang) => lang.value === mode)\n if (isSupported) {\n return mode\n }\n\n return false\n}\n\nexport function CodeInput(props: CodeInputProps) {\n const {\n members,\n elementProps,\n onChange,\n readOnly,\n renderField,\n renderInput,\n renderItem,\n renderPreview,\n schemaType: type,\n value,\n onPathFocus,\n } = props\n\n const aceEditorRef = useRef<any>()\n\n const fieldMembers = useMemo(\n () => members.filter((member) => member.kind === 'field') as FieldMember[],\n [members]\n )\n\n const languageFieldMember = fieldMembers.find((member) => member.name === 'language')\n const filenameMember = fieldMembers.find((member) => member.name === 'filename')\n const codeFieldMember = fieldMembers.find((member) => member.name === 'code')\n\n useImperativeHandle(elementProps.ref, () => ({\n focus: () => {\n aceEditorRef?.current?.editor?.focus()\n },\n }))\n\n const handleCodeFocus = useCallback(() => {\n onPathFocus(PATH_CODE)\n }, [onPathFocus])\n\n const {scheme} = useColorScheme()\n\n const theme = useMemo(() => {\n const isLight = scheme === 'light'\n const preferredTheme = isLight ? type.options?.theme : type.options?.darkTheme\n const defaultTheme = isLight ? DEFAULT_THEME : DEFAULT_DARK_THEME\n return preferredTheme && SUPPORTED_THEMES.find((t) => t === preferredTheme)\n ? preferredTheme\n : defaultTheme\n }, [type, scheme])\n\n const handleToggleSelectLine = useCallback(\n (lineNumber: number) => {\n const editorSession = aceEditorRef.current?.editor?.getSession()\n const backgroundMarkers = editorSession?.getMarkers(true)\n const currentHighlightedLines = Object.keys(backgroundMarkers)\n .filter((key) => backgroundMarkers[key].type === 'screenLine')\n .map((key) => backgroundMarkers[key].range.start.row)\n const currentIndex = currentHighlightedLines.indexOf(lineNumber)\n if (currentIndex > -1) {\n // toggle remove\n currentHighlightedLines.splice(currentIndex, 1)\n } else {\n // toggle add\n currentHighlightedLines.push(lineNumber)\n currentHighlightedLines.sort()\n }\n onChange(\n set(\n currentHighlightedLines.map(\n (line) =>\n // ace starts at line (row) 0, but we store it starting at line 1\n line + 1\n ),\n ['highlightedLines']\n )\n )\n },\n [aceEditorRef, onChange]\n )\n\n const handleGutterMouseDown = useCallback(\n (event: any) => {\n const target = event.domEvent.target\n if (target.classList.contains('ace_gutter-cell')) {\n const row = event.getDocumentPosition().row\n handleToggleSelectLine(row)\n }\n },\n [handleToggleSelectLine]\n )\n\n useEffect(() => {\n const editor = aceEditorRef?.current?.editor\n return () => {\n editor?.session?.removeListener('guttermousedown', handleGutterMouseDown)\n }\n }, [aceEditorRef, handleGutterMouseDown])\n\n const handleEditorLoad = useCallback(\n (editor: any) => {\n editor?.on('guttermousedown', handleGutterMouseDown)\n },\n [handleGutterMouseDown]\n )\n\n const getLanguageAlternatives = useCallback((): {\n title: string\n value: string\n mode?: string\n }[] => {\n const languageAlternatives = type.options?.languageAlternatives\n if (!languageAlternatives) {\n return SUPPORTED_LANGUAGES\n }\n\n if (!Array.isArray(languageAlternatives)) {\n throw new Error(\n `'options.languageAlternatives' should be an array, got ${typeof languageAlternatives}`\n )\n }\n\n return languageAlternatives.reduce((acc: CodeInputLanguage[], {title, value: val, mode}) => {\n const alias = LANGUAGE_ALIASES[val]\n if (alias) {\n // eslint-disable-next-line no-console\n console.warn(\n `'options.languageAlternatives' lists a language with value \"%s\", which is an alias of \"%s\" - please replace the value to read \"%s\"`,\n val,\n alias,\n alias\n )\n\n return acc.concat({title, value: alias, mode: mode})\n }\n\n if (!mode && !SUPPORTED_LANGUAGES.find((lang) => lang.value === val)) {\n // eslint-disable-next-line no-console\n console.warn(\n `'options.languageAlternatives' lists a language which is not supported: \"%s\", syntax highlighting will be disabled.`,\n val\n )\n }\n\n return acc.concat({title, value: val, mode})\n }, [])\n }, [type])\n\n const handleCodeChange = useCallback(\n (code: string) => {\n const path = PATH_CODE\n const fixedLanguage = type.options?.language\n\n onChange([\n setIfMissing({_type: type.name, language: fixedLanguage}),\n code ? set(code, path) : unset(path),\n ])\n },\n [onChange, type]\n )\n\n const languages = getLanguageAlternatives().slice()\n\n const fixedLanguage = type.options?.language\n\n const language = value?.language || fixedLanguage\n\n // the language config from the schema\n const configured = languages.find((entry) => entry.value === language)\n\n // is the language officially supported (e.g. we import the mode by default)\n const supported = language && isSupportedLanguage(language)\n\n const mode = configured?.mode || (supported ? language : 'text')\n\n const renderLanguageInput = useCallback(\n (inputProps: Omit<InputProps, 'renderDefault'>) => {\n return (\n <Select\n {...(inputProps as StringInputProps)}\n onChange={(e) => {\n const newValue = e.currentTarget.value\n inputProps.onChange(newValue ? set(newValue) : unset())\n }}\n >\n {languages.map((lang: {title: string; value: string}) => (\n <option key={lang.value} value={lang.value}>\n {lang.title}\n </option>\n ))}\n </Select>\n )\n },\n [languages]\n )\n\n const AceEditor = useAceEditor()\n\n const renderCodeInput: RenderInputCallback = useCallback(\n (inputProps) => {\n return (\n <EditorContainer radius={1} shadow={1} readOnly={readOnly}>\n {AceEditor && (\n <Suspense fallback={<div>Loading code editor...</div>}>\n <AceEditor\n ref={aceEditorRef}\n mode={mode}\n theme={theme}\n width=\"100%\"\n onChange={handleCodeChange}\n name={inputProps.id}\n value={inputProps.value as string}\n markers={\n value && value.highlightedLines\n ? createHighlightMarkers(value.highlightedLines)\n : undefined\n }\n onLoad={handleEditorLoad}\n readOnly={readOnly}\n tabSize={2}\n wrapEnabled\n setOptions={ACE_SET_OPTIONS}\n editorProps={ACE_EDITOR_PROPS}\n onFocus={handleCodeFocus}\n onBlur={elementProps.onBlur}\n />\n </Suspense>\n )}\n </EditorContainer>\n )\n },\n [\n AceEditor,\n theme,\n handleCodeChange,\n handleCodeFocus,\n handleEditorLoad,\n mode,\n elementProps.onBlur,\n readOnly,\n value,\n ]\n )\n\n return (\n <Stack space={4}>\n {languageFieldMember && (\n <MemberField\n member={languageFieldMember}\n renderItem={renderItem}\n renderField={renderField}\n renderInput={renderLanguageInput}\n renderPreview={renderPreview}\n />\n )}\n\n {type.options?.withFilename && filenameMember && (\n <MemberField\n member={filenameMember}\n renderItem={renderItem}\n renderField={renderField}\n renderInput={renderInput}\n renderPreview={renderPreview}\n />\n )}\n\n {codeFieldMember && (\n <MemberField\n member={codeFieldMember}\n renderInput={renderCodeInput}\n renderItem={renderItem}\n renderField={renderField}\n renderPreview={renderPreview}\n />\n )}\n </Stack>\n )\n}\n","import React, {Suspense, useCallback, useEffect, useRef} from 'react'\nimport styled from 'styled-components'\nimport {Box} from '@sanity/ui'\nimport {ACE_EDITOR_PROPS, ACE_SET_OPTIONS} from './config'\nimport createHighlightMarkers from './createHighlightMarkers'\nimport {CodeInputValue} from './types'\nimport {useAceEditor} from './ace-editor/AceEditorLazy'\nimport {CodeSchemaType} from './CodeInput'\n\nconst PreviewContainer = styled(Box)`\n position: relative;\n`\n\nconst PreviewInner = styled(Box)`\n background-color: #272822;\n\n .ace_editor {\n box-sizing: border-box;\n cursor: default;\n pointer-events: none;\n }\n\n .ace_content {\n box-sizing: border-box;\n overflow: hidden;\n }\n`\n\n/**\n * @public\n */\nexport interface PreviewCodeProps {\n type?: CodeSchemaType\n value?: {selection?: CodeInputValue}\n}\n\n/**\n * @public\n */\nexport default function PreviewCode(props: PreviewCodeProps) {\n const aceEditorRef = useRef<any>()\n\n useEffect(() => {\n if (!aceEditorRef?.current) return\n\n const editor = aceEditorRef.current?.editor\n\n if (editor) {\n // Avoid cursor and focus tracking by Ace\n editor.renderer.$cursorLayer.element.style.opacity = 0\n editor.textInput.getElement().disabled = true\n }\n }, [])\n\n const handleEditorChange = useCallback(() => {\n // do nothing when the editor changes\n }, [])\n\n const {value, type} = props\n const fixedLanguage = type?.options?.language\n\n const selection = value?.selection\n const mode = selection?.language || fixedLanguage || 'text'\n\n const AceEditor = useAceEditor()\n return (\n <PreviewContainer>\n <PreviewInner padding={4}>\n {AceEditor && (\n <Suspense fallback={<div>Loading code preview...</div>}>\n <AceEditor\n ref={aceEditorRef}\n focus={false}\n mode={mode}\n theme=\"monokai\"\n width=\"100%\"\n onChange={handleEditorChange}\n maxLines={200}\n readOnly\n wrapEnabled\n showPrintMargin={false}\n highlightActiveLine={false}\n cursorStart={-1}\n value={selection?.code || ''}\n markers={\n selection?.highlightedLines\n ? createHighlightMarkers(selection.highlightedLines)\n : undefined\n }\n tabSize={2}\n showGutter={false}\n setOptions={ACE_SET_OPTIONS}\n editorProps={ACE_EDITOR_PROPS}\n />\n </Suspense>\n )}\n </PreviewInner>\n </PreviewContainer>\n )\n}\n","import {CodeBlockIcon} from '@sanity/icons'\nimport {CodeInput, CodeOptions} from './CodeInput'\nimport PreviewCode, {PreviewCodeProps} from './PreviewCode'\nimport {getMedia} from './getMedia'\nimport {defineType, ObjectDefinition} from 'sanity'\n\nexport type {CodeInputProps, CodeSchemaType} from './CodeInput'\n\nexport type {CodeInputLanguage, CodeInputValue} from './types'\nexport type {PreviewCode, PreviewCodeProps, CodeInput}\n\n/**\n * @public\n */\nexport const codeTypeName = 'code' as const\n\n/**\n * @public\n */\nexport interface CodeDefinition extends Omit<ObjectDefinition, 'type' | 'fields' | 'options'> {\n type: typeof codeTypeName\n options?: CodeOptions\n}\n\ndeclare module '@sanity/types' {\n // makes type: 'code' narrow correctly when using defineType/defineField/defineArrayMember\n export interface IntrinsicDefinitions {\n code: CodeDefinition\n }\n}\n\n/**\n * @public\n */\nexport const codeSchema = defineType({\n name: 'code',\n type: 'object',\n title: 'Code',\n ...({components: {input: CodeInput, preview: PreviewCode}} as {}), //TODO rollback change when rc.1 is released\n icon: CodeBlockIcon,\n fields: [\n {\n name: 'language',\n title: 'Language',\n type: 'string',\n },\n {\n name: 'filename',\n title: 'Filename',\n type: 'string',\n },\n {\n title: 'Code',\n name: 'code',\n type: 'text',\n },\n {\n title: 'Highlighted lines',\n name: 'highlightedLines',\n type: 'array',\n of: [\n {\n type: 'number',\n title: 'Highlighted line',\n },\n ],\n },\n ],\n preview: {\n select: {\n language: 'language',\n code: 'code',\n filename: 'filename',\n highlightedLines: 'highlightedLines',\n },\n prepare: (value: {\n language?: string\n code?: string\n filename?: string\n highlightedLines?: number[]\n }) => {\n return {\n title: value.filename || (value.language || 'unknown').toUpperCase(),\n media: getMedia(value?.language),\n selection: value,\n }\n },\n },\n})\n","import React from 'react'\n\nexport function getMedia(language?: string) {\n if (language === 'jsx') {\n return (\n <svg xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 128 128\">\n <g fill=\"#61DAFB\">\n <circle cx=\"64\" cy=\"64\" r=\"11.4\" />\n <path 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.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 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\" />\n </g>\n </svg>\n )\n }\n\n if (language === 'javascript') {\n return (\n <svg xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 128 128\">\n <path fill=\"#F0DB4F\" d=\"M1.408 1.408h125.184v125.185H1.408z\" />\n <path\n fill=\"#323330\"\n 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\"\n />\n </svg>\n )\n }\n\n if (language === 'php') {\n return (\n <svg xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 800 400\">\n <g transform=\"translate(-44.632 -141.55)\">\n <g transform=\"matrix(8.3528 0 0 8.3119 -727.13 -3759.5)\">\n <path 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\" />\n <path 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\" />\n <path 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\" />\n </g>\n </g>\n </svg>\n )\n }\n\n if (language === 'json') {\n return (\n <svg\n xmlns=\"http://www.w3.org/2000/svg\"\n xmlnsXlink=\"http://www.w3.org/1999/xlink\"\n viewBox=\"0 0 160 160\"\n >\n <defs>\n <linearGradient id=\"a\">\n <stop offset=\"0\" />\n <stop offset=\"1\" stopColor=\"#fff\" />\n </linearGradient>\n <linearGradient\n x1=\"-553.27\"\n y1=\"525.908\"\n x2=\"-666.116\"\n y2=\"413.045\"\n id=\"c\"\n xlinkHref=\"#a\"\n gradientUnits=\"userSpaceOnUse\"\n gradientTransform=\"matrix(.99884 0 0 .9987 689.008 -388.844)\"\n />\n <linearGradient\n x1=\"-666.117\"\n y1=\"413.045\"\n x2=\"-553.27\"\n y2=\"525.908\"\n id=\"b\"\n xlinkHref=\"#a\"\n gradientUnits=\"userSpaceOnUse\"\n gradientTransform=\"matrix(.99884 0 0 .9987 689.008 -388.844)\"\n />\n </defs>\n <path\n 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\"\n style={{marker: 'none'}}\n color=\"#000\"\n fill=\"url(#b)\"\n fillRule=\"evenodd\"\n overflow=\"visible\"\n />\n <path\n 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\"\n style={{marker: 'none'}}\n color=\"#000\"\n fill=\"url(#c)\"\n fillRule=\"evenodd\"\n overflow=\"visible\"\n />\n </svg>\n )\n }\n\n return undefined\n}\n","import {definePlugin} from 'sanity'\n\nimport {codeSchema, codeTypeName, CodeDefinition} from './schema'\nimport PreviewCode, {PreviewCodeProps} from './PreviewCode'\nexport type {CodeInputProps, CodeSchemaType, CodeOptions} from './CodeInput'\n\nexport type {CodeInputLanguage, CodeInputValue} from './types'\n\nexport {PreviewCode, type PreviewCodeProps}\nexport {codeSchema, codeTypeName}\nexport type {CodeDefinition}\n/**\n * @public\n */\nexport const codeInput = definePlugin({\n name: '@sanity/code-input',\n schema: {types: [codeSchema]},\n})\n"],"names":["highlightMarkersCSS","css","_templateObject","_taggedTemplateLiteral","_ref","theme","sanity","color","solid","primary","enabled","bg","createHighlightMarkers","rows","map","row","startRow","Number","startCol","endRow","endCol","Infinity","className","type","inFront","SUPPORTED_LANGUAGES","title","value","LANGUAGE_ALIASES","js","SUPPORTED_THEMES","ACE_SET_OPTIONS","useSoftTabs","navigateWithinSoftTabs","ACE_EDITOR_PROPS","$blockScrolling","PATH_CODE","AceEditorLazy","React","lazy","import","useAceEditor","mounted","setMounted","useState","useEffect","requestAnimationFrame","EditorContainer","styled","Card","_templateObject2","_ref2","fonts","code","family","_ref3","sizes","_ref4","base","focusRing","_ref5","_ref6","PreviewContainer","Box","_templateObject3","PreviewInner","_templateObject4","PreviewCode","props","_a","aceEditorRef","useRef","current","editor","renderer","$cursorLayer","element","style","opacity","textInput","getElement","disabled","handleEditorChange","useCallback","fixedLanguage","options","language","selection","mode","AceEditor","jsx","children","padding","Suspense","fallback","ref","focus","width","onChange","maxLines","readOnly","wrapEnabled","showPrintMargin","highlightActiveLine","cursorStart","markers","highlightedLines","tabSize","showGutter","setOptions","editorProps","codeTypeName","codeSchema","defineType","_objectSpread","name","components","input","_b","members","elementProps","renderField","renderInput","renderItem","renderPreview","schemaType","onPathFocus","fieldMembers","useMemo","filter","member","kind","languageFieldMember","find","filenameMember","codeFieldMember","useImperativeHandle","handleCodeFocus","scheme","useColorScheme","isLight","preferredTheme","darkTheme","defaultTheme","t","handleToggleSelectLine","lineNumber","editorSession","getSession","backgroundMarkers","getMarkers","currentHighlightedLines","Object","keys","key","range","start","currentIndex","indexOf","splice","push","sort","set","line","handleGutterMouseDown","event","domEvent","target","classList","contains","getDocumentPosition","session","removeListener","handleEditorLoad","on","getLanguageAlternatives","languageAlternatives","Array","isArray","Error","concat","reduce","acc","_ref7","val","alias","console","warn","lang","handleCodeChange","path","setIfMissing","_type","unset","languages","slice","configured","entry","supported","isSupportedLanguage","renderLanguageInput","inputProps","Select","e","newValue","currentTarget","renderCodeInput","radius","shadow","id","onLoad","onFocus","onBlur","jsxs","Stack","space","MemberField","withFilename","preview","icon","CodeBlockIcon","fields","of","select","filename","prepare","toUpperCase","media","xmlns","viewBox","fill","cx","cy","r","d","transform","xmlnsXlink","offset","stopColor","x1","y1","x2","y2","xlinkHref","gradientUnits","gradientTransform","marker","fillRule","overflow","codeInput","definePlugin","schema","types"],"mappings":"uwCAGO,MAAMA,EAAsBC,EAGXC,IAAAA,EAAAC,EAAA,CAAA,uFAAA,iGAAAC,IAAA,IAACC,MAACA,GAAKD,EAAA,OAAMC,EAAMC,OAAOC,MAAMC,MAAMC,QAAQC,QAAQC,EAAA,IAO9E,SAAwBC,EAAuBC,GACtC,OAAAA,EAAKC,KAAKC,IAAS,CACxBC,SAAUC,OAAOF,GAAO,EACxBG,SAAU,EACVC,OAAQF,OAAOF,GAAO,EACtBK,OAAQC,IACRC,UAAW,+BACXC,KAAM,aACNC,SAAS,KAEb,CCpBO,MAAMC,EAA2C,CACtD,CAACC,MAAO,aAAcC,MAAO,aAC7B,CAACD,MAAO,KAAMC,MAAO,UACrB,CAACD,MAAO,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,EAAA,OAAA,CAAKgJ,EAAE,wnBAOD,SAAbpJ,EAEC+H,EAAA,MAAA,CACCe,MAAM,6BACNQ,WAAW,+BACXP,QAAQ,cAER1I,SAAA,CAAC0H,EAAA,OAAA,CACC1H,SAAA,CAAC0H,EAAA,iBAAA,CAAeJ,GAAG,IACjBtH,SAAA,CAACD,EAAA,OAAA,CAAKmJ,OAAO,MACZnJ,EAAA,OAAA,CAAKmJ,OAAO,IAAIC,UAAU,YAE5BpJ,EAAA,iBAAA,CACCqJ,GAAG,UACHC,GAAG,UACHC,GAAG,WACHC,GAAG,UACHjC,GAAG,IACHkC,UAAU,KACVC,cAAc,iBACdC,kBAAkB,8CAEnB3J,EAAA,iBAAA,CACCqJ,GAAG,WACHC,GAAG,UACHC,GAAG,UACHC,GAAG,UACHjC,GAAG,IACHkC,UAAU,KACVC,cAAc,iBACdC,kBAAkB,iDAGrB3J,EAAA,OAAA,CACCgJ,EAAE,+SACF7J,MAAO,CAACyK,OAAQ,QAChB/O,MAAM,OACN+N,KAAK,UACLiB,SAAS,UACTC,SAAS,YAEV9J,EAAA,OAAA,CACCgJ,EAAE,2SACF7J,MAAO,CAACyK,OAAQ,QAChB/O,MAAM,OACN+N,KAAK,UACLiB,SAAS,UACTC,SAAS,oBA/CjB,GD4CMjK,UAAW5D,GClFZ,IAAkB2D,CDmFnB,MEvEOmK,EAAYC,EAAa,CACpCvI,KAAM,qBACNwI,OAAQ,CAACC,MAAO,CAAC5I"}
package/lib/index.js ADDED
@@ -0,0 +1,2 @@
1
+ "use strict";var e,t,n,r;function i(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function l(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?i(Object(n),!0).forEach((function(t){o(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):i(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function o(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function a(e,t){return t||(t=e.slice(0)),Object.freeze(Object.defineProperties(e,{raw:{value:Object.freeze(t)}}))}Object.defineProperty(exports,"__esModule",{value:!0});var s=require("sanity"),c=require("@sanity/icons"),u=require("react/jsx-runtime"),d=require("react"),h=require("@sanity/ui"),v=require("styled-components");function g(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var p=g(d),m=g(v);const f=v.css(e||(e=a(["\n .ace_editor_markers_highlight {\n position: absolute;\n background-color: ",";\n opacity: 0.2;\n width: 100% !important;\n border-radius: 0 !important;\n }\n"])),(e=>{let{theme:t}=e;return t.sanity.color.solid.primary.enabled.bg}));function b(e){return e.map((e=>({startRow:Number(e)-1,startCol:0,endRow:Number(e)-1,endCol:1/0,className:"ace_editor_markers_highlight",type:"screenLine",inFront:!0})))}const x=[{title:"Batch file",value:"batchfile"},{title:"C#",value:"csharp"},{title:"CSS",value:"css"},{title:"Go",value:"golang"},{title:"GROQ",value:"groq"},{title:"HTML",value:"html"},{title:"Java",value:"java"},{title:"JavaScript",value:"javascript"},{title:"JSON",value:"json"},{title:"JSX",value:"jsx"},{title:"Markdown",value:"markdown"},{title:"MySQL",value:"mysql"},{title:"PHP",value:"php"},{title:"Plain text",value:"text"},{title:"Python",value:"python"},{title:"Ruby",value:"ruby"},{title:"SASS",value:"sass"},{title:"SCSS",value:"scss"},{title:"sh",value:"sh"},{title:"TSX",value:"tsx"},{title:"TypeScript",value:"typescript"},{title:"XML",value:"xml"},{title:"YAML",value:"yaml"}],y={js:"javascript"},w=["github","monokai","terminal","tomorrow"],j={useSoftTabs:!0,navigateWithinSoftTabs:!0},k={$blockScrolling:!0},O=["code"],S=p.default.lazy((()=>Promise.resolve().then((function(){return require("./_chunks/editorSupport-bda3d360.js")}))));function C(){const[e,t]=d.useState(!1);return d.useEffect((()=>{requestAnimationFrame((()=>t(!0)))}),[]),e?S:null}const z=m.default(h.Card)(t||(t=a(["\n position: relative;\n box-sizing: border-box;\n overflow: hidden;\n z-index: 0;\n\n .ace_editor {\n font-family: ",";\n font-size: ",";\n line-height: inherit;\n }\n\n ","\n\n &:not([disabled]):not([readonly]) {\n &:focus,\n &:focus-within {\n box-shadow: 0 0 0 2px ",";\n background-color: ",";\n border-color: ",";\n }\n }\n"])),(e=>{let{theme:t}=e;return t.sanity.fonts.code.family}),(e=>{let{theme:t}=e;return t.sanity.fonts.code.sizes[1]}),f,(e=>{let{theme:t}=e;return t.sanity.color.base.focusRing}),(e=>{let{theme:t}=e;return t.sanity.color.base.bg}),(e=>{let{theme:t}=e;return t.sanity.color.base.focusRing}));const P=m.default(h.Box)(n||(n=a(["\n position: relative;\n"]))),M=m.default(h.Box)(r||(r=a(["\n background-color: #272822;\n\n .ace_editor {\n box-sizing: border-box;\n cursor: default;\n pointer-events: none;\n }\n\n .ace_content {\n box-sizing: border-box;\n overflow: hidden;\n }\n"])));function L(e){var t;const n=d.useRef();d.useEffect((()=>{var e;if(!(null==n?void 0:n.current))return;const t=null==(e=n.current)?void 0:e.editor;t&&(t.renderer.$cursorLayer.element.style.opacity=0,t.textInput.getElement().disabled=!0)}),[]);const r=d.useCallback((()=>{}),[]),{value:i,type:l}=e,o=null==(t=null==l?void 0:l.options)?void 0:t.language,a=null==i?void 0:i.selection,s=(null==a?void 0:a.language)||o||"text",c=C();return u.jsx(P,{children:u.jsx(M,{padding:4,children:c&&u.jsx(d.Suspense,{fallback:u.jsx("div",{children:"Loading code preview..."}),children:u.jsx(c,{ref:n,focus:!1,mode:s,theme:"monokai",width:"100%",onChange:r,maxLines:200,readOnly:!0,wrapEnabled:!0,showPrintMargin:!1,highlightActiveLine:!1,cursorStart:-1,value:(null==a?void 0:a.code)||"",markers:(null==a?void 0:a.highlightedLines)?b(a.highlightedLines):void 0,tabSize:2,showGutter:!1,setOptions:j,editorProps:k})})})})}const F=s.defineType(l(l({name:"code",type:"object",title:"Code"},{components:{input:function(e){var t,n;const{members:r,elementProps:i,onChange:o,readOnly:a,renderField:c,renderInput:v,renderItem:g,renderPreview:p,schemaType:m,value:f,onPathFocus:S}=e,P=d.useRef(),M=d.useMemo((()=>r.filter((e=>"field"===e.kind))),[r]),L=M.find((e=>"language"===e.name)),F=M.find((e=>"filename"===e.name)),_=M.find((e=>"code"===e.name));d.useImperativeHandle(i.ref,(()=>({focus:()=>{var e,t;null==(t=null==(e=null==P?void 0:P.current)?void 0:e.editor)||t.focus()}})));const B=d.useCallback((()=>{S(O)}),[S]),{scheme:I}=s.useColorScheme(),T=d.useMemo((()=>{var e,t;const n="light"===I,r=n?null==(e=m.options)?void 0:e.theme:null==(t=m.options)?void 0:t.darkTheme,i=n?"tomorrow":"monokai";return r&&w.find((e=>e===r))?r:i}),[m,I]),A=d.useCallback((e=>{var t,n;const r=null==(n=null==(t=P.current)?void 0:t.editor)?void 0:n.getSession(),i=null==r?void 0:r.getMarkers(!0),l=Object.keys(i).filter((e=>"screenLine"===i[e].type)).map((e=>i[e].range.start.row)),a=l.indexOf(e);a>-1?l.splice(a,1):(l.push(e),l.sort()),o(s.set(l.map((e=>e+1)),["highlightedLines"]))}),[P,o]),q=d.useCallback((e=>{if(e.domEvent.target.classList.contains("ace_gutter-cell")){const t=e.getDocumentPosition().row;A(t)}}),[A]);d.useEffect((()=>{var e;const t=null==(e=null==P?void 0:P.current)?void 0:e.editor;return()=>{var e;null==(e=null==t?void 0:t.session)||e.removeListener("guttermousedown",q)}}),[P,q]);const E=d.useCallback((e=>{null==e||e.on("guttermousedown",q)}),[q]),R=d.useCallback((()=>{var e;const t=null==(e=m.options)?void 0:e.languageAlternatives;if(!t)return x;if(!Array.isArray(t))throw new Error("'options.languageAlternatives' should be an array, got ".concat(typeof t));return t.reduce(((e,t)=>{let{title:n,value:r,mode:i}=t;const l=y[r];return l?(console.warn('\'options.languageAlternatives\' lists a language with value "%s", which is an alias of "%s" - please replace the value to read "%s"',r,l,l),e.concat({title:n,value:l,mode:i})):(i||x.find((e=>e.value===r))||console.warn("'options.languageAlternatives' lists a language which is not supported: \"%s\", syntax highlighting will be disabled.",r),e.concat({title:n,value:r,mode:i}))}),[])}),[m]),H=d.useCallback((e=>{var t;const n=O,r=null==(t=m.options)?void 0:t.language;o([s.setIfMissing({_type:m.name,language:r}),e?s.set(e,n):s.unset(n)])}),[o,m]),D=R().slice(),G=null==(t=m.options)?void 0:t.language,N=(null==f?void 0:f.language)||G,U=D.find((e=>e.value===N)),J=N&&function(e){const t=y[e];return t||!!x.find((t=>t.value===e))&&e}(N),X=(null==U?void 0:U.mode)||(J?N:"text"),Q=d.useCallback((e=>u.jsx(h.Select,l(l({},e),{},{onChange:t=>{const n=t.currentTarget.value;e.onChange(n?s.set(n):s.unset())},children:D.map((e=>u.jsx("option",{value:e.value,children:e.title},e.value)))}))),[D]),$=C(),W=d.useCallback((e=>u.jsx(z,{radius:1,shadow:1,readOnly:a,children:$&&u.jsx(d.Suspense,{fallback:u.jsx("div",{children:"Loading code editor..."}),children:u.jsx($,{ref:P,mode:X,theme:T,width:"100%",onChange:H,name:e.id,value:e.value,markers:f&&f.highlightedLines?b(f.highlightedLines):void 0,onLoad:E,readOnly:a,tabSize:2,wrapEnabled:!0,setOptions:j,editorProps:k,onFocus:B,onBlur:i.onBlur})})})),[$,T,H,B,E,X,i.onBlur,a,f]);return u.jsxs(h.Stack,{space:4,children:[L&&u.jsx(s.MemberField,{member:L,renderItem:g,renderField:c,renderInput:Q,renderPreview:p}),(null==(n=m.options)?void 0:n.withFilename)&&F&&u.jsx(s.MemberField,{member:F,renderItem:g,renderField:c,renderInput:v,renderPreview:p}),_&&u.jsx(s.MemberField,{member:_,renderInput:W,renderItem:g,renderField:c,renderPreview:p})]})},preview:L}}),{},{icon:c.CodeBlockIcon,fields:[{name:"language",title:"Language",type:"string"},{name:"filename",title:"Filename",type:"string"},{title:"Code",name:"code",type:"text"},{title:"Highlighted lines",name:"highlightedLines",type:"array",of:[{type:"number",title:"Highlighted line"}]}],preview:{select:{language:"language",code:"code",filename:"filename",highlightedLines:"highlightedLines"},prepare:e=>{return{title:e.filename||(e.language||"unknown").toUpperCase(),media:(t=null==e?void 0:e.language,"jsx"===t?u.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 128 128",children:u.jsxs("g",{fill:"#61DAFB",children:[u.jsx("circle",{cx:"64",cy:"64",r:"11.4"}),u.jsx("path",{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-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-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"})]})}):"javascript"===t?u.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 128 128",children:[u.jsx("path",{fill:"#F0DB4F",d:"M1.408 1.408h125.184v125.185H1.408z"}),u.jsx("path",{fill:"#323330",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"})]}):"php"===t?u.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 800 400",children:u.jsx("g",{transform:"translate(-44.632 -141.55)",children:u.jsxs("g",{transform:"matrix(8.3528 0 0 8.3119 -727.13 -3759.5)",children:[u.jsx("path",{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"}),u.jsx("path",{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"}),u.jsx("path",{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"})]})})}):"json"===t?u.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",xmlnsXlink:"http://www.w3.org/1999/xlink",viewBox:"0 0 160 160",children:[u.jsxs("defs",{children:[u.jsxs("linearGradient",{id:"a",children:[u.jsx("stop",{offset:"0"}),u.jsx("stop",{offset:"1",stopColor:"#fff"})]}),u.jsx("linearGradient",{x1:"-553.27",y1:"525.908",x2:"-666.116",y2:"413.045",id:"c",xlinkHref:"#a",gradientUnits:"userSpaceOnUse",gradientTransform:"matrix(.99884 0 0 .9987 689.008 -388.844)"}),u.jsx("linearGradient",{x1:"-666.117",y1:"413.045",x2:"-553.27",y2:"525.908",id:"b",xlinkHref:"#a",gradientUnits:"userSpaceOnUse",gradientTransform:"matrix(.99884 0 0 .9987 689.008 -388.844)"})]}),u.jsx("path",{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",style:{marker:"none"},color:"#000",fill:"url(#b)",fillRule:"evenodd",overflow:"visible"}),u.jsx("path",{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",style:{marker:"none"},color:"#000",fill:"url(#c)",fillRule:"evenodd",overflow:"visible"})]}):void 0),selection:e};var t}}})),_=s.definePlugin({name:"@sanity/code-input",schema:{types:[F]}});exports.PreviewCode=L,exports.codeInput=_,exports.codeSchema=F,exports.codeTypeName="code";
2
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sources":["../src/createHighlightMarkers.ts","../src/config.ts","../src/ace-editor/AceEditorLazy.tsx","../src/CodeInput.tsx","../src/PreviewCode.tsx","../src/schema.tsx","../src/getMedia.tsx","../src/index.ts"],"sourcesContent":["import type {IMarker} from 'react-ace'\nimport {css} from 'styled-components'\n\nexport const highlightMarkersCSS = css`\n .ace_editor_markers_highlight {\n position: absolute;\n background-color: ${({theme}) => theme.sanity.color.solid.primary.enabled.bg};\n opacity: 0.2;\n width: 100% !important;\n border-radius: 0 !important;\n }\n`\n\nexport default function createHighlightMarkers(rows: number[]): IMarker[] {\n return rows.map((row) => ({\n startRow: Number(row) - 1,\n startCol: 0,\n endRow: Number(row) - 1,\n endCol: +Infinity,\n className: 'ace_editor_markers_highlight',\n type: 'screenLine',\n inFront: true,\n }))\n}\n","import {CodeInputLanguage} from './types'\n\n// NOTE: MAKE SURE THESE ALIGN WITH IMPORTS IN ./ace-editor/editorSupport\nexport const SUPPORTED_LANGUAGES: CodeInputLanguage[] = [\n {title: 'Batch file', value: 'batchfile'},\n {title: 'C#', value: 'csharp'},\n {title: 'CSS', value: 'css'},\n {title: 'Go', value: 'golang'},\n {title: 'GROQ', value: 'groq'},\n {title: 'HTML', value: 'html'},\n {title: 'Java', value: 'java'},\n {title: 'JavaScript', value: 'javascript'},\n {title: 'JSON', value: 'json'},\n {title: 'JSX', value: 'jsx'},\n {title: 'Markdown', value: 'markdown'},\n {title: 'MySQL', value: 'mysql'},\n {title: 'PHP', value: 'php'},\n {title: 'Plain text', value: 'text'},\n {title: 'Python', value: 'python'},\n {title: 'Ruby', value: 'ruby'},\n {title: 'SASS', value: 'sass'},\n {title: 'SCSS', value: 'scss'},\n {title: 'sh', value: 'sh'},\n {title: 'TSX', value: 'tsx'},\n {title: 'TypeScript', value: 'typescript'},\n {title: 'XML', value: 'xml'},\n {title: 'YAML', value: 'yaml'},\n]\n\nexport const LANGUAGE_ALIASES: Record<string, string | undefined> = {js: 'javascript'}\n\nexport const SUPPORTED_THEMES = ['github', 'monokai', 'terminal', 'tomorrow']\n\nexport const DEFAULT_THEME = 'tomorrow'\nexport const DEFAULT_DARK_THEME = 'monokai'\n\nexport const ACE_SET_OPTIONS = {\n useSoftTabs: true,\n navigateWithinSoftTabs: true /* note only supported by ace v1.2.7 or higher */,\n}\n\nexport const ACE_EDITOR_PROPS = {$blockScrolling: true}\n\nexport const PATH_LANGUAGE = ['language']\nexport const PATH_CODE = ['code']\nexport const PATH_FILENAME = ['filename']\n","import React, {useEffect, useState} from 'react'\n\n/**\n * AceEditor loads window global directly when imported, which crashes in node envs.\n * This works around the issue by only importing ace-dependencies when window is defined.\n *\n * We only set the ace lazy component after mounting, to allow us to render null on the server,\n * and use suspense on the client. This will make hydration work correctly.\n */\nexport const AceEditorLazy = React.lazy(() => import('./editorSupport'))\n\nexport function useAceEditor() {\n const [mounted, setMounted] = useState(false)\n useEffect(() => {\n requestAnimationFrame(() => setMounted(true))\n }, [])\n\n return mounted ? AceEditorLazy : null\n}\n","/* eslint-disable react/jsx-handler-names */\nimport React, {Suspense, useCallback, useEffect, useImperativeHandle, useMemo, useRef} from 'react'\nimport {\n InputProps,\n ObjectSchemaType,\n StringInputProps,\n useColorScheme,\n FieldMember,\n MemberField,\n ObjectInputProps,\n set,\n setIfMissing,\n unset,\n RenderInputCallback,\n} from 'sanity'\nimport {Card, Select, Stack, ThemeColorSchemeKey} from '@sanity/ui'\nimport styled from 'styled-components'\nimport createHighlightMarkers, {highlightMarkersCSS} from './createHighlightMarkers'\nimport {CodeInputLanguage, CodeInputValue} from './types'\nimport {\n ACE_EDITOR_PROPS,\n ACE_SET_OPTIONS,\n DEFAULT_DARK_THEME,\n DEFAULT_THEME,\n LANGUAGE_ALIASES,\n PATH_CODE,\n SUPPORTED_LANGUAGES,\n SUPPORTED_THEMES,\n} from './config'\nimport {useAceEditor} from './ace-editor/AceEditorLazy'\n\nexport type {CodeInputLanguage, CodeInputValue} from './types'\n\nconst EditorContainer = styled(Card)`\n position: relative;\n box-sizing: border-box;\n overflow: hidden;\n z-index: 0;\n\n .ace_editor {\n font-family: ${({theme}) => theme.sanity.fonts.code.family};\n font-size: ${({theme}) => theme.sanity.fonts.code.sizes[1]};\n line-height: inherit;\n }\n\n ${highlightMarkersCSS}\n\n &:not([disabled]):not([readonly]) {\n &:focus,\n &:focus-within {\n box-shadow: 0 0 0 2px ${({theme}) => theme.sanity.color.base.focusRing};\n background-color: ${({theme}) => theme.sanity.color.base.bg};\n border-color: ${({theme}) => theme.sanity.color.base.focusRing};\n }\n }\n`\n\n/**\n * @public\n */\nexport interface CodeOptions {\n theme?: string\n darkTheme?: string\n languageAlternatives?: CodeInputLanguage[]\n language?: string\n withFilename?: boolean\n}\n\n/**\n * @public\n */\nexport type CodeSchemaType = Omit<ObjectSchemaType, 'options'> & {\n options?: CodeOptions\n}\n\n/**\n * @public\n */\nexport type CodeInputProps = ObjectInputProps<CodeInputValue, CodeSchemaType> & {\n /** @internal */\n colorScheme?: ThemeColorSchemeKey\n}\n\n// Returns a string with the mode name if supported (because aliases), otherwise false\nfunction isSupportedLanguage(mode: string) {\n const alias = LANGUAGE_ALIASES[mode]\n\n if (alias) {\n return alias\n }\n\n const isSupported = SUPPORTED_LANGUAGES.find((lang) => lang.value === mode)\n if (isSupported) {\n return mode\n }\n\n return false\n}\n\nexport function CodeInput(props: CodeInputProps) {\n const {\n members,\n elementProps,\n onChange,\n readOnly,\n renderField,\n renderInput,\n renderItem,\n renderPreview,\n schemaType: type,\n value,\n onPathFocus,\n } = props\n\n const aceEditorRef = useRef<any>()\n\n const fieldMembers = useMemo(\n () => members.filter((member) => member.kind === 'field') as FieldMember[],\n [members]\n )\n\n const languageFieldMember = fieldMembers.find((member) => member.name === 'language')\n const filenameMember = fieldMembers.find((member) => member.name === 'filename')\n const codeFieldMember = fieldMembers.find((member) => member.name === 'code')\n\n useImperativeHandle(elementProps.ref, () => ({\n focus: () => {\n aceEditorRef?.current?.editor?.focus()\n },\n }))\n\n const handleCodeFocus = useCallback(() => {\n onPathFocus(PATH_CODE)\n }, [onPathFocus])\n\n const {scheme} = useColorScheme()\n\n const theme = useMemo(() => {\n const isLight = scheme === 'light'\n const preferredTheme = isLight ? type.options?.theme : type.options?.darkTheme\n const defaultTheme = isLight ? DEFAULT_THEME : DEFAULT_DARK_THEME\n return preferredTheme && SUPPORTED_THEMES.find((t) => t === preferredTheme)\n ? preferredTheme\n : defaultTheme\n }, [type, scheme])\n\n const handleToggleSelectLine = useCallback(\n (lineNumber: number) => {\n const editorSession = aceEditorRef.current?.editor?.getSession()\n const backgroundMarkers = editorSession?.getMarkers(true)\n const currentHighlightedLines = Object.keys(backgroundMarkers)\n .filter((key) => backgroundMarkers[key].type === 'screenLine')\n .map((key) => backgroundMarkers[key].range.start.row)\n const currentIndex = currentHighlightedLines.indexOf(lineNumber)\n if (currentIndex > -1) {\n // toggle remove\n currentHighlightedLines.splice(currentIndex, 1)\n } else {\n // toggle add\n currentHighlightedLines.push(lineNumber)\n currentHighlightedLines.sort()\n }\n onChange(\n set(\n currentHighlightedLines.map(\n (line) =>\n // ace starts at line (row) 0, but we store it starting at line 1\n line + 1\n ),\n ['highlightedLines']\n )\n )\n },\n [aceEditorRef, onChange]\n )\n\n const handleGutterMouseDown = useCallback(\n (event: any) => {\n const target = event.domEvent.target\n if (target.classList.contains('ace_gutter-cell')) {\n const row = event.getDocumentPosition().row\n handleToggleSelectLine(row)\n }\n },\n [handleToggleSelectLine]\n )\n\n useEffect(() => {\n const editor = aceEditorRef?.current?.editor\n return () => {\n editor?.session?.removeListener('guttermousedown', handleGutterMouseDown)\n }\n }, [aceEditorRef, handleGutterMouseDown])\n\n const handleEditorLoad = useCallback(\n (editor: any) => {\n editor?.on('guttermousedown', handleGutterMouseDown)\n },\n [handleGutterMouseDown]\n )\n\n const getLanguageAlternatives = useCallback((): {\n title: string\n value: string\n mode?: string\n }[] => {\n const languageAlternatives = type.options?.languageAlternatives\n if (!languageAlternatives) {\n return SUPPORTED_LANGUAGES\n }\n\n if (!Array.isArray(languageAlternatives)) {\n throw new Error(\n `'options.languageAlternatives' should be an array, got ${typeof languageAlternatives}`\n )\n }\n\n return languageAlternatives.reduce((acc: CodeInputLanguage[], {title, value: val, mode}) => {\n const alias = LANGUAGE_ALIASES[val]\n if (alias) {\n // eslint-disable-next-line no-console\n console.warn(\n `'options.languageAlternatives' lists a language with value \"%s\", which is an alias of \"%s\" - please replace the value to read \"%s\"`,\n val,\n alias,\n alias\n )\n\n return acc.concat({title, value: alias, mode: mode})\n }\n\n if (!mode && !SUPPORTED_LANGUAGES.find((lang) => lang.value === val)) {\n // eslint-disable-next-line no-console\n console.warn(\n `'options.languageAlternatives' lists a language which is not supported: \"%s\", syntax highlighting will be disabled.`,\n val\n )\n }\n\n return acc.concat({title, value: val, mode})\n }, [])\n }, [type])\n\n const handleCodeChange = useCallback(\n (code: string) => {\n const path = PATH_CODE\n const fixedLanguage = type.options?.language\n\n onChange([\n setIfMissing({_type: type.name, language: fixedLanguage}),\n code ? set(code, path) : unset(path),\n ])\n },\n [onChange, type]\n )\n\n const languages = getLanguageAlternatives().slice()\n\n const fixedLanguage = type.options?.language\n\n const language = value?.language || fixedLanguage\n\n // the language config from the schema\n const configured = languages.find((entry) => entry.value === language)\n\n // is the language officially supported (e.g. we import the mode by default)\n const supported = language && isSupportedLanguage(language)\n\n const mode = configured?.mode || (supported ? language : 'text')\n\n const renderLanguageInput = useCallback(\n (inputProps: Omit<InputProps, 'renderDefault'>) => {\n return (\n <Select\n {...(inputProps as StringInputProps)}\n onChange={(e) => {\n const newValue = e.currentTarget.value\n inputProps.onChange(newValue ? set(newValue) : unset())\n }}\n >\n {languages.map((lang: {title: string; value: string}) => (\n <option key={lang.value} value={lang.value}>\n {lang.title}\n </option>\n ))}\n </Select>\n )\n },\n [languages]\n )\n\n const AceEditor = useAceEditor()\n\n const renderCodeInput: RenderInputCallback = useCallback(\n (inputProps) => {\n return (\n <EditorContainer radius={1} shadow={1} readOnly={readOnly}>\n {AceEditor && (\n <Suspense fallback={<div>Loading code editor...</div>}>\n <AceEditor\n ref={aceEditorRef}\n mode={mode}\n theme={theme}\n width=\"100%\"\n onChange={handleCodeChange}\n name={inputProps.id}\n value={inputProps.value as string}\n markers={\n value && value.highlightedLines\n ? createHighlightMarkers(value.highlightedLines)\n : undefined\n }\n onLoad={handleEditorLoad}\n readOnly={readOnly}\n tabSize={2}\n wrapEnabled\n setOptions={ACE_SET_OPTIONS}\n editorProps={ACE_EDITOR_PROPS}\n onFocus={handleCodeFocus}\n onBlur={elementProps.onBlur}\n />\n </Suspense>\n )}\n </EditorContainer>\n )\n },\n [\n AceEditor,\n theme,\n handleCodeChange,\n handleCodeFocus,\n handleEditorLoad,\n mode,\n elementProps.onBlur,\n readOnly,\n value,\n ]\n )\n\n return (\n <Stack space={4}>\n {languageFieldMember && (\n <MemberField\n member={languageFieldMember}\n renderItem={renderItem}\n renderField={renderField}\n renderInput={renderLanguageInput}\n renderPreview={renderPreview}\n />\n )}\n\n {type.options?.withFilename && filenameMember && (\n <MemberField\n member={filenameMember}\n renderItem={renderItem}\n renderField={renderField}\n renderInput={renderInput}\n renderPreview={renderPreview}\n />\n )}\n\n {codeFieldMember && (\n <MemberField\n member={codeFieldMember}\n renderInput={renderCodeInput}\n renderItem={renderItem}\n renderField={renderField}\n renderPreview={renderPreview}\n />\n )}\n </Stack>\n )\n}\n","import React, {Suspense, useCallback, useEffect, useRef} from 'react'\nimport styled from 'styled-components'\nimport {Box} from '@sanity/ui'\nimport {ACE_EDITOR_PROPS, ACE_SET_OPTIONS} from './config'\nimport createHighlightMarkers from './createHighlightMarkers'\nimport {CodeInputValue} from './types'\nimport {useAceEditor} from './ace-editor/AceEditorLazy'\nimport {CodeSchemaType} from './CodeInput'\n\nconst PreviewContainer = styled(Box)`\n position: relative;\n`\n\nconst PreviewInner = styled(Box)`\n background-color: #272822;\n\n .ace_editor {\n box-sizing: border-box;\n cursor: default;\n pointer-events: none;\n }\n\n .ace_content {\n box-sizing: border-box;\n overflow: hidden;\n }\n`\n\n/**\n * @public\n */\nexport interface PreviewCodeProps {\n type?: CodeSchemaType\n value?: {selection?: CodeInputValue}\n}\n\n/**\n * @public\n */\nexport default function PreviewCode(props: PreviewCodeProps) {\n const aceEditorRef = useRef<any>()\n\n useEffect(() => {\n if (!aceEditorRef?.current) return\n\n const editor = aceEditorRef.current?.editor\n\n if (editor) {\n // Avoid cursor and focus tracking by Ace\n editor.renderer.$cursorLayer.element.style.opacity = 0\n editor.textInput.getElement().disabled = true\n }\n }, [])\n\n const handleEditorChange = useCallback(() => {\n // do nothing when the editor changes\n }, [])\n\n const {value, type} = props\n const fixedLanguage = type?.options?.language\n\n const selection = value?.selection\n const mode = selection?.language || fixedLanguage || 'text'\n\n const AceEditor = useAceEditor()\n return (\n <PreviewContainer>\n <PreviewInner padding={4}>\n {AceEditor && (\n <Suspense fallback={<div>Loading code preview...</div>}>\n <AceEditor\n ref={aceEditorRef}\n focus={false}\n mode={mode}\n theme=\"monokai\"\n width=\"100%\"\n onChange={handleEditorChange}\n maxLines={200}\n readOnly\n wrapEnabled\n showPrintMargin={false}\n highlightActiveLine={false}\n cursorStart={-1}\n value={selection?.code || ''}\n markers={\n selection?.highlightedLines\n ? createHighlightMarkers(selection.highlightedLines)\n : undefined\n }\n tabSize={2}\n showGutter={false}\n setOptions={ACE_SET_OPTIONS}\n editorProps={ACE_EDITOR_PROPS}\n />\n </Suspense>\n )}\n </PreviewInner>\n </PreviewContainer>\n )\n}\n","import {CodeBlockIcon} from '@sanity/icons'\nimport {CodeInput, CodeOptions} from './CodeInput'\nimport PreviewCode, {PreviewCodeProps} from './PreviewCode'\nimport {getMedia} from './getMedia'\nimport {defineType, ObjectDefinition} from 'sanity'\n\nexport type {CodeInputProps, CodeSchemaType} from './CodeInput'\n\nexport type {CodeInputLanguage, CodeInputValue} from './types'\nexport type {PreviewCode, PreviewCodeProps, CodeInput}\n\n/**\n * @public\n */\nexport const codeTypeName = 'code' as const\n\n/**\n * @public\n */\nexport interface CodeDefinition extends Omit<ObjectDefinition, 'type' | 'fields' | 'options'> {\n type: typeof codeTypeName\n options?: CodeOptions\n}\n\ndeclare module '@sanity/types' {\n // makes type: 'code' narrow correctly when using defineType/defineField/defineArrayMember\n export interface IntrinsicDefinitions {\n code: CodeDefinition\n }\n}\n\n/**\n * @public\n */\nexport const codeSchema = defineType({\n name: 'code',\n type: 'object',\n title: 'Code',\n ...({components: {input: CodeInput, preview: PreviewCode}} as {}), //TODO rollback change when rc.1 is released\n icon: CodeBlockIcon,\n fields: [\n {\n name: 'language',\n title: 'Language',\n type: 'string',\n },\n {\n name: 'filename',\n title: 'Filename',\n type: 'string',\n },\n {\n title: 'Code',\n name: 'code',\n type: 'text',\n },\n {\n title: 'Highlighted lines',\n name: 'highlightedLines',\n type: 'array',\n of: [\n {\n type: 'number',\n title: 'Highlighted line',\n },\n ],\n },\n ],\n preview: {\n select: {\n language: 'language',\n code: 'code',\n filename: 'filename',\n highlightedLines: 'highlightedLines',\n },\n prepare: (value: {\n language?: string\n code?: string\n filename?: string\n highlightedLines?: number[]\n }) => {\n return {\n title: value.filename || (value.language || 'unknown').toUpperCase(),\n media: getMedia(value?.language),\n selection: value,\n }\n },\n },\n})\n","import React from 'react'\n\nexport function getMedia(language?: string) {\n if (language === 'jsx') {\n return (\n <svg xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 128 128\">\n <g fill=\"#61DAFB\">\n <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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\" />\n </g>\n </svg>\n )\n }\n\n if (language === 'javascript') {\n return (\n <svg xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 128 128\">\n <path fill=\"#F0DB4F\" d=\"M1.408 1.408h125.184v125.185H1.408z\" />\n <path\n fill=\"#323330\"\n 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\"\n />\n </svg>\n )\n }\n\n if (language === 'php') {\n return (\n <svg xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 800 400\">\n <g transform=\"translate(-44.632 -141.55)\">\n <g transform=\"matrix(8.3528 0 0 8.3119 -727.13 -3759.5)\">\n <path 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\" />\n <path 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\" />\n <path 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\" />\n </g>\n </g>\n </svg>\n )\n }\n\n if (language === 'json') {\n return (\n <svg\n xmlns=\"http://www.w3.org/2000/svg\"\n xmlnsXlink=\"http://www.w3.org/1999/xlink\"\n viewBox=\"0 0 160 160\"\n >\n <defs>\n <linearGradient id=\"a\">\n <stop offset=\"0\" />\n <stop offset=\"1\" stopColor=\"#fff\" />\n </linearGradient>\n <linearGradient\n x1=\"-553.27\"\n y1=\"525.908\"\n x2=\"-666.116\"\n y2=\"413.045\"\n id=\"c\"\n xlinkHref=\"#a\"\n gradientUnits=\"userSpaceOnUse\"\n gradientTransform=\"matrix(.99884 0 0 .9987 689.008 -388.844)\"\n />\n <linearGradient\n x1=\"-666.117\"\n y1=\"413.045\"\n x2=\"-553.27\"\n y2=\"525.908\"\n id=\"b\"\n xlinkHref=\"#a\"\n gradientUnits=\"userSpaceOnUse\"\n gradientTransform=\"matrix(.99884 0 0 .9987 689.008 -388.844)\"\n />\n </defs>\n <path\n 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\"\n style={{marker: 'none'}}\n color=\"#000\"\n fill=\"url(#b)\"\n fillRule=\"evenodd\"\n overflow=\"visible\"\n />\n <path\n 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\"\n style={{marker: 'none'}}\n color=\"#000\"\n fill=\"url(#c)\"\n fillRule=\"evenodd\"\n overflow=\"visible\"\n />\n </svg>\n )\n }\n\n return undefined\n}\n","import {definePlugin} from 'sanity'\n\nimport {codeSchema, codeTypeName, CodeDefinition} from './schema'\nimport PreviewCode, {PreviewCodeProps} from './PreviewCode'\nexport type {CodeInputProps, CodeSchemaType, CodeOptions} from './CodeInput'\n\nexport type {CodeInputLanguage, CodeInputValue} from './types'\n\nexport {PreviewCode, type PreviewCodeProps}\nexport {codeSchema, codeTypeName}\nexport type {CodeDefinition}\n/**\n * @public\n */\nexport const codeInput = definePlugin({\n name: '@sanity/code-input',\n schema: {types: [codeSchema]},\n})\n"],"names":["highlightMarkersCSS","css","_templateObject","_taggedTemplateLiteral","_ref","theme","sanity","color","solid","primary","enabled","bg","createHighlightMarkers","rows","map","row","startRow","Number","startCol","endRow","endCol","Infinity","className","type","inFront","SUPPORTED_LANGUAGES","title","value","LANGUAGE_ALIASES","js","SUPPORTED_THEMES","ACE_SET_OPTIONS","useSoftTabs","navigateWithinSoftTabs","ACE_EDITOR_PROPS","$blockScrolling","PATH_CODE","AceEditorLazy","React","lazy","Promise","resolve","then","require","useAceEditor","mounted","setMounted","useState","useEffect","requestAnimationFrame","EditorContainer","styled","Card","_templateObject2","_ref2","fonts","code","family","_ref3","sizes","_ref4","base","focusRing","_ref5","_ref6","PreviewContainer","Box","_templateObject3","PreviewInner","_templateObject4","PreviewCode","props","_a","aceEditorRef","useRef","current","editor","renderer","$cursorLayer","element","style","opacity","textInput","getElement","disabled","handleEditorChange","useCallback","fixedLanguage","options","language","selection","mode","AceEditor","jsx","children","padding","Suspense","fallback","ref","focus","width","onChange","maxLines","readOnly","wrapEnabled","showPrintMargin","highlightActiveLine","cursorStart","markers","highlightedLines","tabSize","showGutter","setOptions","editorProps","codeSchema","defineType","_objectSpread","name","components","input","_b","members","elementProps","renderField","renderInput","renderItem","renderPreview","schemaType","onPathFocus","fieldMembers","useMemo","filter","member","kind","languageFieldMember","find","filenameMember","codeFieldMember","useImperativeHandle","handleCodeFocus","scheme","useColorScheme","isLight","preferredTheme","darkTheme","defaultTheme","t","handleToggleSelectLine","lineNumber","editorSession","getSession","backgroundMarkers","getMarkers","currentHighlightedLines","Object","keys","key","range","start","currentIndex","indexOf","splice","push","sort","set","line","handleGutterMouseDown","event","domEvent","target","classList","contains","getDocumentPosition","session","removeListener","handleEditorLoad","on","getLanguageAlternatives","languageAlternatives","Array","isArray","Error","concat","reduce","acc","_ref7","val","alias","console","warn","lang","handleCodeChange","path","setIfMissing","_type","unset","languages","slice","configured","entry","supported","isSupportedLanguage","renderLanguageInput","inputProps","Select","e","newValue","currentTarget","renderCodeInput","radius","shadow","id","onLoad","onFocus","onBlur","jsxs","Stack","space","MemberField","withFilename","preview","icon","CodeBlockIcon","fields","of","select","filename","prepare","toUpperCase","media","xmlns","viewBox","fill","cx","cy","r","d","transform","xmlnsXlink","offset","stopColor","x1","y1","x2","y2","xlinkHref","gradientUnits","gradientTransform","marker","fillRule","overflow","codeInput","definePlugin","schema","types"],"mappings":"+mCAGO,MAAMA,EAAsBC,EAAAA,IAGXC,IAAAA,EAAAC,EAAA,CAAA,uFAAA,iGAAAC,IAAA,IAACC,MAACA,GAAKD,EAAA,OAAMC,EAAMC,OAAOC,MAAMC,MAAMC,QAAQC,QAAQC,EAAA,IAO9E,SAAwBC,EAAuBC,GACtC,OAAAA,EAAKC,KAAKC,IAAS,CACxBC,SAAUC,OAAOF,GAAO,EACxBG,SAAU,EACVC,OAAQF,OAAOF,GAAO,EACtBK,OAAQC,IACRC,UAAW,+BACXC,KAAM,aACNC,SAAS,KAEb,CCpBO,MAAMC,EAA2C,CACtD,CAACC,MAAO,aAAcC,MAAO,aAC7B,CAACD,MAAO,KAAMC,MAAO,UACrB,CAACD,MAAO,MAAOC,MAAO,OACtB,CAACD,MAAO,KAAMC,MAAO,UACrB,CAACD,MAAO,OAAQC,MAAO,QACvB,CAACD,MAAO,OAAQC,MAAO,QACvB,CAACD,MAAO,OAAQC,MAAO,QACvB,CAACD,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