@lblod/ember-rdfa-editor-lblod-plugins 8.2.2 → 8.4.0

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 (63) hide show
  1. package/.woodpecker/.test.yml +5 -0
  2. package/CHANGELOG.md +31 -1
  3. package/addon/components/citation-plugin/citations/search-modal.hbs +18 -41
  4. package/addon/components/citation-plugin/citations/search-modal.ts +0 -17
  5. package/addon/components/document-title-plugin/insert-title-card.hbs +5 -0
  6. package/addon/components/document-title-plugin/insert-title-card.ts +41 -0
  7. package/addon/components/pagination/pagination-view.hbs +39 -0
  8. package/addon/components/snippet-plugin/helpers/alert-load-error.hbs +22 -0
  9. package/addon/components/snippet-plugin/helpers/alert-no-items.hbs +8 -0
  10. package/addon/components/snippet-plugin/search-modal.hbs +83 -0
  11. package/addon/components/snippet-plugin/search-modal.ts +97 -0
  12. package/addon/components/snippet-plugin/snippet-insert.hbs +17 -0
  13. package/addon/components/snippet-plugin/snippet-insert.ts +50 -0
  14. package/addon/components/snippet-plugin/snippets/snippet-list.hbs +12 -0
  15. package/addon/components/snippet-plugin/snippets/snippet-preview.hbs +27 -0
  16. package/addon/components/snippet-plugin/snippets/snippet-preview.ts +28 -0
  17. package/addon/helpers/pagination.ts +40 -0
  18. package/addon/plugins/article-structure-plugin/commands/insert-structure.ts +2 -79
  19. package/addon/plugins/citation-plugin/utils/vlaamse-codex.ts +4 -34
  20. package/addon/plugins/document-title-plugin/commands/insert-document-title.ts +45 -0
  21. package/addon/plugins/document-title-plugin/nodes/document-title.ts +36 -0
  22. package/addon/plugins/document-title-plugin/nodes/index.ts +1 -0
  23. package/addon/plugins/snippet-plugin/index.ts +27 -0
  24. package/addon/plugins/snippet-plugin/utils/fetch-data.ts +96 -0
  25. package/addon/plugins/variable-plugin/nodes.ts +15 -11
  26. package/addon/plugins/variable-plugin/utils/fetch-data.ts +6 -6
  27. package/addon/utils/_private/find-insertion-range.ts +77 -0
  28. package/addon/utils/sparql-helpers.ts +28 -6
  29. package/addon/utils/strings.ts +34 -0
  30. package/addon/utils/types.ts +3 -0
  31. package/app/components/document-title-plugin/insert-title-card.js +1 -0
  32. package/app/components/pagination/pagination-view.js +1 -0
  33. package/app/components/snippet-plugin/helpers/alert-load-error.js +1 -0
  34. package/app/components/snippet-plugin/helpers/alert-no-items.js +1 -0
  35. package/app/components/snippet-plugin/search-modal.js +1 -0
  36. package/app/components/snippet-plugin/snippet-insert.js +1 -0
  37. package/app/components/snippet-plugin/snippets/snippet-list.js +1 -0
  38. package/app/components/snippet-plugin/snippets/snippet-preview.js +1 -0
  39. package/app/helpers/pagination.js +4 -0
  40. package/app/styles/document-title-plugin.scss +9 -0
  41. package/app/styles/snippet-plugin.scss +66 -0
  42. package/components/besluit-type-plugin/toolbar-dropdown.d.ts +1 -1
  43. package/components/citation-plugin/citations/search-modal.d.ts +0 -4
  44. package/components/document-title-plugin/insert-title-card.d.ts +12 -0
  45. package/components/snippet-plugin/search-modal.d.ts +22 -0
  46. package/components/snippet-plugin/snippet-insert.d.ts +16 -0
  47. package/components/snippet-plugin/snippets/snippet-preview.d.ts +14 -0
  48. package/helpers/pagination.d.ts +25 -0
  49. package/package.json +5 -5
  50. package/plugins/document-title-plugin/commands/insert-document-title.d.ts +6 -0
  51. package/plugins/document-title-plugin/nodes/document-title.d.ts +2 -0
  52. package/plugins/document-title-plugin/nodes/index.d.ts +1 -0
  53. package/plugins/snippet-plugin/index.d.ts +16 -0
  54. package/plugins/snippet-plugin/utils/fetch-data.d.ts +18 -0
  55. package/plugins/table-of-contents-plugin/nodes/table-of-contents.d.ts +1 -1
  56. package/plugins/variable-plugin/nodes.d.ts +3 -3
  57. package/translations/en-US.yaml +28 -0
  58. package/translations/nl-BE.yaml +28 -1
  59. package/tsconfig.json +5 -13
  60. package/utils/_private/find-insertion-range.d.ts +11 -0
  61. package/utils/sparql-helpers.d.ts +11 -4
  62. package/utils/strings.d.ts +2 -0
  63. package/utils/types.d.ts +2 -0
