@jfdevelops/react-layout 0.17.5 → 0.18.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.
Files changed (149) hide show
  1. package/dist/create-config/component-keys.cjs +44 -0
  2. package/dist/create-config/component-keys.cjs.map +1 -0
  3. package/dist/create-config/component-keys.mjs +39 -0
  4. package/dist/create-config/component-keys.mjs.map +1 -0
  5. package/dist/create-config/define-layout.cjs +13 -0
  6. package/dist/create-config/define-layout.cjs.map +1 -1
  7. package/dist/create-config/define-layout.d.cts +5 -3
  8. package/dist/create-config/define-layout.d.cts.map +1 -1
  9. package/dist/create-config/define-layout.d.mts +5 -3
  10. package/dist/create-config/define-layout.d.mts.map +1 -1
  11. package/dist/create-config/define-layout.mjs +13 -0
  12. package/dist/create-config/define-layout.mjs.map +1 -1
  13. package/dist/create-config/for-paths/builder.cjs +192 -0
  14. package/dist/create-config/for-paths/builder.cjs.map +1 -0
  15. package/dist/create-config/for-paths/builder.d.cts +77 -0
  16. package/dist/create-config/for-paths/builder.d.cts.map +1 -0
  17. package/dist/create-config/for-paths/builder.d.mts +77 -0
  18. package/dist/create-config/for-paths/builder.d.mts.map +1 -0
  19. package/dist/create-config/for-paths/builder.mjs +192 -0
  20. package/dist/create-config/for-paths/builder.mjs.map +1 -0
  21. package/dist/create-config/for-paths/get-component-for-path.cjs +55 -0
  22. package/dist/create-config/for-paths/get-component-for-path.cjs.map +1 -0
  23. package/dist/create-config/for-paths/get-component-for-path.d.cts +55 -0
  24. package/dist/create-config/for-paths/get-component-for-path.d.cts.map +1 -0
  25. package/dist/create-config/for-paths/get-component-for-path.d.mts +55 -0
  26. package/dist/create-config/for-paths/get-component-for-path.d.mts.map +1 -0
  27. package/dist/create-config/for-paths/get-component-for-path.mjs +55 -0
  28. package/dist/create-config/for-paths/get-component-for-path.mjs.map +1 -0
  29. package/dist/create-config/for-paths/index.d.cts +2 -0
  30. package/dist/create-config/for-paths/index.d.mts +2 -0
  31. package/dist/create-config/get-component.cjs +60 -11
  32. package/dist/create-config/get-component.cjs.map +1 -1
  33. package/dist/create-config/get-component.d.cts +75 -6
  34. package/dist/create-config/get-component.d.cts.map +1 -1
  35. package/dist/create-config/get-component.d.mts +75 -6
  36. package/dist/create-config/get-component.d.mts.map +1 -1
  37. package/dist/create-config/get-component.mjs +61 -11
  38. package/dist/create-config/get-component.mjs.map +1 -1
  39. package/dist/create-config/index.d.cts +6 -1
  40. package/dist/create-config/index.d.mts +6 -1
  41. package/dist/create-config/is-sub-resource-key.cjs +15 -0
  42. package/dist/create-config/is-sub-resource-key.cjs.map +1 -0
  43. package/dist/create-config/is-sub-resource-key.d.cts +30 -0
  44. package/dist/create-config/is-sub-resource-key.d.cts.map +1 -0
  45. package/dist/create-config/is-sub-resource-key.d.mts +30 -0
  46. package/dist/create-config/is-sub-resource-key.d.mts.map +1 -0
  47. package/dist/create-config/is-sub-resource-key.mjs +15 -0
  48. package/dist/create-config/is-sub-resource-key.mjs.map +1 -0
  49. package/dist/create-config/paths/generate.cjs +77 -0
  50. package/dist/create-config/paths/generate.cjs.map +1 -0
  51. package/dist/create-config/paths/generate.mjs +77 -0
  52. package/dist/create-config/paths/generate.mjs.map +1 -0
  53. package/dist/create-config/paths/index.d.cts +2 -0
  54. package/dist/create-config/paths/index.d.mts +2 -0
  55. package/dist/create-config/paths/introspect.cjs +123 -0
  56. package/dist/create-config/paths/introspect.cjs.map +1 -0
  57. package/dist/create-config/paths/introspect.mjs +118 -0
  58. package/dist/create-config/paths/introspect.mjs.map +1 -0
  59. package/dist/create-config/paths/resolve.cjs +130 -0
  60. package/dist/create-config/paths/resolve.cjs.map +1 -0
  61. package/dist/create-config/paths/resolve.mjs +129 -0
  62. package/dist/create-config/paths/resolve.mjs.map +1 -0
  63. package/dist/create-config/paths/types.d.cts +104 -0
  64. package/dist/create-config/paths/types.d.cts.map +1 -0
  65. package/dist/create-config/paths/types.d.mts +104 -0
  66. package/dist/create-config/paths/types.d.mts.map +1 -0
  67. package/dist/create-config/paths/variables.cjs +32 -0
  68. package/dist/create-config/paths/variables.cjs.map +1 -0
  69. package/dist/create-config/paths/variables.d.cts +32 -0
  70. package/dist/create-config/paths/variables.d.cts.map +1 -0
  71. package/dist/create-config/paths/variables.d.mts +32 -0
  72. package/dist/create-config/paths/variables.d.mts.map +1 -0
  73. package/dist/create-config/paths/variables.mjs +29 -0
  74. package/dist/create-config/paths/variables.mjs.map +1 -0
  75. package/dist/create-config/types.d.cts +28 -8
  76. package/dist/create-config/types.d.cts.map +1 -1
  77. package/dist/create-config/types.d.mts +28 -8
  78. package/dist/create-config/types.d.mts.map +1 -1
  79. package/dist/errors/invalid-component.cjs +21 -0
  80. package/dist/errors/invalid-component.cjs.map +1 -0
  81. package/dist/errors/invalid-component.d.cts +18 -0
  82. package/dist/errors/invalid-component.d.cts.map +1 -0
  83. package/dist/errors/invalid-component.d.mts +18 -0
  84. package/dist/errors/invalid-component.d.mts.map +1 -0
  85. package/dist/errors/invalid-component.mjs +21 -0
  86. package/dist/errors/invalid-component.mjs.map +1 -0
  87. package/dist/errors/invalid-config.cjs +13 -0
  88. package/dist/errors/invalid-config.cjs.map +1 -0
  89. package/dist/errors/invalid-config.d.cts +15 -0
  90. package/dist/errors/invalid-config.d.cts.map +1 -0
  91. package/dist/errors/invalid-config.d.mts +15 -0
  92. package/dist/errors/invalid-config.d.mts.map +1 -0
  93. package/dist/errors/invalid-config.mjs +13 -0
  94. package/dist/errors/invalid-config.mjs.map +1 -0
  95. package/dist/errors/invalid-path.cjs +18 -0
  96. package/dist/errors/invalid-path.cjs.map +1 -0
  97. package/dist/errors/invalid-path.d.cts +16 -0
  98. package/dist/errors/invalid-path.d.cts.map +1 -0
  99. package/dist/errors/invalid-path.d.mts +16 -0
  100. package/dist/errors/invalid-path.d.mts.map +1 -0
  101. package/dist/errors/invalid-path.mjs +18 -0
  102. package/dist/errors/invalid-path.mjs.map +1 -0
  103. package/dist/errors/invalid-resource.cjs +18 -0
  104. package/dist/errors/invalid-resource.cjs.map +1 -0
  105. package/dist/errors/invalid-resource.d.cts +16 -0
  106. package/dist/errors/invalid-resource.d.cts.map +1 -0
  107. package/dist/errors/invalid-resource.d.mts +16 -0
  108. package/dist/errors/invalid-resource.d.mts.map +1 -0
  109. package/dist/errors/invalid-resource.mjs +18 -0
  110. package/dist/errors/invalid-resource.mjs.map +1 -0
  111. package/dist/errors/invalid-sub-resource.cjs +18 -0
  112. package/dist/errors/invalid-sub-resource.cjs.map +1 -0
  113. package/dist/errors/invalid-sub-resource.d.cts +17 -0
  114. package/dist/errors/invalid-sub-resource.d.cts.map +1 -0
  115. package/dist/errors/invalid-sub-resource.d.mts +17 -0
  116. package/dist/errors/invalid-sub-resource.d.mts.map +1 -0
  117. package/dist/errors/invalid-sub-resource.mjs +18 -0
  118. package/dist/errors/invalid-sub-resource.mjs.map +1 -0
  119. package/dist/errors/missing-path-variable.cjs +18 -0
  120. package/dist/errors/missing-path-variable.cjs.map +1 -0
  121. package/dist/errors/missing-path-variable.d.cts +16 -0
  122. package/dist/errors/missing-path-variable.d.cts.map +1 -0
  123. package/dist/errors/missing-path-variable.d.mts +16 -0
  124. package/dist/errors/missing-path-variable.d.mts.map +1 -0
  125. package/dist/errors/missing-path-variable.mjs +18 -0
  126. package/dist/errors/missing-path-variable.mjs.map +1 -0
  127. package/dist/errors/react-layout-error.cjs +56 -0
  128. package/dist/errors/react-layout-error.cjs.map +1 -0
  129. package/dist/errors/react-layout-error.d.cts +46 -0
  130. package/dist/errors/react-layout-error.d.cts.map +1 -0
  131. package/dist/errors/react-layout-error.d.mts +46 -0
  132. package/dist/errors/react-layout-error.d.mts.map +1 -0
  133. package/dist/errors/react-layout-error.mjs +54 -0
  134. package/dist/errors/react-layout-error.mjs.map +1 -0
  135. package/dist/index.cjs +15 -0
  136. package/dist/index.d.cts +13 -1
  137. package/dist/index.d.mts +13 -1
  138. package/dist/index.mjs +8 -1
  139. package/dist/resource.cjs.map +1 -1
  140. package/dist/resource.d.cts +2 -2
  141. package/dist/resource.d.cts.map +1 -1
  142. package/dist/resource.d.mts +2 -2
  143. package/dist/resource.d.mts.map +1 -1
  144. package/dist/resource.mjs.map +1 -1
  145. package/dist/utils.d.cts +2 -1
  146. package/dist/utils.d.cts.map +1 -1
  147. package/dist/utils.d.mts +2 -1
  148. package/dist/utils.d.mts.map +1 -1
  149. package/package.json +1 -1
