@node-projects/web-component-designer 0.0.184 → 0.0.186

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 (71) hide show
  1. package/dist/elements/helper/ClipboardHelper.d.ts +4 -0
  2. package/dist/elements/helper/ClipboardHelper.js +84 -0
  3. package/dist/elements/helper/NpmPackageLoader.d.ts +17 -0
  4. package/dist/elements/helper/NpmPackageLoader.js +207 -0
  5. package/dist/elements/services/copyPasteService/CopyPasteService.js +19 -19
  6. package/dist/elements/services/designerAddons/IDesignerAddonJson.d.ts +6 -0
  7. package/dist/elements/services/{propertiesService/IProperty copy.js → designerAddons/IDesignerAddonJson.js} +0 -0
  8. package/dist/elements/services/manifestParsers/WebcomponentManifestParserService.js +1 -1
  9. package/dist/elements/services/propertiesService/services/WebcomponentManifestPropertiesService.js +1 -1
  10. package/dist/index.d.ts +2 -0
  11. package/dist/index.js +2 -0
  12. package/package.json +7 -7
  13. package/dist/elements/controls/ThicknessEditor copy.d.ts +0 -33
  14. package/dist/elements/controls/ThicknessEditor copy.js +0 -145
  15. package/dist/elements/helper/IndentedTextWriter copy.d.ts +0 -14
  16. package/dist/elements/helper/IndentedTextWriter copy.js +0 -34
  17. package/dist/elements/helper/SimpleTextWriter copy.d.ts +0 -12
  18. package/dist/elements/helper/SimpleTextWriter copy.js +0 -26
  19. package/dist/elements/services/htmlParserService/LitElementParserService copy.d.ts +0 -12
  20. package/dist/elements/services/htmlParserService/LitElementParserService copy.js +0 -120
  21. package/dist/elements/services/propertiesService/IProperty copy.d.ts +0 -22
  22. package/dist/elements/services/propertiesService/IPropertyGroupsService.d.ts +0 -8
  23. package/dist/elements/services/propertiesService/IPropertyGroupsService.js +0 -1
  24. package/dist/elements/services/propertiesService/PropertyGroupsService.d.ts +0 -17
  25. package/dist/elements/services/propertiesService/PropertyGroupsService.js +0 -29
  26. package/dist/elements/services/propertiesService/propertyEditors/MetricsEditor.d.ts +0 -0
  27. package/dist/elements/services/propertiesService/propertyEditors/MetricsEditor.js +0 -1
  28. package/dist/elements/services/propertiesService/services/AbstractBasePropertiesService.d.ts +0 -7
  29. package/dist/elements/services/propertiesService/services/AbstractBasePropertiesService.js +0 -44
  30. package/dist/elements/services/propertiesService/services/CssCurrentPropertiesService copy.d.ts +0 -18
  31. package/dist/elements/services/propertiesService/services/CssCurrentPropertiesService copy.js +0 -221
  32. package/dist/elements/services/propertiesService/services/CssPropertiesService copy.d.ts +0 -18
  33. package/dist/elements/services/propertiesService/services/CssPropertiesService copy.js +0 -221
  34. package/dist/elements/services/propertiesService/services/UnkownElementPropertiesService.d.ts +0 -20
  35. package/dist/elements/services/propertiesService/services/UnkownElementPropertiesService.js +0 -162
  36. package/dist/elements/services/stylesheetService/CssTreeStylesheetService copy.d.ts +0 -48
  37. package/dist/elements/services/stylesheetService/CssTreeStylesheetService copy.js +0 -185
  38. package/dist/elements/services/stylesheetService/StylesheetService.d.ts +0 -28
  39. package/dist/elements/services/stylesheetService/StylesheetService.js +0 -108
  40. package/dist/elements/services/undoService/transactionItems/PropertyChangeAction.d.ts +0 -15
  41. package/dist/elements/services/undoService/transactionItems/PropertyChangeAction.js +0 -36
  42. package/dist/elements/widgets/codeView/code-view-monaco copy.d.ts +0 -25
  43. package/dist/elements/widgets/codeView/code-view-monaco copy.js +0 -119
  44. package/dist/elements/widgets/designerView/ButtonSeperatorProvider.d.ts +0 -8
  45. package/dist/elements/widgets/designerView/ButtonSeperatorProvider.js +0 -11
  46. package/dist/elements/widgets/designerView/IDesignViewConfigButtonsProvider.d.ts +0 -5
  47. package/dist/elements/widgets/designerView/IDesignViewConfigButtonsProvider.js +0 -1
  48. package/dist/elements/widgets/designerView/extensions/FlexboxExtensionDesignViewConfigButtons.d.ts +0 -6
  49. package/dist/elements/widgets/designerView/extensions/FlexboxExtensionDesignViewConfigButtons.js +0 -22
  50. package/dist/elements/widgets/designerView/extensions/GridExtension copy.d.ts +0 -10
  51. package/dist/elements/widgets/designerView/extensions/GridExtension copy.js +0 -30
  52. package/dist/elements/widgets/designerView/extensions/GridExtensionDesignViewConfigButtons copy.d.ts +0 -6
  53. package/dist/elements/widgets/designerView/extensions/GridExtensionDesignViewConfigButtons copy.js +0 -21
  54. package/dist/elements/widgets/designerView/extensions/GridExtensionDesignViewConfigButtons.d.ts +0 -6
  55. package/dist/elements/widgets/designerView/extensions/GridExtensionDesignViewConfigButtons.js +0 -22
  56. package/dist/elements/widgets/designerView/extensions/GridExtensionProvider copy.d.ts +0 -11
  57. package/dist/elements/widgets/designerView/extensions/GridExtensionProvider copy.js +0 -18
  58. package/dist/elements/widgets/designerView/extensions/InvisibleDivExtension.d.ts +0 -11
  59. package/dist/elements/widgets/designerView/extensions/InvisibleDivExtension.js +0 -19
  60. package/dist/elements/widgets/designerView/extensions/InvisibleDivExtensionDesignViewConfigButtons.d.ts +0 -6
  61. package/dist/elements/widgets/designerView/extensions/InvisibleDivExtensionDesignViewConfigButtons.js +0 -22
  62. package/dist/elements/widgets/designerView/extensions/InvisibleDivExtensionProvider.d.ts +0 -11
  63. package/dist/elements/widgets/designerView/extensions/InvisibleDivExtensionProvider.js +0 -20
  64. package/dist/elements/widgets/designerView/extensions/InvisibleElementExtensionDesignViewConfigButtons.d.ts +0 -6
  65. package/dist/elements/widgets/designerView/extensions/InvisibleElementExtensionDesignViewConfigButtons.js +0 -22
  66. package/dist/elements/widgets/designerView/extensions/MouseOverExtension.d.ts +0 -11
  67. package/dist/elements/widgets/designerView/extensions/MouseOverExtension.js +0 -20
  68. package/dist/elements/widgets/designerView/extensions/MouseOverExtensionProvider.d.ts +0 -10
  69. package/dist/elements/widgets/designerView/extensions/MouseOverExtensionProvider.js +0 -13
  70. package/dist/elements/widgets/designerView/extensions/buttons/StylesheetServiceDesignViewConfigButtons copy.d.ts +0 -7
  71. package/dist/elements/widgets/designerView/extensions/buttons/StylesheetServiceDesignViewConfigButtons copy.js +0 -21
