@ponchia/ui 0.4.1 → 0.6.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 (153) hide show
  1. package/CHANGELOG.md +552 -8
  2. package/MIGRATIONS.json +106 -0
  3. package/README.md +34 -8
  4. package/annotations/index.d.ts +402 -0
  5. package/annotations/index.d.ts.map +1 -0
  6. package/annotations/index.js +792 -0
  7. package/behaviors/carousel.js +198 -0
  8. package/behaviors/combobox.js +226 -0
  9. package/behaviors/command.js +190 -0
  10. package/behaviors/connectors.js +95 -0
  11. package/behaviors/crosshair.js +57 -0
  12. package/behaviors/dialog.js +74 -0
  13. package/behaviors/disclosure.js +26 -0
  14. package/behaviors/dismissible.js +25 -0
  15. package/behaviors/forms.js +186 -0
  16. package/behaviors/glyph.js +108 -0
  17. package/behaviors/index.d.ts +79 -0
  18. package/behaviors/index.js +18 -1409
  19. package/behaviors/internal.js +97 -0
  20. package/behaviors/legend.js +67 -0
  21. package/behaviors/menu.js +47 -0
  22. package/behaviors/popover.js +179 -0
  23. package/behaviors/spotlight.js +52 -0
  24. package/behaviors/table.js +136 -0
  25. package/behaviors/tabs.js +103 -0
  26. package/behaviors/theme.js +84 -0
  27. package/behaviors/toast.js +164 -0
  28. package/classes/classes.json +1857 -0
  29. package/classes/index.d.ts +306 -13
  30. package/classes/index.js +339 -12
  31. package/classes/vscode.css-custom-data.json +12 -0
  32. package/connectors/index.d.ts +191 -0
  33. package/connectors/index.d.ts.map +1 -0
  34. package/connectors/index.js +275 -0
  35. package/css/analytical.css +21 -0
  36. package/css/annotations.css +292 -0
  37. package/css/app.css +43 -13
  38. package/css/base.css +15 -10
  39. package/css/command.css +97 -0
  40. package/css/connectors.css +110 -0
  41. package/css/content.css +7 -1
  42. package/css/crosshair.css +100 -0
  43. package/css/dataviz.css +5 -1
  44. package/css/disclosure.css +38 -6
  45. package/css/dots.css +57 -0
  46. package/css/feedback.css +111 -2
  47. package/css/fonts.css +11 -7
  48. package/css/forms.css +42 -1
  49. package/css/generated.css +117 -0
  50. package/css/legend.css +272 -0
  51. package/css/marks.css +174 -0
  52. package/css/motion.css +24 -44
  53. package/css/navigation.css +7 -0
  54. package/css/overlay.css +31 -1
  55. package/css/primitives.css +109 -5
  56. package/css/report.css +39 -81
  57. package/css/selection.css +46 -0
  58. package/css/site.css +16 -2
  59. package/css/sources.css +221 -0
  60. package/css/spotlight.css +104 -0
  61. package/css/state.css +121 -0
  62. package/css/tokens.css +60 -37
  63. package/css/workbench.css +83 -0
  64. package/dist/bronto.css +1 -1
  65. package/dist/css/analytical.css +1 -0
  66. package/dist/css/annotations.css +1 -0
  67. package/dist/css/app.css +1 -1
  68. package/dist/css/base.css +1 -1
  69. package/dist/css/command.css +1 -0
  70. package/dist/css/connectors.css +1 -0
  71. package/dist/css/content.css +1 -1
  72. package/dist/css/crosshair.css +1 -0
  73. package/dist/css/disclosure.css +1 -1
  74. package/dist/css/dots.css +1 -1
  75. package/dist/css/feedback.css +1 -1
  76. package/dist/css/fonts.css +1 -1
  77. package/dist/css/forms.css +1 -1
  78. package/dist/css/generated.css +1 -0
  79. package/dist/css/legend.css +1 -0
  80. package/dist/css/marks.css +1 -0
  81. package/dist/css/motion.css +1 -1
  82. package/dist/css/navigation.css +1 -1
  83. package/dist/css/overlay.css +1 -1
  84. package/dist/css/primitives.css +1 -1
  85. package/dist/css/report.css +1 -1
  86. package/dist/css/selection.css +1 -0
  87. package/dist/css/site.css +1 -1
  88. package/dist/css/sources.css +1 -0
  89. package/dist/css/spotlight.css +1 -0
  90. package/dist/css/state.css +1 -0
  91. package/dist/css/tokens.css +1 -1
  92. package/dist/css/workbench.css +1 -0
  93. package/docs/adr/0003-theme-model.md +7 -4
  94. package/docs/annotations.md +425 -0
  95. package/docs/architecture.md +246 -0
  96. package/docs/command.md +95 -0
  97. package/docs/connectors.md +91 -0
  98. package/docs/contrast.md +116 -92
  99. package/docs/crosshair.md +63 -0
  100. package/docs/d2.md +195 -0
  101. package/docs/generated.md +91 -0
  102. package/docs/legends.md +184 -0
  103. package/docs/marks.md +93 -0
  104. package/docs/mermaid.md +152 -0
  105. package/docs/reference.md +385 -23
  106. package/docs/reporting.md +436 -63
  107. package/docs/selection.md +40 -0
  108. package/docs/sources.md +137 -0
  109. package/docs/spotlight.md +78 -0
  110. package/docs/stability.md +24 -2
  111. package/docs/state.md +85 -0
  112. package/docs/usage.md +123 -4
  113. package/docs/vega.md +225 -0
  114. package/docs/workbench.md +78 -0
  115. package/fonts/doto-400.woff2 +0 -0
  116. package/fonts/doto-500.woff2 +0 -0
  117. package/fonts/doto-600.woff2 +0 -0
  118. package/fonts/doto-700.woff2 +0 -0
  119. package/fonts/doto-800.woff2 +0 -0
  120. package/fonts/doto-900.woff2 +0 -0
  121. package/glyphs/glyphs.js +6 -4
  122. package/llms.txt +362 -14
  123. package/package.json +115 -12
  124. package/qwik/index.d.ts +42 -54
  125. package/qwik/index.d.ts.map +1 -0
  126. package/qwik/index.js +75 -3
  127. package/react/index.d.ts +39 -56
  128. package/react/index.d.ts.map +1 -0
  129. package/react/index.js +67 -3
  130. package/solid/index.d.ts +64 -56
  131. package/solid/index.d.ts.map +1 -0
  132. package/solid/index.js +70 -3
  133. package/tokens/d2.d.ts +38 -0
  134. package/tokens/d2.js +71 -0
  135. package/tokens/d2.json +43 -0
  136. package/tokens/index.d.ts +5 -5
  137. package/tokens/index.js +23 -5
  138. package/tokens/index.json +9 -0
  139. package/tokens/mermaid.d.ts +23 -0
  140. package/tokens/mermaid.js +181 -0
  141. package/tokens/mermaid.json +163 -0
  142. package/tokens/resolved.json +45 -1
  143. package/tokens/skins.js +3 -2
  144. package/tokens/tokens.dtcg.json +26 -0
  145. package/tokens/vega.d.ts +34 -0
  146. package/tokens/vega.js +155 -0
  147. package/tokens/vega.json +179 -0
  148. package/fonts/doto-400.ttf +0 -0
  149. package/fonts/doto-500.ttf +0 -0
  150. package/fonts/doto-600.ttf +0 -0
  151. package/fonts/doto-700.ttf +0 -0
  152. package/fonts/doto-800.ttf +0 -0
  153. package/fonts/doto-900.ttf +0 -0
