@w100n/documents 0.4.0 → 0.10.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 (55) hide show
  1. package/dist/SheetView-3XTEV2VT.css +319 -0
  2. package/dist/SheetView-3XTEV2VT.css.map +1 -0
  3. package/dist/SheetView-JYH2ZUZF.js +928 -0
  4. package/dist/SheetView-JYH2ZUZF.js.map +1 -0
  5. package/dist/TextEditor-X3X62R46.js +982 -0
  6. package/dist/TextEditor-X3X62R46.js.map +1 -0
  7. package/dist/caveat-cyrillic-XVO43JCM.woff2 +0 -0
  8. package/dist/caveat-latin-IUBKKMHQ.woff2 +0 -0
  9. package/dist/caveat-latin-ext-5S7R5SZN.woff2 +0 -0
  10. package/dist/chunk-CE3AADY6.js +3447 -0
  11. package/dist/chunk-CE3AADY6.js.map +1 -0
  12. package/dist/chunk-ISOOUYLI.js +150 -0
  13. package/dist/chunk-ISOOUYLI.js.map +1 -0
  14. package/dist/{chunk-KEV4R7W5.js → chunk-K364NAYP.js} +4 -1
  15. package/dist/chunk-K364NAYP.js.map +1 -0
  16. package/dist/chunk-QDH7EZAF.js +27 -0
  17. package/dist/chunk-QDH7EZAF.js.map +1 -0
  18. package/dist/chunk-SVRYWMES.js +196 -0
  19. package/dist/chunk-SVRYWMES.js.map +1 -0
  20. package/dist/chunk-TDP6OJET.js +31 -0
  21. package/dist/chunk-TDP6OJET.js.map +1 -0
  22. package/dist/chunk-TNSN4ZQ5.js +2909 -0
  23. package/dist/chunk-TNSN4ZQ5.js.map +1 -0
  24. package/dist/collab.cjs +6312 -0
  25. package/dist/collab.cjs.map +1 -0
  26. package/dist/collab.d.cts +39 -0
  27. package/dist/collab.d.ts +39 -0
  28. package/dist/collab.js +30 -0
  29. package/dist/collab.js.map +1 -0
  30. package/dist/grid-EI5JNZAA.js +88 -0
  31. package/dist/grid-EI5JNZAA.js.map +1 -0
  32. package/dist/index.cjs +12134 -457
  33. package/dist/index.cjs.map +1 -1
  34. package/dist/index.css +2999 -95
  35. package/dist/index.css.map +1 -1
  36. package/dist/index.d.cts +143 -6
  37. package/dist/index.d.ts +143 -6
  38. package/dist/index.js +3377 -450
  39. package/dist/index.js.map +1 -1
  40. package/dist/memory.cjs +59 -7
  41. package/dist/memory.cjs.map +1 -1
  42. package/dist/memory.d.cts +7 -2
  43. package/dist/memory.d.ts +7 -2
  44. package/dist/memory.js +57 -8
  45. package/dist/memory.js.map +1 -1
  46. package/dist/pdfWrite-EM6GJDBF.js +76 -0
  47. package/dist/pdfWrite-EM6GJDBF.js.map +1 -0
  48. package/dist/types-B5oF25dn.d.cts +165 -0
  49. package/dist/types-B5oF25dn.d.ts +165 -0
  50. package/dist/write-DaVtTJCS.d.cts +6 -0
  51. package/dist/write-DaVtTJCS.d.ts +6 -0
  52. package/package.json +45 -3
  53. package/dist/chunk-KEV4R7W5.js.map +0 -1
  54. package/dist/types-DshXPnWA.d.cts +0 -62
  55. package/dist/types-DshXPnWA.d.ts +0 -62
package/dist/index.d.ts CHANGED
@@ -1,20 +1,67 @@
1
1
  import * as react from 'react';
2
- import { ReactNode } from 'react';
3
- import { D as DocumentsHost, L as Language, P as Place, a as DocumentFile, b as DocumentKind } from './types-DshXPnWA.js';
4
- export { c as DocumentSummary, d as DocumentVersion, F as Fetch, e as Person, R as Rights, S as Space } from './types-DshXPnWA.js';
2
+ import { ReactNode, RefObject } from 'react';
3
+ import { L as Language, D as DocumentsHost, P as Place, a as DocumentFile, G as GuestHost, b as DocumentKind, R as Rights } from './types-B5oF25dn.js';
4
+ export { C as Comment, c as DocumentSummary, d as DocumentVersion, F as Fetch, e as GuestFile, f as GuestLink, g as LinkEntry, h as Person, S as Signature, i as SignatureMethod, j as Space } from './types-B5oF25dn.js';
5
+ import { JSONContent } from '@tiptap/core';
6
+ import { I as Img } from './write-DaVtTJCS.js';
5
7
 
