@floegence/floe-webapp-core 0.78.4 → 0.78.7

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.
@@ -1,24 +1,34 @@
1
- import { insert as f, effect as u, className as c, setAttribute as m, style as p, template as s, use as w } from "solid-js/web";
2
- import { createSignal as h, onMount as y, onCleanup as V, untrack as b } from "solid-js";
3
- import { viewportStyle as g, observeViewport as k } from "../../viewport.js";
4
- var x = /* @__PURE__ */ s("<div data-floe-app-viewport style=position:fixed;inset:0;overflow:hidden;min-height:0>");
5
- function D(r) {
6
- const [i, d] = h();
1
+ import { insert as d, effect as u, className as f, setAttribute as p, style as m, template as w, use as h } from "solid-js/web";
2
+ import { createSignal as V, onMount as b, onCleanup as s, untrack as y } from "solid-js";
3
+ import { viewportStyle as g, observeViewport as E } from "../../viewport.js";
4
+ var L = /* @__PURE__ */ w("<div data-floe-app-viewport style=position:fixed;inset:0;overflow:hidden;min-height:0>");
5
+ function A(o) {
6
+ const [i, v] = V();
7
7
  let n;
8
- return y(() => {
8
+ return b(() => {
9
9
  const e = n?.ownerDocument.defaultView;
10
- e && V(k(e, (o) => {
11
- d(o), b(() => r.onViewportChange?.(o));
10
+ if (!e) return;
11
+ const r = () => {
12
+ Math.abs((e.visualViewport?.scale ?? 1) - 1) >= 0.01 || (e.scrollX || e.scrollY) && e.scrollTo({
13
+ left: 0,
14
+ top: 0,
15
+ behavior: "instant"
16
+ });
17
+ };
18
+ e.addEventListener("scroll", r), e.visualViewport?.addEventListener("resize", r), r(), s(() => {
19
+ e.removeEventListener("scroll", r), e.visualViewport?.removeEventListener("resize", r);
20
+ }), s(E(e, (t) => {
21
+ v(t), y(() => o.onViewportChange?.(t));
12
22
  }));
13
23
  }), (() => {
14
- var e = x(), o = n;
15
- return typeof o == "function" ? w(o, e) : n = e, f(e, () => r.children), u((t) => {
16
- var a = r.class, v = i()?.keyboardOpen || void 0, l = {
24
+ var e = L(), r = n;
25
+ return typeof r == "function" ? h(r, e) : n = e, d(e, () => o.children), u((t) => {
26
+ var a = o.class, l = i()?.keyboardOpen || void 0, c = {
17
27
  ...i() ? g(i()) : {
18
28
  height: "100dvh"
19
29
  }
20
30
  };
21
- return a !== t.e && c(e, t.e = a), v !== t.t && m(e, "data-keyboard-open", t.t = v), t.a = p(e, l, t.a), t;
31
+ return a !== t.e && f(e, t.e = a), l !== t.t && p(e, "data-keyboard-open", t.t = l), t.a = m(e, c, t.a), t;
22
32
  }, {
23
33
  e: void 0,
24
34
  t: void 0,
@@ -27,5 +37,5 @@ function D(r) {
27
37
  })();
28
38
  }
29
39
  export {
30
- D as AppViewport
40
+ A as AppViewport
31
41
  };
@@ -1,6 +1,6 @@
1
- import { AnnotationEditorUIManager } from 'pdfjs-dist';
1
+ import { AnnotationEditorUIManager } from 'pdfjs-dist/legacy/build/pdf.mjs';
2
2
  import type { PDFDocumentProxy, PDFPageProxy } from 'pdfjs-dist';
3
- import { EventBus, PDFFindController, PDFLinkService, PDFPageView } from 'pdfjs-dist/web/pdf_viewer.mjs';
3
+ import { EventBus, PDFFindController, PDFLinkService, PDFPageView } from 'pdfjs-dist/legacy/web/pdf_viewer.mjs';
4
4
  export interface PdfEditorState {
5
5
  canUndo: boolean;
6
6
  canRedo: boolean;
@@ -28,7 +28,8 @@ export interface PdfPageRenderer {
28
28
  render: (scale: number) => Promise<void>;
29
29
  dispose: () => void;
30
30
  }
31
- /** All resources are served by the host; PDF JavaScript and XFA are not enabled. */
31
+ /** The official legacy runtime and worker support embedded clients without the
32
+ * newest JavaScript APIs. All resources are host-served; scripting and XFA are disabled. */
32
33
  export declare function openPdfDocument(bytes: Uint8Array<ArrayBuffer>, assetsUrl: string): import("pdfjs-dist/types/src/display/api").PDFDocumentLoadingTask;
33
34
  /** PDF.js defaults to a single viewer per document. Scope its public input handlers
34
35
  * so multiple embedded readers cannot consume each other's shortcuts or clipboard. */
@@ -1,5 +1,5 @@
1
- import { GlobalWorkerOptions as u, getDocument as f, AnnotationMode as c, AnnotationEditorUIManager as g } from "pdfjs-dist";
2
- import { GenericL10n as p, EventBus as m, PDFLinkService as v, PDFFindController as S, PDFPageView as b } from "pdfjs-dist/web/pdf_viewer.mjs";
1
+ import { GlobalWorkerOptions as u, getDocument as f, AnnotationMode as c, AnnotationEditorUIManager as g } from "pdfjs-dist/legacy/build/pdf.mjs";
2
+ import { GenericL10n as p, EventBus as m, PDFLinkService as v, PDFFindController as S, PDFPageView as b } from "pdfjs-dist/legacy/web/pdf_viewer.mjs";
3
3
  function C(h, e) {
4
4
  const n = new URL(e, document.baseURI).href.replace(/\/?$/, "/");
5
5
  return u.workerSrc = `${n}pdf.worker.min.mjs`, f({
@@ -1,4 +1,4 @@
1
- import { GenericL10n } from 'pdfjs-dist/web/pdf_viewer.mjs';
1
+ import { GenericL10n } from 'pdfjs-dist/legacy/web/pdf_viewer.mjs';
2
2
  export interface PdfLocalizedMessage {
3
3
  text?: string;
4
4
  attributes?: Partial<Record<'title' | 'aria-label' | 'alt' | 'placeholder', string>>;
@@ -1,4 +1,4 @@
1
- import { GenericL10n as o } from "pdfjs-dist/web/pdf_viewer.mjs";
1
+ import { GenericL10n as o } from "pdfjs-dist/legacy/web/pdf_viewer.mjs";
2
2
  class l extends o {
3
3
  constructor(t, a, i = "en-US") {
4
4
  super(i), this.root = t, this.localize = a, this.#t = new MutationObserver((e) => {
package/dist/pdf.css CHANGED
@@ -6410,7 +6410,7 @@ button.hasPopupMenu{
6410
6410
  }
6411
6411
 
6412
6412
  }
6413
- /* Import after pdfjs-dist/web/pdf_viewer.css. Layers use PDF page coordinates;
6413
+ /* Import after pdfjs-dist/legacy/web/pdf_viewer.css. Layers use PDF page coordinates;
6414
6414
  surrounding transforms belong to the host surface and need no compensating math. */
6415
6415
  .floe-pdf-page > .page {
6416
6416
  position: relative;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@floegence/floe-webapp-core",
3
- "version": "0.78.4",
3
+ "version": "0.78.7",
4
4
  "license": "MIT",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",
@@ -6,21 +6,20 @@ import { readdirSync, readFileSync } from 'node:fs';
6
6
  const require = createRequire(import.meta.url);
7
7
  const root = dirname(require.resolve('pdfjs-dist/package.json'));
8
8
  const version = JSON.parse(readFileSync(join(root, 'package.json'), 'utf8')).version;
9
- const prefix = `pdf-assets/${version}/`;
9
+ const prefix = `pdf-assets/${version}/legacy/`;
10
10
  const files = new Map();
11
- function collect(directory) {
11
+ function collect(directory, outputDirectory = directory) {
12
12
  for (const entry of readdirSync(join(root, directory), { withFileTypes: true })) {
13
13
  const file = join(directory, entry.name);
14
- if (entry.isDirectory()) collect(file);
15
- else files.set(file.replaceAll('\\', '/'), join(root, file));
14
+ const output = join(outputDirectory, entry.name);
15
+ if (entry.isDirectory()) collect(file, output);
16
+ else files.set(output.replaceAll('\\', '/'), join(root, file));
16
17
  }
17
18
  }
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'));
19
+ for (const directory of ['cmaps', 'standard_fonts', 'wasm', 'iccs']) collect(directory);
20
+ collect('legacy/web/images', 'images');
21
+ files.set('pdf.worker.min.mjs', join(root, 'legacy/build/pdf.worker.min.mjs'));
20
22
  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
23
 
25
24
  /** Vite-compatible asset plugin. Keeps workers, CMaps, fonts, codecs and their
26
25
  * original notices self-hosted and versioned, outside the initial JS graph. */