@alepha/react 0.13.4 → 0.13.5
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/auth/index.browser.js +3 -3
- package/dist/auth/index.d.ts +117 -117
- package/dist/auth/index.js +4 -4
- package/dist/core/index.browser.js +28 -28
- package/dist/core/index.d.ts +66 -66
- package/dist/core/index.js +29 -29
- package/dist/core/index.native.js +9 -9
- package/dist/form/index.d.ts +12 -12
- package/dist/form/index.js +6 -6
- package/dist/head/index.browser.js +5 -5
- package/dist/head/index.d.ts +30 -30
- package/dist/head/index.js +6 -6
- package/dist/i18n/index.d.ts +33 -33
- package/dist/i18n/index.js +5 -5
- package/dist/websocket/index.d.ts +7 -7
- package/dist/websocket/index.js +1 -1
- package/package.json +3 -3
package/dist/core/index.js
CHANGED
|
@@ -12,7 +12,7 @@ import { ServerStaticProvider } from "alepha/server/static";
|
|
|
12
12
|
import { renderToString } from "react-dom/server";
|
|
13
13
|
import { RouterProvider } from "alepha/router";
|
|
14
14
|
|
|
15
|
-
//#region src/core/services/ReactPageService.ts
|
|
15
|
+
//#region ../../src/core/services/ReactPageService.ts
|
|
16
16
|
var ReactPageService = class {
|
|
17
17
|
fetch(pathname, options = {}) {
|
|
18
18
|
throw new AlephaError("Fetch is not available for this environment.");
|
|
@@ -23,7 +23,7 @@ var ReactPageService = class {
|
|
|
23
23
|
};
|
|
24
24
|
|
|
25
25
|
//#endregion
|
|
26
|
-
//#region src/core/primitives/$page.ts
|
|
26
|
+
//#region ../../src/core/primitives/$page.ts
|
|
27
27
|
/**
|
|
28
28
|
* Main primitive for defining a React route in the application.
|
|
29
29
|
*
|
|
@@ -148,7 +148,7 @@ var PagePrimitive = class extends Primitive {
|
|
|
148
148
|
$page[KIND] = PagePrimitive;
|
|
149
149
|
|
|
150
150
|
//#endregion
|
|
151
|
-
//#region src/core/components/ClientOnly.tsx
|
|
151
|
+
//#region ../../src/core/components/ClientOnly.tsx
|
|
152
152
|
/**
|
|
153
153
|
* A small utility component that renders its children only on the client side.
|
|
154
154
|
*
|
|
@@ -168,7 +168,7 @@ const ClientOnly = (props) => {
|
|
|
168
168
|
var ClientOnly_default = ClientOnly;
|
|
169
169
|
|
|
170
170
|
//#endregion
|
|
171
|
-
//#region src/core/components/ErrorViewer.tsx
|
|
171
|
+
//#region ../../src/core/components/ErrorViewer.tsx
|
|
172
172
|
const ErrorViewer = ({ error, alepha }) => {
|
|
173
173
|
const [expanded, setExpanded] = useState(false);
|
|
174
174
|
if (alepha.isProduction()) return /* @__PURE__ */ jsx(ErrorViewerProduction, {});
|
|
@@ -316,11 +316,11 @@ const ErrorViewerProduction = () => {
|
|
|
316
316
|
};
|
|
317
317
|
|
|
318
318
|
//#endregion
|
|
319
|
-
//#region src/core/contexts/RouterLayerContext.ts
|
|
319
|
+
//#region ../../src/core/contexts/RouterLayerContext.ts
|
|
320
320
|
const RouterLayerContext = createContext(void 0);
|
|
321
321
|
|
|
322
322
|
//#endregion
|
|
323
|
-
//#region src/core/errors/Redirection.ts
|
|
323
|
+
//#region ../../src/core/errors/Redirection.ts
|
|
324
324
|
/**
|
|
325
325
|
* Used for Redirection during the page loading.
|
|
326
326
|
*
|
|
@@ -335,11 +335,11 @@ var Redirection = class extends Error {
|
|
|
335
335
|
};
|
|
336
336
|
|
|
337
337
|
//#endregion
|
|
338
|
-
//#region src/core/contexts/AlephaContext.ts
|
|
338
|
+
//#region ../../src/core/contexts/AlephaContext.ts
|
|
339
339
|
const AlephaContext = createContext(void 0);
|
|
340
340
|
|
|
341
341
|
//#endregion
|
|
342
|
-
//#region src/core/hooks/useAlepha.ts
|
|
342
|
+
//#region ../../src/core/hooks/useAlepha.ts
|
|
343
343
|
/**
|
|
344
344
|
* Main Alepha hook.
|
|
345
345
|
*
|
|
@@ -359,7 +359,7 @@ const useAlepha = () => {
|
|
|
359
359
|
};
|
|
360
360
|
|
|
361
361
|
//#endregion
|
|
362
|
-
//#region src/core/hooks/useEvents.ts
|
|
362
|
+
//#region ../../src/core/hooks/useEvents.ts
|
|
363
363
|
/**
|
|
364
364
|
* Allow subscribing to multiple Alepha events. See {@link Hooks} for available events.
|
|
365
365
|
*
|
|
@@ -396,7 +396,7 @@ const useEvents = (opts, deps) => {
|
|
|
396
396
|
};
|
|
397
397
|
|
|
398
398
|
//#endregion
|
|
399
|
-
//#region src/core/hooks/useStore.ts
|
|
399
|
+
//#region ../../src/core/hooks/useStore.ts
|
|
400
400
|
function useStore(target, defaultValue) {
|
|
401
401
|
const alepha = useAlepha();
|
|
402
402
|
useMemo(() => {
|
|
@@ -416,7 +416,7 @@ function useStore(target, defaultValue) {
|
|
|
416
416
|
}
|
|
417
417
|
|
|
418
418
|
//#endregion
|
|
419
|
-
//#region src/core/hooks/useRouterState.ts
|
|
419
|
+
//#region ../../src/core/hooks/useRouterState.ts
|
|
420
420
|
const useRouterState = () => {
|
|
421
421
|
const [state] = useStore("alepha.react.router.state");
|
|
422
422
|
if (!state) throw new AlephaError("Missing react router state");
|
|
@@ -424,7 +424,7 @@ const useRouterState = () => {
|
|
|
424
424
|
};
|
|
425
425
|
|
|
426
426
|
//#endregion
|
|
427
|
-
//#region src/core/components/ErrorBoundary.tsx
|
|
427
|
+
//#region ../../src/core/components/ErrorBoundary.tsx
|
|
428
428
|
/**
|
|
429
429
|
* A reusable error boundary for catching rendering errors
|
|
430
430
|
* in any part of the React component tree.
|
|
@@ -455,7 +455,7 @@ var ErrorBoundary = class extends React.Component {
|
|
|
455
455
|
var ErrorBoundary_default = ErrorBoundary;
|
|
456
456
|
|
|
457
457
|
//#endregion
|
|
458
|
-
//#region src/core/components/NestedView.tsx
|
|
458
|
+
//#region ../../src/core/components/NestedView.tsx
|
|
459
459
|
/**
|
|
460
460
|
* A component that renders the current view of the nested router layer.
|
|
461
461
|
*
|
|
@@ -578,7 +578,7 @@ function parseAnimation(animationLike, state, type = "enter") {
|
|
|
578
578
|
}
|
|
579
579
|
|
|
580
580
|
//#endregion
|
|
581
|
-
//#region src/core/components/NotFound.tsx
|
|
581
|
+
//#region ../../src/core/components/NotFound.tsx
|
|
582
582
|
function NotFoundPage(props) {
|
|
583
583
|
return /* @__PURE__ */ jsxs("div", {
|
|
584
584
|
style: {
|
|
@@ -613,7 +613,7 @@ function NotFoundPage(props) {
|
|
|
613
613
|
}
|
|
614
614
|
|
|
615
615
|
//#endregion
|
|
616
|
-
//#region src/core/providers/ReactPageProvider.ts
|
|
616
|
+
//#region ../../src/core/providers/ReactPageProvider.ts
|
|
617
617
|
const envSchema$2 = t.object({ REACT_STRICT_MODE: t.boolean({ default: true }) });
|
|
618
618
|
var ReactPageProvider = class {
|
|
619
619
|
log = $logger();
|
|
@@ -937,7 +937,7 @@ const isPageRoute = (it) => {
|
|
|
937
937
|
};
|
|
938
938
|
|
|
939
939
|
//#endregion
|
|
940
|
-
//#region src/core/providers/ReactServerProvider.ts
|
|
940
|
+
//#region ../../src/core/providers/ReactServerProvider.ts
|
|
941
941
|
const envSchema$1 = t.object({
|
|
942
942
|
REACT_SSR_ENABLED: t.optional(t.boolean()),
|
|
943
943
|
REACT_ROOT_ID: t.text({ default: "root" }),
|
|
@@ -1249,7 +1249,7 @@ var ReactServerProvider = class {
|
|
|
1249
1249
|
};
|
|
1250
1250
|
|
|
1251
1251
|
//#endregion
|
|
1252
|
-
//#region src/core/services/ReactPageServerService.ts
|
|
1252
|
+
//#region ../../src/core/services/ReactPageServerService.ts
|
|
1253
1253
|
var ReactPageServerService = class extends ReactPageService {
|
|
1254
1254
|
reactServerProvider = $inject(ReactServerProvider);
|
|
1255
1255
|
serverProvider = $inject(ServerProvider);
|
|
@@ -1273,7 +1273,7 @@ var ReactPageServerService = class extends ReactPageService {
|
|
|
1273
1273
|
};
|
|
1274
1274
|
|
|
1275
1275
|
//#endregion
|
|
1276
|
-
//#region src/core/providers/ReactBrowserRouterProvider.ts
|
|
1276
|
+
//#region ../../src/core/providers/ReactBrowserRouterProvider.ts
|
|
1277
1277
|
var ReactBrowserRouterProvider = class extends RouterProvider {
|
|
1278
1278
|
log = $logger();
|
|
1279
1279
|
alepha = $inject(Alepha);
|
|
@@ -1355,7 +1355,7 @@ var ReactBrowserRouterProvider = class extends RouterProvider {
|
|
|
1355
1355
|
};
|
|
1356
1356
|
|
|
1357
1357
|
//#endregion
|
|
1358
|
-
//#region src/core/providers/ReactBrowserProvider.ts
|
|
1358
|
+
//#region ../../src/core/providers/ReactBrowserProvider.ts
|
|
1359
1359
|
const envSchema = t.object({ REACT_ROOT_ID: t.text({ default: "root" }) });
|
|
1360
1360
|
/**
|
|
1361
1361
|
* React browser renderer configuration atom
|
|
@@ -1520,7 +1520,7 @@ var ReactBrowserProvider = class {
|
|
|
1520
1520
|
};
|
|
1521
1521
|
|
|
1522
1522
|
//#endregion
|
|
1523
|
-
//#region src/core/services/ReactRouter.ts
|
|
1523
|
+
//#region ../../src/core/services/ReactRouter.ts
|
|
1524
1524
|
var ReactRouter = class {
|
|
1525
1525
|
alepha = $inject(Alepha);
|
|
1526
1526
|
pageApi = $inject(ReactPageProvider);
|
|
@@ -1642,7 +1642,7 @@ var ReactRouter = class {
|
|
|
1642
1642
|
};
|
|
1643
1643
|
|
|
1644
1644
|
//#endregion
|
|
1645
|
-
//#region src/core/hooks/useInject.ts
|
|
1645
|
+
//#region ../../src/core/hooks/useInject.ts
|
|
1646
1646
|
/**
|
|
1647
1647
|
* Hook to inject a service instance.
|
|
1648
1648
|
* It's a wrapper of `useAlepha().inject(service)` with a memoization.
|
|
@@ -1653,7 +1653,7 @@ const useInject = (service) => {
|
|
|
1653
1653
|
};
|
|
1654
1654
|
|
|
1655
1655
|
//#endregion
|
|
1656
|
-
//#region src/core/hooks/useAction.ts
|
|
1656
|
+
//#region ../../src/core/hooks/useAction.ts
|
|
1657
1657
|
/**
|
|
1658
1658
|
* Hook for handling async actions with automatic error handling and event emission.
|
|
1659
1659
|
*
|
|
@@ -1880,7 +1880,7 @@ function useAction(options, deps) {
|
|
|
1880
1880
|
}
|
|
1881
1881
|
|
|
1882
1882
|
//#endregion
|
|
1883
|
-
//#region src/core/hooks/useClient.ts
|
|
1883
|
+
//#region ../../src/core/hooks/useClient.ts
|
|
1884
1884
|
/**
|
|
1885
1885
|
* Hook to get a virtual client for the specified scope.
|
|
1886
1886
|
*
|
|
@@ -1891,7 +1891,7 @@ const useClient = (scope) => {
|
|
|
1891
1891
|
};
|
|
1892
1892
|
|
|
1893
1893
|
//#endregion
|
|
1894
|
-
//#region src/core/hooks/useSchema.ts
|
|
1894
|
+
//#region ../../src/core/hooks/useSchema.ts
|
|
1895
1895
|
const useSchema = (action) => {
|
|
1896
1896
|
const name = action.name;
|
|
1897
1897
|
const alepha = useAlepha();
|
|
@@ -1925,7 +1925,7 @@ const ssrSchemaLoading = (alepha, name) => {
|
|
|
1925
1925
|
};
|
|
1926
1926
|
|
|
1927
1927
|
//#endregion
|
|
1928
|
-
//#region src/core/hooks/useRouter.ts
|
|
1928
|
+
//#region ../../src/core/hooks/useRouter.ts
|
|
1929
1929
|
/**
|
|
1930
1930
|
* Use this hook to access the React Router instance.
|
|
1931
1931
|
*
|
|
@@ -1945,7 +1945,7 @@ const useRouter = () => {
|
|
|
1945
1945
|
};
|
|
1946
1946
|
|
|
1947
1947
|
//#endregion
|
|
1948
|
-
//#region src/core/components/Link.tsx
|
|
1948
|
+
//#region ../../src/core/components/Link.tsx
|
|
1949
1949
|
const Link = (props) => {
|
|
1950
1950
|
const router = useRouter();
|
|
1951
1951
|
return /* @__PURE__ */ jsx("a", {
|
|
@@ -1957,7 +1957,7 @@ const Link = (props) => {
|
|
|
1957
1957
|
var Link_default = Link;
|
|
1958
1958
|
|
|
1959
1959
|
//#endregion
|
|
1960
|
-
//#region src/core/hooks/useActive.ts
|
|
1960
|
+
//#region ../../src/core/hooks/useActive.ts
|
|
1961
1961
|
const useActive = (args) => {
|
|
1962
1962
|
const router = useRouter();
|
|
1963
1963
|
const [isPending, setPending] = useState(false);
|
|
@@ -1990,7 +1990,7 @@ const useActive = (args) => {
|
|
|
1990
1990
|
};
|
|
1991
1991
|
|
|
1992
1992
|
//#endregion
|
|
1993
|
-
//#region src/core/hooks/useQueryParams.ts
|
|
1993
|
+
//#region ../../src/core/hooks/useQueryParams.ts
|
|
1994
1994
|
/**
|
|
1995
1995
|
* Not well tested. Use with caution.
|
|
1996
1996
|
*/
|
|
@@ -2025,7 +2025,7 @@ const decode = (alepha, schema, data) => {
|
|
|
2025
2025
|
};
|
|
2026
2026
|
|
|
2027
2027
|
//#endregion
|
|
2028
|
-
//#region src/core/index.ts
|
|
2028
|
+
//#region ../../src/core/index.ts
|
|
2029
2029
|
/**
|
|
2030
2030
|
* Provides full-stack React development with declarative routing, server-side rendering, and client-side hydration.
|
|
2031
2031
|
*
|
|
@@ -4,11 +4,11 @@ import { AlephaServerLinks, LinkProvider } from "alepha/server/links";
|
|
|
4
4
|
import { createContext, useCallback, useContext, useEffect, useMemo, useRef, useState } from "react";
|
|
5
5
|
import { HttpClient } from "alepha/server";
|
|
6
6
|
|
|
7
|
-
//#region src/core/contexts/AlephaContext.ts
|
|
7
|
+
//#region ../../src/core/contexts/AlephaContext.ts
|
|
8
8
|
const AlephaContext = createContext(void 0);
|
|
9
9
|
|
|
10
10
|
//#endregion
|
|
11
|
-
//#region src/core/hooks/useAlepha.ts
|
|
11
|
+
//#region ../../src/core/hooks/useAlepha.ts
|
|
12
12
|
/**
|
|
13
13
|
* Main Alepha hook.
|
|
14
14
|
*
|
|
@@ -28,7 +28,7 @@ const useAlepha = () => {
|
|
|
28
28
|
};
|
|
29
29
|
|
|
30
30
|
//#endregion
|
|
31
|
-
//#region src/core/hooks/useInject.ts
|
|
31
|
+
//#region ../../src/core/hooks/useInject.ts
|
|
32
32
|
/**
|
|
33
33
|
* Hook to inject a service instance.
|
|
34
34
|
* It's a wrapper of `useAlepha().inject(service)` with a memoization.
|
|
@@ -39,7 +39,7 @@ const useInject = (service) => {
|
|
|
39
39
|
};
|
|
40
40
|
|
|
41
41
|
//#endregion
|
|
42
|
-
//#region src/core/hooks/useAction.ts
|
|
42
|
+
//#region ../../src/core/hooks/useAction.ts
|
|
43
43
|
/**
|
|
44
44
|
* Hook for handling async actions with automatic error handling and event emission.
|
|
45
45
|
*
|
|
@@ -266,7 +266,7 @@ function useAction(options, deps) {
|
|
|
266
266
|
}
|
|
267
267
|
|
|
268
268
|
//#endregion
|
|
269
|
-
//#region src/core/hooks/useClient.ts
|
|
269
|
+
//#region ../../src/core/hooks/useClient.ts
|
|
270
270
|
/**
|
|
271
271
|
* Hook to get a virtual client for the specified scope.
|
|
272
272
|
*
|
|
@@ -277,7 +277,7 @@ const useClient = (scope) => {
|
|
|
277
277
|
};
|
|
278
278
|
|
|
279
279
|
//#endregion
|
|
280
|
-
//#region src/core/hooks/useEvents.ts
|
|
280
|
+
//#region ../../src/core/hooks/useEvents.ts
|
|
281
281
|
/**
|
|
282
282
|
* Allow subscribing to multiple Alepha events. See {@link Hooks} for available events.
|
|
283
283
|
*
|
|
@@ -314,7 +314,7 @@ const useEvents = (opts, deps) => {
|
|
|
314
314
|
};
|
|
315
315
|
|
|
316
316
|
//#endregion
|
|
317
|
-
//#region src/core/hooks/useSchema.ts
|
|
317
|
+
//#region ../../src/core/hooks/useSchema.ts
|
|
318
318
|
const useSchema = (action) => {
|
|
319
319
|
const name = action.name;
|
|
320
320
|
const alepha = useAlepha();
|
|
@@ -348,7 +348,7 @@ const ssrSchemaLoading = (alepha, name) => {
|
|
|
348
348
|
};
|
|
349
349
|
|
|
350
350
|
//#endregion
|
|
351
|
-
//#region src/core/hooks/useStore.ts
|
|
351
|
+
//#region ../../src/core/hooks/useStore.ts
|
|
352
352
|
function useStore(target, defaultValue) {
|
|
353
353
|
const alepha = useAlepha();
|
|
354
354
|
useMemo(() => {
|
|
@@ -368,7 +368,7 @@ function useStore(target, defaultValue) {
|
|
|
368
368
|
}
|
|
369
369
|
|
|
370
370
|
//#endregion
|
|
371
|
-
//#region src/core/index.native.ts
|
|
371
|
+
//#region ../../src/core/index.native.ts
|
|
372
372
|
const AlephaReact = $module({
|
|
373
373
|
name: "alepha.react",
|
|
374
374
|
primitives: [],
|
package/dist/form/index.d.ts
CHANGED
|
@@ -4,7 +4,7 @@ import { InputHTMLAttributes, ReactNode } from "react";
|
|
|
4
4
|
import dayjsDuration from "dayjs/plugin/duration.js";
|
|
5
5
|
import DayjsApi, { Dayjs, ManipulateType, PluginFunc } from "dayjs";
|
|
6
6
|
|
|
7
|
-
//#region
|
|
7
|
+
//#region ../../../alepha/src/logger/schemas/logEntrySchema.d.ts
|
|
8
8
|
declare const logEntrySchema: alepha8.TObject<{
|
|
9
9
|
level: alepha8.TUnsafe<"SILENT" | "TRACE" | "DEBUG" | "INFO" | "WARN" | "ERROR">;
|
|
10
10
|
message: alepha8.TString;
|
|
@@ -17,7 +17,7 @@ declare const logEntrySchema: alepha8.TObject<{
|
|
|
17
17
|
}>;
|
|
18
18
|
type LogEntry = Static<typeof logEntrySchema>;
|
|
19
19
|
//#endregion
|
|
20
|
-
//#region
|
|
20
|
+
//#region ../../../alepha/src/datetime/providers/DateTimeProvider.d.ts
|
|
21
21
|
type DateTime = DayjsApi.Dayjs;
|
|
22
22
|
type Duration = dayjsDuration.Duration;
|
|
23
23
|
type DurationLike = number | dayjsDuration.Duration | [number, ManipulateType];
|
|
@@ -123,17 +123,17 @@ interface Timeout {
|
|
|
123
123
|
clear: () => void;
|
|
124
124
|
}
|
|
125
125
|
//#endregion
|
|
126
|
-
//#region
|
|
126
|
+
//#region ../../../alepha/src/logger/providers/LogDestinationProvider.d.ts
|
|
127
127
|
declare abstract class LogDestinationProvider {
|
|
128
128
|
abstract write(message: string, entry: LogEntry): void;
|
|
129
129
|
}
|
|
130
130
|
//#endregion
|
|
131
|
-
//#region
|
|
131
|
+
//#region ../../../alepha/src/logger/providers/LogFormatterProvider.d.ts
|
|
132
132
|
declare abstract class LogFormatterProvider {
|
|
133
133
|
abstract format(entry: LogEntry): string;
|
|
134
134
|
}
|
|
135
135
|
//#endregion
|
|
136
|
-
//#region
|
|
136
|
+
//#region ../../../alepha/src/logger/services/Logger.d.ts
|
|
137
137
|
declare class Logger implements LoggerInterface {
|
|
138
138
|
protected readonly alepha: Alepha;
|
|
139
139
|
protected readonly formatter: LogFormatterProvider;
|
|
@@ -160,7 +160,7 @@ declare class Logger implements LoggerInterface {
|
|
|
160
160
|
protected emit(entry: LogEntry, message?: string): void;
|
|
161
161
|
}
|
|
162
162
|
//#endregion
|
|
163
|
-
//#region
|
|
163
|
+
//#region ../../../alepha/src/logger/index.d.ts
|
|
164
164
|
declare const envSchema: alepha8.TObject<{
|
|
165
165
|
/**
|
|
166
166
|
* Default log level for the application.
|
|
@@ -203,7 +203,7 @@ declare module "alepha" {
|
|
|
203
203
|
}
|
|
204
204
|
}
|
|
205
205
|
//#endregion
|
|
206
|
-
//#region src/form/services/FormModel.d.ts
|
|
206
|
+
//#region ../../src/form/services/FormModel.d.ts
|
|
207
207
|
/**
|
|
208
208
|
* FormModel is a dynamic form handler that generates form inputs based on a provided TypeBox schema.
|
|
209
209
|
* It manages form state, handles input changes, and processes form submissions with validation.
|
|
@@ -313,7 +313,7 @@ type FormCtrlOptions<T extends TObject> = {
|
|
|
313
313
|
onReset?: () => void;
|
|
314
314
|
};
|
|
315
315
|
//#endregion
|
|
316
|
-
//#region src/form/components/FormState.d.ts
|
|
316
|
+
//#region ../../src/form/components/FormState.d.ts
|
|
317
317
|
declare const FormState: <T extends TObject>(props: {
|
|
318
318
|
form: FormModel<T>;
|
|
319
319
|
children: (state: {
|
|
@@ -322,7 +322,7 @@ declare const FormState: <T extends TObject>(props: {
|
|
|
322
322
|
}) => ReactNode;
|
|
323
323
|
}) => ReactNode;
|
|
324
324
|
//#endregion
|
|
325
|
-
//#region src/form/hooks/useForm.d.ts
|
|
325
|
+
//#region ../../src/form/hooks/useForm.d.ts
|
|
326
326
|
/**
|
|
327
327
|
* Custom hook to create a form with validation and field management.
|
|
328
328
|
* This hook uses TypeBox schemas to define the structure and validation rules for the form.
|
|
@@ -353,7 +353,7 @@ declare const FormState: <T extends TObject>(props: {
|
|
|
353
353
|
*/
|
|
354
354
|
declare const useForm: <T extends TObject>(options: FormCtrlOptions<T>, deps?: any[]) => FormModel<T>;
|
|
355
355
|
//#endregion
|
|
356
|
-
//#region src/form/hooks/useFormState.d.ts
|
|
356
|
+
//#region ../../src/form/hooks/useFormState.d.ts
|
|
357
357
|
interface UseFormStateReturn {
|
|
358
358
|
loading: boolean;
|
|
359
359
|
dirty: boolean;
|
|
@@ -365,7 +365,7 @@ declare const useFormState: <T extends TObject, Keys extends keyof UseFormStateR
|
|
|
365
365
|
path: string;
|
|
366
366
|
}, _events?: Keys[]) => Pick<UseFormStateReturn, Keys>;
|
|
367
367
|
//#endregion
|
|
368
|
-
//#region src/form/errors/FormValidationError.d.ts
|
|
368
|
+
//#region ../../src/form/errors/FormValidationError.d.ts
|
|
369
369
|
declare class FormValidationError extends TypeBoxError {
|
|
370
370
|
readonly name = "ValidationError";
|
|
371
371
|
constructor(options: {
|
|
@@ -374,7 +374,7 @@ declare class FormValidationError extends TypeBoxError {
|
|
|
374
374
|
});
|
|
375
375
|
}
|
|
376
376
|
//#endregion
|
|
377
|
-
//#region src/form/index.d.ts
|
|
377
|
+
//#region ../../src/form/index.d.ts
|
|
378
378
|
declare module "alepha" {
|
|
379
379
|
interface Hooks {
|
|
380
380
|
"form:change": {
|
package/dist/form/index.js
CHANGED
|
@@ -3,7 +3,7 @@ import { useAlepha } from "@alepha/react";
|
|
|
3
3
|
import { useEffect, useId, useMemo, useState } from "react";
|
|
4
4
|
import { $logger } from "alepha/logger";
|
|
5
5
|
|
|
6
|
-
//#region src/form/hooks/useFormState.ts
|
|
6
|
+
//#region ../../src/form/hooks/useFormState.ts
|
|
7
7
|
const useFormState = (target, _events = [
|
|
8
8
|
"loading",
|
|
9
9
|
"dirty",
|
|
@@ -64,7 +64,7 @@ const useFormState = (target, _events = [
|
|
|
64
64
|
};
|
|
65
65
|
|
|
66
66
|
//#endregion
|
|
67
|
-
//#region src/form/components/FormState.tsx
|
|
67
|
+
//#region ../../src/form/components/FormState.tsx
|
|
68
68
|
const FormState = (props) => {
|
|
69
69
|
const formState = useFormState(props.form);
|
|
70
70
|
return props.children({
|
|
@@ -75,7 +75,7 @@ const FormState = (props) => {
|
|
|
75
75
|
var FormState_default = FormState;
|
|
76
76
|
|
|
77
77
|
//#endregion
|
|
78
|
-
//#region src/form/services/FormModel.ts
|
|
78
|
+
//#region ../../src/form/services/FormModel.ts
|
|
79
79
|
/**
|
|
80
80
|
* FormModel is a dynamic form handler that generates form inputs based on a provided TypeBox schema.
|
|
81
81
|
* It manages form state, handles input changes, and processes form submissions with validation.
|
|
@@ -327,7 +327,7 @@ var FormModel = class {
|
|
|
327
327
|
};
|
|
328
328
|
|
|
329
329
|
//#endregion
|
|
330
|
-
//#region src/form/hooks/useForm.ts
|
|
330
|
+
//#region ../../src/form/hooks/useForm.ts
|
|
331
331
|
/**
|
|
332
332
|
* Custom hook to create a form with validation and field management.
|
|
333
333
|
* This hook uses TypeBox schemas to define the structure and validation rules for the form.
|
|
@@ -368,7 +368,7 @@ const useForm = (options, deps = []) => {
|
|
|
368
368
|
};
|
|
369
369
|
|
|
370
370
|
//#endregion
|
|
371
|
-
//#region src/form/errors/FormValidationError.ts
|
|
371
|
+
//#region ../../src/form/errors/FormValidationError.ts
|
|
372
372
|
var FormValidationError = class extends TypeBoxError {
|
|
373
373
|
name = "ValidationError";
|
|
374
374
|
constructor(options) {
|
|
@@ -383,7 +383,7 @@ var FormValidationError = class extends TypeBoxError {
|
|
|
383
383
|
};
|
|
384
384
|
|
|
385
385
|
//#endregion
|
|
386
|
-
//#region src/form/index.ts
|
|
386
|
+
//#region ../../src/form/index.ts
|
|
387
387
|
/**
|
|
388
388
|
* React hooks for managing forms in Alepha applications.
|
|
389
389
|
*
|
|
@@ -2,7 +2,7 @@ import { AlephaReact, useInject } from "@alepha/react";
|
|
|
2
2
|
import { $hook, $inject, $module, Alepha, KIND, Primitive, createPrimitive } from "alepha";
|
|
3
3
|
import { useCallback, useEffect, useMemo } from "react";
|
|
4
4
|
|
|
5
|
-
//#region src/head/providers/HeadProvider.ts
|
|
5
|
+
//#region ../../src/head/providers/HeadProvider.ts
|
|
6
6
|
var HeadProvider = class {
|
|
7
7
|
global = [];
|
|
8
8
|
fillHead(state) {
|
|
@@ -40,7 +40,7 @@ var HeadProvider = class {
|
|
|
40
40
|
};
|
|
41
41
|
|
|
42
42
|
//#endregion
|
|
43
|
-
//#region src/head/primitives/$head.ts
|
|
43
|
+
//#region ../../src/head/primitives/$head.ts
|
|
44
44
|
/**
|
|
45
45
|
* Set global `<head>` options for the application.
|
|
46
46
|
*/
|
|
@@ -56,7 +56,7 @@ var HeadPrimitive = class extends Primitive {
|
|
|
56
56
|
$head[KIND] = HeadPrimitive;
|
|
57
57
|
|
|
58
58
|
//#endregion
|
|
59
|
-
//#region src/head/providers/BrowserHeadProvider.ts
|
|
59
|
+
//#region ../../src/head/providers/BrowserHeadProvider.ts
|
|
60
60
|
var BrowserHeadProvider = class {
|
|
61
61
|
headProvider = $inject(HeadProvider);
|
|
62
62
|
get document() {
|
|
@@ -136,7 +136,7 @@ var BrowserHeadProvider = class {
|
|
|
136
136
|
};
|
|
137
137
|
|
|
138
138
|
//#endregion
|
|
139
|
-
//#region src/head/hooks/useHead.ts
|
|
139
|
+
//#region ../../src/head/hooks/useHead.ts
|
|
140
140
|
/**
|
|
141
141
|
* ```tsx
|
|
142
142
|
* const App = () => {
|
|
@@ -171,7 +171,7 @@ const useHead = (options) => {
|
|
|
171
171
|
};
|
|
172
172
|
|
|
173
173
|
//#endregion
|
|
174
|
-
//#region src/head/index.browser.ts
|
|
174
|
+
//#region ../../src/head/index.browser.ts
|
|
175
175
|
/**
|
|
176
176
|
* Alepha React Head Module
|
|
177
177
|
*
|