@omicronenergy/oscd-ui 0.1.2 → 0.1.4

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 (87) hide show
  1. package/CHANGELOG.md +14 -0
  2. package/README.md +42 -0
  3. package/custom-elements.json +2418 -1316
  4. package/dist/ace-editor/OscdAceEditor.d.ts +46 -4
  5. package/dist/ace-editor/OscdAceEditor.js +250 -4
  6. package/dist/ace-editor/OscdAceEditor.js.map +1 -1
  7. package/dist/ace-editor/OscdAceEditor.spec.js +208 -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 +87 -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.stories.d.ts +1 -1
  37. package/dist/divider/OscdDivider.stories.d.ts +1 -1
  38. package/dist/elevation/OscdElevation.stories.d.ts +1 -1
  39. package/dist/fab/OscdBrandedFab.stories.d.ts +1 -1
  40. package/dist/fab/OscdFab.stories.d.ts +1 -1
  41. package/dist/field/OscdFilledField.stories.d.ts +1 -1
  42. package/dist/field/OscdOutlinedField.stories.d.ts +1 -1
  43. package/dist/focus/OscdFocusRing.stories.d.ts +1 -1
  44. package/dist/icon/OscdIcon.stories.d.ts +1 -1
  45. package/dist/iconbutton/OscdFilledIconButton.stories.d.ts +1 -1
  46. package/dist/iconbutton/OscdFilledTonalIconButton.stories.d.ts +1 -1
  47. package/dist/iconbutton/OscdIconButton.stories.d.ts +1 -1
  48. package/dist/iconbutton/OscdOutlinedIconButton.stories.d.ts +1 -1
  49. package/dist/labs/badge/OscdBadge.stories.d.ts +1 -1
  50. package/dist/labs/card/OscdElevatedCard.stories.d.ts +1 -1
  51. package/dist/labs/card/OscdFilledCard.stories.d.ts +1 -1
  52. package/dist/labs/card/OscdOutlinedCard.stories.d.ts +1 -1
  53. package/dist/labs/item/OscdItem.stories.d.ts +1 -1
  54. package/dist/labs/navigationbar/OscdNavigationBar.stories.d.ts +1 -1
  55. package/dist/labs/navigationtab/OscdNavigationTab.stories.d.ts +1 -1
  56. package/dist/list/OscdList.stories.d.ts +1 -1
  57. package/dist/list/OscdListItem.stories.d.ts +1 -1
  58. package/dist/menu/OscdMenuItem.stories.d.ts +1 -1
  59. package/dist/progress/OscdLinearProgress.stories.d.ts +1 -1
  60. package/dist/ripple/OscdRipple.stories.d.ts +1 -1
  61. package/dist/scl-editor/OscdSclEditor.d.ts +22 -0
  62. package/dist/scl-editor/OscdSclEditor.js +62 -0
  63. package/dist/scl-editor/OscdSclEditor.js.map +1 -0
  64. package/dist/scl-editor/OscdSclEditor.spec.d.ts +1 -0
  65. package/dist/scl-editor/OscdSclEditor.spec.js +81 -0
  66. package/dist/scl-editor/OscdSclEditor.spec.js.map +1 -0
  67. package/dist/scl-editor/OscdSclEditor.stories.d.ts +13 -0
  68. package/dist/scl-editor/OscdSclEditor.stories.js +87 -0
  69. package/dist/scl-editor/OscdSclEditor.stories.js.map +1 -0
  70. package/dist/scl-editor/internal/namespace-utils.d.ts +13 -0
  71. package/dist/scl-editor/internal/namespace-utils.js +84 -0
  72. package/dist/scl-editor/internal/namespace-utils.js.map +1 -0
  73. package/dist/scl-editor/internal/namespace-utils.spec.d.ts +1 -0
  74. package/dist/scl-editor/internal/namespace-utils.spec.js +67 -0
  75. package/dist/scl-editor/internal/namespace-utils.spec.js.map +1 -0
  76. package/dist/scl-editor/oscd-scl-editor.d.ts +2 -0
  77. package/dist/scl-editor/oscd-scl-editor.js +4 -0
  78. package/dist/scl-editor/oscd-scl-editor.js.map +1 -0
  79. package/dist/scl-textfield/oscd-scl-text-field.stories.d.ts +1 -1
  80. package/dist/search-field/oscd-outlined-search-field.stories.d.ts +1 -1
  81. package/dist/selection-list/oscd-selection-list.stories.d.ts +1 -1
  82. package/dist/slider/OscdSlider.stories.d.ts +1 -1
  83. package/dist/switch/OscdSwitch.stories.d.ts +1 -1
  84. package/dist/tabs/OscdTabs.stories.d.ts +1 -1
  85. package/dist/textfield/OscdFilledTextField.stories.d.ts +1 -1
  86. package/dist/textfield/OscdOutlinedTextField.stories.d.ts +1 -1
  87. package/package.json +3 -3
