@onereach/ui-components 4.10.0 → 4.10.1-beta.2921.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.
Files changed (63) hide show
  1. package/dist/bundled/v2/components/OrCode/OrCode.js +4 -3792
  2. package/dist/bundled/v2/components/OrCode/index.js +4 -2
  3. package/dist/bundled/v2/components/OrCode/lang.js +24 -3
  4. package/dist/bundled/v2/components/OrCode/theme.js +1 -1
  5. package/dist/bundled/v2/components/OrCodeV3/OrCode.js +333 -0
  6. package/dist/bundled/v2/components/OrCodeV3/OrCode.vue.d.ts +169 -0
  7. package/dist/bundled/v2/components/OrCodeV3/index.d.ts +2 -0
  8. package/dist/bundled/v2/components/OrCodeV3/index.js +49 -0
  9. package/dist/bundled/v2/components/OrCodeV3/props.d.ts +8 -0
  10. package/dist/bundled/v2/components/OrCodeV3/props.js +11 -0
  11. package/dist/bundled/v2/components/OrCodeV3/styles.d.ts +2 -0
  12. package/dist/bundled/v2/components/OrCodeV3/styles.js +10 -0
  13. package/dist/bundled/v2/components/OrModalV3/OrModal.js +2 -2
  14. package/dist/bundled/v2/components/index.d.ts +1 -0
  15. package/dist/bundled/v2/components/index.js +8 -3
  16. package/dist/bundled/{v3/OrCode.vue_vue_type_script_lang-46846a36.js → v2/index-576b3dec.js} +3 -235
  17. package/dist/bundled/v2/{index-cf2c3c27.js → index-6a13fa4e.js} +1 -1
  18. package/dist/bundled/v2/{lang-0fb8f78b.js → index-eba9b646.js} +2 -22
  19. package/dist/bundled/v2/index.js +9 -4
  20. package/dist/bundled/v3/OrCode.vue_vue_type_script_lang-1812e6e4.js +237 -0
  21. package/dist/bundled/v3/OrCode.vue_vue_type_script_lang-84a512fb.js +200 -0
  22. package/dist/bundled/v3/components/OrCode/OrCode.js +7 -5
  23. package/dist/bundled/v3/components/OrCode/index.js +5 -3
  24. package/dist/bundled/v3/components/OrCode/lang.js +24 -3
  25. package/dist/bundled/v3/components/OrCode/theme.js +1 -1
  26. package/dist/bundled/v3/components/OrCodeV3/OrCode.js +142 -0
  27. package/dist/bundled/v3/components/OrCodeV3/OrCode.vue.d.ts +119 -0
  28. package/dist/bundled/v3/components/OrCodeV3/index.d.ts +2 -0
  29. package/dist/bundled/v3/components/OrCodeV3/index.js +60 -0
  30. package/dist/bundled/v3/components/OrCodeV3/props.d.ts +8 -0
  31. package/dist/bundled/v3/components/OrCodeV3/props.js +11 -0
  32. package/dist/bundled/v3/components/OrCodeV3/styles.d.ts +2 -0
  33. package/dist/bundled/v3/components/OrCodeV3/styles.js +10 -0
  34. package/dist/bundled/v3/components/index.d.ts +1 -0
  35. package/dist/bundled/v3/components/index.js +10 -4
  36. package/dist/bundled/v3/index-576b3dec.js +3794 -0
  37. package/dist/bundled/v3/{index-cf2c3c27.js → index-6a13fa4e.js} +1 -1
  38. package/dist/bundled/v3/{lang-0fb8f78b.js → index-eba9b646.js} +2 -22
  39. package/dist/bundled/v3/index.js +16 -10
  40. package/dist/esm/v2/OrCode-ad718022.js +327 -0
  41. package/dist/esm/v2/components/index.d.ts +1 -0
  42. package/dist/esm/v2/components/index.js +2 -1
  43. package/dist/esm/v2/components/or-code-v3/OrCode.vue.d.ts +169 -0
  44. package/dist/esm/v2/components/or-code-v3/index.d.ts +2 -0
  45. package/dist/esm/v2/components/or-code-v3/index.js +35 -0
  46. package/dist/esm/v2/components/or-code-v3/props.d.ts +8 -0
  47. package/dist/esm/v2/components/or-code-v3/styles.d.ts +2 -0
  48. package/dist/esm/v2/index.js +1 -0
  49. package/dist/esm/v3/OrCode-8ccd5dc7.js +301 -0
  50. package/dist/esm/v3/components/index.d.ts +1 -0
  51. package/dist/esm/v3/components/index.js +2 -1
  52. package/dist/esm/v3/components/or-code-v3/OrCode.vue.d.ts +119 -0
  53. package/dist/esm/v3/components/or-code-v3/index.d.ts +2 -0
  54. package/dist/esm/v3/components/or-code-v3/index.js +33 -0
  55. package/dist/esm/v3/components/or-code-v3/props.d.ts +8 -0
  56. package/dist/esm/v3/components/or-code-v3/styles.d.ts +2 -0
  57. package/dist/esm/v3/index.js +1 -0
  58. package/package.json +2 -3
  59. package/src/components/index.ts +1 -0
  60. package/src/components/or-code-v3/OrCode.vue +338 -0
  61. package/src/components/or-code-v3/index.ts +2 -0
  62. package/src/components/or-code-v3/props.ts +8 -0
  63. package/src/components/or-code-v3/styles.ts +12 -0
