@lblod/ember-rdfa-editor-lblod-plugins 35.1.0 → 35.1.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,13 @@
1
1
  # @lblod/ember-rdfa-editor-lblod-plugins
2
2
 
3
+ ## 35.1.1
4
+
5
+ ### Patch Changes
6
+
7
+ - [#633](https://github.com/lblod/ember-rdfa-editor-lblod-plugins/pull/633) [`2bdb16b`](https://github.com/lblod/ember-rdfa-editor-lblod-plugins/commit/2bdb16b0811350bfd01c8a76b316cc0bc9173af9) Thanks [@piemonkey](https://github.com/piemonkey)! - Fix parsing of (deprecated) roadsign_regulation nodes to ignore incorrect `resource="false"` values
8
+
9
+ - [#632](https://github.com/lblod/ember-rdfa-editor-lblod-plugins/pull/632) [`1b9933c`](https://github.com/lblod/ember-rdfa-editor-lblod-plugins/commit/1b9933ca93badb06e3c7cc42797f2cc98bf732e3) Thanks [@piemonkey](https://github.com/piemonkey)! - Update location-plugin types to accept null as well as undefined
10
+
3
11
  ## 35.1.0
4
12
 
5
13
  ### Minor Changes
@@ -7,6 +7,7 @@
7
7
  @expandable={{true}}
8
8
  @shadow={{true}}
9
9
  @size='small'
10
+ @disableAuContent={{true}}
10
11
  {{did-update
11
12
  this.resetToDocumentState
12
13
  this.documentText
@@ -20,7 +20,7 @@ export type InsertArticleOptions = StructurePluginOptions & {
20
20
  interface Sig {
21
21
  Args: {
22
22
  controller: SayController;
23
- label: string;
23
+ label?: string;
24
24
  options?: InsertArticleOptions;
25
25
  };
26
26
  }
@@ -37,6 +37,7 @@ import { type Point } from '@lblod/ember-rdfa-editor-lblod-plugins/plugins/locat
37
37
  import { type NodeContentsUtils } from '@lblod/ember-rdfa-editor-lblod-plugins/plugins/location-plugin/node-contents';
38
38
  import { SUPPORTED_LOCATION_TYPES, type LocationType } from './map';
39
39
  import { type SafeString } from '@ember/template';
40
+ import type { Option } from '@lblod/ember-rdfa-editor-lblod-plugins/utils/option';
40
41
 
41
42
  interface Message {
42
43
  skin: AuAlertSignature['Args']['skin'];
@@ -50,7 +51,7 @@ type Signature = {
50
51
  locationTypes?: readonly LocationType[];
51
52
  locationType: LocationType;
52
53
  setLocationType: (type: LocationType) => void;
53
- defaultMunicipality?: string;
54
+ defaultMunicipality: Option<string>;
54
55
  currentAddress?: Address;
55
56
  selectedLocationNode: ResolvedPNode | null;
56
57
  setAddressToInsert: (address: Address | undefined) => void;
@@ -34,6 +34,7 @@ import LocationMap, {
34
34
  import { transactionCombinator } from '@lblod/ember-rdfa-editor/utils/transaction-utils';
35
35
  import { updateSubject } from '@lblod/ember-rdfa-editor/plugins/rdfa-info/utils';
36
36
  import { replaceSelectionWithLocation } from '@lblod/ember-rdfa-editor-lblod-plugins/plugins/location-plugin/_private/utils/node-utils';
37
+ import type { Option } from '@lblod/ember-rdfa-editor-lblod-plugins/utils/option';
37
38
 
38
39
  export type CurrentLocation = Address | GlobalCoordinates | undefined;
39
40
 
@@ -58,7 +59,7 @@ interface Signature {
58
59
  Args: {
59
60
  controller: SayController;
60
61
  config: LocationPluginConfig;
61
- defaultMunicipality?: string;
62
+ defaultMunicipality?: Option<string>;
62
63
  templateMode?: boolean;
63
64
  locationTypes?: LocationType[];
64
65
  };
@@ -6,6 +6,7 @@
6
6
  @expandable={{false}}
7
7
  @shadow={{true}}
8
8
  @size='flush'
9
+ @disableAuContent={{true}}
9
10
  as |c|
10
11
  >
11
12
  <c.content class='au-c-content--small'>
@@ -5,6 +5,7 @@
5
5
  @divided={{true}}
6
6
  @shadow={{true}}
7
7
  @size='small'
8
+ @disableAuContent={{true}}
8
9
  as |c|
9
10
  >
10
11
  <c.content>
@@ -7,6 +7,7 @@
7
7
  @expandable={{true}}
8
8
  @shadow={{true}}
9
9
  @size='small'
10
+ @disableAuContent={{true}}
10
11
  as |c|
11
12
  >
12
13
  <c.header>
@@ -15,43 +16,45 @@
15
16
  </AuHeading>
16
17
  </c.header>
17
18
  <c.content>
18
- <AuLabel for='location-select'>
19
- {{this.label}}
20
- </AuLabel>
21
- {{#if this.multiSelect}}
22
- <PowerSelectMultiple
23
- id='location-select'
24
- @allowClear={{false}}
25
- @searchEnabled={{true}}
26
- @searchField='label'
27
- @options={{this.locationOptions.value.options}}
28
- @selected={{this.selectedLocationOption}}
29
- @onChange={{this.updateLocationOption}}
30
- as |option|
19
+ <AuContent>
20
+ <AuLabel for='location-select'>
21
+ {{this.label}}
22
+ </AuLabel>
23
+ {{#if this.multiSelect}}
24
+ <PowerSelectMultiple
25
+ id='location-select'
26
+ @allowClear={{false}}
27
+ @searchEnabled={{true}}
28
+ @searchField='label'
29
+ @options={{this.locationOptions.value.options}}
30
+ @selected={{this.selectedLocationOption}}
31
+ @onChange={{this.updateLocationOption}}
32
+ as |option|
33
+ >
34
+ {{option.label}}
35
+ </PowerSelectMultiple>
36
+ {{else}}
37
+ <PowerSelect
38
+ id='location-select'
39
+ @dropdownClass='location-select-dropdown'
40
+ @allowClear={{false}}
41
+ @searchEnabled={{true}}
42
+ @searchField='label'
43
+ @options={{this.locationOptions.value.options}}
44
+ @selected={{this.selectedLocationOption}}
45
+ @onChange={{this.updateLocationOption}}
46
+ as |option|
47
+ >
48
+ {{option.label}}
49
+ </PowerSelect>
50
+ {{/if}}
51
+ <AuButton
52
+ {{on 'click' this.insert}}
53
+ @disabled={{not this.selectedLocationOption}}
31
54
  >
32
- {{option.label}}
33
- </PowerSelectMultiple>
34
- {{else}}
35
- <PowerSelect
36
- id='location-select'
37
- @dropdownClass='location-select-dropdown'
38
- @allowClear={{false}}
39
- @searchEnabled={{true}}
40
- @searchField='label'
41
- @options={{this.locationOptions.value.options}}
42
- @selected={{this.selectedLocationOption}}
43
- @onChange={{this.updateLocationOption}}
44
- as |option|
45
- >
46
- {{option.label}}
47
- </PowerSelect>
48
- {{/if}}
49
- <AuButton
50
- {{on 'click' this.insert}}
51
- @disabled={{not this.selectedLocationOption}}
52
- >
53
- {{t 'editor-plugins.utils.insert'}}
54
- </AuButton>
55
+ {{t 'editor-plugins.utils.insert'}}
56
+ </AuButton>
57
+ </AuContent>
55
58
  </c.content>
56
59
  </AuCard>
57
60
  {{/if}}
@@ -24,7 +24,7 @@ import {
24
24
  MOBILITEIT,
25
25
  RDF,
26
26
  } from '@lblod/ember-rdfa-editor-lblod-plugins/utils/constants';
27
- import { Option } from '@lblod/ember-rdfa-editor/utils/_private/option';
27
+ import { Option } from '@lblod/ember-rdfa-editor-lblod-plugins/utils/option';
28
28
 
29
29
  export type LocationEditOptions = {
30
30
  endpoint: string;
@@ -22,6 +22,7 @@
22
22
  @size='small'
23
23
  id='number-input-tooltip'
24
24
  @standOut={{true}}
25
+ @disableAuContent={{true}}
25
26
  as |card|
26
27
  >
27
28
  <card.content>
@@ -5,6 +5,7 @@
5
5
  @divided={{true}}
6
6
  @shadow={{true}}
7
7
  @size='small'
8
+ @disableAuContent={{true}}
8
9
  as |c|
9
10
  >
10
11
  <c.header>
@@ -27,6 +27,7 @@ import {
27
27
  ModelMigrationGenerator,
28
28
  } from '@lblod/ember-rdfa-editor/core/rdfa-types';
29
29
  import { getRdfaContentElement } from '@lblod/ember-rdfa-editor/core/schema';
30
+ import type { OutgoingTriple } from '@lblod/ember-rdfa-editor/core/rdfa-processor';
30
31
  import {
31
32
  getNewZonalityUri,
32
33
  isLegacyZonalityUri,
@@ -121,13 +122,28 @@ export const roadsign_regulation: NodeSpec = {
121
122
  }
122
123
  const { rdfaNodeType, properties, backlinks, __rdfaId } = attrs;
123
124
  // We need to ensure that a content-literal for the description is added
124
- const propertiesFiltered = properties.filter(
125
+ let propertiesFiltered = properties.filter(
125
126
  (prop) => !DCT('description').matches(prop.predicate),
126
127
  );
127
128
  propertiesFiltered.push({
128
129
  predicate: DCT('description').full,
129
130
  object: sayDataFactory.contentLiteral(),
130
131
  });
132
+
133
+ // Previously having no 'temporal' value could lead to a relationship being added, but
134
+ // to `resource="false". Strip this.
135
+ const temporal = node
136
+ .querySelector(
137
+ `span[property~='${EXT('temporal').prefixed}'],
138
+ span[property~='${EXT('temporal').full}']`,
139
+ )
140
+ ?.getAttribute('resource');
141
+ if (temporal === 'false') {
142
+ propertiesFiltered = propertiesFiltered.filter(
143
+ (prop) => !EXT('temporal').matches(prop.predicate),
144
+ );
145
+ }
146
+
131
147
  return {
132
148
  rdfaNodeType,
133
149
  __rdfaId,
@@ -203,7 +219,7 @@ export const trafficSignalMigration: ModelMigrationGenerator = (attrs) => {
203
219
  return false;
204
220
  };
205
221
 
206
- export const trafficMeasureZonalityMigration: ModelMigrationGenerator = (
222
+ export const trafficMeasureModelMigration: ModelMigrationGenerator = (
207
223
  attrs,
208
224
  ) => {
209
225
  const factory = new SayDataFactory();
@@ -218,20 +234,34 @@ export const trafficMeasureZonalityMigration: ModelMigrationGenerator = (
218
234
  ) {
219
235
  return false;
220
236
  }
237
+
238
+ // Migrate zonality to new model
239
+ let newProps: OutgoingTriple[] | undefined;
221
240
  const zonalityTriple = getOutgoingTriple(attrs, EXT('zonality'));
222
- if (!zonalityTriple) {
223
- return false;
241
+ if (zonalityTriple && isLegacyZonalityUri(zonalityTriple.object.value)) {
242
+ const newZonalityProp = {
243
+ predicate: EXT('zonality').full,
244
+ object: factory.namedNode(getNewZonalityUri(zonalityTriple.object.value)),
245
+ };
246
+ newProps = attrs.properties
247
+ .filter((prop) => !EXT('zonality').matches(prop.predicate))
248
+ .concat([newZonalityProp]);
224
249
  }
225
- if (!isLegacyZonalityUri(zonalityTriple.object.value)) {
250
+
251
+ // Remove invalid temporal values
252
+ const temporalTriple = getOutgoingTriple(attrs, EXT('temporal'));
253
+ if (
254
+ temporalTriple &&
255
+ temporalTriple.object.value === 'http://example.org/false'
256
+ ) {
257
+ newProps = (newProps ?? attrs.properties).filter(
258
+ (prop) => !EXT('temporal').matches(prop.predicate),
259
+ );
260
+ }
261
+
262
+ if (!newProps) {
226
263
  return false;
227
264
  }
228
- const newZonalityProp = {
229
- predicate: EXT('zonality').full,
230
- object: factory.namedNode(getNewZonalityUri(zonalityTriple.object.value)),
231
- };
232
- const newProps = attrs.properties
233
- .filter((prop) => !EXT('zonality').matches(prop.predicate))
234
- .concat([newZonalityProp]);
235
265
  return {
236
266
  getAttrs: () => {
237
267
  return {
@@ -241,3 +271,7 @@ export const trafficMeasureZonalityMigration: ModelMigrationGenerator = (
241
271
  },
242
272
  } satisfies ModelMigration;
243
273
  };
274
+ /**
275
+ * @deprecated moved to trafficMeasureModelMigration
276
+ */
277
+ export const trafficMeasureZonalityMigration = trafficMeasureModelMigration;
@@ -10,7 +10,7 @@ export type InsertArticleOptions = StructurePluginOptions & {
10
10
  interface Sig {
11
11
  Args: {
12
12
  controller: SayController;
13
- label: string;
13
+ label?: string;
14
14
  options?: InsertArticleOptions;
15
15
  };
16
16
  }
@@ -6,6 +6,7 @@ import { Address } from '@lblod/ember-rdfa-editor-lblod-plugins/plugins/location
6
6
  import { type NodeContentsUtils } from '@lblod/ember-rdfa-editor-lblod-plugins/plugins/location-plugin/node-contents';
7
7
  import { type LocationType } from './map';
8
8
  import { type SafeString } from '@ember/template';
9
+ import type { Option } from '@lblod/ember-rdfa-editor-lblod-plugins/utils/option';
9
10
  interface Message {
10
11
  skin: AuAlertSignature['Args']['skin'];
11
12
  icon: AuAlertSignature['Args']['icon'];
@@ -17,7 +18,7 @@ type Signature = {
17
18
  locationTypes?: readonly LocationType[];
18
19
  locationType: LocationType;
19
20
  setLocationType: (type: LocationType) => void;
20
- defaultMunicipality?: string;
21
+ defaultMunicipality: Option<string>;
21
22
  currentAddress?: Address;
22
23
  selectedLocationNode: ResolvedPNode | null;
23
24
  setAddressToInsert: (address: Address | undefined) => void;
@@ -7,12 +7,13 @@ import { GeoPos, type GlobalCoordinates } from '@lblod/ember-rdfa-editor-lblod-p
7
7
  import { type LocationPluginConfig } from '@lblod/ember-rdfa-editor-lblod-plugins/plugins/location-plugin/node';
8
8
  import { NodeContentsUtils } from '@lblod/ember-rdfa-editor-lblod-plugins/plugins/location-plugin/node-contents';
9
9
  import { type LocationType } from './map';
10
+ import type { Option } from '@lblod/ember-rdfa-editor-lblod-plugins/utils/option';
10
11
  export type CurrentLocation = Address | GlobalCoordinates | undefined;
11
12
  interface Signature {
12
13
  Args: {
13
14
  controller: SayController;
14
15
  config: LocationPluginConfig;
15
- defaultMunicipality?: string;
16
+ defaultMunicipality?: Option<string>;
16
17
  templateMode?: boolean;
17
18
  locationTypes?: LocationType[];
18
19
  };
@@ -6,4 +6,8 @@ export declare const roadsign_regulation: NodeSpec;
6
6
  * namedNodes to encode everything in one inline_rdfa
7
7
  **/
8
8
  export declare const trafficSignalMigration: ModelMigrationGenerator;
9
+ export declare const trafficMeasureModelMigration: ModelMigrationGenerator;
10
+ /**
11
+ * @deprecated moved to trafficMeasureModelMigration
12
+ */
9
13
  export declare const trafficMeasureZonalityMigration: ModelMigrationGenerator;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lblod/ember-rdfa-editor-lblod-plugins",
3
- "version": "35.1.0",
3
+ "version": "35.1.1",
4
4
  "description": "Ember addon providing lblod specific plugins for the ember-rdfa-editor",
5
5
  "keywords": [
6
6
  "ember-addon",