@operato/input 1.5.53 → 1.7.2
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 +9 -0
- package/dist/src/ox-input-code.d.ts +1 -0
- package/dist/src/ox-input-code.js +20 -1
- package/dist/src/ox-input-code.js.map +1 -1
- package/dist/stories/ox-input-code.stories.d.ts +5 -0
- package/dist/stories/ox-input-code.stories.js +6 -3
- package/dist/stories/ox-input-code.stories.js.map +1 -1
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +4 -2
- package/src/ox-input-code.ts +19 -2
- package/stories/ox-input-code.stories.ts +7 -3
- package/yarn-error.log +17084 -0
- package/dist/src/ox-input-graphql.d.ts +0 -29
- package/dist/src/ox-input-graphql.js +0 -108
- package/dist/src/ox-input-graphql.js.map +0 -1
- package/src/ox-input-graphql.ts +0 -99
@@ -1,29 +0,0 @@
|
|
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
|
-
}
|
@@ -1,108 +0,0 @@
|
|
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
|
@@ -1 +0,0 @@
|
|
1
|
-
{"version":3,"file":"ox-input-graphql.js","sourceRoot":"","sources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AAO,IAAI,CAAC,OAAO,CAAA;IACrB,CAAC;;AArD2B;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,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"]}
|
package/src/ox-input-graphql.ts
DELETED
@@ -1,99 +0,0 @@
|
|
1
|
-
/**
|
2
|
-
* @license Copyright © HatioLab Inc. All rights reserved.
|
3
|
-
*/
|
4
|
-
|
5
|
-
import { css, PropertyValues } from 'lit'
|
6
|
-
import { customElement, property } from 'lit/decorators.js'
|
7
|
-
|
8
|
-
import { history, historyKeymap, indentWithTab } from '@codemirror/commands'
|
9
|
-
import { EditorView, highlightActiveLine, keymap } from '@codemirror/view'
|
10
|
-
import { javascript } from '@codemirror/lang-javascript'
|
11
|
-
import { ScrollbarStyles } from '@operato/styles'
|
12
|
-
import { togglefullscreen } from '@operato/utils'
|
13
|
-
|
14
|
-
import { OxFormField } from './ox-form-field'
|
15
|
-
|
16
|
-
/**
|
17
|
-
WEB Component for code-mirror code editor.
|
18
|
-
|
19
|
-
Example:
|
20
|
-
|
21
|
-
<ox-input-code .value=${text} mode=${mode} tab-size="4" tab-as-space="true">
|
22
|
-
</ox-input-code>
|
23
|
-
*/
|
24
|
-
@customElement('ox-input-code')
|
25
|
-
export class OxInputCode extends OxFormField {
|
26
|
-
static styles = [
|
27
|
-
ScrollbarStyles,
|
28
|
-
css`
|
29
|
-
:host {
|
30
|
-
display: flex;
|
31
|
-
flex-direction: column;
|
32
|
-
position: relative;
|
33
|
-
background: white;
|
34
|
-
}
|
35
|
-
|
36
|
-
.cm-editor {
|
37
|
-
flex: 1;
|
38
|
-
}
|
39
|
-
`
|
40
|
-
]
|
41
|
-
|
42
|
-
/**
|
43
|
-
* `value`는 에디터에서 작성중인 contents이다.
|
44
|
-
*/
|
45
|
-
@property({ type: String }) value: string = ''
|
46
|
-
@property({ type: String }) mode?: string
|
47
|
-
@property({ type: Number, attribute: 'tab-size' }) tabSize: number = 2
|
48
|
-
@property({ type: Boolean, attribute: 'tab-as-space' }) tabAsSpace: boolean = true
|
49
|
-
|
50
|
-
private _self_changing: boolean = false
|
51
|
-
private _editor?: EditorView
|
52
|
-
private _changed: boolean = false
|
53
|
-
|
54
|
-
updated(changes: PropertyValues<this>) {
|
55
|
-
if (changes.has('value') && this.editor && !this._self_changing) {
|
56
|
-
const to = this.editor.state.doc.toString().length
|
57
|
-
this.editor.dispatch({
|
58
|
-
changes: { from: 0, to, insert: this.value === undefined ? '' : String(this.value) }
|
59
|
-
})
|
60
|
-
}
|
61
|
-
}
|
62
|
-
|
63
|
-
get editor() {
|
64
|
-
if (!this._editor) {
|
65
|
-
this._editor = new EditorView({
|
66
|
-
doc: this.value,
|
67
|
-
extensions: [
|
68
|
-
highlightActiveLine(),
|
69
|
-
history(),
|
70
|
-
javascript(),
|
71
|
-
keymap.of([
|
72
|
-
...historyKeymap,
|
73
|
-
indentWithTab,
|
74
|
-
{
|
75
|
-
key: 'Escape',
|
76
|
-
run: (view: EditorView) => {
|
77
|
-
togglefullscreen(this)
|
78
|
-
return true
|
79
|
-
}
|
80
|
-
}
|
81
|
-
]),
|
82
|
-
EditorView.updateListener.of(v => {
|
83
|
-
if (v.docChanged) {
|
84
|
-
this._self_changing = true
|
85
|
-
this.value = v.state.doc.toString()
|
86
|
-
this.dispatchEvent(new CustomEvent('change', { bubbles: true, composed: true, detail: this.value }))
|
87
|
-
requestAnimationFrame(() => {
|
88
|
-
this._self_changing = false
|
89
|
-
})
|
90
|
-
}
|
91
|
-
})
|
92
|
-
],
|
93
|
-
parent: this.renderRoot
|
94
|
-
})
|
95
|
-
}
|
96
|
-
|
97
|
-
return this._editor
|
98
|
-
}
|
99
|
-
}
|