@cajoa/core 0.18.0 → 0.20.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/dist/index.cjs +4 -0
- package/dist/index.d.cts +24 -12
- package/dist/index.d.ts +24 -12
- package/dist/index.js +4 -0
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -930,6 +930,10 @@ function For(props) {
|
|
|
930
930
|
if (!next.has(k)) entry.dispose();
|
|
931
931
|
});
|
|
932
932
|
cache = next;
|
|
933
|
+
if (nodes2.length === 0 && props.fallback !== void 0) {
|
|
934
|
+
const fallback = props.fallback;
|
|
935
|
+
return untrack(() => typeof fallback === "function" ? fallback() : fallback);
|
|
936
|
+
}
|
|
933
937
|
return nodes2;
|
|
934
938
|
};
|
|
935
939
|
}
|
package/dist/index.d.cts
CHANGED
|
@@ -76,7 +76,9 @@ declare function For<T>(props: {
|
|
|
76
76
|
each: T[] | (() => T[]);
|
|
77
77
|
children: (item: T, index: number) => HostNode;
|
|
78
78
|
key?: (item: T, index: number) => unknown;
|
|
79
|
-
|
|
79
|
+
/** Shown when the list is empty. */
|
|
80
|
+
fallback?: Child | (() => Child);
|
|
81
|
+
}): () => Child;
|
|
80
82
|
|
|
81
83
|
type Lazy$3<T> = T | (() => T);
|
|
82
84
|
declare function ErrorBoundary(props: {
|
|
@@ -126,15 +128,6 @@ declare function lazy<P = Record<string, unknown>>(loader: () => Promise<{
|
|
|
126
128
|
declare function jsx(type: any, props: Record<string, any> | null): any;
|
|
127
129
|
declare const jsxs: typeof jsx;
|
|
128
130
|
declare const jsxDEV: typeof jsx;
|
|
129
|
-
declare namespace JSX {
|
|
130
|
-
type Element = any;
|
|
131
|
-
interface IntrinsicElements {
|
|
132
|
-
[tag: string]: any;
|
|
133
|
-
}
|
|
134
|
-
interface ElementChildrenAttribute {
|
|
135
|
-
children: {};
|
|
136
|
-
}
|
|
137
|
-
}
|
|
138
131
|
declare function Fragment(props: {
|
|
139
132
|
children?: Child;
|
|
140
133
|
}): any;
|
|
@@ -144,12 +137,31 @@ declare function getRenderer(): Renderer;
|
|
|
144
137
|
declare function currentRenderer(): Renderer | null;
|
|
145
138
|
declare function isServer(): boolean;
|
|
146
139
|
|
|
140
|
+
interface HeadMeta {
|
|
141
|
+
name?: string;
|
|
142
|
+
property?: string;
|
|
143
|
+
content: string;
|
|
144
|
+
}
|
|
145
|
+
/** The page title and meta tags that <Title> and <Meta> collect while rendering on the server. */
|
|
146
|
+
interface HeadData {
|
|
147
|
+
title?: string;
|
|
148
|
+
meta?: HeadMeta[];
|
|
149
|
+
}
|
|
150
|
+
/** What components can learn about the request that is being rendered on the server. */
|
|
147
151
|
interface ServerRequest {
|
|
152
|
+
/** The URL of the request (path and query), for example "/users/42?tab=posts". */
|
|
148
153
|
url: string;
|
|
154
|
+
/** Filled by <Title> and <Meta> while rendering. */
|
|
155
|
+
head: HeadData;
|
|
156
|
+
/** <Navigate> asks the server to redirect. */
|
|
149
157
|
redirect(to: string, status: number): void;
|
|
158
|
+
/**
|
|
159
|
+
* Tell renderToStringAsync that there is async work (for example a resource) to wait for.
|
|
160
|
+
* Returns the function to call when the work is done.
|
|
161
|
+
*/
|
|
150
162
|
track(): () => void;
|
|
151
163
|
}
|
|
152
164
|
declare const ServerContext: Context<ServerRequest | null>;
|
|
153
165
|
|
|
154
|
-
export { Dynamic, ErrorBoundary, For, Fragment,
|
|
155
|
-
export type { Child, Context, HostNode, MatchDef, Renderer, Resource, ResourceActions, ServerRequest, SetStoreFunction };
|
|
166
|
+
export { Dynamic, ErrorBoundary, For, Fragment, Match, Portal, ServerContext, Show, Suspense, Switch, batch, catchError, createContext, createEffect, createMemo, createResource, createRoot, createSelector, createSignal, createStore, currentRenderer, getRenderer, h, isServer, jsx, jsxDEV, jsxs, lazy, onCleanup, onMount, provide, render, setRenderer, untrack, unwrap, useContext };
|
|
167
|
+
export type { Child, Context, HeadData, HeadMeta, HostNode, MatchDef, Renderer, Resource, ResourceActions, ServerRequest, SetStoreFunction };
|
package/dist/index.d.ts
CHANGED
|
@@ -76,7 +76,9 @@ declare function For<T>(props: {
|
|
|
76
76
|
each: T[] | (() => T[]);
|
|
77
77
|
children: (item: T, index: number) => HostNode;
|
|
78
78
|
key?: (item: T, index: number) => unknown;
|
|
79
|
-
|
|
79
|
+
/** Shown when the list is empty. */
|
|
80
|
+
fallback?: Child | (() => Child);
|
|
81
|
+
}): () => Child;
|
|
80
82
|
|
|
81
83
|
type Lazy$3<T> = T | (() => T);
|
|
82
84
|
declare function ErrorBoundary(props: {
|
|
@@ -126,15 +128,6 @@ declare function lazy<P = Record<string, unknown>>(loader: () => Promise<{
|
|
|
126
128
|
declare function jsx(type: any, props: Record<string, any> | null): any;
|
|
127
129
|
declare const jsxs: typeof jsx;
|
|
128
130
|
declare const jsxDEV: typeof jsx;
|
|
129
|
-
declare namespace JSX {
|
|
130
|
-
type Element = any;
|
|
131
|
-
interface IntrinsicElements {
|
|
132
|
-
[tag: string]: any;
|
|
133
|
-
}
|
|
134
|
-
interface ElementChildrenAttribute {
|
|
135
|
-
children: {};
|
|
136
|
-
}
|
|
137
|
-
}
|
|
138
131
|
declare function Fragment(props: {
|
|
139
132
|
children?: Child;
|
|
140
133
|
}): any;
|
|
@@ -144,12 +137,31 @@ declare function getRenderer(): Renderer;
|
|
|
144
137
|
declare function currentRenderer(): Renderer | null;
|
|
145
138
|
declare function isServer(): boolean;
|
|
146
139
|
|
|
140
|
+
interface HeadMeta {
|
|
141
|
+
name?: string;
|
|
142
|
+
property?: string;
|
|
143
|
+
content: string;
|
|
144
|
+
}
|
|
145
|
+
/** The page title and meta tags that <Title> and <Meta> collect while rendering on the server. */
|
|
146
|
+
interface HeadData {
|
|
147
|
+
title?: string;
|
|
148
|
+
meta?: HeadMeta[];
|
|
149
|
+
}
|
|
150
|
+
/** What components can learn about the request that is being rendered on the server. */
|
|
147
151
|
interface ServerRequest {
|
|
152
|
+
/** The URL of the request (path and query), for example "/users/42?tab=posts". */
|
|
148
153
|
url: string;
|
|
154
|
+
/** Filled by <Title> and <Meta> while rendering. */
|
|
155
|
+
head: HeadData;
|
|
156
|
+
/** <Navigate> asks the server to redirect. */
|
|
149
157
|
redirect(to: string, status: number): void;
|
|
158
|
+
/**
|
|
159
|
+
* Tell renderToStringAsync that there is async work (for example a resource) to wait for.
|
|
160
|
+
* Returns the function to call when the work is done.
|
|
161
|
+
*/
|
|
150
162
|
track(): () => void;
|
|
151
163
|
}
|
|
152
164
|
declare const ServerContext: Context<ServerRequest | null>;
|
|
153
165
|
|
|
154
|
-
export { Dynamic, ErrorBoundary, For, Fragment,
|
|
155
|
-
export type { Child, Context, HostNode, MatchDef, Renderer, Resource, ResourceActions, ServerRequest, SetStoreFunction };
|
|
166
|
+
export { Dynamic, ErrorBoundary, For, Fragment, Match, Portal, ServerContext, Show, Suspense, Switch, batch, catchError, createContext, createEffect, createMemo, createResource, createRoot, createSelector, createSignal, createStore, currentRenderer, getRenderer, h, isServer, jsx, jsxDEV, jsxs, lazy, onCleanup, onMount, provide, render, setRenderer, untrack, unwrap, useContext };
|
|
167
|
+
export type { Child, Context, HeadData, HeadMeta, HostNode, MatchDef, Renderer, Resource, ResourceActions, ServerRequest, SetStoreFunction };
|
package/dist/index.js
CHANGED
|
@@ -869,6 +869,10 @@ function For(props) {
|
|
|
869
869
|
if (!next.has(k)) entry.dispose();
|
|
870
870
|
});
|
|
871
871
|
cache = next;
|
|
872
|
+
if (nodes2.length === 0 && props.fallback !== void 0) {
|
|
873
|
+
const fallback = props.fallback;
|
|
874
|
+
return untrack(() => typeof fallback === "function" ? fallback() : fallback);
|
|
875
|
+
}
|
|
872
876
|
return nodes2;
|
|
873
877
|
};
|
|
874
878
|
}
|