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

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 (283) hide show
  1. package/CHANGELOG.md +25 -0
  2. package/addon/commands/article-structure-plugin/delete-structure.ts +85 -0
  3. package/addon/commands/article-structure-plugin/index.ts +4 -0
  4. package/addon/commands/article-structure-plugin/insert-article-structure.ts +137 -0
  5. package/addon/commands/article-structure-plugin/move-structure.ts +227 -0
  6. package/addon/commands/article-structure-plugin/recalculate-structure-numbers.ts +88 -0
  7. package/addon/commands/besluit-plugin/get-article-nodes-for-besluit.ts +30 -0
  8. package/addon/commands/besluit-plugin/index.ts +4 -0
  9. package/addon/commands/besluit-plugin/insert-article.ts +94 -0
  10. package/addon/commands/besluit-plugin/insert-title.ts +67 -0
  11. package/addon/commands/besluit-plugin/move-article.ts +69 -0
  12. package/addon/commands/besluit-plugin/recalculate-article-numbers.ts +44 -0
  13. package/addon/commands/modify-date-command.ts +48 -0
  14. package/addon/components/article-structure-plugin/article-structure-card.hbs +14 -0
  15. package/addon/components/article-structure-plugin/article-structure-card.ts +83 -0
  16. package/addon/components/article-structure-plugin/structure-card.hbs +42 -0
  17. package/addon/components/article-structure-plugin/structure-card.ts +140 -0
  18. package/addon/components/au-native-input.hbs +30 -0
  19. package/addon/components/au-native-input.ts +47 -0
  20. package/addon/components/besluit-plugin/besluit-context-card.hbs +44 -0
  21. package/addon/components/besluit-plugin/besluit-context-card.ts +144 -0
  22. package/addon/components/besluit-plugin/besluit-plugin-card.hbs +20 -0
  23. package/addon/components/besluit-plugin/besluit-plugin-card.ts +42 -0
  24. package/addon/components/besluit-type-plugin/{besluit-type-select.js → besluit-type-select.ts} +9 -4
  25. package/addon/components/besluit-type-plugin/toolbar-dropdown.hbs +2 -0
  26. package/addon/components/besluit-type-plugin/toolbar-dropdown.ts +216 -0
  27. package/addon/components/citation-plugin/citation-card.hbs +118 -0
  28. package/addon/components/citation-plugin/citation-card.ts +230 -0
  29. package/addon/components/citation-plugin/citation-insert.hbs +20 -0
  30. package/addon/components/citation-plugin/citation-insert.ts +102 -0
  31. package/addon/components/{citaten-plugin → citation-plugin}/citations/article-list.hbs +2 -2
  32. package/addon/components/{citaten-plugin → citation-plugin}/citations/article-preview.hbs +0 -0
  33. package/addon/components/{citaten-plugin → citation-plugin}/citations/decision-detail.hbs +9 -6
  34. package/addon/components/{citaten-plugin/citations/decision-detail.js → citation-plugin/citations/decision-detail.ts} +30 -31
  35. package/addon/components/{citaten-plugin → citation-plugin}/citations/decision-list.hbs +2 -2
  36. package/addon/components/{citaten-plugin → citation-plugin}/citations/decision-preview.hbs +0 -0
  37. package/addon/components/citation-plugin/citations/search-modal.hbs +254 -0
  38. package/addon/components/{citaten-plugin/citations/search-modal.js → citation-plugin/citations/search-modal.ts} +116 -89
  39. package/addon/components/{citaten-plugin → citation-plugin}/helpers/alert-load-error.hbs +0 -0
  40. package/addon/components/{citaten-plugin → citation-plugin}/helpers/alert-no-items.hbs +0 -0
  41. package/addon/components/import-snippet-plugin/card.ts +119 -0
  42. package/addon/components/insert-variable-plugin/insert-variable-card.hbs +2 -1
  43. package/addon/components/insert-variable-plugin/insert-variable-card.ts +134 -0
  44. package/addon/components/rdfa-date-plugin/{rdfa-date-plugin-card.hbs → card.hbs} +3 -1
  45. package/addon/components/rdfa-date-plugin/card.ts +72 -0
  46. package/addon/components/rdfa-date-plugin/{rdfa-date-time-picker.hbs → date-time-picker.hbs} +0 -0
  47. package/addon/components/rdfa-date-plugin/{rdfa-date-time-picker.js → date-time-picker.ts} +26 -12
  48. package/addon/components/rdfa-date-plugin/{rdfa-date-plugin-insert.hbs → insert.hbs} +0 -0
  49. package/addon/components/rdfa-date-plugin/insert.ts +44 -0
  50. package/addon/components/roadsign-regulation-plugin/expanded-measure.ts +58 -0
  51. package/addon/components/roadsign-regulation-plugin/measure-template.ts +35 -0
  52. package/addon/components/roadsign-regulation-plugin/roadsign-regulation-card.hbs +2 -2
  53. package/addon/components/roadsign-regulation-plugin/roadsign-regulation-card.ts +60 -0
  54. package/addon/components/roadsign-regulation-plugin/{roadsigns-modal.js → roadsigns-modal.ts} +101 -64
  55. package/addon/components/roadsign-regulation-plugin/{roadsigns-pagination.js → roadsigns-pagination.ts} +7 -3
  56. package/addon/components/roadsign-regulation-plugin/roadsigns-table.ts +32 -0
  57. package/addon/components/standard-template-plugin/{template-card.hbs → card.hbs} +0 -0
  58. package/addon/components/standard-template-plugin/card.ts +11 -0
  59. package/addon/components/standard-template-plugin/template-provider.hbs +3 -1
  60. package/addon/components/standard-template-plugin/template-provider.ts +75 -0
  61. package/addon/components/table-of-contents-plugin/card.hbs +12 -1
  62. package/addon/components/table-of-contents-plugin/card.ts +60 -0
  63. package/addon/components/table-of-contents-plugin/{inline-components → ember-nodes}/outline.hbs +2 -2
  64. package/addon/components/table-of-contents-plugin/ember-nodes/table-of-contents.hbs +9 -0
  65. package/addon/components/table-of-contents-plugin/ember-nodes/table-of-contents.ts +95 -0
  66. package/addon/components/template-variable-plugin/template-variable-card.hbs +2 -1
  67. package/addon/components/template-variable-plugin/template-variable-card.ts +227 -0
  68. package/addon/{constants.js → constants.ts} +15 -3
  69. package/addon/ember-nodes/table-of-contents.ts +53 -0
  70. package/addon/helpers/{limit-text.js → limit-text.ts} +2 -2
  71. package/addon/initializers/plugin-initializer.js +0 -75
  72. package/addon/models/instruction.ts +18 -0
  73. package/addon/models/measure.ts +38 -0
  74. package/addon/models/sign.ts +36 -0
  75. package/addon/models/template.ts +14 -0
  76. package/addon/plugins/article-structure-plugin.ts +55 -0
  77. package/addon/plugins/besluit-plugin.ts +27 -0
  78. package/addon/plugins/besluit-type-plugin.ts +6 -0
  79. package/addon/plugins/citation-plugin/index.ts +216 -0
  80. package/addon/plugins/citation-plugin/marks/citation.ts +27 -0
  81. package/addon/plugins/citation-plugin/utils/cited-text.ts +17 -0
  82. package/addon/plugins/citation-plugin/utils/process-match.ts +135 -0
  83. package/addon/{utils/vlaamse-codex.js → plugins/citation-plugin/utils/vlaamse-codex.ts} +161 -42
  84. package/addon/plugins/import-snippet-plugin.ts +6 -0
  85. package/addon/plugins/insert-variable-plugin.ts +11 -0
  86. package/addon/plugins/rdfa-date-plugin.ts +11 -0
  87. package/addon/plugins/roadsign-regulation-plugin.ts +6 -0
  88. package/addon/plugins/standard-template-plugin.ts +6 -0
  89. package/addon/plugins/table-of-contents-plugin.ts +14 -0
  90. package/addon/plugins/template-variable-plugin.ts +6 -0
  91. package/addon/services/{import-rdfa-snippet.js → import-rdfa-snippet.ts} +48 -36
  92. package/addon/services/roadsign-registry.ts +288 -0
  93. package/addon/services/{standard-template-plugin.js → standard-template-plugin.ts} +17 -11
  94. package/addon/utils/article-structure-plugin/constants.ts +260 -0
  95. package/addon/utils/article-structure-plugin/defaults.ts +3 -0
  96. package/addon/utils/article-structure-plugin/options-with-defaults.ts +31 -0
  97. package/addon/utils/article-structure-plugin/validate-datastore.ts +23 -0
  98. package/addon/utils/besluit-plugin/get-title-for-decision.ts +35 -0
  99. package/addon/utils/{fetchBesluitTypes.js → fetchBesluitTypes.ts} +36 -16
  100. package/addon/utils/generate-template-plugin/{default-resources.js → default-resources.ts} +0 -0
  101. package/addon/utils/{instantiate-uuids.js → instantiate-uuids.ts} +9 -6
  102. package/addon/utils/{legislation-types.js → legislation-types.ts} +17 -3
  103. package/addon/utils/{memoize.js → memoize.ts} +4 -2
  104. package/addon/utils/option.ts +58 -0
  105. package/addon/utils/roadsign-regulation-plugin/{fetchData.js → fetchData.ts} +19 -2
  106. package/addon/utils/roadsign-regulation-plugin/includeInstructions.ts +16 -0
  107. package/addon/utils/romanize.ts +47 -0
  108. package/addon/utils/variable-plugins/{default-variable-types.js → default-variable-types.ts} +18 -7
  109. package/addon/utils/variable-plugins/{fetch-data.js → fetch-data.ts} +43 -15
  110. package/app/components/article-structure-plugin/article-structure-card.js +1 -0
  111. package/app/components/article-structure-plugin/structure-card.js +1 -0
  112. package/app/components/{citaten-plugin/citaat-card.js → au-native-input.js} +1 -1
  113. package/app/components/{citaten-plugin/citations/article-list.js → besluit-plugin/besluit-context-card.js} +1 -1
  114. package/app/components/besluit-plugin/besluit-plugin-card.js +1 -0
  115. package/app/components/{citaten-plugin/citations/modal.js → citation-plugin/citation-card.js} +1 -1
  116. package/app/components/citation-plugin/citation-insert.js +1 -0
  117. package/app/components/{citaten-plugin/citations/decision-list.js → citation-plugin/citations/article-list.js} +1 -1
  118. package/app/components/{citaten-plugin → citation-plugin}/citations/article-preview.js +1 -1
  119. package/app/components/{citaten-plugin → citation-plugin}/citations/decision-detail.js +1 -1
  120. package/app/components/citation-plugin/citations/decision-list.js +1 -0
  121. package/app/components/{citaten-plugin → citation-plugin}/citations/decision-preview.js +1 -1
  122. package/app/components/citation-plugin/citations/modal.js +1 -0
  123. package/app/components/{citaten-plugin → citation-plugin}/citations/search-modal.js +1 -1
  124. package/app/components/{citaten-plugin → citation-plugin}/helpers/alert-load-error.js +1 -1
  125. package/app/components/{citaten-plugin → citation-plugin}/helpers/alert-no-items.js +1 -1
  126. package/app/components/{citaten-plugin/citaat-insert.js → rdfa-date-plugin/card.js} +1 -1
  127. package/app/components/rdfa-date-plugin/date-time-picker.js +1 -0
  128. package/app/components/rdfa-date-plugin/insert.js +1 -0
  129. package/app/components/standard-template-plugin/card.js +1 -0
  130. package/app/components/table-of-contents-plugin/ember-nodes/outline.js +1 -0
  131. package/app/components/table-of-contents-plugin/ember-nodes/table-of-contents.js +1 -0
  132. package/app/styles/citaten-plugin.scss +1 -1
  133. package/commands/article-structure-plugin/delete-structure.d.ts +4 -0
  134. package/commands/article-structure-plugin/index.d.ts +4 -0
  135. package/commands/article-structure-plugin/insert-article-structure.d.ts +6 -0
  136. package/commands/article-structure-plugin/move-structure.d.ts +5 -0
  137. package/commands/article-structure-plugin/recalculate-structure-numbers.d.ts +7 -0
  138. package/commands/besluit-plugin/get-article-nodes-for-besluit.d.ts +5 -0
  139. package/commands/besluit-plugin/index.d.ts +4 -0
  140. package/commands/besluit-plugin/insert-article.d.ts +3 -0
  141. package/commands/besluit-plugin/insert-title.d.ts +2 -0
  142. package/commands/besluit-plugin/move-article.d.ts +2 -0
  143. package/commands/besluit-plugin/recalculate-article-numbers.d.ts +2 -0
  144. package/commands/modify-date-command.d.ts +2 -0
  145. package/components/article-structure-plugin/article-structure-card.d.ts +36 -0
  146. package/components/article-structure-plugin/structure-card.d.ts +23 -0
  147. package/components/au-native-input.d.ts +20 -0
  148. package/components/besluit-plugin/besluit-context-card.d.ts +29 -0
  149. package/components/besluit-plugin/besluit-plugin-card.d.ts +14 -0
  150. package/components/besluit-type-plugin/besluit-type-select.d.ts +11 -0
  151. package/components/besluit-type-plugin/toolbar-dropdown.d.ts +46 -0
  152. package/components/citation-plugin/citation-card.d.ts +51 -0
  153. package/components/citation-plugin/citation-insert.d.ts +24 -0
  154. package/components/citation-plugin/citations/decision-detail.d.ts +26 -0
  155. package/components/citation-plugin/citations/search-modal.d.ts +67 -0
  156. package/components/import-snippet-plugin/card.d.ts +19 -0
  157. package/components/insert-variable-plugin/insert-variable-card.d.ts +31 -0
  158. package/components/rdfa-date-plugin/card.d.ts +20 -0
  159. package/components/rdfa-date-plugin/date-time-picker.d.ts +32 -0
  160. package/components/rdfa-date-plugin/insert.d.ts +12 -0
  161. package/components/roadsign-regulation-plugin/expanded-measure.d.ts +20 -0
  162. package/components/roadsign-regulation-plugin/measure-template.d.ts +14 -0
  163. package/components/roadsign-regulation-plugin/roadsign-regulation-card.d.ts +12 -0
  164. package/components/roadsign-regulation-plugin/roadsigns-modal.d.ts +57 -0
  165. package/components/roadsign-regulation-plugin/roadsigns-pagination.d.ts +19 -0
  166. package/components/roadsign-regulation-plugin/roadsigns-table.d.ts +9 -0
  167. package/components/standard-template-plugin/card.d.ts +9 -0
  168. package/components/standard-template-plugin/template-provider.d.ts +17 -0
  169. package/components/table-of-contents-plugin/card.d.ts +20 -0
  170. package/components/table-of-contents-plugin/ember-nodes/table-of-contents.d.ts +22 -0
  171. package/components/template-variable-plugin/template-variable-card.d.ts +27 -0
  172. package/constants.d.ts +11 -0
  173. package/ember-nodes/table-of-contents.d.ts +4 -0
  174. package/helpers/limit-text.d.ts +8 -0
  175. package/index.js +5 -0
  176. package/models/instruction.d.ts +8 -0
  177. package/models/measure.d.ts +14 -0
  178. package/models/sign.d.ts +12 -0
  179. package/models/template.d.ts +13 -0
  180. package/package.json +27 -8
  181. package/plugins/article-structure-plugin.d.ts +29 -0
  182. package/plugins/besluit-plugin.d.ts +9 -0
  183. package/plugins/besluit-type-plugin.d.ts +2 -0
  184. package/plugins/citation-plugin/index.d.ts +31 -0
  185. package/plugins/citation-plugin/marks/citation.d.ts +2 -0
  186. package/plugins/citation-plugin/utils/cited-text.d.ts +3 -0
  187. package/plugins/citation-plugin/utils/process-match.d.ts +23 -0
  188. package/plugins/citation-plugin/utils/vlaamse-codex.d.ts +56 -0
  189. package/plugins/import-snippet-plugin.d.ts +2 -0
  190. package/plugins/insert-variable-plugin.d.ts +2 -0
  191. package/plugins/rdfa-date-plugin.d.ts +3 -0
  192. package/plugins/roadsign-regulation-plugin.d.ts +2 -0
  193. package/plugins/standard-template-plugin.d.ts +2 -0
  194. package/plugins/table-of-contents-plugin.d.ts +3 -0
  195. package/plugins/template-variable-plugin.d.ts +2 -0
  196. package/services/import-rdfa-snippet.d.ts +99 -0
  197. package/services/roadsign-registry.d.ts +42 -0
  198. package/services/standard-template-plugin.d.ts +21 -0
  199. package/translations/en-US.yaml +47 -1
  200. package/translations/nl-BE.yaml +49 -3
  201. package/tsconfig.json +34 -9
  202. package/types/config/environment.d.ts +22 -0
  203. package/types/ember-mu-transform-helpers/transforms/string-set.d.ts +14 -0
  204. package/types/lblod/frontend-gelinkt-notuleren/models/account.d.ts +10 -0
  205. package/types/lblod/frontend-gelinkt-notuleren/models/bestuurseenheid-classificatie-code.d.ts +10 -0
  206. package/types/lblod/frontend-gelinkt-notuleren/models/bestuurseenheid.d.ts +12 -0
  207. package/types/lblod/frontend-gelinkt-notuleren/models/gebruiker-model.d.ts +18 -0
  208. package/types/lblod/frontend-gelinkt-notuleren/services/current-session.d.ts +30 -0
  209. package/types/lblod/marawa/dom-helpers.d.ts +4 -0
  210. package/types/lblod/marawa/ember-object-mock.d.ts +3 -0
  211. package/types/lblod/marawa/node-walker.d.ts +18 -0
  212. package/types/lblod/marawa/range-helpers.d.ts +10 -0
  213. package/types/lblod/marawa/rdfa-attributes.d.ts +25 -0
  214. package/types/lblod/marawa/rdfa-block.d.ts +22 -0
  215. package/types/lblod/marawa/rdfa-context-scanner.d.ts +13 -0
  216. package/types/lblod/marawa/rdfa-helpers.d.ts +22 -0
  217. package/types/lblod/marawa/rich-node.d.ts +50 -0
  218. package/types/lblod/marawa/triple.d.ts +16 -0
  219. package/utils/article-structure-plugin/constants.d.ts +2 -0
  220. package/utils/article-structure-plugin/defaults.d.ts +4 -0
  221. package/utils/article-structure-plugin/options-with-defaults.d.ts +2 -0
  222. package/utils/article-structure-plugin/validate-datastore.d.ts +3 -0
  223. package/utils/besluit-plugin/get-title-for-decision.d.ts +10 -0
  224. package/utils/fetchBesluitTypes.d.ts +12 -0
  225. package/utils/generate-template-plugin/default-resources.d.ts +2 -0
  226. package/utils/instantiate-uuids.d.ts +1 -0
  227. package/utils/legislation-types.d.ts +24 -0
  228. package/utils/memoize.d.ts +1 -0
  229. package/utils/option.d.ts +14 -0
  230. package/utils/roadsign-regulation-plugin/fetchData.d.ts +8 -0
  231. package/utils/roadsign-regulation-plugin/includeInstructions.d.ts +2 -0
  232. package/utils/romanize.d.ts +2 -0
  233. package/utils/variable-plugins/default-variable-types.d.ts +7 -0
  234. package/utils/variable-plugins/fetch-data.d.ts +14 -0
  235. package/addon/commands/generate-template-command.js +0 -35
  236. package/addon/commands/insert-and-collapse.js +0 -32
  237. package/addon/commands/modify-date-command.js +0 -42
  238. package/addon/components/besluit-type-plugin/toolbar-dropdown.js +0 -188
  239. package/addon/components/citaten-plugin/citaat-card.hbs +0 -76
  240. package/addon/components/citaten-plugin/citaat-card.js +0 -286
  241. package/addon/components/citaten-plugin/citaat-insert.hbs +0 -20
  242. package/addon/components/citaten-plugin/citaat-insert.js +0 -68
  243. package/addon/components/citaten-plugin/citations/search-modal.hbs +0 -175
  244. package/addon/components/import-snippet-plugin/card.js +0 -95
  245. package/addon/components/insert-variable-plugin/insert-variable-card.js +0 -125
  246. package/addon/components/rdfa-date-plugin/rdfa-date-plugin-card.js +0 -71
  247. package/addon/components/rdfa-date-plugin/rdfa-date-plugin-insert.js +0 -24
  248. package/addon/components/roadsign-regulation-plugin/expanded-measure.js +0 -38
  249. package/addon/components/roadsign-regulation-plugin/measure-template.js +0 -30
  250. package/addon/components/roadsign-regulation-plugin/roadsign-regulation-card.js +0 -101
  251. package/addon/components/roadsign-regulation-plugin/roadsigns-table.js +0 -24
  252. package/addon/components/standard-template-plugin/template-card.js +0 -7
  253. package/addon/components/standard-template-plugin/template-provider.js +0 -75
  254. package/addon/components/table-of-contents-plugin/card.js +0 -53
  255. package/addon/components/table-of-contents-plugin/inline-components/table-of-contents.hbs +0 -9
  256. package/addon/components/table-of-contents-plugin/inline-components/table-of-contents.js +0 -100
  257. package/addon/components/template-variable-plugin/template-variable-card.js +0 -230
  258. package/addon/inline-components/table-of-contents.js +0 -43
  259. package/addon/models/instruction.js +0 -19
  260. package/addon/models/measure.js +0 -46
  261. package/addon/models/sign.js +0 -37
  262. package/addon/models/template.js +0 -9
  263. package/addon/plugins/besluit-type-plugin.js +0 -16
  264. package/addon/plugins/citaten-plugin.js +0 -22
  265. package/addon/plugins/import-snippet-plugin.js +0 -16
  266. package/addon/plugins/insert-variable-plugin.js +0 -19
  267. package/addon/plugins/rdfa-date-plugin.js +0 -26
  268. package/addon/plugins/roadsign-regulation-plugin.js +0 -24
  269. package/addon/plugins/standard-template-plugin.js +0 -33
  270. package/addon/plugins/table-of-contents-plugin.js +0 -27
  271. package/addon/plugins/template-variable-plugin.js +0 -21
  272. package/addon/services/roadsign-registry.js +0 -240
  273. package/addon/utils/processMatch.js +0 -80
  274. package/addon/utils/roadsign-regulation-plugin/includeInstructions.js +0 -10
  275. package/app/components/rdfa-date-plugin/rdfa-date-plugin-card.js +0 -1
  276. package/app/components/rdfa-date-plugin/rdfa-date-plugin-insert.js +0 -1
  277. package/app/components/rdfa-date-plugin/rdfa-date-time-picker.js +0 -1
  278. package/app/components/standard-template-plugin/template-card.js +0 -1
  279. package/app/components/table-of-contents-plugin/inline-components/outline.js +0 -1
  280. package/app/components/table-of-contents-plugin/inline-components/table-of-contents.js +0 -1
  281. package/app/initializers/plugin-initializer.js +0 -4
  282. package/types/dummy/index.d.ts +0 -1
  283. package/types/ember-data/types/registries/model.d.ts +0 -6
