@lblod/ember-rdfa-editor-lblod-plugins 38.0.3 → 38.1.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 (46) hide show
  1. package/CHANGELOG.md +27 -0
  2. package/addon/components/snippet-plugin/nodes/placeholder.gts +4 -6
  3. package/addon/components/snippet-plugin/nodes/snippet.gts +34 -8
  4. package/addon/components/snippet-plugin/search-modal.gts +12 -6
  5. package/addon/components/snippet-plugin/snippet-insert-rdfa.gts +0 -2
  6. package/addon/plugins/snippet-plugin/commands/update-snippet-placeholder.ts +2 -11
  7. package/addon/plugins/snippet-plugin/index.ts +2 -1
  8. package/addon/plugins/snippet-plugin/nodes/snippet-placeholder.ts +0 -12
  9. package/addon/plugins/snippet-plugin/nodes/snippet.ts +1 -11
  10. package/addon/plugins/snippet-plugin/utils/fetch-data.ts +55 -16
  11. package/addon/plugins/variable-plugin/contextual-actions/codelist.ts +132 -0
  12. package/addon/plugins/variable-plugin/contextual-actions/index.ts +6 -217
  13. package/addon/plugins/variable-plugin/contextual-actions/place-description.ts +222 -0
  14. package/addon/plugins/variable-plugin/utils/codelist-utils.ts +46 -25
  15. package/addon/services/snippet-fetch-service.ts +76 -0
  16. package/app/services/snippet-fetch-service.js +1 -0
  17. package/declarations/addon/components/snippet-plugin/nodes/placeholder.d.ts +1 -1
  18. package/declarations/addon/components/snippet-plugin/nodes/snippet.d.ts +7 -1
  19. package/declarations/addon/components/snippet-plugin/search-modal.d.ts +5 -2
  20. package/declarations/addon/plugins/location-plugin/node.d.ts +1 -1
  21. package/declarations/addon/plugins/locked-placeholder-plugin/nodes/block-locked-placeholder.d.ts +1 -1
  22. package/declarations/addon/plugins/locked-placeholder-plugin/nodes/inline-locked-placeholder.d.ts +1 -1
  23. package/declarations/addon/plugins/mandatee-table-plugin/node.d.ts +1 -1
  24. package/declarations/addon/plugins/snippet-plugin/index.d.ts +2 -1
  25. package/declarations/addon/plugins/snippet-plugin/nodes/snippet-placeholder.d.ts +1 -1
  26. package/declarations/addon/plugins/snippet-plugin/nodes/snippet.d.ts +2 -2
  27. package/declarations/addon/plugins/snippet-plugin/utils/fetch-data.d.ts +9 -5
  28. package/declarations/addon/plugins/structure-plugin/node.d.ts +2 -2
  29. package/declarations/addon/plugins/table-of-contents-plugin/nodes/table-of-contents.d.ts +1 -1
  30. package/declarations/addon/plugins/template-comments-plugin/node.d.ts +1 -1
  31. package/declarations/addon/plugins/variable-plugin/contextual-actions/codelist.d.ts +14 -0
  32. package/declarations/addon/plugins/variable-plugin/contextual-actions/index.d.ts +5 -15
  33. package/declarations/addon/plugins/variable-plugin/contextual-actions/place-description.d.ts +15 -0
  34. package/declarations/addon/plugins/variable-plugin/utils/codelist-utils.d.ts +3 -1
  35. package/declarations/addon/plugins/variable-plugin/variables/address.d.ts +1 -1
  36. package/declarations/addon/plugins/variable-plugin/variables/autofilled.d.ts +1 -1
  37. package/declarations/addon/plugins/variable-plugin/variables/codelist.d.ts +1 -1
  38. package/declarations/addon/plugins/variable-plugin/variables/date.d.ts +1 -1
  39. package/declarations/addon/plugins/variable-plugin/variables/legacy-codelist.d.ts +1 -1
  40. package/declarations/addon/plugins/variable-plugin/variables/location.d.ts +1 -1
  41. package/declarations/addon/plugins/variable-plugin/variables/number.d.ts +1 -1
  42. package/declarations/addon/plugins/variable-plugin/variables/person.d.ts +1 -1
  43. package/declarations/addon/plugins/variable-plugin/variables/text.d.ts +1 -1
  44. package/declarations/addon/services/snippet-fetch-service.d.ts +20 -0
  45. package/package.json +3 -3
  46. package/pnpm-workspace.yaml +1 -0