@@ -0,0 +1,66 @@
1
+ .snippet-modal {
2
+ &--main-container {
3
+ height: 100% !important;
4
+
5
+ background-color: var(--au-gray-100);
6
+
7
+ .au-c-sidebar {
8
+ border-right: 0;
9
+ }
10
+
11
+ #content {
12
+ display: flex;
13
+ flex-direction: column;
14
+ }
15
+ }
16
+
17
+ &--list-container {
18
+ overflow: auto;
19
+ flex-grow: 1;
20
+ }
21
+
22
+ &--error-code {
23
+ font-family: var(--au-font-tertiary);
24
+ }
25
+ }
26
+
27
+ .snippet-preview {
28
+ &--container {
29
+ flex-direction: row;
30
+ }
31
+
32
+ &--article {
33
+ flex-grow: 1;
34
+
35
+ .say-editor__paper,
36
+ .say-editor__inner {
37
+ min-height: auto;
38
+ white-space: inherit;
39
+ }
40
+
41
+ .say-editor,
42
+ .say-editor__inner {
43
+ padding: 0;
44
+ }
45
+ }
46
+
47
+ &--title {
48
+ color: var(--au-gray-700);
49
+ font-weight: var(--au-medium);
50
+ }
51
+
52
+ &--button {
53
+ border-left: 1px solid var(--au-gray-200);
54
+ }
55
+
56
+ &--editor-overlay {
57
+ position: absolute !important;
58
+ top: 0;
59
+ width: 100%;
60
+ height: 100%;
61
+ }
62
+
63
+ &--editor-container {
64
+ position: relative;
65
+ }
66
+ }
@@ -30,7 +30,7 @@ export default class EditorPluginsToolbarDropdownComponent extends Component<Arg
30
30
  constructor(parent: unknown, args: Args);
31
31
  get controller(): SayController;
32
32
  get doc(): import("prosemirror-model").Node;
33
- types: import("ember-resources/util/function").State<BesluitType[]>;
33
+ types: import("ember-resources/util/function").State<Promise<BesluitType[]>>;
34
34
  get currentBesluitRange(): ResolvedPNode | undefined;
35
35
  get currentBesluitURI(): string | undefined;
36
36
  get showCard(): boolean;
@@ -49,10 +49,6 @@ export default class EditorPluginsCitationsSearchModalComponent extends Componen
49
49
  endpoint: string;
50
50
  };
51
51
  get searchText(): string;
52
- get rangeStart(): number;
53
- get rangeEnd(): number;
54
- get isFirstPage(): boolean;
55
- get isLastPage(): boolean;
56
52
  resourceSearch: import("ember-concurrency").TaskForAsyncTaskFunction<unknown, () => Promise<Decision[]>>;
57
53
  decisionResource: import("ember-resources/util/ember-concurrency").TaskInstance<unknown>;
58
54
  setInputSearchText(event: InputEvent): void;