@@ -1 +1 @@
1
- {"version":3,"file":"OscdAceEditor.spec.js","sourceRoot":"","sources":["../../ace-editor/OscdAceEditor.spec.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,MAAM,kBAAkB,CAAC;AAGjD,MAAM,CAAC,MAAM,eAAe,GAAG;;OAExB,CAAC;AAER,QAAQ,CAAC,iBAAiB,EAAE,GAAG,EAAE;IAC/B,IAAI,aAA4B,CAAC;IAEjC,UAAU,CAAC,KAAK,IAAI,EAAE;QACpB,aAAa,GAAG,MAAM,OAAO,CAAC,IAAI,CAAA,qCAAqC,CAAC,CAAC;QACzE,aAAa,CAAC,KAAK,GAAG,eAAe,CAAC;IACxC,CAAC,CAAC,CAAC;IAEH,SAAS,CAAC,GAAG,EAAE;QACb,QAAQ,CAAC,cAAc,CAAC,kBAAkB,CAAC,EAAE,MAAM,EAAE,CAAC;QACtD,aAAa,CAAC,MAAM,EAAE,CAAC;IACzB,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC","sourcesContent":["import { fixture, html } from '@open-wc/testing';\nimport { OscdAceEditor } from './oscd-ace-editor.js';\n\nexport const sclXmlDocString = `<?xml version=\"1.0\" encoding=\"UTF-8\"?><SCL version=\"2007\" revision=\"B\" xmlns=\"http://www.iec.ch/61850/2003/SCL\" xmlns:ens1=\"http://example.org/somePreexistingExtensionNamespace\">\n <Substation ens1:foo=\"a\" name=\"A1\" desc=\"test substation\"></Substation>\n</SCL>`;\n\ndescribe('oscd-ace-editor', () => {\n let oscdAceEditor: OscdAceEditor;\n\n beforeEach(async () => {\n oscdAceEditor = await fixture(html`<oscd-ace-editor></oscd-ace-editor>`);\n oscdAceEditor.value = sclXmlDocString;\n });\n\n afterEach(() => {\n document.getElementById('ace_settingsmenu')?.remove();\n oscdAceEditor.remove();\n });\n});\n"]}
1
+ {"version":3,"file":"OscdAceEditor.spec.js","sourceRoot":"","sources":["../../ace-editor/OscdAceEditor.spec.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EACR,MAAM,EACN,OAAO,EACP,SAAS,EACT,SAAS,GACV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KAAK,CAAC,IAAI,CAAC,CAAC;QAE1E,aAAa,CAAC,OAAO,GAAG,KAAK,CAAC;QAC9B,MAAM,aAAa,CAAC,cAAc,CAAC;QACnC,MAAM,CACJ,aAAa,CAAC,UAAW,CAAC,aAAa,CAAC,UAAU,CAAC,KAAK,IAAI,CAC7D,CAAC,EAAE,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;IACnB,CAAC,CAAC,CAAC;IAEH,EAAE,CAAC,2DAA2D,EAAE,KAAK,IAAI,EAAE;QACzE,MAAM,MAAM,GAAG,QAAQ,CAAC,aAAa,CAAC,QAAQ,CAAC,CAAC;QAChD,MAAM,CAAC,IAAI,GAAG,iBAAiB,CAAC;QAChC,aAAa,CAAC,WAAW,CAAC,MAAM,CAAC,CAAC;QAClC,aAAa,CAAC,OAAO,GAAG,IAAI,CAAC;QAC7B,MAAM,aAAa,CAAC,cAAc,CAAC;QACnC,IAAI,MAAM,GAAG,CAAC,CAAC;QACf,aAAa,CAAC,gBAAgB,CAAC,OAAO,EAAE,GAAG,EAAE;YAC3C,MAAM,IAAI,CAAC,CAAC;QACd,CAAC,CAAC,CAAC;QAEH,MAAM,CAAC,aAAa,CAClB,IAAI,WAAW,CAAC,QAAQ,EAAE;YACxB,MAAM,EAAE,eAAe;YACvB,OAAO,EAAE,IAAI;YACb,QAAQ,EAAE,IAAI;SACf,CAAC,CACH,CAAC;QACF,MAAM,CAAC,MAAM,CAAC,CAAC,EAAE,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC;IAC7B,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC","sourcesContent":["import {\n defineCE,\n expect,\n fixture,\n nextFrame,\n waitUntil,\n} from '@open-wc/testing';\n\nimport { OscdAceEditor } from './OscdAceEditor.js';\n\nconst tagName = defineCE(OscdAceEditor);\n\nexport const sclXmlDocString = `<?xml version=\"1.0\" encoding=\"UTF-8\"?><SCL version=\"2007\" revision=\"B\" xmlns=\"http://www.iec.ch/61850/2003/SCL\" xmlns:ens1=\"http://example.org/somePreexistingExtensionNamespace\">\n <Substation ens1:foo=\"a\" name=\"A1\" desc=\"test substation\"></Substation>\n</SCL>`;\n\ndescribe('oscd-ace-editor', () => {\n let oscdAceEditor: OscdAceEditor;\n\n beforeEach(async () => {\n oscdAceEditor = await fixture<OscdAceEditor>(`<${tagName}></${tagName}>`);\n oscdAceEditor.value = sclXmlDocString;\n await waitUntil(() => oscdAceEditor.editor?.getValue() === sclXmlDocString);\n });\n\n afterEach(() => {\n document.getElementById('ace_settingsmenu')?.remove();\n oscdAceEditor.remove();\n });\n\n it('starts programmatic replacements at the beginning without selecting text', async () => {\n const editor = oscdAceEditor.editor!;\n expect(editor.selection.isEmpty()).to.equal(true);\n expect(editor.getCursorPosition()).to.deep.equal({ row: 0, column: 0 });\n\n editor.moveCursorTo(1, 2);\n oscdAceEditor.value = '<replacement/>';\n await waitUntil(() => editor.getValue() === '<replacement/>');\n expect(editor.selection.isEmpty()).to.equal(true);\n expect(editor.getCursorPosition()).to.deep.equal({ row: 0, column: 0 });\n });\n\n it('keeps the cursor when input is echoed through the value property', async () => {\n const editor = oscdAceEditor.editor!;\n editor.moveCursorTo(1, 2);\n editor.insert('input');\n const position = editor.getCursorPosition();\n oscdAceEditor.value = editor.getValue();\n await oscdAceEditor.updateComplete;\n await nextFrame();\n await nextFrame();\n expect(editor.getCursorPosition()).to.deep.equal(position);\n });\n\n it('keeps the latest value assigned before readiness, then applies external writes synchronously', async () => {\n const element = document.createElement(tagName);\n if (!(element instanceof OscdAceEditor)) {\n throw new Error('Editor did not upgrade');\n }\n element.value = 'first';\n element.value = 'latest';\n document.body.appendChild(element);\n try {\n await waitUntil(() => element.editor?.getValue() === 'latest');\n element.value = 'replacement';\n expect(element.editor!.getValue()).to.equal('replacement');\n } finally {\n element.remove();\n }\n });\n\n it('supports real form values, validator changes and persistent custom validity', async () => {\n const form = await fixture<HTMLFormElement>(\n `<form><${tagName} name=\"xml\"></${tagName}></form>`,\n );\n const element = form.firstElementChild;\n if (!(element instanceof OscdAceEditor)) {\n throw new Error('Editor did not upgrade');\n }\n element.value = 'submitted';\n expect(new FormData(form).get('xml')).to.equal('submitted');\n element.validator = value => (value === 'submitted' ? null : 'Wrong text');\n expect(form.checkValidity()).to.equal(true);\n element.value = 'invalid';\n expect(element.checkValidity()).to.equal(false);\n expect(form.checkValidity()).to.equal(false);\n element.validator = null;\n element.setCustomValidity('Custom failure');\n expect(element.checkValidity()).to.equal(false);\n element.value = 'another value';\n expect(element.checkValidity()).to.equal(false);\n element.setCustomValidity('');\n expect(element.checkValidity()).to.equal(true);\n form.reset();\n expect(element.value).to.equal('');\n expect(new FormData(form).get('xml')).to.equal('');\n });\n\n it('emits compatible text changes and input for edits, not programmatic writes', async () => {\n let changes = 0;\n let inputs = 0;\n let text = '';\n oscdAceEditor.addEventListener('change', event => {\n changes += 1;\n if (event instanceof CustomEvent) {\n text = event.detail;\n }\n });\n oscdAceEditor.addEventListener('input', () => {\n inputs += 1;\n });\n oscdAceEditor.value = '<programmatic/>';\n await nextFrame();\n expect(changes).to.equal(0);\n oscdAceEditor.editor!.insert('typed');\n await waitUntil(() => changes === 1);\n expect(inputs).to.equal(1);\n expect(text).to.equal(oscdAceEditor.value);\n });\n\n it('retains the value attribute API without scheduling text resets', () => {\n oscdAceEditor.setAttribute('value', 'attribute text');\n expect(oscdAceEditor.editor!.getValue()).to.equal('attribute text');\n oscdAceEditor.removeAttribute('value');\n expect(oscdAceEditor.value).to.equal('');\n });\n\n it('shows a working toolbar that formats input and notifies the consumer', async () => {\n oscdAceEditor.toolbar = true;\n await oscdAceEditor.updateComplete;\n oscdAceEditor.value = '<example><item/></example>';\n let changes = 0;\n oscdAceEditor.addEventListener('change', () => {\n changes += 1;\n });\n const actions = oscdAceEditor.shadowRoot!.querySelectorAll<HTMLElement>(\n '.toolbar oscd-outlined-icon-button',\n );\n expect(actions.length).to.equal(7);\n await waitUntil(\n () =>\n actions[5].shadowRoot\n ?.querySelector('button')\n ?.getAttribute('aria-label') === 'Format XML',\n );\n actions[5].click();\n expect(oscdAceEditor.value.includes('\\n\\t<item/>')).to.equal(true);\n expect(changes).to.equal(1);\n });\n\n it('avoids overflow at wide widths before and after toggling the toolbar', async () => {\n oscdAceEditor.style.width = '900px';\n oscdAceEditor.toolbar = true;\n await oscdAceEditor.updateComplete;\n await nextFrame();\n\n for (let cycle = 0; cycle < 2; cycle += 1) {\n const controls =\n oscdAceEditor.shadowRoot!.querySelector<HTMLElement>(\n '.toolbar-controls',\n )!;\n expect(controls.scrollWidth).to.equal(controls.clientWidth);\n expect(controls.scrollHeight).to.equal(controls.clientHeight);\n const buttons = controls.querySelectorAll<HTMLElement>(\n 'oscd-outlined-icon-button',\n );\n const toolbar = controls.parentElement!.getBoundingClientRect();\n const button = buttons[0].getBoundingClientRect();\n expect(button.top - toolbar.top).to.equal(toolbar.bottom - button.bottom);\n expect(\n buttons[1].getBoundingClientRect().left -\n buttons[0].getBoundingClientRect().left >=\n 48,\n ).to.equal(true);\n\n oscdAceEditor.toolbar = false;\n await oscdAceEditor.updateComplete;\n oscdAceEditor.toolbar = true;\n await oscdAceEditor.updateComplete;\n await nextFrame();\n }\n });\n\n it('applies toolbar tokens and inherited Material button colors', async () => {\n oscdAceEditor.style.setProperty(\n '--oscd-ace-editor-toolbar-padding',\n '12px 16px',\n );\n oscdAceEditor.style.setProperty(\n '--oscd-ace-editor-toolbar-background-color',\n 'rgb(12, 34, 56)',\n );\n oscdAceEditor.style.setProperty(\n '--md-outlined-icon-button-icon-color',\n 'rgb(78, 90, 123)',\n );\n oscdAceEditor.toolbar = true;\n await oscdAceEditor.updateComplete;\n await waitUntil(() =>\n Boolean(\n oscdAceEditor.shadowRoot\n ?.querySelector('oscd-outlined-icon-button')\n ?.shadowRoot?.querySelector('button'),\n ),\n );\n const toolbar =\n oscdAceEditor.shadowRoot!.querySelector<HTMLElement>('.toolbar')!;\n const button = toolbar\n .querySelector('oscd-outlined-icon-button')!\n .shadowRoot!.querySelector('button')!;\n expect(getComputedStyle(toolbar).padding).to.equal('12px 16px');\n expect(getComputedStyle(toolbar).backgroundColor).to.equal(\n 'rgb(12, 34, 56)',\n );\n expect(getComputedStyle(button).color).to.equal('rgb(78, 90, 123)');\n });\n\n it('places additional actions above the editor and keeps them visible on narrow widths', async () => {\n oscdAceEditor.style.width = '320px';\n oscdAceEditor.style.height = '400px';\n const action = document.createElement('button');\n action.slot = 'toolbar-actions';\n action.textContent = 'Apply';\n oscdAceEditor.appendChild(action);\n oscdAceEditor.toolbar = true;\n await oscdAceEditor.updateComplete;\n await nextFrame();\n\n const toolbar =\n oscdAceEditor.shadowRoot!.querySelector<HTMLElement>('.toolbar')!;\n const editor =\n oscdAceEditor.shadowRoot!.querySelector<HTMLElement>('ace-editor-base')!;\n const slot = toolbar.querySelector<HTMLSlotElement>('slot')!;\n const controls = toolbar.querySelector<HTMLElement>('.toolbar-controls')!;\n const bounds = oscdAceEditor.getBoundingClientRect();\n expect(slot.assignedElements().includes(action)).to.equal(true);\n expect(\n toolbar.getBoundingClientRect().bottom <=\n editor.getBoundingClientRect().top,\n ).to.equal(true);\n expect(editor.getBoundingClientRect().bottom <= bounds.bottom + 1).to.equal(\n true,\n );\n expect(action.getBoundingClientRect().right <= bounds.right + 1).to.equal(\n true,\n );\n expect(editor.getBoundingClientRect().height > 0).to.equal(true);\n expect(controls.scrollWidth > controls.clientWidth).to.equal(true);\n expect(controls.scrollHeight).to.equal(controls.clientHeight);\n const lastAction = controls.querySelector<HTMLElement>(\n 'oscd-outlined-icon-button:last-child',\n )!;\n await waitUntil(() =>\n Boolean(lastAction.shadowRoot?.querySelector('button')),\n );\n lastAction.shadowRoot!.querySelector('button')!.focus();\n await waitUntil(() => controls.scrollLeft > 0);\n const focusRing =\n lastAction.shadowRoot!.querySelector<HTMLElement>('md-focus-ring')!;\n await waitUntil(() => focusRing.hasAttribute('visible'));\n const controlBounds = controls.getBoundingClientRect();\n const lastBounds = lastAction.getBoundingClientRect();\n const focusBounds = focusRing.getBoundingClientRect();\n expect(lastBounds.right <= controlBounds.right).to.equal(true);\n expect(focusBounds.right + 8 <= controlBounds.right + 1).to.equal(true);\n expect(focusBounds.top - 8 >= controlBounds.top - 1).to.equal(true);\n expect(focusBounds.bottom + 8 <= controlBounds.bottom + 1).to.equal(true);\n\n oscdAceEditor.toolbar = false;\n await oscdAceEditor.updateComplete;\n expect(\n oscdAceEditor.shadowRoot!.querySelector('.toolbar') === null,\n ).to.equal(true);\n });\n\n it('does not treat a slotted action change as an editor input', async () => {\n const action = document.createElement('button');\n action.slot = 'toolbar-actions';\n oscdAceEditor.appendChild(action);\n oscdAceEditor.toolbar = true;\n await oscdAceEditor.updateComplete;\n let inputs = 0;\n oscdAceEditor.addEventListener('input', () => {\n inputs += 1;\n });\n\n action.dispatchEvent(\n new CustomEvent('change', {\n detail: 'action change',\n bubbles: true,\n composed: true,\n }),\n );\n expect(inputs).to.equal(0);\n });\n});\n"]}
@@ -1,30 +1,12 @@
1
- import type { StoryObj } from '@storybook/web-components-vite';
1
+ import type { Meta, StoryObj } from '@storybook/web-components-vite';
2
2
  import './oscd-ace-editor.js';
3
- declare const _default: {
4
- title: string;
5
- tags: string[];
6
- parameters: {
7
- layout: string;
8
- };
9
- id?: import("storybook/internal/csf").ComponentId;
10
- includeStories?: RegExp | string[];
11
- excludeStories?: RegExp | string[];
12
- component?: string | undefined;
13
- subcomponents?: Record<string, string> | undefined;
14
- play?: import("storybook/internal/csf").PlayFunction<import("@storybook/web-components").WebComponentsRenderer, import("@storybook/web-components-vite").Args> | undefined;
15
- globals?: Partial<import("storybook/internal/csf").Globals> | undefined;
16
- decorators?: import("storybook/internal/csf").DecoratorFunction<import("@storybook/web-components").WebComponentsRenderer, {
17
- [x: string]: any;
18
- }> | import("storybook/internal/csf").DecoratorFunction<import("@storybook/web-components").WebComponentsRenderer, {
19
- [x: string]: any;
20
- }>[] | undefined;
21
- args?: Partial<import("@storybook/web-components-vite").Args> | undefined;
22
- argTypes?: Partial<import("@storybook/web-components-vite").ArgTypes<import("@storybook/web-components-vite").Args>> | undefined;
23
- loaders?: import("storybook/internal/csf").LoaderFunction<import("@storybook/web-components").WebComponentsRenderer, import("@storybook/web-components-vite").Args> | import("storybook/internal/csf").LoaderFunction<import("@storybook/web-components").WebComponentsRenderer, import("@storybook/web-components-vite").Args>[] | undefined;
24
- beforeEach?: import("storybook/internal/csf").BeforeEach<import("@storybook/web-components").WebComponentsRenderer, import("@storybook/web-components-vite").Args> | import("storybook/internal/csf").BeforeEach<import("@storybook/web-components").WebComponentsRenderer, import("@storybook/web-components-vite").Args>[] | undefined;
25
- afterEach?: import("storybook/internal/csf").AfterEach<import("@storybook/web-components").WebComponentsRenderer, import("@storybook/web-components-vite").Args> | import("storybook/internal/csf").AfterEach<import("@storybook/web-components").WebComponentsRenderer, import("@storybook/web-components-vite").Args>[] | undefined;
26
- render?: import("storybook/internal/csf").ArgsStoryFn<import("@storybook/web-components").WebComponentsRenderer, import("@storybook/web-components-vite").Args> | undefined;
27
- mount?: ((context: import("storybook/internal/csf").StoryContext<import("@storybook/web-components").WebComponentsRenderer, import("@storybook/web-components-vite").Args>) => () => Promise<import("storybook/internal/csf").Canvas>) | undefined;
3
+ type EditorArgs = {
4
+ value: string;
5
+ toolbar: boolean;
28
6
  };
29
- export default _default;
30
- export declare const Default: StoryObj;
7
+ declare const meta: Meta<EditorArgs>;
8
+ export default meta;
9
+ type Story = StoryObj<EditorArgs>;
10
+ export declare const FullSclDocument: Story;
11
+ export declare const WithToolbar: Story;
12
+ export declare const WithValidator: Story;
@@ -1,31 +1,98 @@
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
+ },
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
+ },
13
44
  },
