@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
@@ -0,0 +1,165 @@
1
+ type DocumentKind = 'docx' | 'markdown' | 'pdf' | 'sheet' | 'slides';
2
+ type Language = 'en' | 'pl' | 'uk';
3
+ type Person = {
4
+ id: string;
5
+ name: string;
6
+ avatarUrl?: string | null;
7
+ };
8
+ type Space = {
9
+ id: string;
10
+ name: string;
11
+ color?: string | null;
12
+ group?: string | null;
13
+ };
14
+ type Rights = {
15
+ view: boolean;
16
+ comment: boolean;
17
+ edit: boolean;
18
+ };
19
+ type DocumentSummary = {
20
+ id: string;
21
+ spaceId: string;
22
+ name: string;
23
+ kind: DocumentKind;
24
+ size: number;
25
+ updatedAt: string;
26
+ updatedBy?: Person | null;
27
+ thumbnailUrl?: string | null;
28
+ excerpt?: string | null;
29
+ folder?: string | null;
30
+ };
31
+ type DocumentFile = DocumentSummary & {
32
+ rights: Rights;
33
+ mimeType?: string | null;
34
+ exports?: ('pdf' | 'docx' | 'md')[];
35
+ live?: boolean;
36
+ convert?: 'xlsx';
37
+ };
38
+ type DocumentVersion = {
39
+ id: string;
40
+ createdAt: string;
41
+ size: number;
42
+ author?: Person | null;
43
+ note?: string | null;
44
+ current: boolean;
45
+ };
46
+ type Fetch = {
47
+ signal?: AbortSignal;
48
+ };
49
+ type SignatureMethod = 'typed' | 'drawn' | 'image';
50
+ type Signature = {
51
+ id: string;
52
+ signer: Person;
53
+ signedAt: string;
54
+ page: number;
55
+ method: SignatureMethod;
56
+ versionId: string | null;
57
+ };
58
+ type Comment = {
59
+ id: string;
60
+ documentId: string;
61
+ author: Person;
62
+ body: string;
63
+ createdAt: string;
64
+ quote: string;
65
+ replyTo: string | null;
66
+ resolved: boolean;
67
+ };
68
+ type GuestLink = {
69
+ id: string;
70
+ url: string;
71
+ comment: boolean;
72
+ download: boolean;
73
+ askName: boolean;
74
+ password: boolean;
75
+ endsAt: string | null;
76
+ ended: boolean;
77
+ createdAt: string;
78
+ createdBy: Person;
79
+ guests: {
80
+ name: string;
81
+ opens: number;
82
+ comments: number;
83
+ lastAt: string;
84
+ }[];
85
+ };
86
+ type LinkEntry = {
87
+ comment: boolean;
88
+ download: boolean;
89
+ askName: boolean;
90
+ endsAt: string | null;
91
+ password: string | null;
92
+ };
93
+ type GuestFile = {
94
+ id: string;
95
+ name: string;
96
+ mimeType: string;
97
+ size: number;
98
+ updatedAt: string;
99
+ sharedBy: string;
100
+ comment: boolean;
101
+ download: boolean;
102
+ bytes: ArrayBuffer;
103
+ };
104
+ interface GuestHost {
105
+ pdfWorker?: () => Worker;
106
+ open(entry: {
107
+ password?: string;
108
+ name?: string;
109
+ }, opts?: Fetch): Promise<GuestFile>;
110
+ comments(opts?: Fetch): Promise<Comment[]>;
111
+ comment(entry: {
112
+ body: string;
113
+ quote: string;
114
+ replyTo: string | null;
115
+ anchor: string;
116
+ name: string;
117
+ }): Promise<Comment>;
118
+ download(format: 'file' | 'pdf'): Promise<void>;
119
+ }
120
+ interface DocumentsHost {
121
+ me: Person;
122
+ pdfWorker?: () => Worker;
123
+ spaces(opts?: Fetch): Promise<Space[]>;
124
+ documents(spaceId: string, opts?: Fetch): Promise<DocumentSummary[]>;
125
+ everything?(opts?: Fetch): Promise<DocumentSummary[]>;
126
+ document(id: string, opts?: Fetch): Promise<DocumentFile>;
127
+ versions(id: string, opts?: Fetch): Promise<DocumentVersion[]>;
128
+ content(id: string, versionId?: string | null, opts?: Fetch): Promise<ArrayBuffer>;
129
+ restore?(id: string, versionId: string): Promise<void>;
130
+ save?(id: string, bytes: ArrayBuffer, note: string): Promise<{
131
+ versionId: string;
132
+ }>;
133
+ signatures?(id: string, opts?: Fetch): Promise<Signature[]>;
134
+ sign?(id: string, entry: {
135
+ versionId: string;
136
+ page: number;
137
+ method: SignatureMethod;
138
+ }): Promise<Signature>;
139
+ comments?(id: string, opts?: Fetch): Promise<Comment[]>;
140
+ comment?(id: string, entry: {
141
+ body: string;
142
+ quote: string;
143
+ replyTo: string | null;
144
+ anchor: string;
145
+ }): Promise<Comment>;
146
+ resolveComment?(id: string, commentId: string, resolved: boolean): Promise<void>;
147
+ editComment?(id: string, commentId: string, body: string): Promise<Comment>;
148
+ deleteComment?(id: string, commentId: string): Promise<void>;
149
+ exportAs?(id: string, format: 'pdf' | 'docx' | 'md'): Promise<Blob>;
150
+ copyAs?(id: string, format: 'xlsx'): Promise<DocumentSummary>;
151
+ links?(id: string, opts?: Fetch): Promise<GuestLink[]>;
152
+ share?(id: string, entry: LinkEntry): Promise<GuestLink>;
153
+ relink?(linkId: string, entry: LinkEntry): Promise<GuestLink>;
154
+ unshare?(linkId: string): Promise<void>;
155
+ collab?: {
156
+ url: string;
157
+ token: () => Promise<string>;
158
+ };
159
+ }
160
+ type Place = {
161
+ spaceId: string | null;
162
+ documentId: string | null;
163
+ };
164
+
165
+ export type { Comment as C, DocumentsHost as D, Fetch as F, GuestHost as G, Language as L, Place as P, Rights as R, Signature as S, DocumentFile as a, DocumentKind as b, DocumentSummary as c, DocumentVersion as d, GuestFile as e, GuestLink as f, LinkEntry as g, Person as h, SignatureMethod as i, Space as j };
@@ -0,0 +1,6 @@
1
+ type Img = {
2
+ bytes: Uint8Array;
3
+ mime: string;
4
+ };
5
+
6
+ export type { Img as I };
@@ -0,0 +1,6 @@
1
+ type Img = {
2
+ bytes: Uint8Array;
3
+ mime: string;
4
+ };
5
+
6
+ export type { Img as I };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@w100n/documents",
3
- "version": "0.4.0",
3
+ "version": "0.10.0",
4
4
  "description": "Documents workspace for Web100Now projects: DOCX, Markdown, PDF, slides and sheets",
