@mechane-ai/elements 0.51.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.
Files changed (62) hide show
  1. package/dist/ai.js +169 -169
  2. package/dist/{article-CRlhq9oA.js → article-BDVuehRt.js} +1 -1
  3. package/dist/article.js +1 -1
  4. package/dist/catalog.json +42 -1
  5. package/dist/{categorical-values-BYP_R5gS.js → categorical-values-BoS03HcI.js} +1 -1
  6. package/dist/charts/cartesian.js +1 -1
  7. package/dist/charts/comparison.js +1 -1
  8. package/dist/charts/distribution.js +1 -1
  9. package/dist/charts/figure.js +12 -13
  10. package/dist/charts/graph.js +1 -1
  11. package/dist/charts/hierarchy.js +1 -1
  12. package/dist/charts/image.js +1 -1
  13. package/dist/charts/matrix.js +1 -1
  14. package/dist/charts/plot.js +3 -3
  15. package/dist/charts/relationship.js +1 -1
  16. package/dist/charts/text.js +1 -1
  17. package/dist/charts/timeline.js +1 -1
  18. package/dist/charts/trend.js +1 -1
  19. package/dist/charts.js +2 -2
  20. package/dist/collections.js +1 -1
  21. package/dist/content/markdown.js +1 -278
  22. package/dist/{dates-ckJdYF7t.js → dates-CjlTzw00.js} +1 -1
  23. package/dist/{dumbbell-plot-BC8d_IJy.js → dumbbell-plot-Xxl6P7D1.js} +3 -3
  24. package/dist/{embedding-map-Bj8krO-d.js → embedding-map-tU8hT_aC.js} +3 -3
  25. package/dist/{figure-frame-koVKcXph.js → figure-frame-BKc9TvtX.js} +1 -1
  26. package/dist/forms/dates.js +1 -1
  27. package/dist/{image-grid-CLhol2jy.js → image-grid-BZy2lkNb.js} +2 -2
  28. package/dist/kits/evaluation.js +4 -4
  29. package/dist/kits/interpretability.js +7 -7
  30. package/dist/kits/operations.js +4 -4
  31. package/dist/kits/research.js +463 -183
  32. package/dist/kits/training.js +3 -3
  33. package/dist/markdown-VpLw_P9T.js +313 -0
  34. package/dist/mdx.js +2 -2
  35. package/dist/packages/charts/src/graph/tree-diagram.d.ts +1 -1
  36. package/dist/packages/charts/src/plot/plot-layout.d.ts +0 -6
  37. package/dist/packages/charts/src/timeline/event-strip.d.ts +12 -2
  38. package/dist/packages/charts/src/timeline/index.d.ts +1 -1
  39. package/dist/packages/collections/src/metrics.d.ts +5 -11
  40. package/dist/packages/content/src/markdown/markdown.d.ts +8 -1
  41. package/dist/packages/kits/src/research/collection-page.d.ts +9 -0
  42. package/dist/packages/kits/src/research/index.d.ts +3 -1
  43. package/dist/packages/kits/src/research/lineage-graph.d.ts +40 -0
  44. package/dist/{plot-layout-B2xRt-_k.js → plot-layout-D8j-ozGR.js} +102 -86
  45. package/dist/{plot-surface-0cKFwtws.js → plot-surface-5e3xeiub.js} +1 -1
  46. package/dist/{reference-lines-nSxcZVF5.js → reference-lines-1FttCg46.js} +1 -1
  47. package/dist/{scene-4ePpWdmE.js → scene-8F-fQksU.js} +4 -4
  48. package/dist/scene.js +1 -1
  49. package/dist/{slope-chart-DWZIYDty.js → slope-chart-B35ZfaYn.js} +4 -4
  50. package/dist/{src-DNclWY4V.js → src-fvoTU3Bq.js} +377 -377
  51. package/dist/{time-series-CsngFxr1.js → time-series-DoFMGmFV.js} +612 -590
  52. package/dist/{token-heatmap-BQLIxPky.js → token-heatmap-DLPQWwMv.js} +3 -3
  53. package/dist/{token-predictions-C3B5L-eO.js → token-predictions-D_Jwf8Aw.js} +3 -3
  54. package/dist/{tree-diagram-Dau9jeXS.js → tree-diagram-DreDBCvt.js} +4 -4
  55. package/dist/{treemap-DWrMQndu.js → treemap-MVX-wa4t.js} +4 -4
  56. package/dist/{violin-plot-D05ODcyc.js → violin-plot-Bi71NqXF.js} +3 -3
  57. package/dist/waterfall-8y8ANO3c.js +605 -0
  58. package/package.json +1 -1
  59. package/recipes/calendar-workspace.tsx +39 -0
  60. package/skills/use-elements/references/workspace.md +8 -6
  61. package/dist/visible-motion-1GcUaEi4.js +0 -23
  62. package/dist/waterfall-BkLLv2Lm.js +0 -576