@@ -0,0 +1,12 @@
1
+ import Component from '@glimmer/component';
2
+ import { SayController } from '@lblod/ember-rdfa-editor';
3
+ import IntlService from 'ember-intl/services/intl';
4
+ type Args = {
5
+ controller: SayController;
6
+ };
7
+ export default class InsertTitleCardComponent extends Component<Args> {
8
+ intl: IntlService;
9
+ insertTitle(): void;
10
+ get canInsertTitle(): boolean;
11
+ }
12
+ export {};
@@ -0,0 +1,22 @@
1
+ import Component from '@glimmer/component';
2
+ import { SnippetPluginConfig } from '@lblod/ember-rdfa-editor-lblod-plugins/plugins/snippet-plugin';
3
+ interface Args {
4
+ config: SnippetPluginConfig;
5
+ closeModal: () => void;
6
+ }
7
+ export default class SnippetPluginSearchModalComponent extends Component<Args> {
8
+ inputSearchText: string | null;
9
+ error: unknown;
10
+ pageNumber: number;
11
+ pageSize: number;
12
+ totalCount: number;
13
+ get config(): SnippetPluginConfig;
14
+ get searchText(): string | null;
15
+ setInputSearchText(event: InputEvent): void;
16
+ closeModal(): Promise<void>;
17
+ snippetsSearch: import("ember-concurrency").TaskForAsyncTaskFunction<unknown, () => Promise<import("@lblod/ember-rdfa-editor-lblod-plugins/plugins/snippet-plugin").Snippet[]>>;
18
+ snippetsResource: import("ember-resources/util/ember-concurrency").TaskInstance<unknown>;
19
+ previousPage(): void;
20
+ nextPage(): void;
21
+ }
22
+ export {};
@@ -0,0 +1,16 @@
1
+ import Component from '@glimmer/component';
2
+ import { SayController } from '@lblod/ember-rdfa-editor';
3
+ import { SnippetPluginConfig } from '@lblod/ember-rdfa-editor-lblod-plugins/plugins/snippet-plugin';
4
+ interface Args {
5
+ controller: SayController;
6
+ config: SnippetPluginConfig;
7
+ }
8
+ export default class SnippetInsertComponent extends Component<Args> {
9
+ showModal: boolean;
10
+ get controller(): SayController;
11
+ get config(): SnippetPluginConfig;
12
+ openModal(): void;
13
+ closeModal(): void;
14
+ onInsert(content: string): void;
15
+ }
16
+ export {};
@@ -0,0 +1,14 @@
1
+ import Component from '@glimmer/component';
2
+ import { SayController } from '@lblod/ember-rdfa-editor';
3
+ import { Snippet, SnippetPluginConfig } from '@lblod/ember-rdfa-editor-lblod-plugins/plugins/snippet-plugin';
4
+ interface Args {
5
+ config: SnippetPluginConfig;
6
+ snippet: Snippet;
7
+ onInsert: (content: string) => void;
8
+ }
9
+ export default class SnippetPreviewComponent extends Component<Args> {
10
+ controller?: SayController;
11
+ get snippet(): Snippet;
12
+ onInsert(): void;
13
+ }
14
+ export {};
@@ -0,0 +1,25 @@
1
+ interface PaginationArguments {
2
+ count: number;
3
+ pageSize: number;
4
+ page: number;
5
+ }
6
+ export declare function pagination({ page, count, pageSize, }: PaginationArguments): {
7
+ count: number;
8
+ pageSize: number;
9
+ page: number;
10
+ totalPages: number;
11
+ pageStart: number;
12
+ pageEnd: number;
13
+ nextPage: number | null;
14
+ previousPage: number | null;
15
+ hasPreviousPage: boolean;
16
+ hasNextPage: boolean;
17
+ };
18
+ declare const _default: import("@ember/component/helper").FunctionBasedHelper<{
19
+ Args: {
20
+ Positional: unknown[];
21
+ Named: PaginationArguments;
22
+ };
23
+ Return: unknown;
24
+ }>;
25
+ export default _default;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lblod/ember-rdfa-editor-lblod-plugins",
3
- "version": "8.2.2",
3
+ "version": "8.4.0",
4
4
  "description": "Ember addon providing lblod specific plugins for the ember-rdfa-editor",
