@graview/react 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/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 +144 -23
- package/dist/connectors.js.map +1 -1
- package/dist/context.d.ts +91 -2
- package/dist/context.d.ts.map +1 -1
- package/dist/context.js +98 -16
- package/dist/context.js.map +1 -1
- package/dist/drawing.d.ts +2 -0
- package/dist/drawing.d.ts.map +1 -1
- package/dist/drawing.js +2 -0
- package/dist/drawing.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 +12 -2
- package/dist/edge-signs.d.ts.map +1 -1
- package/dist/edge-signs.js +95 -9
- package/dist/edge-signs.js.map +1 -1
- package/dist/go.d.ts +28 -10
- package/dist/go.d.ts.map +1 -1
- package/dist/go.js +14 -5
- package/dist/go.js.map +1 -1
- package/dist/index.d.ts +11 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +8 -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/linked-reads.d.ts +3 -0
- package/dist/linked-reads.d.ts.map +1 -0
- package/dist/linked-reads.js +50 -0
- package/dist/linked-reads.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/menu-sections.d.ts +67 -0
- package/dist/menu-sections.d.ts.map +1 -0
- package/dist/menu-sections.js +35 -0
- package/dist/menu-sections.js.map +1 -0
- package/dist/past.d.ts +58 -0
- package/dist/past.d.ts.map +1 -0
- package/dist/past.js +70 -0
- package/dist/past.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/popover.d.ts +9 -1
- package/dist/popover.d.ts.map +1 -1
- package/dist/popover.js +3 -1
- package/dist/popover.js.map +1 -1
- package/dist/provider.d.ts +6 -2
- package/dist/provider.d.ts.map +1 -1
- package/dist/provider.js +5 -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/routes.d.ts +6 -0
- package/dist/routes.d.ts.map +1 -1
- package/dist/routes.js +8 -0
- package/dist/routes.js.map +1 -1
- 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 +305 -86
- package/dist/scene-lines.js.map +1 -1
- package/dist/scene-options.d.ts +10 -3
- package/dist/scene-options.d.ts.map +1 -1
- package/dist/scene-options.js +26 -9
- package/dist/scene-options.js.map +1 -1
- package/dist/scene-root.d.ts +7 -0
- package/dist/scene-root.d.ts.map +1 -1
- package/dist/scene-root.js +224 -158
- package/dist/scene-root.js.map +1 -1
- package/dist/tie-labels.d.ts +83 -0
- package/dist/tie-labels.d.ts.map +1 -0
- package/dist/tie-labels.js +98 -0
- package/dist/tie-labels.js.map +1 -0
- package/dist/view-host.d.ts.map +1 -1
- package/dist/view-host.js +7 -2
- 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,35 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { createContext, useContext, useMemo } from "react";
|
|
3
|
+
import { useGraviewIfAny } from "./context.js";
|
|
4
|
+
const MenuSectionsContext = createContext([]);
|
|
5
|
+
/**
|
|
6
|
+
* A FACE'S OWN SECTIONS (the routed face's "Open", "Change …"), added to
|
|
7
|
+
* every context menu drawn inside it, after those of any around it. A
|
|
8
|
+
* host's are the provider's `menuSections`, and are drawn after these.
|
|
9
|
+
*/
|
|
10
|
+
export function MenuSections({ sections, children }) {
|
|
11
|
+
const outer = useContext(MenuSectionsContext);
|
|
12
|
+
const all = useMemo(() => [...outer, ...sections.filter((source) => !outer.includes(source))], [outer, sections]);
|
|
13
|
+
return _jsx(MenuSectionsContext.Provider, { value: all, children: children });
|
|
14
|
+
}
|
|
15
|
+
/** The sections every source here gives for a target, the ones before the acts first. */
|
|
16
|
+
export function useMenuSections(target) {
|
|
17
|
+
const faces = useContext(MenuSectionsContext);
|
|
18
|
+
const host = useGraviewIfAny()?.menuSections;
|
|
19
|
+
// The same source given twice — a face's and a host's — is drawn once.
|
|
20
|
+
const sources = host ? [...faces, ...host.filter((source) => !faces.includes(source))] : faces;
|
|
21
|
+
if (target === null || sources.length === 0)
|
|
22
|
+
return { start: [], end: [] };
|
|
23
|
+
const sections = sources.flatMap((source) => {
|
|
24
|
+
try {
|
|
25
|
+
const section = source(target);
|
|
26
|
+
return section && ((section.items?.length ?? 0) > 0 || section.render) ? [section] : [];
|
|
27
|
+
}
|
|
28
|
+
catch {
|
|
29
|
+
// A host's section that throws is left out, never the menu.
|
|
30
|
+
return [];
|
|
31
|
+
}
|
|
32
|
+
});
|
|
33
|
+
return { start: sections.filter((section) => section.at === "start"), end: sections.filter((section) => section.at !== "start") };
|
|
34
|
+
}
|
|
35
|
+
//# sourceMappingURL=menu-sections.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"menu-sections.js","sourceRoot":"","sources":["../src/menu-sections.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,aAAa,EAAE,UAAU,EAAE,OAAO,EAAkB,MAAM,OAAO,CAAC;AAC3E,OAAO,EAAE,eAAe,EAAE,MAAM,cAAc,CAAC;AAyD/C,MAAM,mBAAmB,GAAG,aAAa,CAA+B,EAAE,CAAC,CAAC;AAE5E;;;;GA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,CAAC,GAAG,CAAC,IAAI,OAAO,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC;QAC1F,CAAC;QAAC,MAAM,CAAC;YACP,4DAA4D;YAC5D,OAAO,EAAE,CAAC;QACZ,CAAC;IACH,CAAC,CAAC,CAAC;IACH,OAAO,EAAE,KAAK,EAAE,QAAQ,CAAC,MAAM,CAAC,CAAC,OAAO,EAAE,EAAE,CAAC,OAAO,CAAC,EAAE,KAAK,OAAO,CAAC,EAAE,GAAG,EAAE,QAAQ,CAAC,MAAM,CAAC,CAAC,OAAO,EAAE,EAAE,CAAC,OAAO,CAAC,EAAE,KAAK,OAAO,CAAC,EAAE,CAAC;AACpI,CAAC"}
|
package/dist/past.d.ts
ADDED
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
import type { AnySchema, Principal, Store } from "@graview/core";
|
|
2
|
+
import type { HistoryHost } from "@graview/core/history";
|
|
3
|
+
/**
|
|
4
|
+
* THE APP AS IT WAS, SHOWN (Roadmap f-playback): which moment a face is
|
|
5
|
+
* drawing instead of now, and the store of it (`pastOf`) every surface
|
|
6
|
+
* under it reads — the scene, the pages, the problems, the lenses — so the
|
|
7
|
+
* past is drawn by the one renderer the present is.
|
|
8
|
+
*/
|
|
9
|
+
export interface PastShown<S extends AnySchema = AnySchema> {
|
|
10
|
+
/** The ops before this seq are in it, none after. */
|
|
11
|
+
readonly seq: number;
|
|
12
|
+
/** When the last op in it was made. */
|
|
13
|
+
readonly at: string | undefined;
|
|
14
|
+
/** The whole store as it stood: read, never changed, offering no act. */
|
|
15
|
+
readonly store: Store<S>;
|
|
16
|
+
}
|
|
17
|
+
/**
|
|
18
|
+
* PLAYBACK, AS A FACE HOLDS IT: the moment shown (or `null`, now), the way
|
|
19
|
+
* to show another, and the live store — what the timeline reads its ticks
|
|
20
|
+
* from and a "Restore to here" changes. Held by the outermost provider of
|
|
21
|
+
* a face (`GraviewProvider`, or the routed face's `PagesApp`), so a face
|
|
22
|
+
* drawn inside another shares the one moment.
|
|
23
|
+
*/
|
|
24
|
+
export interface Playback<S extends AnySchema = AnySchema> {
|
|
25
|
+
/** The moment drawn instead of now; `null` while now is drawn. */
|
|
26
|
+
readonly past: PastShown<S> | null;
|
|
27
|
+
/** Whether the timeline is open: at a moment, or at now with the way back still in reach. */
|
|
28
|
+
readonly open: boolean;
|
|
29
|
+
/**
|
|
30
|
+
* Show the app as it stood at `seq` — the timeline opens on it; a seq at
|
|
31
|
+
* or past the log's end is now, with the timeline still open. `null`
|
|
32
|
+
* closes the timeline and comes back to now.
|
|
33
|
+
*/
|
|
34
|
+
show(seq: number | null): void;
|
|
35
|
+
/** The store as it is now, whole: read through the seat's sight (`seenBy`). */
|
|
36
|
+
readonly live: Store<S>;
|
|
37
|
+
/** What the host keeps outside the log: declaration changes, a script view's code at a moment. */
|
|
38
|
+
readonly host: HistoryHost | undefined;
|
|
39
|
+
/** Whether `store` is this playback's — now's or the moment's, whole or as one seat sees it. */
|
|
40
|
+
owns(store: Store<AnySchema>, principal: Principal): boolean;
|
|
41
|
+
}
|
|
42
|
+
export declare const PlaybackContext: import("react").Context<Playback<AnySchema> | null>;
|
|
43
|
+
/** The playback the face under this is drawn with, if any. */
|
|
44
|
+
export declare function usePlayback<S extends AnySchema = AnySchema>(): Playback<S> | null;
|
|
45
|
+
/**
|
|
46
|
+
* THE STORE AS IT IS NOW, as this seat sees it, whatever moment the face
|
|
47
|
+
* draws — what Activity lists and a timeline counts its ticks from — drawn
|
|
48
|
+
* again as it changes. The provider's own store where there is no playback.
|
|
49
|
+
*/
|
|
50
|
+
export declare function useLiveStore<S extends AnySchema>(shown: Store<S>, principal: Principal): Store<S>;
|
|
51
|
+
/**
|
|
52
|
+
* A FACE'S OWN PLAYBACK over `live`, or the one it is drawn inside when
|
|
53
|
+
* that one holds this store. Nothing past is folded — or fetched — until
|
|
54
|
+
* somebody asks to see it; a moment the log no longer reaches (cut back
|
|
55
|
+
* under it) is now.
|
|
56
|
+
*/
|
|
57
|
+
export declare function useOwnPlayback<S extends AnySchema>(live: Store<S>, principal: Principal, host: HistoryHost | undefined): Playback<S>;
|
|
58
|
+
//# sourceMappingURL=past.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"past.d.ts","sourceRoot":"","sources":["../src/past.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,SAAS,EAAE,KAAK,EAAE,MAAM,eAAe,CAAC;AACjE,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,uBAAuB,CAAC;AAIzD;;;;;GAKG;AACH,MAAM,WAAW,SAAS,CAAC,CAAC,SAAS,SAAS,GAAG,SAAS;IACxD,qDAAqD;IACrD,QAAQ,CAAC,GAAG,EAAE,MAAM,CAAC;IACrB,uCAAuC;IACvC,QAAQ,CAAC,EAAE,EAAE,MAAM,GAAG,SAAS,CAAC;IAChC,yEAAyE;IACzE,QAAQ,CAAC,KAAK,EAAE,KAAK,CAAC,CAAC,CAAC,CAAC;CAC1B;AAED;;;;;;GAMG;AACH,MAAM,WAAW,QAAQ,CAAC,CAAC,SAAS,SAAS,GAAG,SAAS;IACvD,kEAAkE;IAClE,QAAQ,CAAC,IAAI,EAAE,SAAS,CAAC,CAAC,CAAC,GAAG,IAAI,CAAC;IACnC,6FAA6F;IAC7F,QAAQ,CAAC,IAAI,EAAE,OAAO,CAAC;IACvB;;;;OAIG;IACH,IAAI,CAAC,GAAG,EAAE,MAAM,GAAG,IAAI,GAAG,IAAI,CAAC;IAC/B,+EAA+E;IAC/E,QAAQ,CAAC,IAAI,EAAE,KAAK,CAAC,CAAC,CAAC,CAAC;IACxB,kGAAkG;IAClG,QAAQ,CAAC,IAAI,EAAE,WAAW,GAAG,SAAS,CAAC;IACvC,gGAAgG;IAChG,IAAI,CAAC,KAAK,EAAE,KAAK,CAAC,SAAS,CAAC,EAAE,SAAS,EAAE,SAAS,GAAG,OAAO,CAAC;CAC9D;AAED,eAAO,MAAM,eAAe,qDAAuC,CAAC;AAEpE,8DAA8D;AAC9D,wBAAgB,WAAW,CAAC,CAAC,SAAS,SAAS,GAAG,SAAS,KAAK,QAAQ,CAAC,CAAC,CAAC,GAAG,IAAI,CAEjF;AAED;;;;GAIG;AACH,wBAAgB,YAAY,CAAC,CAAC,SAAS,SAAS,EAAE,KAAK,EAAE,KAAK,CAAC,CAAC,CAAC,EAAE,SAAS,EAAE,SAAS,GAAG,KAAK,CAAC,CAAC,CAAC,CAcjG;AAQD;;;;;GAKG;AACH,wBAAgB,cAAc,CAAC,CAAC,SAAS,SAAS,EAAE,IAAI,EAAE,KAAK,CAAC,CAAC,CAAC,EAAE,SAAS,EAAE,SAAS,EAAE,IAAI,EAAE,WAAW,GAAG,SAAS,GAAG,QAAQ,CAAC,CAAC,CAAC,CAqCpI"}
|
package/dist/past.js
ADDED
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
import { retryingImport } from "@graview/core/retry";
|
|
2
|
+
import { createContext, useCallback, useContext, useEffect, useMemo, useRef, useState, useSyncExternalStore } from "react";
|
|
3
|
+
export const PlaybackContext = createContext(null);
|
|
4
|
+
/** The playback the face under this is drawn with, if any. */
|
|
5
|
+
export function usePlayback() {
|
|
6
|
+
return useContext(PlaybackContext);
|
|
7
|
+
}
|
|
8
|
+
/**
|
|
9
|
+
* THE STORE AS IT IS NOW, as this seat sees it, whatever moment the face
|
|
10
|
+
* draws — what Activity lists and a timeline counts its ticks from — drawn
|
|
11
|
+
* again as it changes. The provider's own store where there is no playback.
|
|
12
|
+
*/
|
|
13
|
+
export function useLiveStore(shown, principal) {
|
|
14
|
+
const playback = usePlayback();
|
|
15
|
+
const live = useMemo(() => (playback ? playback.live.seenBy(principal) : shown), [playback, shown, principal]);
|
|
16
|
+
const version = useRef(0);
|
|
17
|
+
const subscribe = useCallback((listener) => live.subscribe(() => {
|
|
18
|
+
version.current += 1;
|
|
19
|
+
listener();
|
|
20
|
+
}), [live]);
|
|
21
|
+
useSyncExternalStore(subscribe, () => version.current, () => 0);
|
|
22
|
+
return live;
|
|
23
|
+
}
|
|
24
|
+
/** `@graview/core/past`, fetched when somebody first asks to see the past: the fold is none of a page's weight until then. */
|
|
25
|
+
const history = /* @__PURE__ */ retryingImport(() => import("@graview/core/past"));
|
|
26
|
+
/** The module once it is here, so a face drawn after it arrived shows the past at once. */
|
|
27
|
+
let arrived;
|
|
28
|
+
/**
|
|
29
|
+
* A FACE'S OWN PLAYBACK over `live`, or the one it is drawn inside when
|
|
30
|
+
* that one holds this store. Nothing past is folded — or fetched — until
|
|
31
|
+
* somebody asks to see it; a moment the log no longer reaches (cut back
|
|
32
|
+
* under it) is now.
|
|
33
|
+
*/
|
|
34
|
+
export function useOwnPlayback(live, principal, host) {
|
|
35
|
+
const outer = useContext(PlaybackContext);
|
|
36
|
+
const inherited = outer !== null && outer.owns(live, principal);
|
|
37
|
+
const [seq, setSeq] = useState(null);
|
|
38
|
+
const [folds, setFolds] = useState(arrived);
|
|
39
|
+
// The past is fetched the first time it is asked for; until it is here, now is drawn.
|
|
40
|
+
useEffect(() => {
|
|
41
|
+
if (folds || inherited || seq === null)
|
|
42
|
+
return;
|
|
43
|
+
let live = true;
|
|
44
|
+
void history().then((module) => {
|
|
45
|
+
arrived = module;
|
|
46
|
+
if (live)
|
|
47
|
+
setFolds(module);
|
|
48
|
+
}, () => { });
|
|
49
|
+
return () => {
|
|
50
|
+
live = false;
|
|
51
|
+
};
|
|
52
|
+
}, [folds, inherited, seq]);
|
|
53
|
+
const past = useMemo(() => {
|
|
54
|
+
if (inherited || seq === null || seq >= live.log.length || !folds)
|
|
55
|
+
return null;
|
|
56
|
+
try {
|
|
57
|
+
const store = folds.pastAt(live, seq, host);
|
|
58
|
+
return { seq, at: store.past?.at, store };
|
|
59
|
+
}
|
|
60
|
+
catch {
|
|
61
|
+
return null;
|
|
62
|
+
}
|
|
63
|
+
}, [inherited, live, seq, host, folds]);
|
|
64
|
+
const show = useCallback((next) => setSeq(next === null ? null : next >= live.log.length ? Number.POSITIVE_INFINITY : next), [live]);
|
|
65
|
+
const owns = useCallback((store, seat) => [live, past?.store].some((one) => one !== undefined && (one === store || one.seenBy(seat) === store)), [live, past]);
|
|
66
|
+
const open = seq !== null;
|
|
67
|
+
const own = useMemo(() => ({ past, open, show, live, host, owns }), [past, open, show, live, host, owns]);
|
|
68
|
+
return inherited ? outer : own;
|
|
69
|
+
}
|
|
70
|
+
//# sourceMappingURL=past.js.map
|
package/dist/past.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"past.js","sourceRoot":"","sources":["../src/past.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;AACrD,OAAO,EAAE,aAAa,EAAE,WAAW,EAAE,UAAU,EAAE,SAAS,EAAE,OAAO,EAAE,MAAM,EAAE,QAAQ,EAAE,oBAAoB,EAAE,MAAM,OAAO,CAAC;AA2C3H,MAAM,CAAC,MAAM,eAAe,GAAG,aAAa,CAAkB,IAAI,CAAC,CAAC;AAEpE,8DAA8D;AAC9D,MAAM,UAAU,WAAW;IACzB,OAAO,UAAU,CAAC,eAAe,CAAuB,CAAC;AAC3D,CAAC;AAED;;;;GAIG;AACH,MAAM,UAAU,YAAY,CAAsB,KAAe,EAAE,SAAoB;IACrF,MAAM,QAAQ,GAAG,WAAW,EAAK,CAAC;IAClC,MAAM,IAAI,GAAG,OAAO,CAAC,GAAG,EAAE,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,QAAQ,CAAC,IAAI,CAAC,MAAM,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,EAAE,CAAC,QAAQ,EAAE,KAAK,EAAE,SAAS,CAAC,CAAC,CAAC;IAC/G,MAAM,OAAO,GAAG,MAAM,CAAC,CAAC,CAAC,CAAC;IAC1B,MAAM,SAAS,GAAG,WAAW,CAC3B,CAAC,QAAoB,EAAE,EAAE,CACvB,IAAI,CAAC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AAC,EAC7N,CAAC,IAAI,EAAE,IAAI,CAAC,CACb,CAAC;IACF,MAAM,IAAI,GAAG,GAAG,KAAK,IAAI,CAAC;IAC1B,MAAM,GAAG,GAAG,OAAO,CAAc,GAAG,EAAE,CAAC,CAAC,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,CAAC,EAAE,CAAC,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,CAAC,CAAC,CAAC;IACvH,OAAO,SAAS,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,GAAG,CAAC;AACjC,CAAC"}
|
package/dist/plots.d.ts
CHANGED
|
@@ -1,7 +1,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,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