@@ -1,34 +0,0 @@
1
- export class IndentedTextWriter {
2
- _textHolder = '';
3
- indent = 4;
4
- level = 0;
5
- get position() {
6
- return this._textHolder.length;
7
- }
8
- isLastCharNewline() {
9
- return this._textHolder[this._textHolder.length - 1] === '\n';
10
- }
11
- levelRaise() {
12
- this.level++;
13
- }
14
- levelShrink() {
15
- this.level--;
16
- }
17
- write(text) {
18
- this._textHolder += text;
19
- }
20
- writeLine(text) {
21
- this.writeIndent();
22
- this._textHolder += text;
23
- this.writeNewline();
24
- }
25
- writeIndent() {
26
- this._textHolder += ''.padEnd(this.level * this.indent, ' ');
27
- }
28
- writeNewline() {
29
- this._textHolder += '\n';
30
- }
31
- getString() {
32
- return this._textHolder;
33
- }
34
- }
@@ -1,12 +0,0 @@
1
- export declare class SimpleTextWriter {
2
- private _textHolder;
3
- get position(): number;
4
- isLastCharNewline(): boolean;
5
- levelRaise(): void;
6
- levelShrink(): void;
7
- write(text: string): void;
8
- writeLine(text: string): void;
9
- writeIndent(): void;
10
- writeNewline(): void;
11
- getString(): string;
12
- }
@@ -1,26 +0,0 @@
1
- export class SimpleTextWriter {
2
- _textHolder = '';
3
- get position() {
4
- return this._textHolder.length;
5
- }
6
- isLastCharNewline() {
7
- return this._textHolder[this._textHolder.length - 1] === '\n';
8
- }
9
- levelRaise() {
10
- }
11
- levelShrink() {
12
- }
13
- write(text) {
14
- this._textHolder += text;
15
- }
16
- writeLine(text) {
17
- this._textHolder += text;
18
- }
19
- writeIndent() {
20
- }
21
- writeNewline() {
22
- }
23
- getString() {
24
- return this._textHolder;
25
- }
26
- }
@@ -1,12 +0,0 @@
1
- import { InstanceServiceContainer } from '../InstanceServiceContainer.js';
2
- import { ServiceContainer } from '../ServiceContainer.js';
3
- import { IHtmlParserService } from './IHtmlParserService.js';
4
- import { IDesignItem } from '../../item/IDesignItem.js';
5
- export declare class LitElementParserService implements IHtmlParserService {
6
- private _parserUrl;
7
- private _esprimaUrl;
8
- constructor(parserUrl?: string, esprimaUrl?: string);
9
- parse(module: string, serviceContainer: ServiceContainer, instanceServiceContainer: InstanceServiceContainer): Promise<IDesignItem[]>;
10
- private _parseDiv;
11
- _createDesignItemsRecursive(item: any, serviceContainer: ServiceContainer, instanceServiceContainer: InstanceServiceContainer, namespace: string): IDesignItem;
12
- }
@@ -1,120 +0,0 @@
1
- import { DesignItem } from '../../item/DesignItem.js';
2
- import { CssAttributeParser } from '../../helper/CssAttributeParser.js';
3
- import { newElementFromString } from '../../helper/ElementHelper.js';
4
- import * as esprima from "esprima-next/dist/esm/esprima";
5
- function* getChildNodes(node) {
6
- switch (node.type) {
7
- case esprima.Syntax.Program:
8
- yield node.body;
9
- break;
10
- case esprima.Syntax.ClassDeclaration:
11
- yield node.body;
12
- break;
13
- case esprima.Syntax.MethodDefinition:
14
- yield node.value;
15
- break;
16
- }
17
- }
18
- // Alternative Parser, cause when you use the Browser, it instanciates the CusomElements, and some Elemnts remove
19
- // attributes from their DOM, so you loose Data
20
- export class LitElementParserService {
21
- _parserUrl;
22
- _esprimaUrl;
23
- constructor(parserUrl = '../../../../../node-html-parser-esm/dist/index.js', esprimaUrl = '../../../../../esprima-next/dist/esm/esprima.js') {
24
- this._parserUrl = parserUrl;
25
- this._esprimaUrl = esprimaUrl;
26
- }
27
- async parse(module, serviceContainer, instanceServiceContainer) {
28
- let esprima = await import(this._esprimaUrl);
29
- const parsedModule = esprima.parseModule(module);
30
- const classDecl = parsedModule.body.find(x => x.type == esprima.Syntax.ClassDeclaration);
31
- const renderMethod = classDecl.body.body.find(x => x.type == esprima.Syntax.MethodDefinition && x.key.name == 'render');
32
- const renderMethodStatement = renderMethod.value.body.body[0];
33
- const taggedTemplate = renderMethodStatement.argument;
34
- const templateLiteral = taggedTemplate.quasi;
35
- const html = templateLiteral.quasis.map(x => x.value.raw).join();
36
- //@ts-ignore
37
- let parser = await import(this._parserUrl);
38
- const parsed = parser.parse(html, { comment: true });
39
- let designItems = [];
40
- for (let p of parsed.childNodes) {
41
- let di = this._createDesignItemsRecursive(p, serviceContainer, instanceServiceContainer, null);
42
- if (di != null)
43
- designItems.push(di);
44
- else
45
- console.warn("NodeHtmlParserService - could not parse element", p);
46
- }
47
- return designItems;
48
- }
49
- _parseDiv = document.createElement("div");
50
- _createDesignItemsRecursive(item, serviceContainer, instanceServiceContainer, namespace) {
51
- let designItem = null;
52
- if (item.nodeType == 1) {
53
- let element;
54
- let manualCreatedElement = false;
55
- if (!namespace)
56
- element = newElementFromString('<' + item.rawTagName + ' ' + item.rawAttrs + '></' + item.rawTagName + '>'); // some custom elements only parse attributes during constructor call
57
- if (!element) {
58
- if (namespace)
59
- element = document.createElementNS(namespace, item.rawTagName);
60
- else
61
- element = document.createElement(item.rawTagName);
62
- manualCreatedElement = true;
63
- }
64
- designItem = new DesignItem(element, item, serviceContainer, instanceServiceContainer);
65
- let hideAtDesignTime = false;
66
- let hideAtRunTime = false;
67
- let lockAtDesignTime = false;
68
- let style = '';
69
- let attr = item.attributes;
70
- for (let a in attr) {
71
- if (a !== 'style') {
72
- designItem._withoutUndoSetAttribute(a, attr[a]);
73
- if (manualCreatedElement) {
74
- element.setAttribute(a, attr[a]);
75
- }
76
- if (a === 'node-projects-hide-at-design-time')
77
- hideAtDesignTime = true;
78
- else if (a === 'node-projects-hide-at-run-time')
79
- hideAtRunTime = true;
80
- else if (a === 'node-projects-lock-at-design-time')
81
- lockAtDesignTime = true;
82
- }
83
- else {
84
- style = attr[a];
85
- }
86
- }
87
- if ((element instanceof HTMLElement || element instanceof SVGElement) && style) {
88
- let styleParser = new CssAttributeParser();
89
- styleParser.parse(style);
90
- for (let s of styleParser.entries) {
91
- designItem._withoutUndoSetStyle(s.name, s.value);
92
- if (manualCreatedElement) {
93
- element.style[s.name] = s.value;
94
- }
95
- }
96
- }
97
- if (!lockAtDesignTime && (element instanceof HTMLElement || element instanceof SVGElement)) {
98
- requestAnimationFrame(() => element.style.pointerEvents = 'auto');
99
- }
100
- designItem.hideAtDesignTime = hideAtDesignTime;
101
- designItem.hideAtRunTime = hideAtRunTime;
102
- designItem.lockAtDesignTime = lockAtDesignTime;
103
- element.draggable = false; //even if it should be true, for better designer exp.
104
- for (let c of item.childNodes) {
105
- let di = this._createDesignItemsRecursive(c, serviceContainer, instanceServiceContainer, element instanceof SVGElement ? 'http://www.w3.org/2000/svg' : null);
106
- designItem._insertChildInternal(di);
107
- }
108
- }
109
- else if (item.nodeType == 3) {
110
- this._parseDiv.innerHTML = item.rawText;
111
- let element = this._parseDiv.childNodes[0];
112
- designItem = new DesignItem(element, item, serviceContainer, instanceServiceContainer);
113
- }
114
- else if (item.nodeType == 8) {
115
- let element = document.createComment(item.rawText);
116
- designItem = new DesignItem(element, item, serviceContainer, instanceServiceContainer);
117
- }
118
- return designItem;
119
- }
120
- }
@@ -1,22 +0,0 @@
1
- import { IPropertiesService } from './IPropertiesService.js';
2
- import { IPropertyEditor } from './IPropertyEditor.js';
3
- import { PropertyType } from './PropertyType.js';
4
- export interface IProperty {
5
- name: string;
6
- renamable?: boolean;
7
- propertyName?: string;
8
- attributeName?: string;
9
- description?: string;
10
- type?: 'addNew' | 'json' | 'color' | 'date' | 'number' | 'list' | 'enum' | 'boolean' | 'img-lis' | 'thickness' | 'css-length' | 'string' | string;
11
- default?: any;
12
- min?: number;
13
- max?: number;
14
- step?: number;
15
- values?: string[];
16
- enumValues?: [name: string, value: string | number][];
17
- createEditor?: (property: IProperty) => IPropertyEditor;
18
- value?: any;
19
- service: IPropertiesService;
20
- defaultValue?: any;
21
- propertyType: PropertyType;
22
- }
@@ -1,8 +0,0 @@
1
- import { IDesignItem } from '../../item/IDesignItem.js';
2
- import { IPropertiesService } from './IPropertiesService.js';
3
- export interface IPropertyGroupsService {
4
- getPropertygroups(designItems: IDesignItem[]): {
5
- name: string;
6
- propertiesService: IPropertiesService;
7
- }[];
8
- }
@@ -1,17 +0,0 @@
1
- import { IDesignItem } from '../../item/IDesignItem.js';
2
- import { IPropertiesService } from './IPropertiesService.js';
3
- import { IPropertyGroupsService } from './IPropertyGroupsService.js';
4
- export declare class PropertyGroupsService implements IPropertyGroupsService {
5
- protected _pgList: {
6
- name: string;
7
- propertiesService: IPropertiesService;
8
- }[];
9
- protected _svgPgList: {
10
- name: string;
11
- propertiesService: IPropertiesService;
12
- }[];
13
- getPropertygroups(designItems: IDesignItem[]): {
14
- name: string;
15
- propertiesService: IPropertiesService;
16
- }[];
17
- }
@@ -1,29 +0,0 @@
1
- import { AttributesPropertiesService } from './services/AttributesPropertiesService.js';
2
- import { CommonPropertiesService } from './services/CommonPropertiesService.js';
3
- import { CssPropertiesService } from './services/CssPropertiesService.js';
4
- export class PropertyGroupsService {
5
- _pgList = [
6
- { name: 'properties', propertiesService: null },
7
- { name: 'attributes', propertiesService: new AttributesPropertiesService() },
8
- { name: 'common', propertiesService: new CommonPropertiesService() },
9
- { name: 'styles', propertiesService: new CssPropertiesService("styles") },
10
- { name: 'layout', propertiesService: new CssPropertiesService("layout") },
11
- { name: 'flex', propertiesService: new CssPropertiesService("flex") },
12
- { name: 'grid', propertiesService: new CssPropertiesService("grid") },
13
- ];
14
- _svgPgList = [
15
- { name: 'properties', propertiesService: null },
16
- { name: 'attributes', propertiesService: new AttributesPropertiesService() },
17
- { name: 'styles', propertiesService: new CssPropertiesService("styles") },
18
- { name: 'layout', propertiesService: new CssPropertiesService("layout") },
19
- ];
20
- getPropertygroups(designItems) {
21
- if (designItems == null || designItems.length == 0)
22
- return [];
23
- this._pgList[0].propertiesService = designItems[0].serviceContainer.getLastServiceWhere('propertyService', x => x.isHandledElement(designItems[0]));
24
- this._svgPgList[0].propertiesService = designItems[0].serviceContainer.getLastServiceWhere('propertyService', x => x.isHandledElement(designItems[0]));
25
- if (designItems[0].element instanceof SVGElement)
26
- return this._svgPgList;
27
- return this._pgList;
28
- }
29
- }
@@ -1,7 +0,0 @@
1
- import { IProperty } from '../IProperty';
2
- import { IDesignItem } from '../../../item/IDesignItem';
3
- import { UnkownElementPropertiesService } from "./UnkownElementPropertiesService";
4
- export declare abstract class AbstractBasePropertiesService extends UnkownElementPropertiesService {
5
- getProperties(designItem: IDesignItem): IProperty[];
6
- protected parseProperties(list: any): IProperty[];
7
- }
@@ -1,44 +0,0 @@
1
- import { PropertiesHelper } from './PropertiesHelper';
2
- import { UnkownElementPropertiesService } from "./UnkownElementPropertiesService";
3
- import { PropertyType } from '../PropertyType';
4
- export class AbstractBasePropertiesService extends UnkownElementPropertiesService {
5
- getProperties(designItem) {
6
- if (!this.isHandledElement(designItem))
7
- return null;
8
- return this.parseProperties(designItem.element.constructor.properties);
9
- }
10
- parseProperties(list) {
11
- let properties = [];
12
- for (const name in list) {
13
- const polymerProperty = list[name];
14
- let type = polymerProperty;
15
- if (polymerProperty.type)
16
- type = polymerProperty.type;
17
- if (type === String) {
18
- let property = { name: name, type: "string", service: this, propertyType: PropertyType.propertyAndAttribute };
19
- properties.push(property);
20
- }
21
- else if (type === Object) {
22
- let property = { name: name, type: "object", service: this, propertyType: PropertyType.propertyAndAttribute };
23
- properties.push(property);
24
- }
25
- else if (type === Number) {
26
- let property = { name: name, type: "number", service: this, propertyType: PropertyType.propertyAndAttribute };
27
- properties.push(property);
28
- }
29
- else if (type === Date) {
30
- let property = { name: name, type: "date", service: this, propertyType: PropertyType.propertyAndAttribute };
31
- properties.push(property);
32
- }
33
- else if (type === Boolean) {
34
- let property = { name: name, type: "boolean", service: this, propertyType: PropertyType.propertyAndAttribute };
35
- properties.push(property);
36
- }
37
- else if (PropertiesHelper.isTypescriptEnum(type)) {
38
- let property = { name: name, type: "enum", enumValues: PropertiesHelper.getTypescriptEnumEntries(type), service: this, propertyType: PropertyType.propertyAndAttribute };
39
- properties.push(property);
40
- }
41
- }
42
- return properties;
43
- }
44
- }
@@ -1,18 +0,0 @@
1
- import { IProperty } from '../IProperty.js';
2
- import { IDesignItem } from '../../../item/IDesignItem.js';
3
- import { BindingTarget } from '../../../item/BindingTarget.js';
4
- import { CommonPropertiesService } from './CommonPropertiesService.js';
5
- import { RefreshMode } from '../IPropertiesService.js';
6
- import { IPropertyGroup } from '../IPropertyGroup.js';
7
- export declare class CssPropertiesService extends CommonPropertiesService {
8
- getRefreshMode(designItem: IDesignItem): RefreshMode.none | RefreshMode.fullOnValueChange;
9
- layout: IProperty[];
10
- grid: IProperty[];
11
- flex: IProperty[];
12
- constructor(name: 'styles' | 'layout' | 'grid' | 'flex');
13
- isHandledElement(designItem: IDesignItem): boolean;
14
- getProperty(designItem: IDesignItem, name: string): IProperty;
15
- getProperties(designItem: IDesignItem): IProperty[] | IPropertyGroup[];
16
- getPropertyTarget(designItem: IDesignItem, property: IProperty): BindingTarget;
17
- setValue(designItems: IDesignItem[], property: IProperty, value: any): void;
18
- }
@@ -1,221 +0,0 @@
1
- import { BindingTarget } from '../../../item/BindingTarget.js';
2
- import { PropertyType } from '../PropertyType.js';
3
- import { CommonPropertiesService } from './CommonPropertiesService.js';
4
- import { RefreshMode } from '../IPropertiesService.js';
5
- export class CssPropertiesService extends CommonPropertiesService {
6
- getRefreshMode(designItem) {
7
- return this.name == 'styles' ? RefreshMode.fullOnValueChange : RefreshMode.none;
8
- }
9
- layout = [
10
- {
11
- name: "display",
12
- type: "list",
13
- values: ["block", "inline", "inline-block", "flex", "inline-flex", "contents", "grid", "inline-grid", "inherit", "initial", "none"],
14
- service: this,
15
- propertyType: PropertyType.cssValue
16
- },
17
- {
18
- name: "color",
19
- type: "color",
20
- service: this,
21
- propertyType: PropertyType.cssValue
22
- }, {
23
- name: "background-color",
24
- type: "color",
25
- service: this,
26
- propertyType: PropertyType.cssValue
27
- }, {
28
- name: "box-sizing",
29
- type: "list",
30
- values: ["border-box", "content-box"],
31
- service: this,
32
- propertyType: PropertyType.cssValue
33
- }, {
34
- name: "border",
35
- type: "string",
36
- default: "0px none rbg(0,0,0)",
37
- service: this,
38
- propertyType: PropertyType.cssValue
39
- }, {
40
- name: "box-shadow",
41
- type: "string",
42
- default: "none",
43
- service: this,
44
- propertyType: PropertyType.cssValue
45
- }, {
46
- name: "opacity",
47
- type: "number",
48
- min: 0,
49
- max: 1,
50
- step: 0.1,
51
- service: this,
52
- propertyType: PropertyType.cssValue
53
- }, {
54
- name: "metrics",
55
- type: "metrics",
56
- service: this,
57
- propertyType: PropertyType.complex
58
- }, {
59
- name: "position",
60
- type: "list",
61
- values: ["static", "relative", "absolute"],
62
- service: this,
63
- propertyType: PropertyType.cssValue
64
- }, {
65
- name: "font-size",
66
- type: "css-length",
67
- service: this,
68
- propertyType: PropertyType.cssValue
69
- }, {
70
- name: "font-weight",
71
- type: "list",
72
- values: ["normal", "bold", "100", "200", "300", "400", "500", "600", "700", "800", "900", "lighter", "bolder"],
73
- service: this,
74
- propertyType: PropertyType.cssValue
75
- }
76
- ];
77
- grid = [
78
- {
79
- name: "display",
80
- type: "list",
81
- values: ["block", "inline-block", "flex", "contents", "grid", "inherit", "initial", "none"],
82
- service: this,
83
- propertyType: PropertyType.cssValue
84
- }, {
85
- name: "position",
86
- type: "list",
87
- values: ["static", "relative", "absolute"],
88
- service: this,
89
- propertyType: PropertyType.cssValue
90
- }, {
91
- name: "grid-template-columns",
92
- type: "string",
93
- service: this,
94
- propertyType: PropertyType.cssValue
95
- }, {
96
- name: "grid-template-rows",
97
- type: "string",
98
- service: this,
99
- propertyType: PropertyType.cssValue
100
- }, {
101
- name: "column-gap",
102
- type: "css-length",
103
- service: this,
104
- propertyType: PropertyType.cssValue
105
- }, {
106
- name: "row-gap",
107
- type: "css-length",
108
- service: this,
109
- propertyType: PropertyType.cssValue
110
- }, {
111
- name: "align-content",
112
- type: "img-list",
113
- values: ["center", "space-between", "space-around", "space-evenly", "stretch"],
114
- service: this,
115
- propertyType: PropertyType.cssValue
116
- }, {
117
- name: "justify-content",
118
- type: "img-list",
119
- values: ["center", "start", "end", "space-between", "space-around", "space-evenly"],
120
- service: this,
121
- propertyType: PropertyType.cssValue
122
- }, {
123
- name: "align-items",
124
- type: "img-list",
125
- values: ["center", "start", "end", "stretch", "baseline"],
126
- service: this,
127
- propertyType: PropertyType.cssValue
128
- }, {
129
- name: "justify-items",
130
- type: "img-list",
131
- values: ["center", "start", "end", "stretch"],
132
- service: this,
133
- propertyType: PropertyType.cssValue
134
- }
135
- ];
136
- flex = [
137
- {
138
- name: "display",
139
- type: "list",
140
- values: ["block", "inline-block", "flex", "contents", "grid", "inherit", "initial", "none"],
141
- service: this,
142
- propertyType: PropertyType.cssValue
143
- }, {
144
- name: "position",
145
- type: "list",
146
- values: ["static", "relative", "absolute"],
147
- service: this,
148
- propertyType: PropertyType.cssValue
149
- }, {
150
- name: "flex-direction",
151
- type: "img-list",
152
- values: ["row", "column"],
153
- service: this,
154
- propertyType: PropertyType.cssValue
155
- }, {
156
- name: "flex-wrap",
157
- type: "img-list",
158
- values: ["nowrap", "wrap"],
159
- service: this,
160
- propertyType: PropertyType.cssValue
161
- }, {
162
- name: "align-content",
163
- type: "img-list",
164
- values: ["center", "flex-start", "flex-end", "space-between", "space-around", "stretch"],
165
- service: this,
166
- propertyType: PropertyType.cssValue
167
- }, {
168
- name: "justify-content",
169
- type: "img-list",
170
- values: ["center", "flex-start", "flex-end", "space-between", "space-around", "space-evenly"],
171
- service: this,
172
- propertyType: PropertyType.cssValue
173
- }, {
174
- name: "align-items",
175
- type: "img-list",
176
- values: ["center", "flex-start", "flex-end", "stretch", "baseline"],
177
- service: this,
178
- propertyType: PropertyType.cssValue
179
- }
180
- ];
181
- constructor(name) {
182
- super();
183
- this.name = name;
184
- }
185
- isHandledElement(designItem) {
186
- return true;
187
- }
188
- getProperty(designItem, name) {
189
- if (this.name == 'styles') {
190
- return { name: name, type: 'string', service: this, propertyType: PropertyType.cssValue };
191
- }
192
- return this[this.name][name];
193
- }
194
- getProperties(designItem) {
195
- if (this.name == 'styles') {
196
- if (!designItem)
197
- return [];
198
- let styles = designItem.getAllStyles();
199
- let arr = styles.map(x => ({ name: x.selector ?? '&lt;local&gt;', description: x.stylesheetName ?? '', properties: [
200
- ...x.declarations.map(y => ({ name: y.name, renamable: true, type: 'string', service: this, propertyType: PropertyType.cssValue })),
201
- { name: '', type: 'addNew', service: this, propertyType: PropertyType.complex }
202
- ]
203
- }));
204
- //let arr: IProperty[] = Array.from(designItem.styles(), ([key, value]) => ({ name: key, renamable: true, type: 'string', service: this, propertyType: PropertyType.cssValue }));
205
- //arr.push({ name: '', type: 'addNew', service: this, propertyType: PropertyType.complex });
206
- return arr;
207
- }
208
- return this[this.name];
209
- }
210
- getPropertyTarget(designItem, property) {
211
- return BindingTarget.css;
212
- }
213
- setValue(designItems, property, value) {
214
- if (this.name == 'styles') {
215
- super.setValue(designItems, { ...property, propertyType: PropertyType.cssValue }, value);
216
- }
217
- else {
218
- super.setValue(designItems, property, value);
219
- }
220
- }
221
- }
@@ -1,18 +0,0 @@
1
- import { IProperty } from '../IProperty.js';
2
- import { IDesignItem } from '../../../item/IDesignItem.js';
3
- import { BindingTarget } from '../../../item/BindingTarget.js';
4
- import { CommonPropertiesService } from './CommonPropertiesService.js';
5
- import { RefreshMode } from '../IPropertiesService.js';
6
- import { IPropertyGroup } from '../IPropertyGroup.js';
7
- export declare class CssPropertiesService extends CommonPropertiesService {
8
- getRefreshMode(designItem: IDesignItem): RefreshMode.none | RefreshMode.fullOnValueChange;
9
- layout: IProperty[];
10
- grid: IProperty[];
11
- flex: IProperty[];
12
- constructor(name: 'styles' | 'layout' | 'grid' | 'flex');
13
- isHandledElement(designItem: IDesignItem): boolean;
14
- getProperty(designItem: IDesignItem, name: string): IProperty;
15
- getProperties(designItem: IDesignItem): IProperty[] | IPropertyGroup[];
16
- getPropertyTarget(designItem: IDesignItem, property: IProperty): BindingTarget;
17
- setValue(designItems: IDesignItem[], property: IProperty, value: any): void;
18
- }