@lblod/ember-rdfa-editor-lblod-plugins 24.3.0 → 24.3.1-dev.2e3c09f95db40967caaceaa791e7eefd6187c5e4

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 (42) hide show
  1. package/.changeset/four-eagles-live.md +5 -0
  2. package/.changeset/gentle-berries-exist.md +5 -0
  3. package/.changeset/hungry-trees-perform.md +5 -0
  4. package/CHANGELOG.md +6 -0
  5. package/addon/components/snippet-plugin/nodes/placeholder.gts +42 -23
  6. package/addon/components/snippet-plugin/nodes/snippet.gts +104 -47
  7. package/addon/components/snippet-plugin/search-modal.ts +3 -4
  8. package/addon/components/snippet-plugin/snippet-insert-placeholder.gts +4 -4
  9. package/addon/components/snippet-plugin/snippet-insert-rdfa.gts +14 -22
  10. package/addon/components/snippet-plugin/snippet-insert.gts +16 -19
  11. package/addon/components/snippet-plugin/snippet-list/snippet-list-modal.hbs +1 -1
  12. package/addon/components/snippet-plugin/snippet-list/snippet-list-modal.ts +7 -9
  13. package/addon/components/snippet-plugin/snippet-list/snippet-list-view.hbs +1 -1
  14. package/addon/components/snippet-plugin/snippet-list/snippet-list-view.ts +5 -9
  15. package/addon/components/snippet-plugin/snippet-list-select.gts +2 -2
  16. package/addon/plugins/snippet-plugin/commands/insert-snippet.ts +5 -8
  17. package/addon/plugins/snippet-plugin/commands/update-snippet-placeholder.ts +2 -2
  18. package/addon/plugins/snippet-plugin/index.ts +9 -7
  19. package/addon/plugins/snippet-plugin/nodes/snippet-placeholder.ts +71 -23
  20. package/addon/plugins/snippet-plugin/nodes/snippet.ts +50 -20
  21. package/addon/plugins/snippet-plugin/utils/fetch-data.ts +8 -8
  22. package/addon/plugins/snippet-plugin/utils/rdfa-predicate.ts +20 -3
  23. package/addon/utils/has-descendant.ts +19 -0
  24. package/app/styles/snippet-plugin.scss +59 -23
  25. package/declarations/addon/components/snippet-plugin/nodes/placeholder.d.ts +7 -2
  26. package/declarations/addon/components/snippet-plugin/nodes/snippet.d.ts +4 -1
  27. package/declarations/addon/components/snippet-plugin/search-modal.d.ts +1 -1
  28. package/declarations/addon/components/snippet-plugin/snippet-insert-rdfa.d.ts +2 -6
  29. package/declarations/addon/components/snippet-plugin/snippet-insert.d.ts +3 -7
  30. package/declarations/addon/components/snippet-plugin/snippet-list/snippet-list-modal.d.ts +3 -3
  31. package/declarations/addon/components/snippet-plugin/snippet-list/snippet-list-view.d.ts +2 -2
  32. package/declarations/addon/components/snippet-plugin/snippet-list-select.d.ts +1 -1
  33. package/declarations/addon/plugins/snippet-plugin/commands/insert-snippet.d.ts +3 -4
  34. package/declarations/addon/plugins/snippet-plugin/index.d.ts +7 -2
  35. package/declarations/addon/plugins/snippet-plugin/nodes/snippet-placeholder.d.ts +13 -4
  36. package/declarations/addon/plugins/snippet-plugin/nodes/snippet.d.ts +4 -5
  37. package/declarations/addon/plugins/snippet-plugin/utils/fetch-data.d.ts +1 -1
  38. package/declarations/addon/plugins/snippet-plugin/utils/rdfa-predicate.d.ts +9 -2
  39. package/declarations/addon/utils/has-descendant.d.ts +2 -0
  40. package/package.json +1 -1
  41. package/translations/en-US.yaml +1 -1
  42. package/translations/nl-BE.yaml +1 -1
@@ -1,6 +1,6 @@
1
1
  import Component from '@glimmer/component';
2
2
  import { SayController } from '@lblod/ember-rdfa-editor';
3
- import { type ImportedResourceMap, type SnippetPluginConfig } from '@lblod/ember-rdfa-editor-lblod-plugins/plugins/snippet-plugin';
3
+ import { type SnippetListProperties, type SnippetPluginConfig } from '@lblod/ember-rdfa-editor-lblod-plugins/plugins/snippet-plugin';
4
4
  import { ResolvedPNode } from '@lblod/ember-rdfa-editor/utils/_private/types';
