laif-ds 0.2.16 → 0.2.18

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,8 +1,8 @@
1
1
  "use client";
2
2
  import { getDefaultExportFromCjs as e } from "./_commonjsHelpers.js";
3
- import { __require as r } from "../node_modules/extend/index.js";
4
- var t = r();
5
- const x = /* @__PURE__ */ e(t);
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
- x as default
7
+ m as default
8
8
  };
@@ -1,8 +1,8 @@
1
1
  "use client";
2
2
  import { getDefaultExportFromCjs as e } from "./_commonjsHelpers.js";
3
- import { __require as t } from "../node_modules/eventemitter3/index2.js";
4
- var r = t();
5
- const m = /* @__PURE__ */ e(r);
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
- m as default
7
+ x as default
8
8
  };
@@ -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
  };
@@ -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
- import { jsxs as m, jsx as r } from "react/jsx-runtime";
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 u(e) {
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(u(e));
14
+ return d.ask(f(e));
15
15
  }
16
16
  function C(e) {
17
- return d.safeAsk(u(e));
17
+ return d.safeAsk(f(e));
18
18
  }
19
19
  const H = () => {
20
- const [{ payload: e }, { asking: i, cancel: t }] = D(), a = e?.url, l = s(() => e?.filename ? e.filename : (e?.url || "").split(/[?#]/)[0].split("/").pop() || "" || "document", [e?.filename, e?.url]), f = s(() => {
21
- const n = new URL(e?.url || window?.location?.href || ""), o = n.searchParams.get("response-content-type") || n.searchParams.get("content-type"), c = e?.mimeType || o || "";
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: c,
24
- filename: l,
24
+ mimeType: m,
25
+ filename: a,
25
26
  url: e?.url
26
27
  });
27
- }, [e?.mimeType, l, e?.url]), p = s(
28
- () => /* @__PURE__ */ m("span", { className: "flex items-center gap-2", children: [
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 || l
31
+ e?.title || a
31
32
  ] }),
32
- [e?.title, l]
33
+ [e?.title, a]
33
34
  );
34
- return /* @__PURE__ */ r(v, { open: i, onOpenChange: (n) => !n && t(), children: /* @__PURE__ */ m(w, { size: "xl", className: "sm:max-w-4xl", children: [
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: f, src: a, officeUrl: a }) })
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: i,
41
- officeUrl: t
41
+ src: t,
42
+ officeUrl: i
42
43
  }) => {
43
- if (!i && e !== "text" && e !== "office")
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: i,
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: i,
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: i }) }) });
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: i }) }) });
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: i,
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 (t && b(t)) {
79
- const a = P(t);
79
+ if (i && b(i)) {
80
+ const n = P(i);
80
81
  return /* @__PURE__ */ r(
81
82
  "iframe",
82
83
  {
83
- src: a,
84
+ src: n,
84
85
  title: "Office Preview",
85
86
  className: "h-[78vh] w-full rounded"
86
87
  }
@@ -1,5 +1,5 @@
1
1
  "use client";
2
- import e from "../../_virtual/index5.js";
2
+ import e from "../../_virtual/index3.js";
3
3
  export {
4
4
  e as EventEmitter,
5
5
  e as default
@@ -1,5 +1,5 @@
1
1
  "use client";
2
- import { __module as x } from "../../_virtual/index7.js";
2
+ import { __module as x } from "../../_virtual/index6.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 e from "../../../../_virtual/index5.js";
2
+ import e from "../../../../_virtual/index3.js";
3
3
  var r = new e(), n = "recharts.syncEvent.tooltip";
4
4
  export {
5
5
  n as TOOLTIP_SYNC_EVENT,
@@ -1,5 +1,5 @@
1
1
  "use client";
2
- import { __exports as r } from "../../../_virtual/index6.js";
2
+ import { __exports as r } from "../../../_virtual/index7.js";
3
3
  import { __require as c } from "../../inline-style-parser/index.js";
4
4
  var f;
5
5
  function j() {
@@ -1,6 +1,6 @@
1
1
  "use client";
2
2
  import { bail as P } from "../../bail/index.js";
3
- import y from "../../../_virtual/index3.js";
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.16",
4
+ "version": "0.2.18",
5
5
  "type": "module",
6
6
  "main": "dist/index.es.js",
7
7
  "module": "dist/index.es.js",