@biolibs/bionet-space 0.0.0-stage → 0.2.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/README.md +64 -2
- package/dist/arrange.d.ts +81 -0
- package/dist/arrange.d.ts.map +1 -0
- package/dist/arrange.js +243 -0
- package/dist/arrange.js.map +1 -0
- package/dist/example.d.ts +29 -0
- package/dist/example.d.ts.map +1 -0
- package/dist/example.js +81 -0
- package/dist/example.js.map +1 -0
- package/dist/find.d.ts +65 -0
- package/dist/find.d.ts.map +1 -0
- package/dist/find.js +102 -0
- package/dist/find.js.map +1 -0
- package/dist/from.d.ts +81 -0
- package/dist/from.d.ts.map +1 -0
- package/dist/from.js +65 -0
- package/dist/from.js.map +1 -0
- package/dist/index.d.ts +24 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +24 -0
- package/dist/index.js.map +1 -0
- package/dist/model.d.ts +101 -0
- package/dist/model.d.ts.map +1 -0
- package/dist/model.js +17 -0
- package/dist/model.js.map +1 -0
- package/package.json +41 -4
- package/src/arrange.ts +263 -0
- package/src/example.ts +95 -0
- package/src/find.ts +123 -0
- package/src/from.ts +105 -0
- package/src/index.ts +23 -0
- package/src/model.ts +105 -0
package/dist/find.js
ADDED
|
@@ -0,0 +1,102 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* How close a look at a place is.
|
|
3
|
+
*
|
|
4
|
+
* @param arranged - The place, or `null` for the whole lab.
|
|
5
|
+
* @returns `lab` for everything, `room` for a room, `unit` for whatever stands in a room (a freezer, a
|
|
6
|
+
* bench, an instrument), `box` for a place with positions, and `inside` for anything between.
|
|
7
|
+
*/
|
|
8
|
+
export function levelOf(arranged) {
|
|
9
|
+
if (arranged === null)
|
|
10
|
+
return "lab";
|
|
11
|
+
if (arranged.place.grid !== undefined)
|
|
12
|
+
return "box";
|
|
13
|
+
if (arranged.path.length === 1)
|
|
14
|
+
return "room";
|
|
15
|
+
if (arranged.path.length === 2)
|
|
16
|
+
return "unit";
|
|
17
|
+
return "inside";
|
|
18
|
+
}
|
|
19
|
+
/**
|
|
20
|
+
* The space some places take up together.
|
|
21
|
+
*
|
|
22
|
+
* @param places - The places.
|
|
23
|
+
* @returns The smallest box around all of them, or `null` if there are none.
|
|
24
|
+
*/
|
|
25
|
+
export function boundsOf(places) {
|
|
26
|
+
if (places.length === 0)
|
|
27
|
+
return null;
|
|
28
|
+
const low = [Infinity, Infinity, Infinity];
|
|
29
|
+
const high = [-Infinity, -Infinity, -Infinity];
|
|
30
|
+
for (const { center, size } of places) {
|
|
31
|
+
for (let axis = 0; axis < 3; axis++) {
|
|
32
|
+
low[axis] = Math.min(low[axis], center[axis] - size[axis] / 2);
|
|
33
|
+
high[axis] = Math.max(high[axis], center[axis] + size[axis] / 2);
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
return {
|
|
37
|
+
center: [(low[0] + high[0]) / 2, (low[1] + high[1]) / 2, (low[2] + high[2]) / 2],
|
|
38
|
+
size: [high[0] - low[0], high[1] - low[1], high[2] - low[2]],
|
|
39
|
+
};
|
|
40
|
+
}
|
|
41
|
+
/** Which way to look from, by level, for something facing front: across, up, towards the viewer. */
|
|
42
|
+
const FROM = {
|
|
43
|
+
lab: [0.45, 0.62, 1],
|
|
44
|
+
room: [0.4, 0.6, 1],
|
|
45
|
+
unit: [0.42, 0.28, 1],
|
|
46
|
+
inside: [0.3, 0.2, 1],
|
|
47
|
+
box: [0, 1, 0.42],
|
|
48
|
+
};
|
|
49
|
+
/**
|
|
50
|
+
* Where a camera should stand to see a place whole.
|
|
51
|
+
*
|
|
52
|
+
* It looks from in front and a little above, closer the smaller the thing is, and from nearly
|
|
53
|
+
* straight above for a box, since a box is read like a page. A place that is turned is looked at
|
|
54
|
+
* from its own front.
|
|
55
|
+
*
|
|
56
|
+
* @param arranged - Every place, arranged.
|
|
57
|
+
* @param id - The place to look at, or `null` for the whole lab.
|
|
58
|
+
* @param fov - The camera's vertical field of view, in degrees.
|
|
59
|
+
* @returns Where to stand and what to look at.
|
|
60
|
+
*/
|
|
61
|
+
export function poseFor(arranged, id, fov = 45) {
|
|
62
|
+
const one = id === null ? null : arranged.find((each) => each.place.id === id) ?? null;
|
|
63
|
+
const bounds = one ?? boundsOf(arranged.filter((each) => each.place.parent === null)) ?? { center: [0, 0, 0], size: [4, 3, 4] };
|
|
64
|
+
const level = levelOf(one);
|
|
65
|
+
const [x, y, z] = FROM[level];
|
|
66
|
+
// Turn the direction with the place, so a freezer facing a side wall is still seen from its front.
|
|
67
|
+
const turn = one?.turn ?? 0;
|
|
68
|
+
const [dx, dz] = turn === 90 ? [-z, x] : turn === 180 ? [-x, -z] : turn === 270 ? [z, -x] : [x, z];
|
|
69
|
+
const length = Math.hypot(dx, y, dz);
|
|
70
|
+
const reach = Math.max(bounds.size[0], bounds.size[1], bounds.size[2]);
|
|
71
|
+
const distance = (reach * (level === "lab" || level === "room" ? 0.68 : level === "box" ? 1.25 : 1.0)) / Math.tan((fov * Math.PI) / 360);
|
|
72
|
+
return {
|
|
73
|
+
target: [...bounds.center],
|
|
74
|
+
position: [bounds.center[0] + (dx / length) * distance, bounds.center[1] + (y / length) * distance, bounds.center[2] + (dz / length) * distance],
|
|
75
|
+
};
|
|
76
|
+
}
|
|
77
|
+
/**
|
|
78
|
+
* Everything stored in a place or in anything inside it.
|
|
79
|
+
*
|
|
80
|
+
* @param layout - The lab.
|
|
81
|
+
* @param arranged - Its places, arranged.
|
|
82
|
+
* @param id - The place.
|
|
83
|
+
* @returns What is stored there, however deep.
|
|
84
|
+
*/
|
|
85
|
+
export function storedWithin(layout, arranged, id) {
|
|
86
|
+
const inside = new Set(arranged.filter((one) => one.path.includes(id)).map((one) => one.place.id));
|
|
87
|
+
return layout.stored.filter((one) => inside.has(one.place));
|
|
88
|
+
}
|
|
89
|
+
/**
|
|
90
|
+
* Search what is stored, by the name of the part.
|
|
91
|
+
*
|
|
92
|
+
* @param layout - The lab.
|
|
93
|
+
* @param words - What was typed. Case does not matter, and every word has to appear.
|
|
94
|
+
* @returns What matched, in the order it is stored. Nothing, if nothing was typed.
|
|
95
|
+
*/
|
|
96
|
+
export function search(layout, words) {
|
|
97
|
+
const wanted = words.toLowerCase().split(/\s+/).filter((word) => word !== "");
|
|
98
|
+
if (wanted.length === 0)
|
|
99
|
+
return [];
|
|
100
|
+
return layout.stored.filter((one) => wanted.every((word) => one.name.toLowerCase().includes(word)));
|
|
101
|
+
}
|
|
102
|
+
//# sourceMappingURL=find.js.map
|
package/dist/find.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"find.js","sourceRoot":"","sources":["../src/find.ts"],"names":[],"mappings":"AASA;;;;;;GAMG;AACH,MAAM,UAAU,OAAO,CAAC,QAAyB;IAC/C,IAAI,QAAQ,KAAK,IAAI;QAAE,OAAO,KAAK,CAAC;IACpC,IAAI,QAAQ,CAAC,KAAK,CAAC,IAAI,KAAK,SAAS;QAAE,OAAO,KAAK,CAAC;IACpD,IAAI,QAAQ,CAAC,IAAI,CAAC,MAAM,KAAK,CAAC;QAAE,OAAO,MAAM,CAAC;IAC9C,IAAI,QAAQ,CAAC,IAAI,CAAC,MAAM,KAAK,CAAC;QAAE,OAAO,MAAM,CAAC;IAC9C,OAAO,QAAQ,CAAC;AAClB,CAAC;AAQD;;;;;GAKG;AACH,MAAM,UAAU,QAAQ,CAAC,MAAoD;IAC3E,IAAI,MAAM,CAAC,MAAM,KAAK,CAAC;QAAE,OAAO,IAAI,CAAC;IACrC,MAAM,GAAG,GAAG,CAAC,QAAQ,EAAE,QAAQ,EAAE,QAAQ,CAAC,CAAC;IAC3C,MAAM,IAAI,GAAG,CAAC,CAAC,QAAQ,EAAE,CAAC,QAAQ,EAAE,CAAC,QAAQ,CAAC,CAAC;IAC/C,KAAK,MAAM,EAAE,MAAM,EAAE,IAAI,EAAE,IAAI,MAAM,EAAE,CAAC;QACtC,KAAK,IAAI,IAAI,GAAG,CAAC,EAAE,IAAI,GAAG,CAAC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G,CAAC,KAAK,CAAC,EAAE,CAAC,CAAC,CAAC;IACnG,OAAO,MAAM,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,MAAM,CAAC,GAAG,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC,CAAC;AAC9D,CAAC;AAED;;;;;;GAMG;AACH,MAAM,UAAU,MAAM,CAAC,MAA8B,EAAE,KAAa;IAClE,MAAM,MAAM,GAAG,KAAK,CAAC,WAAW,EAAE,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC,MAAM,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,KAAK,EAAE,CAAC,CAAC;IAC9E,IAAI,MAAM,CAAC,MAAM,KAAK,CAAC;QAAE,OAAO,EAAE,CAAC;IACnC,OAAO,MAAM,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,GAAG,CAAC,IAAI,CAAC,WAAW,EAAE,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;AACtG,CAAC"}
|
package/dist/from.d.ts
ADDED
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* A layout made from a lab's own record of itself.
|
|
3
|
+
*
|
|
4
|
+
* A lab's signed log says what places it has, which is inside which, and where each item was put.
|
|
5
|
+
* This turns that into a `Layout`. It asks for the lab structurally, by the few fields it reads, so
|
|
6
|
+
* this package still depends on nothing: `@biolibs/bionet`'s lab state fits, and so does anything
|
|
7
|
+
* else shaped like it.
|
|
8
|
+
*/
|
|
9
|
+
import type { Layout } from "./model.js";
|
|
10
|
+
/** A place, as a lab records it. Lengths are whole millimetres. */
|
|
11
|
+
export interface RecordedPlace {
|
|
12
|
+
place: string;
|
|
13
|
+
kind: string;
|
|
14
|
+
name: string;
|
|
15
|
+
parent: string | null;
|
|
16
|
+
grid: {
|
|
17
|
+
rows: number;
|
|
18
|
+
columns: number;
|
|
19
|
+
} | null;
|
|
20
|
+
standing: {
|
|
21
|
+
at: readonly number[];
|
|
22
|
+
size: readonly number[];
|
|
23
|
+
turn: number;
|
|
24
|
+
} | null;
|
|
25
|
+
retired: boolean;
|
|
26
|
+
fields?: Readonly<Record<string, string | number | null>>;
|
|
27
|
+
}
|
|
28
|
+
/** An item, as a lab records it. */
|
|
29
|
+
export interface RecordedItem {
|
|
30
|
+
item: string;
|
|
31
|
+
part: string;
|
|
32
|
+
unit: string | null;
|
|
33
|
+
amount: number;
|
|
34
|
+
retired: boolean;
|
|
35
|
+
needsRecount: boolean;
|
|
36
|
+
where: {
|
|
37
|
+
place: string;
|
|
38
|
+
slot: {
|
|
39
|
+
row: number;
|
|
40
|
+
column: number;
|
|
41
|
+
} | null;
|
|
42
|
+
} | null;
|
|
43
|
+
}
|
|
44
|
+
/** As much of a lab as a layout is made from. */
|
|
45
|
+
export interface RecordedLab {
|
|
46
|
+
places: readonly RecordedPlace[];
|
|
47
|
+
items: readonly RecordedItem[];
|
|
48
|
+
parts: readonly {
|
|
49
|
+
checksum: string;
|
|
50
|
+
name: string;
|
|
51
|
+
}[];
|
|
52
|
+
}
|
|
53
|
+
/** The ID of the room that is made up when a lab has places standing in no room. */
|
|
54
|
+
export declare const UNNAMED_ROOM = "~room";
|
|
55
|
+
/**
|
|
56
|
+
* Make a layout from a lab.
|
|
57
|
+
*
|
|
58
|
+
* Retired places are left out, with everything in them. Items that have been retired, or that
|
|
59
|
+
* nobody has put anywhere, are left out too: a layout is of what can be found. A place that stands
|
|
60
|
+
* in no room is put in one made up for the purpose, so that a lab which has only said "there is a
|
|
61
|
+
* freezer" can still be drawn.
|
|
62
|
+
*
|
|
63
|
+
* @param lab - The lab's places, items and parts.
|
|
64
|
+
* @param options - `room` is what to call the room that is made up if one is needed.
|
|
65
|
+
* @returns The layout.
|
|
66
|
+
*
|
|
67
|
+
* @example
|
|
68
|
+
* ```ts
|
|
69
|
+
* import { layoutFrom } from "@biolibs/bionet-space";
|
|
70
|
+
*
|
|
71
|
+
* const layout = layoutFrom({
|
|
72
|
+
* places: [{ place: "f", kind: "freezer", name: "−80", parent: null, grid: null, standing: null, retired: false }],
|
|
73
|
+
* items: [], parts: [],
|
|
74
|
+
* });
|
|
75
|
+
* layout.places.map((one) => [one.id, one.parent]); // [ [ "~room", null ], [ "f", "~room" ] ]
|
|
76
|
+
* ```
|
|
77
|
+
*/
|
|
78
|
+
export declare function layoutFrom(lab: RecordedLab, options?: {
|
|
79
|
+
room?: string;
|
|
80
|
+
}): Layout;
|
|
81
|
+
//# sourceMappingURL=from.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"from.d.ts","sourceRoot":"","sources":["../src/from.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AACH,OAAO,KAAK,EAAE,MAAM,EAAuB,MAAM,YAAY,CAAC;AAE9D,mEAAmE;AACnE,MAAM,WAAW,aAAa;IAC5B,KAAK,EAAE,MAAM,CAAC;IACd,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;IACb,MAAM,EAAE,MAAM,GAAG,IAAI,CAAC;IACtB,IAAI,EAAE;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,OAAO,EAAE,MAAM,CAAA;KAAE,GAAG,IAAI,CAAC;IAC/C,QAAQ,EAAE;QAAE,EAAE,EAAE,SAAS,MAAM,EAAE,CAAC;QAAC,IAAI,EAAE,SAAS,MAAM,EAAE,CAAC;QAAC,IAAI,EAAE,MAAM,CAAA;KAAE,GAAG,IAAI,CAAC;IAClF,OAAO,EAAE,OAAO,CAAC;IACjB,MAAM,CAAC,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,CAAC,CAAC,CAAC;CAC3D;AAED,oCAAoC;AACpC,MAAM,WAAW,YAAY;IAC3B,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,GAAG,IAAI,CAAC;IACpB,MAAM,EAAE,MAAM,CAAC;IACf,OAAO,EAAE,OAAO,CAAC;IACjB,YAAY,EAAE,OAAO,CAAC;IACtB,KAAK,EAAE;QAAE,KAAK,EAAE,MAAM,CAAC;QAAC,IAAI,EAAE;YAAE,GAAG,EAAE,MAAM,CAAC;YAAC,MAAM,EAAE,MAAM,CAAA;SAAE,GAAG,IAAI,CAAA;KAAE,GAAG,IAAI,CAAC;CAC/E;AAED,iDAAiD;AACjD,MAAM,WAAW,WAAW;IAC1B,MAAM,EAAE,SAAS,aAAa,EAAE,CAAC;IACjC,KAAK,EAAE,SAAS,YAAY,EAAE,CAAC;IAC/B,KAAK,EAAE,SAAS;QAAE,QAAQ,EAAE,MAAM,CAAC;QAAC,IAAI,EAAE,MAAM,CAAA;KAAE,EAAE,CAAC;CACtD;AAED,oFAAoF;AACpF,eAAO,MAAM,YAAY,UAAU,CAAC;AAIpC;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACH,wBAAgB,UAAU,CAAC,GAAG,EAAE,WAAW,EAAE,OAAO,GAAE;IAAE,IAAI,CAAC,EAAE,MAAM,CAAA;CAAO,GAAG,MAAM,CAoCpF"}
|
package/dist/from.js
ADDED
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
/** The ID of the room that is made up when a lab has places standing in no room. */
|
|
2
|
+
export const UNNAMED_ROOM = "~room";
|
|
3
|
+
const metres = (list) => [list[0] / 1000, list[1] / 1000, list[2] / 1000];
|
|
4
|
+
/**
|
|
5
|
+
* Make a layout from a lab.
|
|
6
|
+
*
|
|
7
|
+
* Retired places are left out, with everything in them. Items that have been retired, or that
|
|
8
|
+
* nobody has put anywhere, are left out too: a layout is of what can be found. A place that stands
|
|
9
|
+
* in no room is put in one made up for the purpose, so that a lab which has only said "there is a
|
|
10
|
+
* freezer" can still be drawn.
|
|
11
|
+
*
|
|
12
|
+
* @param lab - The lab's places, items and parts.
|
|
13
|
+
* @param options - `room` is what to call the room that is made up if one is needed.
|
|
14
|
+
* @returns The layout.
|
|
15
|
+
*
|
|
16
|
+
* @example
|
|
17
|
+
* ```ts
|
|
18
|
+
* import { layoutFrom } from "@biolibs/bionet-space";
|
|
19
|
+
*
|
|
20
|
+
* const layout = layoutFrom({
|
|
21
|
+
* places: [{ place: "f", kind: "freezer", name: "−80", parent: null, grid: null, standing: null, retired: false }],
|
|
22
|
+
* items: [], parts: [],
|
|
23
|
+
* });
|
|
24
|
+
* layout.places.map((one) => [one.id, one.parent]); // [ [ "~room", null ], [ "f", "~room" ] ]
|
|
25
|
+
* ```
|
|
26
|
+
*/
|
|
27
|
+
export function layoutFrom(lab, options = {}) {
|
|
28
|
+
const byId = new Map(lab.places.map((one) => [one.place, one]));
|
|
29
|
+
/** Whether a place, and everything it is inside, is still in use. */
|
|
30
|
+
const kept = (id) => {
|
|
31
|
+
const passed = new Set();
|
|
32
|
+
for (let at = id; at !== null; at = byId.get(at).parent) {
|
|
33
|
+
const one = byId.get(at);
|
|
34
|
+
if (one === undefined || one.retired || passed.has(at))
|
|
35
|
+
return false;
|
|
36
|
+
passed.add(at);
|
|
37
|
+
}
|
|
38
|
+
return true;
|
|
39
|
+
};
|
|
40
|
+
const loose = lab.places.some((one) => one.parent === null && one.kind !== "room" && kept(one.place));
|
|
41
|
+
const places = loose ? [{ id: UNNAMED_ROOM, kind: "room", name: options.room ?? "Lab", parent: null }] : [];
|
|
42
|
+
for (const one of lab.places) {
|
|
43
|
+
if (!kept(one.place))
|
|
44
|
+
continue;
|
|
45
|
+
const model = one.fields?.["model"];
|
|
46
|
+
places.push({
|
|
47
|
+
id: one.place, kind: one.kind, name: one.name,
|
|
48
|
+
parent: one.parent ?? (one.kind === "room" ? null : UNNAMED_ROOM),
|
|
49
|
+
...(one.standing === null ? {} : { standing: { position: metres(one.standing.at), size: metres(one.standing.size), turn: one.standing.turn } }),
|
|
50
|
+
...(one.grid === null ? {} : { grid: { rows: one.grid.rows, columns: one.grid.columns } }),
|
|
51
|
+
...(typeof model === "string" ? { model } : {}),
|
|
52
|
+
});
|
|
53
|
+
}
|
|
54
|
+
const names = new Map(lab.parts.map((part) => [part.checksum, part.name]));
|
|
55
|
+
const stored = [];
|
|
56
|
+
for (const item of lab.items) {
|
|
57
|
+
if (item.retired || item.where === null || !byId.has(item.where.place) || !kept(item.where.place))
|
|
58
|
+
continue;
|
|
59
|
+
stored.push({ item: item.item, place: item.where.place, slot: item.where.slot, part: item.part,
|
|
60
|
+
name: names.get(item.part) ?? "A part the lab no longer lists", amount: item.amount, unit: item.unit,
|
|
61
|
+
needsRecount: item.needsRecount });
|
|
62
|
+
}
|
|
63
|
+
return { places, stored };
|
|
64
|
+
}
|
|
65
|
+
//# sourceMappingURL=from.js.map
|
package/dist/from.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"from.js","sourceRoot":"","sources":["../src/from.ts"],"names":[],"mappings":"AAwCA,oFAAoF;AACpF,MAAM,CAAC,MAAM,YAAY,GAAG,OAAO,CAAC;AAEpC,MAAM,MAAM,GAAG,CAAC,IAAuB,EAA4B,EAAE,CAAC,CAAC,IAAI,CAAC,CAAC,CAAE,GAAG,IAAI,EAAE,IAAI,CAAC,CAAC,CAAE,GAAG,IAAI,EAAE,IAAI,CAAC,CAAC,CAAE,GAAG,IAAI,CAAC,CAAC;AAE1H;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACH,MAAM,UAAU,UAAU,CAAC,GAAgB,EAAE,UAA6B,EAAE;IAC1E,MAAM,IAAI,GAAG,IAAI,GAAG,CAAC,GAAG,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,CAAC,GAAG,CAAC,KAAK,EAAE,GAAG,CAAC,CAAC,CAAC,CAAC;IAChE,qEAAqE;IACrE,MAAM,IAAI,GAAG,CAAC,EAAU,EAAW,EAAE;QACnC,MAAM,MAAM,GAAG,IAAI,GAAG,EAAU,CAAC;QACjC,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KAAK,CAAC;YAAE,SAAS;QAC5G,MAAM,CAAC,IAAI,CAAC,EAAE,IAAI,EAAE,IAAI,CAAC,IAAI,EAAE,KAAK,EAAE,IAAI,CAAC,KAAK,CAAC,KAAK,EAAE,IAAI,EAAE,IAAI,CAAC,KAAK,CAAC,IAAI,EAAE,IAAI,EAAE,IAAI,CAAC,IAAI;YAChF,IAAI,EAAE,KAAK,CAAC,GAAG,CAAC,IAAI,CAAC,IAAI,CAAC,IAAI,gCAAgC,EAAE,MAAM,EAAE,IAAI,CAAC,MAAM,EAAE,IAAI,EAAE,IAAI,CAAC,IAAI;YACpG,YAAY,EAAE,IAAI,CAAC,YAAY,EAAE,CAAC,CAAC;IACnD,CAAC;IACD,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,CAAC;AAC5B,CAAC"}
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @packageDocumentation
|
|
3
|
+
* `@biolibs/bionet-space`: where things are in a lab.
|
|
4
|
+
*
|
|
5
|
+
* A lab is a tree of places with things stored at the ends of it. This package says what that tree
|
|
6
|
+
* is, gives every place somewhere to stand, and answers the questions a view of a lab asks: what is
|
|
7
|
+
* inside what, where a position in a box is, what a search turns up, where a camera should look.
|
|
8
|
+
*
|
|
9
|
+
* It draws nothing and depends on nothing. It is the contract between whatever knows what a lab
|
|
10
|
+
* holds and whatever shows it, so a 3D scene, a flat grid of a box and a list can all be views of
|
|
11
|
+
* the same data.
|
|
12
|
+
*
|
|
13
|
+
* - `model.ts` — places, what is stored in them, and a place with somewhere to stand
|
|
14
|
+
* - `arrange.ts` — giving every place somewhere to stand, and the positions inside a box
|
|
15
|
+
* - `find.ts` — levels, bounds, camera poses, searching
|
|
16
|
+
* - `from.ts` — a layout made from a lab's own record of itself
|
|
17
|
+
* - `example.ts` — a lab to look at
|
|
18
|
+
*/
|
|
19
|
+
export * from "./model.js";
|
|
20
|
+
export * from "./arrange.js";
|
|
21
|
+
export * from "./find.js";
|
|
22
|
+
export * from "./example.js";
|
|
23
|
+
export * from "./from.js";
|
|
24
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;GAiBG;AACH,cAAc,YAAY,CAAC;AAC3B,cAAc,cAAc,CAAC;AAC7B,cAAc,WAAW,CAAC;AAC1B,cAAc,cAAc,CAAC;AAC7B,cAAc,WAAW,CAAC"}
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @packageDocumentation
|
|
3
|
+
* `@biolibs/bionet-space`: where things are in a lab.
|
|
4
|
+
*
|
|
5
|
+
* A lab is a tree of places with things stored at the ends of it. This package says what that tree
|
|
6
|
+
* is, gives every place somewhere to stand, and answers the questions a view of a lab asks: what is
|
|
7
|
+
* inside what, where a position in a box is, what a search turns up, where a camera should look.
|
|
8
|
+
*
|
|
9
|
+
* It draws nothing and depends on nothing. It is the contract between whatever knows what a lab
|
|
10
|
+
* holds and whatever shows it, so a 3D scene, a flat grid of a box and a list can all be views of
|
|
11
|
+
* the same data.
|
|
12
|
+
*
|
|
13
|
+
* - `model.ts` — places, what is stored in them, and a place with somewhere to stand
|
|
14
|
+
* - `arrange.ts` — giving every place somewhere to stand, and the positions inside a box
|
|
15
|
+
* - `find.ts` — levels, bounds, camera poses, searching
|
|
16
|
+
* - `from.ts` — a layout made from a lab's own record of itself
|
|
17
|
+
* - `example.ts` — a lab to look at
|
|
18
|
+
*/
|
|
19
|
+
export * from "./model.js";
|
|
20
|
+
export * from "./arrange.js";
|
|
21
|
+
export * from "./find.js";
|
|
22
|
+
export * from "./example.js";
|
|
23
|
+
export * from "./from.js";
|
|
24
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;GAiBG;AACH,cAAc,YAAY,CAAC;AAC3B,cAAc,cAAc,CAAC;AAC7B,cAAc,WAAW,CAAC;AAC1B,cAAc,cAAc,CAAC;AAC7B,cAAc,WAAW,CAAC"}
|
package/dist/model.d.ts
ADDED
|
@@ -0,0 +1,101 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* What a lab is made of, as far as finding things goes: places, and what is stored in them.
|
|
3
|
+
*
|
|
4
|
+
* A lab is a tree of places. A room holds a freezer, which holds shelves, which hold racks, which
|
|
5
|
+
* hold boxes. Nothing here says a tree must have those levels: a place has a kind and a parent, and
|
|
6
|
+
* that is all a place has to have. A liquid nitrogen dewar with canes in it is as much a lab as a
|
|
7
|
+
* freezer with racks.
|
|
8
|
+
*
|
|
9
|
+
* **Where a place is in the tree is required. Where it stands in the room is not.** A lab can say
|
|
10
|
+
* "this tube is in box 3, rack B, the −80" without anybody drawing a floor plan, and `arrange` will
|
|
11
|
+
* give every place somewhere sensible to stand. A place that does say where it stands is put there.
|
|
12
|
+
*
|
|
13
|
+
* Everything is plain data, so it can be made from signed entries, sent to another process, or
|
|
14
|
+
* written by hand.
|
|
15
|
+
*/
|
|
16
|
+
/**
|
|
17
|
+
* The kinds of place this package knows how to arrange. Any other string is allowed and is treated
|
|
18
|
+
* as a plain container.
|
|
19
|
+
*/
|
|
20
|
+
export type PlaceKind = "room" | "freezer" | "fridge" | "bench" | "instrument" | "shelf" | "rack" | "box";
|
|
21
|
+
/** A quarter turn clockwise, seen from above. */
|
|
22
|
+
export type Turn = 0 | 90 | 180 | 270;
|
|
23
|
+
/** Where a place stands and how big it is, in metres. */
|
|
24
|
+
export interface Standing {
|
|
25
|
+
/**
|
|
26
|
+
* The centre of its base, measured from the centre of its parent's base: across (x), up (y) and
|
|
27
|
+
* towards the front (z). A room has no parent and is measured from the lab's origin.
|
|
28
|
+
*/
|
|
29
|
+
position: [number, number, number];
|
|
30
|
+
/** How wide (x), tall (y) and deep (z) it is, before it is turned. */
|
|
31
|
+
size: [number, number, number];
|
|
32
|
+
/** How far it is turned. Its front faces +z when it is not turned at all. */
|
|
33
|
+
turn?: Turn;
|
|
34
|
+
}
|
|
35
|
+
/** One place. */
|
|
36
|
+
export interface Place {
|
|
37
|
+
/** Its ID, which never changes. */
|
|
38
|
+
id: string;
|
|
39
|
+
/** What kind of place it is. One of `PlaceKind`, or anything else. */
|
|
40
|
+
kind: string;
|
|
41
|
+
/** What the lab calls it. */
|
|
42
|
+
name: string;
|
|
43
|
+
/** The place it is in, or `null` for a room. */
|
|
44
|
+
parent: string | null;
|
|
45
|
+
/** Where it stands, if anybody has said. Otherwise `arrange` decides. */
|
|
46
|
+
standing?: Standing;
|
|
47
|
+
/** For a box: how many rows and columns of positions it has. */
|
|
48
|
+
grid?: {
|
|
49
|
+
rows: number;
|
|
50
|
+
columns: number;
|
|
51
|
+
};
|
|
52
|
+
/** For an instrument: which one, like `thermocycler`. */
|
|
53
|
+
model?: string;
|
|
54
|
+
}
|
|
55
|
+
/** One position in a box. Rows and columns count from 0, from the back left. */
|
|
56
|
+
export interface Slot {
|
|
57
|
+
row: number;
|
|
58
|
+
column: number;
|
|
59
|
+
}
|
|
60
|
+
/** One physical item, and where it is. */
|
|
61
|
+
export interface Stored {
|
|
62
|
+
/** The item's ID. */
|
|
63
|
+
item: string;
|
|
64
|
+
/** The place it is in. */
|
|
65
|
+
place: string;
|
|
66
|
+
/** Its position there, if the place has positions and somebody said which. */
|
|
67
|
+
slot?: Slot | null;
|
|
68
|
+
/** The checksum of the part it is an item of. */
|
|
69
|
+
part: string;
|
|
70
|
+
/** What the part is called. */
|
|
71
|
+
name: string;
|
|
72
|
+
/** How much there is. */
|
|
73
|
+
amount: number;
|
|
74
|
+
/** What one of that is. */
|
|
75
|
+
unit: string | null;
|
|
76
|
+
/** Whether the log has lost track of it and it needs counting. */
|
|
77
|
+
needsRecount?: boolean;
|
|
78
|
+
}
|
|
79
|
+
/** A lab, as far as finding things goes. */
|
|
80
|
+
export interface Layout {
|
|
81
|
+
/** Every place. */
|
|
82
|
+
places: Place[];
|
|
83
|
+
/** Everything stored, and where. */
|
|
84
|
+
stored: Stored[];
|
|
85
|
+
}
|
|
86
|
+
/** A place with somewhere to stand worked out, in the lab's own coordinates. */
|
|
87
|
+
export interface Arranged {
|
|
88
|
+
/** The place. */
|
|
89
|
+
place: Place;
|
|
90
|
+
/** The centre of the space it takes up, in metres from the lab's origin. */
|
|
91
|
+
center: [number, number, number];
|
|
92
|
+
/** How wide (x), tall (y) and deep (z) that space is, after any turning. */
|
|
93
|
+
size: [number, number, number];
|
|
94
|
+
/** How far it is turned in all, counting everything it is inside. */
|
|
95
|
+
turn: Turn;
|
|
96
|
+
/** Every place it is inside, outermost first, ending with itself. */
|
|
97
|
+
path: string[];
|
|
98
|
+
/** Whether anybody said where it stands, or `arrange` chose. */
|
|
99
|
+
placed: "by hand" | "by default";
|
|
100
|
+
}
|
|
101
|
+
//# sourceMappingURL=model.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"model.d.ts","sourceRoot":"","sources":["../src/model.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH;;;GAGG;AACH,MAAM,MAAM,SAAS,GAAG,MAAM,GAAG,SAAS,GAAG,QAAQ,GAAG,OAAO,GAAG,YAAY,GAAG,OAAO,GAAG,MAAM,GAAG,KAAK,CAAC;AAE1G,iDAAiD;AACjD,MAAM,MAAM,IAAI,GAAG,CAAC,GAAG,EAAE,GAAG,GAAG,GAAG,GAAG,CAAC;AAEtC,yDAAyD;AACzD,MAAM,WAAW,QAAQ;IACvB;;;OAGG;IACH,QAAQ,EAAE,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,CAAC,CAAC;IACnC,sEAAsE;IACtE,IAAI,EAAE,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,CAAC,CAAC;IAC/B,6EAA6E;IAC7E,IA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,KAAK,CAAC;IACb,4EAA4E;IAC5E,MAAM,EAAE,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,CAAC,CAAC;IACjC,4EAA4E;IAC5E,IAAI,EAAE,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,CAAC,CAAC;IAC/B,qEAAqE;IACrE,IAAI,EAAE,IAAI,CAAC;IACX,qEAAqE;IACrE,IAAI,EAAE,MAAM,EAAE,CAAC;IACf,gEAAgE;IAChE,MAAM,EAAE,SAAS,GAAG,YAAY,CAAC;CAClC"}
|
package/dist/model.js
ADDED
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* What a lab is made of, as far as finding things goes: places, and what is stored in them.
|
|
3
|
+
*
|
|
4
|
+
* A lab is a tree of places. A room holds a freezer, which holds shelves, which hold racks, which
|
|
5
|
+
* hold boxes. Nothing here says a tree must have those levels: a place has a kind and a parent, and
|
|
6
|
+
* that is all a place has to have. A liquid nitrogen dewar with canes in it is as much a lab as a
|
|
7
|
+
* freezer with racks.
|
|
8
|
+
*
|
|
9
|
+
* **Where a place is in the tree is required. Where it stands in the room is not.** A lab can say
|
|
10
|
+
* "this tube is in box 3, rack B, the −80" without anybody drawing a floor plan, and `arrange` will
|
|
11
|
+
* give every place somewhere sensible to stand. A place that does say where it stands is put there.
|
|
12
|
+
*
|
|
13
|
+
* Everything is plain data, so it can be made from signed entries, sent to another process, or
|
|
14
|
+
* written by hand.
|
|
15
|
+
*/
|
|
16
|
+
export {};
|
|
17
|
+
//# sourceMappingURL=model.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"model.js","sourceRoot":"","sources":["../src/model.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,43 @@
|
|
|
1
1
|
{
|
|
2
|
+
"bugs": {
|
|
3
|
+
"url": "https://github.com/matthewlovestocode/biolibs/issues"
|
|
4
|
+
},
|
|
5
|
+
"description": "Where things are in a lab: a tree of places, where each one stands and how big it is, the positions inside a box, and where a camera should look. Plain data and arithmetic, with nothing drawn",
|
|
6
|
+
"engines": {
|
|
7
|
+
"node": ">=20"
|
|
8
|
+
},
|
|
9
|
+
"exports": {
|
|
10
|
+
".": {
|
|
11
|
+
"types": "./dist/index.d.ts",
|
|
12
|
+
"default": "./dist/index.js"
|
|
13
|
+
}
|
|
14
|
+
},
|
|
15
|
+
"files": [
|
|
16
|
+
"dist",
|
|
17
|
+
"src"
|
|
18
|
+
],
|
|
19
|
+
"homepage": "https://github.com/matthewlovestocode/biolibs/tree/main/packages/bionet-space#readme",
|
|
20
|
+
"keywords": [
|
|
21
|
+
"bionet",
|
|
22
|
+
"lab",
|
|
23
|
+
"layout",
|
|
24
|
+
"geometry",
|
|
25
|
+
"freezer",
|
|
26
|
+
"inventory",
|
|
27
|
+
"biology"
|
|
28
|
+
],
|
|
29
|
+
"license": "MIT",
|
|
30
|
+
"main": "dist/index.js",
|
|
2
31
|
"name": "@biolibs/bionet-space",
|
|
3
|
-
"
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
32
|
+
"publishConfig": {
|
|
33
|
+
"access": "public"
|
|
34
|
+
},
|
|
35
|
+
"repository": {
|
|
36
|
+
"type": "git",
|
|
37
|
+
"url": "git+https://github.com/matthewlovestocode/biolibs.git",
|
|
38
|
+
"directory": "packages/bionet-space"
|
|
39
|
+
},
|
|
40
|
+
"type": "module",
|
|
41
|
+
"types": "dist/index.d.ts",
|
|
42
|
+
"version": "0.2.0"
|
|
43
|
+
}
|