@operato/property-editor 2.0.0-alpha.94 → 2.0.0-alpha.96

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 (32) hide show
  1. package/CHANGELOG.md +18 -0
  2. package/demo/index.html +7 -1
  3. package/dist/src/ox-properties-dynamic-view.js +6 -1
  4. package/dist/src/ox-properties-dynamic-view.js.map +1 -1
  5. package/dist/src/ox-property-editor-textarea.d.ts +1 -0
  6. package/dist/src/ox-property-editor-textarea.js +9 -1
  7. package/dist/src/ox-property-editor-textarea.js.map +1 -1
  8. package/dist/src/ox-property-editor.js +1 -1
  9. package/dist/src/ox-property-editor.js.map +1 -1
  10. package/dist/src/types.d.ts +6 -0
  11. package/dist/src/types.js.map +1 -1
  12. package/dist/stories/index.stories.d.ts +24 -3
  13. package/dist/stories/index.stories.js +260 -21
  14. package/dist/stories/index.stories.js.map +1 -1
  15. package/dist/stories/ox-properties-dynamic-view.stories copy.d.ts +53 -0
  16. package/dist/stories/ox-properties-dynamic-view.stories copy.js +271 -0
  17. package/dist/stories/ox-properties-dynamic-view.stories copy.js.map +1 -0
  18. package/dist/stories/ox-properties-dynamic-view.stories.d.ts +53 -0
  19. package/dist/stories/ox-properties-dynamic-view.stories.js +274 -0
  20. package/dist/stories/ox-properties-dynamic-view.stories.js.map +1 -0
  21. package/dist/stories/ox-properties-editor-textarea.stories.d.ts +31 -0
  22. package/dist/stories/ox-properties-editor-textarea.stories.js +76 -0
  23. package/dist/stories/ox-properties-editor-textarea.stories.js.map +1 -0
  24. package/dist/tsconfig.tsbuildinfo +1 -1
  25. package/package.json +3 -3
  26. package/src/ox-properties-dynamic-view.ts +8 -2
  27. package/src/ox-property-editor-textarea.ts +10 -1
  28. package/src/ox-property-editor.ts +1 -1
  29. package/src/types.ts +7 -0
  30. package/stories/ox-properties-dynamic-view.stories.ts +296 -0
  31. package/stories/ox-properties-editor-textarea.stories.ts +97 -0
  32. package/stories/index.stories.ts +0 -50
