@lblod/ember-rdfa-editor-lblod-plugins 1.0.0-alpha.1 → 1.0.0-alpha.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (173) hide show
  1. package/CHANGELOG.md +30 -0
  2. package/addon/components/article-structure-plugin/article-structure-card.hbs +5 -9
  3. package/addon/components/article-structure-plugin/article-structure-card.ts +15 -65
  4. package/addon/components/article-structure-plugin/structure-card.hbs +12 -8
  5. package/addon/components/article-structure-plugin/structure-card.ts +82 -98
  6. package/addon/components/besluit-plugin/besluit-context-card.ts +1 -7
  7. package/addon/components/besluit-plugin/besluit-plugin-card.ts +3 -5
  8. package/addon/components/besluit-type-plugin/besluit-type-select.ts +1 -2
  9. package/addon/components/besluit-type-plugin/toolbar-dropdown.ts +3 -1
  10. package/addon/components/citation-plugin/citation-card.ts +4 -4
  11. package/addon/components/citation-plugin/citation-insert.ts +1 -1
  12. package/addon/components/citation-plugin/citations/search-modal.ts +1 -1
  13. package/addon/components/insert-variable-plugin/insert-variable-card.ts +6 -6
  14. package/addon/components/rdfa-date-plugin/card.ts +1 -1
  15. package/addon/components/rdfa-date-plugin/insert.ts +1 -0
  16. package/addon/components/roadsign-regulation-plugin/expanded-measure.ts +1 -1
  17. package/addon/components/roadsign-regulation-plugin/measure-template.ts +1 -1
  18. package/addon/components/roadsign-regulation-plugin/roadsigns-modal.ts +4 -4
  19. package/addon/components/standard-template-plugin/template-provider.ts +1 -1
  20. package/addon/components/table-of-contents-plugin/card.ts +3 -3
  21. package/addon/components/table-of-contents-plugin/ember-nodes/table-of-contents.ts +1 -1
  22. package/addon/components/template-variable-plugin/template-variable-card.ts +6 -6
  23. package/addon/plugins/article-structure-plugin/commands/index.ts +6 -0
  24. package/addon/plugins/article-structure-plugin/commands/insert-structure.ts +85 -0
  25. package/addon/plugins/article-structure-plugin/commands/move-selected-structure.ts +131 -0
  26. package/addon/plugins/article-structure-plugin/commands/recalculate-structure-numbers.ts +26 -0
  27. package/addon/plugins/article-structure-plugin/commands/remove-structure.ts +21 -0
  28. package/addon/plugins/article-structure-plugin/commands/unwrap-structure.ts +40 -0
  29. package/addon/plugins/article-structure-plugin/commands/wrap-structure-content.ts +91 -0
  30. package/addon/plugins/article-structure-plugin/constants.ts +11 -0
  31. package/addon/plugins/article-structure-plugin/index.ts +70 -0
  32. package/addon/plugins/article-structure-plugin/structures/article-paragraph.ts +93 -0
  33. package/addon/plugins/article-structure-plugin/structures/article.ts +128 -0
  34. package/addon/plugins/article-structure-plugin/structures/chapter.ts +82 -0
  35. package/addon/plugins/article-structure-plugin/structures/index.ts +33 -0
  36. package/addon/plugins/article-structure-plugin/structures/section.ts +81 -0
  37. package/addon/plugins/article-structure-plugin/structures/structure-header.ts +65 -0
  38. package/addon/plugins/article-structure-plugin/structures/subsection.ts +82 -0
  39. package/addon/plugins/article-structure-plugin/structures/title.ts +82 -0
  40. package/addon/plugins/article-structure-plugin/utils/namespace.ts +25 -0
  41. package/addon/plugins/article-structure-plugin/utils/structure.ts +162 -0
  42. package/addon/{commands/besluit-plugin → plugins/besluit-plugin/commands}/get-article-nodes-for-besluit.ts +0 -0
  43. package/addon/{commands/besluit-plugin → plugins/besluit-plugin/commands}/index.ts +0 -0
  44. package/addon/{commands/besluit-plugin → plugins/besluit-plugin/commands}/insert-article.ts +4 -28
  45. package/addon/{commands/besluit-plugin → plugins/besluit-plugin/commands}/insert-title.ts +0 -0
  46. package/addon/{commands/besluit-plugin → plugins/besluit-plugin/commands}/move-article.ts +1 -1
  47. package/addon/{commands/besluit-plugin → plugins/besluit-plugin/commands}/recalculate-article-numbers.ts +0 -0
  48. package/addon/plugins/besluit-plugin/index.ts +11 -0
  49. package/addon/{utils/besluit-plugin → plugins/besluit-plugin/utils}/get-title-for-decision.ts +0 -0
  50. package/addon/plugins/{besluit-type-plugin.ts → besluit-type-plugin/index.ts} +0 -0
  51. package/addon/{utils → plugins/besluit-type-plugin/utils}/fetchBesluitTypes.ts +3 -4
  52. package/addon/{utils → plugins/citation-plugin/utils}/legislation-types.ts +0 -0
  53. package/addon/plugins/citation-plugin/utils/process-match.ts +1 -4
  54. package/addon/plugins/citation-plugin/utils/vlaamse-codex.ts +1 -1
  55. package/addon/plugins/{insert-variable-plugin.ts → insert-variable-plugin/index.ts} +0 -0
  56. package/addon/{utils/variable-plugins/default-variable-types.ts → plugins/insert-variable-plugin/utils/constants.ts} +1 -1
  57. package/addon/plugins/insert-variable-plugin/utils/fetch-data.ts +41 -0
  58. package/addon/plugins/rdfa-date-plugin/commands/index.ts +1 -0
  59. package/addon/{commands/modify-date-command.ts → plugins/rdfa-date-plugin/commands/modify-date.ts} +0 -0
  60. package/addon/plugins/{rdfa-date-plugin.ts → rdfa-date-plugin/index.ts} +0 -0
  61. package/addon/plugins/{roadsign-regulation-plugin.ts → roadsign-regulation-plugin/index.ts} +0 -0
  62. package/addon/plugins/roadsign-regulation-plugin/utils/constants.ts +8 -0
  63. package/addon/{utils/roadsign-regulation-plugin → plugins/roadsign-regulation-plugin/utils}/fetchData.ts +1 -1
  64. package/addon/{utils/roadsign-regulation-plugin → plugins/roadsign-regulation-plugin/utils}/includeInstructions.ts +0 -0
  65. package/addon/plugins/{standard-template-plugin.ts → standard-template-plugin/index.ts} +0 -0
  66. package/addon/plugins/standard-template-plugin/utils/instantiate-uuids.ts +48 -0
  67. package/addon/plugins/{table-of-contents-plugin.ts → table-of-contents-plugin/index.ts} +1 -1
  68. package/addon/plugins/table-of-contents-plugin/nodes/index.ts +1 -0
  69. package/addon/{ember-nodes → plugins/table-of-contents-plugin/nodes}/table-of-contents.ts +3 -3
  70. package/addon/plugins/table-of-contents-plugin/utils/constants.ts +17 -0
  71. package/addon/plugins/{template-variable-plugin.ts → template-variable-plugin/index.ts} +0 -0
  72. package/addon/plugins/template-variable-plugin/utils/constants.ts +2 -0
  73. package/addon/plugins/template-variable-plugin/utils/fetch-data.ts +62 -0
  74. package/addon/services/roadsign-registry.ts +1 -1
  75. package/addon/utils/memoize.ts +6 -8
  76. package/addon/utils/sparql-helpers.ts +27 -0
  77. package/components/article-structure-plugin/article-structure-card.d.ts +5 -24
  78. package/components/article-structure-plugin/structure-card.d.ts +17 -8
  79. package/components/au-native-input.d.ts +1 -1
  80. package/components/besluit-plugin/besluit-context-card.d.ts +0 -5
  81. package/components/besluit-type-plugin/besluit-type-select.d.ts +1 -1
  82. package/components/besluit-type-plugin/toolbar-dropdown.d.ts +1 -1
  83. package/components/insert-variable-plugin/insert-variable-card.d.ts +2 -2
  84. package/components/table-of-contents-plugin/card.d.ts +1 -1
  85. package/components/table-of-contents-plugin/ember-nodes/table-of-contents.d.ts +1 -1
  86. package/components/template-variable-plugin/template-variable-card.d.ts +1 -1
  87. package/package.json +6 -4
  88. package/plugins/article-structure-plugin/commands/index.d.ts +6 -0
  89. package/plugins/article-structure-plugin/commands/insert-structure.d.ts +5 -0
  90. package/plugins/article-structure-plugin/commands/move-selected-structure.d.ts +10 -0
  91. package/plugins/article-structure-plugin/commands/recalculate-structure-numbers.d.ts +3 -0
  92. package/plugins/article-structure-plugin/commands/remove-structure.d.ts +7 -0
  93. package/plugins/article-structure-plugin/commands/unwrap-structure.d.ts +8 -0
  94. package/plugins/article-structure-plugin/commands/wrap-structure-content.d.ts +5 -0
  95. package/plugins/article-structure-plugin/constants.d.ts +5 -0
  96. package/plugins/article-structure-plugin/index.d.ts +40 -0
  97. package/plugins/article-structure-plugin/structures/article-paragraph.d.ts +4 -0
  98. package/plugins/article-structure-plugin/structures/article.d.ts +6 -0
  99. package/plugins/article-structure-plugin/structures/chapter.d.ts +4 -0
  100. package/plugins/article-structure-plugin/structures/index.d.ts +17 -0
  101. package/plugins/article-structure-plugin/structures/section.d.ts +4 -0
  102. package/plugins/article-structure-plugin/structures/structure-header.d.ts +2 -0
  103. package/plugins/article-structure-plugin/structures/subsection.d.ts +4 -0
  104. package/plugins/article-structure-plugin/structures/title.d.ts +4 -0
  105. package/plugins/article-structure-plugin/utils/namespace.d.ts +6 -0
  106. package/plugins/article-structure-plugin/utils/structure.d.ts +20 -0
  107. package/{commands/besluit-plugin → plugins/besluit-plugin/commands}/get-article-nodes-for-besluit.d.ts +0 -0
  108. package/{commands/besluit-plugin → plugins/besluit-plugin/commands}/index.d.ts +0 -0
  109. package/{commands/besluit-plugin → plugins/besluit-plugin/commands}/insert-article.d.ts +1 -1
  110. package/{commands/besluit-plugin → plugins/besluit-plugin/commands}/insert-title.d.ts +0 -0
  111. package/{commands/besluit-plugin → plugins/besluit-plugin/commands}/move-article.d.ts +0 -0
  112. package/{commands/besluit-plugin → plugins/besluit-plugin/commands}/recalculate-article-numbers.d.ts +0 -0
  113. package/plugins/besluit-plugin/index.d.ts +3 -0
  114. package/{utils/besluit-plugin → plugins/besluit-plugin/utils}/get-title-for-decision.d.ts +0 -0
  115. package/plugins/{besluit-type-plugin.d.ts → besluit-type-plugin/index.d.ts} +0 -0
  116. package/{utils → plugins/besluit-type-plugin/utils}/fetchBesluitTypes.d.ts +0 -0
  117. package/{utils → plugins/citation-plugin/utils}/legislation-types.d.ts +0 -0
  118. package/plugins/{insert-variable-plugin.d.ts → insert-variable-plugin/index.d.ts} +0 -0
  119. package/{utils/variable-plugins/default-variable-types.d.ts → plugins/insert-variable-plugin/utils/constants.d.ts} +1 -1
  120. package/plugins/insert-variable-plugin/utils/fetch-data.d.ts +5 -0
  121. package/plugins/rdfa-date-plugin/commands/index.d.ts +1 -0
  122. package/{commands/modify-date-command.d.ts → plugins/rdfa-date-plugin/commands/modify-date.d.ts} +0 -0
  123. package/plugins/{rdfa-date-plugin.d.ts → rdfa-date-plugin/index.d.ts} +0 -0
  124. package/plugins/{roadsign-regulation-plugin.d.ts → roadsign-regulation-plugin/index.d.ts} +0 -0
  125. package/{constants.d.ts → plugins/roadsign-regulation-plugin/utils/constants.d.ts} +1 -9
  126. package/{utils/roadsign-regulation-plugin → plugins/roadsign-regulation-plugin/utils}/fetchData.d.ts +0 -0
  127. package/{utils/roadsign-regulation-plugin → plugins/roadsign-regulation-plugin/utils}/includeInstructions.d.ts +0 -0
  128. package/plugins/{standard-template-plugin.d.ts → standard-template-plugin/index.d.ts} +0 -0
  129. package/plugins/standard-template-plugin/utils/instantiate-uuids.d.ts +15 -0
  130. package/plugins/{table-of-contents-plugin.d.ts → table-of-contents-plugin/index.d.ts} +1 -1
  131. package/plugins/table-of-contents-plugin/nodes/index.d.ts +1 -0
  132. package/{ember-nodes → plugins/table-of-contents-plugin/nodes}/table-of-contents.d.ts +1 -1
  133. package/plugins/table-of-contents-plugin/utils/constants.d.ts +7 -0
  134. package/plugins/{template-variable-plugin.d.ts → template-variable-plugin/index.d.ts} +0 -0
  135. package/plugins/template-variable-plugin/utils/constants.d.ts +1 -0
  136. package/{utils/variable-plugins → plugins/template-variable-plugin/utils}/fetch-data.d.ts +0 -5
  137. package/translations/en-US.yaml +22 -5
  138. package/translations/nl-BE.yaml +22 -5
  139. package/utils/memoize.d.ts +1 -1
  140. package/utils/sparql-helpers.d.ts +7 -0
  141. package/addon/commands/article-structure-plugin/delete-structure.ts +0 -85
  142. package/addon/commands/article-structure-plugin/index.ts +0 -4
  143. package/addon/commands/article-structure-plugin/insert-article-structure.ts +0 -137
  144. package/addon/commands/article-structure-plugin/move-structure.ts +0 -227
  145. package/addon/commands/article-structure-plugin/recalculate-structure-numbers.ts +0 -88
  146. package/addon/constants.ts +0 -36
  147. package/addon/initializers/plugin-initializer.js +0 -0
  148. package/addon/marks/citaten-mark.js +0 -32
  149. package/addon/plugins/article-structure-plugin.ts +0 -55
  150. package/addon/plugins/besluit-plugin.ts +0 -27
  151. package/addon/plugins/generate-template-plugin.js +0 -16
  152. package/addon/utils/article-structure-plugin/constants.ts +0 -260
  153. package/addon/utils/article-structure-plugin/defaults.ts +0 -3
  154. package/addon/utils/article-structure-plugin/options-with-defaults.ts +0 -31
  155. package/addon/utils/article-structure-plugin/validate-datastore.ts +0 -23
  156. package/addon/utils/generate-template-plugin/default-resources.ts +0 -9
  157. package/addon/utils/instantiate-uuids.ts +0 -37
  158. package/addon/utils/romanize.ts +0 -47
  159. package/addon/utils/variable-plugins/fetch-data.ts +0 -126
  160. package/commands/article-structure-plugin/delete-structure.d.ts +0 -4
  161. package/commands/article-structure-plugin/index.d.ts +0 -4
  162. package/commands/article-structure-plugin/insert-article-structure.d.ts +0 -6
  163. package/commands/article-structure-plugin/move-structure.d.ts +0 -5
  164. package/commands/article-structure-plugin/recalculate-structure-numbers.d.ts +0 -7
  165. package/plugins/article-structure-plugin.d.ts +0 -29
  166. package/plugins/besluit-plugin.d.ts +0 -9
  167. package/utils/article-structure-plugin/constants.d.ts +0 -2
  168. package/utils/article-structure-plugin/defaults.d.ts +0 -4
  169. package/utils/article-structure-plugin/options-with-defaults.d.ts +0 -2
  170. package/utils/article-structure-plugin/validate-datastore.d.ts +0 -3
  171. package/utils/generate-template-plugin/default-resources.d.ts +0 -2
  172. package/utils/instantiate-uuids.d.ts +0 -1
  173. package/utils/romanize.d.ts +0 -2