14
45
  };
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%;',
46
+ export const WithToolbar = {
47
+ args: { toolbar: true },
48
+ render: args => html `
49
+ <oscd-ace-editor
50
+ .value=${args.value}
51
+ .toolbar=${args.toolbar}
52
+ style="height: 100vh; width: 100%;"
53
+ >
54
+ <button slot="toolbar-actions" type="button">Example action</button>
55
+ </oscd-ace-editor>
56
+ `,
57
+ };
58
+ const validateExample = (text) => {
59
+ const document = new DOMParser().parseFromString(text, 'application/xml');
60
+ return document.querySelector('parsererror') === null
61
+ ? null
62
+ : 'Enter one well-formed XML document';
63
+ };
64
+ export const WithValidator = {
65
+ name: 'Custom validation callback',
66
+ parameters: {
67
+ docs: {
68
+ description: {
69
+ 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.',
70
+ },
71
+ },
29
72
  },
73
+ args: { value: '<example>', toolbar: true },
74
+ render: args => html `
75
+ <form style="display: flex; flex-direction: column; height: 100vh;">
76
+ <oscd-ace-editor
77
+ name="xml"
78
+ .validator=${validateExample}
79
+ .value=${args.value}
80
+ .toolbar=${args.toolbar}
81
+ style="flex: 1; min-height: 0; height: auto; width: 100%;"
82
+ ></oscd-ace-editor>
83
+ <button
84
+ type="button"
85
+ style="flex-shrink: 0;"
86
+ @click=${(event) => {
87
+ const target = event.currentTarget;
88
+ if (target instanceof HTMLButtonElement) {
89
+ target.form?.reportValidity();
90
+ }
91
+ }}
92
+ >
93
+ Check XML
94
+ </button>
95
+ </form>
96
+ `,
30
97
  };
