@compas-oscd/open-scd 0.34.1 → 0.34.2

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 (187) hide show
  1. package/dist/WizardDivider.d.ts +8 -0
  2. package/dist/Wizarding.d.ts +10 -0
  3. package/dist/Wizarding.js.map +1 -1
  4. package/dist/action-icon.d.ts +25 -0
  5. package/dist/action-pane.d.ts +25 -0
  6. package/dist/addons/Editor.d.ts +25 -0
  7. package/dist/addons/History.d.ts +86 -0
  8. package/dist/addons/Layout.d.ts +96 -0
  9. package/dist/addons/Settings.d.ts +68 -0
  10. package/dist/addons/Waiter.d.ts +14 -0
  11. package/dist/addons/Wizards.d.ts +15 -0
  12. package/dist/addons/editor/edit-action-to-v1-converter.d.ts +3 -0
  13. package/dist/addons/editor/edit-v1-to-v2-converter.d.ts +2 -0
  14. package/dist/addons/history/get-log-text.d.ts +5 -0
  15. package/dist/addons/menu-tabs/menu-tabs.d.ts +22 -0
  16. package/dist/addons/plugin-manager/custom-plugin-dialog.d.ts +28 -0
  17. package/dist/addons/plugin-manager/plugin-manager.d.ts +20 -0
  18. package/dist/filtered-list.d.ts +27 -0
  19. package/dist/finder-list.d.ts +37 -0
  20. package/dist/foundation/compare.d.ts +79 -0
  21. package/dist/foundation/dai.d.ts +30 -0
  22. package/dist/foundation/generators.d.ts +13 -0
  23. package/dist/foundation/ied.d.ts +22 -0
  24. package/dist/foundation/nsd.d.ts +4 -0
  25. package/dist/foundation/nsdoc.d.ts +14 -0
  26. package/dist/foundation/scl.d.ts +1 -0
  27. package/dist/foundation.d.ts +230 -0
  28. package/dist/icons/compare.d.ts +3 -0
  29. package/dist/icons/icons.d.ts +41 -0
  30. package/dist/icons/ied-icons.d.ts +3 -0
  31. package/dist/icons/lnode.d.ts +16 -0
  32. package/dist/open-scd.d.ts +131 -0
  33. package/dist/oscd-filter-button.d.ts +27 -0
  34. package/dist/plain-compare-list.d.ts +36 -0
  35. package/dist/plugin-tag.d.ts +6 -0
  36. package/dist/plugin.d.ts +23 -0
  37. package/dist/plugin.events.d.ts +15 -0
  38. package/dist/plugins.d.ts +3 -0
  39. package/dist/schemas.d.ts +58 -0
  40. package/dist/themes.d.ts +3 -0
  41. package/dist/translations/de.d.ts +2 -0
  42. package/dist/translations/en.d.ts +963 -0
  43. package/dist/translations/loader.d.ts +12 -0
  44. package/dist/wizard-checkbox.d.ts +37 -0
  45. package/dist/wizard-dialog.d.ts +45 -0
  46. package/dist/wizard-select.d.ts +31 -0
  47. package/dist/wizard-textfield.d.ts +50 -0
  48. package/dist/wizards.d.ts +23 -0
  49. package/package.json +1 -1
  50. package/dist/core/api/api.js +0 -7
  51. package/dist/core/api/api.js.map +0 -1
  52. package/dist/core/api/editor/subject.js +0 -22
  53. package/dist/core/api/editor/subject.js.map +0 -1
  54. package/dist/core/api/editor/xml-editor.js +0 -82
  55. package/dist/core/api/editor/xml-editor.js.map +0 -1
  56. package/dist/core/api/plugin-state-api.js +0 -27
  57. package/dist/core/api/plugin-state-api.js.map +0 -1
  58. package/dist/core/foundation/cyrb64.js +0 -26
  59. package/dist/core/foundation/cyrb64.js.map +0 -1
  60. package/dist/core/foundation/deprecated/edit-event.js +0 -44
  61. package/dist/core/foundation/deprecated/edit-event.js.map +0 -1
  62. package/dist/core/foundation/deprecated/editor.js +0 -94
  63. package/dist/core/foundation/deprecated/editor.js.map +0 -1
  64. package/dist/core/foundation/deprecated/history.js +0 -17
  65. package/dist/core/foundation/deprecated/history.js.map +0 -1
  66. package/dist/core/foundation/deprecated/open-event.js +0 -9
  67. package/dist/core/foundation/deprecated/open-event.js.map +0 -1
  68. package/dist/core/foundation/deprecated/settings.js +0 -19
  69. package/dist/core/foundation/deprecated/settings.js.map +0 -1
  70. package/dist/core/foundation/deprecated/validation.js +0 -8
  71. package/dist/core/foundation/deprecated/validation.js.map +0 -1
  72. package/dist/core/foundation/deprecated/waiter.js +0 -12
  73. package/dist/core/foundation/deprecated/waiter.js.map +0 -1
  74. package/dist/core/foundation/edit-completed-event.js +0 -11
  75. package/dist/core/foundation/edit-completed-event.js.map +0 -1
  76. package/dist/core/foundation/edit-event.js +0 -8
  77. package/dist/core/foundation/edit-event.js.map +0 -1
  78. package/dist/core/foundation/edit.js +0 -31
  79. package/dist/core/foundation/edit.js.map +0 -1
  80. package/dist/core/foundation/handle-edit.js +0 -151
  81. package/dist/core/foundation/handle-edit.js.map +0 -1
  82. package/dist/core/foundation/open-event.js +0 -8
  83. package/dist/core/foundation/open-event.js.map +0 -1
  84. package/dist/core/foundation/plugin.js +0 -2
  85. package/dist/core/foundation/plugin.js.map +0 -1
  86. package/dist/core/foundation.js +0 -14
  87. package/dist/core/foundation.js.map +0 -1
  88. package/dist/core/locales.js +0 -21
  89. package/dist/core/locales.js.map +0 -1
  90. package/dist/openscd/src/WizardDivider.js +0 -37
  91. package/dist/openscd/src/WizardDivider.js.map +0 -1
  92. package/dist/openscd/src/Wizarding.js +0 -38
  93. package/dist/openscd/src/Wizarding.js.map +0 -1
  94. package/dist/openscd/src/action-icon.js +0 -220
  95. package/dist/openscd/src/action-icon.js.map +0 -1
  96. package/dist/openscd/src/action-pane.js +0 -176
  97. package/dist/openscd/src/action-pane.js.map +0 -1
  98. package/dist/openscd/src/addons/Editor.js +0 -106
  99. package/dist/openscd/src/addons/Editor.js.map +0 -1
  100. package/dist/openscd/src/addons/History.js +0 -490
  101. package/dist/openscd/src/addons/History.js.map +0 -1
  102. package/dist/openscd/src/addons/Layout.js +0 -619
  103. package/dist/openscd/src/addons/Layout.js.map +0 -1
  104. package/dist/openscd/src/addons/Settings.js +0 -465
  105. package/dist/openscd/src/addons/Settings.js.map +0 -1
  106. package/dist/openscd/src/addons/Waiter.js +0 -45
  107. package/dist/openscd/src/addons/Waiter.js.map +0 -1
  108. package/dist/openscd/src/addons/Wizards.js +0 -48
  109. package/dist/openscd/src/addons/Wizards.js.map +0 -1
  110. package/dist/openscd/src/addons/editor/edit-action-to-v1-converter.js +0 -96
  111. package/dist/openscd/src/addons/editor/edit-action-to-v1-converter.js.map +0 -1
  112. package/dist/openscd/src/addons/editor/edit-v1-to-v2-converter.js +0 -37
  113. package/dist/openscd/src/addons/editor/edit-v1-to-v2-converter.js.map +0 -1
  114. package/dist/openscd/src/addons/history/get-log-text.js +0 -26
  115. package/dist/openscd/src/addons/history/get-log-text.js.map +0 -1
  116. package/dist/openscd/src/addons/menu-tabs/menu-tabs.js +0 -74
  117. package/dist/openscd/src/addons/menu-tabs/menu-tabs.js.map +0 -1
  118. package/dist/openscd/src/addons/plugin-manager/custom-plugin-dialog.js +0 -177
  119. package/dist/openscd/src/addons/plugin-manager/custom-plugin-dialog.js.map +0 -1
  120. package/dist/openscd/src/addons/plugin-manager/plugin-manager.js +0 -165
  121. package/dist/openscd/src/addons/plugin-manager/plugin-manager.js.map +0 -1
  122. package/dist/openscd/src/filtered-list.js +0 -168
  123. package/dist/openscd/src/filtered-list.js.map +0 -1
  124. package/dist/openscd/src/finder-list.js +0 -207
  125. package/dist/openscd/src/finder-list.js.map +0 -1
  126. package/dist/openscd/src/foundation/compare.js +0 -273
  127. package/dist/openscd/src/foundation/compare.js.map +0 -1
  128. package/dist/openscd/src/foundation/dai.js +0 -127
  129. package/dist/openscd/src/foundation/dai.js.map +0 -1
  130. package/dist/openscd/src/foundation/generators.js +0 -67
  131. package/dist/openscd/src/foundation/generators.js.map +0 -1
  132. package/dist/openscd/src/foundation/ied.js +0 -84
  133. package/dist/openscd/src/foundation/ied.js.map +0 -1
  134. package/dist/openscd/src/foundation/nsd.js +0 -13
  135. package/dist/openscd/src/foundation/nsd.js.map +0 -1
  136. package/dist/openscd/src/foundation/nsdoc.js +0 -180
  137. package/dist/openscd/src/foundation/nsdoc.js.map +0 -1
  138. package/dist/openscd/src/foundation/scl.js +0 -64
  139. package/dist/openscd/src/foundation/scl.js.map +0 -1
  140. package/dist/openscd/src/foundation.js +0 -1922
  141. package/dist/openscd/src/foundation.js.map +0 -1
  142. package/dist/openscd/src/icons/compare.js +0 -11
  143. package/dist/openscd/src/icons/compare.js.map +0 -1
  144. package/dist/openscd/src/icons/icons.js +0 -611
  145. package/dist/openscd/src/icons/icons.js.map +0 -1
  146. package/dist/openscd/src/icons/ied-icons.js +0 -11
  147. package/dist/openscd/src/icons/ied-icons.js.map +0 -1
  148. package/dist/openscd/src/icons/lnode.js +0 -50
  149. package/dist/openscd/src/icons/lnode.js.map +0 -1
  150. package/dist/openscd/src/open-scd.js +0 -483
  151. package/dist/openscd/src/open-scd.js.map +0 -1
  152. package/dist/openscd/src/oscd-filter-button.js +0 -89
  153. package/dist/openscd/src/oscd-filter-button.js.map +0 -1
  154. package/dist/openscd/src/plain-compare-list.js +0 -132
  155. package/dist/openscd/src/plain-compare-list.js.map +0 -1
  156. package/dist/openscd/src/plugin-tag.js +0 -23
  157. package/dist/openscd/src/plugin-tag.js.map +0 -1
  158. package/dist/openscd/src/plugin.events.js +0 -12
  159. package/dist/openscd/src/plugin.events.js.map +0 -1
  160. package/dist/openscd/src/plugin.js +0 -2
  161. package/dist/openscd/src/plugin.js.map +0 -1
  162. package/dist/openscd/src/plugins.js +0 -256
  163. package/dist/openscd/src/plugins.js.map +0 -1
  164. package/dist/openscd/src/schemas.js +0 -9325
  165. package/dist/openscd/src/schemas.js.map +0 -1
  166. package/dist/openscd/src/themes.js +0 -122
  167. package/dist/openscd/src/themes.js.map +0 -1
  168. package/dist/openscd/src/translations/de.js +0 -954
  169. package/dist/openscd/src/translations/de.js.map +0 -1
  170. package/dist/openscd/src/translations/en.js +0 -950
  171. package/dist/openscd/src/translations/en.js.map +0 -1
  172. package/dist/openscd/src/translations/loader.js +0 -10
  173. package/dist/openscd/src/translations/loader.js.map +0 -1
  174. package/dist/openscd/src/wizard-checkbox.js +0 -152
  175. package/dist/openscd/src/wizard-checkbox.js.map +0 -1
  176. package/dist/openscd/src/wizard-dialog.js +0 -374
  177. package/dist/openscd/src/wizard-dialog.js.map +0 -1
  178. package/dist/openscd/src/wizard-select.js +0 -115
  179. package/dist/openscd/src/wizard-select.js.map +0 -1
  180. package/dist/openscd/src/wizard-textfield.js +0 -191
  181. package/dist/openscd/src/wizard-textfield.js.map +0 -1
  182. package/dist/openscd/src/wizards.js +0 -196
  183. package/dist/openscd/src/wizards.js.map +0 -1
  184. package/dist/xml/src/foundation.js +0 -67
  185. package/dist/xml/src/foundation.js.map +0 -1
  186. package/dist/xml/src/index.js +0 -2
  187. package/dist/xml/src/index.js.map +0 -1