@@ -0,0 +1 @@
1
+ {"version":3,"file":"variables.d.cts","names":[],"sources":["../../../src/create-config/paths/variables.ts"],"mappings":";;AAIA;;;cAAa,wBAAA;AAAA,KAED,sBAAA,UAAgC,wBAAwB;AAApE;AAAA,KAGY,YAAA,2BACP,sBAAA,GAAyB,IAAI;AAAA,KAEtB,oBAAA,GAAuB,YAAY;AAAA,KACnC,uBAAA,GAA0B,YAAY;AAAA,KACtC,qBAAA,GAAwB,YAAY;AAAA,KAQ3C,sBAAA,2BACH,OAAA,SAAgB,YAAY,eAAe,IAAA;;;;;AAbX;AAElC;;;;KAsBY,oBAAA,wBACV,IAAA,4CACI,sBAAA,CAAuB,OAAA,IAAW,oBAAA,CAAqB,IAAA,IACvD,sBAAA,CAAuB,IAAA;AAxB7B;AAAA,KA2BY,gBAAA,yBACV,oBAAoB,CAAC,IAAA;AA5B2B;AAAA,KAkCtC,QAAA,wBACV,IAAA,qCAAyC,IAAA,GAAO,IAAI;;KAG1C,QAAA,wBACV,IAAI,qCAAqC,IAAA"}
@@ -0,0 +1,32 @@
1
+ //#region src/create-config/paths/variables.d.ts
2
+ /**
3
+ * Prefix marking a path segment as a caller-supplied variable. `'$resource.detail.$component'`
4
+ * leaves `resource` and `component` open, while `detail` is fixed.
5
+ */
6
+ declare const PATH_VARIABLE_IDENTIFIER = "$";
7
+ type PathVariableIdentifier = typeof PATH_VARIABLE_IDENTIFIER;
8
+ /** A single variable path segment, e.g. `PathVariable<'resource'>` is `'$resource'`. */
9
+ type PathVariable<Name extends string> = `${PathVariableIdentifier}${Name}`;
10
+ type ResourcePathVariable = PathVariable<'resource'>;
11
+ type SubResourcePathVariable = PathVariable<'subResource'>;
12
+ type ComponentPathVariable = PathVariable<'component'>;
13
+ type ExtractSegmentVariable<Segment extends string> = Segment extends PathVariable<infer Name> ? Name : never;
14
+ /**
15
+ * Variable names declared by a dot-separated path.
16
+ *
17
+ * @example
18
+ * ```ts
19
+ * ExtractPathVariables<'$resource.detail.$component'>
20
+ * // ^? 'resource' | 'component'
21
+ * ```
22
+ */
23
+ type ExtractPathVariables<Path extends string> = Path extends `${infer Segment}.${infer Rest}` ? ExtractSegmentVariable<Segment> | ExtractPathVariables<Rest> : ExtractSegmentVariable<Path>;
24
+ /** Whether `Path` leaves any variable open. */
25
+ type PathHasVariables<Path extends string> = [ExtractPathVariables<Path>] extends [never] ? false : true;
26
+ /** First segment of a dot-separated path. */
27
+ type PathHead<Path extends string> = Path extends `${infer Head}.${string}` ? Head : Path;
28
+ /** Everything after the first segment of a dot-separated path (`''` when there is nothing left). */
29
+ type PathTail<Path extends string> = Path extends `${string}.${infer Rest}` ? Rest : '';
30
+ //#endregion
31
+ export { ComponentPathVariable, ExtractPathVariables, PATH_VARIABLE_IDENTIFIER, PathHasVariables, PathHead, PathTail, PathVariable, PathVariableIdentifier, ResourcePathVariable, SubResourcePathVariable };
32
+ //# sourceMappingURL=variables.d.mts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"variables.d.mts","names":[],"sources":["../../../src/create-config/paths/variables.ts"],"mappings":";;AAIA;;;cAAa,wBAAA;AAAA,KAED,sBAAA,UAAgC,wBAAwB;AAApE;AAAA,KAGY,YAAA,2BACP,sBAAA,GAAyB,IAAI;AAAA,KAEtB,oBAAA,GAAuB,YAAY;AAAA,KACnC,uBAAA,GAA0B,YAAY;AAAA,KACtC,qBAAA,GAAwB,YAAY;AAAA,KAQ3C,sBAAA,2BACH,OAAA,SAAgB,YAAY,eAAe,IAAA;;;;;AAbX;AAElC;;;;KAsBY,oBAAA,wBACV,IAAA,4CACI,sBAAA,CAAuB,OAAA,IAAW,oBAAA,CAAqB,IAAA,IACvD,sBAAA,CAAuB,IAAA;AAxB7B;AAAA,KA2BY,gBAAA,yBACV,oBAAoB,CAAC,IAAA;AA5B2B;AAAA,KAkCtC,QAAA,wBACV,IAAA,qCAAyC,IAAA,GAAO,IAAI;;KAG1C,QAAA,wBACV,IAAI,qCAAqC,IAAA"}
@@ -0,0 +1,29 @@
1
+ //#region src/create-config/paths/variables.ts
2
+ /**
3
+ * Prefix marking a path segment as a caller-supplied variable. `'$resource.detail.$component'`
4
+ * leaves `resource` and `component` open, while `detail` is fixed.
5
+ */
6
+ const PATH_VARIABLE_IDENTIFIER = "$";
7
+ function createPathVariable(name) {
8
+ return `${"$"}${name}`;
9
+ }
10
+ function isPathVariableSegment(segment) {
11
+ return segment.startsWith("$");
12
+ }
13
+ /** Variable name for a segment, or `undefined` when the segment is a fixed key. */
14
+ function readPathVariableName(segment) {
15
+ return isPathVariableSegment(segment) ? segment.slice(1) : void 0;
16
+ }
17
+ /** Variable names declared by `path`, in order of appearance and without duplicates. */
18
+ function extractPathVariables(path) {
19
+ const names = /* @__PURE__ */ new Set();
20
+ for (const segment of path.split(".")) {
21
+ const name = readPathVariableName(segment);
22
+ if (name !== void 0 && name.length > 0) names.add(name);
23
+ }
24
+ return [...names];
25
+ }
26
+
27
+ //#endregion
28
+ export { createPathVariable, extractPathVariables, readPathVariableName };
29
+ //# sourceMappingURL=variables.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"variables.mjs","names":[],"sources":["../../../src/create-config/paths/variables.ts"],"sourcesContent":["/**\n * Prefix marking a path segment as a caller-supplied variable. `'$resource.detail.$component'`\n * leaves `resource` and `component` open, while `detail` is fixed.\n */\nexport const PATH_VARIABLE_IDENTIFIER = '$';\n\nexport type PathVariableIdentifier = typeof PATH_VARIABLE_IDENTIFIER;\n\n/** A single variable path segment, e.g. `PathVariable<'resource'>` is `'$resource'`. */\nexport type PathVariable<Name extends string> =\n `${PathVariableIdentifier}${Name}`;\n\nexport type ResourcePathVariable = PathVariable<'resource'>;\nexport type SubResourcePathVariable = PathVariable<'subResource'>;\nexport type ComponentPathVariable = PathVariable<'component'>;\n\n/** Variable names a path may leave open. */\nexport type PathVariableName = 'resource' | 'subResource' | 'component';\n\nexport type RemovePathVariableIdentifier<Segment extends string> =\n Segment extends PathVariable<infer Name> ? Name : Segment;\n\ntype ExtractSegmentVariable<Segment extends string> =\n Segment extends PathVariable<infer Name> ? Name : never;\n\n/**\n * Variable names declared by a dot-separated path.\n *\n * @example\n * ```ts\n * ExtractPathVariables<'$resource.detail.$component'>\n * // ^? 'resource' | 'component'\n * ```\n */\nexport type ExtractPathVariables<Path extends string> =\n Path extends `${infer Segment}.${infer Rest}`\n ? ExtractSegmentVariable<Segment> | ExtractPathVariables<Rest>\n : ExtractSegmentVariable<Path>;\n\n/** Whether `Path` leaves any variable open. */\nexport type PathHasVariables<Path extends string> = [\n ExtractPathVariables<Path>,\n] extends [never]\n ? false\n : true;\n\n/** First segment of a dot-separated path. */\nexport type PathHead<Path extends string> =\n Path extends `${infer Head}.${string}` ? Head : Path;\n\n/** Everything after the first segment of a dot-separated path (`''` when there is nothing left). */\nexport type PathTail<Path extends string> =\n Path extends `${string}.${infer Rest}` ? Rest : '';\n\nexport function createPathVariable<Name extends string>(\n name: Name,\n): PathVariable<Name> {\n return `${PATH_VARIABLE_IDENTIFIER}${name}`;\n}\n\nexport function isPathVariableSegment(segment: string): boolean {\n return segment.startsWith(PATH_VARIABLE_IDENTIFIER);\n}\n\n/** Variable name for a segment, or `undefined` when the segment is a fixed key. */\nexport function readPathVariableName(segment: string): string | undefined {\n return isPathVariableSegment(segment)\n ? segment.slice(PATH_VARIABLE_IDENTIFIER.length)\n : undefined;\n}\n\n/** Variable names declared by `path`, in order of appearance and without duplicates. */\nexport function extractPathVariables(path: string): string[] {\n const names = new Set<string>();\n\n for (const segment of path.split('.')) {\n const name = readPathVariableName(segment);\n\n if (name !== undefined && name.length > 0) {\n names.add(name);\n }\n }\n\n return [...names];\n}\n\nexport function pathHasVariables(path: string): boolean {\n return extractPathVariables(path).length > 0;\n}\n"],"mappings":";;;;;AAIA,MAAa,2BAA2B;AAkDxC,SAAgB,mBACd,MACoB;CACpB,OAAO,SAA8B;AACvC;AAEA,SAAgB,sBAAsB,SAA0B;CAC9D,OAAO,QAAQ,cAAmC;AACpD;;AAGA,SAAgB,qBAAqB,SAAqC;CACxE,OAAO,sBAAsB,OAAO,IAChC,QAAQ,MAAM,CAA+B,IAC7C;AACN;;AAGA,SAAgB,qBAAqB,MAAwB;CAC3D,MAAM,wBAAQ,IAAI,IAAY;CAE9B,KAAK,MAAM,WAAW,KAAK,MAAM,GAAG,GAAG;EACrC,MAAM,OAAO,qBAAqB,OAAO;EAEzC,IAAI,SAAS,UAAa,KAAK,SAAS,GACtC,MAAM,IAAI,IAAI;CAElB;CAEA,OAAO,CAAC,GAAG,KAAK;AAClB"}
@@ -20,15 +20,35 @@ type SharedResourceConfigOptions = {
20
20
  };