5
5
  interface Sig {
6
6
  Args: {
@@ -10,11 +10,7 @@ interface Sig {
10
10
  };
11
11
  }
12
12
  export default class SnippetInsertRdfaComponent extends Component<Sig> {
13
- get disableInsert(): boolean;
14
- get snippetListProperties(): {
15
- listIds: string[];
16
- importedResources: ImportedResourceMap;
17
- } | undefined;
13
+ get listProperties(): SnippetListProperties | undefined;
18
14
  get allowMultipleSnippets(): boolean;
19
15
  }
20
16
  export {};
@@ -1,26 +1,22 @@
1
1
  import Component from '@glimmer/component';
2
2
  import { type SayController, Slice } from '@lblod/ember-rdfa-editor';
3
3
  import { SnippetPluginConfig } from '@lblod/ember-rdfa-editor-lblod-plugins/plugins/snippet-plugin';
4
- import { type ImportedResourceMap } from '@lblod/ember-rdfa-editor-lblod-plugins/plugins/snippet-plugin';
4
+ import { type SnippetListProperties } from '@lblod/ember-rdfa-editor-lblod-plugins/plugins/snippet-plugin';
5
5
  interface Sig {
6
6
  Args: {
7
7
  controller: SayController;
8
8
  config: SnippetPluginConfig;
9
- snippetListProperties: {
10
- listIds: string[];
11
- importedResources: ImportedResourceMap;
12
- } | undefined;
13
- disabled?: boolean;
9
+ listProperties: SnippetListProperties | undefined;
14
10
  allowMultipleSnippets?: boolean;
15
11
  };
16
12
  }
17
13
  export default class SnippetInsertComponent extends Component<Sig> {
18
14
  showModal: boolean;
19
15
  get controller(): SayController;
16
+ get disabled(): boolean;
20
17
  openModal(): void;
21
18
  closeModal(): void;
22
19
  createSliceFromElement(element: Element): Slice;
23
20
  onInsert(content: string, title: string): void;
24
- get disabled(): boolean;
25
21
  }
26
22
  export {};
@@ -5,7 +5,7 @@ interface Signature {
5
5
  Args: {
6
6
  config: SnippetPluginConfig;
7
7
  onSaveSnippetLists: (lists: SnippetList[], allowMultipleSnippets: boolean) => void;
8
- assignedSnippetListsIds: string[] | undefined;
8
+ snippetListIds: string[] | undefined;
9
9
  closeModal: () => void;
10
10
  open: boolean;
11
11
  allowMultipleSnippets?: boolean;
@@ -15,7 +15,7 @@ export default class SnippetListModalComponent extends Component<Signature> {
15
15
  nameFilterText: string | null;
16
16
  sort: OrderBy;
17
17
  error: unknown;
18
- assignedSnippetListsIds: string[];
18
+ snippetListIds: string[];
19
19
  allowMultipleSnippets: boolean;
20
20
  handleMultipleSnippetsCheckbox(checked: boolean): void;
21
21
  get config(): SnippetPluginConfig;
@@ -23,6 +23,6 @@ export default class SnippetListModalComponent extends Component<Signature> {
23
23
  saveAndClose(): void;
24
24
  snippetListSearch: import("ember-concurrency").TaskForAsyncTaskFunction<unknown, () => Promise<SnippetList[]>>;
25
25
  snippetListResource: import("reactiveweb/ember-concurrency").TaskInstance<SnippetList[]>;
26
- onChange(assignedSnippetListsIds: string[]): void;
26
+ onChange(snippetListIds: string[]): void;
27
27
  }
28
28
  export {};
@@ -2,10 +2,10 @@ import Component from '@glimmer/component';
2
2
  import { SnippetList } from '@lblod/ember-rdfa-editor-lblod-plugins/plugins/snippet-plugin';
3
3
  interface Args {
4
4
  snippetLists: SnippetList[];
5
- assignedSnippetListsIds: string[];
5
+ snippetListIds: string[];
6
6
  listNameFilter: string | null;
7
7
  isLoading: boolean;
8
- onChange: (assignedSnippetListsIds: string[]) => void;
8
+ onChange: (snippetListIds: string[]) => void;
9
9
  }
10
10
  export default class SnippetListViewComponent extends Component<Args> {
11
11
  onChange(snippetId: string, isSelected: boolean): void;
@@ -17,7 +17,7 @@ export default class SnippetListSelect extends Component<Signature> {
17
17
  get currentResource(): string | undefined;
18
18
  get isResourceNode(): boolean;
19
19
  get snippetListIdsProperties(): OutgoingTriple[];
20
- get assignedSnippetListsIds(): string[];
20
+ get snippetListIds(): string[];
21
21
  get allowMultipleSnippets(): boolean;
22
22
  get imported(): ImportedResourceMap;
23
23
  onSaveSnippetLists(lists: SnippetList[], allowMultipleSnippets: boolean): void;
@@ -1,15 +1,14 @@
1
1
  import { Command } from '@lblod/ember-rdfa-editor';
2
- import { type ImportedResourceMap } from '@lblod/ember-rdfa-editor-lblod-plugins/plugins/snippet-plugin';
2
+ import { type SnippetListProperties } from '@lblod/ember-rdfa-editor-lblod-plugins/plugins/snippet-plugin';
3
3
  export interface InsertSnippetCommandArgs {
4
4
  content: string;
5
5
  title: string;
6
- assignedSnippetListsIds: string[];
7
- importedResources?: ImportedResourceMap;
6
+ listProperties: SnippetListProperties;
8
7
  range?: {
9
8
  start: number;
10
9
  end: number;
11
10
  };
12
11
  allowMultipleSnippets?: boolean;
13
12
  }
14
- declare const insertSnippet: ({ content, title, assignedSnippetListsIds, importedResources, range, allowMultipleSnippets, }: InsertSnippetCommandArgs) => Command;
13
+ declare const insertSnippet: ({ content, title, listProperties, range, allowMultipleSnippets, }: InsertSnippetCommandArgs) => Command;
15
14
  export default insertSnippet;
@@ -4,6 +4,7 @@ export declare const DEFAULT_CONTENT_STRING = "block+";
4
4
  export type SnippetPluginConfig = {
5
5
  endpoint: string;
6
6
  allowedContent?: string;
7
+ hidePlaceholderInsertButton?: boolean;
7
8
  };
8
9
  interface SnippetArgs {
9
10
  title: string | null;
@@ -17,14 +18,18 @@ export declare class Snippet {
17
18
  constructor({ title, createdOn, content }: SnippetArgs);
18
19
  }
19
20
  export type ImportedResourceMap = Record<string, Option<string>>;
21
+ export type SnippetListProperties = {
22
+ placeholderId: string;
23
+ listIds: string[];
24
+ names: string[];
25
+ importedResources: ImportedResourceMap;
26
+ };
20
27
  export type SnippetListArgs = {
21
28
  id: string;
22
29
  label: string;
23
30
  createdOn: string;
24
31
  importedResources: string[];
25
32
  };
26
- export declare const getSnippetUriFromId: (id: string) => string;
27
- export declare const getSnippetIdFromUri: (uri: string) => string;
28
33
  export declare class SnippetList {
29
34
  id: string;
30
35
  label: string;
@@ -1,8 +1,17 @@
1
1
  import { type Schema } from '@lblod/ember-rdfa-editor';
2
- import { type ImportedResourceMap, type SnippetList } from '@lblod/ember-rdfa-editor-lblod-plugins/plugins/snippet-plugin';
2
+ import { type SnippetListProperties, type ImportedResourceMap, type SnippetList, type SnippetPluginConfig } from '@lblod/ember-rdfa-editor-lblod-plugins/plugins/snippet-plugin';
3
3
  export declare function importedResourcesFromSnippetLists(lists: SnippetList[], existing?: ImportedResourceMap): {
4
4
  [k: string]: import("../../../utils/option").Option<string>;
5
5
  };
6
- export declare function createSnippetPlaceholder(lists: SnippetList[], schema: Schema, allowMultipleSnippets?: boolean): import("prosemirror-model").Node;
7
- export declare const snippetPlaceholder: import("@lblod/ember-rdfa-editor/core/say-node-spec").default;
8
- export declare const snippetPlaceholderView: (controller: import("@lblod/ember-rdfa-editor").SayController) => import("@lblod/ember-rdfa-editor/utils/ember-node").SayNodeViewConstructor;
6
+ type CreateSnippetPlaceholderArgs = {
7
+ schema: Schema;
8
+ allowMultipleSnippets?: boolean;
9
+ } & ({
10
+ listProperties: SnippetListProperties;
11
+ } | {
12
+ lists: SnippetList[];
13
+ });
14
+ export declare function createSnippetPlaceholder({ schema, allowMultipleSnippets, ...args }: CreateSnippetPlaceholderArgs): import("prosemirror-model").Node;
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;
17
+ export {};
@@ -1,13 +1,12 @@
1
1
  import { type PNode, type Schema } from '@lblod/ember-rdfa-editor';
2
2
  import { type OutgoingTriple } from '@lblod/ember-rdfa-editor/core/rdfa-processor';
3
- import { type ImportedResourceMap, type SnippetPluginConfig } from '@lblod/ember-rdfa-editor-lblod-plugins/plugins/snippet-plugin';
3
+ import { SnippetListProperties, type SnippetPluginConfig } from '@lblod/ember-rdfa-editor-lblod-plugins/plugins/snippet-plugin';
4
4
  interface CreateSnippetArgs {
5
5
  schema: Schema;
6
+ allowMultipleSnippets?: boolean;
6
7
  content: string;
7
8
  title: string;
8
- snippetListIds: string[];
9
- importedResources?: ImportedResourceMap;
10
- allowMultipleSnippets?: boolean;
9
+ listProperties: SnippetListProperties;
11
10
  }
12
11
  /**
13
12
  * Creates a Snippet node wrapping the given content while allowing for further snippets to be added
@@ -15,7 +14,7 @@ interface CreateSnippetArgs {
15
14
  * @returns a tuple containing the Node and the map of imported resources to the new outgoing
16
15
  * properties that these resources will have after the snippet is inserted into the document.
17
16
  **/
18
- export declare function createSnippet({ schema, content, title, snippetListIds, importedResources, allowMultipleSnippets, }: CreateSnippetArgs): [PNode, Map<string, OutgoingTriple[]>];
17
+ export declare function createSnippet({ schema, content, title, allowMultipleSnippets, listProperties: { listIds, names: snippetListNames, importedResources, placeholderId, }, }: CreateSnippetArgs): [PNode, Map<string, OutgoingTriple[]>];
19
18
  export declare const snippet: (config: SnippetPluginConfig) => import("@lblod/ember-rdfa-editor/core/say-node-spec").default;
20
19
  export declare const snippetView: (config: SnippetPluginConfig) => (controller: import("@lblod/ember-rdfa-editor").SayController) => import("@lblod/ember-rdfa-editor/utils/ember-node").SayNodeViewConstructor;
21
20
  export {};
@@ -1,7 +1,7 @@
1
1
  import { Snippet, SnippetList } from '../index';
2
2
  type Filter = {
3
3
  name?: string;
4
- assignedSnippetListIds?: string[];
4
+ snippetListIds?: string[];
5
5
  };
6
6
  export type OrderBy = 'label' | 'created-on' | '-label' | '-created-on' | '' | null;
7
7
  type Pagination = {
@@ -1,5 +1,12 @@
1
- import { PNode } from '@lblod/ember-rdfa-editor';
2
- import { OutgoingTriple } from '@lblod/ember-rdfa-editor/core/rdfa-processor';
1
+ import { type PNode } from '@lblod/ember-rdfa-editor';
2
+ import { type OutgoingTriple } from '@lblod/ember-rdfa-editor/core/rdfa-processor';
3
3
  export declare const SNIPPET_LIST_RDFA_PREDICATE: import("@lblod/ember-rdfa-editor-lblod-plugins/utils/namespace").Resource;
4
+ export declare const getSnippetUriFromId: (id: string) => string;
5
+ export declare const getSnippetIdFromUri: (uri: string) => string;
6
+ export declare function tripleForSnippetListId(id: string): {
7
+ predicate: string;
8
+ object: import("@lblod/ember-rdfa-editor/core/say-data-factory").SayNamedNode<string>;
9
+ };
4
10
  export declare const getSnippetListIdsProperties: (node: PNode) => OutgoingTriple[];
5
11
  export declare const getAssignedSnippetListsIdsFromProperties: (snippetListIdsProperty?: OutgoingTriple[] | undefined) => string[];
12
+ export declare const getSnippetListIdsFromNode: (node: PNode) => string[];
@@ -0,0 +1,2 @@
1
+ import { type PNode } from '@lblod/ember-rdfa-editor';
2
+ export declare function hasDecendant(nodeToDescendInto: PNode, matchFunc: (node: PNode) => boolean): boolean;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lblod/ember-rdfa-editor-lblod-plugins",
3
- "version": "24.3.0",
3
+ "version": "24.3.1-dev.2e3c09f95db40967caaceaa791e7eefd6187c5e4",
4
4
  "description": "Ember addon providing lblod specific plugins for the ember-rdfa-editor",
5
5
  "keywords": [
6
6
  "ember-addon",
@@ -301,7 +301,7 @@ snippet-plugin:
301
301
  placeholder:
302
302
  title-single: Snippet from the list "{listName}"
303
303
  title-multiple: Snippet from multiple lists
304
- text: Select this then insert the desired snippet
304
+ button: Select the desired snippet
305
305
  active-lists: 'Active lists:'
306
306
  modal:
307
307
  title: Choose a snippet
@@ -300,7 +300,7 @@ snippet-plugin:
300
300
  placeholder:
301
301
  title-single: Fragment uit de lijst "{listName}"
302
302
  title-multiple: Fragment uit meerdere lijsten
303
- text: Selecteer dit en voeg het gewenste fragment in
303
+ button: Selecteer het gewenste fragment
304
304
  active-lists: 'Actieve lijsten:'
305
305
  modal:
306
306
  title: Kies een fragment