@sinequa/atomic-angular 1.15.1 → 1.17.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.
@@ -143,8 +143,8 @@ function provideLexiqWorkspacesElements() {
143
143
  * Public API of `@sinequa/atomic-angular/workspace-elements` — the workspaces view as custom
144
144
  * elements, for pages that are not Angular. They are thin wrappers (`@angular/elements`)
145
145
  * around the components of `@sinequa/atomic-angular/document-workspaces`: an Angular
146
- * application should use those components directly. `@sinequa/atomic-angular/elements` is the native
147
- * (Shadow DOM) implementation they are meant to replace; both can be registered side by side.
146
+ * application should use those components directly. They replace the native (Shadow DOM)
147
+ * implementation kept in the repository as a reference (`projects/atomic-angular/elements`, not published).
148
148
  *
149
149
  * Importing this entry registers nothing. Register explicitly:
150
150
  * - Angular: providers: [provideLexiqWorkspacesElements()]
@@ -1 +1 @@
1
- {"version":3,"file":"sinequa-atomic-angular-workspace-elements.mjs","sources":["../../../projects/atomic-angular/workspace-elements/register.ts","../../../projects/atomic-angular/workspace-elements/providers.ts","../../../projects/atomic-angular/workspace-elements/public-api.ts","../../../projects/atomic-angular/workspace-elements/sinequa-atomic-angular-workspace-elements.ts"],"sourcesContent":["import { ApplicationConfig, ApplicationRef, Injector, provideZonelessChangeDetection, Type } from \"@angular/core\";\nimport { createCustomElement } from \"@angular/elements\";\nimport { createApplication } from \"@angular/platform-browser\";\nimport { WorkspaceMentionList, WorkspacePickerLauncher, WorkspacesShell } from \"@sinequa/atomic-angular/document-workspaces\";\n\n// Registration is an explicit act, never a side effect of importing this entry:\n// - defineX(injector) → one element (tree-shakable)\n// - registerLexiqWorkspacesElements(injector) → the three\n// - provideLexiqWorkspacesElements() → Angular providers (see providers.ts)\n// - bootstrapLexiqWorkspacesElements() → a page with no Angular of its own\n//\n// Each define is idempotent (customElements.get guard) and SSR-safe (a no-op where\n// `customElements` does not exist).\n\n/** What `createCustomElement` gives: an element that is its component's inputs and outputs, and nothing else. */\ntype NgElementClass = new () => HTMLElement;\n\n/** What an element does beyond that: methods, and the names its events go by. */\ntype Extension = (base: NgElementClass) => CustomElementConstructor;\n\n/**\n * The component of an element, for what `@angular/elements` does not expose: its methods.\n * `NgElement` keeps the component behind its strategy; this is the one place that reaches for it.\n */\nexport function instanceOf<T>(element: HTMLElement): T {\n const strategy = (element as unknown as { ngElementStrategy: { componentRef?: { instance: T } } }).ngElementStrategy;\n if (!strategy.componentRef) throw new Error(\"The element is not connected yet: its component does not exist.\");\n return strategy.componentRef.instance;\n}\n\n/**\n * Re-dispatches an output of the component under the name the page knows it by — the\n * events of this package have always been `lexiq-workspaces:…` or plain names — and so\n * that it crosses a shadow boundary: `@angular/elements` dispatches with neither `bubbles`\n * nor `composed`.\n */\nexport function bridgeEvents(element: HTMLElement, events: Record<string, { name: string; detail?: (payload: unknown) => unknown }>): void {\n // What this sends itself must not be sent again: an output that keeps its name would feed on its own events.\n const sent = new WeakSet<Event>();\n for (const [output, { name, detail }] of Object.entries(events)) {\n element.addEventListener(output, event => {\n if (sent.has(event)) return;\n // Same name: the page hears the bubbling copy, not the original as well.\n if (name === output) event.stopImmediatePropagation();\n const bridged = new CustomEvent(name, {\n detail: detail ? detail((event as CustomEvent).detail) : (event as CustomEvent).detail,\n bubbles: true,\n composed: true\n });\n sent.add(bridged);\n element.dispatchEvent(bridged);\n });\n }\n}\n\nfunction define(tagName: string, component: Type<unknown>, injector: Injector, extend: Extension): void {\n if (typeof customElements === \"undefined\" || customElements.get(tagName)) return;\n customElements.define(tagName, extend(createCustomElement(component, { injector }) as unknown as NgElementClass));\n}\n\nconst EVENT = (name: string) => ({ name });\n\nexport function defineLexiqWorkspaces(injector: Injector, tagName = \"lexiq-workspaces\"): void {\n define(\n tagName,\n WorkspacesShell,\n injector,\n Base =>\n class extends Base {\n constructor() {\n super();\n bridgeEvents(this, {\n workspaceCreated: { name: \"lexiq-workspaces:workspace-created\", detail: workspace => ({ workspace }) },\n workspaceUpdated: { name: \"lexiq-workspaces:workspace-updated\", detail: workspace => ({ workspace }) },\n askFollowUp: { name: \"lexiq-workspaces:ask-followup\" }\n });\n }\n\n /** Shows the list of workspaces. */\n showList(): void {\n (this as unknown as { workspaceId: string | null }).workspaceId = null;\n }\n\n /** Shows a workspace and its documents. */\n showDetail(id: string): void {\n (this as unknown as { workspaceId: string | null }).workspaceId = id;\n }\n\n /** Opens the \"Add workspace\" dialog, then the workspace it makes. */\n addWorkspace(): void {\n void instanceOf<WorkspacesShell>(this).addWorkspace();\n }\n }\n );\n}\n\nexport function defineLexiqWorkspacePicker(injector: Injector, tagName = \"lexiq-workspace-picker\"): void {\n define(\n tagName,\n WorkspacePickerLauncher,\n injector,\n Base =>\n class extends Base {\n constructor() {\n super();\n bridgeEvents(this, { saved: { name: \"save\", detail: name => ({ name }) }, moved: EVENT(\"moved\") });\n }\n\n openSaveCard(anchor: HTMLElement, options: Parameters<WorkspacePickerLauncher[\"openSaveCard\"]>[1] = {}): void {\n void instanceOf<WorkspacePickerLauncher>(this).openSaveCard(anchor, options);\n }\n\n openMoveMenu(anchor: HTMLElement, documentIds: readonly string[], options: { fromWorkspaceId: string }): void {\n void instanceOf<WorkspacePickerLauncher>(this).openMoveMenu(anchor, documentIds, options);\n }\n }\n );\n}\n\nexport function defineLexiqWorkspaceMentionList(injector: Injector, tagName = \"lexiq-workspace-mention-list\"): void {\n define(\n tagName,\n WorkspaceMentionList,\n injector,\n Base =>\n class extends Base {\n constructor() {\n super();\n bridgeEvents(this, { selectionChanged: EVENT(\"selection-changed\") });\n }\n\n /** The rows, for a host that draws its own menu. */\n get items() {\n return instanceOf<WorkspaceMentionList>(this).items();\n }\n\n /** Ticks a workspace from outside. */\n selectById(id: string): void {\n instanceOf<WorkspaceMentionList>(this).select(id);\n }\n }\n );\n}\n\nexport function registerLexiqWorkspacesElements(injector: Injector): void {\n defineLexiqWorkspaces(injector);\n defineLexiqWorkspacePicker(injector);\n defineLexiqWorkspaceMentionList(injector);\n}\n\n/**\n * For a page that is not an Angular application: starts one — zoneless, with the\n * providers the page gives it (Transloco and the `@sinequa/atomic` configuration are the page's\n * to provide) — and registers the three elements on it.\n *\n * ```ts\n * await bootstrapLexiqWorkspacesElements({ providers: [provideTransloco({ … })] });\n * ```\n */\nexport async function bootstrapLexiqWorkspacesElements(config: Partial<ApplicationConfig> = {}): Promise<ApplicationRef> {\n const app = await createApplication({ providers: [provideZonelessChangeDetection(), ...(config.providers ?? [])] });\n registerLexiqWorkspacesElements(app.injector);\n return app;\n}\n","import { EnvironmentProviders, inject, Injector, makeEnvironmentProviders, provideEnvironmentInitializer } from \"@angular/core\";\nimport { registerLexiqWorkspacesElements } from \"./register\";\n\n/**\n * Registers the `lexiq-workspaces`, `lexiq-workspace-picker` and\n * `lexiq-workspace-mention-list` custom elements when the application starts. Add it to\n * the `providers` of the app (or of a route):\n *\n * ```ts\n * export const appConfig: ApplicationConfig = {\n * providers: [provideTransloco({ … }), provideLexiqWorkspacesElements()]\n * };\n * ```\n *\n * The elements render through this application's injector, so they share its Transloco\n * configuration, its `@sinequa/atomic` setup and its `WorkspacesStore` with the rest of the app.\n * A component that uses the tags in a template needs `schemas: [CUSTOM_ELEMENTS_SCHEMA]` — or,\n * in Angular, the components themselves (`WorkspacesShell`…).\n */\nexport function provideLexiqWorkspacesElements(): EnvironmentProviders {\n return makeEnvironmentProviders([provideEnvironmentInitializer(() => registerLexiqWorkspacesElements(inject(Injector)))]);\n}\n","/**\n * Public API of `@sinequa/atomic-angular/workspace-elements` — the workspaces view as custom\n * elements, for pages that are not Angular. They are thin wrappers (`@angular/elements`)\n * around the components of `@sinequa/atomic-angular/document-workspaces`: an Angular\n * application should use those components directly. `@sinequa/atomic-angular/elements` is the native\n * (Shadow DOM) implementation they are meant to replace; both can be registered side by side.\n *\n * Importing this entry registers nothing. Register explicitly:\n * - Angular: providers: [provideLexiqWorkspacesElements()]\n * - Plain JS: await bootstrapLexiqWorkspacesElements({ providers: [ … ] });\n * - One only: defineLexiqWorkspacePicker(injector);\n *\n * Tags: `<lexiq-workspaces>` (attributes `upload-endpoint`, `query-name`, `theme`,\n * `workspace-id`; methods `showList()`, `showDetail(id)`, `addWorkspace()`; events\n * `lexiq-workspaces:workspace-created`, `:workspace-updated`, `:ask-followup`),\n * `<lexiq-workspace-picker>` (methods `openSaveCard(anchor, { documents })`,\n * `openMoveMenu(anchor, documentIds, { fromWorkspaceId })`; events `save`, `moved`) and\n * `<lexiq-workspace-mention-list>` (method `selectById(id)`, property `items`, event\n * `selection-changed`).\n *\n * The elements render in the page's DOM, not in a shadow root: the page provides their\n * styles (the Tailwind build of the page scans the library, and the galactik tokens are\n * defined by its theme), exactly as for the Angular components.\n */\n\nexport {\n bootstrapLexiqWorkspacesElements,\n defineLexiqWorkspaceMentionList,\n defineLexiqWorkspacePicker,\n defineLexiqWorkspaces,\n registerLexiqWorkspacesElements\n} from \"./register\";\nexport { provideLexiqWorkspacesElements } from \"./providers\";\n\nexport type { AskFollowUp, MentionSelection, Workspace, WorkspaceDocument } from \"@sinequa/atomic-angular/document-workspaces\";\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './public-api';\n"],"names":[],"mappings":";;;;;AAoBA;;;AAGG;AACG,SAAU,UAAU,CAAI,OAAoB,EAAA;AAChD,IAAA,MAAM,QAAQ,GAAI,OAAgF,CAAC,iBAAiB;IACpH,IAAI,CAAC,QAAQ,CAAC,YAAY;AAAE,QAAA,MAAM,IAAI,KAAK,CAAC,iEAAiE,CAAC;AAC9G,IAAA,OAAO,QAAQ,CAAC,YAAY,CAAC,QAAQ;AACvC;AAEA;;;;;AAKG;AACG,SAAU,YAAY,CAAC,OAAoB,EAAE,MAAgF,EAAA;;AAEjI,IAAA,MAAM,IAAI,GAAG,IAAI,OAAO,EAAS;AACjC,IAAA,KAAK,MAAM,CAAC,MAAM,EAAE,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC,IAAI,MAAM,CAAC,OAAO,CAAC,MAAM,CAAC,EAAE;AAC/D,QAAA,OAAO,CAAC,gBA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-elements/register.ts","../../../projects/atomic-angular/workspace-elements/providers.ts","../../../projects/atomic-angular/workspace-elements/public-api.ts","../../../projects/atomic-angular/workspace-elements/sinequa-atomic-angular-workspace-elements.ts"],"sourcesContent":["import { ApplicationConfig, ApplicationRef, Injector, provideZonelessChangeDetection, Type } from \"@angular/core\";\nimport { createCustomElement } from \"@angular/elements\";\nimport { createApplication } from \"@angular/platform-browser\";\nimport { WorkspaceMentionList, WorkspacePickerLauncher, WorkspacesShell } from \"@sinequa/atomic-angular/document-workspaces\";\n\n// Registration is an explicit act, never a side effect of importing this entry:\n// - defineX(injector) → one element (tree-shakable)\n// - registerLexiqWorkspacesElements(injector) → the three\n// - provideLexiqWorkspacesElements() → Angular providers (see providers.ts)\n// - bootstrapLexiqWorkspacesElements() → a page with no Angular of its own\n//\n// Each define is idempotent (customElements.get guard) and SSR-safe (a no-op where\n// `customElements` does not exist).\n\n/** What `createCustomElement` gives: an element that is its component's inputs and outputs, and nothing else. */\ntype NgElementClass = new () => HTMLElement;\n\n/** What an element does beyond that: methods, and the names its events go by. */\ntype Extension = (base: NgElementClass) => CustomElementConstructor;\n\n/**\n * The component of an element, for what `@angular/elements` does not expose: its methods.\n * `NgElement` keeps the component behind its strategy; this is the one place that reaches for it.\n */\nexport function instanceOf<T>(element: HTMLElement): T {\n const strategy = (element as unknown as { ngElementStrategy: { componentRef?: { instance: T } } }).ngElementStrategy;\n if (!strategy.componentRef) throw new Error(\"The element is not connected yet: its component does not exist.\");\n return strategy.componentRef.instance;\n}\n\n/**\n * Re-dispatches an output of the component under the name the page knows it by — the\n * events of this package have always been `lexiq-workspaces:…` or plain names — and so\n * that it crosses a shadow boundary: `@angular/elements` dispatches with neither `bubbles`\n * nor `composed`.\n */\nexport function bridgeEvents(element: HTMLElement, events: Record<string, { name: string; detail?: (payload: unknown) => unknown }>): void {\n // What this sends itself must not be sent again: an output that keeps its name would feed on its own events.\n const sent = new WeakSet<Event>();\n for (const [output, { name, detail }] of Object.entries(events)) {\n element.addEventListener(output, event => {\n if (sent.has(event)) return;\n // Same name: the page hears the bubbling copy, not the original as well.\n if (name === output) event.stopImmediatePropagation();\n const bridged = new CustomEvent(name, {\n detail: detail ? detail((event as CustomEvent).detail) : (event as CustomEvent).detail,\n bubbles: true,\n composed: true\n });\n sent.add(bridged);\n element.dispatchEvent(bridged);\n });\n }\n}\n\nfunction define(tagName: string, component: Type<unknown>, injector: Injector, extend: Extension): void {\n if (typeof customElements === \"undefined\" || customElements.get(tagName)) return;\n customElements.define(tagName, extend(createCustomElement(component, { injector }) as unknown as NgElementClass));\n}\n\nconst EVENT = (name: string) => ({ name });\n\nexport function defineLexiqWorkspaces(injector: Injector, tagName = \"lexiq-workspaces\"): void {\n define(\n tagName,\n WorkspacesShell,\n injector,\n Base =>\n class extends Base {\n constructor() {\n super();\n bridgeEvents(this, {\n workspaceCreated: { name: \"lexiq-workspaces:workspace-created\", detail: workspace => ({ workspace }) },\n workspaceUpdated: { name: \"lexiq-workspaces:workspace-updated\", detail: workspace => ({ workspace }) },\n askFollowUp: { name: \"lexiq-workspaces:ask-followup\" }\n });\n }\n\n /** Shows the list of workspaces. */\n showList(): void {\n (this as unknown as { workspaceId: string | null }).workspaceId = null;\n }\n\n /** Shows a workspace and its documents. */\n showDetail(id: string): void {\n (this as unknown as { workspaceId: string | null }).workspaceId = id;\n }\n\n /** Opens the \"Add workspace\" dialog, then the workspace it makes. */\n addWorkspace(): void {\n void instanceOf<WorkspacesShell>(this).addWorkspace();\n }\n }\n );\n}\n\nexport function defineLexiqWorkspacePicker(injector: Injector, tagName = \"lexiq-workspace-picker\"): void {\n define(\n tagName,\n WorkspacePickerLauncher,\n injector,\n Base =>\n class extends Base {\n constructor() {\n super();\n bridgeEvents(this, { saved: { name: \"save\", detail: name => ({ name }) }, moved: EVENT(\"moved\") });\n }\n\n openSaveCard(anchor: HTMLElement, options: Parameters<WorkspacePickerLauncher[\"openSaveCard\"]>[1] = {}): void {\n void instanceOf<WorkspacePickerLauncher>(this).openSaveCard(anchor, options);\n }\n\n openMoveMenu(anchor: HTMLElement, documentIds: readonly string[], options: { fromWorkspaceId: string }): void {\n void instanceOf<WorkspacePickerLauncher>(this).openMoveMenu(anchor, documentIds, options);\n }\n }\n );\n}\n\nexport function defineLexiqWorkspaceMentionList(injector: Injector, tagName = \"lexiq-workspace-mention-list\"): void {\n define(\n tagName,\n WorkspaceMentionList,\n injector,\n Base =>\n class extends Base {\n constructor() {\n super();\n bridgeEvents(this, { selectionChanged: EVENT(\"selection-changed\") });\n }\n\n /** The rows, for a host that draws its own menu. */\n get items() {\n return instanceOf<WorkspaceMentionList>(this).items();\n }\n\n /** Ticks a workspace from outside. */\n selectById(id: string): void {\n instanceOf<WorkspaceMentionList>(this).select(id);\n }\n }\n );\n}\n\nexport function registerLexiqWorkspacesElements(injector: Injector): void {\n defineLexiqWorkspaces(injector);\n defineLexiqWorkspacePicker(injector);\n defineLexiqWorkspaceMentionList(injector);\n}\n\n/**\n * For a page that is not an Angular application: starts one — zoneless, with the\n * providers the page gives it (Transloco and the `@sinequa/atomic` configuration are the page's\n * to provide) — and registers the three elements on it.\n *\n * ```ts\n * await bootstrapLexiqWorkspacesElements({ providers: [provideTransloco({ … })] });\n * ```\n */\nexport async function bootstrapLexiqWorkspacesElements(config: Partial<ApplicationConfig> = {}): Promise<ApplicationRef> {\n const app = await createApplication({ providers: [provideZonelessChangeDetection(), ...(config.providers ?? [])] });\n registerLexiqWorkspacesElements(app.injector);\n return app;\n}\n","import { EnvironmentProviders, inject, Injector, makeEnvironmentProviders, provideEnvironmentInitializer } from \"@angular/core\";\nimport { registerLexiqWorkspacesElements } from \"./register\";\n\n/**\n * Registers the `lexiq-workspaces`, `lexiq-workspace-picker` and\n * `lexiq-workspace-mention-list` custom elements when the application starts. Add it to\n * the `providers` of the app (or of a route):\n *\n * ```ts\n * export const appConfig: ApplicationConfig = {\n * providers: [provideTransloco({ … }), provideLexiqWorkspacesElements()]\n * };\n * ```\n *\n * The elements render through this application's injector, so they share its Transloco\n * configuration, its `@sinequa/atomic` setup and its `WorkspacesStore` with the rest of the app.\n * A component that uses the tags in a template needs `schemas: [CUSTOM_ELEMENTS_SCHEMA]` — or,\n * in Angular, the components themselves (`WorkspacesShell`…).\n */\nexport function provideLexiqWorkspacesElements(): EnvironmentProviders {\n return makeEnvironmentProviders([provideEnvironmentInitializer(() => registerLexiqWorkspacesElements(inject(Injector)))]);\n}\n","/**\n * Public API of `@sinequa/atomic-angular/workspace-elements` — the workspaces view as custom\n * elements, for pages that are not Angular. They are thin wrappers (`@angular/elements`)\n * around the components of `@sinequa/atomic-angular/document-workspaces`: an Angular\n * application should use those components directly. They replace the native (Shadow DOM)\n * implementation kept in the repository as a reference (`projects/atomic-angular/elements`, not published).\n *\n * Importing this entry registers nothing. Register explicitly:\n * - Angular: providers: [provideLexiqWorkspacesElements()]\n * - Plain JS: await bootstrapLexiqWorkspacesElements({ providers: [ … ] });\n * - One only: defineLexiqWorkspacePicker(injector);\n *\n * Tags: `<lexiq-workspaces>` (attributes `upload-endpoint`, `query-name`, `theme`,\n * `workspace-id`; methods `showList()`, `showDetail(id)`, `addWorkspace()`; events\n * `lexiq-workspaces:workspace-created`, `:workspace-updated`, `:ask-followup`),\n * `<lexiq-workspace-picker>` (methods `openSaveCard(anchor, { documents })`,\n * `openMoveMenu(anchor, documentIds, { fromWorkspaceId })`; events `save`, `moved`) and\n * `<lexiq-workspace-mention-list>` (method `selectById(id)`, property `items`, event\n * `selection-changed`).\n *\n * The elements render in the page's DOM, not in a shadow root: the page provides their\n * styles (the Tailwind build of the page scans the library, and the galactik tokens are\n * defined by its theme), exactly as for the Angular components.\n */\n\nexport {\n bootstrapLexiqWorkspacesElements,\n defineLexiqWorkspaceMentionList,\n defineLexiqWorkspacePicker,\n defineLexiqWorkspaces,\n registerLexiqWorkspacesElements\n} from \"./register\";\nexport { provideLexiqWorkspacesElements } from \"./providers\";\n\nexport type { AskFollowUp, MentionSelection, Workspace, WorkspaceDocument } from \"@sinequ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AEA;;;;;;;;AAQG;AACI,eAAe,gCAAgC,CAAC,SAAqC,EAAE,EAAA;IAC5F,MAAM,GAAG,GAAG,MAAM,iBAAiB,CAAC,EAAE,SAAS,EAAE,CAAC,8BAA8B,EAAE,EAAE,IAAI,MAAM,CAAC,SAAS,IAAI,EAAE,CAAC,CAAC,EAAE,CAAC;AACnH,IAAA,+BAA+B,CAAC,GAAG,CAAC,QAAQ,CAAC;AAC7C,IAAA,OAAO,GAAG;AACZ;;AChKA;;;;;;;;;;;;;;;AAeG;SACa,8BAA8B,GAAA;AAC5C,IAAA,OAAO,wBAAwB,CAAC,CAAC,6BAA6B,CAAC,MAAM,+BAA+B,CAAC,MAAM,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,CAAC;AAC3H;;ACrBA;;;;;;;;;;;;;;;;;;;;;;;AAuBG;;ACvBH;;AAEG;;;;"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sinequa/atomic-angular",
3
- "version": "1.15.1",
3
+ "version": "1.17.0",
4
4
  "publishConfig": {
5
5
  "access": "public"
6
6
  },
@@ -17,10 +17,6 @@
17
17
  "types": "./document-workspaces/index.d.ts",
18
18
  "default": "./fesm2022/sinequa-atomic-angular-document-workspaces.mjs"
19
19
  },
20
- "./elements": {
21
- "types": "./elements/index.d.ts",
22
- "default": "./fesm2022/sinequa-atomic-angular-elements.mjs"
23
- },
24
20
  "./workspace-elements": {
25
21
  "types": "./workspace-elements/index.d.ts",
26
22
  "default": "./fesm2022/sinequa-atomic-angular-workspace-elements.mjs"
@@ -1,346 +0,0 @@
1
- import { UpdateContainerInput, UploadJobStatus } from '@sinequa/atomic';
2
- import { EnvironmentProviders } from '@angular/core';
3
-
4
- type TooltipPlacement = "top" | "right" | "left" | "bottom";
5
- interface TooltipController {
6
- /**
7
- * Shows a tooltip on hover. `key` is a catalog key, not literal text, and is
8
- * resolved on every hover — so a tooltip attached once still follows a later
9
- * language change without re-attaching anything.
10
- */
11
- attach(el: HTMLElement, key: string, placement?: TooltipPlacement, condition?: () => boolean): void;
12
- position(trigger: HTMLElement, placement?: TooltipPlacement): void;
13
- el: HTMLSpanElement;
14
- }
15
- interface MobileSheetController {
16
- open(panelEl: HTMLElement, titleText: string, originEl?: HTMLElement | null): void;
17
- close(): void;
18
- }
19
-
20
- type ContainerRole = "creator" | "owner" | "reader";
21
- interface Collection {
22
- id: string;
23
- name: string;
24
- icon: string;
25
- desc: string;
26
- tags: string[];
27
- docs: number;
28
- creatorId: string;
29
- ownerIds: string[];
30
- readerIds: string[];
31
- currentUserRole: ContainerRole;
32
- }
33
- interface CollectionDocument {
34
- _id: string;
35
- name: string;
36
- containerId?: string;
37
- type: string;
38
- date: string;
39
- size?: string;
40
- source?: string;
41
- status?: "uploading" | "indexing" | "error" | null;
42
- uploadedBy?: string;
43
- percent?: number;
44
- jobId?: string;
45
- }
46
- declare class CollectionsStore extends EventTarget {
47
- collections: Collection[];
48
- documents: Record<string, CollectionDocument[]>;
49
- selectedIds: Set<string>;
50
- private _loaded;
51
- private _loadingPromise;
52
- private _page;
53
- private _total;
54
- private _documentsState;
55
- private _emit;
56
- getAll(): Collection[];
57
- get(id: string): Collection | null;
58
- fetchContainer(id: string): Promise<Collection>;
59
- get hasMoreCollections(): boolean;
60
- ensureLoaded(): Promise<Collection[]>;
61
- reload(): Promise<Collection[]>;
62
- load(): Promise<Collection[]>;
63
- loadMore(): Promise<Collection[]>;
64
- create({ name, desc, tags, owners, readers }: {
65
- name: string;
66
- desc?: string;
67
- tags?: string[];
68
- owners?: string[];
69
- readers?: string[];
70
- }): Promise<Collection>;
71
- update(id: string, patch: UpdateContainerInput): Promise<Collection | null>;
72
- remove(ids: string[]): Promise<{
73
- succeeded: string[];
74
- failed: {
75
- id: string;
76
- error: string;
77
- }[];
78
- }>;
79
- getDocuments(collectionId: string): CollectionDocument[];
80
- hasMoreDocuments(collectionId: string): boolean;
81
- loadDocuments(collectionId: string): Promise<CollectionDocument[]>;
82
- loadMoreDocuments(collectionId: string): Promise<CollectionDocument[]>;
83
- addDocuments(collectionId: string, docs: CollectionDocument[]): void;
84
- saveDocuments(collectionId: string, docs: CollectionDocument[]): Promise<CollectionDocument[]>;
85
- removeDocuments(collectionId: string, docIds: string[]): Promise<void>;
86
- moveDocuments(fromCollectionId: string, toCollectionId: string, docIds: string[]): Promise<void>;
87
- toggleSelected(id: string, checked: boolean): void;
88
- get selectedCount(): number;
89
- }
90
- declare const store: CollectionsStore;
91
-
92
- interface TrackerFileInput {
93
- id: string;
94
- name: string;
95
- type: string;
96
- }
97
- /**
98
- * What the tracker's connection banner is currently saying. Emitted whenever the
99
- * situation changes, and `null` once everything is healthy again.
100
- */
101
- interface ConnectionNotice {
102
- /**
103
- * - `retrying` - a transfer is waiting out `retryAtMs` before its next attempt;
104
- * - `reconnecting` - a session recovery is in flight;
105
- * - `signed-out` - recovery came back negative; nothing moves until the user
106
- * signs in again.
107
- */
108
- phase: "retrying" | "reconnecting" | "signed-out";
109
- /** Transfers held up by this. 0 when only the status poll is affected. */
110
- uploads: number;
111
- /** 1-based number of the attempt about to be made, and the budget it comes from. */
112
- attempt: number;
113
- maxAttempts: number;
114
- /** Epoch ms of the next attempt - the countdown's target (`retrying` only). */
115
- retryAtMs?: number;
116
- /** Epoch ms at which the retry budget runs out (`retrying` only). */
117
- budgetEndsAtMs?: number;
118
- /** Epoch ms the connection was first reported lost - drives "lost N ago". */
119
- sinceMs: number;
120
- /**
121
- * Re-runs the recovery, for the banner's Retry button. Carried on the payload
122
- * rather than published as another controller method because it is the one
123
- * thing the banner can DO, and it is meaningless without the notice it belongs
124
- * to. Absent when there is nothing useful to retry.
125
- */
126
- retry?(): void;
127
- }
128
- interface UploadTrackerController {
129
- addFiles(trackerDocs: TrackerFileInput[], colId: string, colName: string): void;
130
- onProgress(docId: string, pct: number): void;
131
- onIndexing(docId: string): void;
132
- onComplete(docId: string): void;
133
- onError(docId: string): void;
134
- /**
135
- * Feeds in the job-level half of the status API: per-file error messages and
136
- * rejections, which only `GET .../document-upload/status` reports.
137
- *
138
- * Optional on purpose - this interface is published from index.ts and driven
139
- * by hand by the demo app's /document-upload tester, so a required method
140
- * would be a breaking change for it. Returns whether anything actually
141
- * changed, which paces the poller; `void` is accepted so an implementation
142
- * that does not care still satisfies the type.
143
- */
144
- onJobUpdate?(jobs: UploadJobStatus[]): boolean | void;
145
- /**
146
- * Drives the connection banner. `null` clears it.
147
- *
148
- * Optional for the same reason as `onJobUpdate` - this interface is published
149
- * from index.ts and driven by hand by the demo app's /document-upload tester.
150
- */
151
- onConnectionChange?(notice: ConnectionNotice | null): void;
152
- }
153
-
154
- interface CollectionsHost extends HTMLElement {
155
- readonly shadowRoot: ShadowRoot;
156
- _pickerContainer: HTMLDivElement;
157
- _tooltip: TooltipController;
158
- _colCurrentView: "grid" | "list";
159
- _colGridBuilt: boolean;
160
- _colListBuilt: boolean;
161
- _showList(): Promise<void>;
162
- _hideList(): void;
163
- _refreshList?(): Promise<void>;
164
- _buildCollectionCard(col: Collection): HTMLElement;
165
- _updateColTabCounts(): void;
166
- _applyColFilters?(): void;
167
- _exitColSelection(): void;
168
- _updateColSelCount(): void;
169
- _closeColDeleteModal(): void;
170
- _currentCol: Collection | null;
171
- _currentDocs: CollectionDocument[];
172
- _cdvCurrentView: "grid" | "list";
173
- _cdvListBuilt: boolean;
174
- _openColDetail(col: Collection): void;
175
- _closeColDetail(): void;
176
- _refreshCdvEmpty(): void;
177
- _buildDocCard(doc: CollectionDocument): HTMLElement;
178
- _buildDocListView(docs: CollectionDocument[]): void;
179
- _resetDetailSearch?(): void;
180
- _exitDocSelection(): void;
181
- openAddCollectionModal?(): void;
182
- _openRefDocPreview(docRef: RefDocument): void;
183
- _closeColDocPreview(): void;
184
- _syncColDocPreviewView(): void;
185
- _uploadTracker: UploadTrackerController;
186
- _startUploadPolling?(): void;
187
- _stopUploadPolling?(): void;
188
- }
189
-
190
- interface Passage {
191
- page: number;
192
- text: string;
193
- }
194
- interface RefDocument {
195
- title: string;
196
- date: string;
197
- path: string;
198
- passages?: Passage[];
199
- }
200
-
201
- declare class LexiqCollectionsElement extends HTMLElement implements CollectionsHost {
202
- readonly shadowRoot: ShadowRoot;
203
- _initialized: boolean;
204
- _pickerContainer: HTMLDivElement;
205
- _tooltip: TooltipController;
206
- _colCurrentView: "grid" | "list";
207
- _colGridBuilt: boolean;
208
- _colListBuilt: boolean;
209
- _showList: () => Promise<void>;
210
- _hideList: () => void;
211
- _buildCollectionCard: (col: Collection) => HTMLElement;
212
- _updateColTabCounts: () => void;
213
- _exitColSelection: () => void;
214
- _updateColSelCount: () => void;
215
- _closeColDeleteModal: () => void;
216
- _currentCol: Collection | null;
217
- _currentDocs: CollectionDocument[];
218
- _cdvCurrentView: "grid" | "list";
219
- _cdvListBuilt: boolean;
220
- _openColDetail: (col: Collection) => void;
221
- _closeColDetail: () => void;
222
- _refreshCdvEmpty: () => void;
223
- _buildDocCard: (doc: CollectionDocument) => HTMLElement;
224
- _buildDocListView: (docs: CollectionDocument[]) => void;
225
- _exitDocSelection: () => void;
226
- _openRefDocPreview: (docRef: RefDocument) => void;
227
- _closeColDocPreview: () => void;
228
- _syncColDocPreviewView: () => void;
229
- _uploadTracker: UploadTrackerController;
230
- _startUploadPolling?: () => void;
231
- _stopUploadPolling?: () => void;
232
- constructor();
233
- connectedCallback(): void;
234
- disconnectedCallback(): void;
235
- showList(): Promise<void>;
236
- hideList(): void;
237
- showDetail(collectionId: string): Promise<void>;
238
- hideDetail(): void;
239
- openDocumentPreview(docRef: RefDocument): void;
240
- closeDocumentPreview(): void;
241
- get collections(): Collection[];
242
- }
243
-
244
- type IncomingDocument = Partial<Pick<CollectionDocument, "_id">> & Omit<CollectionDocument, "_id">;
245
- interface PickerOptions {
246
- mobileSheet?: MobileSheetController | null;
247
- root?: ShadowRoot | null;
248
- container?: HTMLElement | null;
249
- documents?: IncomingDocument[];
250
- onSave?: ((name: string) => void) | null;
251
- onUnsave?: (() => void) | null;
252
- scrollContainer?: EventTarget | null;
253
- fromCollectionId?: string | null;
254
- onMoved?: (() => void) | null;
255
- }
256
-
257
- declare class LexiqCollectionPickerElement extends HTMLElement {
258
- private _initialized;
259
- private _container;
260
- constructor();
261
- connectedCallback(): void;
262
- disconnectedCallback(): void;
263
- private _withEvents;
264
- openSaveCard(anchorEl: HTMLElement, opts?: Partial<PickerOptions>): void;
265
- closeSaveCard(anchorEl?: HTMLElement | null): void;
266
- triggerSaveFeedback(anchorEl: HTMLElement, opts?: Partial<PickerOptions>): void;
267
- openMoveMenu(anchorEl: HTMLElement, targetItems: HTMLElement[], opts?: Partial<PickerOptions>): void;
268
- closeMoveMenu(): void;
269
- }
270
-
271
- declare class LexiqCollectionMentionListElement extends HTMLElement {
272
- private _initialized;
273
- private _list;
274
- private _onSelectionChanged;
275
- private _onCreated;
276
- private _onCollectionsLoaded;
277
- constructor();
278
- connectedCallback(): void;
279
- disconnectedCallback(): void;
280
- private _renderMessage;
281
- private _build;
282
- private _buildRow;
283
- private _syncChecks;
284
- private _dispatchSelectionChanged;
285
- get items(): {
286
- id: string;
287
- icon: string;
288
- name: string;
289
- desc: string;
290
- }[];
291
- selectById(id: string): void;
292
- }
293
-
294
- declare function defineLexiqCollections(tagName?: string): void;
295
- declare function defineLexiqCollectionPicker(tagName?: string): void;
296
- declare function defineLexiqCollectionMentionList(tagName?: string): void;
297
- declare function registerLexiqCollectionsElements(): void;
298
-
299
- /** Values substituted into `{placeholder}` slots of a catalog entry. */
300
- type TranslateParams = Record<string, string | number>;
301
- /**
302
- * Resolves a catalog key (unscoped, e.g. `list.title`) against the host's
303
- * translation engine. Returns `undefined` when the host cannot resolve the
304
- * key, which makes the bundled English catalog take over.
305
- */
306
- type Translator = (key: string, params?: TranslateParams) => string | undefined;
307
- /** The active BCP 47 language tag, for `Intl` formatters used across the views. */
308
- declare function getLang(): string;
309
- /**
310
- * Installs the host's translation engine and language, then re-translates every
311
- * connected element in place. Call it again on every language change.
312
- *
313
- * @param next - Resolver for catalog keys, or null to return to bundled English.
314
- * @param lang - BCP 47 tag of the language `next` resolves into.
315
- */
316
- declare function setTranslator(next: Translator | null, lang: string): void;
317
- /**
318
- * Switches the language used for plural selection and `Intl` formatting, and
319
- * re-translates connected elements. Prefer {@link setTranslator}; this is for
320
- * hosts that translate through a resolver whose language changes behind it.
321
- *
322
- * @param lang - BCP 47 tag, e.g. `fr` or `fr-FR`.
323
- */
324
- declare function setLang(lang: string): void;
325
-
326
- /**
327
- * Registers the LexiQ Collections native Custom Elements when the Angular
328
- * application environment initializes, and — when the host app uses Transloco —
329
- * bridges its translations into the elements. Add to an app/route `providers`
330
- * array:
331
- *
332
- * ```ts
333
- * export const appConfig: ApplicationConfig = {
334
- * providers: [provideLexiqCollectionsElements()],
335
- * };
336
- * ```
337
- *
338
- * Components using the tags still need `schemas: [CUSTOM_ELEMENTS_SCHEMA]`.
339
- *
340
- * Transloco is optional: without it the elements fall back to their bundled
341
- * English catalog, which is why nothing under `internal/` imports it.
342
- */
343
- declare function provideLexiqCollectionsElements(): EnvironmentProviders;
344
-
345
- export { LexiqCollectionMentionListElement, LexiqCollectionPickerElement, LexiqCollectionsElement, store as collectionsStore, defineLexiqCollectionMentionList, defineLexiqCollectionPicker, defineLexiqCollections, getLang, provideLexiqCollectionsElements, registerLexiqCollectionsElements, setLang, setTranslator };
346
- export type { Collection, CollectionDocument, ConnectionNotice, ContainerRole, PickerOptions, RefDocument, TranslateParams, Translator, UploadTrackerController };