21
21
  type ResourceConfigComponents = BaseResourceConfigComponents & SharedResourceConfigOptions;
22
22
  type ResourceConfigComponentKey = keyof ResourceConfigComponents;
23
- /** Config entry for one sub-resource node (recurses when the layout tree has children). */
23
+ /**
24
+ * Config keys that cannot be used as nested sub-resource slugs. They already
25
+ * name component slots (`component`, `errorComponent`, …) or shared branches
26
+ * (`detail`, `new`). Top-level resource names may still use these strings.
27
+ */
28
+ type ReservedResourceSlug = ResourceConfigComponentKey;
29
+ type ReservedResourceSlugMessage<Slug extends string> = `The resource slug "${Slug}" is reserved for config keys`;
30
+ type UnreservedResourceSlug<Slug extends string> = string extends Slug ? Slug : Slug extends ReservedResourceSlug ? ReservedResourceSlugMessage<Slug> : Slug;
31
+ type AssertUnreservedSubResourceDefinition<Resource> = Resource extends string ? UnreservedResourceSlug<Resource> : Resource extends {
32
+ value: infer Value extends string;
33
+ subResources: infer Subs;
34
+ } ? Omit<Resource, 'value' | 'subResources'> & {
35
+ value: UnreservedResourceSlug<Value>;
36
+ subResources: Subs extends ReadonlyArray<unknown> ? { [Index in keyof Subs]: AssertUnreservedSubResourceDefinition<Subs[Index]> } : Subs;
37
+ } : Resource;
38
+ type AssertUnreservedResourceDefinition<Resource> = Resource extends string ? Resource : Resource extends {
39
+ subResources: infer Subs;
40
+ } ? Omit<Resource, 'subResources'> & {
41
+ subResources: Subs extends ReadonlyArray<unknown> ? { [Index in keyof Subs]: AssertUnreservedSubResourceDefinition<Subs[Index]> } : Subs;
42
+ } : Resource;
43
+ type AssertUnreservedResources<Resources extends ReadonlyArray<unknown>> = { [Index in keyof Resources]: AssertUnreservedResourceDefinition<Resources[Index]> };
44
+ /**
45
+ * Config entry for one sub-resource node. Nested sub-resources are keyed directly by
46
+ * their layout slug (there is no `subResources` wrapper in the config).
47
+ */
24
48
  type SubResourceConfigComponentsFor<Resources extends ReadonlyArray<ResourceDefinition>, SubDef extends ResourceDefinition> = ResourceConfigComponents & (SubDef extends {
25
49
  subResources: infer Nested extends ReadonlyArray<ResourceDefinition>;
26
- } ? {
27
- subResources?: { [K in LayoutResourceKey<Nested>]?: SubResourceConfigComponentsFor<Resources, ResourceDefinitionForKey<Nested, K>> };
28
- } : {});
29
- type SubResourceConfig<Resources extends ReadonlyArray<ResourceDefinition>, Resource extends LayoutResourceKey<Resources>> = [SubResourceDefinitionsFor<Resources, Resource>] extends [readonly []] ? {} : {
30
- subResources?: { [K in LayoutResourceKey<SubResourceDefinitionsFor<Resources, Resource>>]?: SubResourceConfigComponentsFor<Resources, ResourceDefinitionForKey<SubResourceDefinitionsFor<Resources, Resource>, K>> };
31
- };
50
+ } ? { [K in LayoutResourceKey<Nested>]?: SubResourceConfigComponentsFor<Resources, ResourceDefinitionForKey<Nested, K>> } : {});
51
+ type SubResourceConfig<Resources extends ReadonlyArray<ResourceDefinition>, Resource extends LayoutResourceKey<Resources>> = [SubResourceDefinitionsFor<Resources, Resource>] extends [readonly []] ? {} : { [K in LayoutResourceKey<SubResourceDefinitionsFor<Resources, Resource>>]?: SubResourceConfigComponentsFor<Resources, ResourceDefinitionForKey<SubResourceDefinitionsFor<Resources, Resource>, K>> };
32
52
  type ResourceConfig<Resources extends ReadonlyArray<ResourceDefinition>> = { [resource in LayoutResourceKey<Resources>]: ResourceConfigComponents & SubResourceConfig<Resources, resource> };
