@operato/input 1.5.49 → 1.5.50

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/CHANGELOG.md CHANGED
@@ -3,6 +3,15 @@
3
3
  All notable changes to this project will be documented in this file.
4
4
  See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
5
5
 
6
+ ### [1.5.50](https://github.com/hatiolab/operato/compare/v1.5.49...v1.5.50) (2023-12-07)
7
+
8
+
9
+ ### :bug: Bug Fix
10
+
11
+ * codemirror v6 ([4332ac2](https://github.com/hatiolab/operato/commit/4332ac2fc74ae08bcb3d583a13f5c2469f9a9fcd))
12
+
13
+
14
+
6
15
  ### [1.5.49](https://github.com/hatiolab/operato/compare/v1.5.48...v1.5.49) (2023-12-04)
7
16
 
8
17
 
@@ -1,12 +1,8 @@
1
1
  /**
2
2
  * @license Copyright © HatioLab Inc. All rights reserved.
3
3
  */
4
- import 'codemirror/mode/javascript/javascript';
5
- import 'codemirror/mode/python/python';
6
- import 'codemirror/addon/display/fullscreen';
7
- import 'codemirror/addon/display/autorefresh';
8
- import CodeMirror from 'codemirror';
9
4
  import { PropertyValues } from 'lit';
5
+ import { EditorView } from '@codemirror/view';
10
6
  import { OxFormField } from './ox-form-field';
11
7
  /**
12
8
  WEB Component for code-mirror code editor.
@@ -26,9 +22,8 @@ export declare class OxInputCode extends OxFormField {
26
22
  tabSize: number;
27
23
  tabAsSpace: boolean;
28
24
  private _self_changing;
29
- private _editor;
25
+ private _editor?;
30
26
  private _changed;
31
27
  updated(changes: PropertyValues<this>): void;
32
- render(): import("lit").TemplateResult<1>;
33
- get editor(): CodeMirror.EditorFromTextArea | null | undefined;
28
+ get editor(): EditorView;
34
29
  }
@@ -2,16 +2,14 @@
2
2
  * @license Copyright © HatioLab Inc. All rights reserved.
3
3
  */
4
4
  import { __decorate } from "tslib";
5
- import 'codemirror/mode/javascript/javascript';
6
- import 'codemirror/mode/python/python';
7
- import 'codemirror/addon/display/fullscreen';
8
- import 'codemirror/addon/display/autorefresh';
9
- import FullScreenStyle from '!!text-loader!codemirror/addon/display/fullscreen.css';
10
- import CodeMirrorStyle from '!!text-loader!codemirror/lib/codemirror.css';
11
- import NightThemeStyle from '!!text-loader!codemirror/theme/night.css';
12
- import CodeMirror from 'codemirror';
13
- import { css, html, unsafeCSS } from 'lit';
5
+ import { css } from 'lit';
14
6
  import { customElement, property } from 'lit/decorators.js';
7
+ import { history, historyKeymap, indentWithTab } from '@codemirror/commands';
8
+ import { EditorView, highlightActiveLine, keymap } from '@codemirror/view';
9
+ import { autocompletion, closeBrackets } from '@codemirror/autocomplete';
10
+ import { bracketMatching, syntaxHighlighting } from '@codemirror/language';
11
+ import { oneDarkHighlightStyle, oneDark } from '@codemirror/theme-one-dark';
12
+ import { javascript } from '@codemirror/lang-javascript';
15
13
  import { ScrollbarStyles } from '@operato/styles';
16
14
  import { togglefullscreen } from '@operato/utils';
17
15
  import { OxFormField } from './ox-form-field';
@@ -33,118 +31,68 @@ let OxInputCode = class OxInputCode extends OxFormField {
33
31
  this.tabSize = 2;
34
32
  this.tabAsSpace = true;
35
33
  this._self_changing = false;
36
- this._editor = null;
37
34
  this._changed = false;
38
35
  }
39
36
  static { this.styles = [
40
37
  ScrollbarStyles,
41
38
  css `
42
- ${unsafeCSS(CodeMirrorStyle)}
43
- ${unsafeCSS(FullScreenStyle)}
44
- ${unsafeCSS(NightThemeStyle)}
45
- `,
46
- css `
47
39
  :host {
48
40
  display: flex;
49
41
  flex-direction: column;
50
42
  position: relative;
43
+ background: white;
51
44
  }
52
45
 
53
- .CodeMirror {
46
+ .cm-editor {
54
47
  flex: 1;
55
48
  }
56
-
57
- textarea {
58
- display: block;
59
- height: 100%;
60
- width: 100%;
61
- resize: none;
62
- font-size: 16px;
63
- line-height: 20px;
64
- border: 0px;
65
- padding: 0px;
66
- }
67
-
68
- #fs-toggle:not(:fullscreen) {
69
- background-color: #afa;
70
- }
71
-
72
- .CodeMirror-fullscreen {
73
- position: fixed;
74
- top: 0;
75
- left: 0;
76
- width: 100%;
77
- height: 100%;
78
- z-index: 9999;
79
- }
80
49
  `
81
50
  ]; }
82
- // private lint: any
83
- // private hintOptions: any
84
51
  updated(changes) {
85
52
  if (changes.has('value') && this.editor && !this._self_changing) {
86
- this.editor?.setValue(this.value === undefined ? '' : String(this.value));
87
- this.editor?.refresh();
53
+ const to = this.editor.state.doc.toString().length;
54
+ this.editor.dispatch({
55
+ changes: { from: 0, to, insert: this.value === undefined ? '' : String(this.value) }
56
+ });
88
57
  }
89
58
  }
90
- render() {
91
- return html ` <textarea></textarea> `;
92
- }
93
59
  get editor() {
94
60
  if (!this._editor) {
95
- let textarea = this.renderRoot.querySelector('textarea');
96
- let mode = this.mode || 'javascript';
97
- let tabSize = Number(this.tabSize) || 2;
98
- let indentUnit = tabSize;
99
- // let lint = this.lint
100
- // let hintOptions = this.hintOptions
101
- let tabAsSpace = this.tabAsSpace;
102
- if (textarea) {
103
- this._editor = CodeMirror.fromTextArea(textarea, {
104
- value: this.value,
105
- mode,
106
- // lint,
107
- // hintOptions,
108
- tabSize,
109
- indentUnit,
110
- lineNumbers: false,
111
- showCursorWhenSelecting: true,
112
- theme: 'night',
113
- extraKeys: {
114
- F11: function (cm) {
115
- cm.setOption('fullScreen', !cm.getOption('fullScreen'));
116
- },
117
- Esc: function (cm) {
118
- // cm.setOption('fullScreen', !cm.getOption('fullScreen'))
119
- togglefullscreen(cm.getWrapperElement());
120
- },
121
- // https://github.com/codemirror/CodeMirror/issues/988#issuecomment-37095621
122
- Tab: tabAsSpace
123
- ? function (cm) {
124
- cm.replaceSelection(Array(cm.getOption('tabSize')).join(' '));
61
+ this._editor = new EditorView({
62
+ doc: this.value,
63
+ extensions: [
64
+ bracketMatching(),
65
+ closeBrackets(),
66
+ history(),
67
+ autocompletion(),
68
+ oneDark,
69
+ syntaxHighlighting(oneDarkHighlightStyle),
70
+ highlightActiveLine(),
71
+ javascript(),
72
+ keymap.of([
73
+ ...historyKeymap,
74
+ indentWithTab,
75
+ {
76
+ key: 'Escape',
77
+ run: (view) => {
78
+ togglefullscreen(this);
79
+ return true;
125
80
  }
126
- : false
127
- },
128
- autoRefresh: {
129
- delay: 500
130
- }
131
- });
132
- this._editor.on('blur', e => {
133
- if (!this._changed)
134
- return;
135
- this.value = e.getValue();
136
- this.dispatchEvent(new CustomEvent('change', { bubbles: true, composed: true, detail: this.value }));
137
- });
138
- this._editor.on('change', async (e) => {
139
- this._self_changing = true;
140
- this._changed = true;
141
- await this.updateComplete;
142
- this._self_changing = false;
143
- });
144
- this._editor.on('keydown', async (_, e) => {
145
- e.stopPropagation();
146
- });
147
- }
81
+ }
82
+ ]),
83
+ EditorView.updateListener.of(v => {
84
+ if (v.docChanged) {
85
+ this._self_changing = true;
86
+ this.value = v.state.doc.toString();
87
+ this.dispatchEvent(new CustomEvent('change', { bubbles: true, composed: true, detail: this.value }));
88
+ requestAnimationFrame(() => {
89
+ this._self_changing = false;
90
+ });
91
+ }
92
+ })
93
+ ],
94
+ parent: this.renderRoot
95
+ });
148
96
  }
149
97
  return this._editor;
150
98
  }
@@ -1 +1 @@
1
- {"version":3,"file":"ox-input-code.js","sourceRoot":"","sources":["../../src/ox-input-code.ts"],"names":[],"mappings":"AAAA;;GAEG;;AAEH,OAAO,uCAAuC,CAAA;AAC9C,OAAO,+BAA+B,CAAA;AACtC,OAAO,qCAAqC,CAAA;AAC5C,OAAO,sCAAsC,CAAA;AAE7C,OAAO,eAAe,MAAM,uDAAuD,CAAA;AACnF,OAAO,eAAe,MAAM,6CAA6C,CAAA;AACzE,OAAO,eAAe,MAAM,0CAA0C,CAAA;AACtE,OAAO,UAAU,MAAM,YAAY,CAAA;AACnC,OAAO,EAAE,GAAG,EAAE,IAAI,EAAkB,SAAS,EAAE,MAAM,KAAK,CAAA;AAC1D,OAAO,EAAE,aAAa,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAA;AAE3D,OAAO,EAAE,eAAe,EAAE,MAAM,iBAAiB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Inc. All rights reserved.\n */\n\nimport 'codemirror/mode/javascript/javascript'\nimport 'codemirror/mode/python/python'\nimport 'codemirror/addon/display/fullscreen'\nimport 'codemirror/addon/display/autorefresh'\n\nimport FullScreenStyle from '!!text-loader!codemirror/addon/display/fullscreen.css'\nimport CodeMirrorStyle from '!!text-loader!codemirror/lib/codemirror.css'\nimport NightThemeStyle from '!!text-loader!codemirror/theme/night.css'\nimport CodeMirror from 'codemirror'\nimport { css, html, PropertyValues, unsafeCSS } from 'lit'\nimport { customElement, property } from 'lit/decorators.js'\n\nimport { ScrollbarStyles } from '@operato/styles'\nimport { togglefullscreen } from '@operato/utils'\n\nimport { OxFormField } from './ox-form-field'\n\n/**\nWEB Component for code-mirror code editor.\n\nExample:\n\n <ox-input-code .value=${text} mode=${mode} tab-size=\"4\" tab-as-space=\"true\">\n </ox-input-code>\n*/\n@customElement('ox-input-code')\nexport class OxInputCode extends OxFormField {\n static styles = [\n ScrollbarStyles,\n css`\n ${unsafeCSS(CodeMirrorStyle)}\n ${unsafeCSS(FullScreenStyle)}\n ${unsafeCSS(NightThemeStyle)}\n `,\n css`\n :host {\n display: flex;\n flex-direction: column;\n position: relative;\n }\n\n .CodeMirror {\n flex: 1;\n }\n\n textarea {\n display: block;\n height: 100%;\n width: 100%;\n resize: none;\n font-size: 16px;\n line-height: 20px;\n border: 0px;\n padding: 0px;\n }\n\n #fs-toggle:not(:fullscreen) {\n background-color: #afa;\n }\n\n .CodeMirror-fullscreen {\n position: fixed;\n top: 0;\n left: 0;\n width: 100%;\n height: 100%;\n z-index: 9999;\n }\n `\n ]\n\n /**\n * `value`는 에디터에서 작성중인 contents이다.\n */\n @property({ type: String }) value: string = ''\n @property({ type: String }) mode?: string\n @property({ type: Number, attribute: 'tab-size' }) tabSize: number = 2\n @property({ type: Boolean, attribute: 'tab-as-space' }) tabAsSpace: boolean = true\n\n private _self_changing: boolean = false\n private _editor: CodeMirror.EditorFromTextArea | null | undefined = null\n private _changed: boolean = false\n\n // private lint: any\n // private hintOptions: any\n\n updated(changes: PropertyValues<this>) {\n if (changes.has('value') && this.editor && !this._self_changing) {\n this.editor?.setValue(this.value === undefined ? '' : String(this.value))\n this.editor?.refresh()\n }\n }\n\n render() {\n return html` <textarea></textarea> `\n }\n\n get editor() {\n if (!this._editor) {\n let textarea = this.renderRoot.querySelector('textarea')\n let mode = this.mode || 'javascript'\n let tabSize = Number(this.tabSize) || 2\n let indentUnit = tabSize\n // let lint = this.lint\n // let hintOptions = this.hintOptions\n let tabAsSpace = this.tabAsSpace\n\n if (textarea) {\n this._editor = CodeMirror.fromTextArea(textarea, {\n value: this.value,\n mode,\n // lint,\n // hintOptions,\n tabSize,\n indentUnit,\n lineNumbers: false,\n showCursorWhenSelecting: true,\n theme: 'night',\n extraKeys: {\n F11: function (cm) {\n cm.setOption('fullScreen', !cm.getOption('fullScreen'))\n },\n Esc: function (cm) {\n // cm.setOption('fullScreen', !cm.getOption('fullScreen'))\n togglefullscreen(cm.getWrapperElement())\n },\n // https://github.com/codemirror/CodeMirror/issues/988#issuecomment-37095621\n Tab: tabAsSpace\n ? function (cm: CodeMirror.Editor) {\n cm.replaceSelection(Array(cm.getOption('tabSize')).join(' '))\n }\n : false\n },\n autoRefresh: {\n delay: 500\n }\n })\n\n this._editor.on('blur', e => {\n if (!this._changed) return\n\n this.value = e.getValue()\n this.dispatchEvent(new CustomEvent('change', { bubbles: true, composed: true, detail: this.value }))\n })\n\n this._editor.on('change', async e => {\n this._self_changing = true\n\n this._changed = true\n\n await this.updateComplete\n this._self_changing = false\n })\n\n this._editor.on('keydown', async (_: any, e: Event) => {\n e.stopPropagation()\n })\n }\n }\n\n return this._editor\n }\n}\n"]}
1
+ {"version":3,"file":"ox-input-code.js","sourceRoot":"","sources":["../../src/ox-input-code.ts"],"names":[],"mappings":"AAAA;;GAEG;;AAEH,OAAO,EAAE,GAAG,EAAkB,MAAM,KAAK,CAAA;AACzC,OAAO,EAAE,aAAa,EAAE,QAAQ,EAAE,MAAM,m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,KAAK,CAAA;4BAC7B,CAAC,CAAC,CAAA;wBACJ,CAAC;oBACH,CAAC,CAAC;iBACH;gBACD,MAAM,EAAE,IAAI,CAAC,UAAU;aACxB,CAAC,CAAA;QACJ,CAAC;QAED,OAAO,IAAI,CAAC,OAAO,CAAA;IACrB,CAAC;;AA1D2B;IAA3B,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;0CAAmB;AAClB;IAA3B,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;yCAAc;AACU;IAAlD,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,SAAS,EAAE,UAAU,EAAE,CAAC;4CAAoB;AACd;IAAvD,QAAQ,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,SAAS,EAAE,cAAc,EAAE,CAAC;+CAA2B;AAvBvE,WAAW;IADvB,aAAa,CAAC,eAAe,CAAC;GAClB,WAAW,CA+EvB","sourcesContent":["/**\n * @license Copyright © HatioLab Inc. All rights reserved.\n */\n\nimport { css, PropertyValues } from 'lit'\nimport { customElement, property } from 'lit/decorators.js'\n\nimport { history, historyKeymap, indentWithTab } from '@codemirror/commands'\nimport { EditorView, highlightActiveLine, keymap } from '@codemirror/view'\nimport { EditorState } from '@codemirror/state'\nimport { autocompletion, closeBrackets } from '@codemirror/autocomplete'\nimport { bracketMatching, syntaxHighlighting } from '@codemirror/language'\nimport { oneDarkHighlightStyle, oneDark } from '@codemirror/theme-one-dark'\n\nimport { javascript } from '@codemirror/lang-javascript'\n\nimport { ScrollbarStyles } from '@operato/styles'\nimport { togglefullscreen } from '@operato/utils'\n\nimport { OxFormField } from './ox-form-field'\n\n/**\nWEB Component for code-mirror code editor.\n\nExample:\n\n <ox-input-code .value=${text} mode=${mode} tab-size=\"4\" tab-as-space=\"true\">\n </ox-input-code>\n*/\n@customElement('ox-input-code')\nexport class OxInputCode extends OxFormField {\n static styles = [\n ScrollbarStyles,\n css`\n :host {\n display: flex;\n flex-direction: column;\n position: relative;\n background: white;\n }\n\n .cm-editor {\n flex: 1;\n }\n `\n ]\n\n /**\n * `value`는 에디터에서 작성중인 contents이다.\n */\n @property({ type: String }) value: string = ''\n @property({ type: String }) mode?: string\n @property({ type: Number, attribute: 'tab-size' }) tabSize: number = 2\n @property({ type: Boolean, attribute: 'tab-as-space' }) tabAsSpace: boolean = true\n\n private _self_changing: boolean = false\n private _editor?: EditorView\n private _changed: boolean = false\n\n updated(changes: PropertyValues<this>) {\n if (changes.has('value') && this.editor && !this._self_changing) {\n const to = this.editor.state.doc.toString().length\n this.editor.dispatch({\n changes: { from: 0, to, insert: this.value === undefined ? '' : String(this.value) }\n })\n }\n }\n\n get editor() {\n if (!this._editor) {\n this._editor = new EditorView({\n doc: this.value,\n extensions: [\n bracketMatching(),\n closeBrackets(),\n history(),\n autocompletion(),\n oneDark,\n syntaxHighlighting(oneDarkHighlightStyle),\n highlightActiveLine(),\n javascript(),\n keymap.of([\n ...historyKeymap,\n indentWithTab,\n {\n key: 'Escape',\n run: (view: EditorView) => {\n togglefullscreen(this)\n return true\n }\n }\n ]),\n EditorView.updateListener.of(v => {\n if (v.docChanged) {\n this._self_changing = true\n this.value = v.state.doc.toString()\n this.dispatchEvent(new CustomEvent('change', { bubbles: true, composed: true, detail: this.value }))\n requestAnimationFrame(() => {\n this._self_changing = false\n })\n }\n })\n ],\n parent: this.renderRoot\n })\n }\n\n return this._editor\n }\n}\n"]}
@@ -0,0 +1,29 @@
1
+ /**
2
+ * @license Copyright © HatioLab Inc. All rights reserved.
3
+ */
4
+ import { PropertyValues } from 'lit';
5
+ import { EditorView } from '@codemirror/view';
6
+ import { OxFormField } from './ox-form-field';
7
+ /**
8
+ WEB Component for code-mirror code editor.
9
+
10
+ Example:
11
+
12
+ <ox-input-code .value=${text} mode=${mode} tab-size="4" tab-as-space="true">
13
+ </ox-input-code>
14
+ */
15
+ export declare class OxInputCode extends OxFormField {
16
+ static styles: import("lit").CSSResult[];
17
+ /**
18
+ * `value`는 에디터에서 작성중인 contents이다.
19
+ */
20
+ value: string;
21
+ mode?: string;
22
+ tabSize: number;
23
+ tabAsSpace: boolean;
24
+ private _self_changing;
25
+ private _editor?;
26
+ private _changed;
27
+ updated(changes: PropertyValues<this>): void;
28
+ get editor(): EditorView;
29
+ }
@@ -0,0 +1,108 @@
1
+ /**
2
+ * @license Copyright © HatioLab Inc. All rights reserved.
3
+ */
4
+ import { __decorate } from "tslib";
5
+ import { css } from 'lit';
6
+ import { customElement, property } from 'lit/decorators.js';
7
+ import { history, historyKeymap, indentWithTab } from '@codemirror/commands';
8
+ import { EditorView, highlightActiveLine, keymap } from '@codemirror/view';
9
+ import { javascript } from '@codemirror/lang-javascript';
10
+ import { ScrollbarStyles } from '@operato/styles';
11
+ import { togglefullscreen } from '@operato/utils';
12
+ import { OxFormField } from './ox-form-field';
13
+ /**
14
+ WEB Component for code-mirror code editor.
15
+
16
+ Example:
17
+
18
+ <ox-input-code .value=${text} mode=${mode} tab-size="4" tab-as-space="true">
19
+ </ox-input-code>
20
+ */
21
+ let OxInputCode = class OxInputCode extends OxFormField {
22
+ constructor() {
23
+ super(...arguments);
24
+ /**
25
+ * `value`는 에디터에서 작성중인 contents이다.
26
+ */
27
+ this.value = '';
28
+ this.tabSize = 2;
29
+ this.tabAsSpace = true;
30
+ this._self_changing = false;
31
+ this._changed = false;
32
+ }
33
+ static { this.styles = [
34
+ ScrollbarStyles,
35
+ css `
36
+ :host {
37
+ display: flex;
38
+ flex-direction: column;
39
+ position: relative;
40
+ background: white;
41
+ }
42
+
43
+ .cm-editor {
44
+ flex: 1;
45
+ }
46
+ `
47
+ ]; }
48
+ updated(changes) {
49
+ if (changes.has('value') && this.editor && !this._self_changing) {
50
+ const to = this.editor.state.doc.toString().length;
51
+ this.editor.dispatch({
52
+ changes: { from: 0, to, insert: this.value === undefined ? '' : String(this.value) }
53
+ });
54
+ }
55
+ }
56
+ get editor() {
57
+ if (!this._editor) {
58
+ this._editor = new EditorView({
59
+ doc: this.value,
60
+ extensions: [
61
+ highlightActiveLine(),
62
+ history(),
63
+ javascript(),
64
+ keymap.of([
65
+ ...historyKeymap,
66
+ indentWithTab,
67
+ {
68
+ key: 'Escape',
69
+ run: (view) => {
70
+ togglefullscreen(this);
71
+ return true;
72
+ }
73
+ }
74
+ ]),
75
+ EditorView.updateListener.of(v => {
76
+ if (v.docChanged) {
77
+ this._self_changing = true;
78
+ this.value = v.state.doc.toString();
79
+ this.dispatchEvent(new CustomEvent('change', { bubbles: true, composed: true, detail: this.value }));
80
+ requestAnimationFrame(() => {
81
+ this._self_changing = false;
82
+ });
83
+ }
84
+ })
85
+ ],
86
+ parent: this.renderRoot
87
+ });
88
+ }
89
+ return this._editor;
90
+ }
91
+ };
92
+ __decorate([
93
+ property({ type: String })
94
+ ], OxInputCode.prototype, "value", void 0);
95
+ __decorate([
96
+ property({ type: String })
97
+ ], OxInputCode.prototype, "mode", void 0);
98
+ __decorate([
99
+ property({ type: Number, attribute: 'tab-size' })
100
+ ], OxInputCode.prototype, "tabSize", void 0);
101
+ __decorate([
102
+ property({ type: Boolean, attribute: 'tab-as-space' })
103
+ ], OxInputCode.prototype, "tabAsSpace", void 0);
104
+ OxInputCode = __decorate([
105
+ customElement('ox-input-code')
106
+ ], OxInputCode);
107
+ export { OxInputCode };
108
+ //# sourceMappingURL=ox-input-graphql.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ox-input-graphql.js","sourceRoot":"","sources":["../../src/ox-input-graphql.ts"],"names":[],"mappings":"AAAA;;GAEG;;AAEH,OAAO,EAAE,GAAG,EAAkB,MAAM,KAAK,CAAA;AACzC,OAAO,EAAE,aAAa,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAA;AAE3D,OAAO,EAAE,OAAO,EAAE,aAAa,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAA;AAC5E,OAAO,EAAE,UAAU,EAAE,mBAAmB,EAAE,MAAM,EAAE,MAAM,kBAAkB,CAAA;AAC1E,OAAO,EAA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AAS,EAAE,cAAc,EAAE,CAAC;+CAA2B;AAvBvE,WAAW;IADvB,aAAa,CAAC,eAAe,CAAC;GAClB,WAAW,CA0EvB","sourcesContent":["/**\n * @license Copyright © HatioLab Inc. All rights reserved.\n */\n\nimport { css, PropertyValues } from 'lit'\nimport { customElement, property } from 'lit/decorators.js'\n\nimport { history, historyKeymap, indentWithTab } from '@codemirror/commands'\nimport { EditorView, highlightActiveLine, keymap } from '@codemirror/view'\nimport { javascript } from '@codemirror/lang-javascript'\nimport { ScrollbarStyles } from '@operato/styles'\nimport { togglefullscreen } from '@operato/utils'\n\nimport { OxFormField } from './ox-form-field'\n\n/**\nWEB Component for code-mirror code editor.\n\nExample:\n\n <ox-input-code .value=${text} mode=${mode} tab-size=\"4\" tab-as-space=\"true\">\n </ox-input-code>\n*/\n@customElement('ox-input-code')\nexport class OxInputCode extends OxFormField {\n static styles = [\n ScrollbarStyles,\n css`\n :host {\n display: flex;\n flex-direction: column;\n position: relative;\n background: white;\n }\n\n .cm-editor {\n flex: 1;\n }\n `\n ]\n\n /**\n * `value`는 에디터에서 작성중인 contents이다.\n */\n @property({ type: String }) value: string = ''\n @property({ type: String }) mode?: string\n @property({ type: Number, attribute: 'tab-size' }) tabSize: number = 2\n @property({ type: Boolean, attribute: 'tab-as-space' }) tabAsSpace: boolean = true\n\n private _self_changing: boolean = false\n private _editor?: EditorView\n private _changed: boolean = false\n\n updated(changes: PropertyValues<this>) {\n if (changes.has('value') && this.editor && !this._self_changing) {\n const to = this.editor.state.doc.toString().length\n this.editor.dispatch({\n changes: { from: 0, to, insert: this.value === undefined ? '' : String(this.value) }\n })\n }\n }\n\n get editor() {\n if (!this._editor) {\n this._editor = new EditorView({\n doc: this.value,\n extensions: [\n highlightActiveLine(),\n history(),\n javascript(),\n keymap.of([\n ...historyKeymap,\n indentWithTab,\n {\n key: 'Escape',\n run: (view: EditorView) => {\n togglefullscreen(this)\n return true\n }\n }\n ]),\n EditorView.updateListener.of(v => {\n if (v.docChanged) {\n this._self_changing = true\n this.value = v.state.doc.toString()\n this.dispatchEvent(new CustomEvent('change', { bubbles: true, composed: true, detail: this.value }))\n requestAnimationFrame(() => {\n this._self_changing = false\n })\n }\n })\n ],\n parent: this.renderRoot\n })\n }\n\n return this._editor\n }\n}\n"]}
@@ -0,0 +1,25 @@
1
+ import '../src/ox-input-code.js';
2
+ import { TemplateResult } from 'lit';
3
+ declare const _default: {
4
+ title: string;
5
+ component: string;
6
+ argTypes: {
7
+ value: {
8
+ control: string;
9
+ };
10
+ name: {
11
+ control: string;
12
+ };
13
+ };
14
+ };
15
+ export default _default;
16
+ interface Story<T> {
17
+ (args: T): TemplateResult;
18
+ args?: Partial<T>;
19
+ argTypes?: Record<string, unknown>;
20
+ }
21
+ interface ArgTypes {
22
+ name?: string;
23
+ value?: string;
24
+ }
25
+ export declare const Regular: Story<ArgTypes>;
@@ -0,0 +1,33 @@
1
+ import '../src/ox-input-code.js';
2
+ import { html } from 'lit';
3
+ export default {
4
+ title: 'ox-input-code',
5
+ component: 'ox-input-code',
6
+ argTypes: {
7
+ value: { control: 'text' },
8
+ name: { control: 'text' }
9
+ }
10
+ };
11
+ const Template = ({ name = 'code', value = '' }) => html `
12
+ <link href="/themes/app-theme.css" rel="stylesheet" />
13
+ <link href="https://fonts.googleapis.com/css?family=Material+Icons&display=block" rel="stylesheet" />
14
+ <style>
15
+ body {
16
+ }
17
+ </style>
18
+
19
+ <ox-input-code
20
+ @change=${(e) => {
21
+ console.log(e.target.value);
22
+ }}
23
+ name=${name}
24
+ .value=${value}
25
+ >
26
+ </ox-input-code>
27
+ `;
28
+ export const Regular = Template.bind({});
29
+ Regular.args = {
30
+ name: 'code',
31
+ value: ''
32
+ };
33
+ //# sourceMappingURL=ox-input-code.stories.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ox-input-code.stories.js","sourceRoot":"","sources":["../../stories/ox-input-code.stories.ts"],"names":[],"mappings":"AAAA,OAAO,yBAAyB,CAAA;AAEhC,OAAO,EAAE,IAAI,EAAkB,MAAM,KAAK,CAAA;AAE1C,eAAe;IACb,KAAK,EAAE,eAAe;IACtB,SAAS,EAAE,eAAe;IAC1B,QAAQ,EAAE;QACR,KAAK,EAAE,EAAE,OAAO,EAAE,MAAM,EAAE;QAC1B,IAAI,EAAE,EAAE,OAAO,EAAE,MAAM,EAAE;KAC1B;CACF,CAAA;AAaD,MAAM,QAAQ,GAAoB,CAAC,EAAE,IAAI,GAAG,MAAM,EAAE,KAAK,GAAG,EAAE,EAAY,EAAE,EAAE,CAAC,IAAI,CAAA;;;;;;;;;cASrE,CAAC,CAAQ,EAAE,EAAE;IACrB,OAAO,CAAC,GAAG,CAAE,CAAC,CAAC,MAA2B,CAAC,KAAK,CAAC,CAAA;AACnD,CAAC;WACM,IAAI;aACF,KAAK;;;CAGjB,CAAA;AAED,MAAM,CAAC,MAAM,OAAO,GAAG,QAAQ,CAAC,IAAI,CAAC,EAAE,CAAC,CAAA;AACxC,OAAO,CAAC,IAAI,GAAG;IACb,IAAI,EAAE,MAAM;IACZ,KAAK,EAAE,EAAE;CACV,CAAA","sourcesContent":["import '../src/ox-input-code.js'\n\nimport { html, TemplateResult } from 'lit'\n\nexport default {\n title: 'ox-input-code',\n component: 'ox-input-code',\n argTypes: {\n value: { control: 'text' },\n name: { control: 'text' }\n }\n}\n\ninterface Story<T> {\n (args: T): TemplateResult\n args?: Partial<T>\n argTypes?: Record<string, unknown>\n}\n\ninterface ArgTypes {\n name?: string\n value?: string\n}\n\nconst Template: Story<ArgTypes> = ({ name = 'code', value = '' }: ArgTypes) => html`\n <link href=\"/themes/app-theme.css\" rel=\"stylesheet\" />\n <link href=\"https://fonts.googleapis.com/css?family=Material+Icons&display=block\" rel=\"stylesheet\" />\n <style>\n body {\n }\n </style>\n\n <ox-input-code\n @change=${(e: Event) => {\n console.log((e.target as HTMLInputElement).value)\n }}\n name=${name}\n .value=${value}\n >\n </ox-input-code>\n`\n\nexport const Regular = Template.bind({})\nRegular.args = {\n name: 'code',\n value: ''\n}\n"]}
@@ -0,0 +1,25 @@
1
+ import '../src/ox-input-graphql.js';
2
+ import { TemplateResult } from 'lit';
3
+ declare const _default: {
4
+ title: string;
5
+ component: string;
6
+ argTypes: {
7
+ value: {
8
+ control: string;
9
+ };
10
+ name: {
11
+ control: string;
12
+ };
13
+ };
14
+ };
15
+ export default _default;
16
+ interface Story<T> {
17
+ (args: T): TemplateResult;
18
+ args?: Partial<T>;
19
+ argTypes?: Record<string, unknown>;
20
+ }
21
+ interface ArgTypes {
22
+ name?: string;
23
+ value?: string;
24
+ }
25
+ export declare const Regular: Story<ArgTypes>;
@@ -0,0 +1,44 @@
1
+ import '../src/ox-input-graphql.js';
2
+ import { html } from 'lit';
3
+ export default {
4
+ title: 'ox-input-graphql',
5
+ component: 'ox-input-graphql',
6
+ argTypes: {
7
+ value: { control: 'text' },
8
+ name: { control: 'text' }
9
+ }
10
+ };
11
+ const Template = ({ name = 'code', value = '' }) => html `
12
+ <link href="/themes/app-theme.css" rel="stylesheet" />
13
+ <link href="https://fonts.googleapis.com/css?family=Material+Icons&display=block" rel="stylesheet" />
14
+ <style>
15
+ body {
16
+ }
17
+ </style>
18
+
19
+ <ox-input-graphql
20
+ @change=${(e) => {
21
+ console.log(e.target.value);
22
+ }}
23
+ name=${name}
24
+ .value=${value}
25
+ >
26
+ </ox-input-graphql>
27
+ `;
28
+ export const Regular = Template.bind({});
29
+ Regular.args = {
30
+ name: 'code',
31
+ value: `
32
+ query privileges {
33
+ privileges {
34
+ items {
35
+ privilege
36
+ category
37
+ description
38
+ }
39
+ total
40
+ }
41
+ }
42
+ `
43
+ };
44
+ //# sourceMappingURL=ox-input-graphql.stories.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ox-input-graphql.stories.js","sourceRoot":"","sources":["../../stories/ox-input-graphql.stories.ts"],"names":[],"mappings":"AAAA,OAAO,4BAA4B,CAAA;AAEnC,OAAO,EAAE,IAAI,EAAkB,MAAM,KAAK,CAAA;AAE1C,eAAe;IACb,KAAK,EAAE,kBAAkB;IACzB,SAAS,EAAE,kBAAkB;IAC7B,QAAQ,EAAE;QACR,KAAK,EAAE,EAAE,OAAO,EAAE,MAAM,EAAE;QAC1B,IAAI,EAAE,EAAE,OAAO,EAAE,MAAM,EAAE;KAC1B;CACF,CAAA;AAaD,MAAM,QAAQ,GAAoB,CAAC,EAAE,IAAI,GAAG,MAAM,EAAE,KAAK,GAAG,EAAE,EAAY,EAAE,EAAE,CAAC,IAAI,CAAA;;;;;;;;;cASrE,CAAC,CAAQ,EAAE,EAAE;IACrB,OAAO,CAAC,GAAG,CAAE,CAAC,CAAC,MAA2B,CAAC,KAAK,CAAC,CAAA;AACnD,CAAC;WACM,IAAI;aACF,KAAK;;;CAGjB,CAAA;AAED,MAAM,CAAC,MAAM,OAAO,GAAG,QAAQ,CAAC,IAAI,CAAC,EAAE,CAAC,CAAA;AACxC,OAAO,CAAC,IAAI,GAAG;IACb,IAAI,EAAE,MAAM;IACZ,KAAK,EAAE;;;;;;;;;;;CAWR;CACA,CAAA","sourcesContent":["import '../src/ox-input-graphql.js'\n\nimport { html, TemplateResult } from 'lit'\n\nexport default {\n title: 'ox-input-graphql',\n component: 'ox-input-graphql',\n argTypes: {\n value: { control: 'text' },\n name: { control: 'text' }\n }\n}\n\ninterface Story<T> {\n (args: T): TemplateResult\n args?: Partial<T>\n argTypes?: Record<string, unknown>\n}\n\ninterface ArgTypes {\n name?: string\n value?: string\n}\n\nconst Template: Story<ArgTypes> = ({ name = 'code', value = '' }: ArgTypes) => html`\n <link href=\"/themes/app-theme.css\" rel=\"stylesheet\" />\n <link href=\"https://fonts.googleapis.com/css?family=Material+Icons&display=block\" rel=\"stylesheet\" />\n <style>\n body {\n }\n </style>\n\n <ox-input-graphql\n @change=${(e: Event) => {\n console.log((e.target as HTMLInputElement).value)\n }}\n name=${name}\n .value=${value}\n >\n </ox-input-graphql>\n`\n\nexport const Regular = Template.bind({})\nRegular.args = {\n name: 'code',\n value: `\nquery privileges {\n privileges {\n items {\n privilege\n category\n description\n }\n total\n }\n}\n`\n}\n"]}