@graview/react 0.1.28 → 0.1.29
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/affordances.d.ts +2 -1
- package/dist/affordances.d.ts.map +1 -1
- package/dist/affordances.js +2 -1
- package/dist/affordances.js.map +1 -1
- package/dist/beside-the-map.d.ts +13 -0
- package/dist/beside-the-map.d.ts.map +1 -0
- package/dist/beside-the-map.js +14 -0
- package/dist/beside-the-map.js.map +1 -0
- package/dist/channels.d.ts +2 -1
- package/dist/channels.d.ts.map +1 -1
- package/dist/channels.js +121 -22
- package/dist/channels.js.map +1 -1
- package/dist/connectors.d.ts +27 -2
- package/dist/connectors.d.ts.map +1 -1
- package/dist/connectors.js +135 -21
- package/dist/connectors.js.map +1 -1
- package/dist/context.d.ts +38 -2
- package/dist/context.d.ts.map +1 -1
- package/dist/context.js +63 -14
- package/dist/context.js.map +1 -1
- package/dist/drawn.d.ts +1 -1
- package/dist/drawn.d.ts.map +1 -1
- package/dist/drawn.js +1 -1
- package/dist/drawn.js.map +1 -1
- package/dist/edge-signs.d.ts +1 -1
- package/dist/edge-signs.d.ts.map +1 -1
- package/dist/edge-signs.js +52 -7
- package/dist/edge-signs.js.map +1 -1
- package/dist/index.d.ts +6 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +5 -1
- package/dist/index.js.map +1 -1
- package/dist/last-visit.d.ts +18 -0
- package/dist/last-visit.d.ts.map +1 -0
- package/dist/last-visit.js +79 -0
- package/dist/last-visit.js.map +1 -0
- package/dist/map-choice.d.ts +55 -0
- package/dist/map-choice.d.ts.map +1 -0
- package/dist/map-choice.js +73 -0
- package/dist/map-choice.js.map +1 -0
- package/dist/plots.d.ts +30 -24
- package/dist/plots.d.ts.map +1 -1
- package/dist/plots.js +168 -149
- package/dist/plots.js.map +1 -1
- package/dist/provider.d.ts +2 -1
- package/dist/provider.d.ts.map +1 -1
- package/dist/provider.js +3 -1
- package/dist/provider.js.map +1 -1
- package/dist/record-links-layer.d.ts +80 -0
- package/dist/record-links-layer.d.ts.map +1 -0
- package/dist/record-links-layer.js +127 -0
- package/dist/record-links-layer.js.map +1 -0
- package/dist/record-links.d.ts +58 -0
- package/dist/record-links.d.ts.map +1 -0
- package/dist/record-links.js +72 -0
- package/dist/record-links.js.map +1 -0
- package/dist/resolved-view.d.ts.map +1 -1
- package/dist/resolved-view.js +4 -0
- package/dist/resolved-view.js.map +1 -1
- package/dist/ribbon-width.d.ts +8 -0
- package/dist/ribbon-width.d.ts.map +1 -0
- package/dist/ribbon-width.js +15 -0
- package/dist/ribbon-width.js.map +1 -0
- package/dist/ribbons-layer.d.ts +56 -0
- package/dist/ribbons-layer.d.ts.map +1 -0
- package/dist/ribbons-layer.js +167 -0
- package/dist/ribbons-layer.js.map +1 -0
- package/dist/ribbons.d.ts +70 -0
- package/dist/ribbons.d.ts.map +1 -0
- package/dist/ribbons.js +400 -0
- package/dist/ribbons.js.map +1 -0
- package/dist/scene-camera.d.ts.map +1 -1
- package/dist/scene-camera.js +10 -4
- package/dist/scene-camera.js.map +1 -1
- package/dist/scene-covered.d.ts +8 -0
- package/dist/scene-covered.d.ts.map +1 -0
- package/dist/scene-covered.js +118 -0
- package/dist/scene-covered.js.map +1 -0
- package/dist/scene-hand.d.ts +15 -0
- package/dist/scene-hand.d.ts.map +1 -1
- package/dist/scene-hand.js +45 -1
- package/dist/scene-hand.js.map +1 -1
- package/dist/scene-lines.d.ts +15 -2
- package/dist/scene-lines.d.ts.map +1 -1
- package/dist/scene-lines.js +215 -85
- package/dist/scene-lines.js.map +1 -1
- package/dist/scene-options.d.ts +7 -2
- package/dist/scene-options.d.ts.map +1 -1
- package/dist/scene-options.js +22 -8
- package/dist/scene-options.js.map +1 -1
- package/dist/scene-root.d.ts +1 -0
- package/dist/scene-root.d.ts.map +1 -1
- package/dist/scene-root.js +197 -154
- package/dist/scene-root.js.map +1 -1
- package/dist/view-host.d.ts.map +1 -1
- package/dist/view-host.js +6 -1
- package/dist/view-host.js.map +1 -1
- package/dist/view-registry.d.ts +5 -0
- package/dist/view-registry.d.ts.map +1 -1
- package/dist/view-registry.js +2 -6
- package/dist/view-registry.js.map +1 -1
- package/dist/where-drawn.d.ts +3 -1
- package/dist/where-drawn.d.ts.map +1 -1
- package/dist/where-drawn.js +10 -16
- package/dist/where-drawn.js.map +1 -1
- package/package.json +5 -5
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
import { type AnySchema } from "@graview/core";
|
|
2
|
+
/** One relation between two kinds, as the graph holds it right now. */
|
|
3
|
+
export interface Ribbon {
|
|
4
|
+
/** `edge|from|to`: stable across renders while the relation exists. */
|
|
5
|
+
readonly key: string;
|
|
6
|
+
readonly edge: string;
|
|
7
|
+
readonly from: string;
|
|
8
|
+
readonly to: string;
|
|
9
|
+
/** How many links run along it. */
|
|
10
|
+
readonly links: number;
|
|
11
|
+
/** How many records of `from` reach along it, and how many of `to` are reached. */
|
|
12
|
+
readonly fromCount: number;
|
|
13
|
+
readonly toCount: number;
|
|
14
|
+
}
|
|
15
|
+
/**
|
|
16
|
+
* The relations between kinds, counted from the links the graph holds. A
|
|
17
|
+
* declared relation nobody has made yet has no ribbon: the map draws what is
|
|
18
|
+
* there, and the Key lists what may be.
|
|
19
|
+
*/
|
|
20
|
+
export declare function ribbonsOf(edges: Iterable<{
|
|
21
|
+
readonly kind: string;
|
|
22
|
+
readonly from: string;
|
|
23
|
+
readonly to: string;
|
|
24
|
+
}>, kindOf: (id: string) => string | undefined): Ribbon[];
|
|
25
|
+
/**
|
|
26
|
+
* WHAT IS CHOSEN, AS THE MAP READS IT: districts (a kind's card or its
|
|
27
|
+
* group), records, or nothing — and a lens open beside the map. One answer
|
|
28
|
+
* for the ribbons, the record's links and the side panel, so the three never
|
|
29
|
+
* disagree about what a press meant.
|
|
30
|
+
*/
|
|
31
|
+
export interface MapChoice {
|
|
32
|
+
/** Kinds whose district is chosen. */
|
|
33
|
+
readonly districts: readonly string[];
|
|
34
|
+
/** Records chosen, in the order they were. */
|
|
35
|
+
readonly records: readonly string[];
|
|
36
|
+
/** The kind whose lens stands open beside the map, if one does. */
|
|
37
|
+
readonly lens: string | null;
|
|
38
|
+
}
|
|
39
|
+
export declare function mapChoice(selection: readonly string[],
|
|
40
|
+
/** `beside`: a panel is drawn beside the map (`BesideTheMap`), where a record in focus is shown rather than stamped over the city. */
|
|
41
|
+
view: {
|
|
42
|
+
readonly overview?: boolean | undefined;
|
|
43
|
+
readonly focusId: string | null;
|
|
44
|
+
readonly beside?: boolean;
|
|
45
|
+
}, kindOf: (id: string) => string | undefined): MapChoice;
|
|
46
|
+
/** The kind a district id names — its card (`kind:x`) or its group (`aggregate:x`) — or null for anything else. */
|
|
47
|
+
export declare function districtOf(id: string): string | null;
|
|
48
|
+
/**
|
|
49
|
+
* A RIBBON IN WORDS: how many of one kind reach how many of the other, and
|
|
50
|
+
* the relation in the words of the kind it leaves — "146 features → 14
|
|
51
|
+
* areas, the part it lives in". Where the declaration has no words, the
|
|
52
|
+
* relation's own name, humanized.
|
|
53
|
+
*/
|
|
54
|
+
export declare function ribbonSentence(schema: AnySchema, ribbon: Ribbon): string;
|
|
55
|
+
//# sourceMappingURL=map-choice.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"map-choice.d.ts","sourceRoot":"","sources":["../src/map-choice.ts"],"names":[],"mappings":"AAAA,OAAO,EAAW,KAAK,SAAS,EAAE,MAAM,eAAe,CAAC;AAYxD,uEAAuE;AACvE,MAAM,WAAW,MAAM;IACrB,uEAAuE;IACvE,QAAQ,CAAC,GAAG,EAAE,MAAM,CAAC;IACrB,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,EAAE,EAAE,MAAM,CAAC;IACpB,mCAAmC;IACnC,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;IACvB,mFAAmF;IACnF,QAAQ,CAAC,SAA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2
|
+
import { edgeWords } from "@graview/core/words";
|
|
3
|
+
/**
|
|
4
|
+
* The relations between kinds, counted from the links the graph holds. A
|
|
5
|
+
* declared relation nobody has made yet has no ribbon: the map draws what is
|
|
6
|
+
* there, and the Key lists what may be.
|
|
7
|
+
*/
|
|
8
|
+
export function ribbonsOf(edges, kindOf) {
|
|
9
|
+
const found = new Map();
|
|
10
|
+
for (const edge of edges) {
|
|
11
|
+
const from = kindOf(edge.from);
|
|
12
|
+
const to = kindOf(edge.to);
|
|
13
|
+
if (from === undefined || to === undefined)
|
|
14
|
+
continue;
|
|
15
|
+
const key = `${edge.kind}|${from}|${to}`;
|
|
16
|
+
let held = found.get(key);
|
|
17
|
+
if (!held)
|
|
18
|
+
found.set(key, (held = { edge: edge.kind, from, to, links: 0, froms: new Set(), tos: new Set() }));
|
|
19
|
+
held.links += 1;
|
|
20
|
+
held.froms.add(edge.from);
|
|
21
|
+
held.tos.add(edge.to);
|
|
22
|
+
}
|
|
23
|
+
return [...found.entries()]
|
|
24
|
+
.sort(([a], [b]) => (a < b ? -1 : a > b ? 1 : 0))
|
|
25
|
+
.map(([key, held]) => ({ key, edge: held.edge, from: held.from, to: held.to, links: held.links, fromCount: held.froms.size, toCount: held.tos.size }));
|
|
26
|
+
}
|
|
27
|
+
export function mapChoice(selection,
|
|
28
|
+
/** `beside`: a panel is drawn beside the map (`BesideTheMap`), where a record in focus is shown rather than stamped over the city. */
|
|
29
|
+
view, kindOf) {
|
|
30
|
+
const districts = [];
|
|
31
|
+
const records = [];
|
|
32
|
+
for (const id of selection) {
|
|
33
|
+
const district = districtOf(id);
|
|
34
|
+
if (district !== null) {
|
|
35
|
+
if (!districts.includes(district))
|
|
36
|
+
districts.push(district);
|
|
37
|
+
continue;
|
|
38
|
+
}
|
|
39
|
+
if (kindOf(id) !== undefined)
|
|
40
|
+
records.push(id);
|
|
41
|
+
}
|
|
42
|
+
const lens = view.overview && view.focusId !== null ? districtOf(view.focusId) : null;
|
|
43
|
+
/*
|
|
44
|
+
* A RECORD IN FOCUS, RISEN FROM: it is what the person was looking at,
|
|
45
|
+
* so from altitude it is the record chosen — its building lit, its links
|
|
46
|
+
* drawn, and the record itself in the panel beside the map at a size a
|
|
47
|
+
* person reads — until something else is chosen.
|
|
48
|
+
*/
|
|
49
|
+
if (view.beside && view.overview && lens === null && view.focusId !== null && records.length === 0 && districts.length === 0 && kindOf(view.focusId) !== undefined) {
|
|
50
|
+
records.push(view.focusId);
|
|
51
|
+
}
|
|
52
|
+
return { districts, records, lens };
|
|
53
|
+
}
|
|
54
|
+
/** The kind a district id names — its card (`kind:x`) or its group (`aggregate:x`) — or null for anything else. */
|
|
55
|
+
export function districtOf(id) {
|
|
56
|
+
if (id.startsWith("kind:"))
|
|
57
|
+
return id.slice(5) || null;
|
|
58
|
+
if (id.startsWith("aggregate:") && !id.includes("|"))
|
|
59
|
+
return id.slice(10) || null;
|
|
60
|
+
return null;
|
|
61
|
+
}
|
|
62
|
+
/**
|
|
63
|
+
* A RIBBON IN WORDS: how many of one kind reach how many of the other, and
|
|
64
|
+
* the relation in the words of the kind it leaves — "146 features → 14
|
|
65
|
+
* areas, the part it lives in". Where the declaration has no words, the
|
|
66
|
+
* relation's own name, humanized.
|
|
67
|
+
*/
|
|
68
|
+
export function ribbonSentence(schema, ribbon) {
|
|
69
|
+
const words = edgeWords(schema, ribbon.from, ribbon.edge, "out");
|
|
70
|
+
const own = ribbon.from === ribbon.to ? " of their own" : "";
|
|
71
|
+
return `${counted(schema, ribbon.from, ribbon.fromCount)} → ${counted(schema, ribbon.to, ribbon.toCount)}${own}, ${words}`;
|
|
72
|
+
}
|
|
73
|
+
//# sourceMappingURL=map-choice.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"map-choice.js","sourceRoot":"","sources":["../src/map-choice.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAkB,MAAM,eAAe,CAAC;AACxD,OAAO,EAAE,SAAS,EAAE,MAAM,qBA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8 @@
|
|
|
1
1
|
import { type Brand } from "@graview/core";
|
|
2
2
|
import { type Building } from "@graview/core/scene";
|
|
3
|
-
import {
|
|
3
|
+
import type { InterpolatedLayout } from "@graview/layout";
|
|
4
4
|
import { type ReactElement } from "react";
|
|
5
|
+
import "./provider.js";
|
|
5
6
|
export interface Point {
|
|
6
7
|
readonly x: number;
|
|
7
8
|
readonly y: number;
|
|
@@ -10,6 +11,8 @@ export interface City {
|
|
|
10
11
|
readonly cell: number;
|
|
11
12
|
readonly originX: number;
|
|
12
13
|
readonly originY: number;
|
|
14
|
+
/** A cell's height over its width: 0.5 at an angle, 1 from straight above. */
|
|
15
|
+
readonly tilt?: number;
|
|
13
16
|
}
|
|
14
17
|
export interface PlotLike {
|
|
15
18
|
readonly col: number;
|
|
@@ -27,10 +30,16 @@ export interface PlotsProps {
|
|
|
27
30
|
readonly brand?: Brand | undefined;
|
|
28
31
|
/** Which district ids are hand-placed: their curb is dashed, as the pinned mark. */
|
|
29
32
|
readonly pinned?: ReadonlySet<string>;
|
|
33
|
+
/** The camera has come down past the whole map: the blocks say their names. */
|
|
34
|
+
readonly close?: boolean;
|
|
35
|
+
/** The day overdue is judged against (ISO date). */
|
|
36
|
+
readonly today?: string;
|
|
30
37
|
/** The scene's own flag for a click that a drag is about to produce: a pan that ends on a tile is not a press. */
|
|
31
38
|
readonly swallowed?: {
|
|
32
39
|
readonly current: boolean;
|
|
33
40
|
};
|
|
41
|
+
/** The records chosen from altitude (`mapChoice`): each stands as a building of its own, ahead of the rest of its row. */
|
|
42
|
+
readonly chosen?: readonly string[];
|
|
34
43
|
onFocus?(id: string): void;
|
|
35
44
|
}
|
|
36
45
|
/**
|
|
@@ -44,10 +53,27 @@ export interface PlotsProps {
|
|
|
44
53
|
* group, so a pan or a tween changes one attribute. Each plot is its own
|
|
45
54
|
* memoized tile whose village is kept for as long as that plot and its
|
|
46
55
|
* members are the same, so dragging one district redraws that district and
|
|
47
|
-
*
|
|
56
|
+
* its tile, not every building in the city on every frame.
|
|
48
57
|
*/
|
|
49
|
-
export declare function Plots({ frame, width, height, pan,
|
|
50
|
-
|
|
58
|
+
export declare function Plots({ frame, width, height, pan, pinned, close, today, swallowed, chosen, onFocus }: PlotsProps): ReactElement | null;
|
|
59
|
+
/**
|
|
60
|
+
* WHICH BLOCKS SAY THEIR NAMES, so that no two names on a plot lie over each
|
|
61
|
+
* other. A district's blocks stand a step apart on the diagonal, and every
|
|
62
|
+
* name was written over its own block whatever stood beside it: coming down
|
|
63
|
+
* on the locations, "The workshop", "The kitchen" and "The yard" were one
|
|
64
|
+
* smudge across the block somebody had chosen. The district nameplates' own
|
|
65
|
+
* rule, a name only where it has room: the chosen block says its name first
|
|
66
|
+
* and whole, then each block wide enough to be named, back to front, as long
|
|
67
|
+
* as its name has room beside the names already written. The rest say
|
|
68
|
+
* theirs once the camera comes down far enough to part them.
|
|
69
|
+
*/
|
|
70
|
+
export declare function namesWithRoom(buildings: readonly {
|
|
71
|
+
readonly id: string;
|
|
72
|
+
readonly name: string;
|
|
73
|
+
readonly width: number;
|
|
74
|
+
readonly top: Point;
|
|
75
|
+
}[], chosen: ReadonlySet<string>): ReadonlyMap<string, string>;
|
|
76
|
+
export { districtBlocks, heightOf, villageCap, villageOf } from "@graview/core/scene";
|
|
51
77
|
export type { Building } from "@graview/core/scene";
|
|
52
78
|
/** The three faces of one building on the canvas, from its foot cell. */
|
|
53
79
|
export declare function buildingFaces(building: Building, city: City, pan: Point): {
|
|
@@ -61,24 +87,4 @@ export declare function toLattice(point: Point, city: City, pan: Point): {
|
|
|
61
87
|
readonly col: number;
|
|
62
88
|
readonly row: number;
|
|
63
89
|
};
|
|
64
|
-
/**
|
|
65
|
-
* THE STREETS. Plots stand at multiples of BLOCK and never fill their
|
|
66
|
-
* block, so between every block there is a gutter — a row and a column
|
|
67
|
-
* of cells nothing stands on. A road runs along them: out of its plot to
|
|
68
|
-
* the gutter beside its block, along that gutter, up the gutter beside
|
|
69
|
-
* the other block, and in. Every leg is a lattice line (one coordinate
|
|
70
|
-
* held), no leg crosses a third plot, and the whole city reads as
|
|
71
|
-
* villages on a street grid rather than lines drawn over it.
|
|
72
|
-
*/
|
|
73
|
-
export declare function streetPoints(from: PlotLike, to: PlotLike): {
|
|
74
|
-
readonly col: number;
|
|
75
|
-
readonly row: number;
|
|
76
|
-
}[];
|
|
77
|
-
/**
|
|
78
|
-
* A ROAD FROM CURB TO CURB: the street between two plots, with the run
|
|
79
|
-
* inside either plot cut away, so the road starts at one curb and ends at
|
|
80
|
-
* the other rather than diving under the buildings. Sampled and bisected,
|
|
81
|
-
* the same way a connector is clipped against a box.
|
|
82
|
-
*/
|
|
83
|
-
export declare function roadBetween(from: PlotLike, to: PlotLike, city: City, pan: Point): Point[];
|
|
84
90
|
//# sourceMappingURL=plots.d.ts.map
|
package/dist/plots.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"plots.d.ts","sourceRoot":"","sources":["../src/plots.tsx"],"names":[],"mappings":"AAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"plots.d.ts","sourceRoot":"","sources":["../src/plots.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAuC,KAAK,KAAK,EAAe,MAAM,eAAe,CAAC;AAC7F,OAAO,EAAqD,KAAK,QAAQ,EAAkB,MAAM,qBAAqB,CAAC;AACvH,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,iBAAiB,CAAC;AAC1D,OAAO,EAA0D,KAAK,YAAY,EAAE,MAAM,OAAO,CAAC;AAIlG,OAAO,eAAe,CAAC;AAavB,MAAM,WAAW,KAAK;IACpB,QAAQ,CAAC,CAAC,EAAE,MAAM,CAAC;IACnB,QAAQ,CAAC,CAAC,EAAE,MAAM,CAAC;CACpB;AACD,MAAM,WAAW,IAAI;IACnB,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;IACzB,QAAQ,CAAC,OAAO,EAAE,MAA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