@glyphjs/components 0.1.0 → 0.3.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.
package/dist/index.d.cts CHANGED
@@ -1,11 +1,12 @@
1
- import { GlyphComponentProps, GlyphComponentDefinition, GraphNode, GraphEdge } from '@glyphjs/types';
1
+ import { GlyphComponentProps, InlineNode, GlyphComponentDefinition, GraphNode, GraphEdge } from '@glyphjs/types';
2
2
  import { ReactElement } from 'react';
3
3
  import * as react_jsx_runtime from 'react/jsx-runtime';
4
4
 
5
5
  interface CalloutData {
6
6
  type: 'info' | 'warning' | 'error' | 'tip';
7
7
  title?: string;
8
- content: string;
8
+ content: string | InlineNode[];
9
+ markdown?: boolean;
9
10
  }
10
11
  /**
11
12
  * Renders a styled callout box with variant-specific icon, optional title,
@@ -40,17 +41,18 @@ type DataRecord = Record<string, number | string>;
40
41
  * Renders a D3-powered chart supporting line, bar, area, and OHLC types.
41
42
  * Uses CSS variables for theming and includes accessibility features.
42
43
  */
43
- declare function Chart({ data, container: containerCtx, }: GlyphComponentProps<ChartData>): ReactElement;
44
+ declare function Chart({ data, block, container: containerCtx, onInteraction, }: GlyphComponentProps<ChartData>): ReactElement;
44
45
 
45
46
  declare const chartDefinition: GlyphComponentDefinition;
46
47
 
47
48
  interface StepItem {
48
49
  title: string;
49
50
  status?: 'pending' | 'active' | 'completed';
50
- content: string;
51
+ content: string | InlineNode[];
51
52
  }
52
53
  interface StepsData {
53
54
  steps: StepItem[];
55
+ markdown?: boolean;
54
56
  }
55
57
  /**
56
58
  * Renders a vertical list of steps with status indicators.
@@ -88,7 +90,7 @@ interface TableData {
88
90
  * and aggregation. Styling is driven by `--glyph-table-*` CSS custom
89
91
  * properties so consumers can re-theme via the Glyph theme system.
90
92
  */
91
- declare function Table({ data, container }: GlyphComponentProps<TableData>): ReactElement;
93
+ declare function Table({ data, block, container, onInteraction, }: GlyphComponentProps<TableData>): ReactElement;
92
94
 
93
95
  declare const tableDefinition: GlyphComponentDefinition<TableData>;
94
96
 
