@granularjs/core 1.0.0
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 +576 -0
- package/dist/granular.min.js +2 -0
- package/dist/granular.min.js.map +7 -0
- package/package.json +54 -0
- package/src/core/bootstrap.js +63 -0
- package/src/core/collections/observable-array.js +204 -0
- package/src/core/component/function-component.js +82 -0
- package/src/core/context.js +172 -0
- package/src/core/dom/dom.js +25 -0
- package/src/core/dom/element.js +725 -0
- package/src/core/dom/error-boundary.js +111 -0
- package/src/core/dom/input-format.js +82 -0
- package/src/core/dom/list.js +185 -0
- package/src/core/dom/portal.js +57 -0
- package/src/core/dom/tags.js +182 -0
- package/src/core/dom/virtual-list.js +242 -0
- package/src/core/dom/when.js +138 -0
- package/src/core/events/event-hub.js +97 -0
- package/src/core/forms/form.js +127 -0
- package/src/core/internal/symbols.js +5 -0
- package/src/core/network/websocket.js +165 -0
- package/src/core/query/query-client.js +529 -0
- package/src/core/reactivity/after-flush.js +20 -0
- package/src/core/reactivity/computed.js +51 -0
- package/src/core/reactivity/concat.js +89 -0
- package/src/core/reactivity/dirty-host.js +162 -0
- package/src/core/reactivity/observe.js +421 -0
- package/src/core/reactivity/persist.js +180 -0
- package/src/core/reactivity/resolve.js +8 -0
- package/src/core/reactivity/signal.js +97 -0
- package/src/core/reactivity/state.js +294 -0
- package/src/core/renderable/render-string.js +51 -0
- package/src/core/renderable/renderable.js +21 -0
- package/src/core/renderable/renderer.js +66 -0
- package/src/core/router/router.js +865 -0
- package/src/core/runtime.js +28 -0
- package/src/index.js +42 -0
- package/types/core/bootstrap.d.ts +11 -0
- package/types/core/collections/observable-array.d.ts +25 -0
- package/types/core/component/function-component.d.ts +14 -0
- package/types/core/context.d.ts +29 -0
- package/types/core/dom/dom.d.ts +13 -0
- package/types/core/dom/element.d.ts +10 -0
- package/types/core/dom/error-boundary.d.ts +8 -0
- package/types/core/dom/input-format.d.ts +6 -0
- package/types/core/dom/list.d.ts +8 -0
- package/types/core/dom/portal.d.ts +8 -0
- package/types/core/dom/tags.d.ts +114 -0
- package/types/core/dom/virtual-list.d.ts +8 -0
- package/types/core/dom/when.d.ts +13 -0
- package/types/core/events/event-hub.d.ts +48 -0
- package/types/core/forms/form.d.ts +9 -0
- package/types/core/internal/symbols.d.ts +4 -0
- package/types/core/network/websocket.d.ts +18 -0
- package/types/core/query/query-client.d.ts +73 -0
- package/types/core/reactivity/after-flush.d.ts +4 -0
- package/types/core/reactivity/computed.d.ts +1 -0
- package/types/core/reactivity/concat.d.ts +1 -0
- package/types/core/reactivity/dirty-host.d.ts +42 -0
- package/types/core/reactivity/observe.d.ts +10 -0
- package/types/core/reactivity/persist.d.ts +1 -0
- package/types/core/reactivity/resolve.d.ts +1 -0
- package/types/core/reactivity/signal.d.ts +11 -0
- package/types/core/reactivity/state.d.ts +14 -0
- package/types/core/renderable/render-string.d.ts +2 -0
- package/types/core/renderable/renderable.d.ts +15 -0
- package/types/core/renderable/renderer.d.ts +38 -0
- package/types/core/router/router.d.ts +57 -0
- package/types/core/runtime.d.ts +26 -0
- package/types/index.d.ts +2 -0
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Core rendering rules for "values".
|
|
3
|
+
* This is intentionally separate from the Renderable contract.
|
|
4
|
+
*/
|
|
5
|
+
export class Renderer {
|
|
6
|
+
/**
|
|
7
|
+
* @param {unknown} value
|
|
8
|
+
* @returns {value is Node}
|
|
9
|
+
*/
|
|
10
|
+
static isDomNode(value: unknown): value is Node;
|
|
11
|
+
/**
|
|
12
|
+
* @param {unknown} value
|
|
13
|
+
* @returns {value is Renderable}
|
|
14
|
+
*/
|
|
15
|
+
static isRenderable(value: unknown): value is Renderable;
|
|
16
|
+
/**
|
|
17
|
+
* Converts a non-renderable value into string for text rendering.
|
|
18
|
+
* @param {unknown} value
|
|
19
|
+
* @returns {string}
|
|
20
|
+
*/
|
|
21
|
+
static toText(value: unknown): string;
|
|
22
|
+
/**
|
|
23
|
+
* Normalizes a value into a flat list of renderables:
|
|
24
|
+
* - Renderable instances
|
|
25
|
+
* - DOM Nodes
|
|
26
|
+
* - TextNodes created from primitives/objects
|
|
27
|
+
*
|
|
28
|
+
* @param {unknown} value
|
|
29
|
+
* @returns {(Renderable|Node)[]}
|
|
30
|
+
*/
|
|
31
|
+
static normalize(value: unknown): (Renderable | Node)[];
|
|
32
|
+
/**
|
|
33
|
+
* Unmounts a renderable value if applicable.
|
|
34
|
+
* @param {unknown} value
|
|
35
|
+
*/
|
|
36
|
+
static unmount(value: unknown): void;
|
|
37
|
+
}
|
|
38
|
+
import { Renderable } from './renderable.js';
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
export function createRouter(options: any): Router;
|
|
2
|
+
export class Router {
|
|
3
|
+
constructor(options?: {});
|
|
4
|
+
add(pathOrConfig: any, PageClass: any, options?: {}): {
|
|
5
|
+
id: string;
|
|
6
|
+
name: any;
|
|
7
|
+
path: any;
|
|
8
|
+
rawPath: any;
|
|
9
|
+
parent: any;
|
|
10
|
+
meta: any;
|
|
11
|
+
redirect: any;
|
|
12
|
+
loader: any;
|
|
13
|
+
guards: any;
|
|
14
|
+
beforeEnter: any;
|
|
15
|
+
beforeLeave: any;
|
|
16
|
+
props: any;
|
|
17
|
+
reuse: any;
|
|
18
|
+
transition: any;
|
|
19
|
+
errorPage: any;
|
|
20
|
+
load: any;
|
|
21
|
+
page: any;
|
|
22
|
+
layout: any;
|
|
23
|
+
children: any[];
|
|
24
|
+
};
|
|
25
|
+
beforeEach(fn: any): () => boolean;
|
|
26
|
+
afterEach(fn: any): () => boolean;
|
|
27
|
+
mount(target: any): void;
|
|
28
|
+
unmount(): void;
|
|
29
|
+
start(): void;
|
|
30
|
+
stop(): void;
|
|
31
|
+
navigate(to: any, options?: {}): Promise<void>;
|
|
32
|
+
replace(to: any, options?: {}): Promise<void>;
|
|
33
|
+
back(): void;
|
|
34
|
+
forward(): void;
|
|
35
|
+
go(delta: any): void;
|
|
36
|
+
resolve(path: any): string;
|
|
37
|
+
parse(url: any): {
|
|
38
|
+
location: {
|
|
39
|
+
pathname: any;
|
|
40
|
+
search: string;
|
|
41
|
+
hash: string;
|
|
42
|
+
query: {};
|
|
43
|
+
state: any;
|
|
44
|
+
url: string;
|
|
45
|
+
};
|
|
46
|
+
match: {
|
|
47
|
+
route: any;
|
|
48
|
+
params: {};
|
|
49
|
+
chain: any[];
|
|
50
|
+
};
|
|
51
|
+
};
|
|
52
|
+
get current(): any;
|
|
53
|
+
checkGuards(): Promise<boolean>;
|
|
54
|
+
queryParameters(options?: {}): {};
|
|
55
|
+
#private;
|
|
56
|
+
}
|
|
57
|
+
export const router: Router;
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
export { bootstrap } from "./bootstrap.js";
|
|
2
|
+
export { component } from "./component/function-component.js";
|
|
3
|
+
export { resolve } from "./reactivity/resolve.js";
|
|
4
|
+
export { computed } from "./reactivity/computed.js";
|
|
5
|
+
export { concat } from "./reactivity/concat.js";
|
|
6
|
+
export { persist } from "./reactivity/persist.js";
|
|
7
|
+
export { form } from "./forms/form.js";
|
|
8
|
+
export { list } from "./dom/list.js";
|
|
9
|
+
export { when } from "./dom/when.js";
|
|
10
|
+
export { ErrorBoundary } from "./dom/error-boundary.js";
|
|
11
|
+
export { virtualList } from "./dom/virtual-list.js";
|
|
12
|
+
export { portal } from "./dom/portal.js";
|
|
13
|
+
export { observableArray } from "./collections/observable-array.js";
|
|
14
|
+
export { Renderable } from "./renderable/renderable.js";
|
|
15
|
+
export { Renderer } from "./renderable/renderer.js";
|
|
16
|
+
export { QueryClient } from "./query/query-client.js";
|
|
17
|
+
export { EventHub } from "./events/event-hub.js";
|
|
18
|
+
export { context } from "./context.js";
|
|
19
|
+
export { Elements } from "./dom/tags.js";
|
|
20
|
+
export * from "./dom/tags.js";
|
|
21
|
+
export { signal, isSignal, setSignal, readSignal } from "./reactivity/signal.js";
|
|
22
|
+
export { state, isState, isStatePath, isComputed } from "./reactivity/state.js";
|
|
23
|
+
export { after, before, set, subscribe } from "./reactivity/observe.js";
|
|
24
|
+
export { WebSocketClient, createWebSocket } from "./network/websocket.js";
|
|
25
|
+
export { renderToString, hydrate } from "./renderable/render-string.js";
|
|
26
|
+
export { Router, createRouter, router } from "./router/router.js";
|
package/types/index.d.ts
ADDED
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
export * from "./core/dom/tags.js";
|
|
2
|
+
export { bootstrap, component, signal, isSignal, setSignal, readSignal, state, isState, isStatePath, isComputed, after, before, set, resolve, computed, concat, subscribe, persist, form, list, when, ErrorBoundary, virtualList, portal, WebSocketClient, createWebSocket, observableArray, Renderable, Renderer, renderToString, hydrate, QueryClient, EventHub, Router, createRouter, router, Elements, context } from "./core/runtime.js";
|