@@ -27,6 +27,8 @@ export { default as OrChip } from './OrChip/OrChip.js';
27
27
  export { default as OrChips } from './OrChips/OrChips.js';
28
28
  export { default as OrCode } from './OrCode/OrCode.js';
29
29
  export { OrCodeLanguages } from './OrCode/constants.js';
30
+ export { default as OrCodeV3 } from './OrCodeV3/OrCode.js';
31
+ export { CodeLanguage } from './OrCodeV3/props.js';
30
32
  export { default as OrCollapse } from './OrCollapse/OrCollapse.js';
31
33
  export { default as OrColorPicker } from './OrColorPicker/OrColorPicker.js';
32
34
  export { amber, black, blue, blueGrey, brown, cyan, deepOrange, deepPurple, green, indigo, lightBlue, lightGreen, lime, orange, pink, purple, red, teal, white, yellow } from './OrColorPicker/constants.js';
@@ -216,9 +218,13 @@ import '../utils/isEmptyValue.js';
216
218
  import './OrCheckboxV3/styles.js';
217
219
  import './OrFormGroupV3/styles.js';
218
220
  import './OrChips/constants.js';
219
- import '../index-cf2c3c27.js';
220
- import '../lang-0fb8f78b.js';
221
+ import '../index-6a13fa4e.js';
222
+ import '../index-576b3dec.js';
223
+ import '../index-eba9b646.js';
224
+ import './OrCode/lang.js';
221
225
  import './OrCode/theme.js';
226
+ import './OrCodeV3/styles.js';
227
+ import './OrModalV3/styles.js';
222
228
  import './OrColorPicker/utils/defultPalette.js';
223
229
  import './OrCombinedInputV3/styles.js';
224
230
  import '../index-15e8c1f3.js';
@@ -249,7 +255,6 @@ import '../isArrayLike-acf249e3.js';
249
255
  import '../_baseAssignValue-0c6c3bcc.js';
250
256
  import '../isEqual-881b7bb5.js';
251
257
  import '../v4-cf8987a3.js';
252
- import './OrModalV3/styles.js';
253
258
  import './OrNotificationV3/styles.js';
254
259
  import './OrPaginationV3/styles.js';
255
260
  import '../hooks/useToggle.js';
