@tailorkit/app 0.1.0-beta.33 → 0.1.0-beta.35
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/README.md +5 -5
- package/dist/{chunk-UDXPIO6D.js → chunk-2JZOHWYW.js} +5 -0
- package/dist/client.js +1 -1
- package/dist/index.js +1 -1
- package/dist/routing.d.ts +1 -0
- package/dist/views.d.ts +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -15,7 +15,7 @@ src/
|
|
|
15
15
|
panel/
|
|
16
16
|
root.tsx
|
|
17
17
|
layout.tsx
|
|
18
|
-
|
|
18
|
+
index.view.tsx
|
|
19
19
|
customers.view.tsx
|
|
20
20
|
customers.layout.tsx
|
|
21
21
|
customers.details.view.tsx
|
|
@@ -33,10 +33,10 @@ import CustomerCard from "./customer-card";
|
|
|
33
33
|
export default defineView({ component: CustomerCard });
|
|
34
34
|
```
|
|
35
35
|
|
|
36
|
-
The builder supplies the slot and route before compiling.
|
|
36
|
+
The builder supplies the slot and route before compiling. An explicit `view` must match the file path and gives precise host context typing:
|
|
37
37
|
|
|
38
38
|
```tsx
|
|
39
|
-
// src/slots/panel/
|
|
39
|
+
// src/slots/panel/index.view.tsx
|
|
40
40
|
import { defineView } from "tailorkit/client";
|
|
41
41
|
|
|
42
42
|
const view = defineView({ view: "/", component: Home });
|
|
@@ -49,7 +49,7 @@ function Home() {
|
|
|
49
49
|
export default view;
|
|
50
50
|
```
|
|
51
51
|
|
|
52
|
-
|
|
52
|
+
`index.view.tsx` maps to `/`. A final `index` segment is omitted, so `customers/index.view.tsx` and `customers.index.view.tsx` both map to `/customers`. Other segments stay literal: `index.details.view.tsx` maps to `/index/details`. An explicit `view` or `slot` must be a matching string literal; mismatches fail the build. Use named properties in the inline `defineView` options so the build can check them. Multi-instance views provide `instances: { dataSchema, resolve }`; resolvers are extracted into the private server bundle. Host slot/view support and multiplicity are validated when publishing. An explicit slot also retains the source-level TypeScript checks for that slot's supported views and instances.
|
|
53
53
|
|
|
54
54
|
## Roots and layouts
|
|
55
55
|
|
|
@@ -71,7 +71,7 @@ export default defineRoute({ shellComponent: Shell });
|
|
|
71
71
|
|
|
72
72
|
Each slot can also have a `root.tsx` exporting `defineRoute({ shellComponent })`. It wraps every view in that slot, inside the app shell. A shell can render its `children` prop instead of `<Route />`.
|
|
73
73
|
|
|
74
|
-
`layout.tsx` wraps the entire slot. `customers.layout.tsx` wraps `/customers` and its descendants, with matching at segment boundaries.
|
|
74
|
+
`layout.tsx` wraps its directory path: at the slot root it wraps the entire slot; `members/layout.tsx` wraps `/members` and its descendants. `customers.layout.tsx` wraps `/customers` and its descendants, with matching at segment boundaries. Unlike view paths, layout paths retain a final `index` segment: `index.layout.tsx` maps to `/index`, and `members/index.layout.tsx` maps to `/members/index`. Layouts do not register views themselves. A layout default-exports an ordinary component (or a `defineRoute({ shellComponent })` definition):
|
|
75
75
|
|
|
76
76
|
```tsx
|
|
77
77
|
import { Route } from "tailorkit/client";
|
|
@@ -496,6 +496,11 @@ var createFileClient = (options) => {
|
|
|
496
496
|
`${module.filename} declares slot "${view.slot}" but is in "${module.slot}".`
|
|
497
497
|
);
|
|
498
498
|
}
|
|
499
|
+
if (view.path !== module.path) {
|
|
500
|
+
throw new Error(
|
|
501
|
+
`${module.filename} declares view "${view.path}" but its file location requires "${module.path}".`
|
|
502
|
+
);
|
|
503
|
+
}
|
|
499
504
|
definitions[module.slot] ??= /* @__PURE__ */ Object.create(null);
|
|
500
505
|
const slot = definitions[module.slot];
|
|
501
506
|
if (slot === void 0) {
|
package/dist/client.js
CHANGED
package/dist/index.js
CHANGED
package/dist/routing.d.ts
CHANGED
package/dist/views.d.ts
CHANGED
|
@@ -109,7 +109,7 @@ type ViewOptions<TPath extends AppViewPath, TSlot extends SlotName, TSchema exte
|
|
|
109
109
|
});
|
|
110
110
|
}[TSlot];
|
|
111
111
|
/** In .view.tsx files, the builder supplies the slot and filename-derived path.
|
|
112
|
-
*
|
|
112
|
+
* An explicit view must match the file path and provides precise host context typing. */
|
|
113
113
|
export declare function defineView<const TPath extends AppViewPath = AppViewPath, TSchema extends z.ZodType = z.ZodType>(options: {
|
|
114
114
|
slot?: never;
|
|
115
115
|
view?: TPath;
|