@packtrack/layout 1.0.6 → 1.0.8

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.
@@ -0,0 +1,8 @@
1
+ import { Device } from "./device";
2
+ export declare class Channel {
3
+ device: Device;
4
+ name: string;
5
+ constructor(device: Device, name: string);
6
+ dump(): void;
7
+ publish(data: any): void;
8
+ }
@@ -0,0 +1,11 @@
1
+ import { Channel } from "./channel";
2
+ export declare class Device {
3
+ identifier: string;
4
+ channels: Channel[];
5
+ lastDiscovery: {
6
+ date: Date;
7
+ address: string;
8
+ };
9
+ constructor(identifier: string);
10
+ dump(): void;
11
+ }
@@ -0,0 +1,20 @@
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
+ }
@@ -0,0 +1,9 @@
1
+ export * from './district';
2
+ export * from './layout';
3
+ export * from './position';
4
+ export * from './power-district';
5
+ export * from './route';
6
+ export * from './router';
7
+ export * from './section';
8
+ export * from './tile';
9
+ export * from './track';
@@ -0,0 +1,29 @@
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
+ }
@@ -0,0 +1,10 @@
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
+ }
@@ -0,0 +1,2 @@
1
+ export declare class Positioner {
2
+ }
@@ -0,0 +1,13 @@
1
+ import { Positioner } from ".";
2
+ import { Channel } from "../device/channel";
3
+ import { Track } from "../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
+ }
@@ -0,0 +1,5 @@
1
+ export declare class ResponderType {
2
+ name: string;
3
+ constructor(name: string);
4
+ dump(): void;
5
+ }
@@ -0,0 +1,8 @@
1
+ import { District } from "./district";
2
+ export declare class PowerDistrict {
3
+ name: string;
4
+ district: District;
5
+ constructor(name: string, district: District);
6
+ get domainName(): string;
7
+ dump(): void;
8
+ }
@@ -0,0 +1,10 @@
1
+ import { Router } from "./router";
2
+ import { Section } from "./section";
3
+ export declare class Route {
4
+ name: string;
5
+ router: Router;
6
+ in: Section;
7
+ out: Section;
8
+ constructor(name: string, router: Router);
9
+ dump(): void;
10
+ }
@@ -0,0 +1,14 @@
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
+ }
@@ -0,0 +1,40 @@
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
+ }
@@ -0,0 +1,57 @@
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
+ }
@@ -0,0 +1,12 @@
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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@packtrack/layout",
3
- "version": "1.0.6",
3
+ "version": "1.0.8",
4
4
  "main": ".built/index.js",
5
5
  "typings": ".built/index.d.ts",
6
6
  "sideEffects": false,
package/source/index.ts CHANGED
@@ -7,3 +7,7 @@ export * from './router';
7
7
  export * from './section';
8
8
  export * from './tile';
9
9
  export * from './track';
10
+
11
+ export * from './positioner/index';
12
+ export * from './positioner/point';
13
+ export * from './positioner/responder-type';
package/tsconfig.json CHANGED
@@ -3,7 +3,8 @@
3
3
  "outDir": ".built",
4
4
  "module": "esnext",
5
5
  "moduleResolution": "node",
6
- "target": "esnext"
6
+ "target": "esnext",
7
+ "declaration": true
7
8
  },
8
9
  "include": [
9
10
  "source"