@lblod/ember-rdfa-editor-lblod-plugins 1.0.0-alpha.3 → 1.0.0-beta.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 (124) hide show
  1. package/CHANGELOG.md +48 -0
  2. package/addon/components/article-structure-plugin/article-structure-card.hbs +3 -1
  3. package/addon/components/au-dropdown-pill.hbs +32 -0
  4. package/addon/components/au-dropdown-pill.ts +65 -0
  5. package/addon/components/besluit-type-plugin/toolbar-dropdown.ts +19 -12
  6. package/addon/components/citation-plugin/citation-card.hbs +2 -2
  7. package/addon/components/citation-plugin/citation-card.ts +1 -1
  8. package/addon/components/citation-plugin/citation-insert.hbs +3 -1
  9. package/addon/components/citation-plugin/citation-insert.ts +28 -2
  10. package/addon/components/citation-plugin/citations/search-modal.hbs +1 -1
  11. package/addon/components/citation-plugin/citations/search-modal.ts +3 -18
  12. package/addon/components/import-snippet-plugin/card.ts +8 -12
  13. package/addon/components/rdfa-date-plugin/card.hbs +28 -0
  14. package/addon/components/rdfa-date-plugin/card.ts +72 -38
  15. package/addon/components/rdfa-date-plugin/date-time-picker.ts +1 -0
  16. package/addon/components/rdfa-date-plugin/insert.hbs +2 -2
  17. package/addon/components/rdfa-date-plugin/insert.ts +14 -23
  18. package/addon/components/roadsign-regulation-plugin/roadsign-regulation-card.ts +24 -25
  19. package/addon/components/roadsign-regulation-plugin/roadsigns-modal.ts +37 -18
  20. package/addon/components/standard-template-plugin/template-provider.ts +54 -11
  21. package/addon/components/table-of-contents-plugin/ember-nodes/table-of-contents.ts +27 -30
  22. package/addon/components/table-of-contents-plugin/toolbar-button.hbs +8 -0
  23. package/addon/components/table-of-contents-plugin/{card.ts → toolbar-button.ts} +1 -18
  24. package/addon/components/{insert-variable-plugin → variable-plugin}/insert-variable-card.hbs +4 -4
  25. package/addon/components/{insert-variable-plugin → variable-plugin}/insert-variable-card.ts +26 -35
  26. package/addon/components/{template-variable-plugin → variable-plugin}/template-variable-card.hbs +6 -6
  27. package/addon/components/variable-plugin/template-variable-card.ts +174 -0
  28. package/addon/components/variable-plugin/variable.hbs +4 -0
  29. package/addon/components/variable-plugin/variable.ts +250 -0
  30. package/addon/plugins/article-structure-plugin/commands/insert-structure.ts +58 -31
  31. package/addon/plugins/article-structure-plugin/index.ts +1 -1
  32. package/addon/plugins/article-structure-plugin/structures/article-paragraph.ts +42 -6
  33. package/addon/plugins/article-structure-plugin/structures/article.ts +14 -4
  34. package/addon/plugins/article-structure-plugin/structures/chapter.ts +2 -3
  35. package/addon/plugins/article-structure-plugin/structures/section.ts +2 -2
  36. package/addon/plugins/article-structure-plugin/structures/structure-header.ts +11 -4
  37. package/addon/plugins/article-structure-plugin/structures/subsection.ts +2 -2
  38. package/addon/plugins/article-structure-plugin/structures/title.ts +2 -3
  39. package/addon/plugins/article-structure-plugin/utils/structure.ts +29 -9
  40. package/addon/plugins/citation-plugin/index.ts +184 -113
  41. package/addon/plugins/rdfa-date-plugin/index.ts +42 -3
  42. package/addon/plugins/rdfa-date-plugin/nodes/date.ts +127 -0
  43. package/addon/plugins/rdfa-date-plugin/nodes/index.ts +1 -0
  44. package/addon/plugins/rdfa-date-plugin/utils.ts +10 -0
  45. package/addon/plugins/roadsign-regulation-plugin/nodes.ts +107 -0
  46. package/addon/plugins/standard-template-plugin/index.ts +26 -0
  47. package/addon/plugins/standard-template-plugin/utils/nodes.ts +366 -0
  48. package/addon/plugins/table-of-contents-plugin/index.ts +8 -12
  49. package/addon/plugins/table-of-contents-plugin/nodes/table-of-contents.ts +35 -42
  50. package/addon/plugins/{insert-variable-plugin → variable-plugin}/index.ts +6 -1
  51. package/addon/plugins/variable-plugin/nodes.ts +137 -0
  52. package/addon/plugins/variable-plugin/utils/constants.ts +107 -0
  53. package/addon/plugins/{template-variable-plugin → variable-plugin}/utils/fetch-data.ts +41 -0
  54. package/addon/services/standard-template-plugin.ts +16 -12
  55. package/addon/utils/changed-descendants.ts +29 -0
  56. package/addon/utils/constants.ts +22 -0
  57. package/addon/utils/namespace.ts +60 -0
  58. package/app/components/{table-of-contents-plugin/card.js → au-dropdown-pill.js} +1 -1
  59. package/app/components/table-of-contents-plugin/toolbar-button.js +1 -0
  60. package/app/components/{insert-variable-plugin → variable-plugin}/insert-variable-card.js +1 -1
  61. package/app/components/{template-variable-plugin → variable-plugin}/template-variable-card.js +1 -1
  62. package/app/components/variable-plugin/variable-edit-modal.js +1 -0
  63. package/app/components/variable-plugin/variable.js +1 -0
  64. package/app/styles/date-plugin.scss +17 -0
  65. package/app/styles/variable-plugin.scss +65 -0
  66. package/components/au-dropdown-pill.d.ts +19 -0
  67. package/components/au-native-input.d.ts +1 -1
  68. package/components/citation-plugin/citation-card.d.ts +1 -1
  69. package/components/citation-plugin/citation-insert.d.ts +7 -0
  70. package/components/citation-plugin/citations/search-modal.d.ts +1 -3
  71. package/components/rdfa-date-plugin/card.d.ts +14 -5
  72. package/components/rdfa-date-plugin/insert.d.ts +1 -2
  73. package/components/roadsign-regulation-plugin/roadsign-regulation-card.d.ts +1 -0
  74. package/components/roadsign-regulation-plugin/roadsigns-modal.d.ts +3 -0
  75. package/components/standard-template-plugin/template-provider.d.ts +6 -1
  76. package/components/table-of-contents-plugin/ember-nodes/table-of-contents.d.ts +1 -1
  77. package/components/table-of-contents-plugin/{card.d.ts → toolbar-button.d.ts} +0 -5
  78. package/components/{insert-variable-plugin → variable-plugin}/insert-variable-card.d.ts +3 -4
  79. package/components/{template-variable-plugin → variable-plugin}/template-variable-card.d.ts +8 -5
  80. package/components/variable-plugin/variable.d.ts +42 -0
  81. package/package.json +6 -6
  82. package/plugins/article-structure-plugin/commands/insert-structure.d.ts +2 -2
  83. package/plugins/article-structure-plugin/index.d.ts +1 -1
  84. package/plugins/article-structure-plugin/utils/structure.d.ts +4 -3
  85. package/plugins/citation-plugin/index.d.ts +11 -4
  86. package/plugins/rdfa-date-plugin/index.d.ts +13 -1
  87. package/plugins/rdfa-date-plugin/nodes/date.d.ts +9 -0
  88. package/plugins/rdfa-date-plugin/nodes/index.d.ts +1 -0
  89. package/plugins/rdfa-date-plugin/utils.d.ts +1 -0
  90. package/plugins/roadsign-regulation-plugin/nodes.d.ts +2 -0
  91. package/plugins/standard-template-plugin/index.d.ts +12 -0
  92. package/plugins/standard-template-plugin/utils/nodes.d.ts +12 -0
  93. package/plugins/table-of-contents-plugin/index.d.ts +4 -2
  94. package/plugins/table-of-contents-plugin/nodes/table-of-contents.d.ts +4 -3
  95. package/plugins/{insert-variable-plugin → variable-plugin}/index.d.ts +1 -0
  96. package/plugins/variable-plugin/nodes.d.ts +2 -0
  97. package/plugins/variable-plugin/utils/constants.d.ts +9 -0
  98. package/plugins/{template-variable-plugin → variable-plugin}/utils/fetch-data.d.ts +5 -0
  99. package/services/standard-template-plugin.d.ts +9 -10
  100. package/translations/en-US.yaml +4 -3
  101. package/translations/nl-BE.yaml +8 -7
  102. package/utils/changed-descendants.d.ts +2 -0
  103. package/utils/constants.d.ts +10 -0
  104. package/utils/namespace.d.ts +11 -0
  105. package/addon/components/table-of-contents-plugin/card.hbs +0 -16
  106. package/addon/components/template-variable-plugin/template-variable-card.ts +0 -227
  107. package/addon/plugins/article-structure-plugin/constants.ts +0 -11
  108. package/addon/plugins/article-structure-plugin/utils/namespace.ts +0 -25
  109. package/addon/plugins/insert-variable-plugin/utils/constants.ts +0 -67
  110. package/addon/plugins/insert-variable-plugin/utils/fetch-data.ts +0 -41
  111. package/addon/plugins/rdfa-date-plugin/commands/index.ts +0 -1
  112. package/addon/plugins/rdfa-date-plugin/commands/modify-date.ts +0 -48
  113. package/addon/plugins/table-of-contents-plugin/utils/constants.ts +0 -17
  114. package/addon/plugins/template-variable-plugin/index.ts +0 -6
  115. package/addon/plugins/template-variable-plugin/utils/constants.ts +0 -2
  116. package/plugins/article-structure-plugin/constants.d.ts +0 -5
  117. package/plugins/article-structure-plugin/utils/namespace.d.ts +0 -6
  118. package/plugins/insert-variable-plugin/utils/constants.d.ts +0 -7
  119. package/plugins/insert-variable-plugin/utils/fetch-data.d.ts +0 -5
  120. package/plugins/rdfa-date-plugin/commands/index.d.ts +0 -1
  121. package/plugins/rdfa-date-plugin/commands/modify-date.d.ts +0 -2
  122. package/plugins/table-of-contents-plugin/utils/constants.d.ts +0 -7
  123. package/plugins/template-variable-plugin/index.d.ts +0 -2
  124. package/plugins/template-variable-plugin/utils/constants.d.ts +0 -1