package/classes/index.js CHANGED
@@ -38,6 +38,11 @@ export const cls = Object.freeze({
38
38
  numPos: 'ui-num--pos',
39
39
  numNeg: 'ui-num--neg',
40
40
  numMuted: 'ui-num--muted',
41
+ delta: 'ui-delta',
42
+ deltaUp: 'ui-delta--up',
43
+ deltaDown: 'ui-delta--down',
44
+ deltaFlat: 'ui-delta--flat',
45
+ deltaInvert: 'ui-delta--invert',
41
46
  badge: 'ui-badge',
42
47
  badgeAccent: 'ui-badge--accent',
43
48
  badgeSuccess: 'ui-badge--success',
@@ -134,6 +139,7 @@ export const cls = Object.freeze({
134
139
  meterSuccess: 'ui-meter--success',
135
140
  meterWarning: 'ui-meter--warning',
136
141
  meterDanger: 'ui-meter--danger',
142
+ meterInfo: 'ui-meter--info',
137
143
  steps: 'ui-steps',
138
144
  stepsItem: 'ui-steps__item',
139
145
  stepsItemDone: 'ui-steps__item--done',
@@ -251,7 +257,7 @@ export const cls = Object.freeze({
251
257
  reportNumbered: 'ui-report--numbered',
252
258
  reportCover: 'ui-report__cover',
253
259
  reportCoverCompact: 'ui-report__cover--compact',
254
- reportHeader: 'ui-report__header',
260
+ reportHead: 'ui-report__head',
255
261
  reportTitle: 'ui-report__title',
256
262
  reportSubtitle: 'ui-report__subtitle',
257
263
  reportMeta: 'ui-report__meta',
@@ -267,16 +273,194 @@ export const cls = Object.freeze({
267
273
  reportSources: 'ui-report__sources',
268
274
  reportAppendix: 'ui-report__appendix',
269
275
  reportFootnotes: 'ui-report__footnotes',
270
- chart: 'ui-chart',
271
- chartLegend: 'ui-chart__legend',
272
- chartSwatch: 'ui-chart__swatch',
273
- chartCaption: 'ui-chart__caption',
274
- chartPlot: 'ui-chart__plot',
275
- chartBar: 'ui-chart__bar',
276
- chartLabel: 'ui-chart__label',
277
- chartTrack: 'ui-chart__track',
278
- chartFill: 'ui-chart__fill',
279
- chartFallback: 'ui-chart__fallback',
276
+ compare: 'ui-compare',
277
+ compare2up: 'ui-compare--2up',
278
+ compareCol: 'ui-compare__col',
279
+ compareHead: 'ui-compare__head',
280
+ // legend (standalone data keys — css/legend.css)
281
+ legend: 'ui-legend',
282
+ legendVertical: 'ui-legend--vertical',
283
+ legendCompact: 'ui-legend--compact',
284
+ legendGradient: 'ui-legend--gradient',
285
+ legendDiverging: 'ui-legend--diverging',
286
+ legendThreshold: 'ui-legend--threshold',
287
+ legendWithValues: 'ui-legend--with-values',
288
+ legendInteractive: 'ui-legend--interactive',
289
+ legendTitle: 'ui-legend__title',
290
+ legendItem: 'ui-legend__item',
291
+ legendSwatch: 'ui-legend__swatch',
292
+ legendSwatchCircle: 'ui-legend__swatch--circle',
293
+ legendSwatchLine: 'ui-legend__swatch--line',
294
+ legendSwatch1: 'ui-legend__swatch--1',
295
+ legendSwatch2: 'ui-legend__swatch--2',
296
+ legendSwatch3: 'ui-legend__swatch--3',
297
+ legendSwatch4: 'ui-legend__swatch--4',
298
+ legendSwatch5: 'ui-legend__swatch--5',
299
+ legendSwatch6: 'ui-legend__swatch--6',
300
+ legendSwatch7: 'ui-legend__swatch--7',
301
+ legendSwatch8: 'ui-legend__swatch--8',
302
+ legendSymbol: 'ui-legend__symbol',
303
+ legendLabel: 'ui-legend__label',
304
+ legendValue: 'ui-legend__value',
305
+ legendCaption: 'ui-legend__caption',
306
+ legendTrack: 'ui-legend__track',
307
+ legendTicks: 'ui-legend__ticks',
308
+ legendTick: 'ui-legend__tick',
309
+ annotation: 'ui-annotation',
310
+ annotationSubject: 'ui-annotation__subject',
311
+ annotationConnector: 'ui-annotation__connector',
312
+ annotationConnectorEnd: 'ui-annotation__connector-end',
313
+ annotationNote: 'ui-annotation__note',
314
+ annotationNoteLine: 'ui-annotation__note-line',
315
+ annotationTitle: 'ui-annotation__title',
316
+ annotationLabel: 'ui-annotation__label',
317
+ annotationBadge: 'ui-annotation__badge',
318
+ annotationLabelVariant: 'ui-annotation--label',
319
+ annotationCallout: 'ui-annotation--callout',
320
+ annotationElbow: 'ui-annotation--elbow',
321
+ annotationCurve: 'ui-annotation--curve',
322
+ annotationCircle: 'ui-annotation--circle',
323
+ annotationRect: 'ui-annotation--rect',
324
+ annotationThreshold: 'ui-annotation--threshold',
325
+ annotationBadgeVariant: 'ui-annotation--badge',
326
+ annotationBracket: 'ui-annotation--bracket',
327
+ annotationBand: 'ui-annotation--band',
328
+ annotationSlope: 'ui-annotation--slope',
329
+ annotationCompare: 'ui-annotation--compare',
330
+ annotationCluster: 'ui-annotation--cluster',
331
+ annotationAxis: 'ui-annotation--axis',
332
+ annotationTimeline: 'ui-annotation--timeline',
333
+ annotationEvidence: 'ui-annotation--evidence',
334
+ annotationAccent: 'ui-annotation--accent',
335
+ annotationMuted: 'ui-annotation--muted',
336
+ annotationSuccess: 'ui-annotation--success',
337
+ annotationWarning: 'ui-annotation--warning',
338
+ annotationDanger: 'ui-annotation--danger',
339
+ annotationInfo: 'ui-annotation--info',
340
+ annotationDraw: 'ui-annotation--draw',
341
+ annotationPulse: 'ui-annotation--pulse',
342
+ annotationReveal: 'ui-annotation--reveal',
343
+ annotationFocus: 'ui-annotation--focus',
344
+ // marks (evidence/emphasis for running text — css/marks.css)
345
+ mark: 'ui-mark',
346
+ markAccent: 'ui-mark--accent',
347
+ markSuccess: 'ui-mark--success',
348
+ markWarning: 'ui-mark--warning',
349
+ markDanger: 'ui-mark--danger',
350
+ markInfo: 'ui-mark--info',
351
+ markMuted: 'ui-mark--muted',
352
+ markUnderline: 'ui-mark--underline',
353
+ markBox: 'ui-mark--box',
354
+ markStrike: 'ui-mark--strike',
355
+ markDraw: 'ui-mark--draw',
356
+ bracketNote: 'ui-bracket-note',
357
+ bracketNoteLabel: 'ui-bracket-note__label',
358
+ bracketNoteAccent: 'ui-bracket-note--accent',
359
+ bracketNoteSuccess: 'ui-bracket-note--success',
360
+ bracketNoteWarning: 'ui-bracket-note--warning',
361
+ bracketNoteDanger: 'ui-bracket-note--danger',
362
+ bracketNoteInfo: 'ui-bracket-note--info',
363
+ // connectors (leader lines — css/connectors.css)
364
+ connector: 'ui-connector',
365
+ connectorPath: 'ui-connector__path',
366
+ connectorEnd: 'ui-connector__end',
367
+ connectorDashed: 'ui-connector--dashed',
368
+ connectorAccent: 'ui-connector--accent',
369
+ connectorMuted: 'ui-connector--muted',
370
+ connectorSuccess: 'ui-connector--success',
371
+ connectorWarning: 'ui-connector--warning',
372
+ connectorDanger: 'ui-connector--danger',
373
+ connectorInfo: 'ui-connector--info',
374
+ connectorDraw: 'ui-connector--draw',
375
+ // spotlight (guided-focus overlay — css/spotlight.css)
376
+ spotlight: 'ui-spotlight',
377
+ spotlightHole: 'ui-spotlight__hole',
378
+ spotlightRing: 'ui-spotlight--ring',
379
+ tourNote: 'ui-tour-note',
380
+ tourNoteStep: 'ui-tour-note__step',
381
+ tourNoteTitle: 'ui-tour-note__title',
382
+ tourNoteBody: 'ui-tour-note__body',
383
+ tourNoteActions: 'ui-tour-note__actions',
384
+ // crosshair (plot ruler + readout — css/crosshair.css)
385
+ crosshair: 'ui-crosshair',
386
+ crosshairMuted: 'ui-crosshair--muted',
387
+ crosshairLine: 'ui-crosshair__line',
388
+ crosshairLineX: 'ui-crosshair__line--x',
389
+ crosshairLineY: 'ui-crosshair__line--y',
390
+ crosshairBadge: 'ui-crosshair__badge',
391
+ readout: 'ui-readout',
392
+ // selection-state vocabulary (cross-cutting — css/selection.css)
393
+ sel: 'ui-sel',
394
+ selOn: 'ui-sel--on',
395
+ selOff: 'ui-sel--off',
396
+ selMaybe: 'ui-sel--maybe',
397
+ // source / citation / provenance — the trust layer (css/sources.css)
398
+ citation: 'ui-citation',
399
+ citationChip: 'ui-citation--chip',
400
+ sourceList: 'ui-source-list',
401
+ sourceListItem: 'ui-source-list__item',
402
+ sourceCard: 'ui-source-card',
403
+ sourceCardTitle: 'ui-source-card__title',
404
+ sourceCardOrigin: 'ui-source-card__origin',
405
+ sourceCardTime: 'ui-source-card__time',
406
+ sourceCardExcerpt: 'ui-source-card__excerpt',
407
+ sourceCardActions: 'ui-source-card__actions',
408
+ provenance: 'ui-provenance',
409
+ provenanceItem: 'ui-provenance__item',
410
+ src: 'ui-src',
411
+ srcVerified: 'ui-src--verified',
412
+ srcUnverified: 'ui-src--unverified',
413
+ srcGenerated: 'ui-src--generated',
414
+ srcReviewed: 'ui-src--reviewed',
415
+ srcStale: 'ui-src--stale',
416
+ srcConflict: 'ui-src--conflict',
417
+ // lifecycle / system state (css/state.css)
418
+ state: 'ui-state',
419
+ stateLabel: 'ui-state__label',
420
+ stateDetail: 'ui-state__detail',
421
+ stateBusy: 'ui-state--busy',
422
+ stateSaving: 'ui-state--saving',
423
+ stateSaved: 'ui-state--saved',
424
+ stateQueued: 'ui-state--queued',
425
+ stateOffline: 'ui-state--offline',
426
+ stateStale: 'ui-state--stale',
427
+ stateConflict: 'ui-state--conflict',
428
+ stateError: 'ui-state--error',
429
+ stateLocked: 'ui-state--locked',
430
+ stateReviewed: 'ui-state--reviewed',
431
+ stateNeedsReview: 'ui-state--needs-review',
432
+ syncbar: 'ui-syncbar',
433
+ // generated content / AI-trust surfaces (css/generated.css)
434
+ generated: 'ui-generated',
435
+ generatedLabel: 'ui-generated__label',
436
+ originLabel: 'ui-origin-label',
437
+ originLabelAi: 'ui-origin-label--ai',
438
+ reasoning: 'ui-reasoning',
439
+ reasoningBody: 'ui-reasoning__body',
440
+ toolLog: 'ui-tool-log',
441
+ toolCall: 'ui-tool-call',
442
+ toolCallName: 'ui-tool-call__name',
443
+ toolCallStatus: 'ui-tool-call__status',
444
+ toolCallBody: 'ui-tool-call__body',
445
+ // workbench — inspector / property / selection bar (css/workbench.css)
446
+ inspector: 'ui-inspector',
447
+ inspectorHead: 'ui-inspector__head',
448
+ inspectorBody: 'ui-inspector__body',
449
+ property: 'ui-property',
450
+ propertyLabel: 'ui-property__label',
451
+ propertyValue: 'ui-property__value',
452
+ selectionbar: 'ui-selectionbar',
453
+ selectionbarCount: 'ui-selectionbar__count',
454
+ selectionbarActions: 'ui-selectionbar__actions',
455
+ // command palette shell (css/command.css + initCommand)
456
+ command: 'ui-command',
457
+ commandInput: 'ui-command__input',
458
+ commandList: 'ui-command__list',
459
+ commandGroup: 'ui-command__group',
460
+ commandItem: 'ui-command__item',
461
+ commandShortcut: 'ui-command__shortcut',
462
+ commandMeta: 'ui-command__meta',
463
+ commandEmpty: 'ui-command__empty',
280
464
  printOnly: 'ui-print-only',
281
465
  screenOnly: 'ui-screen-only',
282
466
  breakBefore: 'ui-break-before',
@@ -284,6 +468,8 @@ export const cls = Object.freeze({
284
468
  keep: 'ui-keep',
285
469
  printExact: 'ui-print-exact',
286
470
  kbd: 'ui-kbd',
471
+ shortcut: 'ui-shortcut',
472
+ shortcutSep: 'ui-shortcut__sep',
287
473
  display: 'ui-display',
288
474
  mono: 'ui-mono',
289
475
  muted: 'ui-muted',
@@ -308,7 +494,6 @@ export const cls = Object.freeze({
308
494
  appShellFull: 'ui-app-shell--full',
309
495
  appRail: 'ui-app-rail',
310
496
  appRailBrand: 'ui-app-rail__brand',
311
- appRailToggle: 'ui-app-rail__toggle',
312
497
  appRailFoot: 'ui-app-rail__foot',
313
498
  appRailAccount: 'ui-app-rail__account',
314
499
  appTopbar: 'ui-app-topbar',
@@ -345,6 +530,33 @@ export function cx(...parts) {
345
530
 
346
531
  const j = (...p) => p.filter(Boolean).join(' ');
347
532
 
533
+ // Lifecycle state → canonical tone class.
534
+ const stateTone = (state) =>
535
+ ({
536
+ saving: cls.stateSaving,
537
+ saved: cls.stateSaved,
538
+ queued: cls.stateQueued,
539
+ offline: cls.stateOffline,
540
+ stale: cls.stateStale,
541
+ conflict: cls.stateConflict,
542
+ error: cls.stateError,
543
+ locked: cls.stateLocked,
544
+ reviewed: cls.stateReviewed,
545
+ 'needs-review': cls.stateNeedsReview,
546
+ })[state] || '';
547
+
548
+ // Trust-state → tone class, shared by the source/citation/provenance recipes.
549
+ // Object-literal lookup to match stateTone above (shorter, greppable, one idiom).
550
+ const srcTone = (state) =>
551
+ ({
552
+ verified: cls.srcVerified,
553
+ unverified: cls.srcUnverified,
554
+ generated: cls.srcGenerated,
555
+ reviewed: cls.srcReviewed,
556
+ stale: cls.srcStale,
557
+ conflict: cls.srcConflict,
558
+ })[state] || '';
559
+
348
560
  export const ui = {
349
561
  button: ({ variant, icon, size } = {}) =>
350
562
  j(
@@ -376,6 +588,15 @@ export const ui = {
376
588
  tone === 'neg' && cls.numNeg,
377
589
  tone === 'muted' && cls.numMuted,
378
590
  ),
591
+ delta: ({ dir, invert } = {}) =>
592
+ j(
593
+ cls.delta,
594
+ dir === 'up' && cls.deltaUp,
595
+ dir === 'down' && cls.deltaDown,
596
+ dir === 'flat' && cls.deltaFlat,
597
+ invert && cls.deltaInvert,
598
+ ),
599
+ compare: ({ cols } = {}) => j(cls.compare, cols === 2 && cls.compare2up),
379
600
  chip: ({ accent } = {}) => j(cls.chip, accent && cls.chipAccent),
380
601
  link: ({ arrow, cta } = {}) => j(cls.link, arrow && cls.linkArrow, cta && cls.linkCta),
381
602
  dot: ({ tone, live } = {}) =>
@@ -427,6 +648,7 @@ export const ui = {
427
648
  tone === 'success' && cls.meterSuccess,
428
649
  tone === 'warning' && cls.meterWarning,
429
650
  tone === 'danger' && cls.meterDanger,
651
+ tone === 'info' && cls.meterInfo,
430
652
  ),
431
653
  dotspinner: ({ size } = {}) =>
432
654
  j(cls.dotspinner, size === 'sm' && cls.dotspinnerSm, size === 'lg' && cls.dotspinnerLg),
@@ -440,6 +662,111 @@ export const ui = {
440
662
  j(cls.container, narrow && cls.containerNarrow, wide && cls.containerWide),
441
663
  tag: ({ accent } = {}) => j(cls.tag, accent && cls.tagAccent),
442
664
  inputIcon: ({ end } = {}) => j(cls.inputIcon, end && cls.inputIconEnd),
665
+ legend: ({ orient, type, diverging, compact, withValues, interactive } = {}) =>
666
+ j(
667
+ cls.legend,
668
+ orient === 'vertical' && cls.legendVertical,
669
+ type === 'gradient' && cls.legendGradient,
670
+ type === 'threshold' && cls.legendThreshold,
671
+ diverging && cls.legendDiverging,
672
+ compact && cls.legendCompact,
673
+ withValues && cls.legendWithValues,
674
+ interactive && cls.legendInteractive,
675
+ ),
676
+ legendItem: ({ inactive } = {}) => j(cls.legendItem, inactive && 'is-inactive'),
677
+ legendSwatch: ({ series, shape } = {}) =>
678
+ j(
679
+ cls.legendSwatch,
680
+ series === 1 && cls.legendSwatch1,
681
+ series === 2 && cls.legendSwatch2,
682
+ series === 3 && cls.legendSwatch3,
683
+ series === 4 && cls.legendSwatch4,
684
+ series === 5 && cls.legendSwatch5,
685
+ series === 6 && cls.legendSwatch6,
686
+ series === 7 && cls.legendSwatch7,
687
+ series === 8 && cls.legendSwatch8,
688
+ shape === 'circle' && cls.legendSwatchCircle,
689
+ shape === 'line' && cls.legendSwatchLine,
690
+ ),
691
+ annotation: ({ variant = 'callout', tone = 'accent', motion } = {}) =>
692
+ j(
693
+ cls.annotation,
694
+ variant === 'label' && cls.annotationLabelVariant,
695
+ variant === 'callout' && cls.annotationCallout,
696
+ variant === 'elbow' && cls.annotationElbow,
697
+ variant === 'curve' && cls.annotationCurve,
698
+ variant === 'circle' && cls.annotationCircle,
699
+ variant === 'rect' && cls.annotationRect,
700
+ variant === 'threshold' && cls.annotationThreshold,
701
+ variant === 'badge' && cls.annotationBadgeVariant,
702
+ variant === 'bracket' && cls.annotationBracket,
703
+ variant === 'band' && cls.annotationBand,
704
+ variant === 'slope' && cls.annotationSlope,
705
+ variant === 'compare' && cls.annotationCompare,
706
+ variant === 'cluster' && cls.annotationCluster,
707
+ variant === 'axis' && cls.annotationAxis,
708
+ variant === 'timeline' && cls.annotationTimeline,
709
+ variant === 'evidence' && cls.annotationEvidence,
710
+ tone === 'accent' && cls.annotationAccent,
711
+ tone === 'muted' && cls.annotationMuted,
712
+ tone === 'success' && cls.annotationSuccess,
713
+ tone === 'warning' && cls.annotationWarning,
714
+ tone === 'danger' && cls.annotationDanger,
715
+ tone === 'info' && cls.annotationInfo,
716
+ motion === 'draw' && cls.annotationDraw,
717
+ motion === 'pulse' && cls.annotationPulse,
718
+ motion === 'reveal' && cls.annotationReveal,
719
+ motion === 'focus' && cls.annotationFocus,
720
+ ),
721
+ mark: ({ style, tone, motion } = {}) =>
722
+ j(
723
+ cls.mark,
724
+ style === 'underline' && cls.markUnderline,
725
+ style === 'box' && cls.markBox,
726
+ style === 'strike' && cls.markStrike,
727
+ tone === 'accent' && cls.markAccent,
728
+ tone === 'success' && cls.markSuccess,
729
+ tone === 'warning' && cls.markWarning,
730
+ tone === 'danger' && cls.markDanger,
731
+ tone === 'info' && cls.markInfo,
732
+ tone === 'muted' && cls.markMuted,
733
+ motion === 'draw' && cls.markDraw,
734
+ ),
735
+ bracketNote: ({ tone } = {}) =>
736
+ j(
737
+ cls.bracketNote,
738
+ tone === 'accent' && cls.bracketNoteAccent,
739
+ tone === 'success' && cls.bracketNoteSuccess,
740
+ tone === 'warning' && cls.bracketNoteWarning,
741
+ tone === 'danger' && cls.bracketNoteDanger,
742
+ tone === 'info' && cls.bracketNoteInfo,
743
+ ),
744
+ connector: ({ tone, dashed, motion } = {}) =>
745
+ j(
746
+ cls.connector,
747
+ tone === 'accent' && cls.connectorAccent,
748
+ tone === 'muted' && cls.connectorMuted,
749
+ tone === 'success' && cls.connectorSuccess,
750
+ tone === 'warning' && cls.connectorWarning,
751
+ tone === 'danger' && cls.connectorDanger,
752
+ tone === 'info' && cls.connectorInfo,
753
+ dashed && cls.connectorDashed,
754
+ motion === 'draw' && cls.connectorDraw,
755
+ ),
756
+ spotlight: ({ ring } = {}) => j(cls.spotlight, ring && cls.spotlightRing),
757
+ crosshair: ({ muted } = {}) => j(cls.crosshair, muted && cls.crosshairMuted),
758
+ sel: ({ state } = {}) =>
759
+ j(
760
+ cls.sel,
761
+ state === 'on' && cls.selOn,
762
+ state === 'off' && cls.selOff,
763
+ state === 'maybe' && cls.selMaybe,
764
+ ),
765
+ citation: ({ chip, state } = {}) => j(cls.citation, chip && cls.citationChip, srcTone(state)),
766
+ source: ({ state } = {}) => j(cls.sourceCard, srcTone(state)),
767
+ provenance: ({ state } = {}) => j(cls.provenance, srcTone(state)),
768
+ state: ({ state, busy } = {}) => j(cls.state, stateTone(state), busy && cls.stateBusy),
769
+ originLabel: ({ ai } = {}) => j(cls.originLabel, ai && cls.originLabelAi),
443
770
  };
444
771
 
445
772
  export default ui;
@@ -141,6 +141,14 @@
141
141
  "name": "--display",
142
142
  "description": "Global scale token. Value: `var(--dot-font)`"
143
143
  },
144
+ {
145
+ "name": "--display-weight",
146
+ "description": "Global scale token. Value: `700`"
147
+ },
148
+ {
149
+ "name": "--display-weight-strong",
150
+ "description": "Global scale token. Value: `800`"
151
+ },
144
152
  {
145
153
  "name": "--dot-font",
146
154
  "description": "Global scale token. Value: `'Doto', var(--mono)`"
@@ -213,6 +221,10 @@
213
221
  "name": "--mono",
214
222
  "description": "Global scale token. Value: `'JetBrains Mono', 'Fira Code', 'Cascadia Code', 'SF Mono', ui-monospace, monospace`"
215
223
  },
224
+ {
225
+ "name": "--on-accent",
226
+ "description": "Theme token. Light: `var(--button-text)` · Dark: `var(--button-text)`"
227
+ },
216
228
  {
217
229
  "name": "--panel",
218
230
  "description": "Theme token. Light: `#ffffff` · Dark: `#1c1c1c`"
@@ -0,0 +1,191 @@
1
+ export function finite(name: any, value: any, fallback: any): any;
2
+ export function dimension(name: any, value: any, fallback: any): any;
3
+ export function fmt(value: any): string;
4
+ export function point(x: any, y: any): string;
5
+ export function clamp(value: any, min: any, max: any): any;
6
+ /**
7
+ * A point on a rect's edge (or centre). `rect` is `{ x, y, width, height }`.
8
+ * @param {Rect} rect
9
+ * @param {Side} [side]
10
+ * @returns {Point}
11
+ */
12
+ export function anchorPoint(rect: Rect, side?: Side): Point;
13
+ /**
14
+ * Angle (radians) from `from` to `to`.
15
+ * @param {Point} from
16
+ * @param {Point} to
17
+ * @returns {number}
18
+ */
19
+ export function angleBetween(from: Point, to: Point): number;
20
+ /**
21
+ * Straight line from `from` to `to`.
22
+ * @param {Point} from
23
+ * @param {Point} to
24
+ * @returns {string}
25
+ */
26
+ export function straightPath(from: Point, to: Point): string;
27
+ /**
28
+ * Right-angle dogleg. Turns on the dominant axis at `mid` (0..1) of the span.
29
+ * @param {Point} from
30
+ * @param {Point} to
31
+ * @param {{ mid?: number }} [opts]
32
+ * @returns {string}
33
+ */
34
+ export function elbowPath(from: Point, to: Point, opts?: {
35
+ mid?: number;
36
+ }): string;
37
+ /**
38
+ * Cubic curve; control points extend along the dominant axis by `curvature`.
39
+ * @param {Point} from
40
+ * @param {Point} to
41
+ * @param {{ curvature?: number }} [opts]
42
+ * @returns {string}
43
+ */
44
+ export function curvePath(from: Point, to: Point, opts?: {
45
+ curvature?: number;
46
+ }): string;
47
+ /**
48
+ * Build a path between two points by `shape` (`straight` | `elbow` | `curve`).
49
+ * @param {ConnectorPathOptions} [opts]
50
+ * @returns {string}
51
+ */
52
+ export function connectorPath(opts?: ConnectorPathOptions): string;
53
+ /**
54
+ * A filled triangle arrowhead at `p`, pointing along `angle` (radians).
55
+ * @param {Point} p
56
+ * @param {number} angle
57
+ * @param {number} [size]
58
+ * @param {number} [spread] Half-angle of the head in radians (default 0.45).
59
+ * Smaller is crisper/sharper; must be in (0, π/2).
60
+ * @returns {string}
61
+ */
62
+ export function arrowHead(p: Point, angle: number, size?: number, spread?: number): string;
63
+ /**
64
+ * A filled dot at `p`.
65
+ * @param {Point} p
66
+ * @param {number} [radius]
67
+ * @returns {string}
68
+ */
69
+ export function dotMark(p: Point, radius?: number): string;
70
+ /**
71
+ * Pick facing edges from the rects' relative centres.
72
+ * @param {Rect} fromRect
73
+ * @param {Rect} toRect
74
+ * @returns {{ from: Side, to: Side }}
75
+ */
76
+ export function autoSides(fromRect: Rect, toRect: Rect): {
77
+ from: Side;
78
+ to: Side;
79
+ };
80
+ /**
81
+ * Angle (radians) at which a `shape` path *arrives* at `to` — straight is the
82
+ * chord; elbow/curve arrive axis-aligned along the dominant axis. Rotate an
83
+ * end marker by this so it points along the path, not the chord.
84
+ * @param {Point} from
85
+ * @param {Point} to
86
+ * @param {ConnectorShape} [shape]
87
+ * @returns {number}
88
+ */
89
+ export function endTangentAngle(from: Point, to: Point, shape?: ConnectorShape): number;
90
+ /**
91
+ * Connect two rects. Resolves anchor points (explicit `fromSide`/`toSide`, else
92
+ * auto), builds the path, and returns `{ d, from, to, angle }` so the caller can
93
+ * place an arrowhead/dot at `to` rotated by `angle`.
94
+ * @param {ConnectRectsOptions} [opts]
95
+ * @returns {ConnectRectsResult}
96
+ */
97
+ export function connectRects(opts?: ConnectRectsOptions): ConnectRectsResult;
98
+ /**
99
+ * @ponchia/ui/connectors — dependency-free SVG geometry for connecting two
100
+ * elements (or two points) with a leader line.
101
+ *
102
+ * Pure functions only: they take points/rects and return SVG path strings (or
103
+ * resolved coordinates). They own no DOM, no scales, and no live tracking —
104
+ * that optional glue lives in `@ponchia/ui/behaviors` (`initConnectors`). This
105
+ * is the page-coordinate, element-to-element cousin of the figure-coordinate
106
+ * `@ponchia/ui/annotations` helpers.
107
+ *
108
+ * import { connectRects } from '@ponchia/ui/connectors';
109
+ * const { d } = connectRects({ fromRect: a, toRect: b, shape: 'elbow' });
110
+ *
111
+ * The public types below are JSDoc `@typedef`s; the shipped `index.d.ts` is
112
+ * generated from them (and these signatures) by `tsc --emitDeclarationOnly`.
113
+ *
114
+ * @typedef {{ x: number, y: number }} Point
115
+ * @typedef {{ x: number, y: number, width: number, height: number }} Rect
116
+ * @typedef {'top' | 'right' | 'bottom' | 'left' | 'center'} Side
117
+ * @typedef {'straight' | 'elbow' | 'curve'} ConnectorShape
118
+ *
119
+ * @typedef {object} ConnectorPathOptions
120
+ * @property {Point} from
121
+ * @property {Point} to
122
+ * @property {ConnectorShape} [shape]
123
+ * @property {number} [curvature] Curve control-point reach along the dominant axis (curve shape). Default 0.5.
124
+ * @property {number} [mid] Turn position 0..1 along the span (elbow shape). Default 0.5.
125
+ *
126
+ * @typedef {object} ConnectRectsOptions
127
+ * @property {Rect} fromRect
128
+ * @property {Rect} toRect
129
+ * @property {Side} [fromSide] Anchor edges. Omit both to auto-pick facing edges from the rects.
130
+ * @property {Side} [toSide]
131
+ * @property {ConnectorShape} [shape]
132
+ * @property {number} [curvature]
133
+ * @property {number} [mid]
134
+ *
135
+ * @typedef {object} ConnectRectsResult
136
+ * @property {string} d SVG path data.
137
+ * @property {Point} from
138
+ * @property {Point} to
139
+ * @property {number} angle The path's end-tangent at `to` in radians — the direction the path arrives, so rotating an arrowhead at `to` by this points it along the path. Equals the straight `from`→`to` angle for `shape: 'straight'`; axis-aligned for `elbow`/`curve`.
140
+ */
141
+ export const PRECISION: 1000;
142
+ export type Point = {
143
+ x: number;
144
+ y: number;
145
+ };
146
+ export type Rect = {
147
+ x: number;
148
+ y: number;
149
+ width: number;
150
+ height: number;
151
+ };
152
+ export type Side = "top" | "right" | "bottom" | "left" | "center";
153
+ export type ConnectorShape = "straight" | "elbow" | "curve";
154
+ export type ConnectorPathOptions = {
155
+ from: Point;
156
+ to: Point;
157
+ shape?: ConnectorShape | undefined;
158
+ /**
159
+ * Curve control-point reach along the dominant axis (curve shape). Default 0.5.
160
+ */
161
+ curvature?: number | undefined;
162
+ /**
163
+ * Turn position 0..1 along the span (elbow shape). Default 0.5.
164
+ */
165
+ mid?: number | undefined;
166
+ };
167
+ export type ConnectRectsOptions = {
168
+ fromRect: Rect;
169
+ toRect: Rect;
170
+ /**
171
+ * Anchor edges. Omit both to auto-pick facing edges from the rects.
172
+ */
173
+ fromSide?: Side | undefined;
174
+ toSide?: Side | undefined;
175
+ shape?: ConnectorShape | undefined;
176
+ curvature?: number | undefined;
177
+ mid?: number | undefined;
178
+ };
179
+ export type ConnectRectsResult = {
180
+ /**
181
+ * SVG path data.
182
+ */
183
+ d: string;
184
+ from: Point;
185
+ to: Point;
186
+ /**
187
+ * The path's end-tangent at `to` in radians — the direction the path arrives, so rotating an arrowhead at `to` by this points it along the path. Equals the straight `from`→`to` angle for `shape: 'straight'`; axis-aligned for `elbow`/`curve`.
188
+ */
189
+ angle: number;
190
+ };
191
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["index.js"],"names":[],"mappings":"AAkDA,kEAIC;AAED,qEAIC;AAED,wCAGC;AAED,8CAEC;AAID,2DAGC;AAED;;;;;GAKG;AACH,kCAJW,IAAI,SACJ,IAAI,GACF,KAAK,CAoBjB;AAED;;;;;GAKG;AACH,mCAJW,KAAK,MACL,KAAK,GACH,MAAM,CAOlB;AAED;;;;;GAKG;AACH,mCAJW,KAAK,MACL,KAAK,GACH,MAAM,CAOlB;AAED;;;;;;GAMG;AACH,gCALW,KAAK,MACL,KAAK,SACL;IAAE,GAAG,CAAC,EAAE,MAAM,CAAA;CAAE,GACd,MAAM,CAgBlB;AAED;;;;;;GAMG;AACH,gCALW,KAAK,MACL,KAAK,SACL;IAAE,SAAS,CAAC,EAAE,MAAM,CAAA;CAAE,GACpB,MAAM,CAclB;AAED;;;;GAIG;AACH,qCAHW,oBAAoB,GAClB,MAAM,CAOlB;AAED;;;;;;;;GAQG;AACH,6BAPW,KAAK,SACL,MAAM,SACN,MAAM,WACN,MAAM,GAEJ,MAAM,CAalB;AAED;;;;;GAKG;AACH,2BAJW,KAAK,WACL,MAAM,GACJ,MAAM,CAUlB;AAED;;;;;GAKG;AACH,oCAJW,IAAI,UACJ,IAAI,GACF;IAAE,IAAI,EAAE,IAAI,CAAC;IAAC,EAAE,EAAE,IAAI,CAAA;CAAE,CAWpC;AAED;;;;;;;;GAQG;AACH,sCALW,KAAK,MACL,KAAK,UACL,cAAc,GACZ,MAAM,CAQlB;AAED;;;;;;GAMG;AACH,oCAHW,mBAAmB,GACjB,kBAAkB,CAW9B;AAlRD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA0CG;AAMH,wBAAyB,IAAI,CAAC;oBAhCjB;IAAE,CAAC,EAAE,MAAM,CAAC;IAAC,CAAC,EAAE,MAAM,CAAA;CAAE;mBACxB;IAAE,CAAC,EAAE,MAAM,CAAC;IAAC,CAAC,EAAE,MAAM,CAAC;IAAC,KAAK,EAAE,MAAM,CAAC;IAAC,MAAM,EAAE,MAAM,CAAA;CAAE;mBACvD,KAAK,GAAG,OAAO,GAAG,QAAQ,GAAG,MAAM,GAAG,QAAQ;6BAC9C,UAAU,GAAG,OAAO,GAAG,OAAO;;UAG7B,KAAK;QACL,KAAK;;;;;;;;;;;;cAML,IAAI;YACJ,IAAI;;;;;;;;;;;;;;OAQJ,MAAM;UACN,KAAK;QACL,KAAK;;;;WACL,MAAM"}