@tailorkit/app 0.1.0-beta.34 → 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 CHANGED
@@ -15,7 +15,7 @@ src/
15
15
  panel/
16
16
  root.tsx
17
17
  layout.tsx
18
- home.view.tsx
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. You can keep an explicit `view` to override the filename and infer the precise host context type:
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/home.view.tsx
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
- There are no special view filenames: `index.view.tsx` maps to `/index`. Use a descriptive filename with `view: "/"` for the slot's home view. An explicit slot, if supplied, must match the containing slot directory. Multi-instance views still 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.
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. Layouts follow the resolved view path, including an explicit `view` override. They do not register views themselves. A layout default-exports an ordinary component (or a `defineRoute({ shellComponent })` definition):
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
@@ -9,7 +9,7 @@ import {
9
9
  useAction,
10
10
  useMutation,
11
11
  useQuery
12
- } from "./chunk-UDXPIO6D.js";
12
+ } from "./chunk-2JZOHWYW.js";
13
13
  import {
14
14
  createApi,
15
15
  createClient,
package/dist/index.js CHANGED
@@ -9,7 +9,7 @@ import {
9
9
  useAction,
10
10
  useMutation,
11
11
  useQuery
12
- } from "./chunk-UDXPIO6D.js";
12
+ } from "./chunk-2JZOHWYW.js";
13
13
  import {
14
14
  createApi,
15
15
  createClient,
package/dist/routing.d.ts CHANGED
@@ -16,6 +16,7 @@ export interface RouteModule {
16
16
  }
17
17
  export interface FileViewModule extends RouteModule {
18
18
  slot: string;
19
+ path: string;
19
20
  }
20
21
  export interface FileLayoutModule extends RouteModule {
21
22
  slot: string;
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
- * Keep an explicit view for a custom path and precise host context typing. */
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;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tailorkit/app",
3
- "version": "0.1.0-beta.34",
3
+ "version": "0.1.0-beta.35",
4
4
  "license": "Apache-2.0",
5
5
  "repository": {
6
6
  "type": "git",