5
5
  "license": "MIT",
6
6
  "type": "module",
@@ -18,6 +18,11 @@
18
18
  "import": "./dist/memory.js",
19
19
  "require": "./dist/memory.cjs"
20
20
  },
21
+ "./collab": {
22
+ "types": "./dist/collab.d.ts",
23
+ "import": "./dist/collab.js",
24
+ "require": "./dist/collab.cjs"
25
+ },
21
26
  "./styles.css": "./dist/index.css",
22
27
  "./package.json": "./package.json"
23
28
  },
@@ -35,17 +40,54 @@
35
40
  "react-dom": ">=18"
36
41
  },
37
42
  "dependencies": {
43
+ "@embedpdf/engines": "^2.15.1",
44
+ "@embedpdf/models": "^2.15.1",
45
+ "@embedpdf/pdfium": "^2.15.1",
46
+ "@hocuspocus/provider": "^4.7.1",
47
+ "@tiptap/core": "^3.32.0",
48
+ "@tiptap/extension-collaboration": "^3.32.0",
49
+ "@tiptap/extension-collaboration-caret": "^3.32.0",
50
+ "@tiptap/extension-highlight": "^3.32.0",
51
+ "@tiptap/extension-image": "^3.32.0",
52
+ "@tiptap/extension-list": "^3.32.0",
53
+ "@tiptap/extension-table": "^3.32.0",
54
+ "@tiptap/extension-text-style": "^3.32.0",
55
+ "@tiptap/pm": "^3.32.0",
56
+ "@tiptap/react": "^3.32.0",
57
+ "@tiptap/starter-kit": "^3.32.0",
58
+ "@tiptap/y-tiptap": "^3.0.10",
59
+ "@univerjs/core": "1.0.4",
60
+ "@univerjs/preset-sheets-core": "1.0.4",
61
+ "@univerjs/preset-sheets-data-validation": "1.0.4",
62
+ "@univerjs/preset-sheets-filter": "1.0.4",
63
+ "@univerjs/preset-sheets-find-replace": "1.0.4",
64
+ "@univerjs/preset-sheets-note": "1.0.4",
65
+ "@univerjs/preset-sheets-sort": "1.0.4",
66
+ "@univerjs/presets": "1.0.4",
67
+ "@univerjs/sheets": "1.0.4",
38
68
  "docx-preview": "^0.4.1",
39
- "dompurify": "^3.4.17",
69
+ "fflate": "^0.8.3",
40
70
  "lucide-react": "^0.562.0",
41
71
  "marked": "^18.1.1",
42
- "pdfjs-dist": "^6.4.299"
72
+ "pdfjs-dist": "^6.4.299",
73
+ "prosemirror-markdown": "^1.13.8",
74
+ "rxjs": "^7.8.2",
75
+ "y-protocols": "^1.0.7",
76
+ "yjs": "^13.6.33"
43
77
  },
