@lblod/ember-rdfa-editor-lblod-plugins 0.4.1 → 1.0.0-alpha.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 (316) hide show
  1. package/CHANGELOG.md +46 -0
  2. package/addon/components/article-structure-plugin/article-structure-card.hbs +10 -0
  3. package/addon/components/article-structure-plugin/article-structure-card.ts +33 -0
  4. package/addon/components/article-structure-plugin/structure-card.hbs +46 -0
  5. package/addon/components/article-structure-plugin/structure-card.ts +124 -0
  6. package/addon/components/au-native-input.hbs +30 -0
  7. package/addon/components/au-native-input.ts +47 -0
  8. package/addon/components/besluit-plugin/besluit-context-card.hbs +44 -0
  9. package/addon/components/besluit-plugin/besluit-context-card.ts +138 -0
  10. package/addon/components/besluit-plugin/besluit-plugin-card.hbs +20 -0
  11. package/addon/components/besluit-plugin/besluit-plugin-card.ts +40 -0
  12. package/addon/components/besluit-type-plugin/{besluit-type-select.js → besluit-type-select.ts} +8 -4
  13. package/addon/components/besluit-type-plugin/toolbar-dropdown.hbs +2 -0
  14. package/addon/components/besluit-type-plugin/toolbar-dropdown.ts +218 -0
  15. package/addon/components/citation-plugin/citation-card.hbs +118 -0
  16. package/addon/components/citation-plugin/citation-card.ts +230 -0
  17. package/addon/components/citation-plugin/citation-insert.hbs +20 -0
  18. package/addon/components/citation-plugin/citation-insert.ts +102 -0
  19. package/addon/components/{citaten-plugin → citation-plugin}/citations/article-list.hbs +2 -2
  20. package/addon/components/{citaten-plugin → citation-plugin}/citations/article-preview.hbs +0 -0
  21. package/addon/components/{citaten-plugin → citation-plugin}/citations/decision-detail.hbs +9 -6
  22. package/addon/components/{citaten-plugin/citations/decision-detail.js → citation-plugin/citations/decision-detail.ts} +30 -31
  23. package/addon/components/{citaten-plugin → citation-plugin}/citations/decision-list.hbs +2 -2
  24. package/addon/components/{citaten-plugin → citation-plugin}/citations/decision-preview.hbs +0 -0
  25. package/addon/components/citation-plugin/citations/search-modal.hbs +254 -0
  26. package/addon/components/{citaten-plugin/citations/search-modal.js → citation-plugin/citations/search-modal.ts} +117 -90
  27. package/addon/components/{citaten-plugin → citation-plugin}/helpers/alert-load-error.hbs +0 -0
  28. package/addon/components/{citaten-plugin → citation-plugin}/helpers/alert-no-items.hbs +0 -0
  29. package/addon/components/import-snippet-plugin/card.ts +119 -0
  30. package/addon/components/insert-variable-plugin/insert-variable-card.hbs +2 -1
  31. package/addon/components/insert-variable-plugin/insert-variable-card.ts +134 -0
  32. package/addon/components/rdfa-date-plugin/{rdfa-date-plugin-card.hbs → card.hbs} +3 -1
  33. package/addon/components/rdfa-date-plugin/card.ts +72 -0
  34. package/addon/components/rdfa-date-plugin/{rdfa-date-time-picker.hbs → date-time-picker.hbs} +0 -0
  35. package/addon/components/rdfa-date-plugin/{rdfa-date-time-picker.js → date-time-picker.ts} +26 -12
  36. package/addon/components/rdfa-date-plugin/{rdfa-date-plugin-insert.hbs → insert.hbs} +0 -0
  37. package/addon/components/rdfa-date-plugin/insert.ts +45 -0
  38. package/addon/components/roadsign-regulation-plugin/expanded-measure.ts +58 -0
  39. package/addon/components/roadsign-regulation-plugin/measure-template.ts +35 -0
  40. package/addon/components/roadsign-regulation-plugin/roadsign-regulation-card.hbs +2 -2
  41. package/addon/components/roadsign-regulation-plugin/roadsign-regulation-card.ts +60 -0
  42. package/addon/components/roadsign-regulation-plugin/{roadsigns-modal.js → roadsigns-modal.ts} +103 -66
  43. package/addon/components/roadsign-regulation-plugin/{roadsigns-pagination.js → roadsigns-pagination.ts} +7 -3
  44. package/addon/components/roadsign-regulation-plugin/roadsigns-table.ts +32 -0
  45. package/addon/components/standard-template-plugin/{template-card.hbs → card.hbs} +0 -0
  46. package/addon/components/standard-template-plugin/card.ts +11 -0
  47. package/addon/components/standard-template-plugin/template-provider.hbs +3 -1
  48. package/addon/components/standard-template-plugin/template-provider.ts +75 -0
  49. package/addon/components/table-of-contents-plugin/card.hbs +12 -1
  50. package/addon/components/table-of-contents-plugin/card.ts +60 -0
  51. package/addon/components/table-of-contents-plugin/{inline-components → ember-nodes}/outline.hbs +2 -2
  52. package/addon/components/table-of-contents-plugin/ember-nodes/table-of-contents.hbs +9 -0
  53. package/addon/components/table-of-contents-plugin/ember-nodes/table-of-contents.ts +95 -0
  54. package/addon/components/template-variable-plugin/template-variable-card.hbs +2 -1
  55. package/addon/components/template-variable-plugin/template-variable-card.ts +227 -0
  56. package/addon/helpers/{limit-text.js → limit-text.ts} +2 -2
  57. package/addon/models/instruction.ts +18 -0
  58. package/addon/models/measure.ts +38 -0
  59. package/addon/models/sign.ts +36 -0
  60. package/addon/models/template.ts +14 -0
  61. package/addon/plugins/article-structure-plugin/commands/index.ts +6 -0
  62. package/addon/plugins/article-structure-plugin/commands/insert-structure.ts +80 -0
  63. package/addon/plugins/article-structure-plugin/commands/move-selected-structure.ts +130 -0
  64. package/addon/plugins/article-structure-plugin/commands/recalculate-structure-numbers.ts +26 -0
  65. package/addon/plugins/article-structure-plugin/commands/remove-structure.ts +21 -0
  66. package/addon/plugins/article-structure-plugin/commands/unwrap-structure.ts +40 -0
  67. package/addon/plugins/article-structure-plugin/commands/wrap-structure-content.ts +66 -0
  68. package/addon/plugins/article-structure-plugin/constants.ts +11 -0
  69. package/addon/plugins/article-structure-plugin/index.ts +70 -0
  70. package/addon/plugins/article-structure-plugin/structures/article-paragraph.ts +94 -0
  71. package/addon/plugins/article-structure-plugin/structures/article.ts +129 -0
  72. package/addon/plugins/article-structure-plugin/structures/chapter.ts +83 -0
  73. package/addon/plugins/article-structure-plugin/structures/index.ts +33 -0
  74. package/addon/plugins/article-structure-plugin/structures/section.ts +82 -0
  75. package/addon/plugins/article-structure-plugin/structures/structure-header.ts +65 -0
  76. package/addon/plugins/article-structure-plugin/structures/subsection.ts +83 -0
  77. package/addon/plugins/article-structure-plugin/structures/title.ts +83 -0
  78. package/addon/plugins/article-structure-plugin/utils/namespace.ts +25 -0
  79. package/addon/plugins/article-structure-plugin/utils/structure.ts +162 -0
  80. package/addon/plugins/besluit-plugin/commands/get-article-nodes-for-besluit.ts +30 -0
  81. package/addon/plugins/besluit-plugin/commands/index.ts +4 -0
  82. package/addon/plugins/besluit-plugin/commands/insert-article.ts +70 -0
  83. package/addon/plugins/besluit-plugin/commands/insert-title.ts +67 -0
  84. package/addon/plugins/besluit-plugin/commands/move-article.ts +69 -0
  85. package/addon/plugins/besluit-plugin/commands/recalculate-article-numbers.ts +44 -0
  86. package/addon/plugins/besluit-plugin/index.ts +11 -0
  87. package/addon/plugins/besluit-plugin/utils/get-title-for-decision.ts +35 -0
  88. package/addon/plugins/besluit-type-plugin/index.ts +6 -0
  89. package/addon/{utils/fetchBesluitTypes.js → plugins/besluit-type-plugin/utils/fetchBesluitTypes.ts} +35 -16
  90. package/addon/plugins/citation-plugin/index.ts +216 -0
  91. package/addon/plugins/citation-plugin/marks/citation.ts +27 -0
  92. package/addon/plugins/citation-plugin/utils/cited-text.ts +17 -0
  93. package/addon/{utils/legislation-types.js → plugins/citation-plugin/utils/legislation-types.ts} +17 -3
  94. package/addon/plugins/citation-plugin/utils/process-match.ts +132 -0
  95. package/addon/{utils/vlaamse-codex.js → plugins/citation-plugin/utils/vlaamse-codex.ts} +160 -41
  96. package/addon/plugins/import-snippet-plugin.ts +6 -0
  97. package/addon/plugins/insert-variable-plugin/index.ts +11 -0
  98. package/addon/{utils/variable-plugins/default-variable-types.js → plugins/insert-variable-plugin/utils/constants.ts} +18 -7
  99. package/addon/plugins/insert-variable-plugin/utils/fetch-data.ts +41 -0
  100. package/addon/plugins/rdfa-date-plugin/commands/index.ts +1 -0
  101. package/addon/plugins/rdfa-date-plugin/commands/modify-date.ts +48 -0
  102. package/addon/plugins/rdfa-date-plugin/index.ts +11 -0
  103. package/addon/plugins/roadsign-regulation-plugin/index.ts +6 -0
  104. package/addon/plugins/roadsign-regulation-plugin/utils/constants.ts +8 -0
  105. package/addon/{utils/roadsign-regulation-plugin/fetchData.js → plugins/roadsign-regulation-plugin/utils/fetchData.ts} +20 -3
  106. package/addon/plugins/roadsign-regulation-plugin/utils/includeInstructions.ts +16 -0
  107. package/addon/plugins/standard-template-plugin/index.ts +6 -0
  108. package/addon/plugins/standard-template-plugin/utils/instantiate-uuids.ts +48 -0
  109. package/addon/plugins/table-of-contents-plugin/index.ts +14 -0
  110. package/addon/plugins/table-of-contents-plugin/nodes/index.ts +1 -0
  111. package/addon/plugins/table-of-contents-plugin/nodes/table-of-contents.ts +53 -0
  112. package/addon/plugins/table-of-contents-plugin/utils/constants.ts +17 -0
  113. package/addon/plugins/template-variable-plugin/index.ts +6 -0
  114. package/addon/plugins/template-variable-plugin/utils/constants.ts +2 -0
  115. package/addon/plugins/template-variable-plugin/utils/fetch-data.ts +62 -0
  116. package/addon/services/{import-rdfa-snippet.js → import-rdfa-snippet.ts} +48 -36
  117. package/addon/services/roadsign-registry.ts +288 -0
  118. package/addon/services/{standard-template-plugin.js → standard-template-plugin.ts} +17 -11
  119. package/addon/utils/memoize.ts +8 -0
  120. package/addon/utils/option.ts +58 -0
  121. package/addon/utils/sparql-helpers.ts +27 -0
  122. package/app/components/article-structure-plugin/article-structure-card.js +1 -0
  123. package/app/components/article-structure-plugin/structure-card.js +1 -0
  124. package/app/components/{citaten-plugin/citaat-card.js → au-native-input.js} +1 -1
  125. package/app/components/{citaten-plugin/citations/article-list.js → besluit-plugin/besluit-context-card.js} +1 -1
  126. package/app/components/besluit-plugin/besluit-plugin-card.js +1 -0
  127. package/app/components/{citaten-plugin/citations/modal.js → citation-plugin/citation-card.js} +1 -1
  128. package/app/components/citation-plugin/citation-insert.js +1 -0
  129. package/app/components/{citaten-plugin/citations/decision-list.js → citation-plugin/citations/article-list.js} +1 -1
  130. package/app/components/{citaten-plugin → citation-plugin}/citations/article-preview.js +1 -1
  131. package/app/components/{citaten-plugin → citation-plugin}/citations/decision-detail.js +1 -1
  132. package/app/components/citation-plugin/citations/decision-list.js +1 -0
  133. package/app/components/{citaten-plugin → citation-plugin}/citations/decision-preview.js +1 -1
  134. package/app/components/citation-plugin/citations/modal.js +1 -0
  135. package/app/components/{citaten-plugin → citation-plugin}/citations/search-modal.js +1 -1
  136. package/app/components/{citaten-plugin → citation-plugin}/helpers/alert-load-error.js +1 -1
  137. package/app/components/{citaten-plugin → citation-plugin}/helpers/alert-no-items.js +1 -1
  138. package/app/components/{citaten-plugin/citaat-insert.js → rdfa-date-plugin/card.js} +1 -1
  139. package/app/components/rdfa-date-plugin/date-time-picker.js +1 -0
  140. package/app/components/rdfa-date-plugin/insert.js +1 -0
  141. package/app/components/standard-template-plugin/card.js +1 -0
  142. package/app/components/table-of-contents-plugin/ember-nodes/outline.js +1 -0
  143. package/app/components/table-of-contents-plugin/ember-nodes/table-of-contents.js +1 -0
  144. package/app/styles/citaten-plugin.scss +1 -1
  145. package/components/article-structure-plugin/article-structure-card.d.ts +17 -0
  146. package/components/article-structure-plugin/structure-card.d.ts +32 -0
  147. package/components/au-native-input.d.ts +20 -0
  148. package/components/besluit-plugin/besluit-context-card.d.ts +24 -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/helpers/limit-text.d.ts +8 -0
  173. package/index.js +5 -0
  174. package/models/instruction.d.ts +8 -0
  175. package/models/measure.d.ts +14 -0
  176. package/models/sign.d.ts +12 -0
  177. package/models/template.d.ts +13 -0
  178. package/package.json +29 -8
  179. package/plugins/article-structure-plugin/commands/index.d.ts +6 -0
  180. package/plugins/article-structure-plugin/commands/insert-structure.d.ts +5 -0
  181. package/plugins/article-structure-plugin/commands/move-selected-structure.d.ts +10 -0
  182. package/plugins/article-structure-plugin/commands/recalculate-structure-numbers.d.ts +3 -0
  183. package/plugins/article-structure-plugin/commands/remove-structure.d.ts +7 -0
  184. package/plugins/article-structure-plugin/commands/unwrap-structure.d.ts +8 -0
  185. package/plugins/article-structure-plugin/commands/wrap-structure-content.d.ts +8 -0
  186. package/plugins/article-structure-plugin/constants.d.ts +5 -0
  187. package/plugins/article-structure-plugin/index.d.ts +41 -0
  188. package/plugins/article-structure-plugin/structures/article-paragraph.d.ts +4 -0
  189. package/plugins/article-structure-plugin/structures/article.d.ts +6 -0
  190. package/plugins/article-structure-plugin/structures/chapter.d.ts +4 -0
  191. package/plugins/article-structure-plugin/structures/index.d.ts +17 -0
  192. package/plugins/article-structure-plugin/structures/section.d.ts +4 -0
  193. package/plugins/article-structure-plugin/structures/structure-header.d.ts +2 -0
  194. package/plugins/article-structure-plugin/structures/subsection.d.ts +4 -0
  195. package/plugins/article-structure-plugin/structures/title.d.ts +4 -0
  196. package/plugins/article-structure-plugin/utils/namespace.d.ts +6 -0
  197. package/plugins/article-structure-plugin/utils/structure.d.ts +20 -0
  198. package/plugins/besluit-plugin/commands/get-article-nodes-for-besluit.d.ts +5 -0
  199. package/plugins/besluit-plugin/commands/index.d.ts +4 -0
  200. package/plugins/besluit-plugin/commands/insert-article.d.ts +3 -0
  201. package/plugins/besluit-plugin/commands/insert-title.d.ts +2 -0
  202. package/plugins/besluit-plugin/commands/move-article.d.ts +2 -0
  203. package/plugins/besluit-plugin/commands/recalculate-article-numbers.d.ts +2 -0
  204. package/plugins/besluit-plugin/index.d.ts +3 -0
  205. package/plugins/besluit-plugin/utils/get-title-for-decision.d.ts +10 -0
  206. package/plugins/besluit-type-plugin/index.d.ts +2 -0
  207. package/plugins/besluit-type-plugin/utils/fetchBesluitTypes.d.ts +12 -0
  208. package/plugins/citation-plugin/index.d.ts +31 -0
  209. package/plugins/citation-plugin/marks/citation.d.ts +2 -0
  210. package/plugins/citation-plugin/utils/cited-text.d.ts +3 -0
  211. package/plugins/citation-plugin/utils/legislation-types.d.ts +24 -0
  212. package/plugins/citation-plugin/utils/process-match.d.ts +23 -0
  213. package/plugins/citation-plugin/utils/vlaamse-codex.d.ts +56 -0
  214. package/plugins/import-snippet-plugin.d.ts +2 -0
  215. package/plugins/insert-variable-plugin/index.d.ts +2 -0
  216. package/plugins/insert-variable-plugin/utils/constants.d.ts +7 -0
  217. package/plugins/insert-variable-plugin/utils/fetch-data.d.ts +5 -0
  218. package/plugins/rdfa-date-plugin/commands/index.d.ts +1 -0
  219. package/plugins/rdfa-date-plugin/commands/modify-date.d.ts +2 -0
  220. package/plugins/rdfa-date-plugin/index.d.ts +3 -0
  221. package/plugins/roadsign-regulation-plugin/index.d.ts +2 -0
  222. package/plugins/roadsign-regulation-plugin/utils/constants.d.ts +3 -0
  223. package/plugins/roadsign-regulation-plugin/utils/fetchData.d.ts +8 -0
  224. package/plugins/roadsign-regulation-plugin/utils/includeInstructions.d.ts +2 -0
  225. package/plugins/standard-template-plugin/index.d.ts +2 -0
  226. package/plugins/standard-template-plugin/utils/instantiate-uuids.d.ts +15 -0
  227. package/plugins/table-of-contents-plugin/index.d.ts +3 -0
  228. package/plugins/table-of-contents-plugin/nodes/index.d.ts +1 -0
  229. package/plugins/table-of-contents-plugin/nodes/table-of-contents.d.ts +4 -0
  230. package/plugins/table-of-contents-plugin/utils/constants.d.ts +7 -0
  231. package/plugins/template-variable-plugin/index.d.ts +2 -0
  232. package/plugins/template-variable-plugin/utils/constants.d.ts +1 -0
  233. package/plugins/template-variable-plugin/utils/fetch-data.d.ts +9 -0
  234. package/services/import-rdfa-snippet.d.ts +99 -0
  235. package/services/roadsign-registry.d.ts +42 -0
  236. package/services/standard-template-plugin.d.ts +21 -0
  237. package/translations/en-US.yaml +64 -1
  238. package/translations/nl-BE.yaml +66 -3
  239. package/tsconfig.json +34 -9
  240. package/types/config/environment.d.ts +22 -0
  241. package/types/ember-mu-transform-helpers/transforms/string-set.d.ts +14 -0
  242. package/types/lblod/frontend-gelinkt-notuleren/models/account.d.ts +10 -0
  243. package/types/lblod/frontend-gelinkt-notuleren/models/bestuurseenheid-classificatie-code.d.ts +10 -0
  244. package/types/lblod/frontend-gelinkt-notuleren/models/bestuurseenheid.d.ts +12 -0
  245. package/types/lblod/frontend-gelinkt-notuleren/models/gebruiker-model.d.ts +18 -0
  246. package/types/lblod/frontend-gelinkt-notuleren/services/current-session.d.ts +30 -0
  247. package/types/lblod/marawa/dom-helpers.d.ts +4 -0
  248. package/types/lblod/marawa/ember-object-mock.d.ts +3 -0
  249. package/types/lblod/marawa/node-walker.d.ts +18 -0
  250. package/types/lblod/marawa/range-helpers.d.ts +10 -0
  251. package/types/lblod/marawa/rdfa-attributes.d.ts +25 -0
  252. package/types/lblod/marawa/rdfa-block.d.ts +22 -0
  253. package/types/lblod/marawa/rdfa-context-scanner.d.ts +13 -0
  254. package/types/lblod/marawa/rdfa-helpers.d.ts +22 -0
  255. package/types/lblod/marawa/rich-node.d.ts +50 -0
  256. package/types/lblod/marawa/triple.d.ts +16 -0
  257. package/utils/memoize.d.ts +1 -0
  258. package/utils/option.d.ts +14 -0
  259. package/utils/sparql-helpers.d.ts +7 -0
  260. package/addon/commands/generate-template-command.js +0 -35
  261. package/addon/commands/insert-and-collapse.js +0 -32
  262. package/addon/commands/modify-date-command.js +0 -42
  263. package/addon/components/besluit-type-plugin/toolbar-dropdown.js +0 -188
  264. package/addon/components/citaten-plugin/citaat-card.hbs +0 -76
  265. package/addon/components/citaten-plugin/citaat-card.js +0 -286
  266. package/addon/components/citaten-plugin/citaat-insert.hbs +0 -20
  267. package/addon/components/citaten-plugin/citaat-insert.js +0 -68
  268. package/addon/components/citaten-plugin/citations/search-modal.hbs +0 -175
  269. package/addon/components/import-snippet-plugin/card.js +0 -95
  270. package/addon/components/insert-variable-plugin/insert-variable-card.js +0 -125
  271. package/addon/components/rdfa-date-plugin/rdfa-date-plugin-card.js +0 -71
  272. package/addon/components/rdfa-date-plugin/rdfa-date-plugin-insert.js +0 -24
  273. package/addon/components/roadsign-regulation-plugin/expanded-measure.js +0 -38
  274. package/addon/components/roadsign-regulation-plugin/measure-template.js +0 -30
  275. package/addon/components/roadsign-regulation-plugin/roadsign-regulation-card.js +0 -101
  276. package/addon/components/roadsign-regulation-plugin/roadsigns-table.js +0 -24
  277. package/addon/components/standard-template-plugin/template-card.js +0 -7
  278. package/addon/components/standard-template-plugin/template-provider.js +0 -75
  279. package/addon/components/table-of-contents-plugin/card.js +0 -53
  280. package/addon/components/table-of-contents-plugin/inline-components/table-of-contents.hbs +0 -9
  281. package/addon/components/table-of-contents-plugin/inline-components/table-of-contents.js +0 -100
  282. package/addon/components/template-variable-plugin/template-variable-card.js +0 -230
  283. package/addon/constants.js +0 -24
  284. package/addon/initializers/plugin-initializer.js +0 -75
  285. package/addon/inline-components/table-of-contents.js +0 -43
  286. package/addon/marks/citaten-mark.js +0 -32
  287. package/addon/models/instruction.js +0 -19
  288. package/addon/models/measure.js +0 -46
  289. package/addon/models/sign.js +0 -37
  290. package/addon/models/template.js +0 -9
  291. package/addon/plugins/besluit-type-plugin.js +0 -16
  292. package/addon/plugins/citaten-plugin.js +0 -22
  293. package/addon/plugins/generate-template-plugin.js +0 -16
  294. package/addon/plugins/import-snippet-plugin.js +0 -16
  295. package/addon/plugins/insert-variable-plugin.js +0 -19
  296. package/addon/plugins/rdfa-date-plugin.js +0 -26
  297. package/addon/plugins/roadsign-regulation-plugin.js +0 -24
  298. package/addon/plugins/standard-template-plugin.js +0 -33
  299. package/addon/plugins/table-of-contents-plugin.js +0 -27
  300. package/addon/plugins/template-variable-plugin.js +0 -21
  301. package/addon/services/roadsign-registry.js +0 -240
  302. package/addon/utils/generate-template-plugin/default-resources.js +0 -9
  303. package/addon/utils/instantiate-uuids.js +0 -34
  304. package/addon/utils/memoize.js +0 -8
  305. package/addon/utils/processMatch.js +0 -80
  306. package/addon/utils/roadsign-regulation-plugin/includeInstructions.js +0 -10
  307. package/addon/utils/variable-plugins/fetch-data.js +0 -98
  308. package/app/components/rdfa-date-plugin/rdfa-date-plugin-card.js +0 -1
  309. package/app/components/rdfa-date-plugin/rdfa-date-plugin-insert.js +0 -1
  310. package/app/components/rdfa-date-plugin/rdfa-date-time-picker.js +0 -1
  311. package/app/components/standard-template-plugin/template-card.js +0 -1
  312. package/app/components/table-of-contents-plugin/inline-components/outline.js +0 -1
  313. package/app/components/table-of-contents-plugin/inline-components/table-of-contents.js +0 -1
  314. package/app/initializers/plugin-initializer.js +0 -4
  315. package/types/dummy/index.d.ts +0 -1
  316. package/types/ember-data/types/registries/model.d.ts +0 -6
