@lblod/ember-rdfa-editor-lblod-plugins 26.0.2 → 26.1.0-dev.42b04a7414e40adf20dff16d76bdf1edff8ea5ff

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 (33) hide show
  1. package/.changeset/few-buses-pay.md +5 -0
  2. package/.changeset/five-suits-pull.md +5 -0
  3. package/CHANGELOG.md +18 -0
  4. package/addon/components/besluit-topic-plugin/besluit-topic-toolbar-dropdown.ts +98 -37
  5. package/addon/components/location-plugin/insert.gts +3 -2
  6. package/addon/components/roadsign-regulation-plugin/roadsigns-modal.ts +21 -1
  7. package/addon/components/structure-plugin/_private/structure.gts +9 -1
  8. package/addon/models/sign.ts +3 -2
  9. package/addon/plugins/besluit-topic-plugin/commands/update-besluit-topic-resource.ts +19 -13
  10. package/addon/plugins/besluit-topic-plugin/index.ts +2 -0
  11. package/addon/plugins/decision-plugin/commands/insert-article-container.ts +7 -1
  12. package/addon/plugins/location-plugin/node-contents/address.ts +21 -16
  13. package/addon/plugins/location-plugin/node-contents/area.ts +13 -3
  14. package/addon/plugins/location-plugin/node-contents/place.ts +13 -3
  15. package/addon/plugins/location-plugin/node.ts +5 -3
  16. package/addon/plugins/location-plugin/utils/node-utils.ts +49 -2
  17. package/addon/plugins/structure-plugin/node.ts +27 -5
  18. package/addon/services/roadsign-registry.ts +1 -1
  19. package/declarations/addon/components/besluit-topic-plugin/besluit-topic-toolbar-dropdown.d.ts +7 -1
  20. package/declarations/addon/components/roadsign-regulation-plugin/roadsigns-modal.d.ts +2 -0
  21. package/declarations/addon/components/structure-plugin/_private/structure.d.ts +1 -0
  22. package/declarations/addon/models/sign.d.ts +2 -1
  23. package/declarations/addon/plugins/besluit-topic-plugin/commands/update-besluit-topic-resource.d.ts +2 -1
  24. package/declarations/addon/plugins/besluit-topic-plugin/index.d.ts +2 -0
  25. package/declarations/addon/plugins/location-plugin/node-contents/address.d.ts +2 -1
  26. package/declarations/addon/plugins/location-plugin/node-contents/area.d.ts +2 -1
  27. package/declarations/addon/plugins/location-plugin/node-contents/index.d.ts +3 -3
  28. package/declarations/addon/plugins/location-plugin/node-contents/place.d.ts +2 -1
  29. package/declarations/addon/plugins/location-plugin/node.d.ts +2 -0
  30. package/declarations/addon/plugins/location-plugin/utils/node-utils.d.ts +15 -1
  31. package/declarations/addon/plugins/structure-plugin/node.d.ts +9 -2
  32. package/package.json +2 -2
  33. package/pnpm-lock.yaml +5 -5
@@ -0,0 +1,5 @@
1
+ ---
2
+ '@lblod/ember-rdfa-editor-lblod-plugins': minor
3
+ ---
4
+
5
+ Add configuration option to location plugin to automatically link to resources in the wider document
@@ -0,0 +1,5 @@
1
+ ---
2
+ '@lblod/ember-rdfa-editor-lblod-plugins': minor
3
+ ---
4
+
5
+ Use prov:atLocation predicate for locations instead of dct:spatial
package/CHANGELOG.md CHANGED
@@ -1,5 +1,23 @@
1
1
  # @lblod/ember-rdfa-editor-lblod-plugins
2
2
 
