@noego/forge 0.1.25 → 0.1.28
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 +18 -1
- package/dist/client.cjs +2 -2
- package/dist/client.cjs.map +1 -1
- package/dist/client.d.ts +30 -1
- package/dist/client.mjs +756 -728
- package/dist/client.mjs.map +1 -1
- package/dist/options/ServerOptions.cjs.map +1 -1
- package/dist/options/ServerOptions.d.ts +3 -0
- package/dist/options/ServerOptions.mjs.map +1 -1
- package/dist/page.svelte-4uv4nQ2i.js.map +1 -1
- package/dist/page.svelte-CW8PJDdH.cjs.map +1 -1
- package/dist/plugins-cjs/options/ServerOptions.js.map +1 -1
- package/dist/plugins-es/options/ServerOptions.d.ts +3 -0
- package/dist/plugins-es/options/ServerOptions.js.map +1 -1
- package/dist-ssr/{path-BqcF5dbs.js → path-2bYzpvRB.js} +3 -1
- package/dist-ssr/{path-BqcF5dbs.js.map → path-2bYzpvRB.js.map} +1 -1
- package/dist-ssr/{path-sxXxpB6R.cjs → path-DCxJMpj7.cjs} +3 -1
- package/dist-ssr/{path-sxXxpB6R.cjs.map → path-DCxJMpj7.cjs.map} +1 -1
- package/dist-ssr/server.cjs +4 -3
- package/dist-ssr/server.cjs.map +1 -1
- package/dist-ssr/server.d.ts +4 -0
- package/dist-ssr/server.js +4 -3
- package/dist-ssr/server.js.map +1 -1
- package/dist-ssr/shared.cjs +1 -1
- package/dist-ssr/shared.js +1 -1
- package/dist-ssr/static.cjs +1 -1
- package/dist-ssr/static.d.ts +1 -0
- package/dist-ssr/static.js +1 -1
- package/dist-ssr/test.d.ts +1 -0
- package/dist-ssr/{url_parser-BX00zzMP.js → url_parser-B6dvK0DX.js} +2 -2
- package/dist-ssr/{url_parser-BX00zzMP.js.map → url_parser-B6dvK0DX.js.map} +1 -1
- package/dist-ssr/{url_parser-Dipo_fiS.cjs → url_parser-D7ZqJUTw.cjs} +2 -2
- package/dist-ssr/{url_parser-Dipo_fiS.cjs.map → url_parser-D7ZqJUTw.cjs.map} +1 -1
- package/package.json +1 -1
- package/src/components/RecursiveRender.svelte +37 -16
package/dist/client.d.ts
CHANGED
|
@@ -22,6 +22,17 @@ declare type CallbackHeadersMiddleware = (headers: HeadersObject, next: NextFunc
|
|
|
22
22
|
|
|
23
23
|
declare type ContextBuilder = (req: any, res: any) => Record<string, any>;
|
|
24
24
|
|
|
25
|
+
export declare interface ControllerEvents {
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
declare type ControllerFactory = (controllerClass: new (...args: any[]) => any) => Promise<unknown> | unknown;
|
|
29
|
+
|
|
30
|
+
export declare interface ControllerInput {
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
export declare interface ControllerState {
|
|
34
|
+
}
|
|
35
|
+
|
|
25
36
|
export declare function createApp<T extends HTMLElement = HTMLElement>(node: T, options: ServerOptions): Promise<void>;
|
|
26
37
|
|
|
27
38
|
declare const fetch_2: FetchMiddlewareAPI & {
|
|
@@ -128,13 +139,14 @@ declare interface IRoute {
|
|
|
128
139
|
layout?: string[];
|
|
129
140
|
middleware?: string[];
|
|
130
141
|
view: string;
|
|
142
|
+
controller?: string;
|
|
131
143
|
responses?: Response_2;
|
|
132
144
|
parameters?: Parameter[];
|
|
133
145
|
query?: Parameter[];
|
|
134
146
|
body?: Body_2;
|
|
135
147
|
}
|
|
136
148
|
|
|
137
|
-
export declare function loadRoute(node: any, base_path: string, route: IRoute, combinedParams: any, urlParams: any, query: any): Promise<void>;
|
|
149
|
+
export declare function loadRoute(node: any, base_path: string, route: IRoute, combinedParams: any, urlParams: any, query: any, controllerFactory?: (controllerClass: new (...args: any[]) => any) => Promise<unknown> | unknown): Promise<void>;
|
|
138
150
|
|
|
139
151
|
declare function makeUrlParser(pattern: string): (pathname: string) => Record<string, string> | null;
|
|
140
152
|
|
|
@@ -144,6 +156,14 @@ declare type NextFunction = (error?: any) => void;
|
|
|
144
156
|
|
|
145
157
|
export declare const page: Writable<IPage>;
|
|
146
158
|
|
|
159
|
+
export declare interface PageController<S extends ControllerState = ControllerState, I extends ControllerInput = ControllerInput, E extends ControllerEvents = ControllerEvents> {
|
|
160
|
+
readonly data?: S;
|
|
161
|
+
readonly input?: I;
|
|
162
|
+
readonly events?: E;
|
|
163
|
+
initialize?(loadData: any, route: RouteContext): void | Promise<void>;
|
|
164
|
+
destroy?(): void;
|
|
165
|
+
}
|
|
166
|
+
|
|
147
167
|
declare type Parameter = any;
|
|
148
168
|
|
|
149
169
|
declare type RequestInitMiddleware = ((init: RequestInit, input: RequestInfo | URL) => Promise<RequestInit> | RequestInit) | ((init: RequestInit) => Promise<RequestInit> | RequestInit);
|
|
@@ -154,6 +174,13 @@ declare type ResponseData = {
|
|
|
154
174
|
description: string;
|
|
155
175
|
};
|
|
156
176
|
|
|
177
|
+
export declare interface RouteContext {
|
|
178
|
+
params: Record<string, string>;
|
|
179
|
+
urlParams: Record<string, string>;
|
|
180
|
+
query: Record<string, string | string[]>;
|
|
181
|
+
page: IPage;
|
|
182
|
+
}
|
|
183
|
+
|
|
157
184
|
declare interface ServerOptions {
|
|
158
185
|
development?: boolean;
|
|
159
186
|
viteOptions?: any;
|
|
@@ -166,6 +193,8 @@ declare interface ServerOptions {
|
|
|
166
193
|
assets?: ForgeAssets;
|
|
167
194
|
context_builder?: ContextBuilder;
|
|
168
195
|
middleware_path?: string;
|
|
196
|
+
/** Optional PageController factory used by the client for each page/layout/controller instantiation. */
|
|
197
|
+
controller_factory?: ControllerFactory;
|
|
169
198
|
}
|
|
170
199
|
|
|
171
200
|
export declare function shadowUrl(pattern: string, url: string): any;
|