@solidjs/start 0.4.1 → 0.4.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.
@@ -0,0 +1,60 @@
1
+ import {
2
+ ErrorBoundary,
3
+ Show,
4
+ createEffect,
5
+ createSignal,
6
+ onCleanup,
7
+ resetErrorBoundaries,
8
+ type JSX
9
+ } from "solid-js";
10
+ import { HttpStatusCode } from "../HttpStatusCode";
11
+ import clientOnly from "../clientOnly";
12
+
13
+ export interface DevOverlayProps {
14
+ children?: JSX.Element;
15
+ }
16
+
17
+ const DevOverlayDialog = /* #__PURE__ */ clientOnly(() => import("./DevOverlayDialog"));
18
+
19
+ export function DevOverlay(props: DevOverlayProps): JSX.Element {
20
+ const [errors, setErrors] = createSignal<unknown[]>([]);
21
+
22
+ function resetError() {
23
+ setErrors([]);
24
+ resetErrorBoundaries();
25
+ }
26
+
27
+ function pushError(error: unknown) {
28
+ console.error(error);
29
+ setErrors(current => [error, ...current]);
30
+ }
31
+
32
+ createEffect(() => {
33
+ const onErrorEvent = (error: ErrorEvent) => {
34
+ pushError(error.error);
35
+ };
36
+
37
+ window.addEventListener("error", onErrorEvent);
38
+
39
+ onCleanup(() => {
40
+ window.removeEventListener("error", onErrorEvent);
41
+ });
42
+ });
43
+
44
+ return (
45
+ <>
46
+ <ErrorBoundary
47
+ fallback={error => {
48
+ pushError(error);
49
+ return <HttpStatusCode code={500} />;
50
+ }}
51
+ >
52
+ {props.children}
53
+ </ErrorBoundary>
54
+ <Show when={errors().length}>
55
+ <HttpStatusCode code={500} />
56
+ <DevOverlayDialog errors={errors()} resetError={resetError} />
57
+ </Show>
58
+ </>
59
+ );
60
+ }
@@ -0,0 +1,287 @@
1
+ .dev-overlay {
2
+ position: fixed;
3
+ inset: 0px;
4
+ z-index: 50;
5
+ overflow-y: auto;
6
+ }
7
+
8
+ .dev-overlay>div {
9
+ position: relative;
10
+ display: flex;
11
+ align-items: center;
12
+ justify-content: center;
13
+ min-height: 100vh;
14
+ }
15
+
16
+ .dev-overlay-background {
17
+ position: absolute;
18
+ inset: 0px;
19
+ background-color: rgb(17 24 39 / 0.5);
20
+ }
21
+
22
+ .dev-overlay-panel {
23
+ display: flex;
24
+ flex-direction: column;
25
+ width: 75vw;
26
+ margin-top: 2rem;
27
+ margin-bottom: 2rem;
28
+ z-index: 10;
29
+ gap: 0.5rem;
30
+ }
31
+
32
+ .dev-overlay-navbar {
33
+ display: flex;
34
+ flex-direction: row;
35
+ align-items: center;
36
+ justify-content: space-between;
37
+ gap: 0.5rem;
38
+ }
39
+
40
+ .dev-overlay-pagination {
41
+ display: flex;
42
+ flex-direction: row;
43
+ align-items: center;
44
+ justify-content: center;
45
+ gap: 0.5rem;
46
+ border-radius: 9999px;
47
+ background-color: rgb(249 250 251);
48
+ padding: 0.25rem;
49
+ }
50
+
51
+ .dev-overlay-button {
52
+ display: flex;
53
+ padding: 0.125rem;
54
+ border-radius: 9999px;
55
+ border-width: 0px;
56
+ align-items: center;
57
+ justify-content: center;
58
+ background-color: rgb(249 250 251);
59
+ color: rgb(17 24 39);
60
+ transition-property: color, background-color, border-color, box-shadow;
61
+ transition-timing-function: cubic-bezier(0.4, 0, 0.2, 1);
62
+ transition-duration: 150ms;
63
+ }
64
+
65
+ .dev-overlay-button:hover {
66
+ background-color: rgb(229 231 235);
67
+ color: rgb(55 65 81);
68
+ }
69
+
70
+ .dev-overlay-button:focus {
71
+ outline: 2px solid transparent;
72
+ outline-offset: 2px
73
+ }
74
+
75
+ .dev-overlay-button:focus-visible {
76
+ box-shadow: 0 0 0 calc(3px) rgb(17 24 39 / 0.75);
77
+ }
78
+
79
+ .dev-overlay-button:active {
80
+ background-color: rgb(243 244 246);
81
+ color: rgb(31 41 55);
82
+ }
83
+
84
+ .dev-overlay-button>svg {
85
+ height: 1.5rem;
86
+ width: 1.5rem;
87
+ }
88
+
89
+ .dev-overlay-page-counter {
90
+ font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
91
+ font-size: 0.875rem;
92
+ line-height: 1.25rem;
93
+ font-weight: 600;
94
+ }
95
+
96
+ .dev-overlay-navbar-left {
97
+ display: flex;
98
+ flex-direction: row;
99
+ gap: 0.5rem;
100
+ }
101
+
102
+
103
+ .dev-overlay-controls {
104
+ display: flex;
105
+ flex-direction: row;
106
+ align-items: center;
107
+ justify-content: center;
108
+ gap: 0.25rem;
109
+ border-radius: 9999px;
110
+ background-color: rgb(249 250 251);
111
+ padding: 0.25rem;
112
+ }
113
+
114
+ .dev-overlay-version {
115
+ display: flex;
116
+ flex-direction: row;
117
+ align-items: center;
118
+ justify-content: center;
119
+ gap: 0.25rem;
120
+ border-radius: 9999px;
121
+ background-color: rgb(249 250 251);
122
+ padding: 0.25rem 0.5rem;
123
+ font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
124
+ font-size: 0.875rem;
125
+ line-height: 1.25rem;
126
+ font-weight: 600;
127
+ }
128
+
129
+ .dev-overlay-version>div {
130
+ height: 1.5rem;
131
+ width: 1.5rem;
132
+ }
133
+
134
+ .dev-overlay-version>div>svg {
135
+ height: 1.5rem;
136
+ width: 1.5rem;
137
+ }
138
+
139
+ .dev-overlay-content {
140
+ display: flex;
141
+ flex-direction: column;
142
+ gap: 0.75rem;
143
+ border-radius: 1.5rem;
144
+ background-color: rgb(249 250 251);
145
+ padding: 1rem;
146
+ }
147
+
148
+ .dev-overlay-error-info {
149
+ font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
150
+ display: flex;
151
+ flex-direction: column;
152
+ gap: 0.25rem;
153
+ }
154
+
155
+ .dev-overlay-error-info-name {
156
+ font-weight: 700;
157
+ }
158
+
159
+ .dev-overlay-error-info-message {
160
+ font-size: 1.5rem;
161
+ line-height: 2rem;
162
+ color: rgb(239 68 68);
163
+ font-weight: 700;
164
+ }
165
+
166
+ .dev-overlay-stack-frames-content {
167
+ display: flex;
168
+ flex-direction: column;
169
+ gap: 0.75rem;
170
+ }
171
+
172
+ .dev-overlay-stack-frames {
173
+ flex: 1 1 0%;
174
+ display: flex;
175
+ flex-direction: column;
176
+ margin: 0;
177
+ margin-block: 0;
178
+ list-style-type: none;
179
+ padding-inline: 0;
180
+ max-height: 16rem;
181
+ overflow-y: auto;
182
+ border-radius: 0.5rem;
183
+ }
184
+
185
+ .dev-overlay-stack-frame {
186
+ display: flex;
187
+ flex-direction: row;
188
+ align-items: center;
189
+ justify-content: space-between;
190
+ gap: 1rem;
191
+ color: rgb(17 24 39);
192
+ cursor: default;
193
+ user-select: none;
194
+ padding-top: 0.5rem;
195
+ padding-bottom: 0.5rem;
196
+ padding-left: 1rem;
197
+ padding-right: 1rem;
198
+ font-size: 0.875rem;
199
+ line-height: 1.25rem;
200
+ outline: none;
201
+ }
202
+
203
+ .dev-overlay-stack-frame[tc-active],
204
+ .dev-overlay-stack-frame[tc-selected],
205
+ .dev-overlay-stack-frame:focus {
206
+ background-color: rgb(219 234 254);
207
+ color: rgb(30 58 138);
208
+ }
209
+
210
+ .dev-overlay-stack-frame-function {
211
+ font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
212
+ font-weight: 700;
213
+ }
214
+
215
+ .dev-overlay-stack-frame-file {
216
+ white-space: nowrap;
217
+ font-size: 0.75rem;
218
+ /* 12px */
219
+ line-height: 1rem;
220
+ /* 16px */
221
+ }
222
+
223
+ .dev-overlay-stack-frames-code {
224
+ padding: 0.5rem 1rem;
225
+ gap: 0.25rem;
226
+ flex: 1 1 0%;
227
+ display: flex;
228
+ flex-direction: column;
229
+ align-items: center;
230
+ justify-content: center;
231
+ border-radius: 0.5rem;
232
+ background-color: rgb(17 24 39);
233
+ }
234
+
235
+ .dev-overlay-stack-frames-code-fallback {
236
+ display: flex;
237
+ align-items: center;
238
+ justify-content: center;
239
+ color: rgb(249 250 251);
240
+ min-height: 16rem;
241
+ font-size: 0.875rem;
242
+ line-height: 1.25rem;
243
+ }
244
+
245
+ .dev-overlay-stack-frames-code-source {
246
+ font-size: 0.875rem;
247
+ line-height: 1.25rem;
248
+ font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
249
+ color: rgb(249 250 251);
250
+ }
251
+
252
+ .dev-overlay-stack-frames-code-container {
253
+ width: 100%;
254
+ overflow: hidden;
255
+ min-width: 100%;
256
+ min-height: 16rem;
257
+ border-top-width: 1px;
258
+ border-top-style: solid;
259
+ border-top-color: rgb(249 250 251);
260
+ }
261
+
262
+ .dev-overlay-code-view {
263
+ overflow: auto;
264
+ min-width: 100%;
265
+ min-height: 16rem;
266
+ }
267
+
268
+ .dev-overlay-code-view>.shiki {
269
+ float: left;
270
+ min-width: 100%;
271
+ overflow-x: auto;
272
+ font-size: 0.75rem;
273
+ line-height: 1rem;
274
+ counter-reset: step;
275
+ counter-increment: step calc(var(--dev-overlay-code-view-start, 1) - 1);
276
+ background-color: transparent !important;
277
+ }
278
+
279
+ .dev-overlay-code-view>.shiki .line::before {
280
+ content: counter(step);
281
+ counter-increment: step;
282
+ width: 1rem;
283
+ margin-right: 1.5rem;
284
+ display: inline-block;
285
+ text-align: right;
286
+ color: rgba(115, 138, 148, .4)
287
+ }
package/shared/routes.ts CHANGED
@@ -138,7 +138,6 @@ function expandOptionals(pattern: string): string[] {
138
138
 
139
139
  function routeToMatchRoute(route: Route): MatchRoute {
140
140
  const segments = route.path.split("/").filter(Boolean);
141
-
142
141
  const params: { type: "*" | ":"; name: string; index: number }[] = [];
143
142
  const matchSegments: (string | null)[] = [];
144
143
  let score = 0;
@@ -164,7 +163,9 @@ function routeToMatchRoute(route: Route): MatchRoute {
164
163
  wildcard = true;
165
164
  } else {
166
165
  score += 4;
167
- matchSegments.push(segment);
166
+ if (!segment.match(/^\(.+\)$/)) {
167
+ matchSegments.push(segment);
168
+ }
168
169
  }
169
170
  }
170
171