laif-ds 0.2.16 → 0.2.19
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/_virtual/index3.js +4 -4
- package/dist/_virtual/index5.js +4 -4
- package/dist/components/ui/file-previewer.js +26 -25
- package/dist/lib/utils.js +48 -42
- package/dist/node_modules/eventemitter3/index.js +1 -1
- package/dist/node_modules/recharts/es6/util/Events.js +1 -1
- package/dist/node_modules/unified/lib/index.js +1 -1
- package/package.json +3 -1
package/dist/_virtual/index3.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { getDefaultExportFromCjs as e } from "./_commonjsHelpers.js";
|
|
3
|
-
import { __require as
|
|
4
|
-
var
|
|
5
|
-
const
|
|
3
|
+
import { __require as t } from "../node_modules/eventemitter3/index2.js";
|
|
4
|
+
var r = t();
|
|
5
|
+
const m = /* @__PURE__ */ e(r);
|
|
6
6
|
export {
|
|
7
|
-
|
|
7
|
+
m as default
|
|
8
8
|
};
|
package/dist/_virtual/index5.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { getDefaultExportFromCjs as e } from "./_commonjsHelpers.js";
|
|
3
|
-
import { __require as
|
|
4
|
-
var
|
|
5
|
-
const
|
|
3
|
+
import { __require as r } from "../node_modules/extend/index.js";
|
|
4
|
+
var t = r();
|
|
5
|
+
const x = /* @__PURE__ */ e(t);
|
|
6
6
|
export {
|
|
7
|
-
|
|
7
|
+
x as default
|
|
8
8
|
};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import { jsxs as
|
|
2
|
+
import { jsxs as u, jsx as r } from "react/jsx-runtime";
|
|
3
3
|
import { createAsk as h } from "../../node_modules/use-ask/dist/index.js";
|
|
4
4
|
import { Dialog as v, DialogContent as w, DialogHeader as x, DialogTitle as g } from "./dialog.js";
|
|
5
5
|
import { Icon as N } from "./icon.js";
|
|
@@ -7,47 +7,48 @@ import { guessKind as y, isHttpUrl as b, getOfficeEmbedUrl as P } from "../../li
|
|
|
7
7
|
import { cn as A } from "../../lib/utils.js";
|
|
8
8
|
import { useMemo as s } from "react";
|
|
9
9
|
const [d, D] = h({});
|
|
10
|
-
function
|
|
10
|
+
function f(e) {
|
|
11
11
|
return typeof e == "string" ? { url: e } : e || {};
|
|
12
12
|
}
|
|
13
13
|
async function z(e) {
|
|
14
|
-
return d.ask(
|
|
14
|
+
return d.ask(f(e));
|
|
15
15
|
}
|
|
16
16
|
function C(e) {
|
|
17
|
-
return d.safeAsk(
|
|
17
|
+
return d.safeAsk(f(e));
|
|
18
18
|
}
|
|
19
19
|
const H = () => {
|
|
20
|
-
const [{ payload: e }, { asking:
|
|
21
|
-
|
|
20
|
+
const [{ payload: e }, { asking: t, cancel: i }] = D(), n = e?.url, a = s(() => e?.filename ? e?.filename : (e?.url || "").split(/[?#]/)[0].split("/").pop() || "" || "document", [e?.filename, e?.url]), o = s(() => {
|
|
21
|
+
if (!e?.url) return null;
|
|
22
|
+
const l = new URL(e?.url), c = l.searchParams.get("response-content-type") || l.searchParams.get("content-type"), m = e?.mimeType || c || "";
|
|
22
23
|
return y({
|
|
23
|
-
mimeType:
|
|
24
|
-
filename:
|
|
24
|
+
mimeType: m,
|
|
25
|
+
filename: a,
|
|
25
26
|
url: e?.url
|
|
26
27
|
});
|
|
27
|
-
}, [e?.mimeType,
|
|
28
|
-
() => /* @__PURE__ */
|
|
28
|
+
}, [e?.mimeType, a, e?.url]), p = s(
|
|
29
|
+
() => /* @__PURE__ */ u("span", { className: "flex items-center gap-2", children: [
|
|
29
30
|
/* @__PURE__ */ r(N, { name: "File", className: "h-4 w-4" }),
|
|
30
|
-
e?.title ||
|
|
31
|
+
e?.title || a
|
|
31
32
|
] }),
|
|
32
|
-
[e?.title,
|
|
33
|
+
[e?.title, a]
|
|
33
34
|
);
|
|
34
|
-
return /* @__PURE__ */ r(v, { open:
|
|
35
|
+
return /* @__PURE__ */ r(v, { open: t, onOpenChange: (l) => !l && i(), children: /* @__PURE__ */ u(w, { size: "xl", className: "sm:max-w-4xl", children: [
|
|
35
36
|
/* @__PURE__ */ r(x, { children: /* @__PURE__ */ r(g, { children: p }) }),
|
|
36
|
-
/* @__PURE__ */ r("div", { className: A("relative", "max-h-[80vh] overflow-auto p-1"), children: /* @__PURE__ */ r(F, { kind:
|
|
37
|
+
/* @__PURE__ */ r("div", { className: A("relative", "max-h-[80vh] overflow-auto p-1"), children: o && n ? /* @__PURE__ */ r(F, { kind: o, src: n, officeUrl: n }) : null })
|
|
37
38
|
] }) });
|
|
38
39
|
}, F = ({
|
|
39
40
|
kind: e,
|
|
40
|
-
src:
|
|
41
|
-
officeUrl:
|
|
41
|
+
src: t,
|
|
42
|
+
officeUrl: i
|
|
42
43
|
}) => {
|
|
43
|
-
if (!
|
|
44
|
+
if (!t && e !== "text" && e !== "office")
|
|
44
45
|
return /* @__PURE__ */ r("div", { className: "text-d-secondary-foreground", children: "Nessuna sorgente disponibile" });
|
|
45
46
|
switch (e) {
|
|
46
47
|
case "image":
|
|
47
48
|
return /* @__PURE__ */ r("div", { className: "grid place-items-center", children: /* @__PURE__ */ r(
|
|
48
49
|
"img",
|
|
49
50
|
{
|
|
50
|
-
src:
|
|
51
|
+
src: t,
|
|
51
52
|
alt: "preview",
|
|
52
53
|
className: "max-h-[78vh] w-auto max-w-full object-contain"
|
|
53
54
|
}
|
|
@@ -56,31 +57,31 @@ const H = () => {
|
|
|
56
57
|
return /* @__PURE__ */ r(
|
|
57
58
|
"iframe",
|
|
58
59
|
{
|
|
59
|
-
src:
|
|
60
|
+
src: t,
|
|
60
61
|
title: "PDF Preview",
|
|
61
62
|
className: "h-[78vh] w-full rounded"
|
|
62
63
|
}
|
|
63
64
|
);
|
|
64
65
|
case "audio":
|
|
65
|
-
return /* @__PURE__ */ r("div", { className: "grid place-items-center", children: /* @__PURE__ */ r("audio", { controls: !0, className: "w-full max-w-2xl", children: /* @__PURE__ */ r("source", { src:
|
|
66
|
+
return /* @__PURE__ */ r("div", { className: "grid place-items-center", children: /* @__PURE__ */ r("audio", { controls: !0, className: "w-full max-w-2xl", children: /* @__PURE__ */ r("source", { src: t }) }) });
|
|
66
67
|
case "video":
|
|
67
|
-
return /* @__PURE__ */ r("div", { className: "grid place-items-center", children: /* @__PURE__ */ r("video", { controls: !0, className: "max-h-[78vh] w-full max-w-3xl rounded", children: /* @__PURE__ */ r("source", { src:
|
|
68
|
+
return /* @__PURE__ */ r("div", { className: "grid place-items-center", children: /* @__PURE__ */ r("video", { controls: !0, className: "max-h-[78vh] w-full max-w-3xl rounded", children: /* @__PURE__ */ r("source", { src: t }) }) });
|
|
68
69
|
case "text":
|
|
69
70
|
return /* @__PURE__ */ r(
|
|
70
71
|
"iframe",
|
|
71
72
|
{
|
|
72
|
-
src:
|
|
73
|
+
src: t,
|
|
73
74
|
title: "Text Preview",
|
|
74
75
|
className: "h-[78vh] w-full rounded"
|
|
75
76
|
}
|
|
76
77
|
);
|
|
77
78
|
case "office": {
|
|
78
|
-
if (
|
|
79
|
-
const
|
|
79
|
+
if (i && b(i)) {
|
|
80
|
+
const n = P(i);
|
|
80
81
|
return /* @__PURE__ */ r(
|
|
81
82
|
"iframe",
|
|
82
83
|
{
|
|
83
|
-
src:
|
|
84
|
+
src: n,
|
|
84
85
|
title: "Office Preview",
|
|
85
86
|
className: "h-[78vh] w-full rounded"
|
|
86
87
|
}
|
package/dist/lib/utils.js
CHANGED
|
@@ -1,47 +1,53 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
|
|
5
|
-
|
|
2
|
+
import { guessKind as l, getOfficeEmbedUrl as m } from "./file-preview.js";
|
|
3
|
+
import { clsx as d } from "../node_modules/clsx/dist/clsx.js";
|
|
4
|
+
import { twMerge as p } from "../node_modules/tailwind-merge/dist/bundle-mjs.js";
|
|
5
|
+
function u(...n) {
|
|
6
|
+
return p(d(n));
|
|
6
7
|
}
|
|
7
|
-
const
|
|
8
|
-
if (!
|
|
9
|
-
let
|
|
10
|
-
for (let
|
|
11
|
-
|
|
12
|
-
let
|
|
13
|
-
const
|
|
14
|
-
|
|
15
|
-
const
|
|
16
|
-
return `#${
|
|
17
|
-
},
|
|
18
|
-
let
|
|
19
|
-
|
|
20
|
-
const o = parseInt(
|
|
21
|
-
return `rgba(${
|
|
22
|
-
},
|
|
23
|
-
const
|
|
24
|
-
return (0.299 *
|
|
25
|
-
},
|
|
26
|
-
if (!
|
|
27
|
-
const
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
8
|
+
const b = (n) => {
|
|
9
|
+
if (!n) return "#777777";
|
|
10
|
+
let e = 0;
|
|
11
|
+
for (let s = 0; s < n.length; s += 1)
|
|
12
|
+
e = n.charCodeAt(s) + ((e << 5) - e), e &= e;
|
|
13
|
+
let t = e >> 16 & 255, o = e >> 8 & 255, r = e & 255;
|
|
14
|
+
const c = 60, a = 200;
|
|
15
|
+
t = Math.min(a, Math.max(c, t)), o = Math.min(a, Math.max(c, o)), r = Math.min(a, Math.max(c, r));
|
|
16
|
+
const i = (s) => s.toString(16).padStart(2, "0");
|
|
17
|
+
return `#${i(t)}${i(o)}${i(r)}`;
|
|
18
|
+
}, w = (n, e) => {
|
|
19
|
+
let t = n.replace("#", "");
|
|
20
|
+
t.length === 3 && (t = t.split("").map((i) => i + i).join(""));
|
|
21
|
+
const o = parseInt(t, 16), r = o >> 16 & 255, c = o >> 8 & 255, a = o & 255;
|
|
22
|
+
return `rgba(${r}, ${c}, ${a}, ${e})`;
|
|
23
|
+
}, x = (n) => {
|
|
24
|
+
const e = parseInt(n.replace("#", ""), 16), t = e >> 16 & 255, o = e >> 8 & 255, r = e & 255;
|
|
25
|
+
return (0.299 * t + 0.587 * o + 0.114 * r) / 255 > 0.5 ? "#000000" : "#FFFFFF";
|
|
26
|
+
}, y = (n, e) => {
|
|
27
|
+
if (!n) return;
|
|
28
|
+
const t = n.split("?")[1] || "";
|
|
29
|
+
let o = "";
|
|
30
|
+
try {
|
|
31
|
+
const c = new URLSearchParams(t);
|
|
32
|
+
o = c.get("response-content-type") || c.get("content-type") || "";
|
|
33
|
+
} catch {
|
|
34
|
+
}
|
|
35
|
+
if (l({ mimeType: o, filename: e, url: n }) === "office") {
|
|
36
|
+
const c = m(n);
|
|
37
|
+
window.open(c, "_blank");
|
|
38
|
+
return;
|
|
39
|
+
}
|
|
40
|
+
window.open(n, "_blank");
|
|
41
|
+
}, F = (n, e) => {
|
|
42
|
+
if (!n) return;
|
|
43
|
+
const t = document.createElement("a");
|
|
44
|
+
t.href = n, t.download = e || "document", t.style.display = "none", document.body.appendChild(t), t.click(), document.body.removeChild(t);
|
|
39
45
|
};
|
|
40
46
|
export {
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
+
u as cn,
|
|
48
|
+
F as downloadFile,
|
|
49
|
+
x as hexContrast,
|
|
50
|
+
w as hexToRgba,
|
|
51
|
+
y as previewFile,
|
|
52
|
+
b as stringToHexColor
|
|
47
53
|
};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { bail as P } from "../../bail/index.js";
|
|
3
|
-
import y from "../../../_virtual/
|
|
3
|
+
import y from "../../../_virtual/index5.js";
|
|
4
4
|
import z from "../../is-plain-obj/index.js";
|
|
5
5
|
import { CallableInstance as C } from "./callable-instance.js";
|
|
6
6
|
import { trough as A } from "../../trough/lib/index.js";
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "laif-ds",
|
|
3
3
|
"private": false,
|
|
4
|
-
"version": "0.2.
|
|
4
|
+
"version": "0.2.19",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/index.es.js",
|
|
7
7
|
"module": "dist/index.es.js",
|
|
@@ -61,6 +61,7 @@
|
|
|
61
61
|
"@tailwindcss/postcss": "^4.1.10",
|
|
62
62
|
"@types/lodash": "^4.17.18",
|
|
63
63
|
"@types/node": "^24.0.4",
|
|
64
|
+
"@types/papaparse": "^5.3.16",
|
|
64
65
|
"@types/react": "^19.1.8",
|
|
65
66
|
"@types/react-dom": "^19.1.6",
|
|
66
67
|
"@types/react-window": "^1.8.8",
|
|
@@ -138,6 +139,7 @@
|
|
|
138
139
|
"lexical": "^0.32.1",
|
|
139
140
|
"lucide-react": "^0.523.0",
|
|
140
141
|
"next-themes": "^0.4.6",
|
|
142
|
+
"papaparse": "^5.5.3",
|
|
141
143
|
"react-colorful": "^5.6.1",
|
|
142
144
|
"react-day-picker": "^9.7.0",
|
|
143
145
|
"react-hook-form": "^7.58.1",
|