@crombolo/crombolo 0.39.1 → 0.41.1
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/package.json +15 -15
- package/src/index.ts +2 -0
- package/src/islands-react.ts +4 -1
- package/src/routes.ts +6 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@crombolo/crombolo",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.41.1",
|
|
4
4
|
"crombolo": {
|
|
5
5
|
"migrations": "compatible"
|
|
6
6
|
},
|
|
@@ -55,21 +55,21 @@
|
|
|
55
55
|
"NOTICE"
|
|
56
56
|
],
|
|
57
57
|
"dependencies": {
|
|
58
|
-
"@crombolo/api-delivery": "0.
|
|
59
|
-
"@crombolo/api-management": "0.
|
|
60
|
-
"@crombolo/auth": "0.
|
|
58
|
+
"@crombolo/api-delivery": "0.41.1",
|
|
59
|
+
"@crombolo/api-management": "0.41.1",
|
|
60
|
+
"@crombolo/auth": "0.41.1",
|
|
61
61
|
"@crombolo/backoffice-dist": "18.2.0",
|
|
62
|
-
"@crombolo/backoffice-host": "0.
|
|
63
|
-
"@crombolo/cli": "0.
|
|
64
|
-
"@crombolo/common": "0.
|
|
65
|
-
"@crombolo/content": "0.
|
|
66
|
-
"@crombolo/contracts": "0.
|
|
67
|
-
"@crombolo/core": "0.
|
|
68
|
-
"@crombolo/data": "0.
|
|
69
|
-
"@crombolo/render": "0.
|
|
70
|
-
"@crombolo/schema": "0.
|
|
71
|
-
"@crombolo/server": "0.
|
|
72
|
-
"@crombolo/transfer": "0.
|
|
62
|
+
"@crombolo/backoffice-host": "0.41.1",
|
|
63
|
+
"@crombolo/cli": "0.41.1",
|
|
64
|
+
"@crombolo/common": "0.41.1",
|
|
65
|
+
"@crombolo/content": "0.41.1",
|
|
66
|
+
"@crombolo/contracts": "0.41.1",
|
|
67
|
+
"@crombolo/core": "0.41.1",
|
|
68
|
+
"@crombolo/data": "0.41.1",
|
|
69
|
+
"@crombolo/render": "0.41.1",
|
|
70
|
+
"@crombolo/schema": "0.41.1",
|
|
71
|
+
"@crombolo/server": "0.41.1",
|
|
72
|
+
"@crombolo/transfer": "0.41.1"
|
|
73
73
|
},
|
|
74
74
|
"peerDependencies": {
|
|
75
75
|
"react": ">=19",
|
package/src/index.ts
CHANGED
|
@@ -15,6 +15,7 @@ import {
|
|
|
15
15
|
type ServerHandle,
|
|
16
16
|
} from '@crombolo/server'
|
|
17
17
|
|
|
18
|
+
export { type ActionState, type ClientAction, clientAction } from '@crombolo/common'
|
|
18
19
|
// A view reads a form definition and a submission's state; both are domain
|
|
19
20
|
// types, so they come from core rather than from the renderer.
|
|
20
21
|
export type {
|
|
@@ -82,6 +83,7 @@ export type {
|
|
|
82
83
|
} from '@crombolo/render'
|
|
83
84
|
export {
|
|
84
85
|
AntiforgeryMeta,
|
|
86
|
+
actionState,
|
|
85
87
|
Blocks,
|
|
86
88
|
type Context,
|
|
87
89
|
createContext,
|
package/src/islands-react.ts
CHANGED
|
@@ -4,6 +4,7 @@
|
|
|
4
4
|
* Crombolo's island build includes it; a site building islands with Vite lists
|
|
5
5
|
* it among its inputs. React is the site's own.
|
|
6
6
|
*/
|
|
7
|
+
import { reviveActions } from '@crombolo/common'
|
|
7
8
|
import { type ComponentType, createElement } from 'react'
|
|
8
9
|
import { createRoot } from 'react-dom/client'
|
|
9
10
|
|
|
@@ -21,8 +22,10 @@ export function mount(
|
|
|
21
22
|
style: { display: 'contents' },
|
|
22
23
|
dangerouslySetInnerHTML: { __html: childrenHtml },
|
|
23
24
|
})
|
|
25
|
+
// A server action in the props is a function again, calling the server (story 219).
|
|
26
|
+
const live = reviveActions(props)
|
|
24
27
|
element.replaceChildren()
|
|
25
28
|
createRoot(element).render(
|
|
26
|
-
createElement(component, children === undefined ?
|
|
29
|
+
createElement(component, children === undefined ? live : { ...live, children }),
|
|
27
30
|
)
|
|
28
31
|
}
|
package/src/routes.ts
CHANGED
|
@@ -4,8 +4,10 @@
|
|
|
4
4
|
* route module (exports `GET`, `POST`, …) as one route.
|
|
5
5
|
*/
|
|
6
6
|
import {
|
|
7
|
+
type ActionContext as CommonActionContext,
|
|
7
8
|
type RouteContext as CommonRouteContext,
|
|
8
9
|
type RouteHandler as CommonRouteHandler,
|
|
10
|
+
type ServerAction as CommonServerAction,
|
|
9
11
|
type SiteRoute as CommonSiteRoute,
|
|
10
12
|
route as commonRoute,
|
|
11
13
|
ROUTE_METHODS,
|
|
@@ -28,6 +30,10 @@ export {
|
|
|
28
30
|
export type RouteContext = CommonRouteContext<SiteServices, RequestMember>
|
|
29
31
|
export type RouteHandler = CommonRouteHandler<SiteServices, RequestMember>
|
|
30
32
|
export type SiteRoute = CommonSiteRoute<SiteServices, RequestMember>
|
|
33
|
+
/** What a server action is given besides the form (story 219): a route's context, less its params. */
|
|
34
|
+
export type ActionContext = CommonActionContext<SiteServices, RequestMember>
|
|
35
|
+
/** A server action: `export async function save(formData: FormData, { site }: ActionContext)`. */
|
|
36
|
+
export type ServerAction = CommonServerAction<SiteServices, RequestMember>
|
|
31
37
|
|
|
32
38
|
/** A route on this site: `route('/api/records/:species', { GET: list, POST: add })`. */
|
|
33
39
|
export function route(
|