31
98
  //# 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,E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EF,MAAM,CAAC,MAAM,aAAa,GAAU;IAClC,IAAI,EAAE,4BAA4B;IAClC,UAAU,EAAE;QACV,IAAI,EAAE;YACJ,WAAW,EAAE;gBACX,KAAK,EACH,gTAAgT;aACnT;SACF;KACF;IACD,IAAI,EAAE,EAAE,KAAK,EAAE,WAAW,EAAE,OAAO,EAAE,IAAI,EAAE;IAC3C,MAAM,EAAE,IAAI,CAAC,EAAE,CAAC,IAAI,CAAA;;;;qBAID,eAAe;iBACnB,IAAI,CAAC,KAAK;mBACR,IAAI,CAAC,OAAO;;;;;;iBAMd,CAAC,KAAY,EAAE,EAAE;QACxB,MAAM,MAAM,GAAG,KAAK,CAAC,aAAa,CAAC;QACnC,IAAI,MAAM,YAAY,iBAAiB,EAAE,CAAC;YACxC,MAAM,CAAC,IAAI,EAAE,cAAc,EAAE,CAAC;QAChC,CAAC;IACH,CAAC;;;;;GAKN;CACF,CAAC","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 = {\n args: { toolbar: true },\n render: args => html`\n <oscd-ace-editor\n .value=${args.value}\n .toolbar=${args.toolbar}\n style=\"height: 100vh; width: 100%;\"\n >\n <button slot=\"toolbar-actions\" type=\"button\">Example action</button>\n </oscd-ace-editor>\n `,\n};\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,IAAI,EAAE,GAAG,EAAyB,MAAM,KAAK,CAAC;AACnE,OAAO,KAAK,SAAS,MAAM,YAAY,CAAC;AACxC,OAAO,EAAE,QAAQ,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAC;AAEpD,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;YAC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B,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,CAA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B,EAAE,CAAC;YAC/B,MAAM,YAAY,GAAG,MAAM,CAAC,GAAG,EAAE,OAAO,EAAE,CAAC,uBAAuB,CAC/B,CAAC;YACpC,YAAY,EAAE,IAAI,EAAE,CAAC;YACrB,yBAAyB,GAAG,IAAI,CAAC;QACnC,CAAC;IACH,CAAC;IAEQ,oBAAoB;QAC3B,KAAK,CAAC,oBAAoB,EAAE,CAAC;QAC7B,MAAM,CAAC,GAAG,EAAE,MAAM,EAAE,mBAAmB,EAAE,CAAC,QAAQ,EAAE,qBAAqB,CAAC,CAAC;IAC7E,CAAC;IAEO,WAAW;QACjB,MAAM,MAAM,GAAG,IAAI,CAAC,MAAM,CAAC;QAC3B,IAAI,MAAM,KAAK,SAAS,IAAI,IAAI,CAAC,YAAY,KAAK,SAAS,EAAE,CAAC;YAC5D,IAAI,MAAM,CAAC,QAAQ,EAAE,KAAK,IAAI,CAAC,YAAY,EAAE,CAAC;gBAC5C,IAAI,CAAC,aAAa,CAAC,KAAK,GAAG,IAAI,CAAC,YAAY,CAAC;YAC/C,CAAC;YACD,IAAI,CAAC,YAAY,GAAG,SAAS,CAAC;QAChC,CAAC;IACH,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,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,MAAM,CAAC,GAAG,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;YAErD,IAAI,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;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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ADC,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.spec.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"AceEditorBase.spec.js","sourceRoot":"","sources":["../../../../ace-editor/internal/ace-editor-base/AceEditorBase.spec.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,EAAE,OAAO,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAC;AAExE,OAAO,kBAAkB,CAAC;AAC1B,OAAO,aAAa,MAAM,oBAAoB,CAAC;AAE/C,MAAM,OAAO,GAAG,QAAQ,CAAC,aAAa,CAAC,CAAC;AAExC,QAAQ,CAAC,qCAAqC,EAAE,GAAG,EAAE;IACnD,IAAI,OAAsB,CAAC;IAE3B,UAAU,CAAC,KAAK,IAAI,EAAE;QACpB,OAAO,GAAG,MAAM,OAAO,CAAgB,IAAI,OAAO,MAAM,OAAO,GAAG,CAA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AAK,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";