@krosoft/react 0.0.376 → 0.0.377

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.
@@ -0,0 +1,257 @@
1
+ import { t as e } from "./tailwind.helper-CJaRYBmL.js";
2
+ import { filterChangelog as t, getChangelogItemAnchors as n, getChangelogTags as r, parseChangelog as i, splitChangelogItems as a } from "./helpers/index.js";
3
+ import { r as o, t as s } from "./i18n-BhLphJa3.js";
4
+ import { Nn as c } from "./ui-Fxy95kSJ.js";
5
+ import { t as l } from "./SearchInput-IT_Rvthr.js";
6
+ import { t as u } from "./useNotifications-CyhTruIG.js";
7
+ import { t as d } from "./AppMarkdown-CAxm82x0.js";
8
+ import { useEffect as f, useMemo as p, useState as m } from "react";
9
+ import { jsx as h, jsxs as g } from "react/jsx-runtime";
10
+ import { HashIcon as _, LinkIcon as v, TagIcon as y } from "lucide-react";
11
+ import { useLocation as b, useNavigate as x } from "react-router-dom";
12
+ import { format as S } from "date-fns";
13
+ //#region src/components/core/changelog/AppChangelogEntry.tsx
14
+ var C = ({ entry: t, onSelect: r, onCopyLink: i, selectedTags: c, linkedId: l }) => {
15
+ let { t: u } = s(), f = o(), m = p(() => a(t.content), [t.content]), b = p(() => n(t.id, m), [t.id, m]), x = t.date ? S(t.date, t.hasTime ? "d MMMM yyyy - HH:mm" : "d MMMM yyyy", { locale: f }) : void 0, C = (e) => {
16
+ e.preventDefault(), r(t.id);
17
+ }, w = /* @__PURE__ */ h("button", {
18
+ type: "button",
19
+ onClick: () => {
20
+ i(t.id);
21
+ },
22
+ title: u("markdown.copyLink"),
23
+ "aria-label": u("markdown.copyLink"),
24
+ className: "inline-flex shrink-0 text-muted-foreground transition-opacity hover:text-primary md:opacity-0 md:focus-visible:opacity-100 md:group-hover:opacity-100",
25
+ children: /* @__PURE__ */ h(v, { className: "size-4" })
26
+ });
27
+ return /* @__PURE__ */ g("article", {
28
+ id: t.id,
29
+ className: "group scroll-mt-4 py-8 first:pt-0",
30
+ children: [/* @__PURE__ */ g("div", {
31
+ className: "mb-4 flex flex-wrap items-center gap-x-3 gap-y-1",
32
+ children: [
33
+ t.version === void 0 ? null : /* @__PURE__ */ g("span", {
34
+ title: u("changelog.version", { version: t.version }),
35
+ className: "inline-flex items-center gap-1.5 rounded-full border border-primary/30 bg-primary/10 px-2.5 py-0.5 font-mono text-xs font-semibold text-primary",
36
+ children: [/* @__PURE__ */ h(y, {
37
+ className: "size-3",
38
+ "aria-hidden": "true"
39
+ }), t.version]
40
+ }),
41
+ t.title === void 0 ? null : /* @__PURE__ */ h("h2", {
42
+ className: "text-lg font-semibold leading-tight text-foreground",
43
+ children: t.title
44
+ }),
45
+ x === void 0 ? null : /* @__PURE__ */ h("a", {
46
+ href: `#${t.id}`,
47
+ onClick: C,
48
+ className: "text-sm font-medium text-muted-foreground hover:text-primary",
49
+ children: x
50
+ }),
51
+ w
52
+ ]
53
+ }), /* @__PURE__ */ h("div", {
54
+ className: "space-y-4 pl-4 sm:pl-6",
55
+ children: m.map((t, n) => {
56
+ let r = b[n];
57
+ return /* @__PURE__ */ g("div", {
58
+ id: r,
59
+ className: e("scroll-mt-4 rounded-md", r !== void 0 && r === l && "-mx-3 bg-primary/5 px-3 py-2 ring-1 ring-primary/20"),
60
+ children: [t.tag === void 0 || r === void 0 ? null : /* @__PURE__ */ g("p", {
61
+ className: e("mb-1 flex items-center gap-1.5 text-sm font-semibold", c.includes(t.tag) ? "text-primary" : "text-foreground"),
62
+ children: [/* @__PURE__ */ h("button", {
63
+ type: "button",
64
+ onClick: () => {
65
+ i(r);
66
+ },
67
+ title: u("markdown.copyLink"),
68
+ "aria-label": u("markdown.copyLink"),
69
+ className: "inline-flex shrink-0 text-muted-foreground opacity-60 transition hover:text-primary hover:opacity-100",
70
+ children: /* @__PURE__ */ h(_, {
71
+ className: "size-3.5",
72
+ "aria-hidden": "true"
73
+ })
74
+ }), t.tag]
75
+ }), /* @__PURE__ */ h("div", {
76
+ className: e("min-w-0 [&>*:last-child]:mb-0", t.tag !== void 0 && "pl-5"),
77
+ children: /* @__PURE__ */ h(d, {
78
+ content: t.content,
79
+ headingAnchors: !1
80
+ })
81
+ })]
82
+ }, r ?? `item-${String(n)}`);
83
+ })
84
+ })]
85
+ });
86
+ }, w = ({ entries: t, activeId: n, onSelect: r, className: i }) => {
87
+ let { t: a } = s(), c = o();
88
+ return /* @__PURE__ */ g("nav", {
89
+ "aria-label": a("changelog.nav"),
90
+ className: i,
91
+ children: [/* @__PURE__ */ h("p", {
92
+ className: "mb-2 text-xs font-semibold uppercase tracking-wide text-muted-foreground",
93
+ children: a("changelog.nav")
94
+ }), /* @__PURE__ */ h("ul", {
95
+ className: "space-y-1",
96
+ children: t.map((t) => {
97
+ let i = t.id === n, o = t.date ? S(t.date, t.hasTime ? "d MMM yyyy - HH:mm" : "d MMM yyyy", { locale: c }) : void 0, s = t.title ?? o ?? t.heading, l = [t.version === void 0 ? void 0 : a("changelog.version", { version: t.version }), t.title === void 0 ? void 0 : o].filter(Boolean).join(" ");
98
+ return /* @__PURE__ */ h("li", { children: /* @__PURE__ */ g("a", {
99
+ href: `#${t.id}`,
100
+ onClick: (e) => {
101
+ e.preventDefault(), r(t.id);
102
+ },
103
+ "aria-current": i ? "location" : void 0,
104
+ className: e("block rounded-md border border-transparent px-3 py-1.5 text-sm text-muted-foreground transition-colors hover:text-foreground", i && "border-border bg-muted text-foreground"),
105
+ children: [/* @__PURE__ */ h("span", {
106
+ className: e("block", i && "font-semibold"),
107
+ children: s
108
+ }), l === "" ? null : /* @__PURE__ */ h("span", {
109
+ className: "mt-0.5 block whitespace-pre text-xs text-muted-foreground",
110
+ children: l
111
+ })]
112
+ }) }, t.id);
113
+ })
114
+ })]
115
+ });
116
+ }, T = ({ tags: t, selected: n, onToggle: r, onClear: i, className: a }) => {
117
+ let { t: o } = s();
118
+ return /* @__PURE__ */ g("div", {
119
+ className: a,
120
+ children: [/* @__PURE__ */ g("div", {
121
+ className: "mb-2 flex items-center justify-between gap-2",
122
+ children: [/* @__PURE__ */ h("p", {
123
+ className: "text-xs font-semibold uppercase tracking-wide text-muted-foreground",
124
+ children: o("changelog.tagsPlaceholder")
125
+ }), n.length > 0 ? /* @__PURE__ */ h("button", {
126
+ type: "button",
127
+ onClick: i,
128
+ className: "text-xs text-muted-foreground hover:text-foreground",
129
+ children: o("actions.clear")
130
+ }) : null]
131
+ }), /* @__PURE__ */ h("div", {
132
+ className: "flex flex-wrap gap-1.5",
133
+ children: t.map((t) => {
134
+ let i = n.includes(t);
135
+ return /* @__PURE__ */ h("button", {
136
+ type: "button",
137
+ "aria-pressed": i,
138
+ onClick: () => {
139
+ r(t);
140
+ },
141
+ className: e(c({ variant: i ? "default" : "outline" }), "cursor-pointer font-medium focus:ring-0 focus-visible:ring-2", !i && "hover:bg-muted"),
142
+ children: t
143
+ }, t);
144
+ })
145
+ })]
146
+ });
147
+ }, E = "0px 0px -60% 0px", D = ({ content: o, showNav: c = !0, showSearch: d = !0 }) => {
148
+ let { t: _ } = s(), { showSuccess: v, showError: y } = u(), S = b(), D = x(), [O, k] = m(""), [A, j] = m([]), [M, N] = m(), P = p(() => i(o), [o]), F = p(() => r(P), [P]), I = p(() => t(P, O, A), [
149
+ P,
150
+ O,
151
+ A
152
+ ]), L = (e) => {
153
+ j((t) => t.includes(e) ? t.filter((t) => t !== e) : [...t, e]);
154
+ }, R = p(() => {
155
+ let e = /* @__PURE__ */ new Map();
156
+ return I.forEach((t) => {
157
+ n(t.id, a(t.content)).forEach((n) => {
158
+ n !== void 0 && e.set(n, t.id);
159
+ });
160
+ }), e;
161
+ }, [I]), z = decodeURIComponent(S.hash.slice(1)), B = I.some((e) => e.id === z) ? z : R.get(z), V = B === void 0 ? void 0 : z, H = I.some((e) => e.id === M) ? M : B ?? I[0]?.id;
162
+ f(() => {
163
+ if (!V) return;
164
+ let e = requestAnimationFrame(() => {
165
+ document.getElementById(V)?.scrollIntoView({
166
+ behavior: "smooth",
167
+ block: "start"
168
+ });
169
+ });
170
+ return () => {
171
+ cancelAnimationFrame(e);
172
+ };
173
+ }, [V]), f(() => {
174
+ let e = /* @__PURE__ */ new Set(), t = new IntersectionObserver((t) => {
175
+ t.forEach((t) => {
176
+ t.isIntersecting ? e.add(t.target.id) : e.delete(t.target.id);
177
+ });
178
+ let n = I.find((t) => e.has(t.id));
179
+ n && N(n.id);
180
+ }, { rootMargin: E });
181
+ return I.forEach((e) => {
182
+ let n = document.getElementById(e.id);
183
+ n && t.observe(n);
184
+ }), () => {
185
+ t.disconnect();
186
+ };
187
+ }, [I]);
188
+ let U = (e) => {
189
+ D({
190
+ search: S.search,
191
+ hash: `#${e}`
192
+ }, { replace: !0 });
193
+ }, W = async (e) => {
194
+ U(e);
195
+ let t = `${window.location.origin}${S.pathname}${S.search}#${e}`;
196
+ try {
197
+ await navigator.clipboard.writeText(t), v(_("markdown.linkCopied"));
198
+ } catch {
199
+ y(_("markdown.linkCopyError"));
200
+ }
201
+ };
202
+ if (P.length === 0) return /* @__PURE__ */ h("p", {
203
+ className: "text-sm text-muted-foreground",
204
+ children: _("changelog.empty")
205
+ });
206
+ let G = /* @__PURE__ */ g("div", {
207
+ className: "flex flex-col gap-4",
208
+ children: [/* @__PURE__ */ h(l, {
209
+ search: O,
210
+ onSearch: k,
211
+ className: "md:w-full"
212
+ }), F.length > 0 ? /* @__PURE__ */ h(T, {
213
+ tags: F,
214
+ selected: A,
215
+ onToggle: L,
216
+ onClear: () => {
217
+ j([]);
218
+ }
219
+ }) : null]
220
+ });
221
+ return /* @__PURE__ */ g("div", {
222
+ className: "flex gap-10",
223
+ children: [c ? /* @__PURE__ */ g("aside", {
224
+ className: "sticky top-4 hidden max-h-[calc(100vh-2rem)] w-60 shrink-0 flex-col gap-8 self-start lg:flex",
225
+ children: [d ? G : null, I.length > 0 ? /* @__PURE__ */ h(w, {
226
+ entries: I,
227
+ activeId: H,
228
+ onSelect: U,
229
+ className: "min-h-0 flex-1 overflow-y-auto"
230
+ }) : null]
231
+ }) : null, /* @__PURE__ */ g("div", {
232
+ className: e("min-w-0 flex-1", c && "lg:border-l lg:pl-10"),
233
+ children: [
234
+ d ? /* @__PURE__ */ h("div", {
235
+ className: e("mb-6 md:max-w-md", c && "lg:hidden"),
236
+ children: G
237
+ }) : null,
238
+ I.length === 0 ? /* @__PURE__ */ h("p", {
239
+ className: "text-sm text-muted-foreground",
240
+ children: _("changelog.noResult")
241
+ }) : null,
242
+ /* @__PURE__ */ h("div", {
243
+ className: "divide-y",
244
+ children: I.map((e) => /* @__PURE__ */ h(C, {
245
+ entry: e,
246
+ onSelect: U,
247
+ onCopyLink: (e) => void W(e),
248
+ selectedTags: A,
249
+ linkedId: V
250
+ }, e.id))
251
+ })
252
+ ]
253
+ })]
254
+ });
255
+ };
256
+ //#endregion
257
+ export { D as t };
@@ -12,7 +12,7 @@ export interface AppChangelogProps {
12
12
  }
