@w100n/documents 0.16.3 → 0.16.4
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-KXFUAILH.js → SheetView-OEKOHMKW.js} +3 -3
- package/dist/{TextEditor-RNHXPYJX.js → TextEditor-5S7FSLIZ.js} +3 -3
- package/dist/{chunk-XFLYD3JS.js → chunk-3D2G5NBI.js} +2 -2
- package/dist/{chunk-E2FVJNDT.js → chunk-AKJGYZME.js} +2 -2
- package/dist/{chunk-E2FVJNDT.js.map → chunk-AKJGYZME.js.map} +1 -1
- package/dist/collab.cjs +1 -1
- package/dist/collab.cjs.map +1 -1
- package/dist/collab.js +1 -1
- package/dist/index.cjs +68 -56
- package/dist/index.cjs.map +1 -1
- package/dist/index.css +11 -0
- package/dist/index.css.map +1 -1
- package/dist/index.d.cts +10 -1
- package/dist/index.d.ts +10 -1
- package/dist/index.js +58 -47
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
- /package/dist/{SheetView-KXFUAILH.js.map → SheetView-OEKOHMKW.js.map} +0 -0
- /package/dist/{TextEditor-RNHXPYJX.js.map → TextEditor-5S7FSLIZ.js.map} +0 -0
- /package/dist/{chunk-XFLYD3JS.js.map → chunk-3D2G5NBI.js.map} +0 -0
package/dist/collab.js
CHANGED
package/dist/index.cjs
CHANGED
|
@@ -4771,7 +4771,7 @@ var init_extensions = __esm({
|
|
|
4771
4771
|
var version;
|
|
4772
4772
|
var init_package = __esm({
|
|
4773
4773
|
"package.json"() {
|
|
4774
|
-
version = "0.16.
|
|
4774
|
+
version = "0.16.4";
|
|
4775
4775
|
}
|
|
4776
4776
|
});
|
|
4777
4777
|
|
|
@@ -10773,6 +10773,7 @@ var index_exports = {};
|
|
|
10773
10773
|
__export(index_exports, {
|
|
10774
10774
|
DocumentOverlay: () => DocumentOverlay,
|
|
10775
10775
|
DocumentsWorkspace: () => DocumentsWorkspace,
|
|
10776
|
+
FilePreview: () => FilePreview,
|
|
10776
10777
|
GuestDocument: () => GuestDocument,
|
|
10777
10778
|
GuestRefused: () => GuestRefused,
|
|
10778
10779
|
SlidesView: () => SlidesView,
|
|
@@ -13883,7 +13884,7 @@ function Thumb({ host, item, label }) {
|
|
|
13883
13884
|
/* @__PURE__ */ (0, import_jsx_runtime12.jsx)("i", {}),
|
|
13884
13885
|
/* @__PURE__ */ (0, import_jsx_runtime12.jsx)("i", {})
|
|
13885
13886
|
] }) }),
|
|
13886
|
-
/* @__PURE__ */ (0, import_jsx_runtime12.jsx)("span", { className: "w100n-docs-kind", "data-kind": item.kind, children: label })
|
|
13887
|
+
label && /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("span", { className: "w100n-docs-kind", "data-kind": item.kind, children: label })
|
|
13887
13888
|
] });
|
|
13888
13889
|
}
|
|
13889
13890
|
|
|
@@ -14901,14 +14902,24 @@ function DocumentsWorkspace({ host, language = "en", theme = "light", place: pla
|
|
|
14901
14902
|
] });
|
|
14902
14903
|
}
|
|
14903
14904
|
|
|
14904
|
-
// src/
|
|
14905
|
+
// src/FilePreview.tsx
|
|
14905
14906
|
var import_react18 = require("react");
|
|
14907
|
+
var import_jsx_runtime15 = require("react/jsx-runtime");
|
|
14908
|
+
function FilePreview({ url, name, mimeType, size: size2 = 0, bytes, pdfWorker }) {
|
|
14909
|
+
const [source] = (0, import_react18.useState)(() => ({ pdfWorker, content: () => bytes ? bytes(url) : fetch(url, { credentials: "include" }).then((res) => res.ok ? res.arrayBuffer() : Promise.reject(new Error(String(res.status)))) }));
|
|
14910
|
+
const kind = kindOf(name, mimeType);
|
|
14911
|
+
if (!kind) return null;
|
|
14912
|
+
return /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("span", { className: "w100n-preview", children: /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(Thumb, { host: source, item: { id: url.split("?")[0], spaceId: "", name, kind, size: size2, updatedAt: "" } }) });
|
|
14913
|
+
}
|
|
14914
|
+
|
|
14915
|
+
// src/GuestDocument.tsx
|
|
14916
|
+
var import_react19 = require("react");
|
|
14906
14917
|
var import_lucide_react11 = require("lucide-react");
|
|
14907
14918
|
init_text();
|
|
14908
14919
|
init_useLoad();
|
|
14909
|
-
var
|
|
14910
|
-
var TextEditor4 = (0,
|
|
14911
|
-
var SheetView4 = (0,
|
|
14920
|
+
var import_jsx_runtime16 = require("react/jsx-runtime");
|
|
14921
|
+
var TextEditor4 = (0, import_react19.lazy)(() => Promise.resolve().then(() => (init_TextEditor(), TextEditor_exports)));
|
|
14922
|
+
var SheetView4 = (0, import_react19.lazy)(() => Promise.resolve().then(() => (init_SheetView(), SheetView_exports)));
|
|
14912
14923
|
var icons4 = { docx: import_lucide_react11.FileText, markdown: import_lucide_react11.FileType, pdf: import_lucide_react11.Files, sheet: import_lucide_react11.FileSpreadsheet, slides: import_lucide_react11.Presentation };
|
|
14913
14924
|
var GuestRefused = class extends Error {
|
|
14914
14925
|
constructor(reason, file = "", sharedBy = "") {
|
|
@@ -14934,14 +14945,14 @@ var remember = (name) => {
|
|
|
14934
14945
|
};
|
|
14935
14946
|
function GuestDocument({ host, language = "en", theme = "light", brand }) {
|
|
14936
14947
|
const t = texts[language];
|
|
14937
|
-
const [ask, setAsk] = (0,
|
|
14938
|
-
const [typed, setTyped] = (0,
|
|
14939
|
-
const [name, setName] = (0,
|
|
14940
|
-
const named3 = (0,
|
|
14941
|
-
const [slot, setSlot] = (0,
|
|
14942
|
-
const [saving, setSaving] = (0,
|
|
14948
|
+
const [ask, setAsk] = (0, import_react19.useState)(() => ({ name: remembered() || void 0 }));
|
|
14949
|
+
const [typed, setTyped] = (0, import_react19.useState)("");
|
|
14950
|
+
const [name, setName] = (0, import_react19.useState)(remembered);
|
|
14951
|
+
const named3 = (0, import_react19.useRef)(name);
|
|
14952
|
+
const [slot, setSlot] = (0, import_react19.useState)(null);
|
|
14953
|
+
const [saving, setSaving] = (0, import_react19.useState)("idle");
|
|
14943
14954
|
const opened2 = useLoad((signal) => host.open(ask, { signal }), [host, ask]);
|
|
14944
|
-
const [notes3] = (0,
|
|
14955
|
+
const [notes3] = (0, import_react19.useState)(() => ({
|
|
14945
14956
|
me: { id: "", name: "" },
|
|
14946
14957
|
spaces: async () => [],
|
|
14947
14958
|
documents: async () => [],
|
|
@@ -14968,17 +14979,17 @@ function GuestDocument({ host, language = "en", theme = "light", brand }) {
|
|
|
14968
14979
|
const top = (file2, badge) => {
|
|
14969
14980
|
const kind2 = file2 ? kindOf(file2.name, file2.mimeType) : null;
|
|
14970
14981
|
const Kind = kind2 ? icons4[kind2] : import_lucide_react11.FileText;
|
|
14971
|
-
return /* @__PURE__ */ (0,
|
|
14972
|
-
brand && /* @__PURE__ */ (0,
|
|
14973
|
-
file2 && /* @__PURE__ */ (0,
|
|
14974
|
-
/* @__PURE__ */ (0,
|
|
14975
|
-
/* @__PURE__ */ (0,
|
|
14976
|
-
/* @__PURE__ */ (0,
|
|
14977
|
-
file2.sharedBy && /* @__PURE__ */ (0,
|
|
14982
|
+
return /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)("header", { className: "w100n-docs-bar w100n-guest-bar", children: [
|
|
14983
|
+
brand && /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("span", { className: "w100n-guest-brand", children: brand }),
|
|
14984
|
+
file2 && /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)(import_jsx_runtime16.Fragment, { children: [
|
|
14985
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsx)("span", { className: "w100n-docs-tile", "data-kind": kind2, children: /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(Kind, { "aria-hidden": true }) }),
|
|
14986
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsxs)("div", { className: "w100n-docs-heading", children: [
|
|
14987
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsx)("strong", { className: "w100n-docs-title", children: file2.name }),
|
|
14988
|
+
file2.sharedBy && /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("span", { className: "w100n-docs-crumbs", children: t.sharedBy.replace("{name}", file2.sharedBy) })
|
|
14978
14989
|
] }),
|
|
14979
|
-
badge && /* @__PURE__ */ (0,
|
|
14980
|
-
file2.download && /* @__PURE__ */ (0,
|
|
14981
|
-
(kind2 === "docx" || kind2 === "markdown" || kind2 === "sheet" || kind2 === "slides") && /* @__PURE__ */ (0,
|
|
14990
|
+
badge && /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("span", { className: "w100n-docs-badge", "data-kind": kind2, children: badge }),
|
|
14991
|
+
file2.download && /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)("div", { className: "w100n-docs-end", children: [
|
|
14992
|
+
(kind2 === "docx" || kind2 === "markdown" || kind2 === "sheet" || kind2 === "slides") && /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)(
|
|
14982
14993
|
"button",
|
|
14983
14994
|
{
|
|
14984
14995
|
type: "button",
|
|
@@ -14989,25 +15000,25 @@ function GuestDocument({ host, language = "en", theme = "light", brand }) {
|
|
|
14989
15000
|
"aria-label": t.pdfCopy,
|
|
14990
15001
|
title: t.pdfCopy,
|
|
14991
15002
|
children: [
|
|
14992
|
-
/* @__PURE__ */ (0,
|
|
14993
|
-
/* @__PURE__ */ (0,
|
|
15003
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsx)(import_lucide_react11.FileDown, { "aria-hidden": true }),
|
|
15004
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsx)("span", { children: t.pdfCopy })
|
|
14994
15005
|
]
|
|
14995
15006
|
}
|
|
14996
15007
|
),
|
|
14997
|
-
/* @__PURE__ */ (0,
|
|
14998
|
-
/* @__PURE__ */ (0,
|
|
14999
|
-
/* @__PURE__ */ (0,
|
|
15008
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsxs)("button", { type: "button", className: "w100n-docs-action", "data-tone": "blue", disabled: saving === "busy", onClick: () => void download("file"), "aria-label": t.download, title: t.download, children: [
|
|
15009
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsx)(import_lucide_react11.Download, { "aria-hidden": true }),
|
|
15010
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsx)("span", { children: t.download })
|
|
15000
15011
|
] })
|
|
15001
15012
|
] })
|
|
15002
15013
|
] })
|
|
15003
15014
|
] });
|
|
15004
15015
|
};
|
|
15005
|
-
const gate = (tone, Icon, title, body, form) => /* @__PURE__ */ (0,
|
|
15016
|
+
const gate = (tone, Icon, title, body, form) => /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)("div", { className: "w100n-docs w100n-guest", "data-theme": theme, children: [
|
|
15006
15017
|
top(null, null),
|
|
15007
|
-
/* @__PURE__ */ (0,
|
|
15008
|
-
/* @__PURE__ */ (0,
|
|
15009
|
-
/* @__PURE__ */ (0,
|
|
15010
|
-
/* @__PURE__ */ (0,
|
|
15018
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsx)("div", { className: "w100n-guest-gate", children: /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)("div", { className: "w100n-guest-card", children: [
|
|
15019
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsx)("span", { className: "w100n-share-tile", "data-tone": tone, children: /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(Icon, { "aria-hidden": true }) }),
|
|
15020
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsx)("h2", { children: title }),
|
|
15021
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsx)("p", { children: body }),
|
|
15011
15022
|
form
|
|
15012
15023
|
] }) })
|
|
15013
15024
|
] });
|
|
@@ -15023,7 +15034,7 @@ function GuestDocument({ host, language = "en", theme = "light", brand }) {
|
|
|
15023
15034
|
password ? import_lucide_react11.Lock : import_lucide_react11.UserRound,
|
|
15024
15035
|
refused.file || t.documents,
|
|
15025
15036
|
shared + (password ? t.passwordAsk : t.nameAsk),
|
|
15026
|
-
/* @__PURE__ */ (0,
|
|
15037
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsxs)("form", { className: "w100n-guest-form", onSubmit: (e) => {
|
|
15027
15038
|
e.preventDefault();
|
|
15028
15039
|
if (!typed.trim()) return;
|
|
15029
15040
|
if (password) setAsk({ ...ask, password: typed });
|
|
@@ -15033,7 +15044,7 @@ function GuestDocument({ host, language = "en", theme = "light", brand }) {
|
|
|
15033
15044
|
}
|
|
15034
15045
|
setTyped("");
|
|
15035
15046
|
}, children: [
|
|
15036
|
-
/* @__PURE__ */ (0,
|
|
15047
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
|
|
15037
15048
|
"input",
|
|
15038
15049
|
{
|
|
15039
15050
|
className: "w100n-share-input",
|
|
@@ -15046,21 +15057,21 @@ function GuestDocument({ host, language = "en", theme = "light", brand }) {
|
|
|
15046
15057
|
onChange: (e) => setTyped(e.target.value)
|
|
15047
15058
|
}
|
|
15048
15059
|
),
|
|
15049
|
-
refused.reason === "wrong" && /* @__PURE__ */ (0,
|
|
15050
|
-
/* @__PURE__ */ (0,
|
|
15051
|
-
/* @__PURE__ */ (0,
|
|
15060
|
+
refused.reason === "wrong" && /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("p", { className: "w100n-docs-muted", role: "alert", children: t.wrongPassword }),
|
|
15061
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsxs)("button", { type: "submit", className: "w100n-docs-action", disabled: !typed.trim(), children: [
|
|
15062
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsx)(import_lucide_react11.Eye, { "aria-hidden": true }),
|
|
15052
15063
|
t.openDoc
|
|
15053
15064
|
] })
|
|
15054
15065
|
] })
|
|
15055
15066
|
);
|
|
15056
15067
|
}
|
|
15057
15068
|
if (refused?.reason === "busy") return gate("slate", import_lucide_react11.Ban, t.failed, t.tooMany);
|
|
15058
|
-
return gate("slate", import_lucide_react11.Ban, t.failed, "", /* @__PURE__ */ (0,
|
|
15069
|
+
return gate("slate", import_lucide_react11.Ban, t.failed, "", /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("button", { type: "button", className: "w100n-docs-action", onClick: opened2.retry, children: t.retry }));
|
|
15059
15070
|
}
|
|
15060
15071
|
const file = opened2.data;
|
|
15061
|
-
if (!file) return /* @__PURE__ */ (0,
|
|
15072
|
+
if (!file) return /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)("div", { className: "w100n-docs w100n-guest", "data-theme": theme, children: [
|
|
15062
15073
|
top(null, null),
|
|
15063
|
-
/* @__PURE__ */ (0,
|
|
15074
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsx)("div", { className: "w100n-docs-empty", children: t.loading })
|
|
15064
15075
|
] });
|
|
15065
15076
|
const kind = kindOf(file.name, file.mimeType);
|
|
15066
15077
|
const text = kind === "docx" || kind === "markdown";
|
|
@@ -15068,23 +15079,23 @@ function GuestDocument({ host, language = "en", theme = "light", brand }) {
|
|
|
15068
15079
|
const rights = { view: true, comment: talk, edit: false };
|
|
15069
15080
|
const quiet3 = () => {
|
|
15070
15081
|
};
|
|
15071
|
-
let stage = /* @__PURE__ */ (0,
|
|
15072
|
-
if (text) stage = /* @__PURE__ */ (0,
|
|
15073
|
-
else if (kind === "pdf") stage = /* @__PURE__ */ (0,
|
|
15074
|
-
else if (kind === "slides") stage = /* @__PURE__ */ (0,
|
|
15075
|
-
else if (kind === "sheet") stage = /* @__PURE__ */ (0,
|
|
15076
|
-
return /* @__PURE__ */ (0,
|
|
15082
|
+
let stage = /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("div", { className: "w100n-docs-empty", children: t.unsupported });
|
|
15083
|
+
if (text) stage = /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(import_react19.Suspense, { fallback: /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("div", { className: "w100n-docs-empty", children: t.loading }), children: /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(TextEditor4, { kind, bytes: file.bytes, t, language, rights, host: talk ? notes3 : void 0, documentId: file.id, onOutline: quiet3, slot: talk ? slot : null }) });
|
|
15084
|
+
else if (kind === "pdf") stage = /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(PdfView, { bytes: file.bytes, t, language, worker: host.pdfWorker, rights, documentId: file.id, onOutline: quiet3 });
|
|
15085
|
+
else if (kind === "slides") stage = /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(SlidesView, { html: new TextDecoder().decode(file.bytes), name: file.name, rights, language, theme, onOutline: quiet3 });
|
|
15086
|
+
else if (kind === "sheet") stage = /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(import_react19.Suspense, { fallback: /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("div", { className: "w100n-docs-empty", children: t.loading }), children: /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(SheetView4, { bytes: file.bytes, name: file.name, kind: /\.csv$/i.test(file.name) || file.mimeType === "text/csv" ? "csv" : "xlsx", rights, language, theme, documentId: file.id }) });
|
|
15087
|
+
return /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)("div", { className: "w100n-docs w100n-guest", "data-theme": theme, children: [
|
|
15077
15088
|
top(file, talk ? t.badgeComment : t.badgeRead),
|
|
15078
|
-
saving === "failed" && /* @__PURE__ */ (0,
|
|
15079
|
-
/* @__PURE__ */ (0,
|
|
15080
|
-
/* @__PURE__ */ (0,
|
|
15081
|
-
talk && /* @__PURE__ */ (0,
|
|
15082
|
-
/* @__PURE__ */ (0,
|
|
15083
|
-
/* @__PURE__ */ (0,
|
|
15084
|
-
/* @__PURE__ */ (0,
|
|
15089
|
+
saving === "failed" && /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("p", { className: "w100n-docs-muted w100n-guest-note", role: "alert", children: t.exportFailed }),
|
|
15090
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsxs)("div", { className: "w100n-docs-body w100n-guest-body", children: [
|
|
15091
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsx)("main", { className: "w100n-docs-stage", children: /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("div", { className: "w100n-docs-bare", children: stage }) }),
|
|
15092
|
+
talk && /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("aside", { className: "w100n-docs-side w100n-docs-panel w100n-guest-panel", "aria-label": t.comments, children: /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)("div", { className: "w100n-docs-panel-body", children: [
|
|
15093
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsxs)("label", { className: "w100n-share-field", children: [
|
|
15094
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsx)("span", { children: t.yourName }),
|
|
15095
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsx)("input", { className: "w100n-share-input", value: name, autoComplete: "name", placeholder: t.yourName, onChange: (e) => typeName(e.target.value) })
|
|
15085
15096
|
] }),
|
|
15086
|
-
/* @__PURE__ */ (0,
|
|
15087
|
-
/* @__PURE__ */ (0,
|
|
15097
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsx)("p", { className: "w100n-docs-muted", children: name.trim() ? t.nameHint : t.nameNeeded }),
|
|
15098
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsx)("div", { ref: setSlot })
|
|
15088
15099
|
] }) })
|
|
15089
15100
|
] })
|
|
15090
15101
|
] });
|
|
@@ -15096,6 +15107,7 @@ init_docx();
|
|
|
15096
15107
|
0 && (module.exports = {
|
|
15097
15108
|
DocumentOverlay,
|
|
15098
15109
|
DocumentsWorkspace,
|
|
15110
|
+
FilePreview,
|
|
15099
15111
|
GuestDocument,
|
|
15100
15112
|
GuestRefused,
|
|
15101
15113
|
SlidesView,
|