nexa-devtools 0.1.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.
@@ -0,0 +1,10 @@
1
+ import { type Signal } from 'nexa-reactivity';
2
+ import { type ComponentInstance } from 'nexa-runtime';
3
+ export declare function devSignal<T>(label: string, signal: Signal<T>): Signal<T>;
4
+ export declare function devComponent(name: string, instance: ComponentInstance): number;
5
+ export declare function inspectSignals(): Record<string, any>;
6
+ export declare function inspectComponents(): Record<string, any>[];
7
+ export declare function inspectStore(): Record<string, any>;
8
+ export declare function clearDevTools(): void;
9
+ export declare function initDevTools(): void;
10
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,MAAM,EAAE,MAAM,iBAAiB,CAAA;AAC7C,OAAO,EAAE,KAAK,iBAAiB,EAAE,MAAM,cAAc,CAAA;AAuBrD,wBAAgB,SAAS,CAAC,CAAC,EAAE,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,CAAC,CAAC,CAAC,GAAG,MAAM,CAAC,CAAC,CAAC,CAIxE;AAED,wBAAgB,YAAY,CAAC,IAAI,EAAE,MAAM,EAAE,QAAQ,EAAE,iBAAiB,GAAG,MAAM,CAI9E;AAED,wBAAgB,cAAc,IAAI,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAMpD;AAED,wBAAgB,iBAAiB,IAAI,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,EAAE,CAWzD;AAED,wBAAgB,YAAY,IAAI,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAKlD;AAED,wBAAgB,aAAa,IAAI,IAAI,CAKpC;AAED,wBAAgB,YAAY,IAAI,IAAI,CAUnC"}
package/dist/index.js ADDED
@@ -0,0 +1,57 @@
1
+ let nextSignalId = 1;
2
+ let nextComponentId = 1;
3
+ const signalRegistry = new Map();
4
+ const componentRegistry = new Map();
5
+ export function devSignal(label, signal) {
6
+ const id = nextSignalId++;
7
+ signalRegistry.set(id, { id, label, signal, createdAt: Date.now() });
8
+ return signal;
9
+ }
10
+ export function devComponent(name, instance) {
11
+ const id = nextComponentId++;
12
+ componentRegistry.set(id, { id, name, instance, mountedAt: Date.now(), children: [] });
13
+ return id;
14
+ }
15
+ export function inspectSignals() {
16
+ const result = {};
17
+ for (const [, entry] of signalRegistry) {
18
+ result[entry.label || `signal_${entry.id}`] = entry.signal.peek();
19
+ }
20
+ return result;
21
+ }
22
+ export function inspectComponents() {
23
+ const result = [];
24
+ for (const [, entry] of componentRegistry) {
25
+ result.push({
26
+ id: entry.id,
27
+ name: entry.name,
28
+ mountedAt: entry.mountedAt,
29
+ props: entry.instance.props,
30
+ });
31
+ }
32
+ return result;
33
+ }
34
+ export function inspectStore() {
35
+ return {
36
+ signals: inspectSignals(),
37
+ components: inspectComponents(),
38
+ };
39
+ }
40
+ export function clearDevTools() {
41
+ signalRegistry.clear();
42
+ componentRegistry.clear();
43
+ nextSignalId = 1;
44
+ nextComponentId = 1;
45
+ }
46
+ export function initDevTools() {
47
+ if (typeof window !== 'undefined') {
48
+ const api = {
49
+ inspectSignals,
50
+ inspectComponents,
51
+ inspectStore,
52
+ clear: clearDevTools,
53
+ };
54
+ window.__NEXA_DEVTOOLS__ = api;
55
+ }
56
+ }
57
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAkBA,IAAI,YAAY,GAAG,CAAC,CAAA;AACpB,IAAI,eAAe,GAAG,CAAC,CAAA;AAEvB,MAAM,cAAc,GAAG,IAAI,GAAG,EAAuB,CAAA;AACrD,MAAM,iBAAiB,GAAG,IAAI,GAAG,EAA0B,CAAA;AAE3D,MAAM,UAAU,SAAS,CAAI,KAAa,EAAE,MAAiB;IAC3D,MAAM,EAAE,GAAG,YAAY,EAAE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AAU,EAAE,iBAAiB,EAAE;KAChC,CAAA;AACH,CAAC;AAED,MAAM,UAAU,aAAa;IAC3B,cAAc,CAAC,KAAK,EAAE,CAAA;IACtB,iBAAiB,CAAC,KAAK,EAAE,CAAA;IACzB,YAAY,GAAG,CAAC,CAAA;IAChB,eAAe,GAAG,CAAC,CAAA;AACrB,CAAC;AAED,MAAM,UAAU,YAAY;IAC1B,IAAI,OAAO,MAAM,KAAK,WAAW,EAAE,CAAC;QAClC,MAAM,GAAG,GAAG;YACV,cAAc;YACd,iBAAiB;YACjB,YAAY;YACZ,KAAK,EAAE,aAAa;SACrB,CACA;QAAC,MAAc,CAAC,iBAAiB,GAAG,GAAG,CAAA;IAC1C,CAAC;AACH,CAAC"}
package/package.json ADDED
@@ -0,0 +1,29 @@
1
+ {
2
+ "name": "nexa-devtools",
3
+ "version": "0.1.0",
4
+ "type": "module",
5
+ "main": "./dist/index.js",
6
+ "module": "./dist/index.js",
7
+ "types": "./dist/index.d.ts",
8
+ "exports": {
9
+ ".": {
10
+ "types": "./dist/index.d.ts",
11
+ "import": "./dist/index.js",
12
+ "default": "./dist/index.js"
13
+ }
14
+ },
15
+ "dependencies": {
16
+ "nexa-reactivity": "0.1.0",
17
+ "nexa-runtime": "0.1.0"
18
+ },
19
+ "files": [
20
+ "dist"
21
+ ],
22
+ "publishConfig": {
23
+ "access": "public"
24
+ },
25
+ "scripts": {
26
+ "build": "tsc",
27
+ "clean": "rm -rf dist"
28
+ }
29
+ }