@@ -0,0 +1,70 @@
1
+ import { v4 as uuid } from 'uuid';
2
+ import { insertHtml } from '@lblod/ember-rdfa-editor/commands/insert-html-command';
3
+ import { ProseController, TextSelection } from '@lblod/ember-rdfa-editor';
4
+ import { Command } from '@lblod/ember-rdfa-editor';
5
+ import recalculateArticleNumbers from './recalculate-article-numbers';
6
+
7
+ export default function insertArticle(
8
+ controller: ProseController,
9
+ articleContent: string
10
+ ): Command {
11
+ return function (_state, dispatch) {
12
+ const selection = controller.state.selection;
13
+ const limitedDatastore = controller.datastore.limitToRange(
14
+ controller.state,
15
+ selection.from,
16
+ selection.to
17
+ );
18
+ const besluitSubject = limitedDatastore
19
+ .match(null, 'a', '>http://data.vlaanderen.be/ns/besluit#Besluit')
20
+ .asQuadResultSet()
21
+ .first()?.subject;
22
+
23
+ if (!besluitSubject) {
24
+ return false;
25
+ }
26
+ const containerRange = [
27
+ ...controller.datastore
28
+ .match(besluitSubject, 'prov:value')
29
+ .asPredicateNodeMapping(),
30
+ ][0].nodes[0];
31
+
32
+ if (!containerRange) {
33
+ return false;
34
+ }
35
+ if (dispatch) {
36
+ const range = {
37
+ from: containerRange.to - 1,
38
+ to: containerRange.to - 1,
39
+ };
40
+ const articleUri = `http://data.lblod.info/artikels/${uuid()}`;
41
+ const articleHtml = `
42
+ <div property="eli:has_part" prefix="mobiliteit: https://data.vlaanderen.be/ns/mobiliteit#" typeof="besluit:Artikel" resource="${articleUri}">
43
+ <div>
44
+ Artikel
45
+ <span property="eli:number" datatype="xsd:string">
46
+ <span class="mark-highlight-manual">nummer</span>
47
+ </span></div>
48
+ <span style="display:none;" property="eli:language" resource="http://publications.europa.eu/resource/authority/language/NLD" typeof="skos:Concept">&nbsp;</span>
49
+ <div property="prov:value" datatype="xsd:string">
50
+ ${
51
+ articleContent
52
+ ? articleContent
53
+ : '<span class="mark-highlight-manual">Voer inhoud in</span>'
54
+ }
55
+ </div>
56
+ </div>
57
+ `;
58
+ controller.doCommand(insertHtml(articleHtml, range.from, range.to));
59
+ recalculateArticleNumbers(controller, besluitSubject.value);
60
+ controller.withTransaction((tr) => {
61
+ const selection = TextSelection.near(
62
+ controller.state.doc.resolve(range.from)
63
+ );
64
+ return tr.setSelection(selection).scrollIntoView();
65
+ });
66
+ controller.focus();
67
+ }
68
+ return true;
69
+ };
70
+ }
@@ -0,0 +1,67 @@
1
+ import {
2
+ Command,
3
+ ProseController,
4
+ TextSelection,
5
+ } from '@lblod/ember-rdfa-editor';
6
+ import { insertHtml } from '@lblod/ember-rdfa-editor/commands/insert-html-command';
7
+
8
+ export default function insertTitle(
9
+ controller: ProseController,
10
+ title: string
11
+ ): Command {
12
+ return function (state, dispatch) {
13
+ const selection = controller.state.selection;
14
+ const limitedDatastore = controller.datastore.limitToRange(
15
+ controller.state,
16
+ selection.from,
17
+ selection.to
18
+ );
19
+
20
+ const besluit = [
21
+ ...limitedDatastore
22
+ .match(null, 'a', 'besluit:Besluit')
23
+ .asSubjectNodeMapping(),
24
+ ][0];
25
+
26
+ const besluitRange = besluit?.nodes[0];
27
+
28
+ if (!besluit || !besluitRange) {
29
+ return false;
30
+ }
31
+
32
+ const titleQuad = controller.datastore
33
+ .match(
34
+ `>${besluit.term.value}`,
35
+ '>http://data.europa.eu/eli/ontology#title'
36
+ )
37
+ .asQuadResultSet()
38
+ .first();
39
+ if (titleQuad) {
40
+ return false;
41
+ }
42
+
43
+ if (dispatch) {
44
+ const range = {
45
+ from: besluitRange.from + 1,
46
+ to: besluitRange.from + 1,
47
+ };
48
+ const articleHtml = `
49
+ <h4 class="h4" property="eli:title" datatype="xsd:string">${
50
+ title
51
+ ? title
52
+ : '<span class="mark-highlight-manual">Geef titel besluit op</span>'
53
+ }</h4>
54
+ `;
55
+ controller.doCommand(insertHtml(articleHtml, range.from, range.to));
56
+ controller.withTransaction((tr) => {
57
+ const selection = TextSelection.near(
58
+ controller.state.doc.resolve(range.from)
59
+ );
60
+ return tr.setSelection(selection).scrollIntoView();
61
+ });
62
+ dispatch(state.tr.scrollIntoView());
63
+ }
64
+
65
+ return true;
66
+ };
67
+ }
@@ -0,0 +1,69 @@
1
+ import {
2
+ Command,
3
+ ProseController,
4
+ Selection,
5
+ TextSelection,
6
+ } from '@lblod/ember-rdfa-editor';
7
+ import recalculateArticleNumbers from './recalculate-article-numbers';
8
+ import { ResolvedPNode } from '@lblod/ember-rdfa-editor/plugins/datastore';
9
+ import { unwrap } from '@lblod/ember-rdfa-editor/utils/option';
10
+ import getArticleNodesForBesluit from './get-article-nodes-for-besluit';
11
+
12
+ export default function moveArticleCommand(
13
+ controller: ProseController,
14
+ besluitUri: string,
15
+ articleUri: string,
16
+ moveUp: boolean
17
+ ): Command {
18
+ return (_state, dispatch) => {
19
+ const articles = getArticleNodesForBesluit(controller, besluitUri);
20
+ if (!articles) {
21
+ return false;
22
+ }
23
+ const articleIndex = articles.findIndex(({ uri }) => uri === articleUri);
24
+
25
+ if (
26
+ articleIndex === -1 ||
27
+ (moveUp && articleIndex === 0) ||
28
+ (!moveUp && articleIndex === articles.length - 1)
29
+ ) {
30
+ return false;
31
+ }
32
+
33
+ if (dispatch) {
34
+ let articleA: ResolvedPNode;
35
+ let articleB: ResolvedPNode;
36
+
37
+ if (moveUp) {
38
+ articleA = unwrap(articles[articleIndex - 1]).range;
39
+ articleB = unwrap(articles[articleIndex]).range;
40
+ } else {
41
+ articleA = unwrap(articles[articleIndex]).range;
42
+ articleB = unwrap(articles[articleIndex + 1]).range;
43
+ }
44
+ const articleBNode = unwrap(controller.state.doc.nodeAt(articleB.from));
45
+ controller.withTransaction((tr) => {
46
+ tr.delete(articleB.from, articleB.to);
47
+ return tr.replaceRangeWith(articleA.from, articleA.from, articleBNode);
48
+ });
49
+ recalculateArticleNumbers(controller, besluitUri);
50
+ let selection: Selection;
51
+ if (moveUp) {
52
+ selection = TextSelection.near(
53
+ controller.state.doc.resolve(articleA.from)
54
+ );
55
+ } else {
56
+ selection = TextSelection.near(
57
+ controller.state.doc.resolve(
58
+ articleA.from + articleB.to - articleB.from
59
+ )
60
+ );
61
+ }
62
+ controller.withTransaction((tr) => {
63
+ return tr.setSelection(selection);
64
+ });
65
+ controller.focus();
66
+ }
67
+ return true;
68
+ };
69
+ }
@@ -0,0 +1,44 @@
1
+ import { ProseController } from '@lblod/ember-rdfa-editor';
2
+ import { unwrap } from '@lblod/ember-rdfa-editor/utils/option';
3
+ import getArticleNodesForBesluit from './get-article-nodes-for-besluit';
4
+
5
+ export default function recalculateArticleNumbers(
6
+ controller: ProseController,
7
+ besluitUri: string
8
+ ) {
9
+ const articles = getArticleNodesForBesluit(controller, besluitUri);
10
+ if (articles) {
11
+ for (let i = 0; i < articles.length; i++) {
12
+ const article = unwrap(articles[i]);
13
+ replaceNumberIfNeeded(controller, article, i);
14
+ }
15
+ }
16
+ }
17
+
18
+ function replaceNumberIfNeeded(
19
+ controller: ProseController,
20
+ article: { uri: string; range: { from: number; to: number } },
21
+ index: number
22
+ ) {
23
+ const articleNumberObject = [
24
+ ...controller.datastore
25
+ .match(`>${article.uri}`, '>http://data.europa.eu/eli/ontology#number')
26
+ .asObjectNodeMapping(),
27
+ ][0];
28
+ if (!articleNumberObject) {
29
+ return;
30
+ }
31
+ const articleNumber = Number(articleNumberObject.term.value);
32
+ const articleNumberRange = unwrap(articleNumberObject.nodes[0]);
33
+ const articleNumberExpected = index + 1;
34
+
35
+ if (articleNumber !== articleNumberExpected) {
36
+ controller.withTransaction((tr) => {
37
+ return tr.insertText(
38
+ articleNumberExpected.toString(),
39
+ articleNumberRange.from,
40
+ articleNumberRange.to
41
+ );
42
+ });
43
+ }
44
+ }
@@ -0,0 +1,11 @@
1
+ import { WidgetSpec } from '@lblod/ember-rdfa-editor';
2
+
3
+ export const besluitPluginCardWidget: WidgetSpec = {
4
+ componentName: 'besluit-plugin/besluit-plugin-card',
5
+ desiredLocation: 'insertSidebar',
6
+ };
7
+
8
+ export const besluitContextCardWidget: WidgetSpec = {
9
+ componentName: 'besluit-plugin/besluit-context-card',
10
+ desiredLocation: 'sidebar',
11
+ };
@@ -0,0 +1,35 @@
1
+ import { ProseStore } from '@lblod/ember-rdfa-editor/plugins/datastore';
2
+
3
+ export function getTitleForDecision(
4
+ decisionUri: string,
5
+ datastore: ProseStore
6
+ ) {
7
+ const title = datastore
8
+ .match(`>${decisionUri}`, '>http://data.europa.eu/eli/ontology#title')
9
+ .asQuads()
10
+ .next().value;
11
+
12
+ return !!title;
13
+ }
14
+
15
+ /**
16
+ * Gets all nodes defining a eli:title predicate for a certain
17
+ * decision subject URI
18
+ * @param decisionUri
19
+ * @param datastore
20
+ * @returns {null|*}
21
+ */
22
+ export function getTitleNodesForDecision(
23
+ decisionUri: string,
24
+ datastore: ProseStore
25
+ ) {
26
+ const mapping = datastore
27
+ .match(`>${decisionUri}`, '>http://data.europa.eu/eli/ontology#title')
28
+ .asPredicateNodeMapping()
29
+ .single();
30
+ if (mapping) {
31
+ return mapping.nodes;
32
+ } else {
33
+ return null;
34
+ }
35
+ }
@@ -0,0 +1,6 @@
1
+ import { WidgetSpec } from '@lblod/ember-rdfa-editor/core/prosemirror';
2
+
3
+ export const besluitTypeWidget: WidgetSpec = {
4
+ componentName: 'besluit-type-plugin/toolbar-dropdown',
5
+ desiredLocation: 'toolbarRight',
6
+ };
@@ -1,6 +1,20 @@
1
- import { SparqlEndpointFetcher } from 'fetch-sparql-endpoint';
1
+ import { IBindings, SparqlEndpointFetcher } from 'fetch-sparql-endpoint';
2
2
 
