@christophervr/pptx-viewer 1.4.0 → 1.4.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
@@ -4,6 +4,12 @@ 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.4.0](https://github.com/ChristopherVR/pptx-viewer/releases/tag/@christophervr/pptx-viewer@1.4.0) - 2026-07-05
8
+
9
+ ### Features
10
+
11
+ - **core,cli:** Add react, angular, vue to npm keywords (by @ChristopherVR) ([528ec61](https://github.com/ChristopherVR/pptx-viewer/commit/528ec6182bb77c07444dd0e93560b65e604b9524))
12
+
7
13
  ## [1.3.0](https://github.com/ChristopherVR/pptx-viewer/releases/tag/@christophervr/pptx-viewer@1.3.0) - 2026-07-04
8
14
 
9
15
  ## [1.2.0](https://github.com/ChristopherVR/pptx-viewer/releases/tag/@christophervr/pptx-viewer@1.2.0) - 2026-07-04
package/dist/index.mjs CHANGED
@@ -412,6 +412,7 @@ var REACT_APP_TSX = `import { useCallback, useState } from 'react';
412
412
  import { PptxHandler } from 'pptx-viewer-core';
413
413
  import { PowerPointViewer } from 'pptx-react-viewer';
414
414
  import 'pptx-react-viewer/styles.css';
415
+ import './i18n';
415
416
 
416
417
  export default function App() {
417
418
  const [content, setContent] = useState<Uint8Array | null>(null);
@@ -453,6 +454,25 @@ export default function App() {
453
454
  );
454
455
  }
455
456
  `;
457
+ var REACT_I18N_TS = `import { createInstance } from 'i18next';
458
+ import { translationsEn, keyToLabel } from 'pptx-react-viewer/i18n';
459
+ import { initReactI18next } from 'react-i18next';
460
+
461
+ const i18n = createInstance();
462
+
463
+ i18n.use(initReactI18next).init({
464
+ resources: {
465
+ en: { translation: translationsEn },
466
+ },
467
+ lng: 'en',
468
+ fallbackLng: 'en',
469
+ interpolation: { escapeValue: false },
470
+ parseMissingKeyHandler: (key: string) => keyToLabel(key),
471
+ missingKeyHandler: false,
472
+ });
473
+
474
+ export default i18n;
475
+ `;
456
476
  var VUE_APP_VUE = `<script setup lang="ts">
457
477
  import { ref } from 'vue';
458
478
  import { PptxHandler } from 'pptx-viewer-core';
@@ -491,6 +511,23 @@ async function newPresentation() {
491
511
  </div>
492
512
  </template>
493
513
  `;
514
+ var VUE_MAIN_TS = `import { createApp } from 'vue';
515
+ import { createI18n } from 'vue-i18n';
516
+ import { translationsEn, keyToLabel } from 'pptx-vue-viewer/i18n';
517
+ import App from './App.vue';
518
+
519
+ const i18n = createI18n({
520
+ legacy: false,
521
+ locale: 'en',
522
+ fallbackLocale: 'en',
523
+ messages: { en: translationsEn },
524
+ missing: (_locale, key) => keyToLabel(key),
525
+ missingWarn: false,
526
+ fallbackWarn: false,
527
+ });
528
+
529
+ createApp(App).use(i18n).mount('#app');
530
+ `;
494
531
  var ANGULAR_APP_TS = `import { Component, signal } from '@angular/core';
495
532
  import { PptxHandler } from 'pptx-viewer-core';
496
533
  import { PowerPointViewerComponent } from 'pptx-angular-viewer';
@@ -531,6 +568,36 @@ export class App {
531
568
  }
532
569
  }
533
570
  `;
571
+ var ANGULAR_MAIN_TS = `import 'zone.js';
572
+ import '@angular/compiler';
573
+ import { bootstrapApplication } from '@angular/platform-browser';
574
+ import { Injectable } from '@angular/core';
575
+ import type { MissingTranslationHandlerParams } from '@ngx-translate/core';
576
+ import { MissingTranslationHandler, provideTranslateService } from '@ngx-translate/core';
577
+ import { keyToLabel } from 'pptx-angular-viewer';
578
+
579
+ import { App } from './app/app.ts';
580
+
581
+ @Injectable()
582
+ class LabelFallbackHandler implements MissingTranslationHandler {
583
+ handle(params: MissingTranslationHandlerParams): string {
584
+ return keyToLabel(params.key);
585
+ }
586
+ }
587
+
588
+ bootstrapApplication(App, {
589
+ providers: [
590
+ provideTranslateService({
591
+ lang: 'en',
592
+ fallbackLang: 'en',
593
+ missingTranslationHandler: {
594
+ provide: MissingTranslationHandler,
595
+ useClass: LabelFallbackHandler,
596
+ },
597
+ }),
598
+ ],
599
+ }).catch((err) => console.error(err));
600
+ `;
534
601
  var TARGETS = [
535
602
  {
536
603
  id: "react",
@@ -578,7 +645,8 @@ Docs: https://www.npmjs.com/package/pptx-react-viewer`,
578
645
  "react-i18next"
579
646
  ],
580
647
  entryCandidates: ["src/App.tsx"],
581
- entryContent: REACT_APP_TSX
648
+ entryContent: REACT_APP_TSX,
649
+ extraFiles: { "src/i18n.ts": REACT_I18N_TS }
582
650
  }
583
651
  },
584
652
  {
@@ -602,9 +670,16 @@ Docs: https://www.npmjs.com/package/pptx-vue-viewer`,
602
670
  scaffold: {
603
671
  command: "create-vite@latest",
604
672
  args: (dir) => [dir, "--template", "vue-ts", "--no-interactive", "--no-immediate"],
605
- extraPackages: ["pptx-vue-viewer", "pptx-viewer-core", "jszip", "fast-xml-parser"],
673
+ extraPackages: [
674
+ "pptx-vue-viewer",
675
+ "pptx-viewer-core",
676
+ "vue-i18n",
677
+ "jszip",
678
+ "fast-xml-parser"
679
+ ],
606
680
  entryCandidates: ["src/App.vue"],
607
- entryContent: VUE_APP_VUE
681
+ entryContent: VUE_APP_VUE,
682
+ extraFiles: { "src/main.ts": VUE_MAIN_TS }
608
683
  }
609
684
  },
610
685
  {
@@ -636,10 +711,11 @@ Docs: https://www.npmjs.com/package/pptx-angular-viewer`,
636
711
  "--skip-install",
637
712
  "--no-interactive"
638
713
  ],
639
- extraPackages: ["pptx-angular-viewer", "pptx-viewer-core"],
714
+ extraPackages: ["pptx-angular-viewer", "pptx-viewer-core", "@ngx-translate/core"],
640
715
  // Angular v20+ generates `app.ts`; older schematics generate `app.component.ts`.
641
716
  entryCandidates: ["src/app/app.ts", "src/app/app.component.ts"],
642
- entryContent: ANGULAR_APP_TS
717
+ entryContent: ANGULAR_APP_TS,
718
+ extraFiles: { "src/main.ts": ANGULAR_MAIN_TS }
643
719
  }
644
720
  },
