@playfast/reform 0.0.1
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 +64 -0
- package/dist/cjs/boundary/boundary.js +86 -0
- package/dist/cjs/calc/asyncCalc.js +128 -0
- package/dist/cjs/calc/asyncData.js +37 -0
- package/dist/cjs/calc/calc.js +58 -0
- package/dist/cjs/calc/calcFamily.js +127 -0
- package/dist/cjs/channel/channel.js +142 -0
- package/dist/cjs/compose/composition.js +50 -0
- package/dist/cjs/compose/host.js +8 -0
- package/dist/cjs/compose/props.js +14 -0
- package/dist/cjs/compose/provide.js +30 -0
- package/dist/cjs/compose/slot.js +27 -0
- package/dist/cjs/compose/ui.js +61 -0
- package/dist/cjs/definition/definition.js +46 -0
- package/dist/cjs/event/event.js +36 -0
- package/dist/cjs/event/eventGroup.js +7 -0
- package/dist/cjs/feature/feature.js +102 -0
- package/dist/cjs/index.js +116 -0
- package/dist/cjs/internal/capture.js +14 -0
- package/dist/cjs/internal/ctx.js +2 -0
- package/dist/cjs/internal/errors.js +62 -0
- package/dist/cjs/internal/inspect.js +36 -0
- package/dist/cjs/internal/queryDriver.js +138 -0
- package/dist/cjs/internal/reuse.js +71 -0
- package/dist/cjs/internal/scheduler.js +73 -0
- package/dist/cjs/internal/seeds.js +19 -0
- package/dist/cjs/internal/sources.js +61 -0
- package/dist/cjs/internal/store.js +77 -0
- package/dist/cjs/internal/track.js +22 -0
- package/dist/cjs/package.json +4 -0
- package/dist/cjs/procedure/procedure.js +52 -0
- package/dist/cjs/reducer/reducer.js +64 -0
- package/dist/cjs/remote/remoteState.js +307 -0
- package/dist/cjs/runtime/bus.js +25 -0
- package/dist/cjs/runtime/loop.js +119 -0
- package/dist/cjs/scene/scene.js +36 -0
- package/dist/cjs/state/state.js +47 -0
- package/dist/cjs/state/stateFamily.js +101 -0
- package/dist/cjs/state/stateGroup.js +47 -0
- package/dist/cjs/state/token.js +23 -0
- package/dist/cjs/ui/node.js +2 -0
- package/dist/cjs/ui/trigger.js +2 -0
- package/dist/dts/boundary/boundary.d.ts +72 -0
- package/dist/dts/boundary/boundary.d.ts.map +1 -0
- package/dist/dts/calc/asyncCalc.d.ts +91 -0
- package/dist/dts/calc/asyncCalc.d.ts.map +1 -0
- package/dist/dts/calc/asyncData.d.ts +55 -0
- package/dist/dts/calc/asyncData.d.ts.map +1 -0
- package/dist/dts/calc/calc.d.ts +57 -0
- package/dist/dts/calc/calc.d.ts.map +1 -0
- package/dist/dts/calc/calcFamily.d.ts +57 -0
- package/dist/dts/calc/calcFamily.d.ts.map +1 -0
- package/dist/dts/channel/channel.d.ts +115 -0
- package/dist/dts/channel/channel.d.ts.map +1 -0
- package/dist/dts/compose/composition.d.ts +72 -0
- package/dist/dts/compose/composition.d.ts.map +1 -0
- package/dist/dts/compose/host.d.ts +17 -0
- package/dist/dts/compose/host.d.ts.map +1 -0
- package/dist/dts/compose/props.d.ts +13 -0
- package/dist/dts/compose/props.d.ts.map +1 -0
- package/dist/dts/compose/provide.d.ts +22 -0
- package/dist/dts/compose/provide.d.ts.map +1 -0
- package/dist/dts/compose/slot.d.ts +49 -0
- package/dist/dts/compose/slot.d.ts.map +1 -0
- package/dist/dts/compose/ui.d.ts +50 -0
- package/dist/dts/compose/ui.d.ts.map +1 -0
- package/dist/dts/definition/definition.d.ts +33 -0
- package/dist/dts/definition/definition.d.ts.map +1 -0
- package/dist/dts/event/event.d.ts +33 -0
- package/dist/dts/event/event.d.ts.map +1 -0
- package/dist/dts/event/eventGroup.d.ts +9 -0
- package/dist/dts/event/eventGroup.d.ts.map +1 -0
- package/dist/dts/feature/feature.d.ts +220 -0
- package/dist/dts/feature/feature.d.ts.map +1 -0
- package/dist/dts/index.d.ts +43 -0
- package/dist/dts/index.d.ts.map +1 -0
- package/dist/dts/internal/capture.d.ts +28 -0
- package/dist/dts/internal/capture.d.ts.map +1 -0
- package/dist/dts/internal/ctx.d.ts +12 -0
- package/dist/dts/internal/ctx.d.ts.map +1 -0
- package/dist/dts/internal/errors.d.ts +69 -0
- package/dist/dts/internal/errors.d.ts.map +1 -0
- package/dist/dts/internal/inspect.d.ts +17 -0
- package/dist/dts/internal/inspect.d.ts.map +1 -0
- package/dist/dts/internal/queryDriver.d.ts +65 -0
- package/dist/dts/internal/queryDriver.d.ts.map +1 -0
- package/dist/dts/internal/reuse.d.ts +10 -0
- package/dist/dts/internal/reuse.d.ts.map +1 -0
- package/dist/dts/internal/scheduler.d.ts +47 -0
- package/dist/dts/internal/scheduler.d.ts.map +1 -0
- package/dist/dts/internal/seeds.d.ts +17 -0
- package/dist/dts/internal/seeds.d.ts.map +1 -0
- package/dist/dts/internal/sources.d.ts +39 -0
- package/dist/dts/internal/sources.d.ts.map +1 -0
- package/dist/dts/internal/store.d.ts +47 -0
- package/dist/dts/internal/store.d.ts.map +1 -0
- package/dist/dts/internal/track.d.ts +33 -0
- package/dist/dts/internal/track.d.ts.map +1 -0
- package/dist/dts/procedure/procedure.d.ts +40 -0
- package/dist/dts/procedure/procedure.d.ts.map +1 -0
- package/dist/dts/reducer/reducer.d.ts +44 -0
- package/dist/dts/reducer/reducer.d.ts.map +1 -0
- package/dist/dts/remote/remoteState.d.ts +119 -0
- package/dist/dts/remote/remoteState.d.ts.map +1 -0
- package/dist/dts/runtime/bus.d.ts +27 -0
- package/dist/dts/runtime/bus.d.ts.map +1 -0
- package/dist/dts/runtime/loop.d.ts +45 -0
- package/dist/dts/runtime/loop.d.ts.map +1 -0
- package/dist/dts/scene/scene.d.ts +44 -0
- package/dist/dts/scene/scene.d.ts.map +1 -0
- package/dist/dts/state/state.d.ts +37 -0
- package/dist/dts/state/state.d.ts.map +1 -0
- package/dist/dts/state/stateFamily.d.ts +79 -0
- package/dist/dts/state/stateFamily.d.ts.map +1 -0
- package/dist/dts/state/stateGroup.d.ts +36 -0
- package/dist/dts/state/stateGroup.d.ts.map +1 -0
- package/dist/dts/state/token.d.ts +30 -0
- package/dist/dts/state/token.d.ts.map +1 -0
- package/dist/dts/ui/node.d.ts +9 -0
- package/dist/dts/ui/node.d.ts.map +1 -0
- package/dist/dts/ui/trigger.d.ts +7 -0
- package/dist/dts/ui/trigger.d.ts.map +1 -0
- package/dist/esm/boundary/boundary.js +83 -0
- package/dist/esm/boundary/boundary.js.map +1 -0
- package/dist/esm/calc/asyncCalc.js +95 -0
- package/dist/esm/calc/asyncCalc.js.map +1 -0
- package/dist/esm/calc/asyncData.js +34 -0
- package/dist/esm/calc/asyncData.js.map +1 -0
- package/dist/esm/calc/calc.js +58 -0
- package/dist/esm/calc/calc.js.map +1 -0
- package/dist/esm/calc/calcFamily.js +124 -0
- package/dist/esm/calc/calcFamily.js.map +1 -0
- package/dist/esm/channel/channel.js +136 -0
- package/dist/esm/channel/channel.js.map +1 -0
- package/dist/esm/compose/composition.js +46 -0
- package/dist/esm/compose/composition.js.map +1 -0
- package/dist/esm/compose/host.js +5 -0
- package/dist/esm/compose/host.js.map +1 -0
- package/dist/esm/compose/props.js +11 -0
- package/dist/esm/compose/props.js.map +1 -0
- package/dist/esm/compose/provide.js +28 -0
- package/dist/esm/compose/provide.js.map +1 -0
- package/dist/esm/compose/slot.js +23 -0
- package/dist/esm/compose/slot.js.map +1 -0
- package/dist/esm/compose/ui.js +57 -0
- package/dist/esm/compose/ui.js.map +1 -0
- package/dist/esm/definition/definition.js +42 -0
- package/dist/esm/definition/definition.js.map +1 -0
- package/dist/esm/event/event.js +30 -0
- package/dist/esm/event/event.js.map +1 -0
- package/dist/esm/event/eventGroup.js +4 -0
- package/dist/esm/event/eventGroup.js.map +1 -0
- package/dist/esm/feature/feature.js +98 -0
- package/dist/esm/feature/feature.js.map +1 -0
- package/dist/esm/index.js +45 -0
- package/dist/esm/index.js.map +1 -0
- package/dist/esm/internal/capture.js +11 -0
- package/dist/esm/internal/capture.js.map +1 -0
- package/dist/esm/internal/ctx.js +2 -0
- package/dist/esm/internal/ctx.js.map +1 -0
- package/dist/esm/internal/errors.js +54 -0
- package/dist/esm/internal/errors.js.map +1 -0
- package/dist/esm/internal/inspect.js +32 -0
- package/dist/esm/internal/inspect.js.map +1 -0
- package/dist/esm/internal/queryDriver.js +134 -0
- package/dist/esm/internal/queryDriver.js.map +1 -0
- package/dist/esm/internal/reuse.js +68 -0
- package/dist/esm/internal/reuse.js.map +1 -0
- package/dist/esm/internal/scheduler.js +69 -0
- package/dist/esm/internal/scheduler.js.map +1 -0
- package/dist/esm/internal/seeds.js +17 -0
- package/dist/esm/internal/seeds.js.map +1 -0
- package/dist/esm/internal/sources.js +59 -0
- package/dist/esm/internal/sources.js.map +1 -0
- package/dist/esm/internal/store.js +73 -0
- package/dist/esm/internal/store.js.map +1 -0
- package/dist/esm/internal/track.js +18 -0
- package/dist/esm/internal/track.js.map +1 -0
- package/dist/esm/package.json +4 -0
- package/dist/esm/procedure/procedure.js +50 -0
- package/dist/esm/procedure/procedure.js.map +1 -0
- package/dist/esm/reducer/reducer.js +63 -0
- package/dist/esm/reducer/reducer.js.map +1 -0
- package/dist/esm/remote/remoteState.js +270 -0
- package/dist/esm/remote/remoteState.js.map +1 -0
- package/dist/esm/runtime/bus.js +20 -0
- package/dist/esm/runtime/bus.js.map +1 -0
- package/dist/esm/runtime/loop.js +116 -0
- package/dist/esm/runtime/loop.js.map +1 -0
- package/dist/esm/scene/scene.js +31 -0
- package/dist/esm/scene/scene.js.map +1 -0
- package/dist/esm/state/state.js +43 -0
- package/dist/esm/state/state.js.map +1 -0
- package/dist/esm/state/stateFamily.js +96 -0
- package/dist/esm/state/stateFamily.js.map +1 -0
- package/dist/esm/state/stateGroup.js +46 -0
- package/dist/esm/state/stateGroup.js.map +1 -0
- package/dist/esm/state/token.js +20 -0
- package/dist/esm/state/token.js.map +1 -0
- package/dist/esm/ui/node.js +2 -0
- package/dist/esm/ui/node.js.map +1 -0
- package/dist/esm/ui/trigger.js +2 -0
- package/dist/esm/ui/trigger.js.map +1 -0
- package/package.json +33 -0
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
import { Context, Effect, Layer, type Schema } from 'effect';
|
|
2
|
+
import type { YieldWrap } from 'effect/Utils';
|
|
3
|
+
import { type Manifest } from '../definition/definition.js';
|
|
4
|
+
import { type Ctx } from '../internal/ctx.js';
|
|
5
|
+
import type { Tracker } from '../internal/track.js';
|
|
6
|
+
import { type SlotHost } from './host.js';
|
|
7
|
+
import type { Node, SlotClass } from './slot.js';
|
|
8
|
+
import type { UiClass, UiContract } from './ui.js';
|
|
9
|
+
import { Props } from './props.js';
|
|
10
|
+
/** Everything the host injects per render: the instance props, the dependency tracker, and slot bindings. */
|
|
11
|
+
export interface RenderEnv {
|
|
12
|
+
readonly props: unknown;
|
|
13
|
+
readonly tracker: Tracker;
|
|
14
|
+
readonly slots: SlotHost;
|
|
15
|
+
}
|
|
16
|
+
/** A mounted composition: given a render environment, produces the current frame's node. */
|
|
17
|
+
export interface CompositionService {
|
|
18
|
+
readonly render: (env: RenderEnv) => Effect.Effect<Node, never, never>;
|
|
19
|
+
}
|
|
20
|
+
export interface CompositionConfig {
|
|
21
|
+
readonly title: string;
|
|
22
|
+
readonly description?: string;
|
|
23
|
+
readonly props?: Schema.Schema<any, any>;
|
|
24
|
+
readonly states?: ReadonlyArray<unknown>;
|
|
25
|
+
readonly calcs?: ReadonlyArray<unknown>;
|
|
26
|
+
readonly events?: ReadonlyArray<unknown>;
|
|
27
|
+
readonly slots?: Record<string, SlotClass>;
|
|
28
|
+
readonly ui: {
|
|
29
|
+
readonly manifest: Manifest & {
|
|
30
|
+
readonly kind: 'Ui';
|
|
31
|
+
};
|
|
32
|
+
};
|
|
33
|
+
}
|
|
34
|
+
type PropsOf<Config> = Config extends {
|
|
35
|
+
props: Schema.Schema<infer P, any>;
|
|
36
|
+
} ? P : unknown;
|
|
37
|
+
export interface CompositionClass<out P, out C extends UiContract = UiContract> {
|
|
38
|
+
new (): {};
|
|
39
|
+
readonly manifest: Manifest & {
|
|
40
|
+
readonly kind: 'Composition';
|
|
41
|
+
} & CompositionConfig;
|
|
42
|
+
/** Phantom carrying the props type for `provide(slot, composition)` checks. */
|
|
43
|
+
readonly Props: P;
|
|
44
|
+
/**
|
|
45
|
+
* Phantom carrying the resolved UI contract (props + events + slots). It lets
|
|
46
|
+
* reflection consumers — proofs, the dev tool — recover the full contract from
|
|
47
|
+
* a composition value and stay fully typed. Covariant (output only); the
|
|
48
|
+
* invariant `impl` tag is never stored here, so no variance regression.
|
|
49
|
+
*/
|
|
50
|
+
readonly Contract: C;
|
|
51
|
+
readonly tag: Context.Tag<CompositionService, CompositionService>;
|
|
52
|
+
}
|
|
53
|
+
/**
|
|
54
|
+
* A component's logic. The *definition* (`Composition.make`) is a reflectable
|
|
55
|
+
* manifest that doubles as a requirement/tag; the *implementation*
|
|
56
|
+
* (`Composition.live`) is the synchronous body, provided separately and
|
|
57
|
+
* checked against it.
|
|
58
|
+
*/
|
|
59
|
+
export declare const make: <const Config extends CompositionConfig, C extends UiContract>(name: string, config: Config & {
|
|
60
|
+
readonly ui: UiClass<C>;
|
|
61
|
+
}) => CompositionClass<PropsOf<Config>, C>;
|
|
62
|
+
/**
|
|
63
|
+
* Wire a composition's synchronous logic (D2): read state, acquire triggers,
|
|
64
|
+
* resolve the UI, return the view. Its requirements (minus `Props`, which the
|
|
65
|
+
* host injects per render) surface as the Layer's `RIn`; the runtime runs the
|
|
66
|
+
* body per render within the captured context.
|
|
67
|
+
*/
|
|
68
|
+
export declare const live: <P, Eff extends YieldWrap<Effect.Effect<unknown, never, unknown>>>(composition: CompositionClass<P, any>, body: () => Generator<Eff, Node, never>) => Layer.Layer<CompositionService, never, Exclude<Ctx<Eff>, Props>>;
|
|
69
|
+
/** Run a mounted composition for one frame, producing its node. */
|
|
70
|
+
export declare const render: (service: CompositionService, env: RenderEnv) => Effect.Effect<Node, never, never>;
|
|
71
|
+
export {};
|
|
72
|
+
//# sourceMappingURL=composition.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"composition.d.ts","sourceRoot":"","sources":["../../../src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EAAE,CAAC,CAMrC,CAAA;AAED;;;;;GAKG;AACH,eAAO,MAAM,IAAI,GAAI,CAAC,EAAE,GAAG,SAAS,SAAS,CAAC,MAAM,CAAC,MAAM,CAAC,OAAO,EAAE,KAAK,EAAE,OAAO,CAAC,CAAC,EAEnF,aAAa,gBAAgB,CAAC,CAAC,EAAE,GAAG,CAAC,EACrC,MAAM,MAAM,SAAS,CAAC,GAAG,EAAE,IAAI,EAAE,KAAK,CAAC,KACtC,KAAK,CAAC,KAAK,CAAC,kBAAkB,EAAE,KAAK,EAAE,OAAO,CAAC,GAAG,CAAC,GAAG,CAAC,EAAE,KAAK,CAAC,CAqBjE,CAAA;AAED,mEAAmE;AACnE,eAAO,MAAM,MAAM,GAAI,SAAS,kBAAkB,EAAE,KAAK,SAAS,KAAG,MAAM,CAAC,MAAM,CAAC,IAAI,EAAE,KAAK,EAAE,KAAK,CAChF,CAAA"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { Context } from 'effect';
|
|
2
|
+
import type { Node } from './slot.js';
|
|
3
|
+
/**
|
|
4
|
+
* Binds a parent's slots to concrete child renderers. The host package
|
|
5
|
+
* (`@reform/react`) builds one per composition instance from the manifest's
|
|
6
|
+
* slot map; the `ui` read consults it so `<slots.Item .../>` renders the wired
|
|
7
|
+
* child. Core stays renderer-neutral — it only defines this hole.
|
|
8
|
+
*/
|
|
9
|
+
export interface SlotHost {
|
|
10
|
+
slot(name: string): (props: unknown) => Node;
|
|
11
|
+
}
|
|
12
|
+
declare const CurrentSlots_base: Context.TagClass<CurrentSlots, "reform/Slots", SlotHost>;
|
|
13
|
+
/** The active composition's slot bindings, provided per render by the host. */
|
|
14
|
+
export declare class CurrentSlots extends CurrentSlots_base {
|
|
15
|
+
}
|
|
16
|
+
export {};
|
|
17
|
+
//# sourceMappingURL=host.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"host.d.ts","sourceRoot":"","sources":["../../../src/compose/host.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,QAAQ,CAAA;AAChC,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,QAAQ,CAAA;AAElC;;;;;GAKG;AACH,MAAM,WAAW,QAAQ;IACvB,IAAI,CAAC,IAAI,EAAE,MAAM,GAAG,CAAC,KAAK,EAAE,OAAO,KAAK,IAAI,CAAA;CAC7C;;AAED,+EAA+E;AAC/E,qBAAa,YAAa,SAAQ,iBAAqD;CAAG"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { Context } from 'effect';
|
|
2
|
+
declare const Props_base: Context.TagClass<Props, "reform/Props", any>;
|
|
3
|
+
/**
|
|
4
|
+
* The current composition instance's props. Bound per render by the runtime; a
|
|
5
|
+
* composition body reads them with `const { todo } = yield* Props`.
|
|
6
|
+
*
|
|
7
|
+
* (Per-instance typing of Props is DESIGN #26 — for now the value is opaque and
|
|
8
|
+
* narrowed at the use site against the composition's declared props schema.)
|
|
9
|
+
*/
|
|
10
|
+
export declare class Props extends Props_base {
|
|
11
|
+
}
|
|
12
|
+
export {};
|
|
13
|
+
//# sourceMappingURL=props.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"props.d.ts","sourceRoot":"","sources":["../../../src/compose/props.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,QAAQ,CAAA;;AAEhC;;;;;;GAMG;AACH,qBAAa,KAAM,SAAQ,UAAyC;CAAG"}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { Layer } from 'effect';
|
|
2
|
+
import type { CompositionClass } from './composition.js';
|
|
3
|
+
import { type EngineServices, type FeatureClass, type ProvidedBy, type RequireCarrier } from '../feature/feature.js';
|
|
4
|
+
import { type SlotChild, type SlotClass } from './slot.js';
|
|
5
|
+
import { type UiClass, type UiContract, type ViewImpl } from './ui.js';
|
|
6
|
+
/**
|
|
7
|
+
* Wire an implementation to a contract. Provides a `.make` presentation to a UI
|
|
8
|
+
* contract, a child composition into a parent's slot, or a `Feature` into a slot.
|
|
9
|
+
* The compose code never imports its implementations — they meet here.
|
|
10
|
+
*/
|
|
11
|
+
export declare function provide<C extends UiContract>(contract: UiClass<C>, view: ViewImpl<C>): Layer.Layer<ViewImpl<C>>;
|
|
12
|
+
export declare function provide<Comp extends CompositionClass<any, any>>(hole: SlotClass<Comp>, composition: Comp): Layer.Layer<CompositionClass<unknown>>;
|
|
13
|
+
/**
|
|
14
|
+
* Fill a slot with a feature. The slot's child composition type
|
|
15
|
+
* (`CompositionClass<P, C>`) must match the feature's mounted composition, so the
|
|
16
|
+
* facade/contract stays typed. The returned layer surfaces the feature's shared
|
|
17
|
+
* requirement (`EngineServices | ProvidedBy<Requires>`) as an open `RIn`, so the
|
|
18
|
+
* scene that wires it won't compile unless it provides the matching `Core` — even
|
|
19
|
+
* for a lazy feature whose own `.live` layer isn't built until mount.
|
|
20
|
+
*/
|
|
21
|
+
export declare function provide<Comp extends CompositionClass<any, any>, ROut, Requires extends ReadonlyArray<RequireCarrier>>(hole: SlotClass<Comp>, feature: FeatureClass<Comp extends CompositionClass<infer P, any> ? P : never, Comp extends CompositionClass<any, infer C> ? C : never, ROut, Requires>): Layer.Layer<SlotChild, never, EngineServices | ProvidedBy<Requires>>;
|
|
22
|
+
//# sourceMappingURL=provide.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"provide.d.ts","sourceRoot":"","sources":["../../../src/compose/provide.ts"],"names":[],"mappings":"AAAA,OAAO,EAAgB,KAAK,EAAE,MAAM,QAAQ,CAAA;AAE5C,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,eAAe,CAAA;AACrD,OAAO,EACL,KAAK,cAAc,EACnB,KAAK,YAAY,EAEjB,KAAK,UAAU,EACf,KAAK,cAAc,EACpB,MAAM,oBAAoB,CAAA;AAC3B,OAAO,EAAU,KAAK,SAAS,EAAE,KAAK,SAAS,EAAE,MAAM,QAAQ,CAAA;AAC/D,OAAO,EAAQ,KAAK,OAAO,EAAE,KAAK,UAAU,EAAE,KAAK,QAAQ,EAAE,MAAM,MAAM,CAAA;AAEzE;;;;GAIG;AACH,wBAAgB,OAAO,CAAC,CAAC,SAAS,UAAU,EAC1C,QAAQ,EAAE,OAAO,CAAC,CAAC,CAAC,EACpB,IAAI,EAAE,QAAQ,CAAC,CAAC,CAAC,GAChB,KAAK,CAAC,KAAK,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,CAAA;AAC3B,wBAAgB,OAAO,CAAC,IAAI,SAAS,gBAAgB,CAAC,GAAG,EAAE,GAAG,CAAC,EAC7D,IAAI,EAAE,SAAS,CAAC,IAAI,CAAC,EACrB,WAAW,EAAE,IAAI,GAChB,KAAK,CAAC,KAAK,CAAC,gBAAgB,CAAC,OAAO,CAAC,CAAC,CAAA;AACzC;;;;;;;GAOG;AACH,wBAAgB,OAAO,CACrB,IAAI,SAAS,gBAAgB,CAAC,GAAG,EAAE,GAAG,CAAC,EACvC,IAAI,EACJ,QAAQ,SAAS,aAAa,CAAC,cAAc,CAAC,EAE9C,IAAI,EAAE,SAAS,CAAC,IAAI,CAAC,EACrB,OAAO,EAAE,YAAY,CACnB,IAAI,SAAS,gBAAgB,CAAC,MAAM,CAAC,EAAE,GAAG,CAAC,GAAG,CAAC,GAAG,KAAK,EACvD,IAAI,SAAS,gBAAgB,CAAC,GAAG,EAAE,MAAM,CAAC,CAAC,GAAG,CAAC,GAAG,KAAK,EACvD,IAAI,EACJ,QAAQ,CACT,GACA,KAAK,CAAC,KAAK,CAAC,SAAS,EAAE,KAAK,EAAE,cAAc,GAAG,UAAU,CAAC,QAAQ,CAAC,CAAC,CAAA"}
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import { Context } from 'effect';
|
|
2
|
+
import type { CompositionClass } from './composition.js';
|
|
3
|
+
import type { FeatureBinding } from '../feature/feature.js';
|
|
4
|
+
import type { Node } from '../ui/node.js';
|
|
5
|
+
export type { Node };
|
|
6
|
+
/** Any composition, used where only the slot's structural role matters. */
|
|
7
|
+
type AnyComposition = CompositionClass<any, any>;
|
|
8
|
+
/**
|
|
9
|
+
* What a slot can be filled with: a plain child composition (the host renders it
|
|
10
|
+
* directly), or a `FeatureBinding` from `provide(slot, Feature)` (the host drives
|
|
11
|
+
* its lazy/eager mount lifecycle). The slot's DI tag holds one of these; the host
|
|
12
|
+
* discriminates by the `FeatureBinding` brand.
|
|
13
|
+
*/
|
|
14
|
+
export type SlotChild = CompositionClass<unknown> | FeatureBinding;
|
|
15
|
+
/**
|
|
16
|
+
* Phantom instance shape: `ItemSlot` used as a *type* denotes this. It carries
|
|
17
|
+
* the child *composition* type `Comp`, so the slot knows both the external props
|
|
18
|
+
* the parent renders it with (`Comp['Props']`) and the child's full UI contract
|
|
19
|
+
* (`Comp['Contract']` — props + events + slots) that reflection consumers, the
|
|
20
|
+
* proof facade, drive.
|
|
21
|
+
*/
|
|
22
|
+
export interface SlotInstance<Comp extends AnyComposition> {
|
|
23
|
+
readonly _slot: Comp;
|
|
24
|
+
}
|
|
25
|
+
/**
|
|
26
|
+
* A DI hole for a child composition. The parent declares
|
|
27
|
+
* `slot('Item')<typeof TodoItem>()` and renders through it; the concrete child
|
|
28
|
+
* is wired with `provide(Item, TodoItem)`, so the parent never imports the
|
|
29
|
+
* child's *implementation* (the `typeof` is a type-only reference to the
|
|
30
|
+
* definition). `Comp` lives only in the phantom instance (so `SlotClass` is
|
|
31
|
+
* covariant and a `{ Item: ItemSlot }` map is well-typed); the match is enforced
|
|
32
|
+
* by `provide`'s signature, not the (invariant) tag.
|
|
33
|
+
*/
|
|
34
|
+
/** Nominal brand identifying a slot at runtime (Effect's `TypeId` idiom). */
|
|
35
|
+
export declare const SlotTypeId: unique symbol;
|
|
36
|
+
export type SlotTypeId = typeof SlotTypeId;
|
|
37
|
+
export interface SlotClass<Comp extends AnyComposition = AnyComposition> {
|
|
38
|
+
new (): SlotInstance<Comp>;
|
|
39
|
+
readonly [SlotTypeId]: SlotTypeId;
|
|
40
|
+
readonly kind: 'Slot';
|
|
41
|
+
/** Internal DI tag the filling child (composition or feature binding) is provided under. */
|
|
42
|
+
readonly tag: Context.Tag<SlotChild, SlotChild>;
|
|
43
|
+
}
|
|
44
|
+
/** Whether a value is a slot — discriminates a `provide` target by brand. */
|
|
45
|
+
export declare const isSlot: (u: unknown) => u is SlotClass;
|
|
46
|
+
/** The props a slot renders with — the child composition's external props. */
|
|
47
|
+
export type SlotProps<S> = S extends SlotInstance<infer Comp> ? Comp['Props'] : never;
|
|
48
|
+
export declare const slot: (name: string) => <Comp extends AnyComposition = AnyComposition>() => SlotClass<Comp>;
|
|
49
|
+
//# sourceMappingURL=slot.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"slot.d.ts","sourceRoot":"","sources":["../../../src/compose/slot.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,QAAQ,CAAA;AAEhC,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,eAAe,CAAA;AACrD,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAA;AACxD,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,YAAY,CAAA;AAEtC,YAAY,EAAE,IAAI,EAAE,CAAA;AAEpB,2EAA2E;AAC3E,KAAK,cAAc,GAAG,gBAAgB,CAAC,GAAG,EAAE,GAAG,CAAC,CAAA;AAEhD;;;;;GAKG;AACH,MAAM,MAAM,SAAS,GAAG,gBAAgB,CAAC,OAAO,CAAC,GAAG,cAAc,CAAA;AAElE;;;;;;GAMG;AACH,MAAM,WAAW,YAAY,CAAC,IAAI,SAAS,cAAc;IACvD,QAAQ,CAAC,KAAK,EAAE,IAAI,CAAA;CACrB;AAED;;;;;;;;GAQG;AACH,6EAA6E;AAC7E,eAAO,MAAM,UAAU,EAAE,OAAO,MAAkC,CAAA;AAClE,MAAM,MAAM,UAAU,GAAG,OAAO,UAAU,CAAA;AAE1C,MAAM,WAAW,SAAS,CAAC,IAAI,SAAS,cAAc,GAAG,cAAc;IACrE,QAAQ,YAAY,CAAC,IAAI,CAAC,CAAA;IAC1B,QAAQ,CAAC,CAAC,UAAU,CAAC,EAAE,UAAU,CAAA;IACjC,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAA;IACrB,4FAA4F;IAC5F,QAAQ,CAAC,GAAG,EAAE,OAAO,CAAC,GAAG,CAAC,SAAS,EAAE,SAAS,CAAC,CAAA;CAChD;AAED,6EAA6E;AAC7E,eAAO,MAAM,MAAM,GAAI,GAAG,OAAO,KAAG,CAAC,IAAI,SAC4C,CAAA;AAErF,8EAA8E;AAC9E,MAAM,MAAM,SAAS,CAAC,CAAC,IAAI,CAAC,SAAS,YAAY,CAAC,MAAM,IAAI,CAAC,GAAG,IAAI,CAAC,OAAO,CAAC,GAAG,KAAK,CAAA;AAErF,eAAO,MAAM,IAAI,GACd,MAAM,MAAM,MAGZ,IAAI,SAAS,cAAc,GAAG,cAAc,OAAK,SAAS,CAAC,IAAI,CAG/D,CAAA"}
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import { Context, Effect } from 'effect';
|
|
2
|
+
import { type Manifest } from '../definition/definition.js';
|
|
3
|
+
import type { Trigger } from '../ui/trigger.js';
|
|
4
|
+
import { type Node, type SlotInstance, type SlotProps } from './slot.js';
|
|
5
|
+
export interface UiContract {
|
|
6
|
+
props: unknown;
|
|
7
|
+
slots?: Record<string, SlotInstance<any>>;
|
|
8
|
+
events?: Record<string, Trigger<any>>;
|
|
9
|
+
}
|
|
10
|
+
type PropsOf<C extends UiContract> = C['props'];
|
|
11
|
+
type EventsOf<C extends UiContract> = C extends {
|
|
12
|
+
events: infer E;
|
|
13
|
+
} ? E : Record<never, never>;
|
|
14
|
+
type SlotsOf<C extends UiContract> = C extends {
|
|
15
|
+
slots: infer S;
|
|
16
|
+
} ? {
|
|
17
|
+
readonly [K in keyof S]: (props: SlotProps<S[K]>) => Node;
|
|
18
|
+
} : Record<never, never>;
|
|
19
|
+
/** What the composition logic calls: props + handlers in, a node out. Slots are bound by the renderer. */
|
|
20
|
+
export type LogicView<C extends UiContract> = (props: PropsOf<C>, events?: EventsOf<C>) => Node;
|
|
21
|
+
/** What `.make` authors: the pure presentation. Slots are injected by the renderer. */
|
|
22
|
+
export type ViewImpl<C extends UiContract> = (props: PropsOf<C>, slots: SlotsOf<C>, events: EventsOf<C>) => Node;
|
|
23
|
+
/** Nominal brand identifying a UI contract at runtime (Effect's `TypeId` idiom). */
|
|
24
|
+
export declare const UiTypeId: unique symbol;
|
|
25
|
+
export type UiTypeId = typeof UiTypeId;
|
|
26
|
+
export interface UiClass<C extends UiContract> extends Effect.Effect<LogicView<C>, never, ViewImpl<C>> {
|
|
27
|
+
new (): {};
|
|
28
|
+
readonly [UiTypeId]: UiTypeId;
|
|
29
|
+
readonly manifest: Manifest & {
|
|
30
|
+
readonly kind: 'Ui';
|
|
31
|
+
};
|
|
32
|
+
/** Internal DI tag the `Ui.make` presentation is provided under. */
|
|
33
|
+
readonly impl: Context.Tag<ViewImpl<C>, ViewImpl<C>>;
|
|
34
|
+
}
|
|
35
|
+
/** Whether a value is a UI contract — discriminates a `provide` target by brand. */
|
|
36
|
+
export declare const isUi: (u: unknown) => u is UiClass<UiContract>;
|
|
37
|
+
/**
|
|
38
|
+
* A renderer-neutral UI contract. The logic resolves it (`yield* TodoAppUi`) to
|
|
39
|
+
* a `(props, events) => node` view with slots already bound; `.make` authors the
|
|
40
|
+
* presentation. Core defines the contract; `@reform/react` does the rendering.
|
|
41
|
+
*/
|
|
42
|
+
export declare const ui: (name: string) => <C extends UiContract>() => UiClass<C>;
|
|
43
|
+
/**
|
|
44
|
+
* Author the pure presentation for a contract — `Ui.make(TodoAppUi, (props,
|
|
45
|
+
* slots, events) => node)`. The contract argument fixes the view's types; wire
|
|
46
|
+
* the result with `provide(contract, view)`.
|
|
47
|
+
*/
|
|
48
|
+
export declare const make: <C extends UiContract>(_contract: UiClass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eAAO,MAAM,IAAI,GAAI,CAAC,SAAS,UAAU,EAAE,WAAW,OAAO,CAAC,CAAC,CAAC,EAAE,MAAM,QAAQ,CAAC,CAAC,CAAC,KAAG,QAAQ,CAAC,CAAC,CAC1F,CAAA"}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { Effect } from 'effect';
|
|
2
|
+
/**
|
|
3
|
+
* The reflectable descriptor every primitive carries (principle #6). The editor
|
|
4
|
+
* and proof packages read these without running any logic.
|
|
5
|
+
*/
|
|
6
|
+
export type Kind = 'State' | 'StateGroup' | 'StateFamily' | 'Event' | 'EventGroup' | 'Reducer' | 'Calc' | 'CalcFamily' | 'AsyncCalc' | 'RemoteState' | 'Boundary' | 'Procedure' | 'Channel' | 'Composition' | 'Ui' | 'Slot' | 'Feature';
|
|
7
|
+
export interface Manifest {
|
|
8
|
+
readonly kind: Kind;
|
|
9
|
+
readonly name: string;
|
|
10
|
+
}
|
|
11
|
+
/**
|
|
12
|
+
* Build a class whose *static* side is itself an Effect, so `yield* TheClass`
|
|
13
|
+
* runs `read` and returns its value (the same mechanism `Context.Tag` uses).
|
|
14
|
+
* Subclasses inherit the protocol through the prototype chain, so the user's
|
|
15
|
+
* `class FeedState extends State.make(...) {}` is yieldable too.
|
|
16
|
+
*
|
|
17
|
+
* `statics` (manifest, `.live`, tag, …) are attached as own properties
|
|
18
|
+
* and likewise inherited by the subclass.
|
|
19
|
+
*/
|
|
20
|
+
export declare const yieldableClass: <A, E, R, Statics extends object>(read: Effect.Effect<A, E, R>, statics: Statics) => {
|
|
21
|
+
new (): {};
|
|
22
|
+
} & Effect.Effect<A, E, R> & Statics;
|
|
23
|
+
/**
|
|
24
|
+
* Build a *definition class*: an empty constructible carrying static marker data
|
|
25
|
+
* (manifest, tag, policy, members, …) that the editor and proof packages reflect
|
|
26
|
+
* on. Definition interfaces declare phantom, type-only fields — a composition's
|
|
27
|
+
* `Props`, a family instance's `Key` — that exist purely for inference and have
|
|
28
|
+
* no runtime value, so the assembled object cannot *structurally* satisfy the
|
|
29
|
+
* interface. The one assertion to `Class` lives here, documented, instead of a
|
|
30
|
+
* scattered `as never` / `as unknown as` at every `*.make`.
|
|
31
|
+
*/
|
|
32
|
+
export declare const definitionClass: <Class>(statics: object) => Class;
|
|
33
|
+
//# sourceMappingURL=definition.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"definition.d.ts","sourceRoot":"","sources":["../../../src/definition/definition.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAA;AAM/B;;;GAGG;AACH,MAAM,MAAM,IAAI,GACZ,OAAO,GACP,YAAY,GACZ,aAAa,GACb,OAAO,GACP,YAAY,GACZ,SAAS,GACT,MAAM,GACN,YAAY,GACZ,WAAW,GACX,aAAa,GACb,UAAU,GACV,WAAW,GACX,SAAS,GACT,aAAa,GACb,IAAI,GACJ,MAAM,GACN,SAAS,CAAA;AAEb,MAAM,WAAW,QAAQ;IACvB,QAAQ,CAAC,IAAI,EAAE,IAAI,CAAA;IACnB,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAA;CACtB;AAED;;;;;;;;GAQG;AACH,eAAO,MAAM,cAAc,GAAI,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,OAAO,SAAS,MAAM,EAC5D,MAAM,MAAM,CAAC,MAAM,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,EAC5B,SAAS,OAAO,KACf;IAAE,QAAQ,EAAE,CAAA;CAAE,GAAG,MAAM,CAAC,MAAM,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,GAAG,OAe5C,CAAA;AAED;;;;;;;;GAQG;AACH,eAAO,MAAM,eAAe,GAAI,KAAK,EAAE,SAAS,MAAM,KAAG,KACyC,CAAA"}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { Effect, type Schema } from 'effect';
|
|
2
|
+
import { type Manifest } from '../definition/definition.js';
|
|
3
|
+
import { Bus, type Tagged } from '../runtime/bus.js';
|
|
4
|
+
import type { Trigger } from '../ui/trigger.js';
|
|
5
|
+
/** The dispatched value of an event: `{ _tag, ...payload }`, matched with `Match.tags`. */
|
|
6
|
+
export type EventOf<N extends string, P> = Tagged & {
|
|
7
|
+
readonly _tag: N;
|
|
8
|
+
} & P;
|
|
9
|
+
export interface EventManifest<N extends string, P> extends Manifest {
|
|
10
|
+
readonly kind: 'Event';
|
|
11
|
+
readonly name: N;
|
|
12
|
+
readonly schema: Schema.Schema<P, any>;
|
|
13
|
+
}
|
|
14
|
+
export interface EventClass<out N extends string, in out P> {
|
|
15
|
+
new (): {};
|
|
16
|
+
readonly manifest: EventManifest<N, P>;
|
|
17
|
+
readonly tag: N;
|
|
18
|
+
/** Carrier for `Event.construct` — builds the tagged value `{ _tag, ...payload }`. */
|
|
19
|
+
readonly build: (payload: P) => EventOf<N, P>;
|
|
20
|
+
/** Carrier for `Event.trigger` — the UI callback effect (High priority). */
|
|
21
|
+
readonly trigger: Effect.Effect<Trigger<P>, never, Bus>;
|
|
22
|
+
}
|
|
23
|
+
export type AnyEvent = EventClass<string, any>;
|
|
24
|
+
export type EventType<E> = E extends EventClass<infer N, infer P> ? EventOf<N, P> : never;
|
|
25
|
+
/** A pure data fact. Events depend on nothing — only reducers tie them to state. */
|
|
26
|
+
export declare const make: <const N extends string, P>(name: N, schema: Schema.Schema<P, any>) => EventClass<N, P>;
|
|
27
|
+
/** Construct the tagged value for an event (used for `boot` events). */
|
|
28
|
+
export declare const construct: <N extends string, P>(event: EventClass<N, P>, payload: P) => EventOf<N, P>;
|
|
29
|
+
/** Dispatch as a follow-up (Normal priority) from a procedure/effect. */
|
|
30
|
+
export declare const dispatch: <N extends string, P>(event: EventClass<N, P>, payload: P) => Effect.Effect<void, never, Bus>;
|
|
31
|
+
/** A callback for the UI that dispatches at High priority via the runtime. */
|
|
32
|
+
export declare const trigger: <N extends string, P>(event: EventClass<N, P>) => Effect.Effect<Trigger<P>, never, Bus>;
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Class<Members extends ReadonlyArray<AnyEvent>> {
|
|
3
|
+
new (): {};
|
|
4
|
+
readonly kind: 'EventGroup';
|
|
5
|
+
readonly members: Members;
|
|
6
|
+
}
|
|
7
|
+
/** Compose events into a group, the same variadic shape as `StateGroup`/`RpcGroup`. */
|
|
8
|
+
export declare const make: <const Members extends ReadonlyArray<AnyEvent>>(...members: Members) => EventGroupClass<Members>;
|
|
9
|
+
//# sourceMappingURL=eventGroup.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"eventGroup.d.ts","sourceRoot":"","sources":["../../../src/event/eventGroup.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAA;AAEvC,MAAM,WAAW,eAAe,CAAC,OAAO,SAAS,aAAa,CAAC,QAAQ,CAAC;IACtE,QAAQ,EAAE,CAAA;IACV,QAAQ,CAAC,IAAI,EAAE,YAAY,CAAA;IAC3B,QAAQ,CAAC,OAAO,EAAE,OAAO,CAAA;CAC1B;AAED,uFAAuF;AACvF,eAAO,MAAM,IAAI,GAAI,KAAK,CAAC,OAAO,SAAS,aAAa,CAAC,QAAQ,CAAC,EAChE,GAAG,SAAS,OAAO,KAClB,eAAe,CAAC,OAAO,CAC2D,CAAA"}
|
|
@@ -0,0 +1,220 @@
|
|
|
1
|
+
import { type Context, Effect, Layer, type Scope } from 'effect';
|
|
2
|
+
import { type Engine } from '../runtime/loop.js';
|
|
3
|
+
import { type StoresOf } from '../internal/sources.js';
|
|
4
|
+
import { FeatureLoadFailed } from '../internal/errors.js';
|
|
5
|
+
import { type Manifest } from '../definition/definition.js';
|
|
6
|
+
import { type CompositionClass } from '../compose/composition.js';
|
|
7
|
+
import { type UiContract } from '../compose/ui.js';
|
|
8
|
+
import { type Tagged } from '../runtime/bus.js';
|
|
9
|
+
/**
|
|
10
|
+
* The always-on engine services a feature builds against: the shared event `Bus`
|
|
11
|
+
* plus the reducer/channel/procedure registries. Derived from the `Engine`
|
|
12
|
+
* layer's output (`runtime/loop.ts`) so it never drifts. A feature layer may name
|
|
13
|
+
* these only as OPEN requirements (its `RIn`) and must never *provide* them — that
|
|
14
|
+
* is what keeps the engine single and shared across every lazily-mounted feature.
|
|
15
|
+
*/
|
|
16
|
+
export type EngineServices = Layer.Layer.Success<typeof Engine>;
|
|
17
|
+
/**
|
|
18
|
+
* A shared-state carrier a feature may declare in `requires`: a `State`,
|
|
19
|
+
* `StateFamily`, `Calc`, or `AsyncCalc` (each carrying a `store` tag), or a
|
|
20
|
+
* `StateGroup` (carrying `members`, each with its own `store`). Per the design,
|
|
21
|
+
* a feature depends on shared state/calc only — never on another feature.
|
|
22
|
+
*/
|
|
23
|
+
export type RequireCarrier = {
|
|
24
|
+
readonly store: Context.Tag<any, any>;
|
|
25
|
+
} | {
|
|
26
|
+
readonly members: ReadonlyArray<{
|
|
27
|
+
readonly store: Context.Tag<any, any>;
|
|
28
|
+
}>;
|
|
29
|
+
};
|
|
30
|
+
/**
|
|
31
|
+
* The Context services a `requires` tuple makes available to a feature layer: a
|
|
32
|
+
* `StateGroup` contributes its members' stores (the shared `StoresOf`); every
|
|
33
|
+
* other carrier contributes its own `store` service. This is the upper bound a
|
|
34
|
+
* feature's open `RIn` is checked against. Because `Layer`'s `RIn` is covariant
|
|
35
|
+
* (`Layer.d.ts` — `out RIn`), a layer that reads anything outside
|
|
36
|
+
* `EngineServices | ProvidedBy<requires>` is simply not assignable, so the check
|
|
37
|
+
* is ordinary assignability — no `as`, no `infer` gymnastics in user code.
|
|
38
|
+
*/
|
|
39
|
+
export type ProvidedBy<Requires extends ReadonlyArray<RequireCarrier>> = {
|
|
40
|
+
[I in keyof Requires]: Requires[I] extends {
|
|
41
|
+
readonly members: infer M extends ReadonlyArray<unknown>;
|
|
42
|
+
} ? StoresOf<M> : Requires[I] extends {
|
|
43
|
+
readonly store: Context.Tag<infer Svc, any>;
|
|
44
|
+
} ? Svc : never;
|
|
45
|
+
}[number];
|
|
46
|
+
/**
|
|
47
|
+
* A loaded feature's two artifacts. `requires` is the runtime-enumerable list the
|
|
48
|
+
* editor reads (types are erased, so the carriers are kept as values); `layer` is
|
|
49
|
+
* the heavy `.live` half. The bound on `layer`'s `RIn` —
|
|
50
|
+
* `EngineServices | ProvidedBy<Requires>` — makes the runtime list provably equal
|
|
51
|
+
* the layer's real requirement set: list too little and the layer no longer type-
|
|
52
|
+
* checks here. Built by `featureModule`, which is the one sanctioned way to publish
|
|
53
|
+
* a feature's lazy half.
|
|
54
|
+
*/
|
|
55
|
+
export interface FeatureModule<ROut, Requires extends ReadonlyArray<RequireCarrier>> {
|
|
56
|
+
readonly requires: Requires;
|
|
57
|
+
readonly layer: Layer.Layer<ROut, never, EngineServices | ProvidedBy<Requires>>;
|
|
58
|
+
}
|
|
59
|
+
/**
|
|
60
|
+
* Publish a feature's lazy half: pair its `requires` (a runtime tuple of shared
|
|
61
|
+
* carriers) with its `layer`. The covariant `RIn` bound does the checking — a
|
|
62
|
+
* layer that reaches for any service outside `EngineServices | ProvidedBy<requires>`
|
|
63
|
+
* is not assignable, so it fails to compile right here, next to the layer, with no
|
|
64
|
+
* cast. Listing an unused carrier is harmless; omitting a needed one is a type error.
|
|
65
|
+
*
|
|
66
|
+
* The bound also forbids a feature from *providing* `EngineServices` (they may only
|
|
67
|
+
* be open `RIn`), structurally enforcing the liveness rule: a feature can never
|
|
68
|
+
* bundle its own engine — it always shares the root's bus and registries.
|
|
69
|
+
*/
|
|
70
|
+
export declare const featureModule: <const Requires extends ReadonlyArray<RequireCarrier>, ROut>(requires: Requires, layer: Layer.Layer<ROut, never, EngineServices | ProvidedBy<Requires>>) => FeatureModule<ROut, Requires>;
|
|
71
|
+
/**
|
|
72
|
+
* Wrap a dynamic `import()` of a feature's `.live` module as an `Effect` — Reform
|
|
73
|
+
* never exposes a Promise/`await` on the feature surface. The unavoidable thenable
|
|
74
|
+
* is sealed here; a rejected import (missing chunk, network failure, module-eval
|
|
75
|
+
* throw) surfaces as a typed `FeatureLoadFailed` the host hands to
|
|
76
|
+
* `placeholder.failed`. The module's default export is its `FeatureModule`.
|
|
77
|
+
*/
|
|
78
|
+
export declare const lazyImport: <M>(thunk: () => Promise<{
|
|
79
|
+
readonly default: M;
|
|
80
|
+
}>) => Effect.Effect<M, FeatureLoadFailed>;
|
|
81
|
+
/** The props the host injects into a lazy feature's `failed` placeholder. */
|
|
82
|
+
export interface FailedProps {
|
|
83
|
+
readonly error: FeatureLoadFailed;
|
|
84
|
+
readonly retry: () => void;
|
|
85
|
+
}
|
|
86
|
+
/**
|
|
87
|
+
* The reflectable shape of a feature: its strategy, the composition it mounts,
|
|
88
|
+
* and (when lazy) its placeholder compositions — all as manifests, so the editor
|
|
89
|
+
* route-map renders the whole feature graph with no chunk loaded. `boot` is
|
|
90
|
+
* runtime data and lives on the `FeatureBinding`, not here.
|
|
91
|
+
*/
|
|
92
|
+
export interface FeatureManifest extends Manifest {
|
|
93
|
+
readonly kind: 'Feature';
|
|
94
|
+
readonly name: string;
|
|
95
|
+
readonly strategy: 'lazy' | 'default';
|
|
96
|
+
readonly composition: Manifest & {
|
|
97
|
+
readonly kind: 'Composition';
|
|
98
|
+
};
|
|
99
|
+
readonly placeholder?: {
|
|
100
|
+
readonly loading: Manifest & {
|
|
101
|
+
readonly kind: 'Composition';
|
|
102
|
+
};
|
|
103
|
+
readonly failed: Manifest & {
|
|
104
|
+
readonly kind: 'Composition';
|
|
105
|
+
};
|
|
106
|
+
};
|
|
107
|
+
}
|
|
108
|
+
/**
|
|
109
|
+
* A feature's loaded artifacts with type params erased, for the renderer-neutral,
|
|
110
|
+
* strategy-uniform host. The erasure is cast-free *into*: because `Layer`'s `ROut`
|
|
111
|
+
* is contravariant and `RIn` covariant, every `Layer<ROut, never, R>` is assignable
|
|
112
|
+
* to `Layer<never, never, unknown>`, so any `FeatureModule<…>` is a `LoadedModule`.
|
|
113
|
+
* The host re-attaches the concrete root context when it builds `layer` (one
|
|
114
|
+
* documented boundary cast there, mirroring `buildRuntime`).
|
|
115
|
+
*/
|
|
116
|
+
export interface LoadedModule {
|
|
117
|
+
readonly requires: ReadonlyArray<RequireCarrier>;
|
|
118
|
+
readonly layer: Layer.Layer<never, never, unknown>;
|
|
119
|
+
}
|
|
120
|
+
/** Nominal brand identifying the value a `provide(slot, Feature)` puts under a slot tag. */
|
|
121
|
+
export declare const FeatureBindingTypeId: unique symbol;
|
|
122
|
+
export type FeatureBindingTypeId = typeof FeatureBindingTypeId;
|
|
123
|
+
/**
|
|
124
|
+
* What `provide(slot, Feature)` binds under the slot tag — everything the host
|
|
125
|
+
* needs to mount the feature, with types erased (the host is renderer-neutral and
|
|
126
|
+
* strategy-uniform). For `default` the host renders `composition` directly; for
|
|
127
|
+
* `lazy` it drives `load` through an `AsyncData` lifecycle, painting `placeholder`
|
|
128
|
+
* around it. The `composition`/`placeholder` here are the same `CompositionClass`
|
|
129
|
+
* values a normal slot fill carries, so the host's existing `Compose` path renders
|
|
130
|
+
* each.
|
|
131
|
+
*/
|
|
132
|
+
export interface FeatureBinding {
|
|
133
|
+
readonly [FeatureBindingTypeId]: FeatureBindingTypeId;
|
|
134
|
+
readonly manifest: FeatureManifest;
|
|
135
|
+
readonly composition: CompositionClass<unknown>;
|
|
136
|
+
readonly strategy: 'lazy' | 'default';
|
|
137
|
+
readonly load: Effect.Effect<LoadedModule, FeatureLoadFailed>;
|
|
138
|
+
readonly placeholder?: {
|
|
139
|
+
readonly loading: CompositionClass<unknown>;
|
|
140
|
+
readonly failed: CompositionClass<unknown>;
|
|
141
|
+
};
|
|
142
|
+
readonly boot: ReadonlyArray<Tagged>;
|
|
143
|
+
}
|
|
144
|
+
/** Whether a slot's bound child is a lazy/eager feature (vs a plain composition). */
|
|
145
|
+
export declare const isFeatureBinding: (u: unknown) => u is FeatureBinding;
|
|
146
|
+
/**
|
|
147
|
+
* A feature *definition*: a reflectable manifest (`kind: 'Feature'`) that carries
|
|
148
|
+
* the eager half (composition + placeholders) and an Effect `load` for the heavy
|
|
149
|
+
* `.live` half. `Props`/`Contract` flow from the composition; `Requires` is the
|
|
150
|
+
* shared-carrier tuple the loaded module declares. `load` is an `Effect`, never a
|
|
151
|
+
* Promise — consumers `yield* Feature.load`.
|
|
152
|
+
*/
|
|
153
|
+
export interface FeatureClass<P, C extends UiContract, ROut, Requires extends ReadonlyArray<RequireCarrier>> {
|
|
154
|
+
new (): {};
|
|
155
|
+
readonly manifest: FeatureManifest;
|
|
156
|
+
/** Phantom carrying the mounted composition's props type (for `provide` checks). */
|
|
157
|
+
readonly Props: P;
|
|
158
|
+
/** Phantom carrying the composition's UI contract (for typed reflection consumers). */
|
|
159
|
+
readonly Contract: C;
|
|
160
|
+
/** Phantom carrying the declared shared-carrier tuple. */
|
|
161
|
+
readonly Requires: Requires;
|
|
162
|
+
/** Load the feature's module — `yield* Feature.load` → its `FeatureModule`, or `FeatureLoadFailed`. */
|
|
163
|
+
readonly load: Effect.Effect<FeatureModule<ROut, Requires>, FeatureLoadFailed>;
|
|
164
|
+
/** The value `provide(slot, Feature)` binds under the slot tag. */
|
|
165
|
+
readonly binding: FeatureBinding;
|
|
166
|
+
/** The eagerly-available module — present only for `loadingStrategy: 'default'`. */
|
|
167
|
+
readonly eagerModule: FeatureModule<ROut, Requires> | undefined;
|
|
168
|
+
}
|
|
169
|
+
export type AnyFeature = FeatureClass<any, any, any, ReadonlyArray<RequireCarrier>>;
|
|
170
|
+
/** Whether a value is a feature definition (its target shape in `provide(slot, Feature)`). */
|
|
171
|
+
export declare const isFeature: (u: unknown) => u is AnyFeature;
|
|
172
|
+
/**
|
|
173
|
+
* The placeholders a lazy feature must ship — both eager compositions (their
|
|
174
|
+
* `.live` is in the eager bundle, so they paint the load gap). `loading` receives
|
|
175
|
+
* the feature's props; `failed` receives `{ error, retry }`. Typed loosely
|
|
176
|
+
* (`CompositionClass<any>`) because the host injects these props directly — they
|
|
177
|
+
* are not schema-decoded inputs.
|
|
178
|
+
*/
|
|
179
|
+
export interface Placeholders {
|
|
180
|
+
readonly loading: CompositionClass<any, UiContract>;
|
|
181
|
+
readonly failed: CompositionClass<any, UiContract>;
|
|
182
|
+
}
|
|
183
|
+
type FeatureConfig<P, C extends UiContract, ROut, Requires extends ReadonlyArray<RequireCarrier>> = {
|
|
184
|
+
readonly composition: CompositionClass<P, C>;
|
|
185
|
+
readonly boot?: ReadonlyArray<Tagged>;
|
|
186
|
+
} & ({
|
|
187
|
+
readonly loadingStrategy?: 'default';
|
|
188
|
+
readonly module: FeatureModule<ROut, Requires>;
|
|
189
|
+
} | {
|
|
190
|
+
readonly loadingStrategy: 'lazy';
|
|
191
|
+
readonly load: Effect.Effect<FeatureModule<ROut, Requires>, FeatureLoadFailed>;
|
|
192
|
+
readonly placeholder: Placeholders;
|
|
193
|
+
});
|
|
194
|
+
/**
|
|
195
|
+
* Define a feature. The whole-app shape (this manifest, the composition, the
|
|
196
|
+
* placeholders) stays eager and reflectable; the `.live` layer in `module`/`load`
|
|
197
|
+
* is the deferred chunk. Flip `loadingStrategy` from `'default'` to `'lazy'` and
|
|
198
|
+
* the discriminated config *requires* `placeholder` — the compiler walks you to a
|
|
199
|
+
* complete code-split feature.
|
|
200
|
+
*/
|
|
201
|
+
export declare const make: <P, C extends UiContract, ROut, Requires extends ReadonlyArray<RequireCarrier>>(name: string, config: FeatureConfig<P, C, ROut, Requires>) => FeatureClass<P, C, ROut, Requires>;
|
|
202
|
+
/**
|
|
203
|
+
* Mount a feature against a live engine. The renderer-neutral lifecycle, run on a
|
|
204
|
+
* per-feature `Scope`: load the module (an Effect — lazy = dynamic import; default
|
|
205
|
+
* = immediate), build its `.live` layer against the host's live `engineContext`
|
|
206
|
+
* (so its reducers/procedures register into the SHARED registries and its fibers
|
|
207
|
+
* fork onto this scope), then dispatch the feature's `boot`. Returns the merged
|
|
208
|
+
* context — engine services + the feature's own services — for the host to read
|
|
209
|
+
* the feature's composition and stores. Closing the scope disposes exactly this
|
|
210
|
+
* feature: its fibers stop and its stores are reclaimed.
|
|
211
|
+
*
|
|
212
|
+
* The single boundary cast (mirroring `buildRuntime`): `module.layer` is erased to
|
|
213
|
+
* `LoadedModule` so the host stays strategy- and type-uniform. The feature's real
|
|
214
|
+
* `RIn` was verified cast-free at `provide(slot, Feature)` and scene wiring; here
|
|
215
|
+
* we re-attach the concrete `engineContext` it builds against. `R` is the engine
|
|
216
|
+
* context's service set, supplied by the host.
|
|
217
|
+
*/
|
|
218
|
+
export declare const mountFeature: <R>(binding: FeatureBinding, engineContext: Context.Context<R>) => Effect.Effect<Context.Context<unknown>, FeatureLoadFailed, Scope.Scope>;
|
|
219
|
+
export {};
|
|
220
|
+
//# sourceMappingURL=feature.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"feature.d.ts","sourceRoot":"","sources":["../../../src/feature/feature.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,OAAO,EAAE,MAAM,EAAE,KAAK,EAAE,KAAK,KAAK,EAAE,MAAM,QAAQ,CAAA;AAChE,OAAO,EAAE,KAAK,MAAM,EAAE,MAAM,iBAAiB,CAAA;AAC7C,OAAO,EAAE,KAAK,QAAQ,EAAE,MAAM,qBAAqB,CAAA;AACnD,OAAO,EAAE,iBAAiB,EAAE,MAAM,oBAAoB,CAAA;AACtD,OAAO,EAAE,KAAK,QAAQ,EAAmB,MAAM,0BAA0B,CAAA;AACzE,OAAO,EAAE,KAAK,gBAAgB,EAAE,MAAM,wBAAwB,CAAA;AAC9D,OAAO,EAAE,KAAK,UAAU,EAAE,MAAM,eAAe,CAAA;AAC/C,OAAO,EAAW,KAAK,MAAM,EAAE,MAAM,gBAAgB,CAAA;AASrD;;;;;;GAMG;AACH,MAAM,MAAM,cAAc,GAAG,KAAK,CAAC,KAAK,CAAC,OAAO,CAAC,OAAO,MAAM,CAAC,CAAA;AAE/D;;;;;GAKG;AACH,MAAM,MAAM,cAAc,GACtB;IAAE,QAAQ,CAAC,KAAK,EAAE,OAAO,CAAC,GAAG,CAAC,GAAG,EAAE,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