@packtrack/layout 1.0.4 → 1.0.6
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/.built/device/channel.js +1 -5
- package/.built/device/device.js +1 -5
- package/.built/{source/district.js → district.js} +3 -7
- package/.built/index.js +9 -0
- package/.built/{source/layout.js → layout.js} +25 -29
- package/.built/{source/position.js → position.js} +1 -5
- package/.built/positioner/index.js +1 -5
- package/.built/positioner/point.js +2 -6
- package/.built/positioner/responder-type.js +1 -5
- package/.built/{source/power-district.js → power-district.js} +1 -5
- package/.built/{source/route.js → route.js} +1 -5
- package/.built/{source/router.js → router.js} +1 -5
- package/.built/{source/section.js → section.js} +8 -12
- package/.built/{source/tile.js → tile.js} +2 -7
- package/.built/{source/track.js → track.js} +3 -7
- package/package.json +3 -2
- package/source/index.ts +9 -0
- package/source/layout.ts +2 -2
- package/{positioner → source/positioner}/point.ts +2 -2
- package/source/track.ts +1 -1
- package/tsconfig.json +7 -5
- package/.built/device/channel.d.ts +0 -8
- package/.built/device/device.d.ts +0 -11
- package/.built/positioner/index.d.ts +0 -2
- package/.built/positioner/point.d.ts +0 -13
- package/.built/positioner/responder-type.d.ts +0 -5
- package/.built/source/device/channel.d.ts +0 -8
- package/.built/source/device/channel.js +0 -16
- package/.built/source/device/device.d.ts +0 -11
- package/.built/source/device/device.js +0 -24
- package/.built/source/district.d.ts +0 -20
- package/.built/source/layout.d.ts +0 -29
- package/.built/source/position.d.ts +0 -10
- package/.built/source/power-district.d.ts +0 -8
- package/.built/source/route.d.ts +0 -10
- package/.built/source/router.d.ts +0 -14
- package/.built/source/section.d.ts +0 -40
- package/.built/source/tile.d.ts +0 -57
- package/.built/source/track.d.ts +0 -12
- package/index.ts +0 -9
- /package/{positioner → source/positioner}/index.ts +0 -0
- /package/{positioner → source/positioner}/responder-type.ts +0 -0
package/.built/device/channel.js
CHANGED
|
@@ -1,7 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.Channel = void 0;
|
|
4
|
-
class Channel {
|
|
1
|
+
export class Channel {
|
|
5
2
|
device;
|
|
6
3
|
name;
|
|
7
4
|
constructor(device, name) {
|
|
@@ -13,4 +10,3 @@ class Channel {
|
|
|
13
10
|
}
|
|
14
11
|
publish(data) { }
|
|
15
12
|
}
|
|
16
|
-
exports.Channel = Channel;
|
package/.built/device/device.js
CHANGED
|
@@ -1,7 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.Device = void 0;
|
|
4
|
-
class Device {
|
|
1
|
+
export class Device {
|
|
5
2
|
identifier;
|
|
6
3
|
channels = [];
|
|
7
4
|
lastDiscovery;
|
|
@@ -21,4 +18,3 @@ class Device {
|
|
|
21
18
|
console.groupEnd();
|
|
22
19
|
}
|
|
23
20
|
}
|
|
24
|
-
exports.Device = Device;
|
|
@@ -1,8 +1,5 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
exports.District = void 0;
|
|
4
|
-
const layout_1 = require("./layout");
|
|
5
|
-
class District {
|
|
1
|
+
import { Layout } from "./layout";
|
|
2
|
+
export class District {
|
|
6
3
|
name;
|
|
7
4
|
parent;
|
|
8
5
|
children = [];
|
|
@@ -14,7 +11,7 @@ class District {
|
|
|
14
11
|
this.parent = parent;
|
|
15
12
|
}
|
|
16
13
|
get domainName() {
|
|
17
|
-
if (this.parent instanceof
|
|
14
|
+
if (this.parent instanceof Layout) {
|
|
18
15
|
return `${this.name}.${this.parent.name}`;
|
|
19
16
|
}
|
|
20
17
|
return `${this.name}.${this.parent.domainName}`;
|
|
@@ -83,4 +80,3 @@ class District {
|
|
|
83
80
|
];
|
|
84
81
|
}
|
|
85
82
|
}
|
|
86
|
-
exports.District = District;
|
package/.built/index.js
ADDED
|
@@ -1,18 +1,15 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
const responder_type_1 = require("../positioner/responder-type");
|
|
14
|
-
const channel_1 = require("./device/channel");
|
|
15
|
-
class Layout {
|
|
1
|
+
import { District } from "./district";
|
|
2
|
+
import { PowerDistrict } from "./power-district";
|
|
3
|
+
import { Route } from "./route";
|
|
4
|
+
import { Router } from "./router";
|
|
5
|
+
import { Section } from "./section";
|
|
6
|
+
import { TilePattern, Tile } from "./tile";
|
|
7
|
+
import { Track } from "./track";
|
|
8
|
+
import { Device } from "./device/device";
|
|
9
|
+
import { ResponderType } from "./positioner/responder-type";
|
|
10
|
+
import { Channel } from "./device/channel";
|
|
11
|
+
import { PointPositioner } from "./positioner/point";
|
|
12
|
+
export class Layout {
|
|
16
13
|
name;
|
|
17
14
|
districts = [];
|
|
18
15
|
devices = [];
|
|
@@ -59,7 +56,7 @@ class Layout {
|
|
|
59
56
|
return layout;
|
|
60
57
|
}
|
|
61
58
|
loadDistrict(source, parent) {
|
|
62
|
-
const district = new
|
|
59
|
+
const district = new District(source.getAttribute('name'), parent);
|
|
63
60
|
let child = source.firstChild;
|
|
64
61
|
while (child) {
|
|
65
62
|
if (child.tagName == 'power-districts') {
|
|
@@ -104,7 +101,7 @@ class Layout {
|
|
|
104
101
|
}
|
|
105
102
|
}
|
|
106
103
|
loadSection(source, district) {
|
|
107
|
-
const section = new
|
|
104
|
+
const section = new Section(source.getAttribute('name'), district);
|
|
108
105
|
district.sections.push(section);
|
|
109
106
|
let child = source.firstChild;
|
|
110
107
|
while (child) {
|
|
@@ -112,7 +109,7 @@ class Layout {
|
|
|
112
109
|
let trackNode = child.firstChild;
|
|
113
110
|
while (trackNode) {
|
|
114
111
|
if (trackNode.tagName == 'track') {
|
|
115
|
-
const track = new
|
|
112
|
+
const track = new Track(section, +trackNode.getAttribute('length'), trackNode.getAttribute('path'));
|
|
116
113
|
section.tracks.push(track);
|
|
117
114
|
let trackChild = trackNode.firstChild;
|
|
118
115
|
while (trackChild) {
|
|
@@ -123,7 +120,7 @@ class Layout {
|
|
|
123
120
|
const device = this.findDevice(positioner.getAttribute('device'));
|
|
124
121
|
const channel = this.findChannel(device, positioner.getAttribute('channel'));
|
|
125
122
|
const responderType = this.findResponderType(positioner.getAttribute('responder'));
|
|
126
|
-
track.positioners.push(new
|
|
123
|
+
track.positioners.push(new PointPositioner(track, +positioner.getAttribute('offset'), channel, responderType));
|
|
127
124
|
}
|
|
128
125
|
positioner = positioner.nextSibling;
|
|
129
126
|
}
|
|
@@ -136,10 +133,10 @@ class Layout {
|
|
|
136
133
|
}
|
|
137
134
|
if (child.tagName == 'tile') {
|
|
138
135
|
const pattern = child.getAttribute('pattern');
|
|
139
|
-
if (!(pattern in
|
|
136
|
+
if (!(pattern in TilePattern.patterns)) {
|
|
140
137
|
throw new Error(`Unknown tile pattern '${pattern}' in tile ${section.tiles.length + 1} in ${section.domainName}`);
|
|
141
138
|
}
|
|
142
|
-
section.tiles.push(new
|
|
139
|
+
section.tiles.push(new Tile(section, +child.getAttribute('x'), +child.getAttribute('y'), TilePattern.patterns[pattern]));
|
|
143
140
|
}
|
|
144
141
|
child = child.nextSibling;
|
|
145
142
|
}
|
|
@@ -149,7 +146,7 @@ class Layout {
|
|
|
149
146
|
if (device) {
|
|
150
147
|
return device;
|
|
151
148
|
}
|
|
152
|
-
device = new
|
|
149
|
+
device = new Device(identifier);
|
|
153
150
|
this.devices.push(device);
|
|
154
151
|
return device;
|
|
155
152
|
}
|
|
@@ -158,7 +155,7 @@ class Layout {
|
|
|
158
155
|
if (channel) {
|
|
159
156
|
return channel;
|
|
160
157
|
}
|
|
161
|
-
channel = new
|
|
158
|
+
channel = new Channel(device, name);
|
|
162
159
|
device.channels.push(channel);
|
|
163
160
|
return channel;
|
|
164
161
|
}
|
|
@@ -167,7 +164,7 @@ class Layout {
|
|
|
167
164
|
if (type) {
|
|
168
165
|
return type;
|
|
169
166
|
}
|
|
170
|
-
type = new
|
|
167
|
+
type = new ResponderType(name);
|
|
171
168
|
this.responderType.push(type);
|
|
172
169
|
return type;
|
|
173
170
|
}
|
|
@@ -203,7 +200,7 @@ class Layout {
|
|
|
203
200
|
pool = pool.parent;
|
|
204
201
|
}
|
|
205
202
|
for (let part of parts) {
|
|
206
|
-
const child = (pool instanceof
|
|
203
|
+
const child = (pool instanceof District ? pool.children : pool.districts).find(child => child.name == part);
|
|
207
204
|
if (!child) {
|
|
208
205
|
throw new Error(`Section '${path}' could not be found from '${source.name}': district '${pool.name}' does not have a child named '${part}'`);
|
|
209
206
|
}
|
|
@@ -215,14 +212,14 @@ class Layout {
|
|
|
215
212
|
return this.findSection(sectionName, pool, source);
|
|
216
213
|
}
|
|
217
214
|
loadRouter(source, district) {
|
|
218
|
-
const router = new
|
|
215
|
+
const router = new Router(source.getAttribute('name'), district);
|
|
219
216
|
return router;
|
|
220
217
|
}
|
|
221
218
|
linkRouter(source, router) {
|
|
222
219
|
let child = source.firstChild;
|
|
223
220
|
while (child) {
|
|
224
221
|
if (child.tagName == 'route') {
|
|
225
|
-
const route = new
|
|
222
|
+
const route = new Route(child.getAttribute('name'), router);
|
|
226
223
|
route.in = this.findSection(child.getAttribute('in'), router.district);
|
|
227
224
|
route.in.out = router;
|
|
228
225
|
route.out = this.findSection(child.getAttribute('out'), router.district);
|
|
@@ -233,7 +230,7 @@ class Layout {
|
|
|
233
230
|
}
|
|
234
231
|
}
|
|
235
232
|
loadPowerDistrict(source, district) {
|
|
236
|
-
const powerDistrict = new
|
|
233
|
+
const powerDistrict = new PowerDistrict(source.getAttribute('name'), district);
|
|
237
234
|
return powerDistrict;
|
|
238
235
|
}
|
|
239
236
|
toDot() {
|
|
@@ -283,4 +280,3 @@ class Layout {
|
|
|
283
280
|
console.groupEnd();
|
|
284
281
|
}
|
|
285
282
|
}
|
|
286
|
-
exports.Layout = Layout;
|
|
@@ -1,7 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.SectionPosition = void 0;
|
|
4
|
-
class SectionPosition {
|
|
1
|
+
export class SectionPosition {
|
|
5
2
|
section;
|
|
6
3
|
offset;
|
|
7
4
|
reversed;
|
|
@@ -30,4 +27,3 @@ class SectionPosition {
|
|
|
30
27
|
return `${this.section.name} @ ${this.offset.toFixed(1)} ${this.reversed ? 'backward' : 'forward'}`;
|
|
31
28
|
}
|
|
32
29
|
}
|
|
33
|
-
exports.SectionPosition = SectionPosition;
|
|
@@ -1,8 +1,5 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
exports.PointPositioner = void 0;
|
|
4
|
-
const _1 = require(".");
|
|
5
|
-
class PointPositioner extends _1.Positioner {
|
|
1
|
+
import { Positioner } from ".";
|
|
2
|
+
export class PointPositioner extends Positioner {
|
|
6
3
|
track;
|
|
7
4
|
offset;
|
|
8
5
|
channel;
|
|
@@ -24,4 +21,3 @@ class PointPositioner extends _1.Positioner {
|
|
|
24
21
|
console.groupEnd();
|
|
25
22
|
}
|
|
26
23
|
}
|
|
27
|
-
exports.PointPositioner = PointPositioner;
|
|
@@ -1,7 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.ResponderType = void 0;
|
|
4
|
-
class ResponderType {
|
|
1
|
+
export class ResponderType {
|
|
5
2
|
name;
|
|
6
3
|
constructor(name) {
|
|
7
4
|
this.name = name;
|
|
@@ -10,4 +7,3 @@ class ResponderType {
|
|
|
10
7
|
console.log(`Responder Type '${this.name}'`);
|
|
11
8
|
}
|
|
12
9
|
}
|
|
13
|
-
exports.ResponderType = ResponderType;
|
|
@@ -1,7 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.PowerDistrict = void 0;
|
|
4
|
-
class PowerDistrict {
|
|
1
|
+
export class PowerDistrict {
|
|
5
2
|
name;
|
|
6
3
|
district;
|
|
7
4
|
constructor(name, district) {
|
|
@@ -15,4 +12,3 @@ class PowerDistrict {
|
|
|
15
12
|
console.log(this.name);
|
|
16
13
|
}
|
|
17
14
|
}
|
|
18
|
-
exports.PowerDistrict = PowerDistrict;
|
|
@@ -1,7 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.Route = void 0;
|
|
4
|
-
class Route {
|
|
1
|
+
export class Route {
|
|
5
2
|
name;
|
|
6
3
|
router;
|
|
7
4
|
in;
|
|
@@ -14,4 +11,3 @@ class Route {
|
|
|
14
11
|
console.log(`Route ${this.name}: ${this.in.domainName} → ${this.out.domainName}`);
|
|
15
12
|
}
|
|
16
13
|
}
|
|
17
|
-
exports.Route = Route;
|
|
@@ -1,7 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.Router = void 0;
|
|
4
|
-
class Router {
|
|
1
|
+
export class Router {
|
|
5
2
|
name;
|
|
6
3
|
district;
|
|
7
4
|
activeRoute;
|
|
@@ -37,4 +34,3 @@ class Router {
|
|
|
37
34
|
`;
|
|
38
35
|
}
|
|
39
36
|
}
|
|
40
|
-
exports.Router = Router;
|
|
@@ -1,9 +1,6 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
const position_1 = require("./position");
|
|
5
|
-
const router_1 = require("./router");
|
|
6
|
-
class Section {
|
|
1
|
+
import { SectionPosition } from "./position";
|
|
2
|
+
import { Router } from "./router";
|
|
3
|
+
export class Section {
|
|
7
4
|
name;
|
|
8
5
|
district;
|
|
9
6
|
powerDistrict;
|
|
@@ -27,7 +24,7 @@ class Section {
|
|
|
27
24
|
if (this.in instanceof Section) {
|
|
28
25
|
return this.in;
|
|
29
26
|
}
|
|
30
|
-
if (this.in instanceof
|
|
27
|
+
if (this.in instanceof Router) {
|
|
31
28
|
const activeRoute = this.in.activeRoute;
|
|
32
29
|
if (!activeRoute) {
|
|
33
30
|
throw new Error(`Router '${this.in.domainName}' has no active route`);
|
|
@@ -48,7 +45,7 @@ class Section {
|
|
|
48
45
|
if (this.out instanceof Section) {
|
|
49
46
|
return this.out;
|
|
50
47
|
}
|
|
51
|
-
if (this.out instanceof
|
|
48
|
+
if (this.out instanceof Router) {
|
|
52
49
|
const activeRoute = this.out.activeRoute;
|
|
53
50
|
if (!activeRoute) {
|
|
54
51
|
throw new Error(`Router '${this.out.domainName}' has no active route`);
|
|
@@ -153,13 +150,13 @@ class Section {
|
|
|
153
150
|
if (!next) {
|
|
154
151
|
return {
|
|
155
152
|
sections,
|
|
156
|
-
tip: new
|
|
153
|
+
tip: new SectionPosition(tip, tip.length, false)
|
|
157
154
|
};
|
|
158
155
|
}
|
|
159
156
|
if (next instanceof Section) {
|
|
160
157
|
tip = next;
|
|
161
158
|
}
|
|
162
|
-
if (next instanceof
|
|
159
|
+
if (next instanceof Router) {
|
|
163
160
|
if (!next.activeRoute) {
|
|
164
161
|
throw new Error(`Router '${next.domainName}' has no active route (routes: ${next.routes.map(route => `'${route.name}'`).join(', ')})`);
|
|
165
162
|
}
|
|
@@ -176,7 +173,7 @@ class Section {
|
|
|
176
173
|
}
|
|
177
174
|
return {
|
|
178
175
|
sections,
|
|
179
|
-
tip: new
|
|
176
|
+
tip: new SectionPosition(tip, reversed ? -length : tip.length + length, false)
|
|
180
177
|
};
|
|
181
178
|
}
|
|
182
179
|
toDotReference() {
|
|
@@ -214,4 +211,3 @@ class Section {
|
|
|
214
211
|
}));
|
|
215
212
|
}
|
|
216
213
|
}
|
|
217
|
-
exports.Section = Section;
|
|
@@ -1,7 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.Tile = exports.TilePattern = void 0;
|
|
4
|
-
class TilePattern {
|
|
1
|
+
export class TilePattern {
|
|
5
2
|
length;
|
|
6
3
|
path;
|
|
7
4
|
// TODO: replace simple paths with rounded versions
|
|
@@ -53,8 +50,7 @@ class TilePattern {
|
|
|
53
50
|
this.path = path;
|
|
54
51
|
}
|
|
55
52
|
}
|
|
56
|
-
|
|
57
|
-
class Tile {
|
|
53
|
+
export class Tile {
|
|
58
54
|
section;
|
|
59
55
|
x;
|
|
60
56
|
y;
|
|
@@ -75,4 +71,3 @@ class Tile {
|
|
|
75
71
|
`;
|
|
76
72
|
}
|
|
77
73
|
}
|
|
78
|
-
exports.Tile = Tile;
|
|
@@ -1,8 +1,5 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
exports.Track = void 0;
|
|
4
|
-
const position_1 = require("./position");
|
|
5
|
-
class Track {
|
|
1
|
+
import { SectionPosition } from "./position";
|
|
2
|
+
export class Track {
|
|
6
3
|
section;
|
|
7
4
|
length;
|
|
8
5
|
path;
|
|
@@ -17,7 +14,7 @@ class Track {
|
|
|
17
14
|
let offset = 0;
|
|
18
15
|
for (let track of this.section.tracks) {
|
|
19
16
|
if (track == this) {
|
|
20
|
-
return new
|
|
17
|
+
return new SectionPosition(this.section, offset, false);
|
|
21
18
|
}
|
|
22
19
|
offset += track.length;
|
|
23
20
|
}
|
|
@@ -26,4 +23,3 @@ class Track {
|
|
|
26
23
|
console.log(this.length);
|
|
27
24
|
}
|
|
28
25
|
}
|
|
29
|
-
exports.Track = Track;
|
package/package.json
CHANGED
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@packtrack/layout",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.6",
|
|
4
4
|
"main": ".built/index.js",
|
|
5
5
|
"typings": ".built/index.d.ts",
|
|
6
|
+
"sideEffects": false,
|
|
6
7
|
"scripts": {
|
|
7
|
-
"
|
|
8
|
+
"build": "tsc"
|
|
8
9
|
},
|
|
9
10
|
"devDependencies": {
|
|
10
11
|
"typescript": "^5.3.3"
|
package/source/index.ts
ADDED
package/source/layout.ts
CHANGED
|
@@ -5,10 +5,10 @@ import { Router } from "./router";
|
|
|
5
5
|
import { Section } from "./section";
|
|
6
6
|
import { TilePattern, Tile } from "./tile";
|
|
7
7
|
import { Track } from "./track";
|
|
8
|
-
import { PointPositioner } from "../positioner/point";
|
|
9
8
|
import { Device } from "./device/device";
|
|
10
|
-
import { ResponderType } from "
|
|
9
|
+
import { ResponderType } from "./positioner/responder-type";
|
|
11
10
|
import { Channel } from "./device/channel";
|
|
11
|
+
import { PointPositioner } from "./positioner/point";
|
|
12
12
|
|
|
13
13
|
export class Layout {
|
|
14
14
|
name: string;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Positioner } from ".";
|
|
2
|
-
import { Channel } from "../
|
|
3
|
-
import { Track } from "../
|
|
2
|
+
import { Channel } from "../device/channel";
|
|
3
|
+
import { Track } from "../track";
|
|
4
4
|
import { ResponderType } from "./responder-type";
|
|
5
5
|
|
|
6
6
|
export class PointPositioner extends Positioner {
|
package/source/track.ts
CHANGED
package/tsconfig.json
CHANGED
|
@@ -1,9 +1,11 @@
|
|
|
1
1
|
{
|
|
2
2
|
"compilerOptions": {
|
|
3
3
|
"outDir": ".built",
|
|
4
|
-
"module": "
|
|
5
|
-
"
|
|
6
|
-
"
|
|
4
|
+
"module": "esnext",
|
|
5
|
+
"moduleResolution": "node",
|
|
6
|
+
"target": "esnext"
|
|
7
7
|
},
|
|
8
|
-
"include": [
|
|
9
|
-
|
|
8
|
+
"include": [
|
|
9
|
+
"source"
|
|
10
|
+
]
|
|
11
|
+
}
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
import { Positioner } from ".";
|
|
2
|
-
import { Channel } from "../source/device/channel";
|
|
3
|
-
import { Track } from "../source/track";
|
|
4
|
-
import { ResponderType } from "./responder-type";
|
|
5
|
-
export declare class PointPositioner extends Positioner {
|
|
6
|
-
track: Track;
|
|
7
|
-
offset: number;
|
|
8
|
-
channel: Channel;
|
|
9
|
-
responder: ResponderType;
|
|
10
|
-
constructor(track: Track, offset: number, channel: Channel, responder: ResponderType);
|
|
11
|
-
get position(): any;
|
|
12
|
-
dump(): void;
|
|
13
|
-
}
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.Channel = void 0;
|
|
4
|
-
class Channel {
|
|
5
|
-
device;
|
|
6
|
-
name;
|
|
7
|
-
constructor(device, name) {
|
|
8
|
-
this.device = device;
|
|
9
|
-
this.name = name;
|
|
10
|
-
}
|
|
11
|
-
dump() {
|
|
12
|
-
console.log(`Channel '${this.name}' on ${this.device.identifier}`);
|
|
13
|
-
}
|
|
14
|
-
publish(data) { }
|
|
15
|
-
}
|
|
16
|
-
exports.Channel = Channel;
|
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.Device = void 0;
|
|
4
|
-
class Device {
|
|
5
|
-
identifier;
|
|
6
|
-
channels = [];
|
|
7
|
-
lastDiscovery;
|
|
8
|
-
constructor(identifier) {
|
|
9
|
-
this.identifier = identifier;
|
|
10
|
-
}
|
|
11
|
-
dump() {
|
|
12
|
-
console.group(`Device ${this.identifier}`);
|
|
13
|
-
if (this.lastDiscovery) {
|
|
14
|
-
console.log(`last discovery: ${this.lastDiscovery.date.toISOString()} ${this.lastDiscovery.address}`);
|
|
15
|
-
}
|
|
16
|
-
console.group('channels');
|
|
17
|
-
for (let channel of this.channels) {
|
|
18
|
-
channel.dump();
|
|
19
|
-
}
|
|
20
|
-
console.groupEnd();
|
|
21
|
-
console.groupEnd();
|
|
22
|
-
}
|
|
23
|
-
}
|
|
24
|
-
exports.Device = Device;
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
import { Layout } from "./layout";
|
|
2
|
-
import { PowerDistrict } from "./power-district";
|
|
3
|
-
import { Router } from "./router";
|
|
4
|
-
import { Section } from "./section";
|
|
5
|
-
export declare class District {
|
|
6
|
-
name: string;
|
|
7
|
-
parent: District | Layout;
|
|
8
|
-
children: District[];
|
|
9
|
-
powerDistricts: PowerDistrict[];
|
|
10
|
-
sections: Section[];
|
|
11
|
-
routers: Router[];
|
|
12
|
-
constructor(name: string, parent: District | Layout);
|
|
13
|
-
get domainName(): string;
|
|
14
|
-
dump(): void;
|
|
15
|
-
toDotReference(): any;
|
|
16
|
-
toDotDefinition(): any;
|
|
17
|
-
toDotConnection(): any;
|
|
18
|
-
toSVG(): any;
|
|
19
|
-
findSVGPositions(): any;
|
|
20
|
-
}
|
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
import { District } from "./district";
|
|
2
|
-
import { PowerDistrict } from "./power-district";
|
|
3
|
-
import { Router } from "./router";
|
|
4
|
-
import { Section } from "./section";
|
|
5
|
-
import { Device } from "./device/device";
|
|
6
|
-
import { ResponderType } from "../positioner/responder-type";
|
|
7
|
-
import { Channel } from "./device/channel";
|
|
8
|
-
export declare class Layout {
|
|
9
|
-
name: string;
|
|
10
|
-
districts: District[];
|
|
11
|
-
devices: Device[];
|
|
12
|
-
responderType: ResponderType[];
|
|
13
|
-
get allDistricts(): District[];
|
|
14
|
-
static from(document: any): Layout;
|
|
15
|
-
loadDistrict(source: any, parent: District | Layout): District;
|
|
16
|
-
linkDistrict(source: any, district: District): void;
|
|
17
|
-
loadSection(source: any, district: District): void;
|
|
18
|
-
findDevice(identifier: string): Device;
|
|
19
|
-
findChannel(device: Device, name: string): Channel;
|
|
20
|
-
findResponderType(name: string): ResponderType;
|
|
21
|
-
linkSection(source: any, section: Section): void;
|
|
22
|
-
findSection(path: string, base: District, source?: District): any;
|
|
23
|
-
loadRouter(source: any, district: District): Router;
|
|
24
|
-
linkRouter(source: any, router: Router): void;
|
|
25
|
-
loadPowerDistrict(source: any, district: District): PowerDistrict;
|
|
26
|
-
toDot(): string;
|
|
27
|
-
toSVG(inject?: string): string;
|
|
28
|
-
dump(): void;
|
|
29
|
-
}
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import { Section } from './section.js';
|
|
2
|
-
export declare class SectionPosition {
|
|
3
|
-
section: Section;
|
|
4
|
-
offset: number;
|
|
5
|
-
reversed: boolean;
|
|
6
|
-
constructor(section: Section, offset: number, reversed: boolean);
|
|
7
|
-
get absolutePosition(): number;
|
|
8
|
-
advance(distance: number): any;
|
|
9
|
-
toString(): string;
|
|
10
|
-
}
|
package/.built/source/route.d.ts
DELETED
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
import { District } from "./district";
|
|
2
|
-
import { Route } from "./route";
|
|
3
|
-
export declare class Router {
|
|
4
|
-
name: string;
|
|
5
|
-
district: District;
|
|
6
|
-
activeRoute?: Route;
|
|
7
|
-
routes: Route[];
|
|
8
|
-
constructor(name: string, district: District);
|
|
9
|
-
get domainName(): string;
|
|
10
|
-
dump(): void;
|
|
11
|
-
toDotReference(): string;
|
|
12
|
-
toDotDefinition(): string;
|
|
13
|
-
toDotConnection(): string;
|
|
14
|
-
}
|
|
@@ -1,40 +0,0 @@
|
|
|
1
|
-
import { District } from "./district";
|
|
2
|
-
import { SectionPosition } from "./position";
|
|
3
|
-
import { PowerDistrict } from "./power-district";
|
|
4
|
-
import { Router } from "./router";
|
|
5
|
-
import { Tile } from "./tile";
|
|
6
|
-
import { Track } from "./track";
|
|
7
|
-
export declare class Section {
|
|
8
|
-
name: string;
|
|
9
|
-
district: District;
|
|
10
|
-
powerDistrict: PowerDistrict;
|
|
11
|
-
tracks: Track[];
|
|
12
|
-
tiles: Tile[];
|
|
13
|
-
in?: Router | Section;
|
|
14
|
-
out?: Router | Section;
|
|
15
|
-
constructor(name: string, district: District);
|
|
16
|
-
get domainName(): string;
|
|
17
|
-
next(reverse: boolean): Section;
|
|
18
|
-
getTilesInRange(startPosition: SectionPosition, endPosition: SectionPosition): {
|
|
19
|
-
offset: {
|
|
20
|
-
start: number;
|
|
21
|
-
end: number;
|
|
22
|
-
};
|
|
23
|
-
tiles: Tile[];
|
|
24
|
-
};
|
|
25
|
-
dump(): void;
|
|
26
|
-
get length(): number;
|
|
27
|
-
get tileLength(): number;
|
|
28
|
-
trail(offset: number, reversed: boolean, length: number): {
|
|
29
|
-
sections: Section[];
|
|
30
|
-
tip: SectionPosition;
|
|
31
|
-
};
|
|
32
|
-
toDotReference(): string;
|
|
33
|
-
toDotDefinition(): string;
|
|
34
|
-
toDotConnection(): string;
|
|
35
|
-
toSVG(): string;
|
|
36
|
-
findSVGPositions(): {
|
|
37
|
-
x: number;
|
|
38
|
-
y: number;
|
|
39
|
-
}[];
|
|
40
|
-
}
|
package/.built/source/tile.d.ts
DELETED
|
@@ -1,57 +0,0 @@
|
|
|
1
|
-
import { Section } from './section.js';
|
|
2
|
-
export declare class TilePattern {
|
|
3
|
-
length: number;
|
|
4
|
-
path: (continuous: boolean, x: number, y: number) => string;
|
|
5
|
-
static patterns: {
|
|
6
|
-
'tl-cc': TilePattern;
|
|
7
|
-
'tc-cc': TilePattern;
|
|
8
|
-
'tr-cc': TilePattern;
|
|
9
|
-
'cl-cc': TilePattern;
|
|
10
|
-
'cr-cc': TilePattern;
|
|
11
|
-
'bl-cc': TilePattern;
|
|
12
|
-
'bc-cc': TilePattern;
|
|
13
|
-
'br-cc': TilePattern;
|
|
14
|
-
'cc-tl': TilePattern;
|
|
15
|
-
'cc-tc': TilePattern;
|
|
16
|
-
'cc-tr': TilePattern;
|
|
17
|
-
'cc-cl': TilePattern;
|
|
18
|
-
'cc-cr': TilePattern;
|
|
19
|
-
'cc-bl': TilePattern;
|
|
20
|
-
'cc-bc': TilePattern;
|
|
21
|
-
'cc-br': TilePattern;
|
|
22
|
-
'cr-cl': TilePattern;
|
|
23
|
-
'cr-tl': TilePattern;
|
|
24
|
-
'cr-bl': TilePattern;
|
|
25
|
-
'cl-cr': TilePattern;
|
|
26
|
-
'cl-tr': TilePattern;
|
|
27
|
-
'cl-bl': TilePattern;
|
|
28
|
-
'tl-bc': TilePattern;
|
|
29
|
-
'tl-br': TilePattern;
|
|
30
|
-
'tl-cr': TilePattern;
|
|
31
|
-
'tc-bc': TilePattern;
|
|
32
|
-
'tc-br': TilePattern;
|
|
33
|
-
'tc-bl': TilePattern;
|
|
34
|
-
'tr-cl': TilePattern;
|
|
35
|
-
'tr-bc': TilePattern;
|
|
36
|
-
'bl-tr': TilePattern;
|
|
37
|
-
'bl-tc': TilePattern;
|
|
38
|
-
'bl-cr': TilePattern;
|
|
39
|
-
'bc-tc': TilePattern;
|
|
40
|
-
'bc-tr': TilePattern;
|
|
41
|
-
'bc-tl': TilePattern;
|
|
42
|
-
'br-cl': TilePattern;
|
|
43
|
-
'br-tc': TilePattern;
|
|
44
|
-
'br-tl': TilePattern;
|
|
45
|
-
'cl-bc': TilePattern;
|
|
46
|
-
};
|
|
47
|
-
constructor(length: number, path: (continuous: boolean, x: number, y: number) => string);
|
|
48
|
-
}
|
|
49
|
-
export declare class Tile {
|
|
50
|
-
section: Section;
|
|
51
|
-
x: number;
|
|
52
|
-
y: number;
|
|
53
|
-
pattern: TilePattern;
|
|
54
|
-
constructor(section: Section, x: number, y: number, pattern: TilePattern);
|
|
55
|
-
toSVGPath(continuous?: boolean): string;
|
|
56
|
-
toSVG(): string;
|
|
57
|
-
}
|
package/.built/source/track.d.ts
DELETED
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
import { Positioner } from "../positioner";
|
|
2
|
-
import { Section } from "./section";
|
|
3
|
-
import { SectionPosition } from "./position";
|
|
4
|
-
export declare class Track {
|
|
5
|
-
section: Section;
|
|
6
|
-
length: number;
|
|
7
|
-
path: string;
|
|
8
|
-
positioners: Positioner[];
|
|
9
|
-
constructor(section: Section, length: number, path: string);
|
|
10
|
-
get head(): SectionPosition;
|
|
11
|
-
dump(): void;
|
|
12
|
-
}
|
package/index.ts
DELETED
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
export * from './source/district';
|
|
2
|
-
export * from './source/layout';
|
|
3
|
-
export * from './source/position';
|
|
4
|
-
export * from './source/power-district';
|
|
5
|
-
export * from './source/route';
|
|
6
|
-
export * from './source/router';
|
|
7
|
-
export * from './source/section';
|
|
8
|
-
export * from './source/tile';
|
|
9
|
-
export * from './source/track';
|
|
File without changes
|
|
File without changes
|