645
721
  {
@@ -735,18 +811,19 @@ function mergePackages(targets) {
735
811
 
736
812
  // src/run-command.ts
737
813
  import { spawn } from "child_process";
738
- function runCommand(command, args, cwd) {
814
+ function runCommand(command, args, cwd, options) {
739
815
  return new Promise((resolve, reject) => {
740
816
  const isWindows = process.platform === "win32";
741
- const child = isWindows ? spawn([command, ...args].join(" "), { cwd, stdio: "inherit", shell: true }) : spawn(command, args, { cwd, stdio: "inherit" });
817
+ const stdio = options?.silent ? "ignore" : "inherit";
818
+ const child = isWindows ? spawn([command, ...args].join(" "), { cwd, stdio, shell: true }) : spawn(command, args, { cwd, stdio });
742
819
  child.on("error", reject);
743
820
  child.on("close", (code) => resolve(code ?? 1));
744
821
  });
745
822
  }
746
823
 
747
824
  // src/scaffold.ts
748
- import { existsSync as existsSync3, writeFileSync } from "fs";
749
- import { join as join3 } from "path";
825
+ import { existsSync as existsSync3, mkdirSync, writeFileSync } from "fs";
826
+ import { dirname, join as join3 } from "path";
750
827
  function sanitizeProjectName(name) {
751
828
  const cleaned = name.trim().replace(/[^a-zA-Z0-9._-]+/gu, "-").replace(/-{2,}/gu, "-").replace(/^-+|-+$/gu, "");
752
829
  return cleaned || "pptx-viewer-app";
@@ -763,7 +840,8 @@ async function scaffoldProject(recipe, projectName, pm, cwd) {
763
840
  const scaffoldExit = await runCommand(
764
841
  "npx",
765
842
  ["--yes", recipe.command, ...recipe.args(projectName)],
766
- cwd
843
+ cwd,
844
+ { silent: true }
767
845
  );
768
846
  if (scaffoldExit !== 0) {
769
847
  throw new Error(`${recipe.command} exited with code ${scaffoldExit}`);
@@ -773,6 +851,13 @@ async function scaffoldProject(recipe, projectName, pm, cwd) {
773
851
  if (patchedFile) {
774
852
  writeFileSync(join3(projectDir, patchedFile), recipe.entryContent);
775
853
  }
854
+ if (recipe.extraFiles) {
855
+ for (const [relativePath, content] of Object.entries(recipe.extraFiles)) {
856
+ const fullPath = join3(projectDir, relativePath);
857
+ mkdirSync(dirname(fullPath), { recursive: true });
858
+ writeFileSync(fullPath, content);
859
+ }
860
+ }
776
861
  if (recipe.extraPackages.length > 0) {
777
862
  const [command, args] = installCommand(pm, recipe.extraPackages);
778
863
  const installExit = await runCommand(command, args, projectDir);
@@ -891,18 +976,20 @@ ${dim("Skipped.")}`);
891
976
  ${yellow("Scaffolded the project, but could not find an entry file to wire up automatically.")} See the quick-start snippet below and add it yourself.`
892
977
  );
893
978
  }
894
- console.log(
895
- `
896
- ${green("\u2714")} ${bold("Done.")} Next steps:
897
-
979
+ for (const configTarget of configTargets) {
980
+ console.log(`
981
+ ${configTarget.nextSteps}
982
+ `);
983
+ }
984
+ console.log(`
985
+ ${green("\u2714")} ${bold("Done!")} Starting dev server...
986
+ `);
987
+ const projectDir = result.projectDir;
988
+ const devExit = await runCommand(pm, ["run", "dev"], projectDir);
989
+ if (devExit !== 0) {
990
+ console.log(`
898
991
  ${cyan(`cd ${projectName}`)}
899
992
  ${cyan(`${pm} run dev`)}
900
-
901
- ${target.nextSteps}
902
- `
903
- );
904
- for (const configTarget of configTargets) {
905
- console.log(`${configTarget.nextSteps}
906
993
  `);
907
994
  }
908
995
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@christophervr/pptx-viewer",
3
- "version": "1.4.0",
3
+ "version": "1.4.1",
4
4
  "description": "Interactive installer for the pptx-viewer family of packages: React, Vue, and Angular viewer components, the framework-agnostic core engine, and the MCP server.",
5
5
  "keywords": [
6
6
  "angular",