@floegence/floe-webapp-core 0.64.0 → 0.65.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.
Files changed (93) hide show
  1. package/dist/PDFJS-LICENSE +177 -0
  2. package/dist/images/altText_add.svg +3 -0
  3. package/dist/images/altText_disclaimer.svg +3 -0
  4. package/dist/images/altText_done.svg +3 -0
  5. package/dist/images/altText_spinner.svg +30 -0
  6. package/dist/images/altText_warning.svg +3 -0
  7. package/dist/images/annotation-check.svg +11 -0
  8. package/dist/images/annotation-comment.svg +16 -0
  9. package/dist/images/annotation-help.svg +26 -0
  10. package/dist/images/annotation-insert.svg +10 -0
  11. package/dist/images/annotation-key.svg +11 -0
  12. package/dist/images/annotation-newparagraph.svg +11 -0
  13. package/dist/images/annotation-noicon.svg +7 -0
  14. package/dist/images/annotation-note.svg +42 -0
  15. package/dist/images/annotation-paperclip.svg +6 -0
  16. package/dist/images/annotation-paragraph.svg +16 -0
  17. package/dist/images/annotation-pushpin.svg +7 -0
  18. package/dist/images/checkmark.svg +5 -0
  19. package/dist/images/comment-actionsButton.svg +3 -0
  20. package/dist/images/comment-closeButton.svg +3 -0
  21. package/dist/images/comment-editButton.svg +8 -0
  22. package/dist/images/comment-popup-editButton.svg +5 -0
  23. package/dist/images/cursor-editorFreeHighlight.svg +6 -0
  24. package/dist/images/cursor-editorFreeText.svg +3 -0
  25. package/dist/images/cursor-editorInk.svg +4 -0
  26. package/dist/images/cursor-editorTextHighlight.svg +8 -0
  27. package/dist/images/editor-toolbar-delete.svg +5 -0
  28. package/dist/images/editor-toolbar-edit.svg +3 -0
  29. package/dist/images/findbarButton-next.svg +3 -0
  30. package/dist/images/findbarButton-previous.svg +3 -0
  31. package/dist/images/gv-toolbarButton-download.svg +3 -0
  32. package/dist/images/loading-icon.gif +0 -0
  33. package/dist/images/loading.svg +1 -0
  34. package/dist/images/messageBar_closingButton.svg +3 -0
  35. package/dist/images/messageBar_info.svg +3 -0
  36. package/dist/images/messageBar_warning.svg +3 -0
  37. package/dist/images/pages_closeButton.svg +3 -0
  38. package/dist/images/pages_selected.svg +7 -0
  39. package/dist/images/pages_viewArrow.svg +3 -0
  40. package/dist/images/pages_viewButton.svg +3 -0
  41. package/dist/images/secondaryToolbarButton-documentProperties.svg +3 -0
  42. package/dist/images/secondaryToolbarButton-firstPage.svg +3 -0
  43. package/dist/images/secondaryToolbarButton-handTool.svg +3 -0
  44. package/dist/images/secondaryToolbarButton-lastPage.svg +3 -0
  45. package/dist/images/secondaryToolbarButton-rotateCcw.svg +3 -0
  46. package/dist/images/secondaryToolbarButton-rotateCw.svg +3 -0
  47. package/dist/images/secondaryToolbarButton-scrollHorizontal.svg +3 -0
  48. package/dist/images/secondaryToolbarButton-scrollPage.svg +3 -0
  49. package/dist/images/secondaryToolbarButton-scrollVertical.svg +3 -0
  50. package/dist/images/secondaryToolbarButton-scrollWrapped.svg +3 -0
  51. package/dist/images/secondaryToolbarButton-selectTool.svg +3 -0
  52. package/dist/images/secondaryToolbarButton-spreadEven.svg +3 -0
  53. package/dist/images/secondaryToolbarButton-spreadNone.svg +3 -0
  54. package/dist/images/secondaryToolbarButton-spreadOdd.svg +3 -0
  55. package/dist/images/signature-properties-row-check.svg +4 -0
  56. package/dist/images/toolbarButton-bookmark.svg +3 -0
  57. package/dist/images/toolbarButton-currentOutlineItem.svg +3 -0
  58. package/dist/images/toolbarButton-download.svg +4 -0
  59. package/dist/images/toolbarButton-editorFreeText.svg +5 -0
  60. package/dist/images/toolbarButton-editorHighlight.svg +6 -0
  61. package/dist/images/toolbarButton-editorInk.svg +4 -0
  62. package/dist/images/toolbarButton-editorSignature.svg +6 -0
  63. package/dist/images/toolbarButton-editorStamp.svg +8 -0
  64. package/dist/images/toolbarButton-menuArrow.svg +3 -0
  65. package/dist/images/toolbarButton-menuArrowNova.svg +3 -0
  66. package/dist/images/toolbarButton-openFile.svg +3 -0
  67. package/dist/images/toolbarButton-pageDown.svg +3 -0
  68. package/dist/images/toolbarButton-pageUp.svg +3 -0
  69. package/dist/images/toolbarButton-presentationMode.svg +3 -0
  70. package/dist/images/toolbarButton-print.svg +3 -0
  71. package/dist/images/toolbarButton-search.svg +3 -0
  72. package/dist/images/toolbarButton-secondaryToolbarToggle.svg +3 -0
  73. package/dist/images/toolbarButton-signaturePropertiesError.svg +7 -0
  74. package/dist/images/toolbarButton-signaturePropertiesVerified.svg +7 -0
  75. package/dist/images/toolbarButton-viewAttachments.svg +3 -0
  76. package/dist/images/toolbarButton-viewLayers.svg +3 -0
  77. package/dist/images/toolbarButton-viewOutline.svg +3 -0
  78. package/dist/images/toolbarButton-viewThumbnail.svg +3 -0
  79. package/dist/images/toolbarButton-viewsManagerToggle.svg +3 -0
  80. package/dist/images/toolbarButton-zoomIn.svg +3 -0
  81. package/dist/images/toolbarButton-zoomOut.svg +3 -0
  82. package/dist/images/treeitem-collapsed.svg +1 -0
  83. package/dist/images/treeitem-expanded.svg +1 -0
  84. package/dist/pdf/PdfDocumentSurface.d.ts +71 -0
  85. package/dist/pdf/PdfDocumentSurface.js +235 -0
  86. package/dist/pdf/localization.d.ts +21 -0
  87. package/dist/pdf/localization.js +50 -0
  88. package/dist/pdf.css +6428 -0
  89. package/dist/pdf.d.ts +5 -0
  90. package/dist/pdf.js +7 -0
  91. package/package.json +16 -4
  92. package/scripts/pdf-assets.d.mts +2 -0
  93. package/scripts/pdf-assets.mjs +52 -0