@@ -1,20 +1,5 @@
1
- import { E as EditorView, F as Facet, c as combineConfig, S as StateField, a as EditorSelection, T as Transaction, C as ChangeSet, b as ChangeDesc, I as IndentContext, g as getIndentation, i as indentString, d as Text, e as indentUnit, f as countColumn, h as getIndentUnit, A as Annotation, j as StateEffect, m as matchBrackets, s as syntaxTree, N as NodeProp, D as Direction, k as findClusterBreak, V as ViewPlugin, l as Decoration, n as codePointAt, o as codePointSize, p as getPanel, q as CharCategory, P as Prec, r as fromCodePoint, t as showPanel, R as RangeSetBuilder, u as EditorState, v as runScopeHandlers, w as hoverTooltip, W as WidgetType, x as logException, y as lineNumbers, z as highlightActiveLineGutter, B as highlightSpecialChars, G as foldGutter, H as drawSelection, J as dropCursor, K as indentOnInput, L as syntaxHighlighting, M as defaultHighlightStyle, O as bracketMatching, Q as rectangularSelection, U as crosshairCursor, X as highlightActiveLine, Y as keymap, Z as foldKeymap } from './index-cf2c3c27.js';
2
- import { c as closeBrackets, a as autocompletion, b as closeBracketsKeymap, d as completionKeymap, l as languages } from './lang-0fb8f78b.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 theme from './components/OrCode/theme.js';
8
- import './components/OrIconButtonV2/OrIconButton.js';
9
- import './components/OrModal/OrModal.js';
10
- import { s as script$2 } from './OrModal.vue_vue_type_script_lang-153819d3.js';
11
- import './components/OrError/OrError.js';
12
- import './components/OrHint/OrHint.js';
13
- import './components/OrLabel/OrLabel.js';
14
- import { s as script$1 } from './OrIconButton.vue_vue_type_script_lang-e078ed4c.js';
15
- import { s as script$4 } from './OrError.vue_vue_type_script_lang-450321b8.js';
16
- import { s as script$5 } from './OrHint.vue_vue_type_script_lang-5eb3ee22.js';
17
- import { s as script$6 } from './OrLabel.vue_vue_type_script_lang-6243e348.js';
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, y as logException, z as lineNumbers, B as highlightActiveLineGutter, G as highlightSpecialChars, H as foldGutter, J as drawSelection, K as dropCursor, L as indentOnInput, M as syntaxHighlighting, O as defaultHighlightStyle, Q as bracketMatching, U as rectangularSelection, X as crosshairCursor, Y as highlightActiveLine, k as keymap, Z as foldKeymap } from './index-6a13fa4e.js';
2
+ import { b as closeBrackets, d as autocompletion, e as closeBracketsKeymap, f as completionKeymap } from './index-eba9b646.js';
18
3
 
19
4
  /**
20
5
  Comment or uncomment the current selection. Will use line comments
@@ -3806,221 +3791,4 @@ const basicSetup = /*@__PURE__*/(() => [lineNumbers(), highlightActiveLineGutter
3806
3791
  fallback: true
3807
3792
  }), bracketMatching(), closeBrackets(), autocompletion(), rectangularSelection(), crosshairCursor(), highlightActiveLine(), highlightSelectionMatches(), keymap.of([...closeBracketsKeymap, ...defaultKeymap, ...searchKeymap, ...historyKeymap, ...foldKeymap, ...completionKeymap, ...lintKeymap])])();
3808
3793
 