3
- export default async function fetchBesluitTypes(classificationUri, ENV) {
3
+ export type BesluitType = {
4
+ uri: string;
5
+ definition: string;
6
+ label: string;
7
+ broader: string;
8
+ subTypes?: BesluitType[];
9
+ };
10
+ export default async function fetchBesluitTypes(
11
+ classificationUri: string,
12
+ ENV: {
13
+ besluitTypePlugin: {
14
+ endpoint: string;
15
+ };
16
+ }
17
+ ) {
4
18
  const query = `
5
19
  PREFIX conceptscheme: <https://data.vlaanderen.be/id/conceptscheme/>
6
20
  PREFIX BesluitType: <https://data.vlaanderen.be/id/concept/BesluitType/>
@@ -42,11 +56,11 @@ export default async function fetchBesluitTypes(classificationUri, ENV) {
42
56
  });
43
57
  const endpoint = ENV.besluitTypePlugin.endpoint;
44
58
  const bindingStream = await typeFetcher.fetchBindings(endpoint, query);
45
- const validBesluitTriples = [];
46
- bindingStream.on('data', (triple) => {
59
+ const validBesluitTriples: IBindings[] = [];
60
+ bindingStream.on('data', (triple: IBindings) => {
47
61
  validBesluitTriples.push(triple);
48
62
  });
49
- return new Promise((resolve, reject) => {
63
+ return new Promise<IBindings[]>((resolve, reject) => {
50
64
  bindingStream.on('error', reject);
51
65
  bindingStream.on('end', () => {
52
66
  resolve(validBesluitTriples);
@@ -54,29 +68,34 @@ export default async function fetchBesluitTypes(classificationUri, ENV) {
54
68
  }).then(quadsToBesluitTypeObjects);
55
69
  }
56
70
 
57
- function quadsToBesluitTypeObjects(triples) {
58
- const besluitTypes = new Map();
71
+ function quadsToBesluitTypeObjects(triples: IBindings[]) {
72
+ const besluitTypes = new Map<string, BesluitType>();
59
73
  triples.forEach((triple) => {
60
- const existing = besluitTypes.get(triple.s.value) || {
61
- uri: triple.s.value,
62
- };
63
- switch (triple.p.value) {
74
+ const subject = triple['s'];
75
+ const predicate = triple['p'];
76
+ const object = triple['o'];
77
+ const existing =
78
+ besluitTypes.get(subject.value) ||
79
+ ({
80
+ uri: subject.value,
81
+ } as BesluitType);
82
+ switch (predicate.value) {
64
83
  case 'http://www.w3.org/2004/02/skos/core#definition':
65
- existing.definition = triple.o.value;
84
+ existing.definition = object.value;
66
85
  break;
67
86
  case 'http://www.w3.org/2004/02/skos/core#prefLabel':
68
- existing.label = triple.o.value;
87
+ existing.label = object.value;
69
88
  break;
70
89
  case 'http://www.w3.org/2004/02/skos/core#broader':
71
- existing.broader = triple.o.value;
90
+ existing.broader = object.value;
72
91
  break;
73
92
  }
74
- besluitTypes.set(triple.s.value, existing);
93
+ besluitTypes.set(subject.value, existing);
75
94
  });
76
95
  return createBesluitTypeObjectsHierarchy([...besluitTypes.values()]);
77
96
  }
78
97
 
79
- function createBesluitTypeObjectsHierarchy(allBesluitTypes) {
98
+ function createBesluitTypeObjectsHierarchy(allBesluitTypes: BesluitType[]) {
80
99
  const besluitTypes = allBesluitTypes.filter((bst) => !bst.broader);
81
100
  const subTypes = allBesluitTypes.filter((bst) => !!bst.broader);
82
101
  subTypes.forEach((subtype) => {
@@ -0,0 +1,216 @@
1
+ import {
2
+ Decoration,
3
+ DecorationSet,
4
+ EditorState,
5
+ EditorStateConfig,
6
+ InlineDecorationSpec,
7
+ MarkSpec,
8
+ PNode,
9
+ ProsePlugin,
10
+ Schema,
11
+ WidgetSpec,
12
+ } from '@lblod/ember-rdfa-editor';
13
+ import {
14
+ datastoreKey,
15
+ ProseStore,
16
+ } from '@lblod/ember-rdfa-editor/plugins/datastore';
17
+ import processMatch, {
18
+ RegexpMatchArrayWithIndices,
19
+ } from './utils/process-match';
20
+ import { expect } from '@lblod/ember-rdfa-editor-lblod-plugins/utils/option';
21
+ import { citation } from './marks/citation';
22
+
23
+ const BASIC_MULTIPLANE_CHARACTER = '\u0021-\uFFFF'; // most of the characters used around the world
24
+
25
+ // Regex nicely structured:
26
+ // (
27
+ // (
28
+ // \w*decreet |
29
+ // omzendbrief |
30
+ // verdrag |
31
+ // grondwetswijziging |
32
+ // samenwerkingsakkoord |
33
+ // \w*wetboek |
34
+ // protocol |
35
+ // besluit[^\S\n]van[^\S\n]de[^\S\n]vlaamse[^\S\n]regering |
36
+ // geco[öo]rdineerde wetten |
37
+ // \w*wet |
38
+ // koninklijk[^\S\n]?besluit |
39
+ // ministerieel[^\S\n]?besluit |
40
+ // genummerd[^\S\n]?koninklijk[^\S\n]?besluit
41
+ // )
42
+ // [^\S\n]*
43
+ // (
44
+ // ([^\S\n] | [\u0021-\uFFFF\d;:'"()&\-_]){3,}
45
+ // )?
46
+ // )
47
+ const NNWS = '[^\\S\\n]';
48
+ export const CITATION_REGEX = new RegExp(
49
+ `((?<type>\\w*decreet|omzendbrief|verdrag|grondwetswijziging|samenwerkingsakkoord|\\w*wetboek|protocol|besluit${NNWS}van${NNWS}de${NNWS}vlaamse${NNWS}regering|geco[öo]rdineerde${NNWS}wetten|\\w*wet|koninklijk${NNWS}?besluit|ministerieel${NNWS}?besluit|genummerd${NNWS}?koninklijk${NNWS}?besluit|\\w*${NNWS}?besluit)${NNWS}*(?<searchTerms>(${NNWS}|[${BASIC_MULTIPLANE_CHARACTER};:'"()&-_]){3,})?)`,
50
+ 'uidg'
51
+ );
52
+ export type CitationSchema = Schema<string, 'citation'>;
53
+
54
+ export interface CitationDecorationSpec extends InlineDecorationSpec {
55
+ legislationTypeUri: string;
56
+ searchText: string;
57
+ }
58
+
59
+ export interface CitationDecoration extends Decoration {
60
+ spec: CitationDecorationSpec;
61
+ }
62
+
63
+ function calculateDecorations(
64
+ schema: CitationSchema,
65
+ doc: PNode,
66
+ activeRanges: [number, number][]
67
+ ) {
68
+ const decorations: Decoration[] = [];
69
+
70
+ for (const [start, end] of activeRanges) {
71
+ doc.nodesBetween(start, end, (node: PNode, pos: number): boolean => {
72
+ if (
73
+ node.isText &&
74
+ node.text &&
75
+ !schema.marks.citation.isInSet(node.marks)
76
+ ) {
77
+ for (const match of node.text.matchAll(CITATION_REGEX)) {
78
+ const processedMatch = processMatch(
79
+ match as RegexpMatchArrayWithIndices
80
+ );
81
+
82
+ if (processedMatch) {
83
+ const { text, legislationTypeUri, searchTextMatch } =
84
+ processedMatch;
85
+ const { start: matchStart, end: matchEnd } = searchTextMatch;
86
+ const decorationStart = pos + matchStart;
87
+ const decorationEnd = pos + matchEnd;
88
+ decorations.push(
89
+ Decoration.inline(
90
+ decorationStart,
91
+ decorationEnd,
92
+
93
+ {
94
+ 'data-editor-highlight': 'true',
95
+ },
96
+ {
97
+ searchText: text,
98
+ legislationTypeUri,
99
+ }
100
+ )
101
+ );
102
+ }
103
+ }
104
+ }
105
+ return true;
106
+ });
107
+ }
108
+ return DecorationSet.create(doc, decorations);
109
+ }
110
+
111
+ interface CitationPluginState {
112
+ highlights: DecorationSet;
113
+ activeRanges: [number, number][];
114
+ }
115
+
116
+ export type CitationPlugin = ProsePlugin<CitationPluginState>;
117
+
118
+ function citationPlugin({
119
+ activeIn = defaultActiveIn,
120
+ }: CitationPluginConfig): CitationPlugin {
121
+ const citation: CitationPlugin = new ProsePlugin({
122
+ state: {
123
+ init(stateConfig: EditorStateConfig, state: EditorState) {
124
+ const { doc, schema } = state;
125
+ const activeRanges = activeIn(
126
+ state,
127
+ expect(
128
+ 'the datastore plugin is required for this plugin',
129
+ datastoreKey.getState(state)
130
+ )
131
+ );
132
+ return {
133
+ highlights: calculateDecorations(schema, doc, activeRanges),
134
+ activeRanges,
135
+ };
136
+ },
137
+ apply(tr, set, oldState, newState) {
138
+ const { doc, schema } = newState;
139
+ const activeRanges = activeIn(
140
+ newState,
141
+ expect(
142
+ 'the datastore plugin is required for this plugin',
143
+ datastoreKey.getState(newState)
144
+ )
145
+ );
146
+ return {
147
+ highlights: calculateDecorations(schema, doc, activeRanges),
148
+ activeRanges,
149
+ };
150
+ },
151
+ },
152
+ props: {
153
+ decorations(state): DecorationSet | undefined {
154
+ return citation.getState(state)?.highlights;
155
+ },
156
+ },
157
+ });
158
+ return citation;
159
+ }
160
+
161
+ function defaultActiveIn(
162
+ state: EditorState,
163
+ datastore: ProseStore
164
+ ): [number, number][] {
165
+ const result: [number, number][] = [];
166
+ for (const { from, to } of datastore
167
+ .match(null, 'besluit:motivering')
168
+ .asPredicateNodeMapping()
169
+ .nodes()) {
170
+ result.push([from, to]);
171
+ }
172
+ return result;
173
+ }
174
+
175
+ export interface CitationPluginBundle {
176
+ plugin: ProsePlugin<CitationPluginState>;
177
+ widgets: {
178
+ citationCard: WidgetSpec;
179
+ citationInsert: WidgetSpec;
180
+ };
181
+ marks: {
182
+ citation: MarkSpec;
183
+ };
184
+ }
185
+
186
+ export interface CitationPluginConfig {
187
+ activeIn?(state: EditorState, datastore: ProseStore): [number, number][];
188
+ }
189
+
190
+ export function setupCitationPlugin(
191
+ config: CitationPluginConfig = {}
192
+ ): CitationPluginBundle {
193
+ const plugin = citationPlugin(config);
194
+ return {
195
+ plugin,
196
+ widgets: {
197
+ citationCard: {
198
+ desiredLocation: 'sidebar',
199
+ componentName: 'citation-plugin/citation-card',
200
+ widgetArgs: {
201
+ plugin,
202
+ },
203
+ },
204
+ citationInsert: {
205
+ desiredLocation: 'insertSidebar',
206
+ componentName: 'citation-plugin/citation-insert',
207
+ widgetArgs: {
208
+ plugin,
209
+ },
210
+ },
211
+ },
212
+ marks: {
213
+ citation,
214
+ },
215
+ };
216
+ }
@@ -0,0 +1,27 @@
1
+ import { getRdfaAttrs, MarkSpec, rdfaAttrs } from '@lblod/ember-rdfa-editor';
2
+
3
+ export const citation: MarkSpec = {
4
+ attrs: { test: { default: 'yeet' }, ...rdfaAttrs },
5
+ inclusive: false,
6
+ group: 'linkmarks',
7
+ excludes: 'linkmarks',
8
+ parseDOM: [
9
+ {
10
+ tag: 'a[href]',
11
+ getAttrs(dom) {
12
+ if (typeof dom === 'string') {
13
+ return false;
14
+ }
15
+ const type = dom.attributes.getNamedItem('typeof')?.value;
16
+ const property = dom.attributes.getNamedItem('property')?.value;
17
+ if (type === 'eli:LegalExpression' && property === 'eli:cites') {
18
+ return getRdfaAttrs(dom);
19
+ }
20
+ return false;
21
+ },
22
+ },
23
+ ],
24
+ toDOM(node) {
25
+ return ['a', { ...node.attrs, class: 'annotation' }, 0];
26
+ },
27
+ };
@@ -0,0 +1,17 @@
1
+ import { PNode } from '@lblod/ember-rdfa-editor';
2
+ import { CitationSchema } from '@lblod/ember-rdfa-editor-lblod-plugins/plugins/citation-plugin';
3
+ import { unwrap } from '@lblod/ember-rdfa-editor-lblod-plugins/utils/option';
4
+
5
+ export function citedText(
6
+ schema: CitationSchema,
7
+ title: string,
8
+ uri: string
9
+ ): PNode {
10
+ return schema.text(title, [
11
+ unwrap(schema.marks.citation).create({
12
+ href: uri,
13
+ property: 'eli:cites',
14
+ typeof: 'eli:LegalExpression',
15
+ }),
16
+ ]);
17
+ }
@@ -25,8 +25,22 @@ const LEGISLATION_TYPES = {
25
25
  protocol: 'https://data.vlaanderen.be/id/concept/AardWetgeving/Protocol',
26
26
  };
27
27
 
28
- const LEGISLATION_TYPE_CONCEPTS = Object.keys(LEGISLATION_TYPES).map((key) => {
29
- return { label: key, value: LEGISLATION_TYPES[key] };
30
- });
28
+ export type Legislations = typeof LEGISLATION_TYPES;
29
+ export type LegislationKey = keyof Legislations;
30
+ // export type MappedLegislations = {
31
+ // [K in LegislationKey]: {
32
+ // label: K;
33
+ // value: Legislations[K];
34
+ // };
35
+ // };
36
+ // export type MappedLegislation = MappedLegislations[LegislationKey];
37
+ const LEGISLATION_TYPE_CONCEPTS = Object.entries(LEGISLATION_TYPES).map(
38
+ (pair: [string, string]) => {
39
+ return {
40
+ label: pair[0],
41
+ value: pair[1],
42
+ };
43
+ }
44
+ );
31
45
 
32
46
  export { LEGISLATION_TYPES, LEGISLATION_TYPE_CONCEPTS };