5
5
  "keywords": [
6
6
  "ember-addon",
@@ -50,8 +50,8 @@
50
50
  "ember-concurrency": "^2.3.7",
51
51
  "ember-mu-transform-helpers": "^2.0.0",
52
52
  "ember-power-select": "^6.0.1",
53
- "ember-resources": "^5.6.2",
54
- "ember-velcro": "^1.1.0",
53
+ "ember-resources": "^6.1.1",
54
+ "ember-velcro": "^2.1.0",
55
55
  "fetch-sparql-endpoint": "^3.0.0",
56
56
  "n2words": "^1.16.4",
57
57
  "process": "0.11.10",
@@ -69,7 +69,7 @@
69
69
  "@embroider/test-setup": "^1.8.3",
70
70
  "@glimmer/component": "^1.1.2",
71
71
  "@glimmer/tracking": "^1.1.2",
72
- "@lblod/ember-rdfa-editor": "^3.8.0",
72
+ "@lblod/ember-rdfa-editor": "^3.10.0",
73
73
  "@rdfjs/types": "^1.1.0",
74
74
  "@release-it/keep-a-changelog": "^3.1.0",
75
75
  "@tsconfig/ember": "^1.0.1",
@@ -148,7 +148,7 @@
148
148
  },
149
149
  "peerDependencies": {
150
150
  "@appuniversum/ember-appuniversum": "^2.4.2",
151
- "@lblod/ember-rdfa-editor": "^3.8.0",
151
+ "@lblod/ember-rdfa-editor": "^3.10.0",
152
152
  "ember-concurrency": "^2.3.7"
153
153
  },
154
154
  "overrides": {
@@ -0,0 +1,6 @@
1
+ import { Command } from '@lblod/ember-rdfa-editor';
2
+ interface InsertDocumentTitleArgs {
3
+ placeholder: string;
4
+ }
5
+ export default function insertDocumentTitle({ placeholder, }: InsertDocumentTitleArgs): Command;
6
+ export {};
@@ -0,0 +1,2 @@
1
+ import { NodeSpec } from '@lblod/ember-rdfa-editor';
2
+ export declare const document_title: NodeSpec;
@@ -0,0 +1 @@
1
+ export { document_title } from './document-title';
@@ -0,0 +1,16 @@
1
+ import { SafeString } from '@lblod/ember-rdfa-editor-lblod-plugins/utils/types';
2
+ export type SnippetPluginConfig = {
3
+ endpoint: string;
4
+ };
5
+ interface SnippetArgs {
6
+ title: string | null;
7
+ createdOn: string | null;
8
+ content: string | null;
9
+ }
10
+ export declare class Snippet {
11
+ content: SafeString | null;
12
+ createdOn: string | null;
13
+ title: string | null;
14
+ constructor({ title, createdOn, content }: SnippetArgs);
15
+ }
16
+ export {};
@@ -0,0 +1,18 @@
1
+ import { Snippet } from '../index';
2
+ type Filter = {
3
+ name?: string;
4
+ };
5
+ type Pagination = {
6
+ pageNumber: number;
7
+ pageSize: number;
8
+ };
9
+ export declare const fetchSnippets: ({ endpoint, abortSignal, filter, pagination, }: {
10
+ endpoint: string;
11
+ abortSignal: AbortSignal;
12
+ filter: Filter;
13
+ pagination: Pagination;
14
+ }) => Promise<{
15
+ totalCount: number;
16
+ results: Snippet[];
17
+ }>;
18
+ export {};
@@ -2,4 +2,4 @@ import { EmberNodeConfig } from '@lblod/ember-rdfa-editor/utils/ember-node';
2
2
  import { TableOfContentsConfig } from '..';
3
3
  export declare const emberNodeConfig: (config: TableOfContentsConfig) => EmberNodeConfig;
4
4
  export declare const table_of_contents: (config: TableOfContentsConfig) => import("prosemirror-model").NodeSpec;
5
- export declare const tableOfContentsView: (config: TableOfContentsConfig) => (controller: import("@lblod/ember-rdfa-editor/addon").SayController) => import("prosemirror-view").NodeViewConstructor;
5
+ export declare const tableOfContentsView: (config: TableOfContentsConfig) => (controller: import("@lblod/ember-rdfa-editor").SayController) => import("prosemirror-view").NodeViewConstructor;
@@ -26,12 +26,12 @@ export declare const getPNodeExtraAttributes: ({ node, type, }: {
26
26
  "data-written-number"?: undefined;
27
27
  };
28
28
  export declare const contentToDom: ({ content, type, node, }: {
29
- content: string;
29
+ content: string | null;
30
30
  type: string;
31
31
  node: PNode;
32
- }) => string;
32
+ }) => string | null;
33
33
  export declare const parseAttributes: (node: HTMLElement) => false | Attrs;
