@node-projects/web-component-designer 0.0.292 → 0.1.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/README.md +1 -30
- package/dist/elements/helper/NpmPackageLoader.d.ts +1 -2
- package/dist/elements/{loader → services/manifestParsers}/OldCustomElementsManifestLoader.d.ts +1 -1
- package/dist/elements/{loader → services/manifestParsers}/OldCustomElementsManifestLoader.js +2 -2
- package/dist/index.d.ts +4 -17
- package/dist/index.js +2 -16
- package/package.json +3 -25
- package/.editorconfig +0 -7
- package/.github/FUNDING.yml +0 -4
- package/.vscode/settings.json +0 -3
- package/ACKNOWLEDGMENTS +0 -15
- package/LICENSE +0 -21
- package/RemoveOldRemoteBranches.bat +0 -7
- package/dist/elements/services/demoProviderService/DemoProviderService.d.ts +0 -6
- package/dist/elements/services/demoProviderService/DemoProviderService.js +0 -38
- package/dist/elements/services/demoProviderService/IframeDemoProviderService copy.d.ts +0 -6
- package/dist/elements/services/demoProviderService/IframeDemoProviderService copy.js +0 -38
- package/dist/elements/services/designerAddons/IDesignerAddonJson copy.d.ts +0 -3
- package/dist/elements/services/designerAddons/IDesignerAddonJson copy.js +0 -1
- package/dist/elements/services/designerAddons/IDesignerInfoJson.d.ts +0 -7
- package/dist/elements/services/designerAddons/IDesignerInfoJson.js +0 -19
- package/dist/elements/services/dragDropService/IExternalDragDropService copy.d.ts +0 -5
- package/dist/elements/services/dragDropService/IExternalDragDropService copy.js +0 -1
- package/dist/elements/services/eventsService/IEventsService copy.d.ts +0 -2
- package/dist/elements/services/eventsService/IEventsService copy.js +0 -1
- package/dist/elements/services/htmlParserService/BaseCustomWebcomponentParserService.d.ts +0 -11
- package/dist/elements/services/htmlParserService/BaseCustomWebcomponentParserService.js +0 -90
- package/dist/elements/services/htmlParserService/LitElementParserService.d.ts +0 -12
- package/dist/elements/services/htmlParserService/LitElementParserService.js +0 -91
- package/dist/elements/services/htmlParserService/NodeHtmlParserService.d.ts +0 -11
- package/dist/elements/services/htmlParserService/NodeHtmlParserService.js +0 -89
- package/dist/elements/services/htmlParserService/VueParserService.d.ts +0 -9
- package/dist/elements/services/htmlParserService/VueParserService.js +0 -10
- package/dist/elements/services/htmlWriterService/HtmlWriterOptions.d.ts +0 -7
- package/dist/elements/services/htmlWriterService/HtmlWriterOptions.js +0 -7
- package/dist/elements/services/propertiesService/propertyEditors/GridAssignedRowColumnPropertyEditor.d.ts +0 -8
- package/dist/elements/services/propertiesService/propertyEditors/GridAssignedRowColumnPropertyEditor.js +0 -45
- package/dist/elements/services/propertiesService/propertyEditors/GridRowColumnPropertyEditor.d.ts +0 -10
- package/dist/elements/services/propertiesService/propertyEditors/GridRowColumnPropertyEditor.js +0 -25
- package/dist/elements/services/propertiesService/propertyEditors/JsonPropertyEditor copy.d.ts +0 -9
- package/dist/elements/services/propertiesService/propertyEditors/JsonPropertyEditor copy.js +0 -21
- package/dist/elements/services/propertiesService/propertyEditors/MetricsPropertyEditor.d.ts +0 -8
- package/dist/elements/services/propertiesService/propertyEditors/MetricsPropertyEditor.js +0 -14
- package/dist/elements/services/propertiesService/propertyEditors/SelectPropertyEditor copy.d.ts +0 -7
- package/dist/elements/services/propertiesService/propertyEditors/SelectPropertyEditor copy.js +0 -28
- package/dist/elements/services/propertiesService/services/CommonPropertiesService copy.d.ts +0 -13
- package/dist/elements/services/propertiesService/services/CommonPropertiesService copy.js +0 -44
- package/dist/elements/services/propertiesService/services/ContentPropertiesService.d.ts +0 -14
- package/dist/elements/services/propertiesService/services/ContentPropertiesService.js +0 -30
- package/dist/elements/services/propertiesService/services/CssCurrentPropertiesService copy.d.ts +0 -34
- package/dist/elements/services/propertiesService/services/CssCurrentPropertiesService copy.js +0 -105
- package/dist/elements/services/propertiesService/services/PolymerPropertiesService copy.d.ts +0 -8
- package/dist/elements/services/propertiesService/services/PolymerPropertiesService copy.js +0 -10
- package/dist/elements/services/propertiesService/services/UnkownElemntPropertiesService.d.ts +0 -24
- package/dist/elements/services/propertiesService/services/UnkownElemntPropertiesService.js +0 -198
- package/dist/elements/services/stylesheetService/CssToolsStylesheetService.d.ts +0 -42
- package/dist/elements/services/stylesheetService/CssToolsStylesheetService.js +0 -114
- package/dist/elements/services/stylesheetService/CssTreeStylesheetService.d.ts +0 -58
- package/dist/elements/services/stylesheetService/CssTreeStylesheetService.js +0 -204
- package/dist/elements/services/stylesheetService/SpecificityCalculator.d.ts +0 -7
- package/dist/elements/services/stylesheetService/SpecificityCalculator.js +0 -178
- package/dist/elements/services/undoService/transactionItems/AttributeChangeAction copy.d.ts +0 -15
- package/dist/elements/services/undoService/transactionItems/AttributeChangeAction copy.js +0 -70
- package/dist/elements/widgets/bindableObjectsBrowser/bindable-objects-browser.d.ts +0 -14
- package/dist/elements/widgets/bindableObjectsBrowser/bindable-objects-browser.js +0 -137
- package/dist/elements/widgets/codeView/code-view-ace.d.ts +0 -24
- package/dist/elements/widgets/codeView/code-view-ace.js +0 -134
- package/dist/elements/widgets/codeView/code-view-code-mirror.d.ts +0 -25
- package/dist/elements/widgets/codeView/code-view-code-mirror.js +0 -117
- package/dist/elements/widgets/codeView/code-view-monaco.d.ts +0 -37
- package/dist/elements/widgets/codeView/code-view-monaco.js +0 -197
- package/dist/elements/widgets/designerView/extensions/EditText/EditTextWithStyloExtension.d.ts +0 -23
- package/dist/elements/widgets/designerView/extensions/EditText/EditTextWithStyloExtension.js +0 -87
- package/dist/elements/widgets/designerView/extensions/EditText/EditTextWithStyloExtensionProvider.d.ts +0 -10
- package/dist/elements/widgets/designerView/extensions/EditText/EditTextWithStyloExtensionProvider.js +0 -15
- package/dist/elements/widgets/miniatureView/html-2-canvas-miniature-view.d.ts +0 -10
- package/dist/elements/widgets/miniatureView/html-2-canvas-miniature-view.js +0 -21
- package/dist/elements/widgets/paletteView/paletteTreeView.d.ts +0 -12
- package/dist/elements/widgets/paletteView/paletteTreeView.js +0 -141
- package/dist/elements/widgets/treeView/treeViewExtended.d.ts +0 -32
- package/dist/elements/widgets/treeView/treeViewExtended.js +0 -366
- package/fixesimport.js +0 -98
- package/jest.config.cjs +0 -7
- package/polymer.json +0 -42
- package/tsconfig.json +0 -75
- /package/dist/elements/{loader → services/manifestParsers}/IOldCustomElementsManifest.d.ts +0 -0
- /package/dist/elements/{loader → services/manifestParsers}/IOldCustomElementsManifest.js +0 -0
|
@@ -1,134 +0,0 @@
|
|
|
1
|
-
import { BaseCustomWebComponentLazyAppend, css, TypedEvent } from '@node-projects/base-custom-webcomponent';
|
|
2
|
-
import { CommandType } from '../../../commandHandling/CommandType.js';
|
|
3
|
-
class CodeViewAceCompleter {
|
|
4
|
-
getCompletions(editor, session, pos, prefix, callback) {
|
|
5
|
-
if (prefix.length === 0) {
|
|
6
|
-
callback(null, []);
|
|
7
|
-
return;
|
|
8
|
-
}
|
|
9
|
-
let wordList = ['t-t', 'visu-conveyor']; //TODO: get word list from custom elements
|
|
10
|
-
{
|
|
11
|
-
callback(null, wordList.map((w) => {
|
|
12
|
-
return { name: w, value: w, score: 1, meta: "tag" };
|
|
13
|
-
}));
|
|
14
|
-
}
|
|
15
|
-
}
|
|
16
|
-
}
|
|
17
|
-
export class CodeViewAce extends BaseCustomWebComponentLazyAppend {
|
|
18
|
-
canvasElement;
|
|
19
|
-
elementsToPackages;
|
|
20
|
-
code;
|
|
21
|
-
onTextChanged = new TypedEvent();
|
|
22
|
-
_aceEditor;
|
|
23
|
-
_editor;
|
|
24
|
-
static style = css `
|
|
25
|
-
:host {
|
|
26
|
-
display: block;
|
|
27
|
-
height: 100%;
|
|
28
|
-
width: 100%;
|
|
29
|
-
}
|
|
30
|
-
`;
|
|
31
|
-
constructor() {
|
|
32
|
-
super();
|
|
33
|
-
this._restoreCachedInititalValues();
|
|
34
|
-
this.style.display = 'block';
|
|
35
|
-
this._editor = document.createElement("div");
|
|
36
|
-
this._editor.style.height = '100%';
|
|
37
|
-
this._editor.style.width = '100%';
|
|
38
|
-
this.shadowRoot.appendChild(this._editor);
|
|
39
|
-
}
|
|
40
|
-
dispose() {
|
|
41
|
-
this._aceEditor?.destroy();
|
|
42
|
-
}
|
|
43
|
-
executeCommand(command) {
|
|
44
|
-
switch (command.type) {
|
|
45
|
-
case CommandType.undo:
|
|
46
|
-
this._aceEditor.execCommand('undo');
|
|
47
|
-
break;
|
|
48
|
-
case CommandType.redo:
|
|
49
|
-
this._aceEditor.execCommand('redo');
|
|
50
|
-
break;
|
|
51
|
-
case CommandType.copy:
|
|
52
|
-
let text = this._aceEditor.getCopyText();
|
|
53
|
-
this._aceEditor.execCommand("copy");
|
|
54
|
-
navigator.clipboard.writeText(text);
|
|
55
|
-
break;
|
|
56
|
-
case CommandType.paste:
|
|
57
|
-
navigator.clipboard.readText().then(text => {
|
|
58
|
-
this._aceEditor.execCommand("paste", text);
|
|
59
|
-
});
|
|
60
|
-
break;
|
|
61
|
-
case CommandType.cut:
|
|
62
|
-
text = this._aceEditor.getCopyText();
|
|
63
|
-
this._aceEditor.execCommand("cut");
|
|
64
|
-
navigator.clipboard.writeText(text);
|
|
65
|
-
break;
|
|
66
|
-
case CommandType.delete:
|
|
67
|
-
this._aceEditor.execCommand("delete");
|
|
68
|
-
break;
|
|
69
|
-
}
|
|
70
|
-
}
|
|
71
|
-
canExecuteCommand(command) {
|
|
72
|
-
switch (command.type) {
|
|
73
|
-
case CommandType.undo:
|
|
74
|
-
case CommandType.redo:
|
|
75
|
-
case CommandType.copy:
|
|
76
|
-
case CommandType.paste:
|
|
77
|
-
case CommandType.cut:
|
|
78
|
-
case CommandType.delete:
|
|
79
|
-
return true;
|
|
80
|
-
}
|
|
81
|
-
return false;
|
|
82
|
-
}
|
|
83
|
-
focusEditor() {
|
|
84
|
-
requestAnimationFrame(() => {
|
|
85
|
-
this.focus();
|
|
86
|
-
this._aceEditor.focus();
|
|
87
|
-
});
|
|
88
|
-
}
|
|
89
|
-
oneTimeSetup() {
|
|
90
|
-
//@ts-ignore
|
|
91
|
-
let langTools = ace.require("ace/ext/language_tools");
|
|
92
|
-
langTools.addCompleter(new CodeViewAceCompleter());
|
|
93
|
-
}
|
|
94
|
-
ready() {
|
|
95
|
-
//@ts-ignore
|
|
96
|
-
this._aceEditor = ace.edit(this._editor, {
|
|
97
|
-
theme: "ace/theme/chrome",
|
|
98
|
-
mode: "ace/mode/html",
|
|
99
|
-
value: "",
|
|
100
|
-
autoScrollEditorIntoView: true,
|
|
101
|
-
fontSize: "14px",
|
|
102
|
-
showPrintMargin: false,
|
|
103
|
-
displayIndentGuides: true,
|
|
104
|
-
enableBasicAutocompletion: true,
|
|
105
|
-
enableSnippets: true,
|
|
106
|
-
enableLiveAutocompletion: true
|
|
107
|
-
});
|
|
108
|
-
//own snippet completer: http://plnkr.co/edit/6MVntVmXYUbjR0DI82Cr?p=preview
|
|
109
|
-
this._aceEditor.renderer.attachToShadowRoot();
|
|
110
|
-
let observer = new MutationObserver((m) => {
|
|
111
|
-
this._aceEditor.setAutoScrollEditorIntoView(false);
|
|
112
|
-
this._aceEditor.setAutoScrollEditorIntoView(true);
|
|
113
|
-
});
|
|
114
|
-
let config = { attributes: true, childList: true, characterData: true };
|
|
115
|
-
observer.observe(this.shadowRoot.querySelector('.ace_content'), config);
|
|
116
|
-
this._aceEditor.on('change', () => this.onTextChanged.emit(this._aceEditor.getValue()));
|
|
117
|
-
}
|
|
118
|
-
update(code) {
|
|
119
|
-
this._aceEditor.setValue(code);
|
|
120
|
-
this._aceEditor.clearSelection();
|
|
121
|
-
}
|
|
122
|
-
getText() {
|
|
123
|
-
return this._aceEditor.getValue();
|
|
124
|
-
}
|
|
125
|
-
setSelection(position) {
|
|
126
|
-
let point1 = this._aceEditor.session.getDocument().indexToPosition(position.start, 0);
|
|
127
|
-
let point2 = this._aceEditor.session.getDocument().indexToPosition(position.start + position.length, 0);
|
|
128
|
-
//@ts-ignore
|
|
129
|
-
this._aceEditor.selection.setRange({ start: point1, end: point2 });
|
|
130
|
-
//@ts-ignore
|
|
131
|
-
this._aceEditor.scrollToLine(point1.row);
|
|
132
|
-
}
|
|
133
|
-
}
|
|
134
|
-
customElements.define('node-projects-code-view-ace', CodeViewAce);
|
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
import { BaseCustomWebComponentLazyAppend, TypedEvent } from '@node-projects/base-custom-webcomponent';
|
|
2
|
-
import { ICodeView } from './ICodeView.js';
|
|
3
|
-
import { IStringPosition } from '../../services/htmlWriterService/IStringPosition.js';
|
|
4
|
-
import { IUiCommand } from '../../../commandHandling/IUiCommand.js';
|
|
5
|
-
import { IDisposable } from '../../../interfaces/IDisposable.js';
|
|
6
|
-
export declare class CodeViewCodeMirror extends BaseCustomWebComponentLazyAppend implements ICodeView, IDisposable {
|
|
7
|
-
canvasElement: HTMLElement;
|
|
8
|
-
elementsToPackages: Map<string, string>;
|
|
9
|
-
code: string;
|
|
10
|
-
onTextChanged: TypedEvent<string>;
|
|
11
|
-
mode: string;
|
|
12
|
-
private _codeMirrorEditor;
|
|
13
|
-
private _editor;
|
|
14
|
-
static readonly style: CSSStyleSheet;
|
|
15
|
-
static readonly template: HTMLTemplateElement;
|
|
16
|
-
constructor();
|
|
17
|
-
dispose(): void;
|
|
18
|
-
executeCommand(command: IUiCommand): void;
|
|
19
|
-
canExecuteCommand(command: IUiCommand): boolean;
|
|
20
|
-
focusEditor(): void;
|
|
21
|
-
ready(): void;
|
|
22
|
-
update(code: any): void;
|
|
23
|
-
getText(): string;
|
|
24
|
-
setSelection(position: IStringPosition): void;
|
|
25
|
-
}
|
|
@@ -1,117 +0,0 @@
|
|
|
1
|
-
import { BaseCustomWebComponentLazyAppend, css, html, TypedEvent } from '@node-projects/base-custom-webcomponent';
|
|
2
|
-
import { CommandType } from '../../../commandHandling/CommandType.js';
|
|
3
|
-
export class CodeViewCodeMirror extends BaseCustomWebComponentLazyAppend {
|
|
4
|
-
canvasElement;
|
|
5
|
-
elementsToPackages;
|
|
6
|
-
code;
|
|
7
|
-
onTextChanged = new TypedEvent();
|
|
8
|
-
mode = 'xml';
|
|
9
|
-
_codeMirrorEditor;
|
|
10
|
-
_editor;
|
|
11
|
-
static style = css `
|
|
12
|
-
:host {
|
|
13
|
-
display: block;
|
|
14
|
-
height: 100%;
|
|
15
|
-
width: 100%;
|
|
16
|
-
}`;
|
|
17
|
-
static template = html `
|
|
18
|
-
<div style="width: 100%; height: 100%; overflow: auto;">
|
|
19
|
-
<div id="textarea"></div>
|
|
20
|
-
</div>`;
|
|
21
|
-
constructor() {
|
|
22
|
-
super();
|
|
23
|
-
this._restoreCachedInititalValues();
|
|
24
|
-
//@ts-ignore
|
|
25
|
-
if (window.importShim) {
|
|
26
|
-
//@ts-ignore
|
|
27
|
-
importShim("codemirror/lib/codemirror.css", { assert: { type: 'css' } }).then(x => this.shadowRoot.adoptedStyleSheets = [x.default, ...this.shadowRoot.adoptedStyleSheets]);
|
|
28
|
-
//@ts-ignore
|
|
29
|
-
importShim("codemirror/addon/fold/foldgutter.css", { assert: { type: 'css' } }).then(x => this.shadowRoot.adoptedStyleSheets = [x.default, ...this.shadowRoot.adoptedStyleSheets]);
|
|
30
|
-
}
|
|
31
|
-
else {
|
|
32
|
-
//@ts-ignore
|
|
33
|
-
import("codemirror/lib/codemirror.css", { assert: { type: 'css' } }).then(x => this.shadowRoot.adoptedStyleSheets = [x.default, ...this.shadowRoot.adoptedStyleSheets]);
|
|
34
|
-
//@ts-ignore
|
|
35
|
-
import("codemirror/addon/fold/foldgutter.css", { assert: { type: 'css' } }).then(x => this.shadowRoot.adoptedStyleSheets = [x.default, ...this.shadowRoot.adoptedStyleSheets]);
|
|
36
|
-
}
|
|
37
|
-
this.style.display = 'block';
|
|
38
|
-
this._editor = this._getDomElement('textarea');
|
|
39
|
-
}
|
|
40
|
-
dispose() {
|
|
41
|
-
}
|
|
42
|
-
executeCommand(command) {
|
|
43
|
-
switch (command.type) {
|
|
44
|
-
case CommandType.undo:
|
|
45
|
-
this._codeMirrorEditor.undo();
|
|
46
|
-
break;
|
|
47
|
-
case CommandType.redo:
|
|
48
|
-
this._codeMirrorEditor.redo();
|
|
49
|
-
break;
|
|
50
|
-
case CommandType.copy:
|
|
51
|
-
const text = this._codeMirrorEditor.getSelection();
|
|
52
|
-
navigator.clipboard.writeText(text);
|
|
53
|
-
break;
|
|
54
|
-
case CommandType.paste:
|
|
55
|
-
navigator.clipboard.readText().then(text => {
|
|
56
|
-
this._codeMirrorEditor.replaceSelection(text);
|
|
57
|
-
});
|
|
58
|
-
break;
|
|
59
|
-
case CommandType.cut:
|
|
60
|
-
const textc = this._codeMirrorEditor.getSelection();
|
|
61
|
-
navigator.clipboard.writeText(textc);
|
|
62
|
-
this._codeMirrorEditor.replaceSelection('');
|
|
63
|
-
break;
|
|
64
|
-
case CommandType.delete:
|
|
65
|
-
this._codeMirrorEditor.replaceSelection('');
|
|
66
|
-
break;
|
|
67
|
-
}
|
|
68
|
-
}
|
|
69
|
-
canExecuteCommand(command) {
|
|
70
|
-
switch (command.type) {
|
|
71
|
-
case CommandType.undo:
|
|
72
|
-
case CommandType.redo:
|
|
73
|
-
case CommandType.copy:
|
|
74
|
-
case CommandType.paste:
|
|
75
|
-
case CommandType.cut:
|
|
76
|
-
case CommandType.delete:
|
|
77
|
-
return true;
|
|
78
|
-
}
|
|
79
|
-
return false;
|
|
80
|
-
}
|
|
81
|
-
focusEditor() {
|
|
82
|
-
requestAnimationFrame(() => {
|
|
83
|
-
this.focus();
|
|
84
|
-
this._codeMirrorEditor.focus();
|
|
85
|
-
});
|
|
86
|
-
}
|
|
87
|
-
ready() {
|
|
88
|
-
const config = {
|
|
89
|
-
tabSize: 3,
|
|
90
|
-
lineNumbers: true,
|
|
91
|
-
mode: this.mode,
|
|
92
|
-
//@ts-ignore
|
|
93
|
-
htmlMode: true,
|
|
94
|
-
lineWrapping: true,
|
|
95
|
-
//@ts-ignore
|
|
96
|
-
extraKeys: { "Ctrl-Q": function (cm) { cm.foldCode(cm.getCursor()); } },
|
|
97
|
-
foldGutter: true,
|
|
98
|
-
gutters: ["CodeMirror-linenumbers", "CodeMirror-foldgutter"]
|
|
99
|
-
};
|
|
100
|
-
//@ts-ignore
|
|
101
|
-
this._codeMirrorEditor = CodeMirror(this._editor, config);
|
|
102
|
-
this._codeMirrorEditor.setSize('100%', '100%');
|
|
103
|
-
this._codeMirrorEditor.on('change', () => this.onTextChanged.emit(this._codeMirrorEditor.getValue()));
|
|
104
|
-
}
|
|
105
|
-
update(code) {
|
|
106
|
-
this._codeMirrorEditor.setValue(code);
|
|
107
|
-
}
|
|
108
|
-
getText() {
|
|
109
|
-
return this._codeMirrorEditor.getValue();
|
|
110
|
-
}
|
|
111
|
-
setSelection(position) {
|
|
112
|
-
let point1 = this._codeMirrorEditor.posFromIndex(position.start);
|
|
113
|
-
let point2 = this._codeMirrorEditor.posFromIndex(position.start + position.length);
|
|
114
|
-
this._codeMirrorEditor.setSelection(point1, point2);
|
|
115
|
-
}
|
|
116
|
-
}
|
|
117
|
-
customElements.define('node-projects-code-view-code-mirror', CodeViewCodeMirror);
|
|
@@ -1,37 +0,0 @@
|
|
|
1
|
-
import { BaseCustomWebComponentLazyAppend, TypedEvent } from '@node-projects/base-custom-webcomponent';
|
|
2
|
-
import { ICodeView } from './ICodeView.js';
|
|
3
|
-
import { IActivateable } from '../../../interfaces/IActivateable.js';
|
|
4
|
-
import { IStringPosition } from '../../services/htmlWriterService/IStringPosition.js';
|
|
5
|
-
import { IUiCommandHandler } from '../../../commandHandling/IUiCommandHandler.js';
|
|
6
|
-
import { IUiCommand } from '../../../commandHandling/IUiCommand.js';
|
|
7
|
-
export declare class CodeViewMonaco extends BaseCustomWebComponentLazyAppend implements ICodeView, IActivateable, IUiCommandHandler {
|
|
8
|
-
private static _initalized;
|
|
9
|
-
dispose(): void;
|
|
10
|
-
canvasElement: HTMLElement;
|
|
11
|
-
elementsToPackages: Map<string, string>;
|
|
12
|
-
code: string;
|
|
13
|
-
onTextChanged: TypedEvent<string>;
|
|
14
|
-
language: string;
|
|
15
|
-
private _theme;
|
|
16
|
-
get theme(): string;
|
|
17
|
-
set theme(value: string);
|
|
18
|
-
static readonly properties: {
|
|
19
|
-
code: StringConstructor;
|
|
20
|
-
language: StringConstructor;
|
|
21
|
-
theme: StringConstructor;
|
|
22
|
-
};
|
|
23
|
-
private _monacoEditor;
|
|
24
|
-
private _editor;
|
|
25
|
-
static readonly style: CSSStyleSheet;
|
|
26
|
-
static readonly template: HTMLTemplateElement;
|
|
27
|
-
executeCommand(command: IUiCommand): void;
|
|
28
|
-
canExecuteCommand(command: IUiCommand): boolean;
|
|
29
|
-
static initMonacoEditor(): Promise<void>;
|
|
30
|
-
constructor();
|
|
31
|
-
ready(): Promise<void>;
|
|
32
|
-
focusEditor(): void;
|
|
33
|
-
activated(): void;
|
|
34
|
-
update(code: any): void;
|
|
35
|
-
getText(): any;
|
|
36
|
-
setSelection(position: IStringPosition): void;
|
|
37
|
-
}
|
|
@@ -1,197 +0,0 @@
|
|
|
1
|
-
import { BaseCustomWebComponentLazyAppend, css, html, TypedEvent } from '@node-projects/base-custom-webcomponent';
|
|
2
|
-
import { CommandType } from '../../../commandHandling/CommandType.js';
|
|
3
|
-
export class CodeViewMonaco extends BaseCustomWebComponentLazyAppend {
|
|
4
|
-
static _initalized;
|
|
5
|
-
dispose() {
|
|
6
|
-
this._monacoEditor?.dispose();
|
|
7
|
-
}
|
|
8
|
-
canvasElement;
|
|
9
|
-
elementsToPackages;
|
|
10
|
-
code;
|
|
11
|
-
onTextChanged = new TypedEvent();
|
|
12
|
-
language = 'html';
|
|
13
|
-
_theme = 'webComponentDesignerTheme';
|
|
14
|
-
get theme() {
|
|
15
|
-
return this._theme;
|
|
16
|
-
}
|
|
17
|
-
set theme(value) {
|
|
18
|
-
this._theme = value;
|
|
19
|
-
//@ts-ignore
|
|
20
|
-
monaco.editor.setTheme(value);
|
|
21
|
-
}
|
|
22
|
-
static properties = {
|
|
23
|
-
code: String,
|
|
24
|
-
language: String,
|
|
25
|
-
theme: String
|
|
26
|
-
};
|
|
27
|
-
//@ts-ignore
|
|
28
|
-
_monacoEditor;
|
|
29
|
-
_editor;
|
|
30
|
-
static style = css `
|
|
31
|
-
:host {
|
|
32
|
-
display: block;
|
|
33
|
-
height: 100%;
|
|
34
|
-
width: 100%;
|
|
35
|
-
}
|
|
36
|
-
`;
|
|
37
|
-
static template = html `
|
|
38
|
-
<div id="container" style="overflow: hidden; width: 100%; height: 100%; position: absolute;"></div>
|
|
39
|
-
`;
|
|
40
|
-
executeCommand(command) {
|
|
41
|
-
switch (command.type) {
|
|
42
|
-
case CommandType.undo:
|
|
43
|
-
this._monacoEditor.trigger('source', 'undo', null);
|
|
44
|
-
break;
|
|
45
|
-
case CommandType.redo:
|
|
46
|
-
this._monacoEditor.trigger('source', 'redo', null);
|
|
47
|
-
break;
|
|
48
|
-
case CommandType.copy:
|
|
49
|
-
this._monacoEditor.trigger('source', 'editor.action.clipboardCopyAction', null);
|
|
50
|
-
break;
|
|
51
|
-
case CommandType.paste:
|
|
52
|
-
this._monacoEditor.trigger('source', 'editor.action.clipboardPasteAction', null);
|
|
53
|
-
break;
|
|
54
|
-
case CommandType.cut:
|
|
55
|
-
break;
|
|
56
|
-
case CommandType.delete:
|
|
57
|
-
break;
|
|
58
|
-
}
|
|
59
|
-
}
|
|
60
|
-
canExecuteCommand(command) {
|
|
61
|
-
switch (command.type) {
|
|
62
|
-
case CommandType.undo:
|
|
63
|
-
case CommandType.redo:
|
|
64
|
-
case CommandType.copy:
|
|
65
|
-
case CommandType.paste:
|
|
66
|
-
case CommandType.cut:
|
|
67
|
-
case CommandType.delete:
|
|
68
|
-
return true;
|
|
69
|
-
}
|
|
70
|
-
return false;
|
|
71
|
-
}
|
|
72
|
-
static initMonacoEditor() {
|
|
73
|
-
return new Promise(async (resolve) => {
|
|
74
|
-
if (!CodeViewMonaco._initalized) {
|
|
75
|
-
CodeViewMonaco._initalized = true;
|
|
76
|
-
//@ts-ignore
|
|
77
|
-
require.config({ paths: { 'vs': 'node_modules/monaco-editor/min/vs' } });
|
|
78
|
-
//@ts-ignore
|
|
79
|
-
require(['vs/editor/editor.main'], () => {
|
|
80
|
-
//@ts-ignore
|
|
81
|
-
monaco.editor.defineTheme('webComponentDesignerTheme', {
|
|
82
|
-
base: 'vs',
|
|
83
|
-
inherit: true,
|
|
84
|
-
//@ts-ignore
|
|
85
|
-
rules: [{ background: 'EDF9FA' }],
|
|
86
|
-
colors: {
|
|
87
|
-
'editor.selectionBackground': '#add6ff',
|
|
88
|
-
'editor.inactiveSelectionBackground': '#add6ff'
|
|
89
|
-
}
|
|
90
|
-
});
|
|
91
|
-
//@ts-ignore
|
|
92
|
-
monaco.editor.setTheme('webComponentDesignerTheme');
|
|
93
|
-
resolve();
|
|
94
|
-
});
|
|
95
|
-
}
|
|
96
|
-
else {
|
|
97
|
-
resolve();
|
|
98
|
-
}
|
|
99
|
-
});
|
|
100
|
-
}
|
|
101
|
-
constructor() {
|
|
102
|
-
super();
|
|
103
|
-
this._restoreCachedInititalValues();
|
|
104
|
-
}
|
|
105
|
-
async ready() {
|
|
106
|
-
this._parseAttributesToProperties();
|
|
107
|
-
let style;
|
|
108
|
-
//@ts-ignore
|
|
109
|
-
if (window.importShim)
|
|
110
|
-
//@ts-ignore
|
|
111
|
-
style = await importShim("monaco-editor/min/vs/editor/editor.main.css", { assert: { type: 'css' } });
|
|
112
|
-
else
|
|
113
|
-
//@ts-ignore
|
|
114
|
-
style = await import("monaco-editor/min/vs/editor/editor.main.css", { assert: { type: 'css' } });
|
|
115
|
-
this.shadowRoot.adoptedStyleSheets = [style.default, this.constructor.style];
|
|
116
|
-
this._editor = this._getDomElement('container');
|
|
117
|
-
await CodeViewMonaco.initMonacoEditor();
|
|
118
|
-
const resizeObserver = new ResizeObserver(() => {
|
|
119
|
-
if (this._editor.offsetWidth > 0) {
|
|
120
|
-
//@ts-ignore
|
|
121
|
-
this._monacoEditor = monaco.editor.create(this._editor, {
|
|
122
|
-
automaticLayout: true,
|
|
123
|
-
wordWrapColumn: 1000,
|
|
124
|
-
//wordWrap: 'wordWrapColumn',
|
|
125
|
-
fontLigatures: '',
|
|
126
|
-
value: this.code,
|
|
127
|
-
language: this.language,
|
|
128
|
-
minimap: {
|
|
129
|
-
size: 'fill'
|
|
130
|
-
},
|
|
131
|
-
fixedOverflowWidgets: true,
|
|
132
|
-
scrollbar: {
|
|
133
|
-
useShadows: false,
|
|
134
|
-
verticalHasArrows: true,
|
|
135
|
-
horizontalHasArrows: true,
|
|
136
|
-
vertical: 'visible',
|
|
137
|
-
horizontal: 'visible'
|
|
138
|
-
}
|
|
139
|
-
});
|
|
140
|
-
//@ts-ignore
|
|
141
|
-
monaco.editor.setTheme(this.theme);
|
|
142
|
-
let changeContentListener = this._monacoEditor.getModel().onDidChangeContent(e => {
|
|
143
|
-
this.onTextChanged.emit(this._monacoEditor.getValue());
|
|
144
|
-
});
|
|
145
|
-
this._monacoEditor.onDidChangeModel(e => {
|
|
146
|
-
changeContentListener.dispose();
|
|
147
|
-
changeContentListener = this._monacoEditor.getModel().onDidChangeContent(e => {
|
|
148
|
-
this.onTextChanged.emit(this._monacoEditor.getValue());
|
|
149
|
-
});
|
|
150
|
-
});
|
|
151
|
-
this._monacoEditor.focus();
|
|
152
|
-
resizeObserver.disconnect();
|
|
153
|
-
}
|
|
154
|
-
;
|
|
155
|
-
});
|
|
156
|
-
resizeObserver.observe(this._editor);
|
|
157
|
-
}
|
|
158
|
-
focusEditor() {
|
|
159
|
-
requestAnimationFrame(() => {
|
|
160
|
-
this.focus();
|
|
161
|
-
if (this._monacoEditor)
|
|
162
|
-
this._monacoEditor.focus();
|
|
163
|
-
});
|
|
164
|
-
}
|
|
165
|
-
activated() {
|
|
166
|
-
if (this._monacoEditor)
|
|
167
|
-
if (this._monacoEditor)
|
|
168
|
-
this._monacoEditor.layout();
|
|
169
|
-
}
|
|
170
|
-
update(code) {
|
|
171
|
-
this.code = code;
|
|
172
|
-
if (this._monacoEditor) {
|
|
173
|
-
if (this._monacoEditor)
|
|
174
|
-
this._monacoEditor.setValue(code);
|
|
175
|
-
//@ts-ignore
|
|
176
|
-
monaco.editor.setModelLanguage(this._monacoEditor.getModel(), this.language);
|
|
177
|
-
//@ts-ignore
|
|
178
|
-
monaco.editor.setTheme(this.theme);
|
|
179
|
-
}
|
|
180
|
-
}
|
|
181
|
-
getText() {
|
|
182
|
-
return this._monacoEditor.getValue();
|
|
183
|
-
}
|
|
184
|
-
setSelection(position) {
|
|
185
|
-
if (this._monacoEditor) {
|
|
186
|
-
let model = this._monacoEditor.getModel();
|
|
187
|
-
let point1 = model.getPositionAt(position.start);
|
|
188
|
-
let point2 = model.getPositionAt(position.start + position.length);
|
|
189
|
-
setTimeout(() => {
|
|
190
|
-
this._monacoEditor.setSelection({ startLineNumber: point1.lineNumber, startColumn: point1.column, endLineNumber: point2.lineNumber, endColumn: point2.column });
|
|
191
|
-
//@ts-ignore
|
|
192
|
-
this._monacoEditor.revealRangeInCenterIfOutsideViewport(new monaco.Range(point1.lineNumber, point1.column, point2.lineNumber, point2.column), 1);
|
|
193
|
-
}, 50);
|
|
194
|
-
}
|
|
195
|
-
}
|
|
196
|
-
}
|
|
197
|
-
customElements.define('node-projects-code-view-monaco', CodeViewMonaco);
|
package/dist/elements/widgets/designerView/extensions/EditText/EditTextWithStyloExtension.d.ts
DELETED
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
import { IDesignItem } from '../../../../item/IDesignItem.js';
|
|
2
|
-
import { IDesignerCanvas } from '../../IDesignerCanvas.js';
|
|
3
|
-
import { AbstractExtension } from "../AbstractExtension.js";
|
|
4
|
-
import { IExtensionManager } from '../IExtensionManger.js';
|
|
5
|
-
import { handlesPointerEvent } from './EditTextExtension.js';
|
|
6
|
-
export declare class EditTextWithStyloExtension extends AbstractExtension implements handlesPointerEvent {
|
|
7
|
-
private _contentEditedBound;
|
|
8
|
-
private _blurBound;
|
|
9
|
-
private static template;
|
|
10
|
-
private _resizeObserver;
|
|
11
|
-
private _rect1;
|
|
12
|
-
private _rect2;
|
|
13
|
-
private _rect3;
|
|
14
|
-
private _rect4;
|
|
15
|
-
private _foreignObject;
|
|
16
|
-
constructor(extensionManager: IExtensionManager, designerView: IDesignerCanvas, extendedItem: IDesignItem);
|
|
17
|
-
extend(): void;
|
|
18
|
-
private _drawClickOverlayRects;
|
|
19
|
-
handlesPointerEvent(designerCanvas: IDesignerCanvas, event: PointerEvent, currentElement: Element): boolean;
|
|
20
|
-
refresh(): void;
|
|
21
|
-
dispose(): void;
|
|
22
|
-
_clickOutside(e: any): void;
|
|
23
|
-
}
|
package/dist/elements/widgets/designerView/extensions/EditText/EditTextWithStyloExtension.js
DELETED
|
@@ -1,87 +0,0 @@
|
|
|
1
|
-
import { html } from "@node-projects/base-custom-webcomponent";
|
|
2
|
-
import { TextTool } from '../../tools/TextTool.js';
|
|
3
|
-
import { AbstractExtension } from "../AbstractExtension.js";
|
|
4
|
-
import { ExtensionType } from "../ExtensionType.js";
|
|
5
|
-
import { OverlayLayer } from "../OverlayLayer.js";
|
|
6
|
-
export class EditTextWithStyloExtension extends AbstractExtension {
|
|
7
|
-
_contentEditedBound;
|
|
8
|
-
_blurBound;
|
|
9
|
-
static template = html `
|
|
10
|
-
<stylo-editor></stylo-editor>
|
|
11
|
-
`;
|
|
12
|
-
_resizeObserver;
|
|
13
|
-
_rect1;
|
|
14
|
-
_rect2;
|
|
15
|
-
_rect3;
|
|
16
|
-
_rect4;
|
|
17
|
-
_foreignObject;
|
|
18
|
-
constructor(extensionManager, designerView, extendedItem) {
|
|
19
|
-
super(extensionManager, designerView, extendedItem);
|
|
20
|
-
import('@papyrs/stylo/dist/esm/loader.js').then(d => d.defineCustomElements());
|
|
21
|
-
}
|
|
22
|
-
extend() {
|
|
23
|
-
this.extendedItem.instanceServiceContainer.selectionService.clearSelectedElements();
|
|
24
|
-
this.extendedItem.element.setAttribute('contenteditable', 'true');
|
|
25
|
-
this.extendedItem.element.addEventListener('input', this._contentEditedBound);
|
|
26
|
-
this.extendedItem.element.addEventListener('blur', this._blurBound);
|
|
27
|
-
this.extendedItem.element.focus();
|
|
28
|
-
this.designerCanvas.eatEvents = this.extendedItem.element;
|
|
29
|
-
this.designerCanvas.serviceContainer.globalContext.tool = new TextTool(true);
|
|
30
|
-
const elements = EditTextWithStyloExtension.template.content.cloneNode(true);
|
|
31
|
-
const foreignObject = document.createElementNS('http://www.w3.org/2000/svg', 'foreignObject');
|
|
32
|
-
this._foreignObject = foreignObject;
|
|
33
|
-
foreignObject.setAttribute('x', '0');
|
|
34
|
-
foreignObject.setAttribute('y', '0');
|
|
35
|
-
foreignObject.setAttribute('width', '100%');
|
|
36
|
-
foreignObject.setAttribute('height', '100%');
|
|
37
|
-
foreignObject.appendChild(elements);
|
|
38
|
-
this._addOverlay(foreignObject, OverlayLayer.Foregorund);
|
|
39
|
-
this._drawClickOverlayRects();
|
|
40
|
-
this._rect1.addEventListener('pointerdown', (e) => this._clickOutside(e));
|
|
41
|
-
this._rect2.addEventListener('pointerdown', (e) => this._clickOutside(e));
|
|
42
|
-
this._rect3.addEventListener('pointerdown', (e) => this._clickOutside(e));
|
|
43
|
-
this._rect4.addEventListener('pointerdown', (e) => this._clickOutside(e));
|
|
44
|
-
requestAnimationFrame(() => {
|
|
45
|
-
const stylo = foreignObject.querySelector('stylo-editor');
|
|
46
|
-
//@ts-ignore
|
|
47
|
-
stylo.containerRef = this.extendedItem.element;
|
|
48
|
-
//@ts-ignore
|
|
49
|
-
stylo.config = {
|
|
50
|
-
dontInjectHeadCss: true
|
|
51
|
-
};
|
|
52
|
-
});
|
|
53
|
-
this.designerCanvas.clickOverlay.style.pointerEvents = 'none';
|
|
54
|
-
this._resizeObserver = new ResizeObserver(() => this._drawClickOverlayRects());
|
|
55
|
-
this._resizeObserver.observe(this.extendedItem.element);
|
|
56
|
-
}
|
|
57
|
-
_drawClickOverlayRects() {
|
|
58
|
-
const normalized = this.designerCanvas.getNormalizedElementCoordinates(this.extendedItem.element);
|
|
59
|
-
this._rect1 = this._drawRect(0, 0, this.designerCanvas.containerBoundingRect.width, normalized.y, 'svg-transparent', this._rect1, OverlayLayer.Normal);
|
|
60
|
-
this._rect2 = this._drawRect(0, 0, normalized.x, this.designerCanvas.containerBoundingRect.height, 'svg-transparent', this._rect2, OverlayLayer.Normal);
|
|
61
|
-
this._rect3 = this._drawRect(normalized.x + normalized.width, 0, this.designerCanvas.containerBoundingRect.width, this.designerCanvas.containerBoundingRect.height, 'svg-transparent', this._rect3, OverlayLayer.Normal);
|
|
62
|
-
this._rect4 = this._drawRect(0, normalized.y + normalized.height, this.designerCanvas.containerBoundingRect.width, this.designerCanvas.containerBoundingRect.height, 'svg-transparent', this._rect4, OverlayLayer.Normal);
|
|
63
|
-
}
|
|
64
|
-
handlesPointerEvent(designerCanvas, event, currentElement) {
|
|
65
|
-
let p = event.composedPath();
|
|
66
|
-
const stylo = this._foreignObject.querySelector('stylo-editor');
|
|
67
|
-
return p.indexOf(stylo) >= 0;
|
|
68
|
-
}
|
|
69
|
-
refresh() {
|
|
70
|
-
this.dispose();
|
|
71
|
-
}
|
|
72
|
-
dispose() {
|
|
73
|
-
this._resizeObserver.disconnect();
|
|
74
|
-
this._removeAllOverlays();
|
|
75
|
-
this.extendedItem.element.removeAttribute('contenteditable');
|
|
76
|
-
this.designerCanvas.eatEvents = null;
|
|
77
|
-
this.extendedItem.updateChildrenFromNodesChildren();
|
|
78
|
-
this.designerCanvas.clickOverlay.style.pointerEvents = 'auto';
|
|
79
|
-
}
|
|
80
|
-
_clickOutside(e) {
|
|
81
|
-
this.extendedItem.innerHTML = this.extendedItem.element.innerHTML;
|
|
82
|
-
//TODO: the extension should remove itself, not the doubleclick extensions
|
|
83
|
-
// cause the extension could be applied in another way
|
|
84
|
-
//maybe also the removal is maybe not desired (for example if it's permanet extension)
|
|
85
|
-
this.extensionManager.removeExtension(this.extendedItem, ExtensionType.Doubleclick);
|
|
86
|
-
}
|
|
87
|
-
}
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import { IDesignerExtensionProvider } from '../IDesignerExtensionProvider.js';
|
|
2
|
-
import { IDesignItem } from '../../../../item/IDesignItem.js';
|
|
3
|
-
import { IDesignerCanvas } from '../../IDesignerCanvas.js';
|
|
4
|
-
import { IDesignerExtension } from '../IDesignerExtension.js';
|
|
5
|
-
import { IExtensionManager } from '../IExtensionManger.js';
|
|
6
|
-
export declare class EditTextWithStyloExtensionProvider implements IDesignerExtensionProvider {
|
|
7
|
-
shouldExtend(extensionManager: IExtensionManager, designerView: IDesignerCanvas, designItem: IDesignItem): boolean;
|
|
8
|
-
getExtension(extensionManager: IExtensionManager, designerView: IDesignerCanvas, designItem: IDesignItem): IDesignerExtension;
|
|
9
|
-
readonly style: CSSStyleSheet;
|
|
10
|
-
}
|
package/dist/elements/widgets/designerView/extensions/EditText/EditTextWithStyloExtensionProvider.js
DELETED
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
import { EditTextWithStyloExtension } from "./EditTextWithStyloExtension.js";
|
|
2
|
-
import { css } from "@node-projects/base-custom-webcomponent";
|
|
3
|
-
export class EditTextWithStyloExtensionProvider {
|
|
4
|
-
shouldExtend(extensionManager, designerView, designItem) {
|
|
5
|
-
if (designItem.name === 'button' || designItem.name === 'input')
|
|
6
|
-
return false;
|
|
7
|
-
return true;
|
|
8
|
-
}
|
|
9
|
-
getExtension(extensionManager, designerView, designItem) {
|
|
10
|
-
return new EditTextWithStyloExtension(extensionManager, designerView, designItem);
|
|
11
|
-
}
|
|
12
|
-
style = css `
|
|
13
|
-
.svg-transparent { stroke: none; fill: transparent; pointer-events: all; }
|
|
14
|
-
`;
|
|
15
|
-
}
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import { BaseCustomWebComponentLazyAppend } from '@node-projects/base-custom-webcomponent';
|
|
2
|
-
import { IDesignerCanvas } from '../designerView/IDesignerCanvas.js';
|
|
3
|
-
import { IMiniatureView } from './IMiniatureView.js';
|
|
4
|
-
export declare class Html2CanvasMiniatureView extends BaseCustomWebComponentLazyAppend implements IMiniatureView {
|
|
5
|
-
static readonly style: CSSStyleSheet;
|
|
6
|
-
static readonly template: HTMLTemplateElement;
|
|
7
|
-
private _imgdiv;
|
|
8
|
-
constructor();
|
|
9
|
-
reRender(designerView: IDesignerCanvas): void;
|
|
10
|
-
}
|