pptx-angular-viewer 1.7.2 → 1.8.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.
package/CHANGELOG.md CHANGED
@@ -4,6 +4,8 @@ All notable changes to this project are documented here.
4
4
  This file is generated from [Conventional Commits](https://www.conventionalcommits.org)
5
5
  by [git-cliff](https://git-cliff.org); do not edit it by hand.
6
6
 
7
+ ## [1.7.2](https://github.com/ChristopherVR/pptx-viewer/releases/tag/pptx-angular-viewer@1.7.2) - 2026-07-07
8
+
7
9
  ## [1.7.1](https://github.com/ChristopherVR/pptx-viewer/releases/tag/pptx-angular-viewer@1.7.1) - 2026-07-06
8
10
 
9
11
  ### Dependencies
@@ -32150,7 +32150,16 @@ const MATERIAL_PRESETS = [
32150
32150
  * (PowerPoint shows "Saved to this PC" there).
32151
32151
  */
32152
32152
  function resolveTitleBarStatusKey(input) {
32153
- const { autosaveState, isDirty, autosaveEnabled } = input;
32153
+ const { autosaveState, isDirty, autosaveEnabled, disabledReason } = input;
32154
+ if (autosaveState === 'disabled') {
32155
+ if (disabledReason === 'no_file_path') {
32156
+ return 'pptx.autosave.disabledNoFilePath';
32157
+ }
32158
+ if (disabledReason === 'autosave_toggle_off') {
32159
+ return 'pptx.autosave.disabledToggleOff';
32160
+ }
32161
+ return 'pptx.autosave.disabled';
32162
+ }
32154
32163
  if (autosaveEnabled && autosaveState === 'saving') {
32155
32164
  return 'pptx.autosave.saving';
32156
32165
  }
@@ -32304,6 +32313,99 @@ function putAutosaveRecord(filePath, data) {
32304
32313
  };
32305
32314
  }));
32306
32315
  }