34
- export declare const attributesToDOM: (node: PNode, content?: null) => DOMOutputSpec;
34
+ export declare const attributesToDOM: (node: PNode, content?: string | null) => DOMOutputSpec;
35
35
  export declare const emberNodeConfig: EmberNodeConfig;
36
36
  export declare const variable: import("prosemirror-model").NodeSpec;
37
37
  export declare const variableView: (controller: import("@lblod/ember-rdfa-editor").SayController) => import("prosemirror-view").NodeViewConstructor;
@@ -179,6 +179,11 @@ date-plugin:
179
179
  required: 'This field cannot be empty'
180
180
  fractions: 'Fractions of a second, such as S or T, are not supported.'
181
181
  unknown: 'Invalid format'
182
+
183
+ document-title-plugin:
184
+ document-title-placeholder: Enter document title
185
+ insert-title: Insert document title
186
+
182
187
  variable:
183
188
  number:
184
189
  placeholder: number
@@ -228,3 +233,26 @@ generic-rdfa-variable:
228
233
  modal:
229
234
  insert: Insert
230
235
  cancel: Cancel
236
+
237
+ snippet-plugin:
238
+ insert:
239
+ title: Insert snippet
240
+ modal:
241
+ title: Choose a snippet
242
+ select: Select
243
+ search:
244
+ title: Filter on
245
+ label: Snippet name
246
+ placeholder: Type something...
247
+ alert:
248
+ loading: Loading…
249
+ no-results: No results found
250
+ error-title: Error while loading results
251
+ error-intro: 'An error occurred while loading results'
252
+ error-outro: In case this problem keeps occurring, please contact
253
+
254
+ pagination:
255
+ next: Next page
256
+ previous: Previous page
257
+ of: of
258
+ results: Results
@@ -184,6 +184,10 @@ date-plugin:
184
184
  fractions: "Fracties van seconden, zoals S en T, zijn niet ondersteund."
185
185
  unknown: "Ongeldig formaat"
186
186
 
187
+ document-title-plugin:
188
+ document-title-placeholder: Geef document-titel op
189
+ insert-title: Document-titel invoegen
190
+
187
191
  validation-plugin:
188
192
  default-fix-message: Oplossen
189
193
 
@@ -197,7 +201,7 @@ variable:
197
201
  type-number: typ een nummer...
198
202
  error-not-integer: Enkel gehele getallen zijn toegelaten
199
203
  error-not-number: Enkel getallen zijn toegelaten
200
- error-number-between: Het getal moet tussen {minValue} en {maxValue} liggen
204
+ error-number-between: Het getal moet tussen {minValue} en {maxValue} liggen
201
205
  error-number-above: Het getal moet groter dan {minValue} zijn
202
206
  error-number-below: Het getal moet kleiner dan {maxValue} zijn
203
207
  written-number-label: Getal voluit schrijven
@@ -233,3 +237,26 @@ generic-rdfa-variable:
233
237
  modal:
