@omicronenergy/oscd-ui 0.1.1 → 0.1.3

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 (107) hide show
  1. package/CHANGELOG.md +15 -0
  2. package/README.md +43 -0
  3. package/custom-elements.json +2314 -1164
  4. package/dist/ace-editor/OscdAceEditor.d.ts +44 -4
  5. package/dist/ace-editor/OscdAceEditor.js +248 -4
  6. package/dist/ace-editor/OscdAceEditor.js.map +1 -1
  7. package/dist/ace-editor/OscdAceEditor.spec.js +114 -2
  8. package/dist/ace-editor/OscdAceEditor.spec.js.map +1 -1
  9. package/dist/ace-editor/OscdAceEditor.stories.d.ts +10 -28
  10. package/dist/ace-editor/OscdAceEditor.stories.js +76 -20
  11. package/dist/ace-editor/OscdAceEditor.stories.js.map +1 -1
  12. package/dist/ace-editor/internal/AceEditor.d.ts +5 -3
  13. package/dist/ace-editor/internal/AceEditor.js +22 -15
  14. package/dist/ace-editor/internal/AceEditor.js.map +1 -1
  15. package/dist/ace-editor/internal/ace-editor-base/AceEditorBase.js +10 -4
  16. package/dist/ace-editor/internal/ace-editor-base/AceEditorBase.js.map +1 -1
  17. package/dist/ace-editor/internal/ace-editor-base/AceEditorBase.spec.d.ts +1 -0
  18. package/dist/ace-editor/internal/ace-editor-base/AceEditorBase.spec.js +33 -0
  19. package/dist/ace-editor/internal/ace-editor-base/AceEditorBase.spec.js.map +1 -0
  20. package/dist/ace-editor/sample-scl.d.ts +9 -0
  21. package/dist/ace-editor/sample-scl.js +297 -0
  22. package/dist/ace-editor/sample-scl.js.map +1 -0
  23. package/dist/action-pane/oscd-action-pane.stories.d.ts +1 -1
  24. package/dist/action-tree/oscd-action-tree.stories.d.ts +1 -1
  25. package/dist/button/OscdElevatedButton.stories.d.ts +1 -1
  26. package/dist/button/OscdFilledButton.stories.d.ts +1 -1
  27. package/dist/button/OscdFilledTonalButton.stories.d.ts +1 -1
  28. package/dist/button/OscdOutlinedButton.stories.d.ts +1 -1
  29. package/dist/button/OscdTextButton.stories.d.ts +1 -1
  30. package/dist/checkbox/OscdCheckbox.stories.d.ts +1 -1
  31. package/dist/chips/OscdAssistChip.stories.d.ts +1 -1
  32. package/dist/chips/OscdChipSet.stories.d.ts +1 -1
  33. package/dist/chips/OscdFilterChip.stories.d.ts +1 -1
  34. package/dist/chips/OscdInputChip.stories.d.ts +1 -1
  35. package/dist/chips/OscdSuggestionChip.stories.d.ts +1 -1
  36. package/dist/dialog/OscdDialog.js +1 -1
  37. package/dist/dialog/OscdDialog.js.map +1 -1
  38. package/dist/dialog/OscdDialog.stories.d.ts +1 -1
  39. package/dist/dialog/OscdDialogStacking.stories.d.ts +5 -0
  40. package/dist/dialog/OscdDialogStacking.stories.js +112 -0
  41. package/dist/dialog/OscdDialogStacking.stories.js.map +1 -0
  42. package/dist/divider/OscdDivider.stories.d.ts +1 -1
  43. package/dist/elevation/OscdElevation.stories.d.ts +1 -1
  44. package/dist/fab/OscdBrandedFab.stories.d.ts +1 -1
  45. package/dist/fab/OscdFab.stories.d.ts +1 -1
  46. package/dist/field/OscdFilledField.stories.d.ts +1 -1
  47. package/dist/field/OscdOutlinedField.stories.d.ts +1 -1
  48. package/dist/focus/OscdFocusRing.stories.d.ts +1 -1
  49. package/dist/icon/OscdIcon.d.ts +1 -1
  50. package/dist/icon/OscdIcon.js +12 -1
  51. package/dist/icon/OscdIcon.js.map +1 -1
  52. package/dist/icon/OscdIcon.stories.d.ts +1 -1
  53. package/dist/icon/OscdIconRendering.spec.d.ts +1 -0
  54. package/dist/icon/OscdIconRendering.spec.js +66 -0
  55. package/dist/icon/OscdIconRendering.spec.js.map +1 -0
  56. package/dist/iconbutton/OscdFilledIconButton.stories.d.ts +1 -1
  57. package/dist/iconbutton/OscdFilledTonalIconButton.stories.d.ts +1 -1
  58. package/dist/iconbutton/OscdIconButton.stories.d.ts +1 -1
  59. package/dist/iconbutton/OscdOutlinedIconButton.stories.d.ts +1 -1
  60. package/dist/labs/badge/OscdBadge.stories.d.ts +1 -1
  61. package/dist/labs/card/OscdElevatedCard.stories.d.ts +1 -1
  62. package/dist/labs/card/OscdFilledCard.stories.d.ts +1 -1
  63. package/dist/labs/card/OscdOutlinedCard.stories.d.ts +1 -1
  64. package/dist/labs/item/OscdItem.stories.d.ts +1 -1
  65. package/dist/labs/navigationbar/OscdNavigationBar.stories.d.ts +1 -1
  66. package/dist/labs/navigationtab/OscdNavigationTab.stories.d.ts +1 -1
  67. package/dist/list/OscdList.stories.d.ts +1 -1
  68. package/dist/list/OscdListItem.stories.d.ts +1 -1
  69. package/dist/menu/OscdMenuItem.stories.d.ts +1 -1
  70. package/dist/progress/OscdLinearProgress.stories.d.ts +1 -1
  71. package/dist/ripple/OscdRipple.stories.d.ts +1 -1
  72. package/dist/scl-editor/OscdSclEditor.d.ts +22 -0
  73. package/dist/scl-editor/OscdSclEditor.js +62 -0
  74. package/dist/scl-editor/OscdSclEditor.js.map +1 -0
  75. package/dist/scl-editor/OscdSclEditor.spec.d.ts +1 -0
  76. package/dist/scl-editor/OscdSclEditor.spec.js +61 -0
  77. package/dist/scl-editor/OscdSclEditor.spec.js.map +1 -0
  78. package/dist/scl-editor/OscdSclEditor.stories.d.ts +13 -0
  79. package/dist/scl-editor/OscdSclEditor.stories.js +87 -0
  80. package/dist/scl-editor/OscdSclEditor.stories.js.map +1 -0
  81. package/dist/scl-editor/internal/namespace-utils.d.ts +13 -0
  82. package/dist/scl-editor/internal/namespace-utils.js +84 -0
  83. package/dist/scl-editor/internal/namespace-utils.js.map +1 -0
  84. package/dist/scl-editor/internal/namespace-utils.spec.d.ts +1 -0
  85. package/dist/scl-editor/internal/namespace-utils.spec.js +67 -0
  86. package/dist/scl-editor/internal/namespace-utils.spec.js.map +1 -0
  87. package/dist/scl-editor/oscd-scl-editor.d.ts +2 -0
  88. package/dist/scl-editor/oscd-scl-editor.js +4 -0
  89. package/dist/scl-editor/oscd-scl-editor.js.map +1 -0
  90. package/dist/scl-icon/internal/icons/icons.d.ts +1 -1
  91. package/dist/scl-icon/internal/icons/icons.js +1 -1
  92. package/dist/scl-icon/internal/icons/icons.js.map +1 -1
  93. package/dist/scl-icon/internal/scl-icons.d.ts +1 -1
  94. package/dist/scl-icon/internal/scl-icons.js +1 -1
  95. package/dist/scl-icon/internal/scl-icons.js.map +1 -1
  96. package/dist/scl-textfield/oscd-scl-text-field.stories.d.ts +1 -1
  97. package/dist/search-field/oscd-outlined-search-field.stories.d.ts +1 -1
  98. package/dist/selection-list/oscd-selection-list.stories.d.ts +1 -1
  99. package/dist/slider/OscdSlider.stories.d.ts +1 -1
  100. package/dist/switch/OscdSwitch.stories.d.ts +1 -1
  101. package/dist/tabs/OscdTabs.stories.d.ts +1 -1
  102. package/dist/textfield/OscdFilledTextField.stories.d.ts +1 -1
  103. package/dist/textfield/OscdOutlinedTextField.stories.d.ts +1 -1
  104. package/dist/utils/storybook/story-overrides/icon-overrides.d.ts +1 -0
  105. package/dist/utils/storybook/story-overrides/icon-overrides.js +61 -5
  106. package/dist/utils/storybook/story-overrides/icon-overrides.js.map +1 -1
  107. package/package.json +4 -4
@@ -1,31 +1,87 @@
1
+ import { html } from 'lit';
1
2
  import './oscd-ace-editor.js';