@@ -108,19 +110,20 @@ interface TabsData {
108
110
  * - ARIA roles: tablist, tab, tabpanel with proper aria-selected, aria-controls,
109
111
  * and aria-labelledby attributes.
110
112
  */
111
- declare function Tabs({ data, block }: GlyphComponentProps<TabsData>): react_jsx_runtime.JSX.Element;
113
+ declare function Tabs({ data, block, onInteraction }: GlyphComponentProps<TabsData>): react_jsx_runtime.JSX.Element;
112
114
 
113
115
  declare const tabsDefinition: GlyphComponentDefinition<TabsData>;
114
116
 
115
117
  interface TimelineEvent {
116
118
  date: string;
117
- title: string;
118
- description?: string;
119
+ title: string | InlineNode[];
120
+ description?: string | InlineNode[];
119
121
  type?: string;
120
122
  }
121
123
  interface TimelineData {
122
124
  events: TimelineEvent[];
123
125
  orientation?: 'vertical' | 'horizontal';
126
+ markdown?: boolean;
124
127
  }
125
128
  /**
126
129
  * Renders an interactive timeline visualization using D3 for positioning.
@@ -156,7 +159,7 @@ interface GraphData {
156
159
  edges: GraphEdgeData[];
157
160
  layout?: 'top-down' | 'left-right' | 'bottom-up' | 'radial' | 'force';
158
161
  }
159
- declare function Graph({ data, outgoingRefs, onNavigate, container, }: GlyphComponentProps<GraphData>): ReactElement;
162
+ declare function Graph({ data, block, outgoingRefs, onNavigate, onInteraction, container, }: GlyphComponentProps<GraphData>): ReactElement;
160
163
 
161
164
  interface PositionedNode extends GraphNode {
162
165
  x: number;
@@ -217,7 +220,7 @@ declare function Relation({ data }: GlyphComponentProps<RelationData>): ReactEle
217
220
  declare const relationDefinition: GlyphComponentDefinition<RelationData>;
218
221
 
219
222
  interface KpiMetric {
220
- label: string;
223
+ label: string | InlineNode[];
221
224
  value: string;
222
225
  delta?: string;
223
226
  trend?: 'up' | 'down' | 'flat';
@@ -228,6 +231,7 @@ interface KpiData {
228
231
  title?: string;
229
232
  metrics: KpiMetric[];
230
233
  columns?: number;
234
+ markdown?: boolean;
231
235
  }
232
236
  declare function Kpi({ data, block, container }: GlyphComponentProps<KpiData>): ReactElement;
233
237
 
@@ -235,32 +239,34 @@ declare const kpiDefinition: GlyphComponentDefinition<KpiData>;
235
239
 
236
240
  interface AccordionSection {
237
241
  title: string;
238
- content: string;
242
+ content: string | InlineNode[];
239
243
  }
240
244
  interface AccordionData {
241
245
  title?: string;
242
246
  sections: AccordionSection[];
243
247
  defaultOpen?: number[];
244
248
  multiple?: boolean;
249
+ markdown?: boolean;
245
250
  }
246
- declare function Accordion({ data, block }: GlyphComponentProps<AccordionData>): ReactElement;
251
+ declare function Accordion({ data, block, onInteraction, }: GlyphComponentProps<AccordionData>): ReactElement;
247
252
 
248
253
  declare const accordionDefinition: GlyphComponentDefinition<AccordionData>;
249
254
 
250
255
  interface ComparisonOption {
251
256
  name: string;
252
- description?: string;
257
+ description?: string | InlineNode[];
253
258
  }
254
259
  interface ComparisonFeature {
255
260
  name: string;
256
- values: string[];
261
+ values: (string | InlineNode[])[];
257
262
  }
258
263
  interface ComparisonData {
259
264
  title?: string;
260
265
  options: ComparisonOption[];
261
266
  features: ComparisonFeature[];
267
+ markdown?: boolean;
262
268
  }
263
- declare function Comparison({ data, block, container, }: GlyphComponentProps<ComparisonData>): ReactElement;
269
+ declare function Comparison({ data, block, container, onInteraction, }: GlyphComponentProps<ComparisonData>): ReactElement;
264
270
 
265
271
  declare const comparisonDefinition: GlyphComponentDefinition<ComparisonData>;
266
272
 
@@ -320,7 +326,7 @@ interface FileTreeData {
320
326
  tree: FileNode[];
321
327
  defaultExpanded: boolean;
322
328
  }
323
- declare function FileTree({ data }: GlyphComponentProps<FileTreeData>): ReactElement;
329
+ declare function FileTree({ data, block, onInteraction, }: GlyphComponentProps<FileTreeData>): ReactElement;
324
330
 
325
331
  declare const fileTreeDefinition: GlyphComponentDefinition<FileTreeData>;
326
332
 
@@ -436,31 +442,32 @@ declare const equationDefinition: GlyphComponentDefinition<EquationData>;
436
442
 
437
443
  interface QuizMultipleChoice {
438
444
  type: 'multiple-choice';
439
- question: string;
440
- options: string[];
445
+ question: string | InlineNode[];
446
+ options: (string | InlineNode[])[];
441
447
  answer: number;
442
- explanation?: string;
448
+ explanation?: string | InlineNode[];
443
449
  }
444
450
  interface QuizTrueFalse {
445
451
  type: 'true-false';
446
- question: string;
452
+ question: string | InlineNode[];
447
453
  answer: boolean;
448
- explanation?: string;
454
+ explanation?: string | InlineNode[];
449
455
  }
450
456
  interface QuizMultiSelect {
451
457
  type: 'multi-select';
452
- question: string;
453
- options: string[];
458
+ question: string | InlineNode[];
459
+ options: (string | InlineNode[])[];
454
460
  answer: number[];
455
- explanation?: string;
461
+ explanation?: string | InlineNode[];
456
462
  }
457
463
  type QuizQuestion = QuizMultipleChoice | QuizTrueFalse | QuizMultiSelect;
458
464
  interface QuizData {
459
465
  questions: QuizQuestion[];
460
466
  showScore?: boolean;
461
467
  title?: string;
468
+ markdown?: boolean;
462
469
  }
463
- declare function Quiz({ data, block }: GlyphComponentProps<QuizData>): ReactElement;
470
+ declare function Quiz({ data, block, onInteraction }: GlyphComponentProps<QuizData>): ReactElement;
464
471
 
465
472
  declare const quizDefinition: GlyphComponentDefinition<QuizData>;
466
473
 
@@ -470,10 +477,10 @@ interface CardAction {
470
477
  }
471
478
  interface CardItem {
472
479
  title: string;
473
- subtitle?: string;
480
+ subtitle?: string | InlineNode[];
474
481
  image?: string;
475
482
  icon?: string;
476
- body?: string;
483
+ body?: string | InlineNode[];
477
484
  actions?: CardAction[];
478
485
  }
479
486
  interface CardData {
@@ -481,6 +488,7 @@ interface CardData {
481
488
  cards: CardItem[];
482
489
  variant?: 'default' | 'outlined' | 'elevated';
483
490
  columns?: number;
491
+ markdown?: boolean;
484
492
  }
485
493
  declare function Card({ data, block, container }: GlyphComponentProps<CardData>): ReactElement;
486
494
 
@@ -490,12 +498,12 @@ interface StatItem {
490
498
  type: 'stat';
491
499
  label: string;
492
500
  value: string;
493
- description?: string;
501
+ description?: string | InlineNode[];
494
502
  }
495
503
  interface FactItem {
496
504
  type: 'fact';
497
505
  icon?: string;
498
- text: string;
506
+ text: string | InlineNode[];
499
507
  }
500
508
  interface ProgressItem {
501
509
  type: 'progress';
@@ -523,14 +531,14 @@ interface DividerItem {
523
531
  type: 'divider';
524
532
  style?: 'solid' | 'dashed' | 'dotted';
525
533
  }
526
- interface RatingItem {
534
+ interface RatingItem$1 {
527
535
  type: 'rating';
528
536
  label: string;
529
537
  value: number;
530
538
  max?: number;
531
539
  description?: string;
532
540
  }
533
- type InfographicItem = StatItem | FactItem | ProgressItem | TextItem | PieItem | DividerItem | RatingItem;
541
+ type InfographicItem = StatItem | FactItem | ProgressItem | TextItem | PieItem | DividerItem | RatingItem$1;
534
542
  interface InfographicSection {
535
543
  heading?: string;
536
544
  items: InfographicItem[];
@@ -538,9 +546,190 @@ interface InfographicSection {
538
546
  interface InfographicData {
539
547
  title?: string;
540
548
  sections: InfographicSection[];
549
+ markdown?: boolean;
541
550
  }
542
551
  declare function Infographic({ data, block, container, }: GlyphComponentProps<InfographicData>): ReactElement;
543
552
 
544
553
  declare const infographicDefinition: GlyphComponentDefinition<InfographicData>;
545
554
 
546
- export { Accordion, type AccordionData, type AccordionSection, Architecture, type ArchitectureData, type ArchitectureLayout, Callout, type CalloutData, Card, type CardAction, type CardData, type CardItem, Chart, CodeDiff, type CodeDiffData, Comparison, type ComparisonData, type ComparisonFeature, type ComparisonOption, type DiffLine, type DiffLineKind, type DividerItem, Equation, type EquationData, type EquationStep, FileTree, type FileTreeData, Flowchart, type FlowchartData, Graph, type GraphData, Infographic, type InfographicData, type InfographicItem, type InfographicSection, Kpi, type KpiData, type KpiMetric, type LayoutResult, MindMap, type MindMapData, type PieItem, type PieSlice, type PositionedArchEdge, type PositionedArchNode, type PositionedEdge, type PositionedNode, type PositionedZone, Quiz, type QuizData, type QuizQuestion, type RatingItem, Relation, type RelationData, Sequence, type SequenceData, Steps, type StepsData, Table, type TableData, Tabs, type TabsData, Timeline, type TimelineData, accordionDefinition, architectureDefinition, calloutDefinition, cardDefinition, chartDefinition, codeDiffDefinition, comparisonDefinition, computeArchitectureLayout, computeDagreLayout, computeDiff, computeForceLayout, equationDefinition, fileTreeDefinition, flowchartDefinition, graphDefinition, infographicDefinition, kpiDefinition, mindMapDefinition, quizDefinition, relationDefinition, sequenceDefinition, stepsDefinition, tableDefinition, tabsDefinition, timelineDefinition };
555
+ interface PollData {
556
+ question: string | InlineNode[];
557
+ options: (string | InlineNode[])[];
558
+ multiple?: boolean;
559
+ showResults?: boolean;
560
+ title?: string;
561
+ markdown?: boolean;
562
+ }
563
+ declare function Poll({ data, block, onInteraction }: GlyphComponentProps<PollData>): ReactElement;
564
+
565
+ declare const pollDefinition: GlyphComponentDefinition<PollData>;
566
+
567
+ interface RatingItem {
568
+ label: string | InlineNode[];
569
+ description?: string | InlineNode[];
570
+ }
571
+ interface RatingData {
572
+ title?: string;
573
+ scale?: number;
574
+ mode?: 'star' | 'number';
575
+ labels?: {
576
+ low: string;
577
+ high: string;
578
+ };
579
+ items: RatingItem[];
580
+ markdown?: boolean;
581
+ }
582
+ declare function Rating({ data, block, onInteraction, }: GlyphComponentProps<RatingData>): ReactElement;
583
+
584
+ declare const ratingDefinition: GlyphComponentDefinition<RatingData>;
585
+
586
+ interface RankerItemData {
587
+ id: string;
588
+ label: string | InlineNode[];
589
+ description?: string;
590
+ }
591
+ interface RankerData {
592
+ title?: string;
593
+ items: RankerItemData[];
594
+ markdown?: boolean;
595
+ }
596
+ declare function Ranker({ data, block, onInteraction, }: GlyphComponentProps<RankerData>): ReactElement;
597
+
598
+ declare const rankerDefinition: GlyphComponentDefinition<RankerData>;
599
+
600
+ interface SliderParameter {
601
+ id: string;
602
+ label: string | InlineNode[];
603
+ min?: number;
604
+ max?: number;
605
+ step?: number;
606
+ value?: number;
607
+ unit?: string;
608
+ }
609
+ interface SliderData {
610
+ title?: string;
611
+ layout?: 'vertical' | 'horizontal';
612
+ parameters: SliderParameter[];
613
+ markdown?: boolean;
614
+ }
615
+ declare function Slider({ data, block, onInteraction, }: GlyphComponentProps<SliderData>): ReactElement;
616
+
617
+ declare const sliderDefinition: GlyphComponentDefinition<SliderData>;
618
+
619
+ interface MatrixColumn {
620
+ id: string;
621
+ label: string | InlineNode[];
622
+ weight?: number;
623
+ }
624
+ interface MatrixRow {
625
+ id: string;
626
+ label: string | InlineNode[];
627
+ }
628
+ interface MatrixData {
629
+ title?: string;
630
+ scale?: number;
631
+ showTotals?: boolean;
632
+ columns: MatrixColumn[];
633
+ rows: MatrixRow[];
634
+ markdown?: boolean;
635
+ }
636
+ declare function Matrix({ data, block, onInteraction, }: GlyphComponentProps<MatrixData>): ReactElement;
637
+
638
+ declare const matrixDefinition: GlyphComponentDefinition<MatrixData>;
639
+
640
+ interface TextField {
641
+ type: 'text';
642
+ id: string;
643
+ label: string;
644
+ required?: boolean;
645
+ default?: string;
646
+ placeholder?: string;
647
+ }
648
+ interface TextareaField {
649
+ type: 'textarea';
650
+ id: string;
651
+ label: string;
652
+ required?: boolean;
653
+ default?: string;
654
+ placeholder?: string;
655
+ rows?: number;
656
+ }
657
+ interface SelectField {
658
+ type: 'select';
659
+ id: string;
660
+ label: string;
661
+ required?: boolean;
662
+ options: string[];
663
+ default?: string;
664
+ }
665
+ interface CheckboxField {
666
+ type: 'checkbox';
667
+ id: string;
668
+ label: string;
669
+ default?: boolean;
670
+ }
671
+ interface RangeField {
672
+ type: 'range';
673
+ id: string;
674
+ label: string;
675
+ min?: number;
676
+ max?: number;
677
+ step?: number;
678
+ default?: number;
679
+ unit?: string;
680
+ }
681
+ type FormField = TextField | TextareaField | SelectField | CheckboxField | RangeField;
682
+ interface FormData {
683
+ title?: string;
684
+ description?: string | InlineNode[];
685
+ submitLabel?: string;
686
+ fields: FormField[];
687
+ markdown?: boolean;
688
+ }
689
+ declare function Form({ data, block, onInteraction }: GlyphComponentProps<FormData>): ReactElement;
690
+
691
+ declare const formDefinition: GlyphComponentDefinition<FormData>;
692
+
693
+ interface KanbanCard {
694
+ id: string;
695
+ title: string;
696
+ description?: string;
697
+ priority?: 'high' | 'medium' | 'low';
698
+ tags?: string[];
699
+ }
700
+ interface KanbanColumn {
701
+ id: string;
702
+ title: string;
703
+ cards: KanbanCard[];
704
+ limit?: number;
705
+ }
706
+ interface KanbanData {
707
+ title?: string;
708
+ columns: KanbanColumn[];
709
+ }
710
+ declare function Kanban({ data, block, onInteraction, }: GlyphComponentProps<KanbanData>): ReactElement;
711
+
712
+ declare const kanbanDefinition: GlyphComponentDefinition<KanbanData>;
713
+
714
+ interface AnnotateLabel {
715
+ name: string;
716
+ color: string;
717
+ }
718
+ interface Annotation {
719
+ start: number;
720
+ end: number;
721
+ label: string;
722
+ note?: string;
723
+ }
724
+ interface AnnotateData {
725
+ title?: string;
726
+ labels: AnnotateLabel[];
727
+ text: string | InlineNode[];
728
+ annotations?: Annotation[];
729
+ markdown?: boolean;
730
+ }
731
+ declare function Annotate({ data, block, onInteraction, }: GlyphComponentProps<AnnotateData>): ReactElement;
732
+
733
+ declare const annotateDefinition: GlyphComponentDefinition<AnnotateData>;
734
+
735
+ export { Accordion, type AccordionData, type AccordionSection, Annotate, type AnnotateData, type AnnotateLabel, type Annotation, Architecture, type ArchitectureData, type ArchitectureLayout, Callout, type CalloutData, Card, type CardAction, type CardData, type CardItem, Chart, CodeDiff, type CodeDiffData, Comparison, type ComparisonData, type ComparisonFeature, type ComparisonOption, type DiffLine, type DiffLineKind, type DividerItem, Equation, type EquationData, type EquationStep, FileTree, type FileTreeData, Flowchart, type FlowchartData, Form, type FormData, type FormField, Graph, type GraphData, Infographic, type InfographicData, type InfographicItem, type InfographicSection, Kanban, type KanbanCard, type KanbanColumn, type KanbanData, Kpi, type KpiData, type KpiMetric, type LayoutResult, Matrix, type MatrixColumn, type MatrixData, type MatrixRow, MindMap, type MindMapData, type PieItem, type PieSlice, Poll, type PollData, type PositionedArchEdge, type PositionedArchNode, type PositionedEdge, type PositionedNode, type PositionedZone, Quiz, type QuizData, type QuizQuestion, Ranker, type RankerData, type RankerItemData, Rating, type RatingData, type RatingItem$1 as RatingItem, type RatingItem as RatingScaleItem, Relation, type RelationData, Sequence, type SequenceData, Slider, type SliderData, type SliderParameter, Steps, type StepsData, Table, type TableData, Tabs, type TabsData, Timeline, type TimelineData, accordionDefinition, annotateDefinition, architectureDefinition, calloutDefinition, cardDefinition, chartDefinition, codeDiffDefinition, comparisonDefinition, computeArchitectureLayout, computeDagreLayout, computeDiff, computeForceLayout, equationDefinition, fileTreeDefinition, flowchartDefinition, formDefinition, graphDefinition, infographicDefinition, kanbanDefinition, kpiDefinition, matrixDefinition, mindMapDefinition, pollDefinition, quizDefinition, rankerDefinition, ratingDefinition, relationDefinition, sequenceDefinition, sliderDefinition, stepsDefinition, tableDefinition, tabsDefinition, timelineDefinition };