@onereach/ui-components 5.5.2-beta.3210.0 → 5.6.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/bundled/v2/components/OrCode/OrCode.js +4 -4
- package/dist/bundled/v2/components/OrCode/index.d.ts +1 -0
- package/dist/bundled/v2/components/OrCode/index.js +2 -0
- package/dist/bundled/v2/components/OrCode/lang.js +2 -1
- package/dist/bundled/v2/components/OrCode/libs.d.ts +5 -0
- package/dist/bundled/v2/components/OrCode/libs.js +2 -0
- package/dist/bundled/v2/components/OrCode/theme.js +1 -1
- package/dist/bundled/v2/components/OrCodeV3/OrCode.js +4 -3
- package/dist/bundled/v2/components/OrTagsV3/OrTags.js +2 -7
- package/dist/bundled/v2/components/OrTagsV3/OrTags.vue.d.ts +0 -12
- package/dist/bundled/v2/components/OrTagsV3/index.d.ts +0 -1
- package/dist/bundled/v2/components/OrTagsV3/index.js +0 -1
- package/dist/bundled/v2/components/OrTagsV3/styles.d.ts +0 -2
- package/dist/bundled/v2/components/OrTagsV3/styles.js +5 -11
- package/dist/bundled/v2/components/index.js +2 -1
- package/dist/bundled/{v3/index-00991c6e.js → v2/index-02646e58.js} +229 -3
- package/dist/bundled/v2/index-3d38888c.js +2284 -0
- package/dist/bundled/{v3/index-40a6d6e0.js → v2/index-5915e78f.js} +2181 -4433
- package/dist/bundled/v2/{index-51f352b6.js → index-6617e2a7.js} +1 -1
- package/dist/bundled/v2/index.js +2 -1
- package/dist/bundled/v3/{OrCode.vue_vue_type_script_lang-97567727.js → OrCode.vue_vue_type_script_lang-b8b2b714.js} +4 -3
- package/dist/bundled/v3/{OrCode.vue_vue_type_script_lang-0d7e3257.js → OrCode.vue_vue_type_script_lang-dce07d9f.js} +2 -2
- package/dist/bundled/v3/{OrTagInput.vue_vue_type_script_lang-ef8d0d01.js → OrTagInput.vue_vue_type_script_lang-f215bf69.js} +1 -1
- package/dist/bundled/v3/{OrTags.vue_vue_type_script_lang-f0bb0463.js → OrTags.vue_vue_type_script_lang-bb2c2245.js} +2 -7
- package/dist/bundled/v3/components/OrCode/OrCode.js +2 -2
- package/dist/bundled/v3/components/OrCode/index.d.ts +1 -0
- package/dist/bundled/v3/components/OrCode/index.js +3 -1
- package/dist/bundled/v3/components/OrCode/lang.js +2 -1
- package/dist/bundled/v3/components/OrCode/libs.d.ts +5 -0
- package/dist/bundled/v3/components/OrCode/libs.js +2 -0
- package/dist/bundled/v3/components/OrCode/theme.js +1 -1
- package/dist/bundled/v3/components/OrCodeV3/OrCode.js +2 -2
- package/dist/bundled/v3/components/OrCodeV3/index.js +1 -1
- package/dist/bundled/v3/components/OrTagInputV3/OrTagInput.js +2 -2
- package/dist/bundled/v3/components/OrTagInputV3/index.js +1 -1
- package/dist/bundled/v3/components/OrTagsV3/OrTags.js +2 -2
- package/dist/bundled/v3/components/OrTagsV3/OrTags.vue.d.ts +0 -10
- package/dist/bundled/v3/components/OrTagsV3/index.d.ts +0 -1
- package/dist/bundled/v3/components/OrTagsV3/index.js +1 -2
- package/dist/bundled/v3/components/OrTagsV3/styles.d.ts +0 -2
- package/dist/bundled/v3/components/OrTagsV3/styles.js +5 -11
- package/dist/bundled/v3/components/index.js +6 -5
- package/dist/bundled/{v2/index-00991c6e.js → v3/index-02646e58.js} +229 -3
- package/dist/bundled/v3/index-3d38888c.js +2284 -0
- package/dist/bundled/{v2/index-40a6d6e0.js → v3/index-5915e78f.js} +2181 -4433
- package/dist/bundled/v3/{index-51f352b6.js → index-6617e2a7.js} +1 -1
- package/dist/bundled/v3/index.js +6 -5
- package/dist/esm/v2/{OrCode-34234c09.js → OrCode-ad753142.js} +5 -4
- package/dist/esm/v2/{OrTagInput-05af802f.js → OrTagInput-fcc06827.js} +1 -1
- package/dist/esm/v2/{OrTags-216a8a05.js → OrTags-43597f24.js} +6 -20
- package/dist/esm/v2/components/index.js +8 -7
- package/dist/esm/v2/components/or-code/index.d.ts +1 -0
- package/dist/esm/v2/components/or-code/index.js +6 -5
- package/dist/esm/v2/components/or-code/libs.d.ts +5 -0
- package/dist/esm/v2/components/or-tag-input-v3/index.js +2 -2
- package/dist/esm/v2/components/or-tags-v3/OrTags.vue.d.ts +0 -12
- package/dist/esm/v2/components/or-tags-v3/index.d.ts +0 -1
- package/dist/esm/v2/components/or-tags-v3/index.js +1 -1
- package/dist/esm/v2/components/or-tags-v3/styles.d.ts +0 -2
- package/dist/esm/v2/index.js +8 -7
- package/dist/esm/v3/{OrCode-0aadc737.js → OrCode-a4ec2041.js} +3 -2
- package/dist/esm/v3/{OrTagInput-5e866ea3.js → OrTagInput-313e738c.js} +1 -1
- package/dist/esm/v3/{OrTags-2be5eb09.js → OrTags-14b3eb12.js} +6 -20
- package/dist/esm/v3/components/index.js +8 -7
- package/dist/esm/v3/components/or-code/index.d.ts +1 -0
- package/dist/esm/v3/components/or-code/index.js +6 -5
- package/dist/esm/v3/components/or-code/libs.d.ts +5 -0
- package/dist/esm/v3/components/or-tag-input-v3/index.js +2 -2
- package/dist/esm/v3/components/or-tags-v3/OrTags.vue.d.ts +0 -10
- package/dist/esm/v3/components/or-tags-v3/index.d.ts +0 -1
- package/dist/esm/v3/components/or-tags-v3/index.js +1 -1
- package/dist/esm/v3/components/or-tags-v3/styles.d.ts +0 -2
- package/dist/esm/v3/index.js +8 -7
- package/package.json +3 -2
- package/src/components/or-code/OrCode.vue +2 -1
- package/src/components/or-code/index.ts +1 -0
- package/src/components/or-code/libs.ts +7 -0
- package/src/components/or-tags-v3/OrTags.vue +1 -8
- package/src/components/or-tags-v3/index.ts +0 -1
- package/src/components/or-tags-v3/styles.ts +6 -14
- package/dist/bundled/v2/components/OrTagsV3/props.d.ts +0 -4
- package/dist/bundled/v2/components/OrTagsV3/props.js +0 -7
- package/dist/bundled/v3/components/OrTagsV3/props.d.ts +0 -4
- package/dist/bundled/v3/components/OrTagsV3/props.js +0 -7
- package/dist/esm/v2/components/or-tags-v3/props.d.ts +0 -4
- package/dist/esm/v3/components/or-tags-v3/props.d.ts +0 -4
- package/src/components/or-tags-v3/props.ts +0 -4
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { E as EditorView, a as EditorState, k as keymap } from '../../index-
|
|
2
|
-
import { b as basicSetup, i as indentWithTab } from '../../index-
|
|
1
|
+
import { E as EditorView, a as EditorState, k as keymap } from '../../index-6617e2a7.js';
|
|
2
|
+
import { b as basicSetup, i as indentWithTab } from '../../index-02646e58.js';
|
|
3
3
|
import { u as useElementHover } from '../../index-509d77a1.js';
|
|
4
4
|
import { defineComponent, ref } from 'vue-demi';
|
|
5
5
|
import __vue_component__$3 from '../OrTeleport/OrTeleport.js';
|
|
@@ -231,7 +231,7 @@ var script = defineComponent({
|
|
|
231
231
|
}
|
|
232
232
|
});
|
|
233
233
|
|
|
234
|
-
var css_248z = "@keyframes spinAround-data-v-
|
|
234
|
+
var css_248z = "@keyframes spinAround-data-v-193dc43c{from{transform:rotate(0)}to{transform:rotate(359deg)}}@keyframes fade-data-v-193dc43c{from{opacity:1}to{opacity:0}}.or-code .fullscreen-button[data-v-193dc43c]{width:2.25rem;height:2.25rem}.or-code .fullscreen-button>.or-icon[data-v-193dc43c]{font-size:1.5rem}.or-code .footer .or-code-error[data-v-193dc43c],.or-code .footer .or-code-hint[data-v-193dc43c]{flex-shrink:1;transition-timing-function:var(--t-func);transition-duration:var(--t-duration);transition-property:height,opacity}.header[data-v-193dc43c]{display:flex;flex-direction:row;align-items:center;height:36px}.header .actions[data-v-193dc43c]{margin-left:auto}.header .actions[data-v-193dc43c]:not(.is-visible){display:none}.or-code-editor[data-v-193dc43c]{min-height:calc(1.4em + 8px);overflow:auto;font-size:var(--fs-0);border:1px solid var(--c-neutral-2);border-radius:var(--s-2)}.or-code-editor.is-invalid[data-v-193dc43c]{border-color:var(--c-error)}.or-code-editor[data-v-193dc43c]> *{width:100%;height:100%}.or-code[data-v-193dc43c],.or-modal[data-v-193dc43c] .content{display:flex;flex-direction:column}.or-code .or-code-editor[data-v-193dc43c],.or-modal[data-v-193dc43c] .content .or-code-editor{text-align:left!important}.or-code .or-code-editor[data-v-193dc43c],.or-modal[data-v-193dc43c] .content .or-code-editor{flex-grow:1}";
|
|
235
235
|
styleInject(css_248z);
|
|
236
236
|
|
|
237
237
|
/* script */
|
|
@@ -335,7 +335,7 @@ var __vue_staticRenderFns__ = [];
|
|
|
335
335
|
/* style */
|
|
336
336
|
const __vue_inject_styles__ = undefined;
|
|
337
337
|
/* scoped */
|
|
338
|
-
const __vue_scope_id__ = "data-v-
|
|
338
|
+
const __vue_scope_id__ = "data-v-193dc43c";
|
|
339
339
|
/* module identifier */
|
|
340
340
|
const __vue_module_identifier__ = undefined;
|
|
341
341
|
/* functional template */
|
|
@@ -1,2 +1,4 @@
|
|
|
1
1
|
export { default as OrCode } from './OrCode.js';
|
|
2
2
|
export { OrCodeLanguages } from './constants.js';
|
|
3
|
+
export { b as basicSetup, a as lintGutter, l as linter } from '../../index-02646e58.js';
|
|
4
|
+
export { h as html, j as javascript, a as json, b as jsonParseLinter } from '../../index-5915e78f.js';
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { j as javascript, c as css, h as html, a as json } from '../../index-5915e78f.js';
|
|
2
|
+
import { m as markdown } from '../../index-3d38888c.js';
|
|
2
3
|
import { OrCodeLanguages } from './constants.js';
|
|
3
4
|
|
|
4
5
|
const JS = javascript({
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { E as EditorView,
|
|
1
|
+
import { E as EditorView, aq as HighlightStyle, ac as tags, X as syntaxHighlighting } from '../../index-6617e2a7.js';
|
|
2
2
|
|
|
3
3
|
// Using https://github.com/one-dark/vscode-one-dark-theme/ as reference for the colors
|
|
4
4
|
const chalky = 'var(--c-warning-darken-20)',
|
|
@@ -1,6 +1,7 @@
|
|
|
1
|
-
import { b as basicSetup, i as indentWithTab } from '../../index-
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
1
|
+
import { b as basicSetup, i as indentWithTab } from '../../index-02646e58.js';
|
|
2
|
+
import { a as json, j as javascript, c as css, h as html } from '../../index-5915e78f.js';
|
|
3
|
+
import { m as markdown } from '../../index-3d38888c.js';
|
|
4
|
+
import { E as EditorView, k as keymap, a as EditorState } from '../../index-6617e2a7.js';
|
|
4
5
|
import { defineComponent, ref, computed, reactive, toRef, watch, onMounted, onUnmounted } from 'vue-demi';
|
|
5
6
|
import { CodeLanguage } from './props.js';
|
|
6
7
|
import { Code, CodeControl } from './styles.js';
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { defineComponent, ref, computed } from 'vue-demi';
|
|
2
|
-
import {
|
|
3
|
-
import { Tags, TagsContainer, TagsContainerOverflows, TagsOverflowButton, TagsOverflowPopover } from './styles.js';
|
|
2
|
+
import { Tags, TagsContainer, TagsOverflowButton, TagsOverflowPopover } from './styles.js';
|
|
4
3
|
import __vue_component__$1 from '../OrButtonV3/OrButton.js';
|
|
5
4
|
import __vue_component__$2 from '../OrPopoverV3/OrPopover.js';
|
|
6
5
|
import __vue_component__$3 from '../OrTagV3/OrTag.js';
|
|
@@ -19,10 +18,6 @@ var script = defineComponent({
|
|
|
19
18
|
type: Array,
|
|
20
19
|
default: () => []
|
|
21
20
|
},
|
|
22
|
-
overflow: {
|
|
23
|
-
type: String,
|
|
24
|
-
default: TagsOverflow.Default
|
|
25
|
-
},
|
|
26
21
|
tagProps: {
|
|
27
22
|
type: Object,
|
|
28
23
|
default: undefined
|
|
@@ -46,7 +41,7 @@ var script = defineComponent({
|
|
|
46
41
|
});
|
|
47
42
|
// Styles
|
|
48
43
|
const rootStyles = computed(() => ['or-tags-v3', ...Tags]);
|
|
49
|
-
const containerStyles = computed(() => [...TagsContainer
|
|
44
|
+
const containerStyles = computed(() => [...TagsContainer]);
|
|
50
45
|
const overflowButtonStyles = computed(() => [...TagsOverflowButton]);
|
|
51
46
|
const overflowPopoverStyles = computed(() => [...TagsOverflowPopover]);
|
|
52
47
|
// State
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { PropType } from 'vue-demi';
|
|
2
|
-
import { TagsOverflow } from './props';
|
|
3
2
|
declare const _default: import("vue").ComponentOptions<import("vue").default, import("@vue/composition-api").ShallowUnwrapRef<{
|
|
4
3
|
root: import("@vue/composition-api").Ref<HTMLElement | undefined>;
|
|
5
4
|
container: import("@vue/composition-api").Ref<HTMLElement | undefined>;
|
|
@@ -25,10 +24,6 @@ declare const _default: import("vue").ComponentOptions<import("vue").default, im
|
|
|
25
24
|
type: PropType<string[]>;
|
|
26
25
|
default: () => never[];
|
|
27
26
|
};
|
|
28
|
-
overflow: {
|
|
29
|
-
type: PropType<"default" | "wrap">;
|
|
30
|
-
default: TagsOverflow;
|
|
31
|
-
};
|
|
32
27
|
tagProps: {
|
|
33
28
|
type: PropType<Readonly<Partial<{
|
|
34
29
|
[x: number]: string;
|
|
@@ -40,10 +35,6 @@ declare const _default: import("vue").ComponentOptions<import("vue").default, im
|
|
|
40
35
|
type: PropType<string[]>;
|
|
41
36
|
default: () => never[];
|
|
42
37
|
};
|
|
43
|
-
overflow: {
|
|
44
|
-
type: PropType<"default" | "wrap">;
|
|
45
|
-
default: TagsOverflow;
|
|
46
|
-
};
|
|
47
38
|
tagProps: {
|
|
48
39
|
type: PropType<Readonly<Partial<{
|
|
49
40
|
[x: number]: string;
|
|
@@ -52,7 +43,6 @@ declare const _default: import("vue").ComponentOptions<import("vue").default, im
|
|
|
52
43
|
};
|
|
53
44
|
}>> & Omit<import("vue").VueConstructor<import("vue").default>, never> & (new (...args: any[]) => import("@vue/composition-api").ComponentRenderProxy<{
|
|
54
45
|
items: string[];
|
|
55
|
-
overflow: "default" | "wrap";
|
|
56
46
|
tagProps: Readonly<Partial<{
|
|
57
47
|
[x: number]: string;
|
|
58
48
|
} | {}> & Omit<{} & {}, never>>;
|
|
@@ -80,7 +70,6 @@ declare const _default: import("vue").ComponentOptions<import("vue").default, im
|
|
|
80
70
|
overflowItems: import("@vue/composition-api").ComputedRef<string[]>;
|
|
81
71
|
}>, import("@vue/composition-api").Data, {}, {}, {}, {}, string[], {
|
|
82
72
|
items: string[];
|
|
83
|
-
overflow: "default" | "wrap";
|
|
84
73
|
tagProps: Readonly<Partial<{
|
|
85
74
|
[x: number]: string;
|
|
86
75
|
} | {}> & Omit<{} & {}, never>>;
|
|
@@ -88,7 +77,6 @@ declare const _default: import("vue").ComponentOptions<import("vue").default, im
|
|
|
88
77
|
[x: `on${Capitalize<string>}`]: ((...args: any[]) => any) | undefined;
|
|
89
78
|
}, {
|
|
90
79
|
items: string[];
|
|
91
|
-
overflow: "default" | "wrap";
|
|
92
80
|
tagProps: Readonly<Partial<{
|
|
93
81
|
[x: number]: string;
|
|
94
82
|
} | {}> & Omit<{} & {}, never>>;
|
|
@@ -1,6 +1,4 @@
|
|
|
1
|
-
import { TagsOverflow } from './props';
|
|
2
1
|
export declare const Tags: string[];
|
|
3
2
|
export declare const TagsContainer: string[];
|
|
4
|
-
export declare const TagsContainerOverflows: Record<TagsOverflow, string[]>;
|
|
5
3
|
export declare const TagsOverflowButton: string[];
|
|
6
4
|
export declare const TagsOverflowPopover: string[];
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { TagsOverflow } from './props.js';
|
|
2
|
-
|
|
3
1
|
const Tags = [
|
|
4
2
|
// Layout
|
|
5
3
|
'layout-row',
|
|
4
|
+
// Overflow
|
|
5
|
+
'overflow-hidden',
|
|
6
6
|
// Spacing
|
|
7
7
|
'gap-sm',
|
|
8
8
|
// Theme
|
|
@@ -10,16 +10,10 @@ const Tags = [
|
|
|
10
10
|
const TagsContainer = [
|
|
11
11
|
// Layout
|
|
12
12
|
'layout-row',
|
|
13
|
+
// Overflow
|
|
14
|
+
'overflow-hidden',
|
|
13
15
|
// Spacing
|
|
14
16
|
'gap-sm'];
|
|
15
|
-
const TagsContainerOverflows = {
|
|
16
|
-
[TagsOverflow.Default]: [
|
|
17
|
-
// Overflow
|
|
18
|
-
'overflow-hidden'],
|
|
19
|
-
[TagsOverflow.Wrap]: [
|
|
20
|
-
// Layout
|
|
21
|
-
'!flex-wrap']
|
|
22
|
-
};
|
|
23
17
|
const TagsOverflowButton = [
|
|
24
18
|
// Typography
|
|
25
19
|
'typography-caption-regular'];
|
|
@@ -31,4 +25,4 @@ const TagsOverflowPopover = [
|
|
|
31
25
|
// Spacing
|
|
32
26
|
'px-md', 'py-md', 'gap-sm'];
|
|
33
27
|
|
|
34
|
-
export { Tags, TagsContainer,
|
|
28
|
+
export { Tags, TagsContainer, TagsOverflowButton, TagsOverflowPopover };
|
|
@@ -25,6 +25,8 @@ export { default as OrChip } from './OrChip/OrChip.js';
|
|
|
25
25
|
export { default as OrChips } from './OrChips/OrChips.js';
|
|
26
26
|
export { default as OrCode } from './OrCode/OrCode.js';
|
|
27
27
|
export { OrCodeLanguages } from './OrCode/constants.js';
|
|
28
|
+
export { b as basicSetup, a as lintGutter, l as linter } from '../index-02646e58.js';
|
|
29
|
+
export { h as html, j as javascript, a as json, b as jsonParseLinter } from '../index-5915e78f.js';
|
|
28
30
|
export { default as OrCodeV3 } from './OrCodeV3/OrCode.js';
|
|
29
31
|
export { CodeLanguage } from './OrCodeV3/props.js';
|
|
30
32
|
export { default as OrCollapse } from './OrCollapse/OrCollapse.js';
|
|
@@ -142,7 +144,6 @@ export { default as OrTagInputV3 } from './OrTagInputV3/OrTagInput.js';
|
|
|
142
144
|
export { default as OrTagV3 } from './OrTagV3/OrTag.js';
|
|
143
145
|
export { TagColor, TagVariant } from './OrTagV3/props.js';
|
|
144
146
|
export { default as OrTagsV3 } from './OrTagsV3/OrTags.js';
|
|
145
|
-
export { TagsOverflow } from './OrTagsV3/props.js';
|
|
146
147
|
export { default as OrTeleport } from './OrTeleport/OrTeleport.js';
|
|
147
148
|
export { default as OrTeleportV3 } from './OrTeleportV3/OrTeleport.js';
|
|
148
149
|
export { default as OrTextV3 } from './OrTextV3/OrText.js';
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { E as EditorView, F as Facet, c as combineConfig, S as StateField, b as EditorSelection, T as Transaction, C as ChangeSet, d as ChangeDesc, I as IndentContext, g as getIndentation, i as indentString, e as Text, f as indentUnit, h as countColumn, j as getIndentUnit, A as Annotation, l as StateEffect, m as matchBrackets, s as syntaxTree, N as NodeProp, D as Direction, n as findClusterBreak, V as ViewPlugin, o as Decoration, p as codePointAt, q as codePointSize, r as getPanel, t as CharCategory, P as Prec, u as fromCodePoint, v as showPanel, R as RangeSetBuilder, a as EditorState, w as runScopeHandlers, x as hoverTooltip, W as WidgetType,
|
|
2
|
-
import {
|
|
1
|
+
import { E as EditorView, F as Facet, c as combineConfig, S as StateField, b as EditorSelection, T as Transaction, C as ChangeSet, d as ChangeDesc, I as IndentContext, g as getIndentation, i as indentString, e as Text, f as indentUnit, h as countColumn, j as getIndentUnit, A as Annotation, l as StateEffect, m as matchBrackets, s as syntaxTree, N as NodeProp, D as Direction, n as findClusterBreak, V as ViewPlugin, o as Decoration, p as codePointAt, q as codePointSize, r as getPanel, t as CharCategory, P as Prec, u as fromCodePoint, v as showPanel, R as RangeSetBuilder, a as EditorState, w as runScopeHandlers, x as hoverTooltip, y as logException, z as gutter, B as RangeSet, G as showTooltip, W as WidgetType, H as GutterMarker, J as lineNumbers, K as highlightActiveLineGutter, L as highlightSpecialChars, M as foldGutter, O as drawSelection, Q as dropCursor, U as indentOnInput, X as syntaxHighlighting, Y as defaultHighlightStyle, Z as bracketMatching, _ as rectangularSelection, $ as crosshairCursor, a0 as highlightActiveLine, k as keymap, a1 as foldKeymap } from './index-6617e2a7.js';
|
|
2
|
+
import { d as closeBrackets, e as autocompletion, f as closeBracketsKeymap, g as completionKeymap } from './index-5915e78f.js';
|
|
3
3
|
|
|
4
4
|
/**
|
|
5
5
|
Comment or uncomment the current selection. Will use line comments
|
|
@@ -3179,6 +3179,16 @@ function maybeEnableLint(state, effects) {
|
|
|
3179
3179
|
return state.field(lintState, false) ? effects : effects.concat(StateEffect.appendConfig.of(lintExtensions));
|
|
3180
3180
|
}
|
|
3181
3181
|
/**
|
|
3182
|
+
Returns a transaction spec which updates the current set of
|
|
3183
|
+
diagnostics, and enables the lint extension if if wasn't already
|
|
3184
|
+
active.
|
|
3185
|
+
*/
|
|
3186
|
+
function setDiagnostics(state, diagnostics) {
|
|
3187
|
+
return {
|
|
3188
|
+
effects: maybeEnableLint(state, [setDiagnosticsEffect.of(diagnostics)])
|
|
3189
|
+
};
|
|
3190
|
+
}
|
|
3191
|
+
/**
|
|
3182
3192
|
The state effect that updates the set of active diagnostics. Can
|
|
3183
3193
|
be useful when writing an extension that needs to track these.
|
|
3184
3194
|
*/
|
|
@@ -3309,6 +3319,58 @@ const lintKeymap = [{
|
|
|
3309
3319
|
key: "F8",
|
|
3310
3320
|
run: nextDiagnostic
|
|
3311
3321
|
}];
|
|
3322
|
+
const lintPlugin = /*@__PURE__*/ViewPlugin.fromClass(class {
|
|
3323
|
+
constructor(view) {
|
|
3324
|
+
this.view = view;
|
|
3325
|
+
this.timeout = -1;
|
|
3326
|
+
this.set = true;
|
|
3327
|
+
let {
|
|
3328
|
+
delay
|
|
3329
|
+
} = view.state.facet(lintConfig);
|
|
3330
|
+
this.lintTime = Date.now() + delay;
|
|
3331
|
+
this.run = this.run.bind(this);
|
|
3332
|
+
this.timeout = setTimeout(this.run, delay);
|
|
3333
|
+
}
|
|
3334
|
+
run() {
|
|
3335
|
+
let now = Date.now();
|
|
3336
|
+
if (now < this.lintTime - 10) {
|
|
3337
|
+
setTimeout(this.run, this.lintTime - now);
|
|
3338
|
+
} else {
|
|
3339
|
+
this.set = false;
|
|
3340
|
+
let {
|
|
3341
|
+
state
|
|
3342
|
+
} = this.view,
|
|
3343
|
+
{
|
|
3344
|
+
sources
|
|
3345
|
+
} = state.facet(lintConfig);
|
|
3346
|
+
Promise.all(sources.map(source => Promise.resolve(source(this.view)))).then(annotations => {
|
|
3347
|
+
let all = annotations.reduce((a, b) => a.concat(b));
|
|
3348
|
+
if (this.view.state.doc == state.doc) this.view.dispatch(setDiagnostics(this.view.state, all));
|
|
3349
|
+
}, error => {
|
|
3350
|
+
logException(this.view.state, error);
|
|
3351
|
+
});
|
|
3352
|
+
}
|
|
3353
|
+
}
|
|
3354
|
+
update(update) {
|
|
3355
|
+
let config = update.state.facet(lintConfig);
|
|
3356
|
+
if (update.docChanged || config != update.startState.facet(lintConfig) || config.needsRefresh && config.needsRefresh(update)) {
|
|
3357
|
+
this.lintTime = Date.now() + config.delay;
|
|
3358
|
+
if (!this.set) {
|
|
3359
|
+
this.set = true;
|
|
3360
|
+
this.timeout = setTimeout(this.run, config.delay);
|
|
3361
|
+
}
|
|
3362
|
+
}
|
|
3363
|
+
}
|
|
3364
|
+
force() {
|
|
3365
|
+
if (this.set) {
|
|
3366
|
+
this.lintTime = Date.now();
|
|
3367
|
+
this.run();
|
|
3368
|
+
}
|
|
3369
|
+
}
|
|
3370
|
+
destroy() {
|
|
3371
|
+
clearTimeout(this.timeout);
|
|
3372
|
+
}
|
|
3373
|
+
});
|
|
3312
3374
|
const lintConfig = /*@__PURE__*/Facet.define({
|
|
3313
3375
|
combine(input) {
|
|
3314
3376
|
return Object.assign({
|
|
@@ -3323,6 +3385,18 @@ const lintConfig = /*@__PURE__*/Facet.define({
|
|
|
3323
3385
|
}));
|
|
3324
3386
|
}
|
|
3325
3387
|
});
|
|
3388
|
+
/**
|
|
3389
|
+
Given a diagnostic source, this function returns an extension that
|
|
3390
|
+
enables linting with that source. It will be called whenever the
|
|
3391
|
+
editor is idle (after its content changed).
|
|
3392
|
+
*/
|
|
3393
|
+
function linter(source) {
|
|
3394
|
+
let config = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
|
3395
|
+
return [lintConfig.of({
|
|
3396
|
+
source,
|
|
3397
|
+
config
|
|
3398
|
+
}), lintPlugin, lintExtensions];
|
|
3399
|
+
}
|
|
3326
3400
|
function assignKeys(actions) {
|
|
3327
3401
|
let assigned = [];
|
|
3328
3402
|
if (actions) actions: for (let {
|
|
@@ -3684,6 +3758,140 @@ const baseTheme = /*@__PURE__*/EditorView.baseTheme({
|
|
|
3684
3758
|
}
|
|
3685
3759
|
}
|
|
3686
3760
|
});
|
|
3761
|
+
class LintGutterMarker extends GutterMarker {
|
|
3762
|
+
constructor(diagnostics) {
|
|
3763
|
+
super();
|
|
3764
|
+
this.diagnostics = diagnostics;
|
|
3765
|
+
this.severity = diagnostics.reduce((max, d) => {
|
|
3766
|
+
let s = d.severity;
|
|
3767
|
+
return s == "error" || s == "warning" && max == "info" ? s : max;
|
|
3768
|
+
}, "info");
|
|
3769
|
+
}
|
|
3770
|
+
toDOM(view) {
|
|
3771
|
+
let elt = document.createElement("div");
|
|
3772
|
+
elt.className = "cm-lint-marker cm-lint-marker-" + this.severity;
|
|
3773
|
+
let diagnostics = this.diagnostics;
|
|
3774
|
+
let diagnosticsFilter = view.state.facet(lintGutterConfig).tooltipFilter;
|
|
3775
|
+
if (diagnosticsFilter) diagnostics = diagnosticsFilter(diagnostics);
|
|
3776
|
+
if (diagnostics.length) elt.onmouseover = () => gutterMarkerMouseOver(view, elt, diagnostics);
|
|
3777
|
+
return elt;
|
|
3778
|
+
}
|
|
3779
|
+
}
|
|
3780
|
+
function trackHoverOn(view, marker) {
|
|
3781
|
+
let mousemove = event => {
|
|
3782
|
+
let rect = marker.getBoundingClientRect();
|
|
3783
|
+
if (event.clientX > rect.left - 10 /* Hover.Margin */ && event.clientX < rect.right + 10 /* Hover.Margin */ && event.clientY > rect.top - 10 /* Hover.Margin */ && event.clientY < rect.bottom + 10 /* Hover.Margin */) return;
|
|
3784
|
+
for (let target = event.target; target; target = target.parentNode) {
|
|
3785
|
+
if (target.nodeType == 1 && target.classList.contains("cm-tooltip-lint")) return;
|
|
3786
|
+
}
|
|
3787
|
+
window.removeEventListener("mousemove", mousemove);
|
|
3788
|
+
if (view.state.field(lintGutterTooltip)) view.dispatch({
|
|
3789
|
+
effects: setLintGutterTooltip.of(null)
|
|
3790
|
+
});
|
|
3791
|
+
};
|
|
3792
|
+
window.addEventListener("mousemove", mousemove);
|
|
3793
|
+
}
|
|
3794
|
+
function gutterMarkerMouseOver(view, marker, diagnostics) {
|
|
3795
|
+
function hovered() {
|
|
3796
|
+
let line = view.elementAtHeight(marker.getBoundingClientRect().top + 5 - view.documentTop);
|
|
3797
|
+
const linePos = view.coordsAtPos(line.from);
|
|
3798
|
+
if (linePos) {
|
|
3799
|
+
view.dispatch({
|
|
3800
|
+
effects: setLintGutterTooltip.of({
|
|
3801
|
+
pos: line.from,
|
|
3802
|
+
above: false,
|
|
3803
|
+
create() {
|
|
3804
|
+
return {
|
|
3805
|
+
dom: diagnosticsTooltip(view, diagnostics),
|
|
3806
|
+
getCoords: () => marker.getBoundingClientRect()
|
|
3807
|
+
};
|
|
3808
|
+
}
|
|
3809
|
+
})
|
|
3810
|
+
});
|
|
3811
|
+
}
|
|
3812
|
+
marker.onmouseout = marker.onmousemove = null;
|
|
3813
|
+
trackHoverOn(view, marker);
|
|
3814
|
+
}
|
|
3815
|
+
let {
|
|
3816
|
+
hoverTime
|
|
3817
|
+
} = view.state.facet(lintGutterConfig);
|
|
3818
|
+
let hoverTimeout = setTimeout(hovered, hoverTime);
|
|
3819
|
+
marker.onmouseout = () => {
|
|
3820
|
+
clearTimeout(hoverTimeout);
|
|
3821
|
+
marker.onmouseout = marker.onmousemove = null;
|
|
3822
|
+
};
|
|
3823
|
+
marker.onmousemove = () => {
|
|
3824
|
+
clearTimeout(hoverTimeout);
|
|
3825
|
+
hoverTimeout = setTimeout(hovered, hoverTime);
|
|
3826
|
+
};
|
|
3827
|
+
}
|
|
3828
|
+
function markersForDiagnostics(doc, diagnostics) {
|
|
3829
|
+
let byLine = Object.create(null);
|
|
3830
|
+
for (let diagnostic of diagnostics) {
|
|
3831
|
+
let line = doc.lineAt(diagnostic.from);
|
|
3832
|
+
(byLine[line.from] || (byLine[line.from] = [])).push(diagnostic);
|
|
3833
|
+
}
|
|
3834
|
+
let markers = [];
|
|
3835
|
+
for (let line in byLine) {
|
|
3836
|
+
markers.push(new LintGutterMarker(byLine[line]).range(+line));
|
|
3837
|
+
}
|
|
3838
|
+
return RangeSet.of(markers, true);
|
|
3839
|
+
}
|
|
3840
|
+
const lintGutterExtension = /*@__PURE__*/gutter({
|
|
3841
|
+
class: "cm-gutter-lint",
|
|
3842
|
+
markers: view => view.state.field(lintGutterMarkers)
|
|
3843
|
+
});
|
|
3844
|
+
const lintGutterMarkers = /*@__PURE__*/StateField.define({
|
|
3845
|
+
create() {
|
|
3846
|
+
return RangeSet.empty;
|
|
3847
|
+
},
|
|
3848
|
+
update(markers, tr) {
|
|
3849
|
+
markers = markers.map(tr.changes);
|
|
3850
|
+
let diagnosticFilter = tr.state.facet(lintGutterConfig).markerFilter;
|
|
3851
|
+
for (let effect of tr.effects) {
|
|
3852
|
+
if (effect.is(setDiagnosticsEffect)) {
|
|
3853
|
+
let diagnostics = effect.value;
|
|
3854
|
+
if (diagnosticFilter) diagnostics = diagnosticFilter(diagnostics || []);
|
|
3855
|
+
markers = markersForDiagnostics(tr.state.doc, diagnostics.slice(0));
|
|
3856
|
+
}
|
|
3857
|
+
}
|
|
3858
|
+
return markers;
|
|
3859
|
+
}
|
|
3860
|
+
});
|
|
3861
|
+
const setLintGutterTooltip = /*@__PURE__*/StateEffect.define();
|
|
3862
|
+
const lintGutterTooltip = /*@__PURE__*/StateField.define({
|
|
3863
|
+
create() {
|
|
3864
|
+
return null;
|
|
3865
|
+
},
|
|
3866
|
+
update(tooltip, tr) {
|
|
3867
|
+
if (tooltip && tr.docChanged) tooltip = hideTooltip(tr, tooltip) ? null : Object.assign(Object.assign({}, tooltip), {
|
|
3868
|
+
pos: tr.changes.mapPos(tooltip.pos)
|
|
3869
|
+
});
|
|
3870
|
+
return tr.effects.reduce((t, e) => e.is(setLintGutterTooltip) ? e.value : t, tooltip);
|
|
3871
|
+
},
|
|
3872
|
+
provide: field => showTooltip.from(field)
|
|
3873
|
+
});
|
|
3874
|
+
const lintGutterTheme = /*@__PURE__*/EditorView.baseTheme({
|
|
3875
|
+
".cm-gutter-lint": {
|
|
3876
|
+
width: "1.4em",
|
|
3877
|
+
"& .cm-gutterElement": {
|
|
3878
|
+
padding: ".2em"
|
|
3879
|
+
}
|
|
3880
|
+
},
|
|
3881
|
+
".cm-lint-marker": {
|
|
3882
|
+
width: "1em",
|
|
3883
|
+
height: "1em"
|
|
3884
|
+
},
|
|
3885
|
+
".cm-lint-marker-info": {
|
|
3886
|
+
content: /*@__PURE__*/svg(`<path fill="#aaf" stroke="#77e" stroke-width="6" stroke-linejoin="round" d="M5 5L35 5L35 35L5 35Z"/>`)
|
|
3887
|
+
},
|
|
3888
|
+
".cm-lint-marker-warning": {
|
|
3889
|
+
content: /*@__PURE__*/svg(`<path fill="#fe8" stroke="#fd7" stroke-width="6" stroke-linejoin="round" d="M20 6L37 35L3 35Z"/>`)
|
|
3890
|
+
},
|
|
3891
|
+
".cm-lint-marker-error": {
|
|
3892
|
+
content: /*@__PURE__*/svg(`<circle cx="20" cy="20" r="15" fill="#f87" stroke="#f43" stroke-width="6"/>`)
|
|
3893
|
+
}
|
|
3894
|
+
});
|
|
3687
3895
|
const lintExtensions = [lintState, /*@__PURE__*/EditorView.decorations.compute([lintState], state => {
|
|
3688
3896
|
let {
|
|
3689
3897
|
selected,
|
|
@@ -3693,6 +3901,24 @@ const lintExtensions = [lintState, /*@__PURE__*/EditorView.decorations.compute([
|
|
|
3693
3901
|
}), /*@__PURE__*/hoverTooltip(lintTooltip, {
|
|
3694
3902
|
hideOn: hideTooltip
|
|
3695
3903
|
}), baseTheme];
|
|
3904
|
+
const lintGutterConfig = /*@__PURE__*/Facet.define({
|
|
3905
|
+
combine(configs) {
|
|
3906
|
+
return combineConfig(configs, {
|
|
3907
|
+
hoverTime: 300 /* Hover.Time */,
|
|
3908
|
+
markerFilter: null,
|
|
3909
|
+
tooltipFilter: null
|
|
3910
|
+
});
|
|
3911
|
+
}
|
|
3912
|
+
});
|
|
3913
|
+
/**
|
|
3914
|
+
Returns an extension that installs a gutter showing markers for
|
|
3915
|
+
each line that has diagnostics, which can be hovered over to see
|
|
3916
|
+
the diagnostics.
|
|
3917
|
+
*/
|
|
3918
|
+
function lintGutter() {
|
|
3919
|
+
let config = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
3920
|
+
return [lintGutterConfig.of(config), lintGutterMarkers, lintGutterExtension, lintGutterTheme, lintGutterTooltip];
|
|
3921
|
+
}
|
|
3696
3922
|
|
|
3697
3923
|
// (The superfluous function calls around the list of extensions work
|
|
3698
3924
|
// around current limitations in tree-shaking software.)
|
|
@@ -3737,4 +3963,4 @@ const basicSetup = /*@__PURE__*/(() => [lineNumbers(), highlightActiveLineGutter
|
|
|
3737
3963
|
fallback: true
|
|
3738
3964
|
}), bracketMatching(), closeBrackets(), autocompletion(), rectangularSelection(), crosshairCursor(), highlightActiveLine(), highlightSelectionMatches(), keymap.of([...closeBracketsKeymap, ...defaultKeymap, ...searchKeymap, ...historyKeymap, ...foldKeymap, ...completionKeymap, ...lintKeymap])])();
|
|
3739
3965
|
|
|
3740
|
-
export { basicSetup as b, indentWithTab as i };
|
|
3966
|
+
export { lintGutter as a, basicSetup as b, indentWithTab as i, linter as l };
|