package/dist/pdf.d.ts ADDED
@@ -0,0 +1,5 @@
1
+ export { openPdfDocument, PdfDocumentSurface } from './pdf/PdfDocumentSurface';
2
+ export type { PdfSurfaceOptions, PdfEditorState, PdfSearchState, PdfPageRenderer } from './pdf/PdfDocumentSurface';
3
+ export type { PDFDocumentProxy, PDFPageProxy } from 'pdfjs-dist';
4
+ export { PdfLocalization } from './pdf/localization';
5
+ export type { PdfLocalize, PdfLocalizedMessage } from './pdf/localization';
package/dist/pdf.js ADDED
@@ -0,0 +1,7 @@
1
+ import { PdfDocumentSurface as f, openPdfDocument as r } from "./pdf/PdfDocumentSurface.js";
2
+ import { PdfLocalization as c } from "./pdf/localization.js";
3
+ export {
4
+ f as PdfDocumentSurface,
5
+ c as PdfLocalization,
6
+ r as openPdfDocument
7
+ };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@floegence/floe-webapp-core",
3
- "version": "0.64.0",
3
+ "version": "0.65.0",
4
4
  "license": "MIT",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",
@@ -91,15 +91,26 @@
91
91
  },
92
92
  "./styles": "./dist/styles.css",
93
93
  "./tailwind": "./dist/tailwind.css",
94
- "./input-focus.css": "./dist/input-focus.css"
94
+ "./input-focus.css": "./dist/input-focus.css",
95
+ "./pdf": {
96
+ "types": "./dist/pdf.d.ts",
97
+ "import": "./dist/pdf.js"
98
+ },
99
+ "./pdf.css": "./dist/pdf.css",
100
+ "./pdf-assets": {
101
+ "types": "./scripts/pdf-assets.d.mts",
102
+ "import": "./scripts/pdf-assets.mjs"
103
+ }
95
104
  },
96
105
  "files": [
97
- "dist"
106
+ "dist",
107
+ "scripts/pdf-assets.mjs",
108
+ "scripts/pdf-assets.d.mts"
98
109
  ],