33
53
  /**
34
54
  * Parameter type for {@link CreateResourceConfigFn}. Intersects the inferred `Config`
@@ -38,5 +58,5 @@ type ResourceConfig<Resources extends ReadonlyArray<ResourceDefinition>> = { [re
38
58
  type ResourceConfigInput<Resources extends ReadonlyArray<ResourceDefinition>, Config extends Partial<ResourceConfig<Resources>>> = Partial<ResourceConfig<Resources>> & Config;
39
59
  type ResourceConfigMap<Resources extends ReadonlyArray<ResourceDefinition>> = Partial<ResourceConfig<Resources>>;
40
60
  //#endregion
41
- export { BaseResourceConfigComponents, ResourceConfig, ResourceConfigComponentKey, ResourceConfigComponents, ResourceConfigInput, ResourceConfigMap, SharedResourceConfigOptions, SubResourceConfig, SubResourceConfigComponentsFor };
61
+ export { AssertUnreservedResources, BaseResourceConfigComponents, ResourceConfig, ResourceConfigComponentKey, ResourceConfigComponents, ResourceConfigInput, ResourceConfigMap, SharedResourceConfigOptions, SubResourceConfig, SubResourceConfigComponentsFor };
42
62
  //# sourceMappingURL=types.d.cts.map
@@ -1 +1 @@
1
- {"version":3,"file":"types.d.cts","names":[],"sources":["../../src/create-config/types.ts"],"mappings":";;;;KAQY,4BAAA;EACV,SAAA,EAAW,GAAA,CAAI,OAAA;EACf,cAAA,GAAiB,GAAA,CAAI,OAAA;EACrB,gBAAA,GAAmB,GAAA,CAAI,OAAA;EACvB,iBAAA,GAAoB,GAAA,CAAI,OAAA;AAAA;AAAA,KASd,2BAAA;EATqB;;;EAa/B,GAAA,GAAM,4BAAA;EAhBS;;;EAoBf,MAAA,GAAS,4BAA4B;AAAA;AAAA,KAG3B,wBAAA,GAA2B,4BAAA,GACrC,2BAA2B;AAAA,KAEjB,0BAAA,SAAmC,wBAAwB;;KAG3D,8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CACE,yBAAA,CAA0B,SAAA,EAAW,QAAA,GACrC,CAAA;AAAA,KAKE,cAAA,mBACQ,aAAA,CAAc,kBAAA,oBAEnB,iBAAA,CAAkB,SAAA,IAAa,wBAAA,GAC1C,iBAAA,CAAkB,SAAA,EAAW,QAAA;;;;;;KAQrB,mBAAA,mBACQ,aAAA,CAAc,kBAAA,kBACjB,OAAA,CAAQ,cAAA,CAAe,SAAA,MACpC,OAAA,CAAQ,cAAA,CAAe,SAAA,KAAc,MAAA;AAAA,KAE7B,iBAAA,mBACQ,aAAA,CAAc,kBAAA,KAC9B,OAAA,CAAQ,cAAA,CAAe,SAAA"}
@@ -20,15 +20,35 @@ type SharedResourceConfigOptions = {
20
20
  };
21
21
  type ResourceConfigComponents = BaseResourceConfigComponents & SharedResourceConfigOptions;
22
22
  type ResourceConfigComponentKey = keyof ResourceConfigComponents;
23
- /** Config entry for one sub-resource node (recurses when the layout tree has children). */
23
+ /**
24
+ * Config keys that cannot be used as nested sub-resource slugs. They already
25
+ * name component slots (`component`, `errorComponent`, …) or shared branches
26
+ * (`detail`, `new`). Top-level resource names may still use these strings.
27
+ */
28
+ type ReservedResourceSlug = ResourceConfigComponentKey;
29
+ type ReservedResourceSlugMessage<Slug extends string> = `The resource slug "${Slug}" is reserved for config keys`;
30
+ type UnreservedResourceSlug<Slug extends string> = string extends Slug ? Slug : Slug extends ReservedResourceSlug ? ReservedResourceSlugMessage<Slug> : Slug;
31
+ type AssertUnreservedSubResourceDefinition<Resource> = Resource extends string ? UnreservedResourceSlug<Resource> : Resource extends {
32
+ value: infer Value extends string;
33
+ subResources: infer Subs;
34
+ } ? Omit<Resource, 'value' | 'subResources'> & {
35
+ value: UnreservedResourceSlug<Value>;
36
+ subResources: Subs extends ReadonlyArray<unknown> ? { [Index in keyof Subs]: AssertUnreservedSubResourceDefinition<Subs[Index]> } : Subs;
37
+ } : Resource;
38
+ type AssertUnreservedResourceDefinition<Resource> = Resource extends string ? Resource : Resource extends {
39
+ subResources: infer Subs;
40
+ } ? Omit<Resource, 'subResources'> & {
41
+ subResources: Subs extends ReadonlyArray<unknown> ? { [Index in keyof Subs]: AssertUnreservedSubResourceDefinition<Subs[Index]> } : Subs;
42
+ } : Resource;
43
+ type AssertUnreservedResources<Resources extends ReadonlyArray<unknown>> = { [Index in keyof Resources]: AssertUnreservedResourceDefinition<Resources[Index]> };
44
+ /**
45
+ * Config entry for one sub-resource node. Nested sub-resources are keyed directly by
46
+ * their layout slug (there is no `subResources` wrapper in the config).
47
+ */
24
48
  type SubResourceConfigComponentsFor<Resources extends ReadonlyArray<ResourceDefinition>, SubDef extends ResourceDefinition> = ResourceConfigComponents & (SubDef extends {
25
49
  subResources: infer Nested extends ReadonlyArray<ResourceDefinition>;
26
- } ? {
27
- subResources?: { [K in LayoutResourceKey<Nested>]?: SubResourceConfigComponentsFor<Resources, ResourceDefinitionForKey<Nested, K>> };
28
- } : {});
29
- type SubResourceConfig<Resources extends ReadonlyArray<ResourceDefinition>, Resource extends LayoutResourceKey<Resources>> = [SubResourceDefinitionsFor<Resources, Resource>] extends [readonly []] ? {} : {
30
- subResources?: { [K in LayoutResourceKey<SubResourceDefinitionsFor<Resources, Resource>>]?: SubResourceConfigComponentsFor<Resources, ResourceDefinitionForKey<SubResourceDefinitionsFor<Resources, Resource>, K>> };
31
- };
50
+ } ? { [K in LayoutResourceKey<Nested>]?: SubResourceConfigComponentsFor<Resources, ResourceDefinitionForKey<Nested, K>> } : {});
51
+ type SubResourceConfig<Resources extends ReadonlyArray<ResourceDefinition>, Resource extends LayoutResourceKey<Resources>> = [SubResourceDefinitionsFor<Resources, Resource>] extends [readonly []] ? {} : { [K in LayoutResourceKey<SubResourceDefinitionsFor<Resources, Resource>>]?: SubResourceConfigComponentsFor<Resources, ResourceDefinitionForKey<SubResourceDefinitionsFor<Resources, Resource>, K>> };
32
52
  type ResourceConfig<Resources extends ReadonlyArray<ResourceDefinition>> = { [resource in LayoutResourceKey<Resources>]: ResourceConfigComponents & SubResourceConfig<Resources, resource> };
