@orieljs/inertia-solid 0.0.0-stage → 0.1.0-alpha.3
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/LICENSE +202 -0
- package/README.md +41 -2
- package/dist/index.d.ts +145 -0
- package/dist/index.js +439 -0
- package/dist/index.js.map +1 -0
- package/dist/server.d.ts +1 -0
- package/dist/server.js +6 -0
- package/dist/server.js.map +1 -0
- package/package.json +46 -3
package/LICENSE
ADDED
|
@@ -0,0 +1,202 @@
|
|
|
1
|
+
|
|
2
|
+
Apache License
|
|
3
|
+
Version 2.0, January 2004
|
|
4
|
+
http://www.apache.org/licenses/
|
|
5
|
+
|
|
6
|
+
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
|
7
|
+
|
|
8
|
+
1. Definitions.
|
|
9
|
+
|
|
10
|
+
"License" shall mean the terms and conditions for use, reproduction,
|
|
11
|
+
and distribution as defined by Sections 1 through 9 of this document.
|
|
12
|
+
|
|
13
|
+
"Licensor" shall mean the copyright owner or entity authorized by
|
|
14
|
+
the copyright owner that is granting the License.
|
|
15
|
+
|
|
16
|
+
"Legal Entity" shall mean the union of the acting entity and all
|
|
17
|
+
other entities that control, are controlled by, or are under common
|
|
18
|
+
control with that entity. For the purposes of this definition,
|
|
19
|
+
"control" means (i) the power, direct or indirect, to cause the
|
|
20
|
+
direction or management of such entity, whether by contract or
|
|
21
|
+
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
|
22
|
+
outstanding shares, or (iii) beneficial ownership of such entity.
|
|
23
|
+
|
|
24
|
+
"You" (or "Your") shall mean an individual or Legal Entity
|
|
25
|
+
exercising permissions granted by this License.
|
|
26
|
+
|
|
27
|
+
"Source" form shall mean the preferred form for making modifications,
|
|
28
|
+
including but not limited to software source code, documentation
|
|
29
|
+
source, and configuration files.
|
|
30
|
+
|
|
31
|
+
"Object" form shall mean any form resulting from mechanical
|
|
32
|
+
transformation or translation of a Source form, including but
|
|
33
|
+
not limited to compiled object code, generated documentation,
|
|
34
|
+
and conversions to other media types.
|
|
35
|
+
|
|
36
|
+
"Work" shall mean the work of authorship, whether in Source or
|
|
37
|
+
Object form, made available under the License, as indicated by a
|
|
38
|
+
copyright notice that is included in or attached to the work
|
|
39
|
+
(an example is provided in the Appendix below).
|
|
40
|
+
|
|
41
|
+
"Derivative Works" shall mean any work, whether in Source or Object
|
|
42
|
+
form, that is based on (or derived from) the Work and for which the
|
|
43
|
+
editorial revisions, annotations, elaborations, or other modifications
|
|
44
|
+
represent, as a whole, an original work of authorship. For the purposes
|
|
45
|
+
of this License, Derivative Works shall not include works that remain
|
|
46
|
+
separable from, or merely link (or bind by name) to the interfaces of,
|
|
47
|
+
the Work and Derivative Works thereof.
|
|
48
|
+
|
|
49
|
+
"Contribution" shall mean any work of authorship, including
|
|
50
|
+
the original version of the Work and any modifications or additions
|
|
51
|
+
to that Work or Derivative Works thereof, that is intentionally
|
|
52
|
+
submitted to Licensor for inclusion in the Work by the copyright owner
|
|
53
|
+
or by an individual or Legal Entity authorized to submit on behalf of
|
|
54
|
+
the copyright owner. For the purposes of this definition, "submitted"
|
|
55
|
+
means any form of electronic, verbal, or written communication sent
|
|
56
|
+
to the Licensor or its representatives, including but not limited to
|
|
57
|
+
communication on electronic mailing lists, source code control systems,
|
|
58
|
+
and issue tracking systems that are managed by, or on behalf of, the
|
|
59
|
+
Licensor for the purpose of discussing and improving the Work, but
|
|
60
|
+
excluding communication that is conspicuously marked or otherwise
|
|
61
|
+
designated in writing by the copyright owner as "Not a Contribution."
|
|
62
|
+
|
|
63
|
+
"Contributor" shall mean Licensor and any individual or Legal Entity
|
|
64
|
+
on behalf of whom a Contribution has been received by Licensor and
|
|
65
|
+
subsequently incorporated within the Work.
|
|
66
|
+
|
|
67
|
+
2. Grant of Copyright License. Subject to the terms and conditions of
|
|
68
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
69
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
70
|
+
copyright license to reproduce, prepare Derivative Works of,
|
|
71
|
+
publicly display, publicly perform, sublicense, and distribute the
|
|
72
|
+
Work and such Derivative Works in Source or Object form.
|
|
73
|
+
|
|
74
|
+
3. Grant of Patent License. Subject to the terms and conditions of
|
|
75
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
76
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
77
|
+
(except as stated in this section) patent license to make, have made,
|
|
78
|
+
use, offer to sell, sell, import, and otherwise transfer the Work,
|
|
79
|
+
where such license applies only to those patent claims licensable
|
|
80
|
+
by such Contributor that are necessarily infringed by their
|
|
81
|
+
Contribution(s) alone or by combination of their Contribution(s)
|
|
82
|
+
with the Work to which such Contribution(s) was submitted. If You
|
|
83
|
+
institute patent litigation against any entity (including a
|
|
84
|
+
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
|
85
|
+
or a Contribution incorporated within the Work constitutes direct
|
|
86
|
+
or contributory patent infringement, then any patent licenses
|
|
87
|
+
granted to You under this License for that Work shall terminate
|
|
88
|
+
as of the date such litigation is filed.
|
|
89
|
+
|
|
90
|
+
4. Redistribution. You may reproduce and distribute copies of the
|
|
91
|
+
Work or Derivative Works thereof in any medium, with or without
|
|
92
|
+
modifications, and in Source or Object form, provided that You
|
|
93
|
+
meet the following conditions:
|
|
94
|
+
|
|
95
|
+
(a) You must give any other recipients of the Work or
|
|
96
|
+
Derivative Works a copy of this License; and
|
|
97
|
+
|
|
98
|
+
(b) You must cause any modified files to carry prominent notices
|
|
99
|
+
stating that You changed the files; and
|
|
100
|
+
|
|
101
|
+
(c) You must retain, in the Source form of any Derivative Works
|
|
102
|
+
that You distribute, all copyright, patent, trademark, and
|
|
103
|
+
attribution notices from the Source form of the Work,
|
|
104
|
+
excluding those notices that do not pertain to any part of
|
|
105
|
+
the Derivative Works; and
|
|
106
|
+
|
|
107
|
+
(d) If the Work includes a "NOTICE" text file as part of its
|
|
108
|
+
distribution, then any Derivative Works that You distribute must
|
|
109
|
+
include a readable copy of the attribution notices contained
|
|
110
|
+
within such NOTICE file, excluding those notices that do not
|
|
111
|
+
pertain to any part of the Derivative Works, in at least one
|
|
112
|
+
of the following places: within a NOTICE text file distributed
|
|
113
|
+
as part of the Derivative Works; within the Source form or
|
|
114
|
+
documentation, if provided along with the Derivative Works; or,
|
|
115
|
+
within a display generated by the Derivative Works, if and
|
|
116
|
+
wherever such third-party notices normally appear. The contents
|
|
117
|
+
of the NOTICE file are for informational purposes only and
|
|
118
|
+
do not modify the License. You may add Your own attribution
|
|
119
|
+
notices within Derivative Works that You distribute, alongside
|
|
120
|
+
or as an addendum to the NOTICE text from the Work, provided
|
|
121
|
+
that such additional attribution notices cannot be construed
|
|
122
|
+
as modifying the License.
|
|
123
|
+
|
|
124
|
+
You may add Your own copyright statement to Your modifications and
|
|
125
|
+
may provide additional or different license terms and conditions
|
|
126
|
+
for use, reproduction, or distribution of Your modifications, or
|
|
127
|
+
for any such Derivative Works as a whole, provided Your use,
|
|
128
|
+
reproduction, and distribution of the Work otherwise complies with
|
|
129
|
+
the conditions stated in this License.
|
|
130
|
+
|
|
131
|
+
5. Submission of Contributions. Unless You explicitly state otherwise,
|
|
132
|
+
any Contribution intentionally submitted for inclusion in the Work
|
|
133
|
+
by You to the Licensor shall be under the terms and conditions of
|
|
134
|
+
this License, without any additional terms or conditions.
|
|
135
|
+
Notwithstanding the above, nothing herein shall supersede or modify
|
|
136
|
+
the terms of any separate license agreement you may have executed
|
|
137
|
+
with Licensor regarding such Contributions.
|
|
138
|
+
|
|
139
|
+
6. Trademarks. This License does not grant permission to use the trade
|
|
140
|
+
names, trademarks, service marks, or product names of the Licensor,
|
|
141
|
+
except as required for reasonable and customary use in describing the
|
|
142
|
+
origin of the Work and reproducing the content of the NOTICE file.
|
|
143
|
+
|
|
144
|
+
7. Disclaimer of Warranty. Unless required by applicable law or
|
|
145
|
+
agreed to in writing, Licensor provides the Work (and each
|
|
146
|
+
Contributor provides its Contributions) on an "AS IS" BASIS,
|
|
147
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
|
148
|
+
implied, including, without limitation, any warranties or conditions
|
|
149
|
+
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
|
150
|
+
PARTICULAR PURPOSE. You are solely responsible for determining the
|
|
151
|
+
appropriateness of using or redistributing the Work and assume any
|
|
152
|
+
risks associated with Your exercise of permissions under this License.
|
|
153
|
+
|
|
154
|
+
8. Limitation of Liability. In no event and under no legal theory,
|
|
155
|
+
whether in tort (including negligence), contract, or otherwise,
|
|
156
|
+
unless required by applicable law (such as deliberate and grossly
|
|
157
|
+
negligent acts) or agreed to in writing, shall any Contributor be
|
|
158
|
+
liable to You for damages, including any direct, indirect, special,
|
|
159
|
+
incidental, or consequential damages of any character arising as a
|
|
160
|
+
result of this License or out of the use or inability to use the
|
|
161
|
+
Work (including but not limited to damages for loss of goodwill,
|
|
162
|
+
work stoppage, computer failure or malfunction, or any and all
|
|
163
|
+
other commercial damages or losses), even if such Contributor
|
|
164
|
+
has been advised of the possibility of such damages.
|
|
165
|
+
|
|
166
|
+
9. Accepting Warranty or Additional Liability. While redistributing
|
|
167
|
+
the Work or Derivative Works thereof, You may choose to offer,
|
|
168
|
+
and charge a fee for, acceptance of support, warranty, indemnity,
|
|
169
|
+
or other liability obligations and/or rights consistent with this
|
|
170
|
+
License. However, in accepting such obligations, You may act only
|
|
171
|
+
on Your own behalf and on Your sole responsibility, not on behalf
|
|
172
|
+
of any other Contributor, and only if You agree to indemnify,
|
|
173
|
+
defend, and hold each Contributor harmless for any liability
|
|
174
|
+
incurred by, or claims asserted against, such Contributor by reason
|
|
175
|
+
of your accepting any such warranty or additional liability.
|
|
176
|
+
|
|
177
|
+
END OF TERMS AND CONDITIONS
|
|
178
|
+
|
|
179
|
+
APPENDIX: How to apply the Apache License to your work.
|
|
180
|
+
|
|
181
|
+
To apply the Apache License to your work, attach the following
|
|
182
|
+
boilerplate notice, with the fields enclosed by brackets "[]"
|
|
183
|
+
replaced with your own identifying information. (Don't include
|
|
184
|
+
the brackets!) The text should be enclosed in the appropriate
|
|
185
|
+
comment syntax for the file format. We also recommend that a
|
|
186
|
+
file or class name and description of purpose be included on the
|
|
187
|
+
same "printed page" as the copyright notice for easier
|
|
188
|
+
identification within third-party archives.
|
|
189
|
+
|
|
190
|
+
Copyright [yyyy] [name of copyright owner]
|
|
191
|
+
|
|
192
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
193
|
+
you may not use this file except in compliance with the License.
|
|
194
|
+
You may obtain a copy of the License at
|
|
195
|
+
|
|
196
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
197
|
+
|
|
198
|
+
Unless required by applicable law or agreed to in writing, software
|
|
199
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
200
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
201
|
+
See the License for the specific language governing permissions and
|
|
202
|
+
limitations under the License.
|
package/README.md
CHANGED
|
@@ -1,3 +1,42 @@
|
|
|
1
|
-
#
|
|
1
|
+
# @orieljs/inertia-solid
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
The Oriel Solid adapter for Inertia. It is Oriel's own adapter, built on `@inertiajs/core`, with typed pages and Oriel route helpers. Apps load it through `oriel({ input, framework })` from `@orieljs/vite`.
|
|
4
|
+
|
|
5
|
+
```bash
|
|
6
|
+
npm install @orieljs/inertia-solid solid-js
|
|
7
|
+
```
|
|
8
|
+
|
|
9
|
+
```tsx
|
|
10
|
+
// resources/js/app.tsx
|
|
11
|
+
import { createInertiaApp } from '@orieljs/inertia-solid'
|
|
12
|
+
|
|
13
|
+
createInertiaApp({ pages: './pages' })
|
|
14
|
+
```
|
|
15
|
+
|
|
16
|
+
```tsx
|
|
17
|
+
// resources/js/pages/Posts/Index.tsx
|
|
18
|
+
import { usePage } from '@orieljs/inertia-solid'
|
|
19
|
+
|
|
20
|
+
export default function Index() {
|
|
21
|
+
const page = usePage<'Posts/Index'>()
|
|
22
|
+
return <p>{page.props.posts.length} posts</p>
|
|
23
|
+
}
|
|
24
|
+
```
|
|
25
|
+
|
|
26
|
+
It provides `createInertiaApp`, `Link`, `Head`, `useForm`, `Deferred`, `WhenVisible`, `router` and a typed `usePage<N>()`, plus `route()`, `hasRoute()`, `currentRoute()` and `isCurrentRoute()`. A `./server` export renders pages on the server.
|
|
27
|
+
|
|
28
|
+
Known limitations:
|
|
29
|
+
|
|
30
|
+
- No `useRemember`, `usePoll`, `usePrefetch`, `useHttp`, `InfiniteScroll` or `<Form>` yet.
|
|
31
|
+
- Persistent layouts are set with `Page.layout = Layout`.
|
|
32
|
+
- `Deferred` and `WhenVisible` take top-level prop keys.
|
|
33
|
+
- `currentRoute()` and `isCurrentRoute()` return nothing during server-side rendering (there is no `location`), so do not use them for markup that must hydrate identically.
|
|
34
|
+
- `useForm` copies the objects along a dotted path on each write (`setData('items.1.name', value)`), so render form arrays with `<Index>`, not `<For>`: `<For>` keys rows by object and would recreate the row, losing input focus.
|
|
35
|
+
|
|
36
|
+
Status: early alpha. APIs will change.
|
|
37
|
+
|
|
38
|
+
## License
|
|
39
|
+
|
|
40
|
+
Oriel is open-source software licensed under the Apache License 2.0 (Apache-2.0; see `LICENSE` and `NOTICE`). The Oriel name and logo are trademarks; see [`TRADEMARKS.md`](https://github.com/orieljs/framework/blob/main/TRADEMARKS.md).
|
|
41
|
+
|
|
42
|
+
Website: https://orieljs.vercel.app
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,145 @@
|
|
|
1
|
+
import { Page, CreateInertiaAppOptions as CreateInertiaAppOptions$1, ProgressOptions, InertiaAppSSRResponse, VisitOptions, PrefetchOptions, ReloadOptions } from '@inertiajs/core';
|
|
2
|
+
export { router } from '@inertiajs/core';
|
|
3
|
+
import { PageName, TypedPage, LinkProps as LinkProps$1, FormHelper } from '@orieljs/inertia-client';
|
|
4
|
+
export { ErrorBags, Errors, PageName, PageProps, Pages, RouteError, RouteList, RouteName, SharedProps, TypedPage, currentRoute, hasRoute, isCurrentRoute, route } from '@orieljs/inertia-client';
|
|
5
|
+
import { Component, JSX } from 'solid-js';
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* The current page, typed by name: `usePage<'Posts/Index'>().props.posts`. The page is a store: read its fields
|
|
9
|
+
* inside JSX, an effect or a memo to react to visits. Call it inside a component rendered by the Inertia app.
|
|
10
|
+
*/
|
|
11
|
+
declare function usePage<N extends PageName = PageName>(): TypedPage<N>;
|
|
12
|
+
|
|
13
|
+
type AnyProps = any;
|
|
14
|
+
/** A persistent layout: it gets the page props, and the page (or the next layout) as `children`. */
|
|
15
|
+
type LayoutComponent = Component<AnyProps>;
|
|
16
|
+
/** A page component. `Home.layout = AppLayout` (or `[Outer, Inner]`) wraps it in layouts that survive visits. */
|
|
17
|
+
type PageComponent = Component<AnyProps> & {
|
|
18
|
+
layout?: LayoutComponent | LayoutComponent[];
|
|
19
|
+
};
|
|
20
|
+
/** What a resolver returns: the component, or its module (`{ default, layout? }`, e.g. `import('./pages/Home.tsx')`). */
|
|
21
|
+
type PageModule = PageComponent | {
|
|
22
|
+
default: PageComponent;
|
|
23
|
+
layout?: LayoutComponent | LayoutComponent[];
|
|
24
|
+
};
|
|
25
|
+
/** Finds the page component for a name: `(name) => import(`./pages/${name}.tsx`)`. */
|
|
26
|
+
type PageResolver = (name: string, page: Page) => PageModule | Promise<PageModule>;
|
|
27
|
+
/** A page ready to render: its component and its layouts, outermost first. */
|
|
28
|
+
interface ResolvedPage {
|
|
29
|
+
readonly component: PageComponent;
|
|
30
|
+
readonly layouts: readonly LayoutComponent[];
|
|
31
|
+
}
|
|
32
|
+
interface InertiaAppProps {
|
|
33
|
+
initialPage: Page;
|
|
34
|
+
initialComponent: ResolvedPage;
|
|
35
|
+
resolveComponent: (name: string, page?: Page) => Promise<ResolvedPage>;
|
|
36
|
+
/** Formats every page title (`(title) => `${title} - My App``). */
|
|
37
|
+
titleCallback?: (title: string) => string;
|
|
38
|
+
/** Receives the head tags on the server (SSR collects them into `head`). */
|
|
39
|
+
onHeadUpdate?: (elements: string[]) => void;
|
|
40
|
+
}
|
|
41
|
+
/**
|
|
42
|
+
* The Inertia root: owns the current page (a store, read through usePage()), lets the router swap pages, and
|
|
43
|
+
* renders the page inside its layouts. A visit to another component, or one without preserveState, remounts the
|
|
44
|
+
* page; layouts that stay the same between two pages are kept, with their state.
|
|
45
|
+
*/
|
|
46
|
+
declare function App(props: InertiaAppProps): JSX.Element;
|
|
47
|
+
|
|
48
|
+
/** Renders one page on the server: what the SSR entry exports and `createServer()` serves. */
|
|
49
|
+
type RenderPage = (page: Page) => Promise<InertiaAppSSRResponse>;
|
|
50
|
+
/** In the browser: unmounts the app. On the server: renders a page (see RenderPage). */
|
|
51
|
+
type InertiaApp = (() => void) | RenderPage;
|
|
52
|
+
interface SetupOptions {
|
|
53
|
+
el: HTMLElement;
|
|
54
|
+
App: typeof App;
|
|
55
|
+
props: InertiaAppProps;
|
|
56
|
+
}
|
|
57
|
+
interface CreateInertiaAppOptions {
|
|
58
|
+
/** The id of the root element and of the page script (default `app`). */
|
|
59
|
+
id?: string;
|
|
60
|
+
/** Finds a page component by name: `(name) => import(`./pages/${name}.tsx`)`. */
|
|
61
|
+
resolve?: PageResolver;
|
|
62
|
+
/** The @inertiajs/vite shorthand (`pages: './pages'`), which the plugin turns into `resolve` at build time. */
|
|
63
|
+
pages?: CreateInertiaAppOptions$1<unknown, unknown, unknown, unknown>['pages'];
|
|
64
|
+
/** Mounts the app yourself (browser only); return a function that unmounts it. */
|
|
65
|
+
setup?: (options: SetupOptions) => (() => void) | void;
|
|
66
|
+
/** Formats every page title. */
|
|
67
|
+
title?: (title: string) => string;
|
|
68
|
+
/** The progress bar (core's NProgress-style bar); false turns it off. */
|
|
69
|
+
progress?: ProgressOptions | false;
|
|
70
|
+
}
|
|
71
|
+
/**
|
|
72
|
+
* Starts the Inertia app. In the browser it reads the page script (`<script data-page="app">`), resolves the page
|
|
73
|
+
* and mounts App on `#app` (hydrating server-rendered markup), then resolves to a function that unmounts it. On the
|
|
74
|
+
* server (Solid's server build) it resolves to the page renderer @inertiajs/vite's SSR entry exports.
|
|
75
|
+
*/
|
|
76
|
+
declare function createInertiaApp(options?: CreateInertiaAppOptions): Promise<InertiaApp>;
|
|
77
|
+
|
|
78
|
+
/** Link's props: Oriel's LinkProps, Inertia's visit callbacks and options, any attribute of the element, and children. */
|
|
79
|
+
type LinkProps = LinkProps$1 & Pick<VisitOptions, 'onCancelToken' | 'onBefore' | 'onStart' | 'onProgress' | 'onFinish' | 'onCancel' | 'onSuccess' | 'onError' | 'onPrefetching' | 'onPrefetched' | 'preserveUrl' | 'async' | 'queryStringArrayFormat' | 'viewTransition'> & Partial<PrefetchOptions> & {
|
|
80
|
+
children?: JSX.Element;
|
|
81
|
+
onClick?: (event: MouseEvent) => void;
|
|
82
|
+
onMouseEnter?: (event: MouseEvent) => void;
|
|
83
|
+
onMouseLeave?: (event: MouseEvent) => void;
|
|
84
|
+
onMouseDown?: (event: MouseEvent) => void;
|
|
85
|
+
[attribute: string]: unknown;
|
|
86
|
+
};
|
|
87
|
+
/**
|
|
88
|
+
* An Inertia link: `<Link href={route('posts.show', { post: 1 })}>`. A plain left click visits through the router
|
|
89
|
+
* instead of loading the page; modified clicks (new tab) are left to the browser. A non-GET link renders a button.
|
|
90
|
+
* `prefetch` (`true` = `'hover'`, `'click'`, `'mount'`) loads the page into core's prefetch cache ahead of the visit.
|
|
91
|
+
* The visit callbacks (`onBefore`, `onSuccess`, …) and options (`preserveUrl`, `async`, …) go to the router.
|
|
92
|
+
*/
|
|
93
|
+
declare function Link(props: LinkProps): JSX.Element;
|
|
94
|
+
|
|
95
|
+
/** The form helper as a Solid signal source: reading a field inside JSX or an effect tracks it. */
|
|
96
|
+
type SolidForm<T extends Record<string, unknown>> = Omit<FormHelper<T>, 'subscribe'>;
|
|
97
|
+
/**
|
|
98
|
+
* A form bound to the Inertia router: `const form = useForm({ title: '' })`, then `form.data.title`,
|
|
99
|
+
* `form.setData('title', value)`, `form.post(route('posts.store'))`, `form.errors.title`, `form.processing`.
|
|
100
|
+
* Built on @orieljs/inertia-client's createForm (no remember, no Precognition). Reading a field is reactive.
|
|
101
|
+
*/
|
|
102
|
+
declare function useForm<T extends Record<string, unknown>>(initial: T | (() => T)): SolidForm<T>;
|
|
103
|
+
|
|
104
|
+
interface DeferredProps {
|
|
105
|
+
/** The deferred prop (or props) to wait for. */
|
|
106
|
+
data: string | string[];
|
|
107
|
+
/** Shown until every prop has arrived. */
|
|
108
|
+
fallback: JSX.Element;
|
|
109
|
+
children?: JSX.Element;
|
|
110
|
+
}
|
|
111
|
+
/** Renders `fallback` until the deferred props in `data` have loaded, then the children. */
|
|
112
|
+
declare function Deferred(props: DeferredProps): JSX.Element;
|
|
113
|
+
|
|
114
|
+
interface WhenVisibleProps {
|
|
115
|
+
/** The props to load (a partial reload with `only`) when the element scrolls into view. */
|
|
116
|
+
data?: string | string[];
|
|
117
|
+
/** Extra reload options. */
|
|
118
|
+
params?: ReloadOptions;
|
|
119
|
+
/** Pixels around the viewport that count as visible (default 0). */
|
|
120
|
+
buffer?: number;
|
|
121
|
+
/** The placeholder element's tag (default `div`). */
|
|
122
|
+
as?: string;
|
|
123
|
+
/** Reload every time it becomes visible, not only the first time. */
|
|
124
|
+
always?: boolean;
|
|
125
|
+
/** Shown until the props have loaded. */
|
|
126
|
+
fallback?: JSX.Element;
|
|
127
|
+
children?: JSX.Element;
|
|
128
|
+
}
|
|
129
|
+
/** Loads props when a placeholder scrolls into view (IntersectionObserver), showing `fallback` until then. */
|
|
130
|
+
declare function WhenVisible(props: WhenVisibleProps): JSX.Element;
|
|
131
|
+
|
|
132
|
+
interface HeadProps {
|
|
133
|
+
/** The page title (passed through createInertiaApp's `title` callback). */
|
|
134
|
+
title?: string;
|
|
135
|
+
/** Head tags: `<meta>`, `<link>`, … A `head-key` attribute replaces the tag with the same key from a layout. */
|
|
136
|
+
children?: JSX.Element;
|
|
137
|
+
}
|
|
138
|
+
/**
|
|
139
|
+
* Sets the document title and head tags for the current page through core's head manager:
|
|
140
|
+
* `<Head title="Posts"><meta name="description" content="…" /></Head>`. On the server the tags go into the SSR
|
|
141
|
+
* response's `head`; in the browser they replace the previous page's tags.
|
|
142
|
+
*/
|
|
143
|
+
declare function Head(props: HeadProps): JSX.Element;
|
|
144
|
+
|
|
145
|
+
export { App, type CreateInertiaAppOptions, Deferred, type DeferredProps, Head, type HeadProps, type InertiaApp, type InertiaAppProps, type LayoutComponent, Link, type LinkProps, type PageComponent, type PageModule, type PageResolver, type RenderPage, type ResolvedPage, type SetupOptions, type SolidForm, WhenVisible, type WhenVisibleProps, createInertiaApp, useForm, usePage };
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,439 @@
|
|
|
1
|
+
// index.ts
|
|
2
|
+
import { router as router4 } from "@inertiajs/core";
|
|
3
|
+
import {
|
|
4
|
+
currentRoute,
|
|
5
|
+
hasRoute,
|
|
6
|
+
isCurrentRoute,
|
|
7
|
+
route,
|
|
8
|
+
RouteError
|
|
9
|
+
} from "@orieljs/inertia-client";
|
|
10
|
+
|
|
11
|
+
// usePage.ts
|
|
12
|
+
import { useContext } from "solid-js";
|
|
13
|
+
|
|
14
|
+
// context.ts
|
|
15
|
+
import { createContext } from "solid-js";
|
|
16
|
+
var PageContext = createContext();
|
|
17
|
+
var HeadContext = createContext();
|
|
18
|
+
|
|
19
|
+
// usePage.ts
|
|
20
|
+
function usePage() {
|
|
21
|
+
const page = useContext(PageContext);
|
|
22
|
+
if (page === void 0) throw new Error("usePage() must be called inside a component rendered by createInertiaApp().");
|
|
23
|
+
return page;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
// App.ts
|
|
27
|
+
import { createHeadManager, router } from "@inertiajs/core";
|
|
28
|
+
import { batch, createComponent, createMemo, createSignal, mergeProps, untrack } from "solid-js";
|
|
29
|
+
import { createStore, reconcile } from "solid-js/store";
|
|
30
|
+
import { isServer } from "solid-js/web";
|
|
31
|
+
async function resolvePage(resolve, name, page) {
|
|
32
|
+
const module = await resolve(name, page);
|
|
33
|
+
const component = typeof module === "function" ? module : module?.default;
|
|
34
|
+
if (typeof component !== "function") throw new Error(`The page [${name}] did not resolve to a Solid component.`);
|
|
35
|
+
const layout = (typeof module === "function" ? void 0 : module?.layout) ?? component.layout;
|
|
36
|
+
return { component, layouts: layout === void 0 ? [] : Array.isArray(layout) ? layout : [layout] };
|
|
37
|
+
}
|
|
38
|
+
function App(props) {
|
|
39
|
+
const [page, setPage] = createStore(structuredClone({ ...props.initialPage, flash: props.initialPage.flash ?? {} }));
|
|
40
|
+
const [view, setView] = createSignal(props.initialComponent);
|
|
41
|
+
const titleCallback = props.titleCallback ?? ((title) => title);
|
|
42
|
+
const headManager = createHeadManager(isServer, titleCallback, props.onHeadUpdate ?? (() => void 0));
|
|
43
|
+
if (!isServer) {
|
|
44
|
+
router.init({
|
|
45
|
+
initialPage: props.initialPage,
|
|
46
|
+
resolveComponent: props.resolveComponent,
|
|
47
|
+
swapComponent: async ({ component, page: next, preserveState }) => {
|
|
48
|
+
batch(() => {
|
|
49
|
+
setPage(reconcile(structuredClone({ ...next, flash: next.flash ?? {} })));
|
|
50
|
+
if (!preserveState || component.component !== view().component) setView(component);
|
|
51
|
+
});
|
|
52
|
+
},
|
|
53
|
+
onFlash: (flash) => setPage("flash", reconcile(structuredClone(flash)))
|
|
54
|
+
});
|
|
55
|
+
}
|
|
56
|
+
const level = (index) => {
|
|
57
|
+
const layout = createMemo(() => view().layouts[index]);
|
|
58
|
+
return createMemo(() => {
|
|
59
|
+
const Layout = layout();
|
|
60
|
+
if (Layout === void 0) {
|
|
61
|
+
return createMemo(() => {
|
|
62
|
+
const { component } = view();
|
|
63
|
+
return untrack(() => createComponent(component, mergeProps(() => page.props)));
|
|
64
|
+
});
|
|
65
|
+
}
|
|
66
|
+
const children = { get children() {
|
|
67
|
+
return level(index + 1);
|
|
68
|
+
} };
|
|
69
|
+
return untrack(() => createComponent(Layout, mergeProps(() => page.props, children)));
|
|
70
|
+
});
|
|
71
|
+
};
|
|
72
|
+
return createComponent(HeadContext.Provider, {
|
|
73
|
+
value: headManager,
|
|
74
|
+
get children() {
|
|
75
|
+
return createComponent(PageContext.Provider, {
|
|
76
|
+
value: page,
|
|
77
|
+
get children() {
|
|
78
|
+
return level(0);
|
|
79
|
+
}
|
|
80
|
+
});
|
|
81
|
+
}
|
|
82
|
+
});
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
// createInertiaApp.ts
|
|
86
|
+
import {
|
|
87
|
+
buildSSRBody,
|
|
88
|
+
getInitialPageFromDOM,
|
|
89
|
+
setupProgress
|
|
90
|
+
} from "@inertiajs/core";
|
|
91
|
+
import { createComponent as createComponent2 } from "solid-js";
|
|
92
|
+
import { generateHydrationScript, hydrate, isServer as isServer2, render, renderToString } from "solid-js/web";
|
|
93
|
+
async function createInertiaApp(options = {}) {
|
|
94
|
+
const { id = "app", resolve, setup, title, progress = {} } = options;
|
|
95
|
+
if (resolve === void 0) throw new Error("createInertiaApp() needs a `resolve` function (or `pages` with @inertiajs/vite).");
|
|
96
|
+
const resolveComponent = (name, page) => resolvePage(resolve, name, page);
|
|
97
|
+
if (isServer2) {
|
|
98
|
+
return async (page) => {
|
|
99
|
+
let head = [];
|
|
100
|
+
const props2 = {
|
|
101
|
+
initialPage: page,
|
|
102
|
+
initialComponent: await resolveComponent(page.component, page),
|
|
103
|
+
resolveComponent: (name, next) => resolveComponent(name, next ?? page),
|
|
104
|
+
titleCallback: title,
|
|
105
|
+
onHeadUpdate: (elements) => {
|
|
106
|
+
head = elements;
|
|
107
|
+
}
|
|
108
|
+
};
|
|
109
|
+
const html = renderToString(() => createComponent2(App, props2));
|
|
110
|
+
return { head: [...head, generateHydrationScript()], body: buildSSRBody(id, page, html) };
|
|
111
|
+
};
|
|
112
|
+
}
|
|
113
|
+
const initialPage = getInitialPageFromDOM(id);
|
|
114
|
+
const el = document.getElementById(id);
|
|
115
|
+
if (initialPage === null || el === null) throw new Error(`No Inertia page found: expected <script data-page="${id}"> and an element with id "${id}".`);
|
|
116
|
+
const props = {
|
|
117
|
+
initialPage,
|
|
118
|
+
initialComponent: await resolveComponent(initialPage.component, initialPage),
|
|
119
|
+
resolveComponent: (name, page) => resolveComponent(name, page ?? initialPage),
|
|
120
|
+
titleCallback: title
|
|
121
|
+
};
|
|
122
|
+
if (progress !== false) setupProgress(progress);
|
|
123
|
+
if (setup !== void 0) return setup({ el, App, props }) ?? (() => void 0);
|
|
124
|
+
const app = () => createComponent2(App, props);
|
|
125
|
+
return el.hasAttribute("data-server-rendered") ? hydrate(app, el) : render(app, el);
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
// Link.ts
|
|
129
|
+
import {
|
|
130
|
+
config,
|
|
131
|
+
mergeDataIntoQueryString,
|
|
132
|
+
router as router2,
|
|
133
|
+
shouldIntercept
|
|
134
|
+
} from "@inertiajs/core";
|
|
135
|
+
import { createComponent as createComponent3, createMemo as createMemo2, mergeProps as mergeProps2, onCleanup, onMount, splitProps } from "solid-js";
|
|
136
|
+
import { Dynamic } from "solid-js/web";
|
|
137
|
+
var LINK_KEYS = [
|
|
138
|
+
"href",
|
|
139
|
+
"method",
|
|
140
|
+
"data",
|
|
141
|
+
"replace",
|
|
142
|
+
"preserveScroll",
|
|
143
|
+
"preserveState",
|
|
144
|
+
"preserveUrl",
|
|
145
|
+
"only",
|
|
146
|
+
"except",
|
|
147
|
+
"headers",
|
|
148
|
+
"queryStringArrayFormat",
|
|
149
|
+
"async",
|
|
150
|
+
"viewTransition",
|
|
151
|
+
"as",
|
|
152
|
+
"prefetch",
|
|
153
|
+
"cacheFor",
|
|
154
|
+
"cacheTags",
|
|
155
|
+
"children",
|
|
156
|
+
"onClick",
|
|
157
|
+
"onMouseEnter",
|
|
158
|
+
"onMouseLeave",
|
|
159
|
+
"onMouseDown",
|
|
160
|
+
"onCancelToken",
|
|
161
|
+
"onBefore",
|
|
162
|
+
"onStart",
|
|
163
|
+
"onProgress",
|
|
164
|
+
"onFinish",
|
|
165
|
+
"onCancel",
|
|
166
|
+
"onSuccess",
|
|
167
|
+
"onError",
|
|
168
|
+
"onPrefetching",
|
|
169
|
+
"onPrefetched"
|
|
170
|
+
];
|
|
171
|
+
function Link(props) {
|
|
172
|
+
const [own, attributes] = splitProps(props, LINK_KEYS);
|
|
173
|
+
const method = createMemo2(() => (own.method ?? "get").toLowerCase());
|
|
174
|
+
const tag = createMemo2(() => {
|
|
175
|
+
const as = (own.as ?? "a").toLowerCase();
|
|
176
|
+
return as === "a" && method() !== "get" ? "button" : as;
|
|
177
|
+
});
|
|
178
|
+
const target = createMemo2(
|
|
179
|
+
() => mergeDataIntoQueryString(method(), own.href, own.data ?? {}, own.queryStringArrayFormat ?? "brackets")
|
|
180
|
+
);
|
|
181
|
+
const baseOptions = () => ({
|
|
182
|
+
data: target()[1],
|
|
183
|
+
method: method(),
|
|
184
|
+
preserveScroll: own.preserveScroll ?? false,
|
|
185
|
+
preserveState: own.preserveState ?? method() !== "get",
|
|
186
|
+
preserveUrl: own.preserveUrl ?? false,
|
|
187
|
+
replace: own.replace ?? false,
|
|
188
|
+
only: own.only ?? [],
|
|
189
|
+
except: own.except ?? [],
|
|
190
|
+
headers: own.headers ?? {},
|
|
191
|
+
async: own.async ?? false
|
|
192
|
+
});
|
|
193
|
+
const visitOptions = () => ({
|
|
194
|
+
...baseOptions(),
|
|
195
|
+
viewTransition: own.viewTransition ?? false,
|
|
196
|
+
onCancelToken: own.onCancelToken,
|
|
197
|
+
onBefore: own.onBefore,
|
|
198
|
+
onStart: own.onStart,
|
|
199
|
+
onProgress: own.onProgress,
|
|
200
|
+
onFinish: own.onFinish,
|
|
201
|
+
onCancel: own.onCancel,
|
|
202
|
+
onSuccess: own.onSuccess,
|
|
203
|
+
onError: own.onError
|
|
204
|
+
});
|
|
205
|
+
const modes = createMemo2(() => own.prefetch === true ? ["hover"] : own.prefetch ? [own.prefetch] : []);
|
|
206
|
+
const cacheFor = () => {
|
|
207
|
+
const value = own.cacheFor ?? 0;
|
|
208
|
+
if (value !== 0) return value;
|
|
209
|
+
return modes().length === 1 && modes()[0] === "click" ? 0 : config.get("prefetch.cacheFor");
|
|
210
|
+
};
|
|
211
|
+
const prefetch = () => {
|
|
212
|
+
if (method() !== "get") return;
|
|
213
|
+
const options = { ...baseOptions(), onPrefetching: own.onPrefetching, onPrefetched: own.onPrefetched };
|
|
214
|
+
router2.prefetch(target()[0], options, { cacheFor: cacheFor(), cacheTags: own.cacheTags ?? [] });
|
|
215
|
+
};
|
|
216
|
+
let hoverTimer;
|
|
217
|
+
onMount(() => {
|
|
218
|
+
if (modes().includes("mount")) prefetch();
|
|
219
|
+
});
|
|
220
|
+
onCleanup(() => clearTimeout(hoverTimer));
|
|
221
|
+
return createComponent3(
|
|
222
|
+
Dynamic,
|
|
223
|
+
mergeProps2(attributes, {
|
|
224
|
+
get component() {
|
|
225
|
+
return tag();
|
|
226
|
+
},
|
|
227
|
+
get href() {
|
|
228
|
+
return tag() === "a" ? target()[0] : void 0;
|
|
229
|
+
},
|
|
230
|
+
get type() {
|
|
231
|
+
return tag() === "button" ? "button" : void 0;
|
|
232
|
+
},
|
|
233
|
+
get children() {
|
|
234
|
+
return own.children;
|
|
235
|
+
},
|
|
236
|
+
onClick: (event) => {
|
|
237
|
+
clearTimeout(hoverTimer);
|
|
238
|
+
own.onClick?.(event);
|
|
239
|
+
if (!shouldIntercept(event)) return;
|
|
240
|
+
event.preventDefault();
|
|
241
|
+
router2.visit(target()[0], visitOptions());
|
|
242
|
+
},
|
|
243
|
+
onMouseEnter: (event) => {
|
|
244
|
+
own.onMouseEnter?.(event);
|
|
245
|
+
if (!modes().includes("hover")) return;
|
|
246
|
+
clearTimeout(hoverTimer);
|
|
247
|
+
hoverTimer = setTimeout(prefetch, config.get("prefetch.hoverDelay"));
|
|
248
|
+
},
|
|
249
|
+
onMouseLeave: (event) => {
|
|
250
|
+
own.onMouseLeave?.(event);
|
|
251
|
+
clearTimeout(hoverTimer);
|
|
252
|
+
},
|
|
253
|
+
onMouseDown: (event) => {
|
|
254
|
+
own.onMouseDown?.(event);
|
|
255
|
+
if (modes().includes("click") && shouldIntercept(event)) prefetch();
|
|
256
|
+
}
|
|
257
|
+
})
|
|
258
|
+
);
|
|
259
|
+
}
|
|
260
|
+
|
|
261
|
+
// useForm.ts
|
|
262
|
+
import { createForm } from "@orieljs/inertia-client";
|
|
263
|
+
import { createSignal as createSignal2, getOwner, onCleanup as onCleanup2 } from "solid-js";
|
|
264
|
+
var STATE = ["data", "defaults", "errors", "hasErrors", "isDirty", "processing", "progress", "wasSuccessful", "recentlySuccessful"];
|
|
265
|
+
function useForm(initial) {
|
|
266
|
+
const helper = createForm(initial);
|
|
267
|
+
const [version, bump] = createSignal2(void 0, { equals: false });
|
|
268
|
+
const unsubscribe = helper.subscribe(() => bump());
|
|
269
|
+
if (getOwner() !== null) onCleanup2(unsubscribe);
|
|
270
|
+
const form = {};
|
|
271
|
+
for (const key of STATE) {
|
|
272
|
+
Object.defineProperty(form, key, {
|
|
273
|
+
enumerable: true,
|
|
274
|
+
get() {
|
|
275
|
+
version();
|
|
276
|
+
return helper[key];
|
|
277
|
+
}
|
|
278
|
+
});
|
|
279
|
+
}
|
|
280
|
+
for (const key of ["setData", "setDefaults", "reset", "clearErrors", "resetAndClearErrors", "setError", "transform", "submit", "get", "post", "put", "patch", "delete", "cancel"]) {
|
|
281
|
+
form[key] = helper[key];
|
|
282
|
+
}
|
|
283
|
+
return form;
|
|
284
|
+
}
|
|
285
|
+
|
|
286
|
+
// Deferred.ts
|
|
287
|
+
import { createComponent as createComponent4, createMemo as createMemo3 } from "solid-js";
|
|
288
|
+
|
|
289
|
+
// show.ts
|
|
290
|
+
import { Show } from "solid-js";
|
|
291
|
+
var When = Show;
|
|
292
|
+
|
|
293
|
+
// Deferred.ts
|
|
294
|
+
function Deferred(props) {
|
|
295
|
+
const page = usePage();
|
|
296
|
+
const keys = createMemo3(() => Array.isArray(props.data) ? props.data : [props.data]);
|
|
297
|
+
return createComponent4(When, {
|
|
298
|
+
get when() {
|
|
299
|
+
return keys().every((key) => page.props[key] !== void 0);
|
|
300
|
+
},
|
|
301
|
+
get fallback() {
|
|
302
|
+
return props.fallback;
|
|
303
|
+
},
|
|
304
|
+
get children() {
|
|
305
|
+
return props.children;
|
|
306
|
+
}
|
|
307
|
+
});
|
|
308
|
+
}
|
|
309
|
+
|
|
310
|
+
// WhenVisible.ts
|
|
311
|
+
import { router as router3 } from "@inertiajs/core";
|
|
312
|
+
import { createComponent as createComponent5, createMemo as createMemo4, createSignal as createSignal3, onCleanup as onCleanup3 } from "solid-js";
|
|
313
|
+
import { Dynamic as Dynamic2, isServer as isServer3 } from "solid-js/web";
|
|
314
|
+
function WhenVisible(props) {
|
|
315
|
+
const page = usePage();
|
|
316
|
+
const keys = createMemo4(() => props.data === void 0 ? [] : Array.isArray(props.data) ? props.data : [props.data]);
|
|
317
|
+
const arrived = () => keys().length > 0 && keys().every((key) => page.props[key] !== void 0);
|
|
318
|
+
const [loaded, setLoaded] = createSignal3(false);
|
|
319
|
+
let fetching = false;
|
|
320
|
+
let observer;
|
|
321
|
+
onCleanup3(() => observer?.disconnect());
|
|
322
|
+
const observe = (element) => {
|
|
323
|
+
if (isServer3) return;
|
|
324
|
+
observer?.disconnect();
|
|
325
|
+
observer = new window.IntersectionObserver(
|
|
326
|
+
(entries) => {
|
|
327
|
+
if (entries[0]?.isIntersecting !== true || fetching) return;
|
|
328
|
+
if (props.always !== true) observer?.disconnect();
|
|
329
|
+
fetching = true;
|
|
330
|
+
const params = props.params ?? {};
|
|
331
|
+
router3.reload({
|
|
332
|
+
preserveErrors: true,
|
|
333
|
+
...params,
|
|
334
|
+
...keys().length > 0 ? { only: keys() } : {},
|
|
335
|
+
onFinish: (visit) => {
|
|
336
|
+
fetching = false;
|
|
337
|
+
setLoaded(true);
|
|
338
|
+
params.onFinish?.(visit);
|
|
339
|
+
}
|
|
340
|
+
});
|
|
341
|
+
},
|
|
342
|
+
{ rootMargin: `${props.buffer ?? 0}px` }
|
|
343
|
+
);
|
|
344
|
+
observer.observe(element);
|
|
345
|
+
};
|
|
346
|
+
const visible = () => loaded() || arrived();
|
|
347
|
+
return [
|
|
348
|
+
createComponent5(When, {
|
|
349
|
+
get when() {
|
|
350
|
+
return props.always === true || !visible();
|
|
351
|
+
},
|
|
352
|
+
get children() {
|
|
353
|
+
return createComponent5(Dynamic2, {
|
|
354
|
+
get component() {
|
|
355
|
+
return props.as ?? "div";
|
|
356
|
+
},
|
|
357
|
+
ref: observe
|
|
358
|
+
});
|
|
359
|
+
}
|
|
360
|
+
}),
|
|
361
|
+
createComponent5(When, {
|
|
362
|
+
get when() {
|
|
363
|
+
return visible();
|
|
364
|
+
},
|
|
365
|
+
get fallback() {
|
|
366
|
+
return props.fallback;
|
|
367
|
+
},
|
|
368
|
+
get children() {
|
|
369
|
+
return props.children;
|
|
370
|
+
}
|
|
371
|
+
})
|
|
372
|
+
];
|
|
373
|
+
}
|
|
374
|
+
|
|
375
|
+
// Head.ts
|
|
376
|
+
import { children as resolveChildren, createRenderEffect, getOwner as getOwner2, onCleanup as onCleanup4, runWithOwner, sharedConfig, useContext as useContext2 } from "solid-js";
|
|
377
|
+
import { insert, isServer as isServer4, resolveSSRNode } from "solid-js/web";
|
|
378
|
+
var escapeHtml = (value) => value.replace(/&/g, "&").replace(/</g, "<").replace(/>/g, ">").replace(/"/g, """);
|
|
379
|
+
var OPENING_TAG = /^<([a-zA-Z][\w-]*)((?:\s+[^\s"'>/=]+(?:="[^"]*")?)*)/;
|
|
380
|
+
var ATTRIBUTE = /\s+([^\s"'>/=]+)(?:="([^"]*)")?/g;
|
|
381
|
+
function markTag(html) {
|
|
382
|
+
const tag = OPENING_TAG.exec(html);
|
|
383
|
+
if (tag === null) return html;
|
|
384
|
+
let key;
|
|
385
|
+
let marked = false;
|
|
386
|
+
const attributes = (tag[2] ?? "").replace(ATTRIBUTE, (attribute, name, value) => {
|
|
387
|
+
if (name === "data-hk") return "";
|
|
388
|
+
if (name === "head-key") {
|
|
389
|
+
key = value ?? "";
|
|
390
|
+
return "";
|
|
391
|
+
}
|
|
392
|
+
if (name === "data-inertia") marked = true;
|
|
393
|
+
return attribute;
|
|
394
|
+
});
|
|
395
|
+
const mark = key !== void 0 ? ` data-inertia="${key}"` : marked ? "" : ' data-inertia=""';
|
|
396
|
+
return `<${tag[1]}${mark}${attributes}${html.slice(tag[0].length)}`;
|
|
397
|
+
}
|
|
398
|
+
function Head(props) {
|
|
399
|
+
const manager = useContext2(HeadContext);
|
|
400
|
+
if (manager === void 0) throw new Error("<Head> must be rendered inside the Inertia app (createInertiaApp).");
|
|
401
|
+
const provider = manager.createProvider();
|
|
402
|
+
if (!isServer4) onCleanup4(() => provider.disconnect());
|
|
403
|
+
const title = () => props.title === void 0 ? [] : [`<title data-inertia="">${escapeHtml(props.title)}</title>`];
|
|
404
|
+
if (isServer4) {
|
|
405
|
+
const tags = resolveChildren(() => props.children).toArray().map((node) => resolveSSRNode(node)).filter((html) => html.startsWith("<"));
|
|
406
|
+
provider.update([...title(), ...tags.map(markTag)]);
|
|
407
|
+
return null;
|
|
408
|
+
}
|
|
409
|
+
const owner = getOwner2();
|
|
410
|
+
const start = () => {
|
|
411
|
+
const container = document.createElement("div");
|
|
412
|
+
const commit = () => provider.update([...title(), ...Array.from(container.children, (element) => markTag(element.outerHTML))]);
|
|
413
|
+
const observer = new window.MutationObserver(commit);
|
|
414
|
+
observer.observe(container, { subtree: true, childList: true, attributes: true, characterData: true });
|
|
415
|
+
onCleanup4(() => observer.disconnect());
|
|
416
|
+
insert(container, () => props.children);
|
|
417
|
+
createRenderEffect(commit);
|
|
418
|
+
};
|
|
419
|
+
if (sharedConfig.context) queueMicrotask(() => runWithOwner(owner, start));
|
|
420
|
+
else start();
|
|
421
|
+
return null;
|
|
422
|
+
}
|
|
423
|
+
export {
|
|
424
|
+
App,
|
|
425
|
+
Deferred,
|
|
426
|
+
Head,
|
|
427
|
+
Link,
|
|
428
|
+
RouteError,
|
|
429
|
+
WhenVisible,
|
|
430
|
+
createInertiaApp,
|
|
431
|
+
currentRoute,
|
|
432
|
+
hasRoute,
|
|
433
|
+
isCurrentRoute,
|
|
434
|
+
route,
|
|
435
|
+
router4 as router,
|
|
436
|
+
useForm,
|
|
437
|
+
usePage
|
|
438
|
+
};
|
|
439
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../index.ts","../usePage.ts","../context.ts","../App.ts","../createInertiaApp.ts","../Link.ts","../useForm.ts","../Deferred.ts","../show.ts","../WhenVisible.ts","../Head.ts"],"sourcesContent":["export { router } from '@inertiajs/core'\nexport {\n currentRoute,\n hasRoute,\n isCurrentRoute,\n route,\n RouteError,\n type ErrorBags,\n type Errors,\n type PageName,\n type PageProps,\n type Pages,\n type RouteList,\n type RouteName,\n type SharedProps,\n type TypedPage,\n} from '@orieljs/inertia-client'\nexport { usePage } from './usePage'\nexport { App, type InertiaAppProps, type LayoutComponent, type PageComponent, type PageModule, type PageResolver, type ResolvedPage } from './App'\nexport { createInertiaApp, type CreateInertiaAppOptions, type InertiaApp, type RenderPage, type SetupOptions } from './createInertiaApp'\nexport { Link, type LinkProps } from './Link'\nexport { useForm, type SolidForm } from './useForm'\nexport { Deferred, type DeferredProps } from './Deferred'\nexport { WhenVisible, type WhenVisibleProps } from './WhenVisible'\nexport { Head, type HeadProps } from './Head'\n","import type { PageName, TypedPage } from '@orieljs/inertia-client'\nimport { useContext } from 'solid-js'\nimport { PageContext } from './context'\n\n/**\n * The current page, typed by name: `usePage<'Posts/Index'>().props.posts`. The page is a store: read its fields\n * inside JSX, an effect or a memo to react to visits. Call it inside a component rendered by the Inertia app.\n */\nexport function usePage<N extends PageName = PageName>(): TypedPage<N> {\n const page = useContext(PageContext)\n if (page === undefined) throw new Error('usePage() must be called inside a component rendered by createInertiaApp().')\n return page as unknown as TypedPage<N>\n}\n","import type { HeadManager, Page } from '@inertiajs/core'\nimport { createContext } from 'solid-js'\n\n/** The current page: a Solid store, so reading `page.props.x` inside JSX or an effect is reactive. */\nexport const PageContext = createContext<Page>()\n\n/** The head manager of the running app (core's createHeadManager), used by Head. */\nexport const HeadContext = createContext<HeadManager>()\n","import { createHeadManager, router, type Page } from '@inertiajs/core'\nimport { batch, createComponent, createMemo, createSignal, mergeProps, untrack, type Component, type JSX } from 'solid-js'\nimport { createStore, reconcile } from 'solid-js/store'\nimport { isServer } from 'solid-js/web'\nimport { HeadContext, PageContext } from './context'\n\n// Page and layout props are the page's props, which each page types itself (PageProps<'Posts/Index'>).\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\ntype AnyProps = any\n\n/** A persistent layout: it gets the page props, and the page (or the next layout) as `children`. */\nexport type LayoutComponent = Component<AnyProps>\n\n/** A page component. `Home.layout = AppLayout` (or `[Outer, Inner]`) wraps it in layouts that survive visits. */\nexport type PageComponent = Component<AnyProps> & { layout?: LayoutComponent | LayoutComponent[] }\n\n/** What a resolver returns: the component, or its module (`{ default, layout? }`, e.g. `import('./pages/Home.tsx')`). */\nexport type PageModule = PageComponent | { default: PageComponent; layout?: LayoutComponent | LayoutComponent[] }\n\n/** Finds the page component for a name: `(name) => import(`./pages/${name}.tsx`)`. */\nexport type PageResolver = (name: string, page: Page) => PageModule | Promise<PageModule>\n\n/** A page ready to render: its component and its layouts, outermost first. */\nexport interface ResolvedPage {\n readonly component: PageComponent\n readonly layouts: readonly LayoutComponent[]\n}\n\n/** Resolves a page name to its component and layouts (a module's `layout` export wins over the component's). */\nexport async function resolvePage(resolve: PageResolver, name: string, page: Page): Promise<ResolvedPage> {\n // Nothing at all for an unknown name too, from a hand-written resolver such as `(name) => pages[name]`.\n const module: PageModule | null | undefined = await resolve(name, page)\n const component = typeof module === 'function' ? module : module?.default\n if (typeof component !== 'function') throw new Error(`The page [${name}] did not resolve to a Solid component.`)\n const layout = (typeof module === 'function' ? undefined : module?.layout) ?? component.layout\n return { component, layouts: layout === undefined ? [] : Array.isArray(layout) ? layout : [layout] }\n}\n\nexport interface InertiaAppProps {\n initialPage: Page\n initialComponent: ResolvedPage\n resolveComponent: (name: string, page?: Page) => Promise<ResolvedPage>\n /** Formats every page title (`(title) => `${title} - My App``). */\n titleCallback?: (title: string) => string\n /** Receives the head tags on the server (SSR collects them into `head`). */\n onHeadUpdate?: (elements: string[]) => void\n}\n\n/**\n * The Inertia root: owns the current page (a store, read through usePage()), lets the router swap pages, and\n * renders the page inside its layouts. A visit to another component, or one without preserveState, remounts the\n * page; layouts that stay the same between two pages are kept, with their state.\n */\nexport function App(props: InertiaAppProps): JSX.Element {\n // The store gets its own copy: reconcile() updates it in place, and core's page objects (history, prefetch cache)\n // must not change under it.\n const [page, setPage] = createStore<Page>(structuredClone({ ...props.initialPage, flash: props.initialPage.flash ?? {} }))\n const [view, setView] = createSignal<ResolvedPage>(props.initialComponent)\n const titleCallback = props.titleCallback ?? ((title: string) => title)\n const headManager = createHeadManager(isServer, titleCallback, props.onHeadUpdate ?? (() => undefined))\n\n if (!isServer) {\n router.init<ResolvedPage>({\n initialPage: props.initialPage,\n resolveComponent: props.resolveComponent as never,\n swapComponent: async ({ component, page: next, preserveState }) => {\n batch(() => {\n setPage(reconcile(structuredClone({ ...next, flash: next.flash ?? {} })))\n if (!preserveState || component.component !== view().component) setView(component)\n })\n },\n onFlash: (flash) => setPage('flash', reconcile(structuredClone(flash))),\n })\n }\n\n // One memo per layout level: a level is rebuilt only when its layout changes, so a shared layout persists.\n // Components get their props as a function source, not as `page.props` itself: reconcile() replaces the props\n // object (instead of merging into it) when the top-level `id` differs, and a held reference would go stale.\n const level = (index: number): JSX.Element => {\n const layout = createMemo(() => view().layouts[index])\n return createMemo(() => {\n const Layout = layout()\n if (Layout === undefined) {\n return createMemo(() => {\n const { component } = view()\n return untrack(() => createComponent(component, mergeProps(() => page.props)))\n }) as unknown as JSX.Element\n }\n // A layout gets the page props and the next level as children.\n const children = { get children() { return level(index + 1) } }\n return untrack(() => createComponent(Layout, mergeProps(() => page.props, children)))\n }) as unknown as JSX.Element\n }\n\n return createComponent(HeadContext.Provider, {\n value: headManager,\n get children() {\n return createComponent(PageContext.Provider, {\n value: page,\n get children() {\n return level(0)\n },\n })\n },\n })\n}\n","import {\n buildSSRBody,\n getInitialPageFromDOM,\n setupProgress,\n type CreateInertiaAppOptions as CoreAppOptions,\n type InertiaAppSSRResponse,\n type Page,\n type ProgressOptions,\n} from '@inertiajs/core'\nimport { createComponent } from 'solid-js'\nimport { generateHydrationScript, hydrate, isServer, render, renderToString } from 'solid-js/web'\nimport { App, resolvePage, type InertiaAppProps, type PageResolver } from './App'\n\n/** Renders one page on the server: what the SSR entry exports and `createServer()` serves. */\nexport type RenderPage = (page: Page) => Promise<InertiaAppSSRResponse>\n\n/** In the browser: unmounts the app. On the server: renders a page (see RenderPage). */\nexport type InertiaApp = (() => void) | RenderPage\n\nexport interface SetupOptions {\n el: HTMLElement\n App: typeof App\n props: InertiaAppProps\n}\n\nexport interface CreateInertiaAppOptions {\n /** The id of the root element and of the page script (default `app`). */\n id?: string\n /** Finds a page component by name: `(name) => import(`./pages/${name}.tsx`)`. */\n resolve?: PageResolver\n /** The @inertiajs/vite shorthand (`pages: './pages'`), which the plugin turns into `resolve` at build time. */\n pages?: CoreAppOptions<unknown, unknown, unknown, unknown>['pages']\n /** Mounts the app yourself (browser only); return a function that unmounts it. */\n setup?: (options: SetupOptions) => (() => void) | void\n /** Formats every page title. */\n title?: (title: string) => string\n /** The progress bar (core's NProgress-style bar); false turns it off. */\n progress?: ProgressOptions | false\n}\n\n/**\n * Starts the Inertia app. In the browser it reads the page script (`<script data-page=\"app\">`), resolves the page\n * and mounts App on `#app` (hydrating server-rendered markup), then resolves to a function that unmounts it. On the\n * server (Solid's server build) it resolves to the page renderer @inertiajs/vite's SSR entry exports.\n */\nexport async function createInertiaApp(options: CreateInertiaAppOptions = {}): Promise<InertiaApp> {\n const { id = 'app', resolve, setup, title, progress = {} } = options\n if (resolve === undefined) throw new Error('createInertiaApp() needs a `resolve` function (or `pages` with @inertiajs/vite).')\n const resolveComponent = (name: string, page: Page) => resolvePage(resolve, name, page)\n\n if (isServer) {\n return async (page: Page): Promise<InertiaAppSSRResponse> => {\n let head: string[] = []\n const props: InertiaAppProps = {\n initialPage: page,\n initialComponent: await resolveComponent(page.component, page),\n resolveComponent: (name, next) => resolveComponent(name, next ?? page),\n titleCallback: title,\n onHeadUpdate: (elements) => {\n head = elements\n },\n }\n const html = renderToString(() => createComponent(App, props))\n return { head: [...head, generateHydrationScript()], body: buildSSRBody(id, page, html) }\n }\n }\n\n const initialPage = getInitialPageFromDOM<Page>(id)\n const el = document.getElementById(id)\n if (initialPage === null || el === null) throw new Error(`No Inertia page found: expected <script data-page=\"${id}\"> and an element with id \"${id}\".`)\n const props: InertiaAppProps = {\n initialPage,\n initialComponent: await resolveComponent(initialPage.component, initialPage),\n resolveComponent: (name, page) => resolveComponent(name, page ?? initialPage),\n titleCallback: title,\n }\n if (progress !== false) setupProgress(progress)\n if (setup !== undefined) return setup({ el, App, props }) ?? (() => undefined)\n const app = () => createComponent(App, props)\n return el.hasAttribute('data-server-rendered') ? hydrate(app, el) : render(app, el)\n}\n","import {\n config,\n mergeDataIntoQueryString,\n router,\n shouldIntercept,\n type Method,\n type PrefetchOptions,\n type RequestPayload,\n type VisitOptions,\n} from '@inertiajs/core'\nimport type { LinkProps as OrielLinkProps } from '@orieljs/inertia-client'\nimport { createComponent, createMemo, mergeProps, onCleanup, onMount, splitProps, type JSX } from 'solid-js'\nimport { Dynamic } from 'solid-js/web'\n\n/** Link's props: Oriel's LinkProps, Inertia's visit callbacks and options, any attribute of the element, and children. */\nexport type LinkProps = OrielLinkProps &\n Pick<\n VisitOptions,\n | 'onCancelToken'\n | 'onBefore'\n | 'onStart'\n | 'onProgress'\n | 'onFinish'\n | 'onCancel'\n | 'onSuccess'\n | 'onError'\n | 'onPrefetching'\n | 'onPrefetched'\n | 'preserveUrl'\n | 'async'\n | 'queryStringArrayFormat'\n | 'viewTransition'\n > &\n Partial<PrefetchOptions> & {\n children?: JSX.Element\n onClick?: (event: MouseEvent) => void\n onMouseEnter?: (event: MouseEvent) => void\n onMouseLeave?: (event: MouseEvent) => void\n onMouseDown?: (event: MouseEvent) => void\n [attribute: string]: unknown\n }\n\nconst LINK_KEYS = [\n 'href',\n 'method',\n 'data',\n 'replace',\n 'preserveScroll',\n 'preserveState',\n 'preserveUrl',\n 'only',\n 'except',\n 'headers',\n 'queryStringArrayFormat',\n 'async',\n 'viewTransition',\n 'as',\n 'prefetch',\n 'cacheFor',\n 'cacheTags',\n 'children',\n 'onClick',\n 'onMouseEnter',\n 'onMouseLeave',\n 'onMouseDown',\n 'onCancelToken',\n 'onBefore',\n 'onStart',\n 'onProgress',\n 'onFinish',\n 'onCancel',\n 'onSuccess',\n 'onError',\n 'onPrefetching',\n 'onPrefetched',\n] as const\n\n/**\n * An Inertia link: `<Link href={route('posts.show', { post: 1 })}>`. A plain left click visits through the router\n * instead of loading the page; modified clicks (new tab) are left to the browser. A non-GET link renders a button.\n * `prefetch` (`true` = `'hover'`, `'click'`, `'mount'`) loads the page into core's prefetch cache ahead of the visit.\n * The visit callbacks (`onBefore`, `onSuccess`, …) and options (`preserveUrl`, `async`, …) go to the router.\n */\nexport function Link(props: LinkProps): JSX.Element {\n const [own, attributes] = splitProps(props, LINK_KEYS)\n const method = createMemo(() => (own.method ?? 'get').toLowerCase() as Method)\n const tag = createMemo(() => {\n const as = (own.as ?? 'a').toLowerCase()\n return as === 'a' && method() !== 'get' ? 'button' : as\n })\n const target = createMemo(() =>\n mergeDataIntoQueryString(method(), own.href, (own.data ?? {}) as RequestPayload, own.queryStringArrayFormat ?? 'brackets'),\n )\n const baseOptions = (): VisitOptions => ({\n data: target()[1] as VisitOptions['data'],\n method: method(),\n preserveScroll: own.preserveScroll ?? false,\n preserveState: own.preserveState ?? method() !== 'get',\n preserveUrl: own.preserveUrl ?? false,\n replace: own.replace ?? false,\n only: own.only ?? [],\n except: own.except ?? [],\n headers: own.headers ?? {},\n async: own.async ?? false,\n })\n const visitOptions = (): VisitOptions => ({\n ...baseOptions(),\n viewTransition: own.viewTransition ?? false,\n onCancelToken: own.onCancelToken,\n onBefore: own.onBefore,\n onStart: own.onStart,\n onProgress: own.onProgress,\n onFinish: own.onFinish,\n onCancel: own.onCancel,\n onSuccess: own.onSuccess,\n onError: own.onError,\n })\n const modes = createMemo(() => (own.prefetch === true ? ['hover'] : own.prefetch ? [own.prefetch] : []))\n // A click-only prefetch is used by the click that follows it, never cached for later.\n const cacheFor = () => {\n const value = own.cacheFor ?? 0\n if (value !== 0) return value\n return modes().length === 1 && modes()[0] === 'click' ? 0 : config.get('prefetch.cacheFor')\n }\n const prefetch = () => {\n if (method() !== 'get') return\n const options = { ...baseOptions(), onPrefetching: own.onPrefetching, onPrefetched: own.onPrefetched }\n router.prefetch(target()[0], options, { cacheFor: cacheFor(), cacheTags: own.cacheTags ?? [] })\n }\n let hoverTimer: ReturnType<typeof setTimeout> | undefined\n onMount(() => {\n if (modes().includes('mount')) prefetch()\n })\n onCleanup(() => clearTimeout(hoverTimer))\n\n return createComponent(\n Dynamic,\n mergeProps(attributes, {\n get component() {\n return tag()\n },\n get href() {\n return tag() === 'a' ? target()[0] : undefined\n },\n get type() {\n return tag() === 'button' ? 'button' : undefined\n },\n get children() {\n return own.children\n },\n onClick: (event: MouseEvent) => {\n // A click within the hover delay visits now: no prefetch after it.\n clearTimeout(hoverTimer)\n own.onClick?.(event)\n if (!shouldIntercept(event)) return\n event.preventDefault()\n router.visit(target()[0], visitOptions())\n },\n onMouseEnter: (event: MouseEvent) => {\n own.onMouseEnter?.(event)\n if (!modes().includes('hover')) return\n clearTimeout(hoverTimer)\n hoverTimer = setTimeout(prefetch, config.get('prefetch.hoverDelay'))\n },\n onMouseLeave: (event: MouseEvent) => {\n own.onMouseLeave?.(event)\n clearTimeout(hoverTimer)\n },\n onMouseDown: (event: MouseEvent) => {\n own.onMouseDown?.(event)\n if (modes().includes('click') && shouldIntercept(event)) prefetch()\n },\n }),\n )\n}\n","import { createForm, type FormHelper } from '@orieljs/inertia-client'\nimport { createSignal, getOwner, onCleanup } from 'solid-js'\n\n/** The form helper as a Solid signal source: reading a field inside JSX or an effect tracks it. */\nexport type SolidForm<T extends Record<string, unknown>> = Omit<FormHelper<T>, 'subscribe'>\n\nconst STATE = ['data', 'defaults', 'errors', 'hasErrors', 'isDirty', 'processing', 'progress', 'wasSuccessful', 'recentlySuccessful'] as const\n\n/**\n * A form bound to the Inertia router: `const form = useForm({ title: '' })`, then `form.data.title`,\n * `form.setData('title', value)`, `form.post(route('posts.store'))`, `form.errors.title`, `form.processing`.\n * Built on @orieljs/inertia-client's createForm (no remember, no Precognition). Reading a field is reactive.\n */\nexport function useForm<T extends Record<string, unknown>>(initial: T | (() => T)): SolidForm<T> {\n const helper = createForm(initial)\n const [version, bump] = createSignal(undefined, { equals: false })\n const unsubscribe = helper.subscribe(() => bump())\n if (getOwner() !== null) onCleanup(unsubscribe)\n\n const form = {} as Record<string, unknown>\n for (const key of STATE) {\n Object.defineProperty(form, key, {\n enumerable: true,\n get() {\n version()\n return helper[key]\n },\n })\n }\n for (const key of ['setData', 'setDefaults', 'reset', 'clearErrors', 'resetAndClearErrors', 'setError', 'transform', 'submit', 'get', 'post', 'put', 'patch', 'delete', 'cancel'] as const) {\n form[key] = helper[key]\n }\n return form as unknown as SolidForm<T>\n}\n","import { createComponent, createMemo, type JSX } from 'solid-js'\nimport { When } from './show'\nimport { usePage } from './usePage'\n\nexport interface DeferredProps {\n /** The deferred prop (or props) to wait for. */\n data: string | string[]\n /** Shown until every prop has arrived. */\n fallback: JSX.Element\n children?: JSX.Element\n}\n\n/** Renders `fallback` until the deferred props in `data` have loaded, then the children. */\nexport function Deferred(props: DeferredProps): JSX.Element {\n const page = usePage()\n const keys = createMemo(() => (Array.isArray(props.data) ? props.data : [props.data]))\n return createComponent(When, {\n get when() {\n return keys().every((key) => (page.props as Record<string, unknown>)[key] !== undefined)\n },\n get fallback() {\n return props.fallback\n },\n get children() {\n return props.children\n },\n })\n}\n","import { Show, type Component, type JSX } from 'solid-js'\n\n/** Show without its keyed overload, for createComponent() (the package has no JSX). */\nexport const When = Show as Component<{ when: boolean; fallback?: JSX.Element; children?: JSX.Element }>\n","import { router, type ReloadOptions } from '@inertiajs/core'\nimport { createComponent, createMemo, createSignal, onCleanup, type JSX } from 'solid-js'\nimport { Dynamic, isServer } from 'solid-js/web'\nimport { When } from './show'\nimport { usePage } from './usePage'\n\nexport interface WhenVisibleProps {\n /** The props to load (a partial reload with `only`) when the element scrolls into view. */\n data?: string | string[]\n /** Extra reload options. */\n params?: ReloadOptions\n /** Pixels around the viewport that count as visible (default 0). */\n buffer?: number\n /** The placeholder element's tag (default `div`). */\n as?: string\n /** Reload every time it becomes visible, not only the first time. */\n always?: boolean\n /** Shown until the props have loaded. */\n fallback?: JSX.Element\n children?: JSX.Element\n}\n\n/** Loads props when a placeholder scrolls into view (IntersectionObserver), showing `fallback` until then. */\nexport function WhenVisible(props: WhenVisibleProps): JSX.Element {\n const page = usePage()\n const keys = createMemo(() => (props.data === undefined ? [] : Array.isArray(props.data) ? props.data : [props.data]))\n const arrived = () => keys().length > 0 && keys().every((key) => (page.props as Record<string, unknown>)[key] !== undefined)\n const [loaded, setLoaded] = createSignal(false)\n let fetching = false\n let observer: IntersectionObserver | undefined\n onCleanup(() => observer?.disconnect())\n\n const observe = (element: Element) => {\n if (isServer) return\n observer?.disconnect()\n observer = new window.IntersectionObserver(\n (entries) => {\n if (entries[0]?.isIntersecting !== true || fetching) return\n if (props.always !== true) observer?.disconnect()\n fetching = true\n const params = props.params ?? {}\n // Validation errors stay: the response's (empty) errors must not clear the page's.\n router.reload({\n preserveErrors: true,\n ...params,\n ...(keys().length > 0 ? { only: keys() } : {}),\n onFinish: (visit) => {\n fetching = false\n setLoaded(true)\n params.onFinish?.(visit)\n },\n })\n },\n { rootMargin: `${props.buffer ?? 0}px` },\n )\n observer.observe(element)\n }\n\n const visible = () => loaded() || arrived()\n return [\n createComponent(When, {\n get when() {\n return props.always === true || !visible()\n },\n get children() {\n return createComponent(Dynamic, {\n get component() {\n return props.as ?? 'div'\n },\n ref: observe,\n })\n },\n }),\n createComponent(When, {\n get when() {\n return visible()\n },\n get fallback() {\n return props.fallback\n },\n get children() {\n return props.children\n },\n }),\n ] as unknown as JSX.Element\n}\n","import { children as resolveChildren, createRenderEffect, getOwner, onCleanup, runWithOwner, sharedConfig, useContext, type JSX } from 'solid-js'\nimport { insert, isServer, resolveSSRNode } from 'solid-js/web'\nimport { HeadContext } from './context'\n\nexport interface HeadProps {\n /** The page title (passed through createInertiaApp's `title` callback). */\n title?: string\n /** Head tags: `<meta>`, `<link>`, … A `head-key` attribute replaces the tag with the same key from a layout. */\n children?: JSX.Element\n}\n\nconst escapeHtml = (value: string) => value.replace(/&/g, '&').replace(/</g, '<').replace(/>/g, '>').replace(/\"/g, '"')\n\n// A tag's name and attributes. Values are double-quoted (Solid's server output, outerHTML), so they may hold `>`.\nconst OPENING_TAG = /^<([a-zA-Z][\\w-]*)((?:\\s+[^\\s\"'>/=]+(?:=\"[^\"]*\")?)*)/\nconst ATTRIBUTE = /\\s+([^\\s\"'>/=]+)(?:=\"([^\"]*)\")?/g\n\n/** One tag as the head manager wants it: marked `data-inertia` (the `head-key`, or empty), no hydration key. */\nfunction markTag(html: string): string {\n const tag = OPENING_TAG.exec(html)\n if (tag === null) return html\n let key: string | undefined\n let marked = false\n const attributes = (tag[2] ?? '').replace(ATTRIBUTE, (attribute, name: string, value: string | undefined) => {\n if (name === 'data-hk') return ''\n if (name === 'head-key') {\n key = value ?? ''\n return ''\n }\n if (name === 'data-inertia') marked = true\n return attribute\n })\n const mark = key !== undefined ? ` data-inertia=\"${key}\"` : marked ? '' : ' data-inertia=\"\"'\n return `<${tag[1]}${mark}${attributes}${html.slice(tag[0].length)}`\n}\n\n/**\n * Sets the document title and head tags for the current page through core's head manager:\n * `<Head title=\"Posts\"><meta name=\"description\" content=\"…\" /></Head>`. On the server the tags go into the SSR\n * response's `head`; in the browser they replace the previous page's tags.\n */\nexport function Head(props: HeadProps): JSX.Element {\n const manager = useContext(HeadContext)\n if (manager === undefined) throw new Error('<Head> must be rendered inside the Inertia app (createInertiaApp).')\n const provider = manager.createProvider()\n // Not on the server: disposing the render root would run this and wipe the head before the response reads it.\n if (!isServer) onCleanup(() => provider.disconnect())\n const title = () => (props.title === undefined ? [] : [`<title data-inertia=\"\">${escapeHtml(props.title)}</title>`])\n\n if (isServer) {\n const tags = resolveChildren(() => props.children)\n .toArray()\n .map((node) => resolveSSRNode(node))\n .filter((html) => html.startsWith('<'))\n provider.update([...title(), ...tags.map(markTag)])\n return null\n }\n\n // In the browser the tags render into a detached element, so Solid keeps their attributes up to date; every\n // change is sent to the head manager. Never while hydrating: the server sent no markup for them.\n const owner = getOwner()\n const start = () => {\n const container = document.createElement('div')\n const commit = () => provider.update([...title(), ...Array.from(container.children, (element) => markTag(element.outerHTML))])\n const observer = new window.MutationObserver(commit)\n observer.observe(container, { subtree: true, childList: true, attributes: true, characterData: true })\n onCleanup(() => observer.disconnect())\n insert(container, () => props.children)\n createRenderEffect(commit)\n }\n if (sharedConfig.context) queueMicrotask(() => runWithOwner(owner, start))\n else start()\n return null\n}\n"],"mappings":";AAAA,SAAS,UAAAA,eAAc;AACvB;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OAUK;;;ACfP,SAAS,kBAAkB;;;ACA3B,SAAS,qBAAqB;AAGvB,IAAM,cAAc,cAAoB;AAGxC,IAAM,cAAc,cAA2B;;;ADC/C,SAAS,UAAuD;AACrE,QAAM,OAAO,WAAW,WAAW;AACnC,MAAI,SAAS,OAAW,OAAM,IAAI,MAAM,6EAA6E;AACrH,SAAO;AACT;;;AEZA,SAAS,mBAAmB,cAAyB;AACrD,SAAS,OAAO,iBAAiB,YAAY,cAAc,YAAY,eAAyC;AAChH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C,CAAC;AAClD,WAAO;AAAA,EACT;AAIA,QAAM,QAAQE,UAAS;AACvB,QAAM,QAAQ,MAAM;AAClB,UAAM,YAAY,SAAS,cAAc,KAAK;AAC9C,UAAM,SAAS,MAAM,SAAS,OAAO,CAAC,GAAG,MAAM,GAAG,GAAG,MAAM,KAAK,UAAU,UAAU,CAAC,YAAY,QAAQ,QAAQ,SAAS,CAAC,CAAC,CAAC;AAC7H,UAAM,WAAW,IAAI,OAAO,iBAAiB,MAAM;AACnD,aAAS,QAAQ,WAAW,EAAE,SAAS,MAAM,WAAW,MAAM,YAAY,MAAM,eAAe,KAAK,CAAC;AACrG,IAAAD,WAAU,MAAM,SAAS,WAAW,CAAC;AACrC,WAAO,WAAW,MAAM,MAAM,QAAQ;AACtC,uBAAmB,MAAM;AAAA,EAC3B;AACA,MAAI,aAAa,QAAS,gBAAe,MAAM,aAAa,OAAO,KAAK,CAAC;AAAA,MACpE,OAAM;AACX,SAAO;AACT;","names":["router","createComponent","isServer","isServer","props","createComponent","router","createComponent","createMemo","mergeProps","createSignal","onCleanup","createComponent","createMemo","createMemo","createComponent","router","createComponent","createMemo","createSignal","onCleanup","Dynamic","isServer","createMemo","createSignal","onCleanup","isServer","router","createComponent","Dynamic","getOwner","onCleanup","useContext","isServer","useContext","isServer","onCleanup","getOwner"]}
|
package/dist/server.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default } from '@inertiajs/core/server';
|
package/dist/server.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../server.ts"],"sourcesContent":["/** The SSR server (`createServer(render)`), as @inertiajs/vite's Solid SSR entry imports it. */\nexport { default } from '@inertiajs/core/server'\n"],"mappings":";AACA,SAAS,WAAAA,gBAAe;","names":["default"]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,49 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@orieljs/inertia-solid",
|
|
3
|
-
"version": "0.
|
|
4
|
-
"
|
|
5
|
-
"
|
|
3
|
+
"version": "0.1.0-alpha.3",
|
|
4
|
+
"description": "The Oriel Solid adapter for Inertia: createInertiaApp, Link, Head, useForm and typed pages, with SSR and hydration.",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"license": "Apache-2.0",
|
|
7
|
+
"homepage": "https://orieljs.vercel.app",
|
|
8
|
+
"sideEffects": false,
|
|
9
|
+
"repository": {
|
|
10
|
+
"type": "git",
|
|
11
|
+
"url": "git+https://github.com/orieljs/framework.git",
|
|
12
|
+
"directory": "src/Oriel/InertiaSolid"
|
|
13
|
+
},
|
|
14
|
+
"engines": {
|
|
15
|
+
"node": ">=22"
|
|
16
|
+
},
|
|
17
|
+
"types": "./dist/index.d.ts",
|
|
18
|
+
"exports": {
|
|
19
|
+
".": {
|
|
20
|
+
"types": "./dist/index.d.ts",
|
|
21
|
+
"import": "./dist/index.js"
|
|
22
|
+
},
|
|
23
|
+
"./server": {
|
|
24
|
+
"types": "./dist/server.d.ts",
|
|
25
|
+
"import": "./dist/server.js"
|
|
26
|
+
}
|
|
27
|
+
},
|
|
28
|
+
"publishConfig": {
|
|
29
|
+
"access": "public"
|
|
30
|
+
},
|
|
31
|
+
"files": [
|
|
32
|
+
"dist",
|
|
33
|
+
"LICENSE",
|
|
34
|
+
"NOTICE"
|
|
35
|
+
],
|
|
36
|
+
"dependencies": {
|
|
37
|
+
"@inertiajs/core": "3.7.1",
|
|
38
|
+
"@orieljs/inertia-client": "0.1.0-alpha.3"
|
|
39
|
+
},
|
|
40
|
+
"peerDependencies": {
|
|
41
|
+
"solid-js": "^1.9.0"
|
|
42
|
+
},
|
|
43
|
+
"devDependencies": {
|
|
44
|
+
"solid-js": "1.9.15"
|
|
45
|
+
},
|
|
46
|
+
"scripts": {
|
|
47
|
+
"build": "tsup && node ../../../scripts/copy-license.mjs"
|
|
48
|
+
}
|
|
6
49
|
}
|