package/CHANGELOG.md CHANGED
@@ -3,6 +3,24 @@
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
+ ## [2.0.0-alpha.96](https://github.com/hatiolab/operato/compare/v2.0.0-alpha.95...v2.0.0-alpha.96) (2024-04-21)
7
+
8
+
9
+ ### :bug: Bug Fix
10
+
11
+ * style for ox-parameters-builder ([6a9a3fb](https://github.com/hatiolab/operato/commit/6a9a3fb74493257790677ecc2664f27beb6b849e))
12
+
13
+
14
+
15
+ ## [2.0.0-alpha.95](https://github.com/hatiolab/operato/compare/v2.0.0-alpha.94...v2.0.0-alpha.95) (2024-04-21)
16
+
17
+
18
+ ### :bug: Bug Fix
19
+
20
+ * add styles for CSStyles property into PropertySpec ([1c18564](https://github.com/hatiolab/operato/commit/1c185645c2f8e8b0c8a654d15e3b7603b80d2864))
21
+
22
+
23
+
6
24
  ## [2.0.0-alpha.94](https://github.com/hatiolab/operato/compare/v2.0.0-alpha.93...v2.0.0-alpha.94) (2024-04-20)
7
25
 
8
26
  **Note:** Version bump only for package @operato/property-editor
package/demo/index.html CHANGED
@@ -16,6 +16,9 @@
16
16
 
17
17
  ox-properties-dynamic-view {
18
18
  width: 100vw;
19
+
20
+ display: flex;
21
+ flex-direction: column;
19
22
  }
20
23
  </style>
21
24
 
@@ -197,7 +200,10 @@
197
200
  {
198
201
  type: 'textarea',
199
202
  label: 'TA',
200
- name: 'TA'
203
+ name: 'TA',
204
+ styles: {
205
+ flex: '1'
206
+ }
201
207
  },
202
208
  {
203
209
  type: 'options',
@@ -56,7 +56,7 @@ let OxPropertiesDynamicView = class OxPropertiesDynamicView extends LitElement {
56
56
  const specs = this.props || [];
57
57
  this.textContent = '';
58
58
  specs.forEach(spec => {
59
- const { label, type, name, placeholder, editor, quantifier, observe, property, defaultValue } = spec;
59
+ const { label, type, name, placeholder, editor, quantifier, observe, property, defaultValue, styles } = spec;
60
60
  let elementType = OxPropertyEditor.getEditor(type);
61
61
  if (!elementType) {
62
62
  console.warn('Property Editor not defined', type);
@@ -76,6 +76,11 @@ let OxPropertiesDynamicView = class OxPropertiesDynamicView extends LitElement {
76
76
  }
77
77
  element.property = property;
78
78
  element.setAttribute('property-editor', 'true');
79
+ if (styles) {
80
+ Object.keys(styles).forEach((key) => {
81
+ element.style[key] = styles[key];
82
+ });
83
+ }
79
84
  this.appendChild(element);
80
85
  });
81
86
  }
@@ -1 +1 @@
1
- {"version":3,"file":"ox-properties-dynamic-view.js","sourceRoot":"","sources":["../../src/ox-properties-dynamic-view.ts"],"names":[],"mappings":"AAAA;;GAEG;;AAEH,OAAO,EAAE,IAAI,EAAE,UAAU,EAAkB,MAAM,KAAK,CAAA;AACtD,OAAO,EAAE,aAAa,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAA;AAE3D,OAAO,EAAE,gBAAgB,EAAE,MAAM,yBAAyB,CAAA;AAG1D;;;;;;;;;;;EAWE;AAEF,MAAM,aAAa,GAAG;IACpB,MAAM,EAAE,EAAE;IACV,MAAM,EAAE,CAAC;IACT,KAAK,EAAE,CAAC;IACR,MAAM,EAAE,EAAE;IACV,QAAQ,EAAE,EAAE;IACZ,QAAQ,EAAE,EAAE;IACZ,QAAQ,EAAE,KAAK;IACf,MAAM,EAAE,EAAE;IACV,KAAK,EAAE,SAAS;IAChB,kBAAkB,EAAE,IAAI;IACxB,qBAAqB,EAAE,IAAI;IAC3B,eAAe,EAAE,EAAE;IACnB,gBAAgB,EAAE,EAAE;IACpB,aAAa,EAAE,IAAI;IACnB,WAAW,EAAE,IAAI;IACjB,aAAa,EAAE,EAAE;IACjB,OAAO,EAAE,IAAI;IACb,IAAI,EAAE,IAAI;CACX,CAAA;AAGM,IAAM,uBAAuB,GAA7B,MAAM,uBAAwB,SAAQ,UAAU;IAAhD;;QACuB,UAAK,GAA4B,EAAE,CAAA;IA4FjE,CAAC;IAzFC,MAAM;QACJ,OAAO,IAAI,CAAA,eAAe,CAAA;IAC5B,CAA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GAAG,MAAM,CAAC,YAAY,CAAC,MAAM,CAAC,CAAA;QACtC,IAAI,CAAC,IAAI,EAAE,CAAC;YACV,OAAM;QACR,CAAC;QAED,IAAI,IAAI,CAAC,KAAK,EAAE,CAAC;YACf,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,GAAG,MAAM,CAAC,KAAK,CAAA;QACjC,CAAC;aAAM,CAAC;YACN,IAAI,CAAC,KAAK,GAAG;gBACX,CAAC,IAAI,CAAC,EAAE,MAAM,CAAC,KAAK;aACrB,CAAA;QACH,CAAC;QAED,IAAI,CAAC,aAAa,CAChB,IAAI,WAAW,CAAC,iBAAiB,EAAE;YACjC,OAAO,EAAE,IAAI;YACb,QAAQ,EAAE,IAAI;YACd,MAAM,EAAE,IAAI,CAAC,KAAK;SACnB,CAAC,CACH,CAAA;IACH,CAAC;CACF,CAAA;AA5F6B;IAA3B,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;sDAAoC;AACpC;IAA1B,QAAQ,CAAC,EAAE,IAAI,EAAE,KAAK,EAAE,CAAC;sDAAuB;AAFtC,uBAAuB;IADnC,aAAa,CAAC,4BAA4B,CAAC;GAC/B,uBAAuB,CA6FnC","sourcesContent":["/**\n * @license Copyright © HatioLab Inc. All rights reserved.\n */\n\nimport { html, LitElement, PropertyValues } from 'lit'\nimport { customElement, property } from 'lit/decorators.js'\n\nimport { OxPropertyEditor } from './ox-property-editor.js'\nimport { PropertySpec } from './types.js'\n\n/**\n모든 에디터들은 change 이벤트를 지원해야 한다. 또한, 모든 에디터들은 value속성에 값을 가져야 한다.\n\nExample:\n\n <ox-properties-dynamic-view value=\"{{value}}\">\n <label>Center X</label>\n <input type=\"number\" .value=\"${value.cx}\">\n <label>Width</label>\n <input type=\"number\" .value=\"${value.width}\">\n </ox-properties-dynamic-view>\n*/\n\nconst DEFAULT_VALUE = {\n legend: '',\n number: 0,\n angle: 0,\n string: '',\n password: '',\n textarea: '',\n checkbox: false,\n select: '',\n color: '#000000',\n 'solidcolor-stops': null,\n 'gradientcolor-stops': null,\n 'gltf-selector': '',\n 'image-selector': '',\n multiplecolor: null,\n editortable: null,\n imageselector: '',\n options: null,\n date: null\n}\n\n@customElement('ox-properties-dynamic-view')\nexport class OxPropertiesDynamicView extends LitElement {\n @property({ type: Object }) value: { [name: string]: any } = {}\n @property({ type: Array }) props?: PropertySpec[]\n\n render() {\n return html`<slot></slot>`\n }\n\n firstUpdated() {\n this.addEventListener('change', this._onValueChanged.bind(this))\n }\n\n updated(changes: PropertyValues<this>) {\n changes.has('props') && this._onPropsChanged(this.props || [])\n changes.has('value') && this._setValues()\n }\n\n _onPropsChanged(props: PropertySpec[]) {\n const specs = this.props || []\n\n this.textContent = ''\n specs.forEach(spec => {\n const { label, type, name, placeholder, editor, quantifier, observe, property, defaultValue } = spec\n\n let elementType = OxPropertyEditor.getEditor(type)\n if (!elementType) {\n console.warn('Property Editor not defined', type)\n return\n }\n let element = document.createElement(elementType) as OxPropertyEditor\n\n element.label = label\n element.type = type\n element.placeholder = placeholder\n element.name = name\n element.setAttribute('name', name)\n element.editor = editor\n element.quantifier = quantifier\n element.defaultValue = defaultValue\n\n if (observe) {\n element.observeHandler = observe\n }\n element.property = property\n element.setAttribute('property-editor', 'true')\n\n this.appendChild(element)\n })\n }\n\n _setValues() {\n this.value &&\n Array.from(this.querySelectorAll('[name]')).forEach(prop => {\n const editor = prop as OxPropertyEditor\n const name = editor.getAttribute('name')\n\n var value = this.value[name!]\n if (value === undefined) {\n value = editor.defaultValue !== undefined ? editor.defaultValue : (DEFAULT_VALUE as any)[editor.type]\n }\n\n editor.value = value\n editor.observe.call(prop, editor.value)\n })\n }\n\n _onValueChanged(e: Event) {\n e.stopPropagation()\n var target = e.target as Element\n\n const editor = target.closest('[property-editor]') as OxPropertyEditor\n\n var name = editor.getAttribute('name')\n if (!name) {\n return\n }\n\n if (this.value) {\n this.value[name] = editor.value\n } else {\n this.value = {\n [name]: editor.value\n }\n }\n\n this.dispatchEvent(\n new CustomEvent('property-change', {\n bubbles: true,\n composed: true,\n detail: this.value\n })\n )\n }\n}\n"]}
1
+ {"version":3,"file":"ox-properties-dynamic-view.js","sourceRoot":"","sources":["../../src/ox-properties-dynamic-view.ts"],"names":[],"mappings":"AAAA;;GAEG;;AAEH,OAAO,EAAE,IAAI,EAAE,UAAU,EAAkB,MAAM,KAAK,CAAA;AACtD,OAAO,EAAE,aAAa,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAA;AAE3D,OAAO,EAAE,gBAAgB,EAAE,MAAM,yBAAyB,CAAA;AAG1D;;;;;;;;;;;EAWE;AAEF,MAAM,aAAa,GAAG;IACpB,MAAM,EAAE,EAAE;IACV,MAAM,EAAE,CAAC;IACT,KAAK,EAAE,CAAC;IACR,MAAM,EAAE,EAAE;IACV,QAAQ,EAAE,EAAE;IACZ,QAAQ,EAAE,EAAE;IACZ,QAAQ,EAAE,KAAK;IACf,MAAM,EAAE,EAAE;IACV,KAAK,EAAE,SAAS;IAChB,kBAAkB,EAAE,IAAI;IACxB,qBAAqB,EAAE,IAAI;IAC3B,eAAe,EAAE,EAAE;IACnB,gBAAgB,EAAE,EAAE;IACpB,aAAa,EAAE,IAAI;IACnB,WAAW,EAAE,IAAI;IACjB,aAAa,EAAE,EAAE;IACjB,OAAO,EAAE,IAAI;IACb,IAAI,EAAE,IAAI;CACX,CAAA;AAGM,IAAM,uBAAuB,GAA7B,MAAM,uBAAwB,SAAQ,UAAU;IAAhD;;QACuB,UAAK,GAA4B,EAAE,CAAA;IAkGjE,CAAC;IA/FC,MAAM;QACJ,OAAO,IAAI,CAAA,eAAe,CAAA;IAC5B,CAAC;IAED,YAAY;QACV,IAAI,CAAC,gBAAgB,CAAC,QAAQ,EAAE,IAAI,CAAC,eAAe,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,CAAA;IAClE,CAAC;IAED,OAAO,CAAC,OAA6B;QACnC,OAAO,CAAC,GAAG,CAAC,OAAO,CAAC,IAAI,IAAI,CAAC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CAAqB,CAAA;QAEtE,IAAI,IAAI,GAAG,MAAM,CAAC,YAAY,CAAC,MAAM,CAAC,CAAA;QACtC,IAAI,CAAC,IAAI,EAAE,CAAC;YACV,OAAM;QACR,CAAC;QAED,IAAI,IAAI,CAAC,KAAK,EAAE,CAAC;YACf,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,GAAG,MAAM,CAAC,KAAK,CAAA;QACjC,CAAC;aAAM,CAAC;YACN,IAAI,CAAC,KAAK,GAAG;gBACX,CAAC,IAAI,CAAC,EAAE,MAAM,CAAC,KAAK;aACrB,CAAA;QACH,CAAC;QAED,IAAI,CAAC,aAAa,CAChB,IAAI,WAAW,CAAC,iBAAiB,EAAE;YACjC,OAAO,EAAE,IAAI;YACb,QAAQ,EAAE,IAAI;YACd,MAAM,EAAE,IAAI,CAAC,KAAK;SACnB,CAAC,CACH,CAAA;IACH,CAAC;CACF,CAAA;AAlG6B;IAA3B,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;sDAAoC;AACpC;IAA1B,QAAQ,CAAC,EAAE,IAAI,EAAE,KAAK,EAAE,CAAC;sDAAuB;AAFtC,uBAAuB;IADnC,aAAa,CAAC,4BAA4B,CAAC;GAC/B,uBAAuB,CAmGnC","sourcesContent":["/**\n * @license Copyright © HatioLab Inc. All rights reserved.\n */\n\nimport { html, LitElement, PropertyValues } from 'lit'\nimport { customElement, property } from 'lit/decorators.js'\n\nimport { OxPropertyEditor } from './ox-property-editor.js'\nimport { PropertySpec, CSSStyles } from './types.js'\n\n/**\n모든 에디터들은 change 이벤트를 지원해야 한다. 또한, 모든 에디터들은 value속성에 값을 가져야 한다.\n\nExample:\n\n <ox-properties-dynamic-view value=\"{{value}}\">\n <label>Center X</label>\n <input type=\"number\" .value=\"${value.cx}\">\n <label>Width</label>\n <input type=\"number\" .value=\"${value.width}\">\n </ox-properties-dynamic-view>\n*/\n\nconst DEFAULT_VALUE = {\n legend: '',\n number: 0,\n angle: 0,\n string: '',\n password: '',\n textarea: '',\n checkbox: false,\n select: '',\n color: '#000000',\n 'solidcolor-stops': null,\n 'gradientcolor-stops': null,\n 'gltf-selector': '',\n 'image-selector': '',\n multiplecolor: null,\n editortable: null,\n imageselector: '',\n options: null,\n date: null\n}\n\n@customElement('ox-properties-dynamic-view')\nexport class OxPropertiesDynamicView extends LitElement {\n @property({ type: Object }) value: { [name: string]: any } = {}\n @property({ type: Array }) props?: PropertySpec[]\n\n render() {\n return html`<slot></slot>`\n }\n\n firstUpdated() {\n this.addEventListener('change', this._onValueChanged.bind(this))\n }\n\n updated(changes: PropertyValues<this>) {\n changes.has('props') && this._onPropsChanged(this.props || [])\n changes.has('value') && this._setValues()\n }\n\n _onPropsChanged(props: PropertySpec[]) {\n const specs = this.props || []\n\n this.textContent = ''\n specs.forEach(spec => {\n const { label, type, name, placeholder, editor, quantifier, observe, property, defaultValue, styles } = spec\n\n let elementType = OxPropertyEditor.getEditor(type)\n if (!elementType) {\n console.warn('Property Editor not defined', type)\n return\n }\n let element = document.createElement(elementType) as OxPropertyEditor\n\n element.label = label\n element.type = type\n element.placeholder = placeholder\n element.name = name\n element.setAttribute('name', name)\n element.editor = editor\n element.quantifier = quantifier\n element.defaultValue = defaultValue\n\n if (observe) {\n element.observeHandler = observe\n }\n element.property = property\n element.setAttribute('property-editor', 'true')\n\n if (styles) {\n Object.keys(styles).forEach((key: string) => {\n element.style[key as keyof CSSStyles] = styles![key as keyof CSSStyles]\n })\n }\n\n this.appendChild(element)\n })\n }\n\n _setValues() {\n this.value &&\n Array.from(this.querySelectorAll('[name]')).forEach(prop => {\n const editor = prop as OxPropertyEditor\n const name = editor.getAttribute('name')\n\n var value = this.value[name!]\n if (value === undefined) {\n value = editor.defaultValue !== undefined ? editor.defaultValue : (DEFAULT_VALUE as any)[editor.type]\n }\n\n editor.value = value\n editor.observe.call(prop, editor.value)\n })\n }\n\n _onValueChanged(e: Event) {\n e.stopPropagation()\n var target = e.target as Element\n\n const editor = target.closest('[property-editor]') as OxPropertyEditor\n\n var name = editor.getAttribute('name')\n if (!name) {\n return\n }\n\n if (this.value) {\n this.value[name] = editor.value\n } else {\n this.value = {\n [name]: editor.value\n }\n }\n\n this.dispatchEvent(\n new CustomEvent('property-change', {\n bubbles: true,\n composed: true,\n detail: this.value\n })\n )\n }\n}\n"]}
@@ -3,5 +3,6 @@ import { TemplateResult } from 'lit';
3
3
  import { OxPropertyEditor } from './ox-property-editor.js';
4
4
  import { PropertySpec } from './types.js';
5
5
  export declare class OxPropertyEditorTextArea extends OxPropertyEditor {
6
+ static styles: import("lit").CSSResult[];
6
7
  editorTemplate(value: any, spec: PropertySpec): TemplateResult;
7
8
  }
@@ -1,6 +1,6 @@
1
1
  import { __decorate } from "tslib";
2
2
  import '@operato/input/ox-input-code.js';
3
- import { html } from 'lit';
3
+ import { css, html } from 'lit';
4
4
  import { customElement } from 'lit/decorators.js';
5
5
  import { OxPropertyEditor } from './ox-property-editor.js';
6
6
  let OxPropertyEditorTextArea = class OxPropertyEditorTextArea extends OxPropertyEditor {
@@ -21,6 +21,14 @@ let OxPropertyEditorTextArea = class OxPropertyEditorTextArea extends OxProperty
21
21
  `;
22
22
  }
23
23
  };
24
+ OxPropertyEditorTextArea.styles = [
25
+ ...OxPropertyEditor.styles,
26
+ css `
27
+ :host {
28
+ grid-template-rows: auto 1fr;
29
+ }
30
+ `
31
+ ];
24
32
  OxPropertyEditorTextArea = __decorate([
25
33
  customElement('ox-property-editor-textarea')
26
34
  ], OxPropertyEditorTextArea);
@@ -1 +1 @@
1
- {"version":3,"file":"ox-property-editor-textarea.js","sourceRoot":"","sources":["../../src/ox-property-editor-textarea.ts"],"names":[],"mappings":";AAAA,OAAO,iCAAiC,CAAA;AAExC,OAAO,EAAE,IAAI,EAAkB,MAAM,KAAK,CAAA;AAC1C,OAAO,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAA;AAEjD,OAAO,EAAE,gBAAgB,EAAE,MAAM,yBAAyB,CAAA;AAInD,IAAM,wBAAwB,GAA9B,MAAM,wBAAyB,SAAQ,gBAAgB;IAC5D,cAAc,CAAC,KAAU,EAAE,IAAkB;;QAC3C,MAAM,EAAE,SAAS,GAAG,IAAI,EAAE,GAAG,IAAI,CAAC,MAAM,IAAI,EAAE,CAAA;QAE9C,OAAO,IAAI,CAAA;;;iBAGE,KAAK;mBACH,CAAA,MAAA,IAAI,CAAC,QAAQ,0CAAE,OAAO,KAAI,EAAE;uBACxB,CAAA,MAAA,IAAI,CAAC,QAAQ,0CAAE,UAAU,KAAI,OAAO;qBACtC,SAAS;mBACX,CAAA,MAAA,IAAI,CAAC,QAAQ,0CAAE,QAAQ,KAAI,YAAY;oBACtC,IAAI,CAAC,QAAQ;;;KAG5B,CAAA;IACH,CAAC;CACF,CAAA;AAjBY,wBAAwB;IADpC,aAAa,CAAC,6BAA6B,CAAC;GAChC,wBAAwB,CAiBpC","sourcesContent":["import '@operato/input/ox-input-code.js'\n\nimport { html, TemplateResult } from 'lit'\nimport { customElement } from 'lit/decorators.js'\n\nimport { OxPropertyEditor } from './ox-property-editor.js'\nimport { PropertySpec } from './types.js'\n\n@customElement('ox-property-editor-textarea')\nexport class OxPropertyEditorTextArea extends OxPropertyEditor {\n editorTemplate(value: any, spec: PropertySpec): TemplateResult {\n const { fullwidth = true } = spec.editor || {}\n\n return html`\n <ox-input-code\n id=\"editor\"\n .value=${value}\n tab-size=${spec.property?.tabSize || ''}\n tab-as-space=${spec.property?.tabAsSpace || 'false'}\n ?fullwidth=${fullwidth}\n language=${spec.property?.language || 'javascript'}\n ?disabled=${this.disabled}\n >\n </ox-input-code>\n `\n }\n}\n"]}
1
+ {"version":3,"file":"ox-property-editor-textarea.js","sourceRoot":"","sources":["../../src/ox-property-editor-textarea.ts"],"names":[],"mappings":";AAAA,OAAO,iCAAiC,CAAA;AAExC,OAAO,EAAE,GAAG,EAAE,IAAI,EAAkB,MAAM,KAAK,CAAA;AAC/C,OAAO,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAA;AAEjD,OAAO,EAAE,gBAAgB,EAAE,MAAM,yBAAyB,CAAA;AAInD,IAAM,wBAAwB,GAA9B,MAAM,wBAAyB,SAAQ,gBAAgB;IAU5D,cAAc,CAAC,KAAU,EAAE,IAAkB;;QAC3C,MAAM,EAAE,SAAS,GAAG,IAAI,EAAE,GAAG,IAAI,CAAC,MAAM,IAAI,EAAE,CAAA;QAE9C,OAAO,IAAI,CAAA;;;iBAGE,KAAK;mBACH,CAAA,MAAA,IAAI,CAAC,QAAQ,0CAAE,OAAO,KAAI,EAAE;uBACxB,CAAA,MAAA,IAAI,CAAC,QAAQ,0CAAE,UAAU,KAAI,OAAO;qBACtC,SAAS;mBACX,CAAA,MAAA,IAAI,CAAC,QAAQ,0CAAE,QAAQ,KAAI,YAAY;oBACtC,IAAI,CAAC,QAAQ;;;KAG5B,CAAA;IACH,CAAC;;AAxBM,+BAAM,GAAG;IACd,GAAG,gBAAgB,CAAC,MAAM;IAC1B,GAAG,CAAA;;;;KAIF;CACF,AAPY,CAOZ;AARU,wBAAwB;IADpC,aAAa,CAAC,6BAA6B,CAAC;GAChC,wBAAwB,CA0BpC","sourcesContent":["import '@operato/input/ox-input-code.js'\n\nimport { css, html, TemplateResult } from 'lit'\nimport { customElement } from 'lit/decorators.js'\n\nimport { OxPropertyEditor } from './ox-property-editor.js'\nimport { PropertySpec } from './types.js'\n\n@customElement('ox-property-editor-textarea')\nexport class OxPropertyEditorTextArea extends OxPropertyEditor {\n static styles = [\n ...OxPropertyEditor.styles,\n css`\n :host {\n grid-template-rows: auto 1fr;\n }\n `\n ]\n\n editorTemplate(value: any, spec: PropertySpec): TemplateResult {\n const { fullwidth = true } = spec.editor || {}\n\n return html`\n <ox-input-code\n id=\"editor\"\n .value=${value}\n tab-size=${spec.property?.tabSize || ''}\n tab-as-space=${spec.property?.tabAsSpace || 'false'}\n ?fullwidth=${fullwidth}\n language=${spec.property?.language || 'javascript'}\n ?disabled=${this.disabled}\n >\n </ox-input-code>\n `\n }\n}\n"]}
@@ -174,7 +174,7 @@ OxPropertyEditor.styles = [
174
174
  ox-input-code,
175
175
  ox-input-data,
176
176
  .multiline-input {
177
- height: 300px;
177
+ min-height: 300px;
178
178
  }
179
179
 
180
180
  :host > div {
@@ -1 +1 @@
1
- {"version":3,"file":"ox-property-editor.js","sourceRoot":"","sources":["../../src/ox-property-editor.ts"],"names":[],"mappings":";AAAA,OAAO,0BAA0B,CAAA;AAEjC,OAAO,EAAE,GAAG,EAAE,IAAI,EAAE,UAAU,EAAkB,MAAM,KAAK,CAAA;AAC3D,OAAO,EAAE,QAAQ,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAA;AACnD,OAAO,SAAS,MAAM,qBAAqB,CAAA;AAI3C,MAAM,OAAO,gBAAiB,SAAQ,UAAU;IAAhD;;QAqH6B,eAAU,GAAgC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAA;QAMnE,cAAS,GAAY,KAAK,CAAA;QAuCzB,YAAO,GAAG,KAAK,CAAA;IA0D1B,CAAC;IAzNQ,MAAM,CAAC,QAAQ,CAAC,KAAiC;QACtD,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,OAAO,CAAC,IAAI,CAAC,EAAE;YAChC,gBAAgB,CAAC,QAAQ,CAAC,IAAI,CAAC,GAAG,KAAK,CAAC,IAAI,CAAC,CAAA;QAC/C,CAAC,CAAC,CAAA;IACJ,CAAC;IAEM,MAAM,CAAC,SAAS,CAAC,IAAY;QAClC,OAAO,gBAAgB,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAA;IACxC,CAAC;IAkHD,iBAAiB;QACf,KAAK,CAAC,iBAAiB,EAAE,CAAA;QAEzB,IAAI,CAAC,UAAU,CAAC,gBAAgB,CAAC,QAAQ,EAAE,IAAI,CAAC,aAAa,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,CAAA;IAC3E,CAAC;IAED,cAAc,CAAC,KAAU,EAAE,IAAkB;QAC3C,OAAO,IAAI,CAAA,EAAE,CAAA;I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Q,CAAC,EAAE,IAAI,EAAE,KAAK,EAAE,CAAC;oDAAiD;AAC/C;IAA3B,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;wDAAsC;AACrC;IAA3B,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;sDAAmB;AAClB;IAA3B,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;iDAAc;AACZ;IAA5B,QAAQ,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,CAAC;kDAAmB;AAyCtC;IAAR,KAAK,EAAE;iDAAgB","sourcesContent":["import '@operato/i18n/ox-i18n.js'\n\nimport { css, html, LitElement, TemplateResult } from 'lit'\nimport { property, state } from 'lit/decorators.js'\nimport deepClone from 'lodash-es/cloneDeep'\n\nimport { EditorProperty, PropertySpec } from './types'\n\nexport class OxPropertyEditor extends LitElement {\n static registry: { [type: string]: string } = {}\n\n public static register(types: { [type: string]: string }) {\n Object.keys(types).forEach(type => {\n OxPropertyEditor.registry[type] = types[type]\n })\n }\n\n public static getEditor(type: string): string {\n return OxPropertyEditor.registry[type]\n }\n\n static styles = [\n css`\n :host {\n margin: 5px;\n\n display: grid;\n grid-template-columns: repeat(10, 1fr);\n grid-gap: 5px;\n grid-auto-rows: minmax(24px, auto);\n\n align-items: center;\n\n color: var(--property-sidebar-fieldset-legend-color);\n }\n\n :host > * {\n box-sizing: border-box;\n\n grid-column: span 7;\n order: 2;\n\n align-self: stretch;\n }\n\n :host > label {\n grid-column: span 3;\n order: 1;\n\n text-align: right;\n\n font: var(--label-font);\n text-transform: capitalize;\n\n align-self: center;\n }\n\n :host > input[type='checkbox'] ~ label,\n :host > ox-checkbox ~ label {\n grid-column: span 6;\n order: 2;\n\n text-align: left;\n }\n\n select,\n ox-select,\n input:not([type='checkbox']) {\n border: 1px solid rgba(0, 0, 0, 0.2);\n border-radius: 4px;\n }\n\n :host > legend {\n grid-column: 1 / -1;\n\n display: inline-block;\n\n text-align: left;\n text-transform: capitalize;\n }\n\n :host > [fullwidth] {\n grid-column: 1 / -1;\n }\n\n :host > input[type='checkbox'],\n :host > ox-checkbox {\n grid-column: span 4;\n order: 1;\n\n justify-self: end;\n align-self: center;\n }\n\n ox-input-code,\n ox-input-data,\n .multiline-input {\n height: 300px;\n }\n\n :host > div {\n display: flex;\n flex-direction: column;\n gap: 3px;\n }\n\n div[data-index] {\n display: flex;\n min-height: 24px;\n }\n\n div[data-index] > * {\n flex: 1;\n }\n `\n ]\n\n @property({ type: Object }) value: any\n @property({ type: String }) type!: string\n @property({ type: String, attribute: true, reflect: true }) name!: string\n @property({ type: String }) label!: string\n @property({ type: String }) placeholder?: string\n @property({ type: Object }) property?: any\n @property({ type: Object }) editor?: EditorProperty\n @property({ type: Object }) host: any\n @property({ type: Array }) quantifier?: [min: number, max: number] = [1, 1]\n @property({ type: Object }) observeHandler?: (value: any) => void\n @property({ type: Object }) defaultValue?: any\n @property({ type: Object }) context?: any\n @property({ type: Boolean }) disabled?: boolean\n\n private observing: boolean = false\n\n connectedCallback() {\n super.connectedCallback()\n\n this.renderRoot.addEventListener('change', this._valueChanged.bind(this))\n }\n\n editorTemplate(value: any, spec: PropertySpec): TemplateResult {\n return html``\n }\n\n render() {\n const { defaultValue } = this\n const { value = defaultValue, quantifier } = this\n const [min = 1, max = 1] = quantifier || [1, 1]\n\n return html`\n ${max <= 1\n ? this.editorTemplate(value, this)\n : html`\n <div ?fullwidth=${this.editor?.fullwidth}>\n ${new Array(max)\n .fill('')\n .map(\n (_, idx) => html` <div editor data-index=${idx}>${this.editorTemplate(value?.[idx], this)}</div> `\n )}\n </div>\n `}\n ${this.label\n ? html`\n <label for=\"editor\">\n <ox-i18n msgid=${this._computeLabelId(this.label)}>${this.label}</ox-i18n>\n </label>\n `\n : html``}\n `\n }\n\n @state() __by_me = false\n\n shouldUpdate(changedProperties: any) {\n if (this.__by_me) {\n return false\n }\n\n if (changedProperties.has('value')) {\n this.__by_me = true\n this.value = this.makeup(this.value)\n this.__by_me = false\n }\n\n return true\n }\n\n get valueProperty() {\n return 'value'\n }\n\n makeup(v: any) {\n return deepClone(v)\n }\n\n _computeLabelId(label: string) {\n if (label.indexOf('label.') >= 0) return label\n\n return 'label.' + label\n }\n\n _valueChanged(e: Event) {\n e.stopPropagation()\n const editor = e.target as HTMLInputElement\n\n const [min = 1, max = 1] = this.quantifier || []\n const value = this.makeup((editor as any)[this.valueProperty])\n\n if (max > 1) {\n const index = Number(editor.closest('[data-index]')?.getAttribute('data-index'))\n var array: any[] = this.value instanceof Array ? [...this.value] : []\n array[index] = value\n this.value = array\n } else {\n this.value = value\n }\n\n this.dispatchEvent(new CustomEvent('change', { bubbles: true, composed: true }))\n\n this.observe(this.value)\n }\n\n observe(value: any) {\n if (this.observeHandler && !this.observing) {\n this.observing = true\n this.observeHandler.call(this, value)\n this.observing = false\n }\n }\n}\n"]}
1
+ {"version":3,"file":"ox-property-editor.js","sourceRoot":"","sources":["../../src/ox-property-editor.ts"],"names":[],"mappings":";AAAA,OAAO,0BAA0B,CAAA;AAEjC,OAAO,EAAE,GAAG,EAAE,IAAI,EAAE,UAAU,EAAkB,MAAM,KAAK,CAAA;AAC3D,OAAO,EAAE,QAAQ,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAA;AACnD,OAAO,SAAS,MAAM,qBAAqB,CAAA;AAI3C,MAAM,OAAO,gBAAiB,SAAQ,UAAU;IAAhD;;QAqH6B,eAAU,GAAgC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAA;QAMnE,cAAS,GAAY,KAAK,CAAA;QAuCzB,YAAO,GAAG,KAAK,CAAA;IA0D1B,CAAC;IAzNQ,MAAM,CAAC,QAAQ,CAAC,KAAiC;QACtD,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,OAAO,CAAC,IAAI,CAAC,EAAE;YAChC,gBAAgB,CAAC,QAAQ,CAAC,IAAI,CAAC,GAAG,KAAK,CAAC,IAAI,CAAC,CAAA;QAC/C,CAAC,C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AI,EAAE,CAAC;8CAAc;AAC7C;IAA3B,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;+CAAe;AACd;IAA3B,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;qDAAqB;AACpB;IAA3B,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;kDAAe;AACd;IAA3B,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;gDAAwB;AACvB;IAA3B,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;8CAAU;AACV;IAA1B,QAAQ,CAAC,EAAE,IAAI,EAAE,KAAK,EAAE,CAAC;oDAAiD;AAC/C;IAA3B,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;wDAAsC;AACrC;IAA3B,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;sDAAmB;AAClB;IAA3B,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;iDAAc;AACZ;IAA5B,QAAQ,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,CAAC;kDAAmB;AAyCtC;IAAR,KAAK,EAAE;iDAAgB","sourcesContent":["import '@operato/i18n/ox-i18n.js'\n\nimport { css, html, LitElement, TemplateResult } from 'lit'\nimport { property, state } from 'lit/decorators.js'\nimport deepClone from 'lodash-es/cloneDeep'\n\nimport { EditorProperty, PropertySpec } from './types'\n\nexport class OxPropertyEditor extends LitElement {\n static registry: { [type: string]: string } = {}\n\n public static register(types: { [type: string]: string }) {\n Object.keys(types).forEach(type => {\n OxPropertyEditor.registry[type] = types[type]\n })\n }\n\n public static getEditor(type: string): string {\n return OxPropertyEditor.registry[type]\n }\n\n static styles = [\n css`\n :host {\n margin: 5px;\n\n display: grid;\n grid-template-columns: repeat(10, 1fr);\n grid-gap: 5px;\n grid-auto-rows: minmax(24px, auto);\n\n align-items: center;\n\n color: var(--property-sidebar-fieldset-legend-color);\n }\n\n :host > * {\n box-sizing: border-box;\n\n grid-column: span 7;\n order: 2;\n\n align-self: stretch;\n }\n\n :host > label {\n grid-column: span 3;\n order: 1;\n\n text-align: right;\n\n font: var(--label-font);\n text-transform: capitalize;\n\n align-self: center;\n }\n\n :host > input[type='checkbox'] ~ label,\n :host > ox-checkbox ~ label {\n grid-column: span 6;\n order: 2;\n\n text-align: left;\n }\n\n select,\n ox-select,\n input:not([type='checkbox']) {\n border: 1px solid rgba(0, 0, 0, 0.2);\n border-radius: 4px;\n }\n\n :host > legend {\n grid-column: 1 / -1;\n\n display: inline-block;\n\n text-align: left;\n text-transform: capitalize;\n }\n\n :host > [fullwidth] {\n grid-column: 1 / -1;\n }\n\n :host > input[type='checkbox'],\n :host > ox-checkbox {\n grid-column: span 4;\n order: 1;\n\n justify-self: end;\n align-self: center;\n }\n\n ox-input-code,\n ox-input-data,\n .multiline-input {\n min-height: 300px;\n }\n\n :host > div {\n display: flex;\n flex-direction: column;\n gap: 3px;\n }\n\n div[data-index] {\n display: flex;\n min-height: 24px;\n }\n\n div[data-index] > * {\n flex: 1;\n }\n `\n ]\n\n @property({ type: Object }) value: any\n @property({ type: String }) type!: string\n @property({ type: String, attribute: true, reflect: true }) name!: string\n @property({ type: String }) label!: string\n @property({ type: String }) placeholder?: string\n @property({ type: Object }) property?: any\n @property({ type: Object }) editor?: EditorProperty\n @property({ type: Object }) host: any\n @property({ type: Array }) quantifier?: [min: number, max: number] = [1, 1]\n @property({ type: Object }) observeHandler?: (value: any) => void\n @property({ type: Object }) defaultValue?: any\n @property({ type: Object }) context?: any\n @property({ type: Boolean }) disabled?: boolean\n\n private observing: boolean = false\n\n connectedCallback() {\n super.connectedCallback()\n\n this.renderRoot.addEventListener('change', this._valueChanged.bind(this))\n }\n\n editorTemplate(value: any, spec: PropertySpec): TemplateResult {\n return html``\n }\n\n render() {\n const { defaultValue } = this\n const { value = defaultValue, quantifier } = this\n const [min = 1, max = 1] = quantifier || [1, 1]\n\n return html`\n ${max <= 1\n ? this.editorTemplate(value, this)\n : html`\n <div ?fullwidth=${this.editor?.fullwidth}>\n ${new Array(max)\n .fill('')\n .map(\n (_, idx) => html` <div editor data-index=${idx}>${this.editorTemplate(value?.[idx], this)}</div> `\n )}\n </div>\n `}\n ${this.label\n ? html`\n <label for=\"editor\">\n <ox-i18n msgid=${this._computeLabelId(this.label)}>${this.label}</ox-i18n>\n </label>\n `\n : html``}\n `\n }\n\n @state() __by_me = false\n\n shouldUpdate(changedProperties: any) {\n if (this.__by_me) {\n return false\n }\n\n if (changedProperties.has('value')) {\n this.__by_me = true\n this.value = this.makeup(this.value)\n this.__by_me = false\n }\n\n return true\n }\n\n get valueProperty() {\n return 'value'\n }\n\n makeup(v: any) {\n return deepClone(v)\n }\n\n _computeLabelId(label: string) {\n if (label.indexOf('label.') >= 0) return label\n\n return 'label.' + label\n }\n\n _valueChanged(e: Event) {\n e.stopPropagation()\n const editor = e.target as HTMLInputElement\n\n const [min = 1, max = 1] = this.quantifier || []\n const value = this.makeup((editor as any)[this.valueProperty])\n\n if (max > 1) {\n const index = Number(editor.closest('[data-index]')?.getAttribute('data-index'))\n var array: any[] = this.value instanceof Array ? [...this.value] : []\n array[index] = value\n this.value = array\n } else {\n this.value = value\n }\n\n this.dispatchEvent(new CustomEvent('change', { bubbles: true, composed: true }))\n\n this.observe(this.value)\n }\n\n observe(value: any) {\n if (this.observeHandler && !this.observing) {\n this.observing = true\n this.observeHandler.call(this, value)\n this.observing = false\n }\n }\n}\n"]}
@@ -1,6 +1,10 @@
1
1
  export type EditorProperty = {
2
2
  fullwidth?: boolean;
3
3
  };
4
+ type WritableKeysOf<T> = {
5
+ [P in keyof T]: T[P] extends Readonly<T[P]> ? never : P;
6
+ }[keyof T];
7
+ export type CSSStyles = Pick<CSSStyleDeclaration, WritableKeysOf<CSSStyleDeclaration>>;
4
8
  export type PropertySpec = {
5
9
  type: string;
6
10
  label: string;
@@ -12,4 +16,6 @@ export type PropertySpec = {
12
16
  observe?: (value: any) => void;
13
17
  defaultValue?: any;
14
18
  disabled?: boolean;
19
+ styles?: CSSStyles;
15
20
  };
21
+ export {};
@@ -1 +1 @@
1
- {"version":3,"file":"types.js","sourceRoot":"","sources":["../../src/types.ts"],"names":[],"mappings":"","sourcesContent":["export type EditorProperty = {\n fullwidth?: boolean\n}\n\nexport type PropertySpec = {\n type: string\n label: string\n name: string\n placeholder?: string\n property?: any\n editor?: EditorProperty\n quantifier?: [min: number, max: number]\n observe?: (value: any) => void\n defaultValue?: any\n disabled?: boolean\n}\n"]}
1
+ {"version":3,"file":"types.js","sourceRoot":"","sources":["../../src/types.ts"],"names":[],"mappings":"","sourcesContent":["export type EditorProperty = {\n fullwidth?: boolean\n}\n\ntype WritableKeysOf<T> = {\n [P in keyof T]: T[P] extends Readonly<T[P]> ? never : P\n}[keyof T]\n\nexport type CSSStyles = Pick<CSSStyleDeclaration, WritableKeysOf<CSSStyleDeclaration>>\n\nexport type PropertySpec = {\n type: string\n label: string\n name: string\n placeholder?: string\n property?: any\n editor?: EditorProperty\n quantifier?: [min: number, max: number]\n observe?: (value: any) => void\n defaultValue?: any\n disabled?: boolean\n styles?: CSSStyles\n}\n"]}
@@ -1,4 +1,28 @@
1
1
  import { TemplateResult } from 'lit';
2
+ import '../src/ox-property-editor-3axis.js';
3
+ import '../src/ox-property-editor-3dish.js';
4
+ import '../src/ox-property-editor-angle.js';
5
+ import '../src/ox-property-editor-checkbox.js';
6
+ import '../src/ox-property-editor-color.js';
7
+ import '../src/ox-property-editor-date.js';
8
+ import '../src/ox-property-editor-legend.js';
9
+ import '../src/ox-property-editor-number.js';
10
+ import '../src/ox-property-editor-unit-number.js';
11
+ import '../src/ox-property-editor-password.js';
12
+ import '../src/ox-property-editor-range.js';
13
+ import '../src/ox-property-editor-select.js';
14
+ import '../src/ox-property-editor-string.js';
15
+ import '../src/ox-property-editor-image.js';
16
+ import '../src/ox-property-editor-file.js';
17
+ import '../src/ox-property-editor-multiple-colors.js';
18
+ import '../src/ox-property-editor-crontab.js';
19
+ import '../src/ox-property-editor-work-shift.js';
20
+ import '../src/ox-property-editor-partition-keys.js';
21
+ import '../src/ox-property-editor-key-values.js';
22
+ import '../src/ox-property-editor-textarea.js';
23
+ import '../src/ox-property-editor-options.js';
24
+ import '../src/ox-property-editor-hashtags.js';
25
+ import '../src/ox-properties-dynamic-view.js';
2
26
  declare const _default: {
3
27
  title: string;
4
28
  component: string;
@@ -27,6 +51,3 @@ interface ArgTypes {
27
51
  slot?: TemplateResult;
28
52
  }
29
53
  export declare const Regular: Story<ArgTypes>;
30
- export declare const CustomTitle: Story<ArgTypes>;
31
- export declare const CustomCounter: Story<ArgTypes>;
32
- export declare const SlottedContent: Story<ArgTypes>;
@@ -1,32 +1,271 @@
1
1
  import { html } from 'lit';
2
+ import '../src/ox-property-editor-3axis.js';
3
+ import '../src/ox-property-editor-3dish.js';
4
+ import '../src/ox-property-editor-angle.js';
5
+ import '../src/ox-property-editor-checkbox.js';
6
+ import '../src/ox-property-editor-color.js';
7
+ import '../src/ox-property-editor-date.js';
8
+ import '../src/ox-property-editor-legend.js';
9
+ import '../src/ox-property-editor-number.js';
10
+ import '../src/ox-property-editor-unit-number.js';
11
+ import '../src/ox-property-editor-password.js';
12
+ import '../src/ox-property-editor-range.js';
13
+ import '../src/ox-property-editor-select.js';
14
+ import '../src/ox-property-editor-string.js';
15
+ import '../src/ox-property-editor-image.js';
16
+ import '../src/ox-property-editor-file.js';
17
+ import '../src/ox-property-editor-multiple-colors.js';
18
+ import '../src/ox-property-editor-crontab.js';
19
+ import '../src/ox-property-editor-work-shift.js';
20
+ import '../src/ox-property-editor-partition-keys.js';
21
+ import '../src/ox-property-editor-key-values.js';
22
+ import '../src/ox-property-editor-textarea.js';
23
+ import '../src/ox-property-editor-options.js';
24
+ import '../src/ox-property-editor-hashtags.js';
25
+ import '../src/ox-properties-dynamic-view.js';
26
+ import { OxPropertyEditor } from '../src/ox-property-editor.js';
2
27
  export default {
3
- title: 'PropertyEditor',
4
- component: 'ox-property-editor',
28
+ title: 'Properties Dynamic View',
29
+ component: 'ox-properties-dynamic-view',
5
30
  argTypes: {
6
31
  title: { control: 'text' },
7
32
  counter: { control: 'number' },
8
33
  textColor: { control: 'color' }
9
34
  }
10
35
  };
11
- const Template = ({ title = 'Hello world', counter = 5, textColor, slot }) => html `
12
- <ox-board-viewer style="--board-viewer-text-color: ${textColor || 'black'}" .title=${title} .counter=${counter}>
13
- ${slot}
14
- </ox-board-viewer>
36
+ OxPropertyEditor.register({
37
+ legend: 'ox-property-editor-legend',
38
+ number: 'ox-property-editor-number',
39
+ 'unit-number': 'ox-property-editor-unit-number',
40
+ slider: 'ox-property-editor-range',
41
+ password: 'ox-property-editor-password',
42
+ angle: 'ox-property-editor-angle',
43
+ string: 'ox-property-editor-string',
44
+ textarea: 'ox-property-editor-textarea',
45
+ javascript: 'ox-property-editor-textarea',
46
+ checkbox: 'ox-property-editor-checkbox',
47
+ boolean: 'ox-property-editor-checkbox',
48
+ select: 'ox-property-editor-select',
49
+ date: 'ox-property-editor-date',
50
+ options: 'ox-property-editor-options',
51
+ data: 'ox-property-editor-data',
52
+ file: 'ox-property-editor-file',
53
+ image: 'ox-property-editor-image',
54
+ 'range-input': 'ox-property-editor-range',
55
+ 'attachment-selector': 'ox-property-editor-attachment-selector',
56
+ 'gltf-selector': 'ox-property-editor-attachment-selector',
57
+ 'image-selector': 'ox-property-editor-image-selector',
58
+ color: 'ox-property-editor-color',
59
+ 'solid-color-stops': 'ox-property-editor-solid-colorstops',
60
+ 'gradient-color-stops': 'ox-property-editor-gradient-colorstops',
61
+ 'multiple-color': 'ox-property-editor-multiple-colors',
62
+ map: 'ox-property-editor-value-map',
63
+ range: 'ox-property-editor-value-ranges',
64
+ graphql: 'ox-property-editor-graphql',
65
+ 'editor-table': 'ox-property-editor-table',
66
+ 'id-input': 'ox-property-editor-scene-component-id',
67
+ 'font-selector': 'ox-property-editor-font-selector',
68
+ crontab: 'ox-property-editor-crontab',
69
+ shift: 'ox-property-editor-work-shift',
70
+ 'partition-keys': 'ox-property-editor-partition-keys',
71
+ 'key-values': 'ox-property-editor-key-values',
72
+ hashtags: 'ox-property-editor-hashtags',
73
+ '3axis': 'ox-property-editor-3axis',
74
+ '3dish': 'ox-property-editor-3dish'
75
+ });
76
+ const properties = [
77
+ {
78
+ type: 'string',
79
+ label: 'ABC',
80
+ name: 'ABC',
81
+ quantifier: [1, 20]
82
+ },
83
+ {
84
+ type: 'password',
85
+ label: 'PWD',
86
+ name: 'PWD'
87
+ },
88
+ {
89
+ type: 'select',
90
+ label: 'SLT',
91
+ name: 'SLT',
92
+ property: {
93
+ options: [
94
+ { display: '', value: '' },
95
+ { display: 'AAA', value: 'aaa' },
96
+ { display: 'BBB', value: 'bbb' }
97
+ ]
98
+ }
99
+ },
100
+ {
101
+ type: 'number',
102
+ label: 'N#',
103
+ name: 'N#'
104
+ },
105
+ {
106
+ type: 'unit-number',
107
+ label: 'NU',
108
+ name: 'NU',
109
+ property: {
110
+ unit: 'K'
111
+ }
112
+ },
113
+ {
114
+ type: 'checkbox',
115
+ label: 'XV',
116
+ name: 'XV'
117
+ },
118
+ {
119
+ type: 'angle',
120
+ label: 'Degree',
121
+ name: 'Degree'
122
+ },
123
+ {
124
+ type: 'date',
125
+ label: 'DD',
126
+ name: 'DD'
127
+ },
128
+ {
129
+ type: 'legend',
130
+ label: '',
131
+ name: 'NEW-GROUP',
132
+ property: {
133
+ label: 'NEW-GROUP'
134
+ }
135
+ },
136
+ {
137
+ type: 'slider',
138
+ label: 'S',
139
+ name: 'S',
140
+ property: {
141
+ min: 30,
142
+ max: 300,
143
+ step: 10
144
+ }
145
+ },
146
+ {
147
+ type: 'textarea',
148
+ label: 'TA',
149
+ name: 'TA'
150
+ },
151
+ {
152
+ type: 'options',
153
+ label: 'OT',
154
+ name: 'OT',
155
+ editor: {
156
+ fullwidth: true
157
+ }
158
+ },
159
+ {
160
+ type: 'data',
161
+ label: 'DT',
162
+ name: 'DT'
163
+ },
164
+ {
165
+ type: 'color',
166
+ label: 'CL',
167
+ name: 'CL'
168
+ },
169
+ {
170
+ type: 'multiple-color',
171
+ label: 'CLS',
172
+ name: 'CLS'
173
+ },
174
+ {
175
+ type: 'image',
176
+ label: 'IM',
177
+ name: 'IM'
178
+ },
179
+ {
180
+ type: 'file',
181
+ label: 'FL',
182
+ name: 'FL',
183
+ property: {
184
+ multiple: true
185
+ }
186
+ },
187
+ {
188
+ type: 'crontab',
189
+ label: 'schedule',
190
+ name: 'schedule'
191
+ },
192
+ {
193
+ type: 'shift',
194
+ label: 'shift',
195
+ name: 'shift'
196
+ },
197
+ {
198
+ type: 'key-values',
199
+ label: 'key-values',
200
+ name: 'key-values'
201
+ },
202
+ {
203
+ type: 'hashtags',
204
+ label: 'hashtags',
205
+ name: 'hashtags'
206
+ },
207
+ {
208
+ type: '3dish',
209
+ label: '3dish',
210
+ name: '3dish'
211
+ }
212
+ ];
213
+ const value = {
214
+ ABC: [4, 3, 2, 1],
215
+ S: 290,
216
+ SLT: 'bbb',
217
+ NU: 1000,
218
+ IM: 'https://www.hatiolab.com/assets/img/arch-thingsboard.png',
219
+ CLS: ['yello', 'green'],
220
+ schedule: '* * * * * *',
221
+ shift: [
222
+ {
223
+ name: 'DAY',
224
+ fromDate: -1,
225
+ fromTime: '22:00',
226
+ toDate: 0,
227
+ toTime: '06:00'
228
+ },
229
+ {
230
+ name: 'SWING',
231
+ fromDate: 0,
232
+ fromTime: '06:00',
233
+ toDate: 0,
234
+ toTime: '14:00'
235
+ },
236
+ {
237
+ name: 'NIGHT',
238
+ fromDate: 0,
239
+ fromTime: '14:00',
240
+ toDate: 0,
241
+ toTime: '22:00'
242
+ }
243
+ ],
244
+ hashtags: ['abc', 'def'],
245
+ '3dish': {
246
+ dimension: { x: 1, y: 1, z: 1 },
247
+ position: { x: 1, y: 1, z: 1 },
248
+ rotate: { x: 1, y: 1, z: 1 },
249
+ scale: { x: 1, y: 1, z: 1 }
250
+ }
251
+ };
252
+ const Template = () => html `
253
+ <link href="/themes/app-theme.css" rel="stylesheet" />
254
+
255
+ <link
256
+ href="https://fonts.googleapis.com/css2?family=Material+Symbols+Outlined:opsz,wght,FILL@20..48,100..700,0..1"
257
+ rel="stylesheet"
258
+ />
259
+ <link
260
+ href="https://fonts.googleapis.com/css2?family=Material+Symbols+Rounded:opsz,wght,FILL@20..48,100..700,0..1"
261
+ rel="stylesheet"
262
+ />
263
+ <link
264
+ href="https://fonts.googleapis.com/css2?family=Material+Symbols+Sharp:opsz,wght,FILL@20..48,100..700,0..1"
265
+ rel="stylesheet"
266
+ />
267
+
268
+ <ox-properties-dynamic-view .props=${properties} .value=${value}></ox-properties-dynamic-view>
15
269
  `;
16
270
  export const Regular = Template.bind({});
17
- export const CustomTitle = Template.bind({});
18
- CustomTitle.args = {
19
- title: 'My title'
20
- };
21
- export const CustomCounter = Template.bind({});
22
- CustomCounter.args = {
23
- counter: 123456
24
- };
25
- export const SlottedContent = Template.bind({});
26
- SlottedContent.args = {
27
- slot: html `<p>Slotted content</p>`
28
- };
29
- SlottedContent.argTypes = {
30
- slot: { table: { disable: true } }
31
- };
32
271
  //# sourceMappingURL=index.stories.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.stories.js","sourceRoot":"","sources":["../../stories/index.stories.ts"],"names":[],"mappings":"AAAA,OAAO,EAAkB,IAAI,EAAE,MAAM,KAAK,CAAA;AAE1C,eAAe;IACb,KAAK,EAAE,gBAAgB;IACvB,SAAS,EAAE,oBAAoB;IAC/B,QAAQ,EAAE;QACR,KAAK,EAAE,EAAE,OAAO,EAAE,MAAM,EAAE;QAC1B,OAAO,EAAE,EAAE,OAAO,EAAE,QAAQ,EAAE;QAC9B,SAAS,EAAE,EAAE,OAAO,EAAE,OAAO,EAAE;KAChC;CACF,CAAA;AAeD,MAAM,QAAQ,GAAoB,CAAC,EAAE,KAAK,GAAG,aAAa,EAAE,OAAO,GAAG,CAAC,EAAE,SAAS,EAAE,IAAI,EAAY,EAAE,EAAE,CAAC,IAAI,CAAA;uDACtD,SAAS,IAAI,OAAO,YAAY,KAAK,aAAa,OAAO;MAC1G,IAAI;;CAET,CAAA;AAED,MAAM,CAAC,MAAM,OAAO,GAAG,QAAQ,CAAC,IAAI,CAAC,EAAE,CAAC,CAAA;AAExC,MAAM,CAAC,MAAM,WAAW,GAAG,QAAQ,CAAC,IAAI,CAAC,EAAE,CAAC,CAAA;AAC5C,WAAW,CAAC,IAAI,GAAG;IACjB,KAAK,EAAE,UAAU;CAClB,CAAA;AAED,MAAM,CAAC,MAAM,aAAa,GAAG,QAAQ,CAAC,IAAI,CAAC,EAAE,CAAC,CAAA;AAC9C,aAAa,CAAC,IAAI,GAAG;IACnB,OAAO,EAAE,MAAM;CAChB,CAAA;AAED,MAAM,CAAC,MAAM,cAAc,GAAG,QAAQ,CAAC,IAAI,CAAC,EAAE,CAAC,CAAA;AAC/C,cAAc,CAAC,IAAI,GAAG;IACpB,IAAI,EAAE,IAAI,CAAA,wBAAwB;CACnC,CAAA;AACD,cAAc,CAAC,QAAQ,GAAG;IACxB,IAAI,EAAE,EAAE,KAAK,EAAE,EAAE,OAAO,EAAE,IAAI,EAAE,EAAE;CACnC,CAAA","sourcesContent":["import { TemplateResult, html } from 'lit'\n\nexport default {\n title: 'PropertyEditor',\n component: 'ox-property-editor',\n argTypes: {\n title: { control: 'text' },\n counter: { control: 'number' },\n textColor: { control: 'color' }\n }\n}\n\ninterface Story<T> {\n (args: T): TemplateResult\n args?: Partial<T>\n argTypes?: Record<string, unknown>\n}\n\ninterface ArgTypes {\n title?: string\n counter?: number\n textColor?: string\n slot?: TemplateResult\n}\n\nconst Template: Story<ArgTypes> = ({ title = 'Hello world', counter = 5, textColor, slot }: ArgTypes) => html`\n <ox-board-viewer style=\"--board-viewer-text-color: ${textColor || 'black'}\" .title=${title} .counter=${counter}>\n ${slot}\n </ox-board-viewer>\n`\n\nexport const Regular = Template.bind({})\n\nexport const CustomTitle = Template.bind({})\nCustomTitle.args = {\n title: 'My title'\n}\n\nexport const CustomCounter = Template.bind({})\nCustomCounter.args = {\n counter: 123456\n}\n\nexport const SlottedContent = Template.bind({})\nSlottedContent.args = {\n slot: html`<p>Slotted content</p>`\n}\nSlottedContent.argTypes = {\n slot: { table: { disable: true } }\n}\n"]}
1
+ {"version":3,"file":"index.stories.js","sourceRoot":"","sources":["../../stories/index.stories.ts"],"names":[],"mappings":"AAAA,OAAO,EAAkB,IAAI,EAAE,MAAM,KAAK,CAAA;AAE1C,OAAO,oCAAoC,CAAA;AAC3C,OAAO,oCAAoC,CAAA;AAC3C,OAAO,oCAAoC,CAAA;AAC3C,OAAO,uCAAuC,CAAA;AAC9C,OAAO,oCAAoC,CAAA;AAC3C,OAAO,mCAAmC,CAAA;AAC1C,OAAO,qCAAqC,CAAA;AAC5C,OAAO,qCAAqC,CAAA;AAC5C,OAAO,0CAA0C,CAAA;AACjD,OAAO,uCAAuC,CAAA;AAC9C,OAAO,oCAAoC,CAAA;AAC3C,OAAO,qCAAqC,CAAA;AAC5C,OAAO,qCAAqC,CAAA;AAC5C,OAAO,oCAAoC,CAAA;AAC3C,OAAO,mCAAmC,CAAA;AAC1C,OAAO,8CAA8C,CAAA;AACrD,OAAO,sCAAsC,CAAA;AAC7C,OAAO,yCAAyC,CAAA;AAChD,OAAO,6CAA6C,CAAA;AACpD,OAAO,yCAAyC,CAAA;AAChD,OAAO,uCAAuC,CAAA;AAC9C,OAAO,sCAAsC,CAAA;AAC7C,OAAO,uCAAuC,CAAA;AAE9C,OAAO,sCAAsC,CAAA;AAE7C,OAAO,EAAE,gBAAgB,EAAE,MAAM,8BAA8B,CAAA;AAE/D,eAAe;IACb,KAAK,EAAE,yBAAyB;IAChC,SAAS,EAAE,4BAA4B;IACvC,QAAQ,EAAE;QACR,KAAK,EAAE,EAAE,OAAO,EAAE,MAAM,EAAE;QAC1B,OAAO,EAAE,EAAE,OAAO,EAAE,QAAQ,EAAE;QAC9B,SAAS,EAAE,EAAE,OAAO,EAAE,O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,CAAC;IACvB,QAAQ,EAAE,aAAa;IACvB,KAAK,EAAE;QACL;YACE,IAAI,EAAE,KAAK;YACX,QAAQ,EAAE,CAAC,CAAC;YACZ,QAAQ,EAAE,OAAO;YACjB,MAAM,EAAE,CAAC;YACT,MAAM,EAAE,OAAO;SAChB;QACD;YACE,IAAI,EAAE,OAAO;YACb,QAAQ,EAAE,CAAC;YACX,QAAQ,EAAE,OAAO;YACjB,MAAM,EAAE,CAAC;YACT,MAAM,EAAE,OAAO;SAChB;QACD;YACE,IAAI,EAAE,OAAO;YACb,QAAQ,EAAE,CAAC;YACX,QAAQ,EAAE,OAAO;YACjB,MAAM,EAAE,CAAC;YACT,MAAM,EAAE,OAAO;SAChB;KACF;IACD,QAAQ,EAAE,CAAC,KAAK,EAAE,KAAK,CAAC;IACxB,OAAO,EAAE;QACP,SAAS,EAAE,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE;QAC/B,QAAQ,EAAE,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE;QAC9B,MAAM,EAAE,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE;QAC5B,KAAK,EAAE,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE;KAC5B;CACF,CAAA;AAED,MAAM,QAAQ,GAAoB,GAAG,EAAE,CAAC,IAAI,CAAA;;;;;;;;;;;;;;;;uCAgBL,UAAU,WAAW,KAAK;CAChE,CAAA;AAED,MAAM,CAAC,MAAM,OAAO,GAAG,QAAQ,CAAC,IAAI,CAAC,EAAE,CAAC,CAAA","sourcesContent":["import { TemplateResult, html } from 'lit'\n\nimport '../src/ox-property-editor-3axis.js'\nimport '../src/ox-property-editor-3dish.js'\nimport '../src/ox-property-editor-angle.js'\nimport '../src/ox-property-editor-checkbox.js'\nimport '../src/ox-property-editor-color.js'\nimport '../src/ox-property-editor-date.js'\nimport '../src/ox-property-editor-legend.js'\nimport '../src/ox-property-editor-number.js'\nimport '../src/ox-property-editor-unit-number.js'\nimport '../src/ox-property-editor-password.js'\nimport '../src/ox-property-editor-range.js'\nimport '../src/ox-property-editor-select.js'\nimport '../src/ox-property-editor-string.js'\nimport '../src/ox-property-editor-image.js'\nimport '../src/ox-property-editor-file.js'\nimport '../src/ox-property-editor-multiple-colors.js'\nimport '../src/ox-property-editor-crontab.js'\nimport '../src/ox-property-editor-work-shift.js'\nimport '../src/ox-property-editor-partition-keys.js'\nimport '../src/ox-property-editor-key-values.js'\nimport '../src/ox-property-editor-textarea.js'\nimport '../src/ox-property-editor-options.js'\nimport '../src/ox-property-editor-hashtags.js'\n\nimport '../src/ox-properties-dynamic-view.js'\n\nimport { OxPropertyEditor } from '../src/ox-property-editor.js'\n\nexport default {\n title: 'Properties Dynamic View',\n component: 'ox-properties-dynamic-view',\n argTypes: {\n title: { control: 'text' },\n counter: { control: 'number' },\n textColor: { control: 'color' }\n }\n}\n\ninterface Story<T> {\n (args: T): TemplateResult\n args?: Partial<T>\n argTypes?: Record<string, unknown>\n}\n\ninterface ArgTypes {\n title?: string\n counter?: number\n textColor?: string\n slot?: TemplateResult\n}\n\nOxPropertyEditor.register({\n legend: 'ox-property-editor-legend',\n number: 'ox-property-editor-number',\n 'unit-number': 'ox-property-editor-unit-number',\n slider: 'ox-property-editor-range',\n password: 'ox-property-editor-password',\n angle: 'ox-property-editor-angle',\n string: 'ox-property-editor-string',\n textarea: 'ox-property-editor-textarea',\n javascript: 'ox-property-editor-textarea',\n checkbox: 'ox-property-editor-checkbox',\n boolean: 'ox-property-editor-checkbox',\n select: 'ox-property-editor-select',\n date: 'ox-property-editor-date',\n options: 'ox-property-editor-options',\n data: 'ox-property-editor-data',\n file: 'ox-property-editor-file',\n image: 'ox-property-editor-image',\n 'range-input': 'ox-property-editor-range',\n 'attachment-selector': 'ox-property-editor-attachment-selector',\n 'gltf-selector': 'ox-property-editor-attachment-selector',\n 'image-selector': 'ox-property-editor-image-selector',\n color: 'ox-property-editor-color',\n 'solid-color-stops': 'ox-property-editor-solid-colorstops',\n 'gradient-color-stops': 'ox-property-editor-gradient-colorstops',\n 'multiple-color': 'ox-property-editor-multiple-colors',\n map: 'ox-property-editor-value-map',\n range: 'ox-property-editor-value-ranges',\n graphql: 'ox-property-editor-graphql',\n 'editor-table': 'ox-property-editor-table',\n 'id-input': 'ox-property-editor-scene-component-id',\n 'font-selector': 'ox-property-editor-font-selector',\n crontab: 'ox-property-editor-crontab',\n shift: 'ox-property-editor-work-shift',\n 'partition-keys': 'ox-property-editor-partition-keys',\n 'key-values': 'ox-property-editor-key-values',\n hashtags: 'ox-property-editor-hashtags',\n '3axis': 'ox-property-editor-3axis',\n '3dish': 'ox-property-editor-3dish'\n})\n\nconst properties = [\n {\n type: 'string',\n label: 'ABC',\n name: 'ABC',\n quantifier: [1, 20]\n },\n {\n type: 'password',\n label: 'PWD',\n name: 'PWD'\n },\n {\n type: 'select',\n label: 'SLT',\n name: 'SLT',\n property: {\n options: [\n { display: '', value: '' },\n { display: 'AAA', value: 'aaa' },\n { display: 'BBB', value: 'bbb' }\n ]\n }\n },\n {\n type: 'number',\n label: 'N#',\n name: 'N#'\n },\n {\n type: 'unit-number',\n label: 'NU',\n name: 'NU',\n property: {\n unit: 'K'\n }\n },\n {\n type: 'checkbox',\n label: 'XV',\n name: 'XV'\n },\n {\n type: 'angle',\n label: 'Degree',\n name: 'Degree'\n },\n {\n type: 'date',\n label: 'DD',\n name: 'DD'\n },\n {\n type: 'legend',\n label: '',\n name: 'NEW-GROUP',\n property: {\n label: 'NEW-GROUP'\n }\n },\n {\n type: 'slider',\n label: 'S',\n name: 'S',\n property: {\n min: 30,\n max: 300,\n step: 10\n }\n },\n {\n type: 'textarea',\n label: 'TA',\n name: 'TA'\n },\n {\n type: 'options',\n label: 'OT',\n name: 'OT',\n editor: {\n fullwidth: true\n }\n },\n {\n type: 'data',\n label: 'DT',\n name: 'DT'\n },\n {\n type: 'color',\n label: 'CL',\n name: 'CL'\n },\n {\n type: 'multiple-color',\n label: 'CLS',\n name: 'CLS'\n },\n {\n type: 'image',\n label: 'IM',\n name: 'IM'\n },\n {\n type: 'file',\n label: 'FL',\n name: 'FL',\n property: {\n multiple: true\n }\n },\n {\n type: 'crontab',\n label: 'schedule',\n name: 'schedule'\n },\n {\n type: 'shift',\n label: 'shift',\n name: 'shift'\n },\n {\n type: 'key-values',\n label: 'key-values',\n name: 'key-values'\n },\n {\n type: 'hashtags',\n label: 'hashtags',\n name: 'hashtags'\n },\n {\n type: '3dish',\n label: '3dish',\n name: '3dish'\n }\n]\n\nconst value = {\n ABC: [4, 3, 2, 1],\n S: 290,\n SLT: 'bbb',\n NU: 1000,\n IM: 'https://www.hatiolab.com/assets/img/arch-thingsboard.png',\n CLS: ['yello', 'green'],\n schedule: '* * * * * *',\n shift: [\n {\n name: 'DAY',\n fromDate: -1,\n fromTime: '22:00',\n toDate: 0,\n toTime: '06:00'\n },\n {\n name: 'SWING',\n fromDate: 0,\n fromTime: '06:00',\n toDate: 0,\n toTime: '14:00'\n },\n {\n name: 'NIGHT',\n fromDate: 0,\n fromTime: '14:00',\n toDate: 0,\n toTime: '22:00'\n }\n ],\n hashtags: ['abc', 'def'],\n '3dish': {\n dimension: { x: 1, y: 1, z: 1 },\n position: { x: 1, y: 1, z: 1 },\n rotate: { x: 1, y: 1, z: 1 },\n scale: { x: 1, y: 1, z: 1 }\n }\n}\n\nconst Template: Story<ArgTypes> = () => html`\n <link href=\"/themes/app-theme.css\" rel=\"stylesheet\" />\n\n <link\n href=\"https://fonts.googleapis.com/css2?family=Material+Symbols+Outlined:opsz,wght,FILL@20..48,100..700,0..1\"\n rel=\"stylesheet\"\n />\n <link\n href=\"https://fonts.googleapis.com/css2?family=Material+Symbols+Rounded:opsz,wght,FILL@20..48,100..700,0..1\"\n rel=\"stylesheet\"\n />\n <link\n href=\"https://fonts.googleapis.com/css2?family=Material+Symbols+Sharp:opsz,wght,FILL@20..48,100..700,0..1\"\n rel=\"stylesheet\"\n />\n\n <ox-properties-dynamic-view .props=${properties} .value=${value}></ox-properties-dynamic-view>\n`\n\nexport const Regular = Template.bind({})\n"]}