3809
- //partially based on https://github.com/logue/vue-codemirror6/blob/master/src/components/CodeMirror.vue
3810
- var script = defineComponent({
3811
- name: 'OrCode',
3812
- components: {
3813
- OrIconButton: script$1,
3814
- OrModal: script$2,
3815
- OrTeleport: script$3,
3816
- OrError: script$4,
3817
- OrHint: script$5,
3818
- OrLabel: script$6
3819
- },
3820
- model: {
3821
- prop: 'modelValue',
3822
- event: 'update:modelValue'
3823
- },
3824
- props: {
3825
- label: {
3826
- type: String,
3827
- default: '',
3828
- required: false
3829
- },
3830
- modelValue: {
3831
- type: String,
3832
- default: '',
3833
- required: false
3834
- },
3835
- language: {
3836
- type: [Object, String],
3837
- required: false,
3838
- default: OrCodeLanguages.JS
3839
- },
3840
- isReadonly: {
3841
- type: Boolean,
3842
- required: false,
3843
- default: false
3844
- },
3845
- extensions: {
3846
- type: Array,
3847
- required: false,
3848
- default: () => [basicSetup]
3849
- },
3850
- phrases: {
3851
- type: Object,
3852
- required: false,
3853
- default: null
3854
- },
3855
- isShowingFullscreen: {
3856
- type: Boolean,
3857
- default: true,
3858
- required: false
3859
- },
3860
- isInvalid: {
3861
- type: Boolean,
3862
- default: false,
3863
- required: false
3864
- },
3865
- error: {
3866
- type: String,
3867
- default: '',
3868
- required: false
3869
- },
3870
- hint: {
3871
- type: String,
3872
- default: '',
3873
- required: false
3874
- },
3875
- allowPaste: {
3876
- type: Boolean,
3877
- default: true
3878
- },
3879
- allowDrop: {
3880
- type: Boolean,
3881
- default: true
3882
- },
3883
- lineWrapping: {
3884
- type: Boolean,
3885
- default: false
3886
- }
3887
- },
3888
- emits: ['update:modelValue', 'focus', 'blur'],
3889
- setup(props, _ref) {
3890
- let {
3891
- emit
3892
- } = _ref;
3893
- // editor config
3894
- const root = ref();
3895
- const target = ref();
3896
- const fullscreenTarget = ref();
3897
- const isHovered = useElementHover(root);
3898
- const editor = new EditorView({
3899
- state: EditorState.create({
3900
- doc: props.modelValue
3901
- }),
3902
- dispatch: tr => {
3903
- editor.update([tr]);
3904
- if (tr.changes.empty) return;
3905
- emit('update:modelValue', editor.state.doc.toString());
3906
- }
3907
- });
3908
- return {
3909
- root,
3910
- target,
3911
- fullscreenTarget,
3912
- editor,
3913
- isHovered
3914
- };
3915
- },
3916
- data() {
3917
- return {
3918
- isFullscreen: false
3919
- };
3920
- },
3921
- computed: {
3922
- localLanguage() {
3923
- if (Object.values(OrCodeLanguages).includes(this.language)) {
3924
- return languages[this.language];
3925
- } else {
3926
- return this.language;
3927
- }
3928
- },
3929
- localExtensions() {
3930
- const {
3931
- allowDrop,
3932
- allowPaste,
3933
- lineWrapping,
3934
- extensions
3935
- } = this;
3936
- let ext = [theme, EditorView.baseTheme({}),
3937
- // locale settings
3938
- this.phrases ? EditorState.phrases.of(this.phrases) : undefined,
3939
- // Parser language setting
3940
- this.localLanguage,
3941
- // Editable option
3942
- EditorView.editable.of(!this.isReadonly),
3943
- // Focus and blur listener
3944
- EditorView.updateListener.of(viewUpdate => {
3945
- if (viewUpdate.focusChanged) {
3946
- viewUpdate.view.hasFocus ? this.$emit('focus') : this.$emit('blur', viewUpdate.state.doc.toString());
3947
- }
3948
- }), EditorView.domEventHandlers({
3949
- drop(event) {
3950
- if (!allowDrop) {
3951
- event.preventDefault();
3952
- return true;
3953
- }
3954
- },
3955
- paste(event) {
3956
- if (!allowPaste) {
3957
- event.preventDefault();
3958
- return true;
3959
- }
3960
- }
3961
- }),
3962
- // line wrapping
3963
- lineWrapping ? EditorView.lineWrapping : undefined, keymap.of([indentWithTab])];
3964
- if (Array.isArray(extensions)) {
3965
- ext = [...ext, ...extensions];
3966
- }
3967
- ext = ext.filter(Boolean);
3968
- return ext;
3969
- },
3970
- isShowingError() {
3971
- return !!this.error && this.isInvalid;
3972
- },
3973
- isShowingHint() {
3974
- return !!this.hint && !this.isShowingError;
3975
- },
3976
- isShowingHeader() {
3977
- var _a;
3978
- return this.isShowingFullscreen || this.$slots.label || this.$slots.actions || ((_a = this.$scopedSlots) === null || _a === void 0 ? void 0 : _a.actions);
3979
- }
3980
- },
3981
- watch: {
3982
- modelValue(value) {
3983
- if (this.editor.composing) return;
3984
- if (this.editor.state.doc.toString() === value) return;
3985
- const previous = this.editor.state.selection;
3986
- this.editor.setState(EditorState.create({
3987
- doc: value,
3988
- extensions: this.localExtensions,
3989
- selection: previous.ranges.some(range => range.to > value.length) ? {
3990
- anchor: value.length
3991
- } : previous
3992
- }));
3993
- },
3994
- isFullscreen(value) {
3995
- if (value) {
3996
- this.fullscreenTarget.append(this.editor.dom);
3997
- } else {
3998
- this.target.append(this.editor.dom);
3999
- }
4000
- },
4001
- localExtensions() {
4002
- this.updateEditorState();
4003
- }
4004
- },
4005
- mounted() {
4006
- this.updateEditorState();
4007
- this.target.append(this.editor.dom);
4008
- },
4009
- beforeUnmount() {
4010
- var _a;
4011
- (_a = this.editor) === null || _a === void 0 ? void 0 : _a.destroy();
4012
- },
4013
- methods: {
4014
- updateEditorState() {
4015
- this.editor.setState(EditorState.create({
4016
- doc: this.modelValue,
4017
- extensions: this.localExtensions
4018
- }));
4019
- },
4020
- toggleFullscreen(value) {
4021
- this.isFullscreen = value === undefined ? !this.isFullscreen : value;
4022
- }
4023
- }
4024
- });
4025
-
4026
- export { script as s };
3794
+ export { basicSetup as b, indentWithTab as i };
@@ -18388,4 +18388,4 @@ function createTokenType(extra, tagStr) {
18388
18388
  return type.id;
18389
18389
  }
