@graview/react 0.1.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 (147) hide show
  1. package/LICENSE +96 -0
  2. package/README.md +20 -0
  3. package/dist/activity.d.ts +113 -0
  4. package/dist/activity.d.ts.map +1 -0
  5. package/dist/activity.js +207 -0
  6. package/dist/activity.js.map +1 -0
  7. package/dist/animation.d.ts +64 -0
  8. package/dist/animation.d.ts.map +1 -0
  9. package/dist/animation.js +245 -0
  10. package/dist/animation.js.map +1 -0
  11. package/dist/captions.d.ts +43 -0
  12. package/dist/captions.d.ts.map +1 -0
  13. package/dist/captions.js +61 -0
  14. package/dist/captions.js.map +1 -0
  15. package/dist/channels.d.ts +15 -0
  16. package/dist/channels.d.ts.map +1 -0
  17. package/dist/channels.js +114 -0
  18. package/dist/channels.js.map +1 -0
  19. package/dist/connectors.d.ts +176 -0
  20. package/dist/connectors.d.ts.map +1 -0
  21. package/dist/connectors.js +837 -0
  22. package/dist/connectors.js.map +1 -0
  23. package/dist/context.d.ts +348 -0
  24. package/dist/context.d.ts.map +1 -0
  25. package/dist/context.js +568 -0
  26. package/dist/context.js.map +1 -0
  27. package/dist/drawn.d.ts +60 -0
  28. package/dist/drawn.d.ts.map +1 -0
  29. package/dist/drawn.js +58 -0
  30. package/dist/drawn.js.map +1 -0
  31. package/dist/edge-signs.d.ts +13 -0
  32. package/dist/edge-signs.d.ts.map +1 -0
  33. package/dist/edge-signs.js +76 -0
  34. package/dist/edge-signs.js.map +1 -0
  35. package/dist/hooks.d.ts +160 -0
  36. package/dist/hooks.d.ts.map +1 -0
  37. package/dist/hooks.js +457 -0
  38. package/dist/hooks.js.map +1 -0
  39. package/dist/index.d.ts +37 -0
  40. package/dist/index.d.ts.map +1 -0
  41. package/dist/index.js +22 -0
  42. package/dist/index.js.map +1 -0
  43. package/dist/keyboard.d.ts +5 -0
  44. package/dist/keyboard.d.ts.map +1 -0
  45. package/dist/keyboard.js +178 -0
  46. package/dist/keyboard.js.map +1 -0
  47. package/dist/kit.d.ts +10 -0
  48. package/dist/kit.d.ts.map +1 -0
  49. package/dist/kit.js +32 -0
  50. package/dist/kit.js.map +1 -0
  51. package/dist/local-intelligence.d.ts +31 -0
  52. package/dist/local-intelligence.d.ts.map +1 -0
  53. package/dist/local-intelligence.js +66 -0
  54. package/dist/local-intelligence.js.map +1 -0
  55. package/dist/motion.d.ts +17 -0
  56. package/dist/motion.d.ts.map +1 -0
  57. package/dist/motion.js +26 -0
  58. package/dist/motion.js.map +1 -0
  59. package/dist/occupants.d.ts +45 -0
  60. package/dist/occupants.d.ts.map +1 -0
  61. package/dist/occupants.js +57 -0
  62. package/dist/occupants.js.map +1 -0
  63. package/dist/parallel.d.ts +19 -0
  64. package/dist/parallel.d.ts.map +1 -0
  65. package/dist/parallel.js +30 -0
  66. package/dist/parallel.js.map +1 -0
  67. package/dist/picking.d.ts +30 -0
  68. package/dist/picking.d.ts.map +1 -0
  69. package/dist/picking.js +140 -0
  70. package/dist/picking.js.map +1 -0
  71. package/dist/plots.d.ts +106 -0
  72. package/dist/plots.d.ts.map +1 -0
  73. package/dist/plots.js +306 -0
  74. package/dist/plots.js.map +1 -0
  75. package/dist/pointer.d.ts +27 -0
  76. package/dist/pointer.d.ts.map +1 -0
  77. package/dist/pointer.js +39 -0
  78. package/dist/pointer.js.map +1 -0
  79. package/dist/presence.d.ts +110 -0
  80. package/dist/presence.d.ts.map +1 -0
  81. package/dist/presence.js +280 -0
  82. package/dist/presence.js.map +1 -0
  83. package/dist/rails.d.ts +11 -0
  84. package/dist/rails.d.ts.map +1 -0
  85. package/dist/rails.js +15 -0
  86. package/dist/rails.js.map +1 -0
  87. package/dist/resolved-view.d.ts +78 -0
  88. package/dist/resolved-view.d.ts.map +1 -0
  89. package/dist/resolved-view.js +365 -0
  90. package/dist/resolved-view.js.map +1 -0
  91. package/dist/robot.d.ts +114 -0
  92. package/dist/robot.d.ts.map +1 -0
  93. package/dist/robot.js +93 -0
  94. package/dist/robot.js.map +1 -0
  95. package/dist/routes.d.ts +50 -0
  96. package/dist/routes.d.ts.map +1 -0
  97. package/dist/routes.js +150 -0
  98. package/dist/routes.js.map +1 -0
  99. package/dist/scene-camera.d.ts +25 -0
  100. package/dist/scene-camera.d.ts.map +1 -0
  101. package/dist/scene-camera.js +130 -0
  102. package/dist/scene-camera.js.map +1 -0
  103. package/dist/scene-hand.d.ts +110 -0
  104. package/dist/scene-hand.d.ts.map +1 -0
  105. package/dist/scene-hand.js +317 -0
  106. package/dist/scene-hand.js.map +1 -0
  107. package/dist/scene-helpers.d.ts +46 -0
  108. package/dist/scene-helpers.d.ts.map +1 -0
  109. package/dist/scene-helpers.js +108 -0
  110. package/dist/scene-helpers.js.map +1 -0
  111. package/dist/scene-lines.d.ts +76 -0
  112. package/dist/scene-lines.d.ts.map +1 -0
  113. package/dist/scene-lines.js +578 -0
  114. package/dist/scene-lines.js.map +1 -0
  115. package/dist/scene-root.d.ts +71 -0
  116. package/dist/scene-root.d.ts.map +1 -0
  117. package/dist/scene-root.js +790 -0
  118. package/dist/scene-root.js.map +1 -0
  119. package/dist/scene.d.ts +17 -0
  120. package/dist/scene.d.ts.map +1 -0
  121. package/dist/scene.js +17 -0
  122. package/dist/scene.js.map +1 -0
  123. package/dist/seat-marks.d.ts +35 -0
  124. package/dist/seat-marks.d.ts.map +1 -0
  125. package/dist/seat-marks.js +43 -0
  126. package/dist/seat-marks.js.map +1 -0
  127. package/dist/settings.d.ts +30 -0
  128. package/dist/settings.d.ts.map +1 -0
  129. package/dist/settings.js +73 -0
  130. package/dist/settings.js.map +1 -0
  131. package/dist/view-boundary.d.ts +33 -0
  132. package/dist/view-boundary.d.ts.map +1 -0
  133. package/dist/view-boundary.js +53 -0
  134. package/dist/view-boundary.js.map +1 -0
  135. package/dist/view-host.d.ts +57 -0
  136. package/dist/view-host.d.ts.map +1 -0
  137. package/dist/view-host.js +474 -0
  138. package/dist/view-host.js.map +1 -0
  139. package/dist/view-registry.d.ts +122 -0
  140. package/dist/view-registry.d.ts.map +1 -0
  141. package/dist/view-registry.js +20 -0
  142. package/dist/view-registry.js.map +1 -0
  143. package/dist/where-drawn.d.ts +151 -0
  144. package/dist/where-drawn.d.ts.map +1 -0
  145. package/dist/where-drawn.js +231 -0
  146. package/dist/where-drawn.js.map +1 -0
  147. package/package.json +60 -0