@@ -1,19 +0,0 @@
1
- export function newLoadNsdocEvent(nsdoc, filename) {
2
- return new CustomEvent('load-nsdoc', {
3
- bubbles: true,
4
- composed: true,
5
- detail: { nsdoc, filename },
6
- });
7
- }
8
- export function newSettingsUIEvent(show, eventInitDict) {
9
- return new CustomEvent('oscd-settings', {
10
- bubbles: true,
11
- composed: true,
12
- ...eventInitDict,
13
- detail: {
14
- show,
15
- ...eventInitDict?.detail,
16
- },
17
- });
18
- }
19
- //# sourceMappingURL=settings.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"settings.js","sourceRoot":"","sources":["../../../../../core/foundation/deprecated/settings.ts"],"names":[],"mappings":"AAgCA,MAAM,UAAU,iBAAiB,CAC/B,KAAa,EACb,QAAgB;IAEhB,OAAO,IAAI,WAAW,CAAkB,YAAY,EAAE;QACpD,OAAO,EAAE,IAAI;QACb,QAAQ,EAAE,IAAI;QACd,MAAM,EAAE,EAAE,KAAK,EAAE,QAAQ,EAAE;KAC5B,CAAC,CAAC;AACL,CAAC;AAQD,MAAM,UAAU,kBAAkB,CAChC,IAAa,EACb,aAA0D;IAE1D,OAAO,IAAI,WAAW,CAAmB,eAAe,EAAE;QACxD,OAAO,EAAE,IAAI;QACb,QAAQ,EAAE,IAAI;QACd,GAAG,aAAa;QAChB,MAAM,EAAE;YACN,IAAI;YACJ,GAAG,aAAa,EAAE,MAAM;SACzB;KACF,CAAC,CAAC;AACL,CAAC","sourcesContent":["export type Language = 'en' | 'de';\n\nexport type Settings = {\n language: Language;\n theme: 'light' | 'dark';\n mode: 'safe' | 'pro';\n showieds: 'on' | 'off';\n 'IEC 61850-7-2': string | undefined;\n 'IEC 61850-7-3': string | undefined;\n 'IEC 61850-7-4': string | undefined;\n 'IEC 61850-8-1': string | undefined;\n};\n\nexport type NsdVersion = {\n version: string | undefined;\n revision: string | undefined;\n release: string | undefined;\n};\n\nexport type NsdVersions = {\n 'IEC 61850-7-2': NsdVersion;\n 'IEC 61850-7-3': NsdVersion;\n 'IEC 61850-7-4': NsdVersion;\n 'IEC 61850-8-1': NsdVersion;\n};\n\n/** Represents a document to be opened. */\nexport interface LoadNsdocDetail {\n nsdoc: string;\n filename: string;\n}\nexport type LoadNsdocEvent = CustomEvent<LoadNsdocDetail>;\nexport function newLoadNsdocEvent(\n nsdoc: string,\n filename: string\n): LoadNsdocEvent {\n return new CustomEvent<LoadNsdocDetail>('load-nsdoc', {\n bubbles: true,\n composed: true,\n detail: { nsdoc, filename },\n });\n}\n\nexport interface SettingsUIDetail {\n show: boolean;\n}\n\nexport type SettingsUIEvent = CustomEvent<SettingsUIDetail>;\n\nexport function newSettingsUIEvent(\n show: boolean,\n eventInitDict?: CustomEventInit<Partial<SettingsUIDetail>>\n): SettingsUIEvent {\n return new CustomEvent<SettingsUIDetail>('oscd-settings', {\n bubbles: true,\n composed: true,\n ...eventInitDict,\n detail: {\n show,\n ...eventInitDict?.detail,\n },\n });\n}\n\n\ndeclare global {\n interface ElementEventMap {\n ['oscd-settings']: SettingsUIEvent;\n }\n}\n"]}
@@ -1,8 +0,0 @@
1
- export function newValidateEvent(eventInitDict) {
2
- return new CustomEvent('validate', {
3
- bubbles: true,
4
- composed: true,
5
- ...eventInitDict,
6
- });
7
- }
8
- //# sourceMappingURL=validation.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"validation.js","sourceRoot":"","sources":["../../../../../core/foundation/deprecated/validation.ts"],"names":[],"mappings":"AAEA,MAAM,UAAU,gBAAgB,CAC9B,aAAqC;IAErC,OAAO,IAAI,WAAW,CAAO,UAAU,EAAE;QACvC,OAAO,EAAE,IAAI;QACb,QAAQ,EAAE,IAAI;QACd,GAAG,aAAa;KACjB,CAAC,CAAC;AACL,CAAC","sourcesContent":["/** Represents a request for validation. */\nexport type ValidateEvent = CustomEvent<void>;\nexport function newValidateEvent(\n eventInitDict?: CustomEventInit<void>\n): ValidateEvent {\n return new CustomEvent<void>('validate', {\n bubbles: true,\n composed: true,\n ...eventInitDict,\n });\n}\n\n\ndeclare global {\n interface ElementEventMap {\n ['validate']: ValidateEvent;\n }\n }\n "]}
@@ -1,12 +0,0 @@
1
- /**
2
- * @deprecated
3
- */
4
- export function newPendingStateEvent(promise, eventInitDict) {
5
- return new CustomEvent('pending-state', {
6
- bubbles: true,
7
- composed: true,
8
- ...eventInitDict,
9
- detail: { promise, ...eventInitDict?.detail },
10
- });
11
- }
12
- //# sourceMappingURL=waiter.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"waiter.js","sourceRoot":"","sources":["../../../../../core/foundation/deprecated/waiter.ts"],"names":[],"mappings":"AAMA;;GAEG;AACH,MAAM,UAAU,oBAAoB,CAClC,OAAsB,EACtB,aAA4D;IAE5D,OAAO,IAAI,WAAW,CAAqB,eAAe,EAAE;QAC1D,OAAO,EAAE,IAAI;QACb,QAAQ,EAAE,IAAI;QACd,GAAG,aAAa;QAChB,MAAM,EAAE,EAAE,OAAO,EAAE,GAAG,aAAa,EAAE,MAAM,EAAE;KAC9C,CAAC,CAAC;AACL,CAAC","sourcesContent":["/** Represents some work pending completion, upon which `promise` resolves. */\nexport interface PendingStateDetail {\n promise: Promise<void>;\n}\nexport type PendingStateEvent = CustomEvent<PendingStateDetail>;\n\n/**\n * @deprecated\n */\nexport function newPendingStateEvent(\n promise: Promise<void>,\n eventInitDict?: CustomEventInit<Partial<PendingStateDetail>>\n): PendingStateEvent {\n return new CustomEvent<PendingStateDetail>('pending-state', {\n bubbles: true,\n composed: true,\n ...eventInitDict,\n detail: { promise, ...eventInitDict?.detail },\n });\n}\n\ndeclare global {\n interface ElementEventMap {\n ['pending-state']: PendingStateEvent;\n }\n}\n"]}
@@ -1,11 +0,0 @@
1
- export function newEditCompletedEvent(edit, initiator = 'user') {
2
- return new CustomEvent('oscd-edit-completed', {
3
- bubbles: true,
4
- composed: true,
5
- detail: {
6
- edit: edit,
7
- initiator: initiator,
8
- },
9
- });
10
- }
11
- //# sourceMappingURL=edit-completed-event.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"edit-completed-event.js","sourceRoot":"","sources":["../../../../core/foundation/edit-completed-event.ts"],"names":[],"mappings":"AAYA,MAAM,UAAU,qBAAqB,CACnC,IAAyB,EACzB,YAAuB,MAAM;IAE7B,OAAO,IAAI,WAAW,CAAsB,qBAAqB,EAAE;QACjE,OAAO,EAAE,IAAI;QACb,QAAQ,EAAE,IAAI;QACd,MAAM,EAAE;YACN,IAAI,EAAE,IAAI;YACV,SAAS,EAAE,SAAS;SACrB;KACF,CAAC,CAAC;AACL,CAAC","sourcesContent":["import { Edit, Initiator } from './deprecated/edit-event.js';\n\nimport { EditorAction } from './deprecated/editor.js';\n\nexport type EditCompletedDetail = {\n edit: Edit | EditorAction;\n initiator: Initiator;\n};\n\n/** Represents the intent to open `doc` with filename `docName`. */\nexport type EditCompletedEvent = CustomEvent<EditCompletedDetail>;\n\nexport function newEditCompletedEvent(\n edit: Edit | EditorAction,\n initiator: Initiator = 'user'\n): EditCompletedEvent {\n return new CustomEvent<EditCompletedDetail>('oscd-edit-completed', {\n bubbles: true,\n composed: true,\n detail: {\n edit: edit,\n initiator: initiator,\n },\n });\n}\n\ndeclare global {\n interface ElementEventMap {\n ['oscd-edit-completed']: EditCompletedEvent;\n }\n}\n"]}
@@ -1,8 +0,0 @@
1
- export function newEditEventV2(edit, options) {
2
- return new CustomEvent('oscd-edit-v2', {
3
- composed: true,
4
- bubbles: true,
5
- detail: { ...options, edit },
6
- });
7
- }
8
- //# sourceMappingURL=edit-event.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"edit-event.js","sourceRoot":"","sources":["../../../../core/foundation/edit-event.ts"],"names":[],"mappings":"AAmBA,MAAM,UAAU,cAAc,CAC5B,IAAO,EACP,OAA4B;IAE5B,OAAO,IAAI,WAAW,CAAkB,cAAc,EAAE;QACtD,QAAQ,EAAE,IAAI;QACd,OAAO,EAAE,IAAI;QACb,MAAM,EAAE,EAAE,GAAG,OAAO,EAAE,IAAI,EAAE;KAC7B,CAAC,CAAC;AACL,CAAC","sourcesContent":["import { EditV2 } from './edit.js';\n\nexport type EditDetailV2<E extends EditV2 = EditV2> = EditEventOptionsV2 & {\n edit: E;\n};\n\nexport type EditEventV2<E extends EditV2 = EditV2> = CustomEvent<\n EditDetailV2<E>\n>;\n\ntype BaseEditEventOptionsV2 = {\n title?: string;\n squash?: boolean;\n}\n\nexport type EditEventOptionsV2 = BaseEditEventOptionsV2 & {\n createHistoryEntry?: boolean;\n};\n\nexport function newEditEventV2<E extends EditV2>(\n edit: E,\n options?: EditEventOptionsV2\n): EditEventV2<E> {\n return new CustomEvent<EditDetailV2<E>>('oscd-edit-v2', {\n composed: true,\n bubbles: true,\n detail: { ...options, edit },\n });\n}\n\ndeclare global {\n interface ElementEventMap {\n ['oscd-edit-v2']: EditEventV2;\n }\n}\n"]}
@@ -1,31 +0,0 @@
1
- export function isComplexV2(edit) {
2
- return edit instanceof Array;
3
- }
4
- export function isSetTextContentV2(edit) {
5
- return (edit.element !== undefined &&
6
- edit.textContent !== undefined);
7
- }
8
- export function isRemoveV2(edit) {
9
- return (edit.parent === undefined && edit.node !== undefined);
10
- }
11
- export function isSetAttributesV2(edit) {
12
- return (edit.element !== undefined &&
13
- edit.attributes !== undefined &&
14
- edit.attributesNS !== undefined);
15
- }
16
- export function isInsertV2(edit) {
17
- return (edit.parent !== undefined &&
18
- edit.node !== undefined &&
19
- edit.reference !== undefined);
20
- }
21
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
22
- export function isEditV2(edit) {
23
- if (isComplexV2(edit)) {
24
- return !edit.some((e) => !isEditV2(e));
25
- }
26
- return (isSetAttributesV2(edit) ||
27
- isSetTextContentV2(edit) ||
28
- isInsertV2(edit) ||
29
- isRemoveV2(edit));
30
- }
31
- //# sourceMappingURL=edit.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"edit.js","sourceRoot":"","sources":["../../../../core/foundation/edit.ts"],"names":[],"mappings":"AAiCA,MAAM,UAAU,WAAW,CAAC,IAAY;IACtC,OAAO,IAAI,YAAY,KAAK,CAAC;AAC/B,CAAC;AAED,MAAM,UAAU,kBAAkB,CAAC,IAAY;IAC7C,OAAO,CACJ,IAAyB,CAAC,OAAO,KAAK,SAAS;QAC/C,IAAyB,CAAC,WAAW,KAAK,SAAS,CACrD,CAAC;AACJ,CAAC;AAED,MAAM,UAAU,UAAU,CAAC,IAAY;IACrC,OAAO,CACJ,IAAiB,CAAC,MAAM,KAAK,SAAS,IAAK,IAAiB,CAAC,IAAI,KAAK,SAAS,CACjF,CAAC;AACJ,CAAC;AAED,MAAM,UAAU,iBAAiB,CAAC,IAAY;IAC5C,OAAO,CACJ,IAAwB,CAAC,OAAO,KAAK,SAAS;QAC9C,IAAwB,CAAC,UAAU,KAAK,SAAS;QACjD,IAAwB,CAAC,YAAY,KAAK,SAAS,CACrD,CAAC;AACJ,CAAC;AAED,MAAM,UAAU,UAAU,CAAC,IAAY;IACrC,OAAO,CACJ,IAAiB,CAAC,MAAM,KAAK,SAAS;QACtC,IAAiB,CAAC,IAAI,KAAK,SAAS;QACpC,IAAiB,CAAC,SAAS,KAAK,SAAS,CAC3C,CAAC;AACJ,CAAC;AAED,8DAA8D;AAC9D,MAAM,UAAU,QAAQ,CAAC,IAAS;IAChC,IAAI,WAAW,CAAC,IAAI,CAAC,EAAE;QACrB,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,CAAC;KACxC;IAED,OAAO,CACL,iBAAiB,CAAC,IAAI,CAAC;QACvB,kBAAkB,CAAC,IAAI,CAAC;QACxB,UAAU,CAAC,IAAI,CAAC;QAChB,UAAU,CAAC,IAAI,CAAC,CACjB,CAAC;AACJ,CAAC","sourcesContent":["/** Intent to `parent.insertBefore(node, reference)` */\nexport type InsertV2 = {\n parent: Node;\n node: Node;\n reference: Node | null;\n};\n\n/** Intent to remove a `node` from its `ownerDocument` */\nexport type RemoveV2 = {\n node: Node;\n};\n\n/** Intent to set the `textContent` of `element` */\nexport type SetTextContentV2 = {\n element: Element;\n textContent: string;\n};\n\n/** Intent to set or remove (if `null`) `attributes`(-`NS`) on `element` */\nexport type SetAttributesV2 = {\n element: Element;\n attributes: Partial<Record<string, string | null>>;\n attributesNS: Partial<Record<string, Partial<Record<string, string | null>>>>;\n};\n\n/** Intent to change some XMLDocuments */\nexport type EditV2 =\n | InsertV2\n | SetAttributesV2\n | SetTextContentV2\n | RemoveV2\n | EditV2[];\n\nexport function isComplexV2(edit: EditV2): edit is EditV2[] {\n return edit instanceof Array;\n}\n\nexport function isSetTextContentV2(edit: EditV2): edit is SetTextContentV2 {\n return (\n (edit as SetTextContentV2).element !== undefined &&\n (edit as SetTextContentV2).textContent !== undefined\n );\n}\n\nexport function isRemoveV2(edit: EditV2): edit is RemoveV2 {\n return (\n (edit as InsertV2).parent === undefined && (edit as RemoveV2).node !== undefined\n );\n}\n\nexport function isSetAttributesV2(edit: EditV2): edit is SetAttributesV2 {\n return (\n (edit as SetAttributesV2).element !== undefined &&\n (edit as SetAttributesV2).attributes !== undefined &&\n (edit as SetAttributesV2).attributesNS !== undefined\n );\n}\n\nexport function isInsertV2(edit: EditV2): edit is InsertV2 {\n return (\n (edit as InsertV2).parent !== undefined &&\n (edit as InsertV2).node !== undefined &&\n (edit as InsertV2).reference !== undefined\n );\n}\n\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\nexport function isEditV2(edit: any): edit is EditV2 {\n if (isComplexV2(edit)) {\n return !edit.some((e) => !isEditV2(e));\n }\n \n return (\n isSetAttributesV2(edit) ||\n isSetTextContentV2(edit) ||\n isInsertV2(edit) ||\n isRemoveV2(edit)\n );\n}\n"]}
@@ -1,151 +0,0 @@
1
- import { isComplexV2, isInsertV2, isRemoveV2, isSetAttributesV2, isSetTextContentV2, } from './edit.js';
2
- function handleSetTextContent({ element, textContent, }) {
3
- const { childNodes } = element;
4
- const restoreChildNodes = Array.from(childNodes).map((node) => ({
5
- parent: element,
6
- node,
7
- reference: null,
8
- }));
9
- element.textContent = textContent;
10
- const undoTextContent = { element, textContent: '' };
11
- return [undoTextContent, ...restoreChildNodes];
12
- }
13
- function uniqueNSPrefix(element, ns) {
14
- let i = 1;
15
- const attributes = Array.from(element.attributes);
16
- const hasSamePrefix = (attribute) => attribute.prefix === `ens${i}` && attribute.namespaceURI !== ns;
17
- const nsOrNull = new Set([null, ns]);
18
- const differentNamespace = (prefix) => !nsOrNull.has(element.lookupNamespaceURI(prefix));
19
- while (differentNamespace(`ens${i}`) || attributes.find(hasSamePrefix))
20
- i += 1;
21
- return `ens${i}`;
22
- }
23
- const xmlAttributeName = /^(?!xml|Xml|xMl|xmL|XMl|xML|XmL|XML)[A-Za-z_][A-Za-z0-9-_.]*(:[A-Za-z_][A-Za-z0-9-_.]*)?$/;
24
- function validName(name) {
25
- return xmlAttributeName.test(name);
26
- }
27
- function handleSetAttributes({ element, attributes, attributesNS, }) {
28
- const oldAttributes = { ...attributes };
29
- const oldAttributesNS = { ...attributesNS };
30
- // save element's non-prefixed attributes for undo
31
- Object.keys(attributes)
32
- .reverse()
33
- .forEach((name) => {
34
- oldAttributes[name] = element.getAttribute(name);
35
- });
36
- // change element's non-prefixed attributes
37
- for (const entry of Object.entries(attributes)) {
38
- try {
39
- const [name, value] = entry;
40
- if (value === null)
41
- element.removeAttribute(name);
42
- else
43
- element.setAttribute(name, value);
44
- }
45
- catch (_e) {
46
- // undo nothing if update didn't work on this attribute
47
- delete oldAttributes[entry[0]];
48
- }
49
- }
50
- // save element's namespaced attributes for undo
51
- Object.entries(attributesNS).forEach(([ns, attrs]) => {
52
- Object.keys(attrs)
53
- .filter(validName)
54
- .reverse()
55
- .forEach((name) => {
56
- oldAttributesNS[ns] = {
57
- ...oldAttributesNS[ns],
58
- [name]: element.getAttributeNS(ns, name.split(':').pop()),
59
- };
60
- });
61
- Object.keys(attrs)
62
- .filter((name) => !validName(name))
63
- .forEach((name) => {
64
- delete oldAttributesNS[ns][name];
65
- });
66
- });
67
- // change element's namespaced attributes
68
- for (const nsEntry of Object.entries(attributesNS)) {
69
- const [ns, attrs] = nsEntry;
70
- for (const entry of Object.entries(attrs).filter(([name]) => validName(name))) {
71
- try {
72
- const [name, value] = entry;
73
- if (value === null) {
74
- element.removeAttributeNS(ns, name.split(':').pop());
75
- }
76
- else {
77
- let qualifiedName = name;
78
- if (!qualifiedName.includes(':')) {
79
- let prefix = element.lookupPrefix(ns);
80
- if (!prefix)
81
- prefix = uniqueNSPrefix(element, ns);
82
- qualifiedName = `${prefix}:${name}`;
83
- }
84
- element.setAttributeNS(ns, qualifiedName, value);
85
- }
86
- }
87
- catch (_e) {
88
- delete oldAttributesNS[ns][entry[0]];
89
- }
90
- }
91
- }
92
- return {
93
- element,
94
- attributes: oldAttributes,
95
- attributesNS: oldAttributesNS,
96
- };
97
- }
98
- function handleRemove({ node }) {
99
- const { parentNode: parent, nextSibling: reference } = node;
100
- node.parentNode?.removeChild(node);
101
- if (parent)
102
- return {
103
- node,
104
- parent,
105
- reference,
106
- };
107
- return [];
108
- }
109
- function handleInsert({ parent, node, reference, }) {
110
- try {
111
- const { parentNode, nextSibling } = node;
112
- /**
113
- * This is a workaround for converted edit api v1 events,
114
- * because if multiple edits are converted, they are converted before the changes from the previous edits are applied to the document
115
- * so if you first remove an element and then add a clone with changed attributes, the reference will be the element to remove since it hasnt been removed yet
116
- */
117
- if (!parent.contains(reference)) {
118
- reference = null;
119
- }
120
- parent.insertBefore(node, reference);
121
- if (parentNode) {
122
- // undo: move child node back to original place
123
- return {
124
- node,
125
- parent: parentNode,
126
- reference: nextSibling,
127
- };
128
- }
129
- // undo: remove orphaned node
130
- return { node };
131
- }
132
- catch (_e) {
133
- // undo nothing if insert doesn't work on these nodes
134
- return [];
135
- }
136
- }
137
- /** Applies an Edit, returning the corresponding 'undo' Edit. */
138
- export function handleEditV2(edit) {
139
- if (isInsertV2(edit))
140
- return handleInsert(edit);
141
- if (isRemoveV2(edit))
142
- return handleRemove(edit);
143
- if (isSetAttributesV2(edit))
144
- return handleSetAttributes(edit);
145
- if (isSetTextContentV2(edit))
146
- return handleSetTextContent(edit);
147
- if (isComplexV2(edit))
148
- return edit.map((edit) => handleEditV2(edit)).reverse();
149
- return [];
150
- }
151
- //# sourceMappingURL=handle-edit.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"handle-edit.js","sourceRoot":"","sources":["../../../../core/foundation/handle-edit.ts"],"names":[],"mappings":"AAAA,OAAO,EAGL,WAAW,EACX,UAAU,EACV,UAAU,EACV,iBAAiB,EACjB,kBAAkB,GAInB,MAAM,WAAW,CAAC;AAEnB,SAAS,oBAAoB,CAAC,EAC5B,OAAO,EACP,WAAW,GACM;IACjB,MAAM,EAAE,UAAU,EAAE,GAAG,OAAO,CAAC;IAE/B,MAAM,iBAAiB,GAAe,KAAK,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,CAAC;QAC1E,MAAM,EAAE,OAAO;QACf,IAAI;QACJ,SAAS,EAAE,IAAI;KAChB,CAAC,CAAC,CAAC;IAEJ,OAAO,CAAC,WAAW,GAAG,WAAW,CAAC;IAElC,MAAM,eAAe,GAAqB,EAAE,OAAO,EAAE,WAAW,EAAE,EAAE,EAAE,CAAC;IAEvE,OAAO,CAAC,eAAe,EAAE,GAAG,iBAAiB,CAAC,CAAC;AACjD,CAAC;AAED,SAAS,cAAc,CAAC,OAAgB,EAAE,EAAU;IAClD,IAAI,CAAC,GAAG,CAAC,CAAC;IACV,MAAM,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V2,\n isComplexV2,\n isInsertV2,\n isRemoveV2,\n isSetAttributesV2,\n isSetTextContentV2,\n RemoveV2,\n SetAttributesV2,\n SetTextContentV2,\n} from './edit.js';\n\nfunction handleSetTextContent({\n element,\n textContent,\n}: SetTextContentV2): (SetTextContentV2 | InsertV2)[] {\n const { childNodes } = element;\n \n const restoreChildNodes: InsertV2[] = Array.from(childNodes).map((node) => ({\n parent: element,\n node,\n reference: null,\n }));\n \n element.textContent = textContent;\n \n const undoTextContent: SetTextContentV2 = { element, textContent: '' };\n \n return [undoTextContent, ...restoreChildNodes];\n}\n\nfunction uniqueNSPrefix(element: Element, ns: string): string {\n let i = 1;\n const attributes = Array.from(element.attributes);\n const hasSamePrefix = (attribute: Attr) =>\n attribute.prefix === `ens${i}` && attribute.namespaceURI !== ns;\n const nsOrNull = new Set([null, ns]);\n const differentNamespace = (prefix: string) =>\n !nsOrNull.has(element.lookupNamespaceURI(prefix));\n while (differentNamespace(`ens${i}`) || attributes.find(hasSamePrefix))\n i += 1;\n return `ens${i}`;\n}\n\nconst xmlAttributeName = /^(?!xml|Xml|xMl|xmL|XMl|xML|XmL|XML)[A-Za-z_][A-Za-z0-9-_.]*(:[A-Za-z_][A-Za-z0-9-_.]*)?$/;\n\nfunction validName(name: string): boolean {\n return xmlAttributeName.test(name);\n}\n\nfunction handleSetAttributes({\n element,\n attributes,\n attributesNS,\n}: SetAttributesV2): SetAttributesV2 {\n const oldAttributes = { ...attributes };\n const oldAttributesNS = { ...attributesNS };\n \n // save element's non-prefixed attributes for undo\n Object.keys(attributes)\n .reverse()\n .forEach((name) => {\n oldAttributes[name] = element.getAttribute(name);\n });\n \n // change element's non-prefixed attributes\n for (const entry of Object.entries(attributes)) {\n try {\n const [name, value] = entry as [string, string | null];\n if (value === null) element.removeAttribute(name);\n else element.setAttribute(name, value);\n } catch (_e) {\n // undo nothing if update didn't work on this attribute\n delete oldAttributes[entry[0]];\n }\n }\n \n // save element's namespaced attributes for undo\n Object.entries(attributesNS).forEach(([ns, attrs]) => {\n Object.keys(attrs!)\n .filter(validName)\n .reverse()\n .forEach((name) => {\n oldAttributesNS[ns] = {\n ...oldAttributesNS[ns],\n [name]: element.getAttributeNS(ns, name.split(':').pop()!),\n };\n });\n Object.keys(attrs!)\n .filter((name) => !validName(name))\n .forEach((name) => {\n delete oldAttributesNS[ns]![name];\n });\n });\n \n // change element's namespaced attributes\n for (const nsEntry of Object.entries(attributesNS)) {\n const [ns, attrs] = nsEntry as [\n string,\n Partial<Record<string, string | null>>,\n ];\n for (const entry of Object.entries(attrs).filter(([name]) =>\n validName(name),\n )) {\n try {\n const [name, value] = entry as [string, string | null];\n if (value === null) {\n element.removeAttributeNS(ns, name.split(':').pop()!);\n } else {\n let qualifiedName = name;\n if (!qualifiedName.includes(':')) {\n let prefix = element.lookupPrefix(ns);\n if (!prefix) prefix = uniqueNSPrefix(element, ns);\n qualifiedName = `${prefix}:${name}`;\n }\n element.setAttributeNS(ns, qualifiedName, value);\n }\n } catch (_e) {\n delete oldAttributesNS[ns]![entry[0]];\n }\n }\n}\n\nreturn {\n element,\n attributes: oldAttributes,\n attributesNS: oldAttributesNS,\n};\n}\n\nfunction handleRemove({ node }: RemoveV2): InsertV2 | [] {\n const { parentNode: parent, nextSibling: reference } = node;\n node.parentNode?.removeChild(node);\n if (parent)\n return {\n node,\n parent,\n reference,\n };\n return [];\n}\n\nfunction handleInsert({\n parent,\n node,\n reference,\n}: InsertV2): InsertV2 | RemoveV2 | [] {\n try {\n const { parentNode, nextSibling } = node;\n\n /**\n * This is a workaround for converted edit api v1 events,\n * because if multiple edits are converted, they are converted before the changes from the previous edits are applied to the document\n * so if you first remove an element and then add a clone with changed attributes, the reference will be the element to remove since it hasnt been removed yet\n */\n if (!parent.contains(reference)) {\n reference = null;\n }\n\n parent.insertBefore(node, reference);\n\n if (parentNode) {\n // undo: move child node back to original place\n return {\n node,\n parent: parentNode,\n reference: nextSibling,\n };\n }\n\n // undo: remove orphaned node\n return { node };\n } catch (_e) {\n // undo nothing if insert doesn't work on these nodes\n return [];\n }\n}\n\n/** Applies an Edit, returning the corresponding 'undo' Edit. */\nexport function handleEditV2(edit: EditV2): EditV2 {\n if (isInsertV2(edit)) return handleInsert(edit);\n if (isRemoveV2(edit)) return handleRemove(edit);\n if (isSetAttributesV2(edit)) return handleSetAttributes(edit);\n if (isSetTextContentV2(edit)) return handleSetTextContent(edit);\n if (isComplexV2(edit)) return edit.map((edit) => handleEditV2(edit)).reverse();\n \n return [];\n}\n"]}
@@ -1,8 +0,0 @@
1
- export function newOpenEvent(doc, docName) {
2
- return new CustomEvent('oscd-open', {
3
- bubbles: true,
4
- composed: true,
5
- detail: { doc, docName },
6
- });
7
- }
8
- //# sourceMappingURL=open-event.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"open-event.js","sourceRoot":"","sources":["../../../../core/foundation/open-event.ts"],"names":[],"mappings":"AAQA,MAAM,UAAU,YAAY,CAAC,GAAgB,EAAE,OAAe;IAC5D,OAAO,IAAI,WAAW,CAAa,WAAW,EAAE;QAC9C,OAAO,EAAE,IAAI;QACb,QAAQ,EAAE,IAAI;QACd,MAAM,EAAE,EAAE,GAAG,EAAE,OAAO,EAAE;KACzB,CAAC,CAAC;AACL,CAAC","sourcesContent":["export type OpenDetail = {\n doc: XMLDocument;\n docName: string;\n};\n\n/** Represents the intent to open `doc` with filename `docName`. */\nexport type OpenEvent = CustomEvent<OpenDetail>;\n\nexport function newOpenEvent(doc: XMLDocument, docName: string): OpenEvent {\n return new CustomEvent<OpenDetail>('oscd-open', {\n bubbles: true,\n composed: true,\n detail: { doc, docName },\n });\n}\n\ndeclare global {\n interface ElementEventMap {\n ['oscd-open']: OpenEvent;\n }\n}\n"]}
@@ -1,2 +0,0 @@
1
- export const menuPosition = ['top', 'middle', 'bottom'];
2
- //# sourceMappingURL=plugin.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"plugin.js","sourceRoot":"","sources":["../../../../core/foundation/plugin.ts"],"names":[],"mappings":"AAyBA,MAAM,CAAC,MAAM,YAAY,GAAG,CAAC,KAAK,EAAE,QAAQ,EAAE,QAAQ,CAAU,CAAC","sourcesContent":["import { targetLocales } from '../locales.js';\n\nexport type Plugin = {\n // name defines the name of the plugin\n name: string;\n // src defines the path to the plugins source file\n src: string;\n // kind defines the type of the plugin\n kind: PluginKind;\n // activeByDefault configures if the plugin should be active by default\n // this is will be user when users resets the plugins\n activeByDefault: boolean;\n // icon stores the icon name of the Material Icon\n icon?: string;\n // active shows if the plugin currently is active\n active?: boolean;\n // requireDoc shows if the plugin requires a document to be loaded\n requireDoc?: boolean;\n // position defines the position of menu plugins\n position?: MenuPosition\n translations?: Record<(typeof targetLocales)[number], string>;\n};\n\nexport type PluginSet = { menu: Plugin[]; editor: Plugin[] };\nexport type PluginKind = 'editor' | 'menu' | 'validator';\nexport const menuPosition = ['top', 'middle', 'bottom'] as const;\nexport type MenuPosition = (typeof menuPosition)[number];\n\n"]}
@@ -1,14 +0,0 @@
1
- export { newOpenEvent } from './foundation/open-event.js';
2
- export { newEditEvent, isComplex, isInsert, isNamespaced, isUpdate, isRemove, } from './foundation/deprecated/edit-event.js';
3
- export { isEditV2, isRemoveV2, isInsertV2, isComplexV2, isSetAttributesV2, isSetTextContentV2 } from './foundation/edit.js';
4
- export { newEditEventV2 } from './foundation/edit-event.js';
5
- export { handleEditV2 } from './foundation/handle-edit.js';
6
- export { cyrb64 } from './foundation/cyrb64.js';
7
- export { newEditCompletedEvent } from './foundation/edit-completed-event.js';
8
- /** @returns the cartesian product of `arrays` */
9
- export function crossProduct(...arrays) {
10
- return arrays.reduce((a, b) => a.flatMap(d => b.map(e => [d, e].flat())), [[]]);
11
- }
12
- export { OscdApi } from './api/api.js';
13
- export { XMLEditor } from './api/editor/xml-editor.js';
14
- //# sourceMappingURL=foundation.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"foundation.js","sourceRoot":"","sources":["../../../core/foundation.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,YAAY,EAAE,MAAM,4BAA4B,CAAC;AAG1D,OAAO,EACL,YAAY,EACZ,SAAS,EACT,QAAQ,EACR,YAAY,EACZ,QAAQ,EACR,QAAQ,GACT,MAAM,uCAAuC,CAAC;AAkB/C,OAAO,EACL,QAAQ,EACR,UAAU,EACV,UAAU,EACV,WAAW,EACX,iBAAiB,EACjB,kBAAkB,EACnB,MAAM,sBAAsB,CAAC;AAM9B,OAAO,EAAE,cAAc,EAAE,MAAM,4BAA4B,CAAC;AAE5D,OAAO,EAAE,YAAY,EAAE,MAAM,6BAA6B,CAAC;AAE3D,OAAO,EAAE,MAAM,EAAE,MAAM,wBAAwB,CAAC;AAIhD,OAAO,EAAE,qBAAqB,EAAE,MAAM,sCAAsC,CAAC;AAO7E,iDAAiD;AACjD,MAAM,UAAU,YAAY,CAAI,GAAG,MAAa;IAC9C,OAAO,MAAM,CAAC,MAAM,CAClB,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE,CAAQ,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,IAAI,EAAE,CAAC,CAAC,EAC1D,CAAC,EAAE,CAAC,CACL,CAAC;AACJ,CAAC;AAED,OAAO,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;AAEvC,OAAO,EAAE,SAAS,EAAE,MAAM,4BAA4B,CAAC","sourcesContent":["import { LitElement } from 'lit';\n\n/** Constructor type for defining `LitElement` mixins. */\nexport type LitElementConstructor = new (...args: any[]) => LitElement;\n\nexport { newOpenEvent } from './foundation/open-event.js';\nexport type { OpenEvent, OpenDetail } from './foundation/open-event.js';\n\nexport {\n newEditEvent,\n isComplex,\n isInsert,\n isNamespaced,\n isUpdate,\n isRemove,\n} from './foundation/deprecated/edit-event.js';\nexport type {\n EditEvent,\n Edit,\n Insert,\n AttributeValue,\n NamespacedAttributeValue,\n Update,\n Remove,\n} from './foundation/deprecated/edit-event.js';\n\nexport type {\n EditV2,\n InsertV2,\n RemoveV2,\n SetTextContentV2,\n SetAttributesV2,\n} from './foundation/edit.js';\nexport {\n isEditV2,\n isRemoveV2,\n isInsertV2,\n isComplexV2,\n isSetAttributesV2,\n isSetTextContentV2\n} from './foundation/edit.js';\nexport type {\n EditEventV2,\n EditEventOptionsV2,\n EditDetailV2\n} from './foundation/edit-event.js';\nexport { newEditEventV2 } from './foundation/edit-event.js';\n\nexport { handleEditV2 } from './foundation/handle-edit.js';\n\nexport { cyrb64 } from './foundation/cyrb64.js';\n\nexport type { Plugin, PluginSet } from './foundation/plugin.js';\n\nexport { newEditCompletedEvent } from './foundation/edit-completed-event.js';\n\nexport type {\n EditCompletedEvent,\n EditCompletedDetail,\n} from './foundation/edit-completed-event.js';\n\n/** @returns the cartesian product of `arrays` */\nexport function crossProduct<T>(...arrays: T[][]): T[][] {\n return arrays.reduce<T[][]>(\n (a, b) => <T[][]>a.flatMap(d => b.map(e => [d, e].flat())),\n [[]]\n );\n}\n\nexport { OscdApi } from './api/api.js';\n\nexport { XMLEditor } from './api/editor/xml-editor.js';\n"]}
@@ -1,21 +0,0 @@
1
- // Do not modify this file by hand!
2
- // Re-generate this file by running lit-localize.
3
- /**
4
- * The locale code that templates in this source code are written in.
5
- */
6
- export const sourceLocale = `en`;
7
- /**
8
- * The other locale codes that this application is localized into. Sorted
9
- * lexicographically.
10
- */
11
- export const targetLocales = [
12
- `de`,
13
- ];
14
- /**
15
- * All valid project locale codes. Sorted lexicographically.
16
- */
17
- export const allLocales = [
18
- `de`,
19
- `en`,
20
- ];
21
- //# sourceMappingURL=locales.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"locales.js","sourceRoot":"","sources":["../../../core/locales.ts"],"names":[],"mappings":"AAAA,mCAAmC;AACnC,iDAAiD;AAEjD;;GAEG;AACH,MAAM,CAAC,MAAM,YAAY,GAAG,IAAI,CAAC;AAEjC;;;GAGG;AACH,MAAM,CAAC,MAAM,aAAa,GAAG;IAC3B,IAAI;CACI,CAAC;AAEX;;GAEG;AACH,MAAM,CAAC,MAAM,UAAU,GAAG;IACxB,IAAI;IACJ,IAAI;CACI,CAAC","sourcesContent":["// Do not modify this file by hand!\n// Re-generate this file by running lit-localize.\n\n/**\n * The locale code that templates in this source code are written in.\n */\nexport const sourceLocale = `en`;\n\n/**\n * The other locale codes that this application is localized into. Sorted\n * lexicographically.\n */\nexport const targetLocales = [\n `de`,\n] as const;\n\n/**\n * All valid project locale codes. Sorted lexicographically.\n */\nexport const allLocales = [\n `de`,\n `en`,\n] as const;\n"]}
@@ -1,37 +0,0 @@
1
- import { __decorate } from "tslib";
2
- import { css, customElement, html, LitElement, property, } from 'lit-element';
3
- let WizardDividerElement = class WizardDividerElement extends LitElement {
4
- render() {
5
- return html ` ${this.renderHeader()} ${this.renderSeparator()}`;
6
- }
7
- renderHeader() {
8
- if (!this.header) {
9
- return html ``;
10
- }
11
- return html `<h4 class="header">${this.header}</h4>`;
12
- }
13
- renderSeparator() {
14
- return html `<div role="separator"></div>`;
15
- }
16
- };
17
- WizardDividerElement.styles = css `
18
- div {
19
- height: 0px;
20
- margin: 10px 0px 10px 0px;
21
- border-top: none;
22
- border-right: none;
23
- border-left: none;
24
- border-image: initial;
25
- border-bottom: 1px solid rgba(0, 0, 0, 0.12);
26
- }
27
- `;
28
- __decorate([
29
- property({
30
- type: String,
31
- })
32
- ], WizardDividerElement.prototype, "header", void 0);
33
- WizardDividerElement = __decorate([
34
- customElement('wizard-divider')
35
- ], WizardDividerElement);
36
- export { WizardDividerElement };
37
- //# sourceMappingURL=WizardDivider.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"WizardDivider.js","sourceRoot":"","sources":["../../../src/WizardDivider.ts"],"names":[],"mappings":";AAAA,OAAO,EACL,GAAG,EACH,aAAa,EACb,IAAI,EACJ,UAAU,EACV,QAAQ,GAET,MAAM,aAAa,CAAC;AAGd,IAAM,oBAAoB,GAA1B,MAAM,oBAAqB,SAAQ,UAAU;IAMlD,MAAM;QACJ,OAAO,IAAI,CAAA,IAAI,IAAI,CAAC,YAAY,EAAE,IAAI,IAAI,CAAC,eAAe,EAAE,EAAE,CAAC;IACjE,CAAC;IAEO,YAAY;QAClB,IAAI,CAAC,IAAI,CAAC,MAAM,EAAE;YAChB,OAAO,IAAI,CAAA,EAAE,CAAC;SACf;QAED,OAAO,IAAI,CAAA,sBAAsB,IAAI,CAAC,MAAM,OAAO,CAAC;IACtD,CAAC;IAEO,eAAe;QACrB,OAAO,IAAI,CAAA,8BAA8B,CAAC;IAC5C,CAAC;;AAEM,2BAAM,GAAG,GAAG,CAAA;;;;;;;;;;GAUlB,CAAC;AA5BF;IAHC,QAAQ,CAAC;QACR,IAAI,EAAE,MAAM;KACb,CAAC;oDACc;AAJL,oBAAoB;IADhC,aAAa,CAAC,gBAAgB,CAAC;GACnB,oBAAoB,CAiChC;SAjCY,oBAAoB","sourcesContent":["import {\n css,\n customElement,\n html,\n LitElement,\n property,\n TemplateResult,\n} from 'lit-element';\n\n@customElement('wizard-divider')\nexport class WizardDividerElement extends LitElement {\n @property({\n type: String,\n })\n header?: string;\n\n render(): TemplateResult {\n return html` ${this.renderHeader()} ${this.renderSeparator()}`;\n }\n\n private renderHeader(): TemplateResult {\n if (!this.header) {\n return html``;\n }\n\n return html`<h4 class=\"header\">${this.header}</h4>`;\n }\n\n private renderSeparator(): TemplateResult {\n return html`<div role=\"separator\"></div>`;\n }\n\n static styles = css`\n div {\n height: 0px;\n margin: 10px 0px 10px 0px;\n border-top: none;\n border-right: none;\n border-left: none;\n border-image: initial;\n border-bottom: 1px solid rgba(0, 0, 0, 0.12);\n }\n `;\n}\n"]}
@@ -1,38 +0,0 @@
1
- import { __decorate } from "tslib";
2
- import { html, state, query } from 'lit-element';
3
- import { ifImplemented, } from './foundation.js';
4
- import './wizard-dialog.js';
5
- export function Wizarding(Base) {
6
- class WizardingElement extends Base {
7
- onWizard(we) {
8
- const wizard = we.detail.wizard;
9
- if (wizard === null)
10
- this.workflow.shift();
11
- else if (we.detail.subwizard)
12
- this.workflow.unshift(wizard);
13
- else
14
- this.workflow.push(wizard);
15
- this.requestUpdate('workflow');
16
- this.updateComplete.then(() => this.wizardUI.updateComplete.then(() => this.wizardUI.dialog?.updateComplete.then(() => this.wizardUI.dialog?.focus())));
17
- }
18
- constructor(...args) {
19
- super(...args);
20
- /** FIFO queue of [[`Wizard`]]s to display. */
21
- this.workflow = [];
22
- this.addEventListener('wizard', this.onWizard);
23
- this.addEventListener('editor-action', () => this.wizardUI.requestUpdate());
24
- }
25
- render() {
26
- return html `${ifImplemented(super.render())}
27
- <wizard-dialog .wizard=${this.workflow[0]?.() ?? []}></wizard-dialog>`;
28
- }
29
- }
30
- __decorate([
31
- state()
32
- ], WizardingElement.prototype, "workflow", void 0);
33
- __decorate([
34
- query('wizard-dialog')
35
- ], WizardingElement.prototype, "wizardUI", void 0);
36
- return WizardingElement;
37
- }
38
- //# sourceMappingURL=Wizarding.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"Wizarding.js","sourceRoot":"","sources":["../../../src/Wizarding.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,IAAI,EAAE,KAAK,EAAkB,KAAK,EAAE,MAAM,aAAa,CAAC;AACjE,OAAO,EACL,aAAa,GAKd,MAAM,iBAAiB,CAAC;AAEzB,OAAO,oBAAoB,CAAC;AAO5B,MAAM,UAAU,SAAS,CAAsC,IAAW;IACxE,MAAM,gBAAiB,SAAQ,IAAI;QAOzB,QAAQ,CAAC,EAAe;YAC9B,MAAM,MAAM,GAAG,EAAE,CAAC,MAAM,CAAC,MAAM,CAAC;YAChC,IAAI,MAAM,KAAK,IAAI;gBAAE,IAAI,CAAC,QAAQ,CAAC,KAAK,EAAE,CAAC;iBACtC,IAAI,EAAE,CAAC,MAAM,CAAC,SAAS;gBAAE,IAAI,CAAC,QAAQ,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC;;gBACvD,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;YAChC,IAAI,CAAC,aAAa,CAAC,UAAU,CAAC,CAAC;YAC/B,IAAI,CAAC,cAAc,CAAC,IAAI,CAAC,GAAG,EAAE,CAC5B,IAAI,CAAC,QAAQ,CAAC,cAAc,CAAC,IAAI,CAAC,GAAG,EAAE,CACrC,IAAI,CAAC,QAAQ,CAAC,MAAM,EAAE,cAAc,CAAC,IAAI,CAAC,GAAG,EAAE,CAC7C,IAAI,CAAC,QAAQ,CAAC,MAAM,EAAE,KAAK,EAAE,CAC9B,CACF,CACF,CAAC;QACJ,CAAC;QAED,YAAY,GAAG,IAAW;YACxB,KAAK,CAAC,GAAG,IAAI,CAAC,CAAC;YAtBjB,8CAA8C;YAE9C,aAAQ,GAAoB,EAAE,CAAC;YAsB7B,IAAI,CAAC,gBAAgB,CAAC,QAAQ,EAAE,IAAI,CAAC,QAAQ,CAAC,CAAC;YAC/C,IAAI,CAAC,gBAAgB,CAAC,eAAe,EAAE,GAAG,EAAE,CAC1C,IAAI,CAAC,QAAQ,CAAC,aAAa,EAAE,CAC9B,CAAC;QACJ,CAAC;QAED,MAAM;YACJ,OAAO,IAAI,CAAA,GAAG,aAAa,CAAC,KAAK,CAAC,MAAM,EAAE,CAAC;iCAChB,IAAI,CAAC,QAAQ,CAAC,CAAC,CAAC,EAAE,EAAE,IAAI,EAAE,mBAAmB,CAAC;QAC3E,CAAC;KACF;IAhCC;QADC,KAAK,EAAE;sDACuB;IAEP;QAAvB,KAAK,CAAC,eAAe,CAAC;sDAAyB;IAgClD,OAAO,gBAAgB,CAAC;AAC1B,CAAC","sourcesContent":["import { html, state, TemplateResult, query } from 'lit-element';\nimport {\n ifImplemented,\n LitElementConstructor,\n Mixin,\n WizardEvent,\n WizardFactory,\n} from './foundation.js';\n\nimport './wizard-dialog.js';\nimport { WizardDialog } from './wizard-dialog.js';\n\n/** `LitElement` mixin that adds a `workflow` property which [[`Wizard`]]s are\n * queued onto on incoming [[`WizardEvent`]]s, first come first displayed. */\nexport type WizardingElement = Mixin<typeof Wizarding>;\n\nexport function Wizarding<TBase extends LitElementConstructor>(Base: TBase) {\n class WizardingElement extends Base {\n /** FIFO queue of [[`Wizard`]]s to display. */\n @state()\n workflow: WizardFactory[] = [];\n\n @query('wizard-dialog') wizardUI!: WizardDialog;\n\n private onWizard(we: WizardEvent) {\n const wizard = we.detail.wizard;\n if (wizard === null) this.workflow.shift();\n else if (we.detail.subwizard) this.workflow.unshift(wizard);\n else this.workflow.push(wizard);\n this.requestUpdate('workflow');\n this.updateComplete.then(() =>\n this.wizardUI.updateComplete.then(() =>\n this.wizardUI.dialog?.updateComplete.then(() =>\n this.wizardUI.dialog?.focus()\n )\n )\n );\n }\n\n constructor(...args: any[]) {\n super(...args);\n\n this.addEventListener('wizard', this.onWizard);\n this.addEventListener('editor-action', () =>\n this.wizardUI.requestUpdate()\n );\n }\n\n render(): TemplateResult {\n return html`${ifImplemented(super.render())}\n <wizard-dialog .wizard=${this.workflow[0]?.() ?? []}></wizard-dialog>`;\n }\n }\n\n return WizardingElement;\n}\n"]}