13
13
  /**
14
14
  * Journal des modifications : sommaire des dates dans une colonne collante à gauche (la date en cours de lecture
15
- * y est surlignée), entrées datées empilées à droite. Chaque date porte une ancre partageable (`#2026-10-30-1441`).
15
+ * y est surlignée), entrées datées empilées à droite. Chaque date et chaque catégorie portent une ancre partageable (`#2026-10-30-1441`, `#2026-10-30-1441-factures`).
16
16
  * Sur petit écran, la colonne disparaît et les filtres passent au-dessus des entrées.
17
17
  */
18
18
  export declare const AppChangelog: ({ content, showNav, showSearch }: AppChangelogProps) => JSX.Element;
@@ -1 +1 @@
1
- {"version":3,"file":"AppChangelog.d.ts","sourceRoot":"","sources":["../../../../src/components/core/changelog/AppChangelog.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,OAAO,CAAC;AAYjC,MAAM,WAAW,iBAAiB;IAChC;;;OAGG;IACH,OAAO,EAAE,MAAM,CAAC;IAChB,sGAAsG;IACtG,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,0DAA0D;IAC1D,UAAU,CAAC,EAAE,OAAO,CAAC;CACtB;AAKD;;;;GAIG;AACH,eAAO,MAAM,YAAY,GAAI,kCAAgD,iBAAiB,KAAG,GAAG,CAAC,OA0HpG,CAAC"}
1
+ {"version":3,"file":"AppChangelog.d.ts","sourceRoot":"","sources":["../../../../src/components/core/changelog/AppChangelog.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,OAAO,CAAC;AAYjC,MAAM,WAAW,iBAAiB;IAChC;;;OAGG;IACH,OAAO,EAAE,MAAM,CAAC;IAChB,sGAAsG;IACtG,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,0DAA0D;IAC1D,UAAU,CAAC,EAAE,OAAO,CAAC;CACtB;AAKD;;;;GAIG;AACH,eAAO,MAAM,YAAY,GAAI,kCAAgD,iBAAiB,KAAG,GAAG,CAAC,OAgJpG,CAAC"}
@@ -6,8 +6,10 @@ interface AppChangelogEntryProps {
6
6
  onCopyLink: (id: string) => void;
7
7
  /** Catégories actuellement filtrées : leurs tags sont mis en évidence. */
8
8
  selectedTags: string[];
9
+ /** Ancre présente dans l'url : l'élément correspondant est mis en évidence. */
10
+ linkedId?: string;
9
11
  }
10
- /** Une entrée du journal : ses éléments (tag de catégorie + texte markdown) et le lien de partage au survol. */
11
- export declare const AppChangelogEntry: ({ entry, onSelect, onCopyLink, selectedTags }: AppChangelogEntryProps) => JSX.Element;
12
+ /** Une entrée du journal : ses éléments (catégorie + texte markdown) et les liens de partage (entrée et éléments). */
13
+ export declare const AppChangelogEntry: ({ entry, onSelect, onCopyLink, selectedTags, linkedId }: AppChangelogEntryProps) => JSX.Element;
12
14
  export {};
13
15
  //# sourceMappingURL=AppChangelogEntry.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"AppChangelogEntry.d.ts","sourceRoot":"","sources":["../../../../src/components/core/changelog/AppChangelogEntry.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,GAAG,EAAc,MAAM,OAAO,CAAC;AAS7C,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,wBAAwB,CAAC;AAE7D,UAAU,sBAAsB;IAC9B,KAAK,EAAE,cAAc,CAAC;IACtB,QAAQ,EAAE,CAAC,EAAE,EAAE,MAAM,KAAK,IAAI,CAAC;IAC/B,UAAU,EAAE,CAAC,EAAE,EAAE,MAAM,KAAK,IAAI,CAAC;IACjC,0EAA0E;IAC1E,YAAY,EAAE,MAAM,EAAE,CAAC;CACxB;AAED,gHAAgH;AAChH,eAAO,MAAM,iBAAiB,GAAI,+CAA+C,sBAAsB,KAAG,GAAG,CAAC,OA8D7G,CAAC"}
1
+ {"version":3,"file":"AppChangelogEntry.d.ts","sourceRoot":"","sources":["../../../../src/components/core/changelog/AppChangelogEntry.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,GAAG,EAAc,MAAM,OAAO,CAAC;AAQ7C,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,wBAAwB,CAAC;AAE7D,UAAU,sBAAsB;IAC9B,KAAK,EAAE,cAAc,CAAC;IACtB,QAAQ,EAAE,CAAC,EAAE,EAAE,MAAM,KAAK,IAAI,CAAC;IAC/B,UAAU,EAAE,CAAC,EAAE,EAAE,MAAM,KAAK,IAAI,CAAC;IACjC,0EAA0E;IAC1E,YAAY,EAAE,MAAM,EAAE,CAAC;IACvB,+EAA+E;IAC/E,QAAQ,CAAC,EAAE,MAAM,CAAC;CACnB;AAED,sHAAsH;AACtH,eAAO,MAAM,iBAAiB,GAAI,yDAAyD,sBAAsB,KAAG,GAAG,CAAC,OAuFvH,CAAC"}
@@ -1 +1 @@
1
- export { t as AppChangelog } from "../../../changelog-D0SbAISW.js";
1
+ export { t as AppChangelog } from "../../../changelog-DyPFIscf.js";
@@ -3,7 +3,7 @@ import { F as o } from "../../ui-Fxy95kSJ.js";
3
3
  import { A as s, D as c, E as l, F as u, M as d, N as f, O as p, P as m, j as h, k as g } from "../../sheet-cWJO_wkT.js";
4
4
  import { t as _ } from "../../SearchInput-IT_Rvthr.js";
5
5
  import { t as v } from "../../AppMarkdown-CAxm82x0.js";
6
- import { t as y } from "../../changelog-D0SbAISW.js";
6
+ import { t as y } from "../../changelog-DyPFIscf.js";
7
7
  import { a as b, c as x, i as S, n as C, o as w, r as T, s as E, t as D } from "../../charts-C7rKxkli.js";
8
8
  import { t as O } from "../../ErrorAlert-cJnfBL8H.js";
9
9
  import { i as k, n as A, r as j, t as M } from "../../dialogs-CG9Q7pqY.js";
@@ -9,7 +9,7 @@ import { a as ur, c as dr, i as fr, l as pr, n as mr, o as hr, r as gr, s as _r,
9
9
  import { t as br } from "../skeleton-D6Ga4BLw.js";
10
10
  import { t as xr } from "../SearchInput-IT_Rvthr.js";
11
11
  import { t as Sr } from "../AppMarkdown-CAxm82x0.js";
12
- import { t as Cr } from "../changelog-D0SbAISW.js";
12
+ import { t as Cr } from "../changelog-DyPFIscf.js";
13
13
  import { a as wr, c as Tr, i as Er, n as Dr, o as Or, r as kr, s as Ar, t as jr } from "../charts-C7rKxkli.js";
14
14
  import { t as Mr } from "../ErrorAlert-cJnfBL8H.js";
15
15
  import { i as Nr, n as Pr, r as Fr, t as Ir } from "../dialogs-CG9Q7pqY.js";
@@ -20,4 +20,9 @@ export declare const splitChangelogItems: (content: string) => ChangelogItem[];
20
20
  export declare const filterChangelog: (entries: ChangelogEntry[], query: string, tags?: string[]) => ChangelogEntry[];
21
21
  /** Modules (tags) cités dans le journal, sans doublon, triés par ordre alphabétique. */
22
22
  export declare const getChangelogTags: (entries: ChangelogEntry[]) => string[];
23
+ /**
24
+ * Ancre de chaque élément d'une entrée : `{ancre de l'entrée}-{catégorie}` (`2026-10-30-1441-factures`),
25
+ * suffixée `-2`, `-3`... si la catégorie revient dans la même entrée. Un élément sans catégorie n'a pas d'ancre.
26
+ */
27
+ export declare const getChangelogItemAnchors: (entryId: string, items: ChangelogItem[]) => (string | undefined)[];
23
28
  //# sourceMappingURL=changelog.helper.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"changelog.helper.d.ts","sourceRoot":"","sources":["../../src/helpers/changelog.helper.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,wBAAwB,CAAC;AAC7D,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,uBAAuB,CAAC;AAO3D,gFAAgF;AAChF,eAAO,MAAM,qBAAqB,GAAI,OAAO,MAAM,KAAG,MAK9B,CAAC;AA4BzB;;;GAGG;AACH,eAAO,MAAM,cAAc,GAAI,UAAU,MAAM,KAAG,cAAc,EAmC/D,CAAC;AAOF;;;;GAIG;AACH,eAAO,MAAM,mBAAmB,GAAI,SAAS,MAAM,KAAG,aAAa,EAqBlE,CAAC;AAKF;;;GAGG;AACH,eAAO,MAAM,eAAe,GAAI,SAAS,cAAc,EAAE,EAAE,OAAO,MAAM,EAAE,OAAM,MAAM,EAAO,KAAG,cAAc,EAY7G,CAAC;AAEF,wFAAwF;AACxF,eAAO,MAAM,gBAAgB,GAAI,SAAS,cAAc,EAAE,KAAG,MAAM,EAGlE,CAAC"}
1
+ {"version":3,"file":"changelog.helper.d.ts","sourceRoot":"","sources":["../../src/helpers/changelog.helper.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,wBAAwB,CAAC;AAC7D,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,uBAAuB,CAAC;AAO3D,gFAAgF;AAChF,eAAO,MAAM,qBAAqB,GAAI,OAAO,MAAM,KAAG,MAK9B,CAAC;AA4BzB;;;GAGG;AACH,eAAO,MAAM,cAAc,GAAI,UAAU,MAAM,KAAG,cAAc,EAmC/D,CAAC;AAOF;;;;GAIG;AACH,eAAO,MAAM,mBAAmB,GAAI,SAAS,MAAM,KAAG,aAAa,EAqBlE,CAAC;AAKF;;;GAGG;AACH,eAAO,MAAM,eAAe,GAAI,SAAS,cAAc,EAAE,EAAE,OAAO,MAAM,EAAE,OAAM,MAAM,EAAO,KAAG,cAAc,EAY7G,CAAC;AAEF,wFAAwF;AACxF,eAAO,MAAM,gBAAgB,GAAI,SAAS,cAAc,EAAE,KAAG,MAAM,EAGlE,CAAC;AAEF;;;GAGG;AACH,eAAO,MAAM,uBAAuB,GAAI,SAAS,MAAM,EAAE,OAAO,aAAa,EAAE,KAAG,CAAC,MAAM,GAAG,SAAS,CAAC,EAWrG,CAAC"}
@@ -59,10 +59,17 @@ var n = /^## +(.+?)\s*$/, r = /^(?:\[v?([^\]]+)\]\s*[-–]\s*)?(\d{4}-\d{2}-\d{2
59
59
  let t = f(`${e.heading}\n${e.content}`);
60
60
  return r.every((e) => t.includes(e));
61
61
  });
62
- }, m = (e) => [...new Set(e.flatMap((e) => d(e.content).flatMap((e) => e.tag === void 0 ? [] : [e.tag])))].sort((e, t) => e.localeCompare(t));
62
+ }, m = (e) => [...new Set(e.flatMap((e) => d(e.content).flatMap((e) => e.tag === void 0 ? [] : [e.tag])))].sort((e, t) => e.localeCompare(t)), h = (e, t) => {
63
+ let n = /* @__PURE__ */ new Map();
64
+ return t.map((t) => {
65
+ if (t.tag === void 0) return;
66
+ let r = `${e}-${a(t.tag)}`, i = (n.get(r) ?? 0) + 1;
67
+ return n.set(r, i), i === 1 ? r : `${r}-${String(i)}`;
68
+ });
69
+ };
63
70
  //#endregion
64
71
  //#region src/helpers/supabase.helper.ts
65
- function h(e, t, n = {}) {
72
+ function g(e, t, n = {}) {
66
73
  let r = e, i = t.debouncedSearchText ?? t.searchText;
67
74
  if (i?.trim() && n.searchColumns?.length) {
68
75
  let e = `%${i.trim()}%`, t = n.searchColumns.map((t) => `${t}.ilike.${e}`).join(",");
@@ -84,13 +91,13 @@ function h(e, t, n = {}) {
84
91
  let a = (t.currentPage - 1) * t.pageSize, o = a + t.pageSize - 1;
85
92
  return r = r.range(a, o), r;
86
93
  }
87
- function g(e, t) {
94
+ function _(e, t) {
88
95
  return e ? e.map((e) => {
89
96
  let n = e[t];
90
97
  return Array.isArray(n) ? n[0] : n;
91
98
  }).filter((e) => !!e) : [];
92
99
  }
93
- function _(e, t) {
100
+ function v(e, t) {
94
101
  if (!e) return null;
95
102
  let n = Array.isArray(e) ? e[0] : e;
96
103
  if (!n) return null;
@@ -102,24 +109,24 @@ function _(e, t) {
102
109
  }
103
110
  //#endregion
104
111
  //#region src/helpers/table.helper.ts
105
- var v = {
112
+ var y = {
106
113
  left: "text-left",
107
114
  center: "text-center",
108
115
  right: "text-right"
109
116
  };
110
- function y(e) {
117
+ function b(e) {
111
118
  if (e.align !== void 0) return e.align;
112
119
  let t = (e.className ?? "").split(/\s+/);
113
120
  return t.includes("text-right") ? "right" : t.includes("text-center") ? "center" : "left";
114
121
  }
115
- function b(e) {
116
- return v[e];
122
+ function x(e) {
123
+ return y[e];
117
124
  }
118
- var x = "__selection__", S = "__actions__", C = {
125
+ var S = "__selection__", C = "__actions__", w = {
119
126
  left: "border-r border-border",
120
127
  right: "border-l border-border"
121
128
  };
122
- function w(e, t) {
129
+ function T(e, t) {
123
130
  if (e === void 0) return {
124
131
  className: "relative",
125
132
  style: {}
@@ -131,12 +138,12 @@ function w(e, t) {
131
138
  n ? "z-20" : "z-10",
132
139
  "before:absolute before:inset-0 before:-z-10 before:pointer-events-none",
133
140
  n ? "before:bg-muted/50" : "group-hover:before:bg-muted/50",
134
- e.isEdge ? C[e.side] : ""
141
+ e.isEdge ? w[e.side] : ""
135
142
  ].filter(Boolean).join(" "),
136
143
  style: e.side === "left" ? { left: e.offset } : { right: e.offset }
137
144
  };
138
145
  }
139
- function T(e) {
146
+ function E(e) {
140
147
  return {
141
148
  read: () => {
142
149
  if (typeof window < "u") try {
@@ -156,4 +163,4 @@ function T(e) {
156
163
  };
157
164
  }
158
165
  //#endregion
159
- export { S as ACTIONS_COLUMN_KEY, x as SELECTION_COLUMN_KEY, h as applyTableStateToQuery, e as cn, p as filterChangelog, b as getAlignmentClass, m as getChangelogTags, y as getColumnAlignment, w as getFixedCellProps, T as localStorageColumnVisibility, g as mapNestedRelationMany, _ as mapNestedRelationOne, c as parseChangelog, t as rehypeVersionSlug, a as slugifyChangelogTitle, d as splitChangelogItems };
166
+ export { C as ACTIONS_COLUMN_KEY, S as SELECTION_COLUMN_KEY, g as applyTableStateToQuery, e as cn, p as filterChangelog, x as getAlignmentClass, h as getChangelogItemAnchors, m as getChangelogTags, b as getColumnAlignment, T as getFixedCellProps, E as localStorageColumnVisibility, _ as mapNestedRelationMany, v as mapNestedRelationOne, c as parseChangelog, t as rehypeVersionSlug, a as slugifyChangelogTitle, d as splitChangelogItems };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@krosoft/react",
3
- "version": "0.0.376",
3
+ "version": "0.0.377",
4
4
  "description": "Krosoft shared React package",
5
5
  "type": "module",
6
6
  "sideEffects": [
@@ -1,231 +0,0 @@
1
- import { t as e } from "./tailwind.helper-CJaRYBmL.js";
2
- import { filterChangelog as t, getChangelogTags as n, parseChangelog as r, splitChangelogItems as i } from "./helpers/index.js";
3
- import { r as a, t as o } from "./i18n-BhLphJa3.js";
4
- import { Nn as s } from "./ui-Fxy95kSJ.js";
5
- import { t as c } from "./SearchInput-IT_Rvthr.js";
6
- import { t as l } from "./useNotifications-CyhTruIG.js";
7
- import { t as u } from "./AppMarkdown-CAxm82x0.js";
8
- import { useEffect as d, useMemo as f, useState as p } from "react";
9
- import { jsx as m, jsxs as h } from "react/jsx-runtime";
10
- import { LinkIcon as g } from "lucide-react";
11
- import { useLocation as _, useNavigate as v } from "react-router-dom";
12
- import { format as y } from "date-fns";
13
- //#region src/components/core/changelog/AppChangelogEntry.tsx
14
- var b = ({ entry: t, onSelect: n, onCopyLink: r, selectedTags: c }) => {
15
- let { t: l } = o(), d = a(), p = f(() => i(t.content), [t.content]), _ = t.date ? y(t.date, t.hasTime ? "d MMMM yyyy - HH:mm" : "d MMMM yyyy", { locale: d }) : void 0;
16
- return /* @__PURE__ */ h("article", {
17
- id: t.id,
18
- className: "group scroll-mt-4 py-8 first:pt-0",
19
- children: [
20
- /* @__PURE__ */ h("div", {
21
- className: "mb-3 flex flex-wrap items-center gap-x-3 gap-y-1",
22
- children: [t.version === void 0 ? null : /* @__PURE__ */ m("span", {
23
- className: e(s({ variant: "secondary" }), "rounded-full hover:bg-secondary"),
24
- children: l("changelog.version", { version: t.version })
25
- }), _ === void 0 ? null : /* @__PURE__ */ m("a", {
26
- href: `#${t.id}`,
27
- onClick: (e) => {
28
- e.preventDefault(), n(t.id);
29
- },
30
- className: "text-sm font-medium text-muted-foreground hover:text-primary",
31
- children: _
32
- })]
33
- }),
34
- t.title === void 0 ? null : /* @__PURE__ */ m("h2", {
35
- className: "mb-4 text-xl font-semibold leading-tight text-foreground",
36
- children: t.title
37
- }),
38
- /* @__PURE__ */ h("div", {
39
- className: "flex gap-4",
40
- children: [/* @__PURE__ */ m("div", {
41
- className: "min-w-0 flex-1 space-y-3",
42
- children: p.map((t, n) => /* @__PURE__ */ h("div", {
43
- className: "flex flex-col items-start gap-1.5 sm:flex-row sm:gap-3",
44
- children: [t.tag === void 0 ? null : /* @__PURE__ */ m("span", {
45
- className: e(s({ variant: c.includes(t.tag) ? "default" : "secondary" }), c.includes(t.tag) ? "hover:bg-primary" : "hover:bg-secondary", "mt-0.5 shrink-0"),
46
- children: t.tag
47
- }), /* @__PURE__ */ m("div", {
48
- className: "min-w-0 [&>*:last-child]:mb-0",
49
- children: /* @__PURE__ */ m(u, {
50
- content: t.content,
51
- headingAnchors: !1
52
- })
53
- })]
54
- }, `${t.tag ?? ""}-${String(n)}`))
55
- }), /* @__PURE__ */ m("button", {
56
- type: "button",
57
- onClick: () => {
58
- r(t.id);
59
- },
60
- title: l("markdown.copyLink"),
61
- "aria-label": l("markdown.copyLink"),
62
- className: "mt-0.5 inline-flex h-fit shrink-0 text-muted-foreground transition-opacity hover:text-primary md:opacity-0 md:focus-visible:opacity-100 md:group-hover:opacity-100",
63
- children: /* @__PURE__ */ m(g, { className: "size-4" })
64
- })]
65
- })
66
- ]
67
- });
68
- }, x = ({ entries: t, activeId: n, onSelect: r, className: i }) => {
69
- let { t: s } = o(), c = a();
70
- return /* @__PURE__ */ h("nav", {
71
- "aria-label": s("changelog.nav"),
72
- className: i,
73
- children: [/* @__PURE__ */ m("p", {
74
- className: "mb-2 text-xs font-semibold uppercase tracking-wide text-muted-foreground",
75
- children: s("changelog.nav")
76
- }), /* @__PURE__ */ m("ul", {
77
- className: "space-y-1",
78
- children: t.map((t) => {
79
- let i = t.id === n, a = t.date ? y(t.date, t.hasTime ? "d MMM yyyy - HH:mm" : "d MMM yyyy", { locale: c }) : void 0, o = t.title ?? a ?? t.heading, l = [t.version === void 0 ? void 0 : s("changelog.version", { version: t.version }), t.title === void 0 ? void 0 : a].filter(Boolean).join(" ");
80
- return /* @__PURE__ */ m("li", { children: /* @__PURE__ */ h("a", {
81
- href: `#${t.id}`,
82
- onClick: (e) => {
83
- e.preventDefault(), r(t.id);
84
- },
85
- "aria-current": i ? "location" : void 0,
86
- className: e("block rounded-md border border-transparent px-3 py-1.5 text-sm text-muted-foreground transition-colors hover:text-foreground", i && "border-border bg-muted text-foreground"),
87
- children: [/* @__PURE__ */ m("span", {
88
- className: e("block", i && "font-semibold"),
89
- children: o
90
- }), l === "" ? null : /* @__PURE__ */ m("span", {
91
- className: "mt-0.5 block whitespace-pre text-xs text-muted-foreground",
92
- children: l
93
- })]
94
- }) }, t.id);
95
- })
96
- })]
97
- });
98
- }, S = ({ tags: t, selected: n, onToggle: r, onClear: i, className: a }) => {
99
- let { t: c } = o();
100
- return /* @__PURE__ */ h("div", {
101
- className: a,
102
- children: [/* @__PURE__ */ h("div", {
103
- className: "mb-2 flex items-center justify-between gap-2",
104
- children: [/* @__PURE__ */ m("p", {
105
- className: "text-xs font-semibold uppercase tracking-wide text-muted-foreground",
106
- children: c("changelog.tagsPlaceholder")
107
- }), n.length > 0 ? /* @__PURE__ */ m("button", {
108
- type: "button",
109
- onClick: i,
110
- className: "text-xs text-muted-foreground hover:text-foreground",
111
- children: c("actions.clear")
112
- }) : null]
113
- }), /* @__PURE__ */ m("div", {
114
- className: "flex flex-wrap gap-1.5",
115
- children: t.map((t) => {
116
- let i = n.includes(t);
117
- return /* @__PURE__ */ m("button", {
118
- type: "button",
119
- "aria-pressed": i,
120
- onClick: () => {
121
- r(t);
122
- },
123
- className: e(s({ variant: i ? "default" : "outline" }), "cursor-pointer font-medium focus:ring-0 focus-visible:ring-2", !i && "hover:bg-muted"),
124
- children: t
125
- }, t);
126
- })
127
- })]
128
- });
129
- }, C = "0px 0px -60% 0px", w = ({ content: i, showNav: a = !0, showSearch: s = !0 }) => {
130
- let { t: u } = o(), { showSuccess: g, showError: y } = l(), w = _(), T = v(), [E, D] = p(""), [O, k] = p([]), [A, j] = p(), M = f(() => r(i), [i]), N = f(() => n(M), [M]), P = f(() => t(M, E, O), [
131
- M,
132
- E,
133
- O
134
- ]), F = (e) => {
135
- k((t) => t.includes(e) ? t.filter((t) => t !== e) : [...t, e]);
136
- }, I = decodeURIComponent(w.hash.slice(1)), L = P.some((e) => e.id === I) ? I : void 0, R = P.some((e) => e.id === A) ? A : L ?? P[0]?.id;
137
- d(() => {
138
- if (!L) return;
139
- let e = requestAnimationFrame(() => {
140
- document.getElementById(L)?.scrollIntoView({
141
- behavior: "smooth",
142
- block: "start"
143
- });
144
- });
145
- return () => {
146
- cancelAnimationFrame(e);
147
- };
148
- }, [L]), d(() => {
149
- let e = /* @__PURE__ */ new Set(), t = new IntersectionObserver((t) => {
150
- t.forEach((t) => {
151
- t.isIntersecting ? e.add(t.target.id) : e.delete(t.target.id);
152
- });
153
- let n = P.find((t) => e.has(t.id));
154
- n && j(n.id);
155
- }, { rootMargin: C });
156
- return P.forEach((e) => {
157
- let n = document.getElementById(e.id);
158
- n && t.observe(n);
159
- }), () => {
160
- t.disconnect();
161
- };
162
- }, [P]);
163
- let z = (e) => {
164
- T({
165
- search: w.search,
166
- hash: `#${e}`
167
- }, { replace: !0 });
168
- }, B = async (e) => {
169
- z(e);
170
- let t = `${window.location.origin}${w.pathname}${w.search}#${e}`;
171
- try {
172
- await navigator.clipboard.writeText(t), g(u("markdown.linkCopied"));
173
- } catch {
174
- y(u("markdown.linkCopyError"));
175
- }
176
- };
177
- if (M.length === 0) return /* @__PURE__ */ m("p", {
178
- className: "text-sm text-muted-foreground",
179
- children: u("changelog.empty")
180
- });
181
- let V = /* @__PURE__ */ h("div", {
182
- className: "flex flex-col gap-4",
183
- children: [/* @__PURE__ */ m(c, {
184
- search: E,
185
- onSearch: D,
186
- className: "md:w-full"
187
- }), N.length > 0 ? /* @__PURE__ */ m(S, {
188
- tags: N,
189
- selected: O,
190
- onToggle: F,
191
- onClear: () => {
192
- k([]);
193
- }
194
- }) : null]
195
- });
196
- return /* @__PURE__ */ h("div", {
197
- className: "flex gap-10",
198
- children: [a ? /* @__PURE__ */ h("aside", {
199
- className: "sticky top-4 hidden max-h-[calc(100vh-2rem)] w-60 shrink-0 flex-col gap-8 self-start lg:flex",
200
- children: [s ? V : null, P.length > 0 ? /* @__PURE__ */ m(x, {
201
- entries: P,
202
- activeId: R,
203
- onSelect: z,
204
- className: "min-h-0 flex-1 overflow-y-auto"
205
- }) : null]
206
- }) : null, /* @__PURE__ */ h("div", {
207
- className: e("min-w-0 flex-1", a && "lg:border-l lg:pl-10"),
208
- children: [
209
- s ? /* @__PURE__ */ m("div", {
210
- className: e("mb-6 md:max-w-md", a && "lg:hidden"),
211
- children: V
212
- }) : null,
213
- P.length === 0 ? /* @__PURE__ */ m("p", {
214
- className: "text-sm text-muted-foreground",
215
- children: u("changelog.noResult")
216
- }) : null,
217
- /* @__PURE__ */ m("div", {
218
- className: "divide-y",
219
- children: P.map((e) => /* @__PURE__ */ m(b, {
220
- entry: e,
221
- onSelect: z,
222
- onCopyLink: (e) => void B(e),
223
- selectedTags: O
224
- }, e.id))
225
- })
226
- ]
227
- })]
228
- });
229
- };
230
- //#endregion
231
- export { w as t };