@w100n/documents 0.16.0 → 0.16.2
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/dist/{SheetView-EFBSMY7K.js → SheetView-S5AFXKPA.js} +5 -5
- package/dist/{TextEditor-MGCSGGGA.js → TextEditor-7WQJFUUU.js} +399 -349
- package/dist/TextEditor-7WQJFUUU.js.map +1 -0
- package/dist/{chunk-3OLRFIHQ.js → chunk-JC4DLTMI.js} +2 -2
- package/dist/{chunk-2L3TK7UF.js → chunk-KGAQT5M3.js} +3 -3
- package/dist/{chunk-2L3TK7UF.js.map → chunk-KGAQT5M3.js.map} +1 -1
- package/dist/{chunk-RKV3N6OS.js → chunk-LZYITB56.js} +22 -1
- package/dist/chunk-LZYITB56.js.map +1 -0
- package/dist/collab.cjs +22 -1
- package/dist/collab.cjs.map +1 -1
- package/dist/collab.d.cts +1 -1
- package/dist/collab.d.ts +1 -1
- package/dist/collab.js +2 -2
- package/dist/{grid-Q4XBPQFY.js → grid-AZLMNS7K.js} +15 -6
- package/dist/grid-AZLMNS7K.js.map +1 -0
- package/dist/index.cjs +1023 -886
- package/dist/index.cjs.map +1 -1
- package/dist/index.css +78 -6
- package/dist/index.css.map +1 -1
- package/dist/index.d.cts +2 -2
- package/dist/index.d.ts +2 -2
- package/dist/index.js +58 -14
- package/dist/index.js.map +1 -1
- package/dist/kinds.d.cts +1 -1
- package/dist/kinds.d.ts +1 -1
- package/dist/memory.cjs +25 -2
- package/dist/memory.cjs.map +1 -1
- package/dist/memory.d.cts +3 -2
- package/dist/memory.d.ts +3 -2
- package/dist/memory.js +25 -2
- package/dist/memory.js.map +1 -1
- package/dist/{types-BTsVooZw.d.cts → types-DNcaU6SK.d.cts} +9 -0
- package/dist/{types-BTsVooZw.d.ts → types-DNcaU6SK.d.ts} +9 -0
- package/package.json +1 -1
- package/dist/TextEditor-MGCSGGGA.js.map +0 -1
- package/dist/chunk-RKV3N6OS.js.map +0 -1
- package/dist/grid-Q4XBPQFY.js.map +0 -1
- /package/dist/{SheetView-EFBSMY7K.js.map → SheetView-S5AFXKPA.js.map} +0 -0
- /package/dist/{chunk-3OLRFIHQ.js.map → chunk-JC4DLTMI.js.map} +0 -0
package/dist/index.d.cts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import * as react from 'react';
|
|
2
2
|
import { ReactNode, RefObject } from 'react';
|
|
3
|
-
import { L as Language, D as DocumentsHost, P as Place, a as DocumentFile, G as GuestHost, R as Rights } from './types-
|
|
4
|
-
export { C as Comment, b as DocumentKind, 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-
|
|
3
|
+
import { L as Language, D as DocumentsHost, P as Place, a as DocumentFile, G as GuestHost, R as Rights } from './types-DNcaU6SK.cjs';
|
|
4
|
+
export { C as Comment, b as DocumentKind, 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-DNcaU6SK.cjs';
|
|
5
5
|
import { JSONContent } from '@tiptap/core';
|
|
6
6
|
import { I as Img, S as Setup } from './write-BCI8yool.cjs';
|
|
7
7
|
export { kindOf, kinds, matches, readable } from './kinds.cjs';
|
package/dist/index.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import * as react from 'react';
|
|
2
2
|
import { ReactNode, RefObject } from 'react';
|
|
3
|
-
import { L as Language, D as DocumentsHost, P as Place, a as DocumentFile, G as GuestHost, R as Rights } from './types-
|
|
4
|
-
export { C as Comment, b as DocumentKind, 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-
|
|
3
|
+
import { L as Language, D as DocumentsHost, P as Place, a as DocumentFile, G as GuestHost, R as Rights } from './types-DNcaU6SK.js';
|
|
4
|
+
export { C as Comment, b as DocumentKind, 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-DNcaU6SK.js';
|
|
5
5
|
import { JSONContent } from '@tiptap/core';
|
|
6
6
|
import { I as Img, S as Setup } from './write-BCI8yool.js';
|
|
7
7
|
export { kindOf, kinds, matches, readable } from './kinds.js';
|
package/dist/index.js
CHANGED
|
@@ -14,7 +14,7 @@ import {
|
|
|
14
14
|
} from "./chunk-TDP6OJET.js";
|
|
15
15
|
import {
|
|
16
16
|
texts
|
|
17
|
-
} from "./chunk-
|
|
17
|
+
} from "./chunk-LZYITB56.js";
|
|
18
18
|
import {
|
|
19
19
|
escape,
|
|
20
20
|
readDocx,
|
|
@@ -2409,8 +2409,8 @@ function PdfView({ bytes, t, language, worker, rights, host, documentId, onSaved
|
|
|
2409
2409
|
|
|
2410
2410
|
// src/DocumentOverlay.tsx
|
|
2411
2411
|
import { jsx as jsx5, jsxs as jsxs5 } from "react/jsx-runtime";
|
|
2412
|
-
var TextEditor = lazy(() => import("./TextEditor-
|
|
2413
|
-
var SheetView = lazy(() => import("./SheetView-
|
|
2412
|
+
var TextEditor = lazy(() => import("./TextEditor-7WQJFUUU.js"));
|
|
2413
|
+
var SheetView = lazy(() => import("./SheetView-S5AFXKPA.js"));
|
|
2414
2414
|
var icons = { docx: FileText, markdown: FileType, pdf: Files, sheet: FileSpreadsheet, slides: Presentation };
|
|
2415
2415
|
var read = { view: true, comment: false, edit: false };
|
|
2416
2416
|
var quiet = () => {
|
|
@@ -2681,14 +2681,20 @@ function NewDocument({ host, t, onClose, onMade }) {
|
|
|
2681
2681
|
const [kind, setKind] = useState6("docx");
|
|
2682
2682
|
const [template, setTemplate] = useState6("blank");
|
|
2683
2683
|
const [name, setName] = useState6("");
|
|
2684
|
+
const [team, setTeam] = useState6(null);
|
|
2685
|
+
const shared = useLoad((signal) => host.templates ? host.templates({ signal }) : Promise.resolve([]), [host]);
|
|
2686
|
+
const ours = (shared.data ?? []).filter((item) => item.kind === kind);
|
|
2687
|
+
const stem = (file) => file.replace(/\.[^.]+$/, "");
|
|
2684
2688
|
const [state, setState] = useState6("idle");
|
|
2685
2689
|
useRestore(true);
|
|
2686
2690
|
const choices = kind === "docx" || kind === "markdown" ? shaped : ["blank"];
|
|
2687
2691
|
const make2 = async () => {
|
|
2688
|
-
const title = name.trim() || (template === "blank" ? t.untitled : t.templates[template]);
|
|
2692
|
+
const title = name.trim() || (team ? stem(team.name) : template === "blank" ? t.untitled : t.templates[template]);
|
|
2689
2693
|
setState("busy");
|
|
2690
2694
|
try {
|
|
2691
|
-
|
|
2695
|
+
const ext = team ? team.name.split(".").pop() : extensions[kind];
|
|
2696
|
+
const bytes = team ? await host.content(team.id) : blank2(kind, title, template);
|
|
2697
|
+
onMade(await host.create({ name: `${title.replace(/[\\/:*?"<>|\s]+/g, " ").trim()}.${ext}`, bytes, mimeType: mimes[kind] }));
|
|
2692
2698
|
} catch {
|
|
2693
2699
|
setState("failed");
|
|
2694
2700
|
}
|
|
@@ -2711,6 +2717,7 @@ function NewDocument({ host, t, onClose, onMade }) {
|
|
|
2711
2717
|
const Icon = icons2[item];
|
|
2712
2718
|
return /* @__PURE__ */ jsxs6("button", { type: "button", role: "radio", "aria-checked": kind === item, "data-kind": item, onClick: () => {
|
|
2713
2719
|
setKind(item);
|
|
2720
|
+
setTeam(null);
|
|
2714
2721
|
if (item === "sheet" || item === "slides") setTemplate("blank");
|
|
2715
2722
|
}, children: [
|
|
2716
2723
|
/* @__PURE__ */ jsx6("span", { className: "w100n-docs-tile", "data-kind": item, children: /* @__PURE__ */ jsx6(Icon, { "aria-hidden": true }) }),
|
|
@@ -2721,7 +2728,10 @@ function NewDocument({ host, t, onClose, onMade }) {
|
|
|
2721
2728
|
] }, item);
|
|
2722
2729
|
}) }),
|
|
2723
2730
|
/* @__PURE__ */ jsx6("p", { className: "w100n-docs-caption", children: t.startFrom }),
|
|
2724
|
-
/* @__PURE__ */ jsx6("div", { role: "radiogroup", "aria-label": t.startFrom, className: "w100n-new-templates", children: choices.map((item) => /* @__PURE__ */ jsxs6("button", { type: "button", role: "radio", "aria-checked": template === item, onClick: () =>
|
|
2731
|
+
/* @__PURE__ */ jsx6("div", { role: "radiogroup", "aria-label": t.startFrom, className: "w100n-new-templates", children: choices.map((item) => /* @__PURE__ */ jsxs6("button", { type: "button", role: "radio", "aria-checked": !team && template === item, onClick: () => {
|
|
2732
|
+
setTeam(null);
|
|
2733
|
+
setTemplate(item);
|
|
2734
|
+
}, children: [
|
|
2725
2735
|
/* @__PURE__ */ jsx6("span", { className: "w100n-new-sheet", "data-blank": item === "blank", children: item === "blank" ? /* @__PURE__ */ jsx6(Plus2, { "aria-hidden": true }) : /* @__PURE__ */ jsxs6(Fragment5, { children: [
|
|
2726
2736
|
/* @__PURE__ */ jsx6("i", { "data-head": true }),
|
|
2727
2737
|
/* @__PURE__ */ jsx6("i", {}),
|
|
@@ -2732,10 +2742,23 @@ function NewDocument({ host, t, onClose, onMade }) {
|
|
|
2732
2742
|
] }) }),
|
|
2733
2743
|
/* @__PURE__ */ jsx6("span", { children: t.templates[item] })
|
|
2734
2744
|
] }, item)) }),
|
|
2745
|
+
ours.length > 0 && /* @__PURE__ */ jsxs6(Fragment5, { children: [
|
|
2746
|
+
/* @__PURE__ */ jsx6("p", { className: "w100n-docs-caption", children: t.teamTemplates }),
|
|
2747
|
+
/* @__PURE__ */ jsx6("div", { role: "radiogroup", "aria-label": t.teamTemplates, className: "w100n-new-templates", children: ours.map((item) => /* @__PURE__ */ jsxs6("button", { type: "button", role: "radio", "aria-checked": team?.id === item.id, onClick: () => setTeam(item), children: [
|
|
2748
|
+
/* @__PURE__ */ jsxs6("span", { className: "w100n-new-sheet", children: [
|
|
2749
|
+
/* @__PURE__ */ jsx6("i", { "data-head": true }),
|
|
2750
|
+
/* @__PURE__ */ jsx6("i", {}),
|
|
2751
|
+
/* @__PURE__ */ jsx6("i", { "data-accent": true }),
|
|
2752
|
+
/* @__PURE__ */ jsx6("i", {}),
|
|
2753
|
+
/* @__PURE__ */ jsx6("i", {})
|
|
2754
|
+
] }),
|
|
2755
|
+
/* @__PURE__ */ jsx6("span", { title: item.name, children: stem(item.name) })
|
|
2756
|
+
] }, item.id)) })
|
|
2757
|
+
] }),
|
|
2735
2758
|
/* @__PURE__ */ jsxs6("div", { className: "w100n-new-fields", children: [
|
|
2736
2759
|
/* @__PURE__ */ jsxs6("label", { children: [
|
|
2737
2760
|
/* @__PURE__ */ jsx6("span", { className: "w100n-docs-caption", children: t.name }),
|
|
2738
|
-
/* @__PURE__ */ jsx6("input", { className: "w100n-docs-field", autoFocus: true, value: name, onChange: (e) => setName(e.target.value), placeholder: template === "blank" ? t.untitled : t.templates[template] })
|
|
2761
|
+
/* @__PURE__ */ jsx6("input", { className: "w100n-docs-field", autoFocus: true, value: name, onChange: (e) => setName(e.target.value), placeholder: team ? stem(team.name) : template === "blank" ? t.untitled : t.templates[template] })
|
|
2739
2762
|
] }),
|
|
2740
2763
|
host.createIn && /* @__PURE__ */ jsxs6("div", { children: [
|
|
2741
2764
|
/* @__PURE__ */ jsx6("span", { className: "w100n-docs-caption", children: t.savesTo }),
|
|
@@ -3100,8 +3123,8 @@ function Thumb({ host, item, label }) {
|
|
|
3100
3123
|
|
|
3101
3124
|
// src/DocumentsWorkspace.tsx
|
|
3102
3125
|
import { Fragment as Fragment8, jsx as jsx9, jsxs as jsxs9 } from "react/jsx-runtime";
|
|
3103
|
-
var TextEditor2 = lazy2(() => import("./TextEditor-
|
|
3104
|
-
var SheetView2 = lazy2(() => import("./SheetView-
|
|
3126
|
+
var TextEditor2 = lazy2(() => import("./TextEditor-7WQJFUUU.js"));
|
|
3127
|
+
var SheetView2 = lazy2(() => import("./SheetView-S5AFXKPA.js"));
|
|
3105
3128
|
var Compare = lazy2(() => import("./Compare-M57FG4R3.js"));
|
|
3106
3129
|
var icons3 = { docx: FileText3, markdown: FileType3, pdf: Files2, sheet: FileSpreadsheet3, slides: Presentation3 };
|
|
3107
3130
|
function DocumentsWorkspace({ host, language = "en", theme = "light", place, onPlace, start, end, aside, actions }) {
|
|
@@ -3183,6 +3206,7 @@ function DocumentsWorkspace({ host, language = "en", theme = "light", place, onP
|
|
|
3183
3206
|
const [restoring, setRestoring] = useState9("idle");
|
|
3184
3207
|
const [exporting, setExporting] = useState9("idle");
|
|
3185
3208
|
const [copying, setCopying] = useState9("idle");
|
|
3209
|
+
const [kept, setKept] = useState9(null);
|
|
3186
3210
|
const [box, setBox] = useState9(null);
|
|
3187
3211
|
const [making, setMaking] = useState9(false);
|
|
3188
3212
|
const [sending, setSending] = useState9("idle");
|
|
@@ -3220,7 +3244,14 @@ function DocumentsWorkspace({ host, language = "en", theme = "light", place, onP
|
|
|
3220
3244
|
const docbar = text && !versionId && !narrow;
|
|
3221
3245
|
const signatures = useLoad((signal) => here.documentId && pdf && host.signatures ? host.signatures(here.documentId, { signal }) : Promise.resolve([]), [host, here.documentId, pdf]);
|
|
3222
3246
|
const all = list.data ?? [];
|
|
3223
|
-
const
|
|
3247
|
+
const deep = useLoad(async (signal) => {
|
|
3248
|
+
const text2 = query.trim();
|
|
3249
|
+
if (!host.search || text2.length < 2) return [];
|
|
3250
|
+
await new Promise((done) => setTimeout(done, 300));
|
|
3251
|
+
return signal.aborted ? [] : host.search(text2, { signal });
|
|
3252
|
+
}, [host, query]);
|
|
3253
|
+
const inside = new Map((deep.data ?? []).map((hit2) => [hit2.id, hit2.excerpt]));
|
|
3254
|
+
const shown = all.filter((item) => matches(item, query, picked) || inside.has(item.id) && matches(item, "", picked));
|
|
3224
3255
|
const present = kinds.filter((item) => all.some((doc2) => doc2.kind === item));
|
|
3225
3256
|
const folders = spaceId ? [.../* @__PURE__ */ new Set(["", ...shown.map((item) => item.folder ?? "")])].filter((folder2) => shown.some((item) => (item.folder ?? "") === folder2)) : [""];
|
|
3226
3257
|
const names2 = new Map((spaces.data ?? []).map((item) => [item.id, item.name]));
|
|
@@ -3330,6 +3361,15 @@ function DocumentsWorkspace({ host, language = "en", theme = "light", place, onP
|
|
|
3330
3361
|
setCopying("failed");
|
|
3331
3362
|
}
|
|
3332
3363
|
};
|
|
3364
|
+
const keep = async (file) => {
|
|
3365
|
+
setKept({ id: file.id, state: "busy" });
|
|
3366
|
+
try {
|
|
3367
|
+
await host.saveTemplate(file.id);
|
|
3368
|
+
setKept({ id: file.id, state: "done" });
|
|
3369
|
+
} catch {
|
|
3370
|
+
setKept({ id: file.id, state: "failed" });
|
|
3371
|
+
}
|
|
3372
|
+
};
|
|
3333
3373
|
const rename = async (file, draft) => {
|
|
3334
3374
|
setRenaming(null);
|
|
3335
3375
|
const ext = /\.[^.]+$/.exec(file.name)?.[0] ?? "";
|
|
@@ -3394,7 +3434,8 @@ function DocumentsWorkspace({ host, language = "en", theme = "light", place, onP
|
|
|
3394
3434
|
formats: host.exportAs ? doc.data.exports ?? [] : [],
|
|
3395
3435
|
download: (f) => void exportAs(doc.data, f),
|
|
3396
3436
|
copy: host.create ? () => void copy(doc.data) : void 0,
|
|
3397
|
-
rename: host.rename && doc.data.rights.edit ? () => setRenaming(doc.data.name.replace(/\.[^.]+$/, "")) : void 0
|
|
3437
|
+
rename: host.rename && doc.data.rights.edit ? () => setRenaming(doc.data.name.replace(/\.[^.]+$/, "")) : void 0,
|
|
3438
|
+
template: host.saveTemplate && doc.data.rights.edit ? () => void keep(doc.data) : void 0
|
|
3398
3439
|
},
|
|
3399
3440
|
onSaved: () => {
|
|
3400
3441
|
versions.retry();
|
|
@@ -3571,6 +3612,8 @@ function DocumentsWorkspace({ host, language = "en", theme = "light", place, onP
|
|
|
3571
3612
|
t.copyAs
|
|
3572
3613
|
] }),
|
|
3573
3614
|
copying === "failed" && /* @__PURE__ */ jsx9("span", { className: "w100n-docs-muted", children: t.copyFailed }),
|
|
3615
|
+
kept?.id === here.documentId && kept.state === "done" && /* @__PURE__ */ jsx9("span", { className: "w100n-docs-muted", role: "status", children: t.templateSaved }),
|
|
3616
|
+
kept?.id === here.documentId && kept.state === "failed" && /* @__PURE__ */ jsx9("span", { className: "w100n-docs-muted", role: "alert", children: t.templateFailed }),
|
|
3574
3617
|
renamed === "failed" && /* @__PURE__ */ jsx9("span", { className: "w100n-docs-muted", children: t.renameFailed }),
|
|
3575
3618
|
docbar && /* @__PURE__ */ jsx9("span", { ref: setStatusAt, className: "w100n-docs-status" }),
|
|
3576
3619
|
sharing && /* @__PURE__ */ jsxs9("button", { type: "button", className: "w100n-docs-action", "aria-label": t.share, title: t.share, onClick: () => {
|
|
@@ -3708,7 +3751,8 @@ function DocumentsWorkspace({ host, language = "en", theme = "light", place, onP
|
|
|
3708
3751
|
/* @__PURE__ */ jsx9(Thumb, { host, item, label: t.kinds[item.kind] }),
|
|
3709
3752
|
/* @__PURE__ */ jsxs9("span", { className: "w100n-docs-card-text", children: [
|
|
3710
3753
|
/* @__PURE__ */ jsx9("b", { children: item.name }),
|
|
3711
|
-
/* @__PURE__ */ jsx9("small", { children: [!spaceId && names2.get(item.spaceId), ago(item.updatedAt)].filter(Boolean).join(" \xB7 ") })
|
|
3754
|
+
/* @__PURE__ */ jsx9("small", { children: [!spaceId && names2.get(item.spaceId), ago(item.updatedAt)].filter(Boolean).join(" \xB7 ") }),
|
|
3755
|
+
inside.get(item.id) && /* @__PURE__ */ jsx9("small", { className: "w100n-docs-hit", children: inside.get(item.id).split(/[«»]/).map((part, i) => i % 2 ? /* @__PURE__ */ jsx9("mark", { children: part }, i) : part) })
|
|
3712
3756
|
] })
|
|
3713
3757
|
] }, item.id)) })
|
|
3714
3758
|
] }, folder2))
|
|
@@ -3887,8 +3931,8 @@ function DocumentsWorkspace({ host, language = "en", theme = "light", place, onP
|
|
|
3887
3931
|
import { lazy as lazy3, Suspense as Suspense3, useRef as useRef7, useState as useState10 } from "react";
|
|
3888
3932
|
import { Ban as Ban2, Download as Download3, Eye as Eye2, FileDown as FileDown2, FileSpreadsheet as FileSpreadsheet4, FileText as FileText4, FileType as FileType4, Files as Files3, Lock as Lock2, Presentation as Presentation4, UserRound } from "lucide-react";
|
|
3889
3933
|
import { Fragment as Fragment9, jsx as jsx10, jsxs as jsxs10 } from "react/jsx-runtime";
|
|
3890
|
-
var TextEditor3 = lazy3(() => import("./TextEditor-
|
|
3891
|
-
var SheetView3 = lazy3(() => import("./SheetView-
|
|
3934
|
+
var TextEditor3 = lazy3(() => import("./TextEditor-7WQJFUUU.js"));
|
|
3935
|
+
var SheetView3 = lazy3(() => import("./SheetView-S5AFXKPA.js"));
|
|
3892
3936
|
var icons4 = { docx: FileText4, markdown: FileType4, pdf: Files3, sheet: FileSpreadsheet4, slides: Presentation4 };
|
|
3893
3937
|
var GuestRefused = class extends Error {
|
|
3894
3938
|
constructor(reason, file = "", sharedBy = "") {
|