99
110
  "scripts": {
100
111
  "dev": "node ./scripts/dev.mjs",
101
112
  "build": "pnpm clean && pnpm build:shell-theme-css && vite build && tsc -p tsconfig.build.json && pnpm build:styles && pnpm build:assets",
102
- "build:assets": "node ./scripts/copy-style-assets.mjs",
113
+ "build:assets": "node ./scripts/copy-style-assets.mjs && node ./scripts/build-pdf-styles.mjs",
103
114
  "build:shell-theme-css": "node ./scripts/generate-shell-theme-css.mjs",
104
115
  "build:styles": "vite build -c vite.styles.config.ts",
105
116
  "typecheck": "tsc --noEmit",
@@ -114,6 +125,7 @@
114
125
  "marked": "^17.0.1",
115
126
  "mermaid": "^11.16.0",
116
127
  "monaco-editor": "^0.55.1",
128
+ "pdfjs-dist": "6.3.289",
117
129
  "shiki": "^3.21.0",
118
130
  "solid-motionone": "^1.0.4",
119
131
  "tailwind-merge": "^3.4.0"
@@ -0,0 +1,2 @@
1
+ /** Vite asset adapter for the pinned PDF.js distribution. */
2
+ export function pdfAssetsPlugin(): import('vite').Plugin;
@@ -0,0 +1,52 @@
1
+ import { URL } from 'node:url';
2
+ import { createRequire } from 'node:module';
3
+ import { dirname, join } from 'node:path';
4
+ import { readdirSync, readFileSync } from 'node:fs';
5
+
6
+ const require = createRequire(import.meta.url);
7
+ const root = dirname(require.resolve('pdfjs-dist/package.json'));
8
+ const version = JSON.parse(readFileSync(join(root, 'package.json'), 'utf8')).version;
9
+ const prefix = `pdf-assets/${version}/`;
10
+ const files = new Map();
11
+ function collect(directory) {
12
+ for (const entry of readdirSync(join(root, directory), { withFileTypes: true })) {
13
+ const file = join(directory, entry.name);
14
+ if (entry.isDirectory()) collect(file);
15
+ else files.set(file.replaceAll('\\', '/'), join(root, file));
16
+ }
17
+ }
18
+ for (const directory of ['cmaps', 'standard_fonts', 'wasm', 'iccs', 'web/images']) collect(directory);
19
+ files.set('pdf.worker.min.mjs', join(root, 'build/pdf.worker.min.mjs'));
20
+ files.set('LICENSE', join(root, 'LICENSE'));
21
+ for (const [name, path] of [...files]) if (name.startsWith('web/')) {
22
+ files.delete(name); files.set(name.slice(4), path);
23
+ }
24
+
25
+ /** Vite-compatible asset plugin. Keeps workers, CMaps, fonts, codecs and their
26
+ * original notices self-hosted and versioned, outside the initial JS graph. */
27
+ export function pdfAssetsPlugin() {
28
+ let base = '/';
29
+ return {
30
+ name: 'floe-pdf-assets',
31
+ configResolved(config) { base = config.base; },
32
+ resolveId(id) { if (id === 'virtual:floe-pdf-assets') return '\0virtual:floe-pdf-assets'; },
33
+ load(id) {
34
+ if (id === '\0virtual:floe-pdf-assets') return `export default new URL(${JSON.stringify(base + prefix)}, globalThis.location.href).href;`;
35
+ },
36
+ configureServer(server) {
37
+ server.middlewares.use((req, res, next) => {
38
+ const pathname = new URL(req.url, 'http://localhost').pathname;
39
+ const candidates = [base + prefix, '/' + prefix];
40
+ const matched = candidates.find(candidate => pathname.startsWith(candidate));
41
+ const file = matched && files.get(pathname.slice(matched.length));
42
+ if (!file) return next();
43
+ const type = file.endsWith('.mjs') ? 'text/javascript' : file.endsWith('.svg') ? 'image/svg+xml' : file.endsWith('.wasm') ? 'application/wasm' : 'application/octet-stream';
44
+ res.setHeader('Content-Type', type);
45
+ res.end(readFileSync(file));
46
+ });
47
+ },
48
+ generateBundle() {
49
+ for (const [name, file] of files) this.emitFile({ type: 'asset', fileName: prefix + name, source: readFileSync(file) });
50
+ },
51
+ };
52
+ }