@mechane-ai/elements 0.39.0 → 0.41.0

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.
Files changed (110) hide show
  1. package/NOTICE +11 -19
  2. package/README.md +49 -25
  3. package/dist/accessibility-P89UG9-r.js +25 -0
  4. package/dist/agent.js +1 -0
  5. package/dist/ai.js +50 -44
  6. package/dist/{categorical-values-BECG-J6R.js → categorical-values-DnGR_pQx.js} +3 -3
  7. package/dist/{chart-frame-CJFnI39T.js → chart-frame-BsyI1Zc8.js} +58 -57
  8. package/dist/{chart-input-DwAobO8Y.js → chart-input-r4S3-QCT.js} +2 -2
  9. package/dist/chart-navigation-D7OkLdSx.js +119 -0
  10. package/dist/charts/cartesian.js +560 -583
  11. package/dist/charts/distribution.js +218 -218
  12. package/dist/charts/graph.js +86 -85
  13. package/dist/charts/hierarchy.js +4 -4
  14. package/dist/charts/matrix.js +148 -147
  15. package/dist/charts/timeline.js +77 -76
  16. package/dist/charts.js +2 -2
  17. package/dist/code-block-C4K1sM9O.js +255 -0
  18. package/dist/collections.js +828 -607
  19. package/dist/constants.stylex-BILvnwUk.js +84 -0
  20. package/dist/content/code.js +1 -1
  21. package/dist/content/diff.js +3 -3
  22. package/dist/content/link.js +1 -1
  23. package/dist/content/markdown.js +2 -2
  24. package/dist/content/tree.js +184 -77
  25. package/dist/{content-link-B3ObdyZY.js → content-link-CBDqSvgP.js} +1 -1
  26. package/dist/content.js +1 -1
  27. package/dist/control-styles-D3q_Qyxi.js +179 -0
  28. package/dist/csp.js +14 -1
  29. package/dist/feedback.js +1 -1
  30. package/dist/forms/dates.js +359 -245
  31. package/dist/forms-I-WMHTkr.js +139 -0
  32. package/dist/forms.js +3 -3
  33. package/dist/index.js +1 -1
  34. package/dist/layout.js +271 -241
  35. package/dist/navigation/commands.js +87 -76
  36. package/dist/{navigation-D2_sGy3C.js → navigation-CveMIuXI.js} +1 -1
  37. package/dist/navigation.js +2 -2
  38. package/dist/overlays.js +1 -1
  39. package/dist/packages/ai/src/message-action.d.ts +1 -1
  40. package/dist/packages/charts/src/chart-navigation.d.ts +18 -2
  41. package/dist/packages/charts/src/chart-surface.d.ts +23 -0
  42. package/dist/packages/charts/src/distribution/distribution-plot.d.ts +3 -2
  43. package/dist/packages/collections/src/data-table.d.ts +7 -2
  44. package/dist/packages/collections/src/index.d.ts +4 -1
  45. package/dist/packages/collections/src/query-controls.d.ts +18 -0
  46. package/dist/packages/collections/src/table-query.d.ts +64 -0
  47. package/dist/packages/collections/src/use-collection-controls.d.ts +3 -8
  48. package/dist/packages/content/src/pierre-theme.d.ts +0 -1
  49. package/dist/packages/core/src/actions.d.ts +15 -13
  50. package/dist/packages/core/src/copy-value.d.ts +3 -2
  51. package/dist/packages/core/src/disclosure.d.ts +14 -11
  52. package/dist/packages/feedback/src/notifications.d.ts +15 -15
  53. package/dist/packages/feedback/src/toast.d.ts +9 -3
  54. package/dist/packages/forms/src/combobox.d.ts +31 -41
  55. package/dist/packages/forms/src/dates/event-month.d.ts +17 -0
  56. package/dist/packages/forms/src/dates/index.d.ts +2 -0
  57. package/dist/packages/forms/src/field-styles.d.ts +0 -19
  58. package/dist/packages/forms/src/form-controls.d.ts +26 -24
  59. package/dist/packages/forms/src/forms.d.ts +17 -14
  60. package/dist/packages/forms/src/select-control.d.ts +6 -4
  61. package/dist/packages/forms/src/select.d.ts +14 -18
  62. package/dist/packages/forms/src/selection-state.d.ts +11 -0
  63. package/dist/packages/forms/src/selection-styles.d.ts +3 -0
  64. package/dist/packages/forms/src/selection.d.ts +21 -19
  65. package/dist/packages/foundations/src/agent/index.d.ts +2 -0
  66. package/dist/packages/foundations/src/control-state.d.ts +2 -3
  67. package/dist/packages/foundations/src/control-styles.d.ts +19 -0
  68. package/dist/packages/foundations/src/csp/index.d.ts +1 -1
  69. package/dist/packages/foundations/src/csp/provider.d.ts +3 -0
  70. package/dist/packages/foundations/src/style-composition.d.ts +4 -1
  71. package/dist/packages/layout/src/app-shell.d.ts +12 -1
  72. package/dist/packages/layout/src/index.d.ts +1 -1
  73. package/dist/packages/layout/src/navigation-rail.d.ts +15 -2
  74. package/dist/packages/layout/src/resizable.d.ts +2 -2
  75. package/dist/packages/layout/src/sidebar.d.ts +4 -3
  76. package/dist/packages/navigation/src/tab-styles.d.ts +1 -1
  77. package/dist/packages/navigation/src/tabs.d.ts +12 -10
  78. package/dist/packages/overlays/src/alert-dialog.d.ts +19 -13
  79. package/dist/packages/overlays/src/dialog.d.ts +39 -24
  80. package/dist/packages/overlays/src/drawer.d.ts +16 -26
  81. package/dist/packages/overlays/src/menu.d.ts +37 -44
  82. package/dist/packages/overlays/src/overlay-root.d.ts +10 -0
  83. package/dist/packages/overlays/src/popover.d.ts +11 -20
  84. package/dist/packages/overlays/src/preview.d.ts +6 -13
  85. package/dist/packages/overlays/src/tooltip.d.ts +12 -15
  86. package/dist/{pierre-diff-CaPsfQRo.js → pierre-diff-DJ3oOfPX.js} +5 -5
  87. package/dist/{src-DPRmO-JY.js → src-CNV1ewzb.js} +379 -407
  88. package/dist/{src-CSWIG_op.js → src-CQQvXi7a.js} +58 -81
  89. package/dist/{src-DWjAoOyd.js → src-D2OHco8V.js} +42 -41
  90. package/dist/src-DfOAlAd2.js +750 -0
  91. package/dist/src-na2DdkKI.js +561 -0
  92. package/dist/{src-C-Sx37kz.js → src-s3tWwnN4.js} +361 -518
  93. package/dist/styles.js +3 -0
  94. package/dist/{elements.css → styles2.css} +195 -97
  95. package/dist/tokens.js +3 -1
  96. package/dist/{tokens.stylex-CJbIDPB9.js → tokens.stylex-dF5CACEJ.js} +13 -93
  97. package/package.json +8 -9
  98. package/skills/elements-workspace/SKILL.md +12 -0
  99. package/dist/accessibility-C-aIZ1Yx.js +0 -15
  100. package/dist/chart-navigation-CBIeNtJq.js +0 -67
  101. package/dist/code-block-aC0Htt4N.js +0 -184
  102. package/dist/forms-BQQFas9g.js +0 -118
  103. package/dist/foundations.css +0 -7
  104. package/dist/packages/content/src/tree/pierre-tree.d.ts +0 -3
  105. package/dist/pierre-theme-BpNaWn1x.js +0 -126
  106. package/dist/pierre-tree-CYCRjdGG.js +0 -106
  107. package/dist/src-d7EAi61b.js +0 -617
  108. package/dist/src-nkgFDl-g.js +0 -1171
  109. package/dist/style-composition-uYlczSsB.js +0 -9
  110. package/styles.css +0 -2