18390
18390
 
18391
- export { getTooltip as $, Annotation as A, highlightSpecialChars as B, ChangeSet as C, Direction as D, EditorView as E, Facet as F, foldGutter as G, drawSelection as H, IndentContext as I, dropCursor as J, indentOnInput as K, syntaxHighlighting as L, defaultHighlightStyle as M, NodeProp as N, bracketMatching as O, Prec as P, rectangularSelection as Q, RangeSetBuilder as R, StateField as S, Transaction as T, crosshairCursor as U, ViewPlugin as V, WidgetType as W, highlightActiveLine as X, keymap as Y, foldKeymap as Z, showTooltip as _, EditorSelection as a, MapMode as a0, RangeValue as a1, RangeSet as a2, Parser as a3, NodeSet as a4, NodeType as a5, DefaultBufferLength as a6, Tree as a7, IterMode as a8, styleTags as a9, tags as aa, parseMixed as ab, LanguageSupport as ac, LRLanguage as ad, indentNodeProp as ae, continuedIndent as af, foldNodeProp as ag, foldInside as ah, flatIndent as ai, delimitedIndent as aj, NodeWeakMap as ak, Tag as al, Language as am, defineLanguageFacet as an, languageDataProp as ao, LanguageDescription as ap, ParseContext as aq, HighlightStyle as ar, ChangeDesc as b, combineConfig as c, Text as d, indentUnit as e, countColumn as f, getIndentation as g, getIndentUnit as h, indentString as i, StateEffect as j, findClusterBreak as k, Decoration as l, matchBrackets as m, codePointAt as n, codePointSize as o, getPanel as p, CharCategory as q, fromCodePoint as r, syntaxTree as s, showPanel as t, EditorState as u, runScopeHandlers as v, hoverTooltip as w, logException as x, lineNumbers as y, highlightActiveLineGutter as z };
18391
+ export { tags as $, Annotation as A, highlightActiveLineGutter as B, ChangeSet as C, Direction as D, EditorView as E, Facet as F, highlightSpecialChars as G, foldGutter as H, IndentContext as I, drawSelection as J, dropCursor as K, indentOnInput as L, syntaxHighlighting as M, NodeProp as N, defaultHighlightStyle as O, Prec as P, bracketMatching as Q, RangeSetBuilder as R, StateField as S, Transaction as T, rectangularSelection as U, ViewPlugin as V, WidgetType as W, crosshairCursor as X, highlightActiveLine as Y, foldKeymap as Z, HighlightStyle as _, EditorState as a, showTooltip as a0, getTooltip as a1, MapMode as a2, RangeValue as a3, RangeSet as a4, Parser as a5, NodeSet as a6, NodeType as a7, DefaultBufferLength as a8, Tree as a9, IterMode as aa, styleTags as ab, parseMixed as ac, LanguageSupport as ad, LRLanguage as ae, indentNodeProp as af, continuedIndent as ag, foldNodeProp as ah, foldInside as ai, flatIndent as aj, delimitedIndent as ak, NodeWeakMap as al, Tag as am, Language as an, defineLanguageFacet as ao, languageDataProp as ap, LanguageDescription as aq, ParseContext as ar, EditorSelection as b, combineConfig as c, ChangeDesc as d, Text as e, indentUnit as f, getIndentation as g, countColumn as h, indentString as i, getIndentUnit as j, keymap as k, StateEffect as l, matchBrackets as m, findClusterBreak as n, Decoration as o, codePointAt as p, codePointSize as q, getPanel as r, syntaxTree as s, CharCategory as t, fromCodePoint as u, showPanel as v, runScopeHandlers as w, hoverTooltip as x, logException as y, lineNumbers as z };
@@ -1,5 +1,4 @@
1
- import { s as syntaxTree, E as EditorView, o as codePointSize, n as codePointAt, a as EditorSelection, q as CharCategory, P as Prec, Y as keymap, F as Facet, c as combineConfig, S as StateField, _ as showTooltip, $ as getTooltip, V as ViewPlugin, x as logException, j as StateEffect, a0 as MapMode, a1 as RangeValue, a2 as RangeSet, r as fromCodePoint, A as Annotation, d as Text, e as indentUnit, l as Decoration, D as Direction, W as WidgetType, a3 as Parser, a4 as NodeSet, a5 as NodeType, a6 as DefaultBufferLength, N as NodeProp, a7 as Tree, a8 as IterMode, a9 as styleTags, aa as tags$1, ab as parseMixed, ac as LanguageSupport, ad as LRLanguage, ae as indentNodeProp, af as continuedIndent, ag as foldNodeProp, ah as foldInside, ai as flatIndent, aj as delimitedIndent, ak as NodeWeakMap, al as Tag, am as Language, an as defineLanguageFacet, ao as languageDataProp, ap as LanguageDescription, aq as ParseContext } from './index-cf2c3c27.js';
2
- import { OrCodeLanguages } from './components/OrCode/constants.js';
1
+ import { s as syntaxTree, E as EditorView, q as codePointSize, p as codePointAt, b as EditorSelection, t as CharCategory, P as Prec, k as keymap, F as Facet, c as combineConfig, S as StateField, a0 as showTooltip, a1 as getTooltip, V as ViewPlugin, y as logException, l as StateEffect, a2 as MapMode, a3 as RangeValue, a4 as RangeSet, u as fromCodePoint, A as Annotation, e as Text, f as indentUnit, o as Decoration, D as Direction, W as WidgetType, a5 as Parser, a6 as NodeSet, a7 as NodeType, a8 as DefaultBufferLength, N as NodeProp, a9 as Tree, aa as IterMode, ab as styleTags, $ as tags$1, ac as parseMixed, ad as LanguageSupport, ae as LRLanguage, af as indentNodeProp, ag as continuedIndent, ah as foldNodeProp, ai as foldInside, aj as flatIndent, ak as delimitedIndent, al as NodeWeakMap, am as Tag, an as Language, ao as defineLanguageFacet, ap as languageDataProp, aq as LanguageDescription, ar as ParseContext } from './index-6a13fa4e.js';
3
2
 