8
+ type DocxModel = {
9
+ doc: JSONContent;
10
+ styles: {
11
+ name: string;
12
+ id: string;
13
+ heading: number | null;
14
+ }[];
15
+ page: {
16
+ width: number;
17
+ height: number;
18
+ margins: [number, number, number, number];
19
+ };
20
+ };
21
+ declare function readDocx(bytes: ArrayBuffer): Promise<DocxModel>;
22
+ declare function writeDocx(original: ArrayBuffer, doc: JSONContent, load?: (src: string) => Promise<Img>): Promise<ArrayBuffer>;
23
+
24
+ declare function DocumentOverlay({ source, name, info, download, onClose, onOpen, language, theme, worker, host, documentId }: {
25
+ source: ArrayBuffer | Blob | string;
26
+ name: string;
27
+ info?: string;
28
+ download?: string;
29
+ onClose: () => void;
30
+ onOpen?: () => void;
31
+ language?: Language;
32
+ theme?: 'light' | 'dark';
33
+ worker?: () => Worker;
34
+ host?: DocumentsHost;
35
+ documentId?: string;
36
+ }): react.ReactPortal;
37
+
38
+ type Slot = ReactNode | ((leave: (then: () => void) => void) => ReactNode);
6
39
  declare function DocumentsWorkspace({ host, language, theme, place, onPlace, start, end, aside, actions }: {
7
40
  host: DocumentsHost;
8
41
  language?: Language;
9
42
  theme?: 'light' | 'dark';
10
43
  place?: Place;
11
44
  onPlace?: (place: Place) => void;
12
- start?: ReactNode;
13
- end?: ReactNode;
45
+ start?: Slot;
46
+ end?: Slot;
14
47
  aside?: (doc: DocumentFile) => ReactNode;
15
48
  actions?: (doc: DocumentFile) => ReactNode;
16
49
  }): react.JSX.Element;
17
50
 
51
+ type GuestRefusal = 'missing' | 'ended' | 'password' | 'wrong' | 'name' | 'busy';
52
+ declare class GuestRefused extends Error {
53
+ readonly reason: GuestRefusal;
54
+ readonly file: string;
55
+ readonly sharedBy: string;
56
+ constructor(reason: GuestRefusal, file?: string, sharedBy?: string);
57
+ }
58
+ declare function GuestDocument({ host, language, theme, brand }: {
59
+ host: GuestHost;
60
+ language?: Language;
61
+ theme?: 'light' | 'dark';
62
+ brand?: ReactNode;
63
+ }): react.JSX.Element;
64
+
18
65
  declare const kinds: DocumentKind[];
19
66
  declare function kindOf(name: string, mimeType?: string | null): DocumentKind | null;
20
67
  declare function matches(doc: {
@@ -22,4 +69,94 @@ declare function matches(doc: {
22
69
  kind: DocumentKind;
23
70
  }, query: string, kind: DocumentKind | 'all'): boolean;
24
71
 
25
- export { DocumentFile, DocumentKind, DocumentsHost, DocumentsWorkspace, Language, Place, kindOf, kinds, matches };
72
+ type Attr = {
73
+ value: string;
74
+ at: [number, number] | null;
75
+ };
76
+ type Text = {
77
+ text: true;
78
+ start: number;
79
+ end: number;
80
+ };
81
+ type El = {
82
+ text?: undefined;
83
+ tag: string;
84
+ attrs: Map<string, Attr>;
85
+ start: number;
86
+ open: number;
87
+ close: number;
88
+ end: number;
89
+ children: (El | Text)[];
90
+ parent: El | null;
91
+ };
92
+
93
+ type DeckKind = 'reveal' | 'marked' | 'sections' | 'page';
94
+ type Block = {
95
+ id: number;
96
+ html: string;
97
+ };
98
+ type Slide = {
99
+ key: string;
100
+ from: number;
101
+ stack: number | null;
102
+ title: string;
103
+ head: number | null;
104
+ notes: string;
105
+ blocks: Block[];
106
+ };
107
+ type Deck = {
108
+ kind: DeckKind;
109
+ width: number;
110
+ height: number;
111
+ center: boolean;
112
+ slides: Slide[];
113
+ };
114
+ type Spot = {
115
+ el: El;
116
+ stack: number | null;
117
+ notes: El | null;
118
+ attr: Attr | null;
119
+ blocks: El[];
120
+ };
121
+ type Shape = {
122
+ kind: DeckKind;
123
+ width: number;
124
+ height: number;
125
+ center: boolean;
126
+ root: El;
127
+ box: El;
128
+ units: El[];
129
+ stacks: El[];
130
+ spots: Spot[];
131
+ scripts: El[];
132
+ refresh: El[];
133
+ head: number;
134
+ body: El | null;
135
+ };
136
+ declare function readDeck(html: string, known?: Shape): Deck;
137
+ declare function writeDeck(original: string, deck: Deck, known?: Shape): string;
138
+
139
+ type Guard = RefObject<(() => Promise<boolean>) | null>;
140
+
141
+ type Heading = {
142
+ id: string;
143
+ level: number;
144
+ text: string;
145
+ go?: () => void;
146
+ };
147
+
148
+ declare function SlidesView({ html, name, rights, language, theme, baseUrl, scripts, onChange, onSaveRequest, onOutline, guard }: {
149
+ html: string;
150
+ name: string;
151
+ rights: Rights;
152
+ language?: Language;
153
+ theme?: 'light' | 'dark';
154
+ baseUrl?: string;
155
+ scripts?: boolean;
156
+ onChange?: (dirty: boolean) => void;
157
+ onSaveRequest?: (bytes: ArrayBuffer, note: string) => Promise<unknown>;
158
+ onOutline?: (list: Heading[]) => void;
159
+ guard?: Guard;
160
+ }): react.JSX.Element;
161
+
162
+ export { type Deck, type DeckKind, DocumentFile, DocumentKind, DocumentOverlay, DocumentsHost, DocumentsWorkspace, type DocxModel, GuestDocument, GuestHost, type GuestRefusal, GuestRefused, Language, Place, Rights, type Slide, SlidesView, kindOf, kinds, matches, readDeck, readDocx, writeDeck, writeDocx };