@onereach/ui-components 4.10.1-beta.2921.0 → 4.10.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/dist/bundled/v2/components/OrCode/OrCode.js +3792 -4
- package/dist/bundled/v2/components/OrCode/index.js +2 -4
- package/dist/bundled/v2/components/OrCode/lang.js +3 -24
- package/dist/bundled/v2/components/OrCode/theme.js +1 -1
- package/dist/bundled/v2/components/OrModalV3/OrModal.js +2 -2
- package/dist/bundled/v2/components/index.d.ts +0 -1
- package/dist/bundled/v2/components/index.js +3 -8
- package/dist/bundled/v2/{index-6a13fa4e.js → index-cf2c3c27.js} +1 -1
- package/dist/bundled/v2/index.js +4 -9
- package/dist/bundled/v2/{index-eba9b646.js → lang-0fb8f78b.js} +22 -2
- package/dist/bundled/{v2/index-576b3dec.js → v3/OrCode.vue_vue_type_script_lang-46846a36.js} +235 -3
- package/dist/bundled/v3/components/OrCode/OrCode.js +5 -7
- package/dist/bundled/v3/components/OrCode/index.js +3 -5
- package/dist/bundled/v3/components/OrCode/lang.js +3 -24
- package/dist/bundled/v3/components/OrCode/theme.js +1 -1
- package/dist/bundled/v3/components/index.d.ts +0 -1
- package/dist/bundled/v3/components/index.js +4 -10
- package/dist/bundled/v3/{index-6a13fa4e.js → index-cf2c3c27.js} +1 -1
- package/dist/bundled/v3/index.js +10 -16
- package/dist/bundled/v3/{index-eba9b646.js → lang-0fb8f78b.js} +22 -2
- package/dist/esm/v2/components/index.d.ts +0 -1
- package/dist/esm/v2/components/index.js +1 -2
- package/dist/esm/v2/index.js +0 -1
- package/dist/esm/v3/components/index.d.ts +0 -1
- package/dist/esm/v3/components/index.js +1 -2
- package/dist/esm/v3/index.js +0 -1
- package/package.json +4 -3
- package/src/components/index.ts +0 -1
- package/dist/bundled/v2/components/OrCodeV3/OrCode.js +0 -333
- package/dist/bundled/v2/components/OrCodeV3/OrCode.vue.d.ts +0 -169
- package/dist/bundled/v2/components/OrCodeV3/index.d.ts +0 -2
- package/dist/bundled/v2/components/OrCodeV3/index.js +0 -49
- package/dist/bundled/v2/components/OrCodeV3/props.d.ts +0 -8
- package/dist/bundled/v2/components/OrCodeV3/props.js +0 -11
- package/dist/bundled/v2/components/OrCodeV3/styles.d.ts +0 -2
- package/dist/bundled/v2/components/OrCodeV3/styles.js +0 -10
- package/dist/bundled/v3/OrCode.vue_vue_type_script_lang-1812e6e4.js +0 -237
- package/dist/bundled/v3/OrCode.vue_vue_type_script_lang-84a512fb.js +0 -200
- package/dist/bundled/v3/components/OrCodeV3/OrCode.js +0 -142
- package/dist/bundled/v3/components/OrCodeV3/OrCode.vue.d.ts +0 -119
- package/dist/bundled/v3/components/OrCodeV3/index.d.ts +0 -2
- package/dist/bundled/v3/components/OrCodeV3/index.js +0 -60
- package/dist/bundled/v3/components/OrCodeV3/props.d.ts +0 -8
- package/dist/bundled/v3/components/OrCodeV3/props.js +0 -11
- package/dist/bundled/v3/components/OrCodeV3/styles.d.ts +0 -2
- package/dist/bundled/v3/components/OrCodeV3/styles.js +0 -10
- package/dist/bundled/v3/index-576b3dec.js +0 -3794
- package/dist/esm/v2/OrCode-ad718022.js +0 -327
- package/dist/esm/v2/components/or-code-v3/OrCode.vue.d.ts +0 -169
- package/dist/esm/v2/components/or-code-v3/index.d.ts +0 -2
- package/dist/esm/v2/components/or-code-v3/index.js +0 -35
- package/dist/esm/v2/components/or-code-v3/props.d.ts +0 -8
- package/dist/esm/v2/components/or-code-v3/styles.d.ts +0 -2
- package/dist/esm/v3/OrCode-8ccd5dc7.js +0 -301
- package/dist/esm/v3/components/or-code-v3/OrCode.vue.d.ts +0 -119
- package/dist/esm/v3/components/or-code-v3/index.d.ts +0 -2
- package/dist/esm/v3/components/or-code-v3/index.js +0 -33
- package/dist/esm/v3/components/or-code-v3/props.d.ts +0 -8
- package/dist/esm/v3/components/or-code-v3/styles.d.ts +0 -2
- package/src/components/or-code-v3/OrCode.vue +0 -338
- package/src/components/or-code-v3/index.ts +0 -2
- package/src/components/or-code-v3/props.ts +0 -8
- package/src/components/or-code-v3/styles.ts +0 -12
|
@@ -1,169 +0,0 @@
|
|
|
1
|
-
import { Extension } from '@codemirror/state';
|
|
2
|
-
import { PropType } from 'vue-demi';
|
|
3
|
-
import { CodeLanguage } from './props';
|
|
4
|
-
declare const _default: import("vue").ComponentOptions<import("vue").default, import("@vue/composition-api").ShallowUnwrapRef<{
|
|
5
|
-
root: import("@vue/composition-api").Ref<HTMLElement | undefined>;
|
|
6
|
-
control: import("@vue/composition-api").Ref<HTMLElement | undefined>;
|
|
7
|
-
fullscreenControl: import("@vue/composition-api").Ref<HTMLElement | undefined>;
|
|
8
|
-
modal: import("@vue/composition-api").Ref<import("@vue/composition-api").ComponentRenderProxy<{} & {}, import("@vue/composition-api").ShallowUnwrapRef<unknown>, unknown, import("@vue/composition-api").ComputedOptions, import("@vue/composition-api").MethodOptions, unknown, unknown, {
|
|
9
|
-
[x: string]: ((...args: any[]) => any) | null;
|
|
10
|
-
} | string[], {} & {}, {
|
|
11
|
-
[x: number]: string;
|
|
12
|
-
} | {}, true> | undefined>;
|
|
13
|
-
rootStyles: import("@vue/composition-api").ComputedRef<string[]>;
|
|
14
|
-
controlStyles: import("@vue/composition-api").ComputedRef<string[]>;
|
|
15
|
-
controlAttributes: {
|
|
16
|
-
required: boolean | undefined;
|
|
17
|
-
minlength: number | undefined;
|
|
18
|
-
maxlength: number | undefined;
|
|
19
|
-
pattern: string | undefined;
|
|
20
|
-
min: number | undefined;
|
|
21
|
-
max: number | undefined;
|
|
22
|
-
step: number | undefined;
|
|
23
|
-
readonly: boolean | undefined;
|
|
24
|
-
disabled: boolean | undefined;
|
|
25
|
-
'force-state': string | undefined;
|
|
26
|
-
id: string | undefined;
|
|
27
|
-
};
|
|
28
|
-
proxyModelValue: import("@vue/composition-api").WritableComputedRef<string>;
|
|
29
|
-
proxyLanguage: import("@vue/composition-api").ComputedRef<import("@codemirror/language").LanguageSupport>;
|
|
30
|
-
focus: () => void;
|
|
31
|
-
blur: () => void;
|
|
32
|
-
}> & import("@vue/composition-api").Data, {}, {}, {
|
|
33
|
-
modelValue: {
|
|
34
|
-
type: StringConstructor;
|
|
35
|
-
default: undefined;
|
|
36
|
-
};
|
|
37
|
-
language: {
|
|
38
|
-
type: PropType<CodeLanguage>;
|
|
39
|
-
default: CodeLanguage;
|
|
40
|
-
};
|
|
41
|
-
extensions: {
|
|
42
|
-
type: PropType<Extension[]>;
|
|
43
|
-
default: () => Extension[];
|
|
44
|
-
};
|
|
45
|
-
label: {
|
|
46
|
-
type: StringConstructor;
|
|
47
|
-
default: undefined;
|
|
48
|
-
};
|
|
49
|
-
hint: {
|
|
50
|
-
type: StringConstructor;
|
|
51
|
-
default: undefined;
|
|
52
|
-
};
|
|
53
|
-
error: {
|
|
54
|
-
type: (BooleanConstructor | StringConstructor)[];
|
|
55
|
-
default: undefined;
|
|
56
|
-
};
|
|
57
|
-
required: {
|
|
58
|
-
type: BooleanConstructor;
|
|
59
|
-
default: boolean;
|
|
60
|
-
};
|
|
61
|
-
readonly: {
|
|
62
|
-
type: BooleanConstructor;
|
|
63
|
-
default: boolean;
|
|
64
|
-
};
|
|
65
|
-
disabled: {
|
|
66
|
-
type: BooleanConstructor;
|
|
67
|
-
default: boolean;
|
|
68
|
-
};
|
|
69
|
-
}, import("@vue/composition-api").ExtractPropTypes<{
|
|
70
|
-
modelValue: {
|
|
71
|
-
type: StringConstructor;
|
|
72
|
-
default: undefined;
|
|
73
|
-
};
|
|
74
|
-
language: {
|
|
75
|
-
type: PropType<CodeLanguage>;
|
|
76
|
-
default: CodeLanguage;
|
|
77
|
-
};
|
|
78
|
-
extensions: {
|
|
79
|
-
type: PropType<Extension[]>;
|
|
80
|
-
default: () => Extension[];
|
|
81
|
-
};
|
|
82
|
-
label: {
|
|
83
|
-
type: StringConstructor;
|
|
84
|
-
default: undefined;
|
|
85
|
-
};
|
|
86
|
-
hint: {
|
|
87
|
-
type: StringConstructor;
|
|
88
|
-
default: undefined;
|
|
89
|
-
};
|
|
90
|
-
error: {
|
|
91
|
-
type: (BooleanConstructor | StringConstructor)[];
|
|
92
|
-
default: undefined;
|
|
93
|
-
};
|
|
94
|
-
required: {
|
|
95
|
-
type: BooleanConstructor;
|
|
96
|
-
default: boolean;
|
|
97
|
-
};
|
|
98
|
-
readonly: {
|
|
99
|
-
type: BooleanConstructor;
|
|
100
|
-
default: boolean;
|
|
101
|
-
};
|
|
102
|
-
disabled: {
|
|
103
|
-
type: BooleanConstructor;
|
|
104
|
-
default: boolean;
|
|
105
|
-
};
|
|
106
|
-
}>> & Omit<import("vue").VueConstructor<import("vue").default>, never> & (new (...args: any[]) => import("@vue/composition-api").ComponentRenderProxy<{
|
|
107
|
-
modelValue: string;
|
|
108
|
-
language: CodeLanguage;
|
|
109
|
-
extensions: Extension[];
|
|
110
|
-
label: string;
|
|
111
|
-
hint: string;
|
|
112
|
-
error: string | boolean;
|
|
113
|
-
required: boolean;
|
|
114
|
-
readonly: boolean;
|
|
115
|
-
disabled: boolean;
|
|
116
|
-
} & {} & {
|
|
117
|
-
[x: `on${Capitalize<string>}`]: ((...args: any[]) => any) | undefined;
|
|
118
|
-
}, import("@vue/composition-api").ShallowUnwrapRef<{
|
|
119
|
-
root: import("@vue/composition-api").Ref<HTMLElement | undefined>;
|
|
120
|
-
control: import("@vue/composition-api").Ref<HTMLElement | undefined>;
|
|
121
|
-
fullscreenControl: import("@vue/composition-api").Ref<HTMLElement | undefined>;
|
|
122
|
-
modal: import("@vue/composition-api").Ref<import("@vue/composition-api").ComponentRenderProxy<{} & {}, import("@vue/composition-api").ShallowUnwrapRef<unknown>, unknown, import("@vue/composition-api").ComputedOptions, import("@vue/composition-api").MethodOptions, unknown, unknown, {
|
|
123
|
-
[x: string]: ((...args: any[]) => any) | null;
|
|
124
|
-
} | string[], {} & {}, {
|
|
125
|
-
[x: number]: string;
|
|
126
|
-
} | {}, true> | undefined>;
|
|
127
|
-
rootStyles: import("@vue/composition-api").ComputedRef<string[]>;
|
|
128
|
-
controlStyles: import("@vue/composition-api").ComputedRef<string[]>;
|
|
129
|
-
controlAttributes: {
|
|
130
|
-
required: boolean | undefined;
|
|
131
|
-
minlength: number | undefined;
|
|
132
|
-
maxlength: number | undefined;
|
|
133
|
-
pattern: string | undefined;
|
|
134
|
-
min: number | undefined;
|
|
135
|
-
max: number | undefined;
|
|
136
|
-
step: number | undefined;
|
|
137
|
-
readonly: boolean | undefined;
|
|
138
|
-
disabled: boolean | undefined;
|
|
139
|
-
'force-state': string | undefined;
|
|
140
|
-
id: string | undefined;
|
|
141
|
-
};
|
|
142
|
-
proxyModelValue: import("@vue/composition-api").WritableComputedRef<string>;
|
|
143
|
-
proxyLanguage: import("@vue/composition-api").ComputedRef<import("@codemirror/language").LanguageSupport>;
|
|
144
|
-
focus: () => void;
|
|
145
|
-
blur: () => void;
|
|
146
|
-
}>, import("@vue/composition-api").Data, {}, {}, {}, {}, string[], {
|
|
147
|
-
modelValue: string;
|
|
148
|
-
language: CodeLanguage;
|
|
149
|
-
extensions: Extension[];
|
|
150
|
-
label: string;
|
|
151
|
-
hint: string;
|
|
152
|
-
error: string | boolean;
|
|
153
|
-
required: boolean;
|
|
154
|
-
readonly: boolean;
|
|
155
|
-
disabled: boolean;
|
|
156
|
-
} & {} & {
|
|
157
|
-
[x: `on${Capitalize<string>}`]: ((...args: any[]) => any) | undefined;
|
|
158
|
-
}, {
|
|
159
|
-
modelValue: string;
|
|
160
|
-
language: CodeLanguage;
|
|
161
|
-
extensions: Extension[];
|
|
162
|
-
label: string;
|
|
163
|
-
hint: string;
|
|
164
|
-
error: string | boolean;
|
|
165
|
-
required: boolean;
|
|
166
|
-
readonly: boolean;
|
|
167
|
-
disabled: boolean;
|
|
168
|
-
}, true>);
|
|
169
|
-
export default _default;
|
|
@@ -1,49 +0,0 @@
|
|
|
1
|
-
export { default as OrCodeV3 } from './OrCode.js';
|
|
2
|
-
export { CodeLanguage } from './props.js';
|
|
3
|
-
import '../../index-576b3dec.js';
|
|
4
|
-
import '../../index-6a13fa4e.js';
|
|
5
|
-
import '../../index-eba9b646.js';
|
|
6
|
-
import 'vue-demi';
|
|
7
|
-
import './styles.js';
|
|
8
|
-
import '../OrErrorV3/OrError.js';
|
|
9
|
-
import '../OrErrorV3/styles.js';
|
|
10
|
-
import '../../normalize-component-6e8e3d80.js';
|
|
11
|
-
import '../OrHintV3/OrHint.js';
|
|
12
|
-
import '../OrHintV3/styles.js';
|
|
13
|
-
import '../OrIconButtonV3/OrIconButton.js';
|
|
14
|
-
import '../OrIconButtonV3/props.js';
|
|
15
|
-
import '../OrIconV3/props.js';
|
|
16
|
-
import '../OrIconButtonV3/styles.js';
|
|
17
|
-
import '../OrIconV3/OrIcon.js';
|
|
18
|
-
import '../OrIconV3/styles.js';
|
|
19
|
-
import '../OrTooltipV3/OrTooltip.js';
|
|
20
|
-
import '../OrTooltipV3/styles.js';
|
|
21
|
-
import '../OrPopoverV3/OrPopover.js';
|
|
22
|
-
import '../../floating-ui.dom.esm-83eba816.js';
|
|
23
|
-
import '../../index-c92e2839.js';
|
|
24
|
-
import '../../index-ec92055d.js';
|
|
25
|
-
import '../OrPopoverV3/props.js';
|
|
26
|
-
import '../OrPopoverV3/styles.js';
|
|
27
|
-
import '../OrBottomSheetV3/OrBottomSheet.js';
|
|
28
|
-
import '../OrBottomSheetV3/props.js';
|
|
29
|
-
import '../OrBottomSheetV3/styles.js';
|
|
30
|
-
import '../OrOverlayV3/OrOverlay.js';
|
|
31
|
-
import '../OrOverlayV3/styles.js';
|
|
32
|
-
import '../OrTeleportV3/OrTeleport.js';
|
|
33
|
-
import 'vue';
|
|
34
|
-
import '../../hooks/useElevation.js';
|
|
35
|
-
import '../../utils/isVisible.js';
|
|
36
|
-
import '../../hooks/usePopoverState.js';
|
|
37
|
-
import '../../hooks/useResponsive/useResponsive.js';
|
|
38
|
-
import '../OrInputBoxV3/OrInputBox.js';
|
|
39
|
-
import '../OrInputBoxV3/props.js';
|
|
40
|
-
import '../OrInputBoxV3/styles.js';
|
|
41
|
-
import '../OrLabelV3/OrLabel.js';
|
|
42
|
-
import '../OrLabelV3/props.js';
|
|
43
|
-
import '../OrLabelV3/styles.js';
|
|
44
|
-
import '../OrModalV3/OrModal.js';
|
|
45
|
-
import '../OrModalV3/props.js';
|
|
46
|
-
import '../OrModalV3/styles.js';
|
|
47
|
-
import '../../hooks/useIdAttribute.js';
|
|
48
|
-
import '../../hooks/useControlAttributes.js';
|
|
49
|
-
import '../../hooks/useValidationAttributes.js';
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
var CodeLanguage;
|
|
2
|
-
(function (CodeLanguage) {
|
|
3
|
-
CodeLanguage["HTML"] = "html";
|
|
4
|
-
CodeLanguage["CSS"] = "css";
|
|
5
|
-
CodeLanguage["JS"] = "js";
|
|
6
|
-
CodeLanguage["TS"] = "ts";
|
|
7
|
-
CodeLanguage["JSON"] = "json";
|
|
8
|
-
CodeLanguage["MD"] = "md";
|
|
9
|
-
})(CodeLanguage || (CodeLanguage = {}));
|
|
10
|
-
|
|
11
|
-
export { CodeLanguage };
|
|
@@ -1,237 +0,0 @@
|
|
|
1
|
-
import { E as EditorView, a as EditorState, k as keymap } from './index-6a13fa4e.js';
|
|
2
|
-
import { b as basicSetup, i as indentWithTab } from './index-576b3dec.js';
|
|
3
|
-
import { a as useElementHover } from './index-09d1cb24.js';
|
|
4
|
-
import { defineComponent, ref } from 'vue-demi';
|
|
5
|
-
import script$3 from './components/OrTeleport/OrTeleport.js';
|
|
6
|
-
import { OrCodeLanguages } from './components/OrCode/constants.js';
|
|
7
|
-
import languages from './components/OrCode/lang.js';
|
|
8
|
-
import theme from './components/OrCode/theme.js';
|
|
9
|
-
import './components/OrIconButtonV2/OrIconButton.js';
|
|
10
|
-
import './components/OrModal/OrModal.js';
|
|
11
|
-
import { s as script$2 } from './OrModal.vue_vue_type_script_lang-153819d3.js';
|
|
12
|
-
import './components/OrError/OrError.js';
|
|
13
|
-
import './components/OrHint/OrHint.js';
|
|
14
|
-
import './components/OrLabel/OrLabel.js';
|
|
15
|
-
import { s as script$1 } from './OrIconButton.vue_vue_type_script_lang-e078ed4c.js';
|
|
16
|
-
import { s as script$4 } from './OrError.vue_vue_type_script_lang-450321b8.js';
|
|
17
|
-
import { s as script$5 } from './OrHint.vue_vue_type_script_lang-5eb3ee22.js';
|
|
18
|
-
import { s as script$6 } from './OrLabel.vue_vue_type_script_lang-6243e348.js';
|
|
19
|
-
|
|
20
|
-
//partially based on https://github.com/logue/vue-codemirror6/blob/master/src/components/CodeMirror.vue
|
|
21
|
-
var script = defineComponent({
|
|
22
|
-
name: 'OrCode',
|
|
23
|
-
components: {
|
|
24
|
-
OrIconButton: script$1,
|
|
25
|
-
OrModal: script$2,
|
|
26
|
-
OrTeleport: script$3,
|
|
27
|
-
OrError: script$4,
|
|
28
|
-
OrHint: script$5,
|
|
29
|
-
OrLabel: script$6
|
|
30
|
-
},
|
|
31
|
-
model: {
|
|
32
|
-
prop: 'modelValue',
|
|
33
|
-
event: 'update:modelValue'
|
|
34
|
-
},
|
|
35
|
-
props: {
|
|
36
|
-
label: {
|
|
37
|
-
type: String,
|
|
38
|
-
default: '',
|
|
39
|
-
required: false
|
|
40
|
-
},
|
|
41
|
-
modelValue: {
|
|
42
|
-
type: String,
|
|
43
|
-
default: '',
|
|
44
|
-
required: false
|
|
45
|
-
},
|
|
46
|
-
language: {
|
|
47
|
-
type: [Object, String],
|
|
48
|
-
required: false,
|
|
49
|
-
default: OrCodeLanguages.JS
|
|
50
|
-
},
|
|
51
|
-
isReadonly: {
|
|
52
|
-
type: Boolean,
|
|
53
|
-
required: false,
|
|
54
|
-
default: false
|
|
55
|
-
},
|
|
56
|
-
extensions: {
|
|
57
|
-
type: Array,
|
|
58
|
-
required: false,
|
|
59
|
-
default: () => [basicSetup]
|
|
60
|
-
},
|
|
61
|
-
phrases: {
|
|
62
|
-
type: Object,
|
|
63
|
-
required: false,
|
|
64
|
-
default: null
|
|
65
|
-
},
|
|
66
|
-
isShowingFullscreen: {
|
|
67
|
-
type: Boolean,
|
|
68
|
-
default: true,
|
|
69
|
-
required: false
|
|
70
|
-
},
|
|
71
|
-
isInvalid: {
|
|
72
|
-
type: Boolean,
|
|
73
|
-
default: false,
|
|
74
|
-
required: false
|
|
75
|
-
},
|
|
76
|
-
error: {
|
|
77
|
-
type: String,
|
|
78
|
-
default: '',
|
|
79
|
-
required: false
|
|
80
|
-
},
|
|
81
|
-
hint: {
|
|
82
|
-
type: String,
|
|
83
|
-
default: '',
|
|
84
|
-
required: false
|
|
85
|
-
},
|
|
86
|
-
allowPaste: {
|
|
87
|
-
type: Boolean,
|
|
88
|
-
default: true
|
|
89
|
-
},
|
|
90
|
-
allowDrop: {
|
|
91
|
-
type: Boolean,
|
|
92
|
-
default: true
|
|
93
|
-
},
|
|
94
|
-
lineWrapping: {
|
|
95
|
-
type: Boolean,
|
|
96
|
-
default: false
|
|
97
|
-
}
|
|
98
|
-
},
|
|
99
|
-
emits: ['update:modelValue', 'focus', 'blur'],
|
|
100
|
-
setup(props, _ref) {
|
|
101
|
-
let {
|
|
102
|
-
emit
|
|
103
|
-
} = _ref;
|
|
104
|
-
// editor config
|
|
105
|
-
const root = ref();
|
|
106
|
-
const target = ref();
|
|
107
|
-
const fullscreenTarget = ref();
|
|
108
|
-
const isHovered = useElementHover(root);
|
|
109
|
-
const editor = new EditorView({
|
|
110
|
-
state: EditorState.create({
|
|
111
|
-
doc: props.modelValue
|
|
112
|
-
}),
|
|
113
|
-
dispatch: tr => {
|
|
114
|
-
editor.update([tr]);
|
|
115
|
-
if (tr.changes.empty) return;
|
|
116
|
-
emit('update:modelValue', editor.state.doc.toString());
|
|
117
|
-
}
|
|
118
|
-
});
|
|
119
|
-
return {
|
|
120
|
-
root,
|
|
121
|
-
target,
|
|
122
|
-
fullscreenTarget,
|
|
123
|
-
editor,
|
|
124
|
-
isHovered
|
|
125
|
-
};
|
|
126
|
-
},
|
|
127
|
-
data() {
|
|
128
|
-
return {
|
|
129
|
-
isFullscreen: false
|
|
130
|
-
};
|
|
131
|
-
},
|
|
132
|
-
computed: {
|
|
133
|
-
localLanguage() {
|
|
134
|
-
if (Object.values(OrCodeLanguages).includes(this.language)) {
|
|
135
|
-
return languages[this.language];
|
|
136
|
-
} else {
|
|
137
|
-
return this.language;
|
|
138
|
-
}
|
|
139
|
-
},
|
|
140
|
-
localExtensions() {
|
|
141
|
-
const {
|
|
142
|
-
allowDrop,
|
|
143
|
-
allowPaste,
|
|
144
|
-
lineWrapping,
|
|
145
|
-
extensions
|
|
146
|
-
} = this;
|
|
147
|
-
let ext = [theme, EditorView.baseTheme({}),
|
|
148
|
-
// locale settings
|
|
149
|
-
this.phrases ? EditorState.phrases.of(this.phrases) : undefined,
|
|
150
|
-
// Parser language setting
|
|
151
|
-
this.localLanguage,
|
|
152
|
-
// Editable option
|
|
153
|
-
EditorView.editable.of(!this.isReadonly),
|
|
154
|
-
// Focus and blur listener
|
|
155
|
-
EditorView.updateListener.of(viewUpdate => {
|
|
156
|
-
if (viewUpdate.focusChanged) {
|
|
157
|
-
viewUpdate.view.hasFocus ? this.$emit('focus') : this.$emit('blur', viewUpdate.state.doc.toString());
|
|
158
|
-
}
|
|
159
|
-
}), EditorView.domEventHandlers({
|
|
160
|
-
drop(event) {
|
|
161
|
-
if (!allowDrop) {
|
|
162
|
-
event.preventDefault();
|
|
163
|
-
return true;
|
|
164
|
-
}
|
|
165
|
-
},
|
|
166
|
-
paste(event) {
|
|
167
|
-
if (!allowPaste) {
|
|
168
|
-
event.preventDefault();
|
|
169
|
-
return true;
|
|
170
|
-
}
|
|
171
|
-
}
|
|
172
|
-
}),
|
|
173
|
-
// line wrapping
|
|
174
|
-
lineWrapping ? EditorView.lineWrapping : undefined, keymap.of([indentWithTab])];
|
|
175
|
-
if (Array.isArray(extensions)) {
|
|
176
|
-
ext = [...ext, ...extensions];
|
|
177
|
-
}
|
|
178
|
-
ext = ext.filter(Boolean);
|
|
179
|
-
return ext;
|
|
180
|
-
},
|
|
181
|
-
isShowingError() {
|
|
182
|
-
return !!this.error && this.isInvalid;
|
|
183
|
-
},
|
|
184
|
-
isShowingHint() {
|
|
185
|
-
return !!this.hint && !this.isShowingError;
|
|
186
|
-
},
|
|
187
|
-
isShowingHeader() {
|
|
188
|
-
var _a;
|
|
189
|
-
return this.isShowingFullscreen || this.$slots.label || this.$slots.actions || ((_a = this.$scopedSlots) === null || _a === void 0 ? void 0 : _a.actions);
|
|
190
|
-
}
|
|
191
|
-
},
|
|
192
|
-
watch: {
|
|
193
|
-
modelValue(value) {
|
|
194
|
-
if (this.editor.composing) return;
|
|
195
|
-
if (this.editor.state.doc.toString() === value) return;
|
|
196
|
-
const previous = this.editor.state.selection;
|
|
197
|
-
this.editor.setState(EditorState.create({
|
|
198
|
-
doc: value,
|
|
199
|
-
extensions: this.localExtensions,
|
|
200
|
-
selection: previous.ranges.some(range => range.to > value.length) ? {
|
|
201
|
-
anchor: value.length
|
|
202
|
-
} : previous
|
|
203
|
-
}));
|
|
204
|
-
},
|
|
205
|
-
isFullscreen(value) {
|
|
206
|
-
if (value) {
|
|
207
|
-
this.fullscreenTarget.append(this.editor.dom);
|
|
208
|
-
} else {
|
|
209
|
-
this.target.append(this.editor.dom);
|
|
210
|
-
}
|
|
211
|
-
},
|
|
212
|
-
localExtensions() {
|
|
213
|
-
this.updateEditorState();
|
|
214
|
-
}
|
|
215
|
-
},
|
|
216
|
-
mounted() {
|
|
217
|
-
this.updateEditorState();
|
|
218
|
-
this.target.append(this.editor.dom);
|
|
219
|
-
},
|
|
220
|
-
beforeUnmount() {
|
|
221
|
-
var _a;
|
|
222
|
-
(_a = this.editor) === null || _a === void 0 ? void 0 : _a.destroy();
|
|
223
|
-
},
|
|
224
|
-
methods: {
|
|
225
|
-
updateEditorState() {
|
|
226
|
-
this.editor.setState(EditorState.create({
|
|
227
|
-
doc: this.modelValue,
|
|
228
|
-
extensions: this.localExtensions
|
|
229
|
-
}));
|
|
230
|
-
},
|
|
231
|
-
toggleFullscreen(value) {
|
|
232
|
-
this.isFullscreen = value === undefined ? !this.isFullscreen : value;
|
|
233
|
-
}
|
|
234
|
-
}
|
|
235
|
-
});
|
|
236
|
-
|
|
237
|
-
export { script as s };
|
|
@@ -1,200 +0,0 @@
|
|
|
1
|
-
import { b as basicSetup, i as indentWithTab } from './index-576b3dec.js';
|
|
2
|
-
import { m as markdown, j as json, a as javascript, c as css, h as html } from './index-eba9b646.js';
|
|
3
|
-
import { E as EditorView, k as keymap, a as EditorState } from './index-6a13fa4e.js';
|
|
4
|
-
import { defineComponent, ref, computed, reactive, watch, onMounted, onUnmounted } from 'vue-demi';
|
|
5
|
-
import { CodeLanguage } from './components/OrCodeV3/props.js';
|
|
6
|
-
import { Code, CodeControl } from './components/OrCodeV3/styles.js';
|
|
7
|
-
import './components/OrErrorV3/OrError.js';
|
|
8
|
-
import './components/OrHintV3/OrHint.js';
|
|
9
|
-
import './components/OrIconButtonV3/OrIconButton.js';
|
|
10
|
-
import './components/OrInputBoxV3/OrInputBox.js';
|
|
11
|
-
import './components/OrLabelV3/OrLabel.js';
|
|
12
|
-
import './components/OrModalV3/OrModal.js';
|
|
13
|
-
import { s as script$6 } from './OrModal.vue_vue_type_script_lang-83469d51.js';
|
|
14
|
-
import { useIdAttribute } from './hooks/useIdAttribute.js';
|
|
15
|
-
import { useControlAttributes } from './hooks/useControlAttributes.js';
|
|
16
|
-
import { useValidationAttributes } from './hooks/useValidationAttributes.js';
|
|
17
|
-
import { s as script$1 } from './OrError.vue_vue_type_script_lang-df7b5e32.js';
|
|
18
|
-
import { s as script$2 } from './OrHint.vue_vue_type_script_lang-0f5e8377.js';
|
|
19
|
-
import { s as script$3 } from './OrIconButton.vue_vue_type_script_lang-c3a78c23.js';
|
|
20
|
-
import { s as script$4 } from './OrInputBox.vue_vue_type_script_lang-49fb179a.js';
|
|
21
|
-
import { s as script$5 } from './OrLabel.vue_vue_type_script_lang-3e11ab8a.js';
|
|
22
|
-
|
|
23
|
-
var script = defineComponent({
|
|
24
|
-
name: 'OrCode',
|
|
25
|
-
components: {
|
|
26
|
-
OrError: script$1,
|
|
27
|
-
OrHint: script$2,
|
|
28
|
-
OrIconButton: script$3,
|
|
29
|
-
OrInputBox: script$4,
|
|
30
|
-
OrLabel: script$5,
|
|
31
|
-
OrModal: script$6
|
|
32
|
-
},
|
|
33
|
-
model: {
|
|
34
|
-
prop: 'modelValue',
|
|
35
|
-
event: 'update:modelValue'
|
|
36
|
-
},
|
|
37
|
-
props: {
|
|
38
|
-
modelValue: {
|
|
39
|
-
type: String,
|
|
40
|
-
default: undefined
|
|
41
|
-
},
|
|
42
|
-
language: {
|
|
43
|
-
type: String,
|
|
44
|
-
default: CodeLanguage.JS
|
|
45
|
-
},
|
|
46
|
-
extensions: {
|
|
47
|
-
type: Array,
|
|
48
|
-
default: () => [basicSetup]
|
|
49
|
-
},
|
|
50
|
-
label: {
|
|
51
|
-
type: String,
|
|
52
|
-
default: undefined
|
|
53
|
-
},
|
|
54
|
-
hint: {
|
|
55
|
-
type: String,
|
|
56
|
-
default: undefined
|
|
57
|
-
},
|
|
58
|
-
error: {
|
|
59
|
-
type: [String, Boolean],
|
|
60
|
-
default: undefined
|
|
61
|
-
},
|
|
62
|
-
required: {
|
|
63
|
-
type: Boolean,
|
|
64
|
-
default: false
|
|
65
|
-
},
|
|
66
|
-
readonly: {
|
|
67
|
-
type: Boolean,
|
|
68
|
-
default: false
|
|
69
|
-
},
|
|
70
|
-
disabled: {
|
|
71
|
-
type: Boolean,
|
|
72
|
-
default: false
|
|
73
|
-
}
|
|
74
|
-
},
|
|
75
|
-
emits: ['update:modelValue', 'keydown', 'keyup', 'focus', 'blur'],
|
|
76
|
-
expose: ['root', 'focus', 'blur'],
|
|
77
|
-
setup(props, context) {
|
|
78
|
-
// Refs
|
|
79
|
-
const root = ref();
|
|
80
|
-
const control = ref();
|
|
81
|
-
const fullscreenControl = ref();
|
|
82
|
-
const modal = ref();
|
|
83
|
-
// Styles
|
|
84
|
-
const rootStyles = computed(() => ['or-code-v3', ...Code]);
|
|
85
|
-
const controlStyles = computed(() => [...CodeControl]);
|
|
86
|
-
// State
|
|
87
|
-
const controlAttributes = reactive({
|
|
88
|
-
id: useIdAttribute(),
|
|
89
|
-
...useControlAttributes(),
|
|
90
|
-
...useValidationAttributes()
|
|
91
|
-
});
|
|
92
|
-
const proxyModelValue = computed({
|
|
93
|
-
get: () => props.modelValue,
|
|
94
|
-
set: value => {
|
|
95
|
-
context.emit('update:modelValue', value);
|
|
96
|
-
}
|
|
97
|
-
});
|
|
98
|
-
const proxyLanguage = computed(() => {
|
|
99
|
-
switch (props.language) {
|
|
100
|
-
case CodeLanguage.HTML:
|
|
101
|
-
return html();
|
|
102
|
-
case CodeLanguage.CSS:
|
|
103
|
-
return css();
|
|
104
|
-
case CodeLanguage.JS:
|
|
105
|
-
return javascript();
|
|
106
|
-
case CodeLanguage.TS:
|
|
107
|
-
return javascript({
|
|
108
|
-
typescript: true
|
|
109
|
-
});
|
|
110
|
-
case CodeLanguage.JSON:
|
|
111
|
-
return json();
|
|
112
|
-
case CodeLanguage.MD:
|
|
113
|
-
return markdown();
|
|
114
|
-
}
|
|
115
|
-
});
|
|
116
|
-
// Methods
|
|
117
|
-
function focus() {
|
|
118
|
-
var _a;
|
|
119
|
-
(_a = control.value) === null || _a === void 0 ? void 0 : _a.focus();
|
|
120
|
-
}
|
|
121
|
-
function blur() {
|
|
122
|
-
var _a;
|
|
123
|
-
(_a = control.value) === null || _a === void 0 ? void 0 : _a.blur();
|
|
124
|
-
}
|
|
125
|
-
// #region Codemirror
|
|
126
|
-
const editorView = new EditorView({
|
|
127
|
-
dispatch: transaction => {
|
|
128
|
-
editorView.update([transaction]);
|
|
129
|
-
proxyModelValue.value = String(editorView.state.doc);
|
|
130
|
-
}
|
|
131
|
-
});
|
|
132
|
-
const extensions = computed(() => [...props.extensions, proxyLanguage.value, keymap.of([indentWithTab]), EditorView.editable.of(!props.readonly && !props.disabled), EditorView.domEventHandlers({
|
|
133
|
-
keydown: event => {
|
|
134
|
-
context.emit('keydown', event);
|
|
135
|
-
},
|
|
136
|
-
keyup: event => {
|
|
137
|
-
context.emit('keyup', event);
|
|
138
|
-
},
|
|
139
|
-
focus: event => {
|
|
140
|
-
context.emit('focus', event);
|
|
141
|
-
},
|
|
142
|
-
blur: event => {
|
|
143
|
-
context.emit('blur', event);
|
|
144
|
-
}
|
|
145
|
-
}), EditorView.baseTheme({})]);
|
|
146
|
-
watch([proxyModelValue, extensions], _ref => {
|
|
147
|
-
let [modelValue = '', extensions] = _ref;
|
|
148
|
-
const {
|
|
149
|
-
selection
|
|
150
|
-
} = editorView.state;
|
|
151
|
-
editorView.setState(EditorState.create({
|
|
152
|
-
doc: modelValue,
|
|
153
|
-
extensions,
|
|
154
|
-
selection: selection.ranges.some(range => range.to > modelValue.length) ? {
|
|
155
|
-
anchor: modelValue.length
|
|
156
|
-
} : selection
|
|
157
|
-
}));
|
|
158
|
-
}, {
|
|
159
|
-
immediate: true
|
|
160
|
-
});
|
|
161
|
-
// #endregion
|
|
162
|
-
// Effects
|
|
163
|
-
watch(() => {
|
|
164
|
-
var _a;
|
|
165
|
-
return (_a = modal.value) === null || _a === void 0 ? void 0 : _a.state;
|
|
166
|
-
}, value => {
|
|
167
|
-
setTimeout(() => {
|
|
168
|
-
var _a, _b;
|
|
169
|
-
if (value === 'open') {
|
|
170
|
-
(_a = fullscreenControl.value) === null || _a === void 0 ? void 0 : _a.append(editorView.dom);
|
|
171
|
-
} else {
|
|
172
|
-
(_b = control.value) === null || _b === void 0 ? void 0 : _b.append(editorView.dom);
|
|
173
|
-
}
|
|
174
|
-
});
|
|
175
|
-
});
|
|
176
|
-
// Lifecycle
|
|
177
|
-
onMounted(() => {
|
|
178
|
-
var _a;
|
|
179
|
-
(_a = control.value) === null || _a === void 0 ? void 0 : _a.append(editorView.dom);
|
|
180
|
-
});
|
|
181
|
-
onUnmounted(() => {
|
|
182
|
-
editorView.destroy();
|
|
183
|
-
});
|
|
184
|
-
return {
|
|
185
|
-
root,
|
|
186
|
-
control,
|
|
187
|
-
fullscreenControl,
|
|
188
|
-
modal,
|
|
189
|
-
rootStyles,
|
|
190
|
-
controlStyles,
|
|
191
|
-
controlAttributes,
|
|
192
|
-
proxyModelValue,
|
|
193
|
-
proxyLanguage,
|
|
194
|
-
focus,
|
|
195
|
-
blur
|
|
196
|
-
};
|
|
197
|
-
}
|
|
198
|
-
});
|
|
199
|
-
|
|
200
|
-
export { script as s };
|