@pritzlaff/nano-ui 0.0.0-stage → 0.4.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/LICENSE +21 -0
- package/README.md +13 -2
- package/explorer.d.ts +36 -0
- package/index.d.ts +18 -0
- package/index.js +958 -0
- package/index.js.map +30 -0
- package/interfaces.d.ts +113 -0
- package/layout.d.ts +31 -0
- package/package.json +29 -4
- package/pods/debounce.d.ts +3 -0
- package/pods/input.d.ts +2 -0
- package/pods/log.d.ts +3 -0
- package/pods/map.d.ts +3 -0
- package/provider.d.ts +1 -0
- package/views/define.d.ts +3 -0
- package/views/faces.d.ts +29 -0
- package/views/pod-view.d.ts +10 -0
- package/views/view.d.ts +60 -0
- package/wiring/constants.d.ts +15 -0
- package/wiring/layout.d.ts +49 -0
- package/wiring/model.d.ts +3 -0
- package/wiring/render-drawer.d.ts +16 -0
- package/wiring/render-pills.d.ts +2 -0
- package/wiring/render-stage.d.ts +2 -0
- package/wiring/styles.d.ts +1 -0
- package/wiring/types.d.ts +68 -0
- package/wiring/wiring.d.ts +69 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const styles: import("lit").CSSResult[];
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
import type { TSchema } from 'typebox';
|
|
2
|
+
export type PadType = 'string' | 'number' | 'boolean' | 'object' | 'array' | 'signal' | 'any' | 'call';
|
|
3
|
+
/** A pad's data type, from its schema's type: none (or Void) is a signal; unions, Unknown and the rest are any. */
|
|
4
|
+
export declare function padTypeOf(schema: TSchema | undefined): PadType;
|
|
5
|
+
/** An event is round, an action a rounded square; an input is hollow, an output filled. */
|
|
6
|
+
export type Pad = {
|
|
7
|
+
key: string;
|
|
8
|
+
instance: string;
|
|
9
|
+
op: string;
|
|
10
|
+
label: string;
|
|
11
|
+
dir: 'in' | 'out';
|
|
12
|
+
kind: 'event' | 'call';
|
|
13
|
+
type: PadType;
|
|
14
|
+
description?: string;
|
|
15
|
+
schema?: TSchema;
|
|
16
|
+
};
|
|
17
|
+
export type Box = {
|
|
18
|
+
x: number;
|
|
19
|
+
y: number;
|
|
20
|
+
w: number;
|
|
21
|
+
h: number;
|
|
22
|
+
};
|
|
23
|
+
export type Footprint = {
|
|
24
|
+
system: string;
|
|
25
|
+
instance: string;
|
|
26
|
+
title: string;
|
|
27
|
+
box: Box;
|
|
28
|
+
shared: boolean;
|
|
29
|
+
pads: Pad[];
|
|
30
|
+
};
|
|
31
|
+
export type Layer = {
|
|
32
|
+
screen: string;
|
|
33
|
+
title: string;
|
|
34
|
+
system: string;
|
|
35
|
+
footprints: Footprint[];
|
|
36
|
+
};
|
|
37
|
+
export type SideItem = {
|
|
38
|
+
system: string;
|
|
39
|
+
instance: string;
|
|
40
|
+
title: string;
|
|
41
|
+
pads: Pad[];
|
|
42
|
+
};
|
|
43
|
+
export type SystemBlock = {
|
|
44
|
+
system: string;
|
|
45
|
+
items: SideItem[];
|
|
46
|
+
};
|
|
47
|
+
/** Where a cable end sits: on a runtime's layer, or in the side area (the block's system id). */
|
|
48
|
+
export type CableEnd = {
|
|
49
|
+
pad: string;
|
|
50
|
+
at: {
|
|
51
|
+
layer: string;
|
|
52
|
+
} | {
|
|
53
|
+
side: string;
|
|
54
|
+
};
|
|
55
|
+
};
|
|
56
|
+
/** `id` is `runtime|from|to|port|source` for a pipe, `runtime|from|to|call|` for a call edge. */
|
|
57
|
+
export type Cable = {
|
|
58
|
+
id: string;
|
|
59
|
+
system: string;
|
|
60
|
+
from: CableEnd;
|
|
61
|
+
to: CableEnd;
|
|
62
|
+
type: PadType;
|
|
63
|
+
};
|
|
64
|
+
export type Circuit = {
|
|
65
|
+
layers: Layer[];
|
|
66
|
+
side: SystemBlock[];
|
|
67
|
+
cables: Cable[];
|
|
68
|
+
};
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `<nano-wiring>`: the app as a tilted stack of runtime layers (their pods, pads and cables) and a side area for pods
|
|
3
|
+
* placed in more than one runtime. Read-only. It rebuilds on `applied` and lights a cable for 600ms when it carries a message.
|
|
4
|
+
*/
|
|
5
|
+
import { LitElement } from 'lit';
|
|
6
|
+
import type { Application, Registry } from '@pritzlaff/nano-core';
|
|
7
|
+
import { type Layout, type Rect } from './layout.js';
|
|
8
|
+
import type { Circuit } from './types.js';
|
|
9
|
+
type Target = {
|
|
10
|
+
app: Application;
|
|
11
|
+
registry: Registry;
|
|
12
|
+
};
|
|
13
|
+
/** The view: focused layer, zoom, pan, and what is selected (`pad:`, `cable:` or `fp:` + id). */
|
|
14
|
+
export interface State {
|
|
15
|
+
focus: string | null;
|
|
16
|
+
zoom: number;
|
|
17
|
+
panX: number;
|
|
18
|
+
panY: number;
|
|
19
|
+
sel: string | null;
|
|
20
|
+
}
|
|
21
|
+
export declare class NanoWiring extends LitElement {
|
|
22
|
+
static properties: {
|
|
23
|
+
target: {
|
|
24
|
+
attribute: boolean;
|
|
25
|
+
};
|
|
26
|
+
};
|
|
27
|
+
static styles: import("lit").CSSResult[];
|
|
28
|
+
target?: Target;
|
|
29
|
+
s: State;
|
|
30
|
+
model: Circuit;
|
|
31
|
+
geo: Layout;
|
|
32
|
+
dragging: boolean;
|
|
33
|
+
private off?;
|
|
34
|
+
private watching?;
|
|
35
|
+
private fitted;
|
|
36
|
+
private drag;
|
|
37
|
+
private lit;
|
|
38
|
+
constructor();
|
|
39
|
+
connectedCallback(): void;
|
|
40
|
+
disconnectedCallback(): void;
|
|
41
|
+
willUpdate(changed: Map<string, unknown>): void;
|
|
42
|
+
render(): import("lit").TemplateResult<1>[];
|
|
43
|
+
private watch;
|
|
44
|
+
private stop;
|
|
45
|
+
private load;
|
|
46
|
+
/** A cable is lit by prefix: its id starts with `runtime|from|to|port|` (a pipe's target port) or `...|call|`. */
|
|
47
|
+
private light;
|
|
48
|
+
isLit(id: string): boolean;
|
|
49
|
+
reduced(): boolean;
|
|
50
|
+
stageSize(): {
|
|
51
|
+
w: number;
|
|
52
|
+
h: number;
|
|
53
|
+
};
|
|
54
|
+
fitRect(r: Rect): void;
|
|
55
|
+
fitPage(id: string): void;
|
|
56
|
+
fitAll(): void;
|
|
57
|
+
go(id: string): void;
|
|
58
|
+
move(by: number): void;
|
|
59
|
+
key(e: KeyboardEvent): void;
|
|
60
|
+
refocus(): void;
|
|
61
|
+
select(sel: string | null): void;
|
|
62
|
+
/** Pans to the other end of the selected pad's (or cable's) cable, focusing its layer if it has one. */
|
|
63
|
+
follow(): void;
|
|
64
|
+
wheel(e: WheelEvent): void;
|
|
65
|
+
dragStart(e: PointerEvent): void;
|
|
66
|
+
/** Centres the view on the world point clicked in the minimap. */
|
|
67
|
+
panFromMinimap(e: MouseEvent): void;
|
|
68
|
+
}
|
|
69
|
+
export {};
|