2
- import { getStorybookMeta } from '@/utils/storybook/getStorybookMeta.js';
3
- const { args, argTypes, meta } = getStorybookMeta({
3
+ import { sampleScl } from './sample-scl.js';
4
+ import { getStorybookMeta } from '../utils/storybook/getStorybookMeta.js';
5
+ const { args, argTypes, meta: editorMeta, } = getStorybookMeta({
4
6
  tagName: 'oscd-ace-editor',
7
+ defaultArgs: { value: sampleScl, toolbar: false },
8
+ options: { omitTextContent: true },
5
9
  });
6
- export default {
7
- ...meta,
10
+ const meta = {
11
+ ...editorMeta,
8
12
  title: 'Editors / Ace Editor',
9
- tags: ['autodocs'],
10
13
  parameters: {
11
- ...meta.parameters,
12
14
  layout: 'fullscreen',
15
+ docs: {
16
+ description: {
17
+ component: 'Text-in/text-out editor. The live value is a string; optional validation is application-defined, not SCL schema validation. User edits emit input and a compatible CustomEvent<string> change. Programmatic writes emit neither. The SCL Editor adds namespace-aware Element conversion.',
18
+ },
19
+ },
13
20
  },
21
+ args,
22
+ argTypes: {
23
+ ...argTypes,
24
+ value: { control: 'text' },
25
+ toolbar: { control: 'boolean' },
26
+ },
27
+ render: args => html `
28
+ <oscd-ace-editor
29
+ .value=${args.value}
30
+ .toolbar=${args.toolbar}
31
+ style="height: 100vh; width: 100%;"
32
+ ></oscd-ace-editor>
33
+ `,
34
+ };
35
+ export default meta;
36
+ export const FullSclDocument = {
37
+ name: 'SCL Doc as text',
38
+ parameters: {
39
+ docs: {
40
+ description: {
41
+ story: 'Pass the complete shared SCL file as a string through .value. The editor displays the whole document.',
42
+ },
43
+ },
44
+ },
45
+ };
46
+ export const WithToolbar = { args: { toolbar: true } };
47
+ const validateExample = (text) => {
48
+ const document = new DOMParser().parseFromString(text, 'application/xml');
49
+ return document.querySelector('parsererror') === null
50
+ ? null
51
+ : 'Enter one well-formed XML document';
14
52
  };
15
- export const Default = {
16
- argTypes,
17
- args: {
18
- ...args,
19
- value: `<?xml version="1.0" encoding="UTF-8"?>
20
- <SCL
21
- version="2007"
22
- revision="B"
23
- xmlns="http://www.iec.ch/61850/2003/SCL"
24
- xmlns:ens1="http://example.org/somePreexistingExtensionNamespace"
25
- >
26
- <Substation ens1:foo="a" name="A1" desc="test substation"></Substation>
27
- </SCL>`,
28
- style: 'height: 100vh; width: 100%;',
53
+ export const WithValidator = {
54
+ name: 'Custom validation callback',
55
+ parameters: {
56
+ docs: {
57
+ description: {
58
+ story: 'Supply an application-defined .validator callback that returns an error message or null. This example checks only XML well-formedness, not SCL schema validity. It starts with malformed <example>; click Check XML to display the form validation error, then change the text to <example/> to make it valid.',
59
+ },
60
+ },
29
61
  },
62
+ args: { value: '<example>', toolbar: true },
63
+ render: args => html `
64
+ <form style="display: flex; flex-direction: column; height: 100vh;">
65
+ <oscd-ace-editor
66
+ name="xml"
67
+ .validator=${validateExample}
68
+ .value=${args.value}
69
+ .toolbar=${args.toolbar}
70
+ style="flex: 1; min-height: 0; height: auto; width: 100%;"
71
+ ></oscd-ace-editor>
72
+ <button
73
+ type="button"
74
+ style="flex-shrink: 0;"
75
+ @click=${(event) => {
76
+ const target = event.currentTarget;
77
+ if (target instanceof HTMLButtonElement) {
78
+ target.form?.reportValidity();
79
+ }
80
+ }}
81
+ >
82
+ Check XML
83
+ </button>
84
+ </form>
85
+ `,
30
86
  };
31
87
  //# sourceMappingURL=OscdAceEditor.stories.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"OscdAceEditor.stories.js","sourceRoot":"","sources":["../../ace-editor/OscdAceEditor.stories.ts"],"names":[],"mappings":"AACA,OAAO,sBAAsB,CAAC;AAE9B,OAAO,EAAE,gBAAgB,EAAE,MAAM,uCAAuC,CAAC;AAEzE,MAAM,EAAE,IAAI,EAAE,QAAQ,EAAE,IAAI,EAAE,GAAG,gBAAgB,CAAgB;IAC/D,OAAO,EAAE,iBAAiB;CAC3B,CAAC,CAAC;AAEH,eAAe;IACb,GAAG,IAAI;IACP,KAAK,EAAE,sBAAsB;IAC7B,IAAI,EAAE,CAAC,UAAU,CAAC;IAClB,UAAU,EAAE;QACV,GAAG,IAAI,CAAC,UAAU;QAClB,MAAM,EAAE,YAAY;KACrB;CACF,CAAC;AAEF,MAAM,CAAC,MAAM,OAAO,GAAa;IAC/B,QAAQ;IACR,IAAI,EAAE;QACJ,GAAG,IAAI;QACP,KAAK,EAAE;;;;;;;;OAQJ;QACH,KAAK,EAAE,6BAA6B;KACrC;CACF,CAAC","sourcesContent":["import type { StoryObj } from '@storybook/web-components-vite';\nimport './oscd-ace-editor.js';\nimport { OscdAceEditor } from './OscdAceEditor.js';\nimport { getStorybookMeta } from '@/utils/storybook/getStorybookMeta.js';\n\nconst { args, argTypes, meta } = getStorybookMeta<OscdAceEditor>({\n tagName: 'oscd-ace-editor',\n});\n\nexport default {\n ...meta,\n title: 'Editors / Ace Editor',\n tags: ['autodocs'],\n parameters: {\n ...meta.parameters,\n layout: 'fullscreen',\n },\n};\n\nexport const Default: StoryObj = {\n argTypes,\n args: {\n ...args,\n value: `<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<SCL\n version=\"2007\"\n revision=\"B\"\n xmlns=\"http://www.iec.ch/61850/2003/SCL\"\n xmlns:ens1=\"http://example.org/somePreexistingExtensionNamespace\"\n>\n <Substation ens1:foo=\"a\" name=\"A1\" desc=\"test substation\"></Substation>\n</SCL>`,\n style: 'height: 100vh; width: 100%;',\n },\n};\n"]}
1
+ {"version":3,"file":"OscdAceEditor.stories.js","sourceRoot":"","sources":["../../ace-editor/OscdAceEditor.stories.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,IAAI,EAAE,MAAM,KAAK,CAAC;AAE3B,OAAO,sBAAsB,CAAC;AAC9B,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAC5C,OAAO,EAAE,gBAAgB,EAAE,MAAM,wCAAwC,CAAC;AAO1E,MAAM,EACJ,IAAI,EACJ,QAAQ,EACR,IAAI,EAAE,UAAU,GACjB,GAAG,gBAAgB,CAAa;IAC/B,OAAO,EAAE,iBAAiB;IAC1B,WAAW,EAAE,EAAE,KAAK,EAAE,SAAS,EAAE,OAAO,EAAE,KAAK,EAAE;IACjD,OAAO,EAAE,EAAE,eAAe,EAAE,IAAI,EAAE;CACnC,CAAC,CAAC;AAEH,MAAM,IAAI,GAAqB;IAC7B,GAAG,UAAU;IACb,KAAK,EAAE,sBAAsB;IAC7B,UAAU,EAAE;QACV,MAAM,EAAE,YAAY;QACpB,IAAI,EAAE;YACJ,WAAW,EAAE;gBACX,SAAS,EACP,0RAA0R;aAC7R;SACF;KACF;IACD,IAAI;IACJ,QAAQ,EAAE;QACR,GAAG,QAAQ;QACX,KAAK,EAAE,EAAE,OAAO,EAAE,MAAM,EAAE;QAC1B,OAAO,EAAE,EAAE,OAAO,EAAE,SAAS,EAAE;KAChC;IACD,MAAM,EAAE,IAAI,CAAC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AC","sourcesContent":["import type { Meta, StoryObj } from '@storybook/web-components-vite';\nimport { html } from 'lit';\n\nimport './oscd-ace-editor.js';\nimport { sampleScl } from './sample-scl.js';\nimport { getStorybookMeta } from '../utils/storybook/getStorybookMeta.js';\n\ntype EditorArgs = {\n value: string;\n toolbar: boolean;\n};\n\nconst {\n args,\n argTypes,\n meta: editorMeta,\n} = getStorybookMeta<EditorArgs>({\n tagName: 'oscd-ace-editor',\n defaultArgs: { value: sampleScl, toolbar: false },\n options: { omitTextContent: true },\n});\n\nconst meta: Meta<EditorArgs> = {\n ...editorMeta,\n title: 'Editors / Ace Editor',\n parameters: {\n layout: 'fullscreen',\n docs: {\n description: {\n component:\n 'Text-in/text-out editor. The live value is a string; optional validation is application-defined, not SCL schema validation. User edits emit input and a compatible CustomEvent<string> change. Programmatic writes emit neither. The SCL Editor adds namespace-aware Element conversion.',\n },\n },\n },\n args,\n argTypes: {\n ...argTypes,\n value: { control: 'text' },\n toolbar: { control: 'boolean' },\n },\n render: args => html`\n <oscd-ace-editor\n .value=${args.value}\n .toolbar=${args.toolbar}\n style=\"height: 100vh; width: 100%;\"\n ></oscd-ace-editor>\n `,\n};\n\nexport default meta;\ntype Story = StoryObj<EditorArgs>;\n\nexport const FullSclDocument: Story = {\n name: 'SCL Doc as text',\n parameters: {\n docs: {\n description: {\n story:\n 'Pass the complete shared SCL file as a string through .value. The editor displays the whole document.',\n },\n },\n },\n};\nexport const WithToolbar: Story = { args: { toolbar: true } };\n\nconst validateExample = (text: string): string | null => {\n const document = new DOMParser().parseFromString(text, 'application/xml');\n return document.querySelector('parsererror') === null\n ? null\n : 'Enter one well-formed XML document';\n};\n\nexport const WithValidator: Story = {\n name: 'Custom validation callback',\n parameters: {\n docs: {\n description: {\n story:\n 'Supply an application-defined .validator callback that returns an error message or null. This example checks only XML well-formedness, not SCL schema validity. It starts with malformed <example>; click Check XML to display the form validation error, then change the text to <example/> to make it valid.',\n },\n },\n },\n args: { value: '<example>', toolbar: true },\n render: args => html`\n <form style=\"display: flex; flex-direction: column; height: 100vh;\">\n <oscd-ace-editor\n name=\"xml\"\n .validator=${validateExample}\n .value=${args.value}\n .toolbar=${args.toolbar}\n style=\"flex: 1; min-height: 0; height: auto; width: 100%;\"\n ></oscd-ace-editor>\n <button\n type=\"button\"\n style=\"flex-shrink: 0;\"\n @click=${(event: Event) => {\n const target = event.currentTarget;\n if (target instanceof HTMLButtonElement) {\n target.form?.reportValidity();\n }\n }}\n >\n Check XML\n </button>\n </form>\n `,\n};\n"]}
@@ -1,4 +1,4 @@
1
- import { LitElement, type PropertyValueMap } from 'lit';
1
+ import { LitElement } from 'lit';
2
2
  import * as AceGlobal from 'ace-builds';
3
3
  import './ace.config.js';
4
4
  import AceEditorBase from './ace-editor-base/AceEditorBase.js';
@@ -11,12 +11,14 @@ type AceEditorWithSettingsMenu = AceGlobal.Ace.Editor & {
11
11
  export { AceGlobal };
12
12
  export type { AceSettingsMenuModule, AceEditorWithSettingsMenu };
13
13
  export declare class AceEditor extends LitElement {
14
- value: string | undefined;
14
+ private pendingValue;
15
+ set value(value: string | undefined);
16
+ get value(): string;
15
17
  aceEditorBase: AceEditorBase;
16
18
  get editor(): AceGlobal.Ace.Editor | undefined;
17
19
  connectedCallback(): void;
18
20
  disconnectedCallback(): void;
19
- protected updated(changedProps: PropertyValueMap<AceEditor>): void;
21
+ private handleReady;
20
22
  render(): import("lit-html").TemplateResult<1>;
21
23
  static styles: import("lit").CSSResult;
22
24
  }
@@ -1,7 +1,7 @@
1
1
  import { __decorate } from "tslib";
2
2
  import { LitElement, html, css } from 'lit';
3
3
  import * as AceGlobal from 'ace-builds';
4
- import { property, query } from 'lit/decorators.js';
4
+ import { query } from 'lit/decorators.js';
5
5
  import './ace.config.js';
6
6
  export { AceGlobal };
7
7
  const ACE_DEFAULT_OPTIONS = {
@@ -53,6 +53,18 @@ function manageAceOptionChange(editor) {
53
53
  };
54
54
  }
55
55
  export class AceEditor extends LitElement {
56
+ set value(value) {
57
+ const editor = this.editor;
58
+ if (editor === undefined) {
59
+ this.pendingValue = value ?? '';
60
+ }
61
+ else if (editor.getValue() !== (value ?? '')) {
62
+ this.aceEditorBase.value = value ?? '';
63
+ }
64
+ }
65
+ get value() {
66
+ return this.editor?.getValue() ?? this.pendingValue ?? '';
67
+ }
56
68
  get editor() {
57
69
  return this.aceEditorBase?.editor;
58
70
  }
@@ -69,24 +81,22 @@ export class AceEditor extends LitElement {
69
81
  super.disconnectedCallback();
70
82
  window.ace?.config?.removeEventListener?.('editor', manageAceOptionChange);
71
83
  }
72
- updated(changedProps) {
73
- if (changedProps.has('value')) {
74
- // Clear selection when content updates
75
- setTimeout(() => {
76
- if (this.aceEditorBase?.editor) {
77
- /* For reasons unknown the ace editor initially selects all code, so we need to clear that*/
78
- this.aceEditorBase.editor.selection.clearSelection();
79
- this.aceEditorBase.editor.moveCursorTo(0, 0);
80
- }
81
- }, 10);
84
+ handleReady() {
85
+ const editor = this.editor;
86
+ if (editor !== undefined && this.pendingValue !== undefined) {
87
+ if (editor.getValue() !== this.pendingValue) {
88
+ this.aceEditorBase.value = this.pendingValue;
89
+ }
90
+ this.pendingValue = undefined;
82
91
  }
83
92
  }
84
93
  render() {
85
94
  return html `
86
95
  <ace-editor-base
96
+ .valueUpdateMode=${'start'}
87
97
  .mode=${aceOptions.mode}
88
98
  .theme=${aceOptions.theme}
89
- .value=${this.value}
99
+ @ready=${this.handleReady}
90
100
  ></ace-editor-base>
91
101
  `;
92
102
  }
@@ -104,9 +114,6 @@ AceEditor.styles = css `
104
114
  width: inherit;
105
115
  }
106
116
  `;
107
- __decorate([
108
- property({ type: String })
109
- ], AceEditor.prototype, "value", void 0);
110
117
  __decorate([
111
118
  query('ace-editor-base')
112
119
  ], AceEditor.prototype, "aceEditorBase", void 0);
@@ -1 +1 @@
1
- {"version":3,"file":"AceEditor.js","sourceRoot":"","sources":["../../../ace-editor/internal/AceEditor.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,UAAU,EAAE,IAA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,IAAI,YAAY,CAAC,GAAG,CAAC,OAAO,CAAC,EAAE,CAAC;YAC9B,uCAAuC;YACvC,UAAU,CAAC,GAAG,EAAE;gBACd,IAAI,IAAI,CAAC,aAAa,EAAE,MAAM,EAAE,CAAC;oBAC/B,4FAA4F;oBAC5F,IAAI,CAAC,aAAa,CAAC,MAAM,CAAC,SAAS,CAAC,cAAc,EAAE,CAAC;oBACrD,IAAI,CAAC,aAAa,CAAC,MAAM,CAAC,YAAY,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC;gBAC/C,CAAC;YACH,CAAC,EAAE,EAAE,CAAC,CAAC;QACT,CAAC;IACH,CAAC;IAEQ,MAAM;QACb,OAAO,IAAI,CAAA;;gBAEC,UAAU,CAAC,IAAI;iBACd,UAAU,CAAC,KAAK;iBAChB,IAAI,CAAC,KAAK;;KAEtB,CAAC;IACJ,CAAC;;AAEe,gBAAM,GAAG,GAAG,CAAA;;;;;;;;;;;;GAY3B,CAAC;AA7DF;IADC,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;wCACD;AAG1B;IADC,KAAK,CAAC,iBAAiB,CAAC;gDACK","sourcesContent":["import { LitElement, html, css, type PropertyValueMap } from 'lit';\nimport * as AceGlobal from 'ace-builds';\nimport { property, query } from 'lit/decorators.js';\n\nimport './ace.config.js';\n\nimport AceEditorBase from './ace-editor-base/AceEditorBase.js';\n\ntype AceSettingsMenuModule = {\n init: () => void;\n};\n\ntype AceEditorWithSettingsMenu = AceGlobal.Ace.Editor & {\n showSettingsMenu?: () => void;\n};\n\nexport { AceGlobal };\nexport type { AceSettingsMenuModule, AceEditorWithSettingsMenu };\n\nconst ACE_DEFAULT_OPTIONS = {\n fontSize: '17',\n theme: 'ace/theme/oscd',\n mode: 'ace/mode/xml',\n};\n\nconst storageKey = 'oscd:ace-options';\n\nconst getStoredAceOptions = (): Omit<\n Partial<AceGlobal.Ace.EditorOptions>,\n 'theme' | 'mode'\n> &\n Pick<AceGlobal.Ace.EditorOptions, 'theme' | 'mode'> => {\n try {\n const stored = localStorage.getItem(storageKey);\n if (stored) {\n return {\n ...ACE_DEFAULT_OPTIONS,\n ...JSON.parse(stored),\n };\n }\n } catch (error) {\n console.warn('Failed to retrieve Ace options from storage:', error);\n }\n return ACE_DEFAULT_OPTIONS;\n};\n\nlet aceOptions = getStoredAceOptions();\nlet isSettingsMenuInitialized = false;\n\nfunction manageAceOptionChange(editor: AceGlobal.Ace.Editor) {\n editor.setOptions(aceOptions);\n\n const originalSetOption = editor.setOption.bind(editor);\n const originalSetOptions = editor.setOptions.bind(editor);\n const persistOptions = () => {\n try {\n aceOptions = {\n ...ACE_DEFAULT_OPTIONS,\n ...editor.getOptions(),\n };\n localStorage.setItem(storageKey, JSON.stringify(aceOptions));\n } catch (error) {\n console.warn('Failed to store Ace options:', error);\n }\n };\n\n editor.setOption = (name: string, value: unknown) => {\n originalSetOption(\n name as keyof AceGlobal.Ace.EditorOptions,\n value as never,\n );\n persistOptions();\n };\n\n editor.setOptions = (options: Partial<AceGlobal.Ace.EditorOptions>) => {\n originalSetOptions(options);\n persistOptions();\n };\n}\n\nexport class AceEditor extends LitElement {\n @property({ type: String })\n value: string | undefined;\n\n @query('ace-editor-base')\n aceEditorBase!: AceEditorBase;\n\n public get editor(): AceGlobal.Ace.Editor | undefined {\n return this.aceEditorBase?.editor;\n }\n\n override connectedCallback(): void {\n super.connectedCallback();\n window.ace?.config?.addEventListener?.('editor', manageAceOptionChange);\n\n if (!isSettingsMenuInitialized) {\n const settingsMenu = window.ace?.require?.('ace/ext/settings_menu') as\n AceSettingsMenuModule | undefined;\n settingsMenu?.init();\n isSettingsMenuInitialized = true;\n }\n }\n\n override disconnectedCallback(): void {\n super.disconnectedCallback();\n window.ace?.config?.removeEventListener?.('editor', manageAceOptionChange);\n }\n\n protected override updated(changedProps: PropertyValueMap<AceEditor>): void {\n if (changedProps.has('value')) {\n // Clear selection when content updates\n setTimeout(() => {\n if (this.aceEditorBase?.editor) {\n /* For reasons unknown the ace editor initially selects all code, so we need to clear that*/\n this.aceEditorBase.editor.selection.clearSelection();\n this.aceEditorBase.editor.moveCursorTo(0, 0);\n }\n }, 10);\n }\n }\n\n override render() {\n return html`\n <ace-editor-base\n .mode=${aceOptions.mode}\n .theme=${aceOptions.theme}\n .value=${this.value}\n ></ace-editor-base>\n `;\n }\n\n static override styles = css`\n :host {\n display: block;\n height: 100%;\n width: 100%;\n }\n\n ace-editor-base {\n display: inherit;\n height: inherit;\n width: inherit;\n }\n `;\n}\n"]}
1
+ {"version":3,"file":"AceEditor.js","sourceRoot":"","sources":["../../../ace-editor/internal/AceEditor.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,UAAU,EAAE,IAAI,EAAE,GAAG,EAAE,MAAM,KAAK,CAAC;AAC5C,OAAO,KAAK,SAAS,MAAM,YAAY,CAAC;AACxC,OAAO,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAC;AAE1C,OAAO,iBAAiB,CAAC;AAYzB,OAAO,EAAE,SAAS,EAAE,CAAC;AAGrB,MAAM,mBAAmB,GAAG;IAC1B,QAAQ,EAAE,IAAI;IACd,KAAK,EAAE,gBAAgB;IACvB,IAAI,EAAE,cAAc;CACrB,CAAC;AAEF,MAAM,UAAU,GAAG,kBAAkB,CAAC;AAEtC,MAAM,mBAAmB,GAAG,GAI0B,EAAE;IACtD,IAAI,CAAC;QACH,MAAM,MAAM,GAAG,YAAY,CAAC,OAAO,CAAC,UAAU,CAAC,CAAC;QAChD,IAAI,MAAM,EAAE,CAAC;YACX,OAAO;gBACL,GAAG,mBAAmB;gBACtB,GAAG,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC;aACtB,CAAC;QACJ,CAAC;IACH,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,OAAO,CAAC,IAAI,CAAC,8CAA8C,EAAE,KAAK,CAAC,CAAC;IACtE,CAAC;IACD,OAAO,mBAAmB,CAAC;AAC7B,CAAC,CAAC;AAEF,IAAI,UAAU,GAA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ACH,CAAC;IAEQ,MAAM;QACb,OAAO,IAAI,CAAA;;2BAEY,OAAO;gBAClB,UAAU,CAAC,IAAI;iBACd,UAAU,CAAC,KAAK;iBAChB,IAAI,CAAC,WAAW;;KAE5B,CAAC;IACJ,CAAC;;AAEe,gBAAM,GAAG,GAAG,CAAA;;;;;;;;;;;;GAY3B,CAAC;AAxDF;IADC,KAAK,CAAC,iBAAiB,CAAC;gDACK","sourcesContent":["import { LitElement, html, css } from 'lit';\nimport * as AceGlobal from 'ace-builds';\nimport { query } from 'lit/decorators.js';\n\nimport './ace.config.js';\n\nimport AceEditorBase from './ace-editor-base/AceEditorBase.js';\n\ntype AceSettingsMenuModule = {\n init: () => void;\n};\n\ntype AceEditorWithSettingsMenu = AceGlobal.Ace.Editor & {\n showSettingsMenu?: () => void;\n};\n\nexport { AceGlobal };\nexport type { AceSettingsMenuModule, AceEditorWithSettingsMenu };\n\nconst ACE_DEFAULT_OPTIONS = {\n fontSize: '17',\n theme: 'ace/theme/oscd',\n mode: 'ace/mode/xml',\n};\n\nconst storageKey = 'oscd:ace-options';\n\nconst getStoredAceOptions = (): Omit<\n Partial<AceGlobal.Ace.EditorOptions>,\n 'theme' | 'mode'\n> &\n Pick<AceGlobal.Ace.EditorOptions, 'theme' | 'mode'> => {\n try {\n const stored = localStorage.getItem(storageKey);\n if (stored) {\n return {\n ...ACE_DEFAULT_OPTIONS,\n ...JSON.parse(stored),\n };\n }\n } catch (error) {\n console.warn('Failed to retrieve Ace options from storage:', error);\n }\n return ACE_DEFAULT_OPTIONS;\n};\n\nlet aceOptions = getStoredAceOptions();\nlet isSettingsMenuInitialized = false;\n\nfunction manageAceOptionChange(editor: AceGlobal.Ace.Editor) {\n editor.setOptions(aceOptions);\n\n const originalSetOption = editor.setOption.bind(editor);\n const originalSetOptions = editor.setOptions.bind(editor);\n const persistOptions = () => {\n try {\n aceOptions = {\n ...ACE_DEFAULT_OPTIONS,\n ...editor.getOptions(),\n };\n localStorage.setItem(storageKey, JSON.stringify(aceOptions));\n } catch (error) {\n console.warn('Failed to store Ace options:', error);\n }\n };\n\n editor.setOption = (name: string, value: unknown) => {\n originalSetOption(\n name as keyof AceGlobal.Ace.EditorOptions,\n value as never,\n );\n persistOptions();\n };\n\n editor.setOptions = (options: Partial<AceGlobal.Ace.EditorOptions>) => {\n originalSetOptions(options);\n persistOptions();\n };\n}\n\nexport class AceEditor extends LitElement {\n private pendingValue: string | undefined;\n\n set value(value: string | undefined) {\n const editor = this.editor;\n if (editor === undefined) {\n this.pendingValue = value ?? '';\n } else if (editor.getValue() !== (value ?? '')) {\n this.aceEditorBase.value = value ?? '';\n }\n }\n\n get value(): string {\n return this.editor?.getValue() ?? this.pendingValue ?? '';\n }\n\n @query('ace-editor-base')\n aceEditorBase!: AceEditorBase;\n\n public get editor(): AceGlobal.Ace.Editor | undefined {\n return this.aceEditorBase?.editor;\n }\n\n override connectedCallback(): void {\n super.connectedCallback();\n window.ace?.config?.addEventListener?.('editor', manageAceOptionChange);\n\n if (!isSettingsMenuInitialized) {\n const settingsMenu = window.ace?.require?.('ace/ext/settings_menu') as\n AceSettingsMenuModule | undefined;\n settingsMenu?.init();\n isSettingsMenuInitialized = true;\n }\n }\n\n override disconnectedCallback(): void {\n super.disconnectedCallback();\n window.ace?.config?.removeEventListener?.('editor', manageAceOptionChange);\n }\n\n private handleReady(): void {\n const editor = this.editor;\n if (editor !== undefined && this.pendingValue !== undefined) {\n if (editor.getValue() !== this.pendingValue) {\n this.aceEditorBase.value = this.pendingValue;\n }\n this.pendingValue = undefined;\n }\n }\n\n override render() {\n return html`\n <ace-editor-base\n .valueUpdateMode=${'start'}\n .mode=${aceOptions.mode}\n .theme=${aceOptions.theme}\n @ready=${this.handleReady}\n ></ace-editor-base>\n `;\n }\n\n static override styles = css`\n :host {\n display: block;\n height: 100%;\n width: 100%;\n }\n\n ace-editor-base {\n display: inherit;\n height: inherit;\n width: inherit;\n }\n `;\n}\n"]}
@@ -32,7 +32,7 @@ class AceEditorBase extends HTMLElement {
32
32
  editor.session.setMode(this.mode || 'ace/mode/xml');
33
33
  editor.setTheme(this.theme || 'ace/theme/oscd');
34
34
  const text = editor.getValue() || '';
35
- if (text !== this.value) {
35
+ if (this._editor === undefined && text !== (this.value ?? '')) {
36
36
  editor.setValue(this.value || '', getValueUpdateNumber(this.valueUpdateMode));
37
37
  }
38
38
  editor.getSession().setTabSize(this.tabSize || 2);
@@ -150,12 +150,18 @@ class AceEditorBase extends HTMLElement {
150
150
  this._editor.off('change', this.handleChange);
151
151
  this._editor.off('blur', this.handleBlur);
152
152
  }
153
- // eslint-disable-next-line @typescript-eslint/no-unused-vars
154
153
  attributeChangedCallback(name) {
155
- this.initializeEditor();
154
+ this.notifyPropertyChanged(name);
156
155
  }
157
- // eslint-disable-next-line @typescript-eslint/no-unused-vars
158
156
  notifyPropertyChanged(name) {
157
+ // Apply external text synchronously; input echoes must not schedule stale resets.
158
+ if (name === 'value' && this._editor !== undefined) {
159
+ const value = this.value ?? '';
160
+ if (value !== this._editor.getValue()) {
161
+ this._editor.setValue(value, getValueUpdateNumber(this.valueUpdateMode));
162
+ }
163
+ return;
164
+ }
159
165
  this.initializeEditor();
160
166
  }
161
167
  resize() {
@@ -1 +1 @@
1
- {"version":3,"file":"AceEditorBase.js","sourceRoot":"","sources":["../../../../ace-editor/internal/ace-editor-base/AceEditorBase.ts"],"names":[],"mappings":"AAAA,2CAA2C;;AAE3C,OAAO,EACL,eAAe,EACf,sBAAsB,EACtB,sBAAsB,GACvB,MAAM,0BAA0B,CAAC;AAGlC,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AASzC,IAAK,eAIJ;AAJD,WAAK,eAAe;IAClB,kCAAe,CAAA;IACf,8BAAW,CAAA;IACX,oCAAiB,CAAA;AACnB,CAAC,EAJI,eAAe,KAAf,eAAe,QAInB;AAED,SAAS,oBAAoB,CAAC,IAAsB;IAClD,IAAI,IAAI,KAAK,eAAe,CAAC,KAAK,EAAE,CAAC;QACnC,O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QAAQ,EAAE,IAAI,CAAC,YAAY,CAAC,CAAC;QAC9C,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,MAAM,EAAE,IAAI,CAAC,UAAU,CAAC,CAAC;IAC5C,CAAC;IAED,6DAA6D;IAC7D,wBAAwB,CAAC,IAAY;QACnC,IAAI,CAAC,gBAAgB,EAAE,CAAC;IAC1B,CAAC;IAED,6DAA6D;IAC7D,qBAAqB,CAAC,IAAY;QAChC,IAAI,CAAC,gBAAgB,EAAE,CAAC;IAC1B,CAAC;IAED,MAAM;QACJ,IAAI,CAAC,OAAO,EAAE,MAAM,EAAE,CAAC;IACzB,CAAC;;AAhMc,iCAAmB,GAAa,EAAE,AAAf,CAAgB;AAclD;IADC,eAAe,EAAE;4CACH;AAGf;IADC,eAAe,EAAE;2CACJ;AAGd;IADC,eAAe,EAAE;4CACH;AAGf;IADC,sBAAsB,EAAE;8CACR;AAGjB;IADC,sBAAsB,EAAE;+CACN;AAGnB;IADC,sBAAsB,EAAE;+CACN;AAGnB;IADC,sBAAsB,EAAE;2CACV;AAGf;IADC,eAAe,EAAE;sDACgB;AAGlC;IADC,sBAAsB,EAAE;8DACS;AAGlC;IADC,sBAAsB,EAAE;iDACJ;AAGrB;IADC,sBAAsB,EAAE;8DACS;AAGlC;IADC,sBAAsB,EAAE;sDACC;AAG1B;IADC,eAAe,EAAE;+CACA;AAkKpB,eAAe,aAAa,CAAC","sourcesContent":["/* eslint-disable class-methods-use-this */\n\nimport {\n NotifyAttribute,\n NotifyBooleanAttribute,\n NotifyNumericAttribute,\n} from './property-decorators.js';\n\nimport { Ace } from 'ace-builds';\nimport { debounce } from './debounce.js';\nimport type * as AceGlobal from 'ace-builds';\n\ndeclare global {\n interface Window {\n ace: typeof AceGlobal;\n }\n}\n\nenum ValueUpdateMode {\n start = 'start',\n end = 'end',\n select = 'select',\n}\n\nfunction getValueUpdateNumber(mode?: ValueUpdateMode): number {\n if (mode === ValueUpdateMode.start) {\n return -1;\n }\n if (mode === ValueUpdateMode.end) {\n return 1;\n }\n return 0;\n}\n\n/**\n * Custom element Ace code editor\n */\nclass AceEditorBase extends HTMLElement {\n private static _observedAttributes: string[] = [];\n\n private _editor?: Ace.Editor;\n get editor(): Ace.Editor | undefined {\n return this._editor;\n }\n\n get version(): { [key: string]: string } {\n return {\n ace: window.ace?.version || 'unknown',\n };\n }\n\n @NotifyAttribute()\n value?: string;\n\n @NotifyAttribute()\n mode?: string;\n\n @NotifyAttribute()\n theme?: string;\n\n @NotifyNumericAttribute()\n tabSize?: number;\n\n @NotifyBooleanAttribute()\n readonly?: boolean;\n\n @NotifyBooleanAttribute()\n softTabs?: boolean;\n\n @NotifyBooleanAttribute()\n wrap?: boolean;\n\n @NotifyAttribute()\n valueUpdateMode?: ValueUpdateMode;\n\n @NotifyBooleanAttribute()\n hideActiveLineHighlight?: boolean;\n\n @NotifyBooleanAttribute()\n hideGutter?: boolean;\n\n @NotifyBooleanAttribute()\n hideGutterLineHighlight?: boolean;\n\n @NotifyBooleanAttribute()\n hidePrintMargin?: boolean;\n\n @NotifyAttribute()\n basePath?: string;\n\n static get observedAttributes(): string[] {\n return AceEditorBase._observedAttributes;\n }\n\n /**\n * Registers an attribute to be observed.\n *\n * @param name Attribute name to observe.\n * @internal\n */\n addObservedAttribute(name: string): void {\n AceEditorBase._observedAttributes.push(name);\n }\n\n private dispatch<T>(type: string, detail: T): void {\n this.dispatchEvent(\n new CustomEvent(type, {\n bubbles: true,\n composed: true,\n cancelable: false,\n detail,\n }),\n );\n }\n\n private initializeEditor = debounce(() => {\n if (this.basePath) {\n window.ace.config.set('basePath', this.basePath);\n }\n\n const editor = this._editor || window.ace.edit(this);\n\n this.appendStyles();\n\n editor.session.setMode(this.mode || 'ace/mode/xml');\n editor.setTheme(this.theme || 'ace/theme/oscd');\n\n const text = editor.getValue() || '';\n if (text !== this.value) {\n editor.setValue(\n this.value || '',\n getValueUpdateNumber(this.valueUpdateMode),\n );\n }\n\n editor.getSession().setTabSize(this.tabSize || 2);\n editor.getSession().setUseSoftTabs(!!this.softTabs);\n\n editor.renderer.setShowGutter(!this.hideGutter);\n editor.renderer.setShowPrintMargin(!this.hidePrintMargin);\n editor.setHighlightActiveLine(!this.hideActiveLineHighlight);\n editor.setHighlightGutterLine(!this.hideGutterLineHighlight);\n\n editor.setReadOnly(!!this.readonly);\n if (this.readonly) {\n editor.setHighlightActiveLine(!this.readonly);\n editor.setHighlightGutterLine(!this.readonly);\n }\n\n editor.getSession().setUseWrapMode(!!this.wrap);\n\n editor.off('change', this.handleChange);\n editor.on('change', this.handleChange);\n editor.off('blur', this.handleBlur);\n editor.on('blur', this.handleBlur);\n\n this.resize();\n\n this._editor = editor;\n });\n\n private appendStyles() {\n const rootNode = this.getRootNode() as Document | ShadowRoot | undefined;\n const aceStyleId = `ace_editor.css`;\n const customStyleId = `ace-custom-element-style`;\n\n // initialize styles if rendering on the client:\n if (rootNode) {\n if (!rootNode.getElementById?.(customStyleId)) {\n const style = document.createElement('style');\n style.id = customStyleId;\n style.type = 'text/css';\n style.innerHTML = `\n ace-editor {\n display: block;\n width: 100%;\n height: 100%;\n min-height: 250px;\n }\n `;\n\n if (rootNode instanceof Document && rootNode.head) {\n rootNode.head.appendChild(style);\n } else {\n rootNode.appendChild(style);\n }\n }\n\n if (!rootNode.getElementById?.(aceStyleId)) {\n const editorStyle = document.getElementById(aceStyleId);\n if (editorStyle) {\n if (rootNode instanceof Document && rootNode.head) {\n rootNode.head.appendChild(editorStyle.cloneNode(true));\n } else {\n rootNode.appendChild(editorStyle.cloneNode(true));\n }\n }\n }\n }\n }\n\n connectedCallback(): void {\n this.initializeEditor().then(() => {\n this.dispatch('ready', {\n editor: this.editor,\n });\n });\n }\n\n disconnectedCallback(): void {\n if (!this._editor) {\n return;\n }\n\n this._editor.off('change', this.handleChange);\n this._editor.off('blur', this.handleBlur);\n }\n\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n attributeChangedCallback(name: string): void {\n this.initializeEditor();\n }\n\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n notifyPropertyChanged(name: string): void {\n this.initializeEditor();\n }\n\n resize(): void {\n this._editor?.resize();\n }\n\n private handleChange = debounce(() => {\n const text = this._editor?.getValue() || '';\n if (text !== this.value) {\n if (text) {\n this.setAttribute('value', text);\n } else {\n this.removeAttribute('value');\n }\n\n this.dispatch('change', text);\n }\n });\n\n private handleBlur = () => {\n this.dispatchEvent(new FocusEvent('blur'));\n };\n}\n\nexport default AceEditorBase;\n"]}
1
+ {"version":3,"file":"AceEditorBase.js","sourceRoot":"","sources":["../../../../ace-editor/internal/ace-editor-base/AceEditorBase.ts"],"names":[],"mappings":"AAAA,2CAA2C;;AAE3C,OAAO,EACL,eAAe,EACf,sBAAsB,EACtB,sBAAsB,GACvB,MAAM,0BAA0B,CAAC;AAGlC,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AASzC,IAAK,eAIJ;AAJD,WAAK,eAAe;IAClB,kCAAe,CAAA;IACf,8BAAW,CAAA;IACX,oCAAiB,CAAA;AACnB,CAAC,EAJI,eAAe,KAAf,eAAe,QAInB;AAED,SAAS,oBAAoB,CAAC,IAAsB;IAClD,IAAI,IAAI,KAAK,eAAe,CAAC,KAAK,EAAE,CAAC;QACnC,OAAO,CAAC,CAAC,CAAC;IACZ,CAAC;IACD,IAAI,IAAI,KAAK,eAAe,CAAC,GAAG,EAAE,CAAC;QACjC,OAAO,CAAC,CAAC;IACX,CAAC;IACD,OAAO,CAAC,CAAC;AACX,CAAC;AAED;;GAEG;AACH,MAAM,aAAc,SAAQ,WAAW;IAAvC;;QA8EU,qBAAgB,GAAG,QAAQ,CAAC,GAAG,EAAE;YACvC,IAAI,IAAI,CAAC,QAAQ,EAAE,CAAC;gBAClB,MAAM,CAAC,GAAG,CAAC,MAAM,CAAC,GAAG,CAAC,UAAU,EAAE,IAAI,CAAC,QAAQ,CAAC,CAAC;YACnD,CAAC;YAED,MAAM,MAAM,GAAG,IAAI,CAAC,OAAO,IAAI,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I,EAAE,CAAC;YAC/B,IAAI,KAAK,KAAK,IAAI,CAAC,OAAO,CAAC,QAAQ,EAAE,EAAE,CAAC;gBACtC,IAAI,CAAC,OAAO,CAAC,QAAQ,CACnB,KAAK,EACL,oBAAoB,CAAC,IAAI,CAAC,eAAe,CAAC,CAC3C,CAAC;YACJ,CAAC;YACD,OAAO;QACT,CAAC;QACD,IAAI,CAAC,gBAAgB,EAAE,CAAC;IAC1B,CAAC;IAED,MAAM;QACJ,IAAI,CAAC,OAAO,EAAE,MAAM,EAAE,CAAC;IACzB,CAAC;;AAzMc,iCAAmB,GAAa,EAAE,AAAf,CAAgB;AAclD;IADC,eAAe,EAAE;4CACH;AAGf;IADC,eAAe,EAAE;2CACJ;AAGd;IADC,eAAe,EAAE;4CACH;AAGf;IADC,sBAAsB,EAAE;8CACR;AAGjB;IADC,sBAAsB,EAAE;+CACN;AAGnB;IADC,sBAAsB,EAAE;+CACN;AAGnB;IADC,sBAAsB,EAAE;2CACV;AAGf;IADC,eAAe,EAAE;sDACgB;AAGlC;IADC,sBAAsB,EAAE;8DACS;AAGlC;IADC,sBAAsB,EAAE;iDACJ;AAGrB;IADC,sBAAsB,EAAE;8DACS;AAGlC;IADC,sBAAsB,EAAE;sDACC;AAG1B;IADC,eAAe,EAAE;+CACA;AA2KpB,eAAe,aAAa,CAAC","sourcesContent":["/* eslint-disable class-methods-use-this */\n\nimport {\n NotifyAttribute,\n NotifyBooleanAttribute,\n NotifyNumericAttribute,\n} from './property-decorators.js';\n\nimport { Ace } from 'ace-builds';\nimport { debounce } from './debounce.js';\nimport type * as AceGlobal from 'ace-builds';\n\ndeclare global {\n interface Window {\n ace: typeof AceGlobal;\n }\n}\n\nenum ValueUpdateMode {\n start = 'start',\n end = 'end',\n select = 'select',\n}\n\nfunction getValueUpdateNumber(mode?: ValueUpdateMode): number {\n if (mode === ValueUpdateMode.start) {\n return -1;\n }\n if (mode === ValueUpdateMode.end) {\n return 1;\n }\n return 0;\n}\n\n/**\n * Custom element Ace code editor\n */\nclass AceEditorBase extends HTMLElement {\n private static _observedAttributes: string[] = [];\n\n private _editor?: Ace.Editor;\n get editor(): Ace.Editor | undefined {\n return this._editor;\n }\n\n get version(): { [key: string]: string } {\n return {\n ace: window.ace?.version || 'unknown',\n };\n }\n\n @NotifyAttribute()\n value?: string;\n\n @NotifyAttribute()\n mode?: string;\n\n @NotifyAttribute()\n theme?: string;\n\n @NotifyNumericAttribute()\n tabSize?: number;\n\n @NotifyBooleanAttribute()\n readonly?: boolean;\n\n @NotifyBooleanAttribute()\n softTabs?: boolean;\n\n @NotifyBooleanAttribute()\n wrap?: boolean;\n\n @NotifyAttribute()\n valueUpdateMode?: ValueUpdateMode;\n\n @NotifyBooleanAttribute()\n hideActiveLineHighlight?: boolean;\n\n @NotifyBooleanAttribute()\n hideGutter?: boolean;\n\n @NotifyBooleanAttribute()\n hideGutterLineHighlight?: boolean;\n\n @NotifyBooleanAttribute()\n hidePrintMargin?: boolean;\n\n @NotifyAttribute()\n basePath?: string;\n\n static get observedAttributes(): string[] {\n return AceEditorBase._observedAttributes;\n }\n\n /**\n * Registers an attribute to be observed.\n *\n * @param name Attribute name to observe.\n * @internal\n */\n addObservedAttribute(name: string): void {\n AceEditorBase._observedAttributes.push(name);\n }\n\n private dispatch<T>(type: string, detail: T): void {\n this.dispatchEvent(\n new CustomEvent(type, {\n bubbles: true,\n composed: true,\n cancelable: false,\n detail,\n }),\n );\n }\n\n private initializeEditor = debounce(() => {\n if (this.basePath) {\n window.ace.config.set('basePath', this.basePath);\n }\n\n const editor = this._editor || window.ace.edit(this);\n\n this.appendStyles();\n\n editor.session.setMode(this.mode || 'ace/mode/xml');\n editor.setTheme(this.theme || 'ace/theme/oscd');\n\n const text = editor.getValue() || '';\n if (this._editor === undefined && text !== (this.value ?? '')) {\n editor.setValue(\n this.value || '',\n getValueUpdateNumber(this.valueUpdateMode),\n );\n }\n\n editor.getSession().setTabSize(this.tabSize || 2);\n editor.getSession().setUseSoftTabs(!!this.softTabs);\n\n editor.renderer.setShowGutter(!this.hideGutter);\n editor.renderer.setShowPrintMargin(!this.hidePrintMargin);\n editor.setHighlightActiveLine(!this.hideActiveLineHighlight);\n editor.setHighlightGutterLine(!this.hideGutterLineHighlight);\n\n editor.setReadOnly(!!this.readonly);\n if (this.readonly) {\n editor.setHighlightActiveLine(!this.readonly);\n editor.setHighlightGutterLine(!this.readonly);\n }\n\n editor.getSession().setUseWrapMode(!!this.wrap);\n\n editor.off('change', this.handleChange);\n editor.on('change', this.handleChange);\n editor.off('blur', this.handleBlur);\n editor.on('blur', this.handleBlur);\n\n this.resize();\n\n this._editor = editor;\n });\n\n private appendStyles() {\n const rootNode = this.getRootNode() as Document | ShadowRoot | undefined;\n const aceStyleId = `ace_editor.css`;\n const customStyleId = `ace-custom-element-style`;\n\n // initialize styles if rendering on the client:\n if (rootNode) {\n if (!rootNode.getElementById?.(customStyleId)) {\n const style = document.createElement('style');\n style.id = customStyleId;\n style.type = 'text/css';\n style.innerHTML = `\n ace-editor {\n display: block;\n width: 100%;\n height: 100%;\n min-height: 250px;\n }\n `;\n\n if (rootNode instanceof Document && rootNode.head) {\n rootNode.head.appendChild(style);\n } else {\n rootNode.appendChild(style);\n }\n }\n\n if (!rootNode.getElementById?.(aceStyleId)) {\n const editorStyle = document.getElementById(aceStyleId);\n if (editorStyle) {\n if (rootNode instanceof Document && rootNode.head) {\n rootNode.head.appendChild(editorStyle.cloneNode(true));\n } else {\n rootNode.appendChild(editorStyle.cloneNode(true));\n }\n }\n }\n }\n }\n\n connectedCallback(): void {\n this.initializeEditor().then(() => {\n this.dispatch('ready', {\n editor: this.editor,\n });\n });\n }\n\n disconnectedCallback(): void {\n if (!this._editor) {\n return;\n }\n\n this._editor.off('change', this.handleChange);\n this._editor.off('blur', this.handleBlur);\n }\n\n attributeChangedCallback(name: string): void {\n this.notifyPropertyChanged(name);\n }\n\n notifyPropertyChanged(name: string): void {\n // Apply external text synchronously; input echoes must not schedule stale resets.\n if (name === 'value' && this._editor !== undefined) {\n const value = this.value ?? '';\n if (value !== this._editor.getValue()) {\n this._editor.setValue(\n value,\n getValueUpdateNumber(this.valueUpdateMode),\n );\n }\n return;\n }\n this.initializeEditor();\n }\n\n resize(): void {\n this._editor?.resize();\n }\n\n private handleChange = debounce(() => {\n const text = this._editor?.getValue() || '';\n if (text !== this.value) {\n if (text) {\n this.setAttribute('value', text);\n } else {\n this.removeAttribute('value');\n }\n\n this.dispatch('change', text);\n }\n });\n\n private handleBlur = () => {\n this.dispatchEvent(new FocusEvent('blur'));\n };\n}\n\nexport default AceEditorBase;\n"]}
@@ -0,0 +1 @@
1
+ import '../ace.config.js';
@@ -0,0 +1,33 @@
1
+ import { defineCE, expect, fixture, waitUntil } from '@open-wc/testing';
2
+ import '../ace.config.js';
3
+ import AceEditorBase from './AceEditorBase.js';
4
+ const tagName = defineCE(AceEditorBase);
5
+ describe('AceEditorBase value synchronization', () => {
6
+ let element;
7
+ beforeEach(async () => {
8
+ element = await fixture(`<${tagName}></${tagName}>`);
9
+ element.value = '<root/>';
10
+ await waitUntil(() => element.editor?.getValue() === '<root/>');
11
+ });
12
+ for (const firstValue of ['<root>first</root>', '']) {
13
+ it(`preserves subsequent input after notifying ${firstValue || 'an empty buffer'}`, async () => {
14
+ const editor = element.editor;
15
+ element.addEventListener('change', () => {
16
+ editor.insert('later');
17
+ }, { once: true });
18
+ editor.setValue(firstValue, -1);
19
+ const expected = 'later' + firstValue;
20
+ await waitUntil(() => element.value === expected, 'The next input was overwritten by a stale value notification');
21
+ expect(editor.getValue()).to.equal(expected);
22
+ });
23
+ }
24
+ it('still applies external property and attribute changes', async () => {
25
+ element.value = '<property/>';
26
+ await waitUntil(() => element.editor?.getValue() === '<property/>');
27
+ element.setAttribute('value', '<attribute/>');
28
+ await waitUntil(() => element.editor?.getValue() === '<attribute/>');
29
+ element.removeAttribute('value');
30
+ await waitUntil(() => element.editor?.getValue() === '');
31
+ });
32
+ });
33
+ //# sourceMappingURL=AceEditorBase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C,KAAK,KAAK,QAAQ,EAChC,8DAA8D,CAC/D,CAAC;YACF,MAAM,CAAC,MAAM,CAAC,QAAQ,EAAE,CAAC,CAAC,EAAE,CAAC,KAAK,CAAC,QAAQ,CAAC,CAAC;QAC/C,CAAC,CAAC,CAAC;IACL,CAAC;IAED,EAAE,CAAC,uDAAuD,EAAE,KAAK,IAAI,EAAE;QACrE,OAAO,CAAC,KAAK,GAAG,aAAa,CAAC;QAC9B,MAAM,SAAS,CAAC,GAAG,EAAE,CAAC,OAAO,CAAC,MAAM,EAAE,QAAQ,EAAE,KAAK,aAAa,CAAC,CAAC;QACpE,OAAO,CAAC,YAAY,CAAC,OAAO,EAAE,cAAc,CAAC,CAAC;QAC9C,MAAM,SAAS,CAAC,GAAG,EAAE,CAAC,OAAO,CAAC,MAAM,EAAE,QAAQ,EAAE,KAAK,cAAc,CAAC,CAAC;QACrE,OAAO,CAAC,eAAe,CAAC,OAAO,CAAC,CAAC;QACjC,MAAM,SAAS,CAAC,GAAG,EAAE,CAAC,OAAO,CAAC,MAAM,EAAE,QAAQ,EAAE,KAAK,EAAE,CAAC,CAAC;IAC3D,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC","sourcesContent":["import { defineCE, expect, fixture, waitUntil } from '@open-wc/testing';\n\nimport '../ace.config.js';\nimport AceEditorBase from './AceEditorBase.js';\n\nconst tagName = defineCE(AceEditorBase);\n\ndescribe('AceEditorBase value synchronization', () => {\n let element: AceEditorBase;\n\n beforeEach(async () => {\n element = await fixture<AceEditorBase>(`<${tagName}></${tagName}>`);\n element.value = '<root/>';\n await waitUntil(() => element.editor?.getValue() === '<root/>');\n });\n\n for (const firstValue of ['<root>first</root>', '']) {\n it(`preserves subsequent input after notifying ${firstValue || 'an empty buffer'}`, async () => {\n const editor = element.editor!;\n element.addEventListener(\n 'change',\n () => {\n editor.insert('later');\n },\n { once: true },\n );\n\n editor.setValue(firstValue, -1);\n const expected = 'later' + firstValue;\n await waitUntil(\n () => element.value === expected,\n 'The next input was overwritten by a stale value notification',\n );\n expect(editor.getValue()).to.equal(expected);\n });\n }\n\n it('still applies external property and attribute changes', async () => {\n element.value = '<property/>';\n await waitUntil(() => element.editor?.getValue() === '<property/>');\n element.setAttribute('value', '<attribute/>');\n await waitUntil(() => element.editor?.getValue() === '<attribute/>');\n element.removeAttribute('value');\n await waitUntil(() => element.editor?.getValue() === '');\n });\n});\n"]}
@@ -0,0 +1,9 @@
1
+ /**
2
+ * @license
3
+ * Copyright 2026 OMICRON electronics GmbH
4
+ * SPDX-License-Identifier: Apache-2.0
5
+ *
6
+ * Copied from OMICRONEnergyOSS/oscd-editor-publisher, demo/sample.scd.
7
+ * Demonstration data; not a claim of SCL schema conformance.
8
+ */
9
+ export declare const sampleScl = "<?xml version=\"1.0\" encoding=\"UTF-8\"?><SCL xmlns=\"http://www.iec.ch/61850/2003/SCL\" version=\"2007\" revision=\"B\" release=\"4\">\n\t<Header id=\"data-binding-demo\"/>\n\t<Substation name=\"S1\">\n\t\t<VoltageLevel name=\"V1\">\n\t\t\t<Bay name=\"PUB\"/>\n\t\t\t<Bay name=\"SUB\"/>\n\t\t</VoltageLevel>\n\t</Substation>\n\t<Communication>\n\t\t<SubNetwork name=\"StationBus\" type=\"8-MMS\">\n\t\t\t<BitRate unit=\"b/s\" multiplier=\"M\">100</BitRate>\n\t\t\t<ConnectedAP iedName=\"PUB_A\" apName=\"AP1\">\n\t\t\t\t<GSE ldInst=\"LD_A\" cbName=\"GCB_A\">\n\t\t\t\t\t<Address>\n\t\t\t\t\t\t<P type=\"MAC-Address\">01-0C-CD-01-00-01</P>\n\t\t\t\t\t\t<P type=\"APPID\">0001</P>\n\t\t\t\t\t</Address>\n\t\t\t\t\t<MinTime unit=\"s\" multiplier=\"m\">10</MinTime>\n\t\t\t\t\t<MaxTime unit=\"s\" multiplier=\"m\">1000</MaxTime>\n\t\t\t\t</GSE>\n\t\t\t</ConnectedAP>\n\t\t\t<ConnectedAP iedName=\"PUB_B\" apName=\"AP1\">\n\t\t\t\t<GSE ldInst=\"LD_B\" cbName=\"GCB_B\">\n\t\t\t\t\t<Address>\n\t\t\t\t\t\t<P type=\"MAC-Address\">01-0C-CD-01-00-02</P>\n\t\t\t\t\t\t<P type=\"APPID\">0002</P>\n\t\t\t\t\t</Address>\n\t\t\t\t\t<MinTime unit=\"s\" multiplier=\"m\">10</MinTime>\n\t\t\t\t\t<MaxTime unit=\"s\" multiplier=\"m\">1000</MaxTime>\n\t\t\t\t</GSE>\n\t\t\t</ConnectedAP>\n\t\t\t<ConnectedAP iedName=\"SMV_PUB\" apName=\"AP1\">\n\t\t\t\t<SMV ldInst=\"MU01\" cbName=\"MSVCB01\">\n\t\t\t\t\t<Address>\n\t\t\t\t\t\t<P type=\"MAC-Address\">01-0C-CD-04-00-01</P>\n\t\t\t\t\t\t<P type=\"APPID\">4000</P>\n\t\t\t\t\t\t<P type=\"VLAN-ID\">001</P>\n\t\t\t\t\t\t<P type=\"VLAN-PRIORITY\">4</P>\n\t\t\t\t\t</Address>\n\t\t\t\t</SMV>\n\t\t\t</ConnectedAP>\n\t\t\t<ConnectedAP iedName=\"SUB_A\" apName=\"AP1\"/>\n\t\t\t<ConnectedAP iedName=\"SUB_B\" apName=\"AP1\"/>\n\t\t</SubNetwork>\n\t</Communication>\n\t<IED name=\"PUB_A\" manufacturer=\"OpenSCD\">\n\t\t<Services>\n\t\t\t<ConfDataSet max=\"16\" maxAttributes=\"64\"/>\n\t\t\t<ConfReportControl max=\"16\" maxBuf=\"16\"/>\n\t\t\t<GOOSE max=\"16\"/>\n\t\t\t<SMVsc max=\"16\"/>\n\t\t</Services>\n\t\t<AccessPoint name=\"AP1\">\n\t\t\t<Server>\n\t\t\t\t<Authentication/>\n\t\t\t\t<LDevice inst=\"LD_A\">\n\t\t\t\t\t<LN0 lnClass=\"LLN0\" inst=\"\" lnType=\"LLN0_Test\">\n\t\t\t\t\t\t<DataSet name=\"DS_A\">\n\t\t\t\t\t\t\t<FCDA ldInst=\"LD_A\" prefix=\"\" lnClass=\"TCTR\" lnInst=\"1\" doName=\"Beh\" daName=\"stVal\" fc=\"ST\"/>\n\t\t\t\t\t\t\t<FCDA ldInst=\"LD_A\" prefix=\"\" lnClass=\"TCTR\" lnInst=\"1\" doName=\"Beh\" daName=\"q\" fc=\"ST\"/>\n\t\t\t\t\t\t</DataSet>\n\t\t\t\t\t\t<GSEControl name=\"GCB_A\" type=\"GOOSE\" appID=\"0001\" confRev=\"1\" datSet=\"DS_A\"/>\n\t\t\t\t\t\t<ReportControl name=\"RCB_A\" buffered=\"true\" datSet=\"DS_A\" confRev=\"1\" rptID=\"PUB_A/LD_A/RCB_A\" indexed=\"true\" bufTime=\"100\" intgPd=\"1000\">\n\t\t\t\t\t\t\t<TrgOps dchg=\"true\" qchg=\"true\" dupd=\"true\" period=\"true\" gi=\"true\"/>\n\t\t\t\t\t\t\t<OptFields seqNum=\"true\" timeStamp=\"true\" dataSet=\"true\" reasonCode=\"true\" dataRef=\"true\" entryID=\"true\" configRef=\"true\" bufOvfl=\"true\"/>\n\t\t\t\t\t\t\t<RptEnabled max=\"4\"/>\n\t\t\t\t\t\t</ReportControl>\n\t\t\t\t\t</LN0>\n\t\t\t\t\t<LN lnClass=\"TCTR\" inst=\"1\" lnType=\"TCTR_Test\">\n\t\t\t\t\t\t<DOI name=\"Beh\">\n\t\t\t\t\t\t\t<DAI name=\"stVal\">\n\t\t\t\t\t\t\t\t<Val>on</Val>\n\t\t\t\t\t\t\t</DAI>\n\t\t\t\t\t\t</DOI>\n\t\t\t\t\t\t<DOI name=\"HzRtg\"/>\n\t\t\t\t\t\t<DOI name=\"ARtg\"/>\n\t\t\t\t\t</LN>\n\t\t\t\t\t<LN lnClass=\"XCBR\" inst=\"1\" lnType=\"XCBR_Test\">\n\t\t\t\t\t\t<DOI name=\"Beh\">\n\t\t\t\t\t\t\t<DAI name=\"stVal\">\n\t\t\t\t\t\t\t\t<Val>on</Val>\n\t\t\t\t\t\t\t</DAI>\n\t\t\t\t\t\t</DOI>\n\t\t\t\t\t\t<DOI name=\"HzRtg\"/>\n\t\t\t\t\t\t<DOI name=\"ARtg\"/>\n\t\t\t\t\t</LN>\n\t\t\t\t</LDevice>\n\t\t\t</Server>\n\t\t</AccessPoint>\n\t</IED>\n\t<IED name=\"PUB_B\" manufacturer=\"OpenSCD\">\n\t\t<Services>\n\t\t\t<!-- deliberately left empty to test default values -->\n\t\t\t<!-- <ConfDataSet max=\"16\" maxAttributes=\"64\"/> -->\n\t\t\t<!-- <ConfReportControl max=\"16\" maxBuf=\"16\"/> -->\n\t\t\t<!-- <GOOSE max=\"16\"/> -->\n\t\t\t<!-- <SMVsc max=\"16\"/> -->\n\t\t</Services>\n\t\t<AccessPoint name=\"AP1\">\n\t\t\t<Server>\n\t\t\t\t<Authentication/>\n\t\t\t\t<LDevice inst=\"LD_B\">\n\t\t\t\t\t<LN0 lnClass=\"LLN0\" inst=\"\" lnType=\"LLN0_Test\">\n\t\t\t\t\t\t<DataSet name=\"DS_B\">\n\t\t\t\t\t\t\t<FCDA ldInst=\"LD_B\" prefix=\"\" lnClass=\"TCTR\" lnInst=\"1\" doName=\"Beh\" daName=\"stVal\" fc=\"ST\"/>\n\t\t\t\t\t\t\t<FCDA ldInst=\"LD_B\" prefix=\"\" lnClass=\"TCTR\" lnInst=\"1\" doName=\"Beh\" daName=\"q\" fc=\"ST\"/>\n\t\t\t\t\t\t</DataSet>\n\t\t\t\t\t\t<GSEControl name=\"GCB_B\" type=\"GOOSE\" appID=\"0002\" confRev=\"1\" datSet=\"DS_B\"/>\n\t\t\t\t\t</LN0>\n\t\t\t\t\t<LN lnClass=\"TCTR\" inst=\"1\" lnType=\"TCTR_Test\">\n\t\t\t\t\t\t<DOI name=\"Beh\">\n\t\t\t\t\t\t\t<DAI name=\"stVal\">\n\t\t\t\t\t\t\t\t<Val>blocked</Val>\n\t\t\t\t\t\t\t</DAI>\n\t\t\t\t\t\t</DOI>\n\t\t\t\t\t\t<DOI name=\"HzRtg\"/>\n\t\t\t\t\t\t<DOI name=\"ARtg\"/>\n\t\t\t\t\t</LN>\n\t\t\t\t</LDevice>\n\t\t\t</Server>\n\t\t</AccessPoint>\n\t</IED>\n\t<IED name=\"SMV_PUB\" manufacturer=\"OpenSCD\">\n\t\t<Services>\n\t\t\t<ConfDataSet max=\"16\" maxAttributes=\"64\"/>\n\t\t\t<ConfReportControl max=\"16\" maxBuf=\"16\"/>\n\t\t\t<GOOSE max=\"16\"/>\n\t\t\t<SMVsc max=\"16\"/>\n\t\t</Services>\n\t\t<AccessPoint name=\"AP1\">\n\t\t\t<Server>\n\t\t\t\t<Authentication/>\n\t\t\t\t<LDevice inst=\"MU01\">\n\t\t\t\t\t<LN0 lnClass=\"LLN0\" inst=\"\" lnType=\"LLN0_Test\">\n\t\t\t\t\t\t<DataSet name=\"PhsMeas1\">\n\t\t\t\t\t\t\t<FCDA ldInst=\"MU01\" prefix=\"\" lnClass=\"TCTR\" lnInst=\"1\" doName=\"AmpSv\" daName=\"instMag.i\" fc=\"MX\"/>\n\t\t\t\t\t\t\t<FCDA ldInst=\"MU01\" prefix=\"\" lnClass=\"TCTR\" lnInst=\"1\" doName=\"AmpSv\" daName=\"q\" fc=\"MX\"/>\n\t\t\t\t\t\t\t<FCDA ldInst=\"MU01\" prefix=\"\" lnClass=\"TVTR\" lnInst=\"1\" doName=\"VolSv\" daName=\"instMag.i\" fc=\"MX\"/>\n\t\t\t\t\t\t\t<FCDA ldInst=\"MU01\" prefix=\"\" lnClass=\"TVTR\" lnInst=\"1\" doName=\"VolSv\" daName=\"q\" fc=\"MX\"/>\n\t\t\t\t\t\t</DataSet>\n\t\t\t\t\t\t<SampledValueControl name=\"MSVCB01\" smvID=\"SMV_PUB/MU01/MSVCB01\" smpRate=\"80\" nofASDU=\"1\" confRev=\"1\" multicast=\"true\" datSet=\"PhsMeas1\">\n\t\t\t\t\t\t\t<SmvOpts sampleRate=\"true\" dataSet=\"true\"/>\n\t\t\t\t\t\t</SampledValueControl>\n\t\t\t\t\t</LN0>\n\t\t\t\t\t<LN lnClass=\"TCTR\" inst=\"1\" lnType=\"TCTR_SMV\">\n\t\t\t\t\t\t<DOI name=\"AmpSv\"/>\n\t\t\t\t\t</LN>\n\t\t\t\t\t<LN lnClass=\"TVTR\" inst=\"1\" lnType=\"TVTR_SMV\">\n\t\t\t\t\t\t<DOI name=\"VolSv\"/>\n\t\t\t\t\t</LN>\n\t\t\t\t</LDevice>\n\t\t\t</Server>\n\t\t</AccessPoint>\n\t</IED>\n\t<IED name=\"SUB_A\" manufacturer=\"OpenSCD\">\n\t\t<Services>\n\t\t\t<ConfDataSet max=\"16\" maxAttributes=\"64\"/>\n\t\t\t<ConfReportControl max=\"16\" maxBuf=\"16\"/>\n\t\t\t<GOOSE max=\"16\"/>\n\t\t\t<SMVsc max=\"16\"/>\n\t\t</Services>\n\t\t<AccessPoint name=\"AP1\">\n\t\t\t<Server>\n\t\t\t\t<Authentication/>\n\t\t\t\t<LDevice inst=\"LD_SUB_A\">\n\t\t\t\t\t<LN0 lnClass=\"LLN0\" inst=\"\" lnType=\"LLN0_Test\">\n\t\t\t\t\t\t<Inputs>\n\t\t\t\t\t\t\t<ExtRef iedName=\"PUB_A\" serviceType=\"GOOSE\" ldInst=\"LD_A\" prefix=\"\" lnClass=\"TCTR\" lnInst=\"1\" doName=\"Beh\" daName=\"stVal\" srcLDInst=\"LD_A\" srcLNClass=\"LLN0\" srcCBName=\"GCB_A\"/>\n\t\t\t\t\t\t\t<ExtRef iedName=\"PUB_A\" serviceType=\"GOOSE\" ldInst=\"LD_A\" prefix=\"\" lnClass=\"TCTR\" lnInst=\"1\" doName=\"Beh\" daName=\"q\" srcLDInst=\"LD_A\" srcLNClass=\"LLN0\" srcCBName=\"GCB_A\"/>\n\t\t\t\t\t\t</Inputs>\n\t\t\t\t\t</LN0>\n\t\t\t\t\t<LN lnClass=\"TCTR\" inst=\"1\" lnType=\"TCTR_Test\">\n\t\t\t\t\t\t<DOI name=\"Beh\"/>\n\t\t\t\t\t\t<DOI name=\"HzRtg\"/>\n\t\t\t\t\t\t<DOI name=\"ARtg\"/>\n\t\t\t\t\t\t<Inputs>\n\t\t\t\t\t\t\t<ExtRef iedName=\"PUB_B\" serviceType=\"GOOSE\" ldInst=\"LD_B\" prefix=\"\" lnClass=\"TCTR\" lnInst=\"1\" doName=\"Beh\" daName=\"stVal\" srcLDInst=\"LD_B\" srcLNClass=\"LLN0\" srcCBName=\"GCB_B\"/>\n\t\t\t\t\t\t\t<ExtRef iedName=\"SMV_PUB\" serviceType=\"SMV\" ldInst=\"MU01\" prefix=\"\" lnClass=\"TCTR\" lnInst=\"1\" doName=\"AmpSv\" daName=\"instMag.i\" srcLDInst=\"MU01\" srcLNClass=\"LLN0\" srcCBName=\"MSVCB01\"/>\n\t\t\t\t\t\t\t<ExtRef iedName=\"SMV_PUB\" serviceType=\"SMV\" ldInst=\"MU01\" prefix=\"\" lnClass=\"TCTR\" lnInst=\"1\" doName=\"AmpSv\" daName=\"q\" srcLDInst=\"MU01\" srcLNClass=\"LLN0\" srcCBName=\"MSVCB01\"/>\n\t\t\t\t\t\t</Inputs>\n\t\t\t\t\t</LN>\n\t\t\t\t</LDevice>\n\t\t\t</Server>\n\t\t</AccessPoint>\n\t</IED>\n\t<IED name=\"SUB_B\" manufacturer=\"OpenSCD\">\n\t\t<Services>\n\t\t\t<ConfDataSet max=\"16\" maxAttributes=\"64\"/>\n\t\t\t<ConfReportControl max=\"16\" maxBuf=\"16\"/>\n\t\t\t<GOOSE max=\"16\"/>\n\t\t\t<SMVsc max=\"16\"/>\n\t\t</Services>\n\t\t<AccessPoint name=\"AP1\">\n\t\t\t<Server>\n\t\t\t\t<Authentication/>\n\t\t\t\t<LDevice inst=\"LD_SUB_B\">\n\t\t\t\t\t<LN0 lnClass=\"LLN0\" inst=\"\" lnType=\"LLN0_Test\">\n\t\t\t\t\t\t<Inputs>\n\t\t\t\t\t\t\t<ExtRef iedName=\"PUB_B\" serviceType=\"GOOSE\" ldInst=\"LD_B\" prefix=\"\" lnClass=\"TCTR\" lnInst=\"1\" doName=\"Beh\" daName=\"q\" srcLDInst=\"LD_B\" srcLNClass=\"LLN0\" srcCBName=\"GCB_B\"/>\n\t\t\t\t\t\t</Inputs>\n\t\t\t\t\t</LN0>\n\t\t\t\t\t<LN lnClass=\"TCTR\" inst=\"1\" lnType=\"TCTR_Test\">\n\t\t\t\t\t\t<DOI name=\"Beh\"/>\n\t\t\t\t\t\t<DOI name=\"HzRtg\"/>\n\t\t\t\t\t\t<DOI name=\"ARtg\"/>\n\t\t\t\t\t\t<Inputs>\n\t\t\t\t\t\t\t<ExtRef iedName=\"PUB_A\" serviceType=\"GOOSE\" ldInst=\"LD_A\" prefix=\"\" lnClass=\"TCTR\" lnInst=\"1\" doName=\"Beh\" daName=\"stVal\" srcLDInst=\"LD_A\" srcLNClass=\"LLN0\" srcCBName=\"GCB_A\"/>\n\t\t\t\t\t\t\t<ExtRef iedName=\"SMV_PUB\" serviceType=\"SMV\" ldInst=\"MU01\" prefix=\"\" lnClass=\"TVTR\" lnInst=\"1\" doName=\"VolSv\" daName=\"instMag.i\" srcLDInst=\"MU01\" srcLNClass=\"LLN0\" srcCBName=\"MSVCB01\"/>\n\t\t\t\t\t\t\t<ExtRef iedName=\"SMV_PUB\" serviceType=\"SMV\" ldInst=\"MU01\" prefix=\"\" lnClass=\"TVTR\" lnInst=\"1\" doName=\"VolSv\" daName=\"q\" srcLDInst=\"MU01\" srcLNClass=\"LLN0\" srcCBName=\"MSVCB01\"/>\n\t\t\t\t\t\t</Inputs>\n\t\t\t\t\t</LN>\n\t\t\t\t</LDevice>\n\t\t\t</Server>\n\t\t</AccessPoint>\n\t</IED>\n\t<DataTypeTemplates>\n\t\t<LNodeType lnClass=\"LLN0\" id=\"LLN0_Test\">\n\t\t\t<DO name=\"Beh\" type=\"Beh_Test\"/>\n\t\t</LNodeType>\n\t\t<LNodeType lnClass=\"TCTR\" id=\"TCTR_Test\">\n\t\t\t<DO name=\"Beh\" type=\"Beh_Test\"/>\n\t\t\t<DO name=\"HzRtg\" type=\"HzRtg_Test\"/>\n\t\t\t<DO name=\"ARtg\" type=\"ARtg_Test\"/>\n\t\t</LNodeType>\n\t\t<LNodeType lnClass=\"XCBR\" id=\"XCBR_Test\">\n\t\t\t<DO name=\"Beh\" type=\"Beh_Test\"/>\n\t\t\t<DO name=\"HzRtg\" type=\"HzRtg_Test\"/>\n\t\t\t<DO name=\"ARtg\" type=\"ARtg_Test\"/>\n\t\t</LNodeType>\n\t\t<LNodeType lnClass=\"TCTR\" id=\"TCTR_SMV\">\n\t\t\t<DO name=\"Beh\" type=\"Beh_Test\"/>\n\t\t\t<DO name=\"ARtg\" type=\"ARtg_Test\"/>\n\t\t\t<DO name=\"HzRtg\" type=\"HzRtg_Test\"/>\n\t\t\t<DO name=\"AmpSv\" type=\"SAV_Test\"/>\n\t\t</LNodeType>\n\t\t<LNodeType lnClass=\"TVTR\" id=\"TVTR_SMV\">\n\t\t\t<DO name=\"Beh\" type=\"Beh_Test\"/>\n\t\t\t<DO name=\"VRtg\" type=\"ASG_Test\"/>\n\t\t\t<DO name=\"HzRtg\" type=\"HzRtg_Test\"/>\n\t\t\t<DO name=\"VolSv\" type=\"SAV_Test\"/>\n\t\t</LNodeType>\n\t\t<DOType cdc=\"SAV\" id=\"SAV_Test\">\n\t\t\t<DA name=\"instMag\" fc=\"MX\" bType=\"Struct\" type=\"AnalogueValue\"/>\n\t\t\t<DA name=\"q\" fc=\"MX\" bType=\"Quality\"/>\n\t\t</DOType>\n\t\t<DOType cdc=\"ENS\" id=\"Beh_Test\">\n\t\t\t<DA name=\"stVal\" fc=\"ST\" dchg=\"true\" dupd=\"true\" bType=\"Enum\" type=\"stVal_enums\"/>\n\t\t\t<DA name=\"q\" fc=\"ST\" qchg=\"true\" bType=\"Quality\"/>\n\t\t\t<DA name=\"t\" fc=\"ST\" bType=\"Timestamp\"/>\n\t\t</DOType>\n\t\t<DOType cdc=\"ASG\" id=\"ARtg_Test\">\n\t\t\t<DA name=\"setVal\" fc=\"SG\" bType=\"INT32\"/>\n\t\t\t<DA name=\"setMag\" fc=\"SE\" bType=\"INT32\"/>\n\t\t</DOType>\n\t\t<DOType cdc=\"ASG\" id=\"HzRtg_Test\">\n\t\t\t<DA name=\"setMag\" fc=\"SE\" bType=\"Struct\" type=\"AnalogueValueCtl\"/>\n\t\t\t<DA name=\"units\" fc=\"CF\" bType=\"Struct\" type=\"Unit\"/>\n\t\t</DOType>\n\t\t<DOType cdc=\"ASG\" id=\"ASG_Test\">\n\t\t\t<DA name=\"setVal\" fc=\"SG\" bType=\"INT32\"/>\n\t\t\t<DA name=\"setMag\" fc=\"SE\" bType=\"INT32\"/>\n\t\t</DOType>\n\t\t<DAType id=\"AnalogueValue\">\n\t\t\t<BDA name=\"i\" bType=\"INT32\"/>\n\t\t</DAType>\n\t\t<DAType id=\"AnalogueValueCtl\">\n\t\t\t<BDA name=\"i\" bType=\"INT32\"/>\n\t\t</DAType>\n\t\t<DAType id=\"Unit\">\n\t\t\t<BDA name=\"SIUnit\" bType=\"Enum\" type=\"SIUnitKind\"/>\n\t\t\t<BDA name=\"multiplier\" bType=\"Enum\" type=\"MultiplierKind\"/>\n\t\t</DAType>\n\t\t<EnumType id=\"stVal_enums\">\n\t\t\t<EnumVal ord=\"1\">on</EnumVal>\n\t\t\t<EnumVal ord=\"2\">blocked</EnumVal>\n\t\t\t<EnumVal ord=\"3\">test</EnumVal>\n\t\t\t<EnumVal ord=\"4\">test/blocked</EnumVal>\n\t\t\t<EnumVal ord=\"5\">off</EnumVal>\n\t\t</EnumType>\n\t\t<EnumType id=\"SIUnitKind\">\n\t\t\t<EnumVal ord=\"1\">Hz</EnumVal>\n\t\t</EnumType>\n\t\t<EnumType id=\"MultiplierKind\">\n\t\t\t<EnumVal ord=\"0\">none</EnumVal>\n\t\t</EnumType>\n\t</DataTypeTemplates>\n</SCL>\n";