44
78
  "devDependencies": {
45
79
  "@testing-library/react": "^16.3.3",
80
+ "@types/node": "^22.20.5",
46
81
  "@types/react": "^19.0.0",
47
82
  "@types/react-dom": "^19.0.0",
83
+ "@univerjs/data-validation": "1.0.4",
84
+ "@univerjs/engine-formula": "1.0.4",
85
+ "@univerjs/sheets-data-validation": "1.0.4",
86
+ "@univerjs/sheets-filter": "1.0.4",
87
+ "@univerjs/sheets-formula": "1.0.4",
88
+ "@univerjs/sheets-note": "1.0.4",
48
89
  "@vitejs/plugin-react": "^5.0.5",
90
+ "exceljs": "4.4.0",
49
91
  "jsdom": "^30.1.3",
50
92
  "react": "^19.2.3",
51
93
  "react-dom": "^19.2.3",
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../src/kinds.ts"],"sourcesContent":["import type { DocumentKind } from './types';\n\nconst byExtension: Record<string, DocumentKind> = {\n docx: 'docx', md: 'markdown', markdown: 'markdown', pdf: 'pdf', xlsx: 'sheet', csv: 'sheet', html: 'slides', htm: 'slides',\n};\n\nconst byMime: Record<string, DocumentKind> = {\n 'application/vnd.openxmlformats-officedocument.wordprocessingml.document': 'docx',\n 'text/markdown': 'markdown',\n 'application/pdf': 'pdf',\n 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet': 'sheet',\n 'text/csv': 'sheet',\n 'text/html': 'slides',\n};\n\nexport const kinds: DocumentKind[] = ['docx', 'markdown', 'pdf', 'sheet', 'slides'];\n\nexport function kindOf(name: string, mimeType?: string | null): DocumentKind | null {\n const extension = name.includes('.') ? name.split('.').pop()!.toLowerCase() : '';\n return byExtension[extension] ?? (mimeType ? byMime[mimeType.split(';')[0].trim().toLowerCase()] : undefined) ?? null;\n}\n\nexport function matches(doc: { name: string; kind: DocumentKind }, query: string, kind: DocumentKind | 'all') {\n const words = query.toLocaleLowerCase().split(/\\s+/).filter(Boolean);\n return (kind === 'all' || doc.kind === kind) && words.every(word => doc.name.toLocaleLowerCase().includes(word));\n}\n"],"mappings":";;;AAEA,IAAM,cAA4C;AAAA,EAChD,MAAM;AAAA,EAAQ,IAAI;AAAA,EAAY,UAAU;AAAA,EAAY,KAAK;AAAA,EAAO,MAAM;AAAA,EAAS,KAAK;AAAA,EAAS,MAAM;AAAA,EAAU,KAAK;AACpH;AAEA,IAAM,SAAuC;AAAA,EAC3C,2EAA2E;AAAA,EAC3E,iBAAiB;AAAA,EACjB,mBAAmB;AAAA,EACnB,qEAAqE;AAAA,EACrE,YAAY;AAAA,EACZ,aAAa;AACf;AAEO,IAAM,QAAwB,CAAC,QAAQ,YAAY,OAAO,SAAS,QAAQ;AAE3E,SAAS,OAAO,MAAc,UAA+C;AAClF,QAAM,YAAY,KAAK,SAAS,GAAG,IAAI,KAAK,MAAM,GAAG,EAAE,IAAI,EAAG,YAAY,IAAI;AAC9E,SAAO,YAAY,SAAS,MAAM,WAAW,OAAO,SAAS,MAAM,GAAG,EAAE,CAAC,EAAE,KAAK,EAAE,YAAY,CAAC,IAAI,WAAc;AACnH;AAEO,SAAS,QAAQ,KAA2C,OAAe,MAA4B;AAC5G,QAAM,QAAQ,MAAM,kBAAkB,EAAE,MAAM,KAAK,EAAE,OAAO,OAAO;AACnE,UAAQ,SAAS,SAAS,IAAI,SAAS,SAAS,MAAM,MAAM,UAAQ,IAAI,KAAK,kBAAkB,EAAE,SAAS,IAAI,CAAC;AACjH;","names":[]}
@@ -1,62 +0,0 @@
1
- type DocumentKind = 'docx' | 'markdown' | 'pdf' | 'sheet' | 'slides';
2
- type Language = 'en' | 'pl' | 'uk';
3
- type Person = {
4
- id: string;
5
- name: string;
6
- avatarUrl?: string | null;
7
- };
8
- type Space = {
9
- id: string;
10
- name: string;
11
- color?: string | null;
12
- group?: string | null;
13
- };
14
- type Rights = {
15
- view: boolean;
16
- comment: boolean;
17
- edit: boolean;
18
- };
19
- type DocumentSummary = {
20
- id: string;
21
- spaceId: string;
22
- name: string;
23
- kind: DocumentKind;
24
- size: number;
25
- updatedAt: string;
26
- updatedBy?: Person | null;
27
- thumbnailUrl?: string | null;
28
- excerpt?: string | null;
29
- folder?: string | null;
30
- };
31
- type DocumentFile = DocumentSummary & {
32
- rights: Rights;
33
- mimeType?: string | null;
34
- };
35
- type DocumentVersion = {
36
- id: string;
37
- createdAt: string;
38
- size: number;
39
- author?: Person | null;
40
- note?: string | null;
41
- current: boolean;
42
- };
43
- type Fetch = {
44
- signal?: AbortSignal;
45
- };
46
- interface DocumentsHost {
47
- me: Person;
48
- pdfWorker?: () => Worker;
49
- spaces(opts?: Fetch): Promise<Space[]>;
50
- documents(spaceId: string, opts?: Fetch): Promise<DocumentSummary[]>;
51
- everything?(opts?: Fetch): Promise<DocumentSummary[]>;
52
- document(id: string, opts?: Fetch): Promise<DocumentFile>;
53
- versions(id: string, opts?: Fetch): Promise<DocumentVersion[]>;
54
- content(id: string, versionId?: string | null, opts?: Fetch): Promise<ArrayBuffer>;
55
- restore?(id: string, versionId: string): Promise<void>;
56
- }
57
- type Place = {
58
- spaceId: string | null;
59
- documentId: string | null;
60
- };
61
-
62
- export type { DocumentsHost as D, Fetch as F, Language as L, Place as P, Rights as R, Space as S, DocumentFile as a, DocumentKind as b, DocumentSummary as c, DocumentVersion as d, Person as e };
@@ -1,62 +0,0 @@
1
- type DocumentKind = 'docx' | 'markdown' | 'pdf' | 'sheet' | 'slides';
2
- type Language = 'en' | 'pl' | 'uk';
3
- type Person = {
4
- id: string;
5
- name: string;
6
- avatarUrl?: string | null;
7
- };
8
- type Space = {
9
- id: string;
10
- name: string;
11
- color?: string | null;
12
- group?: string | null;
13
- };
14
- type Rights = {
15
- view: boolean;
16
- comment: boolean;
17
- edit: boolean;
18
- };
19
- type DocumentSummary = {
20
- id: string;
21
- spaceId: string;
22
- name: string;
23
- kind: DocumentKind;
24
- size: number;
25
- updatedAt: string;
26
- updatedBy?: Person | null;
27
- thumbnailUrl?: string | null;
28
- excerpt?: string | null;
29
- folder?: string | null;
30
- };
31
- type DocumentFile = DocumentSummary & {
32
- rights: Rights;
33
- mimeType?: string | null;
34
- };
35
- type DocumentVersion = {
36
- id: string;
37
- createdAt: string;
38
- size: number;
39
- author?: Person | null;
40
- note?: string | null;
41
- current: boolean;
42
- };
43
- type Fetch = {
44
- signal?: AbortSignal;
45
- };
46
- interface DocumentsHost {
47
- me: Person;
48
- pdfWorker?: () => Worker;
49
- spaces(opts?: Fetch): Promise<Space[]>;
50
- documents(spaceId: string, opts?: Fetch): Promise<DocumentSummary[]>;
51
- everything?(opts?: Fetch): Promise<DocumentSummary[]>;
52
- document(id: string, opts?: Fetch): Promise<DocumentFile>;
53
- versions(id: string, opts?: Fetch): Promise<DocumentVersion[]>;
54
- content(id: string, versionId?: string | null, opts?: Fetch): Promise<ArrayBuffer>;
55
- restore?(id: string, versionId: string): Promise<void>;
56
- }
57
- type Place = {
58
- spaceId: string | null;
59
- documentId: string | null;
60
- };
61
-
62
- export type { DocumentsHost as D, Fetch as F, Language as L, Place as P, Rights as R, Space as S, DocumentFile as a, DocumentKind as b, DocumentSummary as c, DocumentVersion as d, Person as e };