calmlens 0.20.0 → 0.21.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/README.md +13 -9
- package/bin/calmlens.js +1329 -664
- package/cjs/{BrowserUpload-CjSHjx3C.js → BrowserUpload-CeSwiMo5.js} +1 -1
- package/cjs/{BrowserUpload-C07aL9Vq.d.ts → BrowserUpload-D-NnAN7g.d.ts} +2 -2
- package/cjs/{CalmLensAppClient-NaCxOVlM.js → CalmLensAppClient-0UVCuNqW.js} +30 -10
- package/cjs/{CalmLensAppClient-DDLojj0P.d.ts → CalmLensAppClient-gG16T2py.d.ts} +13 -3
- package/cjs/{CalmLensOptionKeys-p2QK687A.js → CalmLensOptionKeys-CYY6elxg.js} +183 -347
- package/cjs/{CalmLensServerClient-C-jsjn8m.d.ts → CalmLensServerClient-BHx3x_nZ.d.ts} +106 -48
- package/cjs/{CalmLensServerClient-BDzTthxE.js → CalmLensServerClient-nfu6_YEW.js} +288 -88
- package/cjs/{CalmLensTypes-COJbOuiv.d.ts → CalmLensTypes-CUB0YYVz.d.ts} +26601 -27354
- package/cjs/{Classification-D3SkprrQ-CMnQKW13.d.ts → Classification-Q5zGpR8l-CEWjnE39.d.ts} +731 -607
- package/cjs/Core-C82YmjjX.d.ts +823 -0
- package/cjs/Core-Dc3cteU7.js +998 -0
- package/cjs/FileIcons-4qSX7DW2.d.ts +67 -0
- package/cjs/{ModerationContextLimits-2nIv7Zh3.js → ModerationContextLimits-BxOmeSqq.js} +669 -269
- package/cjs/{ReactUpload-BdTRCTGA.js → ReactUpload-BK2O3dnK.js} +1 -1
- package/cjs/{ReactUpload-CRJNPB5T.d.ts → ReactUpload-DiiXfKvj.d.ts} +1 -1
- package/cjs/{TestTriggers-DbhsNPdg-DjvVuc2h.js → TestTriggers-BTyXtX0Q-ATuFDhLX.js} +342 -34
- package/{esm/TestTriggers-D-fwfhEP-hlaP1oW2.d.ts → cjs/TestTriggers-D0pYHbkr-D5T0VdSn.d.ts} +146 -8
- package/cjs/{UploadController-MLVs97Zt.js → UploadController-DLyiLDTB.js} +34 -14
- package/cjs/{WebhookPayload-DkukERKE.d.ts → WebhookPayload-BLT2y_Jy.d.ts} +93 -86
- package/cjs/app.d.ts +6 -7
- package/cjs/app.js +4 -3
- package/cjs/elements.d.ts +123 -22
- package/cjs/elements.js +553 -156
- package/cjs/file-icons.d.ts +2 -67
- package/cjs/index-CKRgjV16.d.ts +16 -0
- package/cjs/index.d.ts +5 -6
- package/cjs/index.js +3 -2
- package/cjs/react-native.d.ts +52 -11
- package/cjs/react-native.js +231 -99
- package/cjs/react.d.ts +42 -9
- package/cjs/react.js +381 -118
- package/cjs/server.d.ts +48 -7
- package/cjs/server.js +7 -3
- package/cjs/test-inputs.d.ts +2 -2
- package/cjs/test-inputs.js +13 -9
- package/cjs/testing.d.ts +24 -14
- package/cjs/testing.js +1413 -402
- package/cjs/ui-CTBUxnVp.d.ts +139 -0
- package/cjs/ui-CZ8exACq.js +1359 -0
- package/cjs/ui.d.ts +3 -2
- package/cjs/ui.js +45 -22
- package/cjs/vue.d.ts +802 -199
- package/cjs/vue.js +359 -127
- package/esm/{BrowserUpload-C07aL9Vq.d.ts → BrowserUpload-D-NnAN7g.d.ts} +2 -2
- package/esm/{BrowserUpload-CAVkRotw.js → BrowserUpload-i9OhCzMJ.js} +1 -1
- package/esm/{CalmLensAppClient-PQ9VBvlW.js → CalmLensAppClient-CK4_Py0c.js} +30 -10
- package/esm/{CalmLensAppClient-DDLojj0P.d.ts → CalmLensAppClient-gG16T2py.d.ts} +13 -3
- package/esm/{CalmLensOptionKeys-Do2mPP6w.js → CalmLensOptionKeys-BGZlIsT2.js} +182 -340
- package/esm/{CalmLensServerClient-C-jsjn8m.d.ts → CalmLensServerClient-BHx3x_nZ.d.ts} +106 -48
- package/esm/{CalmLensServerClient-C_H5aAsV.js → CalmLensServerClient-dAQUcDWb.js} +265 -89
- package/esm/{CalmLensTypes-COJbOuiv.d.ts → CalmLensTypes-CUB0YYVz.d.ts} +26601 -27354
- package/esm/{Classification-D3SkprrQ-CMnQKW13.d.ts → Classification-Q5zGpR8l-CEWjnE39.d.ts} +731 -607
- package/esm/Core-BxeIud_S.js +843 -0
- package/esm/Core-C82YmjjX.d.ts +823 -0
- package/esm/FileIcons-4qSX7DW2.d.ts +67 -0
- package/esm/{ModerationContextLimits-Chw-AzgL.js → ModerationContextLimits-B6_RalCQ.js} +624 -254
- package/esm/{ReactUpload-CRJNPB5T.d.ts → ReactUpload-DiiXfKvj.d.ts} +1 -1
- package/esm/{ReactUpload-CMmL0R5Q.js → ReactUpload-DxwVqfX1.js} +1 -1
- package/esm/{TestTriggers-DbhsNPdg-CUdrv8Nm.js → TestTriggers-BTyXtX0Q-GRB9jQwo.js} +319 -35
- package/{cjs/TestTriggers-D-fwfhEP-hlaP1oW2.d.ts → esm/TestTriggers-D0pYHbkr-D5T0VdSn.d.ts} +146 -8
- package/esm/{UploadController-BJZghJpg.js → UploadController-D9Z-h00Q.js} +34 -14
- package/esm/{WebhookPayload-DkukERKE.d.ts → WebhookPayload-BLT2y_Jy.d.ts} +93 -86
- package/esm/app.d.ts +6 -7
- package/esm/app.js +3 -3
- package/esm/elements.d.ts +123 -22
- package/esm/elements.js +497 -128
- package/esm/file-icons.d.ts +2 -67
- package/esm/index-CKRgjV16.d.ts +16 -0
- package/esm/index.d.ts +5 -6
- package/esm/index.js +1 -1
- package/esm/react-native.d.ts +52 -11
- package/esm/react-native.js +205 -75
- package/esm/react.d.ts +42 -9
- package/esm/react.js +327 -91
- package/esm/server.d.ts +48 -7
- package/esm/server.js +3 -3
- package/esm/styles.css +142 -22
- package/esm/svelte/AssetViewer.svelte +25 -0
- package/esm/svelte/CalmLensAsset.svelte +318 -0
- package/esm/svelte/CalmLensDocumentViewer.svelte +7 -0
- package/esm/svelte/CalmLensImageViewer.svelte +7 -0
- package/esm/svelte/CalmLensSpreadsheetViewer.svelte +7 -0
- package/esm/svelte/CalmLensTextViewer.svelte +7 -0
- package/esm/svelte/CalmLensWebsiteViewer.svelte +7 -0
- package/esm/svelte/index.d.ts +29 -6
- package/esm/svelte/index.js +7 -2
- package/esm/test-inputs.d.ts +2 -2
- package/esm/test-inputs.js +1 -1
- package/esm/testing.d.ts +24 -14
- package/esm/testing.js +1409 -398
- package/esm/ui-CTBUxnVp.d.ts +139 -0
- package/esm/ui-Cr7s6JHm.js +1258 -0
- package/esm/ui.d.ts +3 -2
- package/esm/ui.js +4 -3
- package/esm/vue.d.ts +802 -199
- package/esm/vue.js +308 -103
- package/package.json +3 -1
- package/cjs/ModerationContext-9lGm-Mna-CcmbRnOy.d.ts +0 -67
- package/cjs/index-DxbJ_Xaa.d.ts +0 -253
- package/cjs/ui-BSqPGKrZ.d.ts +0 -539
- package/cjs/ui-CX1z2pD9.js +0 -586
- package/esm/ModerationContext-9lGm-Mna-CcmbRnOy.d.ts +0 -67
- package/esm/index-DxbJ_Xaa.d.ts +0 -253
- package/esm/svelte/CalmLensMedia.svelte +0 -134
- package/esm/ui-BSqPGKrZ.d.ts +0 -539
- package/esm/ui-CXH7xJpb.js +0 -461
|
@@ -0,0 +1,139 @@
|
|
|
1
|
+
import "./CalmLensTypes-CUB0YYVz.js";
|
|
2
|
+
import { G as AssetSession, W as AssetOptions, Y as AssetView, at as ImageViewerOptions, ct as TextViewerOptions, ft as WebsiteViewerOptions, it as DocumentViewerOptions, ot as PdfAssetOptions, st as SpreadsheetViewerOptions, ut as ViewerOptions } from "./Core-C82YmjjX.js";
|
|
3
|
+
import "pdfjs-dist";
|
|
4
|
+
/** A viewer mounted into an element, which it owns the children of. */
|
|
5
|
+
interface AssetViewer<O extends ViewerOptions = ViewerOptions> {
|
|
6
|
+
/** Shows new options, loading again only when what is shown changed. */
|
|
7
|
+
update(options: O): void;
|
|
8
|
+
/** Stops loading and empties the element. */
|
|
9
|
+
destroy(): void;
|
|
10
|
+
}
|
|
11
|
+
type ViewerState = "loading" | "loaded" | "error";
|
|
12
|
+
/** Shows a PDF, or a document rendered as one, in `root`. */
|
|
13
|
+
declare const createDocumentViewer: (root: HTMLElement, options: DocumentViewerOptions) => AssetViewer<DocumentViewerOptions>;
|
|
14
|
+
/** Shows an image asset's rendered file in `root`. */
|
|
15
|
+
declare const createImageViewer: (root: HTMLElement, options: ImageViewerOptions) => AssetViewer<ImageViewerOptions>;
|
|
16
|
+
/** Shows a website asset's screenshot and a link to the page in `root`. */
|
|
17
|
+
declare const createWebsiteViewer: (root: HTMLElement, options: WebsiteViewerOptions) => AssetViewer<WebsiteViewerOptions>;
|
|
18
|
+
type PdfJs = typeof import("pdfjs-dist");
|
|
19
|
+
/**
|
|
20
|
+
* Loads pdf.js, the first time a document viewer needs it: never at import, so pages without
|
|
21
|
+
* documents never download it. With `workerSrc`, pdf.js reads documents in a worker loaded from
|
|
22
|
+
* your app; otherwise its worker module is imported too and reads them on the main thread.
|
|
23
|
+
*/
|
|
24
|
+
declare const loadPdfJs: (options?: PdfAssetOptions) => Promise<PdfJs>;
|
|
25
|
+
/** One cell of a spreadsheet's extracted text. */
|
|
26
|
+
interface SpreadsheetCell {
|
|
27
|
+
/** Zero-based column index: 0 is column `A`. */
|
|
28
|
+
column: number;
|
|
29
|
+
/** The column's letters, such as `A` or `AB`. */
|
|
30
|
+
columnName: string;
|
|
31
|
+
/** Whether the cell's column is hidden in the workbook. */
|
|
32
|
+
hidden: boolean;
|
|
33
|
+
/** The cell's value, then any `(formula: …)` and `(link: …)` notes. */
|
|
34
|
+
text: string;
|
|
35
|
+
}
|
|
36
|
+
interface SpreadsheetRow {
|
|
37
|
+
/** The one-based row number in the sheet. */
|
|
38
|
+
number: number;
|
|
39
|
+
hidden: boolean;
|
|
40
|
+
cells: SpreadsheetCell[];
|
|
41
|
+
}
|
|
42
|
+
interface SpreadsheetSheet {
|
|
43
|
+
name: string;
|
|
44
|
+
hidden: boolean;
|
|
45
|
+
/** The rows that have cells, in order. */
|
|
46
|
+
rows: SpreadsheetRow[];
|
|
47
|
+
/** The columns any row has a cell in, in order. */
|
|
48
|
+
columns: {
|
|
49
|
+
column: number;
|
|
50
|
+
columnName: string;
|
|
51
|
+
hidden: boolean;
|
|
52
|
+
}[];
|
|
53
|
+
/** The sheet's comments and chart titles, one line each. */
|
|
54
|
+
notes: string[];
|
|
55
|
+
}
|
|
56
|
+
/** A column's index from its letters: `A` is 0, `Z` 25 and `AA` 26. */
|
|
57
|
+
declare const spreadsheetColumnIndex: (name: string) => number;
|
|
58
|
+
/**
|
|
59
|
+
* Reads a spreadsheet's sheets from the text CalmLens extracts from it: a `# Sheet "name"` line
|
|
60
|
+
* per sheet (marked `(hidden)` when it is), then a `Row 3: A=… | B=…` line per row that has cells,
|
|
61
|
+
* then its comments and chart titles. A cell value that itself contains ` | B=` reads as two
|
|
62
|
+
* cells. Text before the first sheet heading, as in a file that isn't a spreadsheet's text, reads
|
|
63
|
+
* as one unnamed sheet's notes.
|
|
64
|
+
*/
|
|
65
|
+
declare const parseSpreadsheetText: (text: string) => SpreadsheetSheet[];
|
|
66
|
+
/** The rows of one page of a sheet, with their one-based positions among the sheet's rows. */
|
|
67
|
+
declare const getSpreadsheetPage: (sheet: SpreadsheetSheet, page: number, pageSize: number) => {
|
|
68
|
+
rows: SpreadsheetRow[];
|
|
69
|
+
from: number;
|
|
70
|
+
to: number;
|
|
71
|
+
pages: number;
|
|
72
|
+
};
|
|
73
|
+
/** Shows text in `root`. */
|
|
74
|
+
declare const createTextViewer: (root: HTMLElement, options: TextViewerOptions) => AssetViewer<TextViewerOptions>;
|
|
75
|
+
/** Shows a spreadsheet's sheets in `root`. */
|
|
76
|
+
declare const createSpreadsheetViewer: (root: HTMLElement, options: SpreadsheetViewerOptions) => AssetViewer<SpreadsheetViewerOptions>;
|
|
77
|
+
/**
|
|
78
|
+
* The asset viewers' styles, part of the components' stylesheet (`calmlens/styles.css`). A viewer
|
|
79
|
+
* fills its element; give the element a height (an embed page's frame, or a box in your page),
|
|
80
|
+
* or it takes the image's shape, or a default height for documents, text and spreadsheets. Set
|
|
81
|
+
* `--calmlens-viewer-background` and `--calmlens-viewer-text` to match a page's own colours.
|
|
82
|
+
*/
|
|
83
|
+
declare const VIEWER_STYLES: string;
|
|
84
|
+
/** Each viewer's options, by the kind of viewer `getAssetViewerKind` names. */
|
|
85
|
+
interface AssetViewerOptionsByKind {
|
|
86
|
+
image: ImageViewerOptions;
|
|
87
|
+
website: WebsiteViewerOptions;
|
|
88
|
+
text: TextViewerOptions;
|
|
89
|
+
document: DocumentViewerOptions;
|
|
90
|
+
spreadsheet: SpreadsheetViewerOptions;
|
|
91
|
+
}
|
|
92
|
+
type AssetViewerName = keyof AssetViewerOptionsByKind;
|
|
93
|
+
/** Mounts each viewer, by kind, for the bindings. */
|
|
94
|
+
declare const ASSET_VIEWERS: { [K in AssetViewerName]: (root: HTMLElement, options: AssetViewerOptionsByKind[K]) => AssetViewer<AssetViewerOptionsByKind[K]>; };
|
|
95
|
+
/** The kinds of view `CalmLensAsset` shows through a viewer module. */
|
|
96
|
+
type MountedViewerKind = Extract<AssetView["kind"], "document" | "text" | "spreadsheet">;
|
|
97
|
+
declare const isMountedViewerKind: (kind: AssetView["kind"]) => kind is MountedViewerKind;
|
|
98
|
+
/**
|
|
99
|
+
* The viewer options for `CalmLensAsset`'s options: the asset URL in use, the info, and the
|
|
100
|
+
* session's refresh and unavailable notice, so the viewer follows the same asset URL.
|
|
101
|
+
*/
|
|
102
|
+
declare const getMountedViewerOptions: (options: AssetOptions & {
|
|
103
|
+
alt?: string;
|
|
104
|
+
}, session: AssetSession) => ViewerOptions & Record<string, unknown>;
|
|
105
|
+
/**
|
|
106
|
+
* Keeps the viewer for a document, text or spreadsheet view mounted in `root`, replacing it when
|
|
107
|
+
* the kind changes and destroying it when there is none. `onState` reports each state the viewer
|
|
108
|
+
* reaches (`loading`, `loaded`, `error`).
|
|
109
|
+
*/
|
|
110
|
+
declare class AssetViewerMount {
|
|
111
|
+
#private;
|
|
112
|
+
update(root: HTMLElement | null | undefined, kind: MountedViewerKind | undefined, options: ViewerOptions & Record<string, unknown>, onState?: (state: ViewerState) => void): void;
|
|
113
|
+
destroy(): void;
|
|
114
|
+
}
|
|
115
|
+
/**
|
|
116
|
+
* Plays the adaptive stream of `CalmLensAsset`'s video or audio, when its view has one: as the
|
|
117
|
+
* element's own source where the browser plays HLS (Safari and iOS), through hls.js where it has
|
|
118
|
+
* Media Source Extensions (hls.js loads only then), and otherwise, or once the stream fails, from
|
|
119
|
+
* the rendered file. Without a stream the component sets the file as the element's `src` itself.
|
|
120
|
+
* `onExpired` runs when the stream's URL is refused, as an expired signed one is; it returns
|
|
121
|
+
* `true` when a fresh asset URL is on its way, which replaces the stream once it renders.
|
|
122
|
+
*/
|
|
123
|
+
declare class MediaStreamPlayer {
|
|
124
|
+
#private;
|
|
125
|
+
constructor(onExpired: (media: HTMLMediaElement) => boolean);
|
|
126
|
+
/**
|
|
127
|
+
* Call after every render with the video or audio element shown (or none) and the view: it
|
|
128
|
+
* starts, replaces or stops the stream when either changed.
|
|
129
|
+
*/
|
|
130
|
+
update(media: HTMLMediaElement | null | undefined, view: AssetView): void;
|
|
131
|
+
/**
|
|
132
|
+
* For a video or audio element's `error`: `true` when it switched from the stream to the
|
|
133
|
+
* rendered file. `false` means the file itself failed, for the component's session to handle.
|
|
134
|
+
*/
|
|
135
|
+
recover(media: HTMLMediaElement): boolean;
|
|
136
|
+
/** Stops the stream, when the component unmounts. */
|
|
137
|
+
stop(): void;
|
|
138
|
+
}
|
|
139
|
+
export { ViewerState as C, AssetViewer as S, spreadsheetColumnIndex as _, isMountedViewerKind as a, createWebsiteViewer as b, AssetViewerOptionsByKind as c, createTextViewer as d, SpreadsheetCell as f, parseSpreadsheetText as g, getSpreadsheetPage as h, getMountedViewerOptions as i, VIEWER_STYLES as l, SpreadsheetSheet as m, AssetViewerMount as n, ASSET_VIEWERS as o, SpreadsheetRow as p, MountedViewerKind as r, AssetViewerName as s, MediaStreamPlayer as t, createSpreadsheetViewer as u, loadPdfJs as v, createDocumentViewer as x, createImageViewer as y };
|