@@ -1,101 +0,0 @@
1
- import { action } from '@ember/object';
2
- import Component from '@glimmer/component';
3
- import { tracked } from '@glimmer/tracking';
4
-
5
- /**
6
- * Card displaying a hint of the Date plugin
7
- *
8
- * @module editor-roadsign-regulation-plugin
9
- * @class RoadsignRegulationCard
10
- * @extends Ember.Component
11
- */
12
- const acceptedTypes = [
13
- '>https://data.vlaanderen.be/id/concept/BesluitType/4d8f678a-6fa4-4d5f-a2a1-80974e43bf34',
14
- '>https://data.vlaanderen.be/id/concept/BesluitType/7d95fd2e-3cc9-4a4c-a58e-0fbc408c2f9b',
15
- '>https://data.vlaanderen.be/id/concept/BesluitType/3bba9f10-faff-49a6-acaa-85af7f2199a3',
16
- '>https://data.vlaanderen.be/id/concept/BesluitType/0d1278af-b69e-4152-a418-ec5cfd1c7d0b',
17
- '>https://data.vlaanderen.be/id/concept/BesluitType/e8afe7c5-9640-4db8-8f74-3f023bec3241',
18
- '>https://data.vlaanderen.be/id/concept/BesluitType/256bd04a-b74b-4f2a-8f5d-14dda4765af9',
19
- '>https://data.vlaanderen.be/id/concept/BesluitType/67378dd0-5413-474b-8996-d992ef81637a',
20
- ];
21
-
22
- export default class RoadsignRegulationCard extends Component {
23
- @tracked modalOpen;
24
- @tracked showCard = false;
25
-
26
- constructor() {
27
- super(...arguments);
28
- this.args.controller.onEvent('selectionChanged', this.selectionChanged);
29
- }
30
-
31
- @action
32
- toggleModal() {
33
- this.modalOpen = !this.modalOpen;
34
- }
35
-
36
- @action
37
- insert(html) {
38
- const selectedRange = this.args.controller.selection.lastRange;
39
- if (!selectedRange) {
40
- return;
41
- }
42
- const limitedDatastore = this.args.controller.datastore.limitToRange(
43
- selectedRange,
44
- 'rangeIsInside'
45
- );
46
- const besluit = limitedDatastore
47
- .match(null, 'a')
48
- .transformDataset((dataset, termConverter) => {
49
- return dataset.filter((quad) =>
50
- acceptedTypes
51
- .map((type) => termConverter(type).value)
52
- .includes(quad.object.value)
53
- );
54
- })
55
- .asSubjectNodes()
56
- .next().value;
57
- const besluitNode = [...besluit.nodes][0];
58
- let articleContainerNode;
59
- for (let child of besluitNode.children) {
60
- if (child.attributeMap.get('property') === 'prov:value') {
61
- articleContainerNode = child;
62
- break;
63
- }
64
- }
65
- const range = this.args.controller.rangeFactory.fromInNode(
66
- articleContainerNode,
67
- articleContainerNode.getMaxOffset(),
68
- articleContainerNode.getMaxOffset()
69
- );
70
- this.args.controller.executeCommand('insert-html', html, range);
71
- }
72
-
73
- @action
74
- selectionChanged() {
75
- const selectedRange = this.args.controller.selection.lastRange;
76
- if (!selectedRange) {
77
- return;
78
- }
79
- const limitedDatastore = this.args.controller.datastore.limitToRange(
80
- selectedRange,
81
- 'rangeIsInside'
82
- );
83
- const besluit = limitedDatastore
84
- .match(null, 'a')
85
- .transformDataset((dataset, termConverter) => {
86
- return dataset.filter((quad) =>
87
- acceptedTypes
88
- .map((type) => termConverter(type).value)
89
- .includes(quad.object.value)
90
- );
91
- })
92
- .asQuads()
93
- .next().value;
94
- if (besluit) {
95
- this.showCard = true;
96
- this.besluitUri = besluit.subject.value;
97
- } else {
98
- this.showCard = false;
99
- }
100
- }
101
- }
@@ -1,24 +0,0 @@
1
- import { action } from '@ember/object';
2
- import Component from '@glimmer/component';
3
- import { tracked } from '@glimmer/tracking';
4
- import { getOwner } from '@ember/application';
5
-
6
- export default class RoadsignsTable extends Component {
7
- @tracked selected;
8
- imageBaseUrl;
9
-
10
- constructor() {
11
- super(...arguments);
12
- const config = getOwner(this).resolveRegistration('config:environment');
13
- this.imageBaseUrl = config.roadsignRegulationPlugin.imageBaseUrl;
14
- }
15
-
16
- @action
17
- selectRow(id) {
18
- if (this.selected === id) {
19
- this.selected = undefined;
20
- } else {
21
- this.selected = id;
22
- }
23
- }
24
- }
@@ -1,7 +0,0 @@
1
- import Component from '@glimmer/component';
2
-
3
- export default class StandardTemplateTemplateCardComponent extends Component {
4
- get controller() {
5
- return this.args.controller;
6
- }
7
- }
@@ -1,75 +0,0 @@
1
- import Component from '@glimmer/component';
2
- import { action } from '@ember/object';
3
- import { tracked } from '@glimmer/tracking';
4
- import { inject as service } from '@ember/service';
5
- import instantiateUuids from '../../utils/instantiate-uuids';
6
-
7
- export default class TemplateProviderComponent extends Component {
8
- @service standardTemplatePlugin;
9
- @tracked applicableTemplates = [];
10
-
11
- constructor() {
12
- super(...arguments);
13
- this.args.controller.onEvent('selectionChanged', this.trackSelectionChange);
14
- }
15
-
16
- get busy() {
17
- return this.standardTemplatePlugin.fetchTemplates.isRunning;
18
- }
19
-
20
- get controller() {
21
- return this.args.controller;
22
- }
23
-
24
- get hasApplicableTemplates() {
25
- return this.applicableTemplates.length > 0;
26
- }
27
-
28
- templateIsApplicable(template) {
29
- const selectedRange = this.controller.selection.lastRange;
30
- if (!selectedRange) {
31
- return false;
32
- }
33
- const rangeStore = this.controller.datastore.limitToRange(
34
- selectedRange,
35
- 'rangeIsInside'
36
- );
37
-
38
- const containsTypes = rangeStore.match(null, 'a').dataset.some((quad) => {
39
- return template.contexts.includes(quad.object.value);
40
- });
41
-
42
- const containsDisabledTypes = rangeStore
43
- .match(null, 'a')
44
- .dataset.some((quad) =>
45
- template.disabledInContexts.includes(quad.object.value)
46
- );
47
-
48
- return containsTypes && !containsDisabledTypes;
49
- }
50
-
51
- @action
52
- trackSelectionChange() {
53
- this.applicableTemplates =
54
- this.standardTemplatePlugin.fetchTemplates.last.value?.filter(
55
- (template) => this.templateIsApplicable(template)
56
- ) || [];
57
- }
58
-
59
- @action
60
- async insert(template) {
61
- await template.reload();
62
- let insertRange = this.controller.selection.lastRange;
63
- if (insertRange.getMarks().hasMarkName('highlighted')) {
64
- insertRange = this.controller.rangeFactory.fromAroundNode(
65
- insertRange.getCommonAncestor()
66
- );
67
- }
68
- this.controller.executeCommand(
69
- 'insert-html',
70
- instantiateUuids(template.body),
71
- insertRange,
72
- 'right'
73
- );
74
- }
75
- }
@@ -1,53 +0,0 @@
1
- import { action } from '@ember/object';
2
- import Component from '@glimmer/component';
3
- import { tracked } from '@glimmer/tracking';
4
-
5
- export default class TableOfContentsCardComponent extends Component {
6
- @tracked toggled;
7
-
8
- constructor() {
9
- super(...arguments);
10
- this.toggled = this.tableOfContentsInstances.length !== 0;
11
- this.args.controller.onEvent('modelWritten', () => {
12
- this.toggled = this.tableOfContentsInstances.length !== 0;
13
- });
14
- }
15
-
16
- get tableOfContentsInstances() {
17
- return this.args.controller.getComponentInstances({
18
- componentName:
19
- 'table-of-contents-plugin/inline-components/table-of-contents',
20
- });
21
- }
22
-
23
- get tableOfContentsProps() {
24
- return this.args.widgetArgs.config
25
- ? { config: this.args.widgetArgs.config }
26
- : {};
27
- }
28
-
29
- @action
30
- toggle() {
31
- if (this.toggled) {
32
- // Remove instances from table of contents
33
- this.tableOfContentsInstances.forEach((instance) => {
34
- const model = instance.componentController.model;
35
- this.args.controller.executeCommand('remove-component', model);
36
- });
37
- } else {
38
- // Add table of contents
39
- console.log(this.tableOfContentsProps);
40
- this.args.controller.executeCommand(
41
- 'insert-component',
42
- 'table-of-contents-plugin/inline-components/table-of-contents',
43
- this.tableOfContentsProps,
44
- false,
45
- this.args.controller.rangeFactory.fromInElement(
46
- this.args.controller.modelRoot,
47
- 0,
48
- 0
49
- )
50
- );
51
- }
52
- }
53
- }
@@ -1,9 +0,0 @@
1
- <div class='au-u-background-gray-100 au-u-padding-tiny table-of-contents'>
2
- <h3>{{t "table-of-contents-plugin.title"}}</h3>
3
- {{#if this.documentOutline}}
4
- <TableOfContentsPlugin::InlineComponents::Outline
5
- @entries={{this.documentOutline.entries}}
6
- @onEntryClick={{this.moveToSection}}
7
- />
8
- {{/if}}
9
- </div>
@@ -1,100 +0,0 @@
1
- import ModelNode from '@lblod/ember-rdfa-editor/model/model-node';
2
- import { tracked } from '@glimmer/tracking';
3
- import ModelNodeUtils from '@lblod/ember-rdfa-editor/model/util/model-node-utils';
4
- import { action } from '@ember/object';
5
- import Component from '@glimmer/component';
6
- import dataFactory from '@rdfjs/data-model';
7
- import { TABLE_OF_CONTENTS_DEFAULT_CONFIG } from '../../../constants';
8
- export default class TableOfContentsComponent extends Component {
9
- @tracked
10
- documentOutline;
11
-
12
- constructor(owner, args) {
13
- super(owner, args);
14
- this.update();
15
-
16
- this.args.editorController.onEvent(
17
- 'contentChanged',
18
- this.update.bind(this)
19
- );
20
- this.args.editorController.onEvent('modelRead', this.update.bind(this));
21
- }
22
-
23
- get config() {
24
- return (
25
- this.args.componentController.getProperty('config') ??
26
- TABLE_OF_CONTENTS_DEFAULT_CONFIG
27
- );
28
- }
29
-
30
- willDestroy() {
31
- this.args.editorController.offEvent(
32
- 'contentChanged',
33
- this.update.bind(this)
34
- );
35
- this.args.editorController.offEvent('modelRead', this.update.bind(this));
36
- super.willDestroy();
37
- }
38
-
39
- update() {
40
- const outline = {
41
- entries: this.extractOutline(this.args.editorController.modelRoot),
42
- };
43
- this.documentOutline = outline;
44
- }
45
-
46
- extractOutline(node) {
47
- let result = [];
48
-
49
- if (ModelNode.isModelElement(node)) {
50
- let parent;
51
- const attributes = node.getRdfaAttributes();
52
- if (attributes.properties) {
53
- for (const tocConfigEntry of this.config) {
54
- if (attributes.properties.includes(tocConfigEntry.sectionPredicate)) {
55
- if (typeof tocConfigEntry.value === 'string') {
56
- parent = { content: tocConfigEntry.value, node };
57
- break;
58
- } else {
59
- const nodes = [
60
- ...this.args.editorController.datastore
61
- .match(
62
- `>${attributes.resource}`,
63
- dataFactory.namedNode(tocConfigEntry.value.predicate)
64
- )
65
- .asObjectNodeMapping()
66
- .nodes(),
67
- ];
68
- if (nodes.length) {
69
- parent = {
70
- content: ModelNodeUtils.getTextContent(nodes[0]),
71
- node,
72
- };
73
- break;
74
- }
75
- }
76
- }
77
- }
78
- }
79
- const subResults = [];
80
- node.children.forEach((child) => {
81
- subResults.push(...this.extractOutline(child));
82
- });
83
- if (parent) {
84
- parent.children = subResults;
85
- result = [parent];
86
- } else {
87
- result = subResults;
88
- }
89
- }
90
- return result;
91
- }
92
-
93
- @action
94
- moveToSection(node) {
95
- console.log('moveToSection');
96
- const range = this.args.editorController.rangeFactory.fromInNode(node, 0);
97
- this.args.editorController.selection.selectRange(range);
98
- this.args.editorController.write(true, true);
99
- }
100
- }
@@ -1,230 +0,0 @@
1
- import Component from '@glimmer/component';
2
- import { tracked } from '@glimmer/tracking';
3
- import { action } from '@ember/object';
4
- import { getOwner } from '@ember/application';
5
- import { task } from 'ember-concurrency';
6
-
7
- import { fetchCodeListOptions } from '../../utils/variable-plugins/fetch-data';
8
- import { MULTI_SELECT_CODELIST_TYPE, ZONAL_URI } from '../../constants';
9
-
10
- export default class EditorPluginsTemplateVariableCardComponent extends Component {
11
- @tracked variableOptions = [];
12
- @tracked selectedVariable;
13
- @tracked showCard = false;
14
- @tracked multiSelect = false;
15
- mappingUri;
16
-
17
- constructor() {
18
- super(...arguments);
19
- const config = getOwner(this).resolveRegistration('config:environment');
20
- this.zonalLocationCodelistUri =
21
- config.templateVariablePlugin.zonalLocationCodelistUri;
22
- this.endpoint = config.templateVariablePlugin.endpoint;
23
- this.nonZonalLocationCodelistUri =
24
- config.templateVariablePlugin.nonZonalLocationCodelistUri;
25
- this.args.controller.onEvent('selectionChanged', this.selectionChanged);
26
- this.liveHighlights = this.args.controller.createLiveMarkSet({
27
- datastoreQuery: (datastore) => {
28
- const limitedDataset = datastore.transformDataset(
29
- (dataset, termconverter) => {
30
- const mappings = dataset.match(
31
- null,
32
- termconverter('a'),
33
- termconverter('ext:Mapping')
34
- );
35
- const locations = dataset.match(
36
- null,
37
- termconverter('>http://purl.org/dc/terms/type'),
38
- termconverter('@en-US"location')
39
- );
40
- const codelists = dataset.match(
41
- null,
42
- termconverter('>http://purl.org/dc/terms/type'),
43
- termconverter('@en-US"codelist')
44
- );
45
- const supportedMappings = locations.union(codelists);
46
- return mappings.filter(
47
- (quad) => supportedMappings.match(quad.subject).size !== 0
48
- );
49
- }
50
- );
51
- const matches = limitedDataset.searchTextIn(
52
- 'subject',
53
- new RegExp('.*')
54
- );
55
- return matches;
56
- },
57
-
58
- liveMarkSpecs: ['highlighted'],
59
- });
60
- }
61
-
62
- @action
63
- insert() {
64
- const selectedRange = this.args.controller.selection.lastRange;
65
- if (!selectedRange) {
66
- return;
67
- }
68
- const limitedDatastore = this.args.controller.datastore.limitToRange(
69
- selectedRange,
70
- 'rangeIsInside'
71
- );
72
- const mapping = limitedDatastore
73
- .match(`>${this.mappingUri}`, 'ext:content', null)
74
- .asSubjectNodes()
75
- .next().value;
76
- const mappingNode = [...mapping.nodes][0];
77
- let mappingContentNode;
78
- for (let child of mappingNode.children) {
79
- if (child.attributeMap.get('property') === 'ext:content') {
80
- mappingContentNode = child;
81
- break;
82
- }
83
- }
84
- let textToInsert = '';
85
- if (this.selectedVariable.length) {
86
- textToInsert = this.selectedVariable
87
- .map((variable) => variable.value)
88
- .join(', ');
89
- } else {
90
- textToInsert = this.selectedVariable.value;
91
- }
92
- textToInsert = this.wrapVariableInHighlight(textToInsert);
93
- this.args.controller.executeCommand(
94
- 'insert-and-collapse',
95
- this.args.controller,
96
- textToInsert,
97
- mappingContentNode
98
- );
99
- }
100
-
101
- wrapVariableInHighlight(text) {
102
- return text.replace(
103
- /\$\{(.+?)\}/g,
104
- '<span class="mark-highlight-manual">${$1}</span>'
105
- );
106
- }
107
-
108
- @action
109
- selectionChanged() {
110
- this.showCard = false;
111
- this.selectedVariable = undefined;
112
- const selectedRange = this.args.controller.selection.lastRange;
113
- if (!selectedRange) {
114
- return;
115
- }
116
- const fullDatastore = this.args.controller.datastore;
117
- const limitedDatastore = this.args.controller.datastore.limitToRange(
118
- selectedRange,
119
- 'rangeIsInside'
120
- );
121
- const mapping = limitedDatastore
122
- .match(null, 'a', 'ext:Mapping')
123
- .asQuads()
124
- .next().value;
125
- console.log('MAPPING: ', mapping);
126
- if (mapping) {
127
- const mappingUri = mapping.subject.value;
128
- this.mappingUri = mappingUri;
129
- const mappingTypeTriple = fullDatastore
130
- .match(`>${mappingUri}`, 'dct:type', null)
131
- .asQuads()
132
- .next().value;
133
- console.log('TRIPLE: ', mappingTypeTriple);
134
- if (mappingTypeTriple) {
135
- const mappingType = mappingTypeTriple.object.value;
136
- if (mappingType === 'codelist') {
137
- const codelistTriple = fullDatastore
138
- .match(`>${mappingUri}`, 'ext:codelist', null)
139
- .asQuads()
140
- .next().value;
141
- const codelistSource = this.getCodelistSource(
142
- fullDatastore,
143
- mappingUri
144
- );
145
- this.showCard = true;
146
- const codelistUri = codelistTriple.object.value;
147
- this.fetchCodeListOptions.perform(codelistSource, codelistUri);
148
- } else if (mappingType === 'location') {
149
- const codelistSource = this.getCodelistSource(
150
- fullDatastore,
151
- mappingUri
152
- );
153
- const measureTriple = limitedDatastore
154
- .match(
155
- null,
156
- 'a',
157
- '>https://data.vlaanderen.be/ns/mobiliteit#Mobiliteitsmaatregel'
158
- )
159
- .asQuads()
160
- .next().value;
161
- const measureUri = measureTriple.subject.value;
162
- const zonalityTriple = fullDatastore
163
- .match(`>${measureUri}`, 'ext:zonality', null)
164
- .asQuads()
165
- .next().value;
166
- const zonalityUri = zonalityTriple.object.value;
167
- if (zonalityUri === ZONAL_URI) {
168
- this.fetchCodeListOptions.perform(
169
- codelistSource,
170
- this.zonalLocationCodelistUri,
171
- true
172
- );
173
- } else {
174
- this.fetchCodeListOptions.perform(
175
- codelistSource,
176
- this.nonZonalLocationCodelistUri,
177
- true
178
- );
179
- }
180
- this.showCard = true;
181
- }
182
- }
183
- }
184
- }
185
-
186
- getCodelistSource(fullDatastore, mappingUri) {
187
- const codelistSourceTriple = fullDatastore
188
- .match(`>${mappingUri}`, 'dct:source', null)
189
- .asQuads()
190
- .next();
191
-
192
- if (codelistSourceTriple && codelistSourceTriple.value) {
193
- const codelistSourceTripleValue = codelistSourceTriple.value;
194
- return codelistSourceTripleValue.object.value;
195
- } else {
196
- return this.endpoint;
197
- }
198
- }
199
-
200
- @action
201
- updateVariable(variable) {
202
- this.selectedVariable = variable;
203
- }
204
-
205
- @task
206
- *fetchCodeListOptions(endpoint, codelistUri, isLocation) {
207
- const { type, options } = yield fetchCodeListOptions(endpoint, codelistUri);
208
- if (isLocation) {
209
- this.variableOptions = options.map((option) => ({
210
- label: option.label,
211
- value: this.wrapInLocation(option.value),
212
- }));
213
- } else {
214
- this.variableOptions = options;
215
- }
216
- if (type === MULTI_SELECT_CODELIST_TYPE) {
217
- this.multiSelect = true;
218
- } else {
219
- this.multiSelect = false;
220
- }
221
- }
222
-
223
- wrapInLocation(value) {
224
- return `
225
- <span property="https://data.vlaanderen.be/ns/mobiliteit#plaatsbepaling">
226
- ${value}
227
- </span>
228
- `;
229
- }
230
- }
@@ -1,43 +0,0 @@
1
- import { InlineComponentSpec } from '@lblod/ember-rdfa-editor/model/inline-components/model-inline-component';
2
- import { isElement } from '@lblod/ember-rdfa-editor/utils/dom-helpers';
3
- import { TABLE_OF_CONTENTS_DEFAULT_CONFIG } from '../constants';
4
- export default class TableOfContentsSpec extends InlineComponentSpec {
5
- matcher = {
6
- tag: this.tag,
7
- attributeBuilder: (node) => {
8
- if (isElement(node)) {
9
- if (
10
- (node.classList.contains('inline-component') &&
11
- (node.classList.contains(this.name) ||
12
- node.classList.contains(
13
- 'inline-components/table-of-contents'
14
- ))) ||
15
- node.dataset.inlineComponent === this.name ||
16
- node.dataset.inlineComponent === 'inline-components/table-of-contents'
17
- ) {
18
- return {};
19
- }
20
- }
21
- return null;
22
- },
23
- };
24
-
25
- properties = {
26
- config: {
27
- serializable: true,
28
- defaultValue: TABLE_OF_CONTENTS_DEFAULT_CONFIG,
29
- },
30
- };
31
-
32
- _renderStatic() {
33
- // TODO: should be implemented when static version of inline components work correctly
34
- return '';
35
- }
36
- constructor(controller) {
37
- super(
38
- 'table-of-contents-plugin/inline-components/table-of-contents',
39
- 'div',
40
- controller
41
- );
42
- }
43
- }
@@ -1,19 +0,0 @@
1
- export default class Instruction {
2
- name;
3
- template;
4
- annotatedTemplate;
5
-
6
- static fromBinding(binding) {
7
- return new Instruction(
8
- binding.name.value,
9
- binding.template.value,
10
- binding.annotatedTemplate.value
11
- );
12
- }
13
-
14
- constructor(name, template, annotatedTemplate) {
15
- this.name = name;
16
- this.template = template;
17
- this.annotatedTemplate = annotatedTemplate;
18
- }
19
- }