@@ -1,12 +1,13 @@
1
- import { c as e } from "../src-C-Sx37kz.js";
2
- import { n as t } from "../chart-frame-CJFnI39T.js";
3
- import { n, t as r } from "../chart-input-DwAobO8Y.js";
1
+ import { c as e } from "../src-s3tWwnN4.js";
2
+ import { n as t } from "../chart-frame-BsyI1Zc8.js";
3
+ import { n, t as r } from "../chart-input-r4S3-QCT.js";
4
4
  import * as i from "@stylexjs/stylex";
5
- import { jsx as a, jsxs as o } from "react/jsx-runtime";
6
- import { scaleLinear as s } from "@visx/scale";
7
- import { Bar as c } from "@visx/shape";
5
+ import { Button as a } from "@ui-sdk/react/button";
6
+ import { jsx as o, jsxs as s } from "react/jsx-runtime";
7
+ import { scaleLinear as c } from "@visx/scale";
8
+ import { Bar as l } from "@visx/shape";
8
9
  // packages/charts/src/timeline/waterfall.tsx
9
- var l = 5, u = {
10
+ var u = 5, d = {
10
11
  plot: {
11
12
  k7Eaqz: "xeuugli",
12
13
  kUOVxO: "xl4o6ss",
@@ -26,125 +27,125 @@ var l = 5, u = {
26
27
  kMwMTN: "xr5kp14",
27
28
  $$css: !0
28
29
  }
29
- }, d = {
30
- neutral: u.neutral,
31
- positive: u.positive,
32
- negative: u.negative
33
- }, f = [
30
+ }, f = {
31
+ neutral: d.neutral,
32
+ positive: d.positive,
33
+ negative: d.negative
34
+ }, p = [
34
35
  0,
35
36
  .5,
36
37
  1
37
- ], p = 100;
38
- function m({ items: n, start: c, end: l, label: m, report: v, rowLabel: y, summaryLabel: b, emptyLabel: x, selectedId: S, selectedRef: C, onSelect: w, formatOffset: T }) {
39
- let E = h({
38
+ ], m = 100;
39
+ function h({ items: n, start: l, end: u, label: h, report: y, rowLabel: b, summaryLabel: x, emptyLabel: S, selectedId: C, selectedRef: w, onSelect: T, formatOffset: E }) {
40
+ let D = g({
40
41
  items: n,
41
- start: c,
42
- end: l
42
+ start: l,
43
+ end: u
43
44
  });
44
- if (E !== void 0) return /* @__PURE__ */ a(r, {
45
- title: m,
46
- report: v,
47
- message: E
45
+ if (D !== void 0) return /* @__PURE__ */ o(r, {
46
+ title: h,
47
+ report: y,
48
+ message: D
48
49
  });
49
- let D = l - c, O = s({
50
- domain: [c, l],
51
- range: [0, D === 0 ? 0 : p]
52
- }), k = D > 0 ? f : [0], A = n.some((e) => e.geometry.kind !== "unavailable"), j = /* @__PURE__ */ o("div", {
50
+ let O = u - l, k = c({
51
+ domain: [l, u],
52
+ range: [0, O === 0 ? 0 : m]
53
+ }), A = O > 0 ? p : [0], j = n.some((e) => e.geometry.kind !== "unavailable"), M = /* @__PURE__ */ s("div", {
53
54
  role: "group",
54
- "aria-label": m,
55
+ "aria-label": h,
55
56
  className: "xeuugli x1hz01jw x12h1iku",
56
57
  children: [
57
- /* @__PURE__ */ o("div", {
58
+ /* @__PURE__ */ s("div", {
58
59
  className: "xrvj5dj x13sfnbj x1prkh4w x6s0dn4 x1gkm1c7 x1y1mm1b xh8yej3 x9f619 x1doqdfy x17tes2r x153jb6y xy8obcc xso031l x1q0q8m5 x1qndepd",
59
60
  children: [
60
- /* @__PURE__ */ a(e, {
61
+ /* @__PURE__ */ o(e, {
61
62
  variant: "caption",
62
63
  tone: "muted",
63
- children: y
64
+ children: b
64
65
  }),
65
- /* @__PURE__ */ a("div", {
66
+ /* @__PURE__ */ o("div", {
66
67
  className: "xeuugli xl4o6ss x1npkx4u x1v577k8 x1ms6mhf x1aa6nly x78zum5 x1qughib x6s0dn4 xy8obcc xas2l8k xss6m8b",
67
- children: A ? k.map((e) => /* @__PURE__ */ a("span", { children: T(D * e) }, e)) : /* @__PURE__ */ a("span", { children: "Timing unavailable" })
68
+ children: j ? A.map((e) => /* @__PURE__ */ o("span", { children: E(O * e) }, e)) : /* @__PURE__ */ o("span", { children: "Timing unavailable" })
68
69
  }),
69
- /* @__PURE__ */ a("span", {
70
+ /* @__PURE__ */ o("span", {
70
71
  className: "xrvj5dj xfko13i xeuugli x1k3v4rp x14r0xmm x1ms6mhf xp4054r xj0a0fe xss6m8b",
71
- children: /* @__PURE__ */ a(e, {
72
+ children: /* @__PURE__ */ o(e, {
72
73
  variant: "caption",
73
74
  tone: "muted",
74
- children: b
75
+ children: x
75
76
  })
76
77
  })
77
78
  ]
78
79
  }),
79
- n.length === 0 && /* @__PURE__ */ a("p", {
80
+ n.length === 0 && /* @__PURE__ */ o("p", {
80
81
  className: "x1ghz6dp x1c8xbx5",
81
- children: /* @__PURE__ */ a(e, {
82
+ children: /* @__PURE__ */ o(e, {
82
83
  tone: "muted",
83
- children: x
84
+ children: S
84
85
  })
85
86
  }),
86
87
  n.map((t) => {
87
- let n = _({
88
+ let n = v({
88
89
  geometry: t.geometry,
89
- start: c,
90
- formatOffset: T
90
+ start: l,
91
+ formatOffset: E
91
92
  });
92
- return /* @__PURE__ */ o("button", {
93
- ref: S === t.id ? C : void 0,
93
+ return /* @__PURE__ */ s(a, {
94
+ ref: C === t.id ? w : void 0,
94
95
  type: "button",
95
- "aria-pressed": S === t.id,
96
+ "aria-pressed": C === t.id,
96
97
  "aria-controls": t.controls,
97
98
  "aria-label": `${t.label} · ${t.detail} · ${t.summary} · ${n}`,
98
- onClick: () => w(t.id),
99
+ onClick: () => T(t.id),
99
100
  ...{
100
101
  0: { className: "xrvj5dj x13sfnbj x1prkh4w x6s0dn4 x1gkm1c7 x1y1mm1b xh8yej3 x9f619 x1doqdfy xn9t2bk x1wiwyrm xc342km xso031l x1q0q8m5 x1qndepd xpvm0e4 xbixft x1hz01jw x1yc453h x1ypdohk x1t137rt xif5pkx x1ecmtor x19rmrnh x9v5kkp x13qnu6 x1bqaal x1t1lzn6" },
101
102
  1: { className: "xrvj5dj x13sfnbj x1prkh4w x6s0dn4 x1gkm1c7 x1y1mm1b xh8yej3 x9f619 x1doqdfy xn9t2bk x1wiwyrm xc342km xso031l x1q0q8m5 x1qndepd xbixft x1hz01jw x1yc453h x1ypdohk x1t137rt xif5pkx x1ecmtor x19rmrnh x9v5kkp x13qnu6 x1bqaal x1t1lzn6 x1r7kqkb xh3r7i3" }
102
- }[S === t.id | 0],
103
+ }[C === t.id | 0],
103
104
  children: [
104
- /* @__PURE__ */ o("span", {
105
+ /* @__PURE__ */ s("span", {
105
106
  className: "xeuugli xrvj5dj xfko13i",
106
- children: [/* @__PURE__ */ a(e, { children: t.label }), /* @__PURE__ */ a("span", {
107
+ children: [/* @__PURE__ */ o(e, { children: t.label }), /* @__PURE__ */ o("span", {
107
108
  title: t.detail,
108
109
  ...{
109
110
  0: { className: "xb3r6kr xuxw1ft xlyipyv" },
110
111
  1: { className: "xb3r6kr xlyipyv xeaf4i8 xj0a0fe" }
111
- }[S === t.id | 0],
112
- children: /* @__PURE__ */ a(e, {
112
+ }[C === t.id | 0],
113
+ children: /* @__PURE__ */ o(e, {
113
114
  variant: "caption",
114
115
  tone: "muted",
115
116
  children: t.detail
116
117
  })
117
118
  })]
118
119
  }),
119
- /* @__PURE__ */ a("span", {
120
+ /* @__PURE__ */ o("span", {
120
121
  title: n,
121
- ...i.props(u.plot, d[t.tone]),
122
- children: t.geometry.kind === "unavailable" ? /* @__PURE__ */ a(e, {
122
+ ...i.props(d.plot, f[t.tone]),
123
+ children: t.geometry.kind === "unavailable" ? /* @__PURE__ */ o(e, {
123
124
  variant: "caption",
124
125
  tone: "muted",
125
126
  children: n
126
- }) : /* @__PURE__ */ o("svg", {
127
+ }) : /* @__PURE__ */ s("svg", {
127
128
  "aria-hidden": !0,
128
129
  className: "x1lliihq xh8yej3 xmix8c7 x1rea2x4",
129
- children: [k.map((e) => /* @__PURE__ */ a("line", {
130
- x1: `${e * p}%`,
131
- x2: `${e * p}%`,
130
+ children: [A.map((e) => /* @__PURE__ */ o("line", {
131
+ x1: `${e * m}%`,
132
+ x2: `${e * m}%`,
132
133
  y1: "0",
133
134
  y2: "18",
134
135
  className: "x13hfdr1"
135
- }, e)), /* @__PURE__ */ a(g, {
136
+ }, e)), /* @__PURE__ */ o(_, {
136
137
  geometry: t.geometry,
137
- scale: O
138
+ scale: k
138
139
  })]
139
140
  })
140
141
  }),
141
- /* @__PURE__ */ o("span", {
142
+ /* @__PURE__ */ s("span", {
142
143
  className: "xrvj5dj xfko13i xeuugli x1k3v4rp x14r0xmm x1ms6mhf xp4054r xj0a0fe xss6m8b",
143
- children: [/* @__PURE__ */ a(e, {
144
+ children: [/* @__PURE__ */ o(e, {
144
145
  variant: "caption",
145
146
  tone: "muted",
146
147
  children: t.summary
147
- }), S === t.id && /* @__PURE__ */ a(e, {
148
+ }), C === t.id && /* @__PURE__ */ o(e, {
148
149
  variant: "caption",
149
150
  tone: "muted",
150
151
  children: n
@@ -155,13 +156,13 @@ function m({ items: n, start: c, end: l, label: m, report: v, rowLabel: y, summa
155
156
  })
156
157
  ]
157
158
  });
158
- return v === void 0 ? j : /* @__PURE__ */ a(t, {
159
- title: m,
160
- report: v,
161
- children: j
159
+ return y === void 0 ? M : /* @__PURE__ */ o(t, {
160
+ title: h,
161
+ report: y,
162
+ children: M
162
163
  });
163
164
  }
164
- function h({ items: e, start: t, end: r }) {
165
+ function g({ items: e, start: t, end: r }) {
165
166
  if (!Number.isFinite(t) || !Number.isFinite(r) || !Number.isFinite(r - t) || r < t) return "The timing domain must have finite, ordered endpoints.";
166
167
  if (!n(e)) return "Timing records must have unique identifiers.";
167
168
  for (let n of e) {
@@ -173,17 +174,17 @@ function h({ items: e, start: t, end: r }) {
173
174
  if (e.kind === "point" && (!Number.isFinite(e.at) || e.at < t || e.at > r)) return "Timing points must be finite and fit inside the supplied domain.";
174
175
  }
175
176
  }
176
- function g({ geometry: e, scale: t }) {
177
+ function _({ geometry: e, scale: t }) {
177
178
  switch (e.kind) {
178
179
  case "unavailable": return null;
179
180
  case "interval": {
180
181
  let n = t(e.start), r = t(e.end) - n;
181
- return r === 0 ? /* @__PURE__ */ a("circle", {
182
+ return r === 0 ? /* @__PURE__ */ o("circle", {
182
183
  cx: `${n}%`,
183
184
  cy: 9,
184
185
  r: 3,
185
186
  className: "x117rol3"
186
- }) : /* @__PURE__ */ a(c, {
187
+ }) : /* @__PURE__ */ o(l, {
187
188
  x: `${n}%`,
188
189
  y: 6,
189
190
  width: `${r}%`,
@@ -195,26 +196,26 @@ function g({ geometry: e, scale: t }) {
195
196
  case "point": {
196
197
  let n = t(e.at);
197
198
  switch (e.marker) {
198
- case "filled": return /* @__PURE__ */ a("circle", {
199
+ case "filled": return /* @__PURE__ */ o("circle", {
199
200
  cx: `${n}%`,
200
201
  cy: 9,
201
202
  r: 3,
202
203
  className: "x117rol3"
203
204
  });
204
- case "hollow": return /* @__PURE__ */ a("circle", {
205
+ case "hollow": return /* @__PURE__ */ o("circle", {
205
206
  cx: `${n}%`,
206
207
  cy: 9,
207
208
  r: 3.5,
208
209
  className: "x1fytgo2 x73je2i xvlca1e"
209
210
  });
210
- case "diamond": return /* @__PURE__ */ a("svg", {
211
+ case "diamond": return /* @__PURE__ */ o("svg", {
211
212
  x: `${n}%`,
212
213
  y: 9,
213
214
  width: 1,
214
215
  height: 1,
215
216
  overflow: "visible",
216
- children: /* @__PURE__ */ a("path", {
217
- d: `M0 -${l} ${l} 0 0 ${l} -${l} 0Z`,
217
+ children: /* @__PURE__ */ o("path", {
218
+ d: `M0 -${u} ${u} 0 0 ${u} -${u} 0Z`,
218
219
  className: "x117rol3"
219
220
  })
220
221
  });
@@ -222,11 +223,11 @@ function g({ geometry: e, scale: t }) {
222
223
  }
223
224
  }
224
225
  }
225
- function _({ geometry: e, start: t, formatOffset: n }) {
226
+ function v({ geometry: e, start: t, formatOffset: n }) {
226
227
  switch (e.kind) {
227
228
  case "interval": return `Start ${n(e.start - t)}, end ${n(e.end - t)}, duration ${n(e.end - e.start)}`;
228
229
  case "point": return `At ${n(e.at - t)}`;
229
230
  case "unavailable": return "Timing unavailable";
230
231
  }
231
232
  }
232
- export { m as Waterfall };
233
+ export { h as Waterfall };
package/dist/charts.js CHANGED
@@ -1,3 +1,3 @@
1
- import { a as e, n as t, r as n } from "./chart-frame-CJFnI39T.js";
2
- import { c as r } from "./src-nkgFDl-g.js";
1
+ import { a as e, n as t, r as n } from "./chart-frame-BsyI1Zc8.js";
2
+ import { c as r } from "./src-DfOAlAd2.js";
3
3
  export { t as ChartFrame, n as ChartLegend, e as ChartSeriesMarker, r as chartToneColors };
@@ -0,0 +1,255 @@
1
+ import { v as e } from "./src-s3tWwnN4.js";
2
+ import { d as t, f as n, i as r, r as i, u as a } from "./tokens.stylex-dF5CACEJ.js";
3
+ import { t as o } from "./use-scroll-tab-index-Dxpdh4W7.js";
4
+ import { t as s } from "./viewer-styles-DsFYri4K.js";
5
+ import * as c from "@stylexjs/stylex";
6
+ import { useEffect as l, useRef as u, useState as d } from "react";
7
+ import { jsx as f, jsxs as p } from "react/jsx-runtime";
8
+ import { getFiletypeFromFileName as m } from "@pierre/diffs";
9
+ // packages/content/src/pierre-theme.ts
10
+ var h = {
11
+ name: "Elements",
12
+ appearance: "light",
13
+ cssVariables: {
14
+ prefix: "--elements-syntax-",
15
+ defaults: {
16
+ foreground: i.ink,
17
+ background: i.surface,
18
+ keyword: t.keyword,
19
+ string: t.string,
20
+ comment: t.comment,
21
+ number: t.number,
22
+ type: t.type,
23
+ punctuation: i.muted
24
+ }
25
+ },
26
+ style: {
27
+ "editor.background": "background",
28
+ "editor.foreground": "foreground",
29
+ syntax: {
30
+ keyword: {
31
+ color: "keyword",
32
+ font_weight: 600
33
+ },
34
+ string: "string",
35
+ comment: "comment",
36
+ number: "number",
37
+ type: "type",
38
+ function: "foreground",
39
+ operator: "punctuation",
40
+ punctuation: "punctuation"
41
+ }
42
+ }
43
+ }, g = `
44
+ :host {
45
+ color-scheme: inherit;
46
+ --diffs-font-family: ${n.monoFamily};
47
+ --diffs-header-font-family: ${n.fontFamily};
48
+ --diffs-font-size: ${n.captionSize};
49
+ --diffs-line-height: ${n.bodyLineHeight};
50
+ --diffs-gap-inline: ${a.sm};
51
+ --diffs-gap-block: ${a.sm};
52
+ --diffs-bg: ${i.surface};
53
+ --diffs-fg: ${i.ink};
54
+ --diffs-fg-number: ${i.muted};
55
+ --diffs-bg-addition: ${i.accentSoft};
56
+ --diffs-bg-deletion: ${i.dangerSoft};
57
+ --diffs-addition-color-override: ${i.accent};
58
+ --diffs-deletion-color-override: ${i.danger};
59
+ --diffs-modified-color-override: ${i.focus};
60
+ --diffs-bg-context-override: ${i.surface};
61
+ --diffs-bg-context-gutter-override: ${i.canvas};
62
+ --diffs-bg-separator-override: ${i.canvas};
63
+ --diffs-selection-background: ${i.accentSoft};
64
+ font-family: ${n.monoFamily};
65
+ font-size: ${n.captionSize};
66
+ color: ${i.ink};
67
+ background: ${i.surface};
68
+ }
69
+ pre { font-family: ${n.monoFamily}; font-size: ${n.captionSize}; line-height: ${n.bodyLineHeight}; }
70
+ [data-line-number] { color: ${i.muted}; }
71
+ [data-diffs-header] {
72
+ min-height: ${r.height};
73
+ padding-block: ${a.sm};
74
+ padding-inline: ${a.md};
75
+ border-bottom: 1px solid ${i.line};
76
+ font-size: ${n.captionSize};
77
+ line-height: ${n.captionLineHeight};
78
+ font-weight: ${n.mediumWeight};
79
+ flex-wrap: wrap;
80
+ }
81
+ [data-header-content] { flex: 1 1 12ch; }
82
+ `, _ = 2e5, v = 4096;
83
+ function y(e, t) {
84
+ let n = u(null), [r, i] = d();
85
+ return l(() => () => {
86
+ n.current !== null && (n.current.tokenizer.dispose(), n.current = null);
87
+ }, []), l(() => {
88
+ let r = !0;
89
+ async function a() {
90
+ try {
91
+ let a = await import("@pierre/highlights");
92
+ if (!r || e.length > _ || !a.isSupportedLanguage(t)) return;
93
+ let o = n.current, s = o !== null && o.language === t, c = s ? o : {
94
+ language: t,
95
+ source: e,
96
+ tokenizer: new a.LiveTokenizer({
97
+ code: e,
98
+ lang: t,
99
+ theme: h,
100
+ tokenizeMaxLineLength: v
101
+ })
102
+ };
103
+ if (s) {
104
+ if (e.startsWith(o.source)) {
105
+ let t = c.tokenizer.lineCount - 1, n = {
106
+ line: t,
107
+ character: c.tokenizer.getLineLength(t)
108
+ };
109
+ c.tokenizer.applyEdits([{
110
+ range: {
111
+ start: n,
112
+ end: n
113
+ },
114
+ newText: e.slice(o.source.length)
115
+ }]);
116
+ } else c.tokenizer.reset(e);
117
+ } else o !== null && o.tokenizer.dispose();
118
+ n.current = {
119
+ ...c,
120
+ source: e
121
+ };
122
+ let l = c.tokenizer;
123
+ l.flush();
124
+ let u = Array.from({ length: l.lineCount }, (e, t) => l.getLineTokens(t).tokens);
125
+ i({
126
+ code: e,
127
+ language: t,
128
+ lines: u,
129
+ hasFailed: !1
130
+ });
131
+ } catch {
132
+ r && i({
133
+ code: e,
134
+ language: t,
135
+ lines: [],
136
+ hasFailed: !0
137
+ });
138
+ }
139
+ }
140
+ return a(), () => {
141
+ r = !1;
142
+ };
143
+ }, [e, t]), r !== void 0 && r.code === e && r.language === t ? r : void 0;
144
+ }
145
+ // packages/content/src/code/code-block.tsx
146
+ var b = {
147
+ kVQacm: "xysyzu8",
148
+ k9g6sI: "x12h1iku",
149
+ $$css: !0
150
+ }, x = {
151
+ viewport: (e) => [
152
+ b,
153
+ {
154
+ kskxy: e == null ? e : "x1jols5v",
155
+ $$css: !0
156
+ },
157
+ { "--x-maxHeight": ((e) => typeof e == "number" ? e + "px" : e ?? void 0)(e) }
158
+ ],
159
+ token: (e) => [{
160
+ kMwMTN: e == null ? e : "x14rh7hd",
161
+ $$css: !0
162
+ }, { "--x-color": e ?? void 0 }],
163
+ italic: {
164
+ kKX8nH: "x1k4tb9n",
165
+ $$css: !0
166
+ },
167
+ bold: {
168
+ k63SB2: "x1b5ytql",
169
+ $$css: !0
170
+ }
171
+ }, S = 2e5;
172
+ function C({ token: e }) {
173
+ let t = e.fontStyle ?? 0, [n, r] = [!!(t & 1), !!(t & 2)];
174
+ return /* @__PURE__ */ f("span", {
175
+ ...c.props(x.token(e.color ?? i.ink), n && x.italic, r && x.bold),
176
+ children: e.content
177
+ });
178
+ }
179
+ function w({ code: t, variant: n = "default", language: r, filename: i, isStreaming: a = !1, shouldWrap: l = !1, showLineNumbers: u = !0, selectedLines: d, annotations: h = [], maxHeight: g = 400, maxLines: _ = 2e3 }) {
180
+ let v = r ?? (i === void 0 ? "text" : m(i)), b = y(t, v), w = o(), T = t.slice(0, S).split(/\r\n|\n|\r/u), E = T.slice(0, Math.max(1, _)).map((e, t) => ({
181
+ text: e,
182
+ line: t + 1
183
+ })), D = i ?? v, O = n === "embedded";
184
+ return /* @__PURE__ */ p("section", {
185
+ "aria-label": i ?? "Code",
186
+ ...c.props(s.root, O && s.embedded),
187
+ children: [
188
+ /* @__PURE__ */ p("div", {
189
+ ...c.props(s.header, O && s.embeddedHeader),
190
+ children: [/* @__PURE__ */ p("span", {
191
+ ...c.props(s.label),
192
+ children: [D, a && !O && " · streaming"]
193
+ }), /* @__PURE__ */ f(e, {
194
+ label: i ?? "code",
195
+ value: t,
196
+ display: O ? "icon" : "value",
197
+ children: "Copy"
198
+ })]
199
+ }),
200
+ /* @__PURE__ */ f("div", {
201
+ ref: w.ref,
202
+ role: "region",
203
+ "aria-label": `${D} source`,
204
+ tabIndex: w.tabIndex,
205
+ ...c.props(s.scrollRegion, x.viewport(g)),
206
+ children: /* @__PURE__ */ f("pre", {
207
+ ...{
208
+ 0: { className: "x1ghz6dp xn9t2bk xiard35 xy8obcc x1778rvt xeq4nuv xk8lq53" },
209
+ 1: { className: "x1ghz6dp xn9t2bk xiard35 xy8obcc x1778rvt xeq4nuv xeuugli x126k92a xj0a0fe" }
210
+ }[!!l | 0],
211
+ children: /* @__PURE__ */ f("code", {
212
+ className: "xjb2p0i",
213
+ children: E.map(({ text: e, line: t }) => {
214
+ let n = b === void 0 ? void 0 : b.lines[t - 1], r = d !== void 0 && t >= d.start && t <= (d.end ?? d.start), i = h.find((e) => e.line === t);
215
+ return /* @__PURE__ */ p("span", { children: [/* @__PURE__ */ p("span", {
216
+ ...{
217
+ 0: { className: "x78zum5 x16exltd" },
218
+ 1: { className: "x78zum5 x16exltd x1r8u7ye" }
219
+ }[!!r | 0],
220
+ children: [u && /* @__PURE__ */ f("span", {
221
+ "aria-hidden": !0,
222
+ className: "x1rg5ohu x2lah0s xl3ry0p x5g2kb4 xp4054r x153jb6y x87ps6o",
223
+ children: t
224
+ }), /* @__PURE__ */ p("span", {
225
+ className: "x1lliihq x12lumcd x1doqdfy xeuugli",
226
+ children: [n === void 0 ? e : n.map((e) => /* @__PURE__ */ f(C, { token: e }, e.offset)), e.length === 0 && "\n"]
227
+ })]
228
+ }), i !== void 0 && /* @__PURE__ */ f("span", {
229
+ className: "x1lliihq x9f619 x7wzq59 x1o0tod xzfn7dr x1mvvolr x1r7kqkb x1hz01jw xtqrqnz x1778rvt xeaf4i8 xj0a0fe",
230
+ children: i.content
231
+ })] }, t);
232
+ })
233
+ })
234
+ })
235
+ }),
236
+ T.length > E.length && /* @__PURE__ */ f("div", {
237
+ ...c.props(s.note),
238
+ children: "Additional lines omitted. Copy includes the complete source."
239
+ }),
240
+ t.length > S && /* @__PURE__ */ f("div", {
241
+ ...c.props(s.note),
242
+ children: "Preview limited to the first 200,000 characters. Copy includes the complete source."
243
+ }),
244
+ t.length === 0 && /* @__PURE__ */ f("div", {
245
+ ...c.props(s.note),
246
+ children: "No source text."
247
+ }),
248
+ b !== void 0 && b.hasFailed && /* @__PURE__ */ f("div", {
249
+ ...c.props(s.note),
250
+ children: "Syntax highlighting unavailable. The source is shown unchanged."
251
+ })
252
+ ]
253
+ });
254
+ }
255
+ export { h as n, g as r, w as t };