@@ -0,0 +1,137 @@
1
+ import { hasRDFaAttribute } from '@lblod/ember-rdfa-editor-lblod-plugins/utils/namespace';
2
+ import {
3
+ DCT,
4
+ EXT,
5
+ } from '@lblod/ember-rdfa-editor-lblod-plugins/utils/constants';
6
+ import {
7
+ createEmberNodeSpec,
8
+ createEmberNodeView,
9
+ EmberNodeConfig,
10
+ } from '@lblod/ember-rdfa-editor/utils/ember-node';
11
+ import { v4 as uuidv4 } from 'uuid';
12
+
13
+ const CONTENT_SELECTOR = `span[property~='${EXT('content').prefixed}'],
14
+ span[property~='${EXT('content').full}']`;
15
+
16
+ const emberNodeConfig: EmberNodeConfig = {
17
+ name: 'variable',
18
+ componentPath: 'variable-plugin/variable',
19
+ inline: true,
20
+ group: 'inline',
21
+ content: 'inline*',
22
+ atom: true,
23
+ draggable: false,
24
+ attrs: {
25
+ mappingResource: {},
26
+ codelistResource: {
27
+ default: null,
28
+ },
29
+ variableInstance: {},
30
+ source: {
31
+ default: null,
32
+ },
33
+ type: {
34
+ default: 'text',
35
+ },
36
+ datatype: {
37
+ default: null,
38
+ },
39
+ },
40
+ toDOM: (node) => {
41
+ const {
42
+ mappingResource,
43
+ codelistResource,
44
+ variableInstance,
45
+ type,
46
+ datatype,
47
+ source,
48
+ } = node.attrs;
49
+ const sourceSpan = source
50
+ ? [
51
+ [
52
+ 'span',
53
+ { property: DCT('source').prefixed, resource: source as string },
54
+ ],
55
+ ]
56
+ : [];
57
+ const codelistResourceSpan = codelistResource
58
+ ? [
59
+ [
60
+ 'span',
61
+ {
62
+ property: EXT('codelist').prefixed, //becomes EXT('instance')
63
+ resource: codelistResource as string,
64
+ },
65
+ ],
66
+ ]
67
+ : [];
68
+ return [
69
+ 'span',
70
+ {
71
+ resource: mappingResource as string,
72
+ typeof: EXT('Mapping').prefixed,
73
+ },
74
+ [
75
+ 'span',
76
+ { property: EXT('instance'), resource: variableInstance as string },
77
+ ],
78
+ ['span', { property: DCT('type').prefixed, content: type as string }],
79
+ ...sourceSpan,
80
+ ...codelistResourceSpan,
81
+ [
82
+ 'span',
83
+ {
84
+ property: EXT('content').prefixed,
85
+ ...(!!datatype && { datatype: datatype as string }),
86
+ },
87
+ 0,
88
+ ],
89
+ ];
90
+ },
91
+ parseDOM: [
92
+ {
93
+ tag: 'span',
94
+ getAttrs: (node: HTMLElement) => {
95
+ if (
96
+ hasRDFaAttribute(node, 'typeof', EXT('Mapping')) &&
97
+ node.querySelector(CONTENT_SELECTOR)
98
+ ) {
99
+ const variableInstance = [...node.children]
100
+ .find((el) => hasRDFaAttribute(el, 'property', EXT('instance')))
101
+ ?.getAttribute('resource');
102
+ const mappingResource = node.getAttribute('resource');
103
+ const codelistResource = [...node.children]
104
+ .find((el) => hasRDFaAttribute(el, 'property', EXT('codelist')))
105
+ ?.getAttribute('resource');
106
+ const source = [...node.children]
107
+ .find((el) => hasRDFaAttribute(el, 'property', DCT('source')))
108
+ ?.getAttribute('resource');
109
+ const type = [...node.children]
110
+ .find((el) => hasRDFaAttribute(el, 'property', DCT('type')))
111
+ ?.getAttribute('content');
112
+ const datatype = [...node.children]
113
+ .find((el) => hasRDFaAttribute(el, 'property', EXT('content')))
114
+ ?.getAttribute('datatype');
115
+ if (!mappingResource) {
116
+ return false;
117
+ }
118
+ return {
119
+ variableInstance:
120
+ variableInstance ??
121
+ `http://data.lblod.info/variables/${uuidv4()}`,
122
+ mappingResource,
123
+ codelistResource,
124
+ source,
125
+ type,
126
+ datatype,
127
+ };
128
+ }
129
+ return false;
130
+ },
131
+ contentElement: CONTENT_SELECTOR,
132
+ },
133
+ ],
134
+ };
135
+
136
+ export const variable = createEmberNodeSpec(emberNodeConfig);
137
+ export const variableView = createEmberNodeView(emberNodeConfig);
@@ -0,0 +1,107 @@
1
+ import { PNode, Schema } from '@lblod/ember-rdfa-editor';
2
+ import { CodeList, fetchCodeListsByPublisher } from './fetch-data';
3
+ import { v4 as uuidv4 } from 'uuid';
4
+ import { XSD } from '@lblod/ember-rdfa-editor-lblod-plugins/utils/constants';
5
+ import { unwrap } from '@lblod/ember-rdfa-editor-lblod-plugins/utils/option';
6
+
7
+ export const MULTI_SELECT_CODELIST_TYPE =
8
+ 'http://lblod.data.gift/concepts/57C93E12-A02C-4D4B-8B95-666B6701286C';
9
+
10
+ export type VariableType = {
11
+ label: string;
12
+ fetchSubtypes?: (endpoint: string, publisher: string) => Promise<CodeList[]>;
13
+ constructor: (
14
+ schema: Schema,
15
+ endpoint?: string,
16
+ selectedCodelist?: CodeList
17
+ ) => PNode;
18
+ };
19
+
20
+ export const DEFAULT_VARIABLE_TYPES: Record<string, VariableType> = {
21
+ text: {
22
+ label: 'text',
23
+ constructor: (schema) => {
24
+ const mappingURI = `http://data.lblod.info/mappings/${uuidv4()}`;
25
+ const variableInstance = `http://data.lblod.info/variables/${uuidv4()}`;
26
+ return schema.node(
27
+ 'variable',
28
+ {
29
+ mappingResource: mappingURI,
30
+ variableInstance,
31
+ type: 'text',
32
+ },
33
+ schema.node('placeholder', { placeholderText: 'text' })
34
+ );
35
+ },
36
+ },
37
+ number: {
38
+ label: 'number',
39
+ constructor: (schema) => {
40
+ const mappingURI = `http://data.lblod.info/mappings/${uuidv4()}`;
41
+ const variableInstance = `http://data.lblod.info/variables/${uuidv4()}`;
42
+ return schema.node(
43
+ 'variable',
44
+ {
45
+ mappingResource: mappingURI,
46
+ variableInstance,
47
+ type: 'number',
48
+ datatype: XSD('integer').prefixed,
49
+ },
50
+ schema.node('placeholder', { placeholderText: 'number' })
51
+ );
52
+ },
53
+ },
54
+ date: {
55
+ label: 'date',
56
+ constructor: (schema) => {
57
+ return unwrap(
58
+ schema.nodes.date.createAndFill({
59
+ mappingResource: `http://data.lblod.info/mappings/${uuidv4()}`,
60
+ })
61
+ );
62
+ },
63
+ },
64
+ location: {
65
+ label: 'location',
66
+ constructor: (schema, endpoint) => {
67
+ const mappingURI = `http://data.lblod.info/mappings/${uuidv4()}`;
68
+ const variableInstance = `http://data.lblod.info/variables/${uuidv4()}`;
69
+ return schema.node(
70
+ 'variable',
71
+ {
72
+ type: 'location',
73
+ mappingResource: mappingURI,
74
+ variableInstance,
75
+ source: endpoint,
76
+ },
77
+ schema.node('placeholder', {
78
+ placeholderText: 'location',
79
+ })
80
+ );
81
+ },
82
+ },
83
+ codelist: {
84
+ label: 'codelist',
85
+ fetchSubtypes: async (endpoint: string, publisher: string) => {
86
+ const codelists = fetchCodeListsByPublisher(endpoint, publisher);
87
+ return codelists;
88
+ },
89
+ constructor: (schema, endpoint, selectedCodelist?: CodeList) => {
90
+ const mappingURI = `http://data.lblod.info/mappings/${uuidv4()}`;
91
+ const variableInstance = `http://data.lblod.info/variables/${uuidv4()}`;
92
+ return schema.node(
93
+ 'variable',
94
+ {
95
+ type: 'codelist',
96
+ mappingResource: mappingURI,
97
+ codelistResource: selectedCodelist?.uri,
98
+ variableInstance,
99
+ source: endpoint,
100
+ },
101
+ schema.node('placeholder', {
102
+ placeholderText: selectedCodelist?.label ?? '',
103
+ })
104
+ );
105
+ },
106
+ },
107
+ };
@@ -60,3 +60,44 @@ function parseCodelistOptions(queryResult: QueryResult): CodeListOption[] {
60
60
  label: binding['label']?.value,
61
61
  }));