3
+ ## 26.1.0
4
+
5
+ ### Minor Changes
6
+
7
+ - [#514](https://github.com/lblod/ember-rdfa-editor-lblod-plugins/pull/514) [`21dcb88`](https://github.com/lblod/ember-rdfa-editor-lblod-plugins/commit/21dcb88270ef5c4b43492db987811603aa996af5) Thanks [@piemonkey](https://github.com/piemonkey)! - Change predicate used for decision theme to match application profile
8
+
9
+ - [#515](https://github.com/lblod/ember-rdfa-editor-lblod-plugins/pull/515) [`e1f4791`](https://github.com/lblod/ember-rdfa-editor-lblod-plugins/commit/e1f47919b3f6af6300bbf4b6ea2e418240220666) Thanks [@lagartoverde](https://github.com/lagartoverde)! - Allow the user to select how they want the article titles
10
+
11
+ - [#510](https://github.com/lblod/ember-rdfa-editor-lblod-plugins/pull/510) [`ffe23cb`](https://github.com/lblod/ember-rdfa-editor-lblod-plugins/commit/ffe23cb7501a94ee7a10839eac363ddae0b5d2b6) Thanks [@abeforgit](https://github.com/abeforgit)! - Make the decision-topic plugin useable outside decisions
12
+
13
+ ### Patch Changes
14
+
15
+ - [#487](https://github.com/lblod/ember-rdfa-editor-lblod-plugins/pull/487) [`1c95c0f`](https://github.com/lblod/ember-rdfa-editor-lblod-plugins/commit/1c95c0fbf3e9433ab5e1b0610e9c592f5fddb80b) Thanks [@andreo141](https://github.com/andreo141)! - Change the IRGN plugin to prefix the sign code with the traffic sign type in the outputted HTML of a measure.
16
+
17
+ - [#513](https://github.com/lblod/ember-rdfa-editor-lblod-plugins/pull/513) [`90615a4`](https://github.com/lblod/ember-rdfa-editor-lblod-plugins/commit/90615a4c6d0daa6509a7d08cc6126c74a4a6ee26) Thanks [@elpoelma](https://github.com/elpoelma)! - bugfix: ensure that an http://data.europa.eu/eli/ontology#has_part relationship is created between the article and decision when inserting an article container/block
18
+
19
+ - [#516](https://github.com/lblod/ember-rdfa-editor-lblod-plugins/pull/516) [`a51ff27`](https://github.com/lblod/ember-rdfa-editor-lblod-plugins/commit/a51ff279e4a2b808081fb2eb192f4071eccbc14a) Thanks [@elpoelma](https://github.com/elpoelma)! - Execute `recalculateNumbers` transaction-monad when inserting article container
20
+
3
21
  ## 26.0.2
4
22
 
5
23
  ### Patch Changes
@@ -2,8 +2,8 @@ import { tracked } from '@glimmer/tracking';
2
2
  import Component from '@glimmer/component';
3
3
  import { action } from '@ember/object';
4
4
  import { SayController } from '@lblod/ember-rdfa-editor';
5
+ import { transformExternalTriples } from '@lblod/ember-rdfa-editor/utils/external-triple-utils';
5
6
  import { trackedFunction } from 'reactiveweb/function';
6
- import { ELI } from '@lblod/ember-rdfa-editor-lblod-plugins/utils/constants';
7
7
  import { AlertTriangleIcon } from '@appuniversum/ember-appuniversum/components/icons/alert-triangle';
8
8
  import { CrossIcon } from '@appuniversum/ember-appuniversum/components/icons/cross';
9
9
  import { MailIcon } from '@appuniversum/ember-appuniversum/components/icons/mail';
@@ -18,9 +18,15 @@ import {
18
18
  } from '@lblod/ember-rdfa-editor-lblod-plugins/plugins/besluit-topic-plugin/utils/helpers';
19
19
  import {
20
20
  updateBesluitTopicResource,
21
- ELI_SUBJECT,
21
+ TOPIC_PREDICATE,
22
+ TOPIC_PREDICATE_DEPRECATED,
22
23
  } from '@lblod/ember-rdfa-editor-lblod-plugins/plugins/besluit-topic-plugin/commands/update-besluit-topic-resource';
23
24
  import { getOutgoingTripleList } from '@lblod/ember-rdfa-editor-lblod-plugins/utils/namespace';
25
+ import {
26
+ FullTriple,
27
+ OutgoingTriple,
28
+ } from '@lblod/ember-rdfa-editor/core/rdfa-processor';
29
+ import { SayDataFactory } from '@lblod/ember-rdfa-editor/core/say-data-factory';
24
30
 
25
31
  type Args = {
26
32
  controller: SayController;
@@ -52,9 +58,43 @@ export default class BesluitTopicToolbarDropdownComponent extends Component<Args
52
58
  }
53
59
 
54
60
  get showCard() {
55
- return !!this.decisionRange;
61
+ return this.decisionUri || this.decisionRange;
62
+ }
63
+ get options() {
64
+ return this.args.options;
65
+ }
66
+ get decisionUri() {
67
+ return this.options.decisionUri;
56
68
  }
57
69
 
70
+ get currentTopicUris() {
71
+ if (this.decisionRange) {
72
+ const triples: OutgoingTriple[] = this.findTopicTriples(
73
+ this.decisionRange.node.attrs,
74
+ );
75
+ const topicTriples = triples.filter(
76
+ (topic) =>
77
+ topic.object.termType === 'NamedNode' &&
78
+ topic.object.value.includes(
79
+ 'https://data.vlaanderen.be/id/concept/BesluitThema/',
80
+ ),
81
+ );
82
+ return topicTriples.map((topic) => topic.object.value);
83
+ } else if (this.decisionUri) {
84
+ const triples: FullTriple[] = this.doc.attrs['externalTriples'];
85
+ const topicTriples = triples.filter(
86
+ (topic) =>
87
+ topic.subject.value === this.decisionUri &&
88
+ topic.object.termType === 'NamedNode' &&
89
+ topic.object.value.includes(
90
+ 'https://data.vlaanderen.be/id/concept/BesluitThema/',
91
+ ),
92
+ );
93
+ return topicTriples.map((topic) => topic.object.value);
94
+ } else {
95
+ return [];
96
+ }
97
+ }
58
98
  topics = trackedFunction(this, async () => {
59
99
  const result = await fetchBesluitTopics({
60
100
  config: { endpoint: this.args.options.endpoint },
@@ -71,10 +111,27 @@ export default class BesluitTopicToolbarDropdownComponent extends Component<Args
71
111
 
72
112
  return topics.filter((besluitTopic) => uris.includes(besluitTopic.uri));
73
113
  }
114
+ findTopicTriples(attrs?: Record<string, unknown>): OutgoingTriple[] {
115
+ if (!attrs) {
116
+ return [];
117
+ }
118
+ const result = getOutgoingTripleList(attrs, TOPIC_PREDICATE);
119
+ if (result) {
120
+ return result;
121
+ }
122
+ return getOutgoingTripleList(attrs, TOPIC_PREDICATE_DEPRECATED);
123
+ }
124
+ matchTopicPredicate = (predicate: string): boolean => {
125
+ const newMatch = TOPIC_PREDICATE.matches(predicate);
126
+ if (newMatch) {
127
+ return newMatch;
128
+ }
129
+ return TOPIC_PREDICATE_DEPRECATED.matches(predicate);
130
+ };
74
131
 
75
132
  @action
76
133
  updateBesluitTopic() {
77
- if (!this.topics.isFinished || !this.decisionRange) {
134
+ if (!this.topics.isFinished || !this.showCard) {
78
135
  return;
79
136
  }
80
137
  if (!this.topics.value) {
@@ -82,27 +139,10 @@ export default class BesluitTopicToolbarDropdownComponent extends Component<Args
82
139
  return;
83
140
  }
84
141
 
85
- const outgoingBesluitTopics = getOutgoingTripleList(
86
- this.decisionRange.node.attrs,
87
- ELI(ELI_SUBJECT),
88
- );
142
+ const besluitTopics = this.findBesluitTopicsByUris(this.currentTopicUris);
89
143
 
90
- const besluitTopicsRelevant = outgoingBesluitTopics.filter(
91
- (topic) =>
92
- topic.object.termType === 'NamedNode' &&
93
- topic.object.value.includes(
94
- 'https://data.vlaanderen.be/id/concept/BesluitThema/',
95
- ),
96
- );
97
-
98
- const outgoingUris = besluitTopicsRelevant.map(
99
- (topic) => topic.object.value,
100
- );
101
-
102
- const besluitTopics = this.findBesluitTopicsByUris(outgoingUris);
103
-
104
- if (besluitTopicsRelevant && besluitTopics) {
105
- this.previousBesluitTopics = outgoingUris;
144
+ if (this.currentTopicUris && besluitTopics) {
145
+ this.previousBesluitTopics = this.currentTopicUris;
106
146
 
107
147
  this.besluitTopicsSelected = besluitTopics;
108
148
  } else {
@@ -114,19 +154,40 @@ export default class BesluitTopicToolbarDropdownComponent extends Component<Args
114
154
  upsertBesluitTopic(selected: BesluitTopic[]) {
115
155
  this.besluitTopicsSelected = selected;
116
156
 
117
- const resource = getCurrentBesluitURI(this.controller);
118
-
119
- if (this.besluitTopicsSelected && resource) {
120
- this.controller.doCommand(
121
- updateBesluitTopicResource({
122
- resource,
123
- previousTopics: this.previousBesluitTopics,
124
- newTopics: this.besluitTopicsSelected,
125
- }),
126
- {
127
- view: this.args.controller.mainEditorView,
128
- },
129
- );
157
+ if (this.besluitTopicsSelected) {
158
+ const resource = getCurrentBesluitURI(this.controller);
159
+ if (resource) {
160
+ this.controller.doCommand(
161
+ updateBesluitTopicResource({
162
+ resource,
163
+ previousTopics: this.previousBesluitTopics,
164
+ newTopics: this.besluitTopicsSelected,
165
+ }),
166
+ {
167
+ view: this.args.controller.mainEditorView,
168
+ },
169
+ );
170
+ } else if (this.decisionUri) {
171
+ const factory = new SayDataFactory();
172
+ // locking it in for the closure
173
+ const decisionUri = this.decisionUri;
174
+ const newTriples = this.besluitTopicsSelected.map((topic) => ({
175
+ subject: factory.namedNode(decisionUri),
176
+ predicate: TOPIC_PREDICATE.full,
177
+ object: factory.namedNode(topic.uri),
178
+ }));
179
+ const res = transformExternalTriples((oldTriples) => {
180
+ const notOurTriples = oldTriples.filter(
181
+ (trip) =>
182
+ trip.subject.value !== decisionUri ||
183
+ !this.matchTopicPredicate(trip.predicate),
184
+ );
185
+ return notOurTriples.concat(newTriples);
186
+ })(this.controller.mainEditorState);
187
+ if (res.result) {
188
+ this.controller.mainEditorView.dispatch(res.transaction);
189
+ }
190
+ }
130
191
  }
131
192
  }
132
193
 
@@ -24,7 +24,7 @@ import {
24
24
  Point,
25
25
  Polygon,
26
26
  } from '@lblod/ember-rdfa-editor-lblod-plugins/plugins/location-plugin/utils/geo-helpers';
27
- import { replaceSelectionWithAddress } from '@lblod/ember-rdfa-editor-lblod-plugins/plugins/location-plugin/utils/node-utils';
27
+ import { replaceSelectionWithLocation } from '@lblod/ember-rdfa-editor-lblod-plugins/plugins/location-plugin/utils/node-utils';
28
28
  import { type LocationPluginConfig } from '@lblod/ember-rdfa-editor-lblod-plugins/plugins/location-plugin/node';
29
29
  import { NodeContentsUtils } from '@lblod/ember-rdfa-editor-lblod-plugins/plugins/location-plugin/node-contents';
30
30
  import Edit from './edit';
@@ -190,12 +190,13 @@ export default class LocationPluginInsertComponent extends Component<Signature>
190
190
  @action
191
191
  insertOrEditAddress() {
192
192
  if (!this.selectedLocationNode) {
193
- replaceSelectionWithAddress(
193
+ replaceSelectionWithLocation(
194
194
  this.controller,
195
195
  this.intl.t('location-plugin.default-label', {
196
196
  locale: this.documentLanguage,
197
197
  }),
198
198
  this.args.templateMode,
199
+ this.args.config.subjectTypesToLinkTo,
199
200
  );
200
201
  }
201
202
  this.modalOpen = true;
@@ -21,6 +21,7 @@ import { RoadsignRegulationPluginOptions } from '@lblod/ember-rdfa-editor-lblod-
21
21
  import insertArticle from '@lblod/ember-rdfa-editor-lblod-plugins/plugins/decision-plugin/commands/insert-article-command';
22
22
  import { getCurrentBesluitRange } from '@lblod/ember-rdfa-editor-lblod-plugins/plugins/besluit-topic-plugin/utils/helpers';
23
23
  import { buildArticleStructure } from '@lblod/ember-rdfa-editor-lblod-plugins/plugins/decision-plugin/utils/build-article-structure';
24
+ import Sign from '@lblod/ember-rdfa-editor-lblod-plugins/models/sign';
24
25
 
25
26
  const PAGE_SIZE = 10;
26
27
  const SIGN_TYPE_URI =
@@ -274,15 +275,17 @@ export default class RoadsignsModal extends Component<Args> {
274
275
  instructions,
275
276
  true,
276
277
  );
278
+
277
279
  const signsHTML = measure.signs
278
280
  .map((sign) => {
279
281
  const roadSignUri = 'http://data.lblod.info/verkeerstekens/' + uuid();
282
+ const trafficSignPrefix = this.addTrafficSignPrefix(sign);
280
283
  return `<li style="margin-bottom:1rem;">
281
284
  <span property="mobiliteit:wordtAangeduidDoor" resource=${roadSignUri} typeof="mobiliteit:Verkeersbord-Verkeersteken">
282
285
  <span property="mobiliteit:heeftVerkeersbordconcept" resource="${
283
286
  sign.uri
284
287
  }" typeof="mobiliteit:Verkeersbordconcept" style="display:flex;align-items:center;">
285
- <span property="skos:prefLabel" style="padding-bottom:0;margin-left:0;margin-right:.4rem;">${
288
+ <span property="skos:prefLabel" style="padding-bottom:0;margin-left:0;margin-right:.4rem;"> ${trafficSignPrefix} ${
286
289
  sign.code
287
290
  }</span>
288
291
  <span style="margin-left:0;margin-top:0;">${
@@ -340,6 +343,23 @@ export default class RoadsignsModal extends Component<Args> {
340
343
  this.args.closeModal();
341
344
  }
342
345
 
346
+ @action
347
+ addTrafficSignPrefix(sign: Sign) {
348
+ let trafficSignPrefix;
349
+ switch (sign.type) {
350
+ case 'https://data.vlaanderen.be/ns/mobiliteit#Verkeersbordconcept':
351
+ trafficSignPrefix = 'Verkeersbord';
352
+ break;
353
+ case 'https://data.vlaanderen.be/ns/mobiliteit#Wegmarkeringconcept':
354
+ trafficSignPrefix = 'Wegmarkering van artikel';
355
+ break;
356
+ case 'https://data.vlaanderen.be/ns/mobiliteit#Verkeerslichtconcept':
357
+ trafficSignPrefix = 'Verkeerslicht van artikel';
358
+ break;
359
+ }
360
+ return trafficSignPrefix;
361
+ }
362
+
343
363
  @action
344
364
  goToPage(pageStart: number) {
345
365
  this.pageStart = pageStart;
@@ -95,12 +95,17 @@ export default class Structure extends Component<Sig> {
95
95
  return this.node.attrs.structureType as StructureType;
96
96
  }
97
97
 
98
+ get fullLengthArticles() {
99
+ return this.node.attrs.fullLengthArticles as boolean;
100
+ }
101
+
98
102
  get structureName() {
99
103
  const docLang = this.controller.mainEditorState.doc.attrs.lang;
100
104
  if (this.displayStructureName) {
101
105
  return getNameForStructureType(
102
106
  this.structureType,
103
107
  this.number,
108
+ this.fullLengthArticles,
104
109
  this.intl,
105
110
  docLang,
106
111
  );
@@ -113,7 +118,10 @@ export default class Structure extends Component<Sig> {
113
118
  }
114
119
 
115
120
  get title() {
116
- if (this.node.attrs.isOnlyArticle) {
121
+ if (
122
+ this.node.attrs.isOnlyArticle &&
123
+ this.node.attrs.onlyArticleSpecialName
124
+ ) {
117
125
  const docLang = this.controller.mainEditorState.doc.attrs.lang;
118
126
  return this.intl.t('structure-plugin.only-article-title', {
119
127
  locale: docLang,
@@ -4,6 +4,7 @@ import { unwrap } from '../utils/option';
4
4
  export default class Sign {
5
5
  constructor(
6
6
  readonly code: string,
7
+ readonly type: string,
7
8
  readonly image: string,
8
9
  readonly classifications: string[] = [],
9
10
  readonly uri: string,
@@ -19,10 +20,10 @@ export default class Sign {
19
20
 
20
21
  const uri = unwrap(binding['uri']?.value);
21
22
  const order = unwrap(binding['order']?.value);
22
-
23
+ const type = unwrap(binding['type']?.value);
23
24
  const classifications = binding['classifications']?.value.split('|') ?? [];
24
25
  const zonality = binding['zonality']?.value;
25
- return new Sign(code, image, classifications, uri, order, zonality);
26
+ return new Sign(code, type, image, classifications, uri, order, zonality);
26
27
  }
27
28
 
28
29
  static processImage(url: string, imageBaseUrl: string) {
@@ -2,9 +2,13 @@ import { BesluitTopic } from '@lblod/ember-rdfa-editor-lblod-plugins/plugins/bes
2
2
  import { Command } from '@lblod/ember-rdfa-editor';
3
3
  import { addProperty, removeProperty } from '@lblod/ember-rdfa-editor/commands';
4
4
  import { sayDataFactory } from '@lblod/ember-rdfa-editor/core/say-data-factory';
5
- import { ELI } from '@lblod/ember-rdfa-editor-lblod-plugins/utils/constants';
5
+ import {
6
+ DCT,
7
+ ELI,
8
+ } from '@lblod/ember-rdfa-editor-lblod-plugins/utils/constants';
6
9
 
7
- export const ELI_SUBJECT = 'is_about';
10
+ export const TOPIC_PREDICATE = DCT('subject');
11
+ export const TOPIC_PREDICATE_DEPRECATED = ELI('is_about');
8
12
 
9
13
  export const updateBesluitTopicResource = ({
10
14
  resource,
@@ -24,16 +28,18 @@ export const updateBesluitTopicResource = ({
24
28
  previousTopics.forEach((uri) => {
25
29
  newState = state.apply(transaction);
26
30
 
27
- removeProperty({
28
- resource,
29
- property: {
30
- predicate: ELI(ELI_SUBJECT).full,
31
- object: sayDataFactory.namedNode(uri),
32
- },
33
- transaction,
34
- })(newState, (newTransaction) => {
35
- transaction = newTransaction;
36
- });
31
+ [TOPIC_PREDICATE, TOPIC_PREDICATE_DEPRECATED].forEach((PREDICATE) =>
32
+ removeProperty({
33
+ resource,
34
+ property: {
35
+ predicate: PREDICATE.full,
36
+ object: sayDataFactory.namedNode(uri),
37
+ },
38
+ transaction,
39
+ })(newState, (newTransaction) => {
40
+ transaction = newTransaction;
41
+ }),
42
+ );
37
43
  });
38
44
  }
39
45
 
@@ -43,7 +49,7 @@ export const updateBesluitTopicResource = ({
43
49
  addProperty({
44
50
  resource,
45
51
  property: {
46
- predicate: ELI(ELI_SUBJECT).full,
52
+ predicate: TOPIC_PREDICATE.full,
47
53
  object: sayDataFactory.namedNode(besluitTopic.uri),
48
54
  },
49
55
  transaction,
@@ -1,3 +1,5 @@
1
1
  export type BesluitTopicPluginOptions = {
2
2
  endpoint: string;
3
+ /** Pass an explicit decision uri instead of finding it in the doc */
4
+ decisionUri?: string;
3
5
  };
@@ -7,6 +7,7 @@ import { PROV } from '@lblod/ember-rdfa-editor-lblod-plugins/utils/constants';
7
7
  import { SayDataFactory } from '@lblod/ember-rdfa-editor/core/say-data-factory';
8
8
  import { buildArticleStructure } from '../utils/build-article-structure';
9
9
  import { transactionCombinator } from '@lblod/ember-rdfa-editor/utils/transaction-utils';
10
+ import { recalculateNumbers } from '../../structure-plugin/recalculate-structure-numbers';
10
11
 
11
12
  interface InsertArticleContainerArgs {
12
13
  intl: IntlService;
@@ -24,7 +25,11 @@ export default function insertArticleContainer({
24
25
  const nodeToInsert = schema.node(
25
26
  'block_rdfa',
26
27
  { rdfaNodeType: 'literal', __rdfaId: articleContainerId },
27
- buildArticleStructure(schema, articleUriGenerator),
28
+ buildArticleStructure(
29
+ schema,
30
+ articleUriGenerator,
31
+ decisionLocation.node.attrs.subject,
32
+ ),
28
33
  );
29
34
 
30
35
  const tr = state.tr;
@@ -42,6 +47,7 @@ export default function insertArticleContainer({
42
47
  object: factory.literalNode(articleContainerId),
43
48
  },
44
49
  }),
50
+ recalculateNumbers,
45
51
  ]);
46
52
  if (dispatch && result.every((ok) => ok)) {
47
53
  dispatch(newTr.scrollIntoView());
@@ -13,8 +13,10 @@ import { Address } from '@lblod/ember-rdfa-editor-lblod-plugins/plugins/location
13
13
  import { Point } from '@lblod/ember-rdfa-editor-lblod-plugins/plugins/location-plugin/utils/geo-helpers';
14
14
  import { constructGeometrySpec } from './point';
15
15
  import { type NodeContentsUtils } from './';
16
+ import { PNode } from '@lblod/ember-rdfa-editor';
17
+ import { IncomingTriple } from '@lblod/ember-rdfa-editor/core/rdfa-processor';
16
18
 
17
- export const constructAddressSpec = (address: Address) => {
19
+ export const constructAddressSpec = (address: Address, node: PNode) => {
18
20
  const housenumberNode = address.housenumber
19
21
  ? [
20
22
  ' ',
@@ -41,22 +43,26 @@ export const constructAddressSpec = (address: Address) => {
41
43
  }),
42
44
  ]
43
45
  : [];
44
- // TODO Should dump and use spatial properly, but need to actually link into document...
46
+ const linkingSpans = ((node.attrs.backlinks as IncomingTriple[]) ?? []).map(
47
+ (bl) =>
48
+ span({
49
+ about: bl.subject.value,
50
+ property: bl.predicate,
51
+ resource: address.uri,
52
+ }),
53
+ );
54
+ // TODO Should dump the 'typeof', etc. as this is a hangover from being a variable
45
55
  return contentSpan(
46
56
  { resource: address.uri, typeof: LOCN('Address').full },
57
+ ...linkingSpans,
47
58
  span(
48
59
  {
49
- property: DCT('spatial').full,
60
+ property: LOCN('thoroughfare').full,
50
61
  },
51
- span(
52
- {
53
- property: LOCN('thoroughfare').full,
54
- },
55
- address.street,
56
- ),
57
- ...housenumberNode,
58
- ...busnumberNode,
62
+ address.street,
59
63
  ),
64
+ ...housenumberNode,
65
+ ...busnumberNode,
60
66
  ', ',
61
67
  span(
62
68
  {
@@ -147,11 +153,10 @@ export const parseAddressElement =
147
153
  'property',
148
154
  ADRES('verwijstNaar'),
149
155
  )?.getAttribute('content');
150
- const spatialNode = findChildWithRdfaAttribute(
151
- addressNode,
152
- 'property',
153
- DCT('spatial'),
154
- );
156
+ // This node is no longer added, but we keep this lookup for compatibility
157
+ const spatialNode =
158
+ findChildWithRdfaAttribute(addressNode, 'property', DCT('spatial')) ||
159
+ addressNode;
155
160
  const street =
156
161
  spatialNode &&
157
162
  findChildWithRdfaAttribute(spatialNode, 'property', LOCN('thoroughfare'))
@@ -1,6 +1,8 @@
1
+ import { PNode } from '@lblod/ember-rdfa-editor';
2
+ import { IncomingTriple } from '@lblod/ember-rdfa-editor/core/rdfa-processor';
1
3
  import {
2
- DCT,
3
4
  LOCN,
5
+ PROV,
4
6
  RDFS,
5
7
  } from '@lblod/ember-rdfa-editor-lblod-plugins/utils/constants';
6
8
  import { findChildWithRdfaAttribute } from '@lblod/ember-rdfa-editor-lblod-plugins/utils/namespace';
@@ -12,13 +14,21 @@ import {
12
14
  import { constructGeometrySpec } from './point';
13
15
  import { type NodeContentsUtils } from './';
14
16
 
15
- export const constructAreaSpec = (area: Area) => {
17
+ export const constructAreaSpec = (area: Area, node: PNode) => {
18
+ const linkingSpans = ((node.attrs.backlinks as IncomingTriple[]) ?? []).map(
19
+ (bl) =>
20
+ span({
21
+ rev: bl.predicate,
22
+ resource: bl.subject.value,
23
+ }),
24
+ );
16
25
  return span(
17
26
  {
18
27
  resource: area.uri,
19
28
  typeof: LOCN('Location').full,
20
- property: DCT('spatial').full,
29
+ property: PROV('atLocation').full,
21
30
  },
31
+ ...linkingSpans,
22
32
  span(
23
33
  {
24
34
  property: RDFS('label').full,
@@ -1,6 +1,8 @@
1
+ import { PNode } from '@lblod/ember-rdfa-editor';
2
+ import { IncomingTriple } from '@lblod/ember-rdfa-editor/core/rdfa-processor';
1
3
  import {
2
- DCT,
3
4
  LOCN,
5
+ PROV,
4
6
  RDFS,
5
7
  } from '@lblod/ember-rdfa-editor-lblod-plugins/utils/constants';
6
8
  import { findChildWithRdfaAttribute } from '@lblod/ember-rdfa-editor-lblod-plugins/utils/namespace';
@@ -12,13 +14,21 @@ import {
12
14
  import { constructGeometrySpec } from './point';
13
15
  import { type NodeContentsUtils } from './';
14
16
 
15
- export const constructPlaceSpec = (place: Place) => {
17
+ export const constructPlaceSpec = (place: Place, node: PNode) => {
18
+ const linkingSpans = ((node.attrs.backlinks as IncomingTriple[]) ?? []).map(
19
+ (bl) =>
20
+ span({
21
+ rev: bl.predicate,
22
+ resource: bl.subject.value,
23
+ }),
24
+ );
16
25
  return span(
17
26
  {
18
27
  resource: place.uri,
19
28
  typeof: LOCN('Location').full,
20
- property: DCT('spatial').full,
29
+ property: PROV('atLocation').full,
21
30
  },
31
+ ...linkingSpans,
22
32
  span(
23
33
  {
24
34
  property: RDFS('label').full,
@@ -32,6 +32,7 @@ import {
32
32
  import {
33
33
  hasOutgoingNamedNodeTriple,
34
34
  hasRDFaAttribute,
35
+ Resource,
35
36
  } from '@lblod/ember-rdfa-editor-lblod-plugins/utils/namespace';
36
37
  import { contentSpan } from '@lblod/ember-rdfa-editor-lblod-plugins/utils/dom-output-spec-helpers';
37
38
  import AddressNodeviewComponent from '@lblod/ember-rdfa-editor-lblod-plugins/components/location-plugin/nodeview';
@@ -48,6 +49,7 @@ export interface LocationPluginConfig {
48
49
  defaultAddressUriRoot: string;
49
50
  defaultPlaceUriRoot: string;
50
51
  defaultPointUriRoot: string;
52
+ subjectTypesToLinkTo?: Resource[];
51
53
  }
52
54
 
53
55
  const parseDOM = (config: LocationPluginConfig): TagParseRule[] => {
@@ -166,11 +168,11 @@ const serialize =
166
168
  // it for now
167
169
  // const type = getOutgoingTriple(node.attrs, RDF('type'));
168
170
  if (value instanceof Address) {
169
- contentNode = nodeContentsUtils.address.construct(value);
171
+ contentNode = nodeContentsUtils.address.construct(value, node);
170
172
  } else if (value instanceof Place) {
171
- contentNode = nodeContentsUtils.place.construct(value);
173
+ contentNode = nodeContentsUtils.place.construct(value, node);
172
174
  } else if (value instanceof Area) {
173
- contentNode = nodeContentsUtils.area.construct(value);
175
+ contentNode = nodeContentsUtils.area.construct(value, node);
174
176
  }
175
177
  }
176
178
  if (!contentNode) {
@@ -1,17 +1,63 @@
1
- import { SayController, NodeSelection } from '@lblod/ember-rdfa-editor';
1
+ import { SayController, NodeSelection, PNode } from '@lblod/ember-rdfa-editor';
2
2
  import { sayDataFactory } from '@lblod/ember-rdfa-editor/core/say-data-factory';
3
3
  import {
4
4
  DCT,
5
5
  EXT,
6
+ PROV,
6
7
  RDF,
7
8
  } from '@lblod/ember-rdfa-editor-lblod-plugins/utils/constants';
8
9
  import { v4 as uuidv4 } from 'uuid';
10
+ import { findAncestors } from '@lblod/ember-rdfa-editor/utils/position-utils';
11
+ import {
12
+ Resource,
13
+ hasOutgoingNamedNodeTriple,
14
+ } from '@lblod/ember-rdfa-editor-lblod-plugins/utils/namespace';
9
15
 
10
- export function replaceSelectionWithAddress(
16
+ /**
17
+ * Creates an 'OSLO location' node in place of the selection, along with the RDFa to create a triple
18
+ * with the nearest parent of one of the passed types as the subject and the predicate
19
+ * prov:atLocation. This doesn't work well with the RDFa tools, but since refactoring is required to
20
+ * clean up the RDFa structure inherited from variables and to make it work well with 'undo', this
21
+ * work was put off until then.
22
+ * @param controller - SayController
23
+ * @param label - label to add to the node
24
+ * @param templateMode - Whether to create template URIs in place of 'real' URIs
25
+ * @param subjectTypes - A list of Resources, each will be looked at in turn to compare the
26
+ * `rdf:type` of the resource, if no parent is found matching the first, then the second will be
27
+ * used, etc.
28
+ */
29
+ export function replaceSelectionWithLocation(
11
30
  controller: SayController,
12
31
  label?: string,
13
32
  templateMode?: boolean,
33
+ subjectTypes?: Resource[],
14
34
  ) {
35
+ let resourceToLink: { pos: number; node: PNode } | undefined;
36
+ subjectTypes?.forEach((subjectType) => {
37
+ if (!resourceToLink) {
38
+ resourceToLink = findAncestors(
39
+ controller.mainEditorState.selection.$from,
40
+ (node) => {
41
+ return hasOutgoingNamedNodeTriple(
42
+ node.attrs,
43
+ RDF('type'),
44
+ subjectType,
45
+ );
46
+ },
47
+ )[0];
48
+ }
49
+ });
50
+ const backlinks = !resourceToLink
51
+ ? []
52
+ : [
53
+ {
54
+ predicate: PROV('atLocation').full,
55
+ subject: sayDataFactory.resourceNode(
56
+ resourceToLink.node.attrs.subject,
57
+ ),
58
+ },
59
+ ];
60
+
15
61
  const mappingResource = `http://data.lblod.info/mappings/${
16
62
  templateMode ? '--ref-uuid4-' : ''
17
63
  }$${uuidv4()}`;
@@ -42,6 +88,7 @@ export function replaceSelectionWithAddress(
42
88
  object: sayDataFactory.literal(label || ''),
43
89
  },
44
90
  ],
91
+ backlinks,
45
92
  }),
46
93
  );
47
94
  if (tr.selection.$anchor.nodeBefore) {
@@ -30,11 +30,12 @@ const rdfaAware = true;
30
30
  export function getNameForStructureType(
31
31
  structureType: StructureType,
32
32
  number: number,
33
+ fullLengthArticles?: boolean,
33
34
  intl?: IntlService,
34
35
  locale?: string,
35
36
  ) {
36
37
  if (intl?.exists(`structure-plugin.types.${structureType}`, locale)) {
37
- if (structureType === 'article' && number !== 1) {
38
+ if (structureType === 'article' && number !== 1 && !fullLengthArticles) {
38
39
  return intl?.t(`structure-plugin.shortened-article`, { locale });
39
40
  } else {
40
41
  return intl?.t(`structure-plugin.types.${structureType}`, { locale });
@@ -51,7 +52,14 @@ export type StructureType =
51
52
  | 'subsection'
52
53
  | 'paragraph';
53
54
 
54
- export const emberNodeConfig: () => EmberNodeConfig = () => {
55
+ type StructureConfig = {
56
+ fullLengthArticles?: boolean;
57
+ onlyArticleSpecialName?: boolean;
58
+ };
59
+
60
+ export const emberNodeConfig: (config?: StructureConfig) => EmberNodeConfig = (
61
+ config,
62
+ ) => {
55
63
  return {
56
64
  name: 'structure',
57
65
  component: Structure as unknown as ComponentLike,
@@ -88,6 +96,13 @@ export const emberNodeConfig: () => EmberNodeConfig = () => {
88
96
  },
89
97
 
90
98
  sayRenderAs: { default: 'structure' },
99
+ fullLengthArticles: { default: config?.fullLengthArticles },
100
+ onlyArticleSpecialName: {
101
+ default:
102
+ config?.onlyArticleSpecialName === undefined
103
+ ? true
104
+ : config?.onlyArticleSpecialName,
105
+ },
91
106
  },
92
107
  serialize(node: PNode, state: EditorState) {
93
108
  const parser = new DOMParser();
@@ -106,6 +121,7 @@ export const emberNodeConfig: () => EmberNodeConfig = () => {
106
121
  ? getNameForStructureType(
107
122
  structureType,
108
123
  number,
124
+ node.attrs.fullLengthArticles,
109
125
  intlService,
110
126
  state.doc.attrs.lang,
111
127
  )
@@ -117,6 +133,8 @@ export const emberNodeConfig: () => EmberNodeConfig = () => {
117
133
  locale: state.doc.attrs.lang,
118
134
  })
119
135
  : structureName;
136
+ const displayOnlyArticle =
137
+ isOnlyArticle && node.attrs.onlyArticleSpecialName;
120
138
  if (titleHTML) {
121
139
  headerSpec = [
122
140
  tag,
@@ -149,20 +167,20 @@ export const emberNodeConfig: () => EmberNodeConfig = () => {
149
167
  [
150
168
  'span',
151
169
  { 'data-say-structure-header-name': true },
152
- `${isOnlyArticle ? onlyArticleTitle : structureName} `,
170
+ `${displayOnlyArticle ? onlyArticleTitle : structureName} `,
153
171
  ],
154
172
  ]
155
173
  : []),
156
174
  [
157
175
  'span',
158
176
  {
159
- style: isOnlyArticle ? 'display: none;' : '',
177
+ style: displayOnlyArticle ? 'display: none;' : '',
160
178
  'data-say-structure-header-number': true,
161
179
  property: ELI('number').full,
162
180
  },
163
181
  number.toString(),
164
182
  ],
165
- isOnlyArticle ? '' : '.',
183
+ displayOnlyArticle ? '' : '.',
166
184
  ];
167
185
  }
168
186
  return renderRdfaAware({
@@ -297,3 +315,7 @@ export const emberNodeConfig: () => EmberNodeConfig = () => {
297
315
  };
298
316
  export const structure = createEmberNodeSpec(emberNodeConfig());
299
317
  export const structureView = createEmberNodeView(emberNodeConfig());
318
+ export const structureWithConfig = (config?: StructureConfig) =>
319
+ createEmberNodeSpec(emberNodeConfig(config));
320
+ export const structureViewWithConfig = (config?: StructureConfig) =>
321
+ createEmberNodeView(emberNodeConfig(config));
@@ -240,7 +240,7 @@ export default class RoadsignRegistryService extends Service {
240
240
  fetchSignsForMeasure = task(
241
241
  async (uri: string, endpoint: string, imageBaseUrl: string) => {
242
242
  const query = `
243
- SELECT ?uri ?code ?image ?zonality ?order (GROUP_CONCAT(?classification; SEPARATOR="|") AS ?classifications)
243
+ SELECT ?uri ?code ?image ?zonality ?order ?type (GROUP_CONCAT(?classification; SEPARATOR="|") AS ?classifications)
244
244
  WHERE {
245
245
  <${uri}> ext:relation ?relation.
246
246
  ?relation a ext:MustUseRelation;
@@ -2,6 +2,7 @@ import Component from '@glimmer/component';
2
2
  import { SayController } from '@lblod/ember-rdfa-editor';
3
3
  import { BesluitTopicPluginOptions } from '@lblod/ember-rdfa-editor-lblod-plugins/plugins/besluit-topic-plugin';
4
4
  import { BesluitTopic } from '@lblod/ember-rdfa-editor-lblod-plugins/plugins/besluit-topic-plugin/utils/fetchBesluitTopics';
5
+ import { OutgoingTriple } from '@lblod/ember-rdfa-editor/core/rdfa-processor';
5
6
  type Args = {
6
7
  controller: SayController;
7
8
  options: BesluitTopicPluginOptions;
@@ -19,9 +20,14 @@ export default class BesluitTopicToolbarDropdownComponent extends Component<Args
19
20
  get controller(): SayController;
20
21
  get doc(): import("prosemirror-model").Node;
21
22
  get decisionRange(): import("@lblod/ember-rdfa-editor/plugins/datastore").ElementPNode | undefined;
22
- get showCard(): boolean;
23
+ get showCard(): string | import("@lblod/ember-rdfa-editor/plugins/datastore").ElementPNode | undefined;
24
+ get options(): BesluitTopicPluginOptions;
25
+ get decisionUri(): string | undefined;
26
+ get currentTopicUris(): string[];
23
27
  topics: import("reactiveweb/function").State<Promise<BesluitTopic[]>>;
24
28
  findBesluitTopicsByUris(uris: string[], topics?: BesluitTopic[] | null): BesluitTopic[] | undefined;
29
+ findTopicTriples(attrs?: Record<string, unknown>): OutgoingTriple[];
30
+ matchTopicPredicate: (predicate: string) => boolean;
25
31
  updateBesluitTopic(): void;
26
32
  upsertBesluitTopic(selected: BesluitTopic[]): void;
27
33
  toggleCard(): void;
@@ -4,6 +4,7 @@ import Measure from '@lblod/ember-rdfa-editor-lblod-plugins/models/measure';
4
4
  import { SayController } from '@lblod/ember-rdfa-editor';
5
5
  import IntlService from 'ember-intl/services/intl';
6
6
  import { RoadsignRegulationPluginOptions } from '@lblod/ember-rdfa-editor-lblod-plugins/plugins/roadsign-regulation-plugin';
7
+ import Sign from '@lblod/ember-rdfa-editor-lblod-plugins/models/sign';
7
8
  type Option = {
8
9
  label: string;
9
10
  value: string;
@@ -62,6 +63,7 @@ export default class RoadsignsModal extends Component<Args> {
62
63
  restartable: boolean;
63
64
  }, () => Promise<void>>;
64
65
  insertHtml(measure: Measure, zonalityValue: string, temporalValue: string): Promise<void>;
66
+ addTrafficSignPrefix(sign: Sign): string | undefined;
65
67
  goToPage(pageStart: number): void;
66
68
  search(): void;
67
69
  }
@@ -25,6 +25,7 @@ export default class Structure extends Component<Sig> {
25
25
  get number(): any;
26
26
  get displayStructureName(): boolean;
27
27
  get structureType(): StructureType;
28
+ get fullLengthArticles(): boolean;
28
29
  get structureName(): string;
29
30
  get hasTitle(): any;
30
31
  get title(): string;
@@ -1,12 +1,13 @@
1
1
  import { IBindings } from 'fetch-sparql-endpoint';
2
2
  export default class Sign {
3
3
  readonly code: string;
4
+ readonly type: string;
4
5
  readonly image: string;
5
6
  readonly classifications: string[];
6
7
  readonly uri: string;
7
8
  readonly order: string;
8
9
  readonly zonality?: string | undefined;
9
- constructor(code: string, image: string, classifications: string[], uri: string, order: string, zonality?: string | undefined);
10
+ constructor(code: string, type: string, image: string, classifications: string[], uri: string, order: string, zonality?: string | undefined);
10
11
  static fromBinding(binding: IBindings): Sign;
11
12
  static processImage(url: string, imageBaseUrl: string): string;
12
13
  }
@@ -1,6 +1,7 @@
1
1
  import { BesluitTopic } from '@lblod/ember-rdfa-editor-lblod-plugins/plugins/besluit-topic-plugin/utils/fetchBesluitTopics';
2
2
  import { Command } from '@lblod/ember-rdfa-editor';
3
- export declare const ELI_SUBJECT = "is_about";
3
+ export declare const TOPIC_PREDICATE: import("../../../utils/namespace").Resource;
4
+ export declare const TOPIC_PREDICATE_DEPRECATED: import("../../../utils/namespace").Resource;
4
5
  export declare const updateBesluitTopicResource: ({ resource, previousTopics, newTopics, }: {
5
6
  resource: string;
6
7
  previousTopics: string[] | undefined;
@@ -1,3 +1,5 @@
1
1
  export type BesluitTopicPluginOptions = {
2
2
  endpoint: string;
3
+ /** Pass an explicit decision uri instead of finding it in the doc */
4
+ decisionUri?: string;
3
5
  };
@@ -1,6 +1,7 @@
1
1
  import { Address } from '@lblod/ember-rdfa-editor-lblod-plugins/plugins/location-plugin/utils/address-helpers';
2
2
  import { type NodeContentsUtils } from './';
3
- export declare const constructAddressSpec: (address: Address) => import("prosemirror-model").DOMOutputSpec;
3
+ import { PNode } from '@lblod/ember-rdfa-editor';
4
+ export declare const constructAddressSpec: (address: Address, node: PNode) => import("prosemirror-model").DOMOutputSpec;
4
5
  /** Parse pre-OSLO model rdfaAware address nodes */
5
6
  export declare const parseOldAddressElement: (nodeContentsUtils: NodeContentsUtils) => (addressNode: Element) => Address | undefined;
6
7
  export declare const parseAddressElement: (nodeContentsUtils: NodeContentsUtils) => (addressNode: Element | undefined) => Address | undefined;
@@ -1,4 +1,5 @@
1
+ import { PNode } from '@lblod/ember-rdfa-editor';
1
2
  import { Area } from '@lblod/ember-rdfa-editor-lblod-plugins/plugins/location-plugin/utils/geo-helpers';
2
3
  import { type NodeContentsUtils } from './';
3
- export declare const constructAreaSpec: (area: Area) => import("prosemirror-model").DOMOutputSpec;
4
+ export declare const constructAreaSpec: (area: Area, node: PNode) => import("prosemirror-model").DOMOutputSpec;
4
5
  export declare const parseAreaElement: (nodeContentsUtils: NodeContentsUtils) => (element: Element) => Area | undefined;
@@ -10,16 +10,16 @@ export declare class NodeContentsUtils {
10
10
  };
11
11
  fallbackPlaceUri: () => string;
12
12
  place: {
13
- construct: (place: import("../utils/geo-helpers").Place) => import("prosemirror-model").DOMOutputSpec;
13
+ construct: (place: import("../utils/geo-helpers").Place, node: import("prosemirror-model").Node) => import("prosemirror-model").DOMOutputSpec;
14
14
  parse: (element: Element) => import("../utils/geo-helpers").Place | undefined;
15
15
  };
16
16
  area: {
17
- construct: (area: import("../utils/geo-helpers").Area) => import("prosemirror-model").DOMOutputSpec;
17
+ construct: (area: import("../utils/geo-helpers").Area, node: import("prosemirror-model").Node) => import("prosemirror-model").DOMOutputSpec;
18
18
  parse: (element: Element) => import("../utils/geo-helpers").Area | undefined;
19
19
  };
20
20
  fallbackAddressUri: () => string;
21
21
  address: {
22
- construct: (address: import("../utils/address-helpers").Address) => import("prosemirror-model").DOMOutputSpec;
22
+ construct: (address: import("../utils/address-helpers").Address, node: import("prosemirror-model").Node) => import("prosemirror-model").DOMOutputSpec;
23
23
  parseOld: (addressNode: Element) => import("../utils/address-helpers").Address | undefined;
24
24
  parse: (addressNode: Element | undefined) => import("../utils/address-helpers").Address | undefined;
25
25
  };
@@ -1,4 +1,5 @@
1
+ import { PNode } from '@lblod/ember-rdfa-editor';
1
2
  import { Place } from '@lblod/ember-rdfa-editor-lblod-plugins/plugins/location-plugin/utils/geo-helpers';
2
3
  import { type NodeContentsUtils } from './';
3
- export declare const constructPlaceSpec: (place: Place) => import("prosemirror-model").DOMOutputSpec;
4
+ export declare const constructPlaceSpec: (place: Place, node: PNode) => import("prosemirror-model").DOMOutputSpec;
4
5
  export declare const parsePlaceElement: (nodeContentsUtils: NodeContentsUtils) => (element: Element) => Place | undefined;
@@ -1,7 +1,9 @@
1
+ import { Resource } from '@lblod/ember-rdfa-editor-lblod-plugins/utils/namespace';
1
2
  export interface LocationPluginConfig {
2
3
  defaultAddressUriRoot: string;
3
4
  defaultPlaceUriRoot: string;
4
5
  defaultPointUriRoot: string;
6
+ subjectTypesToLinkTo?: Resource[];
5
7
  }
6
8
  export declare const osloLocation: (config: LocationPluginConfig) => import("@lblod/ember-rdfa-editor/core/say-node-spec").default;
7
9
  export declare const osloLocationView: (config: LocationPluginConfig) => (controller: import("@lblod/ember-rdfa-editor").SayController) => import("@lblod/ember-rdfa-editor/utils/ember-node").SayNodeViewConstructor;
@@ -1,2 +1,16 @@
1
1
  import { SayController } from '@lblod/ember-rdfa-editor';
2
- export declare function replaceSelectionWithAddress(controller: SayController, label?: string, templateMode?: boolean): void;
2
+ import { Resource } from '@lblod/ember-rdfa-editor-lblod-plugins/utils/namespace';
3
+ /**
4
+ * Creates an 'OSLO location' node in place of the selection, along with the RDFa to create a triple
5
+ * with the nearest parent of one of the passed types as the subject and the predicate
6
+ * prov:atLocation. This doesn't work well with the RDFa tools, but since refactoring is required to
7
+ * clean up the RDFa structure inherited from variables and to make it work well with 'undo', this
8
+ * work was put off until then.
9
+ * @param controller - SayController
10
+ * @param label - label to add to the node
11
+ * @param templateMode - Whether to create template URIs in place of 'real' URIs
12
+ * @param subjectTypes - A list of Resources, each will be looked at in turn to compare the
13
+ * `rdf:type` of the resource, if no parent is found matching the first, then the second will be
14
+ * used, etc.
15
+ */
16
+ export declare function replaceSelectionWithLocation(controller: SayController, label?: string, templateMode?: boolean, subjectTypes?: Resource[]): void;
@@ -1,7 +1,14 @@
1
1
  import { EmberNodeConfig } from '@lblod/ember-rdfa-editor/utils/ember-node';
2
2
  import IntlService from 'ember-intl/services/intl';
3
- export declare function getNameForStructureType(structureType: StructureType, number: number, intl?: IntlService, locale?: string): string;
3
+ export declare function getNameForStructureType(structureType: StructureType, number: number, fullLengthArticles?: boolean, intl?: IntlService, locale?: string): string;
4
4
  export type StructureType = 'article' | 'chapter' | 'section' | 'subsection' | 'paragraph';
5
- export declare const emberNodeConfig: () => EmberNodeConfig;
5
+ type StructureConfig = {
6
+ fullLengthArticles?: boolean;
7
+ onlyArticleSpecialName?: boolean;
8
+ };
9
+ export declare const emberNodeConfig: (config?: StructureConfig) => EmberNodeConfig;
6
10
  export declare const structure: import("@lblod/ember-rdfa-editor/core/say-node-spec").default;
7
11
  export declare const structureView: (controller: import("@lblod/ember-rdfa-editor").SayController) => import("@lblod/ember-rdfa-editor/utils/ember-node").SayNodeViewConstructor;
12
+ export declare const structureWithConfig: (config?: StructureConfig) => import("@lblod/ember-rdfa-editor/core/say-node-spec").default;
13
+ export declare const structureViewWithConfig: (config?: StructureConfig) => (controller: import("@lblod/ember-rdfa-editor").SayController) => import("@lblod/ember-rdfa-editor/utils/ember-node").SayNodeViewConstructor;
14
+ export {};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lblod/ember-rdfa-editor-lblod-plugins",
3
- "version": "26.0.2",
3
+ "version": "26.1.0-dev.42b04a7414e40adf20dff16d76bdf1edff8ea5ff",
4
4
  "description": "Ember addon providing lblod specific plugins for the ember-rdfa-editor",
5
5
  "keywords": [
6
6
  "ember-addon",
@@ -105,7 +105,7 @@
105
105
  "@glint/template": "^1.4.0",
106
106
  "@graphy/content.ttl.write": "^4.3.7",
107
107
  "@graphy/memory.dataset.fast": "4.3.3",
108
- "@lblod/ember-rdfa-editor": "10.8.0",
108
+ "@lblod/ember-rdfa-editor": "10.9.0",
109
109
  "@rdfjs/types": "^1.1.0",
110
110
  "@release-it/keep-a-changelog": "^4.0.0",
111
111
  "@tsconfig/ember": "^3.0.8",
package/pnpm-lock.yaml CHANGED
@@ -169,8 +169,8 @@ importers:
169
169
  specifier: 4.3.3
170
170
  version: 4.3.3
171
171
  '@lblod/ember-rdfa-editor':
172
- specifier: 10.8.0
173
- version: 10.8.0(2ef3gpurqxbttnmniw6grhzpuy)
172
+ specifier: 10.9.0
173
+ version: 10.9.0(2ef3gpurqxbttnmniw6grhzpuy)
174
174
  '@rdfjs/types':
175
175
  specifier: ^1.1.0
176
176
  version: 1.1.0
@@ -1595,8 +1595,8 @@ packages:
1595
1595
  '@jridgewell/trace-mapping@0.3.25':
1596
1596
  resolution: {integrity: sha512-vNk6aEwybGtawWmy/PzwnGDOjCkLWSD2wqvjGGAgOAwCGWySYXfYoxt00IJkTF+8Lb57DwOb3Aa0o9CApepiYQ==}
1597
1597
 
1598
- '@lblod/ember-rdfa-editor@10.8.0':
1599
- resolution: {integrity: sha512-Xmcs8+e5sC9aDKz6hB5PslIePKizvh294O9A1JpKx00TzZhIFVBZeyW2baKiBpKpMjR/SyXj4WyryUKLYDldWw==}
1598
+ '@lblod/ember-rdfa-editor@10.9.0':
1599
+ resolution: {integrity: sha512-FHCV9/yYosA9c/dU1zQkHhscsysv5MuUQEZCZ3mayrVFN7EQyerJutC/apej0pqHx+dBL6HHtV+nTv3O3q8FSQ==}
1600
1600
  engines: {node: 16.* || 18.* || >= 20}
1601
1601
  peerDependencies:
1602
1602
  '@appuniversum/ember-appuniversum': ^3.4.2
@@ -10738,7 +10738,7 @@ snapshots:
10738
10738
  '@jridgewell/resolve-uri': 3.1.2
10739
10739
  '@jridgewell/sourcemap-codec': 1.4.15
10740
10740
 
10741
- '@lblod/ember-rdfa-editor@10.8.0(2ef3gpurqxbttnmniw6grhzpuy)':
10741
+ '@lblod/ember-rdfa-editor@10.9.0(2ef3gpurqxbttnmniw6grhzpuy)':
10742
10742
  dependencies:
10743
10743
  '@appuniversum/ember-appuniversum': 3.4.2(yenc6o4wruytt4u2jbwlbsqcl4)
10744
10744
  '@babel/core': 7.24.7