@w100n/documents 0.10.0 → 0.11.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.
@@ -5,7 +5,7 @@ import {
5
5
  pending,
6
6
  save,
7
7
  seed
8
- } from "./chunk-CE3AADY6.js";
8
+ } from "./chunk-EM4U6OC5.js";
9
9
 
10
10
  // src/editor/live.ts
11
11
  import { HocuspocusProvider } from "@hocuspocus/provider";
@@ -193,4 +193,4 @@ ${id}`, id, kind, doc, host2, { id: me.id, name: me.name, language }, edit) : ne
193
193
  export {
194
194
  useLive
195
195
  };
196
- //# sourceMappingURL=chunk-SVRYWMES.js.map
196
+ //# sourceMappingURL=chunk-FPGPEIW5.js.map
@@ -27,6 +27,10 @@ function kindOf(name, mimeType) {
27
27
  const extension = name.includes(".") ? name.split(".").pop().toLowerCase() : "";
28
28
  return byExtension[extension] ?? (mimeType ? byMime[mimeType.split(";")[0].trim().toLowerCase()] : void 0) ?? null;
29
29
  }
30
+ function readable(name, mimeType) {
31
+ const kind = kindOf(name, mimeType);
32
+ return kind !== "sheet" || /\.(xlsx|csv)$/i.test(name) || /spreadsheetml|text\/csv/.test(mimeType ?? "") ? kind : null;
33
+ }
30
34
  function matches(doc, query, kind) {
31
35
  const words = query.toLocaleLowerCase().split(/\s+/).filter(Boolean);
32
36
  return (kind === "all" || doc.kind === kind) && words.every((word) => doc.name.toLocaleLowerCase().includes(word));
@@ -35,6 +39,7 @@ function matches(doc, query, kind) {
35
39
  export {
36
40
  kinds,
37
41
  kindOf,
42
+ readable,
38
43
  matches
39
44
  };
40
- //# sourceMappingURL=chunk-K364NAYP.js.map
45
+ //# sourceMappingURL=chunk-L765DZPO.js.map
@@ -0,0 +1 @@
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', xls: 'sheet', ods: 'sheet', tsv: '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 readable(name: string, mimeType?: string | null): DocumentKind | null {\n const kind = kindOf(name, mimeType);\n return kind !== 'sheet' || /\\.(xlsx|csv)$/i.test(name) || /spreadsheetml|text\\/csv/.test(mimeType ?? '') ? kind : 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,KAAK;AAAA,EAAS,KAAK;AAAA,EAAS,KAAK;AAAA,EAAS,MAAM;AAAA,EAAU,KAAK;AAC9J;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,SAAS,MAAc,UAA+C;AACpF,QAAM,OAAO,OAAO,MAAM,QAAQ;AAClC,SAAO,SAAS,WAAW,iBAAiB,KAAK,IAAI,KAAK,0BAA0B,KAAK,YAAY,EAAE,IAAI,OAAO;AACpH;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":[]}
package/dist/collab.cjs CHANGED
@@ -50,7 +50,7 @@ var import_y_tiptap2 = require("@tiptap/y-tiptap");
50
50
  var Y2 = __toESM(require("yjs"), 1);
51
51
 
52
52
  // package.json
53
- var version = "0.10.0";
53
+ var version = "0.11.0";
54
54
 
55
55
  // src/docx/xml.ts
56
56
  function parse(s) {