32316
+ /**
32317
+ * Retrieve a single autosave snapshot by file path.
32318
+ * Returns undefined when no snapshot exists.
32319
+ */
32320
+ async function getAutosaveSnapshot(filePath) {
32321
+ const db = await openAutosaveDb$1();
32322
+ return new Promise((resolve) => {
32323
+ const tx = db.transaction(AUTOSAVE_STORE_NAME, 'readonly');
32324
+ const store = tx.objectStore(AUTOSAVE_STORE_NAME);
32325
+ const req = store.get(filePath);
32326
+ req.onsuccess = () => {
32327
+ db.close();
32328
+ resolve(req.result);
32329
+ };
32330
+ req.onerror = () => {
32331
+ db.close();
32332
+ resolve(undefined);
32333
+ };
32334
+ });
32335
+ }
32336
+ /**
32337
+ * List all autosave snapshots (without the heavy `data` blob).
32338
+ * Useful for showing a recovery picker on app start.
32339
+ */
32340
+ async function listAutosaveSnapshots() {
32341
+ const db = await openAutosaveDb$1();
32342
+ return new Promise((resolve) => {
32343
+ const results = [];
32344
+ try {
32345
+ const tx = db.transaction(AUTOSAVE_STORE_NAME, 'readonly');
32346
+ const store = tx.objectStore(AUTOSAVE_STORE_NAME);
32347
+ const cursorReq = store.openCursor();
32348
+ cursorReq.onsuccess = () => {
32349
+ const cursor = cursorReq.result;
32350
+ if (cursor) {
32351
+ const val = cursor.value;
32352
+ results.push({ key: val.key, timestamp: val.timestamp, size: val.size });
32353
+ cursor.continue();
32354
+ }
32355
+ };
32356
+ tx.oncomplete = () => {
32357
+ db.close();
32358
+ resolve(results);
32359
+ };
32360
+ tx.onerror = () => {
32361
+ db.close();
32362
+ resolve([]);
32363
+ };
32364
+ }
32365
+ catch {
32366
+ try {
32367
+ db.close();
32368
+ }
32369
+ catch {
32370
+ // Ignore
32371
+ }
32372
+ resolve([]);
32373
+ }
32374
+ });
32375
+ }
32376
+ /**
32377
+ * Delete an autosave snapshot by file path.
32378
+ */
32379
+ async function deleteAutosaveSnapshot(filePath) {
32380
+ const db = await openAutosaveDb$1();
32381
+ return new Promise((resolve) => {
32382
+ try {
32383
+ const tx = db.transaction(AUTOSAVE_STORE_NAME, 'readwrite');
32384
+ const store = tx.objectStore(AUTOSAVE_STORE_NAME);
32385
+ store.delete(filePath);
32386
+ tx.oncomplete = () => {
32387
+ db.close();
32388
+ resolve(true);
32389
+ };
32390
+ tx.onerror = () => {
32391
+ db.close();
32392
+ resolve(false);
32393
+ };
32394
+ }
32395
+ catch {
32396
+ try {
32397
+ db.close();
32398
+ }
32399
+ catch {
32400
+ // Ignore
32401
+ }
32402
+ resolve(false);
32403
+ }
32404
+ });
32405
+ }
32406
+ // ---------------------------------------------------------------------------
32407
+ // Write helpers
32408
+ // ---------------------------------------------------------------------------
32307
32409
  /**
32308
32410
  * Persist a recovery snapshot. On QuotaExceededError the oldest record is
32309
32411
  * dropped and the write retried once.
@@ -35127,9 +35229,18 @@ class AutosaveService {
35127
35229
  const filePath = host.filePath();
35128
35230
  const seconds = host.intervalSeconds?.() ?? AUTOSAVE_DEFAULT_INTERVAL_SECONDS;
35129
35231
  this.clearTimer();
35130
- if (!enabled || !filePath) {
35232
+ if (!enabled) {
35233
+ this.status.set({ state: 'disabled', reason: 'autosave_toggle_off' });
35131
35234
  return;
35132
35235
  }
35236
+ if (!filePath) {
35237
+ this.status.set({ state: 'disabled', reason: 'no_file_path' });
35238
+ return;
35239
+ }
35240
+ // Requirements met; reset to idle if currently disabled.
35241
+ if (this.status().state === 'disabled') {
35242
+ this.status.set({ state: 'idle' });
35243
+ }
35133
35244
  this.timer = setInterval(() => {
35134
35245
  void this.doAutosave();
35135
35246
  }, autosaveIntervalMs(seconds));
@@ -73867,11 +73978,15 @@ class TitleBarComponent {
73867
73978
  tb = TITLE_BAR_CLASSES;
73868
73979
  defaultFileKey = TITLE_BAR_DEFAULT_FILE_KEY;
73869
73980
  /** The i18n key for the save-location status text (next to the file name). */
73870
- statusKey = computed(() => resolveTitleBarStatusKey({
73871
- autosaveState: this.autosaveStatus()?.state ?? 'idle',
73872
- isDirty: this.isDirty(),
73873
- autosaveEnabled: this.autosaveEnabled(),
73874
- }), /* @ts-ignore */
73981
+ statusKey = computed(() => {
73982
+ const status = this.autosaveStatus();
73983
+ return resolveTitleBarStatusKey({
73984
+ autosaveState: status?.state ?? 'idle',
73985
+ isDirty: this.isDirty(),
73986
+ autosaveEnabled: this.autosaveEnabled(),
73987
+ disabledReason: status?.state === 'disabled' ? status.reason : undefined,
73988
+ });
73989
+ }, /* @ts-ignore */
73875
73990
  ...(ngDevMode ? [{ debugName: "statusKey" }] : /* istanbul ignore next */ []));
73876
73991
  /** Colour override for the status text on saving/error (when autosave is on). */
73877
73992
  statusStateClass = computed(() => {
@@ -81924,6 +82039,9 @@ const translationsEn = {
81924
82039
  'pptx.autosave.saving': 'Saving…',
81925
82040
  'pptx.autosave.saved': 'Saved {{time}}',
81926
82041
  'pptx.autosave.error': 'Autosave error',
82042
+ 'pptx.autosave.disabled': 'AutoSave unavailable',
82043
+ 'pptx.autosave.disabledNoFilePath': 'AutoSave disabled: no file path provided',
82044
+ 'pptx.autosave.disabledToggleOff': 'AutoSave off',
81927
82045
  'pptx.autosave.justNow': 'just now',
81928
82046
  'pptx.autosave.oneMinAgo': '1 min ago',
81929
82047
  'pptx.autosave.minutesAgo': '{{count}} min ago',