@askrjs/askr 0.0.2 → 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/README.md +8 -5
- package/dist/chunk-64C7W2AE.js +43 -0
- package/dist/chunk-64C7W2AE.js.map +1 -0
- package/dist/chunk-6FLMH4EL.js +124 -0
- package/dist/chunk-6FLMH4EL.js.map +1 -0
- package/dist/chunk-FJUXFA72.js +16 -0
- package/dist/chunk-FJUXFA72.js.map +1 -0
- package/dist/chunk-SALJX5PZ.js +26 -0
- package/dist/{chunk-KR6HG7HF.js.map → chunk-SALJX5PZ.js.map} +1 -1
- package/dist/{chunk-RJWOOUYV.js → chunk-VRAEBIJ3.js} +7 -9
- package/dist/chunk-VRAEBIJ3.js.map +1 -0
- package/dist/chunk-WTFWRSHB.js +98 -0
- package/dist/chunk-WTFWRSHB.js.map +1 -0
- package/dist/chunk-XHKZGJE3.js +2907 -0
- package/dist/chunk-XHKZGJE3.js.map +1 -0
- package/dist/chunk-Z5ZSTLYF.js +420 -0
- package/dist/chunk-Z5ZSTLYF.js.map +1 -0
- package/dist/fx/index.cjs +1193 -0
- package/dist/fx/index.cjs.map +1 -0
- package/dist/fx/index.d.cts +186 -0
- package/dist/fx/index.d.ts +186 -0
- package/dist/fx/index.js +418 -0
- package/dist/fx/index.js.map +1 -0
- package/dist/index.cjs +3020 -3506
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +74 -364
- package/dist/index.d.ts +74 -364
- package/dist/index.js +88 -656
- package/dist/index.js.map +1 -1
- package/dist/jsx/jsx-dev-runtime.cjs +1 -1
- package/dist/jsx/jsx-dev-runtime.cjs.map +1 -1
- package/dist/jsx/jsx-dev-runtime.d.cts +3 -2
- package/dist/jsx/jsx-dev-runtime.d.ts +3 -2
- package/dist/jsx/jsx-dev-runtime.js +2 -5
- package/dist/jsx/jsx-dev-runtime.js.map +1 -1
- package/dist/jsx/jsx-runtime.d.cts +2 -1
- package/dist/jsx/jsx-runtime.d.ts +2 -1
- package/dist/jsx/jsx-runtime.js +2 -4
- package/dist/{types-DLTViI21.d.cts → jsx-AzPM8gMS.d.cts} +6 -21
- package/dist/{types-DLTViI21.d.ts → jsx-AzPM8gMS.d.ts} +6 -21
- package/dist/navigate-LUVYHYZZ.js +17 -0
- package/dist/resources/index.cjs +1200 -0
- package/dist/resources/index.cjs.map +1 -0
- package/dist/resources/index.d.cts +21 -0
- package/dist/resources/index.d.ts +21 -0
- package/dist/resources/index.js +278 -0
- package/dist/resources/index.js.map +1 -0
- package/dist/{route-P5YQBT4T.js → route-BCND6MPK.js} +5 -4
- package/dist/router/index.cjs +3247 -0
- package/dist/router/index.cjs.map +1 -0
- package/dist/router/index.d.cts +64 -0
- package/dist/router/index.d.ts +64 -0
- package/dist/router/index.js +49 -0
- package/dist/router/index.js.map +1 -0
- package/dist/router-DaGtH1Sq.d.cts +36 -0
- package/dist/router-DaGtH1Sq.d.ts +36 -0
- package/dist/ssr/index.cjs +4059 -0
- package/dist/ssr/index.cjs.map +1 -0
- package/dist/ssr/index.d.cts +123 -0
- package/dist/ssr/index.d.ts +123 -0
- package/dist/ssr/index.js +666 -0
- package/dist/ssr/index.js.map +1 -0
- package/dist/types-CZ5sWur5.d.cts +23 -0
- package/dist/types-CZHOAiC1.d.ts +23 -0
- package/package.json +21 -7
- package/src/jsx/types.ts +4 -17
- package/dist/chunk-KR6HG7HF.js +0 -38
- package/dist/chunk-MIPES65F.js +0 -3023
- package/dist/chunk-MIPES65F.js.map +0 -1
- package/dist/chunk-PFOLLB6A.js +0 -524
- package/dist/chunk-PFOLLB6A.js.map +0 -1
- package/dist/chunk-QECQ2TF6.js +0 -28
- package/dist/chunk-QECQ2TF6.js.map +0 -1
- package/dist/chunk-RJWOOUYV.js.map +0 -1
- package/dist/navigate-SDZNA2ZE.js +0 -16
- package/dist/ssr-65K3IJ6B.js +0 -28
- package/dist/ssr-65K3IJ6B.js.map +0 -1
- /package/dist/{navigate-SDZNA2ZE.js.map → navigate-LUVYHYZZ.js.map} +0 -0
- /package/dist/{route-P5YQBT4T.js.map → route-BCND6MPK.js.map} +0 -0
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
import { a as RouteSnapshot, b as RouteHandler, R as Route } from '../router-DaGtH1Sq.cjs';
|
|
2
|
+
export { c as RouteMatch, d as RouteQuery } from '../router-DaGtH1Sq.cjs';
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* Route definition and matching
|
|
6
|
+
* Supports dynamic route registration for micro frontends
|
|
7
|
+
*
|
|
8
|
+
* Optimization: Index by depth but maintain insertion order within each depth
|
|
9
|
+
*/
|
|
10
|
+
|
|
11
|
+
declare function route(): RouteSnapshot;
|
|
12
|
+
declare function route(path: string, handler?: RouteHandler, namespace?: string): void;
|
|
13
|
+
/**
|
|
14
|
+
* Get all registered routes
|
|
15
|
+
*/
|
|
16
|
+
declare function getRoutes(): Route[];
|
|
17
|
+
/**
|
|
18
|
+
* Clear all registered routes (mainly for testing)
|
|
19
|
+
*/
|
|
20
|
+
declare function clearRoutes(): void;
|
|
21
|
+
|
|
22
|
+
/**
|
|
23
|
+
* Client-side navigation with History API
|
|
24
|
+
*/
|
|
25
|
+
|
|
26
|
+
/**
|
|
27
|
+
* Navigate to a new path
|
|
28
|
+
* Updates URL, resolves route, and re-mounts app with new handler
|
|
29
|
+
*/
|
|
30
|
+
declare function navigate(path: string): void;
|
|
31
|
+
|
|
32
|
+
/**
|
|
33
|
+
* Link component for client-side navigation
|
|
34
|
+
*/
|
|
35
|
+
interface LinkProps {
|
|
36
|
+
href: string;
|
|
37
|
+
children?: unknown;
|
|
38
|
+
}
|
|
39
|
+
/**
|
|
40
|
+
* Link component that prevents default navigation and uses navigate()
|
|
41
|
+
* Provides declarative way to navigate between routes
|
|
42
|
+
*
|
|
43
|
+
* Respects:
|
|
44
|
+
* - Middle-click (opens in new tab)
|
|
45
|
+
* - Ctrl/Cmd+click (opens in new tab)
|
|
46
|
+
* - Shift+click (opens in new window)
|
|
47
|
+
* - Right-click context menu
|
|
48
|
+
*/
|
|
49
|
+
declare function Link({ href, children }: LinkProps): unknown;
|
|
50
|
+
|
|
51
|
+
/**
|
|
52
|
+
* Layout helper.
|
|
53
|
+
*
|
|
54
|
+
* A layout is just a normal component that wraps children.
|
|
55
|
+
* Persistence and reuse are handled by the runtime via component identity.
|
|
56
|
+
*
|
|
57
|
+
* This helper exists purely for readability and convention.
|
|
58
|
+
*/
|
|
59
|
+
type LayoutComponent<P = object> = (props: P & {
|
|
60
|
+
children?: unknown;
|
|
61
|
+
}) => unknown;
|
|
62
|
+
declare function layout<P = object>(Layout: LayoutComponent<P>): (children?: unknown, props?: P) => unknown;
|
|
63
|
+
|
|
64
|
+
export { Link, type LinkProps, Route, RouteHandler, RouteSnapshot, clearRoutes, getRoutes, layout, navigate, route };
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
import { a as RouteSnapshot, b as RouteHandler, R as Route } from '../router-DaGtH1Sq.js';
|
|
2
|
+
export { c as RouteMatch, d as RouteQuery } from '../router-DaGtH1Sq.js';
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* Route definition and matching
|
|
6
|
+
* Supports dynamic route registration for micro frontends
|
|
7
|
+
*
|
|
8
|
+
* Optimization: Index by depth but maintain insertion order within each depth
|
|
9
|
+
*/
|
|
10
|
+
|
|
11
|
+
declare function route(): RouteSnapshot;
|
|
12
|
+
declare function route(path: string, handler?: RouteHandler, namespace?: string): void;
|
|
13
|
+
/**
|
|
14
|
+
* Get all registered routes
|
|
15
|
+
*/
|
|
16
|
+
declare function getRoutes(): Route[];
|
|
17
|
+
/**
|
|
18
|
+
* Clear all registered routes (mainly for testing)
|
|
19
|
+
*/
|
|
20
|
+
declare function clearRoutes(): void;
|
|
21
|
+
|
|
22
|
+
/**
|
|
23
|
+
* Client-side navigation with History API
|
|
24
|
+
*/
|
|
25
|
+
|
|
26
|
+
/**
|
|
27
|
+
* Navigate to a new path
|
|
28
|
+
* Updates URL, resolves route, and re-mounts app with new handler
|
|
29
|
+
*/
|
|
30
|
+
declare function navigate(path: string): void;
|
|
31
|
+
|
|
32
|
+
/**
|
|
33
|
+
* Link component for client-side navigation
|
|
34
|
+
*/
|
|
35
|
+
interface LinkProps {
|
|
36
|
+
href: string;
|
|
37
|
+
children?: unknown;
|
|
38
|
+
}
|
|
39
|
+
/**
|
|
40
|
+
* Link component that prevents default navigation and uses navigate()
|
|
41
|
+
* Provides declarative way to navigate between routes
|
|
42
|
+
*
|
|
43
|
+
* Respects:
|
|
44
|
+
* - Middle-click (opens in new tab)
|
|
45
|
+
* - Ctrl/Cmd+click (opens in new tab)
|
|
46
|
+
* - Shift+click (opens in new window)
|
|
47
|
+
* - Right-click context menu
|
|
48
|
+
*/
|
|
49
|
+
declare function Link({ href, children }: LinkProps): unknown;
|
|
50
|
+
|
|
51
|
+
/**
|
|
52
|
+
* Layout helper.
|
|
53
|
+
*
|
|
54
|
+
* A layout is just a normal component that wraps children.
|
|
55
|
+
* Persistence and reuse are handled by the runtime via component identity.
|
|
56
|
+
*
|
|
57
|
+
* This helper exists purely for readability and convention.
|
|
58
|
+
*/
|
|
59
|
+
type LayoutComponent<P = object> = (props: P & {
|
|
60
|
+
children?: unknown;
|
|
61
|
+
}) => unknown;
|
|
62
|
+
declare function layout<P = object>(Layout: LayoutComponent<P>): (children?: unknown, props?: P) => unknown;
|
|
63
|
+
|
|
64
|
+
export { Link, type LinkProps, Route, RouteHandler, RouteSnapshot, clearRoutes, getRoutes, layout, navigate, route };
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import {
|
|
2
|
+
navigate
|
|
3
|
+
} from "../chunk-VRAEBIJ3.js";
|
|
4
|
+
import {
|
|
5
|
+
clearRoutes,
|
|
6
|
+
getRoutes,
|
|
7
|
+
route
|
|
8
|
+
} from "../chunk-Z5ZSTLYF.js";
|
|
9
|
+
import "../chunk-XHKZGJE3.js";
|
|
10
|
+
import "../chunk-SALJX5PZ.js";
|
|
11
|
+
import "../chunk-FJUXFA72.js";
|
|
12
|
+
|
|
13
|
+
// src/components/Link.tsx
|
|
14
|
+
function Link({ href, children }) {
|
|
15
|
+
return {
|
|
16
|
+
type: "a",
|
|
17
|
+
props: {
|
|
18
|
+
href,
|
|
19
|
+
children,
|
|
20
|
+
onClick: (e) => {
|
|
21
|
+
const event = e;
|
|
22
|
+
const button = event.button ?? 0;
|
|
23
|
+
if (button !== 0 || // not left-click
|
|
24
|
+
event.ctrlKey || // Ctrl/Cmd+click
|
|
25
|
+
event.metaKey || // Cmd on Mac
|
|
26
|
+
event.shiftKey || // Shift+click
|
|
27
|
+
event.altKey) {
|
|
28
|
+
return;
|
|
29
|
+
}
|
|
30
|
+
event.preventDefault();
|
|
31
|
+
navigate(href);
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
};
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
// src/foundations/layout.tsx
|
|
38
|
+
function layout(Layout) {
|
|
39
|
+
return (children, props) => Layout({ ...props, children });
|
|
40
|
+
}
|
|
41
|
+
export {
|
|
42
|
+
Link,
|
|
43
|
+
clearRoutes,
|
|
44
|
+
getRoutes,
|
|
45
|
+
layout,
|
|
46
|
+
navigate,
|
|
47
|
+
route
|
|
48
|
+
};
|
|
49
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/components/Link.tsx","../../src/foundations/layout.tsx"],"sourcesContent":["/**\n * Link component for client-side navigation\n */\n\nimport { navigate } from '../router/navigate';\nexport interface LinkProps {\n href: string;\n children?: unknown;\n}\n\n/**\n * Link component that prevents default navigation and uses navigate()\n * Provides declarative way to navigate between routes\n *\n * Respects:\n * - Middle-click (opens in new tab)\n * - Ctrl/Cmd+click (opens in new tab)\n * - Shift+click (opens in new window)\n * - Right-click context menu\n */\nexport function Link({ href, children }: LinkProps): unknown {\n return {\n type: 'a',\n props: {\n href,\n children,\n onClick: (e: Event) => {\n const event = e as MouseEvent;\n\n // Only handle left-click without modifiers\n // Default button to 0 if undefined (for mock events in tests)\n const button = event.button ?? 0;\n if (\n button !== 0 || // not left-click\n event.ctrlKey || // Ctrl/Cmd+click\n event.metaKey || // Cmd on Mac\n event.shiftKey || // Shift+click\n event.altKey // Alt+click\n ) {\n return; // Let browser handle it (new tab, etc.)\n }\n\n event.preventDefault();\n navigate(href);\n },\n },\n };\n}\n","/**\n * Layout helper.\n *\n * A layout is just a normal component that wraps children.\n * Persistence and reuse are handled by the runtime via component identity.\n *\n * This helper exists purely for readability and convention.\n */\n\nexport type LayoutComponent<P = object> = (\n props: P & { children?: unknown }\n) => unknown;\n\nexport function layout<P = object>(Layout: LayoutComponent<P>) {\n return (children?: unknown, props?: P) =>\n Layout({ ...(props as P), children });\n}\n"],"mappings":";;;;;;;;;;;;;AAoBO,SAAS,KAAK,EAAE,MAAM,SAAS,GAAuB;AAC3D,SAAO;AAAA,IACL,MAAM;AAAA,IACN,OAAO;AAAA,MACL;AAAA,MACA;AAAA,MACA,SAAS,CAAC,MAAa;AACrB,cAAM,QAAQ;AAId,cAAM,SAAS,MAAM,UAAU;AAC/B,YACE,WAAW;AAAA,QACX,MAAM;AAAA,QACN,MAAM;AAAA,QACN,MAAM;AAAA,QACN,MAAM,QACN;AACA;AAAA,QACF;AAEA,cAAM,eAAe;AACrB,iBAAS,IAAI;AAAA,MACf;AAAA,IACF;AAAA,EACF;AACF;;;AClCO,SAAS,OAAmB,QAA4B;AAC7D,SAAO,CAAC,UAAoB,UAC1B,OAAO,EAAE,GAAI,OAAa,SAAS,CAAC;AACxC;","names":[]}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Common call contracts: Router types
|
|
3
|
+
*/
|
|
4
|
+
interface RouteHandler {
|
|
5
|
+
(params: Record<string, string>, context?: {
|
|
6
|
+
signal: AbortSignal;
|
|
7
|
+
}): unknown;
|
|
8
|
+
}
|
|
9
|
+
interface Route {
|
|
10
|
+
path: string;
|
|
11
|
+
handler: RouteHandler;
|
|
12
|
+
namespace?: string;
|
|
13
|
+
}
|
|
14
|
+
interface RouteMatch {
|
|
15
|
+
path: string;
|
|
16
|
+
params: Readonly<Record<string, string>>;
|
|
17
|
+
name?: string;
|
|
18
|
+
namespace?: string;
|
|
19
|
+
}
|
|
20
|
+
interface RouteQuery {
|
|
21
|
+
get(key: string): string | null;
|
|
22
|
+
getAll(key: string): string[];
|
|
23
|
+
has(key: string): boolean;
|
|
24
|
+
toJSON(): Record<string, string | string[]>;
|
|
25
|
+
}
|
|
26
|
+
interface RouteSnapshot {
|
|
27
|
+
path: string;
|
|
28
|
+
params: Readonly<Record<string, string>>;
|
|
29
|
+
query: Readonly<RouteQuery>;
|
|
30
|
+
hash: string | null;
|
|
31
|
+
name?: string;
|
|
32
|
+
namespace?: string;
|
|
33
|
+
matches: readonly RouteMatch[];
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
export type { Route as R, RouteSnapshot as a, RouteHandler as b, RouteMatch as c, RouteQuery as d };
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Common call contracts: Router types
|
|
3
|
+
*/
|
|
4
|
+
interface RouteHandler {
|
|
5
|
+
(params: Record<string, string>, context?: {
|
|
6
|
+
signal: AbortSignal;
|
|
7
|
+
}): unknown;
|
|
8
|
+
}
|
|
9
|
+
interface Route {
|
|
10
|
+
path: string;
|
|
11
|
+
handler: RouteHandler;
|
|
12
|
+
namespace?: string;
|
|
13
|
+
}
|
|
14
|
+
interface RouteMatch {
|
|
15
|
+
path: string;
|
|
16
|
+
params: Readonly<Record<string, string>>;
|
|
17
|
+
name?: string;
|
|
18
|
+
namespace?: string;
|
|
19
|
+
}
|
|
20
|
+
interface RouteQuery {
|
|
21
|
+
get(key: string): string | null;
|
|
22
|
+
getAll(key: string): string[];
|
|
23
|
+
has(key: string): boolean;
|
|
24
|
+
toJSON(): Record<string, string | string[]>;
|
|
25
|
+
}
|
|
26
|
+
interface RouteSnapshot {
|
|
27
|
+
path: string;
|
|
28
|
+
params: Readonly<Record<string, string>>;
|
|
29
|
+
query: Readonly<RouteQuery>;
|
|
30
|
+
hash: string | null;
|
|
31
|
+
name?: string;
|
|
32
|
+
namespace?: string;
|
|
33
|
+
matches: readonly RouteMatch[];
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
export type { Route as R, RouteSnapshot as a, RouteHandler as b, RouteMatch as c, RouteQuery as d };
|