@graview/layout 0.1.28 → 0.1.30
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/city.d.ts +70 -38
- package/dist/city.d.ts.map +1 -1
- package/dist/city.js +336 -219
- package/dist/city.js.map +1 -1
- package/dist/index.d.ts +4 -4
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +2 -2
- package/dist/index.js.map +1 -1
- package/dist/interpolate.d.ts.map +1 -1
- package/dist/interpolate.js +3 -0
- package/dist/interpolate.js.map +1 -1
- package/dist/layout.d.ts +0 -16
- package/dist/layout.d.ts.map +1 -1
- package/dist/layout.js +95 -211
- package/dist/layout.js.map +1 -1
- package/dist/sizes.d.ts +2 -0
- package/dist/sizes.d.ts.map +1 -1
- package/dist/sizes.js +4 -1
- package/dist/sizes.js.map +1 -1
- package/dist/types.d.ts +88 -9
- package/dist/types.d.ts.map +1 -1
- package/dist/types.js.map +1 -1
- package/dist/view-moves.d.ts +35 -0
- package/dist/view-moves.d.ts.map +1 -0
- package/dist/view-moves.js +77 -0
- package/dist/view-moves.js.map +1 -0
- package/dist/view-state.d.ts +2 -24
- package/dist/view-state.d.ts.map +1 -1
- package/dist/view-state.js +5 -72
- package/dist/view-state.js.map +1 -1
- package/dist/view.d.ts +4 -6
- package/dist/view.d.ts.map +1 -1
- package/dist/view.js +4 -5
- package/dist/view.js.map +1 -1
- package/package.json +10 -2
package/dist/city.d.ts
CHANGED
|
@@ -1,17 +1,24 @@
|
|
|
1
1
|
import { type AnySchema } from "@graview/core";
|
|
2
|
-
import { type CityMap, type Plot } from "@graview/core/
|
|
2
|
+
import { type CityMap, type Plot } from "@graview/core/city";
|
|
3
3
|
import type { CityFrame, Layout } from "./types.js";
|
|
4
4
|
/**
|
|
5
5
|
* THE CITY AT ALTITUDE: districts on the lattice, one uniform scale.
|
|
6
6
|
*
|
|
7
7
|
* The map is the declaration's (`cityMap`): a kind's plot never moves
|
|
8
|
-
* because of what happened today
|
|
9
|
-
*
|
|
10
|
-
*
|
|
11
|
-
* the
|
|
12
|
-
*
|
|
13
|
-
*
|
|
14
|
-
*
|
|
8
|
+
* because of what happened today. What this file decides is how the
|
|
9
|
+
* lattice meets the canvas — ONE scale and ONE translate, so the city keeps
|
|
10
|
+
* its shape at every width — and which way up it stands: up and to the
|
|
11
|
+
* right along the ground in a wide window, down it in a tall one, whichever
|
|
12
|
+
* draws it larger.
|
|
13
|
+
*
|
|
14
|
+
* THE WHOLE CITY OPENS IN THE WINDOW. The cell is the largest at which
|
|
15
|
+
* every plot, and the name under it, stands inside the room the canvas
|
|
16
|
+
* leaves once its chrome is paid for — the bar's corner controls at the
|
|
17
|
+
* top, the ask field and the zoom at the foot. The names are a fixed size
|
|
18
|
+
* on the screen, so the city never grows past the window to make room for
|
|
19
|
+
* them: where two would collide at this scale, the less pressing one says
|
|
20
|
+
* less — its name and count without the bar, then nothing until the camera
|
|
21
|
+
* comes closer. A district with problems is the last to go quiet.
|
|
15
22
|
*/
|
|
16
23
|
export interface CityCard {
|
|
17
24
|
readonly id: string;
|
|
@@ -26,13 +33,33 @@ export interface CityCard {
|
|
|
26
33
|
* listed one and counted three — opening it answered nothing.
|
|
27
34
|
*/
|
|
28
35
|
readonly openedMin?: number;
|
|
36
|
+
/** The name under the district, on the screen: its whole size, and its size said short (name and count). */
|
|
37
|
+
readonly nameplate?: {
|
|
38
|
+
readonly width: number;
|
|
39
|
+
readonly height: number;
|
|
40
|
+
readonly short: {
|
|
41
|
+
readonly width: number;
|
|
42
|
+
readonly height: number;
|
|
43
|
+
};
|
|
44
|
+
};
|
|
45
|
+
/** How pressing it is to say: problems first, then population. The most pressing names are placed first. */
|
|
46
|
+
readonly weight?: number;
|
|
29
47
|
/**
|
|
30
|
-
*
|
|
31
|
-
*
|
|
32
|
-
*
|
|
48
|
+
* The showings hanging under its name, when they are shown (a district a
|
|
49
|
+
* lens is open on): how wide and tall, on the screen. No other district's
|
|
50
|
+
* name is placed on them.
|
|
33
51
|
*/
|
|
34
|
-
readonly marquee?:
|
|
52
|
+
readonly marquee?: {
|
|
53
|
+
readonly width: number;
|
|
54
|
+
readonly height: number;
|
|
55
|
+
};
|
|
35
56
|
}
|
|
57
|
+
/**
|
|
58
|
+
* How much a district's name says at this scale — all of it, its name and
|
|
59
|
+
* count, or nothing until closer — and whether it stands beside the plot
|
|
60
|
+
* (`-aside`) because the ground under it is the next district's.
|
|
61
|
+
*/
|
|
62
|
+
export type Nameplate = "full" | "short" | "full-above" | "short-above" | "full-aside" | "short-aside" | "none";
|
|
36
63
|
export interface PlacedCard {
|
|
37
64
|
readonly id: string;
|
|
38
65
|
readonly x: number;
|
|
@@ -41,55 +68,55 @@ export interface PlacedCard {
|
|
|
41
68
|
readonly height: number;
|
|
42
69
|
readonly depth: number;
|
|
43
70
|
readonly plot: Plot;
|
|
71
|
+
readonly nameplate: Nameplate;
|
|
44
72
|
}
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
y: number;
|
|
49
|
-
width: number;
|
|
50
|
-
height: number;
|
|
51
|
-
}, b: {
|
|
52
|
-
x: number;
|
|
53
|
-
y: number;
|
|
54
|
-
width: number;
|
|
55
|
-
height: number;
|
|
56
|
-
}, air?: number): boolean;
|
|
57
|
-
export declare function placeCity(cards: readonly CityCard[], schema: AnySchema, base: {
|
|
73
|
+
interface Box {
|
|
74
|
+
readonly x: number;
|
|
75
|
+
readonly y: number;
|
|
58
76
|
readonly width: number;
|
|
59
77
|
readonly height: number;
|
|
60
|
-
}
|
|
78
|
+
}
|
|
79
|
+
export declare function nameplateSize(name: string, count: number, problems: number, states: boolean, unit?: number): {
|
|
80
|
+
width: number;
|
|
81
|
+
height: number;
|
|
82
|
+
short: {
|
|
83
|
+
width: number;
|
|
84
|
+
height: number;
|
|
85
|
+
};
|
|
86
|
+
};
|
|
87
|
+
/** Two drawn boxes sharing ground, with a little air required between them. */
|
|
88
|
+
export declare function collides(a: Box, b: Box, air?: number): boolean;
|
|
89
|
+
export declare function placeCity(cards: readonly CityCard[], schema: AnySchema, canvas: {
|
|
61
90
|
readonly width: number;
|
|
62
91
|
readonly height: number;
|
|
63
92
|
}, inset?: {
|
|
64
93
|
readonly left?: number;
|
|
65
94
|
readonly right?: number;
|
|
95
|
+
readonly top?: number;
|
|
96
|
+
readonly bottom?: number;
|
|
66
97
|
}, options?: {
|
|
67
98
|
readonly order?: readonly string[];
|
|
68
99
|
readonly plots?: Readonly<Record<string, {
|
|
69
100
|
col: number;
|
|
70
101
|
row: number;
|
|
71
102
|
}>>;
|
|
72
|
-
readonly scale?: number;
|
|
73
|
-
/** The height a card is never drawn under, whatever the canvas — the layout's own floor. */
|
|
74
|
-
readonly minHeight?: number;
|
|
75
103
|
/** A factor on the fitted cell: the camera brought closer, the city allowed past the window. */
|
|
76
104
|
readonly zoom?: number;
|
|
105
|
+
/** The kinds whose districts are chosen: a city drawn past the window keeps these, and their names, inside it. */
|
|
106
|
+
readonly keep?: readonly string[];
|
|
77
107
|
/** The pan baked into the cards, recorded on the frame so the ground can tween with them. */
|
|
78
108
|
readonly pan?: {
|
|
79
109
|
readonly x: number;
|
|
80
110
|
readonly y: number;
|
|
81
111
|
};
|
|
112
|
+
/** A cell's height over its width: 0.5 at an angle, 1 from straight above. */
|
|
113
|
+
readonly tilt?: number;
|
|
82
114
|
/**
|
|
83
115
|
* Ground already taken — the picture standing in the middle from
|
|
84
|
-
* altitude. No district is laid under it:
|
|
85
|
-
*
|
|
116
|
+
* altitude, the corner controls. No district or name is laid under it:
|
|
117
|
+
* the city steps aside, then draws smaller, until each has ground of its own.
|
|
86
118
|
*/
|
|
87
|
-
readonly avoid?: readonly
|
|
88
|
-
readonly x: number;
|
|
89
|
-
readonly y: number;
|
|
90
|
-
readonly width: number;
|
|
91
|
-
readonly height: number;
|
|
92
|
-
}[];
|
|
119
|
+
readonly avoid?: readonly Box[];
|
|
93
120
|
}): {
|
|
94
121
|
readonly placed: readonly PlacedCard[];
|
|
95
122
|
readonly frame: CityFrame;
|
|
@@ -107,6 +134,10 @@ export declare function cameraLimit(result: {
|
|
|
107
134
|
readonly width: number;
|
|
108
135
|
readonly height: number;
|
|
109
136
|
readonly city?: CityFrame;
|
|
137
|
+
readonly visible?: {
|
|
138
|
+
readonly width: number;
|
|
139
|
+
readonly height: number;
|
|
140
|
+
};
|
|
110
141
|
}): {
|
|
111
142
|
readonly x: number;
|
|
112
143
|
readonly y: number;
|
|
@@ -134,7 +165,7 @@ export interface PastTheEdge {
|
|
|
134
165
|
* is named here with the side it lies past, so the scene can put a sign on
|
|
135
166
|
* that edge, and with the pan that brings it into the window.
|
|
136
167
|
*/
|
|
137
|
-
export declare function districtsPastTheEdge(result: Pick<Layout, "nodes" | "width" | "height" | "city">): readonly PastTheEdge[];
|
|
168
|
+
export declare function districtsPastTheEdge(result: Pick<Layout, "nodes" | "width" | "height" | "city" | "visible">): readonly PastTheEdge[];
|
|
138
169
|
/**
|
|
139
170
|
* THE PAN THAT KEEPS THE POINT UNDER THE POINTER STILL when the city is
|
|
140
171
|
* zoomed. The city is placed about the canvas's center, so scaling its cell
|
|
@@ -159,4 +190,5 @@ export declare function panForZoom(pan: {
|
|
|
159
190
|
readonly x: number;
|
|
160
191
|
readonly y: number;
|
|
161
192
|
};
|
|
193
|
+
export {};
|
|
162
194
|
//# sourceMappingURL=city.d.ts.map
|
package/dist/city.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"city.d.ts","sourceRoot":"","sources":["../src/city.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,SAAS,EAAE,MAAM,eAAe,CAAC;AAC/C,OAAO,
|
|
1
|
+
{"version":3,"file":"city.d.ts","sourceRoot":"","sources":["../src/city.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,SAAS,EAAE,MAAM,eAAe,CAAC;AAC/C,OAAO,EAAyB,KAAK,OAAO,EAAE,KAAK,IAAI,EAAE,MAAM,oBAAoB,CAAC;AACpF,OAA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