4
3
  /**
5
4
  An instance of this is passed to completion source functions.
@@ -7868,23 +7867,4 @@ function markdown() {
7868
7867
  return new LanguageSupport(mkLang(parser.configure(extensions)), support);
7869
7868
  }
7870
7869
 
7871
- const JS = javascript({
7872
- typescript: false
7873
- });
7874
- const TS = javascript({
7875
- typescript: true
7876
- });
7877
- const CSS = css();
7878
- const HTML = html();
7879
- const JSON$1 = json();
7880
- const MD = markdown();
7881
- var languages = {
7882
- [OrCodeLanguages.JS]: JS,
7883
- [OrCodeLanguages.TS]: TS,
7884
- [OrCodeLanguages.CSS]: CSS,
7885
- [OrCodeLanguages.HTML]: HTML,
7886
- [OrCodeLanguages.JSON]: JSON$1,
7887
- [OrCodeLanguages.MD]: MD
7888
- };
7889
-
7890
- export { CSS as C, HTML as H, JS as J, MD as M, TS as T, autocompletion as a, closeBracketsKeymap as b, closeBrackets as c, completionKeymap as d, JSON$1 as e, languages as l };
7870
+ export { javascript as a, closeBrackets as b, css as c, autocompletion as d, closeBracketsKeymap as e, completionKeymap as f, html as h, json as j, markdown as m };
@@ -14,6 +14,7 @@ export { default as OrCheckboxGroupV3 } from './components/OrCheckboxGroupV3/OrC
14
14
  export { default as OrChip } from './components/OrChip/OrChip.js';
15
15
  export { default as OrChips } from './components/OrChips/OrChips.js';
16
16
  export { default as OrCode } from './components/OrCode/OrCode.js';
17
+ export { default as OrCodeV3 } from './components/OrCodeV3/OrCode.js';
17
18
  export { default as OrColorPicker } from './components/OrColorPicker/OrColorPicker.js';
18
19
  export { default as OrCombinedInputV3 } from './components/OrCombinedInputV3/OrCombinedInput.js';
19
20
  export { default as OrConfirm } from './components/OrConfirm/OrConfirm.js';
@@ -29,7 +30,6 @@ export { default as OrInlineTextEdit } from './components/OrInlineTextEdit/OrInl
29
30
  export { default as OrInlineTextareaV3 } from './components/OrInlineTextareaV3/OrInlineTextarea.js';
30
31
  export { default as OrLinkV3 } from './components/OrLinkV3/OrLink.js';
31
32
  export { default as OrListOfInputs } from './components/OrListOfInputs/OrListOfInputs.js';
32
- export { default as OrModalV3 } from './components/OrModalV3/OrModal.js';
33
33
  export { default as OrNotification } from './components/OrNotification/OrNotification.js';
34
34
  export { default as OrNotificationV3 } from './components/OrNotificationV3/OrNotification.js';
35
35
  export { default as OrNumberInput } from './components/OrNumberInput/OrNumberInput.js';
@@ -87,6 +87,7 @@ export { DefaultCardCollectionViews, defaultViewModes, gridView, listView } from
87
87
  export { default as OrCheckboxTreeV3 } from './components/OrCheckboxTreeV3/OrCheckboxTree.js';
88
88
  export { default as OrCheckboxV3 } from './components/OrCheckboxV3/OrCheckbox.js';
89
89
  export { OrCodeLanguages } from './components/OrCode/constants.js';
90
+ export { CodeLanguage } from './components/OrCodeV3/props.js';
90
91
  export { default as OrCollapse } from './components/OrCollapse/OrCollapse.js';
91
92
  export { amber, black, blue, blueGrey, brown, cyan, deepOrange, deepPurple, green, indigo, lightBlue, lightGreen, lime, orange, pink, purple, red, teal, white, yellow } from './components/OrColorPicker/constants.js';
92
93
  export { InputBoxSize as CombinedInputSize, InputBoxSize as DatePickerSize, InputBoxSize as DateTimePickerSize, InputBoxSize, InputBoxVariant, InputBoxSize as InputSize, InputBoxSize as SearchSize, InputBoxSize as SelectSize, InputBoxSize as TagInputSize, InputBoxSize as TextareaSize, InputBoxSize as TimePickerSize } from './components/OrInputBoxV3/props.js';
@@ -133,6 +134,7 @@ export { default as OrMenuV3 } from './components/OrMenuV3/OrMenu.js';
133
134
  export { PopoverPlacement as MenuPlacement, PopoverPlacement, PopoverVariant, PopoverPlacement as TooltipPlacement } from './components/OrPopoverV3/props.js';
134
135
  export { default as OrModal } from './components/OrModal/OrModal.js';
135
136
  export { OrModalSizes } from './components/OrModal/constants.js';
137
+ export { default as OrModalV3 } from './components/OrModalV3/OrModal.js';
136
138
  export { ModalSize } from './components/OrModalV3/props.js';
137
139
  export { OR_NOTIFICATION_SIZE, OR_NOTIFICATION_TYPE } from './components/OrNotification/constants.js';
138
140
  export { NotificationVariant } from './components/OrNotificationV3/props.js';
@@ -191,9 +193,12 @@ import './components/OrCarousel/constants.js';
191
193
  import './index-c92e2839.js';
192
194
  import './index-ec92055d.js';
193
195
  import './components/OrChips/constants.js';
194
- import './index-cf2c3c27.js';
195
- import './lang-0fb8f78b.js';
196
+ import './index-6a13fa4e.js';
197
+ import './index-576b3dec.js';
198
+ import './index-eba9b646.js';
199
+ import './components/OrCode/lang.js';
196
200
  import './components/OrCode/theme.js';
201
+ import './components/OrCodeV3/styles.js';
197
202
  import './components/OrColorPicker/utils/defultPalette.js';
198
203
  import './components/OrCombinedInputV3/styles.js';
199
204
  import './index-15e8c1f3.js';
@@ -222,7 +227,6 @@ import './components/OrFabV3/styles.js';
222
227
  import './components/OrInlineInputV3/styles.js';
223
228
  import './components/OrInlineTextareaV3/styles.js';
224
229
  import './components/OrLinkV3/styles.js';
225
- import './components/OrModalV3/styles.js';
226
230
  import './components/OrNotificationV3/styles.js';
227
231
  import './components/OrPaginationV3/styles.js';
228
232
  import './round-136c7e43.js';
@@ -270,6 +274,7 @@ import './components/OrLabelV3/styles.js';
270
274
  import './components/OrLoaderV3/styles.js';
271
275
  import './components/OrMenuItemV3/styles.js';
272
276
  import './components/OrMenuV3/styles.js';
277
+ import './components/OrModalV3/styles.js';
273
278
  import './components/OrOverlayV3/styles.js';
274
279
  import './components/OrPopoverV3/styles.js';
275
280
  import './components/OrRadioV3/styles.js';
@@ -0,0 +1,237 @@
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 };