62
62
  }
63
+
64
+ export type CodeList = {
65
+ uri?: string;
66
+ label?: string;
67
+ };
68
+
69
+ function generateCodeListsByPublisherQuery(publisher: string): string {
70
+ const codeListOptionsQuery = `
71
+ PREFIX lblodMobilitiet: <http://data.lblod.info/vocabularies/mobiliteit/>
72
+ PREFIX dct: <http://purl.org/dc/terms/>
73
+ PREFIX skos: <http://www.w3.org/2004/02/skos/core#>
74
+ PREFIX mu: <http://mu.semte.ch/vocabularies/core/>
75
+ SELECT DISTINCT * WHERE {
76
+ ?uri a lblodMobilitiet:Codelist;
77
+ skos:prefLabel ?label.
78
+ ${
79
+ publisher
80
+ ? `
81
+ ?uri dct:publisher <${publisher}>.
82
+ `
83
+ : ''
84
+ }
85
+ }
86
+ `;
87
+ return codeListOptionsQuery;
88
+ }
89
+
90
+ export async function fetchCodeListsByPublisher(
91
+ endpoint: string,
92
+ publisher: string
93
+ ): Promise<CodeList[]> {
94
+ const codelistsOptionsQueryResult = await executeQuery(
95
+ endpoint,
96
+ generateCodeListsByPublisherQuery(publisher)
97
+ );
98
+ const bindings = codelistsOptionsQueryResult.results.bindings;
99
+ return bindings.map((binding) => ({
100
+ uri: binding['uri']?.value,
101
+ label: binding['label']?.value,
102
+ }));
103
+ }
@@ -1,14 +1,15 @@
1
1
  import Store from '@ember-data/store';
