pptx-angular-viewer 3.18.0 → 3.19.1

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.
package/CHANGELOG.md CHANGED
@@ -7,6 +7,113 @@ A release listed with no entries carried no Conventional Commit in this package'
7
7
  scope: scripts/release-plan.mjs re-releases a package whenever any of its files
8
8
  change, not only on conventional ones.
9
9
 
10
+ ## [3.19.0](https://github.com/ChristopherVR/pptx-viewer/releases/tag/pptx-angular-viewer@3.19.0) - 2026-09-16
11
+
12
+ ### Features
13
+
14
+ - **shared:** Preserve native list editing and pending snapshots (by @Sudhansh6) ([ef82b95](https://github.com/ChristopherVR/pptx-viewer/commit/ef82b95b52d12a40c1cd20a4df3b431e3c5db50c))
15
+ - **angular:** Support live list drafts and pending export (by @Sudhansh6) ([96f1c0e](https://github.com/ChristopherVR/pptx-viewer/commit/96f1c0e4edcbd5bb95e9f0d6f5381e6d326f90b3))
16
+ - **i18n:** Export locale subpaths from viewer packages (by @yunfeizhu) ([65003c5](https://github.com/ChristopherVR/pptx-viewer/commit/65003c5af3ecf2e8e4e1daad1a3bcd3f5ee35481))
17
+ - **shared:** Construct image elements from local image files (by @Sudhansh6) ([562fb4a](https://github.com/ChristopherVR/pptx-viewer/commit/562fb4acf0fd2f7c3031542da05454bcfcd87ab3))
18
+ - **bindings:** Expose the shared image file construction helper (by @Sudhansh6) ([14f3f08](https://github.com/ChristopherVR/pptx-viewer/commit/14f3f084e39bd6b5c822a3af8d7f572e55533bef))
19
+ - **shared:** Handle native images on the focused canvas (by @Sudhansh6) ([20c9d66](https://github.com/ChristopherVR/pptx-viewer/commit/20c9d669bca8d97f32841a5e3a31a5c3f0512ffb))
20
+ - **angular:** Preserve canvas focus for native image paste (by @Sudhansh6) ([0797e7b](https://github.com/ChristopherVR/pptx-viewer/commit/0797e7b43201a3e9a668cb2e55aba57e6d6a8b3d))
21
+ - **shared:** Add optional selection artwork tokens (by @Sudhansh6) ([9fe6015](https://github.com/ChristopherVR/pptx-viewer/commit/9fe60154bc8e5eb314f187a42cbd4af510c714ca))
22
+ - **angular:** Support selection control artwork themes (by @Sudhansh6) ([7c1a15c](https://github.com/ChristopherVR/pptx-viewer/commit/7c1a15c9ff68a618b86ebfb506dd66d6fc2e17ac))
23
+ - Expose slide-transition helpers from every binding's internals entry (by @ChristopherVR) ([d232ffb](https://github.com/ChristopherVR/pptx-viewer/commit/d232ffba626b4088c2ee7f3acbb5cfa00452490d))
24
+ - Add atomic cross-slide element batches (by @yunfeizhu) ([1157b68](https://github.com/ChristopherVR/pptx-viewer/commit/1157b68784672c6273d40c7fcee6c0c11b3216a3))
25
+
26
+ ### Bug Fixes
27
+
28
+ - **shared:** Preserve theme colors in native list replacement (by @Sudhansh6) ([1b302b3](https://github.com/ChristopherVR/pptx-viewer/commit/1b302b3db65e8f87794b022e07808cd2b9383875))
29
+ - Preserve live list editing through upstream merge (by @Sudhansh6) ([3f8b4f4](https://github.com/ChristopherVR/pptx-viewer/commit/3f8b4f4dce22d2f822e1c706474f946b7c20c3c7))
30
+ - **shared:** Preserve caret scope and native list breaks (by @Sudhansh6) ([f19179b](https://github.com/ChristopherVR/pptx-viewer/commit/f19179b93b85c3486b6f7458c9debe79d3fe7d6c))
31
+ - **angular:** Align live list caret and paragraph keys (by @Sudhansh6) ([bc457b1](https://github.com/ChristopherVR/pptx-viewer/commit/bc457b117945de472bccfb6d52a4dc676f5989bb))
32
+ - **shared:** Retain loaded webfonts during slide edits (by @ChristopherVR) ([4f81eb0](https://github.com/ChristopherVR/pptx-viewer/commit/4f81eb062431a273cf714cafc751cc4b8446f30c))
33
+ - **tests:** Numerous test issues (by @ChristopherVR) ([c5b8260](https://github.com/ChristopherVR/pptx-viewer/commit/c5b826079078371191b48e04db0e7e4e6877435c))
34
+ - **angular:** Exempt selection controls from the button size floor (by @Sudhansh6) ([24afa77](https://github.com/ChristopherVR/pptx-viewer/commit/24afa777ecbacc41673b50fa08f1922b6c2b6ad9))
35
+ - **shared:** Anchor rotation gestures to their initial press (by @Sudhansh6) ([798c83c](https://github.com/ChristopherVR/pptx-viewer/commit/798c83c91cb7cf0ebafd1f2c206ec02f701c5ecc))
36
+ - **angular:** Gate font controls on editable text selection (by @Sudhansh6) ([3fe14c7](https://github.com/ChristopherVR/pptx-viewer/commit/3fe14c71e922e1113091fcbfd01b476edcd94da7))
37
+ - **shared:** Preserve SVG namespaces in raster exports (by @Sudhansh6) ([1e3fdaf](https://github.com/ChristopherVR/pptx-viewer/commit/1e3fdaf5b08a4bdae98662067f9460958aaf8b0f))
38
+ - **shared:** Bound resize hit areas between neighboring anchors (by @Sudhansh6) ([61d735d](https://github.com/ChristopherVR/pptx-viewer/commit/61d735d66644cd5ed3b6e87e7c6ff4c8dfeb9c99))
39
+ - **angular:** Keep neighboring resize handles reachable (by @Sudhansh6) ([d801214](https://github.com/ChristopherVR/pptx-viewer/commit/d80121413b58dbf7286164d40a8db766afe7d27f))
40
+ - **angular:** Retain accepted paste when editing becomes available (by @Sudhansh6) ([639821f](https://github.com/ChristopherVR/pptx-viewer/commit/639821fd96beb4e54b2e221dbde6ac1bb349a095))
41
+ - **shared:** Keep rotate controls inside visible canvas (by @Sudhansh6) ([df584e9](https://github.com/ChristopherVR/pptx-viewer/commit/df584e90335c8b8da92cf8dd25c6e5a9695f7b1b))
42
+ - **angular:** Keep rotation controls within canvas bounds (by @Sudhansh6) ([546d98b](https://github.com/ChristopherVR/pptx-viewer/commit/546d98b55a8f5fff6248259422f235bc53103f71))
43
+ - **angular:** Keep inward rotation reachable during text editing (by @Sudhansh6) ([da50e91](https://github.com/ChristopherVR/pptx-viewer/commit/da50e91d40670e7537df0779f425e47b1aeb0be5))
44
+ - **shared:** Apply picture alphaModFix once, not filter times opacity (by @ChristopherVR) ([3fd154b](https://github.com/ChristopherVR/pptx-viewer/commit/3fd154bda6958725bda279f81c001a99f55bd485))
45
+ - **shared:** Stop padding the painted element box to MIN_ELEMENT_SIZE (by @ChristopherVR) ([4caef83](https://github.com/ChristopherVR/pptx-viewer/commit/4caef831004ff52da1fa816970226567e7e2bef9))
46
+ - **core:** Honour a:alpha on solid slide backgrounds and keep it on save (by @ChristopherVR) ([3b50c7a](https://github.com/ChristopherVR/pptx-viewer/commit/3b50c7a28f8a64fcbc14eea4c2f47564b9515942))
47
+ - Guard element batches during active pointer gestures (by @yunfeizhu) ([da3bf49](https://github.com/ChristopherVR/pptx-viewer/commit/da3bf490851c95ed3e165cb0139ee5fa5c9f4408))
48
+ - **core:** Blend a:alpha on pattern background colours onto white (by @ChristopherVR) ([893a261](https://github.com/ChristopherVR/pptx-viewer/commit/893a261811f96f5078a9e505630414b005ab3735))
49
+ - Render the degenerate-shape hit target for every element type (by @ChristopherVR) ([49a15a4](https://github.com/ChristopherVR/pptx-viewer/commit/49a15a40cf612ae8cbb51b9e4ceeb20e644b4936))
50
+ - **shared:** Model relaxedInset/slope/hardEdge as non-monotonic bevel profiles (by @ChristopherVR) ([e3ef9fb](https://github.com/ChristopherVR/pptx-viewer/commit/e3ef9fb33bd991d93153daee3876aebf575128a8))
51
+
52
+ ### Refactor
53
+
54
+ - **core:** Expose paragraph geometry keys for editing (by @Sudhansh6) ([da5b8f5](https://github.com/ChristopherVR/pptx-viewer/commit/da5b8f595c2c68d0cf354f92c2ec4d14a89618ea))
55
+
56
+ ### Documentation
57
+
58
+ - **shared:** Document the foreignObject SVG string's safe-sink boundary (by @ChristopherVR) ([c3446d8](https://github.com/ChristopherVR/pptx-viewer/commit/c3446d8316632644db8827ba3c7cd7e39c487014))
59
+
60
+ ### Testing
61
+
62
+ - **core:** Register the nested list roundtrip fixture (by @Sudhansh6) ([857e0b2](https://github.com/ChristopherVR/pptx-viewer/commit/857e0b2dc589a237266a5c31944b34d0173b2d82))
63
+ - **angular:** Keep GIF cap checks lightweight (by @Sudhansh6) ([cc9e436](https://github.com/ChristopherVR/pptx-viewer/commit/cc9e4364e13cc74b3fb22b924362590e655a2bb2))
64
+ - Cover batch update history across viewer bindings (by @yunfeizhu) ([fff49e8](https://github.com/ChristopherVR/pptx-viewer/commit/fff49e83203008bd4c01ac531791ad550006a4ab))
65
+ - Cover gesture isolation and demo handle lifecycle (by @yunfeizhu) ([62331e2](https://github.com/ChristopherVR/pptx-viewer/commit/62331e27dd5d542db57d7ec3642757f27010df0b))
66
+
67
+ ### Chores
68
+
69
+ - Merge main into live list editing (by @Sudhansh6) ([a9b760d](https://github.com/ChristopherVR/pptx-viewer/commit/a9b760d9c051b39066731665824af3230b8797db))
70
+ - Sync upstream validation and ribbon updates (by @Sudhansh6) ([c70516c](https://github.com/ChristopherVR/pptx-viewer/commit/c70516c0389efd29e2dde70aeb041053fe9bd17b))
71
+ - Merge main and resolve locale documentation conflicts (by @yunfeizhu) ([ac9123d](https://github.com/ChristopherVR/pptx-viewer/commit/ac9123d4fa531cd591898a721bd690cca25b2cf6))
72
+ - **shared:** Merge main into resize hit ownership (by @Sudhansh6) ([f6d6336](https://github.com/ChristopherVR/pptx-viewer/commit/f6d63362dce076f497a9c350fd93501515634ab5))
73
+ - Sync main for native paste validation (by @Sudhansh6) ([29f5fb3](https://github.com/ChristopherVR/pptx-viewer/commit/29f5fb33b0115f528731b9412f4769600b243c0c))
74
+ - Merge main into native canvas image paste (by @Sudhansh6) ([0ebf261](https://github.com/ChristopherVR/pptx-viewer/commit/0ebf261014cc30d3422b4c87ac6def51352951e8))
75
+ - Integrate rotation and selection-control prerequisites (by @Sudhansh6) ([e6f9cde](https://github.com/ChristopherVR/pptx-viewer/commit/e6f9cde524570b7aab4f8e95cff3756e27e45811))
76
+ - **shared:** Align boundary controls with current main (by @Sudhansh6) ([7fbfc4c](https://github.com/ChristopherVR/pptx-viewer/commit/7fbfc4c3ae6df408035d3f21e7a6321f8323c74f))
77
+ - **shared:** Align selection artwork with boundary controls (by @Sudhansh6) ([3b971d3](https://github.com/ChristopherVR/pptx-viewer/commit/3b971d3bb0a647d3d9158a8e23d2ec6e91e58791))
78
+
79
+ ## [3.18.0](https://github.com/ChristopherVR/pptx-viewer/releases/tag/pptx-angular-viewer@3.18.0) - 2026-09-14
80
+
81
+ ### Features
82
+
83
+ - **i18n:** Add Simplified Chinese reference locale (by @yunfeizhu) ([4f65031](https://github.com/ChristopherVR/pptx-viewer/commit/4f650313634f2dd3f9ca30a01f742ea4a5349b0f))
84
+ - **core:** Preserve smart art diagram parts (by @ChristopherVR) ([187e0e1](https://github.com/ChristopherVR/pptx-viewer/commit/187e0e17c4e8446fb1b745bb77e96fd44710ed34))
85
+
86
+ ### Bug Fixes
87
+
88
+ - **angular:** CSS not matching React (by @ChristopherVR) ([1b8113e](https://github.com/ChristopherVR/pptx-viewer/commit/1b8113e9fb42bb23831320995bc3cd49e0a07420))
89
+ - **shared:** Retain list state after upstream rebase (by @ChristopherVR) ([268a1f1](https://github.com/ChristopherVR/pptx-viewer/commit/268a1f132b664a6fec4df127a3588cf0e7748ff1))
90
+ - **core:** Retain original duplicate shape ids (by @ChristopherVR) ([74d595c](https://github.com/ChristopherVR/pptx-viewer/commit/74d595cbc380af69faf6cd47932475d33b139943))
91
+ - **shared:** Restore paragraph remap helpers (by @ChristopherVR) ([e07554c](https://github.com/ChristopherVR/pptx-viewer/commit/e07554c9bffbd86a4a1c273a35572f2a3a77e0bf))
92
+ - **shared:** Expose freeform geometry helpers (by @ChristopherVR) ([96e54a5](https://github.com/ChristopherVR/pptx-viewer/commit/96e54a523e185a09e94d8d15ed5cf8b06b47a8b8))
93
+ - **core:** Evaluate connector and cloud preset geometry (by @ChristopherVR) ([5f34ed5](https://github.com/ChristopherVR/pptx-viewer/commit/5f34ed520cc1c86721b059d5b9a5e7e1e6277b49))
94
+ - **core:** Evaluate connector and cloud preset geometry (by @ChristopherVR) ([8e2608a](https://github.com/ChristopherVR/pptx-viewer/commit/8e2608a397160c8640bb6801da6cfdc273beb60a))
95
+ - **shared:** Remove code scanning findings (by @ChristopherVR) ([ccf02f2](https://github.com/ChristopherVR/pptx-viewer/commit/ccf02f2d1065e4fda3233fe517e06d95ec1a5c0e))
96
+ - **core:** Avoid namespace scan backtracking (by @ChristopherVR) ([2c3f038](https://github.com/ChristopherVR/pptx-viewer/commit/2c3f038420d96af57c01a26da5fbc5752c1147c9))
97
+
98
+ ### Documentation
99
+
100
+ - **repo:** Sync guides and references with implementation (by @ChristopherVR) ([70440f6](https://github.com/ChristopherVR/pptx-viewer/commit/70440f6f10297ba7847662361c6d6f23d35ad9e2))
101
+
102
+ ### Testing
103
+
104
+ - **core:** Stabilize the Vitest 5 suite (by @ChristopherVR) ([83b4cc5](https://github.com/ChristopherVR/pptx-viewer/commit/83b4cc53b4846da72494e4b81d8530546e9ad888))
105
+ - **repo:** Stabilize Vitest 5 concurrency (by @ChristopherVR) ([6b151b3](https://github.com/ChristopherVR/pptx-viewer/commit/6b151b352ba8c7b78013696e91c3040fb95a929f))
106
+
107
+ ### Dependencies
108
+
109
+ - **deps:** Bump the minor-and-patch group with 2 updates (by @dependabot[bot]) ([7bed5e5](https://github.com/ChristopherVR/pptx-viewer/commit/7bed5e56a34cbffbe7e8604a76344a33a05e7f12))
110
+ - **deps:** Bump @lucide/angular from 1.46.0 to 1.44.0 (by @dependabot[bot]) ([14c2f51](https://github.com/ChristopherVR/pptx-viewer/commit/14c2f51d22c1674c1f447c78fbc89299f63f3d12))
111
+ - **deps:** Rebase lint-staged update (by @ChristopherVR) ([c2a649e](https://github.com/ChristopherVR/pptx-viewer/commit/c2a649ee2df1e29a963aec29cb109d9c70ead6ff))
112
+
113
+ ### Chores
114
+
115
+ - **deps-dev:** Bump vitest from 4.1.11 to 5.0.0 (by @dependabot[bot]) ([5f8fe4f](https://github.com/ChristopherVR/pptx-viewer/commit/5f8fe4f851d33a02545556fd63238a55cf5f868a))
116
+
10
117
  ## [3.17.1](https://github.com/ChristopherVR/pptx-viewer/releases/tag/pptx-angular-viewer@3.17.1) - 2026-09-14
11
118
 
12
119
  ### Bug Fixes
package/README.md CHANGED
@@ -314,6 +314,27 @@ for the `addElement` contract and a core-factory example.
314
314
  for using `RibbonComponent` and `SlideCanvasComponent` outside
315
315
  `PowerPointViewerComponent`.
316
316
 
317
+ ### Internal building blocks & slide-transition helpers
318
+
319
+ Most of this package's cross-framework logic (colour/geometry/connector/animation/chart math,
320
+ slide transitions, and more) lives in `pptx-viewer-shared`, an internal package that is **never
321
+ published to npm**. Everything not part of the curated API above (~150 internal services,
322
+ components, and helpers) is importable from `pptx-angular-viewer/internals` instead, not covered
323
+ by semver. That includes the slide-transition resolver/keyframes
324
+ (`resolveSlideTransition`, `resolveTransitionDurationMs`, `SLIDE_TRANSITION_KEYFRAMES`) and the
325
+ `PresentationTransitionOverlayComponent` behind presentation mode, so you never need
326
+ `pptx-viewer-shared` yourself:
327
+
328
+ ```ts
329
+ import {
330
+ resolveSlideTransition,
331
+ PresentationTransitionOverlayComponent,
332
+ } from 'pptx-angular-viewer/internals';
333
+ ```
334
+
335
+ See the [services reference](https://christophervr.github.io/pptx-viewer/angular/services-reference)
336
+ for the full list.
337
+
317
338
  ## Localization (i18n)
318
339
 
319
340
  UI labels go through [@ngx-translate/core](https://github.com/ngx-translate/core) with dotted keys such as `pptx.statusBar.allSaved`. Provide it with `provideTranslateService()` (the demo's `src/i18n.ts` shows a minimal config, including a `MissingTranslationHandler` that derives Title Case labels for any key you don't explicitly translate):
@@ -351,6 +372,20 @@ bun run typecheck # tsc against tsconfig.lib.json
351
372
  bun run test # vitest
352
373
  ```
353
374
 
375
+ ## Reference translations
376
+
377
+ Optional French, Spanish, German, and Simplified Chinese dictionaries ship with
378
+ this package. Import only the language you need:
379
+
380
+ ```ts
381
+ import { translationsZhCN } from 'pptx-angular-viewer/i18n/zh-CN';
382
+ ```
383
+
384
+ The other subpaths are `i18n/fr` (`translationsFr`), `i18n/es`
385
+ (`translationsEs`), and `i18n/de` (`translationsDe`). See the
386
+ [localization guide](https://christophervr.github.io/pptx-viewer/guide/localization)
387
+ for registration and runtime switching. Existing English imports are unchanged.
388
+
354
389
  ## License
355
390
 
356
391
  [Apache-2.0](LICENSE). Please keep the [`NOTICE`](NOTICE) file with redistributions.
@@ -1,4 +1,4 @@
1
- import { t as toChatSummary } from './pptx-angular-viewer-pptx-angular-viewer-B3FNZYVL.mjs';
1
+ import { t as toChatSummary } from './pptx-angular-viewer-pptx-angular-viewer-D2wmF5iB.mjs';
2
2
 
3
3
  /**
4
4
  * IndexedDB backend for {@link createChatHistoryStore}. Kept in its own module
@@ -103,4 +103,4 @@ function createIdbBackend(db) {
103
103
  }
104
104
 
105
105
  export { CHAT_STORE, createIdbBackend, openChatDb };
106
- //# sourceMappingURL=pptx-angular-viewer-chat-history-idb-BaGfTtS5.mjs.map
106
+ //# sourceMappingURL=pptx-angular-viewer-chat-history-idb-BKazjZCl.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"pptx-angular-viewer-chat-history-idb-BaGfTtS5.mjs","sources":["../../src/internal/shared-src/ai/chat-history-idb.ts"],"sourcesContent":["/**\n * IndexedDB backend for {@link createChatHistoryStore}. Kept in its own module\n * so the localStorage fallback and the public factory stay within the per-file\n * size budget. Uses the raw IndexedDB API with tiny promise wrappers so no new\n * runtime dependency is pulled in.\n *\n * Every browser global is touched lazily from inside a function, never at module\n * load, so importing this file in a non-DOM environment (Node, SSR) never throws.\n */\n\nimport type { ChatBackend, PptxAiChatSummary, PptxAiStoredChat } from './chat-history-store';\nimport { toChatSummary } from './chat-history-store';\n\n/** Object store holding one record per chat, keyed by `id`. */\nexport const CHAT_STORE = 'chats';\n/** Index over the optional `deckId` key path, used for per-deck filtering. */\nconst DECK_INDEX = 'deckId';\n\n/** Resolve an `IDBRequest` to a promise. */\nfunction requestToPromise<T>(request: IDBRequest<T>): Promise<T> {\n\treturn new Promise<T>((resolve, reject) => {\n\t\trequest.onsuccess = () => resolve(request.result);\n\t\trequest.onerror = () => reject(request.error ?? new Error('IndexedDB request failed.'));\n\t});\n}\n\n/** Resolve when a transaction commits (or reject on error/abort). */\nfunction transactionDone(tx: IDBTransaction): Promise<void> {\n\treturn new Promise<void>((resolve, reject) => {\n\t\ttx.oncomplete = () => resolve();\n\t\ttx.onerror = () => reject(tx.error ?? new Error('IndexedDB transaction failed.'));\n\t\ttx.onabort = () => reject(tx.error ?? new Error('IndexedDB transaction aborted.'));\n\t});\n}\n\n/**\n * Open (and if needed create/upgrade) the chat database. Throws when there is no\n * `indexedDB` global so the caller can transparently fall back to localStorage.\n */\nexport function openChatDb(dbName: string): Promise<IDBDatabase> {\n\tconst idb = typeof indexedDB !== 'undefined' ? indexedDB : undefined;\n\tif (!idb) {\n\t\tthrow new Error('IndexedDB is not available in this environment.');\n\t}\n\treturn new Promise<IDBDatabase>((resolve, reject) => {\n\t\tconst open = idb.open(dbName, 1);\n\t\topen.onupgradeneeded = () => {\n\t\t\tconst db = open.result;\n\t\t\tif (!db.objectStoreNames.contains(CHAT_STORE)) {\n\t\t\t\tconst store = db.createObjectStore(CHAT_STORE, { keyPath: 'id' });\n\t\t\t\tstore.createIndex(DECK_INDEX, 'deckId', { unique: false });\n\t\t\t}\n\t\t};\n\t\topen.onsuccess = () => resolve(open.result);\n\t\topen.onerror = () => reject(open.error ?? new Error('Failed to open IndexedDB.'));\n\t\topen.onblocked = () => reject(new Error('IndexedDB open blocked by another connection.'));\n\t});\n}\n\n/** Read every stored chat (newest-first ordering is applied by the caller). */\nasync function readAll(db: IDBDatabase, deckId: string | undefined): Promise<PptxAiStoredChat[]> {\n\tconst tx = db.transaction(CHAT_STORE, 'readonly');\n\tconst store = tx.objectStore(CHAT_STORE);\n\tconst source =\n\t\tdeckId === undefined\n\t\t\t? store.getAll()\n\t\t\t: store.index(DECK_INDEX).getAll(IDBKeyRange.only(deckId));\n\tconst rows = await requestToPromise<PptxAiStoredChat[]>(source);\n\tawait transactionDone(tx);\n\treturn rows;\n}\n\n/** Create an IndexedDB-backed {@link ChatBackend}. */\nexport function createIdbBackend(db: IDBDatabase): ChatBackend {\n\treturn {\n\t\tasync list(deckId: string | undefined): Promise<PptxAiChatSummary[]> {\n\t\t\tconst rows = await readAll(db, deckId);\n\t\t\treturn rows.map(toChatSummary).sort((a, b) => b.updatedAt - a.updatedAt);\n\t\t},\n\t\tasync load(id: string): Promise<PptxAiStoredChat | null> {\n\t\t\tconst tx = db.transaction(CHAT_STORE, 'readonly');\n\t\t\tconst row = await requestToPromise<PptxAiStoredChat | undefined>(\n\t\t\t\ttx.objectStore(CHAT_STORE).get(id),\n\t\t\t);\n\t\t\tawait transactionDone(tx);\n\t\t\treturn row ?? null;\n\t\t},\n\t\tasync save(chat: PptxAiStoredChat): Promise<void> {\n\t\t\tconst tx = db.transaction(CHAT_STORE, 'readwrite');\n\t\t\ttx.objectStore(CHAT_STORE).put(chat);\n\t\t\tawait transactionDone(tx);\n\t\t},\n\t\tasync remove(id: string): Promise<void> {\n\t\t\tconst tx = db.transaction(CHAT_STORE, 'readwrite');\n\t\t\ttx.objectStore(CHAT_STORE).delete(id);\n\t\t\tawait transactionDone(tx);\n\t\t},\n\t\tasync clear(deckId: string | undefined): Promise<void> {\n\t\t\tconst tx = db.transaction(CHAT_STORE, 'readwrite');\n\t\t\tconst store = tx.objectStore(CHAT_STORE);\n\t\t\tif (deckId === undefined) {\n\t\t\t\tstore.clear();\n\t\t\t} else {\n\t\t\t\tconst ids = await requestToPromise<IDBValidKey[]>(\n\t\t\t\t\tstore.index(DECK_INDEX).getAllKeys(IDBKeyRange.only(deckId)),\n\t\t\t\t);\n\t\t\t\tfor (const id of ids) {\n\t\t\t\t\tstore.delete(id);\n\t\t\t\t}\n\t\t\t}\n\t\t\tawait transactionDone(tx);\n\t\t},\n\t};\n}\n"],"names":[],"mappings":";;AAAA;;;;;;;;AAQG;AAKH;AACO,MAAM,UAAU,GAAG;AAC1B;AACA,MAAM,UAAU,GAAG,QAAQ;AAE3B;AACA,SAAS,gBAAgB,CAAI,OAAsB,EAAA;IAClD,OAAO,IAAI,OAAO,CAAI,CAAC,OAAO,EAAE,MAAM,KAAI;AACzC,QAAA,OAAO,CAAC,SAAS,GAAG,MAAM,OAAO,CA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E;AACrB,oBAAA,KAAK,CAAC,MAAM,CAAC,EAAE,CAAC;gBACjB;YACD;AACA,YAAA,MAAM,eAAe,CAAC,EAAE,CAAC;QAC1B,CAAC;KACD;AACF;;"}
1
+ {"version":3,"file":"pptx-angular-viewer-chat-history-idb-BKazjZCl.mjs","sources":["../../src/internal/shared-src/ai/chat-history-idb.ts"],"sourcesContent":["/**\n * IndexedDB backend for {@link createChatHistoryStore}. Kept in its own module\n * so the localStorage fallback and the public factory stay within the per-file\n * size budget. Uses the raw IndexedDB API with tiny promise wrappers so no new\n * runtime dependency is pulled in.\n *\n * Every browser global is touched lazily from inside a function, never at module\n * load, so importing this file in a non-DOM environment (Node, SSR) never throws.\n */\n\nimport type { ChatBackend, PptxAiChatSummary, PptxAiStoredChat } from './chat-history-store';\nimport { toChatSummary } from './chat-history-store';\n\n/** Object store holding one record per chat, keyed by `id`. */\nexport const CHAT_STORE = 'chats';\n/** Index over the optional `deckId` key path, used for per-deck filtering. */\nconst DECK_INDEX = 'deckId';\n\n/** Resolve an `IDBRequest` to a promise. */\nfunction requestToPromise<T>(request: IDBRequest<T>): Promise<T> {\n\treturn new Promise<T>((resolve, reject) => {\n\t\trequest.onsuccess = () => resolve(request.result);\n\t\trequest.onerror = () => reject(request.error ?? new Error('IndexedDB request failed.'));\n\t});\n}\n\n/** Resolve when a transaction commits (or reject on error/abort). */\nfunction transactionDone(tx: IDBTransaction): Promise<void> {\n\treturn new Promise<void>((resolve, reject) => {\n\t\ttx.oncomplete = () => resolve();\n\t\ttx.onerror = () => reject(tx.error ?? new Error('IndexedDB transaction failed.'));\n\t\ttx.onabort = () => reject(tx.error ?? new Error('IndexedDB transaction aborted.'));\n\t});\n}\n\n/**\n * Open (and if needed create/upgrade) the chat database. Throws when there is no\n * `indexedDB` global so the caller can transparently fall back to localStorage.\n */\nexport function openChatDb(dbName: string): Promise<IDBDatabase> {\n\tconst idb = typeof indexedDB !== 'undefined' ? indexedDB : undefined;\n\tif (!idb) {\n\t\tthrow new Error('IndexedDB is not available in this environment.');\n\t}\n\treturn new Promise<IDBDatabase>((resolve, reject) => {\n\t\tconst open = idb.open(dbName, 1);\n\t\topen.onupgradeneeded = () => {\n\t\t\tconst db = open.result;\n\t\t\tif (!db.objectStoreNames.contains(CHAT_STORE)) {\n\t\t\t\tconst store = db.createObjectStore(CHAT_STORE, { keyPath: 'id' });\n\t\t\t\tstore.createIndex(DECK_INDEX, 'deckId', { unique: false });\n\t\t\t}\n\t\t};\n\t\topen.onsuccess = () => resolve(open.result);\n\t\topen.onerror = () => reject(open.error ?? new Error('Failed to open IndexedDB.'));\n\t\topen.onblocked = () => reject(new Error('IndexedDB open blocked by another connection.'));\n\t});\n}\n\n/** Read every stored chat (newest-first ordering is applied by the caller). */\nasync function readAll(db: IDBDatabase, deckId: string | undefined): Promise<PptxAiStoredChat[]> {\n\tconst tx = db.transaction(CHAT_STORE, 'readonly');\n\tconst store = tx.objectStore(CHAT_STORE);\n\tconst source =\n\t\tdeckId === undefined\n\t\t\t? store.getAll()\n\t\t\t: store.index(DECK_INDEX).getAll(IDBKeyRange.only(deckId));\n\tconst rows = await requestToPromise<PptxAiStoredChat[]>(source);\n\tawait transactionDone(tx);\n\treturn rows;\n}\n\n/** Create an IndexedDB-backed {@link ChatBackend}. */\nexport function createIdbBackend(db: IDBDatabase): ChatBackend {\n\treturn {\n\t\tasync list(deckId: string | undefined): Promise<PptxAiChatSummary[]> {\n\t\t\tconst rows = await readAll(db, deckId);\n\t\t\treturn rows.map(toChatSummary).sort((a, b) => b.updatedAt - a.updatedAt);\n\t\t},\n\t\tasync load(id: string): Promise<PptxAiStoredChat | null> {\n\t\t\tconst tx = db.transaction(CHAT_STORE, 'readonly');\n\t\t\tconst row = await requestToPromise<PptxAiStoredChat | undefined>(\n\t\t\t\ttx.objectStore(CHAT_STORE).get(id),\n\t\t\t);\n\t\t\tawait transactionDone(tx);\n\t\t\treturn row ?? null;\n\t\t},\n\t\tasync save(chat: PptxAiStoredChat): Promise<void> {\n\t\t\tconst tx = db.transaction(CHAT_STORE, 'readwrite');\n\t\t\ttx.objectStore(CHAT_STORE).put(chat);\n\t\t\tawait transactionDone(tx);\n\t\t},\n\t\tasync remove(id: string): Promise<void> {\n\t\t\tconst tx = db.transaction(CHAT_STORE, 'readwrite');\n\t\t\ttx.objectStore(CHAT_STORE).delete(id);\n\t\t\tawait transactionDone(tx);\n\t\t},\n\t\tasync clear(deckId: string | undefined): Promise<void> {\n\t\t\tconst tx = db.transaction(CHAT_STORE, 'readwrite');\n\t\t\tconst store = tx.objectStore(CHAT_STORE);\n\t\t\tif (deckId === undefined) {\n\t\t\t\tstore.clear();\n\t\t\t} else {\n\t\t\t\tconst ids = await requestToPromise<IDBValidKey[]>(\n\t\t\t\t\tstore.index(DECK_INDEX).getAllKeys(IDBKeyRange.only(deckId)),\n\t\t\t\t);\n\t\t\t\tfor (const id of ids) {\n\t\t\t\t\tstore.delete(id);\n\t\t\t\t}\n\t\t\t}\n\t\t\tawait transactionDone(tx);\n\t\t},\n\t};\n}\n"],"names":[],"mappings":";;AAAA;;;;;;;;AAQG;AAKH;AACO,MAAM,UAAU,GAAG;AAC1B;AACA,MAAM,UAAU,GAAG,QAAQ;AAE3B;AACA,SAAS,gBAAgB,CAAI,OAAsB,EAAA;IAClD,OAAO,IAAI,OAAO,CAAI,CAAC,OAAO,EAAE,MAAM,KAAI;AACzC,QAAA,OAAO,CAAC,SAAS,GAAG,MAAM,OAAO,CAAC,OAAO,CAAC,MAAM,CAAC;AACjD,QAAA,OAAO,CAAC,OAAO,GAAG,MAAM,MAAM,CAAC,OAAO,CAAC,KAAK,IAAI,IAAI,KAAK,CAAC,2BAA2B,CAAC,CAAC;AACxF,IAAA,CAAC,CAAC;AACH;AAEA;AACA,SAAS,eAAe,CAAC,EAAkB,EAAA;IAC1C,OAAO,IAAI,OAAO,CAAO,CAAC,OAAO,EAAE,MAAM,KAAI;QAC5C,EAAE,CAAC,UAAU,GAAG,MAAM,OAAO,EAAE;AAC/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