@@ -0,0 +1,176 @@
1
+ import { type Connector } from "@graview/layout";
2
+ import type { ActivityMark } from "./activity.js";
3
+ import type { SceneNode } from "./scene-root.js";
4
+ /**
5
+ * Where a line toward `towards` should MEET a box: on its border, not at its
6
+ * centre.
7
+ *
8
+ * Centre-anchored lines cross the card's own interior on the way out — the
9
+ * yellow dash sawing through the middle of REASONS was this — and where
10
+ * several relations share an endpoint they converge to a single point at the
11
+ * centre, which reads as a knot rather than as several roads arriving. The
12
+ * border is where a road meets a building.
13
+ */
14
+ /**
15
+ * HOW A TIE RUNS between two measured drawings — a pure decision, so it is
16
+ * testable without a browser.
17
+ *
18
+ * Two drawings stacked in one column used to get a near-straight vertical
19
+ * aimed centre-to-centre — a line THROUGH every row between them, whose
20
+ * hit corridor then stole those rows' clicks. Boxes that share a column
21
+ * stitch along their common right edge, in the gutter; boxes that share a
22
+ * row stitch over the top. Only ends with clear air between them take the
23
+ * direct arc. Returns null when no honest line exists: one drawing inside
24
+ * another is the view's own composition, and anchors within a few pixels
25
+ * are one drawing restating itself.
26
+ */
27
+ export declare function tieRoute(fromBox: {
28
+ x: number;
29
+ y: number;
30
+ width: number;
31
+ height: number;
32
+ }, toBox: {
33
+ x: number;
34
+ y: number;
35
+ width: number;
36
+ height: number;
37
+ }): {
38
+ from: {
39
+ x: number;
40
+ y: number;
41
+ };
42
+ to: {
43
+ x: number;
44
+ y: number;
45
+ };
46
+ control: {
47
+ x: number;
48
+ y: number;
49
+ };
50
+ mode: "stacked" | "abreast" | "direct";
51
+ } | null;
52
+ /** A box in stage space, anchored at its top-left. */
53
+ export type Box = {
54
+ x: number;
55
+ y: number;
56
+ width: number;
57
+ height: number;
58
+ };
59
+ type SceneConnector = Connector & {
60
+ readonly opacity?: number;
61
+ };
62
+ /**
63
+ * ONE DRAWN LINE: an anchor at each end, and the real edges that run
64
+ * between them.
65
+ *
66
+ * Layout resolves an edge's ends to whatever is PLACED — a session inside
67
+ * the week resolves to the week — and bundles every edge that lands on the
68
+ * same pair. That is right for the layout, which cannot see inside a view.
69
+ * The renderer can: the week draws each session as its own span, a session
70
+ * card draws each drill as a chip, and any element wearing
71
+ * `data-graview-pick` for a member is where a line to that member should
72
+ * start. So a connector is unpicked here into strands, one per distinct
73
+ * pair of anchors, and bundled again only where the view draws nothing for
74
+ * the member. A strand that stands for exactly one edge is selectable.
75
+ */
76
+ export interface Strand {
77
+ readonly key: string;
78
+ readonly connector: SceneConnector;
79
+ readonly edges: readonly {
80
+ readonly from: string;
81
+ readonly to: string;
82
+ }[];
83
+ readonly fromBox: Box;
84
+ readonly toBox: Box;
85
+ /** What each end is anchored ON: the drawn node, or a member drawn inside it. */
86
+ readonly fromAnchor: string;
87
+ readonly toAnchor: string;
88
+ /** Every other drawn box, so the line can dive under cards it merely crosses. */
89
+ readonly obstacles: readonly Box[];
90
+ /** Both ends are chips of the relation band: every chip of it, so the line can take the gutters. */
91
+ readonly band?: readonly Box[];
92
+ /**
93
+ * The cards an end is drawn INSIDE, when it lands on a member: the line
94
+ * is visible across them (that is what landing on a member means), but
95
+ * its hit stroke is not, so a line to Ravi never takes a click meant
96
+ * for June above him.
97
+ */
98
+ readonly hosts: readonly Box[];
99
+ }
100
+ /**
101
+ * Resolves the frame's connectors into the strands the scene will draw.
102
+ *
103
+ * Pure of React and null-safe without a DOM: headless, every strand is
104
+ * anchored on the layout's own boxes, which is the old behaviour exactly.
105
+ * From altitude nothing is unpicked — the constellation is a picture of
106
+ * kinds, and a line from a span inside the shrunk stamp would say nothing
107
+ * the road between two districts does not.
108
+ */
109
+ export declare function connectorStrands(nodes: readonly SceneNode[], connectors: readonly SceneConnector[], stageEl: HTMLElement | null, overview: boolean, scheme: "light" | "dark"): Strand[];
110
+ type Point = {
111
+ x: number;
112
+ y: number;
113
+ };
114
+ type Quadratic = {
115
+ p0: Point;
116
+ c: Point;
117
+ p1: Point;
118
+ };
119
+ /**
120
+ * THE VISIBLE RUNS of a curve: every stretch of it that lies outside the
121
+ * given boxes, as exact pieces of the same curve.
122
+ *
123
+ * A line used to be clipped by sitting BEHIND the cards, which was free and
124
+ * was also why a line anchored on a span inside the week never showed the
125
+ * stretch from the span to the panel's edge — it was under the panel. The
126
+ * lines now sit over the cards and clip themselves: out of the box they
127
+ * start in, into the box they end in, and under any card they cross on
128
+ * the way. Sampled, then each crossing refined by bisection, so a run ends
129
+ * on a border rather than a sample shy of it.
130
+ */
131
+ export declare function clipQuadratic(q: Quadratic, boxes: readonly Box[]): Quadratic[];
132
+ /**
133
+ * Connectors, drawn in SVG over the scene on BOTH renderer paths.
134
+ *
135
+ * A deliberate choice, not an omission: the GPU pipeline earns its cost on
136
+ * per-plane blur of captured pixels, and lines are the one thing it would be
137
+ * worse at. SVG strokes stay crisp at any scale, carry their edge kind into
138
+ * the DOM where a test or a screen reader can find it, and cost nothing to
139
+ * restyle. The capture inside a `layoutsubtree` canvas is not disturbed,
140
+ * because this sits outside it.
141
+ */
142
+ export declare function Connectors({ strands, result, scheme, overview, selection, emphasis, stageRef, liveOf, onPickEdge, }: {
143
+ /** The lines to draw, resolved once per render by `connectorStrands`. */
144
+ readonly strands: readonly Strand[];
145
+ readonly overview: boolean;
146
+ /** For measuring the boxes a person can actually see. */
147
+ readonly stageRef: {
148
+ current: HTMLElement | null;
149
+ };
150
+ /** So a chosen kind's relations can stand out from the rest. */
151
+ readonly selection: readonly string[];
152
+ /** A relation the legend is asking about: its lines come forward. */
153
+ readonly emphasis: string | null;
154
+ /** Select the ONE edge a line stands for; `at` set means "and menu here". */
155
+ readonly onPickEdge?: (edgeId: string, at?: {
156
+ x: number;
157
+ y: number;
158
+ }) => void;
159
+ /** What just happened to this relation, if anything. */
160
+ liveOf?: (connector: {
161
+ from: string;
162
+ to: string;
163
+ }) => ActivityMark | undefined;
164
+ result: {
165
+ nodes: readonly SceneNode[];
166
+ width: number;
167
+ height: number;
168
+ /** Present at altitude: the roads run along this lattice. */
169
+ city?: {
170
+ readonly cell: number;
171
+ };
172
+ };
173
+ scheme: "light" | "dark";
174
+ }): import("react").JSX.Element | null;
175
+ export {};
176
+ //# sourceMappingURL=connectors.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"connectors.d.ts","sourceRoot":"","sources":["../src/connectors.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,SAAS,EAAoC,MAAM,iBAAiB,CAAC;AAEnF,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,eAAe,CAAC;AAalD,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAEjD;;;;;;;;;GASG;AACH;;;;;;;;;;;;GAYG;AACH,wBAAgB,QAAQ,CACtB,OAAO,EAAE;IAAE,CAAC,EAAE,MAAM,CAAC;IAAC,CAAC,EAAE,MAAM,CAAC;IAAC,KAAK,EAAE,MAAM,CAAC;IAAC,MAAM,EAAE,MAAM,CAAA;CAAE,EAChE,KAAK,EAAE;IAAE,CAAC,EAAE,MAAM,CAAC;IAAC,CAAC,EAAE,MAAM,CAAC;IAAC,KAAK,EAAE,MAAM,CAAC;IAAC,MAAM,EAAE,MAAM,CAAA;CAAE,GAE5D;IACE,IAAI,EAAE;QAAE,CAAC,EAAE,MAAM,CAAC;QAAC,CAAC,EAAE,MAAM,CAAA;KAAE,CAAC;IAC/B,EAAE,EAAE;QAAE,CAAC,EAAE,MAAM,CAAC;QAAC,CAAC,EAAE,MAAM,CAAA;KAAE,CAAC;IAC7B,OAAO,EAAE;QAAE,CAAC,EAAE,MAAM,CAAC;QAAC,CAAC,EAAE,MAAM,CAAA;KAAE,CAAC;IAClC,IAAI,EAAE,SAAS,GAAG,SAAS,GAAG,QAAQ,CA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