@sanity/runtime-cli 6.1.1 → 6.2.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +16 -16
- package/dist/baseCommands.js +1 -1
- package/dist/commands/functions/env/add.js +5 -7
- package/dist/commands/functions/env/list.js +4 -4
- package/dist/commands/functions/env/remove.js +5 -7
- package/dist/commands/functions/logs.js +15 -15
- package/dist/cores/blueprints/config.js +5 -5
- package/dist/cores/blueprints/deploy.js +13 -13
- package/dist/cores/blueprints/destroy.js +9 -9
- package/dist/cores/blueprints/info.js +1 -1
- package/dist/cores/blueprints/init.js +1 -1
- package/dist/cores/blueprints/logs.js +10 -12
- package/dist/cores/blueprints/stacks.js +1 -1
- package/dist/server/static/components/app.css +18 -6
- package/dist/server/static/components/codemirror-theme.d.ts +6 -0
- package/dist/server/static/components/codemirror-theme.js +49 -0
- package/dist/server/static/components/function-list.js +1 -1
- package/dist/server/static/components/payload-panel.js +4 -2
- package/dist/server/static/components/response-panel.js +4 -2
- package/dist/server/static/favicon-dark.svg +17 -0
- package/dist/server/static/favicon.svg +17 -0
- package/dist/server/static/index.html +13 -1
- package/dist/server/static/vendor/vendor.bundle.d.ts +193 -0
- package/dist/server/static/vendor/vendor.bundle.js +51 -14
- package/dist/utils/display/blueprints-formatting.js +24 -17
- package/dist/utils/display/colors.d.ts +8 -4
- package/dist/utils/display/colors.js +8 -16
- package/dist/utils/display/index.d.ts +1 -0
- package/dist/utils/display/index.js +1 -0
- package/dist/utils/display/logs-formatting.js +3 -3
- package/dist/utils/display/presenters.d.ts +4 -0
- package/dist/utils/display/presenters.js +15 -0
- package/dist/utils/display/resources-formatting.d.ts +4 -0
- package/dist/utils/display/resources-formatting.js +52 -0
- package/dist/utils/types.d.ts +5 -0
- package/oclif.manifest.json +1 -1
- package/package.json +16 -15
- package/dist/server/static/sanity-logo-sm.svg +0 -1
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import {HighlightStyle, syntaxHighlighting} from '../vendor/vendor.bundle.js'
|
|
2
|
+
import {tags as t} from '../vendor/vendor.bundle.js'
|
|
3
|
+
|
|
4
|
+
const red = 'light-dark(var(--red-600), var(--red-400))'
|
|
5
|
+
const orange = 'light-dark(var(--orange-600), var(--orange-400))'
|
|
6
|
+
const yellow = 'light-dark(var(--yellow-600), var(--yellow-400))'
|
|
7
|
+
const green = 'light-dark(var(--green-600), var(--green-400))'
|
|
8
|
+
const blue = 'light-dark(var(--blue-600), var(--blue-400))'
|
|
9
|
+
const magenta = 'light-dark(var(--magenta-600), var(--magenta-400))'
|
|
10
|
+
const purple = 'light-dark(var(--purple-600), var(--purple-400))'
|
|
11
|
+
const gray = 'light-dark(var(--gray-600), var(--gray-400))'
|
|
12
|
+
const text = 'light-dark(var(--gray-900), var(--gray-100))'
|
|
13
|
+
|
|
14
|
+
/// The highlighting style for code
|
|
15
|
+
export const sanityHighlightStyle = HighlightStyle.define([
|
|
16
|
+
{tag: t.keyword, color: magenta},
|
|
17
|
+
{tag: [t.name, t.deleted, t.character, t.propertyName, t.macroName], color: blue},
|
|
18
|
+
{tag: [t.function(t.variableName), t.labelName], color: green},
|
|
19
|
+
{tag: [t.color, t.constant(t.name), t.standard(t.name)], color: red},
|
|
20
|
+
{tag: [t.definition(t.name), t.separator], color: purple},
|
|
21
|
+
{
|
|
22
|
+
tag: [
|
|
23
|
+
t.typeName,
|
|
24
|
+
t.className,
|
|
25
|
+
t.number,
|
|
26
|
+
t.changed,
|
|
27
|
+
t.annotation,
|
|
28
|
+
t.modifier,
|
|
29
|
+
t.self,
|
|
30
|
+
t.namespace,
|
|
31
|
+
],
|
|
32
|
+
color: purple,
|
|
33
|
+
},
|
|
34
|
+
{
|
|
35
|
+
tag: [t.operator, t.operatorKeyword, t.url, t.escape, t.regexp, t.link, t.special(t.string)],
|
|
36
|
+
color: magenta,
|
|
37
|
+
},
|
|
38
|
+
{tag: [t.meta, t.comment], color: gray},
|
|
39
|
+
{tag: t.strong, fontWeight: 'bold'},
|
|
40
|
+
{tag: t.emphasis, fontStyle: 'italic'},
|
|
41
|
+
{tag: t.strikethrough, textDecoration: 'line-through'},
|
|
42
|
+
{tag: t.link, color: blue, textDecoration: 'underline'},
|
|
43
|
+
{tag: t.heading, fontWeight: 'bold', color: blue},
|
|
44
|
+
{tag: [t.atom, t.bool, t.special(t.variableName)], color: purple},
|
|
45
|
+
{tag: [t.processingInstruction, t.string, t.inserted], color: yellow},
|
|
46
|
+
{tag: t.invalid, color: text},
|
|
47
|
+
])
|
|
48
|
+
|
|
49
|
+
export const sanityCodeMirrorTheme = [syntaxHighlighting(sanityHighlightStyle)]
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
import {ApiBaseElement} from './api-base.js'
|
|
3
3
|
|
|
4
4
|
const template = `<ol class="hidden-lg" type="content" style="padding:0 16px;"></ol>
|
|
5
|
-
<fieldset class="hidden block-lg" style="padding:0 var(--space-3); margin-bottom: var(--space-3);"><select></select></fieldset>
|
|
5
|
+
<fieldset class="hidden block-lg" style="padding:0 var(--space-3); margin-bottom: var(--space-3);"><select class="dropdown-select"></select></fieldset>
|
|
6
6
|
`
|
|
7
7
|
|
|
8
8
|
class FunctionList extends ApiBaseElement {
|
|
@@ -1,4 +1,6 @@
|
|
|
1
|
-
/* globals customElements */
|
|
1
|
+
/* globals customElements document */
|
|
2
|
+
import {sanityCodeMirrorTheme} from './codemirror-theme.js'
|
|
3
|
+
|
|
2
4
|
import {EditorView, basicSetup, json} from '../vendor/vendor.bundle.js'
|
|
3
5
|
import {ApiBaseElement} from './api-base.js'
|
|
4
6
|
|
|
@@ -52,7 +54,7 @@ class PayloadPanel extends ApiBaseElement {
|
|
|
52
54
|
|
|
53
55
|
this.api.store.payload = new EditorView({
|
|
54
56
|
doc: '\n\n\n\n',
|
|
55
|
-
extensions: [basicSetup, json()],
|
|
57
|
+
extensions: [basicSetup, json(), sanityCodeMirrorTheme],
|
|
56
58
|
parent: this.payload,
|
|
57
59
|
})
|
|
58
60
|
}
|
|
@@ -1,5 +1,7 @@
|
|
|
1
|
-
/* eslint-disable unicorn/prefer-dom-node-text-content */
|
|
2
1
|
/* globals customElements document */
|
|
2
|
+
/* eslint-disable unicorn/prefer-dom-node-text-content */
|
|
3
|
+
import {sanityCodeMirrorTheme} from './codemirror-theme.js'
|
|
4
|
+
|
|
3
5
|
import {
|
|
4
6
|
EditorState,
|
|
5
7
|
EditorView,
|
|
@@ -86,7 +88,7 @@ class ResponsePanel extends ApiBaseElement {
|
|
|
86
88
|
|
|
87
89
|
this.api.store.response = new EditorView({
|
|
88
90
|
doc: '\n\n\n\n',
|
|
89
|
-
extensions: [basicSetup, json(), EditorState.readOnly.of(true)],
|
|
91
|
+
extensions: [basicSetup, json(), sanityCodeMirrorTheme, EditorState.readOnly.of(true)],
|
|
90
92
|
parent: this.response,
|
|
91
93
|
})
|
|
92
94
|
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
<svg width="32" height="32" viewBox="0 0 32 32" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
2
|
+
<g clip-path="url(#clip0_2_1533)">
|
|
3
|
+
<rect width="32" height="32" fill="#FFFFFF"/>
|
|
4
|
+
<rect width="32" height="32" fill="#FFFFFF"/>
|
|
5
|
+
<g clip-path="url(#clip1_2_1533)">
|
|
6
|
+
<path d="M29.1873 19.2072L28.1078 17.4092L22.8865 20.4531L28.6858 13.3858L29.5625 12.8933L29.3456 12.5814L29.7439 12.0942L27.914 10.6363L27.0763 11.6579L10.1693 21.126L16.4203 13.9307L28.0633 7.82194L26.9572 5.77516L20.6155 9.10118L23.7383 5.5088L21.9493 4L14.9211 12.089L7.94101 15.7532L13.285 8.99078L16.6337 7.32251L15.5702 5.25295L5.81407 10.1141L8.47452 6.74423L6.61612 5.31954L1 12.4342L1.08714 12.5008L2.13638 14.5458L8.36248 11.4424L2.68768 18.6219L3.61777 19.3351L4.17085 20.3585L10.7259 16.9186L3.50751 25.2283L5.29656 26.7371L5.65579 26.3236L23.0697 16.54L17.2882 23.5881L17.3824 23.6635L17.3735 23.6687L18.5721 25.6647L26.2619 21.1803L23.3009 25.7541L25.2855 27L30 19.7189L29.1873 19.2072Z" fill="#0B0B0B" />
|
|
7
|
+
</g>
|
|
8
|
+
</g>
|
|
9
|
+
<defs>
|
|
10
|
+
<clipPath id="clip0_2_1533">
|
|
11
|
+
<rect width="32" height="32" fill="#0B0B0B"/>
|
|
12
|
+
</clipPath>
|
|
13
|
+
<clipPath id="clip1_2_1533">
|
|
14
|
+
<rect width="29" height="23" fill="#0B0B0B" transform="translate(1 4)"/>
|
|
15
|
+
</clipPath>
|
|
16
|
+
</defs>
|
|
17
|
+
</svg>
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
<svg width="32" height="32" viewBox="0 0 32 32" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
2
|
+
<g clip-path="url(#clip0_2_1533)">
|
|
3
|
+
<rect width="32" height="32" fill="#0B0B0B"/>
|
|
4
|
+
<rect width="32" height="32" fill="#0B0B0B"/>
|
|
5
|
+
<g clip-path="url(#clip1_2_1533)">
|
|
6
|
+
<path d="M29.1873 19.2072L28.1078 17.4092L22.8865 20.4531L28.6858 13.3858L29.5625 12.8933L29.3456 12.5814L29.7439 12.0942L27.914 10.6363L27.0763 11.6579L10.1693 21.126L16.4203 13.9307L28.0633 7.82194L26.9572 5.77516L20.6155 9.10118L23.7383 5.5088L21.9493 4L14.9211 12.089L7.94101 15.7532L13.285 8.99078L16.6337 7.32251L15.5702 5.25295L5.81407 10.1141L8.47452 6.74423L6.61612 5.31954L1 12.4342L1.08714 12.5008L2.13638 14.5458L8.36248 11.4424L2.68768 18.6219L3.61777 19.3351L4.17085 20.3585L10.7259 16.9186L3.50751 25.2283L5.29656 26.7371L5.65579 26.3236L23.0697 16.54L17.2882 23.5881L17.3824 23.6635L17.3735 23.6687L18.5721 25.6647L26.2619 21.1803L23.3009 25.7541L25.2855 27L30 19.7189L29.1873 19.2072Z" fill="white" />
|
|
7
|
+
</g>
|
|
8
|
+
</g>
|
|
9
|
+
<defs>
|
|
10
|
+
<clipPath id="clip0_2_1533">
|
|
11
|
+
<rect width="32" height="32" fill="white"/>
|
|
12
|
+
</clipPath>
|
|
13
|
+
<clipPath id="clip1_2_1533">
|
|
14
|
+
<rect width="29" height="23" fill="white" transform="translate(1 4)"/>
|
|
15
|
+
</clipPath>
|
|
16
|
+
</defs>
|
|
17
|
+
</svg>
|
|
@@ -6,13 +6,25 @@
|
|
|
6
6
|
<link href="https://unpkg.com/m-@3.2.0/dist/m-.woff2" rel="preload" as="font" crossorigin>
|
|
7
7
|
<link href="https://unpkg.com/m-@3.2.0/dist/m-.css" rel="stylesheet">
|
|
8
8
|
<link href="./components/app.css" rel="stylesheet">
|
|
9
|
+
<link rel="icon" type="image/svg+xml" href="favicon.svg" media="(prefers-color-scheme: light)">
|
|
10
|
+
<link rel="icon" type="image/svg+xml" href="favicon-dark.svg" media="(prefers-color-scheme: dark)">
|
|
9
11
|
|
|
10
12
|
</head>
|
|
11
13
|
<body>
|
|
12
14
|
<header data-slot="header">
|
|
13
15
|
<div class="logo pad-sm">
|
|
14
16
|
<div class="logo-image">
|
|
15
|
-
|
|
17
|
+
<svg xmlns="http://www.w3.org/2000/svg" width="25" height="25" viewBox="0 0 400 400" fill="none">
|
|
18
|
+
<rect width="400" height="400" fill="light-dark(#0B0B0B, #FFFFFF)"/>
|
|
19
|
+
<g clip-path="url(#clip0_2001_278)">
|
|
20
|
+
<path d="M304.798 227.286L296.218 212.355L254.714 237.632L300.812 178.943L307.781 174.853L306.057 172.263L309.223 168.217L294.677 156.11L288.019 164.594L153.627 243.22L203.315 183.468L295.864 132.739L287.072 115.742L236.662 143.362L261.485 113.53L247.265 101L191.399 168.174L135.915 198.603L178.394 142.445L205.012 128.591L196.558 111.405L119.008 151.773L140.155 123.789L125.383 111.958L80.7414 171.041L81.4341 171.594L89.7744 188.576L139.265 162.804L94.1565 222.425L101.55 228.348L105.946 236.846L158.052 208.28L100.673 277.288L114.894 289.817L117.75 286.383L256.17 205.137L210.214 263.667L210.963 264.292L210.892 264.336L220.42 280.911L281.545 243.672L258.008 281.653L273.784 292L311.259 231.535L304.798 227.286Z" fill="light-dark(white, #0B0B0B)"/>
|
|
21
|
+
</g>
|
|
22
|
+
<defs>
|
|
23
|
+
<clipPath id="clip0_2001_278">
|
|
24
|
+
<rect width="230.517" height="191" fill="light-dark(white, #0B0B0B)" transform="translate(80.7414 101)"/>
|
|
25
|
+
</clipPath>
|
|
26
|
+
</defs>
|
|
27
|
+
</svg>
|
|
16
28
|
</div>
|
|
17
29
|
<span class="logo-text pad-xs">Functions</span>
|
|
18
30
|
</div>
|
|
@@ -632,6 +632,34 @@ export namespace EditorView {
|
|
|
632
632
|
export let lineWrapping: FacetProvider;
|
|
633
633
|
export let announce: StateEffectType;
|
|
634
634
|
}
|
|
635
|
+
/**
|
|
636
|
+
A highlight style associates CSS styles with higlighting
|
|
637
|
+
[tags](https://lezer.codemirror.net/docs/ref#highlight.Tag).
|
|
638
|
+
*/
|
|
639
|
+
export class HighlightStyle {
|
|
640
|
+
/**
|
|
641
|
+
Create a highlighter style that associates the given styles to
|
|
642
|
+
the given tags. The specs must be objects that hold a style tag
|
|
643
|
+
or array of tags in their `tag` property, and either a single
|
|
644
|
+
`class` property providing a static CSS class (for highlighter
|
|
645
|
+
that rely on external styling), or a
|
|
646
|
+
[`style-mod`](https://github.com/marijnh/style-mod#documentation)-style
|
|
647
|
+
set of CSS properties (which define the styling for those tags).
|
|
648
|
+
|
|
649
|
+
The CSS rules created for a highlighter will be emitted in the
|
|
650
|
+
order of the spec's properties. That means that for elements that
|
|
651
|
+
have multiple tags associated with them, styles defined further
|
|
652
|
+
down in the list will have a higher CSS precedence than styles
|
|
653
|
+
defined earlier.
|
|
654
|
+
*/
|
|
655
|
+
static define(specs: any, options: any): HighlightStyle;
|
|
656
|
+
constructor(specs: any, options: any);
|
|
657
|
+
specs: any;
|
|
658
|
+
scope: ((type: any) => boolean) | undefined;
|
|
659
|
+
style: (tags: any) => any;
|
|
660
|
+
module: StyleModule | null;
|
|
661
|
+
themeType: any;
|
|
662
|
+
}
|
|
635
663
|
export function Store(initialState: any): any;
|
|
636
664
|
/**
|
|
637
665
|
This is an extension value that just pulls together a number of
|
|
@@ -678,6 +706,102 @@ export function json(): LanguageSupport;
|
|
|
678
706
|
export function prettyBytes(number: any, options: any): string;
|
|
679
707
|
export function prettyMilliseconds(milliseconds: any, options: any): string;
|
|
680
708
|
/**
|
|
709
|
+
Wrap a highlighter in an editor extension that uses it to apply
|
|
710
|
+
syntax highlighting to the editor content.
|
|
711
|
+
|
|
712
|
+
When multiple (non-fallback) styles are provided, the styling
|
|
713
|
+
applied is the union of the classes they emit.
|
|
714
|
+
*/
|
|
715
|
+
export function syntaxHighlighting(highlighter: any, options: any): PrecExtension[];
|
|
716
|
+
export namespace tags {
|
|
717
|
+
export { comment };
|
|
718
|
+
export let lineComment: Tag;
|
|
719
|
+
export let blockComment: Tag;
|
|
720
|
+
export let docComment: Tag;
|
|
721
|
+
export { name };
|
|
722
|
+
export let variableName: Tag;
|
|
723
|
+
export { typeName };
|
|
724
|
+
export let tagName: Tag;
|
|
725
|
+
export { propertyName };
|
|
726
|
+
export let attributeName: Tag;
|
|
727
|
+
export let className: Tag;
|
|
728
|
+
export let labelName: Tag;
|
|
729
|
+
export let namespace: Tag;
|
|
730
|
+
export let macroName: Tag;
|
|
731
|
+
export { literal };
|
|
732
|
+
export { string };
|
|
733
|
+
export let docString: Tag;
|
|
734
|
+
export let character: Tag;
|
|
735
|
+
export let attributeValue: Tag;
|
|
736
|
+
export { number };
|
|
737
|
+
export let integer: Tag;
|
|
738
|
+
export let float: Tag;
|
|
739
|
+
export let bool: Tag;
|
|
740
|
+
export let regexp: Tag;
|
|
741
|
+
export let escape: Tag;
|
|
742
|
+
export let color: Tag;
|
|
743
|
+
export let url: Tag;
|
|
744
|
+
export { keyword };
|
|
745
|
+
export let self: Tag;
|
|
746
|
+
let _null: Tag;
|
|
747
|
+
export { _null as null };
|
|
748
|
+
export let atom: Tag;
|
|
749
|
+
export let unit: Tag;
|
|
750
|
+
export let modifier: Tag;
|
|
751
|
+
export let operatorKeyword: Tag;
|
|
752
|
+
export let controlKeyword: Tag;
|
|
753
|
+
export let definitionKeyword: Tag;
|
|
754
|
+
export let moduleKeyword: Tag;
|
|
755
|
+
export { operator };
|
|
756
|
+
export let derefOperator: Tag;
|
|
757
|
+
export let arithmeticOperator: Tag;
|
|
758
|
+
export let logicOperator: Tag;
|
|
759
|
+
export let bitwiseOperator: Tag;
|
|
760
|
+
export let compareOperator: Tag;
|
|
761
|
+
export let updateOperator: Tag;
|
|
762
|
+
export let definitionOperator: Tag;
|
|
763
|
+
export let typeOperator: Tag;
|
|
764
|
+
export let controlOperator: Tag;
|
|
765
|
+
export { punctuation };
|
|
766
|
+
export let separator: Tag;
|
|
767
|
+
export { bracket };
|
|
768
|
+
export let angleBracket: Tag;
|
|
769
|
+
export let squareBracket: Tag;
|
|
770
|
+
export let paren: Tag;
|
|
771
|
+
export let brace: Tag;
|
|
772
|
+
export { content };
|
|
773
|
+
export { heading };
|
|
774
|
+
export let heading1: Tag;
|
|
775
|
+
export let heading2: Tag;
|
|
776
|
+
export let heading3: Tag;
|
|
777
|
+
export let heading4: Tag;
|
|
778
|
+
export let heading5: Tag;
|
|
779
|
+
export let heading6: Tag;
|
|
780
|
+
export let contentSeparator: Tag;
|
|
781
|
+
export let list: Tag;
|
|
782
|
+
export let quote: Tag;
|
|
783
|
+
export let emphasis: Tag;
|
|
784
|
+
export let strong: Tag;
|
|
785
|
+
export let link: Tag;
|
|
786
|
+
export let monospace: Tag;
|
|
787
|
+
export let strikethrough: Tag;
|
|
788
|
+
export let inserted: Tag;
|
|
789
|
+
export let deleted: Tag;
|
|
790
|
+
export let changed: Tag;
|
|
791
|
+
export let invalid: Tag;
|
|
792
|
+
export { meta };
|
|
793
|
+
export let documentMeta: Tag;
|
|
794
|
+
export let annotation: Tag;
|
|
795
|
+
export let processingInstruction: Tag;
|
|
796
|
+
export function definition(tag: any): any;
|
|
797
|
+
export function constant(tag: any): any;
|
|
798
|
+
export function _function(tag: any): any;
|
|
799
|
+
export { _function as function };
|
|
800
|
+
export function standard(tag: any): any;
|
|
801
|
+
export function local(tag: any): any;
|
|
802
|
+
export function special(tag: any): any;
|
|
803
|
+
}
|
|
804
|
+
/**
|
|
681
805
|
A change set represents a group of modifications to a document. It
|
|
682
806
|
stores the document length, and can only be applied to documents
|
|
683
807
|
with exactly that length.
|
|
@@ -1320,6 +1444,13 @@ declare class StateEffectType {
|
|
|
1320
1444
|
*/
|
|
1321
1445
|
of(value: any): StateEffect;
|
|
1322
1446
|
}
|
|
1447
|
+
declare class StyleModule {
|
|
1448
|
+
static newName(): string;
|
|
1449
|
+
static mount(root: any, modules: any, options: any): void;
|
|
1450
|
+
constructor(spec: any, options: any);
|
|
1451
|
+
rules: any[];
|
|
1452
|
+
getRules(): string;
|
|
1453
|
+
}
|
|
1323
1454
|
/**
|
|
1324
1455
|
This class bundles a [language](https://codemirror.net/6/docs/ref/#language.Language) with an
|
|
1325
1456
|
optional set of supporting extensions. Language packages are
|
|
@@ -1336,6 +1467,68 @@ declare class LanguageSupport {
|
|
|
1336
1467
|
support: any[];
|
|
1337
1468
|
extension: any[];
|
|
1338
1469
|
}
|
|
1470
|
+
declare const comment: Tag;
|
|
1471
|
+
/**
|
|
1472
|
+
Highlighting tags are markers that denote a highlighting category.
|
|
1473
|
+
They are [associated](#highlight.styleTags) with parts of a syntax
|
|
1474
|
+
tree by a language mode, and then mapped to an actual CSS style by
|
|
1475
|
+
a [highlighter](#highlight.Highlighter).
|
|
1476
|
+
|
|
1477
|
+
Because syntax tree node types and highlight styles have to be
|
|
1478
|
+
able to talk the same language, CodeMirror uses a mostly _closed_
|
|
1479
|
+
[vocabulary](#highlight.tags) of syntax tags (as opposed to
|
|
1480
|
+
traditional open string-based systems, which make it hard for
|
|
1481
|
+
highlighting themes to cover all the tokens produced by the
|
|
1482
|
+
various languages).
|
|
1483
|
+
|
|
1484
|
+
It _is_ possible to [define](#highlight.Tag^define) your own
|
|
1485
|
+
highlighting tags for system-internal use (where you control both
|
|
1486
|
+
the language package and the highlighter), but such tags will not
|
|
1487
|
+
be picked up by regular highlighters (though you can derive them
|
|
1488
|
+
from standard tags to allow highlighters to fall back to those).
|
|
1489
|
+
*/
|
|
1490
|
+
declare class Tag {
|
|
1491
|
+
static define(nameOrParent: any, parent: any): Tag;
|
|
1492
|
+
/**
|
|
1493
|
+
Define a tag _modifier_, which is a function that, given a tag,
|
|
1494
|
+
will return a tag that is a subtag of the original. Applying the
|
|
1495
|
+
same modifier to a twice tag will return the same value (`m1(t1)
|
|
1496
|
+
== m1(t1)`) and applying multiple modifiers will, regardless or
|
|
1497
|
+
order, produce the same tag (`m1(m2(t1)) == m2(m1(t1))`).
|
|
1498
|
+
|
|
1499
|
+
When multiple modifiers are applied to a given base tag, each
|
|
1500
|
+
smaller set of modifiers is registered as a parent, so that for
|
|
1501
|
+
example `m1(m2(m3(t1)))` is a subtype of `m1(m2(t1))`,
|
|
1502
|
+
`m1(m3(t1)`, and so on.
|
|
1503
|
+
*/
|
|
1504
|
+
static defineModifier(name: any): (tag: any) => any;
|
|
1505
|
+
/**
|
|
1506
|
+
@internal
|
|
1507
|
+
*/
|
|
1508
|
+
constructor(name: any, set: any, base: any, modified: any);
|
|
1509
|
+
name: any;
|
|
1510
|
+
set: any;
|
|
1511
|
+
base: any;
|
|
1512
|
+
modified: any;
|
|
1513
|
+
/**
|
|
1514
|
+
@internal
|
|
1515
|
+
*/
|
|
1516
|
+
id: number;
|
|
1517
|
+
toString(): any;
|
|
1518
|
+
}
|
|
1519
|
+
declare const name: Tag;
|
|
1520
|
+
declare const typeName: Tag;
|
|
1521
|
+
declare const propertyName: Tag;
|
|
1522
|
+
declare const literal: Tag;
|
|
1523
|
+
declare const string: Tag;
|
|
1524
|
+
declare const number: Tag;
|
|
1525
|
+
declare const keyword: Tag;
|
|
1526
|
+
declare const operator: Tag;
|
|
1527
|
+
declare const punctuation: Tag;
|
|
1528
|
+
declare const bracket: Tag;
|
|
1529
|
+
declare const content: Tag;
|
|
1530
|
+
declare const heading: Tag;
|
|
1531
|
+
declare const meta: Tag;
|
|
1339
1532
|
/**
|
|
1340
1533
|
A change description is a variant of [change set](https://codemirror.net/6/docs/ref/#state.ChangeSet)
|
|
1341
1534
|
that doesn't store the inserted text. As such, it can't be
|
|
@@ -12311,17 +12311,26 @@ function isSuspiciousChromeCaretResult(node, offset, x) {
|
|
|
12311
12311
|
: textRange(node, 0, Math.max(node.nodeValue.length, 1)).getBoundingClientRect();
|
|
12312
12312
|
return x - rect.left > 5;
|
|
12313
12313
|
}
|
|
12314
|
-
function blockAt(view, pos) {
|
|
12314
|
+
function blockAt(view, pos, side) {
|
|
12315
12315
|
let line = view.lineBlockAt(pos);
|
|
12316
|
-
if (Array.isArray(line.type))
|
|
12316
|
+
if (Array.isArray(line.type)) {
|
|
12317
|
+
let best;
|
|
12317
12318
|
for (let l of line.type) {
|
|
12318
|
-
if (l.
|
|
12319
|
+
if (l.from > pos)
|
|
12320
|
+
break;
|
|
12321
|
+
if (l.to < pos)
|
|
12322
|
+
continue;
|
|
12323
|
+
if (l.from < pos && l.to > pos)
|
|
12319
12324
|
return l;
|
|
12325
|
+
if (!best || (l.type == BlockType.Text && (best.type != l.type || (side < 0 ? l.from < pos : l.to > pos))))
|
|
12326
|
+
best = l;
|
|
12320
12327
|
}
|
|
12328
|
+
return best || line;
|
|
12329
|
+
}
|
|
12321
12330
|
return line;
|
|
12322
12331
|
}
|
|
12323
12332
|
function moveToLineBoundary(view, start, forward, includeWrap) {
|
|
12324
|
-
let line = blockAt(view, start.head);
|
|
12333
|
+
let line = blockAt(view, start.head, start.assoc || -1);
|
|
12325
12334
|
let coords = !includeWrap || line.type != BlockType.Text || !(view.lineWrapping || line.widgetLineBreaks) ? null
|
|
12326
12335
|
: view.coordsAtPos(start.assoc < 0 && start.head > line.from ? start.head - 1 : start.head);
|
|
12327
12336
|
if (coords) {
|
|
@@ -13556,7 +13565,7 @@ function focusChangeTransaction(state, focus) {
|
|
|
13556
13565
|
if (effect)
|
|
13557
13566
|
effects.push(effect);
|
|
13558
13567
|
}
|
|
13559
|
-
return effects ? state.update({ effects, annotations: isFocusChange.of(true) }) : null;
|
|
13568
|
+
return effects.length ? state.update({ effects, annotations: isFocusChange.of(true) }) : null;
|
|
13560
13569
|
}
|
|
13561
13570
|
function updateForFocusChange(view) {
|
|
13562
13571
|
setTimeout(() => {
|
|
@@ -14591,7 +14600,7 @@ class ViewState {
|
|
|
14591
14600
|
}
|
|
14592
14601
|
else {
|
|
14593
14602
|
this.scrollAnchorPos = -1;
|
|
14594
|
-
this.scrollAnchorHeight =
|
|
14603
|
+
this.scrollAnchorHeight = prevHeight;
|
|
14595
14604
|
}
|
|
14596
14605
|
let viewport = heightChanges.length ? this.mapViewport(this.viewport, update.changes) : this.viewport;
|
|
14597
14606
|
if (scrollTarget && (scrollTarget.range.head < viewport.from || scrollTarget.range.head > viewport.to) ||
|
|
@@ -16087,14 +16096,14 @@ class EditorView {
|
|
|
16087
16096
|
[IME](https://en.wikipedia.org/wiki/Input_method), and at least
|
|
16088
16097
|
one change has been made in the current composition.
|
|
16089
16098
|
*/
|
|
16090
|
-
get composing() { return this.inputState.composing > 0; }
|
|
16099
|
+
get composing() { return !!this.inputState && this.inputState.composing > 0; }
|
|
16091
16100
|
/**
|
|
16092
16101
|
Indicates whether the user is currently in composing state. Note
|
|
16093
16102
|
that on some platforms, like Android, this will be the case a
|
|
16094
16103
|
lot, since just putting the cursor on a word starts a
|
|
16095
16104
|
composition there.
|
|
16096
16105
|
*/
|
|
16097
|
-
get compositionStarted() { return this.inputState.composing >= 0; }
|
|
16106
|
+
get compositionStarted() { return !!this.inputState && this.inputState.composing >= 0; }
|
|
16098
16107
|
/**
|
|
16099
16108
|
The document or shadow root that the view lives in.
|
|
16100
16109
|
*/
|
|
@@ -17521,7 +17530,7 @@ function rectanglesForRange(view, className, range) {
|
|
|
17521
17530
|
let leftSide = contentRect.left +
|
|
17522
17531
|
(lineStyle ? parseInt(lineStyle.paddingLeft) + Math.min(0, parseInt(lineStyle.textIndent)) : 0);
|
|
17523
17532
|
let rightSide = contentRect.right - (lineStyle ? parseInt(lineStyle.paddingRight) : 0);
|
|
17524
|
-
let startBlock = blockAt(view, from), endBlock = blockAt(view, to);
|
|
17533
|
+
let startBlock = blockAt(view, from, 1), endBlock = blockAt(view, to, -1);
|
|
17525
17534
|
let visualStart = startBlock.type == BlockType.Text ? startBlock : null;
|
|
17526
17535
|
let visualEnd = endBlock.type == BlockType.Text ? endBlock : null;
|
|
17527
17536
|
if (visualStart && (view.lineWrapping || startBlock.widgetLineBreaks))
|
|
@@ -26625,8 +26634,36 @@ const toLocaleString = (number, locale, options) => {
|
|
|
26625
26634
|
return result;
|
|
26626
26635
|
};
|
|
26627
26636
|
|
|
26637
|
+
const log10 = numberOrBigInt => {
|
|
26638
|
+
if (typeof numberOrBigInt === 'number') {
|
|
26639
|
+
return Math.log10(numberOrBigInt);
|
|
26640
|
+
}
|
|
26641
|
+
|
|
26642
|
+
const string = numberOrBigInt.toString(10);
|
|
26643
|
+
|
|
26644
|
+
return string.length + Math.log10('0.' + string.slice(0, 15));
|
|
26645
|
+
};
|
|
26646
|
+
|
|
26647
|
+
const log = numberOrBigInt => {
|
|
26648
|
+
if (typeof numberOrBigInt === 'number') {
|
|
26649
|
+
return Math.log(numberOrBigInt);
|
|
26650
|
+
}
|
|
26651
|
+
|
|
26652
|
+
return log10(numberOrBigInt) * Math.log(10);
|
|
26653
|
+
};
|
|
26654
|
+
|
|
26655
|
+
const divide = (numberOrBigInt, divisor) => {
|
|
26656
|
+
if (typeof numberOrBigInt === 'number') {
|
|
26657
|
+
return numberOrBigInt / divisor;
|
|
26658
|
+
}
|
|
26659
|
+
|
|
26660
|
+
const integerPart = numberOrBigInt / BigInt(divisor);
|
|
26661
|
+
const remainder = numberOrBigInt % BigInt(divisor);
|
|
26662
|
+
return Number(integerPart) + (Number(remainder) / divisor);
|
|
26663
|
+
};
|
|
26664
|
+
|
|
26628
26665
|
function prettyBytes(number, options) {
|
|
26629
|
-
if (!Number.isFinite(number)) {
|
|
26666
|
+
if (typeof number !== 'bigint' && !Number.isFinite(number)) {
|
|
26630
26667
|
throw new TypeError(`Expected a finite number, got ${typeof number}: ${number}`);
|
|
26631
26668
|
}
|
|
26632
26669
|
|
|
@@ -26643,7 +26680,7 @@ function prettyBytes(number, options) {
|
|
|
26643
26680
|
|
|
26644
26681
|
const separator = options.space ? ' ' : '';
|
|
26645
26682
|
|
|
26646
|
-
if (options.signed && number === 0) {
|
|
26683
|
+
if (options.signed && (typeof number === 'number' ? number === 0 : number === 0n)) {
|
|
26647
26684
|
return ` 0${separator}${UNITS[0]}`;
|
|
26648
26685
|
}
|
|
26649
26686
|
|
|
@@ -26669,8 +26706,8 @@ function prettyBytes(number, options) {
|
|
|
26669
26706
|
return prefix + numberString + separator + UNITS[0];
|
|
26670
26707
|
}
|
|
26671
26708
|
|
|
26672
|
-
const exponent = Math.min(Math.floor(options.binary ?
|
|
26673
|
-
number
|
|
26709
|
+
const exponent = Math.min(Math.floor(options.binary ? log(number) / Math.log(1024) : log10(number) / 3), UNITS.length - 1);
|
|
26710
|
+
number = divide(number, (options.binary ? 1024 : 1000) ** exponent);
|
|
26674
26711
|
|
|
26675
26712
|
if (!localeOptions) {
|
|
26676
26713
|
number = number.toPrecision(3);
|
|
@@ -26877,4 +26914,4 @@ function prettyMilliseconds(milliseconds, options) {
|
|
|
26877
26914
|
return sign + result.join(separator);
|
|
26878
26915
|
}
|
|
26879
26916
|
|
|
26880
|
-
export { EditorState, EditorView, Store, basicSetup, json, prettyBytes, prettyMilliseconds };
|
|
26917
|
+
export { EditorState, EditorView, HighlightStyle, Store, basicSetup, json, prettyBytes, prettyMilliseconds, syntaxHighlighting, tags };
|
|
@@ -1,33 +1,40 @@
|
|
|
1
1
|
import { treeify } from 'array-treeify';
|
|
2
2
|
import chalk from 'chalk';
|
|
3
|
-
import { niceId } from './colors.js';
|
|
4
3
|
import { formatDate, formatDuration } from './dates.js';
|
|
4
|
+
import { niceId } from './presenters.js';
|
|
5
|
+
import { arrayifyLocalFunction, arrayifyStackFunction } from './resources-formatting.js';
|
|
5
6
|
export function formatTitle(title, name) {
|
|
6
7
|
return `${chalk.bold.blue(title)} ${chalk.bold(`"${name}"`)}`;
|
|
7
8
|
}
|
|
8
9
|
export function formatResourceTree(resources) {
|
|
9
|
-
if (!resources || resources.length === 0)
|
|
10
|
+
if (!resources || resources.length === 0)
|
|
10
11
|
return ' Zero resources';
|
|
11
|
-
}
|
|
12
|
-
const output = [];
|
|
13
|
-
output.push(`${chalk.blue('Blueprint Resources')} [${resources.length}]`);
|
|
12
|
+
const output = [`${chalk.blue('Blueprint Resources')} [${resources.length}]`];
|
|
14
13
|
const functionResources = resources.filter((r) => r.type?.startsWith('sanity.function.'));
|
|
15
14
|
const otherResources = resources.filter((r) => !r.type?.startsWith('sanity.function.'));
|
|
16
15
|
const hasOtherResources = otherResources.length > 0;
|
|
17
16
|
if (functionResources.length > 0) {
|
|
18
|
-
const
|
|
19
|
-
|
|
20
|
-
const
|
|
17
|
+
const fnsOutput = [`${chalk.bold('Functions')} [${functionResources.length}]`];
|
|
18
|
+
const fnDetails = [];
|
|
19
|
+
for (const fn of functionResources) {
|
|
21
20
|
const name = chalk.green(fn.displayName || fn.name);
|
|
22
|
-
const
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
21
|
+
const ids = [
|
|
22
|
+
'id' in fn && fn.id ? `${niceId(fn.id)}` : '',
|
|
23
|
+
'externalId' in fn && fn.externalId ? `<${niceId(fn.externalId)}>` : '',
|
|
24
|
+
].join(' ');
|
|
25
|
+
fnDetails.push(`"${name}" ${ids}`);
|
|
26
|
+
if ('parameters' in fn && fn.parameters) {
|
|
27
|
+
fnDetails.push(arrayifyStackFunction(fn));
|
|
28
|
+
}
|
|
29
|
+
else {
|
|
30
|
+
fnDetails.push(arrayifyLocalFunction(fn));
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
fnsOutput.push(fnDetails);
|
|
34
|
+
output.push(fnsOutput);
|
|
27
35
|
}
|
|
28
36
|
if (hasOtherResources) {
|
|
29
|
-
const otherOutput = [];
|
|
30
|
-
otherOutput.push(`${chalk.bold('Other Resources')} [${otherResources.length}]`);
|
|
37
|
+
const otherOutput = [`${chalk.bold('Other Resources')} [${otherResources.length}]`];
|
|
31
38
|
const otherResourcesOutput = otherResources.map((other) => {
|
|
32
39
|
return `"${chalk.yellow(other.displayName ?? other.name ?? 'unnamed')}"`;
|
|
33
40
|
});
|
|
@@ -37,9 +44,8 @@ export function formatResourceTree(resources) {
|
|
|
37
44
|
return treeify(output);
|
|
38
45
|
}
|
|
39
46
|
export function formatStackInfo(stack, isCurrentStack = false) {
|
|
40
|
-
const output = [];
|
|
41
47
|
const isStack = 'id' in stack;
|
|
42
|
-
const
|
|
48
|
+
const output = [];
|
|
43
49
|
if (isStack) {
|
|
44
50
|
const stackName = isCurrentStack ? chalk.bold.blue(stack.name) : chalk.bold(stack.name);
|
|
45
51
|
output.push(`"${stackName}" ${niceId(stack.id)}${isCurrentStack ? ' (current)' : ''}`);
|
|
@@ -47,6 +53,7 @@ export function formatStackInfo(stack, isCurrentStack = false) {
|
|
|
47
53
|
else {
|
|
48
54
|
output.push('Local Blueprint');
|
|
49
55
|
}
|
|
56
|
+
const infoOutput = [];
|
|
50
57
|
if (stack.resources) {
|
|
51
58
|
infoOutput.push(`${stack.resources.length} resource${stack.resources.length === 1 ? '' : 's'}`);
|
|
52
59
|
}
|
|
@@ -1,11 +1,15 @@
|
|
|
1
|
+
export { info, niceId, warn, severe } from './presenters.js';
|
|
2
|
+
/** @deprecated Use `chalk.bold` directly */
|
|
1
3
|
export declare function bold(str: string): string;
|
|
4
|
+
/** @deprecated Use `chalk.underline` directly */
|
|
2
5
|
export declare function underline(str: string): string;
|
|
6
|
+
/** @deprecated Use `chalk.dim` directly */
|
|
3
7
|
export declare function dim(str: string): string;
|
|
8
|
+
/** @deprecated Use `chalk.blue` directly */
|
|
4
9
|
export declare function blue(str: string): string;
|
|
10
|
+
/** @deprecated Use `chalk.green` directly */
|
|
5
11
|
export declare function green(str: string): string;
|
|
12
|
+
/** @deprecated Use `chalk.red` directly */
|
|
6
13
|
export declare function red(str: string): string;
|
|
14
|
+
/** @deprecated Use `chalk.yellow` directly */
|
|
7
15
|
export declare function yellow(str: string): string;
|
|
8
|
-
export declare function info(str: string): string;
|
|
9
|
-
export declare function warn(str: string): string;
|
|
10
|
-
export declare function severe(str: string): string;
|
|
11
|
-
export declare function niceId(id: string | undefined): string;
|
|
@@ -1,38 +1,30 @@
|
|
|
1
1
|
import chalk from 'chalk';
|
|
2
|
-
|
|
3
|
-
|
|
2
|
+
export { info, niceId, warn, severe } from './presenters.js';
|
|
3
|
+
/** @deprecated Use `chalk.bold` directly */
|
|
4
4
|
export function bold(str) {
|
|
5
5
|
return chalk.bold(str);
|
|
6
6
|
}
|
|
7
|
+
/** @deprecated Use `chalk.underline` directly */
|
|
7
8
|
export function underline(str) {
|
|
8
9
|
return chalk.underline(str);
|
|
9
10
|
}
|
|
11
|
+
/** @deprecated Use `chalk.dim` directly */
|
|
10
12
|
export function dim(str) {
|
|
11
13
|
return chalk.dim(str);
|
|
12
14
|
}
|
|
15
|
+
/** @deprecated Use `chalk.blue` directly */
|
|
13
16
|
export function blue(str) {
|
|
14
17
|
return chalk.blue(str);
|
|
15
18
|
}
|
|
19
|
+
/** @deprecated Use `chalk.green` directly */
|
|
16
20
|
export function green(str) {
|
|
17
21
|
return chalk.green(str);
|
|
18
22
|
}
|
|
23
|
+
/** @deprecated Use `chalk.red` directly */
|
|
19
24
|
export function red(str) {
|
|
20
25
|
return chalk.red(str);
|
|
21
26
|
}
|
|
27
|
+
/** @deprecated Use `chalk.yellow` directly */
|
|
22
28
|
export function yellow(str) {
|
|
23
29
|
return chalk.yellow(str);
|
|
24
30
|
}
|
|
25
|
-
export function info(str) {
|
|
26
|
-
return `${chalk.blue('❯')} ${str}`;
|
|
27
|
-
}
|
|
28
|
-
export function warn(str) {
|
|
29
|
-
return `${chalk.yellow('❯')} ${str}`;
|
|
30
|
-
}
|
|
31
|
-
export function severe(str) {
|
|
32
|
-
return `${chalk.red('❯')} ${str}`;
|
|
33
|
-
}
|
|
34
|
-
export function niceId(id) {
|
|
35
|
-
if (!id)
|
|
36
|
-
return '';
|
|
37
|
-
return `<${yellow(id)}>`;
|
|
38
|
-
}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
export * as blueprintsFormatting from './blueprints-formatting.js';
|
|
2
2
|
export * as colors from './colors.js';
|
|
3
|
+
export * as presenters from './presenters.js';
|
|
3
4
|
export * as dates from './dates.js';
|
|
4
5
|
export * as logsFormatting from './logs-formatting.js';
|
|
5
6
|
export * as errors from './errors.js';
|