@tangle-network/ui 11.25.0 → 11.26.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 +6 -0
- package/README.md +22 -0
- package/dist/editor/editor-peers.js +1 -21
- package/dist/files/file-card.d.ts +30 -0
- package/dist/files/file-card.js +162 -0
- package/dist/files/file-list.d.ts +25 -0
- package/dist/files/file-list.js +88 -0
- package/dist/files/file-preview.js +16 -62
- package/dist/files/pdf-loader.d.ts +22 -0
- package/dist/files/pdf-loader.js +82 -0
- package/dist/files/pdf-viewer.d.ts +32 -0
- package/dist/files/pdf-viewer.js +567 -0
- package/dist/files.d.ts +5 -1
- package/dist/files.js +5 -1
- package/dist/index.d.ts +7 -3
- package/dist/index.js +5 -1
- package/dist/lib/optional-peer.js +29 -0
- package/dist/primitives.d.ts +2 -2
- package/package.json +6 -1
- package/src/editor/editor-peers.ts +3 -25
- package/src/files/file-artifact-pane.test.tsx +12 -2
- package/src/files/file-card.test.tsx +62 -0
- package/src/files/file-card.tsx +210 -0
- package/src/files/file-list.stories.tsx +121 -0
- package/src/files/file-list.test.tsx +81 -0
- package/src/files/file-list.tsx +167 -0
- package/src/files/file-preview.tsx +25 -94
- package/src/files/index.ts +9 -0
- package/src/files/pdf-loader.test.ts +130 -0
- package/src/files/pdf-loader.ts +169 -0
- package/src/files/pdf-viewer.stories.tsx +81 -0
- package/src/files/pdf-viewer.test.tsx +245 -0
- package/src/files/pdf-viewer.tsx +677 -0
- package/src/files/pdfjs-worker.d.ts +3 -0
- package/src/lib/optional-peer.ts +30 -0
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Shared handling for optional peers that an entry reaches through a dynamic
|
|
3
|
+
* `import()`: `./editor` for tiptap, yjs and Hocuspocus, `./files` for
|
|
4
|
+
* pdfjs-dist. `scripts/validate-dist.mjs` holds the rules these helpers serve.
|
|
5
|
+
*/
|
|
6
|
+
|
|
7
|
+
/** The messages a bundler or a runtime gives for a module it cannot resolve. */
|
|
8
|
+
const RESOLUTION_FAILURE =
|
|
9
|
+
/could not resolve|cannot find (?:module|package)|can't resolve|failed to resolve|module not found/i;
|
|
10
|
+
|
|
11
|
+
/**
|
|
12
|
+
* True when the rejection says the package is not installed. Only such an
|
|
13
|
+
* error gets the install list: a transient chunk-fetch failure that reads as
|
|
14
|
+
* "install the peers" sends the reader to the wrong fix. An error this
|
|
15
|
+
* predicate does not match keeps its own message, so it can only
|
|
16
|
+
* under-report.
|
|
17
|
+
*/
|
|
18
|
+
export function isMissingPeerError(error: unknown): boolean {
|
|
19
|
+
return error instanceof Error && RESOLUTION_FAILURE.test(error.message);
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
/**
|
|
23
|
+
* Hands an `import()` rejection on unchanged. esbuild reports an unresolvable
|
|
24
|
+
* literal `import()` as a build error and defers it to run time only when the
|
|
25
|
+
* call carries a `.catch()`, so every peer import attaches this handler. It
|
|
26
|
+
* changes nothing at run time.
|
|
27
|
+
*/
|
|
28
|
+
export function rethrow(error: unknown): never {
|
|
29
|
+
throw error;
|
|
30
|
+
}
|