@noego/wood 0.0.1 → 0.0.4
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/bin/wood.js +1 -0
- package/dist/bridge/backend_entry.cjs +23 -4
- package/dist/bridge/backend_entry.cjs.map +1 -1
- package/dist/bridge/backend_entry.d.cts +8 -2
- package/dist/bridge/backend_entry.d.ts +8 -2
- package/dist/bridge/backend_entry.js +22 -4
- package/dist/bridge/backend_entry.js.map +1 -1
- package/dist/bridge/buffered_ipc_sender.cjs +120 -0
- package/dist/bridge/buffered_ipc_sender.cjs.map +1 -0
- package/dist/bridge/buffered_ipc_sender.d.cts +49 -0
- package/dist/bridge/buffered_ipc_sender.d.ts +49 -0
- package/dist/bridge/buffered_ipc_sender.js +95 -0
- package/dist/bridge/buffered_ipc_sender.js.map +1 -0
- package/dist/client/controller_contract.cjs.map +1 -1
- package/dist/client/controller_contract.d.cts +3 -5
- package/dist/client/controller_contract.d.ts +3 -5
- package/dist/client/index.cjs +18 -20
- package/dist/client/index.cjs.map +1 -1
- package/dist/client/index.d.cts +1 -2
- package/dist/client/index.d.ts +1 -2
- package/dist/client/index.js +18 -19
- package/dist/client/index.js.map +1 -1
- package/dist/codegen/preload_generator.cjs +10 -4
- package/dist/codegen/preload_generator.cjs.map +1 -1
- package/dist/codegen/preload_generator.js +10 -4
- package/dist/codegen/preload_generator.js.map +1 -1
- package/dist/main/index.cjs +9 -0
- package/dist/main/index.cjs.map +1 -1
- package/dist/main/index.d.cts +4 -0
- package/dist/main/index.d.ts +4 -0
- package/dist/main/index.js +9 -0
- package/dist/main/index.js.map +1 -1
- package/dist/router/wood_router.cjs +1 -1
- package/dist/router/wood_router.cjs.map +1 -1
- package/dist/router/wood_router.d.cts +1 -1
- package/dist/router/wood_router.d.ts +1 -1
- package/dist/router/wood_router.js +1 -1
- package/dist/router/wood_router.js.map +1 -1
- package/dist/runtime/runtime.cjs +35 -24
- package/dist/runtime/runtime.cjs.map +1 -1
- package/dist/runtime/runtime.d.cts +5 -0
- package/dist/runtime/runtime.d.ts +5 -0
- package/dist/runtime/runtime.js +35 -24
- package/dist/runtime/runtime.js.map +1 -1
- package/dist/tracing/index.cjs +6 -2
- package/dist/tracing/index.cjs.map +1 -1
- package/dist/tracing/index.d.cts +1 -1
- package/dist/tracing/index.d.ts +1 -1
- package/dist/tracing/index.js +5 -1
- package/dist/tracing/index.js.map +1 -1
- package/dist/tracing/trace_hub.cjs +37 -8
- package/dist/tracing/trace_hub.cjs.map +1 -1
- package/dist/tracing/trace_hub.d.cts +3 -1
- package/dist/tracing/trace_hub.d.ts +3 -1
- package/dist/tracing/trace_hub.js +34 -7
- package/dist/tracing/trace_hub.js.map +1 -1
- package/dist/tracing/trace_provider.cjs +12 -0
- package/dist/tracing/trace_provider.cjs.map +1 -1
- package/dist/tracing/trace_provider.d.cts +4 -1
- package/dist/tracing/trace_provider.d.ts +4 -1
- package/dist/tracing/trace_provider.js +15 -1
- package/dist/tracing/trace_provider.js.map +1 -1
- package/package.json +1 -1
- package/src/components/WoodRecursiveRender.svelte +6 -6
- package/src/stick/WoodRecursiveRender.svelte +4 -4
- package/dist/client/wood_controller.svelte.cjs +0 -110
- package/dist/client/wood_controller.svelte.cjs.map +0 -1
- package/dist/client/wood_controller.svelte.d.cts +0 -30
- package/dist/client/wood_controller.svelte.d.ts +0 -30
- package/dist/client/wood_controller.svelte.js +0 -86
- package/dist/client/wood_controller.svelte.js.map +0 -1
|
@@ -1,110 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __defProp = Object.defineProperty;
|
|
3
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
-
var __export = (target, all) => {
|
|
7
|
-
for (var name in all)
|
|
8
|
-
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
-
};
|
|
10
|
-
var __copyProps = (to, from2, except, desc) => {
|
|
11
|
-
if (from2 && typeof from2 === "object" || typeof from2 === "function") {
|
|
12
|
-
for (let key of __getOwnPropNames(from2))
|
|
13
|
-
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
-
__defProp(to, key, { get: () => from2[key], enumerable: !(desc = __getOwnPropDesc(from2, key)) || desc.enumerable });
|
|
15
|
-
}
|
|
16
|
-
return to;
|
|
17
|
-
};
|
|
18
|
-
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
-
var wood_controller_svelte_exports = {};
|
|
20
|
-
__export(wood_controller_svelte_exports, {
|
|
21
|
-
WoodController: () => WoodController
|
|
22
|
-
});
|
|
23
|
-
module.exports = __toCommonJS(wood_controller_svelte_exports);
|
|
24
|
-
var import_rxjs = require("rxjs");
|
|
25
|
-
var import_operators = require("rxjs/operators");
|
|
26
|
-
class WoodController {
|
|
27
|
-
constructor() {
|
|
28
|
-
this._state = null;
|
|
29
|
-
this._input = null;
|
|
30
|
-
this._events = null;
|
|
31
|
-
this.destroyed = false;
|
|
32
|
-
this.subscriptions = new import_rxjs.Subscription();
|
|
33
|
-
}
|
|
34
|
-
/**
|
|
35
|
-
* Controller state. Subclasses should define this as a class field
|
|
36
|
-
* (e.g. `readonly state = $state({...})`). The field shadows this getter.
|
|
37
|
-
*
|
|
38
|
-
* For backward compatibility, subclasses that implement `createState()`
|
|
39
|
-
* will have it called lazily via this getter.
|
|
40
|
-
*/
|
|
41
|
-
get state() {
|
|
42
|
-
if (!this._state) {
|
|
43
|
-
if (typeof this.createState === "function") {
|
|
44
|
-
this._state = this.createState();
|
|
45
|
-
}
|
|
46
|
-
}
|
|
47
|
-
return this._state;
|
|
48
|
-
}
|
|
49
|
-
get input() {
|
|
50
|
-
if (!this._input) {
|
|
51
|
-
this._input = this.createInput();
|
|
52
|
-
}
|
|
53
|
-
return this._input;
|
|
54
|
-
}
|
|
55
|
-
get events() {
|
|
56
|
-
if (!this._events) {
|
|
57
|
-
this._events = this.createEvents();
|
|
58
|
-
}
|
|
59
|
-
return this._events;
|
|
60
|
-
}
|
|
61
|
-
get isDestroyed() {
|
|
62
|
-
return this.destroyed;
|
|
63
|
-
}
|
|
64
|
-
track(teardown) {
|
|
65
|
-
this.subscriptions.add(teardown);
|
|
66
|
-
}
|
|
67
|
-
createAction(actionName, strategy, handler) {
|
|
68
|
-
const subject = new import_rxjs.Subject();
|
|
69
|
-
let pipeline$;
|
|
70
|
-
if (strategy === "sync") {
|
|
71
|
-
pipeline$ = subject.pipe(
|
|
72
|
-
(0, import_operators.tap)((payload) => {
|
|
73
|
-
try {
|
|
74
|
-
handler(payload);
|
|
75
|
-
} catch (e) {
|
|
76
|
-
this.handleActionError(actionName, e);
|
|
77
|
-
}
|
|
78
|
-
})
|
|
79
|
-
);
|
|
80
|
-
} else {
|
|
81
|
-
const mapOp = strategy === "exhaust" ? import_operators.exhaustMap : strategy === "switch" ? import_operators.switchMap : strategy === "concat" ? import_operators.concatMap : import_operators.mergeMap;
|
|
82
|
-
pipeline$ = subject.pipe(
|
|
83
|
-
mapOp(
|
|
84
|
-
(payload) => (0, import_rxjs.from)((async () => {
|
|
85
|
-
await handler(payload);
|
|
86
|
-
})()).pipe(
|
|
87
|
-
(0, import_operators.catchError)((error) => {
|
|
88
|
-
this.handleActionError(actionName, error);
|
|
89
|
-
return import_rxjs.EMPTY;
|
|
90
|
-
})
|
|
91
|
-
)
|
|
92
|
-
)
|
|
93
|
-
);
|
|
94
|
-
}
|
|
95
|
-
this.track(pipeline$.subscribe());
|
|
96
|
-
return (payload) => subject.next(payload);
|
|
97
|
-
}
|
|
98
|
-
handleActionError(actionName, error) {
|
|
99
|
-
console.error(`[WoodController] Action '${actionName}' failed:`, error);
|
|
100
|
-
}
|
|
101
|
-
destroy() {
|
|
102
|
-
this.destroyed = true;
|
|
103
|
-
this.subscriptions.unsubscribe();
|
|
104
|
-
}
|
|
105
|
-
}
|
|
106
|
-
// Annotate the CommonJS export names for ESM import in node:
|
|
107
|
-
0 && (module.exports = {
|
|
108
|
-
WoodController
|
|
109
|
-
});
|
|
110
|
-
//# sourceMappingURL=wood_controller.svelte.cjs.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/client/wood_controller.svelte.ts"],"sourcesContent":["import { Subject, Subscription, from, EMPTY, Observable, type Unsubscribable } from 'rxjs';\nimport { exhaustMap, concatMap, switchMap, mergeMap, tap, catchError } from 'rxjs/operators';\nimport type {\n ControllerEvents,\n ControllerInput,\n ControllerState,\n PageController,\n} from './controller_contract';\n\nexport type ActionConcurrency = \n | 'exhaust' \n | 'switch' \n | 'concat' \n | 'merge' \n | 'sync'; \n\nexport abstract class WoodController<\n S extends ControllerState,\n I extends ControllerInput,\n E extends ControllerEvents,\n> implements PageController<S, I, E> {\n private _state: S | null = null;\n private _input: I | null = null;\n private _events: E | null = null;\n private destroyed = false;\n protected readonly subscriptions = new Subscription();\n\n /**\n * Controller state. Subclasses should define this as a class field\n * (e.g. `readonly state = $state({...})`). The field shadows this getter.\n *\n * For backward compatibility, subclasses that implement `createState()`\n * will have it called lazily via this getter.\n */\n get state(): S {\n if (!this._state) {\n if (typeof (this as any).createState === 'function') {\n this._state = (this as any).createState();\n }\n }\n return this._state!;\n }\n\n get input(): I {\n if (!this._input) {\n this._input = this.createInput();\n }\n return this._input;\n }\n\n get events(): E {\n if (!this._events) {\n this._events = this.createEvents();\n }\n return this._events;\n }\n\n protected abstract createInput(): I;\n\n protected abstract createEvents(): E;\n\n protected get isDestroyed(): boolean {\n return this.destroyed;\n }\n\n protected track(teardown: Unsubscribable | (() => void)): void {\n this.subscriptions.add(teardown);\n }\n\n protected createAction<T = void>(\n actionName: string,\n strategy: ActionConcurrency,\n handler: (payload: T) => Promise<void> | void\n ): (payload: T) => void {\n const subject = new Subject<T>();\n let pipeline$: Observable<any>;\n\n if (strategy === 'sync') {\n pipeline$ = subject.pipe(\n tap((payload) => {\n try {\n handler(payload);\n } catch (e) {\n this.handleActionError(actionName, e);\n }\n })\n );\n } else {\n const mapOp = \n strategy === 'exhaust' ? exhaustMap :\n strategy === 'switch' ? switchMap :\n strategy === 'concat' ? concatMap :\n mergeMap;\n\n pipeline$ = subject.pipe(\n mapOp((payload) => \n from((async () => {\n await handler(payload);\n })()).pipe(\n catchError((error) => {\n this.handleActionError(actionName, error);\n return EMPTY; \n })\n )\n )\n );\n }\n\n this.track(pipeline$.subscribe());\n\n return (payload: T) => subject.next(payload);\n }\n\n protected handleActionError(actionName: string, error: unknown): void {\n console.error(`[WoodController] Action '${actionName}' failed:`, error);\n }\n\n destroy(): void {\n this.destroyed = true;\n this.subscriptions.unsubscribe();\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,kBAAoF;AACpF,uBAA4E;AAerE,MAAe,eAIe;AAAA,EAJ9B;AAKL,SAAQ,SAAmB;AAC3B,SAAQ,SAAmB;AAC3B,SAAQ,UAAoB;AAC5B,SAAQ,YAAY;AACpB,SAAmB,gBAAgB,IAAI,yBAAa;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EASpD,IAAI,QAAW;AACb,QAAI,CAAC,KAAK,QAAQ;AAChB,UAAI,OAAQ,KAAa,gBAAgB,YAAY;AACnD,aAAK,SAAU,KAAa,YAAY;AAAA,MAC1C;AAAA,IACF;AACA,WAAO,KAAK;AAAA,EACd;AAAA,EAEA,IAAI,QAAW;AACb,QAAI,CAAC,KAAK,QAAQ;AAChB,WAAK,SAAS,KAAK,YAAY;AAAA,IACjC;AACA,WAAO,KAAK;AAAA,EACd;AAAA,EAEA,IAAI,SAAY;AACd,QAAI,CAAC,KAAK,SAAS;AACjB,WAAK,UAAU,KAAK,aAAa;AAAA,IACnC;AACA,WAAO,KAAK;AAAA,EACd;AAAA,EAMA,IAAc,cAAuB;AACnC,WAAO,KAAK;AAAA,EACd;AAAA,EAEU,MAAM,UAA+C;AAC7D,SAAK,cAAc,IAAI,QAAQ;AAAA,EACjC;AAAA,EAEU,aACR,YACA,UACA,SACsB;AACtB,UAAM,UAAU,IAAI,oBAAW;AAC/B,QAAI;AAEJ,QAAI,aAAa,QAAQ;AACvB,kBAAY,QAAQ;AAAA,YAClB,sBAAI,CAAC,YAAY;AACf,cAAI;AACD,oBAAQ,OAAO;AAAA,UAClB,SAAS,GAAG;AACT,iBAAK,kBAAkB,YAAY,CAAC;AAAA,UACvC;AAAA,QACF,CAAC;AAAA,MACH;AAAA,IACF,OAAO;AACL,YAAM,QACJ,aAAa,YAAY,8BACzB,aAAa,WAAW,6BACxB,aAAa,WAAW,6BACxB;AAEF,kBAAY,QAAQ;AAAA,QAClB;AAAA,UAAM,CAAC,gBACL,mBAAM,YAAY;AACf,kBAAM,QAAQ,OAAO;AAAA,UACxB,GAAG,CAAC,EAAE;AAAA,gBACJ,6BAAW,CAAC,UAAU;AACpB,mBAAK,kBAAkB,YAAY,KAAK;AACxC,qBAAO;AAAA,YACT,CAAC;AAAA,UACH;AAAA,QACF;AAAA,MACF;AAAA,IACF;AAEA,SAAK,MAAM,UAAU,UAAU,CAAC;AAEhC,WAAO,CAAC,YAAe,QAAQ,KAAK,OAAO;AAAA,EAC7C;AAAA,EAEU,kBAAkB,YAAoB,OAAsB;AACpE,YAAQ,MAAM,4BAA4B,UAAU,aAAa,KAAK;AAAA,EACxE;AAAA,EAEA,UAAgB;AACd,SAAK,YAAY;AACjB,SAAK,cAAc,YAAY;AAAA,EACjC;AACF;","names":[]}
|
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
import { Subscription, Unsubscribable } from 'rxjs';
|
|
2
|
-
import { ControllerState, ControllerInput, ControllerEvents, PageController } from './controller_contract.cjs';
|
|
3
|
-
|
|
4
|
-
type ActionConcurrency = 'exhaust' | 'switch' | 'concat' | 'merge' | 'sync';
|
|
5
|
-
declare abstract class WoodController<S extends ControllerState, I extends ControllerInput, E extends ControllerEvents> implements PageController<S, I, E> {
|
|
6
|
-
private _state;
|
|
7
|
-
private _input;
|
|
8
|
-
private _events;
|
|
9
|
-
private destroyed;
|
|
10
|
-
protected readonly subscriptions: Subscription;
|
|
11
|
-
/**
|
|
12
|
-
* Controller state. Subclasses should define this as a class field
|
|
13
|
-
* (e.g. `readonly state = $state({...})`). The field shadows this getter.
|
|
14
|
-
*
|
|
15
|
-
* For backward compatibility, subclasses that implement `createState()`
|
|
16
|
-
* will have it called lazily via this getter.
|
|
17
|
-
*/
|
|
18
|
-
get state(): S;
|
|
19
|
-
get input(): I;
|
|
20
|
-
get events(): E;
|
|
21
|
-
protected abstract createInput(): I;
|
|
22
|
-
protected abstract createEvents(): E;
|
|
23
|
-
protected get isDestroyed(): boolean;
|
|
24
|
-
protected track(teardown: Unsubscribable | (() => void)): void;
|
|
25
|
-
protected createAction<T = void>(actionName: string, strategy: ActionConcurrency, handler: (payload: T) => Promise<void> | void): (payload: T) => void;
|
|
26
|
-
protected handleActionError(actionName: string, error: unknown): void;
|
|
27
|
-
destroy(): void;
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
export { type ActionConcurrency, WoodController };
|
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
import { Subscription, Unsubscribable } from 'rxjs';
|
|
2
|
-
import { ControllerState, ControllerInput, ControllerEvents, PageController } from './controller_contract.js';
|
|
3
|
-
|
|
4
|
-
type ActionConcurrency = 'exhaust' | 'switch' | 'concat' | 'merge' | 'sync';
|
|
5
|
-
declare abstract class WoodController<S extends ControllerState, I extends ControllerInput, E extends ControllerEvents> implements PageController<S, I, E> {
|
|
6
|
-
private _state;
|
|
7
|
-
private _input;
|
|
8
|
-
private _events;
|
|
9
|
-
private destroyed;
|
|
10
|
-
protected readonly subscriptions: Subscription;
|
|
11
|
-
/**
|
|
12
|
-
* Controller state. Subclasses should define this as a class field
|
|
13
|
-
* (e.g. `readonly state = $state({...})`). The field shadows this getter.
|
|
14
|
-
*
|
|
15
|
-
* For backward compatibility, subclasses that implement `createState()`
|
|
16
|
-
* will have it called lazily via this getter.
|
|
17
|
-
*/
|
|
18
|
-
get state(): S;
|
|
19
|
-
get input(): I;
|
|
20
|
-
get events(): E;
|
|
21
|
-
protected abstract createInput(): I;
|
|
22
|
-
protected abstract createEvents(): E;
|
|
23
|
-
protected get isDestroyed(): boolean;
|
|
24
|
-
protected track(teardown: Unsubscribable | (() => void)): void;
|
|
25
|
-
protected createAction<T = void>(actionName: string, strategy: ActionConcurrency, handler: (payload: T) => Promise<void> | void): (payload: T) => void;
|
|
26
|
-
protected handleActionError(actionName: string, error: unknown): void;
|
|
27
|
-
destroy(): void;
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
export { type ActionConcurrency, WoodController };
|
|
@@ -1,86 +0,0 @@
|
|
|
1
|
-
import { Subject, Subscription, from, EMPTY } from "rxjs";
|
|
2
|
-
import { exhaustMap, concatMap, switchMap, mergeMap, tap, catchError } from "rxjs/operators";
|
|
3
|
-
class WoodController {
|
|
4
|
-
constructor() {
|
|
5
|
-
this._state = null;
|
|
6
|
-
this._input = null;
|
|
7
|
-
this._events = null;
|
|
8
|
-
this.destroyed = false;
|
|
9
|
-
this.subscriptions = new Subscription();
|
|
10
|
-
}
|
|
11
|
-
/**
|
|
12
|
-
* Controller state. Subclasses should define this as a class field
|
|
13
|
-
* (e.g. `readonly state = $state({...})`). The field shadows this getter.
|
|
14
|
-
*
|
|
15
|
-
* For backward compatibility, subclasses that implement `createState()`
|
|
16
|
-
* will have it called lazily via this getter.
|
|
17
|
-
*/
|
|
18
|
-
get state() {
|
|
19
|
-
if (!this._state) {
|
|
20
|
-
if (typeof this.createState === "function") {
|
|
21
|
-
this._state = this.createState();
|
|
22
|
-
}
|
|
23
|
-
}
|
|
24
|
-
return this._state;
|
|
25
|
-
}
|
|
26
|
-
get input() {
|
|
27
|
-
if (!this._input) {
|
|
28
|
-
this._input = this.createInput();
|
|
29
|
-
}
|
|
30
|
-
return this._input;
|
|
31
|
-
}
|
|
32
|
-
get events() {
|
|
33
|
-
if (!this._events) {
|
|
34
|
-
this._events = this.createEvents();
|
|
35
|
-
}
|
|
36
|
-
return this._events;
|
|
37
|
-
}
|
|
38
|
-
get isDestroyed() {
|
|
39
|
-
return this.destroyed;
|
|
40
|
-
}
|
|
41
|
-
track(teardown) {
|
|
42
|
-
this.subscriptions.add(teardown);
|
|
43
|
-
}
|
|
44
|
-
createAction(actionName, strategy, handler) {
|
|
45
|
-
const subject = new Subject();
|
|
46
|
-
let pipeline$;
|
|
47
|
-
if (strategy === "sync") {
|
|
48
|
-
pipeline$ = subject.pipe(
|
|
49
|
-
tap((payload) => {
|
|
50
|
-
try {
|
|
51
|
-
handler(payload);
|
|
52
|
-
} catch (e) {
|
|
53
|
-
this.handleActionError(actionName, e);
|
|
54
|
-
}
|
|
55
|
-
})
|
|
56
|
-
);
|
|
57
|
-
} else {
|
|
58
|
-
const mapOp = strategy === "exhaust" ? exhaustMap : strategy === "switch" ? switchMap : strategy === "concat" ? concatMap : mergeMap;
|
|
59
|
-
pipeline$ = subject.pipe(
|
|
60
|
-
mapOp(
|
|
61
|
-
(payload) => from((async () => {
|
|
62
|
-
await handler(payload);
|
|
63
|
-
})()).pipe(
|
|
64
|
-
catchError((error) => {
|
|
65
|
-
this.handleActionError(actionName, error);
|
|
66
|
-
return EMPTY;
|
|
67
|
-
})
|
|
68
|
-
)
|
|
69
|
-
)
|
|
70
|
-
);
|
|
71
|
-
}
|
|
72
|
-
this.track(pipeline$.subscribe());
|
|
73
|
-
return (payload) => subject.next(payload);
|
|
74
|
-
}
|
|
75
|
-
handleActionError(actionName, error) {
|
|
76
|
-
console.error(`[WoodController] Action '${actionName}' failed:`, error);
|
|
77
|
-
}
|
|
78
|
-
destroy() {
|
|
79
|
-
this.destroyed = true;
|
|
80
|
-
this.subscriptions.unsubscribe();
|
|
81
|
-
}
|
|
82
|
-
}
|
|
83
|
-
export {
|
|
84
|
-
WoodController
|
|
85
|
-
};
|
|
86
|
-
//# sourceMappingURL=wood_controller.svelte.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/client/wood_controller.svelte.ts"],"sourcesContent":["import { Subject, Subscription, from, EMPTY, Observable, type Unsubscribable } from 'rxjs';\nimport { exhaustMap, concatMap, switchMap, mergeMap, tap, catchError } from 'rxjs/operators';\nimport type {\n ControllerEvents,\n ControllerInput,\n ControllerState,\n PageController,\n} from './controller_contract';\n\nexport type ActionConcurrency = \n | 'exhaust' \n | 'switch' \n | 'concat' \n | 'merge' \n | 'sync'; \n\nexport abstract class WoodController<\n S extends ControllerState,\n I extends ControllerInput,\n E extends ControllerEvents,\n> implements PageController<S, I, E> {\n private _state: S | null = null;\n private _input: I | null = null;\n private _events: E | null = null;\n private destroyed = false;\n protected readonly subscriptions = new Subscription();\n\n /**\n * Controller state. Subclasses should define this as a class field\n * (e.g. `readonly state = $state({...})`). The field shadows this getter.\n *\n * For backward compatibility, subclasses that implement `createState()`\n * will have it called lazily via this getter.\n */\n get state(): S {\n if (!this._state) {\n if (typeof (this as any).createState === 'function') {\n this._state = (this as any).createState();\n }\n }\n return this._state!;\n }\n\n get input(): I {\n if (!this._input) {\n this._input = this.createInput();\n }\n return this._input;\n }\n\n get events(): E {\n if (!this._events) {\n this._events = this.createEvents();\n }\n return this._events;\n }\n\n protected abstract createInput(): I;\n\n protected abstract createEvents(): E;\n\n protected get isDestroyed(): boolean {\n return this.destroyed;\n }\n\n protected track(teardown: Unsubscribable | (() => void)): void {\n this.subscriptions.add(teardown);\n }\n\n protected createAction<T = void>(\n actionName: string,\n strategy: ActionConcurrency,\n handler: (payload: T) => Promise<void> | void\n ): (payload: T) => void {\n const subject = new Subject<T>();\n let pipeline$: Observable<any>;\n\n if (strategy === 'sync') {\n pipeline$ = subject.pipe(\n tap((payload) => {\n try {\n handler(payload);\n } catch (e) {\n this.handleActionError(actionName, e);\n }\n })\n );\n } else {\n const mapOp = \n strategy === 'exhaust' ? exhaustMap :\n strategy === 'switch' ? switchMap :\n strategy === 'concat' ? concatMap :\n mergeMap;\n\n pipeline$ = subject.pipe(\n mapOp((payload) => \n from((async () => {\n await handler(payload);\n })()).pipe(\n catchError((error) => {\n this.handleActionError(actionName, error);\n return EMPTY; \n })\n )\n )\n );\n }\n\n this.track(pipeline$.subscribe());\n\n return (payload: T) => subject.next(payload);\n }\n\n protected handleActionError(actionName: string, error: unknown): void {\n console.error(`[WoodController] Action '${actionName}' failed:`, error);\n }\n\n destroy(): void {\n this.destroyed = true;\n this.subscriptions.unsubscribe();\n }\n}\n"],"mappings":"AAAA,SAAS,SAAS,cAAc,MAAM,aAA8C;AACpF,SAAS,YAAY,WAAW,WAAW,UAAU,KAAK,kBAAkB;AAerE,MAAe,eAIe;AAAA,EAJ9B;AAKL,SAAQ,SAAmB;AAC3B,SAAQ,SAAmB;AAC3B,SAAQ,UAAoB;AAC5B,SAAQ,YAAY;AACpB,SAAmB,gBAAgB,IAAI,aAAa;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EASpD,IAAI,QAAW;AACb,QAAI,CAAC,KAAK,QAAQ;AAChB,UAAI,OAAQ,KAAa,gBAAgB,YAAY;AACnD,aAAK,SAAU,KAAa,YAAY;AAAA,MAC1C;AAAA,IACF;AACA,WAAO,KAAK;AAAA,EACd;AAAA,EAEA,IAAI,QAAW;AACb,QAAI,CAAC,KAAK,QAAQ;AAChB,WAAK,SAAS,KAAK,YAAY;AAAA,IACjC;AACA,WAAO,KAAK;AAAA,EACd;AAAA,EAEA,IAAI,SAAY;AACd,QAAI,CAAC,KAAK,SAAS;AACjB,WAAK,UAAU,KAAK,aAAa;AAAA,IACnC;AACA,WAAO,KAAK;AAAA,EACd;AAAA,EAMA,IAAc,cAAuB;AACnC,WAAO,KAAK;AAAA,EACd;AAAA,EAEU,MAAM,UAA+C;AAC7D,SAAK,cAAc,IAAI,QAAQ;AAAA,EACjC;AAAA,EAEU,aACR,YACA,UACA,SACsB;AACtB,UAAM,UAAU,IAAI,QAAW;AAC/B,QAAI;AAEJ,QAAI,aAAa,QAAQ;AACvB,kBAAY,QAAQ;AAAA,QAClB,IAAI,CAAC,YAAY;AACf,cAAI;AACD,oBAAQ,OAAO;AAAA,UAClB,SAAS,GAAG;AACT,iBAAK,kBAAkB,YAAY,CAAC;AAAA,UACvC;AAAA,QACF,CAAC;AAAA,MACH;AAAA,IACF,OAAO;AACL,YAAM,QACJ,aAAa,YAAY,aACzB,aAAa,WAAW,YACxB,aAAa,WAAW,YACxB;AAEF,kBAAY,QAAQ;AAAA,QAClB;AAAA,UAAM,CAAC,YACL,MAAM,YAAY;AACf,kBAAM,QAAQ,OAAO;AAAA,UACxB,GAAG,CAAC,EAAE;AAAA,YACJ,WAAW,CAAC,UAAU;AACpB,mBAAK,kBAAkB,YAAY,KAAK;AACxC,qBAAO;AAAA,YACT,CAAC;AAAA,UACH;AAAA,QACF;AAAA,MACF;AAAA,IACF;AAEA,SAAK,MAAM,UAAU,UAAU,CAAC;AAEhC,WAAO,CAAC,YAAe,QAAQ,KAAK,OAAO;AAAA,EAC7C;AAAA,EAEU,kBAAkB,YAAoB,OAAsB;AACpE,YAAQ,MAAM,4BAA4B,UAAU,aAAa,KAAK;AAAA,EACxE;AAAA,EAEA,UAAgB;AACd,SAAK,YAAY;AACjB,SAAK,cAAc,YAAY;AAAA,EACjC;AACF;","names":[]}
|