@rikalabs/effect-react 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/LICENSE +21 -0
- package/README.md +179 -0
- package/dist/actions/http.d.ts +18 -0
- package/dist/actions/index.d.ts +4 -0
- package/dist/actions/react.d.ts +7 -0
- package/dist/actions/service.d.ts +18 -0
- package/dist/actions/types.d.ts +33 -0
- package/dist/boundary/codecs.d.ts +40 -0
- package/dist/boundary/errors.d.ts +22 -0
- package/dist/boundary/index.d.ts +2 -0
- package/dist/chunk-2GIUCKL2.js +16 -0
- package/dist/chunk-2GIUCKL2.js.map +1 -0
- package/dist/chunk-2TG7YEVD.js +11 -0
- package/dist/chunk-2TG7YEVD.js.map +1 -0
- package/dist/chunk-6FI4ROTW.js +152 -0
- package/dist/chunk-6FI4ROTW.js.map +1 -0
- package/dist/chunk-C5JI7D7W.js +213 -0
- package/dist/chunk-C5JI7D7W.js.map +1 -0
- package/dist/chunk-EEYASTXR.js +99 -0
- package/dist/chunk-EEYASTXR.js.map +1 -0
- package/dist/chunk-H7MOLKTU.js +301 -0
- package/dist/chunk-H7MOLKTU.js.map +1 -0
- package/dist/chunk-IVIYY6S5.js +77 -0
- package/dist/chunk-IVIYY6S5.js.map +1 -0
- package/dist/chunk-JKN75OYC.js +87 -0
- package/dist/chunk-JKN75OYC.js.map +1 -0
- package/dist/chunk-M2CJG6T7.js +24 -0
- package/dist/chunk-M2CJG6T7.js.map +1 -0
- package/dist/chunk-MDGEGQZB.js +206 -0
- package/dist/chunk-MDGEGQZB.js.map +1 -0
- package/dist/chunk-NI2GNZ7S.js +78 -0
- package/dist/chunk-NI2GNZ7S.js.map +1 -0
- package/dist/chunk-O7XTA7H3.js +423 -0
- package/dist/chunk-O7XTA7H3.js.map +1 -0
- package/dist/chunk-S67FHWAR.js +88 -0
- package/dist/chunk-S67FHWAR.js.map +1 -0
- package/dist/chunk-SKC3HMF3.js +17 -0
- package/dist/chunk-SKC3HMF3.js.map +1 -0
- package/dist/chunk-TUJZ6XJY.js +127 -0
- package/dist/chunk-TUJZ6XJY.js.map +1 -0
- package/dist/chunk-WPV3WFMS.js +38 -0
- package/dist/chunk-WPV3WFMS.js.map +1 -0
- package/dist/chunk-XIBEKS5A.js +301 -0
- package/dist/chunk-XIBEKS5A.js.map +1 -0
- package/dist/chunk-YG22YP5K.js +68 -0
- package/dist/chunk-YG22YP5K.js.map +1 -0
- package/dist/chunk-ZMZQBREU.js +262 -0
- package/dist/chunk-ZMZQBREU.js.map +1 -0
- package/dist/client/index.cjs +191 -0
- package/dist/client/index.cjs.map +1 -0
- package/dist/client/index.d.ts +8 -0
- package/dist/client/index.js +14 -0
- package/dist/client/index.js.map +1 -0
- package/dist/config/index.cjs +63 -0
- package/dist/config/index.cjs.map +1 -0
- package/dist/config/index.d.ts +32 -0
- package/dist/config/index.js +9 -0
- package/dist/config/index.js.map +1 -0
- package/dist/data/index.d.ts +3 -0
- package/dist/data/react.d.ts +10 -0
- package/dist/data/service.d.ts +20 -0
- package/dist/data/types.d.ts +31 -0
- package/dist/devtools/events.d.ts +37 -0
- package/dist/devtools/index.cjs +149 -0
- package/dist/devtools/index.cjs.map +1 -0
- package/dist/devtools/index.d.ts +2 -0
- package/dist/devtools/index.js +18 -0
- package/dist/devtools/index.js.map +1 -0
- package/dist/devtools/react.d.ts +8 -0
- package/dist/form/index.cjs +301 -0
- package/dist/form/index.cjs.map +1 -0
- package/dist/form/index.d.ts +3 -0
- package/dist/form/index.js +14 -0
- package/dist/form/index.js.map +1 -0
- package/dist/form/react.d.ts +9 -0
- package/dist/form/service.d.ts +3 -0
- package/dist/form/types.d.ts +41 -0
- package/dist/framework/app.d.ts +21 -0
- package/dist/framework/cache.d.ts +10 -0
- package/dist/framework/contracts.d.ts +32 -0
- package/dist/framework/index.cjs +1006 -0
- package/dist/framework/index.cjs.map +1 -0
- package/dist/framework/index.d.ts +4 -0
- package/dist/framework/index.js +35 -0
- package/dist/framework/index.js.map +1 -0
- package/dist/framework/manifest.d.ts +12 -0
- package/dist/framework/vite.d.ts +13 -0
- package/dist/framework-vite/index.cjs +163 -0
- package/dist/framework-vite/index.cjs.map +1 -0
- package/dist/framework-vite/index.d.ts +1 -0
- package/dist/framework-vite/index.js +125 -0
- package/dist/framework-vite/index.js.map +1 -0
- package/dist/grid/grid.d.ts +8 -0
- package/dist/grid/index.cjs +238 -0
- package/dist/grid/index.cjs.map +1 -0
- package/dist/grid/index.d.ts +2 -0
- package/dist/grid/index.js +19 -0
- package/dist/grid/index.js.map +1 -0
- package/dist/grid/types.d.ts +35 -0
- package/dist/index.cjs +2512 -0
- package/dist/index.cjs.map +1 -0
- package/dist/index.d.ts +13 -0
- package/dist/index.js +207 -0
- package/dist/index.js.map +1 -0
- package/dist/kernel/app.d.ts +26 -0
- package/dist/kernel/index.d.ts +3 -0
- package/dist/kernel/runtime.d.ts +5 -0
- package/dist/kernel/telemetry.d.ts +37 -0
- package/dist/navigation/index.d.ts +4 -0
- package/dist/navigation/matcher.d.ts +13 -0
- package/dist/navigation/react.d.ts +12 -0
- package/dist/navigation/service.d.ts +23 -0
- package/dist/navigation/types.d.ts +65 -0
- package/dist/query/index.cjs +361 -0
- package/dist/query/index.cjs.map +1 -0
- package/dist/query/index.d.ts +3 -0
- package/dist/query/index.js +30 -0
- package/dist/query/index.js.map +1 -0
- package/dist/query/react.d.ts +27 -0
- package/dist/query/service.d.ts +10 -0
- package/dist/query/types.d.ts +5 -0
- package/dist/react/index.d.ts +1 -0
- package/dist/react/provider.d.ts +10 -0
- package/dist/realtime/channel.d.ts +15 -0
- package/dist/realtime/index.cjs +117 -0
- package/dist/realtime/index.cjs.map +1 -0
- package/dist/realtime/index.d.ts +2 -0
- package/dist/realtime/index.js +15 -0
- package/dist/realtime/index.js.map +1 -0
- package/dist/realtime/presence.d.ts +22 -0
- package/dist/render/hydration.d.ts +24 -0
- package/dist/render/index.d.ts +2 -0
- package/dist/render/ssr.d.ts +13 -0
- package/dist/router/helpers.d.ts +26 -0
- package/dist/router/index.cjs +236 -0
- package/dist/router/index.cjs.map +1 -0
- package/dist/router/index.d.ts +4 -0
- package/dist/router/index.js +40 -0
- package/dist/router/index.js.map +1 -0
- package/dist/router/react.d.ts +5 -0
- package/dist/router/service.d.ts +5 -0
- package/dist/router/types.d.ts +1 -0
- package/dist/server/index.cjs +174 -0
- package/dist/server/index.cjs.map +1 -0
- package/dist/server/index.d.ts +16 -0
- package/dist/server/index.js +12 -0
- package/dist/server/index.js.map +1 -0
- package/dist/state/index.cjs +128 -0
- package/dist/state/index.cjs.map +1 -0
- package/dist/state/index.d.ts +2 -0
- package/dist/state/index.js +36 -0
- package/dist/state/index.js.map +1 -0
- package/dist/state/react.d.ts +3 -0
- package/dist/state/service.d.ts +28 -0
- package/dist/testing/index.cjs +970 -0
- package/dist/testing/index.cjs.map +1 -0
- package/dist/testing/index.d.ts +2 -0
- package/dist/testing/index.js +13 -0
- package/dist/testing/index.js.map +1 -0
- package/dist/virtual/index.cjs +160 -0
- package/dist/virtual/index.cjs.map +1 -0
- package/dist/virtual/index.d.ts +2 -0
- package/dist/virtual/index.js +21 -0
- package/dist/virtual/index.js.map +1 -0
- package/dist/virtual/types.d.ts +25 -0
- package/dist/virtual/virtual.d.ts +9 -0
- package/package.json +156 -0
package/dist/index.js
ADDED
|
@@ -0,0 +1,207 @@
|
|
|
1
|
+
import {
|
|
2
|
+
fetchQuery,
|
|
3
|
+
invalidate,
|
|
4
|
+
invalidateQuery,
|
|
5
|
+
prefetch,
|
|
6
|
+
prefetchQuery,
|
|
7
|
+
useInfiniteQuery,
|
|
8
|
+
useQuery,
|
|
9
|
+
useSuspenseQuery
|
|
10
|
+
} from "./chunk-H7MOLKTU.js";
|
|
11
|
+
import {
|
|
12
|
+
Link,
|
|
13
|
+
Outlet,
|
|
14
|
+
navigate,
|
|
15
|
+
revalidateNavigation,
|
|
16
|
+
routeHref,
|
|
17
|
+
routePath,
|
|
18
|
+
routeSearchText,
|
|
19
|
+
routeUrl,
|
|
20
|
+
useNavigate,
|
|
21
|
+
useNavigationSnapshot,
|
|
22
|
+
useRouteMatch
|
|
23
|
+
} from "./chunk-6FI4ROTW.js";
|
|
24
|
+
import {
|
|
25
|
+
createRequestHandler
|
|
26
|
+
} from "./chunk-EEYASTXR.js";
|
|
27
|
+
import {
|
|
28
|
+
changes,
|
|
29
|
+
createStore,
|
|
30
|
+
createStoreFromEffect,
|
|
31
|
+
createStoreTag,
|
|
32
|
+
derive,
|
|
33
|
+
get,
|
|
34
|
+
makeStoreLayer,
|
|
35
|
+
makeStoreLayerFromEffect,
|
|
36
|
+
modify,
|
|
37
|
+
select,
|
|
38
|
+
selectChanges,
|
|
39
|
+
set,
|
|
40
|
+
update,
|
|
41
|
+
useStore,
|
|
42
|
+
useStoreSelector
|
|
43
|
+
} from "./chunk-NI2GNZ7S.js";
|
|
44
|
+
import {
|
|
45
|
+
createTestApp
|
|
46
|
+
} from "./chunk-2TG7YEVD.js";
|
|
47
|
+
import {
|
|
48
|
+
calculateOffsetForIndex,
|
|
49
|
+
calculateOffsets,
|
|
50
|
+
calculateTotalSize,
|
|
51
|
+
calculateVisibleRange,
|
|
52
|
+
getOffsetForIndex,
|
|
53
|
+
getTotalSize,
|
|
54
|
+
getVisibleRange,
|
|
55
|
+
measureVirtualItems
|
|
56
|
+
} from "./chunk-TUJZ6XJY.js";
|
|
57
|
+
import {
|
|
58
|
+
defaultHydrationGlobalName,
|
|
59
|
+
hydrateApp
|
|
60
|
+
} from "./chunk-M2CJG6T7.js";
|
|
61
|
+
import "./chunk-IVIYY6S5.js";
|
|
62
|
+
import {
|
|
63
|
+
createDevtoolsEventStream,
|
|
64
|
+
createDevtoolsEventStreamFromTelemetry,
|
|
65
|
+
createRuntimeEventSource,
|
|
66
|
+
useDevtoolsEvents,
|
|
67
|
+
useEventStream
|
|
68
|
+
} from "./chunk-S67FHWAR.js";
|
|
69
|
+
import {
|
|
70
|
+
createChannel,
|
|
71
|
+
createPresence,
|
|
72
|
+
publish,
|
|
73
|
+
publishAll,
|
|
74
|
+
subscribe
|
|
75
|
+
} from "./chunk-JKN75OYC.js";
|
|
76
|
+
import {
|
|
77
|
+
FormValidationError,
|
|
78
|
+
defineForm,
|
|
79
|
+
makeForm,
|
|
80
|
+
useForm
|
|
81
|
+
} from "./chunk-ZMZQBREU.js";
|
|
82
|
+
import "./chunk-2GIUCKL2.js";
|
|
83
|
+
import {
|
|
84
|
+
cachePolicy,
|
|
85
|
+
createApp,
|
|
86
|
+
defineAction,
|
|
87
|
+
defineLayout,
|
|
88
|
+
defineManifest,
|
|
89
|
+
defineMiddleware,
|
|
90
|
+
definePage,
|
|
91
|
+
loadersFromManifest,
|
|
92
|
+
noStore,
|
|
93
|
+
routesFromManifest
|
|
94
|
+
} from "./chunk-XIBEKS5A.js";
|
|
95
|
+
import {
|
|
96
|
+
QueryRuntimeError,
|
|
97
|
+
defineQuery
|
|
98
|
+
} from "./chunk-C5JI7D7W.js";
|
|
99
|
+
import {
|
|
100
|
+
NavigationCancelledError,
|
|
101
|
+
NavigationRuntimeError,
|
|
102
|
+
defineLoader,
|
|
103
|
+
defineRoute
|
|
104
|
+
} from "./chunk-O7XTA7H3.js";
|
|
105
|
+
import "./chunk-YG22YP5K.js";
|
|
106
|
+
import {
|
|
107
|
+
defineConfig,
|
|
108
|
+
resolveConfig
|
|
109
|
+
} from "./chunk-WPV3WFMS.js";
|
|
110
|
+
import "./chunk-SKC3HMF3.js";
|
|
111
|
+
import {
|
|
112
|
+
defineColumns,
|
|
113
|
+
filterRows,
|
|
114
|
+
mapRows,
|
|
115
|
+
paginateRows,
|
|
116
|
+
projectRow,
|
|
117
|
+
projectRows,
|
|
118
|
+
sortRows
|
|
119
|
+
} from "./chunk-MDGEGQZB.js";
|
|
120
|
+
export {
|
|
121
|
+
FormValidationError,
|
|
122
|
+
Link,
|
|
123
|
+
NavigationCancelledError,
|
|
124
|
+
NavigationRuntimeError,
|
|
125
|
+
Outlet,
|
|
126
|
+
QueryRuntimeError,
|
|
127
|
+
cachePolicy,
|
|
128
|
+
calculateOffsetForIndex,
|
|
129
|
+
calculateOffsets,
|
|
130
|
+
calculateTotalSize,
|
|
131
|
+
calculateVisibleRange,
|
|
132
|
+
changes,
|
|
133
|
+
createApp,
|
|
134
|
+
createChannel,
|
|
135
|
+
createDevtoolsEventStream,
|
|
136
|
+
createDevtoolsEventStreamFromTelemetry,
|
|
137
|
+
createPresence,
|
|
138
|
+
createRequestHandler,
|
|
139
|
+
createRuntimeEventSource,
|
|
140
|
+
createStore,
|
|
141
|
+
createStoreFromEffect,
|
|
142
|
+
createStoreTag,
|
|
143
|
+
createTestApp,
|
|
144
|
+
defaultHydrationGlobalName,
|
|
145
|
+
defineAction,
|
|
146
|
+
defineColumns,
|
|
147
|
+
defineConfig,
|
|
148
|
+
defineForm,
|
|
149
|
+
defineLayout,
|
|
150
|
+
defineLoader,
|
|
151
|
+
defineManifest,
|
|
152
|
+
defineMiddleware,
|
|
153
|
+
definePage,
|
|
154
|
+
defineQuery,
|
|
155
|
+
defineRoute,
|
|
156
|
+
derive,
|
|
157
|
+
fetchQuery,
|
|
158
|
+
filterRows,
|
|
159
|
+
get,
|
|
160
|
+
getOffsetForIndex,
|
|
161
|
+
getTotalSize,
|
|
162
|
+
getVisibleRange,
|
|
163
|
+
hydrateApp,
|
|
164
|
+
invalidate,
|
|
165
|
+
invalidateQuery,
|
|
166
|
+
loadersFromManifest,
|
|
167
|
+
makeForm,
|
|
168
|
+
makeStoreLayer,
|
|
169
|
+
makeStoreLayerFromEffect,
|
|
170
|
+
mapRows,
|
|
171
|
+
measureVirtualItems,
|
|
172
|
+
modify,
|
|
173
|
+
navigate,
|
|
174
|
+
noStore,
|
|
175
|
+
paginateRows,
|
|
176
|
+
prefetch,
|
|
177
|
+
prefetchQuery,
|
|
178
|
+
projectRow,
|
|
179
|
+
projectRows,
|
|
180
|
+
publish,
|
|
181
|
+
publishAll,
|
|
182
|
+
resolveConfig,
|
|
183
|
+
revalidateNavigation,
|
|
184
|
+
routeHref,
|
|
185
|
+
routePath,
|
|
186
|
+
routeSearchText,
|
|
187
|
+
routeUrl,
|
|
188
|
+
routesFromManifest,
|
|
189
|
+
select,
|
|
190
|
+
selectChanges,
|
|
191
|
+
set,
|
|
192
|
+
sortRows,
|
|
193
|
+
subscribe,
|
|
194
|
+
update,
|
|
195
|
+
useDevtoolsEvents,
|
|
196
|
+
useEventStream,
|
|
197
|
+
useForm,
|
|
198
|
+
useInfiniteQuery,
|
|
199
|
+
useNavigate,
|
|
200
|
+
useNavigationSnapshot,
|
|
201
|
+
useQuery,
|
|
202
|
+
useRouteMatch,
|
|
203
|
+
useStore,
|
|
204
|
+
useStoreSelector,
|
|
205
|
+
useSuspenseQuery
|
|
206
|
+
};
|
|
207
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { Layer } from "effect";
|
|
2
|
+
import { type AnyActionDefinition } from "../actions";
|
|
3
|
+
import type { Actions } from "../actions";
|
|
4
|
+
import type { Boundary } from "../boundary";
|
|
5
|
+
import { type QueryRuntimeOptions } from "../data";
|
|
6
|
+
import type { Data } from "../data";
|
|
7
|
+
import { type AnyLoaderDefinition, type AnyRouteDefinition } from "../navigation";
|
|
8
|
+
import type { Navigation } from "../navigation";
|
|
9
|
+
import { type AppManagedRuntime } from "./runtime";
|
|
10
|
+
import { type TelemetryEvent } from "./telemetry";
|
|
11
|
+
import type { Telemetry } from "./telemetry";
|
|
12
|
+
import type { Stream } from "effect";
|
|
13
|
+
export interface CreateAppLayerOptions {
|
|
14
|
+
readonly routes: readonly AnyRouteDefinition[];
|
|
15
|
+
readonly actions?: readonly AnyActionDefinition[];
|
|
16
|
+
readonly loaders?: readonly AnyLoaderDefinition[];
|
|
17
|
+
readonly initialHref?: string;
|
|
18
|
+
readonly data?: QueryRuntimeOptions;
|
|
19
|
+
}
|
|
20
|
+
export type AppServices = Boundary | Data | Actions | Navigation | Telemetry;
|
|
21
|
+
export type AppLayer = Layer.Layer<AppServices, never, never>;
|
|
22
|
+
export declare const createAppLayer: (options: CreateAppLayerOptions) => AppLayer;
|
|
23
|
+
export declare const createAppRuntime: (options: CreateAppLayerOptions) => AppManagedRuntime<AppServices>;
|
|
24
|
+
export interface FrameworkEventStream {
|
|
25
|
+
readonly stream: Stream.Stream<TelemetryEvent>;
|
|
26
|
+
}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { ManagedRuntime, type Runtime } from "effect";
|
|
2
|
+
import type { Layer } from "effect";
|
|
3
|
+
export type AppManagedRuntime<R> = ManagedRuntime.ManagedRuntime<R, never>;
|
|
4
|
+
export declare const createManagedRuntime: <R>(layer: Layer.Layer<R, never, never>) => AppManagedRuntime<R>;
|
|
5
|
+
export type RuntimeHandle<R> = Runtime.Runtime<R>;
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import { Context, Effect, Layer, Stream } from "effect";
|
|
2
|
+
export type TelemetryEvent = {
|
|
3
|
+
readonly _tag: "query";
|
|
4
|
+
readonly phase: "start" | "success" | "failure" | "invalidate";
|
|
5
|
+
readonly key: string;
|
|
6
|
+
readonly timestamp: number;
|
|
7
|
+
readonly detail?: unknown;
|
|
8
|
+
} | {
|
|
9
|
+
readonly _tag: "navigation";
|
|
10
|
+
readonly phase: "start" | "success" | "failure" | "cancel";
|
|
11
|
+
readonly pathname: string;
|
|
12
|
+
readonly routeId?: string;
|
|
13
|
+
readonly timestamp: number;
|
|
14
|
+
readonly detail?: unknown;
|
|
15
|
+
} | {
|
|
16
|
+
readonly _tag: "action";
|
|
17
|
+
readonly phase: "start" | "success" | "failure" | "transport";
|
|
18
|
+
readonly name: string;
|
|
19
|
+
readonly timestamp: number;
|
|
20
|
+
readonly detail?: unknown;
|
|
21
|
+
} | {
|
|
22
|
+
readonly _tag: "boundary";
|
|
23
|
+
readonly phase: "decode-failure" | "protocol-failure" | "transport-failure";
|
|
24
|
+
readonly source: string;
|
|
25
|
+
readonly timestamp: number;
|
|
26
|
+
readonly detail?: unknown;
|
|
27
|
+
};
|
|
28
|
+
export interface TelemetryService {
|
|
29
|
+
readonly emit: (event: TelemetryEvent) => Effect.Effect<void>;
|
|
30
|
+
readonly stream: Stream.Stream<TelemetryEvent>;
|
|
31
|
+
}
|
|
32
|
+
declare const Telemetry_base: Context.TagClass<Telemetry, "EffectReact/Telemetry", TelemetryService>;
|
|
33
|
+
export declare class Telemetry extends Telemetry_base {
|
|
34
|
+
}
|
|
35
|
+
export declare const TelemetryLive: Layer.Layer<Telemetry, never, never>;
|
|
36
|
+
export declare const emitTelemetry: (event: TelemetryEvent) => Effect.Effect<void, never, Telemetry>;
|
|
37
|
+
export {};
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import type { AnyRouteDefinition, RouteMatch } from "./types";
|
|
2
|
+
export interface MatchInput {
|
|
3
|
+
readonly routes: readonly AnyRouteDefinition[];
|
|
4
|
+
readonly pathname: string;
|
|
5
|
+
readonly search: unknown;
|
|
6
|
+
}
|
|
7
|
+
export declare const matchRoute: ({ routes, pathname, search }: MatchInput) => RouteMatch<AnyRouteDefinition> | null;
|
|
8
|
+
export declare const buildHref: (pathname: string, searchText: string) => string;
|
|
9
|
+
export declare const normalizeSearchText: (searchText: string) => string;
|
|
10
|
+
export declare const parseHref: (href: string) => {
|
|
11
|
+
readonly pathname: string;
|
|
12
|
+
readonly searchText: string;
|
|
13
|
+
};
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { type AnchorHTMLAttributes, type ReactNode } from "react";
|
|
2
|
+
import type { NavigationSnapshot } from "./types";
|
|
3
|
+
export declare const useNavigationSnapshot: () => NavigationSnapshot;
|
|
4
|
+
export declare const useNavigate: () => ((href: string) => Promise<NavigationSnapshot>);
|
|
5
|
+
export interface LinkProps extends Omit<AnchorHTMLAttributes<HTMLAnchorElement>, "href"> {
|
|
6
|
+
readonly to: string;
|
|
7
|
+
readonly children?: ReactNode;
|
|
8
|
+
}
|
|
9
|
+
export declare const Link: ({ to, onClick, children, ...rest }: LinkProps) => import("react/jsx-runtime").JSX.Element;
|
|
10
|
+
export declare const Outlet: ({ children }: {
|
|
11
|
+
readonly children?: ReactNode;
|
|
12
|
+
}) => import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { Context, Effect, Layer, type Stream } from "effect";
|
|
2
|
+
import { Boundary } from "../boundary";
|
|
3
|
+
import { Telemetry } from "../kernel/telemetry";
|
|
4
|
+
import { type AnyLoaderDefinition, type AnyRouteDefinition, type NavigationSnapshot } from "./types";
|
|
5
|
+
import type { NavigationError } from "./types";
|
|
6
|
+
export interface NavigationService {
|
|
7
|
+
readonly navigate: (href: string) => Effect.Effect<NavigationSnapshot, NavigationError, never>;
|
|
8
|
+
readonly revalidate: () => Effect.Effect<NavigationSnapshot, NavigationError, never>;
|
|
9
|
+
readonly getSnapshot: Effect.Effect<NavigationSnapshot, never, never>;
|
|
10
|
+
readonly hydrateSnapshot: (snapshot: NavigationSnapshot) => Effect.Effect<void, never, never>;
|
|
11
|
+
readonly snapshots: Stream.Stream<NavigationSnapshot>;
|
|
12
|
+
}
|
|
13
|
+
declare const Navigation_base: Context.TagClass<Navigation, "EffectReact/Navigation", NavigationService>;
|
|
14
|
+
export declare class Navigation extends Navigation_base {
|
|
15
|
+
}
|
|
16
|
+
export interface MakeNavigationLayerOptions {
|
|
17
|
+
readonly routes: readonly AnyRouteDefinition[];
|
|
18
|
+
readonly loaders?: readonly AnyLoaderDefinition[];
|
|
19
|
+
readonly initialHref?: string;
|
|
20
|
+
}
|
|
21
|
+
export declare const makeNavigationLayer: (options: MakeNavigationLayerOptions) => Layer.Layer<Navigation, never, Boundary | Telemetry>;
|
|
22
|
+
export declare const navigateTo: (href: string) => Effect.Effect<NavigationSnapshot, NavigationError, Navigation>;
|
|
23
|
+
export {};
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
import type { Effect, Schedule, Schema } from "effect";
|
|
2
|
+
import type { BoundaryDecodeError } from "../boundary";
|
|
3
|
+
export interface RouteDefinition<Path extends string, Search, SearchEncoded = Search> {
|
|
4
|
+
readonly id: string;
|
|
5
|
+
readonly path: Path;
|
|
6
|
+
readonly search?: Schema.Schema<Search, SearchEncoded, never>;
|
|
7
|
+
}
|
|
8
|
+
export declare const defineRoute: <Path extends string, Search = Record<never, never>, SearchEncoded = Search>(route: RouteDefinition<Path, Search, SearchEncoded>) => RouteDefinition<Path, Search, SearchEncoded>;
|
|
9
|
+
export interface AnyRouteDefinition {
|
|
10
|
+
readonly id: string;
|
|
11
|
+
readonly path: string;
|
|
12
|
+
readonly search?: Schema.Schema.All;
|
|
13
|
+
}
|
|
14
|
+
export interface RouteMatch<TRoute extends AnyRouteDefinition> {
|
|
15
|
+
readonly route: TRoute;
|
|
16
|
+
readonly pathname: string;
|
|
17
|
+
readonly params: Readonly<Record<string, string>>;
|
|
18
|
+
readonly search: unknown;
|
|
19
|
+
}
|
|
20
|
+
export interface LoaderContext<TRoute extends AnyRouteDefinition> {
|
|
21
|
+
readonly route: TRoute;
|
|
22
|
+
readonly pathname: string;
|
|
23
|
+
readonly searchText: string;
|
|
24
|
+
readonly params: Readonly<Record<string, string>>;
|
|
25
|
+
readonly search: unknown;
|
|
26
|
+
readonly dependencyResults: Readonly<Record<string, unknown>>;
|
|
27
|
+
}
|
|
28
|
+
export interface LoaderDefinition<Name extends string, RouteId extends string, Output, E, TRoute extends AnyRouteDefinition = AnyRouteDefinition> {
|
|
29
|
+
readonly name: Name;
|
|
30
|
+
readonly routeId: RouteId;
|
|
31
|
+
readonly dependsOn?: readonly string[];
|
|
32
|
+
readonly retry?: Schedule.Schedule<unknown, E, never>;
|
|
33
|
+
readonly run: (context: LoaderContext<TRoute>) => Effect.Effect<Output, E, never>;
|
|
34
|
+
}
|
|
35
|
+
export declare const defineLoader: <Name extends string, RouteId extends string, Output, E, TRoute extends AnyRouteDefinition = AnyRouteDefinition>(loader: LoaderDefinition<Name, RouteId, Output, E, TRoute>) => LoaderDefinition<Name, RouteId, Output, E, TRoute>;
|
|
36
|
+
export type AnyLoaderDefinition = LoaderDefinition<string, string, unknown, never, AnyRouteDefinition>;
|
|
37
|
+
export type LoaderSnapshotEntry = {
|
|
38
|
+
readonly _tag: "pending";
|
|
39
|
+
} | {
|
|
40
|
+
readonly _tag: "success";
|
|
41
|
+
readonly value: unknown;
|
|
42
|
+
} | {
|
|
43
|
+
readonly _tag: "failure";
|
|
44
|
+
readonly error: unknown;
|
|
45
|
+
};
|
|
46
|
+
export interface NavigationSnapshot {
|
|
47
|
+
readonly pathname: string;
|
|
48
|
+
readonly searchText: string;
|
|
49
|
+
readonly href: string;
|
|
50
|
+
readonly status: "idle" | "loading" | "success" | "failure";
|
|
51
|
+
readonly match: RouteMatch<AnyRouteDefinition> | null;
|
|
52
|
+
readonly loaders: Readonly<Record<string, LoaderSnapshotEntry>>;
|
|
53
|
+
readonly error: unknown;
|
|
54
|
+
}
|
|
55
|
+
export declare class NavigationRuntimeError extends Error {
|
|
56
|
+
readonly messageText: string;
|
|
57
|
+
readonly _tag: "NavigationRuntimeError";
|
|
58
|
+
constructor(messageText: string);
|
|
59
|
+
}
|
|
60
|
+
export declare class NavigationCancelledError extends Error {
|
|
61
|
+
readonly pathname: string;
|
|
62
|
+
readonly _tag: "NavigationCancelledError";
|
|
63
|
+
constructor(pathname: string);
|
|
64
|
+
}
|
|
65
|
+
export type NavigationError = NavigationRuntimeError | NavigationCancelledError | BoundaryDecodeError;
|