@@ -0,0 +1,605 @@
1
+ import { T as e, c as t, m as n } from "./src-9EJskqB_.js";
2
+ import { A as r, E as i, M as a, S as o, f as s, j as c, l, s as u } from "./plot-layout-D8j-ozGR.js";
3
+ import { i as d } from "./chart-link-AE_xuxiP.js";
4
+ import { a as f } from "./tone-scope-DKiSw-JR.js";
5
+ import { n as ee, r as p } from "./figure-format-B8kRZMlo.js";
6
+ import { a as m, o as h, r as te } from "./scale-C2xgZyZN.js";
7
+ import { t as ne } from "./chart-cursor-1mFd48Jc.js";
8
+ import { i as re, l as ie, n as ae, r as oe, t as g } from "./figure-frame-BKc9TvtX.js";
9
+ import { n as _ } from "./plot-width-D3hTycYX.js";
10
+ import { t as se } from "./plot-axes-D5S9BnBa.js";
11
+ import { a as ce, c as le, f as ue, r as de } from "./plot-marks-FVsbFkUs.js";
12
+ import { n as fe, r as pe, t as me } from "./plot-surface-5e3xeiub.js";
13
+ import { t as he } from "./locate-Bcg3QcP4.js";
14
+ import * as ge from "@stylexjs/stylex";
15
+ import { useId as _e, useState as ve } from "react";
16
+ import { stackSpans as ye } from "@ui-sdk/core";
17
+ import { Fragment as be, jsx as v, jsxs as y } from "react/jsx-runtime";
18
+ import { Waterfall as b, WaterfallBar as xe, WaterfallCell as x, WaterfallColumnHeader as S, WaterfallHeaderRow as Se, WaterfallRow as C, WaterfallRowHeader as Ce } from "@ui-sdk/react/waterfall";
19
+ // packages/charts/src/timeline/event-strip.tsx
20
+ var w = {
21
+ lanes: 12,
22
+ events: 1e3
23
+ }, T = 22, E = 6, we = 14, Te = 3, D = 5, Ee = 14, De = 4, Oe = 18, O = 4, ke = 6.5, Ae = 12, k = .5, je = .04, A = 1e3, j = 60 * A, M = 60 * j, N = 24 * M, P = {
24
+ unit: "second",
25
+ size: A
26
+ }, Me = [
27
+ {
28
+ unit: "day",
29
+ size: N
30
+ },
31
+ {
32
+ unit: "hour",
33
+ size: M
34
+ },
35
+ {
36
+ unit: "minute",
37
+ size: j
38
+ },
39
+ P
40
+ ], Ne = { separator: {
41
+ kfzvcC: "x47corl",
42
+ $$css: !0
43
+ } };
44
+ function Pe(e) {
45
+ return l({
46
+ width: Infinity,
47
+ valueLabels: e,
48
+ hasXTitle: !0,
49
+ hasYTitle: !1
50
+ }).left;
51
+ }
52
+ function Fe(e, t) {
53
+ let n = Me.find((t) => e >= t.size) ?? P;
54
+ return p({
55
+ value: e / n.size,
56
+ locale: t,
57
+ format: {
58
+ style: "unit",
59
+ unit: n.unit,
60
+ unitDisplay: "long",
61
+ maximumFractionDigits: 1
62
+ }
63
+ });
64
+ }
65
+ function Ie(e, t) {
66
+ let n = [...e.flatMap((e) => e.end === void 0 ? [e.start] : [e.start, e.end]), ...t.map((e) => e.at)];
67
+ if (n.length === 0) return [0, M];
68
+ let r = Math.min(...n), i = Math.max(...n), a = i - r, o = a > 0 ? Math.max(j, Math.round(a * je)) : M * k;
69
+ return [r - o, i + o];
70
+ }
71
+ function Le({ lanes: e, events: t, markers: n, domain: r, zone: i }) {
72
+ let o = h(r);
73
+ if (o !== void 0) return o;
74
+ if (i === void 0) return "A function time format needs a timeZone beside it, so the axis ticks fall on that zone.";
75
+ if (e.length > w.lanes || t.length > w.events) return `This strip draws at most ${w.lanes} lanes and ${w.events} events. Supply a shorter window.`;
76
+ if (!a(e) || !a(t) || !a(n)) return "Lanes, events and markers must each have unique identifiers.";
77
+ let s = new Set(e.map((e) => e.id)), c = t.find((e) => !s.has(e.laneId));
78
+ if (c !== void 0) return `Event ${c.id} names lane ${c.laneId}, which is not supplied.`;
79
+ let l = t.find((e) => {
80
+ let t = e.end !== void 0 && (m(e.end, r) || e.end <= e.start);
81
+ return m(e.start, r) || t;
82
+ });
83
+ return l === void 0 ? n.some((e) => m(e.at, r)) ? "A marker lies outside the domain." : void 0 : `Event ${l.id} must start inside the domain and, when it has an end, end after its start inside the domain.`;
84
+ }
85
+ function Re(t) {
86
+ let { lanes: a, events: p, domain: m, markers: h = [], windows: b, defaultWindowId: xe, gutterWidth: x, timeFormat: S, timeZone: Se, selected: C, onSelectedChange: Ce, ...w } = t, { emptyLabel: je = "No events in this window.", ...A } = w, { locale: j, title: M } = A, N = pe("compact"), P = _e(), Me = f(), Pe = d(), Re = b?.[0]?.id ?? "", [F, I] = ve(() => xe ?? Re);
87
+ if (A.status === "loading") return /* @__PURE__ */ v(re, {
88
+ ...A,
89
+ height: "compact"
90
+ });
91
+ let L = p.map((e) => e.end !== void 0 && e.end <= e.start ? {
92
+ ...e,
93
+ end: void 0
94
+ } : e), R = m ?? Ie(L, h), z = b === void 0 || b.length === 0 ? void 0 : b.find((e) => e.id === F) ?? b[0], B = z?.durationMs ?? null, V = B !== null && B > 0, H = V ? [Math.max(R[0], R[1] - B), R[1]] : R, U = V ? L.flatMap((e) => {
95
+ if ((e.end ?? e.start) < H[0] || e.start > H[1]) return [];
96
+ let t = Math.max(H[0], e.start), n = e.end === void 0 ? void 0 : Math.min(H[1], e.end), r = n !== void 0 && n > t ? n : void 0;
97
+ return [{
98
+ ...e,
99
+ start: t,
100
+ end: r
101
+ }];
102
+ }) : L, W = V ? h.filter((e) => e.at >= H[0] && e.at <= H[1]) : h, G = typeof S == "function" ? Se : S.timeZone, ze = Le({
103
+ lanes: a,
104
+ events: U,
105
+ markers: W,
106
+ domain: H,
107
+ zone: G
108
+ });
109
+ if (ze !== void 0 || G === void 0) return /* @__PURE__ */ v(oe, {
110
+ ...A,
111
+ message: ze ?? "The strip needs a time zone."
112
+ });
113
+ let Be = b === void 0 || b.length <= 1 ? A.actions : /* @__PURE__ */ y(n, { children: [b.map((t) => {
114
+ let n = t.id === z?.id;
115
+ return /* @__PURE__ */ v(e, {
116
+ type: "button",
117
+ density: "compact",
118
+ variant: n ? "outline" : "ghost",
119
+ "aria-pressed": n,
120
+ onClick: () => I(t.id),
121
+ children: t.label
122
+ }, t.id);
123
+ }), A.actions] });
124
+ function K(e) {
125
+ return ee({
126
+ timestamp: e,
127
+ locale: j,
128
+ format: S
129
+ });
130
+ }
131
+ let Ve = l({
132
+ width: N.width,
133
+ valueLabels: a.map((e) => e.label),
134
+ hasXTitle: !0,
135
+ hasYTitle: !1
136
+ }), q = x === void 0 ? Ve : {
137
+ ...Ve,
138
+ left: x
139
+ }, J = Math.max(1, N.width - q.left - q.right), Y = te({
140
+ domain: H,
141
+ range: [q.left, q.left + J]
142
+ }), X = W.map((e) => {
143
+ let t = Y.position(e.at), n = `${e.label} ${K(e.at)}`, r = n.length * ke + 8, i = t > q.left + J * k;
144
+ return {
145
+ marker: e,
146
+ at: t,
147
+ text: n,
148
+ isEnd: i,
149
+ start: i ? t - r : t,
150
+ end: i ? t : t + r
151
+ };
152
+ }), He = ye(X.map((e) => ({
153
+ id: e.marker.id,
154
+ track: "markers",
155
+ start: e.start,
156
+ end: e.end
157
+ }))), Ue = Math.max(0, ...X.map((e) => (He.get(e.marker.id)?.lane ?? 0) + 1)), We = q.top + Ue * Oe, Ge = (H[1] - H[0]) * Ee / J, Ke = (H[1] - H[0]) * Te / J, qe = ye(U.map((e) => ({
158
+ id: e.id,
159
+ track: e.laneId,
160
+ start: e.end === void 0 ? e.start - Ge * k : e.start,
161
+ end: e.end === void 0 ? e.start + Ge * k : Math.max(e.end, e.start + Ke)
162
+ }))), Je = a.map((e) => Math.max(1, ...U.flatMap((t) => t.laneId === e.id ? [(qe.get(t.id)?.lane ?? 0) + 1] : []))), Ye = a.flatMap((e, t) => Array.from({ length: Je[t] ?? 1 }, (t, n) => ({
163
+ laneId: e.id,
164
+ row: n
165
+ }))), Xe = We + Ye.length * T + a.length * E * 2 + q.bottom, Z = u({
166
+ width: N.width,
167
+ height: Xe,
168
+ margins: {
169
+ ...q,
170
+ top: We
171
+ }
172
+ }), Ze = a.map((e, t) => {
173
+ let n = Ye.findIndex((t) => t.laneId === e.id), r = Z.top + t * E * 2 + n * T;
174
+ return {
175
+ lane: e,
176
+ index: t,
177
+ start: r,
178
+ end: r + (Je[t] ?? 1) * T + 12
179
+ };
180
+ }), Qe = s({
181
+ domain: H,
182
+ length: Z.innerWidth,
183
+ timeFormat: S,
184
+ locale: j,
185
+ timeZone: G
186
+ }), $e = Qe.values.map((e, t) => ({
187
+ key: String(e),
188
+ position: Y.position(e),
189
+ label: Qe.labels[t] ?? ""
190
+ })), et = Ze.map((e) => ({
191
+ key: e.lane.id,
192
+ position: (e.start + e.end) * k,
193
+ label: e.lane.label
194
+ })), Q = U.map((e, t) => ({
195
+ event: e,
196
+ index: t
197
+ })).toSorted((e, t) => e.event.start === t.event.start ? e.index - t.index : e.event.start - t.event.start).map((e) => e.event).map((e, t) => {
198
+ let n = Ze.find((t) => t.lane.id === e.laneId), r = n?.index ?? 0, i = a[r], o = qe.get(e.id)?.lane ?? 0, s = (n?.start ?? Z.top) + E + (o + k) * T, c = Y.position(e.start), l = e.end === void 0 ? c : Math.max(c + Te, Y.position(e.end)), u = e.tone ?? Me({
199
+ id: e.laneId,
200
+ tone: i?.tone,
201
+ index: r
202
+ });
203
+ return {
204
+ event: e,
205
+ rank: t,
206
+ laneIndex: r,
207
+ laneLabel: i?.label ?? e.laneId,
208
+ x1: c,
209
+ x2: l,
210
+ y: s,
211
+ tone: u
212
+ };
213
+ }), $ = Q.map(({ event: e, laneLabel: t }) => {
214
+ let n = e.end === void 0 ? K(e.start) : `${K(e.start)} – ${K(e.end)} · ${Fe(e.end - e.start, j)}`;
215
+ return {
216
+ id: e.id,
217
+ label: [
218
+ t,
219
+ e.label,
220
+ n,
221
+ e.detail
222
+ ].filter((e) => e !== void 0).join(" · ")
223
+ };
224
+ }), tt = 1 / (a.length * 2 + 1), nt = he({
225
+ marks: Q.map((e) => ({
226
+ id: e.event.id,
227
+ x: (e.x1 + e.x2) * k,
228
+ y: e.y
229
+ })),
230
+ width: Z.width,
231
+ height: Z.height
232
+ });
233
+ function rt(e) {
234
+ let t = e.x / e.width * Z.width, n = e.y / e.height * Z.height;
235
+ return Q.findLast((e) => t >= e.x1 - D - De && t <= e.x2 + D + De && Math.abs(n - e.y) <= T * k)?.event.id ?? nt(e);
236
+ }
237
+ return /* @__PURE__ */ v(i, {
238
+ ...Pe,
239
+ items: $,
240
+ place: (e) => {
241
+ let t = Q.find((t) => t.event.id === e), n = t?.rank ?? 0, r = (t?.laneIndex ?? 0) * tt;
242
+ return t === void 0 ? void 0 : {
243
+ left: n,
244
+ right: n,
245
+ top: r,
246
+ bottom: r
247
+ };
248
+ },
249
+ locate: rt,
250
+ selected: C ?? null,
251
+ onSelect: Ce,
252
+ render: (e, { inspected: t, cursor: n }) => {
253
+ let i = Q.find((e) => e.event.id === n);
254
+ return /* @__PURE__ */ v(ae, {
255
+ ...A,
256
+ actions: Be,
257
+ figure: e,
258
+ footer: U.length === 0 ? void 0 : /* @__PURE__ */ v(o, {
259
+ id: P,
260
+ children: r($, t)
261
+ }),
262
+ children: U.length === 0 ? /* @__PURE__ */ v(g, { children: je }) : /* @__PURE__ */ y(be, { children: [/* @__PURE__ */ y(fe, {
263
+ plotRef: N.ref,
264
+ box: Z,
265
+ label: c({
266
+ title: M,
267
+ marks: "events",
268
+ isSelectable: Ce !== void 0
269
+ }),
270
+ readoutId: P,
271
+ children: [
272
+ /* @__PURE__ */ v(se, {
273
+ box: Z,
274
+ xTicks: $e,
275
+ yTicks: et,
276
+ xTitle: `Time (${G})`,
277
+ grid: "x"
278
+ }),
279
+ Ze.slice(1).map((e) => /* @__PURE__ */ v("line", {
280
+ x1: Z.left,
281
+ x2: Z.right,
282
+ y1: e.start,
283
+ y2: e.start,
284
+ ...ge.props(_.grid, Ne.separator)
285
+ }, e.lane.id)),
286
+ /* @__PURE__ */ v(me, {
287
+ box: Z,
288
+ children: Q.map((e) => e.event.end === void 0 ? /* @__PURE__ */ v(ce, {
289
+ x: e.x1,
290
+ y: e.y,
291
+ radius: D,
292
+ tone: e.tone,
293
+ isInspected: t === e.event.id,
294
+ isSelected: C === e.event.id
295
+ }, e.event.id) : /* @__PURE__ */ v(de, {
296
+ x: e.x1,
297
+ y: e.y - we * k,
298
+ width: e.x2 - e.x1,
299
+ height: we,
300
+ tone: e.tone,
301
+ isInspected: t === e.event.id,
302
+ isSelected: C === e.event.id
303
+ }, e.event.id))
304
+ }),
305
+ X.map(({ marker: e, at: t, text: n, isEnd: r }) => {
306
+ let i = He.get(e.id)?.lane ?? 0, a = Z.top - 8 - i * Oe;
307
+ return /* @__PURE__ */ y("g", { children: [/* @__PURE__ */ v(ue, {
308
+ x1: t,
309
+ x2: t,
310
+ y1: a + O,
311
+ y2: Z.bottom,
312
+ stroke: "dashed"
313
+ }), /* @__PURE__ */ v(le, {
314
+ x: r ? t - O : t + O,
315
+ y: a,
316
+ anchor: r ? "end" : "start",
317
+ children: n
318
+ })] }, e.id);
319
+ }),
320
+ i !== void 0 && /* @__PURE__ */ v(ne, {
321
+ x: (i.x1 + i.x2) * k,
322
+ top: Z.top,
323
+ bottom: Z.bottom,
324
+ width: Ae
325
+ })
326
+ ]
327
+ }), /* @__PURE__ */ v(ie, {
328
+ label: `${M} events`,
329
+ columns: [{
330
+ id: "event",
331
+ label: "Event"
332
+ }],
333
+ rows: $.map((e) => ({
334
+ id: e.id,
335
+ values: [e.label]
336
+ }))
337
+ })] })
338
+ });
339
+ }
340
+ });
341
+ }
342
+ // packages/charts/src/timeline/waterfall.tsx
343
+ var F = 5, I = {
344
+ cell: {
345
+ k3XXqK: "x1t137rt",
346
+ kZs9gx: "x19rmrnh",
347
+ k7shQP: "x9v5kkp",
348
+ kPJHz1: "x13qnu6",
349
+ kiEn40: "x7s97pk",
350
+ $$css: !0
351
+ },
352
+ plot: {
353
+ k7Eaqz: "xeuugli",
354
+ kUOVxO: "xl4o6ss",
355
+ kBCFzs: "x1npkx4u x1v577k8",
356
+ kbNqZ1: "x1ms6mhf x1aa6nly",
357
+ $$css: !0
358
+ },
359
+ neutral: {
360
+ kMwMTN: "x153jb6y",
361
+ $$css: !0
362
+ },
363
+ positive: {
364
+ kMwMTN: "x7ixh4y",
365
+ $$css: !0
366
+ },
367
+ negative: {
368
+ kMwMTN: "xr5kp14",
369
+ $$css: !0
370
+ }
371
+ }, L = {
372
+ neutral: I.neutral,
373
+ positive: I.positive,
374
+ negative: I.negative
375
+ }, R = [
376
+ 0,
377
+ .5,
378
+ 1
379
+ ], z = 100;
380
+ function B({ items: e, start: n, end: r, rowLabel: i, summaryLabel: a, emptyLabel: o = "No timing records are available.", selected: s, selectedRef: c, onSelectedChange: l, offsetFormat: u, ...d }) {
381
+ let { title: f, locale: ee } = d, m = V({
382
+ items: e,
383
+ start: n,
384
+ end: r
385
+ });
386
+ if (m !== void 0) return /* @__PURE__ */ v(oe, {
387
+ ...d,
388
+ message: m
389
+ });
390
+ let h = r - n, ne = te({
391
+ domain: [n, r],
392
+ range: [0, z]
393
+ }), re = h > 0 ? R : [0], ie = e.some((e) => e.geometry.kind !== "unavailable");
394
+ function g(e) {
395
+ return p({
396
+ value: e,
397
+ locale: ee,
398
+ format: u
399
+ });
400
+ }
401
+ let _ = new Map(e.map((e) => [e.id, W({
402
+ geometry: e.geometry,
403
+ start: n,
404
+ offset: g
405
+ })])), se = e.map((e) => ({
406
+ value: e.id,
407
+ label: `${e.label} · ${e.detail} · ${e.summary} · ${_.get(e.id)}`,
408
+ ...U(e.geometry)
409
+ })), ce = e.length === 0 ? /* @__PURE__ */ v("div", {
410
+ role: "group",
411
+ "aria-label": f,
412
+ className: "xeuugli x1hz01jw x12h1iku",
413
+ children: /* @__PURE__ */ v("p", {
414
+ className: "x1ghz6dp x1c8xbx5",
415
+ children: /* @__PURE__ */ v(t, {
416
+ tone: "muted",
417
+ children: o
418
+ })
419
+ })
420
+ }) : /* @__PURE__ */ y(b, {
421
+ items: se,
422
+ range: [n, r],
423
+ value: s ?? null,
424
+ onValueChange: (e, t) => {
425
+ e !== null && l(e, t);
426
+ },
427
+ getBarLabel: (e) => _.get(e.value) ?? "",
428
+ "aria-label": f,
429
+ className: "xeuugli x1hz01jw x12h1iku",
430
+ children: [/* @__PURE__ */ y(Se, {
431
+ className: "xrvj5dj x13sfnbj x1prkh4w x6s0dn4 x1gkm1c7 x1y1mm1b xh8yej3 x9f619 x1doqdfy x17tes2r x153jb6y xy8obcc xso031l x1q0q8m5 x1qndepd",
432
+ children: [
433
+ /* @__PURE__ */ v(S, { children: /* @__PURE__ */ v(t, {
434
+ variant: "caption",
435
+ tone: "muted",
436
+ children: i
437
+ }) }),
438
+ /* @__PURE__ */ v(S, {
439
+ "aria-label": "Timing",
440
+ className: "xeuugli xl4o6ss x1npkx4u x1v577k8 x1ms6mhf x1aa6nly x78zum5 x1qughib x6s0dn4 xy8obcc xas2l8k xss6m8b",
441
+ children: ie ? re.map((e) => /* @__PURE__ */ v("span", { children: g(h * e) }, e)) : /* @__PURE__ */ v("span", { children: "Timing unavailable" })
442
+ }),
443
+ /* @__PURE__ */ v(S, {
444
+ className: "xrvj5dj xfko13i xeuugli x1k3v4rp x14r0xmm x1ms6mhf xp4054r xj0a0fe xss6m8b",
445
+ children: /* @__PURE__ */ v(t, {
446
+ variant: "caption",
447
+ tone: "muted",
448
+ children: a
449
+ })
450
+ })
451
+ ]
452
+ }), e.map((e) => {
453
+ let n = _.get(e.id), r = s === e.id;
454
+ return /* @__PURE__ */ y(C, {
455
+ value: e.id,
456
+ ref: r ? c : void 0,
457
+ "aria-controls": e.controls,
458
+ ...{
459
+ 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" },
460
+ 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" }
461
+ }[!!r | 0],
462
+ children: [
463
+ /* @__PURE__ */ y(Ce, {
464
+ className: "xeuugli xrvj5dj xfko13i x1t137rt x19rmrnh x9v5kkp x13qnu6 x7s97pk",
465
+ children: [/* @__PURE__ */ v(t, { children: e.label }), /* @__PURE__ */ v("span", {
466
+ title: e.detail,
467
+ ...{
468
+ 0: { className: "xb3r6kr xuxw1ft xlyipyv" },
469
+ 1: { className: "xb3r6kr xlyipyv xeaf4i8 xj0a0fe" }
470
+ }[!!r | 0],
471
+ children: /* @__PURE__ */ v(t, {
472
+ variant: "caption",
473
+ tone: "muted",
474
+ children: e.detail
475
+ })
476
+ })]
477
+ }),
478
+ /* @__PURE__ */ v(xe, {
479
+ title: n,
480
+ ...ge.props(I.plot, I.cell, L[e.tone ?? "neutral"]),
481
+ children: e.geometry.kind === "unavailable" ? /* @__PURE__ */ v(t, {
482
+ variant: "caption",
483
+ tone: "muted",
484
+ children: n
485
+ }) : /* @__PURE__ */ y("svg", {
486
+ "aria-hidden": !0,
487
+ className: "x1lliihq xh8yej3 xmix8c7 x1rea2x4",
488
+ children: [re.map((e) => /* @__PURE__ */ v("line", {
489
+ x1: `${e * z}%`,
490
+ x2: `${e * z}%`,
491
+ y1: "0",
492
+ y2: "18",
493
+ className: "x13hfdr1"
494
+ }, e)), /* @__PURE__ */ v(H, {
495
+ geometry: e.geometry,
496
+ scale: ne
497
+ })]
498
+ })
499
+ }),
500
+ /* @__PURE__ */ y(x, {
501
+ className: "xrvj5dj xfko13i xeuugli x1k3v4rp x14r0xmm x1ms6mhf xp4054r xj0a0fe xss6m8b x1t137rt x19rmrnh x9v5kkp x13qnu6 x7s97pk",
502
+ children: [/* @__PURE__ */ v(t, {
503
+ variant: "caption",
504
+ tone: "muted",
505
+ children: e.summary
506
+ }), r && /* @__PURE__ */ v(t, {
507
+ variant: "caption",
508
+ tone: "muted",
509
+ children: n
510
+ })]
511
+ })
512
+ ]
513
+ }, e.id);
514
+ })]
515
+ });
516
+ return /* @__PURE__ */ v(ae, {
517
+ ...d,
518
+ children: ce
519
+ });
520
+ }
521
+ function V({ items: e, start: t, end: n }) {
522
+ if (!Number.isFinite(t) || !Number.isFinite(n) || !Number.isFinite(n - t) || n < t) return "The timing domain must have finite, ordered endpoints.";
523
+ if (!a(e)) return "Timing records must have unique identifiers.";
524
+ for (let r of e) {
525
+ let e = r.geometry;
526
+ if (e.kind === "interval") {
527
+ if (!Number.isFinite(e.start) || !Number.isFinite(e.end) || e.end < e.start) return "Timing intervals must have finite, ordered endpoints.";
528
+ if (e.start < t || e.end > n) return "Timing intervals must fit inside the supplied domain.";
529
+ }
530
+ if (e.kind === "point" && (!Number.isFinite(e.at) || e.at < t || e.at > n)) return "Timing points must be finite and fit inside the supplied domain.";
531
+ }
532
+ }
533
+ function H({ geometry: e, scale: t }) {
534
+ switch (e.kind) {
535
+ case "unavailable": return null;
536
+ case "interval": {
537
+ let n = t.position(e.start), r = t.position(e.end) - n;
538
+ return r === 0 ? /* @__PURE__ */ v("circle", {
539
+ cx: `${n}%`,
540
+ cy: 9,
541
+ r: 3,
542
+ className: "x117rol3"
543
+ }) : /* @__PURE__ */ v("rect", {
544
+ x: `${n}%`,
545
+ y: 6,
546
+ width: `${r}%`,
547
+ height: 6,
548
+ rx: 2,
549
+ className: "x117rol3"
550
+ });
551
+ }
552
+ case "point": {
553
+ let n = t.position(e.at);
554
+ switch (e.marker) {
555
+ case "filled": return /* @__PURE__ */ v("circle", {
556
+ cx: `${n}%`,
557
+ cy: 9,
558
+ r: 3,
559
+ className: "x117rol3"
560
+ });
561
+ case "hollow": return /* @__PURE__ */ v("circle", {
562
+ cx: `${n}%`,
563
+ cy: 9,
564
+ r: 3.5,
565
+ className: "x1fytgo2 x73je2i xvlca1e"
566
+ });
567
+ case "diamond": return /* @__PURE__ */ v("svg", {
568
+ x: `${n}%`,
569
+ y: 9,
570
+ width: 1,
571
+ height: 1,
572
+ overflow: "visible",
573
+ children: /* @__PURE__ */ v("path", {
574
+ d: `M0 -${F} ${F} 0 0 ${F} -${F} 0Z`,
575
+ className: "x117rol3"
576
+ })
577
+ });
578
+ }
579
+ }
580
+ }
581
+ }
582
+ function U(e) {
583
+ switch (e.kind) {
584
+ case "interval": return {
585
+ start: e.start,
586
+ duration: e.end - e.start
587
+ };
588
+ case "point": return {
589
+ start: e.at,
590
+ duration: 0
591
+ };
592
+ case "unavailable": return {
593
+ start: NaN,
594
+ duration: NaN
595
+ };
596
+ }
597
+ }
598
+ function W({ geometry: e, start: t, offset: n }) {
599
+ switch (e.kind) {
600
+ case "interval": return `Start ${n(e.start - t)}, end ${n(e.end - t)}, duration ${n(e.end - e.start)}`;
601
+ case "point": return `At ${n(e.at - t)}`;
602
+ case "unavailable": return "Timing unavailable";
603
+ }
604
+ }
605
+ export { w as i, Re as n, Pe as r, B as t };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mechane-ai/elements",
3
- "version": "0.51.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": {
@@ -0,0 +1,39 @@
1
+ import { Text } from '@mechane-ai/elements';
2
+ import { EventMonth, serializeCalendarDate } from '@mechane-ai/elements/forms/dates';
3
+ import type { EventMonthProps } from '@mechane-ai/elements/forms/dates';
4
+ import { PageLayout, PageSection } from '@mechane-ai/elements/layout';
5
+
6
+ /**
7
+ * Keep a month grid flush with the workspace edges using PageSection's breakdown slot, then show the selected day's
8
+ * full event names in an inset sibling section. The caller supplies the events and controls the selected civil date.
9
+ */
10
+ export function CalendarWorkspace(calendar: EventMonthProps) {
11
+ const date = serializeCalendarDate(calendar.selected);
12
+ const selected = new Date(`${date}T00:00:00Z`);
13
+
14
+ const month = new Intl.DateTimeFormat(calendar.locale, { month: 'long', year: 'numeric', timeZone: 'UTC' }).format(
15
+ selected,
16
+ );
17
+
18
+ const day = new Intl.DateTimeFormat(calendar.locale, {
19
+ weekday: 'short',
20
+ month: 'short',
21
+ day: 'numeric',
22
+ timeZone: 'UTC',
23
+ }).format(selected);
24
+
25
+ const events = calendar.itemsByDate.get(date) ?? [];
26
+
27
+ return (
28
+ <PageLayout title="Calendar" showNavigation={false}>
29
+ <PageSection title={month} breakdown={<EventMonth {...calendar} />} />
30
+ <PageSection title={day}>
31
+ {events.length === 0 ? (
32
+ <Text tone="muted">No events on this day.</Text>
33
+ ) : (
34
+ events.map((event) => <Text key={event.id}>{event.label}</Text>)
35
+ )}
36
+ </PageSection>
37
+ </PageLayout>
38
+ );
39
+ }
@@ -5,12 +5,14 @@ Mount one `AppShell` around the router outlet. `AppShell` locks the viewport at
5
5
  show only the active area's pages, and put Settings/account controls in `railFooter`. On a phone use the shell's drawer
6
6
  and its navigation callback.
7
7
 
8
- Use `PageSection` for report sections: both `summary` and `children` receive the standard inset gutter automatically
9
- (without double-padding if wrapped in `PageContent`), while `breakdown` renders edge-to-edge full width for a
10
- `DataTable`. Use `DetailPage isWide` for a wide standalone working surface (it keeps the standard inset gutter by
11
- default; pass `isBleed` only for an intentional zero-gutter canvas). Constrain prose and individual forms locally. Keep
12
- a wide plot's horizontal scroll inside its figure. At a wide desktop viewport, compare the right edge of a report header
13
- with its table and the edge of the pane.
8
+ Compose `PageSection` directly inside `PageLayout`. Its `summary` and `children` slots supply the standard inset gutter,
9
+ and `breakdown` spans the pane for a `DataTable` or `EventMonth`. The `calendar-workspace` recipe uses the grid as a
10
+ breakdown and shows the selected day's full event names in the inset body of a sibling section. `PageContent` inside an
11
+ already inset slot adds no second gutter.
12
+
13
+ Use `DetailPage isWide` for a wide standalone working surface with the standard inset. Use `isBleed` when the entire
14
+ detail fills the pane. Constrain prose and individual forms locally. Keep a wide plot's horizontal scroll inside its
15
+ figure. At a wide desktop viewport, compare the right edge of a report header with its table and the edge of the pane.
14
16
 
15
17
  Use `CollectionPage` from `/kits/research` for full-width searchable/filterable table pages. It wires `PageLayout`,
16
18
  top-bar search & filter controls (`/` and `⌘F`), `CollectionToolbar` filter chips, full-width `DataTable`, and an
@@ -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 };