@@ -1,2 +1,2 @@
1
1
  export declare const inlineLockedPlaceholder: import("@lblod/ember-rdfa-editor/core/say-node-spec").default;
2
- export declare const inlineLockedPlaceholderView: (controller: import("@lblod/ember-rdfa-editor").SayController) => import("@lblod/ember-rdfa-editor/utils/ember-node").SayNodeViewConstructor;
2
+ export declare const inlineLockedPlaceholderView: (controller: import("@lblod/ember-rdfa-editor").SayController) => import("@lblod/ember-rdfa-editor").NodeViewConstructor;
@@ -1,4 +1,4 @@
1
1
  import { EmberNodeConfig } from '@lblod/ember-rdfa-editor/utils/ember-node';
2
2
  export declare const emberNodeConfig: () => EmberNodeConfig;
3
3
  export declare const mandatee_table: import("@lblod/ember-rdfa-editor/core/say-node-spec").default;
4
- export declare const mandateeTableView: (controller: import("@lblod/ember-rdfa-editor").SayController) => import("@lblod/ember-rdfa-editor/utils/ember-node").SayNodeViewConstructor;
4
+ export declare const mandateeTableView: (controller: import("@lblod/ember-rdfa-editor").SayController) => import("@lblod/ember-rdfa-editor").NodeViewConstructor;
@@ -21,7 +21,8 @@ export type ImportedResourceMap = Record<string, Option<string>>;
21
21
  export type SnippetListProperties = {
22
22
  placeholderId: string;
23
23
  listUris: string[];
24
- names: string[];
24
+ /** @deprecated Passing snippet list names is no longer necessary */
25
+ names?: string[];
25
26
  importedResources: ImportedResourceMap;
26
27
  };
27
28
  export type SnippetListArgs = {
@@ -13,5 +13,5 @@ type CreateSnippetPlaceholderArgs = {
13
13
  });
14
14
  export declare function createSnippetPlaceholder({ schema, allowMultipleSnippets, ...args }: CreateSnippetPlaceholderArgs): import("prosemirror-model").Node;
15
15
  export declare const snippetPlaceholder: (config: SnippetPluginConfig) => import("@lblod/ember-rdfa-editor/core/say-node-spec").default;
16
- export declare const snippetPlaceholderView: (config: SnippetPluginConfig) => (controller: import("@lblod/ember-rdfa-editor").SayController) => import("@lblod/ember-rdfa-editor/utils/ember-node").SayNodeViewConstructor;
16
+ export declare const snippetPlaceholderView: (config: SnippetPluginConfig) => (controller: import("@lblod/ember-rdfa-editor").SayController) => import("@lblod/ember-rdfa-editor").NodeViewConstructor;
17
17
  export {};
