@compas-oscd/open-scd 0.34.1 → 0.34.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.
- package/dist/WizardDivider.d.ts +8 -0
- package/dist/Wizarding.d.ts +10 -0
- package/dist/Wizarding.js.map +1 -1
- package/dist/action-icon.d.ts +25 -0
- package/dist/action-pane.d.ts +25 -0
- package/dist/addons/Editor.d.ts +25 -0
- package/dist/addons/History.d.ts +86 -0
- package/dist/addons/Layout.d.ts +96 -0
- package/dist/addons/Settings.d.ts +68 -0
- package/dist/addons/Waiter.d.ts +14 -0
- package/dist/addons/Wizards.d.ts +15 -0
- package/dist/addons/editor/edit-action-to-v1-converter.d.ts +3 -0
- package/dist/addons/editor/edit-v1-to-v2-converter.d.ts +2 -0
- package/dist/addons/history/get-log-text.d.ts +5 -0
- package/dist/addons/menu-tabs/menu-tabs.d.ts +22 -0
- package/dist/addons/plugin-manager/custom-plugin-dialog.d.ts +28 -0
- package/dist/addons/plugin-manager/plugin-manager.d.ts +20 -0
- package/dist/filtered-list.d.ts +27 -0
- package/dist/finder-list.d.ts +37 -0
- package/dist/foundation/compare.d.ts +79 -0
- package/dist/foundation/dai.d.ts +30 -0
- package/dist/foundation/generators.d.ts +13 -0
- package/dist/foundation/ied.d.ts +22 -0
- package/dist/foundation/nsd.d.ts +4 -0
- package/dist/foundation/nsdoc.d.ts +14 -0
- package/dist/foundation/scl.d.ts +1 -0
- package/dist/foundation.d.ts +230 -0
- package/dist/icons/compare.d.ts +3 -0
- package/dist/icons/icons.d.ts +41 -0
- package/dist/icons/ied-icons.d.ts +3 -0
- package/dist/icons/lnode.d.ts +16 -0
- package/dist/open-scd.d.ts +131 -0
- package/dist/oscd-filter-button.d.ts +27 -0
- package/dist/plain-compare-list.d.ts +36 -0
- package/dist/plugin-tag.d.ts +6 -0
- package/dist/plugin.d.ts +23 -0
- package/dist/plugin.events.d.ts +15 -0
- package/dist/plugins.d.ts +3 -0
- package/dist/schemas.d.ts +58 -0
- package/dist/src/WizardDivider.d.ts +8 -0
- package/dist/src/WizardDivider.js.map +1 -0
- package/dist/src/Wizarding.d.ts +10 -0
- package/dist/src/Wizarding.js.map +1 -0
- package/dist/src/action-icon.d.ts +25 -0
- package/dist/src/action-icon.js.map +1 -0
- package/dist/src/action-pane.d.ts +25 -0
- package/dist/src/action-pane.js.map +1 -0
- package/dist/src/addons/Editor.d.ts +25 -0
- package/dist/src/addons/Editor.js.map +1 -0
- package/dist/src/addons/History.d.ts +86 -0
- package/dist/src/addons/History.js.map +1 -0
- package/dist/src/addons/Layout.d.ts +96 -0
- package/dist/src/addons/Layout.js.map +1 -0
- package/dist/src/addons/Settings.d.ts +68 -0
- package/dist/src/addons/Settings.js.map +1 -0
- package/dist/src/addons/Waiter.d.ts +14 -0
- package/dist/src/addons/Waiter.js.map +1 -0
- package/dist/src/addons/Wizards.d.ts +15 -0
- package/dist/src/addons/Wizards.js.map +1 -0
- package/dist/src/addons/editor/edit-action-to-v1-converter.d.ts +3 -0
- package/dist/src/addons/editor/edit-action-to-v1-converter.js.map +1 -0
- package/dist/src/addons/editor/edit-v1-to-v2-converter.d.ts +2 -0
- package/dist/src/addons/editor/edit-v1-to-v2-converter.js.map +1 -0
- package/dist/src/addons/history/get-log-text.d.ts +5 -0
- package/dist/src/addons/history/get-log-text.js.map +1 -0
- package/dist/src/addons/menu-tabs/menu-tabs.d.ts +22 -0
- package/dist/src/addons/menu-tabs/menu-tabs.js.map +1 -0
- package/dist/src/addons/plugin-manager/custom-plugin-dialog.d.ts +28 -0
- package/dist/src/addons/plugin-manager/custom-plugin-dialog.js.map +1 -0
- package/dist/src/addons/plugin-manager/plugin-manager.d.ts +20 -0
- package/dist/src/addons/plugin-manager/plugin-manager.js.map +1 -0
- package/dist/src/filtered-list.d.ts +27 -0
- package/dist/src/filtered-list.js.map +1 -0
- package/dist/src/finder-list.d.ts +37 -0
- package/dist/src/finder-list.js.map +1 -0
- package/dist/src/foundation/compare.d.ts +79 -0
- package/dist/src/foundation/compare.js.map +1 -0
- package/dist/src/foundation/dai.d.ts +30 -0
- package/dist/src/foundation/dai.js.map +1 -0
- package/dist/src/foundation/generators.d.ts +13 -0
- package/dist/src/foundation/generators.js.map +1 -0
- package/dist/src/foundation/ied.d.ts +22 -0
- package/dist/src/foundation/ied.js.map +1 -0
- package/dist/src/foundation/nsd.d.ts +4 -0
- package/dist/src/foundation/nsd.js.map +1 -0
- package/dist/src/foundation/nsdoc.d.ts +14 -0
- package/dist/src/foundation/nsdoc.js.map +1 -0
- package/dist/src/foundation/scl.d.ts +1 -0
- package/dist/src/foundation/scl.js.map +1 -0
- package/dist/src/foundation.d.ts +230 -0
- package/dist/src/foundation.js.map +1 -0
- package/dist/src/icons/compare.d.ts +3 -0
- package/dist/src/icons/compare.js.map +1 -0
- package/dist/src/icons/icons.d.ts +41 -0
- package/dist/src/icons/icons.js.map +1 -0
- package/dist/src/icons/ied-icons.d.ts +3 -0
- package/dist/src/icons/ied-icons.js.map +1 -0
- package/dist/src/icons/lnode.d.ts +16 -0
- package/dist/src/icons/lnode.js.map +1 -0
- package/dist/src/open-scd.d.ts +131 -0
- package/dist/src/open-scd.js.map +1 -0
- package/dist/src/oscd-filter-button.d.ts +27 -0
- package/dist/src/oscd-filter-button.js.map +1 -0
- package/dist/src/plain-compare-list.d.ts +36 -0
- package/dist/src/plain-compare-list.js.map +1 -0
- package/dist/src/plugin-tag.d.ts +6 -0
- package/dist/src/plugin-tag.js.map +1 -0
- package/dist/src/plugin.d.ts +23 -0
- package/dist/src/plugin.events.d.ts +15 -0
- package/dist/src/plugin.events.js.map +1 -0
- package/dist/src/plugin.js.map +1 -0
- package/dist/src/plugins.d.ts +3 -0
- package/dist/src/plugins.js.map +1 -0
- package/dist/src/schemas.d.ts +58 -0
- package/dist/src/schemas.js.map +1 -0
- package/dist/src/themes.d.ts +3 -0
- package/dist/src/themes.js.map +1 -0
- package/dist/src/translations/de.d.ts +2 -0
- package/dist/src/translations/de.js.map +1 -0
- package/dist/src/translations/en.d.ts +963 -0
- package/dist/src/translations/en.js.map +1 -0
- package/dist/src/translations/loader.d.ts +12 -0
- package/dist/src/translations/loader.js.map +1 -0
- package/dist/src/wizard-checkbox.d.ts +37 -0
- package/dist/src/wizard-checkbox.js.map +1 -0
- package/dist/src/wizard-dialog.d.ts +45 -0
- package/dist/src/wizard-dialog.js.map +1 -0
- package/dist/src/wizard-select.d.ts +31 -0
- package/dist/src/wizard-select.js.map +1 -0
- package/dist/src/wizard-textfield.d.ts +50 -0
- package/dist/src/wizard-textfield.js.map +1 -0
- package/dist/src/wizards.d.ts +23 -0
- package/dist/src/wizards.js.map +1 -0
- package/dist/test/foundation.d.ts +34 -0
- package/dist/test/foundation.js +55 -0
- package/dist/test/foundation.js.map +1 -0
- package/dist/test/mock-editor-logger.d.ts +16 -0
- package/dist/test/mock-editor-logger.js +53 -0
- package/dist/test/mock-editor-logger.js.map +1 -0
- package/dist/test/mock-edits.d.ts +7 -0
- package/dist/test/mock-edits.js +12 -0
- package/dist/test/mock-edits.js.map +1 -0
- package/dist/test/mock-open-scd.d.ts +22 -0
- package/dist/test/mock-open-scd.js +53 -0
- package/dist/test/mock-open-scd.js.map +1 -0
- package/dist/test/mock-plugins.d.ts +33 -0
- package/dist/test/mock-plugins.js +239 -0
- package/dist/test/mock-plugins.js.map +1 -0
- package/dist/test/mock-wizard-editor.d.ts +15 -0
- package/dist/test/mock-wizard-editor.js +50 -0
- package/dist/test/mock-wizard-editor.js.map +1 -0
- package/dist/themes.d.ts +3 -0
- package/dist/translations/de.d.ts +2 -0
- package/dist/translations/en.d.ts +963 -0
- package/dist/translations/loader.d.ts +12 -0
- package/dist/wizard-checkbox.d.ts +37 -0
- package/dist/wizard-dialog.d.ts +45 -0
- package/dist/wizard-select.d.ts +31 -0
- package/dist/wizard-textfield.d.ts +50 -0
- package/dist/wizards.d.ts +23 -0
- package/package.json +42 -22
- package/dist/core/api/api.js +0 -7
- package/dist/core/api/api.js.map +0 -1
- package/dist/core/api/editor/subject.js +0 -22
- package/dist/core/api/editor/subject.js.map +0 -1
- package/dist/core/api/editor/xml-editor.js +0 -82
- package/dist/core/api/editor/xml-editor.js.map +0 -1
- package/dist/core/api/plugin-state-api.js +0 -27
- package/dist/core/api/plugin-state-api.js.map +0 -1
- package/dist/core/foundation/cyrb64.js +0 -26
- package/dist/core/foundation/cyrb64.js.map +0 -1
- package/dist/core/foundation/deprecated/edit-event.js +0 -44
- package/dist/core/foundation/deprecated/edit-event.js.map +0 -1
- package/dist/core/foundation/deprecated/editor.js +0 -94
- package/dist/core/foundation/deprecated/editor.js.map +0 -1
- package/dist/core/foundation/deprecated/history.js +0 -17
- package/dist/core/foundation/deprecated/history.js.map +0 -1
- package/dist/core/foundation/deprecated/open-event.js +0 -9
- package/dist/core/foundation/deprecated/open-event.js.map +0 -1
- package/dist/core/foundation/deprecated/settings.js +0 -19
- package/dist/core/foundation/deprecated/settings.js.map +0 -1
- package/dist/core/foundation/deprecated/validation.js +0 -8
- package/dist/core/foundation/deprecated/validation.js.map +0 -1
- package/dist/core/foundation/deprecated/waiter.js +0 -12
- package/dist/core/foundation/deprecated/waiter.js.map +0 -1
- package/dist/core/foundation/edit-completed-event.js +0 -11
- package/dist/core/foundation/edit-completed-event.js.map +0 -1
- package/dist/core/foundation/edit-event.js +0 -8
- package/dist/core/foundation/edit-event.js.map +0 -1
- package/dist/core/foundation/edit.js +0 -31
- package/dist/core/foundation/edit.js.map +0 -1
- package/dist/core/foundation/handle-edit.js +0 -151
- package/dist/core/foundation/handle-edit.js.map +0 -1
- package/dist/core/foundation/open-event.js +0 -8
- package/dist/core/foundation/open-event.js.map +0 -1
- package/dist/core/foundation/plugin.js.map +0 -1
- package/dist/core/foundation.js +0 -14
- package/dist/core/foundation.js.map +0 -1
- package/dist/core/locales.js +0 -21
- package/dist/core/locales.js.map +0 -1
- package/dist/openscd/src/WizardDivider.js.map +0 -1
- package/dist/openscd/src/Wizarding.js.map +0 -1
- package/dist/openscd/src/action-icon.js.map +0 -1
- package/dist/openscd/src/action-pane.js.map +0 -1
- package/dist/openscd/src/addons/Editor.js.map +0 -1
- package/dist/openscd/src/addons/History.js.map +0 -1
- package/dist/openscd/src/addons/Layout.js.map +0 -1
- package/dist/openscd/src/addons/Settings.js.map +0 -1
- package/dist/openscd/src/addons/Waiter.js.map +0 -1
- package/dist/openscd/src/addons/Wizards.js.map +0 -1
- package/dist/openscd/src/addons/editor/edit-action-to-v1-converter.js.map +0 -1
- package/dist/openscd/src/addons/editor/edit-v1-to-v2-converter.js.map +0 -1
- package/dist/openscd/src/addons/history/get-log-text.js.map +0 -1
- package/dist/openscd/src/addons/menu-tabs/menu-tabs.js.map +0 -1
- package/dist/openscd/src/addons/plugin-manager/custom-plugin-dialog.js.map +0 -1
- package/dist/openscd/src/addons/plugin-manager/plugin-manager.js.map +0 -1
- package/dist/openscd/src/filtered-list.js.map +0 -1
- package/dist/openscd/src/finder-list.js.map +0 -1
- package/dist/openscd/src/foundation/compare.js.map +0 -1
- package/dist/openscd/src/foundation/dai.js.map +0 -1
- package/dist/openscd/src/foundation/generators.js.map +0 -1
- package/dist/openscd/src/foundation/ied.js.map +0 -1
- package/dist/openscd/src/foundation/nsd.js.map +0 -1
- package/dist/openscd/src/foundation/nsdoc.js.map +0 -1
- package/dist/openscd/src/foundation/scl.js.map +0 -1
- package/dist/openscd/src/foundation.js.map +0 -1
- package/dist/openscd/src/icons/compare.js.map +0 -1
- package/dist/openscd/src/icons/icons.js.map +0 -1
- package/dist/openscd/src/icons/ied-icons.js.map +0 -1
- package/dist/openscd/src/icons/lnode.js.map +0 -1
- package/dist/openscd/src/open-scd.js.map +0 -1
- package/dist/openscd/src/oscd-filter-button.js.map +0 -1
- package/dist/openscd/src/plain-compare-list.js.map +0 -1
- package/dist/openscd/src/plugin-tag.js.map +0 -1
- package/dist/openscd/src/plugin.events.js.map +0 -1
- package/dist/openscd/src/plugin.js +0 -2
- package/dist/openscd/src/plugin.js.map +0 -1
- package/dist/openscd/src/plugins.js.map +0 -1
- package/dist/openscd/src/schemas.js.map +0 -1
- package/dist/openscd/src/themes.js.map +0 -1
- package/dist/openscd/src/translations/de.js.map +0 -1
- package/dist/openscd/src/translations/en.js.map +0 -1
- package/dist/openscd/src/translations/loader.js.map +0 -1
- package/dist/openscd/src/wizard-checkbox.js.map +0 -1
- package/dist/openscd/src/wizard-dialog.js.map +0 -1
- package/dist/openscd/src/wizard-select.js.map +0 -1
- package/dist/openscd/src/wizard-textfield.js.map +0 -1
- package/dist/openscd/src/wizards.js.map +0 -1
- package/dist/xml/src/foundation.js +0 -67
- package/dist/xml/src/foundation.js.map +0 -1
- package/dist/xml/src/index.js +0 -2
- package/dist/xml/src/index.js.map +0 -1
- /package/dist/{openscd/src → src}/WizardDivider.js +0 -0
- /package/dist/{openscd/src → src}/Wizarding.js +0 -0
- /package/dist/{openscd/src → src}/action-icon.js +0 -0
- /package/dist/{openscd/src → src}/action-pane.js +0 -0
- /package/dist/{openscd/src → src}/addons/Editor.js +0 -0
- /package/dist/{openscd/src → src}/addons/History.js +0 -0
- /package/dist/{openscd/src → src}/addons/Layout.js +0 -0
- /package/dist/{openscd/src → src}/addons/Settings.js +0 -0
- /package/dist/{openscd/src → src}/addons/Waiter.js +0 -0
- /package/dist/{openscd/src → src}/addons/Wizards.js +0 -0
- /package/dist/{openscd/src → src}/addons/editor/edit-action-to-v1-converter.js +0 -0
- /package/dist/{openscd/src → src}/addons/editor/edit-v1-to-v2-converter.js +0 -0
- /package/dist/{openscd/src → src}/addons/history/get-log-text.js +0 -0
- /package/dist/{openscd/src → src}/addons/menu-tabs/menu-tabs.js +0 -0
- /package/dist/{openscd/src → src}/addons/plugin-manager/custom-plugin-dialog.js +0 -0
- /package/dist/{openscd/src → src}/addons/plugin-manager/plugin-manager.js +0 -0
- /package/dist/{openscd/src → src}/filtered-list.js +0 -0
- /package/dist/{openscd/src → src}/finder-list.js +0 -0
- /package/dist/{openscd/src → src}/foundation/compare.js +0 -0
- /package/dist/{openscd/src → src}/foundation/dai.js +0 -0
- /package/dist/{openscd/src → src}/foundation/generators.js +0 -0
- /package/dist/{openscd/src → src}/foundation/ied.js +0 -0
- /package/dist/{openscd/src → src}/foundation/nsd.js +0 -0
- /package/dist/{openscd/src → src}/foundation/nsdoc.js +0 -0
- /package/dist/{openscd/src → src}/foundation/scl.js +0 -0
- /package/dist/{openscd/src → src}/foundation.js +0 -0
- /package/dist/{openscd/src → src}/icons/compare.js +0 -0
- /package/dist/{openscd/src → src}/icons/icons.js +0 -0
- /package/dist/{openscd/src → src}/icons/ied-icons.js +0 -0
- /package/dist/{openscd/src → src}/icons/lnode.js +0 -0
- /package/dist/{openscd/src → src}/open-scd.js +0 -0
- /package/dist/{openscd/src → src}/oscd-filter-button.js +0 -0
- /package/dist/{openscd/src → src}/plain-compare-list.js +0 -0
- /package/dist/{openscd/src → src}/plugin-tag.js +0 -0
- /package/dist/{openscd/src → src}/plugin.events.js +0 -0
- /package/dist/{core/foundation → src}/plugin.js +0 -0
- /package/dist/{openscd/src → src}/plugins.js +0 -0
- /package/dist/{openscd/src → src}/schemas.js +0 -0
- /package/dist/{openscd/src → src}/themes.js +0 -0
- /package/dist/{openscd/src → src}/translations/de.js +0 -0
- /package/dist/{openscd/src → src}/translations/en.js +0 -0
- /package/dist/{openscd/src → src}/translations/loader.js +0 -0
- /package/dist/{openscd/src → src}/wizard-checkbox.js +0 -0
- /package/dist/{openscd/src → src}/wizard-dialog.js +0 -0
- /package/dist/{openscd/src → src}/wizard-select.js +0 -0
- /package/dist/{openscd/src → src}/wizard-textfield.js +0 -0
- /package/dist/{openscd/src → src}/wizards.js +0 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"compare.js","sourceRoot":"","sources":["../../../src/foundation/compare.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAkB,MAAM,aAAa,CAAC;AACnD,OAAO,EAAE,MAAM,EAAE,MAAM,4BAA4B,CAAC;AACpD,OAA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GxB,cAAc,CAAC,GAAG,CAAC,IAAI,CAAC,IAAI,CAAC;;yBAElC;gBACH,CAAC,CAAC,EAAE;mCACS,CACpB;;;eAGA;YACT,CAAC,CAAC,EAAE;MACJ,uBAAuB,EAAE,CAAC;KAC7B;IACD,OAAO,IAAI,CAAC;AACd,CAAC","sourcesContent":["import { html, TemplateResult } from 'lit-element';\nimport { repeat } from 'lit-html/directives/repeat';\nimport { get } from 'lit-translate';\n\nimport '@material/mwc-list';\nimport '@material/mwc-list/mwc-list-item';\nimport '@material/mwc-icon';\n\nimport { identity } from '../foundation.js';\nimport { SVGTemplateResult } from 'lit-html';\n\nimport { attributeIcon, contentIcon, elementIcon } from '../icons/compare.js';\n\nconst diffTypeToIcon: Map<DiffType, SVGTemplateResult> = new Map<\n DiffType,\n SVGTemplateResult\n>();\n\ndiffTypeToIcon.set('Attribute', attributeIcon);\ndiffTypeToIcon.set('Content', contentIcon);\ndiffTypeToIcon.set('Element', elementIcon);\n\nexport type DiffType = 'Element' | 'Attribute' | 'Content';\n\nexport type Diff<T> =\n | { type: DiffType; oldValue: T; newValue: null }\n | { type: DiffType; oldValue: null; newValue: T }\n | { type: DiffType; oldValue: T; newValue: T };\n\n/**\n * Type to filter out a difference based on `tagName`.`attributeName`\n *\n * The matcher can be a boolean or a `consumer` that returns a boolean\n */\nexport interface DiffFilter<T> {\n [selector: string]: DiffFilterSelector<T>;\n}\n\ninterface DiffFilterSelector<T> {\n full?: DiffFilterConsumer<T>;\n attributes?: {\n [name: string]: DiffFilterConsumer<T>;\n };\n}\n\n/**\n * Consumer to match if a diff should be filtered out.\n */\ntype DiffFilterConsumer<T> = boolean | ((value: T | null) => boolean);\n\nfunction getDiffFilterSelector(\n elementToBeCompared: Element,\n rootElementToBeCompared: Element,\n filters: DiffFilter<Element>\n): DiffFilterSelector<Element> | undefined {\n const querySelector: string | undefined =\n rootElementToBeCompared === elementToBeCompared\n ? ':scope'\n : Object.keys(filters).find(selector =>\n Array.from(\n rootElementToBeCompared.querySelectorAll(selector)\n ).includes(elementToBeCompared)\n );\n\n return querySelector ? filters[querySelector!] : undefined;\n}\n\nfunction shouldFilterElement(\n element: Element,\n filter: DiffFilterSelector<Element> | undefined\n): boolean {\n if (!filter || !filter.full) {\n return false;\n }\n const consumer: DiffFilterConsumer<Element> = filter!.full!;\n\n return typeof consumer === 'boolean' ? consumer : consumer(element);\n}\n\nfunction shouldFilterAttribute(\n element: Element,\n attribute: string,\n filter: DiffFilterSelector<Element> | undefined\n): boolean {\n if (!filter || !filter.attributes || !filter.attributes![attribute]) {\n return false;\n }\n const consumer: DiffFilterConsumer<Element> = filter!.attributes![attribute];\n\n return typeof consumer === 'boolean' ? consumer : consumer(element);\n}\n\n/**\n * Returns the description of the Element that differs.\n *\n * @param element - The Element to retrieve the identifier from.\n */\nfunction describe(element: Element): string {\n const id = identity(element);\n return typeof id === 'string' ? id : get('unidentifiable');\n}\n\n/**\n * Check if there are any attribute values changed between the two elements.\n *\n * @param elementToBeCompared - The element to check for differences.\n * @param elementToCompareAgainst - The element used to check against.\n */\nexport function diffSclAttributes(\n elementToBeCompared: Element,\n elementToCompareAgainst: Element,\n filterToIgnore: DiffFilter<Element>,\n searchElementToBeCompared: Element\n): [string, Diff<string>][] {\n const attrDiffs: [string, Diff<string>][] = [];\n\n // First check if there is any text inside the element and there should be no child elements.\n const newText = elementToBeCompared.textContent?.trim() ?? '';\n const oldText = elementToCompareAgainst.textContent?.trim() ?? '';\n if (\n elementToBeCompared.childElementCount === 0 &&\n elementToCompareAgainst.childElementCount === 0 &&\n newText !== oldText\n ) {\n const shouldFilter: boolean = shouldFilterElement(\n elementToBeCompared,\n getDiffFilterSelector(\n elementToBeCompared,\n searchElementToBeCompared,\n filterToIgnore\n )\n );\n\n if (!shouldFilter) {\n attrDiffs.push([\n 'value',\n { type: 'Content', newValue: newText, oldValue: oldText },\n ]);\n }\n }\n\n // Next check if there are any difference between attributes.\n const attributeNames = new Set(\n elementToCompareAgainst\n .getAttributeNames()\n .concat(elementToBeCompared.getAttributeNames())\n );\n for (const name of attributeNames) {\n const shouldFilter: boolean = shouldFilterAttribute(\n elementToBeCompared,\n name,\n getDiffFilterSelector(\n elementToBeCompared,\n searchElementToBeCompared,\n filterToIgnore\n )\n );\n if (\n !shouldFilter &&\n elementToCompareAgainst.getAttribute(name) !==\n elementToBeCompared.getAttribute(name)\n ) {\n attrDiffs.push([\n name,\n <Diff<string>>{\n type: 'Attribute',\n newValue: elementToBeCompared.getAttribute(name),\n oldValue: elementToCompareAgainst.getAttribute(name),\n },\n ]);\n }\n }\n return attrDiffs;\n}\n\n/**\n * Function to retrieve the identity to compare 2 children on the same level.\n * This means we only need to last part of the Identity string to compare the children.\n *\n * @param element - The element to retrieve the identity from.\n */\nexport function identityForCompare(element: Element): string | number {\n let identityOfElement = identity(element);\n if (typeof identityOfElement === 'string') {\n identityOfElement = identityOfElement.split('>').pop() ?? '';\n }\n return identityOfElement;\n}\n\n/**\n * Custom method for comparing to check if 2 elements are the same. Because they are on the same level\n * we don't need to compare the full identity, we just compare the part of the Element itself.\n *\n * <b>Remark</b>Private elements are already filtered out, so we don't need to bother them.\n *\n * @param newValue - The new element to compare with the old element.\n * @param oldValue - The old element to which the new element is compared.\n */\nexport function isSame(newValue: Element, oldValue: Element): boolean {\n return (\n newValue.tagName === oldValue.tagName &&\n identityForCompare(newValue) === identityForCompare(oldValue)\n );\n}\n\n/**\n * List of all differences between children elements that both old and new element have.\n * The list contains children both elements have and children that were added or removed\n * from the new element.\n * <b>Remark</b>: Private elements are ignored.\n *\n * @param elementToBeCompared - The element to check for differences.\n * @param elementToCompareAgainst - The element used to check against.\n */\nexport function diffSclChilds(\n elementToBeCompared: Element,\n elementToCompareAgainst: Element,\n filterToIgnore: DiffFilter<Element>,\n searchElementToBeCompared: Element,\n searchElementToCompareAgainst: Element\n): Diff<Element>[] {\n const childDiffs: Diff<Element>[] = [];\n const childrenToBeCompared = Array.from(elementToBeCompared.children);\n const childrenToCompareTo = Array.from(elementToCompareAgainst.children);\n\n childrenToBeCompared.forEach(newElement => {\n if (!newElement.closest('Private')) {\n const shouldFilter: boolean = shouldFilterElement(\n newElement,\n getDiffFilterSelector(\n newElement,\n searchElementToBeCompared,\n filterToIgnore\n )\n );\n if (!shouldFilter) {\n const twinIndex = childrenToCompareTo.findIndex(ourChild =>\n isSame(newElement, ourChild)\n );\n const oldElement =\n twinIndex > -1 ? childrenToCompareTo[twinIndex] : null;\n\n if (oldElement) {\n childrenToCompareTo.splice(twinIndex, 1);\n childDiffs.push({\n type: 'Element',\n newValue: newElement,\n oldValue: oldElement,\n });\n } else {\n childDiffs.push({\n type: 'Element',\n newValue: newElement,\n oldValue: null,\n });\n }\n }\n }\n });\n childrenToCompareTo.forEach(oldElement => {\n if (!oldElement.closest('Private')) {\n const shouldFilter: boolean = shouldFilterElement(\n oldElement,\n getDiffFilterSelector(\n oldElement,\n searchElementToCompareAgainst,\n filterToIgnore\n )\n );\n if (!shouldFilter) {\n childDiffs.push({\n type: 'Element',\n newValue: null,\n oldValue: oldElement,\n });\n }\n }\n });\n return childDiffs;\n}\n\n/**\n * Generate HTML (TemplateResult) containing all the differences between the two elements passed.\n * If null is returned there are no differences between the two elements.\n *\n * @param elementToBeCompared - The element to check for differences.\n * @param elementToCompareAgainst - The element used to check against.\n */\nexport function renderDiff(\n elementToBeCompared: Element,\n elementToCompareAgainst: Element,\n filterToIgnore: DiffFilter<Element> = {}\n): TemplateResult | null {\n return renderDiffInternal(\n elementToBeCompared,\n elementToCompareAgainst,\n filterToIgnore,\n elementToBeCompared,\n elementToCompareAgainst\n );\n}\n\nfunction renderDiffInternal(\n elementToBeCompared: Element,\n elementToCompareAgainst: Element,\n filterToIgnore: DiffFilter<Element> = {},\n searchElementToBeCompared: Element,\n searchElementToCompareAgainst: Element\n): TemplateResult | null {\n // Determine the ID from the current tag. These can be numbers or strings.\n let idTitle: string | undefined = identity(elementToBeCompared).toString();\n if (idTitle === 'NaN') {\n idTitle = undefined;\n }\n\n // Set the root elements if they are not defined yet\n searchElementToBeCompared = searchElementToBeCompared || elementToBeCompared;\n searchElementToCompareAgainst =\n searchElementToCompareAgainst || elementToCompareAgainst;\n\n const attrDiffs: [string, Diff<string>][] = diffSclAttributes(\n elementToBeCompared,\n elementToCompareAgainst,\n filterToIgnore,\n searchElementToBeCompared\n );\n\n // Next check which elements are added, deleted or in both elements.\n const childDiffs: Diff<Element>[] = diffSclChilds(\n elementToBeCompared,\n elementToCompareAgainst,\n filterToIgnore,\n searchElementToBeCompared,\n searchElementToCompareAgainst\n );\n\n const childAddedOrDeleted: Diff<Element>[] = [];\n const childToCompare: Diff<Element>[] = [];\n childDiffs.forEach(diff => {\n if (!diff.oldValue || !diff.newValue) {\n childAddedOrDeleted.push(diff);\n } else {\n childToCompare.push(diff);\n }\n });\n\n // These children exist in both old and new element, let's check if there are any difference in the children.\n const childToCompareTemplates = childToCompare\n .map(diff => renderDiff(diff.newValue!, diff.oldValue!, filterToIgnore))\n .filter(result => result !== null);\n\n // If there are difference generate the HTML otherwise just return null.\n if (\n childToCompareTemplates.length > 0 ||\n attrDiffs.length > 0 ||\n childAddedOrDeleted.length > 0\n ) {\n return html` ${attrDiffs.length > 0 || childAddedOrDeleted.length > 0\n ? html`<div class=\"container container--alt\">\n <div class=\"list__container list__container--left\">\n <mwc-list multi right nonInteractive>\n ${repeat(\n attrDiffs,\n e => e,\n ([name, diff]) =>\n html`<mwc-list-item right twoLine graphic=\"icon\">\n ${diff.oldValue !== null\n ? html`\n <span>\n ${name}:\n ${diff.oldValue === '' ? '\"\"' : diff.oldValue}\n </span>\n <span slot=\"secondary\">${idTitle}</span>\n <mwc-icon slot=\"graphic\">\n ${diffTypeToIcon.get(diff.type)}\n </mwc-icon>\n `\n : ''}\n </mwc-list-item>`\n )}\n ${repeat(\n childAddedOrDeleted,\n e => e,\n diff =>\n html` <mwc-list-item right twoLine graphic=\"icon\">\n ${diff.oldValue\n ? html`\n <span>${diff.oldValue.tagName}</span>\n <span slot=\"secondary\">\n ${describe(diff.oldValue!)}\n </span>\n <mwc-icon slot=\"graphic\">\n ${diffTypeToIcon.get(diff.type)}\n </mwc-icon>\n `\n : ''}\n </mwc-list-item>`\n )}\n </mwc-list>\n </div>\n <div class=\"list__container\">\n <mwc-list multi left nonInteractive>\n ${repeat(\n attrDiffs,\n e => e,\n ([name, diff]) =>\n html` <mwc-list-item left twoLine graphic=\"icon\">\n ${diff.newValue !== null\n ? html`\n <span>\n ${name}:\n ${diff.newValue === '' ? '\"\"' : diff.newValue}\n </span>\n <span slot=\"secondary\">${idTitle}</span>\n <mwc-icon slot=\"graphic\">\n ${diffTypeToIcon.get(diff.type)}\n </mwc-icon>\n `\n : ''}\n </mwc-list-item>`\n )}\n ${repeat(\n childAddedOrDeleted,\n e => e,\n diff =>\n html` <mwc-list-item left twoLine graphic=\"icon\">\n ${diff.newValue\n ? html`\n <span>${diff.newValue.tagName}</span>\n <span slot=\"secondary\">\n ${describe(diff.newValue!)}\n </span>\n <mwc-icon slot=\"graphic\">\n ${diffTypeToIcon.get(diff.type)}\n </mwc-icon>\n `\n : ''}\n </mwc-list-item>`\n )}\n </mwc-list>\n </div>\n </div>`\n : ''}\n ${childToCompareTemplates}`;\n }\n return null;\n}\n"]}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Determine which part of the Template Structure still needs to be initialized.
|
|
3
|
+
* With the first call the parent will normally be the LN(0) Element to start from.
|
|
4
|
+
* It will use the list to pop the first element and look if there is a DOI/SDI/DAI
|
|
5
|
+
* Element available with the same name.
|
|
6
|
+
*
|
|
7
|
+
* @param parentElement - The element to search from for a DOI/SDI/DAI
|
|
8
|
+
* @param templateStructure - The templates structure with DO/DA/BDA Elements.
|
|
9
|
+
* @returns The last element initialized element or LN(0) if nothing is initialized. This Element can be used to
|
|
10
|
+
* add the new element to. And the list of Template Elements that still need to be initialized.
|
|
11
|
+
*/
|
|
12
|
+
export declare function determineUninitializedStructure(parentElement: Element, templateStructure: Element[]): [Element, Element[]];
|
|
13
|
+
/**
|
|
14
|
+
* Create a new instance structure defined by the array of template elements passed.
|
|
15
|
+
*
|
|
16
|
+
* @param uninitializedTemplateStructure - The Array of Template Elements for which new instance elements need to be
|
|
17
|
+
* created.
|
|
18
|
+
* @returns The Element created from the last Template Element in the Array.
|
|
19
|
+
*/
|
|
20
|
+
export declare function initializeElements(uninitializedTemplateStructure: Element[]): Element;
|
|
21
|
+
/**
|
|
22
|
+
* Use the path configuration of a Common Data Class to search for all DO/SDO/DA/BDA Elements to create
|
|
23
|
+
* a structure for which DOI/SDI/DAI Elements should be created later. Null will be returned when an invalid
|
|
24
|
+
* Template Structure is described by the path.
|
|
25
|
+
*
|
|
26
|
+
* @param lnElement - The LN Element to use for searching the starting DO Element.
|
|
27
|
+
* @param path - The (S)DO/(B)DA Elements to find in the template structure.
|
|
28
|
+
* @returns List of Elements starting with the DO Element followed by one or more SDO or (B)DA Elements describing the structure.
|
|
29
|
+
*/
|
|
30
|
+
export declare function createTemplateStructure(lnElement: Element, path: string[]): Element[] | null;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"dai.js","sourceRoot":"","sources":["../../../src/foundation/dai.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,eAAe,CAAC;AAE9C;;;;;;;;;;GAUG;AACH,MAAM,UAAU,+BAA+B,CAC7C,aAAsB,EACtB,iBAA4B;IAE5B,MAAM,eAAe,GAAG,iBAAiB,CAAC,KAAK,EAAE,CAAC;IAClD,IAAI,iBAAiB,CAAC,MAAM,GAAG,CAAC,EAAE;QAChC,4GAA4G;QAC5G,uCAAuC;QACvC,IAAI,eAA+B,CAAC;QACpC,qDAAqD;QACrD,IAAI,eAAgB,CAAC,OAAO,KAAK,IAAI,EAAE;YACrC,eAAe,GAAG,aAAa,CAAC,aAAa,CAC3C,aAAa,eAAgB,CAAC,YAAY,CAAC,MAAM,CAAC,IAAI,CACvD,CAAC;SACH;aAAM;YACL,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AAW,CAAC,CAAC;QAErC,IAAI,WAAW,CAAC,OAAO,KAAK,IAAI,IAAI,WAAW,CAAC,OAAO,KAAK,KAAK,EAAE;YACjE,MAAM,IAAI,GAAG,WAAW,CAAC,YAAY,CAAC,MAAM,CAAC,IAAI,EAAE,CAAC;YACpD,WAAW,GAAG,GAAG,CAAC,aAAa,CAC7B,kCAAkC,IAAI,IAAI,CAC3C,CAAC;SACH;aAAM;YACL,MAAM,KAAK,GAAG,WAAW,CAAC,YAAY,CAAC,OAAO,CAAC,IAAI,EAAE,CAAC;YACtD,IAAI,KAAK,KAAK,QAAQ,EAAE;gBACtB,MAAM,IAAI,GAAG,WAAW,CAAC,YAAY,CAAC,MAAM,CAAC,IAAI,EAAE,CAAC;gBACpD,WAAW,GAAG,GAAG,CAAC,aAAa,CAC7B,kCAAkC,IAAI,IAAI,CAC3C,CAAC;aACH;iBAAM;gBACL,WAAW,GAAG,IAAI,CAAC;aACpB;SACF;IACH,CAAC,CAAC,CAAC;IACH,OAAO,iBAAiB,CAAC;AAC3B,CAAC","sourcesContent":["import { SCL_NAMESPACE } from '../schemas.js';\n\n/**\n * Determine which part of the Template Structure still needs to be initialized.\n * With the first call the parent will normally be the LN(0) Element to start from.\n * It will use the list to pop the first element and look if there is a DOI/SDI/DAI\n * Element available with the same name.\n *\n * @param parentElement - The element to search from for a DOI/SDI/DAI\n * @param templateStructure - The templates structure with DO/DA/BDA Elements.\n * @returns The last element initialized element or LN(0) if nothing is initialized. This Element can be used to\n * add the new element to. And the list of Template Elements that still need to be initialized.\n */\nexport function determineUninitializedStructure(\n parentElement: Element,\n templateStructure: Element[]\n): [Element, Element[]] {\n const templateElement = templateStructure.shift();\n if (templateStructure.length > 0) {\n // If there are still Template Elements we didn't reach the DAI Element, so continue checking if any DOI/SDI\n // Element is found with the same name.\n let instanceElement: Element | null;\n // DO Elements are initialized as DOI, others as SDI.\n if (templateElement!.tagName === 'DO') {\n instanceElement = parentElement.querySelector(\n `DOI[name=\"${templateElement!.getAttribute('name')}\"]`\n );\n } else {\n instanceElement = parentElement.querySelector(\n `SDI[name=\"${templateElement!.getAttribute('name')}\"]`\n );\n }\n\n if (instanceElement) {\n // If instance element found we will search one level lower again.\n // So the parent will become the instance element and the list is 1 smaller.\n return determineUninitializedStructure(\n instanceElement,\n templateStructure\n );\n } else {\n // No instance element found, so the element and all other elements still need to be\n // initialized and returned.\n templateStructure.unshift(templateElement!);\n return [parentElement, templateStructure];\n }\n } else {\n // The last template element in the list, so this should be the DA Element that only needs\n // to be initialized.\n return [parentElement, [templateElement!]];\n }\n}\n\n/**\n * Create a new instance structure defined by the array of template elements passed.\n *\n * @param uninitializedTemplateStructure - The Array of Template Elements for which new instance elements need to be\n * created.\n * @returns The Element created from the last Template Element in the Array.\n */\nexport function initializeElements(\n uninitializedTemplateStructure: Element[]\n): Element {\n const element = uninitializedTemplateStructure.shift();\n if (uninitializedTemplateStructure.length > 0) {\n // If there are more template elements left this will become a DOI or SDI Element.\n let newElement;\n // Depending on the level create a DOI or SDI Element.\n if (element!.tagName === 'DO') {\n newElement = element!.ownerDocument.createElementNS(SCL_NAMESPACE, 'DOI');\n } else {\n newElement = element!.ownerDocument.createElementNS(SCL_NAMESPACE, 'SDI');\n }\n newElement.setAttribute('name', element?.getAttribute('name') ?? '');\n\n // Create an element from the next one (last) from the shortened array.\n const childElement = initializeElements(uninitializedTemplateStructure);\n newElement.append(childElement);\n\n return newElement;\n } else {\n // Create Val Element\n const newValElement = element!.ownerDocument.createElementNS(\n SCL_NAMESPACE,\n 'Val'\n );\n const valElement = element!.querySelector('Val');\n if (valElement) {\n newValElement.textContent = valElement.textContent;\n }\n\n // Create DAI Element\n const daiElement = element!.ownerDocument.createElementNS(\n SCL_NAMESPACE,\n 'DAI'\n );\n daiElement.setAttribute('name', element?.getAttribute('name') ?? '');\n daiElement.append(newValElement);\n return daiElement;\n }\n}\n\n/**\n * Use the path configuration of a Common Data Class to search for all DO/SDO/DA/BDA Elements to create\n * a structure for which DOI/SDI/DAI Elements should be created later. Null will be returned when an invalid\n * Template Structure is described by the path.\n *\n * @param lnElement - The LN Element to use for searching the starting DO Element.\n * @param path - The (S)DO/(B)DA Elements to find in the template structure.\n * @returns List of Elements starting with the DO Element followed by one or more SDO or (B)DA Elements describing the structure.\n */\nexport function createTemplateStructure(\n lnElement: Element,\n path: string[]\n): Element[] | null {\n let templateStructure: Element[] | null = [];\n\n const doc = lnElement.ownerDocument;\n const lnType = lnElement.getAttribute('lnType') ?? '';\n let typeElement = doc.querySelector(`LNodeType[id=\"${lnType}\"]`);\n path.forEach(name => {\n // There should be a DOType or DAType set for the current element in the list.\n if (!typeElement) {\n templateStructure = null;\n return;\n }\n const dataElement = typeElement.querySelector(\n `:scope > DO[name=\"${name}\"], :scope > SDO[name=\"${name}\"], :scope > DA[name=\"${name}\"], :scope > BDA[name=\"${name}\"]`\n );\n // If there is no (S)DO/(B)DA Element found the structure is incorrect, so just stop.\n if (dataElement === null) {\n templateStructure = null;\n return;\n }\n templateStructure!.push(dataElement);\n\n if (dataElement.tagName === 'DO' || dataElement.tagName === 'SDO') {\n const type = dataElement.getAttribute('type') ?? '';\n typeElement = doc.querySelector(\n `DataTypeTemplates > DOType[id=\"${type}\"]`\n );\n } else {\n const bType = dataElement.getAttribute('bType') ?? '';\n if (bType === 'Struct') {\n const type = dataElement.getAttribute('type') ?? '';\n typeElement = doc.querySelector(\n `DataTypeTemplates > DAType[id=\"${type}\"]`\n );\n } else {\n typeElement = null;\n }\n }\n });\n return templateStructure;\n}\n"]}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @param doc - project xml document
|
|
3
|
+
* @param serviceType - SampledValueControl (SMV) or GSEControl (GSE)
|
|
4
|
+
* @returns a function generating increasing unused `MAC-Address` within `doc` on subsequent invocations
|
|
5
|
+
*/
|
|
6
|
+
export declare function mACAddressGenerator(doc: XMLDocument, serviceType: 'SMV' | 'GSE'): () => string;
|
|
7
|
+
/**
|
|
8
|
+
* @param doc - project xml document
|
|
9
|
+
* @param serviceType - SampledValueControl (SMV) or GSEControl (GSE)
|
|
10
|
+
* @param type1A - whether the GOOSE is a Trip GOOSE resulting in different APPID range - default false
|
|
11
|
+
* @returns a function generating increasing unused `APPID` within `doc` on subsequent invocations
|
|
12
|
+
*/
|
|
13
|
+
export declare function appIdGenerator(doc: XMLDocument, serviceType: 'SMV' | 'GSE', type1A?: boolean): () => string;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"generators.js","sourceRoot":"","sources":["../../../src/foundation/generators.ts"],"names":[],"mappings":"AAAA,MAAM,gBAAgB,GAAG,cAAc,CAAC;AACxC,MAAM,gBAAgB,GAAG,cAAc,CAAC;AAExC,MAAM,gBAAgB,GAAG,cAAc,CAAC;AACxC,MAAM,gBAAgB,GAAG,cAAc,CAAC;AAExC,SAAS,YAAY,CAAC,GAAW;IAC/B,MAAM,GAAG,GAAG,CAAC,GAAG,GAAG,CAAC,QAAQ,CAAC,EAAE,CAAC,CAAC,WAAW,EAAE,CAAC;IAC/C,MAAM,GAAG,GAAG,GAAG,CAAC,KAAK,CAAC,SAAS,CAAE,CAAC;IAClC,OAAO,GAAG,EAAE,IAAI,CAAC,GAAG,CAAC,CAAC;AACxB,CAAC;AAED,MAAM,WAAW,GAAG,KAAK,CAAC,gBAAgB,GAAG,gBAAgB,CAAC;KAC3D,IAAI,CAAC,CAAC,CAAC;KACP,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC,YAAY,CAAC,gBAAgB,GAAG,CAAC,CAAC,CAAC,CAAC;AAErD,MAAM,WAAW,GAAG,KAAK,CAAC,gBAAgB,GAAG,gBAAgB,CAAC;KAC3D,IAAI,CAAC,CAAC,CAAC;KACP,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC,YAAY,CAAC,gBAAgB,GAAG,CAAC,CAAC,CAAC,CAAC;AAErD;;;;GAIG;AACH,MAAM,UAAU,mBAAmB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ff;\nconst minGseMacAddress = 0x010ccd010000;\n\nconst maxSmvMacAddress = 0x010ccd0401ff;\nconst minSmvMacAddress = 0x010ccd040000;\n\nfunction convertToMac(mac: number): string {\n const str = 0 + mac.toString(16).toUpperCase();\n const arr = str.match(/.{1,2}/g)!;\n return arr?.join('-');\n}\n\nconst gseMacRange = Array(maxGseMacAddress - minGseMacAddress)\n .fill(1)\n .map((_, i) => convertToMac(minGseMacAddress + i));\n\nconst smvMacRange = Array(maxSmvMacAddress - minSmvMacAddress)\n .fill(1)\n .map((_, i) => convertToMac(minSmvMacAddress + i));\n\n/**\n * @param doc - project xml document\n * @param serviceType - SampledValueControl (SMV) or GSEControl (GSE)\n * @returns a function generating increasing unused `MAC-Address` within `doc` on subsequent invocations\n */\nexport function mACAddressGenerator(\n doc: XMLDocument,\n serviceType: 'SMV' | 'GSE'\n): () => string {\n const macs = new Set(\n Array.from(\n doc.querySelectorAll(`${serviceType} > Address > P[type=\"MAC-Address\"]`)\n ).map(macs => macs.textContent!)\n );\n\n const range = serviceType === 'SMV' ? smvMacRange : gseMacRange;\n\n return () => {\n const uniqueMAC = range.find(mac => !macs.has(mac));\n if (uniqueMAC) macs.add(uniqueMAC);\n return uniqueMAC ?? '';\n };\n}\n\nconst maxGseAppId = 0x3fff;\nconst minGseAppId = 0x0000;\n\n// APPID range for Type1A(Trip) GOOSE acc. IEC 61850-8-1\nconst maxGseTripAppId = 0xbfff;\nconst minGseTripAppId = 0x8000;\n\nconst maxSmvAppId = 0x7fff;\nconst minSmvAppId = 0x4000;\n\nconst gseAppIdRange = Array(maxGseAppId - minGseAppId)\n .fill(1)\n .map((_, i) => (minGseAppId + i).toString(16).toUpperCase().padStart(4, '0'));\n\nconst gseTripAppIdRange = Array(maxGseTripAppId - minGseTripAppId)\n .fill(1)\n .map((_, i) =>\n (minGseTripAppId + i).toString(16).toUpperCase().padStart(4, '0')\n );\n\nconst smvAppIdRange = Array(maxSmvAppId - minSmvAppId)\n .fill(1)\n .map((_, i) => (minSmvAppId + i).toString(16).toUpperCase().padStart(4, '0'));\n\n/**\n * @param doc - project xml document\n * @param serviceType - SampledValueControl (SMV) or GSEControl (GSE)\n * @param type1A - whether the GOOSE is a Trip GOOSE resulting in different APPID range - default false\n * @returns a function generating increasing unused `APPID` within `doc` on subsequent invocations\n */\nexport function appIdGenerator(\n doc: XMLDocument,\n serviceType: 'SMV' | 'GSE',\n type1A = false\n): () => string {\n const appIds = new Set(\n Array.from(\n doc.querySelectorAll(`${serviceType} > Address > P[type=\"APPID\"]`)\n ).map(appId => appId.textContent!)\n );\n\n const range =\n serviceType === 'SMV'\n ? smvAppIdRange\n : type1A\n ? gseTripAppIdRange\n : gseAppIdRange;\n\n return () => {\n const uniqueAppId = range.find(appId => !appIds.has(appId));\n if (uniqueAppId) appIds.add(uniqueAppId);\n return uniqueAppId ?? '';\n };\n}\n"]}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { Delete } from '@openscd/core/foundation/deprecated/editor.js';
|
|
2
|
+
/**
|
|
3
|
+
* Get all the FCDA attributes containing values from a specific element.
|
|
4
|
+
*
|
|
5
|
+
* @param elementContainingFcdaReferences - The element to use
|
|
6
|
+
* @returns FCDA references
|
|
7
|
+
*/
|
|
8
|
+
export declare function getFcdaReferences(elementContainingFcdaReferences: Element): string;
|
|
9
|
+
/**
|
|
10
|
+
* Get all the Control attributes containing values from a specific element.
|
|
11
|
+
*
|
|
12
|
+
* @param extRef - The element to use
|
|
13
|
+
* @returns Control references
|
|
14
|
+
*/
|
|
15
|
+
export declare function getControlReferences(extRef: Element): string;
|
|
16
|
+
/**
|
|
17
|
+
* Creating Delete actions in case Inputs elements are empty.
|
|
18
|
+
*
|
|
19
|
+
* @param extRefDeleteActions - All Delete actions for ExtRefs.
|
|
20
|
+
* @returns Possible delete actions for empty Inputs elements.
|
|
21
|
+
*/
|
|
22
|
+
export declare function emptyInputsDeleteActions(extRefDeleteActions: Delete[]): Delete[];
|
|
@@ -0,0 +1 @@
|
|
|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BAClC,kBAAkB,CAAC,IAAI,CAAC;oBACtB,GAAG,EAAE,EAAE,MAAM,EAAE,MAAM,CAAC,aAAa,EAAE,OAAO,EAAE,MAAM,EAAE;iBACvD,CAAC,CAAC;aACJ;SACF;IACH,CAAC,CAAC,CAAC;IAEH,OAAO,kBAAkB,CAAC;AAC5B,CAAC","sourcesContent":["import { find, identity } from '../foundation.js';\nimport { Delete } from '@openscd/core/foundation/deprecated/editor.js';\n\n/**\n * All available FCDA references that are used to link ExtRefs.\n */\nconst fcdaReferences = [\n 'ldInst',\n 'lnClass',\n 'lnInst',\n 'prefix',\n 'doName',\n 'daName',\n];\n\n/**\n * Get all the FCDA attributes containing values from a specific element.\n *\n * @param elementContainingFcdaReferences - The element to use\n * @returns FCDA references\n */\nexport function getFcdaReferences(\n elementContainingFcdaReferences: Element\n): string {\n return fcdaReferences\n .map(fcdaRef =>\n elementContainingFcdaReferences.getAttribute(fcdaRef)\n ? `[${fcdaRef}=\"${elementContainingFcdaReferences.getAttribute(\n fcdaRef\n )}\"]`\n : ''\n )\n .join('');\n}\n\n/**\n * All available Control references that are used to link ExtRefs.\n */\nconst controlReferences = ['srcLDInst', 'srcLNClass', 'srcLNInst', 'srcCBName'];\n\n/**\n * Get all the Control attributes containing values from a specific element.\n *\n * @param extRef - The element to use\n * @returns Control references\n */\nexport function getControlReferences(extRef: Element): string {\n return controlReferences\n .map(controlRef =>\n extRef.getAttribute(controlRef)\n ? `[${controlRef}=\"${extRef.getAttribute(controlRef)}\"]`\n : ''\n )\n .join('');\n}\n\n/**\n * Creating Delete actions in case Inputs elements are empty.\n *\n * @param extRefDeleteActions - All Delete actions for ExtRefs.\n * @returns Possible delete actions for empty Inputs elements.\n */\nexport function emptyInputsDeleteActions(\n extRefDeleteActions: Delete[]\n): Delete[] {\n if (!extRefDeleteActions.length) return [];\n\n const inputDeleteActions: Delete[] = [];\n const inputsMap: Record<string, Element> = {};\n\n for (const extRefDeleteAction of extRefDeleteActions) {\n const extRef = <Element>extRefDeleteAction.old.element;\n const inputsElement = <Element>extRefDeleteAction.old.parent;\n\n const id = identity(inputsElement);\n if (!inputsMap[id]) inputsMap[id] = <Element>inputsElement.cloneNode(true);\n\n // Search the ExtRef in the Cloned Inputs Element\n const linkedExtRef = inputsMap[id].querySelector(\n `ExtRef${\n extRef.getAttribute('iedName')\n ? `[iedName=\"${extRef.getAttribute('iedName')}\"]`\n : ''\n }${getFcdaReferences(extRef)}${\n extRef.getAttribute('serviceType')\n ? `[serviceType=\"${extRef.getAttribute('serviceType')}\"]`\n : ''\n }${getControlReferences(extRef)}`\n );\n // And if found remove it as child from the Cloned Inputs Element\n if (linkedExtRef) inputsMap[id].removeChild(linkedExtRef);\n }\n\n // Create delete action for each empty inputs\n Object.entries(inputsMap).forEach(([key, value]) => {\n if (value.children.length! == 0) {\n const doc = extRefDeleteActions[0].old.parent.ownerDocument!;\n const inputs = find(doc, 'Inputs', key);\n\n if (inputs && inputs.parentElement) {\n inputDeleteActions.push({\n old: { parent: inputs.parentElement, element: inputs },\n });\n }\n }\n });\n\n return inputDeleteActions;\n}\n"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"nsd.js","sourceRoot":"","sources":["../../../src/foundation/nsd.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,MAAM,UAAU,GAAG,KAAK,CAAC,qCAAqC,CAAC;KACnE,IAAI,CAAC,QAAQ,CAAC,EAAE,CAAC,QAAQ,CAAC,IAAI,EAAE,CAAC;KACjC,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,IAAI,SAAS,EAAE,CAAC,eAAe,CAAC,GAAG,EAAE,iBAAiB,CAAC,CAAC,CAAC;AAExE,MAAM,CAAC,MAAM,UAAU,GAAG,KAAK,CAAC,qCAAqC,CAAC;KACnE,IAAI,CAAC,QAAQ,CAAC,EAAE,CAAC,QAAQ,CAAC,IAAI,EAAE,CAAC;KACjC,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,IAAI,SAAS,EAAE,CAAC,eAAe,CAAC,GAAG,EAAE,iBAAiB,CAAC,CAAC,CAAC;AAExE,MAAM,CAAC,MAAM,UAAU,GAAG,KAAK,CAAC,qCAAqC,CAAC;KACnE,IAAI,CAAC,QAAQ,CAAC,EAAE,CAAC,QAAQ,CAAC,IAAI,EAAE,CAAC;KACjC,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,IAAI,SAAS,EAAE,CAAC,eAAe,CAAC,GAAG,EAAE,iBAAiB,CAAC,CAAC,CAAC;AAExE,MAAM,CAAC,MAAM,UAAU,GAAG,KAAK,CAAC,qCAAqC,CAAC;KACnE,IAAI,CAAC,QAAQ,CAAC,EAAE,CAAC,QAAQ,CAAC,IAAI,EAAE,CAAC;KACjC,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,IAAI,SAAS,EAAE,CAAC,eAAe,CAAC,GAAG,EAAE,iBAAiB,CAAC,CAAC,CAAC","sourcesContent":["export const iec6185074 = fetch('public/xml/IEC_61850-7-4_2007B5.nsd')\n .then(response => response.text())\n .then(str => new DOMParser().parseFromString(str, 'application/xml'));\n\nexport const iec6185073 = fetch('public/xml/IEC_61850-7-3_2007B5.nsd')\n .then(response => response.text())\n .then(str => new DOMParser().parseFromString(str, 'application/xml'));\n\nexport const iec6185072 = fetch('public/xml/IEC_61850-7-2_2007B5.nsd')\n .then(response => response.text())\n .then(str => new DOMParser().parseFromString(str, 'application/xml'));\n\nexport const iec6185081 = fetch('public/xml/IEC_61850-8-1_2003A2.nsd')\n .then(response => response.text())\n .then(str => new DOMParser().parseFromString(str, 'application/xml'));\n"]}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
export interface Nsdoc {
|
|
2
|
+
nsdoc72?: XMLDocument;
|
|
3
|
+
nsdoc73?: XMLDocument;
|
|
4
|
+
nsdoc74?: XMLDocument;
|
|
5
|
+
nsdoc81?: XMLDocument;
|
|
6
|
+
getDataDescription: (element: Element, ancestors?: Element[]) => {
|
|
7
|
+
label: string;
|
|
8
|
+
};
|
|
9
|
+
}
|
|
10
|
+
/**
|
|
11
|
+
* Initialize the full Nsdoc object.
|
|
12
|
+
* @returns A fully initialized Nsdoc object for wizards/editors to use.
|
|
13
|
+
*/
|
|
14
|
+
export declare function initializeNsdoc(): Nsdoc;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"nsdoc.js","sourceRoot":"","sources":["../../../src/foundation/nsdoc.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,UAAU,EAAE,UAAU,EAAE,UAAU,EAAE,MAAM,UAAU,CAAC;AAU1E,MAAM,CAAC,KAAK,EAAE,KAAK,EAAE,KAAK,EAAE,KAAK,CAAC,GAAG,MAAM,OAAO,CAAC,GAAG,CAAC,CAAC,UAAU,EAAE,UAAU,EAAE,UAAU,EAAE,UAAU,CAAC,CAAC,CAAC;AAEzG,IAAI,OAAO,GAAyB,SAAS,CAAC;AAC9C,IAAI,OAAO,GAAyB,SAAS,CAAC;AAC9C,IAAI,OAAO,GAAyB,SAAS,CAAC;AAC9C,IAAI,OAAO,GAAyB,SAAS,CAAC;AAE9C;;;GAGG;AACH,MAAM,UAAU,eAAe;IAC7B,CAAC,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,OAAO,CAAC,GAAG;QACrC,YAAY,CAAC,OAAO,CAAC,eAAe,CAAC,CAAC,CAAC,CAAC,IAAI,SAAS,EAAE,CAAC,eAAe,CAAC,YAAY,CAAC,OAAO,CAAC,eAAe,CAAE,EAAE,iBAAiB,CAAC,CAAC,CAAC,CAAC,SAAS;QAC9I,YAAY,CAAC,OAAO,CAAC,eAAe,CAAC,CAAC,CAAC,CAAC,IAAI,SAAS,EAAE,CAAC,eAAe,CAAC,YAAY,CAAC,OAAO,CAAC,eAAe,CAAE,EAAE,iBAAiB,CAAC,CAAC,CAAC,CAAC,SAAS;QAC9I,YAAY,CAAC,OAAO,CAAC,eAAe,CAAC,CAAC,CAAC,CAAC,IAAI,SAAS,EAAE,CAAC,eA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AAO,IAAI,CAAC;QAC9B,MAAM,OAAO,GAAG,KAAK,CAAC,aAAa,CAAC,0CAA0C,WAAW,IAAI,CAAC,CAAC;QAC/F,MAAM,IAAI,GAAG,OAAO,EAAE,YAAY,CAAC,MAAM,CAAC,CAAC;QAE3C,OAAO,OAAO,EAAE,aAAa,CAAC,oBAAoB,MAAM,IAAI,CAAC,IAAI,sBAAsB,CAAC,IAAK,EAAE,MAAM,CAAC,CAAC;IACzG,CAAC;IAED,OAAO;QACL,OAAO,EAAE,OAAO;QAChB,OAAO,EAAE,OAAO;QAChB,OAAO,EAAE,OAAO;QAChB,OAAO,EAAE,OAAO;QAChB,kBAAkB,EAAE,SAAS,kBAAkB,CAAC,OAAgB,EAAE,SAAqB;YACrF,OAAO,mBAAmB,CAAC,OAAO,CAAC,OAIhC,CAAC,CAAC,kBAAkB,CAAC,OAAO,EAAE,SAAS,CAAC,CAAC;QAC9C,CAAC;KAEF,CAAA;AACH,CAAC;AAED;;;;;GAKG;AACH,SAAS,qBAAqB,CAAC,KAAkB,EAAE,EAA6B;IAC9E,OAAO,KAAK,EAAE,aAAa,CAAC,mBAAmB,EAAE,IAAI,EAAE,IAAI,CAAC,EAAE,WAAW,CAAC;AAC5E,CAAC","sourcesContent":["import { iec6185072, iec6185073, iec6185074, iec6185081 } from \"./nsd.js\";\n\nexport interface Nsdoc {\n nsdoc72?: XMLDocument;\n nsdoc73?: XMLDocument;\n nsdoc74?: XMLDocument;\n nsdoc81?: XMLDocument;\n getDataDescription: (element: Element, ancestors?: Element[]) => { label: string; }\n}\n\nconst [nsd72, nsd73, nsd74, nsd81] = await Promise.all([iec6185072, iec6185073, iec6185074, iec6185081]);\n\nlet nsdoc72: Document | undefined = undefined;\nlet nsdoc73: Document | undefined = undefined;\nlet nsdoc74: Document | undefined = undefined;\nlet nsdoc81: Document | undefined = undefined;\n\n/**\n * Initialize the full Nsdoc object.\n * @returns A fully initialized Nsdoc object for wizards/editors to use.\n */\nexport function initializeNsdoc(): Nsdoc {\n [nsdoc72, nsdoc73, nsdoc74, nsdoc81] = [\n localStorage.getItem('IEC 61850-7-2') ? new DOMParser().parseFromString(localStorage.getItem('IEC 61850-7-2')!, 'application/xml') : undefined,\n localStorage.getItem('IEC 61850-7-3') ? new DOMParser().parseFromString(localStorage.getItem('IEC 61850-7-3')!, 'application/xml') : undefined,\n localStorage.getItem('IEC 61850-7-4') ? new DOMParser().parseFromString(localStorage.getItem('IEC 61850-7-4')!, 'application/xml') : undefined,\n localStorage.getItem('IEC 61850-8-1') ? new DOMParser().parseFromString(localStorage.getItem('IEC 61850-8-1')!, 'application/xml') : undefined\n ]\n\n const iedElementTagNames = ['LN', 'LN0', 'DO', 'SDO', 'DOI', 'DA', 'BDA', 'DAI'] as const;\n type IEDElementTagNames = typeof iedElementTagNames[number];\n type GetDataDescription = (element: Element, ancestors?: Element[]) => { label: string; };\n\n const getDataDescriptions: Record<\n IEDElementTagNames,\n {\n getDataDescription: GetDataDescription;\n }\n > = {\n LN: {\n getDataDescription: getLNDataDescription\n },\n LN0: {\n getDataDescription: getLNDataDescription\n },\n DO: {\n getDataDescription: getDODataDescription\n },\n SDO: {\n getDataDescription: getSDODataDescription\n },\n DOI: {\n getDataDescription: getDODataDescription\n },\n DA: {\n getDataDescription: getDADataDescription\n },\n BDA: {\n getDataDescription: getBDADataDescription\n },\n DAI: {\n getDataDescription: getDADataDescription\n }\n };\n\n /**\n * Getting data descriptions for LN(0) elements out of the IEC 61850-7-4 .nsdoc file.\n * @param element - The element to use for searching the LN description.\n * @returns Documentation from the .nsdoc file for this LN(0) file, or the lnClass attribute in case no description can be found.\n */\n function getLNDataDescription(element: Element): { label: string; } {\n const lnClassAttribute = element.getAttribute('lnClass')!;\n const lnClass = nsd74.querySelector(`NS > LNClasses > LNClass[name=\"${lnClassAttribute}\"]`);\n const lnClassDescription = getNsdocDocumentation(nsdoc74!, lnClass?.getAttribute('titleID'));\n\n return {\n label: lnClassDescription ? lnClassDescription + ' (' + lnClassAttribute + ')' : lnClassAttribute\n };\n }\n\n /**\n * Getting data descriptions for DO(I) elements out of the IEC 61850-7-4 .nsdoc file.\n * @param element - The element to use for searching the DO description.\n * @returns Documentation from the .nsdoc file for this DO(I) file, or the name attribute in case no description can be found.\n */\n function getDODataDescription(element: Element): { label: string; } {\n const doName = element.getAttribute('name')!;\n const lnClass = nsd74.querySelector(`NS > LNClasses > LNClass[name=\"${element.parentElement?.getAttribute('lnClass')}\"]`);\n const base = lnClass?.getAttribute('base');\n const dObject = lnClass?.querySelector(`DataObject[name=\"${doName}\"]`) ?? getInheritedDataObject(base!, doName);\n\n return {\n label: getNsdocDocumentation(nsdoc74!, dObject?.getAttribute('descID')) ?? doName\n };\n }\n\n /**\n * Getting data descriptions for SDO elements out of the IEC 61850-7-3 .nsdoc file.\n * @param element - The element to use for searching the SDO description.\n * @returns Documentation from the .nsdoc file for this SDO element, or the name attribute in case no description can be found.\n */\n function getSDODataDescription(element: Element): { label: string; } {\n const sdoName = element.getAttribute('name')!;\n const subDataObject = nsd73.querySelector(`CDCs > CDC[name=\"${element.parentElement?.getAttribute('cdc')}\"] > SubDataObject[name=\"${sdoName}\"]`);\n\n return {\n label: getNsdocDocumentation(nsdoc73!, subDataObject?.getAttribute('descID')) ?? sdoName\n };\n }\n\n /**\n * Getting data descriptions for DA(I) elements out of the IEC 61850-7-3 and IEC 61850-8-1 .nsdoc file.\n * @param element - The element to use for searching the DA description.\n * @returns Documentation from the .nsdoc file for this DA(I) element, or the name attribute in case no description can be found.\n */\n function getDADataDescription(element: Element): { label: string; } {\n const daElementName = element.getAttribute('name')!;\n const cdcName = element.closest('DOType')!.getAttribute('cdc');\n const serviceDataAttr = nsd81.querySelector(`ServiceCDCs > ServiceCDC[cdc=\"${cdcName}\"] > ServiceDataAttribute[name=\"${daElementName}\"]`);\n\n if (serviceDataAttr) {\n const id = serviceDataAttr?.getAttribute('descID') ??\n nsd81.querySelector(`ServiceConstructedAttributes > ServiceConstructedAttribute[name=\"${daElementName}\"]`)?.getAttribute('titleID') ?? '';\n return {\n label: getNsdocDocumentation(nsdoc81!, id) ?? daElementName\n };\n } else {\n const dataAttr = nsd73.querySelector(`NS > CDCs > CDC[name=\"${cdcName}\"] > DataAttribute[name=\"${daElementName}\"]`);\n return {\n label: getNsdocDocumentation(nsdoc73!, dataAttr?.getAttribute('descID')) ?? daElementName\n };\n }\n }\n\n /**\n * Getting data descriptions for BDA elements out of the IEC 61850-7-3 and IEC 61850-8-1 .nsdoc file.\n * @param element - The element to use for searching the BDA description.\n * @param ancestors - In this function, we need an ancestor to get a 'CDC' attribute.\n * @returns Documentation from the .nsdoc file for this BDA element, or the name attribute in case no description can be found.\n */\n function getBDADataDescription(element: Element, ancestors?: Element[]): { label: string; } {\n const bdaElementName = element.getAttribute('name')!;\n const daParent = ancestors?.filter(x => x.tagName === 'DA')[0];\n const serviceDataAttr = nsd81.querySelector(`ServiceConstructedAttributes > ServiceConstructedAttribute[name=\"${daParent!.getAttribute('name')}\"]`);\n\n if (serviceDataAttr) {\n if (serviceDataAttr.querySelector(`SubDataAttribute[name=\"${ancestors![0].getAttribute('name')}\"]`)?.getAttribute('type') == 'Originator') {\n const subDataAttr = nsd72.querySelector(`ConstructedAttributes > ConstructedAttribute[name=\"Originator\"] > SubDataAttribute[name=\"${bdaElementName}\"]`);\n return {\n label: getNsdocDocumentation(nsdoc72!, subDataAttr?.getAttribute('descID')) ?? bdaElementName\n };\n }\n return {\n label: getNsdocDocumentation(nsdoc81!,\n serviceDataAttr.querySelector(`SubDataAttribute[name=\"${bdaElementName}\"]`)?.getAttribute('descID')) ?? bdaElementName\n };\n } else {\n const dataAttrParent = nsd73.querySelector(`NS > CDCs > CDC[name=\"${daParent!.closest('DOType')?.getAttribute('cdc')}\"] >\n DataAttribute[name=\"${daParent!.getAttribute('name')}\"]`);\n return {\n label: getNsdocDocumentation(nsdoc73!, getSubDataAttribute(dataAttrParent!, bdaElementName)?.getAttribute('descID')) ?? bdaElementName\n };\n }\n }\n\n /**\n * Get the SubDataAttribute from the IEC-61850-7-3.\n * @param parent - The parent element in which to search for a SubDataAttribute.\n * @param bdaElementName - The name of the element to search.\n * @returns A SubDataAttribute, or null.\n */\n function getSubDataAttribute(parent: Element | undefined, bdaElementName: string): Element | null {\n if (!parent) return null;\n const subDataAttr = nsd73.querySelector(`ConstructedAttributes > ConstructedAttribute[name=\"${parent?.getAttribute('type')}\"] > SubDataAttribute[name=\"${bdaElementName}\"]`);\n return subDataAttr ?? getSubDataAttribute(nsd73.querySelector(`ConstructedAttributes > ConstructedAttribute[name=\"${parent?.getAttribute('type')}\"] > SubDataAttribute`)!, bdaElementName);\n }\n\n /**\n * Get the potential inherited data object based on a LNClass base.\n * @param lnClassBase - The base of a LNClass element.\n * @param doName - The name of the DO(I) to search for.\n * @returns the DataObject in case found, otherwise null.\n */\n function getInheritedDataObject(lnClassBase: string, doName: string): Element | null {\n if (!lnClassBase) return null;\n const lnClass = nsd74.querySelector(`NS > LNClasses > AbstractLNClass[name=\"${lnClassBase}\"]`);\n const base = lnClass?.getAttribute('base');\n\n return lnClass?.querySelector(`DataObject[name=\"${doName}\"]`) ?? getInheritedDataObject(base!, doName);\n }\n\n return {\n nsdoc72: nsdoc72,\n nsdoc73: nsdoc73,\n nsdoc74: nsdoc74,\n nsdoc81: nsdoc81,\n getDataDescription: function getDataDescription(element: Element, ancestors?: Element[]): { label: string; } {\n return getDataDescriptions[element.tagName as keyof Record<IEDElementTagNames,\n {\n getDataDescription: GetDataDescription;\n }\n >].getDataDescription(element, ancestors);\n }\n\n }\n}\n\n/**\n * Get the documentation from a given nsdoc file.\n * @param nsdoc - The .nsdoc file to use for searching\n * @param id - The id of the doc to search for.\n * @returns - The documentation belonging to the id.\n */\nfunction getNsdocDocumentation(nsdoc: XMLDocument, id: string | null | undefined): string | null | undefined {\n return nsdoc?.querySelector(`NSDoc > Doc[id=\"${id ?? ''}\"]`)?.textContent;\n}\n"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function existF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ACnC,MAAM,YAAY,GAAG,oBAAoB,CAAC,MAAM,CAAC,CAAC,IAAI,CACpD,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,YAAY,CAAC,IAAI,CAAC,KAAK,EAAE,CACnC,CAAC;IACF,IAAI,CAAC,OAAO,IAAI,YAAY;QAAE,OAAO,IAAI,CAAC;IAC1C,IAAI,CAAC,OAAO;QAAE,OAAO,KAAK,CAAC;IAE3B,IAAI,MAAM,GAAG,EAAE,CAAC;IAChB,KAAK,MAAM,UAAU,IAAI,OAAO,EAAE;QAChC,MAAM,GAAG,oBAAoB,CAAC,MAAM,CAAC,CAAC,IAAI,CACxC,KAAK,CAAC,EAAE,CAAC,KAAK,CAAC,YAAY,CAAC,MAAM,CAAC,KAAK,UAAU,CACnD,CAAC;QAEF,IAAI,MAAM,EAAE,YAAY,CAAC,IAAI,CAAC;YAAE,MAAM,GAAG,MAAM,CAAC,YAAY,CAAC,IAAI,CAAE,CAAC;QAEpE,IAAI,CAAC,MAAM;YAAE,OAAO,KAAK,CAAC;KAC3B;IAED,IAAI,MAAM,KAAK,EAAE;QAAE,OAAO,KAAK,CAAC;IAEhC,OAAO,IAAI,CAAC;AACd,CAAC","sourcesContent":["import { crossProduct } from '../foundation.js';\n\nfunction getDataModelChildren(parent: Element): Element[] {\n if (['LDevice', 'Server'].includes(parent.tagName))\n return Array.from(parent.children).filter(\n child =>\n child.tagName === 'LDevice' ||\n child.tagName === 'LN0' ||\n child.tagName === 'LN'\n );\n\n const id =\n parent.tagName === 'LN' || parent.tagName === 'LN0'\n ? parent.getAttribute('lnType')\n : parent.getAttribute('type');\n\n return Array.from(\n parent.ownerDocument.querySelectorAll(\n `LNodeType[id=\"${id}\"] > DO, DOType[id=\"${id}\"] > SDO, DOType[id=\"${id}\"] > DA, DAType[id=\"${id}\"] > BDA`\n )\n );\n}\n\nexport function existFcdaReference(fcda: Element, ied: Element): boolean {\n const [ldInst, prefix, lnClass, lnInst, doName, daName, fc] = [\n 'ldInst',\n 'prefix',\n 'lnClass',\n 'lnInst',\n 'doName',\n 'daName',\n 'fc',\n ].map(attr => fcda.getAttribute(attr));\n\n const sinkLdInst = ied.querySelector(`LDevice[inst=\"${ldInst}\"]`);\n if (!sinkLdInst) return false;\n\n const prefixSelctors = prefix\n ? [`[prefix=\"${prefix}\"]`]\n : ['[prefix=\"\"]', ':not([prefix])'];\n const lnInstSelectors = lnInst\n ? [`[inst=\"${lnInst}\"]`]\n : ['[inst=\"\"]', ':not([inst])'];\n\n const anyLnSelector = crossProduct(\n ['LN0', 'LN'],\n prefixSelctors,\n [`[lnClass=\"${lnClass}\"]`],\n lnInstSelectors\n )\n .map(strings => strings.join(''))\n .join(',');\n\n const sinkAnyLn = ied.querySelector(anyLnSelector);\n if (!sinkAnyLn) return false;\n\n const doNames = doName?.split('.');\n if (!doNames) return false;\n\n let parent: Element | undefined = sinkAnyLn;\n for (const doNameAttr of doNames) {\n parent = getDataModelChildren(parent).find(\n child => child.getAttribute('name') === doNameAttr\n );\n if (!parent) return false;\n }\n\n const daNames = daName?.split('.');\n const someFcInSink = getDataModelChildren(parent).some(\n da => da.getAttribute('fc') === fc\n );\n if (!daNames && someFcInSink) return true;\n if (!daNames) return false;\n\n let sinkFc = '';\n for (const daNameAttr of daNames) {\n parent = getDataModelChildren(parent).find(\n child => child.getAttribute('name') === daNameAttr\n );\n\n if (parent?.getAttribute('fc')) sinkFc = parent.getAttribute('fc')!;\n\n if (!parent) return false;\n }\n\n if (sinkFc !== fc) return false;\n\n return true;\n}\n"]}
|
|
@@ -0,0 +1,230 @@
|
|
|
1
|
+
import { LitElement, TemplateResult } from 'lit-element';
|
|
2
|
+
import { Part } from 'lit-html';
|
|
3
|
+
import { List } from '@material/mwc-list';
|
|
4
|
+
import { Select } from '@material/mwc-select';
|
|
5
|
+
import { TextField } from '@material/mwc-textfield';
|
|
6
|
+
import AceEditor from 'ace-custom-element';
|
|
7
|
+
import { WizardTextField } from './wizard-textfield.js';
|
|
8
|
+
import { WizardSelect } from './wizard-select.js';
|
|
9
|
+
import { EditorAction } from '@openscd/core/foundation/deprecated/editor.js';
|
|
10
|
+
export declare const wizardInputSelector = "wizard-textfield, mwc-textfield, ace-editor, mwc-select, wizard-select, wizard-checkbox";
|
|
11
|
+
export type WizardInputElement = WizardTextField | TextField | (AceEditor & {
|
|
12
|
+
checkValidity: () => boolean;
|
|
13
|
+
validityTransform: (newValue: string, nativeValidity: ValidityState) => ValidityState;
|
|
14
|
+
validationMessage: string;
|
|
15
|
+
validity: ValidityState;
|
|
16
|
+
label: string;
|
|
17
|
+
requestUpdate(name?: PropertyKey, oldValue?: unknown): Promise<unknown>;
|
|
18
|
+
}) | Select | WizardSelect;
|
|
19
|
+
export type WizardAction = EditorAction | WizardFactory;
|
|
20
|
+
/** @returns [[`EditorAction`]]s to dispatch on [[`WizardDialog`]] commit. */
|
|
21
|
+
export type WizardActor = (inputs: WizardInputElement[], wizard: Element, list?: List | null) => WizardAction[];
|
|
22
|
+
export declare function isWizardFactory(maybeFactory: WizardAction | Wizard | null): maybeFactory is WizardFactory;
|
|
23
|
+
/** @returns the validity of `input` depending on type. */
|
|
24
|
+
export declare function checkValidity(input: WizardInputElement): boolean;
|
|
25
|
+
/** reports the validity of `input` depending on type. */
|
|
26
|
+
export declare function reportValidity(input: WizardInputElement): boolean;
|
|
27
|
+
/** @returns the `value` or `maybeValue` of `input` depending on type. */
|
|
28
|
+
export declare function getValue(input: WizardInputElement): string | null;
|
|
29
|
+
/** @returns the `multiplier` of `input` if available. */
|
|
30
|
+
export declare function getMultiplier(input: WizardInputElement): string | null;
|
|
31
|
+
/** Inputs as `TextField`, `Select` or `Checkbox `used in`wizard-dialog` */
|
|
32
|
+
export type WizardInput = WizardInputTextField | WizardInputSelect | WizardInputCheckbox;
|
|
33
|
+
interface WizardInputBase {
|
|
34
|
+
/** maps attribute key */
|
|
35
|
+
label: string;
|
|
36
|
+
/** maps attribute value */
|
|
37
|
+
maybeValue: string | null;
|
|
38
|
+
/** whether attribute is optional */
|
|
39
|
+
nullable?: boolean;
|
|
40
|
+
/** whether the input shall be disabled */
|
|
41
|
+
disabled?: boolean;
|
|
42
|
+
/** helper text */
|
|
43
|
+
helper?: string;
|
|
44
|
+
/** initial focused element in `wizard-dialog` (once per dialog) */
|
|
45
|
+
dialogInitialFocus?: boolean;
|
|
46
|
+
}
|
|
47
|
+
interface WizardInputTextField extends WizardInputBase {
|
|
48
|
+
kind: 'TextField';
|
|
49
|
+
/** wether the input might be empty string */
|
|
50
|
+
required?: boolean;
|
|
51
|
+
/** pattern definition from schema */
|
|
52
|
+
pattern?: string;
|
|
53
|
+
/** minimal characters allowed */
|
|
54
|
+
minLength?: number;
|
|
55
|
+
/** maximal characters allowed */
|
|
56
|
+
maxLength?: number;
|
|
57
|
+
/** message text explaining invalid inputs */
|
|
58
|
+
validationMessage?: string;
|
|
59
|
+
/** suffix definition - overwrites unit multiplier definition */
|
|
60
|
+
suffix?: string;
|
|
61
|
+
/** SI unit for specific suffix definition */
|
|
62
|
+
unit?: string;
|
|
63
|
+
/** in comibination with unit defines specific suffix */
|
|
64
|
+
multiplier?: string | null;
|
|
65
|
+
/** array of multipliers allowed for the input */
|
|
66
|
+
multipliers?: (string | null)[];
|
|
67
|
+
/** used for specific input type e.g. number */
|
|
68
|
+
type?: string;
|
|
69
|
+
/** minimal valid number in combination with type number */
|
|
70
|
+
min?: number;
|
|
71
|
+
/** maximal valid number in combination with type number */
|
|
72
|
+
max?: number;
|
|
73
|
+
/** value displaxed when input is nulled */
|
|
74
|
+
default?: string;
|
|
75
|
+
}
|
|
76
|
+
interface WizardInputSelect extends WizardInputBase {
|
|
77
|
+
kind: 'Select';
|
|
78
|
+
/** selectabled values */
|
|
79
|
+
values: string[];
|
|
80
|
+
/** value displayed with input is nulled */
|
|
81
|
+
default?: string;
|
|
82
|
+
/** message explaining invalid inputs */
|
|
83
|
+
valadationMessage?: string;
|
|
84
|
+
}
|
|
85
|
+
interface WizardInputCheckbox extends WizardInputBase {
|
|
86
|
+
kind: 'Checkbox';
|
|
87
|
+
/** wether checkbox is checked with nulled input */
|
|
88
|
+
default?: boolean;
|
|
89
|
+
}
|
|
90
|
+
/** @returns [[`WizardAction`]]s to dispatch on [[`WizardDialog`]] menu action. */
|
|
91
|
+
export type WizardMenuActor = (wizard: Element) => void;
|
|
92
|
+
/** User interactions rendered in the wizard-dialog menu */
|
|
93
|
+
export interface MenuAction {
|
|
94
|
+
label: string;
|
|
95
|
+
icon?: string;
|
|
96
|
+
action: WizardMenuActor;
|
|
97
|
+
}
|
|
98
|
+
/** Represents a page of a wizard dialog */
|
|
99
|
+
export interface WizardPage {
|
|
100
|
+
title: string;
|
|
101
|
+
content?: (TemplateResult | WizardInput)[];
|
|
102
|
+
primary?: {
|
|
103
|
+
icon: string;
|
|
104
|
+
label: string;
|
|
105
|
+
action: WizardActor;
|
|
106
|
+
auto?: boolean;
|
|
107
|
+
};
|
|
108
|
+
secondary?: {
|
|
109
|
+
icon: string;
|
|
110
|
+
label: string;
|
|
111
|
+
action: WizardActor;
|
|
112
|
+
};
|
|
113
|
+
initial?: boolean;
|
|
114
|
+
element?: Element;
|
|
115
|
+
menuActions?: MenuAction[];
|
|
116
|
+
}
|
|
117
|
+
export type Wizard = WizardPage[];
|
|
118
|
+
export type WizardFactory = () => Wizard;
|
|
119
|
+
/** If `wizard === null`, close the current wizard, else queue `wizard`. */
|
|
120
|
+
export interface WizardDetail {
|
|
121
|
+
wizard: WizardFactory | null;
|
|
122
|
+
subwizard?: boolean;
|
|
123
|
+
}
|
|
124
|
+
export type WizardEvent = CustomEvent<WizardDetail>;
|
|
125
|
+
export declare function newWizardEvent(wizardOrFactory?: Wizard | WizardFactory, eventInitDict?: CustomEventInit<Partial<WizardDetail>>): WizardEvent;
|
|
126
|
+
export declare function newSubWizardEvent(wizardOrFactory?: Wizard | WizardFactory): WizardEvent;
|
|
127
|
+
/** @returns a reference to `element` with segments delimited by '/'. */
|
|
128
|
+
export declare function referencePath(element: Element): string;
|
|
129
|
+
export type SclEdition = '2003' | '2007B' | '2007B4';
|
|
130
|
+
export declare function getSclSchemaVersion(doc: Document): SclEdition;
|
|
131
|
+
/**
|
|
132
|
+
* Extract the 'name' attribute from the given XML element.
|
|
133
|
+
* @param element - The element to extract name from.
|
|
134
|
+
* @returns the name, or undefined if there is no name.
|
|
135
|
+
*/
|
|
136
|
+
export declare function getNameAttribute(element: Element): string | undefined;
|
|
137
|
+
/**
|
|
138
|
+
* Extract the 'ldName' attribute from the given XML element.
|
|
139
|
+
* @param element - The element to extract ldName from.
|
|
140
|
+
* @returns the ldName, or undefined if there is no ldName.
|
|
141
|
+
*/
|
|
142
|
+
export declare function getLdNameAttribute(element: Element): string | undefined;
|
|
143
|
+
/**
|
|
144
|
+
* Extract the 'desc' attribute from the given XML element.
|
|
145
|
+
* @param element - The element to extract description from.
|
|
146
|
+
* @returns the name, or undefined if there is no description.
|
|
147
|
+
*/
|
|
148
|
+
export declare function getDescriptionAttribute(element: Element): string | undefined;
|
|
149
|
+
/**
|
|
150
|
+
* Extract the 'pathName' attribute from the given XML element.
|
|
151
|
+
* @param element - The element to extract path name from.
|
|
152
|
+
* @returns the name, or undefined if there is no path name.
|
|
153
|
+
*/
|
|
154
|
+
export declare function getPathNameAttribute(element: Element): string | undefined;
|
|
155
|
+
/**
|
|
156
|
+
* Extract the 'inst' attribute from the given XML element.
|
|
157
|
+
* @param element - The element to extract instance from.
|
|
158
|
+
* @returns the instance, or undefined if there is no instance.
|
|
159
|
+
*/
|
|
160
|
+
export declare function getInstanceAttribute(element: Element): string | undefined;
|
|
161
|
+
export declare function pathParts(identity: string): [string, string];
|
|
162
|
+
type IdentityFunction = (e: Element) => string | number;
|
|
163
|
+
type SelectorFunction = (tagName: SCLTag, identity: string) => string;
|
|
164
|
+
declare const sCLTags: readonly ["SCL", "SubNetwork", "GOOSESecurity", "SMVSecurity", "ConnectivityNode", "SubFunction", "Function", "TapChanger", "SubEquipment", "GeneralEquipment", "PowerTransformer", "TransformerWinding", "ConductingEquipment", "Substation", "VoltageLevel", "Bay", "Process", "Line", "EqSubFunction", "EqFunction", "ConnectedAP", "PhysConn", "SDO", "DO", "DAI", "SDI", "DOI", "Inputs", "RptEnabled", "Server", "ServerAt", "SettingControl", "Communication", "Log", "LDevice", "DataSet", "AccessPoint", "IED", "NeutralPoint", "SampledValueControl", "GSEControl", "LogControl", "ReportControl", "GSE", "SMV", "BDA", "DA", "LNodeType", "DOType", "DAType", "EnumType", "Text", "Private", "Hitem", "AccessControl", "Header", "LNode", "Val", "Voltage", "Services", "Subject", "IssuerName", "MinTime", "MaxTime", "Association", "FCDA", "ClientLN", "IEDName", "ExtRef", "Protocol", "LN0", "LN", "FileHandling", "TimeSyncProt", "CommProt", "SGEdit", "ConfSG", "GetDirectory", "GetDataObjectDefinition", "DataObjectDirectory", "GetDataSetValue", "SetDataSetValue", "DataSetDirectory", "ReadWrite", "TimerActivatedControl", "GetCBValues", "GSEDir", "ConfLdName", "DynAssociation", "SettingGroups", "GSSE", "GOOSE", "ConfReportControl", "SMVsc", "DynDataSet", "ConfDataSet", "ConfLogControl", "ConfSigRef", "ReportSettings", "LogSettings", "GSESettings", "SMVSettings", "ConfLNs", "ClientServices", "SupSubscription", "ValueHandling", "RedProt", "McSecurity", "KDC", "Address", "P", "ProtNs", "EnumVal", "Terminal", "BitRate", "Authentication", "DataTypeTemplates", "History", "OptFields", "SmvOpts", "TrgOps", "SamplesPerSec", "SmpRate", "SecPerSamples"];
|
|
165
|
+
export type SCLTag = (typeof sCLTags)[number];
|
|
166
|
+
export declare const tags: Record<SCLTag, {
|
|
167
|
+
identity: IdentityFunction;
|
|
168
|
+
selector: SelectorFunction;
|
|
169
|
+
parents: SCLTag[];
|
|
170
|
+
children: SCLTag[];
|
|
171
|
+
}>;
|
|
172
|
+
export declare function getReference(parent: Element, tag: SCLTag): Element | null;
|
|
173
|
+
export declare function find(root: XMLDocument | Element | DocumentFragment, tagName: string, identity: string | number): Element | null;
|
|
174
|
+
/** @returns a string uniquely identifying `e` in its document, or NaN if `e`
|
|
175
|
+
* is unidentifiable. */
|
|
176
|
+
export declare function identity(e: Element | null): string | number;
|
|
177
|
+
/** @returns whether `a` and `b` are considered identical by IEC-61850 */
|
|
178
|
+
export declare function isSame(a: Element, b: Element): boolean;
|
|
179
|
+
export declare function isEqual(a: Element, b: Element): boolean;
|
|
180
|
+
/** A directive rendering its argument `rendered` only if `rendered !== {}`. */
|
|
181
|
+
export declare const ifImplemented: (rendered: any) => (part: Part) => void;
|
|
182
|
+
/** Constructor type for defining `LitElement` mixins. */
|
|
183
|
+
export type LitElementConstructor = new (...args: any[]) => LitElement;
|
|
184
|
+
/** The type returned by `MyMixin(...)` is `Mixin<typeof MyMixin>`. */
|
|
185
|
+
export type Mixin<T extends (...args: any[]) => any> = InstanceType<ReturnType<T>>;
|
|
186
|
+
export declare const patterns: {
|
|
187
|
+
string: string;
|
|
188
|
+
normalizedString: string;
|
|
189
|
+
name: string;
|
|
190
|
+
nmToken: string;
|
|
191
|
+
names: string;
|
|
192
|
+
nmTokens: string;
|
|
193
|
+
decimal: string;
|
|
194
|
+
unsigned: string;
|
|
195
|
+
integer: string;
|
|
196
|
+
alphanumericFirstUpperCase: string;
|
|
197
|
+
alphanumericFirstLowerCase: string;
|
|
198
|
+
lnClass: string;
|
|
199
|
+
};
|
|
200
|
+
/** Sorts selected `ListItem`s to the top and disabled ones to the bottom. */
|
|
201
|
+
export declare function compareNames(a: Element | string, b: Element | string): number;
|
|
202
|
+
/** @returns the cartesian product of `arrays` */
|
|
203
|
+
export declare function crossProduct<T>(...arrays: T[][]): T[][];
|
|
204
|
+
/** @returns the depth of `t` if it is an object or array, zero otherwise. */
|
|
205
|
+
export declare function depth(t: Record<string, unknown>, mem?: WeakSet<object>): number;
|
|
206
|
+
export declare function findFCDAs(extRef: Element): Element[];
|
|
207
|
+
export declare function findControlBlocks(extRef: Element): Set<Element>;
|
|
208
|
+
export declare function isPublic(element: Element): boolean;
|
|
209
|
+
/** @returns the version of the SCL project */
|
|
210
|
+
export declare function getVersion(element: Element): string;
|
|
211
|
+
/**
|
|
212
|
+
* @param parent - The LNodes' parent element to be scanned once for `lnInst`
|
|
213
|
+
* values already in use. Be sure to create a new generator every time the
|
|
214
|
+
* children of this element change.
|
|
215
|
+
* @returns a function generating increasing unused `lnInst` values for
|
|
216
|
+
* `lnClass` LNodes within `parent` on subsequent invocations
|
|
217
|
+
*/
|
|
218
|
+
export declare function newLnInstGenerator(parent: Element): (lnClass: string) => string | undefined;
|
|
219
|
+
/**
|
|
220
|
+
* @param lnElements - The LN elements to be scanned for `inst`
|
|
221
|
+
* values already in use.
|
|
222
|
+
* @returns first available inst value for LN or undefined if no inst is available
|
|
223
|
+
*/
|
|
224
|
+
export declare function minAvailableLogicalNodeInstance(lnElements: Element[]): string | undefined;
|
|
225
|
+
declare global {
|
|
226
|
+
interface ElementEventMap {
|
|
227
|
+
['wizard']: WizardEvent;
|
|
228
|
+
}
|
|
229
|
+
}
|
|
230
|
+
export {};
|