@mechane-ai/elements 0.52.0 → 0.52.1

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/catalog.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "package": "@mechane-ai/elements",
3
- "version": "0.52.0",
3
+ "version": "0.52.1",
4
4
  "recipes": [
5
5
  {
6
6
  "slug": "allocation-report",
@@ -1,278 +1 @@
1
- import { t as e } from "../use-scroll-tab-index-Dxpdh4W7.js";
2
- import { t } from "../visible-motion-1GcUaEi4.js";
3
- import { t as n } from "../code-block-BZsY2sh3.js";
4
- import { n as r, t as i } from "../content-link-PnpcnTCx.js";
5
- import { t as a } from "../viewer-styles-DsFYri4K.js";
6
- import * as o from "@stylexjs/stylex";
7
- import { Children as s, createContext as c, createElement as l, memo as u, useContext as d } from "react";
8
- import { Fragment as f, jsx as p, jsxs as m } from "react/jsx-runtime";
9
- import { Block as h, Streamdown as g, defaultRehypePlugins as _, defaultRemarkPlugins as v, useIsCodeFenceIncomplete as y } from "streamdown";
10
- // packages/content/src/markdown/markdown-options.ts
11
- var b = /* @__PURE__ */ new Set(["href", "src"]), x = {
12
- rehypePlugins: Object.entries(_).filter(([e]) => e === "sanitize").map(([, e]) => e),
13
- remarkPlugins: Object.values(v),
14
- skipHtml: !0,
15
- urlTransform: (e, t) => {
16
- if (b.has(t)) return r(e);
17
- }
18
- }, S = {
19
- root: {
20
- k7Eaqz: "xeuugli",
21
- kMwMTN: "xbixft",
22
- kMv6JI: "x1hz01jw",
23
- khiITx: "xvmahel",
24
- kGuDYH: "xtqrqnz",
25
- kLWn49: "x1ytb0s6",
26
- k63SB2: "xj57cvi",
27
- kHjlTd: "xj0a0fe",
28
- $$css: !0
29
- },
30
- block: {
31
- keoZOQ: "xyrmp21 x14l7nz5",
32
- k1K539: "x1jfksii xzboxd6",
33
- $$css: !0
34
- },
35
- heading: {
36
- keoZOQ: "x1m1vpj6 x14l7nz5",
37
- k1K539: "x1jfksii xzboxd6",
38
- k63SB2: "x1b5ytql",
39
- $$css: !0
40
- },
41
- title: {
42
- kGuDYH: "x1i2cqwi",
43
- kLWn49: "x4fansv",
44
- $$css: !0
45
- },
46
- section: {
47
- kGuDYH: "x12myhf4",
48
- kLWn49: "x1778rvt",
49
- $$css: !0
50
- },
51
- minor: {
52
- kGuDYH: "xtqrqnz",
53
- kLWn49: "x1778rvt",
54
- $$css: !0
55
- },
56
- tableRegion: {
57
- k7Eaqz: "xeuugli",
58
- ks0D6T: "x193iq5w",
59
- kXHlph: "xw2csxc",
60
- kMzoRj: "xmkeg23",
61
- kt9PQ7: "x1qhh985",
62
- ksu8eU: "x1y0btm7",
63
- kVAM5u: "x1ey3b81",
64
- $$css: !0
65
- },
66
- strong: {
67
- k63SB2: "x1b5ytql",
68
- $$css: !0
69
- },
70
- muted: {
71
- kMwMTN: "x153jb6y",
72
- $$css: !0
73
- }
74
- }, C = {
75
- default: null,
76
- muted: S.muted
77
- }, w = {
78
- regular: null,
79
- strong: S.strong
80
- }, T = c(1), E = {
81
- animation: "fadeIn",
82
- duration: 160,
83
- stagger: 14,
84
- maxBacklogMs: 100
85
- }, D = /* @__PURE__ */ new Set(["string", "number"]);
86
- function O(e) {
87
- return D.has(typeof e);
88
- }
89
- function k({ children: e, className: t }) {
90
- let r = y(), i = typeof t == "string" ? /(?:^|\s)language-([^\s]+)/u.exec(t) : null, a = i === null ? void 0 : i[1], o = s.toArray(e);
91
- return o.every(O) ? /* @__PURE__ */ p("div", {
92
- className: "xyrmp21 x14l7nz5 x1jfksii xzboxd6",
93
- children: /* @__PURE__ */ p(n, {
94
- code: o.join(""),
95
- language: a,
96
- isStreaming: r
97
- })
98
- }) : /* @__PURE__ */ p("code", {
99
- className: "xiard35 xy8obcc x1r7kqkb x1ok0vyi x10dazmo x14w6jbu x17etxam",
100
- children: e
101
- });
102
- }
103
- function A({ level: e, children: t, id: n }) {
104
- let r = d(T), i = `h${Math.min(e + r - 1, 6)}`, a = e === 1 ? S.title : e === 2 ? S.section : S.minor;
105
- return l(i, {
106
- id: n,
107
- ...o.props(S.heading, a)
108
- }, t);
109
- }
110
- function j({ children: t }) {
111
- let n = e();
112
- return /* @__PURE__ */ p("div", {
113
- ref: n.ref,
114
- role: "region",
115
- "aria-label": "Markdown table",
116
- tabIndex: n.tabIndex,
117
- ...o.props(a.scrollRegion, S.block, S.tableRegion),
118
- children: /* @__PURE__ */ p("table", {
119
- className: "xh8yej3 x1mwwwfo xss6m8b x1yc453h x1h4wwuj x1778rvt",
120
- children: t
121
- })
122
- });
123
- }
124
- var M = {
125
- h1: (e) => /* @__PURE__ */ p(A, {
126
- ...e,
127
- level: 1
128
- }),
129
- h2: (e) => /* @__PURE__ */ p(A, {
130
- ...e,
131
- level: 2
132
- }),
133
- h3: (e) => /* @__PURE__ */ p(A, {
134
- ...e,
135
- level: 3
136
- }),
137
- h4: (e) => /* @__PURE__ */ p(A, {
138
- ...e,
139
- level: 4
140
- }),
141
- h5: (e) => /* @__PURE__ */ p(A, {
142
- ...e,
143
- level: 5
144
- }),
145
- h6: (e) => /* @__PURE__ */ p(A, {
146
- ...e,
147
- level: 6
148
- }),
149
- p: ({ children: e }) => /* @__PURE__ */ p("p", {
150
- className: "xyrmp21 x14l7nz5 x1jfksii xzboxd6",
151
- children: e
152
- }),
153
- ul: ({ children: e }) => /* @__PURE__ */ p("ul", {
154
- className: "xyrmp21 x14l7nz5 x1jfksii xzboxd6 x1sbza1b",
155
- children: e
156
- }),
157
- ol: ({ children: e, start: t }) => /* @__PURE__ */ p("ol", {
158
- start: t,
159
- className: "xyrmp21 x14l7nz5 x1jfksii xzboxd6 x1sbza1b",
160
- children: e
161
- }),
162
- li: ({ children: e }) => /* @__PURE__ */ p("li", {
163
- className: "x1vblts3 xnkn1qj",
164
- children: e
165
- }),
166
- blockquote: ({ children: e }) => /* @__PURE__ */ p("blockquote", {
167
- className: "xyrmp21 x14l7nz5 x1jfksii xzboxd6 xrxpjvj x1umj4g3 xyumdvf x1t7ytsu x97x49r x153jb6y",
168
- children: e
169
- }),
170
- code: ({ children: e, className: t }) => /* @__PURE__ */ p(k, {
171
- className: t,
172
- children: e
173
- }),
174
- inlineCode: ({ children: e }) => /* @__PURE__ */ p("code", {
175
- className: "xiard35 xy8obcc x1r7kqkb x1ok0vyi x10dazmo x14w6jbu x17etxam",
176
- children: e
177
- }),
178
- a: ({ href: e, children: t, title: n }) => /* @__PURE__ */ p(i, {
179
- href: e,
180
- title: n,
181
- children: t
182
- }),
183
- img: ({ src: e, alt: t, title: n }) => /* @__PURE__ */ p(i, {
184
- href: typeof e == "string" ? e : void 0,
185
- title: n,
186
- children: t !== void 0 && t.length > 0 ? `Open image: ${t}` : "Open image"
187
- }),
188
- table: ({ children: e }) => /* @__PURE__ */ p(j, { children: e }),
189
- thead: ({ children: e }) => /* @__PURE__ */ p("thead", { children: e }),
190
- tbody: ({ children: e }) => /* @__PURE__ */ p("tbody", { children: e }),
191
- tr: ({ children: e }) => /* @__PURE__ */ p("tr", { children: e }),
192
- th: ({ children: e }) => /* @__PURE__ */ p("th", {
193
- scope: "col",
194
- className: "xn9t2bk x1doqdfy xso031l x1q0q8m5 x1qndepd x16dsc37 x1yc453h x153jb6y xk4h15q x1r7kqkb",
195
- children: e
196
- }),
197
- td: ({ children: e }) => /* @__PURE__ */ p("td", {
198
- className: "xn9t2bk x1doqdfy xso031l x1q0q8m5 x1qndepd x16dsc37 x1yc453h",
199
- children: e
200
- }),
201
- input: ({ checked: e }) => /* @__PURE__ */ p("input", {
202
- type: "checkbox",
203
- checked: e ?? !1,
204
- disabled: !0,
205
- "aria-label": "Task item",
206
- className: "x1bzlxqo x6e7ywc"
207
- }),
208
- hr: () => /* @__PURE__ */ p("hr", { className: "xhff0hu xc342km x178xt8z x13fuv20 xhjagg4" }),
209
- strong: ({ children: e }) => /* @__PURE__ */ p("strong", {
210
- className: "x1b5ytql",
211
- children: e
212
- }),
213
- em: ({ children: e }) => /* @__PURE__ */ p("em", {
214
- className: "x1k4tb9n",
215
- children: e
216
- }),
217
- del: ({ children: e }) => /* @__PURE__ */ p("del", {
218
- className: "x5lhwog",
219
- children: e
220
- })
221
- }, N = /* @__PURE__ */ "p.span.h1.h2.h3.h4.h5.h6.ul.ol.li.blockquote.pre.code.a.img.table.thead.tbody.tr.th.td.input.hr.strong.em.del.br.sup.sub.section".split("."), P = u(({ children: e, isStreaming: n = !1, label: r, headingLevel: i = 1, tone: a = "default", weight: s = "regular" }) => {
222
- let { ref: c, isActive: l } = t(n);
223
- return /* @__PURE__ */ p(T, {
224
- value: i,
225
- children: /* @__PURE__ */ p("div", {
226
- ref: c,
227
- "data-streamdown-paused": n && !l ? "" : void 0,
228
- children: /* @__PURE__ */ p(g, {
229
- ...x,
230
- ...o.props(S.root, C[a], w[s]),
231
- "aria-label": r,
232
- components: M,
233
- mode: n ? "streaming" : "static",
234
- isAnimating: n,
235
- animated: n ? E : !1,
236
- controls: !1,
237
- linkSafety: { enabled: !1 },
238
- allowedElements: N,
239
- children: e
240
- })
241
- })
242
- });
243
- });
244
- // packages/content/src/markdown/markdown-preview.tsx
245
- function F({ children: e }) {
246
- return /* @__PURE__ */ m(f, { children: [e, " "] });
247
- }
248
- var I = {
249
- p: F,
250
- li: F,
251
- h1: F,
252
- h2: F,
253
- h3: F,
254
- h4: F,
255
- h5: F,
256
- h6: F,
257
- blockquote: F,
258
- pre: F,
259
- code: ({ children: e }) => /* @__PURE__ */ p(f, { children: e }),
260
- th: F,
261
- td: F,
262
- br: () => /* @__PURE__ */ p(f, { children: " " }),
263
- img: ({ alt: e }) => /* @__PURE__ */ p(f, { children: e })
264
- };
265
- function L({ children: e }) {
266
- return /* @__PURE__ */ p(h, {
267
- ...x,
268
- content: e,
269
- components: I,
270
- allowedElements: Object.keys(I),
271
- unwrapDisallowed: !0,
272
- shouldParseIncompleteMarkdown: !1,
273
- shouldNormalizeHtmlIndentation: !1,
274
- isIncomplete: !1,
275
- index: 0
276
- });
277
- }
278
- export { P as Markdown, L as MarkdownPreview };
1
+ export { n as Markdown, t as MarkdownPreview } from "../markdown-VpLw_P9T.js";
@@ -0,0 +1,313 @@
1
+ import { t as e } from "./use-scroll-tab-index-Dxpdh4W7.js";
2
+ import { t } from "./code-block-BZsY2sh3.js";
3
+ import { n, t as r } from "./content-link-PnpcnTCx.js";
4
+ import { t as i } from "./viewer-styles-DsFYri4K.js";
5
+ import * as a from "@stylexjs/stylex";
6
+ import { Children as o, createContext as s, createElement as c, memo as l, useContext as u, useEffect as d, useMemo as f, useRef as p, useState as m } from "react";
7
+ import { Fragment as h, jsx as g, jsxs as _ } from "react/jsx-runtime";
8
+ import { Block as v, Streamdown as y, defaultRehypePlugins as b, defaultRemarkPlugins as x, useIsCodeFenceIncomplete as S } from "streamdown";
9
+ // packages/foundations/src/visible-motion.ts
10
+ function C(e) {
11
+ let t = p(null), [n, r] = m(!1);
12
+ return d(() => {
13
+ let n = t.current;
14
+ if (!e || n === null) return;
15
+ let i = matchMedia("(prefers-reduced-motion: reduce)"), a = !1;
16
+ function o() {
17
+ r(a && !document.hidden && !i.matches);
18
+ }
19
+ let s = new IntersectionObserver((e) => {
20
+ a = e.some((e) => e.isIntersecting), o();
21
+ });
22
+ return s.observe(n), i.addEventListener("change", o), document.addEventListener("visibilitychange", o), () => {
23
+ s.disconnect(), i.removeEventListener("change", o), document.removeEventListener("visibilitychange", o);
24
+ };
25
+ }, [e]), {
26
+ ref: t,
27
+ isActive: e && n
28
+ };
29
+ }
30
+ // packages/content/src/markdown/markdown-options.ts
31
+ var w = /* @__PURE__ */ new Set(["href", "src"]), T = {
32
+ rehypePlugins: Object.entries(b).filter(([e]) => e === "sanitize").map(([, e]) => e),
33
+ remarkPlugins: Object.values(x),
34
+ skipHtml: !0,
35
+ urlTransform: (e, t) => {
36
+ if (w.has(t)) return n(e);
37
+ }
38
+ }, E = {
39
+ root: {
40
+ k7Eaqz: "xeuugli",
41
+ kMwMTN: "xbixft",
42
+ kMv6JI: "x1hz01jw",
43
+ khiITx: "xvmahel",
44
+ kGuDYH: "xtqrqnz",
45
+ kLWn49: "x1ytb0s6",
46
+ k63SB2: "xj57cvi",
47
+ kHjlTd: "xj0a0fe",
48
+ $$css: !0
49
+ },
50
+ block: {
51
+ keoZOQ: "xyrmp21 x14l7nz5",
52
+ k1K539: "x1jfksii xzboxd6",
53
+ $$css: !0
54
+ },
55
+ heading: {
56
+ keoZOQ: "x1m1vpj6 x14l7nz5",
57
+ k1K539: "x1jfksii xzboxd6",
58
+ k63SB2: "x1b5ytql",
59
+ $$css: !0
60
+ },
61
+ title: {
62
+ kGuDYH: "x1i2cqwi",
63
+ kLWn49: "x4fansv",
64
+ $$css: !0
65
+ },
66
+ section: {
67
+ kGuDYH: "x12myhf4",
68
+ kLWn49: "x1778rvt",
69
+ $$css: !0
70
+ },
71
+ minor: {
72
+ kGuDYH: "xtqrqnz",
73
+ kLWn49: "x1778rvt",
74
+ $$css: !0
75
+ },
76
+ tableRegion: {
77
+ k7Eaqz: "xeuugli",
78
+ ks0D6T: "x193iq5w",
79
+ kXHlph: "xw2csxc",
80
+ kMzoRj: "xmkeg23",
81
+ kt9PQ7: "x1qhh985",
82
+ ksu8eU: "x1y0btm7",
83
+ kVAM5u: "x1ey3b81",
84
+ $$css: !0
85
+ },
86
+ strong: {
87
+ k63SB2: "x1b5ytql",
88
+ $$css: !0
89
+ },
90
+ muted: {
91
+ kMwMTN: "x153jb6y",
92
+ $$css: !0
93
+ }
94
+ }, D = {
95
+ default: null,
96
+ muted: E.muted
97
+ }, O = {
98
+ regular: null,
99
+ strong: E.strong
100
+ }, k = s(1), A = {
101
+ animation: "fadeIn",
102
+ duration: 160,
103
+ stagger: 14,
104
+ maxBacklogMs: 100
105
+ }, j = /* @__PURE__ */ new Set(["string", "number"]);
106
+ function M(e) {
107
+ return j.has(typeof e);
108
+ }
109
+ function N({ children: e, className: n }) {
110
+ let r = S(), i = typeof n == "string" ? /(?:^|\s)language-([^\s]+)/u.exec(n) : null, a = i === null ? void 0 : i[1], s = o.toArray(e);
111
+ return s.every(M) ? /* @__PURE__ */ g("div", {
112
+ className: "xyrmp21 x14l7nz5 x1jfksii xzboxd6",
113
+ children: /* @__PURE__ */ g(t, {
114
+ code: s.join(""),
115
+ language: a,
116
+ isStreaming: r
117
+ })
118
+ }) : /* @__PURE__ */ g("code", {
119
+ className: "xiard35 xy8obcc x1r7kqkb x1ok0vyi x10dazmo x14w6jbu x17etxam",
120
+ children: e
121
+ });
122
+ }
123
+ function P({ level: e, children: t, id: n }) {
124
+ let r = u(k), i = `h${Math.min(e + r - 1, 6)}`, o = e === 1 ? E.title : e === 2 ? E.section : E.minor;
125
+ return c(i, {
126
+ id: n,
127
+ ...a.props(E.heading, o)
128
+ }, t);
129
+ }
130
+ function F({ children: t }) {
131
+ let n = e();
132
+ return /* @__PURE__ */ g("div", {
133
+ ref: n.ref,
134
+ role: "region",
135
+ "aria-label": "Markdown table",
136
+ tabIndex: n.tabIndex,
137
+ ...a.props(i.scrollRegion, E.block, E.tableRegion),
138
+ children: /* @__PURE__ */ g("table", {
139
+ className: "xh8yej3 x1mwwwfo xss6m8b x1yc453h x1h4wwuj x1778rvt",
140
+ children: t
141
+ })
142
+ });
143
+ }
144
+ var I = s(void 0);
145
+ function L(e) {
146
+ let t = u(I);
147
+ return t === void 0 ? /* @__PURE__ */ g(r, {
148
+ href: e.href,
149
+ title: e.title,
150
+ children: e.children
151
+ }) : t(e);
152
+ }
153
+ var R = {
154
+ h1: (e) => /* @__PURE__ */ g(P, {
155
+ ...e,
156
+ level: 1
157
+ }),
158
+ h2: (e) => /* @__PURE__ */ g(P, {
159
+ ...e,
160
+ level: 2
161
+ }),
162
+ h3: (e) => /* @__PURE__ */ g(P, {
163
+ ...e,
164
+ level: 3
165
+ }),
166
+ h4: (e) => /* @__PURE__ */ g(P, {
167
+ ...e,
168
+ level: 4
169
+ }),
170
+ h5: (e) => /* @__PURE__ */ g(P, {
171
+ ...e,
172
+ level: 5
173
+ }),
174
+ h6: (e) => /* @__PURE__ */ g(P, {
175
+ ...e,
176
+ level: 6
177
+ }),
178
+ p: ({ children: e }) => /* @__PURE__ */ g("p", {
179
+ className: "xyrmp21 x14l7nz5 x1jfksii xzboxd6",
180
+ children: e
181
+ }),
182
+ ul: ({ children: e }) => /* @__PURE__ */ g("ul", {
183
+ className: "xyrmp21 x14l7nz5 x1jfksii xzboxd6 x1sbza1b",
184
+ children: e
185
+ }),
186
+ ol: ({ children: e, start: t }) => /* @__PURE__ */ g("ol", {
187
+ start: t,
188
+ className: "xyrmp21 x14l7nz5 x1jfksii xzboxd6 x1sbza1b",
189
+ children: e
190
+ }),
191
+ li: ({ children: e }) => /* @__PURE__ */ g("li", {
192
+ className: "x1vblts3 xnkn1qj",
193
+ children: e
194
+ }),
195
+ blockquote: ({ children: e }) => /* @__PURE__ */ g("blockquote", {
196
+ className: "xyrmp21 x14l7nz5 x1jfksii xzboxd6 xrxpjvj x1umj4g3 xyumdvf x1t7ytsu x97x49r x153jb6y",
197
+ children: e
198
+ }),
199
+ code: ({ children: e, className: t }) => /* @__PURE__ */ g(N, {
200
+ className: t,
201
+ children: e
202
+ }),
203
+ inlineCode: ({ children: e }) => /* @__PURE__ */ g("code", {
204
+ className: "xiard35 xy8obcc x1r7kqkb x1ok0vyi x10dazmo x14w6jbu x17etxam",
205
+ children: e
206
+ }),
207
+ a: ({ href: e, children: t, title: n }) => /* @__PURE__ */ g(L, {
208
+ kind: "link",
209
+ href: e,
210
+ title: n,
211
+ children: t
212
+ }),
213
+ img: ({ src: e, alt: t, title: n }) => /* @__PURE__ */ g(L, {
214
+ kind: "image",
215
+ href: typeof e == "string" ? e : void 0,
216
+ title: n,
217
+ children: t !== void 0 && t.length > 0 ? `Open image: ${t}` : "Open image"
218
+ }),
219
+ table: ({ children: e }) => /* @__PURE__ */ g(F, { children: e }),
220
+ thead: ({ children: e }) => /* @__PURE__ */ g("thead", { children: e }),
221
+ tbody: ({ children: e }) => /* @__PURE__ */ g("tbody", { children: e }),
222
+ tr: ({ children: e }) => /* @__PURE__ */ g("tr", { children: e }),
223
+ th: ({ children: e }) => /* @__PURE__ */ g("th", {
224
+ scope: "col",
225
+ className: "xn9t2bk x1doqdfy xso031l x1q0q8m5 x1qndepd x16dsc37 x1yc453h x153jb6y xk4h15q x1r7kqkb",
226
+ children: e
227
+ }),
228
+ td: ({ children: e }) => /* @__PURE__ */ g("td", {
229
+ className: "xn9t2bk x1doqdfy xso031l x1q0q8m5 x1qndepd x16dsc37 x1yc453h",
230
+ children: e
231
+ }),
232
+ input: ({ checked: e }) => /* @__PURE__ */ g("input", {
233
+ type: "checkbox",
234
+ checked: e ?? !1,
235
+ disabled: !0,
236
+ "aria-label": "Task item",
237
+ className: "x1bzlxqo x6e7ywc"
238
+ }),
239
+ hr: () => /* @__PURE__ */ g("hr", { className: "xhff0hu xc342km x178xt8z x13fuv20 xhjagg4" }),
240
+ strong: ({ children: e }) => /* @__PURE__ */ g("strong", {
241
+ className: "x1b5ytql",
242
+ children: e
243
+ }),
244
+ em: ({ children: e }) => /* @__PURE__ */ g("em", {
245
+ className: "x1k4tb9n",
246
+ children: e
247
+ }),
248
+ del: ({ children: e }) => /* @__PURE__ */ g("del", {
249
+ className: "x5lhwog",
250
+ children: e
251
+ })
252
+ }, z = /* @__PURE__ */ "p.span.h1.h2.h3.h4.h5.h6.ul.ol.li.blockquote.pre.code.a.img.table.thead.tbody.tr.th.td.input.hr.strong.em.del.br.sup.sub.section".split("."), B = l(({ children: e, isStreaming: t = !1, label: n, headingLevel: r = 1, tone: i = "default", weight: o = "regular", renderLink: s, remarkPlugins: c }) => {
253
+ let { ref: l, isActive: u } = C(t), d = f(() => [...T.remarkPlugins ?? [], ...c ?? []], [c]);
254
+ return /* @__PURE__ */ g(I, {
255
+ value: s,
256
+ children: /* @__PURE__ */ g(k, {
257
+ value: r,
258
+ children: /* @__PURE__ */ g("div", {
259
+ ref: l,
260
+ "data-streamdown-paused": t && !u ? "" : void 0,
261
+ children: /* @__PURE__ */ g(y, {
262
+ ...T,
263
+ remarkPlugins: d,
264
+ ...a.props(E.root, D[i], O[o]),
265
+ "aria-label": n,
266
+ components: R,
267
+ mode: t ? "streaming" : "static",
268
+ isAnimating: t,
269
+ animated: t ? A : !1,
270
+ controls: !1,
271
+ linkSafety: { enabled: !1 },
272
+ allowedElements: z,
273
+ children: e
274
+ })
275
+ })
276
+ })
277
+ });
278
+ });
279
+ // packages/content/src/markdown/markdown-preview.tsx
280
+ function V({ children: e }) {
281
+ return /* @__PURE__ */ _(h, { children: [e, " "] });
282
+ }
283
+ var H = {
284
+ p: V,
285
+ li: V,
286
+ h1: V,
287
+ h2: V,
288
+ h3: V,
289
+ h4: V,
290
+ h5: V,
291
+ h6: V,
292
+ blockquote: V,
293
+ pre: V,
294
+ code: ({ children: e }) => /* @__PURE__ */ g(h, { children: e }),
295
+ th: V,
296
+ td: V,
297
+ br: () => /* @__PURE__ */ g(h, { children: " " }),
298
+ img: ({ alt: e }) => /* @__PURE__ */ g(h, { children: e })
299
+ };
300
+ function U({ children: e }) {
301
+ return /* @__PURE__ */ g(v, {
302
+ ...T,
303
+ content: e,
304
+ components: H,
305
+ allowedElements: Object.keys(H),
306
+ unwrapDisallowed: !0,
307
+ shouldParseIncompleteMarkdown: !1,
308
+ shouldNormalizeHtmlIndentation: !1,
309
+ isIncomplete: !1,
310
+ index: 0
311
+ });
312
+ }
313
+ export { B as n, C as r, U as t };
@@ -1,6 +1,13 @@
1
1
  import type { ReactNode } from 'react';
2
+ import type { StreamdownProps } from 'streamdown';
3
+ import type { ContentLinkProps } from '../content-link.tsx';
2
4
  type HeadingLevel = 1 | 2 | 3 | 4 | 5 | 6;
5
+ type MarkdownLinkProps = ContentLinkProps & {
6
+ readonly kind: 'link' | 'image';
7
+ };
3
8
  export type MarkdownProps = {
9
+ readonly renderLink?: (props: MarkdownLinkProps) => ReactNode;
10
+ readonly remarkPlugins?: StreamdownProps['remarkPlugins'];
4
11
  readonly children: string;
5
12
  readonly isStreaming?: boolean;
6
13
  readonly label?: string;
@@ -8,5 +15,5 @@ export type MarkdownProps = {
8
15
  readonly tone?: 'default' | 'muted';
9
16
  readonly weight?: 'regular' | 'strong';
10
17
  };
11
- export declare const Markdown: import("react").MemoExoticComponent<({ children, isStreaming, label, headingLevel, tone, weight, }: MarkdownProps) => ReactNode>;
18
+ export declare const Markdown: import("react").MemoExoticComponent<({ children, isStreaming, label, headingLevel, tone, weight, renderLink, remarkPlugins, }: MarkdownProps) => ReactNode>;
12
19
  export {};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mechane-ai/elements",
3
- "version": "0.52.0",
3
+ "version": "0.52.1",
4
4
  "description": "Elements by Mechane — React components for applications, AI interfaces, and analytical graphics",
5
5
  "license": "Apache-2.0",
6
6
  "repository": {
@@ -1,23 +0,0 @@
1
- import { useEffect as e, useRef as t, useState as n } from "react";
2
- // packages/foundations/src/visible-motion.ts
3
- function r(r) {
4
- let i = t(null), [a, o] = n(!1);
5
- return e(() => {
6
- let e = i.current;
7
- if (!r || e === null) return;
8
- let t = matchMedia("(prefers-reduced-motion: reduce)"), n = !1;
9
- function a() {
10
- o(n && !document.hidden && !t.matches);
11
- }
12
- let s = new IntersectionObserver((e) => {
13
- n = e.some((e) => e.isIntersecting), a();
14
- });
15
- return s.observe(e), t.addEventListener("change", a), document.addEventListener("visibilitychange", a), () => {
16
- s.disconnect(), t.removeEventListener("change", a), document.removeEventListener("visibilitychange", a);
17
- };
18
- }, [r]), {
19
- ref: i,
20
- isActive: r && a
21
- };
22
- }
23
- export { r as t };