33
53
  /**
34
54
  * Parameter type for {@link CreateResourceConfigFn}. Intersects the inferred `Config`
@@ -38,5 +58,5 @@ type ResourceConfig<Resources extends ReadonlyArray<ResourceDefinition>> = { [re
38
58
  type ResourceConfigInput<Resources extends ReadonlyArray<ResourceDefinition>, Config extends Partial<ResourceConfig<Resources>>> = Partial<ResourceConfig<Resources>> & Config;
39
59
  type ResourceConfigMap<Resources extends ReadonlyArray<ResourceDefinition>> = Partial<ResourceConfig<Resources>>;
40
60
  //#endregion
41
- export { BaseResourceConfigComponents, ResourceConfig, ResourceConfigComponentKey, ResourceConfigComponents, ResourceConfigInput, ResourceConfigMap, SharedResourceConfigOptions, SubResourceConfig, SubResourceConfigComponentsFor };
61
+ export { AssertUnreservedResources, BaseResourceConfigComponents, ResourceConfig, ResourceConfigComponentKey, ResourceConfigComponents, ResourceConfigInput, ResourceConfigMap, SharedResourceConfigOptions, SubResourceConfig, SubResourceConfigComponentsFor };
42
62
  //# sourceMappingURL=types.d.mts.map
@@ -1 +1 @@
1
- {"version":3,"file":"types.d.mts","names":[],"sources":["../../src/create-config/types.ts"],"mappings":";;;;KAQY,4BAAA;EACV,SAAA,EAAW,GAAA,CAAI,OAAA;EACf,cAAA,GAAiB,GAAA,CAAI,OAAA;EACrB,gBAAA,GAAmB,GAAA,CAAI,OAAA;EACvB,iBAAA,GAAoB,GAAA,CAAI,OAAA;AAAA;AAAA,KASd,2BAAA;EATqB;;;EAa/B,GAAA,GAAM,4BAAA;EAhBS;;;EAoBf,MAAA,GAAS,4BAA4B;AAAA;AAAA,KAG3B,wBAAA,GAA2B,4BAAA,GACrC,2BAA2B;AAAA,KAEjB,0BAAA,SAAmC,wBAAwB;;KAG3D,8BAAA,mBACQ,aAAA,CAAc,kBAAA,kBACjB,kBAAA,IACb,wBAAA,IACD,MAAA;EACC,YAAA,uBAAmC,aAAA,CAAc,kBAAA;AAAA;EAG7C,YAAA,WACQ,iBAAA,CAAkB,MAAA,KAAW,8BAAA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AW,QAAA;;;;;;KAQrB,mBAAA,mBACQ,aAAA,CAAc,kBAAA,kBACjB,OAAA,CAAQ,cAAA,CAAe,SAAA,MACpC,OAAA,CAAQ,cAAA,CAAe,SAAA,KAAc,MAAA;AAAA,KAE7B,iBAAA,mBACQ,aAAA,CAAc,kBAAA,KAC9B,OAAA,CAAQ,cAAA,CAAe,SAAA"}
@@ -0,0 +1,21 @@
1
+ const require_react_layout_error = require('./react-layout-error.cjs');
2
+
3
+ //#region src/errors/invalid-component.ts
4
+ const scope = "component";
5
+ /** Thrown when a requested component slot cannot be resolved. */
6
+ var InvalidComponentError = class extends require_react_layout_error.createReactLayoutError({
7
+ code: "invalidComponent",
8
+ scope
9
+ })((scope, { component, path, resource, validComponents, reason }) => {
10
+ const quotedComponent = JSON.stringify(component) ?? `"${String(component)}"`;
11
+ const locationParts = [path ? `path "${path}"` : void 0, resource ? `resource "${resource}"` : void 0].filter((part) => part !== void 0);
12
+ const locationMessage = locationParts.length > 0 ? ` for ${locationParts.join(" and ")}` : "";
13
+ return `[${scope}]: ${reason ?? `Component slot ${quotedComponent}${locationMessage} is not configured.`}${validComponents && validComponents.length > 0 ? ` Available component slots are ${new Intl.ListFormat("en", {
14
+ style: "long",
15
+ type: "disjunction"
16
+ }).format(validComponents)}.` : ""}`;
17
+ }) {};
18
+
19
+ //#endregion
20
+ exports.InvalidComponentError = InvalidComponentError;
21
+ //# sourceMappingURL=invalid-component.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"invalid-component.cjs","names":["createReactLayoutError"],"sources":["../../src/errors/invalid-component.ts"],"sourcesContent":["import {\n createReactLayoutError,\n type ReactLayoutErrorContext,\n} from './react-layout-error';\n\nconst scope = 'component' as const;\n\n/** Context describing an invalid or unconfigured component slot. */\nexport interface InvalidComponentContext\n extends ReactLayoutErrorContext<typeof scope> {\n component: unknown;\n path?: string;\n resource?: string;\n validComponents?: readonly string[];\n reason?: string;\n}\n\n/** Thrown when a requested component slot cannot be resolved. */\nexport class InvalidComponentError extends createReactLayoutError(\n { code: 'invalidComponent', scope },\n)(\n (\n scope,\n {\n component,\n path,\n resource,\n validComponents,\n reason,\n }: InvalidComponentContext,\n ) => {\n const quotedComponent =\n JSON.stringify(component) ?? `\"${String(component)}\"`;\n const locationParts = [\n path ? `path \"${path}\"` : undefined,\n resource ? `resource \"${resource}\"` : undefined,\n ].filter((part): part is string => part !== undefined);\n const locationMessage =\n locationParts.length > 0 ? ` for ${locationParts.join(' and ')}` : '';\n const body =\n reason ??\n `Component slot ${quotedComponent}${locationMessage} is not configured.`;\n const validComponentsMessage =\n validComponents && validComponents.length > 0\n ? ` Available component slots are ${new Intl.ListFormat('en', {\n style: 'long',\n type: 'disjunction',\n }).format(validComponents)}.`\n : '';\n\n return `[${scope}]: ${body}${validComponentsMessage}`;\n },\n) {}\n"],"mappings":";;;AAKA,MAAM,QAAQ;;AAad,IAAa,wBAAb,cAA2CA,kDACzC;CAAE,MAAM;CAAoB;AAAM,CACpC,GAEI,OACA,EACE,WACA,MACA,UACA,iBACA,aAEC;CACH,MAAM,kBACJ,KAAK,UAAU,SAAS,KAAK,IAAI,OAAO,SAAS,EAAE;CACrD,MAAM,gBAAgB,CACpB,OAAO,SAAS,KAAK,KAAK,QAC1B,WAAW,aAAa,SAAS,KAAK,MACxC,EAAE,QAAQ,SAAyB,SAAS,MAAS;CACrD,MAAM,kBACJ,cAAc,SAAS,IAAI,QAAQ,cAAc,KAAK,OAAO,MAAM;CAYrE,OAAO,IAAI,MAAM,KAVf,UACA,kBAAkB,kBAAkB,gBAAgB,uBAEpD,mBAAmB,gBAAgB,SAAS,IACxC,kCAAkC,IAAI,KAAK,WAAW,MAAM;EAC1D,OAAO;EACP,MAAM;CACR,CAAC,EAAE,OAAO,eAAe,EAAE,KAC3B;AAGR,CACF,EAAE,CAAC"}
@@ -0,0 +1,18 @@
1
+ import { CreatedReactLayoutError, ReactLayoutErrorContext } from "./react-layout-error.cjs";
2
+
3
+ //#region src/errors/invalid-component.d.ts
4
+ declare const scope: "component";
5
+ /** Context describing an invalid or unconfigured component slot. */
6
+ interface InvalidComponentContext extends ReactLayoutErrorContext<typeof scope> {
7
+ component: unknown;
8
+ path?: string;
9
+ resource?: string;
10
+ validComponents?: readonly string[];
11
+ reason?: string;
12
+ }
13
+ declare const InvalidComponentError_base: CreatedReactLayoutError<"invalidComponent", "component", InvalidComponentContext>;
14
+ /** Thrown when a requested component slot cannot be resolved. */
15
+ declare class InvalidComponentError extends InvalidComponentError_base {}
16
+ //#endregion
17
+ export { InvalidComponentContext, InvalidComponentError };
18
+ //# sourceMappingURL=invalid-component.d.cts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"invalid-component.d.cts","names":[],"sources":["../../src/errors/invalid-component.ts"],"mappings":";;;cAKM,KAAA;;UAGW,uBAAA,SACP,uBAAuB,QAAQ,KAAA;EACvC,SAAA;EACA,IAAA;EACA,QAAA;EACA,eAAA;EACA,MAAA;AAAA;AAAA,cACD,0BAAA;;cAGY,qBAAA,SAA8B,0BAkC1C"}
@@ -0,0 +1,18 @@
1
+ import { CreatedReactLayoutError, ReactLayoutErrorContext } from "./react-layout-error.mjs";
2
+
3
+ //#region src/errors/invalid-component.d.ts
4
+ declare const scope: "component";
5
+ /** Context describing an invalid or unconfigured component slot. */
6
+ interface InvalidComponentContext extends ReactLayoutErrorContext<typeof scope> {
7
+ component: unknown;
8
+ path?: string;
9
+ resource?: string;
10
+ validComponents?: readonly string[];
11
+ reason?: string;
12
+ }
13
+ declare const InvalidComponentError_base: CreatedReactLayoutError<"invalidComponent", "component", InvalidComponentContext>;
14
+ /** Thrown when a requested component slot cannot be resolved. */
15
+ declare class InvalidComponentError extends InvalidComponentError_base {}
16
+ //#endregion
17
+ export { InvalidComponentContext, InvalidComponentError };
18
+ //# sourceMappingURL=invalid-component.d.mts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"invalid-component.d.mts","names":[],"sources":["../../src/errors/invalid-component.ts"],"mappings":";;;cAKM,KAAA;;UAGW,uBAAA,SACP,uBAAuB,QAAQ,KAAA;EACvC,SAAA;EACA,IAAA;EACA,QAAA;EACA,eAAA;EACA,MAAA;AAAA;AAAA,cACD,0BAAA;;cAGY,qBAAA,SAA8B,0BAkC1C"}
@@ -0,0 +1,21 @@
1
+ import { createReactLayoutError } from "./react-layout-error.mjs";
2
+
3
+ //#region src/errors/invalid-component.ts
4
+ const scope = "component";
5
+ /** Thrown when a requested component slot cannot be resolved. */
6
+ var InvalidComponentError = class extends createReactLayoutError({
7
+ code: "invalidComponent",
8
+ scope
9
+ })((scope, { component, path, resource, validComponents, reason }) => {
10
+ const quotedComponent = JSON.stringify(component) ?? `"${String(component)}"`;
11
+ const locationParts = [path ? `path "${path}"` : void 0, resource ? `resource "${resource}"` : void 0].filter((part) => part !== void 0);
12
+ const locationMessage = locationParts.length > 0 ? ` for ${locationParts.join(" and ")}` : "";
13
+ return `[${scope}]: ${reason ?? `Component slot ${quotedComponent}${locationMessage} is not configured.`}${validComponents && validComponents.length > 0 ? ` Available component slots are ${new Intl.ListFormat("en", {
14
+ style: "long",
15
+ type: "disjunction"
16
+ }).format(validComponents)}.` : ""}`;
17
+ }) {};
18
+
19
+ //#endregion
20
+ export { InvalidComponentError };
21
+ //# sourceMappingURL=invalid-component.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"invalid-component.mjs","names":[],"sources":["../../src/errors/invalid-component.ts"],"sourcesContent":["import {\n createReactLayoutError,\n type ReactLayoutErrorContext,\n} from './react-layout-error';\n\nconst scope = 'component' as const;\n\n/** Context describing an invalid or unconfigured component slot. */\nexport interface InvalidComponentContext\n extends ReactLayoutErrorContext<typeof scope> {\n component: unknown;\n path?: string;\n resource?: string;\n validComponents?: readonly string[];\n reason?: string;\n}\n\n/** Thrown when a requested component slot cannot be resolved. */\nexport class InvalidComponentError extends createReactLayoutError(\n { code: 'invalidComponent', scope },\n)(\n (\n scope,\n {\n component,\n path,\n resource,\n validComponents,\n reason,\n }: InvalidComponentContext,\n ) => {\n const quotedComponent =\n JSON.stringify(component) ?? `\"${String(component)}\"`;\n const locationParts = [\n path ? `path \"${path}\"` : undefined,\n resource ? `resource \"${resource}\"` : undefined,\n ].filter((part): part is string => part !== undefined);\n const locationMessage =\n locationParts.length > 0 ? ` for ${locationParts.join(' and ')}` : '';\n const body =\n reason ??\n `Component slot ${quotedComponent}${locationMessage} is not configured.`;\n const validComponentsMessage =\n validComponents && validComponents.length > 0\n ? ` Available component slots are ${new Intl.ListFormat('en', {\n style: 'long',\n type: 'disjunction',\n }).format(validComponents)}.`\n : '';\n\n return `[${scope}]: ${body}${validComponentsMessage}`;\n },\n) {}\n"],"mappings":";;;AAKA,MAAM,QAAQ;;AAad,IAAa,wBAAb,cAA2C,uBACzC;CAAE,MAAM;CAAoB;AAAM,CACpC,GAEI,OACA,EACE,WACA,MACA,UACA,iBACA,aAEC;CACH,MAAM,kBACJ,KAAK,UAAU,SAAS,KAAK,IAAI,OAAO,SAAS,EAAE;CACrD,MAAM,gBAAgB,CACpB,OAAO,SAAS,KAAK,KAAK,QAC1B,WAAW,aAAa,SAAS,KAAK,MACxC,EAAE,QAAQ,SAAyB,SAAS,MAAS;CACrD,MAAM,kBACJ,cAAc,SAAS,IAAI,QAAQ,cAAc,KAAK,OAAO,MAAM;CAYrE,OAAO,IAAI,MAAM,KAVf,UACA,kBAAkB,kBAAkB,gBAAgB,uBAEpD,mBAAmB,gBAAgB,SAAS,IACxC,kCAAkC,IAAI,KAAK,WAAW,MAAM;EAC1D,OAAO;EACP,MAAM;CACR,CAAC,EAAE,OAAO,eAAe,EAAE,KAC3B;AAGR,CACF,EAAE,CAAC"}
@@ -0,0 +1,13 @@
1
+ const require_react_layout_error = require('./react-layout-error.cjs');
2
+
3
+ //#region src/errors/invalid-config.ts
4
+ const scope = "config";
5
+ /** Thrown when a React Layout configuration is invalid. */
6
+ var InvalidConfigError = class extends require_react_layout_error.createReactLayoutError({
7
+ code: "invalidConfig",
8
+ scope
9
+ })((scope, { reason }) => `[${scope}]: The layout configuration is invalid: ${reason}`) {};
10
+
11
+ //#endregion
12
+ exports.InvalidConfigError = InvalidConfigError;
13
+ //# sourceMappingURL=invalid-config.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"invalid-config.cjs","names":["createReactLayoutError"],"sources":["../../src/errors/invalid-config.ts"],"sourcesContent":["import {\n createReactLayoutError,\n type ReactLayoutErrorContext,\n} from './react-layout-error';\n\nconst scope = 'config' as const;\n\n/** Context describing a configuration that React Layout cannot use. */\nexport interface InvalidConfigContext\n extends ReactLayoutErrorContext<typeof scope> {\n reason: string;\n config?: unknown;\n}\n\n/** Thrown when a React Layout configuration is invalid. */\nexport class InvalidConfigError extends createReactLayoutError(\n { code: 'invalidConfig', scope },\n)(\n (scope, { reason }: InvalidConfigContext) =>\n `[${scope}]: The layout configuration is invalid: ${reason}`,\n) {}\n"],"mappings":";;;AAKA,MAAM,QAAQ;;AAUd,IAAa,qBAAb,cAAwCA,kDACtC;CAAE,MAAM;CAAiB;AAAM,CACjC,GACG,OAAO,EAAE,aACR,IAAI,MAAM,0CAA0C,QACxD,EAAE,CAAC"}
@@ -0,0 +1,15 @@
1
+ import { CreatedReactLayoutError, ReactLayoutErrorContext } from "./react-layout-error.cjs";
2
+
3
+ //#region src/errors/invalid-config.d.ts
4
+ declare const scope: "config";
5
+ /** Context describing a configuration that React Layout cannot use. */
6
+ interface InvalidConfigContext extends ReactLayoutErrorContext<typeof scope> {
7
+ reason: string;
8
+ config?: unknown;
9
+ }
10
+ declare const InvalidConfigError_base: CreatedReactLayoutError<"invalidConfig", "config", InvalidConfigContext>;
11
+ /** Thrown when a React Layout configuration is invalid. */
12
+ declare class InvalidConfigError extends InvalidConfigError_base {}
13
+ //#endregion
14
+ export { InvalidConfigContext, InvalidConfigError };
15
+ //# sourceMappingURL=invalid-config.d.cts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"invalid-config.d.cts","names":[],"sources":["../../src/errors/invalid-config.ts"],"mappings":";;;cAKM,KAAA;;UAGW,oBAAA,SACP,uBAAuB,QAAQ,KAAA;EACvC,MAAA;EACA,MAAA;AAAA;AAAA,cACD,uBAAA;AAJD;AAAA,cAOa,kBAAA,SAA2B,uBAKvC"}
@@ -0,0 +1,15 @@
1
+ import { CreatedReactLayoutError, ReactLayoutErrorContext } from "./react-layout-error.mjs";
2
+
3
+ //#region src/errors/invalid-config.d.ts
4
+ declare const scope: "config";
5
+ /** Context describing a configuration that React Layout cannot use. */
6
+ interface InvalidConfigContext extends ReactLayoutErrorContext<typeof scope> {
7
+ reason: string;
8
+ config?: unknown;
9
+ }
10
+ declare const InvalidConfigError_base: CreatedReactLayoutError<"invalidConfig", "config", InvalidConfigContext>;
11
+ /** Thrown when a React Layout configuration is invalid. */
12
+ declare class InvalidConfigError extends InvalidConfigError_base {}
13
+ //#endregion
14
+ export { InvalidConfigContext, InvalidConfigError };
15
+ //# sourceMappingURL=invalid-config.d.mts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"invalid-config.d.mts","names":[],"sources":["../../src/errors/invalid-config.ts"],"mappings":";;;cAKM,KAAA;;UAGW,oBAAA,SACP,uBAAuB,QAAQ,KAAA;EACvC,MAAA;EACA,MAAA;AAAA;AAAA,cACD,uBAAA;AAJD;AAAA,cAOa,kBAAA,SAA2B,uBAKvC"}
@@ -0,0 +1,13 @@
1
+ import { createReactLayoutError } from "./react-layout-error.mjs";
2
+
3
+ //#region src/errors/invalid-config.ts
4
+ const scope = "config";
5
+ /** Thrown when a React Layout configuration is invalid. */
6
+ var InvalidConfigError = class extends createReactLayoutError({
7
+ code: "invalidConfig",
8
+ scope
9
+ })((scope, { reason }) => `[${scope}]: The layout configuration is invalid: ${reason}`) {};
10
+
11
+ //#endregion
12
+ export { InvalidConfigError };
13
+ //# sourceMappingURL=invalid-config.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"invalid-config.mjs","names":[],"sources":["../../src/errors/invalid-config.ts"],"sourcesContent":["import {\n createReactLayoutError,\n type ReactLayoutErrorContext,\n} from './react-layout-error';\n\nconst scope = 'config' as const;\n\n/** Context describing a configuration that React Layout cannot use. */\nexport interface InvalidConfigContext\n extends ReactLayoutErrorContext<typeof scope> {\n reason: string;\n config?: unknown;\n}\n\n/** Thrown when a React Layout configuration is invalid. */\nexport class InvalidConfigError extends createReactLayoutError(\n { code: 'invalidConfig', scope },\n)(\n (scope, { reason }: InvalidConfigContext) =>\n `[${scope}]: The layout configuration is invalid: ${reason}`,\n) {}\n"],"mappings":";;;AAKA,MAAM,QAAQ;;AAUd,IAAa,qBAAb,cAAwC,uBACtC;CAAE,MAAM;CAAiB;AAAM,CACjC,GACG,OAAO,EAAE,aACR,IAAI,MAAM,0CAA0C,QACxD,EAAE,CAAC"}
@@ -0,0 +1,18 @@
1
+ const require_react_layout_error = require('./react-layout-error.cjs');
2
+
3
+ //#region src/errors/invalid-path.ts
4
+ const scope = "path";
5
+ /** Thrown when a requested layout path is invalid or unavailable. */
6
+ var InvalidPathError = class extends require_react_layout_error.createReactLayoutError({
7
+ code: "invalidPath",
8
+ scope
9
+ })((scope, { path, validPaths, reason }) => {
10
+ return `[${scope}]: Path ${JSON.stringify(path) ?? `"${String(path)}"`} is not available.${reason ? ` ${reason}` : ""}${validPaths && validPaths.length > 0 ? ` Available paths are ${new Intl.ListFormat("en", {
11
+ style: "long",
12
+ type: "disjunction"
13
+ }).format(validPaths)}.` : ""}`;
14
+ }) {};
15
+
16
+ //#endregion
17
+ exports.InvalidPathError = InvalidPathError;
18
+ //# sourceMappingURL=invalid-path.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"invalid-path.cjs","names":["createReactLayoutError"],"sources":["../../src/errors/invalid-path.ts"],"sourcesContent":["import {\n createReactLayoutError,\n type ReactLayoutErrorContext,\n} from './react-layout-error';\n\nconst scope = 'path' as const;\n\n/** Context describing a path that is unavailable to React Layout. */\nexport interface InvalidPathContext\n extends ReactLayoutErrorContext<typeof scope> {\n path: unknown;\n validPaths?: readonly string[];\n reason?: string;\n}\n\n/** Thrown when a requested layout path is invalid or unavailable. */\nexport class InvalidPathError extends createReactLayoutError(\n { code: 'invalidPath', scope },\n)((scope, { path, validPaths, reason }: InvalidPathContext) => {\n const quotedPath = JSON.stringify(path) ?? `\"${String(path)}\"`;\n const reasonMessage = reason ? ` ${reason}` : '';\n const validPathsMessage =\n validPaths && validPaths.length > 0\n ? ` Available paths are ${new Intl.ListFormat('en', {\n style: 'long',\n type: 'disjunction',\n }).format(validPaths)}.`\n : '';\n\n return `[${scope}]: Path ${quotedPath} is not available.${reasonMessage}${validPathsMessage}`;\n}) {}\n"],"mappings":";;;AAKA,MAAM,QAAQ;;AAWd,IAAa,mBAAb,cAAsCA,kDACpC;CAAE,MAAM;CAAe;AAAM,CAC/B,GAAG,OAAO,EAAE,MAAM,YAAY,aAAiC;CAW7D,OAAO,IAAI,MAAM,UAVE,KAAK,UAAU,IAAI,KAAK,IAAI,OAAO,IAAI,EAAE,GAUtB,oBAThB,SAAS,IAAI,WAAW,KAE5C,cAAc,WAAW,SAAS,IAC9B,wBAAwB,IAAI,KAAK,WAAW,MAAM;EAChD,OAAO;EACP,MAAM;CACR,CAAC,EAAE,OAAO,UAAU,EAAE,KACtB;AAGR,CAAC,EAAE,CAAC"}
@@ -0,0 +1,16 @@
1
+ import { CreatedReactLayoutError, ReactLayoutErrorContext } from "./react-layout-error.cjs";
2
+
3
+ //#region src/errors/invalid-path.d.ts
4
+ declare const scope: "path";
5
+ /** Context describing a path that is unavailable to React Layout. */
6
+ interface InvalidPathContext extends ReactLayoutErrorContext<typeof scope> {
7
+ path: unknown;
8
+ validPaths?: readonly string[];
9
+ reason?: string;
10
+ }
11
+ declare const InvalidPathError_base: CreatedReactLayoutError<"invalidPath", "path", InvalidPathContext>;
12
+ /** Thrown when a requested layout path is invalid or unavailable. */
13
+ declare class InvalidPathError extends InvalidPathError_base {}
14
+ //#endregion
15
+ export { InvalidPathContext, InvalidPathError };
16
+ //# sourceMappingURL=invalid-path.d.cts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"invalid-path.d.cts","names":[],"sources":["../../src/errors/invalid-path.ts"],"mappings":";;;cAKM,KAAA;;UAGW,kBAAA,SACP,uBAAuB,QAAQ,KAAA;EACvC,IAAA;EACA,UAAA;EACA,MAAA;AAAA;AAAA,cACD,qBAAA;;cAGY,gBAAA,SAAyB,qBAcpC"}
@@ -0,0 +1,16 @@
1
+ import { CreatedReactLayoutError, ReactLayoutErrorContext } from "./react-layout-error.mjs";
2
+
3
+ //#region src/errors/invalid-path.d.ts
4
+ declare const scope: "path";
5
+ /** Context describing a path that is unavailable to React Layout. */
6
+ interface InvalidPathContext extends ReactLayoutErrorContext<typeof scope> {
7
+ path: unknown;
8
+ validPaths?: readonly string[];
9
+ reason?: string;
10
+ }
11
+ declare const InvalidPathError_base: CreatedReactLayoutError<"invalidPath", "path", InvalidPathContext>;
12
+ /** Thrown when a requested layout path is invalid or unavailable. */
13
+ declare class InvalidPathError extends InvalidPathError_base {}
14
+ //#endregion
15
+ export { InvalidPathContext, InvalidPathError };
16
+ //# sourceMappingURL=invalid-path.d.mts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"invalid-path.d.mts","names":[],"sources":["../../src/errors/invalid-path.ts"],"mappings":";;;cAKM,KAAA;;UAGW,kBAAA,SACP,uBAAuB,QAAQ,KAAA;EACvC,IAAA;EACA,UAAA;EACA,MAAA;AAAA;AAAA,cACD,qBAAA;;cAGY,gBAAA,SAAyB,qBAcpC"}
@@ -0,0 +1,18 @@
1
+ import { createReactLayoutError } from "./react-layout-error.mjs";
2
+
3
+ //#region src/errors/invalid-path.ts
4
+ const scope = "path";
5
+ /** Thrown when a requested layout path is invalid or unavailable. */
6
+ var InvalidPathError = class extends createReactLayoutError({
7
+ code: "invalidPath",
8
+ scope
9
+ })((scope, { path, validPaths, reason }) => {
10
+ return `[${scope}]: Path ${JSON.stringify(path) ?? `"${String(path)}"`} is not available.${reason ? ` ${reason}` : ""}${validPaths && validPaths.length > 0 ? ` Available paths are ${new Intl.ListFormat("en", {
11
+ style: "long",
12
+ type: "disjunction"
13
+ }).format(validPaths)}.` : ""}`;
14
+ }) {};
15
+
16
+ //#endregion
17
+ export { InvalidPathError };
18
+ //# sourceMappingURL=invalid-path.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"invalid-path.mjs","names":[],"sources":["../../src/errors/invalid-path.ts"],"sourcesContent":["import {\n createReactLayoutError,\n type ReactLayoutErrorContext,\n} from './react-layout-error';\n\nconst scope = 'path' as const;\n\n/** Context describing a path that is unavailable to React Layout. */\nexport interface InvalidPathContext\n extends ReactLayoutErrorContext<typeof scope> {\n path: unknown;\n validPaths?: readonly string[];\n reason?: string;\n}\n\n/** Thrown when a requested layout path is invalid or unavailable. */\nexport class InvalidPathError extends createReactLayoutError(\n { code: 'invalidPath', scope },\n)((scope, { path, validPaths, reason }: InvalidPathContext) => {\n const quotedPath = JSON.stringify(path) ?? `\"${String(path)}\"`;\n const reasonMessage = reason ? ` ${reason}` : '';\n const validPathsMessage =\n validPaths && validPaths.length > 0\n ? ` Available paths are ${new Intl.ListFormat('en', {\n style: 'long',\n type: 'disjunction',\n }).format(validPaths)}.`\n : '';\n\n return `[${scope}]: Path ${quotedPath} is not available.${reasonMessage}${validPathsMessage}`;\n}) {}\n"],"mappings":";;;AAKA,MAAM,QAAQ;;AAWd,IAAa,mBAAb,cAAsC,uBACpC;CAAE,MAAM;CAAe;AAAM,CAC/B,GAAG,OAAO,EAAE,MAAM,YAAY,aAAiC;CAW7D,OAAO,IAAI,MAAM,UAVE,KAAK,UAAU,IAAI,KAAK,IAAI,OAAO,IAAI,EAAE,GAUtB,oBAThB,SAAS,IAAI,WAAW,KAE5C,cAAc,WAAW,SAAS,IAC9B,wBAAwB,IAAI,KAAK,WAAW,MAAM;EAChD,OAAO;EACP,MAAM;CACR,CAAC,EAAE,OAAO,UAAU,EAAE,KACtB;AAGR,CAAC,EAAE,CAAC"}
@@ -0,0 +1,18 @@
1
+ const require_react_layout_error = require('./react-layout-error.cjs');
2
+
3
+ //#region src/errors/invalid-resource.ts
4
+ const scope = "resource";
5
+ /** Thrown when a requested layout resource is invalid or unavailable. */
6
+ var InvalidResourceError = class extends require_react_layout_error.createReactLayoutError({
7
+ code: "invalidResource",
8
+ scope
9
+ })((scope, { resource, validResources, reason }) => {
10
+ return `[${scope}]: Resource ${JSON.stringify(resource) ?? `"${String(resource)}"`} is not available.${reason ? ` ${reason}` : ""}${validResources && validResources.length > 0 ? ` Available resources are ${new Intl.ListFormat("en", {
11
+ style: "long",
12
+ type: "disjunction"
13
+ }).format(validResources)}.` : ""}`;
14
+ }) {};
15
+
16
+ //#endregion
17
+ exports.InvalidResourceError = InvalidResourceError;
18
+ //# sourceMappingURL=invalid-resource.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"invalid-resource.cjs","names":["createReactLayoutError"],"sources":["../../src/errors/invalid-resource.ts"],"sourcesContent":["import {\n createReactLayoutError,\n type ReactLayoutErrorContext,\n} from './react-layout-error';\n\nconst scope = 'resource' as const;\n\n/** Context describing a resource that is unavailable to React Layout. */\nexport interface InvalidResourceContext\n extends ReactLayoutErrorContext<typeof scope> {\n resource: unknown;\n validResources?: readonly string[];\n reason?: string;\n}\n\n/** Thrown when a requested layout resource is invalid or unavailable. */\nexport class InvalidResourceError extends createReactLayoutError(\n { code: 'invalidResource', scope },\n)((scope, { resource, validResources, reason }: InvalidResourceContext) => {\n const quotedResource = JSON.stringify(resource) ?? `\"${String(resource)}\"`;\n const reasonMessage = reason ? ` ${reason}` : '';\n const validResourcesMessage =\n validResources && validResources.length > 0\n ? ` Available resources are ${new Intl.ListFormat('en', {\n style: 'long',\n type: 'disjunction',\n }).format(validResources)}.`\n : '';\n\n return `[${scope}]: Resource ${quotedResource} is not available.${reasonMessage}${validResourcesMessage}`;\n}) {}\n"],"mappings":";;;AAKA,MAAM,QAAQ;;AAWd,IAAa,uBAAb,cAA0CA,kDACxC;CAAE,MAAM;CAAmB;AAAM,CACnC,GAAG,OAAO,EAAE,UAAU,gBAAgB,aAAqC;CAWzE,OAAO,IAAI,MAAM,cAVM,KAAK,UAAU,QAAQ,KAAK,IAAI,OAAO,QAAQ,EAAE,GAU1B,oBATxB,SAAS,IAAI,WAAW,KAE5C,kBAAkB,eAAe,SAAS,IACtC,4BAA4B,IAAI,KAAK,WAAW,MAAM;EACpD,OAAO;EACP,MAAM;CACR,CAAC,EAAE,OAAO,cAAc,EAAE,KAC1B;AAGR,CAAC,EAAE,CAAC"}
@@ -0,0 +1,16 @@
1
+ import { CreatedReactLayoutError, ReactLayoutErrorContext } from "./react-layout-error.cjs";
2
+
3
+ //#region src/errors/invalid-resource.d.ts
4
+ declare const scope: "resource";
5
+ /** Context describing a resource that is unavailable to React Layout. */
6
+ interface InvalidResourceContext extends ReactLayoutErrorContext<typeof scope> {
7
+ resource: unknown;
8
+ validResources?: readonly string[];
9
+ reason?: string;
10
+ }
11
+ declare const InvalidResourceError_base: CreatedReactLayoutError<"invalidResource", "resource", InvalidResourceContext>;
12
+ /** Thrown when a requested layout resource is invalid or unavailable. */
13
+ declare class InvalidResourceError extends InvalidResourceError_base {}
14
+ //#endregion
15
+ export { InvalidResourceContext, InvalidResourceError };
16
+ //# sourceMappingURL=invalid-resource.d.cts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"invalid-resource.d.cts","names":[],"sources":["../../src/errors/invalid-resource.ts"],"mappings":";;;cAKM,KAAA;;UAGW,sBAAA,SACP,uBAAuB,QAAQ,KAAA;EACvC,QAAA;EACA,cAAA;EACA,MAAA;AAAA;AAAA,cACD,yBAAA;;cAGY,oBAAA,SAA6B,yBAcxC"}
@@ -0,0 +1,16 @@
1
+ import { CreatedReactLayoutError, ReactLayoutErrorContext } from "./react-layout-error.mjs";
2
+
3
+ //#region src/errors/invalid-resource.d.ts
4
+ declare const scope: "resource";
5
+ /** Context describing a resource that is unavailable to React Layout. */
6
+ interface InvalidResourceContext extends ReactLayoutErrorContext<typeof scope> {
7
+ resource: unknown;
8
+ validResources?: readonly string[];
9
+ reason?: string;
10
+ }
11
+ declare const InvalidResourceError_base: CreatedReactLayoutError<"invalidResource", "resource", InvalidResourceContext>;
12
+ /** Thrown when a requested layout resource is invalid or unavailable. */
13
+ declare class InvalidResourceError extends InvalidResourceError_base {}
14
+ //#endregion
15
+ export { InvalidResourceContext, InvalidResourceError };
16
+ //# sourceMappingURL=invalid-resource.d.mts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"invalid-resource.d.mts","names":[],"sources":["../../src/errors/invalid-resource.ts"],"mappings":";;;cAKM,KAAA;;UAGW,sBAAA,SACP,uBAAuB,QAAQ,KAAA;EACvC,QAAA;EACA,cAAA;EACA,MAAA;AAAA;AAAA,cACD,yBAAA;;cAGY,oBAAA,SAA6B,yBAcxC"}
@@ -0,0 +1,18 @@
1
+ import { createReactLayoutError } from "./react-layout-error.mjs";
2
+
3
+ //#region src/errors/invalid-resource.ts
4
+ const scope = "resource";
5
+ /** Thrown when a requested layout resource is invalid or unavailable. */
6
+ var InvalidResourceError = class extends createReactLayoutError({
7
+ code: "invalidResource",
8
+ scope
9
+ })((scope, { resource, validResources, reason }) => {
10
+ return `[${scope}]: Resource ${JSON.stringify(resource) ?? `"${String(resource)}"`} is not available.${reason ? ` ${reason}` : ""}${validResources && validResources.length > 0 ? ` Available resources are ${new Intl.ListFormat("en", {
11
+ style: "long",
12
+ type: "disjunction"
13
+ }).format(validResources)}.` : ""}`;
14
+ }) {};
15
+
16
+ //#endregion
17
+ export { InvalidResourceError };
18
+ //# sourceMappingURL=invalid-resource.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"invalid-resource.mjs","names":[],"sources":["../../src/errors/invalid-resource.ts"],"sourcesContent":["import {\n createReactLayoutError,\n type ReactLayoutErrorContext,\n} from './react-layout-error';\n\nconst scope = 'resource' as const;\n\n/** Context describing a resource that is unavailable to React Layout. */\nexport interface InvalidResourceContext\n extends ReactLayoutErrorContext<typeof scope> {\n resource: unknown;\n validResources?: readonly string[];\n reason?: string;\n}\n\n/** Thrown when a requested layout resource is invalid or unavailable. */\nexport class InvalidResourceError extends createReactLayoutError(\n { code: 'invalidResource', scope },\n)((scope, { resource, validResources, reason }: InvalidResourceContext) => {\n const quotedResource = JSON.stringify(resource) ?? `\"${String(resource)}\"`;\n const reasonMessage = reason ? ` ${reason}` : '';\n const validResourcesMessage =\n validResources && validResources.length > 0\n ? ` Available resources are ${new Intl.ListFormat('en', {\n style: 'long',\n type: 'disjunction',\n }).format(validResources)}.`\n : '';\n\n return `[${scope}]: Resource ${quotedResource} is not available.${reasonMessage}${validResourcesMessage}`;\n}) {}\n"],"mappings":";;;AAKA,MAAM,QAAQ;;AAWd,IAAa,uBAAb,cAA0C,uBACxC;CAAE,MAAM;CAAmB;AAAM,CACnC,GAAG,OAAO,EAAE,UAAU,gBAAgB,aAAqC;CAWzE,OAAO,IAAI,MAAM,cAVM,KAAK,UAAU,QAAQ,KAAK,IAAI,OAAO,QAAQ,EAAE,GAU1B,oBATxB,SAAS,IAAI,WAAW,KAE5C,kBAAkB,eAAe,SAAS,IACtC,4BAA4B,IAAI,KAAK,WAAW,MAAM;EACpD,OAAO;EACP,MAAM;CACR,CAAC,EAAE,OAAO,cAAc,EAAE,KAC1B;AAGR,CAAC,EAAE,CAAC"}
@@ -0,0 +1,18 @@
1
+ const require_react_layout_error = require('./react-layout-error.cjs');
2
+
3
+ //#region src/errors/invalid-sub-resource.ts
4
+ const scope = "subResource";
5
+ /** Thrown when a requested sub-resource is invalid or unavailable. */
6
+ var InvalidSubResourceError = class extends require_react_layout_error.createReactLayoutError({
7
+ code: "invalidSubResource",
8
+ scope
9
+ })((scope, { subResource, resource, validSubResources, reason }) => {
10
+ return `[${scope}]: Sub-resource ${JSON.stringify(subResource) ?? `"${String(subResource)}"`}${resource ? ` for resource "${resource}"` : ""} is not available.${reason ? ` ${reason}` : ""}${validSubResources && validSubResources.length > 0 ? ` Available sub-resources are ${new Intl.ListFormat("en", {
11
+ style: "long",
12
+ type: "disjunction"
13
+ }).format(validSubResources)}.` : ""}`;
14
+ }) {};
15
+
16
+ //#endregion
17
+ exports.InvalidSubResourceError = InvalidSubResourceError;
18
+ //# sourceMappingURL=invalid-sub-resource.cjs.map