package/CHANGELOG.md CHANGED
@@ -8,6 +8,36 @@
8
8
 
9
9
 
10
10
 
11
+
12
+
13
+ ## 1.0.0-alpha.3 (2023-01-09)
14
+
15
+ #### :house: Internal
16
+ * [#42](https://github.com/lblod/ember-rdfa-editor-lblod-plugins/pull/42) Remove redundant context from article-structure plugin ([@elpoelma](https://github.com/elpoelma))
17
+
18
+ #### Committers: 1
19
+ - Elena Poelman ([@elpoelma](https://github.com/elpoelma))
20
+
21
+ ## 1.0.0-alpha.2 (2023-01-03)
22
+
23
+ #### :boom: Breaking Change
24
+ * [#38](https://github.com/lblod/ember-rdfa-editor-lblod-plugins/pull/38) Folder restructure ([@elpoelma](https://github.com/elpoelma))
25
+
26
+ #### :rocket: Enhancement
27
+ * [#40](https://github.com/lblod/ember-rdfa-editor-lblod-plugins/pull/40) Major rework of article-structure plugin ([@elpoelma](https://github.com/elpoelma))
28
+ * [#39](https://github.com/lblod/ember-rdfa-editor-lblod-plugins/pull/39) Remove paragraphs from toc ([@lagartoverde](https://github.com/lagartoverde))
29
+
30
+ #### :bug: Bug Fix
31
+ * [#37](https://github.com/lblod/ember-rdfa-editor-lblod-plugins/pull/37) Fix besluit plugin numbering ([@elpoelma](https://github.com/elpoelma))
32
+
33
+ #### :house: Internal
34
+ * [#41](https://github.com/lblod/ember-rdfa-editor-lblod-plugins/pull/41) Update editor to 1.0.0-alpha.13 ([@elpoelma](https://github.com/elpoelma))
35
+ * [#38](https://github.com/lblod/ember-rdfa-editor-lblod-plugins/pull/38) Folder restructure ([@elpoelma](https://github.com/elpoelma))
36
+
37
+ #### Committers: 2
38
+ - Elena Poelman ([@elpoelma](https://github.com/elpoelma))
39
+ - Oscar Rodriguez Villalobos ([@lagartoverde](https://github.com/lagartoverde))
40
+
11
41
  ## 1.0.0-alpha.1 (2022-12-22)
12
42
 
13
43
  #### :rocket: Enhancement
@@ -1,14 +1,10 @@
1
1
  <div>
2
- {{#each this.structures.value as |structure|}}
2
+ {{#each this.structureTypes as |structureType|}}
3
3
  <AuList::Item>
4
- <AuButton
5
- @icon="add"
6
- @iconAlignment="left"
7
- @skin="link"
8
- @disabled={{not structure.canExecute}}
9
- {{on 'click' (fn this.insertStructure structure.title)}}>
10
- {{t structure.translation}}
4
+ <AuButton @icon="add" @iconAlignment="left" @skin="link" @disabled={{not (this.canInsertStructure structureType)}}
5
+ {{on 'click' (fn this.insertStructure structureType)}}>
6
+ {{t structureType.translations.insert}}
11
7
  </AuButton>
12
8
  </AuList::Item>
13
- {{/each}}
9
+ {{/each}}
14
10
  </div>
@@ -1,83 +1,33 @@
1
1
  import Component from '@glimmer/component';
2
- import { action } from '@ember/object';
3
2
  import { inject as service } from '@ember/service';
4
3
  import { ProseController } from '@lblod/ember-rdfa-editor';
5
- import { insertArticleStructure } from '@lblod/ember-rdfa-editor-lblod-plugins/commands/article-structure-plugin';
6
4
  import IntlService from 'ember-intl/services/intl';
7
- import { trackedFunction } from 'ember-resources/util/function';
8
- import validateDatastore from '@lblod/ember-rdfa-editor-lblod-plugins/utils/article-structure-plugin/validate-datastore';
9
- import { ResolvedArticleStructurePluginOptions } from '@lblod/ember-rdfa-editor-lblod-plugins/plugins/article-structure-plugin';
5
+ import {
6
+ ArticleStructurePluginOptions,
7
+ StructureSpec,
8
+ } from '@lblod/ember-rdfa-editor-lblod-plugins/plugins/article-structure-plugin';
9
+ import { action } from '@ember/object';
10
+ import { insertStructure } from '@lblod/ember-rdfa-editor-lblod-plugins/plugins/article-structure-plugin/commands';
10
11
 
11
12
  type Args = {
12
13
  controller: ProseController;
13
14
  widgetArgs: {
14
- options: ResolvedArticleStructurePluginOptions;
15
+ options: ArticleStructurePluginOptions;
15
16
  };
16
17
  };
17
18
  export default class EditorPluginsArticleStructureCardComponent extends Component<Args> {
18
19
  @service declare intl: IntlService;
19
20
 
20
- structures = trackedFunction(this, async () => {
21
- return Promise.all(
22
- this.args.widgetArgs.options.structures.map(async (structure) => {
23
- const shaclReport = await validateDatastore(
24
- this.args.controller.datastore,
25
- structure.shaclConstraint
26
- );
27
- const canExecute = this.args.controller.checkCommand(
28
- insertArticleStructure(
29
- this.args.controller,
30
- structure.title,
31
- this.args.widgetArgs.options,
32
- shaclReport,
33
- this.intl
34
- )
35
- );
36
- return {
37
- ...structure,
38
- canExecute,
39
- };
40
- })
41
- );
42
- });
43
-
44
- @action
45
- async insertStructure(structureName: string) {
46
- const structureToAdd = this.args.widgetArgs.options.structures.find(
47
- (structure) => structure.title === structureName
48
- );
49
- if (structureToAdd) {
50
- const shaclReport = await validateDatastore(
51
- this.args.controller.datastore,
52
- structureToAdd.shaclConstraint
53
- );
54
- this.args.controller.doCommand(
55
- insertArticleStructure(
56
- this.args.controller,
57
- structureName,
58
- this.args.widgetArgs.options,
59
- shaclReport,
60
- this.intl
61
- )
62
- );
63
- }
21
+ get structureTypes() {
22
+ return this.args.widgetArgs.options;
64
23
  }
65
24
 
66
- get structureUri() {
67
- const currentSelection = this.args.controller.state.selection;
68
- const limitedDatastore = this.args.controller.datastore.limitToRange(
69
- this.args.controller.state,
70
- currentSelection.from,
71
- currentSelection.to
72
- );
73
-
74
- return limitedDatastore
75
- .match(null, 'a', '>https://say.data.gift/ns/DocumentSubdivision')
76
- .asQuadResultSet()
77
- .first()?.subject.value;
25
+ @action
26
+ insertStructure(spec: StructureSpec) {
27
+ this.args.controller.doCommand(insertStructure(spec, this.intl));
28
+ this.args.controller.focus();
78
29
  }
79
30
 
80
- get isOutsideStructure() {
81
- return !this.structureUri;
82
- }
31
+ canInsertStructure = (spec: StructureSpec) =>
32
+ this.args.controller.checkCommand(insertStructure(spec, this.intl));
83
33
  }
@@ -10,9 +10,9 @@
10
10
  @icon="chevron-up"
11
11
  @iconAlignment="left"
12
12
  @skin="link"
13
- @disabled={{not this.canMoveUp.value}}
14
- {{on 'click' (fn this.moveStructure true)}}>
15
- {{t this.structureTypeSelected.moveUp}}
13
+ @disabled={{not this.canMoveUp}}
14
+ {{on 'click' (fn this.moveStructure 'up')}}>
15
+ {{t this.currentStructureType.translations.move.up}}
16
16
  </AuButton>
17
17
  </Item>
18
18
  <Item>
@@ -20,20 +20,24 @@
20
20
  @icon="chevron-down"
21
21
  @iconAlignment="left"
22
22
  @skin="link"
23
- @disabled={{not this.canMoveDown.value}}
24
- {{on 'click' (fn this.moveStructure false)}}>
25
- {{t this.structureTypeSelected.moveDown}}
23
+ @disabled={{not this.canMoveDown}}
24
+ {{on 'click' (fn this.moveStructure 'down')}}>
25
+ {{t this.currentStructureType.translations.move.down}}
26
26
  </AuButton>
27
27
  </Item>
28
28
  <Item>
29
+ <AuToggleSwitch
30
+ @label={{t "article-structure-plugin.remove.content"}}
31
+ @checked={{this.removeStructureContent}}
32
+ @onChange={{this.setRemoveStructureContent}}/>
29
33
  <AuButton
30
34
  @icon="bin"
31
35
  @iconAlignment="left"
32
36
  @skin="link"
33
37
  @alert={{true}}
34
- @disabled={{this.isOutsideStructure}}
38
+ @disabled={{not this.canRemoveStructure}}
35
39
  {{on 'click' this.removeStructure}}>
36
- {{t "article-structure-plugin.remove.structure"}}
40
+ {{t this.currentStructureType.translations.remove}}
37
41
  </AuButton>
38
42
  </Item>
39
43
  </AuList>
@@ -1,140 +1,124 @@
1
1
  import Component from '@glimmer/component';
2
2
  import { action } from '@ember/object';
3
3
  import { ProseController } from '@lblod/ember-rdfa-editor';
4
- import { trackedFunction } from 'ember-resources/util/function';
5
4
  import {
6
- deleteStructure,
7
- moveStructure,
8
- } from '@lblod/ember-rdfa-editor-lblod-plugins/commands/article-structure-plugin';
9
- import validateDatastore from '@lblod/ember-rdfa-editor-lblod-plugins/utils/article-structure-plugin/validate-datastore';
10
- import { ResolvedArticleStructurePluginOptions } from '@lblod/ember-rdfa-editor-lblod-plugins/plugins/article-structure-plugin';
5
+ moveSelectedStructure,
6
+ removeStructure,
7
+ unwrapStructure,
8
+ } from '@lblod/ember-rdfa-editor-lblod-plugins/plugins/article-structure-plugin/commands';
9
+ import { ArticleStructurePluginOptions } from '@lblod/ember-rdfa-editor-lblod-plugins/plugins/article-structure-plugin';
10
+ import { findAncestorOfType } from '@lblod/ember-rdfa-editor-lblod-plugins/plugins/article-structure-plugin/utils/structure';
11
+ import { tracked } from '@glimmer/tracking';
12
+ import { inject as service } from '@ember/service';
13
+ import IntlService from 'ember-intl/services/intl';
14
+
11
15
  type Args = {
12
16
  controller: ProseController;
13
17
  widgetArgs: {
14
- options: ResolvedArticleStructurePluginOptions;
18
+ options: ArticleStructurePluginOptions;
15
19
  };
16
20
  };
17
21
 
18
22
  export default class EditorPluginsStructureCardComponent extends Component<Args> {
23
+ @service declare intl: IntlService;
24
+ @tracked removeStructureContent = false;
25
+
19
26
  get controller() {
20
27
  return this.args.controller;
21
28
  }
22
29
 
23
30
  @action
24
- async moveStructure(moveUp: boolean) {
25
- const structureToMove = this.args.widgetArgs.options.structures.find(
26
- (structure) => structure === this.structureTypeSelected
31
+ moveStructure(direction: 'up' | 'down') {
32
+ this.controller.doCommand(
33
+ moveSelectedStructure(this.structureTypes, direction, this.intl)
27
34
  );
28
- if (structureToMove && this.structure) {
29
- const shaclReport = await validateDatastore(
30
- this.controller.datastore,
31
- structureToMove.shaclConstraint
32
- );
33
- this.controller.doCommand(
34
- moveStructure(
35
- this.controller,
36
- this.structure.uri,
37
- moveUp,
38
- this.args.widgetArgs.options,
39
- shaclReport
40
- )
41
- );
42
- }
35
+ this.controller.focus();
43
36
  }
44
37
 
45
38
  @action
46
39
  removeStructure() {
47
- if (this.structure) {
48
- this.controller.doCommand(
49
- deleteStructure(
50
- this.controller,
51
- this.structure.uri,
52
- this.args.widgetArgs.options
53
- )
54
- );
40
+ if (this.structure && this.currentStructureType) {
41
+ if (this.removeStructureContent) {
42
+ this.controller.doCommand(
43
+ removeStructure(this.structure, this.structureTypes)
44
+ );
45
+ } else {
46
+ this.controller.doCommand(
47
+ unwrapStructure(
48
+ {
49
+ ...this.structure,
50
+ type: this.currentStructureType,
51
+ },
52
+ this.structureTypes
53
+ )
54
+ );
55
+ }
55
56
  }
57
+ this.controller.focus();
56
58
  }
57
59
 
58
- get structure(): { uri: string; type: string } | undefined {
59
- const currentSelection = this.controller.state.selection;
60
- const limitedDatastore = this.controller.datastore.limitToRange(
61
- this.controller.state,
62
- currentSelection.from,
63
- currentSelection.to
60
+ @action
61
+ setRemoveStructureContent(value: boolean) {
62
+ this.removeStructureContent = value;
63
+ }
64
+
65
+ get structureTypes() {
66
+ return this.args.widgetArgs.options;
67
+ }
68
+
69
+ get structureNodeSpecs() {
70
+ return this.structureTypes.map(
71
+ (type) => this.controller.schema.nodes[type.name]
64
72
  );
73
+ }
65
74
 
66
- const quad = limitedDatastore
67
- .match(null, 'a')
68
- .transformDataset((dataset) => {
69
- return dataset.filter((quad) => {
70
- return this.args.widgetArgs.options.structureTypes.includes(
71
- quad.object.value
72
- );
73
- });
74
- })
75
- .asQuadResultSet()
76
- .first();
77
- if (quad) {
78
- return { uri: quad.subject.value, type: quad.object.value };
79
- }
80
- return;
75
+ get structure() {
76
+ const currentSelection = this.controller.state.selection;
77
+ return findAncestorOfType(currentSelection, ...this.structureNodeSpecs);
81
78
  }
82
79
 
83
- get structureTypeSelected() {
84
- const structureTypeof = this.structure?.type;
85
- if (structureTypeof) {
86
- return this.args.widgetArgs.options.structures.find((structure) =>
87
- structureTypeof.includes(structure.type)
80
+ get currentStructureType() {
81
+ if (this.structure) {
82
+ const { node: structureNode } = this.structure;
83
+ return this.structureTypes.find(
84
+ (spec) => spec.name === structureNode.type.name
88
85
  );
89
86
  }
90
87
  return;
91
88
  }
92
89
 
93
90
  get isOutsideStructure() {
94
- return !this.structure?.uri;
91
+ return !this.structure;
95
92
  }
96
93
 
97
- canMoveDown = trackedFunction(this, async () => {
98
- const structureToMove = this.args.widgetArgs.options.structures.find(
99
- (structure) => structure === this.structureTypeSelected
94
+ get canMoveDown() {
95
+ return this.controller.checkCommand(
96
+ moveSelectedStructure(this.structureTypes, 'down', this.intl)
100
97
  );
101
- if (structureToMove && this.structure) {
102
- const shaclReport = await validateDatastore(
103
- this.controller.datastore,
104
- structureToMove.shaclConstraint
105
- );
106
- return this.controller.checkCommand(
107
- moveStructure(
108
- this.controller,
109
- this.structure.uri,
110
- false,
111
- this.args.widgetArgs.options,
112
- shaclReport
113
- )
114
- );
115
- }
116
- return false;
117
- });
98
+ }
118
99
 
119
- canMoveUp = trackedFunction(this, async () => {
120
- const structureToMove = this.args.widgetArgs.options.structures.find(
121
- (structure) => structure === this.structureTypeSelected
100
+ get canMoveUp() {
101
+ return this.controller.checkCommand(
102
+ moveSelectedStructure(this.structureTypes, 'up', this.intl)
122
103
  );
123
- if (structureToMove && this.structure) {
124
- const shaclReport = await validateDatastore(
125
- this.controller.datastore,
126
- structureToMove.shaclConstraint
127
- );
128
- return this.controller.checkCommand(
129
- moveStructure(
130
- this.controller,
131
- this.structure.uri,
132
- true,
133
- this.args.widgetArgs.options,
134
- shaclReport
135
- )
136
- );
104
+ }
105
+
106
+ get canRemoveStructure() {
107
+ if (this.structure && this.currentStructureType) {
108
+ if (this.removeStructureContent) {
109
+ return true;
110
+ } else {
111
+ return this.controller.checkCommand(
112
+ unwrapStructure(
113
+ {
114
+ ...this.structure,
115
+ type: this.currentStructureType,
116
+ },
117
+ this.structureTypes
118
+ )
119
+ );
120
+ }
137
121
  }
138
122
  return false;
139
- });
123
+ }
140
124
  }
@@ -4,18 +4,12 @@ import { action } from '@ember/object';
4
4
  import {
5
5
  moveArticle,
6
6
  recalculateArticleNumbers,
7
- } from '@lblod/ember-rdfa-editor-lblod-plugins/commands/besluit-plugin';
7
+ } from '@lblod/ember-rdfa-editor-lblod-plugins/plugins/besluit-plugin/commands';
8
8
  import { ResolvedPNode } from '@lblod/ember-rdfa-editor/plugins/datastore';
9
- import { DecisionOptions } from '@lblod/ember-rdfa-editor-lblod-plugins/plugins/besluit-plugin';
10
9
  import { ProseController } from '@lblod/ember-rdfa-editor';
11
10
 
12
- interface ContextCardWidgetArgs {
13
- options?: DecisionOptions;
14
- }
15
-
16
11
  interface Args {
17
12
  controller: ProseController;
18
- widgetArgs: ContextCardWidgetArgs;
19
13
  }
20
14
 
21
15
  export default class BesluitContextCardComponent extends Component<Args> {
@@ -3,7 +3,7 @@ import { action } from '@ember/object';
3
3
  import {
4
4
  insertTitle,
5
5
  insertArticle,
6
- } from '@lblod/ember-rdfa-editor-lblod-plugins/commands/besluit-plugin';
6
+ } from '@lblod/ember-rdfa-editor-lblod-plugins/plugins/besluit-plugin/commands';
7
7
  import { ProseController } from '@lblod/ember-rdfa-editor';
8
8
 
9
9
  type Args = {
@@ -20,7 +20,7 @@ export default class BesluitPluginCardComponent extends Component<Args> {
20
20
  }
21
21
  @action
22
22
  insertArticle() {
23
- this.controller.checkAndDoCommand(insertArticle(this.controller, '', ''));
23
+ this.controller.checkAndDoCommand(insertArticle(this.controller, ''));
24
24
  this.focus();
25
25
  }
26
26
 
@@ -35,8 +35,6 @@ export default class BesluitPluginCardComponent extends Component<Args> {
35
35
  }
36
36
 
37
37
  get disableArticleInsert() {
38
- return !this.controller.checkCommand(
39
- insertArticle(this.controller, '', '')
40
- );
38
+ return !this.controller.checkCommand(insertArticle(this.controller, ''));
41
39
  }
42
40
  }
@@ -1,8 +1,7 @@
1
1
  import Component from '@glimmer/component';
2
2
  import { action } from '@ember/object';
3
3
  import { tracked } from '@glimmer/tracking';
4
- import { BesluitType } from '@lblod/ember-rdfa-editor-lblod-plugins/utils/fetchBesluitTypes';
5
-
4
+ import { BesluitType } from '@lblod/ember-rdfa-editor-lblod-plugins/plugins/besluit-type-plugin/utils/fetchBesluitTypes';
6
5
  type Args = {
7
6
  besluitTypes: BesluitType[];
8
7
  };
@@ -3,7 +3,6 @@ import Component from '@glimmer/component';
3
3
  import { action } from '@ember/object';
4
4
  import { task } from 'ember-concurrency';
5
5
  import { getOwner } from '@ember/application';
6
- import fetchBesluitTypes, { BesluitType } from '../../utils/fetchBesluitTypes';
7
6
  import { inject as service } from '@ember/service';
8
7
  import {
9
8
  addType,
@@ -14,6 +13,9 @@ import CurrentSessionService from '@lblod/frontend-gelinkt-notuleren/services/cu
14
13
  import { ResolvedPNode } from '@lblod/ember-rdfa-editor/plugins/datastore';
15
14
  import { unwrap } from '@lblod/ember-rdfa-editor/utils/option';
16
15
  import { getRdfaAttribute } from '@lblod/ember-rdfa-editor/utils/rdfa-utils';
16
+ import fetchBesluitTypes, {
17
+ BesluitType,
18
+ } from '@lblod/ember-rdfa-editor-lblod-plugins/plugins/besluit-type-plugin/utils/fetchBesluitTypes';
17
19
  declare module 'ember__owner' {
18
20
  export default interface Owner {
19
21
  resolveRegistration(name: string): unknown;
@@ -9,10 +9,6 @@ import {
9
9
  Decision,
10
10
  fetchDecisions,
11
11
  } from '../../plugins/citation-plugin/utils/vlaamse-codex';
12
- import {
13
- LEGISLATION_TYPE_CONCEPTS,
14
- LEGISLATION_TYPES,
15
- } from '../../utils/legislation-types';
16
12
  import { task as trackedTask } from 'ember-resources/util/ember-concurrency';
17
13
  import {
18
14
  Option,
@@ -25,6 +21,10 @@ import {
25
21
  } from '@lblod/ember-rdfa-editor-lblod-plugins/plugins/citation-plugin';
26
22
  import { ProseController, Transaction } from '@lblod/ember-rdfa-editor';
27
23
  import { citedText } from '@lblod/ember-rdfa-editor-lblod-plugins/plugins/citation-plugin/utils/cited-text';
24
+ import {
25
+ LEGISLATION_TYPES,
26
+ LEGISLATION_TYPE_CONCEPTS,
27
+ } from '@lblod/ember-rdfa-editor-lblod-plugins/plugins/citation-plugin/utils/legislation-types';
28
28
 
29
29
  interface Args {
30
30
  controller: ProseController;
@@ -1,7 +1,6 @@
1
1
  import Component from '@glimmer/component';
2
2
  import { action } from '@ember/object';
3
3
  import { tracked } from '@glimmer/tracking';
4
- import { LEGISLATION_TYPES } from '../../utils/legislation-types';
5
4
  import {
6
5
  Fragment,
7
6
  ProseController,
@@ -14,6 +13,7 @@ import {
14
13
  } from '@lblod/ember-rdfa-editor-lblod-plugins/plugins/citation-plugin/utils/vlaamse-codex';
15
14
  import { citedText } from '@lblod/ember-rdfa-editor-lblod-plugins/plugins/citation-plugin/utils/cited-text';
16
15
  import { CitationPlugin } from '@lblod/ember-rdfa-editor-lblod-plugins/plugins/citation-plugin';
16
+ import { LEGISLATION_TYPES } from '@lblod/ember-rdfa-editor-lblod-plugins/plugins/citation-plugin/utils/legislation-types';
17
17
 
18
18
  interface Args {
19
19
  controller: ProseController;
@@ -8,7 +8,7 @@ import { task as trackedTask } from 'ember-resources/util/ember-concurrency';
8
8
  import {
9
9
  LEGISLATION_TYPE_CONCEPTS,
10
10
  LEGISLATION_TYPES,
11
- } from '../../../utils/legislation-types';
11
+ } from '@lblod/ember-rdfa-editor-lblod-plugins/plugins/citation-plugin/utils/legislation-types';
12
12
  import {
13
13
  Article,
14
14
  Decision,
@@ -3,13 +3,13 @@ import { tracked } from '@glimmer/tracking';
3
3
  import { action } from '@ember/object';
4
4
  import { task } from 'ember-concurrency';
5
5
  import { v4 as uuidv4 } from 'uuid';
6
- import {
7
- defaultVariableTypes,
8
- VariableType,
9
- } from '../../utils/variable-plugins/default-variable-types';
10
6
  import { ProseController } from '@lblod/ember-rdfa-editor/core/prosemirror';
11
- import { CodeList } from '@lblod/ember-rdfa-editor-lblod-plugins/utils/variable-plugins/fetch-data';
12
7
  import { insertHtml } from '@lblod/ember-rdfa-editor/commands/insert-html-command';
8
+ import {
9
+ DEFAULT_VARIABLE_TYPES,
10
+ VariableType,
11
+ } from '@lblod/ember-rdfa-editor-lblod-plugins/plugins/insert-variable-plugin/utils/constants';
12
+ import { CodeList } from '@lblod/ember-rdfa-editor-lblod-plugins/plugins/insert-variable-plugin/utils/fetch-data';
13
13
  type Args = {
14
14
  controller: ProseController;
15
15
  widgetArgs: {
@@ -48,7 +48,7 @@ export default class EditorPluginsInsertCodelistCardComponent extends Component<
48
48
  const variablesArray: VariableType[] = [];
49
49
  for (const type of variableTypesSelectedByUser) {
50
50
  if (typeof type === 'string') {
51
- const variableType = defaultVariableTypes[type];
51
+ const variableType = DEFAULT_VARIABLE_TYPES[type];
52
52
  if (variableType) {
53
53
  variablesArray.push(variableType);
54
54
  } else {
@@ -1,7 +1,7 @@
1
1
  import Component from '@glimmer/component';
2
2
  import { tracked } from '@glimmer/tracking';
3
3
  import { action } from '@ember/object';
4
- import modifyDate from '../../commands/modify-date-command';
4
+ import { modifyDate } from '@lblod/ember-rdfa-editor-lblod-plugins/plugins/rdfa-date-plugin/commands';
5
5
  import { ProseController } from '@lblod/ember-rdfa-editor/core/prosemirror';
6
6
  import { getRdfaAttribute } from '@lblod/ember-rdfa-editor/utils/rdfa-utils';
7
7
  type Args = {
@@ -14,6 +14,7 @@ export default class RdfaDatePluginInsertComponent extends Component<Args> {
14
14
  get schema() {
15
15
  return this.controller.schema;
16
16
  }
17
+
17
18
  @action
18
19
  insertDate() {
19
20
  this.controller.withTransaction((tr) => {
@@ -5,7 +5,7 @@ import {
5
5
  NON_ZONAL_URI,
6
6
  POTENTIALLY_ZONAL_URI,
7
7
  ZONAL_URI,
8
- } from '../../constants';
8
+ } from '@lblod/ember-rdfa-editor-lblod-plugins/plugins/roadsign-regulation-plugin/utils/constants';
9
9
  import Measure from '@lblod/ember-rdfa-editor-lblod-plugins/models/measure';
10
10
  import { assert } from '@ember/debug';
11
11
 
@@ -2,7 +2,7 @@ import Component from '@glimmer/component';
2
2
  import { inject as service } from '@ember/service';
3
3
  import { task } from 'ember-concurrency';
4
4
  import { tracked } from '@glimmer/tracking';
5
- import includeInstructions from '../../utils/roadsign-regulation-plugin/includeInstructions';
5
+ import includeInstructions from '@lblod/ember-rdfa-editor-lblod-plugins/plugins/roadsign-regulation-plugin/utils/includeInstructions';
6
6
  import RoadsignRegistryService from '@lblod/ember-rdfa-editor-lblod-plugins/services/roadsign-registry';
7
7
 
8
8
  type Args = {
@@ -5,18 +5,18 @@ import { task } from 'ember-concurrency';
5
5
  import { getOwner } from '@ember/application';
6
6
  import { v4 as uuid } from 'uuid';
7
7
  import { inject as service } from '@ember/service';
8
- import includeInstructions from '../../utils/roadsign-regulation-plugin/includeInstructions';
8
+ import includeInstructions from '@lblod/ember-rdfa-editor-lblod-plugins/plugins/roadsign-regulation-plugin/utils/includeInstructions';
9
9
  import {
10
10
  NON_ZONAL_URI,
11
11
  POTENTIALLY_ZONAL_URI,
12
12
  ZONAL_URI,
13
- } from '../../constants';
13
+ } from '@lblod/ember-rdfa-editor-lblod-plugins/plugins/roadsign-regulation-plugin/utils/constants';
14
14
  import RoadsignRegistryService from '@lblod/ember-rdfa-editor-lblod-plugins/services/roadsign-registry';
15
15
  import { assert } from '@ember/debug';
16
16
  import { unwrap } from '@lblod/ember-rdfa-editor/utils/option';
17
17
  import Measure from '@lblod/ember-rdfa-editor-lblod-plugins/models/measure';
18
18
  import { ProseController } from '@lblod/ember-rdfa-editor/core/prosemirror';
19
- import { insertArticle } from '@lblod/ember-rdfa-editor-lblod-plugins/commands/besluit-plugin';
19
+ import { insertArticle } from '@lblod/ember-rdfa-editor-lblod-plugins/plugins/besluit-plugin/commands';
20
20
 
21
21
  const PAGE_SIZE = 10;
22
22
  const SIGN_TYPE_URI =
@@ -287,7 +287,7 @@ export default class RoadsignRegulationCard extends Component<Args> {
287
287
  `;
288
288
 
289
289
  this.args.controller.doCommand(
290
- insertArticle(this.args.controller, regulationHTML, '')
290
+ insertArticle(this.args.controller, regulationHTML)
291
291
  );
292
292
  this.args.closeModal();
293
293
  }