laif-ds 0.2.18 → 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.
@@ -1,5 +1,5 @@
1
1
  "use client";
2
- var e = { exports: {} };
2
+ var e = {};
3
3
  export {
4
- e as __module
4
+ e as __exports
5
5
  };
@@ -1,5 +1,5 @@
1
1
  "use client";
2
- var e = {};
2
+ var e = { exports: {} };
3
3
  export {
4
- e as __exports
4
+ e as __module
5
5
  };
package/dist/lib/utils.js CHANGED
@@ -1,47 +1,53 @@
1
1
  "use client";
2
- import { clsx as r } from "../node_modules/clsx/dist/clsx.js";
3
- import { twMerge as l } from "../node_modules/tailwind-merge/dist/bundle-mjs.js";
4
- function g(...t) {
5
- return l(r(t));
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 h = (t) => {
8
- if (!t) return "#777777";
9
- let n = 0;
10
- for (let p = 0; p < t.length; p += 1)
11
- n = t.charCodeAt(p) + ((n << 5) - n), n &= n;
12
- let e = n >> 16 & 255, o = n >> 8 & 255, c = n & 255;
13
- const i = 60, a = 200;
14
- e = Math.min(a, Math.max(i, e)), o = Math.min(a, Math.max(i, o)), c = Math.min(a, Math.max(i, c));
15
- const s = (p) => p.toString(16).padStart(2, "0");
16
- return `#${s(e)}${s(o)}${s(c)}`;
17
- }, x = (t, n) => {
18
- let e = t.replace("#", "");
19
- e.length === 3 && (e = e.split("").map((s) => s + s).join(""));
20
- const o = parseInt(e, 16), c = o >> 16 & 255, i = o >> 8 & 255, a = o & 255;
21
- return `rgba(${c}, ${i}, ${a}, ${n})`;
22
- }, b = (t) => {
23
- const n = parseInt(t.replace("#", ""), 16), e = n >> 16 & 255, o = n >> 8 & 255, c = n & 255;
24
- return (0.299 * e + 0.587 * o + 0.114 * c) / 255 > 0.5 ? "#000000" : "#FFFFFF";
25
- }, f = (t, n) => {
26
- if (!t) return;
27
- const e = n?.split(".").pop()?.toLowerCase() || "";
28
- if (["pdf", "jpg", "jpeg", "png", "gif", "bmp", "webp", "svg"].includes(e))
29
- window.open(t, "_blank");
30
- else if (["doc", "docx", "xls", "xlsx", "ppt", "pptx"].includes(e)) {
31
- const o = `https://view.officeapps.live.com/op/embed.aspx?src=${encodeURIComponent(t)}`;
32
- window.open(o, "_blank");
33
- } else
34
- window.open(t, "_blank");
35
- }, w = (t, n) => {
36
- if (!t) return;
37
- const e = document.createElement("a");
38
- e.href = t, e.download = n || "document", e.style.display = "none", document.body.appendChild(e), e.click(), document.body.removeChild(e);
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
- g as cn,
42
- w as downloadFile,
43
- b as hexContrast,
44
- x as hexToRgba,
45
- f as previewFile,
46
- h as stringToHexColor
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,5 +1,5 @@
1
1
  "use client";
2
- import { __module as x } from "../../_virtual/index6.js";
2
+ import { __module as x } from "../../_virtual/index7.js";
3
3
  var w;
4
4
  function O() {
5
5
  return w ? x.exports : (w = 1, function(d) {
@@ -1,5 +1,5 @@
1
1
  "use client";
2
- import { __exports as r } from "../../../_virtual/index7.js";
2
+ import { __exports as r } from "../../../_virtual/index6.js";
3
3
  import { __require as c } from "../../inline-style-parser/index.js";
4
4
  var f;
5
5
  function j() {
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "laif-ds",
3
3
  "private": false,
4
- "version": "0.2.18",
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",