trebol 0.1.2 → 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 +2 -0
- package/dist/cli.js +10040 -7519
- package/dist/lib/core/boot.js +10 -7
- package/dist/lib/core/eval.js +2 -2
- package/dist/lib/core/machine/checks.d.ts +1 -0
- package/dist/lib/core/machine/checks.js +250 -0
- package/dist/lib/core/machine/events.d.ts +1 -0
- package/dist/lib/core/machine/events.js +365 -0
- package/dist/lib/core/machine/running.d.ts +1 -0
- package/dist/lib/core/machine/running.js +180 -0
- package/dist/lib/core/machine/shared.d.ts +1 -0
- package/dist/lib/core/machine/shared.js +123 -0
- package/dist/lib/core/machine/snapshot.d.ts +1 -0
- package/dist/lib/core/machine/snapshot.js +244 -0
- package/dist/lib/core/machine/spec.d.ts +1 -0
- package/dist/lib/core/machine/spec.js +274 -0
- package/dist/lib/core/machine/words.d.ts +1 -0
- package/dist/lib/core/machine/words.js +98 -0
- package/dist/lib/core/machine.d.ts +1 -0
- package/dist/lib/core/machine.js +17 -0
- package/dist/lib/core/mezz.js +31 -0
- package/dist/lib/core/natives/control.js +1 -1
- package/dist/lib/core/natives/data.js +6 -1
- package/dist/lib/core/natives/series.js +49 -9
- package/dist/lib/core/natives/text.js +0 -1
- package/dist/lib/host/browser/calendar.d.ts +34 -0
- package/dist/lib/host/browser/calendar.js +268 -0
- package/dist/lib/host/browser/count.d.ts +15 -0
- package/dist/lib/host/browser/count.js +48 -0
- package/dist/lib/host/browser/dialogs.d.ts +39 -0
- package/dist/lib/host/browser/dialogs.js +443 -0
- package/dist/lib/host/browser/drag.d.ts +70 -0
- package/dist/lib/host/browser/drag.js +268 -0
- package/dist/lib/host/browser/drawings.d.ts +30 -0
- package/dist/lib/host/browser/drawings.js +176 -0
- package/dist/lib/host/browser/events.d.ts +16 -0
- package/dist/lib/host/browser/events.js +125 -0
- package/dist/lib/host/browser/faces.d.ts +35 -0
- package/dist/lib/host/browser/faces.js +131 -0
- package/dist/lib/host/browser/fields.d.ts +16 -0
- package/dist/lib/host/browser/fields.js +322 -0
- package/dist/lib/host/browser/keys.d.ts +29 -0
- package/dist/lib/host/browser/keys.js +151 -0
- package/dist/lib/host/browser/lookup.d.ts +25 -0
- package/dist/lib/host/browser/lookup.js +275 -0
- package/dist/lib/host/browser/menus.d.ts +20 -0
- package/dist/lib/host/browser/menus.js +149 -0
- package/dist/lib/host/browser/mount.d.ts +92 -0
- package/dist/lib/host/browser/mount.js +448 -0
- package/dist/lib/host/browser/orbits.d.ts +90 -0
- package/dist/lib/host/browser/orbits.js +379 -0
- package/dist/lib/host/browser/page.d.ts +13 -0
- package/dist/lib/host/browser/page.js +35 -0
- package/dist/lib/host/browser/richtext.d.ts +19 -0
- package/dist/lib/host/browser/richtext.js +379 -0
- package/dist/lib/host/browser/row-faces.d.ts +5 -0
- package/dist/lib/host/browser/row-faces.js +74 -0
- package/dist/lib/host/browser/screens.d.ts +37 -0
- package/dist/lib/host/browser/screens.js +140 -0
- package/dist/lib/host/browser/swipe.d.ts +31 -0
- package/dist/lib/host/browser/swipe.js +178 -0
- package/dist/lib/host/browser/sync.d.ts +24 -0
- package/dist/lib/host/browser/sync.js +450 -0
- package/dist/lib/host/browser/tables.d.ts +65 -0
- package/dist/lib/host/browser/tables.js +505 -0
- package/dist/lib/host/browser/times.d.ts +14 -0
- package/dist/lib/host/browser/times.js +114 -0
- package/dist/lib/host/browser/toolbars.d.ts +17 -0
- package/dist/lib/host/browser/toolbars.js +129 -0
- package/dist/lib/host/browser/trees.d.ts +20 -0
- package/dist/lib/host/browser/trees.js +235 -0
- package/dist/lib/host/browser/uploads.d.ts +29 -0
- package/dist/lib/host/browser/uploads.js +370 -0
- package/dist/lib/host/browser/widget.d.ts +13 -0
- package/dist/lib/host/browser/widget.js +105 -0
- package/dist/lib/host/browser.d.ts +25 -0
- package/dist/lib/host/browser.js +84 -4812
- package/dist/lib/host/devtools/console.d.ts +9 -0
- package/dist/lib/host/devtools/console.js +104 -0
- package/dist/lib/host/devtools/faces.d.ts +25 -0
- package/dist/lib/host/devtools/faces.js +169 -0
- package/dist/lib/host/devtools/log.d.ts +3 -0
- package/dist/lib/host/devtools/log.js +32 -0
- package/dist/lib/host/devtools/machines.d.ts +34 -0
- package/dist/lib/host/devtools/machines.js +212 -0
- package/dist/lib/host/devtools/read.d.ts +13 -0
- package/dist/lib/host/devtools/read.js +52 -0
- package/dist/lib/host/devtools/state.d.ts +90 -0
- package/dist/lib/host/devtools/state.js +123 -0
- package/dist/lib/host/devtools.d.ts +15 -19
- package/dist/lib/host/devtools.js +39 -427
- package/dist/lib/host/fonts.js +4 -3
- package/dist/lib/host/icons.js +4 -0
- package/dist/lib/host/index.d.ts +3 -1
- package/dist/lib/host/index.js +107 -4
- package/dist/lib/host/locale.d.ts +18 -0
- package/dist/lib/host/locale.js +75 -5
- package/dist/lib/host/markdown.d.ts +4 -0
- package/dist/lib/host/markdown.js +8 -0
- package/dist/lib/host/modules.js +118 -19
- package/dist/lib/host/motion.d.ts +32 -0
- package/dist/lib/host/motion.js +190 -0
- package/dist/lib/host/net.js +5 -2
- package/dist/lib/host/palette.d.ts +17 -0
- package/dist/lib/host/palette.js +131 -0
- package/dist/lib/host/scheduler.d.ts +2 -0
- package/dist/lib/host/scheduler.js +4 -0
- package/dist/lib/host/share.d.ts +31 -0
- package/dist/lib/host/share.js +134 -0
- package/dist/lib/host/theme/classic.d.ts +1 -0
- package/dist/lib/host/theme/classic.js +120 -0
- package/dist/lib/host/theme/cupertino.d.ts +1 -0
- package/dist/lib/host/theme/cupertino.js +65 -0
- package/dist/lib/host/theme/data.d.ts +1 -0
- package/dist/lib/host/theme/data.js +109 -0
- package/dist/lib/host/theme/devtools.d.ts +1 -0
- package/dist/lib/host/theme/devtools.js +166 -0
- package/dist/lib/host/theme/dialogs.d.ts +1 -0
- package/dist/lib/host/theme/dialogs.js +63 -0
- package/dist/lib/host/theme/fluent.d.ts +1 -0
- package/dist/lib/host/theme/fluent.js +64 -0
- package/dist/lib/host/theme/forms.d.ts +1 -0
- package/dist/lib/host/theme/forms.js +239 -0
- package/dist/lib/host/theme/fusion.d.ts +1 -0
- package/dist/lib/host/theme/fusion.js +66 -0
- package/dist/lib/host/theme/layout.d.ts +1 -0
- package/dist/lib/host/theme/layout.js +166 -0
- package/dist/lib/host/theme/media.d.ts +1 -0
- package/dist/lib/host/theme/media.js +106 -0
- package/dist/lib/host/theme/navigation.d.ts +1 -0
- package/dist/lib/host/theme/navigation.js +36 -0
- package/dist/lib/host/theme/panes.d.ts +1 -0
- package/dist/lib/host/theme/panes.js +99 -0
- package/dist/lib/host/theme/popups.d.ts +1 -0
- package/dist/lib/host/theme/popups.js +149 -0
- package/dist/lib/host/theme/responsive.d.ts +1 -0
- package/dist/lib/host/theme/responsive.js +103 -0
- package/dist/lib/host/theme/toasts.d.ts +1 -0
- package/dist/lib/host/theme/toasts.js +62 -0
- package/dist/lib/host/theme.js +19 -1384
- package/dist/lib/ui/dialect/events.trb +276 -0
- package/dist/lib/ui/dialect/faces.trb +135 -0
- package/dist/lib/ui/dialect/layout.trb +283 -0
- package/dist/lib/ui/dialect/palette.trb +87 -0
- package/dist/lib/ui/dialect/problems.trb +174 -0
- package/dist/lib/ui/dialect/reactions.trb +198 -0
- package/dist/lib/ui/dialect/rows.trb +208 -0
- package/dist/lib/ui/dialect/screens.trb +293 -0
- package/dist/lib/ui/dialect/steps.trb +203 -0
- package/dist/lib/ui/dialect/validation.trb +137 -0
- package/dist/lib/ui/dialect/view.trb +110 -0
- package/dist/lib/ui/dialect/walking.trb +98 -0
- package/dist/lib/ui/dialect/words.trb +70 -0
- package/dist/lib/ui/i18n.trb +17 -0
- package/dist/lib/ui/test.trb +3 -556
- package/dist/lib/ui/testing/actions.trb +421 -0
- package/dist/lib/ui/testing/faces.trb +148 -0
- package/dist/lib/ui/testing/server.trb +73 -0
- package/dist/lib/ui/ui.trb +25 -1675
- package/dist/trebol.js +4463 -1891
- package/package.json +1 -1
- package/src/core/boot.ts +9 -6
- package/src/core/eval.ts +2 -2
- package/src/core/machine/checks.ts +251 -0
- package/src/core/machine/events.ts +366 -0
- package/src/core/machine/running.ts +181 -0
- package/src/core/machine/shared.ts +124 -0
- package/src/core/machine/snapshot.ts +245 -0
- package/src/core/machine/spec.ts +275 -0
- package/src/core/machine/words.ts +99 -0
- package/src/core/machine.ts +20 -0
- package/src/core/mezz.ts +31 -0
- package/src/core/natives/control.ts +1 -1
- package/src/core/natives/data.ts +6 -1
- package/src/core/natives/parse.ts +1 -1
- package/src/core/natives/series.ts +47 -11
- package/src/core/natives/text.ts +0 -1
- package/src/host/browser/calendar.ts +264 -0
- package/src/host/browser/count.ts +48 -0
- package/src/host/browser/dialogs.ts +439 -0
- package/src/host/browser/drag.ts +278 -0
- package/src/host/browser/drawings.ts +178 -0
- package/src/host/browser/events.ts +117 -0
- package/src/host/browser/faces.ts +143 -0
- package/src/host/browser/fields.ts +315 -0
- package/src/host/browser/keys.ts +145 -0
- package/src/host/browser/lookup.ts +262 -0
- package/src/host/browser/menus.ts +146 -0
- package/src/host/browser/mount.ts +420 -0
- package/src/host/browser/orbits.ts +418 -0
- package/src/host/browser/page.ts +43 -0
- package/src/host/browser/richtext.ts +346 -0
- package/src/host/browser/row-faces.ts +75 -0
- package/src/host/browser/screens.ts +142 -0
- package/src/host/browser/swipe.ts +168 -0
- package/src/host/browser/sync.ts +354 -0
- package/src/host/browser/tables.ts +461 -0
- package/src/host/browser/times.ts +115 -0
- package/src/host/browser/toolbars.ts +126 -0
- package/src/host/browser/trees.ts +205 -0
- package/src/host/browser/uploads.ts +367 -0
- package/src/host/browser/widget.ts +103 -0
- package/src/host/browser.ts +82 -4612
- package/src/host/devtools/console.ts +102 -0
- package/src/host/devtools/faces.ts +160 -0
- package/src/host/devtools/log.ts +34 -0
- package/src/host/devtools/machines.ts +208 -0
- package/src/host/devtools/read.ts +58 -0
- package/src/host/devtools/state.ts +148 -0
- package/src/host/devtools.ts +39 -442
- package/src/host/fonts.ts +4 -3
- package/src/host/icons.ts +4 -0
- package/src/host/index.ts +107 -4
- package/src/host/locale.ts +71 -5
- package/src/host/markdown.ts +9 -0
- package/src/host/modules.ts +117 -21
- package/src/host/motion.ts +204 -0
- package/src/host/net.ts +4 -2
- package/src/host/palette.ts +139 -0
- package/src/host/scheduler.ts +5 -0
- package/src/host/share.ts +168 -0
- package/src/host/theme/classic.ts +121 -0
- package/src/host/theme/cupertino.ts +66 -0
- package/src/host/theme/data.ts +110 -0
- package/src/host/theme/devtools.ts +167 -0
- package/src/host/theme/dialogs.ts +64 -0
- package/src/host/theme/fluent.ts +65 -0
- package/src/host/theme/forms.ts +240 -0
- package/src/host/theme/fusion.ts +67 -0
- package/src/host/theme/layout.ts +167 -0
- package/src/host/theme/media.ts +107 -0
- package/src/host/theme/navigation.ts +37 -0
- package/src/host/theme/panes.ts +100 -0
- package/src/host/theme/popups.ts +150 -0
- package/src/host/theme/responsive.ts +104 -0
- package/src/host/theme/toasts.ts +63 -0
- package/src/host/theme.ts +19 -1384
- package/src/ui/dialect/events.trb +276 -0
- package/src/ui/dialect/faces.trb +135 -0
- package/src/ui/dialect/layout.trb +283 -0
- package/src/ui/dialect/palette.trb +87 -0
- package/src/ui/dialect/problems.trb +174 -0
- package/src/ui/dialect/reactions.trb +198 -0
- package/src/ui/dialect/rows.trb +208 -0
- package/src/ui/dialect/screens.trb +293 -0
- package/src/ui/dialect/steps.trb +203 -0
- package/src/ui/dialect/validation.trb +137 -0
- package/src/ui/dialect/view.trb +110 -0
- package/src/ui/dialect/walking.trb +98 -0
- package/src/ui/dialect/words.trb +70 -0
- package/src/ui/i18n.trb +17 -0
- package/src/ui/test.trb +3 -556
- package/src/ui/testing/actions.trb +421 -0
- package/src/ui/testing/faces.trb +148 -0
- package/src/ui/testing/server.trb +73 -0
- package/src/ui/ui.trb +25 -1675
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
import type { ObjectCell } from '../../core/index.ts';
|
|
2
|
+
import type { Host } from '../index.ts';
|
|
3
|
+
/** What the dev tools need from the browser host. */
|
|
4
|
+
export interface DevSide {
|
|
5
|
+
host: Host;
|
|
6
|
+
/** The folder trebol dev serves, to link a face to its file; null if unknown. */
|
|
7
|
+
root: string | null;
|
|
8
|
+
/** The face whose own node this is, if any. */
|
|
9
|
+
faceOf(e: Element): ObjectCell | null;
|
|
10
|
+
/** The face of a node or of the nearest node around it that is one. */
|
|
11
|
+
faceAt(e: Element): {
|
|
12
|
+
face: ObjectCell;
|
|
13
|
+
el: HTMLElement;
|
|
14
|
+
} | null;
|
|
15
|
+
/** The node of a face on the page, if it is on the page. */
|
|
16
|
+
nodeOf(face: ObjectCell): HTMLElement | null;
|
|
17
|
+
}
|
|
18
|
+
export type Tab = 'faces' | 'machines' | 'console' | 'log';
|
|
19
|
+
/** The panel's state, kept across the reloads of live reload. */
|
|
20
|
+
export interface State {
|
|
21
|
+
open: boolean;
|
|
22
|
+
tab: Tab;
|
|
23
|
+
height: number;
|
|
24
|
+
}
|
|
25
|
+
export declare const STATE_KEY = "trebol-dev";
|
|
26
|
+
export declare const HISTORY_KEY = "trebol-dev-history";
|
|
27
|
+
export declare const MAX_HISTORY = 100;
|
|
28
|
+
export declare const MAX_LOG = 500;
|
|
29
|
+
export declare const MAX_MOLD = 2000;
|
|
30
|
+
export declare let side: DevSide;
|
|
31
|
+
export declare function setSide(v: DevSide): void;
|
|
32
|
+
export declare let state: State;
|
|
33
|
+
export declare function setState(v: State): void;
|
|
34
|
+
export declare let panel: HTMLElement;
|
|
35
|
+
export declare function setPanel(v: HTMLElement): void;
|
|
36
|
+
export declare let opener: HTMLButtonElement;
|
|
37
|
+
export declare function setOpener(v: HTMLButtonElement): void;
|
|
38
|
+
export declare let outline: HTMLElement;
|
|
39
|
+
export declare function setOutline(v: HTMLElement): void;
|
|
40
|
+
export declare let pickButton: HTMLButtonElement;
|
|
41
|
+
export declare function setPickButton(v: HTMLButtonElement): void;
|
|
42
|
+
export declare let tree: HTMLElement;
|
|
43
|
+
export declare function setTree(v: HTMLElement): void;
|
|
44
|
+
export declare let detail: HTMLElement;
|
|
45
|
+
export declare function setDetail(v: HTMLElement): void;
|
|
46
|
+
export declare let consoleOut: HTMLElement;
|
|
47
|
+
export declare function setConsoleOut(v: HTMLElement): void;
|
|
48
|
+
export declare let consoleIn: HTMLTextAreaElement;
|
|
49
|
+
export declare function setConsoleIn(v: HTMLTextAreaElement): void;
|
|
50
|
+
export declare let consoleFace: HTMLElement;
|
|
51
|
+
export declare function setConsoleFace(v: HTMLElement): void;
|
|
52
|
+
export declare let logList: HTMLElement;
|
|
53
|
+
export declare function setLogList(v: HTMLElement): void;
|
|
54
|
+
export declare const tabs: Map<Tab, {
|
|
55
|
+
button: HTMLButtonElement;
|
|
56
|
+
pane: HTMLElement;
|
|
57
|
+
}>;
|
|
58
|
+
/** The face chosen in Faces, `face` in Console. */
|
|
59
|
+
export declare let picked: ObjectCell | null;
|
|
60
|
+
export declare function setPicked(v: ObjectCell | null): void;
|
|
61
|
+
/** The face under the pointer or the tree row the pointer is on. */
|
|
62
|
+
export declare let pointed: ObjectCell | null;
|
|
63
|
+
export declare function setPointed(v: ObjectCell | null): void;
|
|
64
|
+
export declare let picking: boolean;
|
|
65
|
+
export declare function storePicking(v: typeof picking): void;
|
|
66
|
+
export declare let history: string[];
|
|
67
|
+
export declare function setHistory(v: string[]): void;
|
|
68
|
+
export declare let back: number;
|
|
69
|
+
export declare function setBack(v: typeof back): void;
|
|
70
|
+
export declare let lastLog: {
|
|
71
|
+
key: string;
|
|
72
|
+
li: HTMLElement;
|
|
73
|
+
text: HTMLElement;
|
|
74
|
+
count: number;
|
|
75
|
+
} | null;
|
|
76
|
+
export declare function setLastLog(v: {
|
|
77
|
+
key: string;
|
|
78
|
+
li: HTMLElement;
|
|
79
|
+
text: HTMLElement;
|
|
80
|
+
count: number;
|
|
81
|
+
} | null): void;
|
|
82
|
+
export declare let treeFrame: number;
|
|
83
|
+
export declare function setTreeFrame(v: typeof treeFrame): void;
|
|
84
|
+
/** The code typed so far runs one piece after another. */
|
|
85
|
+
export declare let running: Promise<void>;
|
|
86
|
+
export declare function setRunning(v: Promise<void>): void;
|
|
87
|
+
export declare function el<T extends keyof HTMLElementTagNameMap>(tag: T, cls?: string, content?: string): HTMLElementTagNameMap[T];
|
|
88
|
+
export declare function button(cls: string, content: string, act: () => void): HTMLButtonElement;
|
|
89
|
+
export declare function read<T>(store: () => Storage, key: string, fallback: T): T;
|
|
90
|
+
export declare function write(store: () => Storage, key: string, v: unknown): void;
|
|
@@ -0,0 +1,123 @@
|
|
|
1
|
+
// --- what the dev tools share ------------------------------------------------------
|
|
2
|
+
//
|
|
3
|
+
// What the dev tools need from the host, the panel's elements and state, and small helpers to make and keep them.
|
|
4
|
+
export const STATE_KEY = 'trebol-dev';
|
|
5
|
+
export const HISTORY_KEY = 'trebol-dev-history';
|
|
6
|
+
export const MAX_HISTORY = 100;
|
|
7
|
+
export const MAX_LOG = 500;
|
|
8
|
+
export const MAX_MOLD = 2000;
|
|
9
|
+
export let side;
|
|
10
|
+
export function setSide(v) {
|
|
11
|
+
side = v;
|
|
12
|
+
}
|
|
13
|
+
export let state = { open: false, tab: 'faces', height: 320 };
|
|
14
|
+
export function setState(v) {
|
|
15
|
+
state = v;
|
|
16
|
+
}
|
|
17
|
+
export let panel;
|
|
18
|
+
export function setPanel(v) {
|
|
19
|
+
panel = v;
|
|
20
|
+
}
|
|
21
|
+
export let opener;
|
|
22
|
+
export function setOpener(v) {
|
|
23
|
+
opener = v;
|
|
24
|
+
}
|
|
25
|
+
export let outline;
|
|
26
|
+
export function setOutline(v) {
|
|
27
|
+
outline = v;
|
|
28
|
+
}
|
|
29
|
+
export let pickButton;
|
|
30
|
+
export function setPickButton(v) {
|
|
31
|
+
pickButton = v;
|
|
32
|
+
}
|
|
33
|
+
export let tree;
|
|
34
|
+
export function setTree(v) {
|
|
35
|
+
tree = v;
|
|
36
|
+
}
|
|
37
|
+
export let detail;
|
|
38
|
+
export function setDetail(v) {
|
|
39
|
+
detail = v;
|
|
40
|
+
}
|
|
41
|
+
export let consoleOut;
|
|
42
|
+
export function setConsoleOut(v) {
|
|
43
|
+
consoleOut = v;
|
|
44
|
+
}
|
|
45
|
+
export let consoleIn;
|
|
46
|
+
export function setConsoleIn(v) {
|
|
47
|
+
consoleIn = v;
|
|
48
|
+
}
|
|
49
|
+
export let consoleFace;
|
|
50
|
+
export function setConsoleFace(v) {
|
|
51
|
+
consoleFace = v;
|
|
52
|
+
}
|
|
53
|
+
export let logList;
|
|
54
|
+
export function setLogList(v) {
|
|
55
|
+
logList = v;
|
|
56
|
+
}
|
|
57
|
+
export const tabs = new Map();
|
|
58
|
+
/** The face chosen in Faces, `face` in Console. */
|
|
59
|
+
export let picked = null;
|
|
60
|
+
export function setPicked(v) {
|
|
61
|
+
picked = v;
|
|
62
|
+
}
|
|
63
|
+
/** The face under the pointer or the tree row the pointer is on. */
|
|
64
|
+
export let pointed = null;
|
|
65
|
+
export function setPointed(v) {
|
|
66
|
+
pointed = v;
|
|
67
|
+
}
|
|
68
|
+
export let picking = false;
|
|
69
|
+
export function storePicking(v) {
|
|
70
|
+
picking = v;
|
|
71
|
+
}
|
|
72
|
+
export let history = [];
|
|
73
|
+
export function setHistory(v) {
|
|
74
|
+
history = v;
|
|
75
|
+
}
|
|
76
|
+
export let back = 0;
|
|
77
|
+
export function setBack(v) {
|
|
78
|
+
back = v;
|
|
79
|
+
}
|
|
80
|
+
export let lastLog = null;
|
|
81
|
+
export function setLastLog(v) {
|
|
82
|
+
lastLog = v;
|
|
83
|
+
}
|
|
84
|
+
export let treeFrame = 0;
|
|
85
|
+
export function setTreeFrame(v) {
|
|
86
|
+
treeFrame = v;
|
|
87
|
+
}
|
|
88
|
+
/** The code typed so far runs one piece after another. */
|
|
89
|
+
export let running = Promise.resolve();
|
|
90
|
+
export function setRunning(v) {
|
|
91
|
+
running = v;
|
|
92
|
+
}
|
|
93
|
+
export function el(tag, cls, content) {
|
|
94
|
+
const e = document.createElement(tag);
|
|
95
|
+
if (cls)
|
|
96
|
+
e.className = cls;
|
|
97
|
+
if (content !== undefined)
|
|
98
|
+
e.textContent = content;
|
|
99
|
+
return e;
|
|
100
|
+
}
|
|
101
|
+
export function button(cls, content, act) {
|
|
102
|
+
const b = el('button', cls, content);
|
|
103
|
+
b.type = 'button';
|
|
104
|
+
b.addEventListener('click', act);
|
|
105
|
+
return b;
|
|
106
|
+
}
|
|
107
|
+
export function read(store, key, fallback) {
|
|
108
|
+
try {
|
|
109
|
+
const v = store().getItem(key);
|
|
110
|
+
return v === null ? fallback : { ...fallback, ...JSON.parse(v) };
|
|
111
|
+
}
|
|
112
|
+
catch {
|
|
113
|
+
return fallback;
|
|
114
|
+
}
|
|
115
|
+
}
|
|
116
|
+
export function write(store, key, v) {
|
|
117
|
+
try {
|
|
118
|
+
store().setItem(key, JSON.stringify(v));
|
|
119
|
+
}
|
|
120
|
+
catch {
|
|
121
|
+
// a private window or blocked storage: the panel forgets, nothing else
|
|
122
|
+
}
|
|
123
|
+
}
|
|
@@ -1,23 +1,19 @@
|
|
|
1
|
-
import { type
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
export interface DevSide {
|
|
5
|
-
host: Host;
|
|
6
|
-
/** The folder trebol dev serves, to link a face to its file; null if unknown. */
|
|
7
|
-
root: string | null;
|
|
8
|
-
/** The face whose own node this is, if any. */
|
|
9
|
-
faceOf(e: Element): ObjectCell | null;
|
|
10
|
-
/** The face of a node or of the nearest node around it that is one. */
|
|
11
|
-
faceAt(e: Element): {
|
|
12
|
-
face: ObjectCell;
|
|
13
|
-
el: HTMLElement;
|
|
14
|
-
} | null;
|
|
15
|
-
/** The node of a face on the page, if it is on the page. */
|
|
16
|
-
nodeOf(face: ObjectCell): HTMLElement | null;
|
|
17
|
-
}
|
|
18
|
-
/** How a face is named in the tree, the log and errors: its style, name and text (`field email "Email"`). */
|
|
19
|
-
export declare function faceRef(face: ObjectCell, rt: Runtime): string;
|
|
1
|
+
import { type DevSide, type Tab } from './devtools/state.ts';
|
|
2
|
+
export { faceRef } from './devtools/read.ts';
|
|
3
|
+
export type { DevSide } from './devtools/state.ts';
|
|
20
4
|
/** Starts the dev tools on a page served by trebol dev; not in a frame (the documentation's examples). */
|
|
21
5
|
export declare function startDevtools(s: DevSide): void;
|
|
22
6
|
/** Keys typed in the panel are not the app's: its shortcuts and on-key leave them. */
|
|
23
7
|
export declare function inDevtools(target: EventTarget | null): boolean;
|
|
8
|
+
/**
|
|
9
|
+
* Puts the panel, its opener and the outline inside the dialog on show, or back in the body: while a
|
|
10
|
+
* modal dialog is open everything outside it is inert, the panel too.
|
|
11
|
+
*/
|
|
12
|
+
export declare function home(): void;
|
|
13
|
+
export declare function setOpen(open: boolean): void;
|
|
14
|
+
export declare function setHeight(h: number): void;
|
|
15
|
+
export declare function resizeFrom(ev: PointerEvent): void;
|
|
16
|
+
export declare function openTab(tab: Tab): void;
|
|
17
|
+
/** What the host tells: events, requests, notes and repaints. */
|
|
18
|
+
export declare function hook(): void;
|
|
19
|
+
export declare function refresh(): void;
|