@pritzlaff/nano-ui 0.0.0-stage → 0.5.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-details.d.ts +44 -0
- package/explorer-nodes.d.ts +9 -0
- package/explorer.d.ts +52 -0
- package/filter/filter.d.ts +40 -0
- package/filter/model.d.ts +25 -0
- package/index.d.ts +33 -0
- package/index.js +2556 -0
- package/index.js.map +54 -0
- package/interfaces.d.ts +239 -0
- package/layout.d.ts +23 -0
- package/observe/bar.d.ts +46 -0
- package/observe/clock-driver.d.ts +16 -0
- package/observe/entry.d.ts +66 -0
- package/observe/fold.d.ts +14 -0
- package/observe/in-flight.d.ts +10 -0
- package/observe/memory-store.d.ts +5 -0
- package/observe/record.d.ts +15 -0
- package/observe/replay.d.ts +56 -0
- package/observe/restart-order.d.ts +3 -0
- package/observe/ring-view.d.ts +86 -0
- package/observe/ring.d.ts +38 -0
- package/observe/shadow.d.ts +18 -0
- package/observe/time-machine.d.ts +55 -0
- package/package.json +29 -4
- package/pods/clock.d.ts +3 -0
- package/pods/debounce.d.ts +6 -0
- package/pods/input.d.ts +5 -0
- package/pods/log.d.ts +3 -0
- package/pods/map.d.ts +3 -0
- package/pods/random.d.ts +5 -0
- package/pods/sim-clock.d.ts +3 -0
- package/provider.d.ts +1 -0
- package/views/debounce-model.d.ts +72 -0
- package/views/debounce-parts.d.ts +12 -0
- package/views/debounce.d.ts +36 -0
- package/views/define.d.ts +3 -0
- package/views/faces.d.ts +16 -0
- package/views/input.d.ts +9 -0
- package/views/pod-view.d.ts +10 -0
- package/views/view.d.ts +61 -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
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Aaron Pritzlaff
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
CHANGED
|
@@ -1,3 +1,14 @@
|
|
|
1
|
-
#
|
|
1
|
+
# @pritzlaff/nano-ui
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
The `nano.ui` provider over `@pritzlaff/nano-core`: input, debounce, map and log pods, the `HostUI` interface a host
|
|
4
|
+
implements, and the views (explorer, wiring, pod view).
|
|
5
|
+
|
|
6
|
+
```ts
|
|
7
|
+
import uiProvider from '@pritzlaff/nano-ui'
|
|
8
|
+
registry.add(uiProvider)
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
## Trust
|
|
12
|
+
|
|
13
|
+
A `nano.json` is code: it names modules the host loads and runs. Import only what you trust. `nano.ui/map` compiles its
|
|
14
|
+
config with `new Function`, so a host needs a CSP that allows `'unsafe-eval'`.
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The explorer's details pane: what one selected node is, from the live deployment and the registry. Ids name the
|
|
3
|
+
* node: `r:<runtime>`, `p:<runtime>:<pod>`, `s:<runtime>:<pod>:<i>` (that pod's i-th subscription), `i:<interface>`,
|
|
4
|
+
* `m:<implementation>`, `o:<interface>/<op>`. `go(id)` selects another node (a link); `open(where)` asks the host for a pod's view; `remove(runtime)` asks it to delete a runtime.
|
|
5
|
+
*/
|
|
6
|
+
import { type TemplateResult } from 'lit';
|
|
7
|
+
import type { AppDeployment, Registry } from '@pritzlaff/nano-core';
|
|
8
|
+
export type Where = {
|
|
9
|
+
runtime: string;
|
|
10
|
+
pod: string;
|
|
11
|
+
};
|
|
12
|
+
/** An op-level call (ui-workspace's OpCall, structurally): `from`'s op `source` (null: unknown) calls `to`'s `target`. */
|
|
13
|
+
export type Called = {
|
|
14
|
+
runtime: string;
|
|
15
|
+
from: string;
|
|
16
|
+
to: string;
|
|
17
|
+
source: string | null;
|
|
18
|
+
target: string;
|
|
19
|
+
declared: boolean;
|
|
20
|
+
seen: boolean;
|
|
21
|
+
};
|
|
22
|
+
type Ctx = {
|
|
23
|
+
d: AppDeployment;
|
|
24
|
+
registry: Registry;
|
|
25
|
+
status(runtime: string, pod: string): string;
|
|
26
|
+
calls?: Called[];
|
|
27
|
+
go(id: string): void;
|
|
28
|
+
open(w: Where): void;
|
|
29
|
+
remove(runtime: string): void;
|
|
30
|
+
};
|
|
31
|
+
type Shape = {
|
|
32
|
+
type?: string;
|
|
33
|
+
properties?: Record<string, unknown>;
|
|
34
|
+
items?: Shape;
|
|
35
|
+
anyOf?: Shape[];
|
|
36
|
+
const?: unknown;
|
|
37
|
+
};
|
|
38
|
+
/** A schema in a few characters: its label, else its shape (`{ a, b }`, `string[]`, `a | b`). */
|
|
39
|
+
export declare const typeName: (def: (Shape & {
|
|
40
|
+
label?: string;
|
|
41
|
+
}) | undefined) => string;
|
|
42
|
+
/** The details of node `id`, or a hint when nothing is selected. */
|
|
43
|
+
export declare function details(c: Ctx, id: string | null): TemplateResult;
|
|
44
|
+
export {};
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { AppDeployment, Registry } from '@pritzlaff/nano-core';
|
|
2
|
+
import type { PodStatus } from '@pritzlaff/nano-core';
|
|
3
|
+
import type { TreeNode } from '@pritzlaff/nano-elements';
|
|
4
|
+
export declare const primary: (id: string) => string;
|
|
5
|
+
/** A coordinate's namespace: `nano.ui` for `nano.ui.Input`, `nano.ui/input` and a runtime `nano.ui.main`. */
|
|
6
|
+
export declare const namespaceOf: (coord: string) => string;
|
|
7
|
+
export declare function nodes(d: AppDeployment, registry: Registry, status: (runtime: string, pod: string) => PodStatus): TreeNode[];
|
|
8
|
+
/** Every namespace in the tree, sorted. */
|
|
9
|
+
export declare const namespaces: (list: TreeNode[]) => string[];
|
package/explorer.d.ts
ADDED
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `<nano-explorer>`: the system as a tree of its runtimes (explorer-nodes.ts); the shared filter (`<nano-filter>`: search, kinds, namespaces, pod status). Each pod's status is asked of nano-core (`runtime(r).status(pod)`, on each lifecycle event); the optional `icon` renderer (a node, its `kind` and a pod's `data.status`) goes to `<nano-tree>`. Choosing a node shows its details beside the tree
|
|
3
|
+
* (explorer-details.ts); a pod's "Open view" (or a double-click on a pod) fires `nano-open` with `{ runtime, pod }`; a runtime's "Delete runtime" fires `nano-delete` with `{ runtime }`.
|
|
4
|
+
*/
|
|
5
|
+
import { LitElement } from 'lit';
|
|
6
|
+
import type { TreeNode } from '@pritzlaff/nano-elements';
|
|
7
|
+
import { type Called } from './explorer-details.js';
|
|
8
|
+
import { type FilterValue } from './filter/model.js';
|
|
9
|
+
import './filter/filter.js';
|
|
10
|
+
import type { Application, Registry } from '@pritzlaff/nano-core';
|
|
11
|
+
import '@pritzlaff/nano-elements';
|
|
12
|
+
/** `calls`: the op-level calls to show (optional; read on each render). */
|
|
13
|
+
type ExplorerTarget = {
|
|
14
|
+
app: Application;
|
|
15
|
+
registry: Registry;
|
|
16
|
+
calls?: Called[];
|
|
17
|
+
};
|
|
18
|
+
export declare class NanoExplorer extends LitElement {
|
|
19
|
+
static properties: {
|
|
20
|
+
target: {
|
|
21
|
+
attribute: boolean;
|
|
22
|
+
};
|
|
23
|
+
icon: {
|
|
24
|
+
attribute: boolean;
|
|
25
|
+
};
|
|
26
|
+
selected: {
|
|
27
|
+
state: boolean;
|
|
28
|
+
};
|
|
29
|
+
filter: {
|
|
30
|
+
state: boolean;
|
|
31
|
+
};
|
|
32
|
+
};
|
|
33
|
+
static styles: import("lit").CSSResult[];
|
|
34
|
+
target?: ExplorerTarget;
|
|
35
|
+
icon?: (n: TreeNode) => unknown;
|
|
36
|
+
selected: string | null;
|
|
37
|
+
filter: FilterValue;
|
|
38
|
+
private off?;
|
|
39
|
+
private watching?;
|
|
40
|
+
constructor();
|
|
41
|
+
connectedCallback(): void;
|
|
42
|
+
disconnectedCallback(): void;
|
|
43
|
+
willUpdate(changed: Map<string, unknown>): void;
|
|
44
|
+
private watch;
|
|
45
|
+
private stop;
|
|
46
|
+
private open;
|
|
47
|
+
private del;
|
|
48
|
+
/** A double-click on a pod opens its view. */
|
|
49
|
+
private dbl;
|
|
50
|
+
render(): import("lit").TemplateResult<1>;
|
|
51
|
+
}
|
|
52
|
+
export {};
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `<nano-filter>`: a search input and a filter button naming how many chips are on; the button opens a popover (top
|
|
3
|
+
* layer, so Escape and outside-click close it) with one labelled group of chips (toggle buttons, `aria-pressed`) per
|
|
4
|
+
* group given. It holds no state of its own: `value` is the filter, and every keystroke or chip toggle emits `change`
|
|
5
|
+
* (`detail` a new FilterValue) for the host to set back.
|
|
6
|
+
*
|
|
7
|
+
* f.groups = { kinds: ['pod', 'action'], namespaces: ['nano.ui'], statuses: ['running', 'failed'] }
|
|
8
|
+
* f.value = emptyFilter(); f.addEventListener('change', e => { f.value = e.detail })
|
|
9
|
+
*/
|
|
10
|
+
import { LitElement } from 'lit';
|
|
11
|
+
import { type FilterValue, type PodStatus } from './model.js';
|
|
12
|
+
type Groups = {
|
|
13
|
+
kinds?: string[];
|
|
14
|
+
namespaces?: string[];
|
|
15
|
+
statuses?: PodStatus[];
|
|
16
|
+
};
|
|
17
|
+
export declare class NanoFilter extends LitElement {
|
|
18
|
+
static properties: {
|
|
19
|
+
groups: {
|
|
20
|
+
attribute: boolean;
|
|
21
|
+
};
|
|
22
|
+
value: {
|
|
23
|
+
attribute: boolean;
|
|
24
|
+
};
|
|
25
|
+
open: {
|
|
26
|
+
state: boolean;
|
|
27
|
+
};
|
|
28
|
+
};
|
|
29
|
+
static styles: import("lit").CSSResult[];
|
|
30
|
+
groups: Groups;
|
|
31
|
+
value: FilterValue;
|
|
32
|
+
open: boolean;
|
|
33
|
+
constructor();
|
|
34
|
+
private emit;
|
|
35
|
+
private flip;
|
|
36
|
+
/** `open` follows the popover; opening puts the panel under the button and focus in it, closing returns focus only if it was in the panel. */
|
|
37
|
+
private toggled;
|
|
38
|
+
render(): import("lit").TemplateResult<1>;
|
|
39
|
+
}
|
|
40
|
+
export {};
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
/** The shared filter's value and its pure rules: what matches, which tree nodes stay. */
|
|
2
|
+
import type { PodStatus } from '@pritzlaff/nano-core';
|
|
3
|
+
import type { TreeNode } from '@pritzlaff/nano-elements';
|
|
4
|
+
export type { PodStatus };
|
|
5
|
+
export type FilterValue = {
|
|
6
|
+
text: string;
|
|
7
|
+
kinds: Set<string>;
|
|
8
|
+
namespaces: Set<string>;
|
|
9
|
+
statuses: Set<PodStatus>;
|
|
10
|
+
};
|
|
11
|
+
export type FilterItem = {
|
|
12
|
+
label: string;
|
|
13
|
+
kind?: string;
|
|
14
|
+
ns?: string;
|
|
15
|
+
status?: PodStatus;
|
|
16
|
+
terms?: string[];
|
|
17
|
+
};
|
|
18
|
+
export declare const emptyFilter: () => FilterValue;
|
|
19
|
+
/** An empty group is any. Selected namespaces absent from `known.namespaces` are ignored; an item with no status fails a status filter. */
|
|
20
|
+
export declare function matches(item: FilterItem, f: FilterValue, known?: {
|
|
21
|
+
namespaces?: Set<string>;
|
|
22
|
+
}): boolean;
|
|
23
|
+
/** `nodes` with what matches (by `kind`, `data.ns`, `data.status`) and the way to it; a kept node keeps its children.
|
|
24
|
+
* Groups (no kind) are kept when something under them is, and recounted. */
|
|
25
|
+
export declare function filterTree(nodes: TreeNode[], f: FilterValue): TreeNode[];
|
package/index.d.ts
ADDED
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The `nano.ui` provider: input, debounce, map and log pods, the real and simulated clocks, the real and seeded random, and the HostUI and HostDeploy interfaces a host implements.
|
|
3
|
+
*
|
|
4
|
+
* registry.add(uiProvider) // then Pod.lazy(log), Pod.eager(debounce, { config: { quietMs: 200 } })
|
|
5
|
+
* defineViews() // the default `views`, and nano-pod-view for any pod
|
|
6
|
+
*/
|
|
7
|
+
import { uiProvider } from './provider.js';
|
|
8
|
+
export { Any, Clock, ClockControl, Debounce, HostDeploy, HostUI, Input, Log, MapIface, Nothing, Random } from './interfaces.js';
|
|
9
|
+
export { clock } from './pods/clock.js';
|
|
10
|
+
export { simClock } from './pods/sim-clock.js';
|
|
11
|
+
export { random, seededRandom } from './pods/random.js';
|
|
12
|
+
export { debounce } from './pods/debounce.js';
|
|
13
|
+
export { input } from './pods/input.js';
|
|
14
|
+
export { log } from './pods/log.js';
|
|
15
|
+
export { map } from './pods/map.js';
|
|
16
|
+
export { defineViews, views } from './views/define.js';
|
|
17
|
+
export { circuitOf } from './wiring/model.js';
|
|
18
|
+
export type { LayoutBox, LayoutData, LayoutSlot } from './layout.js';
|
|
19
|
+
export { viewFor, type ViewMap, type ViewTarget } from './views/view.js';
|
|
20
|
+
export { uiProvider };
|
|
21
|
+
export default uiProvider;
|
|
22
|
+
export { record } from './observe/record.js';
|
|
23
|
+
export { replay, diverge, roots } from './observe/replay.js';
|
|
24
|
+
export { pair, snap, truncated, type Entry, type Recorded, type Message, type MessageStore } from './observe/entry.js';
|
|
25
|
+
export { memoryStore } from './observe/memory-store.js';
|
|
26
|
+
export { timeMachine, type Frame, type Ticker, type TimeMachine } from './observe/time-machine.js';
|
|
27
|
+
export { clockDriver } from './observe/clock-driver.js';
|
|
28
|
+
export { foldAt } from './observe/fold.js';
|
|
29
|
+
export { shadowAt } from './observe/shadow.js';
|
|
30
|
+
export { NanoTimeMachine } from './observe/bar.js';
|
|
31
|
+
export { NanoRing } from './observe/ring-view.js';
|
|
32
|
+
export { emptyFilter, filterTree, matches, type FilterValue, type PodStatus } from './filter/model.js';
|
|
33
|
+
export { NanoFilter } from './filter/filter.js';
|