234
238
  insert: Invoegen
235
239
  cancel: Terug
240
+
241
+ snippet-plugin:
242
+ insert:
243
+ title: Fragment invoegen
244
+ modal:
245
+ title: Kies een fragment
246
+ select: Selecteer
247
+ search:
248
+ title: Filter op
249
+ label: Fragmentnaam
250
+ placeholder: Typ iets...
251
+ alert:
252
+ loading: Laden…
253
+ no-results: Geen resultaten gevonden
254
+ error-title: Probleem bij het laden
255
+ error-intro: "Er is een fout opgetreden tijdens het laden van de resultaten:"
256
+ error-outro: Moest dit probleem aanhouden, neem contact op met
257
+
258
+ pagination:
259
+ next: Volgende pagina
260
+ previous: Vorige pagina
261
+ of: van
262
+ results: Resultaten
package/tsconfig.json CHANGED
@@ -23,7 +23,7 @@
23
23
  "skipLibCheck": true,
24
24
  "experimentalDecorators": true,
25
25
  "typeRoots": [
26
- "./node_modules/@types",
26
+ "./node_modules/@types"
27
27
  ],
28
28
  "paths": {
29
29
  "dummy/tests/*": [
@@ -46,24 +46,16 @@
46
46
  "addon-test-support/*"
47
47
  ],
48
48
  "*": [
49
- "types/*",
50
- "node_modules/@lblod/ember-rdfa-editor/types/*"
51
- ],
52
- "@lblod/ember-rdfa-editor": [
53
- "node_modules/@lblod/ember-rdfa-editor/addon"
54
- ],
55
- "@lblod/ember-rdfa-editor/*": [
56
- "node_modules/@lblod/ember-rdfa-editor/addon/*"
57
- ],
58
- },
49
+ "types/*"
50
+ ]
51
+ }
59
52
  },
60
53
  "include": [
61
54
  "app/**/*",
62
55
  "addon/**/*",
63
56
  "tests/**/*",
64
57
  "types/**/*",
65
- "node_modules/@lblod/ember-rdfa-editor/types/**/*",
66
58
  "test-support/**/*",
67
- "addon-test-support/**/*",
59
+ "addon-test-support/**/*"
68
60
  ]
69
61
  }
@@ -0,0 +1,11 @@
1
+ import { NodeType, PNode, ResolvedPos, Schema } from '@lblod/ember-rdfa-editor';
2
+ export declare function findInsertionRange(args: {
3
+ doc: PNode;
4
+ $from: ResolvedPos;
5
+ nodeType: NodeType;
6
+ schema: Schema;
7
+ limitTo?: string;
8
+ }): {
9
+ from: number;
10
+ to: number;
11
+ } | null;
@@ -1,7 +1,14 @@
1
1
  import * as RDF from '@rdfjs/types';
2
- export type QueryResult = {
2
+ export interface QueryResult<Binding = Record<string, RDF.Term>> {
3
3
  results: {
4
- bindings: Record<string, RDF.Term>[];
4
+ bindings: Binding[];
5
5
  };
6
- };
7
- export declare function executeQuery(endpoint: string, query: string): Promise<QueryResult>;
6
+ }
7
+ interface QueryConfig {
8
+ query: string;
9
+ endpoint: string;
10
+ abortSignal?: AbortSignal;
11
+ }
12
+ export declare function executeQuery<Binding = Record<string, RDF.Term>>({ query, endpoint, abortSignal, }: QueryConfig): Promise<QueryResult<Binding>>;
13
+ export declare function executeCountQuery(queryConfig: QueryConfig): Promise<number>;
14
+ export {};
@@ -0,0 +1,2 @@
1
+ export declare function escapeValue(value?: string): string | null;
2
+ export declare function dateValue(value?: string): string | null;
@@ -0,0 +1,2 @@
1
+ import { htmlSafe } from '@ember/template';
2
+ export type SafeString = ReturnType<typeof htmlSafe>;