@@ -14,7 +14,7 @@ interface CreateSnippetArgs {
14
14
  * @returns a tuple containing the Node and the map of imported resources to the new outgoing
15
15
  * properties that these resources will have after the snippet is inserted into the document.
16
16
  **/
17
- export declare function createSnippet({ schema, content, title, allowMultipleSnippets, listProperties: { listUris, names: snippetListNames, importedResources, placeholderId, }, }: CreateSnippetArgs): [PNode, Map<string, OutgoingTriple[]>];
17
+ export declare function createSnippet({ schema, content, title, allowMultipleSnippets, listProperties: { listUris, importedResources, placeholderId }, }: CreateSnippetArgs): [PNode, Map<string, OutgoingTriple[]>];
18
18
  export declare const snippet: (config: SnippetPluginConfig) => import("@lblod/ember-rdfa-editor/core/say-node-spec").default;
19
- export declare const snippetView: (config: SnippetPluginConfig) => (controller: import("@lblod/ember-rdfa-editor").SayController) => import("@lblod/ember-rdfa-editor/utils/ember-node").SayNodeViewConstructor;
19
+ export declare const snippetView: (config: SnippetPluginConfig) => (controller: import("@lblod/ember-rdfa-editor").SayController) => import("@lblod/ember-rdfa-editor").NodeViewConstructor;
20
20
  export {};
@@ -1,17 +1,17 @@
1
1
  import { Snippet, SnippetList } from '../index';
2
- type Filter = {
2
+ export type SnippetFilter = {
3
3
  name?: string;
4
4
  snippetListUris?: string[];
5
5
  };
6
6
  export type OrderBy = 'label' | 'created-on' | '-label' | '-created-on' | '' | null;
7
- type Pagination = {
7
+ export type Pagination = {
8
8
  pageNumber: number;
9
9
  pageSize: number;
10
10
  };
11
11
  export declare const fetchSnippets: ({ endpoint, abortSignal, filter, pagination, }: {
12
12
  endpoint: string;
13
13
  abortSignal: AbortSignal;
14
- filter: Filter;
14
+ filter: SnippetFilter;
15
15
  pagination: Pagination;
16
16
  }) => Promise<{
17
17
  totalCount: number;
@@ -20,9 +20,13 @@ export declare const fetchSnippets: ({ endpoint, abortSignal, filter, pagination
20
20
  export declare const fetchSnippetLists: ({ endpoint, abortSignal, filter, orderBy, }: {
21
21
  endpoint: string;
22
22
  abortSignal: AbortSignal;
23
- filter: Filter;
23
+ filter: SnippetFilter;
24
24
  orderBy: OrderBy;
25
25
  }) => Promise<{
26
26
  results: SnippetList[];
27
27
  }>;
28
- export {};
28
+ export declare const fetchSnippetListNames: ({ endpoint, abortSignal, snippetListUris, }: {
29
+ endpoint: string;
30
+ abortSignal: AbortSignal;
31
+ snippetListUris: string[];
32
+ }) => Promise<Map<string, string>>;
@@ -4,6 +4,6 @@ import { StructurePluginOptions, StructureType } from './structure-types';
4
4
  export declare function getNameForStructureType(structureType: StructureType, number: number, fullLengthArticles?: boolean, intl?: IntlService, locale?: string): string;
5
5
  export declare const emberNodeConfig: (config?: StructurePluginOptions) => EmberNodeConfig;
6
6
  export declare const structure: import("@lblod/ember-rdfa-editor/core/say-node-spec").default;
7
- export declare const structureView: (controller: import("@lblod/ember-rdfa-editor").SayController) => import("@lblod/ember-rdfa-editor/utils/ember-node").SayNodeViewConstructor;
7
+ export declare const structureView: (controller: import("@lblod/ember-rdfa-editor").SayController) => import("@lblod/ember-rdfa-editor").NodeViewConstructor;
8
8
  export declare const structureWithConfig: (config?: StructurePluginOptions) => import("@lblod/ember-rdfa-editor/core/say-node-spec").default;
9
- export declare const structureViewWithConfig: (config?: StructurePluginOptions) => (controller: import("@lblod/ember-rdfa-editor").SayController) => import("@lblod/ember-rdfa-editor/utils/ember-node").SayNodeViewConstructor;
9
+ export declare const structureViewWithConfig: (config?: StructurePluginOptions) => (controller: import("@lblod/ember-rdfa-editor").SayController) => import("@lblod/ember-rdfa-editor").NodeViewConstructor;
@@ -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("@lblod/ember-rdfa-editor/core/say-node-spec").default;
5
- export declare const tableOfContentsView: (config?: TableOfContentsConfig) => (controller: import("@lblod/ember-rdfa-editor").SayController) => import("@lblod/ember-rdfa-editor/utils/ember-node").SayNodeViewConstructor;
5
+ export declare const tableOfContentsView: (config?: TableOfContentsConfig) => (controller: import("@lblod/ember-rdfa-editor").SayController) => import("@lblod/ember-rdfa-editor").NodeViewConstructor;
@@ -1,4 +1,4 @@
1
1
  import { EmberNodeConfig } from '@lblod/ember-rdfa-editor/utils/ember-node';
2
2
  export declare const emberNodeConfig: () => EmberNodeConfig;
3
3
  export declare const templateComment: import("@lblod/ember-rdfa-editor/core/say-node-spec").default;
4
- export declare const templateCommentView: (controller: import("@lblod/ember-rdfa-editor").SayController) => import("@lblod/ember-rdfa-editor/utils/ember-node").SayNodeViewConstructor;
4
+ export declare const templateCommentView: (controller: import("@lblod/ember-rdfa-editor").SayController) => import("@lblod/ember-rdfa-editor").NodeViewConstructor;
@@ -0,0 +1,14 @@
1
+ import { EditorState } from '@lblod/ember-rdfa-editor';
2
+ import { ContextualActionGroup } from '@lblod/ember-rdfa-editor/plugins/contextual-actions';
3
+ type GetContextualActionsAttrs = {
4
+ endpoint?: string;
5
+ };
6
+ export declare function getContextualActions(attrs: GetContextualActionsAttrs): (state: EditorState, searchQuery?: string) => Promise<{
7
+ id: string;
8
+ label: string;
9
+ group: string;
10
+ command: (state: EditorState, dispatch?: (tr: import("@lblod/ember-rdfa-editor").Transaction) => void) => boolean;
11
+ selected: boolean;
12
+ }[]>;
13
+ export declare function getCodelistActionGroups(attrs: GetContextualActionsAttrs): (state: EditorState) => ContextualActionGroup[];
14
+ export {};
@@ -1,15 +1,5 @@
1
- import { EditorState, Transaction } from '@lblod/ember-rdfa-editor';
2
- import { ContextualActionGroup } from '@lblod/ember-rdfa-editor/plugins/contextual-actions';
3
- type GetContextualActionsAttrs = {
4
- zonalLocationCodelistUri: string;
5
- nonZonalLocationCodelistUri: string;
6
- endpoint?: string;
7
- };
8
- export declare function getContextualActions(attrs: GetContextualActionsAttrs): (state: EditorState, searchQuery?: string) => Promise<{
9
- id: string;
10
- label: string;
11
- group: string;
12
- command: (state: EditorState, dispatch?: (tr: Transaction) => void) => boolean;
13
- }[]>;
14
- export declare function getContextualActionGroups(attrs: GetContextualActionsAttrs): (state: EditorState) => ContextualActionGroup[];
15
- export {};
1
+ export {
2
+ /** @deprecated these imports have been moved to contextual-actions/place-description.ts */
3
+ getContextualActions,
4
+ /** @deprecated these imports have been moved to contextual-actions/place-description.ts */
5
+ getPlaceDescriptionActionGroups as getContextualActionGroups, } from './place-description';
@@ -0,0 +1,15 @@
1
+ import { EditorState, Transaction } from '@lblod/ember-rdfa-editor';
2
+ import { ContextualActionGroup } from '@lblod/ember-rdfa-editor/plugins/contextual-actions';
3
+ type GetContextualActionsAttrs = {
4
+ zonalLocationCodelistUri: string;
5
+ nonZonalLocationCodelistUri: string;
6
+ endpoint: string;
7
+ };
8
+ export declare function getContextualActions(attrs: GetContextualActionsAttrs): (state: EditorState, searchQuery?: string) => Promise<{
9
+ id: string;
10
+ label: string;
11
+ group: string;
12
+ command: (state: EditorState, dispatch?: (tr: Transaction) => void) => boolean;
13
+ }[]>;
14
+ export declare function getPlaceDescriptionActionGroups(attrs: GetContextualActionsAttrs): (state: EditorState) => ContextualActionGroup[];
15
+ export {};
@@ -1,5 +1,6 @@
1
+ import { EditorState, PNode, SayController, Transaction } from '@lblod/ember-rdfa-editor';
2
+ import { ResolvedPNode } from '@lblod/ember-rdfa-editor/utils/_private/types';
1
3
  import { CodeListOption } from './fetch-data';
2
- import { PNode, SayController } from '@lblod/ember-rdfa-editor';
3
4
  /**
4
5
  *
5
6
  * @param text content of variable option which needs to be inserted
@@ -10,6 +11,7 @@ import { PNode, SayController } from '@lblod/ember-rdfa-editor';
10
11
  * `This is a variable with <span class="mark-highlight-manual">${placeholder}</span>`
11
12
  */
12
13
  export declare function wrapVariableInHighlight(text: string): string;
14
+ export declare function updateCodelistVariableCommand(selectedCodelist: ResolvedPNode, selectedOption: CodeListOption | CodeListOption[]): (state: EditorState, dispatch?: (tr: Transaction) => void) => boolean;
13
15
  export declare function updateCodelistVariable(selectedCodelist: {
14
16
  node: PNode;
15
17
  pos: number;
@@ -7,4 +7,4 @@ export declare const address: import("@lblod/ember-rdfa-editor/core/say-node-spe
7
7
  * @deprecated Use oslo_location node instead which inserts valid OSLO model RDFa and supports
8
8
  * linking to the document it is in.
9
9
  */
10
- export declare const addressView: (controller: import("@lblod/ember-rdfa-editor").SayController) => import("@lblod/ember-rdfa-editor/utils/ember-node").SayNodeViewConstructor;
10
+ export declare const addressView: (controller: import("@lblod/ember-rdfa-editor").SayController) => import("@lblod/ember-rdfa-editor").NodeViewConstructor;
@@ -1,2 +1,2 @@
1
1
  export declare const autofilled_variable: import("@lblod/ember-rdfa-editor/core/say-node-spec").default;
2
- export declare const autofilledVariableView: (controller: import("@lblod/ember-rdfa-editor").SayController) => import("@lblod/ember-rdfa-editor/utils/ember-node").SayNodeViewConstructor;
2
+ export declare const autofilledVariableView: (controller: import("@lblod/ember-rdfa-editor").SayController) => import("@lblod/ember-rdfa-editor").NodeViewConstructor;
@@ -11,5 +11,5 @@ export type CodelistAttrs = {
11
11
  hardcodedOptionList: Option<CodeListOption[]>;
12
12
  };
13
13
  export declare const codelist: SayNodeSpec;
14
- export declare const codelistView: (controller: import("@lblod/ember-rdfa-editor").SayController) => import("@lblod/ember-rdfa-editor/utils/ember-node").SayNodeViewConstructor;
14
+ export declare const codelistView: (controller: import("@lblod/ember-rdfa-editor").SayController) => import("@lblod/ember-rdfa-editor").NodeViewConstructor;
15
15
  export declare const codelist_option: SayNodeSpec;
@@ -9,4 +9,4 @@ export type DateOptions = {
9
9
  allowCustomFormat: boolean;
10
10
  };
11
11
  export declare const date: (options: DateOptions) => import("@lblod/ember-rdfa-editor/core/say-node-spec").default;
12
- export declare const dateView: (options: DateOptions) => (controller: import("@lblod/ember-rdfa-editor").SayController) => import("@lblod/ember-rdfa-editor/utils/ember-node").SayNodeViewConstructor;
12
+ export declare const dateView: (options: DateOptions) => (controller: import("@lblod/ember-rdfa-editor").SayController) => import("@lblod/ember-rdfa-editor").NodeViewConstructor;
@@ -1,2 +1,2 @@
1
1
  export declare const legacy_codelist: import("@lblod/ember-rdfa-editor/core/say-node-spec").default;
2
- export declare const legacyCodelistView: (controller: import("@lblod/ember-rdfa-editor").SayController) => import("@lblod/ember-rdfa-editor/utils/ember-node").SayNodeViewConstructor;
2
+ export declare const legacyCodelistView: (controller: import("@lblod/ember-rdfa-editor").SayController) => import("@lblod/ember-rdfa-editor").NodeViewConstructor;
@@ -1,2 +1,2 @@
1
1
  export declare const location: import("@lblod/ember-rdfa-editor/core/say-node-spec").default;
2
- export declare const locationView: (controller: import("@lblod/ember-rdfa-editor").SayController) => import("@lblod/ember-rdfa-editor/utils/ember-node").SayNodeViewConstructor;
2
+ export declare const locationView: (controller: import("@lblod/ember-rdfa-editor").SayController) => import("@lblod/ember-rdfa-editor").NodeViewConstructor;
@@ -1,2 +1,2 @@
1
1
  export declare const number: import("@lblod/ember-rdfa-editor/core/say-node-spec").default;
2
- export declare const numberView: (controller: import("@lblod/ember-rdfa-editor").SayController) => import("@lblod/ember-rdfa-editor/utils/ember-node").SayNodeViewConstructor;
2
+ export declare const numberView: (controller: import("@lblod/ember-rdfa-editor").SayController) => import("@lblod/ember-rdfa-editor").NodeViewConstructor;
@@ -4,4 +4,4 @@ export type Person = {
4
4
  lastName: string;
5
5
  };
6
6
  export declare const person_variable: import("@lblod/ember-rdfa-editor/core/say-node-spec").default;
7
- export declare const personVariableView: (controller: import("@lblod/ember-rdfa-editor").SayController) => import("@lblod/ember-rdfa-editor/utils/ember-node").SayNodeViewConstructor;
7
+ export declare const personVariableView: (controller: import("@lblod/ember-rdfa-editor").SayController) => import("@lblod/ember-rdfa-editor").NodeViewConstructor;
@@ -1,2 +1,2 @@
1
1
  export declare const text_variable: import("@lblod/ember-rdfa-editor/core/say-node-spec").default;
2
- export declare const textVariableView: (controller: import("@lblod/ember-rdfa-editor").SayController) => import("@lblod/ember-rdfa-editor/utils/ember-node").SayNodeViewConstructor;
2
+ export declare const textVariableView: (controller: import("@lblod/ember-rdfa-editor").SayController) => import("@lblod/ember-rdfa-editor").NodeViewConstructor;
@@ -0,0 +1,20 @@
1
+ import Service from '@ember/service';
2
+ import { Pagination, SnippetFilter } from '@lblod/ember-rdfa-editor-lblod-plugins/plugins/snippet-plugin/utils/fetch-data';
3
+ import { Snippet, SnippetPluginConfig } from '@lblod/ember-rdfa-editor-lblod-plugins/plugins/snippet-plugin';
4
+ export default class SnippetFetchService extends Service {
5
+ listNameCache: Map<string, string>;
6
+ snippetPageCache: Map<string, {
7
+ totalCount: number;
8
+ pages: Map<number, Snippet[]>;
9
+ }>;
10
+ getListNames(config: SnippetPluginConfig, listUris: string[]): Promise<string[]>;
11
+ getSnippets({ endpoint, abortSignal, filter, pagination, }: {
12
+ endpoint: string;
13
+ abortSignal: AbortSignal;
14
+ filter: SnippetFilter;
15
+ pagination: Pagination;
16
+ }): Promise<{
17
+ totalCount: number;
18
+ results: Snippet[];
19
+ }>;
20
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lblod/ember-rdfa-editor-lblod-plugins",
3
- "version": "38.0.3",
3
+ "version": "38.1.0",
4
4
  "description": "Ember addon providing lblod specific plugins for the ember-rdfa-editor",
5
5
  "keywords": [
6
6
  "ember-addon",
@@ -54,7 +54,7 @@
54
54
  "dependencies": {
55
55
  "@babel/core": "^7.25.2",
56
56
  "@codemirror/lang-html": "^6.4.9",
57
- "@codemirror/state": "^6.4.1",
57
+ "@codemirror/state": "^6.7.0",
58
58
  "@codemirror/view": "^6.28.3",
59
59
  "@curvenote/prosemirror-utils": "^1.0.5",
60
60
  "@embroider/macros": "^1.19.7",
@@ -110,7 +110,7 @@
110
110
  "@glint/ember-tsc": "^1.5.0",
111
111
  "@glint/environment-ember-loose": "^1.5.0",
112
112
  "@glint/environment-ember-template-imports": "^1.5.0",
113
- "@lblod/ember-rdfa-editor": "13.12.0",
113
+ "@lblod/ember-rdfa-editor": "13.16.0",
114
114
  "@glint/template": "^1.7.7",
115
115
  "@rdfjs/to-ntriples": "^3.0.1",
116
116
  "@rdfjs/types": "^2.0.1",
@@ -1,2 +1,3 @@
1
1
  overrides:
2
2
  'prosemirror-model': '^1.25.9'
3
+ '@codemirror/state': '^6.7.0'