2
2
  // eslint-disable-next-line ember/use-ember-data-rfc-395-imports
3
- import { DS } from 'ember-data';
4
3
  import Service, { inject as service } from '@ember/service';
5
- import { task, waitForProperty, Task } from 'ember-concurrency';
4
+ import { task, Task, waitForProperty } from 'ember-concurrency';
6
5
  import { tracked } from '@glimmer/tracking';
7
6
  import TemplateModel from '../models/template';
8
7
 
8
+ const BLACKLISTED_TEMPLATES = new Set(['Citeeropschrift']);
9
+
9
10
  export default class StandardTemplatePluginService extends Service {
10
11
  @service declare store: Store;
11
- @tracked declare templates: DS.RecordArray<TemplateModel>;
12
+ @tracked declare templates: TemplateModel[];
12
13
 
13
14
  constructor() {
14
15
  // eslint-disable-next-line prefer-rest-params
@@ -16,7 +17,7 @@ export default class StandardTemplatePluginService extends Service {
16
17
  void this.loadTemplates();
17
18
  }
18
19
 
19
- fetchTemplates: Task<DS.RecordArray<TemplateModel>, []> = task(async () => {
20
+ fetchTemplates: Task<TemplateModel[], []> = task(async () => {
20
21
  // eslint-disable-next-line @typescript-eslint/ban-ts-comment
21
22
  // @ts-ignore
22
23
  await waitForProperty(this, 'templates');
@@ -24,19 +25,22 @@ export default class StandardTemplatePluginService extends Service {
24
25
  });
25
26
 
26
27
  async loadTemplates() {
27
- this.templates = await this.store.query('template', {
28
+ const templates = await this.store.query('template', {
28
29
  fields: { templates: 'title,contexts,matches,disabled-in-contexts' },
29
30
  });
31
+ this.templates = templates.filter(
32
+ (template) => !BLACKLISTED_TEMPLATES.has(template.title)
33
+ );
30
34
  }
31
35
 
32
36
  /**
33
- Filter the valid templates for a context.
34
- @method templatesForContext
35
- @param {Array} Array of templates
36
- @param {Array} The path of rdfaContext objects from the root till the current context
37
- @return {Array} Array of templates (filtered)
38
- @private
39
- */
37
+ Filter the valid templates for a context.
38
+ @method templatesForContext
39
+ @param {Array} Array of templates
40
+ @param {Array} The path of rdfaContext objects from the root till the current context
41
+ @return {Array} Array of templates (filtered)
42
+ @private
43
+ */
40
44
  templatesForContext(templates: TemplateModel[], rdfaTypes: string[]) {
41
45
  const isMatchingForContext = (template: TemplateModel) => {
42
46
  return (
@@ -0,0 +1,29 @@
1
+ import { PNode } from '@lblod/ember-rdfa-editor';
2
+
3
+ // from https://github.com/ProseMirror/prosemirror-tables/blob/8ec1e96ae994c1585b07b1ca9dc3292f63e868e0/src/fixtables.ts#L24
4
+ export function changedDescendants(
5
+ old: PNode,
6
+ cur: PNode,
7
+ offset: number,
8
+ f: (node: PNode, pos: number) => void
9
+ ): void {
10
+ const oldSize = old.childCount;
11
+ const curSize = cur.childCount;
12
+ outer: for (let i = 0, j = 0; i < curSize; i++) {
13
+ const child = cur.child(i);
14
+ for (let scan = j, e = Math.min(oldSize, i + 3); scan < e; scan++) {
15
+ if (old.child(scan) === child) {
16
+ j = scan + 1;
17
+ offset += child.nodeSize;
18
+ continue outer;
19
+ }
20
+ }
21
+ f(child, offset);
22
+ if (j < oldSize && old.child(j).sameMarkup(child)) {
23
+ changedDescendants(old.child(j), child, offset + 1, f);
24
+ } else {
25
+ child.nodesBetween(0, child.content.size, f, offset + 1);
26
+ }
27
+ offset += child.nodeSize;
28
+ }
29
+ }
@@ -0,0 +1,22 @@
1
+ import { namespace } from '@lblod/ember-rdfa-editor-lblod-plugins/utils/namespace';
2
+
3
+ export const SAY = namespace('https://say.data.gift/ns/', 'say');
4
+ export const RDF = namespace(
5
+ 'http://www.w3.org/1999/02/22-rdf-syntax-ns#',
6
+ 'rdf'
7
+ );
8
+
9
+ export const ELI = namespace('http://data.europa.eu/eli/ontology#', 'eli');
10
+ export const XSD = namespace('http://www.w3.org/2001/XMLSchema#', 'xsd');
11
+ export const EXT = namespace('http://mu.semte.ch/vocabularies/ext/', 'ext');
12
+ export const BESLUIT = namespace(
13
+ 'http://data.vlaanderen.be/ns/besluit#',
14
+ 'besluit'
15
+ );
16
+ export const PROV = namespace('http://www.w3.org/ns/prov#', 'prov');
17
+ export const SKOS = namespace('http://www.w3.org/2004/02/skos/core#', 'skos');
18
+ export const DCT = namespace('http://purl.org/dc/terms/', 'dct');
19
+ export const MOBILITEIT = namespace(
20
+ 'https://data.vlaanderen.be/ns/mobiliteit#',
21
+ 'mobiliteit'
22
+ );
@@ -0,0 +1,60 @@
1
+ import { PNode } from '@lblod/ember-rdfa-editor';
2
+
3
+ export class Resource {
4
+ full: string;
5
+ prefixed: string;
6
+
7
+ constructor(full: string, prefixed: string) {
8
+ this.full = full;
9
+ this.prefixed = prefixed;
10
+ }
11
+
12
+ toString() {
13
+ return this.full;
14
+ }
15
+ }
16
+
17
+ export function namespace(uri: string, prefix: string) {
18
+ return (s: string): Resource => {
19
+ return new Resource(uri + s, `${prefix}:${s}`);
20
+ };
21
+ }
22
+
23
+ export function hasRDFaAttribute(
24
+ element: Element,
25
+ attr: string,
26
+ value: Resource
27
+ ) {
28
+ const result = element.getAttribute(attr)?.split(' ');
29
+ if (result) {
30
+ return result.includes(value.full) || result.includes(value.prefixed);
31
+ }
32
+ return false;
33
+ }
34
+
35
+ export function pnodeHasRdfaAttribute(
36
+ node: PNode,
37
+ attr: string,
38
+ value: Resource
39
+ ) {
40
+ const result = (node.attrs[attr] as string | null)?.split(' ');
41
+ if (result) {
42
+ return result.includes(value.full) || result.includes(value.prefixed);
43
+ }
44
+ return false;
45
+ }
46
+
47
+ export function expandPrefixedString(
48
+ base: string,
49
+ prefix: string,
50
+ stringToExpand: string
51
+ ): string {
52
+ if (stringToExpand.startsWith(base)) {
53
+ return stringToExpand;
54
+ } else if (stringToExpand.startsWith(prefix)) {
55
+ const [, affix] = stringToExpand.split(':');
56
+ return base + affix;
57
+ } else {
58
+ return stringToExpand;
59
+ }
60
+ }
@@ -1 +1 @@
1
- export { default } from '@lblod/ember-rdfa-editor-lblod-plugins/components/table-of-contents-plugin/card';
1
+ export { default } from '@lblod/ember-rdfa-editor-lblod-plugins/components/au-dropdown-pill';
@@ -0,0 +1 @@
1
+ export { default } from '@lblod/ember-rdfa-editor-lblod-plugins/components/table-of-contents-plugin/toolbar-button';
@@ -1 +1 @@
1
- export { default } from '@lblod/ember-rdfa-editor-lblod-plugins/components/insert-variable-plugin/insert-variable-card';
1
+ export { default } from '@lblod/ember-rdfa-editor-lblod-plugins/components/variable-plugin/insert-variable-card';
@@ -1 +1 @@
1
- export { default } from '@lblod/ember-rdfa-editor-lblod-plugins/components/template-variable-plugin/template-variable-card';
1
+ export { default } from '@lblod/ember-rdfa-editor-lblod-plugins/components/variable-plugin/template-variable-card';
@@ -0,0 +1 @@
1
+ export { default } from '@lblod/ember-rdfa-editor-lblod-plugins/components/variable-plugin/variable-edit-modal';
@@ -0,0 +1 @@
1
+ export { default } from '@lblod/ember-rdfa-editor-lblod-plugins/components/variable-plugin/variable';
@@ -0,0 +1,17 @@
1
+
2
+ span.date {
3
+ border-radius: 0.3rem;
4
+ margin-right: 0.5rem !important;
5
+ padding: 0 0.2rem !important;
6
+ line-height: 1.2rem !important;
7
+ transition: border 0.1s ease-in-out, background-color 0.1s ease-in-out;
8
+ &::selection {
9
+ background-color: var(--au-blue-200);
10
+ }
11
+ user-select: none;
12
+ }
13
+
14
+ span.date.ProseMirror-selectednode {
15
+ background-color: var(--au-blue-200);
16
+ outline: 2px solid var(--au-blue-500);
17
+ }
@@ -0,0 +1,65 @@
1
+ [typeof='ext:Mapping'] + [typeof='ext:Mapping'] {
2
+ margin-left: 0.3rem;
3
+ }
4
+
5
+ [typeof='ext:Mapping'] {
6
+ border-bottom: 0 !important;
7
+
8
+ [property],
9
+ .mark-highlight-manual {
10
+ border-bottom: 0;
11
+ }
12
+
13
+ [property='ext:content'] {
14
+ border-radius: 0.3rem;
15
+ padding: 0 0.3rem;
16
+ line-height: 1.2rem;
17
+ margin-bottom: 0.3rem;
18
+ }
19
+
20
+ [property='dct:type'] ~ [property='ext:content'] {
21
+ color: var(--vl-picton-120);
22
+ border-radius: 0.3rem;
23
+ background-color: rgba(#16465b, 0.15);
24
+ transition: border 0.1s ease-in-out, background-color 0.1s ease-in-out;
25
+
26
+ &:hover,
27
+ &:focus,
28
+ &:focus-within {
29
+ background-color: rgba(#16465b, 0.1);
30
+ }
31
+ }
32
+
33
+ [property='dct:type'] ~ [property='ext:content']:after {
34
+ position: relative;
35
+ top: -0.2rem;
36
+ content: '' !important;
37
+ display: inline-block !important;
38
+ width: 1rem;
39
+ height: 1rem;
40
+ margin-left: 0.3rem;
41
+ background-size: contain;
42
+ background-image: url('data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMjQiIGhlaWdodD0iMjQiIHZpZXdCb3g9IjAgMCAyNCAyNCIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIiBmaWxsPSIjMTY0NjVCIj48cGF0aCBkPSJNMjAuODMxMTAwMywzLjE4Mzg0MTggQzIwLjQ1OTEwMDMsMi44MDc0MjE4IDIwLjAxNjEwMDMsMi41MDg1NjE4IDE5LjUyNzcwMDMsMi4zMDQ2MDE4IEMxOS4wMzk0MDAzLDIuMTAwNjMxOCAxOC41MTU0MDAzLDEuOTk1NjAxOCAxNy45ODYxMDAzLDEuOTk1NjAxOCBDMTcuNDU2OTAwMywxLjk5NTYwMTggMTYuOTMyOTAwMywyLjEwMDYzMTggMTYuNDQ0NjAwMywyLjMwNDYwMTggQzE1Ljk1NjIwMDMsMi41MDg1NjE4IDE1LjUxMzIwMDMsMi44MDc0MjE4IDE1LjE0MTEwMDMsMy4xODM4NDE4IEwzLjczMTE0MDMyLDE0LjU5MzgwMTggQzMuNjEzMTgwMzIsMTQuNzI3MzAxOCAzLjUyNDYwMDMyLDE0Ljg4NDAwMTggMy40NzExNDAzMiwxNS4wNTM4MDE4IEwyLjAxMTE0MDMyLDIwLjc2MzgwMTggQzEuOTY4ODEwMzIsMjAuOTMxMjAxOCAxLjk3MDUxMDMyLDIxLjEwNjYwMTggMi4wMTYwNzAzMiwyMS4yNzMxMDE4IEMyLjA2MTYzMDMyLDIxLjQzOTUwMTggMi4xNDk1MDAzMiwyMS41OTE0MDE4IDIuMjcxMTQwMzIsMjEuNzEzODAxOCBDMi4zOTM1OTAzMiwyMS44MzU1MDE4IDIuNTQ1NDQwMzIsMjEuOTIzNDAxOCAyLjcxMTkxMDMyLDIxLjk2ODkwMTggQzIuODc4MzgwMzIsMjIuMDE0NTAxOCAzLjA1MzgyMDMyLDIyLjAxNjIwMTggMy4yMjExNDAzMiwyMS45NzM4MDE4IEw4LjkyMTE0MDMyLDIwLjU0MzgwMTggQzkuMDkxMDEwMzIsMjAuNDkwNDAxOCA5LjI0NzczMDMyLDIwLjQwMTgwMTggOS4zODExNDAzMiwyMC4yODM4MDE4IEwyMC44MzExMDAzLDguODczODQxOCBDMjEuMjA3NjAwMyw4LjUwMTgyMTggMjEuNTA2NDAwMyw4LjA1ODc5MTggMjEuNzEwNDAwMyw3LjU3MDQzMTggQzIxLjkxNDQwMDMsNy4wODIwNzE4IDIyLjAxOTQwMDMsNi41NTgwOTE4IDIyLjAxOTQwMDMsNi4wMjg4NDE4IEMyMi4wMTk0MDAzLDUuNDk5NjAxOCAyMS45MTQ0MDAzLDQuOTc1NjIxOCAyMS43MTA0MDAzLDQuNDg3MjYxOCBDMjEuNTA2NDAwMywzLjk5ODkwMTggMjEuMjA3NjAwMywzLjU1NTg3MTggMjAuODMxMTAwMywzLjE4Mzg0MTggWiBNMTQuNDIxMTAwMyw2LjczMzg0MTggTDE3LjI4MTEwMDMsOS41OTM4NDE4IEw4LjcyMTE0MDMyLDE4LjE2MzgwMTggTDUuODUxMTQwMzIsMTUuMzAzODAxOCBMMTQuNDIxMTAwMyw2LjczMzg0MTggWiBNNC40MjExNDAzMiwxOS42MzM4MDE4IEw1LjAxMTE0MDMyLDE3LjI1MzgwMTggTDYuNzYxMTQwMzIsMTkuMDAzODAxOCBMNC40MjExNDAzMiwxOS42MzM4MDE4IFogTTE5LjQyMTEwMDMsNC42MzM4NDE4IEMxOS43ODY5MDAzLDUuMDIwMTQxOCAxOS45OTA3MDAzLDUuNTMxODgxOCAxOS45OTA3MDAzLDYuMDYzODQxOCBDMTkuOTkwNzAwMyw2LjU5NTgwMTggMTkuNzg2OTAwMyw3LjEwNzU0MTggMTkuNDIxMTAwMyw3LjQ5Mzg0MTggTDE4LjcwMTEwMDMsOC4yMTM4NDE4IEwxNS44MzExMDAzLDUuMzEzODQxOCBMMTYuNTUxMTAwMyw0LjU5Mzg0MTggQzE2LjkzNjgwMDMsNC4yMjI5MTE4IDE3LjQ1MTEwMDMsNC4wMTU3MTE4IDE3Ljk4NjEwMDMsNC4wMTU3MTE4IEMxOC41MjEyMDAzLDQuMDE1NzExOCAxOS4wMzU1MDAzLDQuMjIyOTExOCAxOS40MjExMDAzLDQuNTkzODQxOCBMMTkuNDIxMTAwMyw0LjYzMzg0MTggWiIvPjwvc3ZnPgo=');
43
+ }
44
+ }
45
+
46
+ .ember-node {
47
+ .variable {
48
+ [contenteditable] {
49
+ white-space: pre-wrap;
50
+ word-wrap: break-word;
51
+ outline: 0px;
52
+ }
53
+ }
54
+ }
55
+
56
+ .ember-node.ProseMirror-selectednode {
57
+ .variable {
58
+ background-color: var(--au-blue-200);
59
+ outline: 2px solid var(--au-blue-500);
60
+
61
+ ::selection {
62
+ background-color: var(--au-blue-300);
63
+ }
64
+ }
65
+ }
@@ -0,0 +1,19 @@
1
+ import Component from '@glimmer/component';
2
+ type Args = {
3
+ alignment: 'left' | 'right';
4
+ icon: string;
5
+ iconAlignment: 'left' | 'right';
6
+ skin?: string;
7
+ };
8
+ export default class AuDropdownPill extends Component<Args> {
9
+ dropdownOpen: boolean;
10
+ openDropdown(): void;
11
+ closeDropdown(): void;
12
+ toggleDropdown(): void;
13
+ clickOutsideDeactivates(event: InputEvent): boolean;
14
+ get alignment(): "au-c-dropdown__menu--left" | "au-c-dropdown__menu--right" | "";
15
+ get skin(): string;
16
+ get icon(): string;
17
+ get iconAlignment(): "left" | "right";
18
+ }
19
+ export {};
@@ -10,7 +10,7 @@ interface Args {
10
10
  }
11
11
  export default class AuNativeInput extends Component<Args> {
12
12
  constructor(owner: unknown, args: Args);
13
- get width(): "au-c-input--block" | "";
13
+ get width(): "" | "au-c-input--block";
14
14
  get iconAlignment(): "" | "au-c-input-wrapper--left" | "au-c-input-wrapper--right";
15
15
  get error(): "" | "au-c-input--error";
16
16
  get warning(): "" | "au-c-input--warning";
@@ -21,7 +21,7 @@ export default class CitationCardComponent extends Component<Args> {
21
21
  cardText: string | null;
22
22
  cardLegislationType: string | null;
23
23
  get controller(): ProseController;
24
- get showCard(): Option<CitationDecoration>;
24
+ get showCard(): false | Option<CitationDecoration>;
25
25
  get plugin(): CitationPlugin;
26
26
  get decorations(): import("prosemirror-view").DecorationSet | undefined;
27
27
  get activeDecoration(): Option<CitationDecoration>;
@@ -12,6 +12,13 @@ export default class EditorPluginsCitationInsertComponent extends Component<Args
12
12
  showModal: boolean;
13
13
  legislationTypeUri: string;
14
14
  text: string;
15
+ legislationType: string | null;
16
+ get selectedLegislationTypeUri(): string;
17
+ get selectedLegislationType(): {
18
+ label: string;
19
+ value: string;
20
+ };
21
+ selectLegislationType(type: string): void;
15
22
  get disableInsert(): boolean;
16
23
  get plugin(): CitationPlugin;
17
24
  get activeRanges(): [number, number][] | undefined;
@@ -11,7 +11,6 @@ interface Args {
11
11
  }
12
12
  export default class EditorPluginsCitationsSearchModalComponent extends Component<Args> {
13
13
  intl: IntlService;
14
- legislationTypeUri: string;
15
14
  pageNumber: number;
16
15
  pageSize: number;
17
16
  totalCount: number;
@@ -25,7 +24,7 @@ export default class EditorPluginsCitationsSearchModalComponent extends Componen
25
24
  inputSearchText: string | null;
26
25
  minDate: Date;
27
26
  maxDate: Date;
28
- constructor(owner: unknown, args: Args);
27
+ get legislationTypeUri(): string;
29
28
  get datePickerLocalization(): {
30
29
  buttonLabel: string;
31
30
  selectedDateMessage: string;
@@ -51,7 +50,6 @@ export default class EditorPluginsCitationsSearchModalComponent extends Componen
51
50
  resourceSearch: import("ember-concurrency").TaskForAsyncTaskFunction<unknown, () => Promise<Decision[]>>;
52
51
  decisionResource: import("ember-resources/util/ember-concurrency").TaskInstance<unknown>;
53
52
  setInputSearchText(event: InputEvent): void;
54
- selectLegislationType(type: string): void;
55
53
  updateDocumentDateFrom(_isoDate: unknown, date: Date): void;
56
54
  updateDocumentDateTo(_isoDate: unknown, date: Date): void;
57
55
  updatePublicationDateFrom(_isoDate: unknown, date: Date): void;