@jfdevelops/react-layout 0.19.0 → 0.21.0
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/dist/create-config/define-layout.cjs +180 -3
- package/dist/create-config/define-layout.cjs.map +1 -1
- package/dist/create-config/define-layout.d.cts +214 -33
- package/dist/create-config/define-layout.d.cts.map +1 -1
- package/dist/create-config/define-layout.d.mts +214 -33
- package/dist/create-config/define-layout.d.mts.map +1 -1
- package/dist/create-config/define-layout.mjs +181 -4
- package/dist/create-config/define-layout.mjs.map +1 -1
- package/dist/create-config/for-resources/create-component.d.mts +1 -1
- package/dist/create-config/for-resources/create-for-resources.cjs +1 -1
- package/dist/create-config/for-resources/create-for-resources.mjs +1 -1
- package/dist/create-config/index.d.cts +2 -1
- package/dist/create-config/index.d.mts +2 -1
- package/dist/create-config/shell-context.cjs +22 -0
- package/dist/create-config/shell-context.cjs.map +1 -0
- package/dist/create-config/shell-context.d.cts +18 -0
- package/dist/create-config/shell-context.d.cts.map +1 -0
- package/dist/create-config/shell-context.d.mts +18 -0
- package/dist/create-config/shell-context.d.mts.map +1 -0
- package/dist/create-config/shell-context.mjs +21 -0
- package/dist/create-config/shell-context.mjs.map +1 -0
- package/dist/index.d.cts +4 -3
- package/dist/index.d.mts +4 -3
- package/dist/resource.cjs.map +1 -1
- package/dist/resource.d.cts +1 -1
- package/dist/resource.d.cts.map +1 -1
- package/dist/resource.d.mts +2 -2
- package/dist/resource.d.mts.map +1 -1
- package/dist/resource.mjs.map +1 -1
- package/package.json +1 -1
- package/skills/build-react-layouts/SKILL.md +4 -0
- package/skills/build-react-layouts/references/architecture.md +92 -0
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { BaseComponent, Show } from "../utils.cjs";
|
|
2
|
-
import { LayoutResourceKey, ResourceDefinition } from "../resource.cjs";
|
|
2
|
+
import { LayoutResourceKey, ResourceDefinition, ResourceDefinitionValue } from "../resource.cjs";
|
|
3
3
|
import { InPropsDefinition, InPropsObject, IncludedProps, InferredInProps, LayoutRenderProps, MergedLayoutInProps, ResolvedIncludedComponentProps, ResolvedIncludedConfigProps } from "../props.cjs";
|
|
4
4
|
import { AssertUnreservedResources } from "./types.cjs";
|
|
5
5
|
import { CreateResourceConfigFn } from "./get-component.cjs";
|
|
@@ -7,7 +7,7 @@ import { CreateResourceLinksFn } from "./create-resource-links.cjs";
|
|
|
7
7
|
import { CreateLayoutForResource, CreateResourceLayoutOptions, CreateResourceLayoutOptionsBase } from "./for-resource.cjs";
|
|
8
8
|
import { CreateResourceLayoutForResourcesFn } from "./for-resources/scoped-layout.cjs";
|
|
9
9
|
import { ComposableComponents, ComposableResourceLayout, CreateLayoutComposable, MakeComposable, RequiredPresetLayoutProps } from "@jfdevelops/react-layout-composables";
|
|
10
|
-
import { JSX } from "react";
|
|
10
|
+
import { JSX, ReactNode } from "react";
|
|
11
11
|
import { ResolveLayoutProps, ResolveProps } from "@jfdevelops/react-layout-validator";
|
|
12
12
|
|
|
13
13
|
//#region src/create-config/define-layout.d.ts
|
|
@@ -39,19 +39,45 @@ type LayoutRenderContext<Resources extends ReadonlyArray<ResourceDefinition>, Co
|
|
|
39
39
|
resources: LayoutRenderResourcesAccessor<Resources>;
|
|
40
40
|
name: string;
|
|
41
41
|
};
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
}
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
42
|
+
/**
|
|
43
|
+
* A single {@link ResourceDefinition} kept by a `pick`, or `never` when it does
|
|
44
|
+
* not match. Widened definitions (`string`, `{ value: string }`) are always
|
|
45
|
+
* kept — the concrete keys are not known statically, so the runtime filter is
|
|
46
|
+
* the source of truth.
|
|
47
|
+
*/
|
|
48
|
+
type PickResourceDefinition<Definition, Keys extends string> = Definition extends ResourceDefinition ? string extends ResourceDefinitionValue<Definition> ? Definition : ResourceDefinitionValue<Definition> extends Keys ? Definition : never : never;
|
|
49
|
+
type PickResourceDefinitions<Resources extends ReadonlyArray<ResourceDefinition>, Keys extends LayoutResourceKey<Resources>> = Array<PickResourceDefinition<Resources[number], Keys>>;
|
|
50
|
+
/**
|
|
51
|
+
* A single {@link ResourceDefinition} kept by an `omit`, or `never` when it is
|
|
52
|
+
* one of the omitted keys. Widened definitions are always kept.
|
|
53
|
+
*/
|
|
54
|
+
type OmitResourceDefinition<Definition, Keys extends string> = Definition extends ResourceDefinition ? string extends ResourceDefinitionValue<Definition> ? Definition : ResourceDefinitionValue<Definition> extends Keys ? never : Definition : never;
|
|
55
|
+
type OmitResourceDefinitions<Resources extends ReadonlyArray<ResourceDefinition>, Keys extends LayoutResourceKey<Resources>> = Array<OmitResourceDefinition<Resources[number], Keys>>;
|
|
56
|
+
/**
|
|
57
|
+
* The result of `resources.pick(...)` / `resources.omit(...)`.
|
|
58
|
+
*
|
|
59
|
+
* - calling it returns the selected resource definitions.
|
|
60
|
+
* - `.isResource(value)` narrows an unknown value to one of the selected keys.
|
|
61
|
+
*/
|
|
62
|
+
type ResourceSelection<Definitions extends ReadonlyArray<ResourceDefinition>> = {
|
|
63
|
+
/** Returns the selected resource definitions. */(): Show<Definitions>;
|
|
64
|
+
/**
|
|
65
|
+
* Narrows an unknown value to one of the selected resource keys.
|
|
66
|
+
*
|
|
67
|
+
* @param value - The value to test.
|
|
68
|
+
*/
|
|
69
|
+
isResource(value: unknown): value is LayoutResourceKey<Definitions>;
|
|
70
|
+
};
|
|
48
71
|
/**
|
|
49
72
|
* Accessor for the resources bound to a `defineResourceLayout` definition.
|
|
50
73
|
*
|
|
51
74
|
* - `resources()` returns the raw resources.
|
|
52
|
-
* - `resources.omit(...
|
|
53
|
-
* - `resources.pick(...
|
|
75
|
+
* - `resources.omit(key, ...rest)` selects every resource except the named ones.
|
|
76
|
+
* - `resources.pick(key, ...rest)` selects only the named resources.
|
|
54
77
|
* - `resources.isResource(value)` narrows an unknown value to a resource key.
|
|
78
|
+
*
|
|
79
|
+
* `pick` / `omit` return a {@link ResourceSelection} thunk: call it for the
|
|
80
|
+
* definitions, or use its `isResource` guard.
|
|
55
81
|
*/
|
|
56
82
|
type LayoutResourcesAccessor<Resources extends ReadonlyArray<ResourceDefinition>> = {
|
|
57
83
|
/**
|
|
@@ -67,19 +93,18 @@ type LayoutResourcesAccessor<Resources extends ReadonlyArray<ResourceDefinition>
|
|
|
67
93
|
*/
|
|
68
94
|
isResource(value: unknown): value is LayoutResourceKey<Resources>;
|
|
69
95
|
/**
|
|
70
|
-
*
|
|
71
|
-
*
|
|
96
|
+
* Selects every declared resource except the named ones. Requires at least
|
|
97
|
+
* one key.
|
|
72
98
|
*
|
|
73
99
|
* @param keys - Top-level resource names to exclude.
|
|
74
100
|
*/
|
|
75
|
-
omit<Keys extends LayoutResourceKey<Resources
|
|
101
|
+
omit<Keys extends [LayoutResourceKey<Resources>, ...LayoutResourceKey<Resources>[]]>(...keys: Keys): ResourceSelection<OmitResourceDefinitions<Resources, Keys[number]>>;
|
|
76
102
|
/**
|
|
77
|
-
*
|
|
78
|
-
* order and shape of the selected definitions.
|
|
103
|
+
* Selects only the named resources. Requires at least one key.
|
|
79
104
|
*
|
|
80
105
|
* @param keys - Top-level resource names to keep.
|
|
81
106
|
*/
|
|
82
|
-
pick<Keys extends LayoutResourceKey<Resources
|
|
107
|
+
pick<Keys extends [LayoutResourceKey<Resources>, ...LayoutResourceKey<Resources>[]]>(...keys: Keys): ResourceSelection<PickResourceDefinitions<Resources, Keys[number]>>;
|
|
83
108
|
};
|
|
84
109
|
/**
|
|
85
110
|
* Render-scoped {@link LayoutResourcesAccessor}, extended with `current` — the
|
|
@@ -89,6 +114,29 @@ type LayoutRenderResourcesAccessor<Resources extends ReadonlyArray<ResourceDefin
|
|
|
89
114
|
/** The resource this layout instance is rendering for. */readonly current: LayoutResourceKey<Resources>;
|
|
90
115
|
};
|
|
91
116
|
type LayoutRenderComposables<Composables extends ComposableComponents> = [keyof Composables] extends [never] ? undefined : Composables;
|
|
117
|
+
/**
|
|
118
|
+
* The `layout` block of a {@link defineResourceLayout} call: the props, the
|
|
119
|
+
* composable map, and the render for a per-resource page component.
|
|
120
|
+
*
|
|
121
|
+
* Extracted so {@link defineResourceLayout.withLayout} can reuse the exact same
|
|
122
|
+
* shape while making `render` optional (see {@link ShellLayoutDefinition}).
|
|
123
|
+
*/
|
|
124
|
+
type LayoutDefinition<Resources extends ReadonlyArray<ResourceDefinition>, Options extends InPropsDefinition<Resources>, Composables extends ComposableComponents, IncludeProps extends LayoutIncludeProps<Resources, Options, Composables>, CustomProps extends InPropsObject> = {
|
|
125
|
+
/**
|
|
126
|
+
* The props to pass to the layout.
|
|
127
|
+
*/
|
|
128
|
+
props?: LayoutProps<Resources, Options, Composables, IncludeProps, CustomProps>;
|
|
129
|
+
/**
|
|
130
|
+
* Components used to compose the layout. Invoked per layout instance with
|
|
131
|
+
* a scoped `create` that resolves composable `name` callbacks using the
|
|
132
|
+
* layout's `resource` and `name`.
|
|
133
|
+
*/
|
|
134
|
+
composables?: (create: CreateLayoutComposable<LayoutResourceKey<Resources>>) => Composables;
|
|
135
|
+
/**
|
|
136
|
+
* The render function for the layout.
|
|
137
|
+
*/
|
|
138
|
+
render: (props: LayoutRenderProps<Resources, Options, Composables, IncludeProps, CustomProps>, context: LayoutRenderContext<Resources, Composables>) => JSX.Element;
|
|
139
|
+
};
|
|
92
140
|
type CreateViewMapOptions<Resources extends ReadonlyArray<ResourceDefinition>, Options extends InPropsDefinition<Resources> = {}, Composables extends ComposableComponents = {}, IncludeProps extends LayoutIncludeProps<Resources, Options, Composables> = {}, CustomProps extends InPropsObject = {}> = {
|
|
93
141
|
/**
|
|
94
142
|
* An array of valid resource names to support. Nested sub-resource slugs that
|
|
@@ -99,22 +147,7 @@ type CreateViewMapOptions<Resources extends ReadonlyArray<ResourceDefinition>, O
|
|
|
99
147
|
* The options that are passed into the created resource layout.
|
|
100
148
|
*/
|
|
101
149
|
options?: Options;
|
|
102
|
-
layout:
|
|
103
|
-
/**
|
|
104
|
-
* The props to pass to the layout.
|
|
105
|
-
*/
|
|
106
|
-
props?: LayoutProps<Resources, Options, Composables, IncludeProps, CustomProps>;
|
|
107
|
-
/**
|
|
108
|
-
* Components used to compose the layout. Invoked per layout instance with
|
|
109
|
-
* a scoped `create` that resolves composable `name` callbacks using the
|
|
110
|
-
* layout's `resource` and `name`.
|
|
111
|
-
*/
|
|
112
|
-
composables?: (create: CreateLayoutComposable<LayoutResourceKey<Resources>>) => Composables;
|
|
113
|
-
/**
|
|
114
|
-
* The render function for the layout.
|
|
115
|
-
*/
|
|
116
|
-
render: (props: LayoutRenderProps<Resources, Options, Composables, IncludeProps, CustomProps>, context: LayoutRenderContext<Resources, Composables>) => JSX.Element;
|
|
117
|
-
};
|
|
150
|
+
layout: LayoutDefinition<Resources, Options, Composables, IncludeProps, CustomProps>;
|
|
118
151
|
};
|
|
119
152
|
type ResourceLayoutComposition<Name extends string, Composables extends ComposableComponents> = [keyof Composables] extends [never] ? {} : {
|
|
120
153
|
makeComposable: MakeComposable<Composables, Name>;
|
|
@@ -191,8 +224,156 @@ type DefineResourceLayout = DefineResourceLayoutFn & {
|
|
|
191
224
|
* (or `defineResourceLayout.forResources`) without an `as const` assertion.
|
|
192
225
|
*/
|
|
193
226
|
defineResources: DefineResourcesFn;
|
|
227
|
+
/**
|
|
228
|
+
* Like {@link defineResourceLayout}, but also returns a `Shell` component.
|
|
229
|
+
*
|
|
230
|
+
* With plain `defineResourceLayout`, every page is wrapped in its own
|
|
231
|
+
* `createResourceLayout` component, so navigating between resources unmounts
|
|
232
|
+
* one page component and mounts another — the shared chrome the `render`
|
|
233
|
+
* produces (a sidebar, a header, subscriptions, observers) is rebuilt every
|
|
234
|
+
* time. `withLayout` splits that chrome into a `shell` that mounts once,
|
|
235
|
+
* above the router outlet, and stays mounted across navigation; pages mount
|
|
236
|
+
* and unmount inside it and report their resource up automatically.
|
|
237
|
+
*/
|
|
238
|
+
withLayout: DefineResourceLayoutWithLayoutFn;
|
|
194
239
|
};
|
|
240
|
+
/**
|
|
241
|
+
* Render context passed as the second argument to
|
|
242
|
+
* {@link ShellLayoutDefinition.render}.
|
|
243
|
+
*
|
|
244
|
+
* The same shape as a per-resource `render` context (`composables`,
|
|
245
|
+
* `resources`, `name`, `inProps`), with two differences that follow from the
|
|
246
|
+
* shell being mounted once above the router outlet rather than per page:
|
|
247
|
+
*
|
|
248
|
+
* - `resource` / `resources.current` are `LayoutResourceKey | undefined`. The
|
|
249
|
+
* shell outlives any single page, so the current resource is whatever the
|
|
250
|
+
* mounted page last reported (or the `resource` prop, or nothing yet).
|
|
251
|
+
* - `children` is the shell's content region. Render it where page content
|
|
252
|
+
* belongs; it is already wrapped so mounted pages report their resource back.
|
|
253
|
+
*/
|
|
254
|
+
type ShellRenderContext<Resources extends ReadonlyArray<ResourceDefinition>, ShellComposables extends ComposableComponents> = {
|
|
255
|
+
composables: LayoutRenderComposables<ShellComposables>;
|
|
256
|
+
inProps: Record<string, unknown>;
|
|
257
|
+
/**
|
|
258
|
+
* The resource currently rendered in the outlet, or `undefined` when no
|
|
259
|
+
* per-resource page is mounted and no `resource` prop was passed.
|
|
260
|
+
*/
|
|
261
|
+
resource: LayoutResourceKey<Resources> | undefined;
|
|
262
|
+
/**
|
|
263
|
+
* Resources accessor for this definition. `current` follows `resource` above
|
|
264
|
+
* and may be `undefined`.
|
|
265
|
+
*/
|
|
266
|
+
resources: LayoutResourcesAccessor<Resources> & {
|
|
267
|
+
readonly current: LayoutResourceKey<Resources> | undefined;
|
|
268
|
+
};
|
|
269
|
+
name: string;
|
|
270
|
+
/**
|
|
271
|
+
* The shell's content region — typically a router `<Outlet />`. Render it
|
|
272
|
+
* where page content belongs.
|
|
273
|
+
*/
|
|
274
|
+
children: ReactNode;
|
|
275
|
+
};
|
|
276
|
+
/**
|
|
277
|
+
* The `shell` block of a {@link defineResourceLayout.withLayout} call: the
|
|
278
|
+
* chrome that mounts once and stays mounted while pages navigate inside it.
|
|
279
|
+
*
|
|
280
|
+
* Mirrors {@link LayoutDefinition} (`props`, `composables`, `render`) so the
|
|
281
|
+
* two blocks read the same, plus an optional `name`.
|
|
282
|
+
*/
|
|
283
|
+
type ShellLayoutDefinition<Resources extends ReadonlyArray<ResourceDefinition>, Options extends InPropsDefinition<Resources>, ShellComposables extends ComposableComponents, ShellIncludeProps extends LayoutIncludeProps<Resources, Options, ShellComposables>, ShellCustomProps extends InPropsObject> = {
|
|
284
|
+
/**
|
|
285
|
+
* Stable name for the shell component (React DevTools) and the base for any
|
|
286
|
+
* resource-scoped composable names. Defaults to `'ResourceLayoutShell'`.
|
|
287
|
+
*/
|
|
288
|
+
name?: string;
|
|
289
|
+
props?: LayoutProps<Resources, Options, ShellComposables, ShellIncludeProps, ShellCustomProps>;
|
|
290
|
+
composables?: (create: CreateLayoutComposable<LayoutResourceKey<Resources>>) => ShellComposables;
|
|
291
|
+
render: (props: LayoutRenderProps<Resources, Options, ShellComposables, ShellIncludeProps, ShellCustomProps>, context: ShellRenderContext<Resources, ShellComposables>) => JSX.Element;
|
|
292
|
+
};
|
|
293
|
+
/**
|
|
294
|
+
* Props accepted by the `Shell` component from
|
|
295
|
+
* {@link defineResourceLayout.withLayout}.
|
|
296
|
+
*/
|
|
297
|
+
type ResourceLayoutShellProps<Resources extends ReadonlyArray<ResourceDefinition>, Options extends InPropsDefinition<Resources>, ShellComposables extends ComposableComponents, ShellIncludeProps extends LayoutIncludeProps<Resources, Options, ShellComposables>, ShellCustomProps extends InPropsObject> = Show<ResolveProps<ShellCustomProps> & ResolvedIncludedComponentProps<MergedLayoutInProps<Resources, Options, ShellComposables>, ShellIncludeProps> & {
|
|
298
|
+
/**
|
|
299
|
+
* The resource the shell renders for. Overrides the value reported by the
|
|
300
|
+
* page mounted in `children`. Always available — pass it from tests,
|
|
301
|
+
* stories, or a route that renders non-library content but still wants
|
|
302
|
+
* the shell.
|
|
303
|
+
*/
|
|
304
|
+
resource?: LayoutResourceKey<Resources>; /** The shell's content region — typically a router `<Outlet />`. */
|
|
305
|
+
children: ReactNode;
|
|
306
|
+
}>;
|
|
307
|
+
/**
|
|
308
|
+
* The once-mounted application shell returned from
|
|
309
|
+
* {@link defineResourceLayout.withLayout}. Wrap the router outlet with it.
|
|
310
|
+
*/
|
|
311
|
+
type ResourceLayoutShellComponent<Resources extends ReadonlyArray<ResourceDefinition>, Options extends InPropsDefinition<Resources>, ShellComposables extends ComposableComponents = {}, ShellIncludeProps extends LayoutIncludeProps<Resources, Options, ShellComposables> = {}, ShellCustomProps extends InPropsObject = {}> = BaseComponent<string, ResourceLayoutShellProps<Resources, Options, ShellComposables, ShellIncludeProps, ShellCustomProps>> & {
|
|
312
|
+
(props: ResourceLayoutShellProps<Resources, Options, ShellComposables, ShellIncludeProps, ShellCustomProps>): JSX.Element;
|
|
313
|
+
};
|
|
314
|
+
/**
|
|
315
|
+
* Options for {@link defineResourceLayout.withLayout}: everything
|
|
316
|
+
* {@link defineResourceLayout} accepts, plus a required `shell`, and with the
|
|
317
|
+
* per-resource `layout.render` made optional.
|
|
318
|
+
*/
|
|
319
|
+
type CreateResourceLayoutWithLayoutOptions<Resources extends ReadonlyArray<ResourceDefinition>, Options extends InPropsDefinition<Resources> = {}, Composables extends ComposableComponents = {}, IncludeProps extends LayoutIncludeProps<Resources, Options, Composables> = {}, CustomProps extends InPropsObject = {}, ShellComposables extends ComposableComponents = {}, ShellIncludeProps extends LayoutIncludeProps<Resources, Options, ShellComposables> = {}, ShellCustomProps extends InPropsObject = {}> = {
|
|
320
|
+
/**
|
|
321
|
+
* An array of valid resource names to support. Nested sub-resource slugs that
|
|
322
|
+
* collide with config keys (`component`, `detail`, `new`, …) are reserved.
|
|
323
|
+
*/
|
|
324
|
+
resources: AssertUnreservedResources<Resources>;
|
|
325
|
+
/**
|
|
326
|
+
* The options that are passed into the created resource layout. Shared by the
|
|
327
|
+
* shell and the per-resource layout, so an `include` on either side can draw
|
|
328
|
+
* from the same definitions.
|
|
329
|
+
*/
|
|
330
|
+
options?: Options;
|
|
331
|
+
/**
|
|
332
|
+
* The once-mounted shell. The returned `Shell` wraps the router outlet and
|
|
333
|
+
* stays mounted across resource navigation, so its composables (a persistent
|
|
334
|
+
* sidebar, header, breadcrumb container, …) keep their state and DOM while
|
|
335
|
+
* pages mount and unmount inside it.
|
|
336
|
+
*/
|
|
337
|
+
shell: ShellLayoutDefinition<Resources, Options, ShellComposables, ShellIncludeProps, ShellCustomProps>;
|
|
338
|
+
/**
|
|
339
|
+
* Per-resource content. Optional here: when the shell renders the whole
|
|
340
|
+
* chrome, a page is just a slot — omit `render` and the generated component
|
|
341
|
+
* renders its own `children` into the shell's outlet. Provide it to give a
|
|
342
|
+
* resource its own header, actions, or per-page structure.
|
|
343
|
+
*/
|
|
344
|
+
layout?: Omit<LayoutDefinition<Resources, Options, Composables, IncludeProps, CustomProps>, 'render'> & {
|
|
345
|
+
render?: LayoutDefinition<Resources, Options, Composables, IncludeProps, CustomProps>['render'];
|
|
346
|
+
};
|
|
347
|
+
};
|
|
348
|
+
/**
|
|
349
|
+
* {@link DefinedResourceLayout} plus the once-mounted `Shell`.
|
|
350
|
+
*/
|
|
351
|
+
type DefinedResourceLayoutWithShell<Resources extends ReadonlyArray<ResourceDefinition>, Options extends InPropsDefinition<Resources>, Composables extends ComposableComponents = {}, IncludeProps extends LayoutIncludeProps<Resources, Options, Composables> = {}, CustomProps extends InPropsObject = {}, ShellComposables extends ComposableComponents = {}, ShellIncludeProps extends LayoutIncludeProps<Resources, Options, ShellComposables> = {}, ShellCustomProps extends InPropsObject = {}> = DefinedResourceLayout<Resources, Options, Composables, IncludeProps, CustomProps> & {
|
|
352
|
+
/**
|
|
353
|
+
* The application shell. Mount it once, wrapping the router outlet:
|
|
354
|
+
*
|
|
355
|
+
* ```tsx
|
|
356
|
+
* function AdminRoute() {
|
|
357
|
+
* const resource = Route.useParams({ select: (p) => p.resource });
|
|
358
|
+
* return (
|
|
359
|
+
* <Shell resource={resource}>
|
|
360
|
+
* <Outlet />
|
|
361
|
+
* </Shell>
|
|
362
|
+
* );
|
|
363
|
+
* }
|
|
364
|
+
* ```
|
|
365
|
+
*
|
|
366
|
+
* Passing `resource` is optional: a page created by `createResourceLayout`
|
|
367
|
+
* reports its own resource to the shell automatically. Pass it for routes
|
|
368
|
+
* that render non-library content, or in tests and stories.
|
|
369
|
+
*/
|
|
370
|
+
Shell: ResourceLayoutShellComponent<Resources, Options, ShellComposables, ShellIncludeProps, ShellCustomProps>;
|
|
371
|
+
};
|
|
372
|
+
/**
|
|
373
|
+
* Signature of {@link defineResourceLayout.withLayout}.
|
|
374
|
+
*/
|
|
375
|
+
type DefineResourceLayoutWithLayoutFn = <const Resources extends ReadonlyArray<ResourceDefinition>, Options extends InPropsDefinition<Resources> = {}, Composables extends ComposableComponents = {}, const IncludeProps extends LayoutIncludeProps<Resources, Options, Composables> = {}, CustomProps extends InPropsObject = {}, ShellComposables extends ComposableComponents = {}, const ShellIncludeProps extends LayoutIncludeProps<Resources, Options, ShellComposables> = {}, ShellCustomProps extends InPropsObject = {}>(options: CreateResourceLayoutWithLayoutOptions<Resources, Options, Composables, IncludeProps, CustomProps, ShellComposables, ShellIncludeProps, ShellCustomProps>) => DefinedResourceLayoutWithShell<Resources, Options, Composables, IncludeProps, CustomProps, ShellComposables, ShellIncludeProps, ShellCustomProps>;
|
|
195
376
|
declare const defineResourceLayout: DefineResourceLayout;
|
|
196
377
|
//#endregion
|
|
197
|
-
export { CreateResourceLayoutFn, CreateResourceLayoutMakeComposableOptions, DefineResourceLayout, DefineResourceLayoutFn, DefineResourceLayoutForResources, DefineResourceLayoutForResourcesFactory, DefineResourcesFn, LayoutIncludeProps, LayoutProps, LayoutPropsForResource, LayoutRenderResourcesAccessor, LayoutResourcesAccessor, ResourceLayoutComponent, defineResourceLayout };
|
|
378
|
+
export { CreateResourceLayoutFn, CreateResourceLayoutMakeComposableOptions, CreateResourceLayoutWithLayoutOptions, DefineResourceLayout, DefineResourceLayoutFn, DefineResourceLayoutForResources, DefineResourceLayoutForResourcesFactory, DefineResourceLayoutWithLayoutFn, DefineResourcesFn, DefinedResourceLayoutWithShell, LayoutIncludeProps, LayoutProps, LayoutPropsForResource, LayoutRenderResourcesAccessor, LayoutResourcesAccessor, ResourceLayoutComponent, ResourceLayoutShellComponent, ResourceLayoutShellProps, ResourceSelection, ShellLayoutDefinition, ShellRenderContext, defineResourceLayout };
|
|
198
379
|
//# sourceMappingURL=define-layout.d.cts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"define-layout.d.cts","names":[],"sources":["../../src/create-config/define-layout.tsx"],"mappings":";;;;;;;;;;;;;
|
|
1
|
+
{"version":3,"file":"define-layout.d.cts","names":[],"sources":["../../src/create-config/define-layout.tsx"],"mappings":";;;;;;;;;;;;;KAgFY,kBAAA,mBACQ,aAAA,CAAc,kBAAA,mBAChB,iBAAA,CAAkB,SAAA,uBACd,oBAAA,IAClB,aAAA,CAAc,mBAAA,CAAoB,SAAA,EAAW,OAAA,EAAS,WAAA;AAAA,KAE9C,WAAA,mBACQ,aAAA,CAAc,kBAAA,mBAChB,iBAAA,CAAkB,SAAA,uBACd,oBAAA,uBACC,kBAAA,CAAmB,SAAA,EAAW,OAAA,EAAS,WAAA,4BACxC,aAAA;;AAXtB;;EAgBE,OAAA,GAAU,kBAAA,CAAmB,SAAA,EAAW,OAAA,EAAS,WAAA,IAAe,YAAA;EAfhC;;;EAmBhC,MAAA,GAAS,WAAA;AAAA;AAAA,KAGN,mBAAA,mBACe,aAAA,CAAc,kBAAA,uBACZ,oBAAA;EAEpB,WAAA,EAAa,uBAAA,CAAwB,WAAA;EACrC,OAAA,EAAS,MAAA;EAxBO;;;;EA6BhB,QAAA,EAAU,iBAAA,CAAkB,SAAA;EAhCV;;;;;;EAuClB,SAAA,EAAW,6BAAA,CAA8B,SAAA;EACzC,IAAA;AAAA;;;;;AArCmE;AAErE;KA4CK,sBAAA,oCAGD,UAAA,SAAmB,kBAAA,kBACJ,uBAAA,CAAwB,UAAA,IACrC,UAAA,GACA,uBAAA,CAAwB,UA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