@jfdevelops/react-layout-composables 1.0.0 → 1.1.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/composable.cjs +124 -12
- package/dist/composable.cjs.map +1 -1
- package/dist/composable.d.cts +98 -13
- package/dist/composable.d.cts.map +1 -1
- package/dist/composable.d.mts +98 -13
- package/dist/composable.d.mts.map +1 -1
- package/dist/composable.mjs +125 -13
- package/dist/composable.mjs.map +1 -1
- package/dist/custom-props.cjs +20 -0
- package/dist/custom-props.cjs.map +1 -0
- package/dist/custom-props.d.cts +36 -0
- package/dist/custom-props.d.cts.map +1 -0
- package/dist/custom-props.d.mts +36 -0
- package/dist/custom-props.d.mts.map +1 -0
- package/dist/custom-props.mjs +20 -0
- package/dist/custom-props.mjs.map +1 -0
- package/dist/errors.cjs +28 -4
- package/dist/errors.cjs.map +1 -1
- package/dist/errors.d.cts +152 -21
- package/dist/errors.d.cts.map +1 -1
- package/dist/errors.d.mts +152 -21
- package/dist/errors.d.mts.map +1 -1
- package/dist/errors.mjs +26 -5
- package/dist/errors.mjs.map +1 -1
- package/dist/index.cjs +22 -0
- package/dist/index.d.cts +5 -3
- package/dist/index.d.mts +5 -3
- package/dist/index.mjs +3 -2
- package/package.json +2 -3
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import { ReactNode } from "react";
|
|
2
|
+
import { PropDefinition, PropValidator, PropValidatorSchema } from "@jfdevelops/react-layout-validator";
|
|
3
|
+
|
|
4
|
+
//#region src/custom-props.d.ts
|
|
5
|
+
/** Marks the built-in `children` slot as required. */
|
|
6
|
+
type ChildrenRequirement = 'required';
|
|
7
|
+
type CustomPropsOf<Definition> = Record<string, Definition | ChildrenRequirement> & {
|
|
8
|
+
/** Optional React content by default; an explicit schema replaces that default. */children?: Definition | ChildrenRequirement;
|
|
9
|
+
};
|
|
10
|
+
/**
|
|
11
|
+
* Custom props keyed by prop name. This one type defines every `props.custom`
|
|
12
|
+
* in the library: layouts, render states, components, and composables.
|
|
13
|
+
*
|
|
14
|
+
* Elsewhere `props` is `{ include, custom }`, where `include` selects shared
|
|
15
|
+
* layout options. A defined composable has no shared options to select, so
|
|
16
|
+
* its `props` is this object directly, as if it were `custom`.
|
|
17
|
+
*/
|
|
18
|
+
type CustomPropsObject = CustomPropsOf<PropDefinition>;
|
|
19
|
+
/** String requirements are reserved for the built-in children slot. */
|
|
20
|
+
type CustomPropsInput<Props extends CustomPropsObject> = { [Key in keyof Props]: Key extends 'children' ? Props[Key] : Extract<Props[Key], PropDefinition> };
|
|
21
|
+
/** One prop of a defined composable: a schema, or an inline validator. */
|
|
22
|
+
type ComposablePropDefinition = PropDefinition | PropValidator;
|
|
23
|
+
/**
|
|
24
|
+
* The `props` of a defined composable: the library's custom props object,
|
|
25
|
+
* whose definitions may also be inline validators.
|
|
26
|
+
*/
|
|
27
|
+
type ComposableProps = CustomPropsOf<ComposablePropDefinition>;
|
|
28
|
+
/** {@link CustomPropsInput} for props that may also be inline validators. */
|
|
29
|
+
type ComposablePropsInput<Props extends ComposableProps> = { [Key in keyof Props]: Key extends 'children' ? Props[Key] : Extract<Props[Key], ComposablePropDefinition> };
|
|
30
|
+
/** The schema behind the `children: 'required'` shorthand. */
|
|
31
|
+
type RequiredChildren = PropValidatorSchema<Exclude<ReactNode, undefined>>;
|
|
32
|
+
/** The prop definitions that a defined composable's `props` resolve to. */
|
|
33
|
+
type NormalizeComposableProps<Props> = { [Key in keyof Props]: Props[Key] extends PropDefinition ? Props[Key] : Props[Key] extends ChildrenRequirement ? RequiredChildren : Props[Key] extends ((...args: never[]) => infer Value) ? PropValidatorSchema<Value> : never };
|
|
34
|
+
//#endregion
|
|
35
|
+
export { ChildrenRequirement, ComposablePropDefinition, ComposableProps, ComposablePropsInput, CustomPropsInput, CustomPropsObject, NormalizeComposableProps, RequiredChildren };
|
|
36
|
+
//# sourceMappingURL=custom-props.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"custom-props.d.mts","names":[],"sources":["../src/custom-props.ts"],"mappings":";;;;;KAWY,mBAAA;AAAA,KAGP,aAAA,eAA4B,MAAA,SAE/B,UAAA,GAAa,mBAAA;EALgB,mFAQ7B,QAAA,GAAW,UAAA,GAAa,mBAAA;AAAA;AARK;AAAc;;;;;;;AAAd,KAmBnB,iBAAA,GAAoB,aAAa,CAAC,cAAA;;KAGlC,gBAAA,eAA+B,iBAAA,oBAC3B,KAAA,GAAQ,GAAA,sBAClB,KAAA,CAAM,GAAA,IACN,OAAA,CAAQ,KAAA,CAAM,GAAA,GAAM,cAAA;;KAId,wBAAA,GAA2B,cAAA,GAAiB,aAAa;;;;;KAMzD,eAAA,GAAkB,aAAa,CAAC,wBAAA;AAhB5C;AAAA,KAmBY,oBAAA,eAAmC,eAAA,oBAC/B,KAAA,GAAQ,GAAA,sBAClB,KAAA,CAAM,GAAA,IACN,OAAA,CAAQ,KAAA,CAAM,GAAA,GAAM,wBAAA;AAtBkC;AAAA,KA0BhD,gBAAA,GAAmB,mBAAA,CAC7B,OAAA,CAAQ,SAAA;;KAcE,wBAAA,0BACI,KAAA,GAAQ,KAAA,CAAM,GAAA,UAAa,cAAA,GACrC,KAAA,CAAM,GAAA,IACN,KAAA,CAAM,GAAA,UAAa,mBAAA,GACjB,gBAAA,GACA,KAAA,CAAM,GAAA,eAAiB,IAAA,6BACrB,mBAAA,CAAoB,KAAA"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { InvalidComposablePropsError } from "./errors.mjs";
|
|
2
|
+
import { createPropValidator, normalizePropDefinitions } from "@jfdevelops/react-layout-validator";
|
|
3
|
+
|
|
4
|
+
//#region src/custom-props.ts
|
|
5
|
+
const requiredChildren = createPropValidator(({ value, error }) => {
|
|
6
|
+
if (value === void 0) throw error("Expected children");
|
|
7
|
+
return value;
|
|
8
|
+
});
|
|
9
|
+
/** Resolves the children shorthand and inline validators to definitions. */
|
|
10
|
+
function normalizeComposableProps(props) {
|
|
11
|
+
return normalizePropDefinitions(Object.fromEntries(Object.entries(props).map(([key, definition]) => {
|
|
12
|
+
if (typeof definition !== "string") return [key, definition];
|
|
13
|
+
if (key !== "children" || definition !== "required") throw new InvalidComposablePropsError(`Prop "${key}" cannot be a string: only children accepts the required shorthand.`);
|
|
14
|
+
return [key, requiredChildren];
|
|
15
|
+
})));
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
//#endregion
|
|
19
|
+
export { normalizeComposableProps };
|
|
20
|
+
//# sourceMappingURL=custom-props.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"custom-props.mjs","names":[],"sources":["../src/custom-props.ts"],"sourcesContent":["import {\n createPropValidator,\n normalizePropDefinitions,\n type PropDefinition,\n type PropValidator,\n type PropValidatorSchema,\n} from '@jfdevelops/react-layout-validator';\nimport type { ReactNode } from 'react';\nimport { InvalidComposablePropsError } from './errors';\n\n/** Marks the built-in `children` slot as required. */\nexport type ChildrenRequirement = 'required';\n\n// The shape behind every custom props object; `Definition` is what a prop may be.\ntype CustomPropsOf<Definition> = Record<\n string,\n Definition | ChildrenRequirement\n> & {\n /** Optional React content by default; an explicit schema replaces that default. */\n children?: Definition | ChildrenRequirement;\n};\n\n/**\n * Custom props keyed by prop name. This one type defines every `props.custom`\n * in the library: layouts, render states, components, and composables.\n *\n * Elsewhere `props` is `{ include, custom }`, where `include` selects shared\n * layout options. A defined composable has no shared options to select, so\n * its `props` is this object directly, as if it were `custom`.\n */\nexport type CustomPropsObject = CustomPropsOf<PropDefinition>;\n\n/** String requirements are reserved for the built-in children slot. */\nexport type CustomPropsInput<Props extends CustomPropsObject> = {\n [Key in keyof Props]: Key extends 'children'\n ? Props[Key]\n : Extract<Props[Key], PropDefinition>;\n};\n\n/** One prop of a defined composable: a schema, or an inline validator. */\nexport type ComposablePropDefinition = PropDefinition | PropValidator;\n\n/**\n * The `props` of a defined composable: the library's custom props object,\n * whose definitions may also be inline validators.\n */\nexport type ComposableProps = CustomPropsOf<ComposablePropDefinition>;\n\n/** {@link CustomPropsInput} for props that may also be inline validators. */\nexport type ComposablePropsInput<Props extends ComposableProps> = {\n [Key in keyof Props]: Key extends 'children'\n ? Props[Key]\n : Extract<Props[Key], ComposablePropDefinition>;\n};\n\n/** The schema behind the `children: 'required'` shorthand. */\nexport type RequiredChildren = PropValidatorSchema<\n Exclude<ReactNode, undefined>\n>;\n\nconst requiredChildren: RequiredChildren = createPropValidator(\n ({ value, error }) => {\n if (value === undefined) {\n throw error('Expected children');\n }\n\n return value as Exclude<ReactNode, undefined>;\n },\n);\n\n/** The prop definitions that a defined composable's `props` resolve to. */\nexport type NormalizeComposableProps<Props> = {\n [Key in keyof Props]: Props[Key] extends PropDefinition\n ? Props[Key]\n : Props[Key] extends ChildrenRequirement\n ? RequiredChildren\n : Props[Key] extends (...args: never[]) => infer Value\n ? PropValidatorSchema<Value>\n : never;\n};\n\n/** Resolves the children shorthand and inline validators to definitions. */\nexport function normalizeComposableProps<Props extends ComposableProps>(\n props: Props,\n) {\n return normalizePropDefinitions(\n Object.fromEntries(\n Object.entries(props).map(([key, definition]) => {\n if (typeof definition !== 'string') {\n return [key, definition];\n }\n\n if (key !== 'children' || definition !== 'required') {\n throw new InvalidComposablePropsError(\n `Prop \"${key}\" cannot be a string: only children accepts the required shorthand.`,\n );\n }\n\n return [key, requiredChildren];\n }),\n ),\n ) as NormalizeComposableProps<Props>;\n}\n"],"mappings":";;;;AA4DA,MAAM,mBAAqC,qBACxC,EAAE,OAAO,YAAY;CACpB,IAAI,UAAU,QACZ,MAAM,MAAM,mBAAmB;CAGjC,OAAO;AACT,CACF;;AAcA,SAAgB,yBACd,OACA;CACA,OAAO,yBACL,OAAO,YACL,OAAO,QAAQ,KAAK,EAAE,KAAK,CAAC,KAAK,gBAAgB;EAC/C,IAAI,OAAO,eAAe,UACxB,OAAO,CAAC,KAAK,UAAU;EAGzB,IAAI,QAAQ,cAAc,eAAe,YACvC,MAAM,IAAI,4BACR,SAAS,IAAI,oEACf;EAGF,OAAO,CAAC,KAAK,gBAAgB;CAC/B,CAAC,CACH,CACF;AACF"}
|
package/dist/errors.cjs
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
let _jfdevelops_create_error = require("@jfdevelops/create-error");
|
|
2
|
-
let
|
|
2
|
+
let _jfdevelops_react_layout_validator = require("@jfdevelops/react-layout-validator");
|
|
3
3
|
|
|
4
4
|
//#region src/errors.ts
|
|
5
5
|
const composableErrorFactory = (0, _jfdevelops_create_error.createError)({
|
|
6
|
-
definition:
|
|
6
|
+
definition: _jfdevelops_react_layout_validator.builtIn.object({ code: _jfdevelops_react_layout_validator.builtIn.string }),
|
|
7
7
|
data: {
|
|
8
8
|
property: "context",
|
|
9
9
|
resolve: ({ input }) => input
|
|
@@ -12,11 +12,35 @@ const composableErrorFactory = (0, _jfdevelops_create_error.createError)({
|
|
|
12
12
|
properties: ({ definition }) => ({ code: definition.code })
|
|
13
13
|
});
|
|
14
14
|
/** Thrown when the composable component map is not an object. */
|
|
15
|
-
var InvalidComponentsError = class extends composableErrorFactory({ code: "invalidComponents" }).defineContext(
|
|
15
|
+
var InvalidComponentsError = class extends composableErrorFactory({ code: "invalidComponents" }).defineContext(_jfdevelops_react_layout_validator.builtIn.string).implement((message) => message) {};
|
|
16
16
|
/** Thrown when no composable components were provided. */
|
|
17
|
-
var EmptyComponentsError = class extends composableErrorFactory({ code: "emptyComponents" }).defineContext(
|
|
17
|
+
var EmptyComponentsError = class extends composableErrorFactory({ code: "emptyComponents" }).defineContext(_jfdevelops_react_layout_validator.builtIn.string).implement((message) => message) {};
|
|
18
|
+
/** Thrown when a defined composable's props are declared incorrectly. */
|
|
19
|
+
var InvalidComposablePropsError = class extends composableErrorFactory({ code: "invalidComposableProps" }).defineContext(_jfdevelops_react_layout_validator.builtIn.string).implement((message) => message) {};
|
|
20
|
+
const propRenameContext = _jfdevelops_react_layout_validator.builtIn.object({
|
|
21
|
+
composable: _jfdevelops_react_layout_validator.builtIn.string,
|
|
22
|
+
prop: _jfdevelops_react_layout_validator.builtIn.string,
|
|
23
|
+
name: _jfdevelops_react_layout_validator.builtIn.string,
|
|
24
|
+
reason: _jfdevelops_react_layout_validator.builtIn.literal("reserved", "duplicate", "unknown")
|
|
25
|
+
});
|
|
26
|
+
const propRenameReasons = {
|
|
27
|
+
reserved: "is reserved",
|
|
28
|
+
duplicate: "is already used by another prop",
|
|
29
|
+
unknown: "cannot be applied because the prop is not defined"
|
|
30
|
+
};
|
|
31
|
+
/** Thrown when a defined composable's prop cannot take its new name. */
|
|
32
|
+
var InvalidPropRenameError = class extends composableErrorFactory({ code: "invalidPropRename" }).defineContext(propRenameContext).implement(({ composable, prop, name, reason }) => `Composable "${composable}" cannot rename prop "${prop}" to "${name}": the name ${propRenameReasons[reason]}.`) {};
|
|
33
|
+
const presetPropConflictContext = _jfdevelops_react_layout_validator.builtIn.object({
|
|
34
|
+
prop: _jfdevelops_react_layout_validator.builtIn.string,
|
|
35
|
+
composables: _jfdevelops_react_layout_validator.builtIn.tuple(_jfdevelops_react_layout_validator.builtIn.string, _jfdevelops_react_layout_validator.builtIn.string)
|
|
36
|
+
});
|
|
37
|
+
/** Thrown when two preset composables declare one prop with different definitions. */
|
|
38
|
+
var ConflictingPresetPropError = class extends composableErrorFactory({ code: "conflictingPresetProp" }).defineContext(presetPropConflictContext).implement(({ prop, composables: [first, second] }) => `Composables "${first}" and "${second}" both declare prop "${prop}" with different definitions. Rename the prop on one of them, or share one definition.`) {};
|
|
18
39
|
|
|
19
40
|
//#endregion
|
|
41
|
+
exports.ConflictingPresetPropError = ConflictingPresetPropError;
|
|
20
42
|
exports.EmptyComponentsError = EmptyComponentsError;
|
|
21
43
|
exports.InvalidComponentsError = InvalidComponentsError;
|
|
44
|
+
exports.InvalidComposablePropsError = InvalidComposablePropsError;
|
|
45
|
+
exports.InvalidPropRenameError = InvalidPropRenameError;
|
|
22
46
|
//# sourceMappingURL=errors.cjs.map
|
package/dist/errors.cjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"errors.cjs","names":[],"sources":["../src/errors.ts"],"sourcesContent":["import { createError } from '@jfdevelops/create-error';\nimport {
|
|
1
|
+
{"version":3,"file":"errors.cjs","names":["builtIn"],"sources":["../src/errors.ts"],"sourcesContent":["import { createError } from '@jfdevelops/create-error';\nimport {\n builtIn,\n type StandardSchemaV1,\n} from '@jfdevelops/react-layout-validator';\n\nconst composableErrorFactory = createError({\n definition: builtIn.object({\n code: builtIn.string,\n }),\n data: {\n property: 'context',\n resolve: ({ input }) => input,\n },\n message: ({ data, implementation }) => implementation(data),\n properties: ({ definition }) => ({\n code: definition.code,\n }),\n});\n\n/** Thrown when the composable component map is not an object. */\nexport class InvalidComponentsError extends composableErrorFactory({\n code: 'invalidComponents',\n})\n .defineContext(builtIn.string)\n .implement((message) => message) {}\n\n/** Thrown when no composable components were provided. */\nexport class EmptyComponentsError extends composableErrorFactory({\n code: 'emptyComponents',\n})\n .defineContext(builtIn.string)\n .implement((message) => message) {}\n\n/** Thrown when a defined composable's props are declared incorrectly. */\nexport class InvalidComposablePropsError extends composableErrorFactory({\n code: 'invalidComposableProps',\n})\n .defineContext(builtIn.string)\n .implement((message) => message) {}\n\nconst propRenameContext = builtIn.object({\n composable: builtIn.string,\n prop: builtIn.string,\n name: builtIn.string,\n reason: builtIn.literal('reserved', 'duplicate', 'unknown'),\n});\n\nexport type InvalidPropRenameContext = StandardSchemaV1.InferOutput<\n typeof propRenameContext\n>;\n\nconst propRenameReasons = {\n reserved: 'is reserved',\n duplicate: 'is already used by another prop',\n unknown: 'cannot be applied because the prop is not defined',\n} satisfies Record<InvalidPropRenameContext['reason'], string>;\n\n/** Thrown when a defined composable's prop cannot take its new name. */\nexport class InvalidPropRenameError extends composableErrorFactory({\n code: 'invalidPropRename',\n})\n .defineContext(propRenameContext)\n .implement(\n ({ composable, prop, name, reason }) =>\n `Composable \"${composable}\" cannot rename prop \"${prop}\" to \"${name}\": the name ${propRenameReasons[reason]}.`,\n ) {}\n\nconst presetPropConflictContext = builtIn.object({\n prop: builtIn.string,\n composables: builtIn.tuple(builtIn.string, builtIn.string),\n});\n\nexport type ConflictingPresetPropContext = StandardSchemaV1.InferOutput<\n typeof presetPropConflictContext\n>;\n\n/** Thrown when two preset composables declare one prop with different definitions. */\nexport class ConflictingPresetPropError extends composableErrorFactory({\n code: 'conflictingPresetProp',\n})\n .defineContext(presetPropConflictContext)\n .implement(\n ({ prop, composables: [first, second] }) =>\n `Composables \"${first}\" and \"${second}\" both declare prop \"${prop}\" with different definitions. Rename the prop on one of them, or share one definition.`,\n ) {}\n"],"mappings":";;;;AAMA,MAAM,mEAAqC;CACzC,YAAYA,2CAAQ,OAAO,EACzB,MAAMA,2CAAQ,OAChB,CAAC;CACD,MAAM;EACJ,UAAU;EACV,UAAU,EAAE,YAAY;CAC1B;CACA,UAAU,EAAE,MAAM,qBAAqB,eAAe,IAAI;CAC1D,aAAa,EAAE,kBAAkB,EAC/B,MAAM,WAAW,KACnB;AACF,CAAC;;AAGD,IAAa,yBAAb,cAA4C,uBAAuB,EACjE,MAAM,oBACR,CAAC,EACE,cAAcA,2CAAQ,MAAM,EAC5B,WAAW,YAAY,OAAO,EAAE,CAAC;;AAGpC,IAAa,uBAAb,cAA0C,uBAAuB,EAC/D,MAAM,kBACR,CAAC,EACE,cAAcA,2CAAQ,MAAM,EAC5B,WAAW,YAAY,OAAO,EAAE,CAAC;;AAGpC,IAAa,8BAAb,cAAiD,uBAAuB,EACtE,MAAM,yBACR,CAAC,EACE,cAAcA,2CAAQ,MAAM,EAC5B,WAAW,YAAY,OAAO,EAAE,CAAC;AAEpC,MAAM,oBAAoBA,2CAAQ,OAAO;CACvC,YAAYA,2CAAQ;CACpB,MAAMA,2CAAQ;CACd,MAAMA,2CAAQ;CACd,QAAQA,2CAAQ,QAAQ,YAAY,aAAa,SAAS;AAC5D,CAAC;AAMD,MAAM,oBAAoB;CACxB,UAAU;CACV,WAAW;CACX,SAAS;AACX;;AAGA,IAAa,yBAAb,cAA4C,uBAAuB,EACjE,MAAM,oBACR,CAAC,EACE,cAAc,iBAAiB,EAC/B,WACE,EAAE,YAAY,MAAM,MAAM,aACzB,eAAe,WAAW,wBAAwB,KAAK,QAAQ,KAAK,cAAc,kBAAkB,QAAQ,EAChH,EAAE,CAAC;AAEL,MAAM,4BAA4BA,2CAAQ,OAAO;CAC/C,MAAMA,2CAAQ;CACd,aAAaA,2CAAQ,MAAMA,2CAAQ,QAAQA,2CAAQ,MAAM;AAC3D,CAAC;;AAOD,IAAa,6BAAb,cAAgD,uBAAuB,EACrE,MAAM,wBACR,CAAC,EACE,cAAc,yBAAyB,EACvC,WACE,EAAE,MAAM,aAAa,CAAC,OAAO,cAC5B,gBAAgB,MAAM,SAAS,OAAO,uBAAuB,KAAK,uFACtE,EAAE,CAAC"}
|
package/dist/errors.d.cts
CHANGED
|
@@ -1,33 +1,34 @@
|
|
|
1
1
|
import { BlueprintContext, DataSlot, ImplementedErrorClass, ResolveContext, TypeSlot } from "./node_modules/.pnpm/@jfdevelops_create-error@0.2.1/node_modules/@jfdevelops/create-error/dist/types.cjs";
|
|
2
|
+
import { StandardSchemaV1 } from "@jfdevelops/react-layout-validator";
|
|
2
3
|
|
|
3
4
|
//#region src/errors.d.ts
|
|
4
5
|
declare const InvalidComponentsError_base: ImplementedErrorClass<{
|
|
5
|
-
definition: import("
|
|
6
|
+
definition: import("@jfdevelops/react-layout-validator").PropValidatorSchema<{
|
|
6
7
|
code: string;
|
|
7
|
-
}
|
|
8
|
+
}>;
|
|
8
9
|
} & {
|
|
9
|
-
readonly definition: import("
|
|
10
|
+
readonly definition: import("@jfdevelops/react-layout-validator").PropValidatorSchema<{
|
|
10
11
|
code: string;
|
|
11
|
-
}
|
|
12
|
+
}>;
|
|
12
13
|
readonly data: {
|
|
13
14
|
readonly property: "context";
|
|
14
15
|
readonly resolve: ({
|
|
15
16
|
input
|
|
16
|
-
}: ResolveContext<import("
|
|
17
|
+
}: ResolveContext<import("@jfdevelops/react-layout-validator").PropValidatorSchema<{
|
|
17
18
|
code: string;
|
|
18
|
-
}
|
|
19
|
+
}>>) => object;
|
|
19
20
|
};
|
|
20
21
|
readonly message: ({
|
|
21
22
|
data,
|
|
22
23
|
implementation
|
|
23
|
-
}: BlueprintContext<import("
|
|
24
|
+
}: BlueprintContext<import("@jfdevelops/react-layout-validator").PropValidatorSchema<{
|
|
24
25
|
code: string;
|
|
25
|
-
}
|
|
26
|
+
}>>) => string & TypeSlot<"implementationArgument", DataSlot>;
|
|
26
27
|
readonly properties: ({
|
|
27
28
|
definition
|
|
28
|
-
}: BlueprintContext<import("
|
|
29
|
+
}: BlueprintContext<import("@jfdevelops/react-layout-validator").PropValidatorSchema<{
|
|
29
30
|
code: string;
|
|
30
|
-
}
|
|
31
|
+
}>>) => {
|
|
31
32
|
code: string & TypeSlot<"definition", "code">;
|
|
32
33
|
};
|
|
33
34
|
}, {
|
|
@@ -36,32 +37,32 @@ declare const InvalidComponentsError_base: ImplementedErrorClass<{
|
|
|
36
37
|
/** Thrown when the composable component map is not an object. */
|
|
37
38
|
declare class InvalidComponentsError extends InvalidComponentsError_base {}
|
|
38
39
|
declare const EmptyComponentsError_base: ImplementedErrorClass<{
|
|
39
|
-
definition: import("
|
|
40
|
+
definition: import("@jfdevelops/react-layout-validator").PropValidatorSchema<{
|
|
40
41
|
code: string;
|
|
41
|
-
}
|
|
42
|
+
}>;
|
|
42
43
|
} & {
|
|
43
|
-
readonly definition: import("
|
|
44
|
+
readonly definition: import("@jfdevelops/react-layout-validator").PropValidatorSchema<{
|
|
44
45
|
code: string;
|
|
45
|
-
}
|
|
46
|
+
}>;
|
|
46
47
|
readonly data: {
|
|
47
48
|
readonly property: "context";
|
|
48
49
|
readonly resolve: ({
|
|
49
50
|
input
|
|
50
|
-
}: ResolveContext<import("
|
|
51
|
+
}: ResolveContext<import("@jfdevelops/react-layout-validator").PropValidatorSchema<{
|
|
51
52
|
code: string;
|
|
52
|
-
}
|
|
53
|
+
}>>) => object;
|
|
53
54
|
};
|
|
54
55
|
readonly message: ({
|
|
55
56
|
data,
|
|
56
57
|
implementation
|
|
57
|
-
}: BlueprintContext<import("
|
|
58
|
+
}: BlueprintContext<import("@jfdevelops/react-layout-validator").PropValidatorSchema<{
|
|
58
59
|
code: string;
|
|
59
|
-
}
|
|
60
|
+
}>>) => string & TypeSlot<"implementationArgument", DataSlot>;
|
|
60
61
|
readonly properties: ({
|
|
61
62
|
definition
|
|
62
|
-
}: BlueprintContext<import("
|
|
63
|
+
}: BlueprintContext<import("@jfdevelops/react-layout-validator").PropValidatorSchema<{
|
|
63
64
|
code: string;
|
|
64
|
-
}
|
|
65
|
+
}>>) => {
|
|
65
66
|
code: string & TypeSlot<"definition", "code">;
|
|
66
67
|
};
|
|
67
68
|
}, {
|
|
@@ -69,6 +70,136 @@ declare const EmptyComponentsError_base: ImplementedErrorClass<{
|
|
|
69
70
|
}, string, string>;
|
|
70
71
|
/** Thrown when no composable components were provided. */
|
|
71
72
|
declare class EmptyComponentsError extends EmptyComponentsError_base {}
|
|
73
|
+
declare const InvalidComposablePropsError_base: ImplementedErrorClass<{
|
|
74
|
+
definition: import("@jfdevelops/react-layout-validator").PropValidatorSchema<{
|
|
75
|
+
code: string;
|
|
76
|
+
}>;
|
|
77
|
+
} & {
|
|
78
|
+
readonly definition: import("@jfdevelops/react-layout-validator").PropValidatorSchema<{
|
|
79
|
+
code: string;
|
|
80
|
+
}>;
|
|
81
|
+
readonly data: {
|
|
82
|
+
readonly property: "context";
|
|
83
|
+
readonly resolve: ({
|
|
84
|
+
input
|
|
85
|
+
}: ResolveContext<import("@jfdevelops/react-layout-validator").PropValidatorSchema<{
|
|
86
|
+
code: string;
|
|
87
|
+
}>>) => object;
|
|
88
|
+
};
|
|
89
|
+
readonly message: ({
|
|
90
|
+
data,
|
|
91
|
+
implementation
|
|
92
|
+
}: BlueprintContext<import("@jfdevelops/react-layout-validator").PropValidatorSchema<{
|
|
93
|
+
code: string;
|
|
94
|
+
}>>) => string & TypeSlot<"implementationArgument", DataSlot>;
|
|
95
|
+
readonly properties: ({
|
|
96
|
+
definition
|
|
97
|
+
}: BlueprintContext<import("@jfdevelops/react-layout-validator").PropValidatorSchema<{
|
|
98
|
+
code: string;
|
|
99
|
+
}>>) => {
|
|
100
|
+
code: string & TypeSlot<"definition", "code">;
|
|
101
|
+
};
|
|
102
|
+
}, {
|
|
103
|
+
readonly code: string;
|
|
104
|
+
}, string, string>;
|
|
105
|
+
/** Thrown when a defined composable's props are declared incorrectly. */
|
|
106
|
+
declare class InvalidComposablePropsError extends InvalidComposablePropsError_base {}
|
|
107
|
+
declare const propRenameContext: import("@jfdevelops/react-layout-validator").PropValidatorSchema<{
|
|
108
|
+
reason: "reserved" | "duplicate" | "unknown";
|
|
109
|
+
composable: string;
|
|
110
|
+
prop: string;
|
|
111
|
+
name: string;
|
|
112
|
+
}>;
|
|
113
|
+
type InvalidPropRenameContext = StandardSchemaV1.InferOutput<typeof propRenameContext>;
|
|
114
|
+
declare const InvalidPropRenameError_base: ImplementedErrorClass<{
|
|
115
|
+
definition: import("@jfdevelops/react-layout-validator").PropValidatorSchema<{
|
|
116
|
+
code: string;
|
|
117
|
+
}>;
|
|
118
|
+
} & {
|
|
119
|
+
readonly definition: import("@jfdevelops/react-layout-validator").PropValidatorSchema<{
|
|
120
|
+
code: string;
|
|
121
|
+
}>;
|
|
122
|
+
readonly data: {
|
|
123
|
+
readonly property: "context";
|
|
124
|
+
readonly resolve: ({
|
|
125
|
+
input
|
|
126
|
+
}: ResolveContext<import("@jfdevelops/react-layout-validator").PropValidatorSchema<{
|
|
127
|
+
code: string;
|
|
128
|
+
}>>) => object;
|
|
129
|
+
};
|
|
130
|
+
readonly message: ({
|
|
131
|
+
data,
|
|
132
|
+
implementation
|
|
133
|
+
}: BlueprintContext<import("@jfdevelops/react-layout-validator").PropValidatorSchema<{
|
|
134
|
+
code: string;
|
|
135
|
+
}>>) => string & TypeSlot<"implementationArgument", DataSlot>;
|
|
136
|
+
readonly properties: ({
|
|
137
|
+
definition
|
|
138
|
+
}: BlueprintContext<import("@jfdevelops/react-layout-validator").PropValidatorSchema<{
|
|
139
|
+
code: string;
|
|
140
|
+
}>>) => {
|
|
141
|
+
code: string & TypeSlot<"definition", "code">;
|
|
142
|
+
};
|
|
143
|
+
}, {
|
|
144
|
+
readonly code: string;
|
|
145
|
+
}, {
|
|
146
|
+
reason: "reserved" | "duplicate" | "unknown";
|
|
147
|
+
composable: string;
|
|
148
|
+
prop: string;
|
|
149
|
+
name: string;
|
|
150
|
+
}, {
|
|
151
|
+
reason: "reserved" | "duplicate" | "unknown";
|
|
152
|
+
composable: string;
|
|
153
|
+
prop: string;
|
|
154
|
+
name: string;
|
|
155
|
+
}>;
|
|
156
|
+
/** Thrown when a defined composable's prop cannot take its new name. */
|
|
157
|
+
declare class InvalidPropRenameError extends InvalidPropRenameError_base {}
|
|
158
|
+
declare const presetPropConflictContext: import("@jfdevelops/react-layout-validator").PropValidatorSchema<{
|
|
159
|
+
prop: string;
|
|
160
|
+
composables: [string, string];
|
|
161
|
+
}>;
|
|
162
|
+
type ConflictingPresetPropContext = StandardSchemaV1.InferOutput<typeof presetPropConflictContext>;
|
|
163
|
+
declare const ConflictingPresetPropError_base: ImplementedErrorClass<{
|
|
164
|
+
definition: import("@jfdevelops/react-layout-validator").PropValidatorSchema<{
|
|
165
|
+
code: string;
|
|
166
|
+
}>;
|
|
167
|
+
} & {
|
|
168
|
+
readonly definition: import("@jfdevelops/react-layout-validator").PropValidatorSchema<{
|
|
169
|
+
code: string;
|
|
170
|
+
}>;
|
|
171
|
+
readonly data: {
|
|
172
|
+
readonly property: "context";
|
|
173
|
+
readonly resolve: ({
|
|
174
|
+
input
|
|
175
|
+
}: ResolveContext<import("@jfdevelops/react-layout-validator").PropValidatorSchema<{
|
|
176
|
+
code: string;
|
|
177
|
+
}>>) => object;
|
|
178
|
+
};
|
|
179
|
+
readonly message: ({
|
|
180
|
+
data,
|
|
181
|
+
implementation
|
|
182
|
+
}: BlueprintContext<import("@jfdevelops/react-layout-validator").PropValidatorSchema<{
|
|
183
|
+
code: string;
|
|
184
|
+
}>>) => string & TypeSlot<"implementationArgument", DataSlot>;
|
|
185
|
+
readonly properties: ({
|
|
186
|
+
definition
|
|
187
|
+
}: BlueprintContext<import("@jfdevelops/react-layout-validator").PropValidatorSchema<{
|
|
188
|
+
code: string;
|
|
189
|
+
}>>) => {
|
|
190
|
+
code: string & TypeSlot<"definition", "code">;
|
|
191
|
+
};
|
|
192
|
+
}, {
|
|
193
|
+
readonly code: string;
|
|
194
|
+
}, {
|
|
195
|
+
prop: string;
|
|
196
|
+
composables: [string, string];
|
|
197
|
+
}, {
|
|
198
|
+
prop: string;
|
|
199
|
+
composables: [string, string];
|
|
200
|
+
}>;
|
|
201
|
+
/** Thrown when two preset composables declare one prop with different definitions. */
|
|
202
|
+
declare class ConflictingPresetPropError extends ConflictingPresetPropError_base {}
|
|
72
203
|
//#endregion
|
|
73
|
-
export { EmptyComponentsError, InvalidComponentsError };
|
|
204
|
+
export { ConflictingPresetPropContext, ConflictingPresetPropError, EmptyComponentsError, InvalidComponentsError, InvalidComposablePropsError, InvalidPropRenameContext, InvalidPropRenameError };
|
|
74
205
|
//# sourceMappingURL=errors.d.cts.map
|
package/dist/errors.d.cts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"errors.d.cts","names":[],"sources":["../src/errors.ts"],"mappings":"
|
|
1
|
+
{"version":3,"file":"errors.d.cts","names":[],"sources":["../src/errors.ts"],"mappings":";;;;cAI4C,2BAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;cAiB/B,sBAAA,SAA+B,2BAIV;AAAA,cAAG,yBAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;cAGxB,oBAAA,SAA6B,yBAIR;AAAA,cAAG,gCAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;cAGxB,2BAAA,SAAoC,gCAIf;AAAA,cAE5B,iBAAA,+CAAiB,mBAAA;;;;;;KAOX,wBAAA,GAA2B,gBAAA,CAAiB,WAAW,QAC1D,iBAAA;AAAA,cACP,2BAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;cASW,sBAAA,SAA+B,2BAOzC;AAAA,cAEG,yBAAA,+CAAyB,mBAAA;;;;KAKnB,4BAAA,GAA+B,gBAAA,CAAiB,WAAW,QAC9D,yBAAA;AAAA,cACP,+BAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;cAGW,0BAAA,SAAmC,+BAO7C"}
|
package/dist/errors.d.mts
CHANGED
|
@@ -1,33 +1,34 @@
|
|
|
1
1
|
import { BlueprintContext, DataSlot, ImplementedErrorClass, ResolveContext, TypeSlot } from "./node_modules/.pnpm/@jfdevelops_create-error@0.2.1/node_modules/@jfdevelops/create-error/dist/types.mjs";
|
|
2
|
+
import { StandardSchemaV1 } from "@jfdevelops/react-layout-validator";
|
|
2
3
|
|
|
3
4
|
//#region src/errors.d.ts
|
|
4
5
|
declare const InvalidComponentsError_base: ImplementedErrorClass<{
|
|
5
|
-
definition: import("
|
|
6
|
+
definition: import("@jfdevelops/react-layout-validator").PropValidatorSchema<{
|
|
6
7
|
code: string;
|
|
7
|
-
}
|
|
8
|
+
}>;
|
|
8
9
|
} & {
|
|
9
|
-
readonly definition: import("
|
|
10
|
+
readonly definition: import("@jfdevelops/react-layout-validator").PropValidatorSchema<{
|
|
10
11
|
code: string;
|
|
11
|
-
}
|
|
12
|
+
}>;
|
|
12
13
|
readonly data: {
|
|
13
14
|
readonly property: "context";
|
|
14
15
|
readonly resolve: ({
|
|
15
16
|
input
|
|
16
|
-
}: ResolveContext<import("
|
|
17
|
+
}: ResolveContext<import("@jfdevelops/react-layout-validator").PropValidatorSchema<{
|
|
17
18
|
code: string;
|
|
18
|
-
}
|
|
19
|
+
}>>) => object;
|
|
19
20
|
};
|
|
20
21
|
readonly message: ({
|
|
21
22
|
data,
|
|
22
23
|
implementation
|
|
23
|
-
}: BlueprintContext<import("
|
|
24
|
+
}: BlueprintContext<import("@jfdevelops/react-layout-validator").PropValidatorSchema<{
|
|
24
25
|
code: string;
|
|
25
|
-
}
|
|
26
|
+
}>>) => string & TypeSlot<"implementationArgument", DataSlot>;
|
|
26
27
|
readonly properties: ({
|
|
27
28
|
definition
|
|
28
|
-
}: BlueprintContext<import("
|
|
29
|
+
}: BlueprintContext<import("@jfdevelops/react-layout-validator").PropValidatorSchema<{
|
|
29
30
|
code: string;
|
|
30
|
-
}
|
|
31
|
+
}>>) => {
|
|
31
32
|
code: string & TypeSlot<"definition", "code">;
|
|
32
33
|
};
|
|
33
34
|
}, {
|
|
@@ -36,32 +37,32 @@ declare const InvalidComponentsError_base: ImplementedErrorClass<{
|
|
|
36
37
|
/** Thrown when the composable component map is not an object. */
|
|
37
38
|
declare class InvalidComponentsError extends InvalidComponentsError_base {}
|
|
38
39
|
declare const EmptyComponentsError_base: ImplementedErrorClass<{
|
|
39
|
-
definition: import("
|
|
40
|
+
definition: import("@jfdevelops/react-layout-validator").PropValidatorSchema<{
|
|
40
41
|
code: string;
|
|
41
|
-
}
|
|
42
|
+
}>;
|
|
42
43
|
} & {
|
|
43
|
-
readonly definition: import("
|
|
44
|
+
readonly definition: import("@jfdevelops/react-layout-validator").PropValidatorSchema<{
|
|
44
45
|
code: string;
|
|
45
|
-
}
|
|
46
|
+
}>;
|
|
46
47
|
readonly data: {
|
|
47
48
|
readonly property: "context";
|
|
48
49
|
readonly resolve: ({
|
|
49
50
|
input
|
|
50
|
-
}: ResolveContext<import("
|
|
51
|
+
}: ResolveContext<import("@jfdevelops/react-layout-validator").PropValidatorSchema<{
|
|
51
52
|
code: string;
|
|
52
|
-
}
|
|
53
|
+
}>>) => object;
|
|
53
54
|
};
|
|
54
55
|
readonly message: ({
|
|
55
56
|
data,
|
|
56
57
|
implementation
|
|
57
|
-
}: BlueprintContext<import("
|
|
58
|
+
}: BlueprintContext<import("@jfdevelops/react-layout-validator").PropValidatorSchema<{
|
|
58
59
|
code: string;
|
|
59
|
-
}
|
|
60
|
+
}>>) => string & TypeSlot<"implementationArgument", DataSlot>;
|
|
60
61
|
readonly properties: ({
|
|
61
62
|
definition
|
|
62
|
-
}: BlueprintContext<import("
|
|
63
|
+
}: BlueprintContext<import("@jfdevelops/react-layout-validator").PropValidatorSchema<{
|
|
63
64
|
code: string;
|
|
64
|
-
}
|
|
65
|
+
}>>) => {
|
|
65
66
|
code: string & TypeSlot<"definition", "code">;
|
|
66
67
|
};
|
|
67
68
|
}, {
|
|
@@ -69,6 +70,136 @@ declare const EmptyComponentsError_base: ImplementedErrorClass<{
|
|
|
69
70
|
}, string, string>;
|
|
70
71
|
/** Thrown when no composable components were provided. */
|
|
71
72
|
declare class EmptyComponentsError extends EmptyComponentsError_base {}
|
|
73
|
+
declare const InvalidComposablePropsError_base: ImplementedErrorClass<{
|
|
74
|
+
definition: import("@jfdevelops/react-layout-validator").PropValidatorSchema<{
|
|
75
|
+
code: string;
|
|
76
|
+
}>;
|
|
77
|
+
} & {
|
|
78
|
+
readonly definition: import("@jfdevelops/react-layout-validator").PropValidatorSchema<{
|
|
79
|
+
code: string;
|
|
80
|
+
}>;
|
|
81
|
+
readonly data: {
|
|
82
|
+
readonly property: "context";
|
|
83
|
+
readonly resolve: ({
|
|
84
|
+
input
|
|
85
|
+
}: ResolveContext<import("@jfdevelops/react-layout-validator").PropValidatorSchema<{
|
|
86
|
+
code: string;
|
|
87
|
+
}>>) => object;
|
|
88
|
+
};
|
|
89
|
+
readonly message: ({
|
|
90
|
+
data,
|
|
91
|
+
implementation
|
|
92
|
+
}: BlueprintContext<import("@jfdevelops/react-layout-validator").PropValidatorSchema<{
|
|
93
|
+
code: string;
|
|
94
|
+
}>>) => string & TypeSlot<"implementationArgument", DataSlot>;
|
|
95
|
+
readonly properties: ({
|
|
96
|
+
definition
|
|
97
|
+
}: BlueprintContext<import("@jfdevelops/react-layout-validator").PropValidatorSchema<{
|
|
98
|
+
code: string;
|
|
99
|
+
}>>) => {
|
|
100
|
+
code: string & TypeSlot<"definition", "code">;
|
|
101
|
+
};
|
|
102
|
+
}, {
|
|
103
|
+
readonly code: string;
|
|
104
|
+
}, string, string>;
|
|
105
|
+
/** Thrown when a defined composable's props are declared incorrectly. */
|
|
106
|
+
declare class InvalidComposablePropsError extends InvalidComposablePropsError_base {}
|
|
107
|
+
declare const propRenameContext: import("@jfdevelops/react-layout-validator").PropValidatorSchema<{
|
|
108
|
+
reason: "reserved" | "duplicate" | "unknown";
|
|
109
|
+
composable: string;
|
|
110
|
+
prop: string;
|
|
111
|
+
name: string;
|
|
112
|
+
}>;
|
|
113
|
+
type InvalidPropRenameContext = StandardSchemaV1.InferOutput<typeof propRenameContext>;
|
|
114
|
+
declare const InvalidPropRenameError_base: ImplementedErrorClass<{
|
|
115
|
+
definition: import("@jfdevelops/react-layout-validator").PropValidatorSchema<{
|
|
116
|
+
code: string;
|
|
117
|
+
}>;
|
|
118
|
+
} & {
|
|
119
|
+
readonly definition: import("@jfdevelops/react-layout-validator").PropValidatorSchema<{
|
|
120
|
+
code: string;
|
|
121
|
+
}>;
|
|
122
|
+
readonly data: {
|
|
123
|
+
readonly property: "context";
|
|
124
|
+
readonly resolve: ({
|
|
125
|
+
input
|
|
126
|
+
}: ResolveContext<import("@jfdevelops/react-layout-validator").PropValidatorSchema<{
|
|
127
|
+
code: string;
|
|
128
|
+
}>>) => object;
|
|
129
|
+
};
|
|
130
|
+
readonly message: ({
|
|
131
|
+
data,
|
|
132
|
+
implementation
|
|
133
|
+
}: BlueprintContext<import("@jfdevelops/react-layout-validator").PropValidatorSchema<{
|
|
134
|
+
code: string;
|
|
135
|
+
}>>) => string & TypeSlot<"implementationArgument", DataSlot>;
|
|
136
|
+
readonly properties: ({
|
|
137
|
+
definition
|
|
138
|
+
}: BlueprintContext<import("@jfdevelops/react-layout-validator").PropValidatorSchema<{
|
|
139
|
+
code: string;
|
|
140
|
+
}>>) => {
|
|
141
|
+
code: string & TypeSlot<"definition", "code">;
|
|
142
|
+
};
|
|
143
|
+
}, {
|
|
144
|
+
readonly code: string;
|
|
145
|
+
}, {
|
|
146
|
+
reason: "reserved" | "duplicate" | "unknown";
|
|
147
|
+
composable: string;
|
|
148
|
+
prop: string;
|
|
149
|
+
name: string;
|
|
150
|
+
}, {
|
|
151
|
+
reason: "reserved" | "duplicate" | "unknown";
|
|
152
|
+
composable: string;
|
|
153
|
+
prop: string;
|
|
154
|
+
name: string;
|
|
155
|
+
}>;
|
|
156
|
+
/** Thrown when a defined composable's prop cannot take its new name. */
|
|
157
|
+
declare class InvalidPropRenameError extends InvalidPropRenameError_base {}
|
|
158
|
+
declare const presetPropConflictContext: import("@jfdevelops/react-layout-validator").PropValidatorSchema<{
|
|
159
|
+
prop: string;
|
|
160
|
+
composables: [string, string];
|
|
161
|
+
}>;
|
|
162
|
+
type ConflictingPresetPropContext = StandardSchemaV1.InferOutput<typeof presetPropConflictContext>;
|
|
163
|
+
declare const ConflictingPresetPropError_base: ImplementedErrorClass<{
|
|
164
|
+
definition: import("@jfdevelops/react-layout-validator").PropValidatorSchema<{
|
|
165
|
+
code: string;
|
|
166
|
+
}>;
|
|
167
|
+
} & {
|
|
168
|
+
readonly definition: import("@jfdevelops/react-layout-validator").PropValidatorSchema<{
|
|
169
|
+
code: string;
|
|
170
|
+
}>;
|
|
171
|
+
readonly data: {
|
|
172
|
+
readonly property: "context";
|
|
173
|
+
readonly resolve: ({
|
|
174
|
+
input
|
|
175
|
+
}: ResolveContext<import("@jfdevelops/react-layout-validator").PropValidatorSchema<{
|
|
176
|
+
code: string;
|
|
177
|
+
}>>) => object;
|
|
178
|
+
};
|
|
179
|
+
readonly message: ({
|
|
180
|
+
data,
|
|
181
|
+
implementation
|
|
182
|
+
}: BlueprintContext<import("@jfdevelops/react-layout-validator").PropValidatorSchema<{
|
|
183
|
+
code: string;
|
|
184
|
+
}>>) => string & TypeSlot<"implementationArgument", DataSlot>;
|
|
185
|
+
readonly properties: ({
|
|
186
|
+
definition
|
|
187
|
+
}: BlueprintContext<import("@jfdevelops/react-layout-validator").PropValidatorSchema<{
|
|
188
|
+
code: string;
|
|
189
|
+
}>>) => {
|
|
190
|
+
code: string & TypeSlot<"definition", "code">;
|
|
191
|
+
};
|
|
192
|
+
}, {
|
|
193
|
+
readonly code: string;
|
|
194
|
+
}, {
|
|
195
|
+
prop: string;
|
|
196
|
+
composables: [string, string];
|
|
197
|
+
}, {
|
|
198
|
+
prop: string;
|
|
199
|
+
composables: [string, string];
|
|
200
|
+
}>;
|
|
201
|
+
/** Thrown when two preset composables declare one prop with different definitions. */
|
|
202
|
+
declare class ConflictingPresetPropError extends ConflictingPresetPropError_base {}
|
|
72
203
|
//#endregion
|
|
73
|
-
export { EmptyComponentsError, InvalidComponentsError };
|
|
204
|
+
export { ConflictingPresetPropContext, ConflictingPresetPropError, EmptyComponentsError, InvalidComponentsError, InvalidComposablePropsError, InvalidPropRenameContext, InvalidPropRenameError };
|
|
74
205
|
//# sourceMappingURL=errors.d.mts.map
|
package/dist/errors.d.mts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"errors.d.mts","names":[],"sources":["../src/errors.ts"],"mappings":"
|
|
1
|
+
{"version":3,"file":"errors.d.mts","names":[],"sources":["../src/errors.ts"],"mappings":";;;;cAI4C,2BAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;cAiB/B,sBAAA,SAA+B,2BAIV;AAAA,cAAG,yBAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;cAGxB,oBAAA,SAA6B,yBAIR;AAAA,cAAG,gCAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;cAGxB,2BAAA,SAAoC,gCAIf;AAAA,cAE5B,iBAAA,+CAAiB,mBAAA;;;;;;KAOX,wBAAA,GAA2B,gBAAA,CAAiB,WAAW,QAC1D,iBAAA;AAAA,cACP,2BAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;cASW,sBAAA,SAA+B,2BAOzC;AAAA,cAEG,yBAAA,+CAAyB,mBAAA;;;;KAKnB,4BAAA,GAA+B,gBAAA,CAAiB,WAAW,QAC9D,yBAAA;AAAA,cACP,+BAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;cAGW,0BAAA,SAAmC,+BAO7C"}
|
package/dist/errors.mjs
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { createError } from "@jfdevelops/create-error";
|
|
2
|
-
import {
|
|
2
|
+
import { builtIn } from "@jfdevelops/react-layout-validator";
|
|
3
3
|
|
|
4
4
|
//#region src/errors.ts
|
|
5
5
|
const composableErrorFactory = createError({
|
|
6
|
-
definition:
|
|
6
|
+
definition: builtIn.object({ code: builtIn.string }),
|
|
7
7
|
data: {
|
|
8
8
|
property: "context",
|
|
9
9
|
resolve: ({ input }) => input
|
|
@@ -12,10 +12,31 @@ const composableErrorFactory = createError({
|
|
|
12
12
|
properties: ({ definition }) => ({ code: definition.code })
|
|
13
13
|
});
|
|
14
14
|
/** Thrown when the composable component map is not an object. */
|
|
15
|
-
var InvalidComponentsError = class extends composableErrorFactory({ code: "invalidComponents" }).defineContext(
|
|
15
|
+
var InvalidComponentsError = class extends composableErrorFactory({ code: "invalidComponents" }).defineContext(builtIn.string).implement((message) => message) {};
|
|
16
16
|
/** Thrown when no composable components were provided. */
|
|
17
|
-
var EmptyComponentsError = class extends composableErrorFactory({ code: "emptyComponents" }).defineContext(
|
|
17
|
+
var EmptyComponentsError = class extends composableErrorFactory({ code: "emptyComponents" }).defineContext(builtIn.string).implement((message) => message) {};
|
|
18
|
+
/** Thrown when a defined composable's props are declared incorrectly. */
|
|
19
|
+
var InvalidComposablePropsError = class extends composableErrorFactory({ code: "invalidComposableProps" }).defineContext(builtIn.string).implement((message) => message) {};
|
|
20
|
+
const propRenameContext = builtIn.object({
|
|
21
|
+
composable: builtIn.string,
|
|
22
|
+
prop: builtIn.string,
|
|
23
|
+
name: builtIn.string,
|
|
24
|
+
reason: builtIn.literal("reserved", "duplicate", "unknown")
|
|
25
|
+
});
|
|
26
|
+
const propRenameReasons = {
|
|
27
|
+
reserved: "is reserved",
|
|
28
|
+
duplicate: "is already used by another prop",
|
|
29
|
+
unknown: "cannot be applied because the prop is not defined"
|
|
30
|
+
};
|
|
31
|
+
/** Thrown when a defined composable's prop cannot take its new name. */
|
|
32
|
+
var InvalidPropRenameError = class extends composableErrorFactory({ code: "invalidPropRename" }).defineContext(propRenameContext).implement(({ composable, prop, name, reason }) => `Composable "${composable}" cannot rename prop "${prop}" to "${name}": the name ${propRenameReasons[reason]}.`) {};
|
|
33
|
+
const presetPropConflictContext = builtIn.object({
|
|
34
|
+
prop: builtIn.string,
|
|
35
|
+
composables: builtIn.tuple(builtIn.string, builtIn.string)
|
|
36
|
+
});
|
|
37
|
+
/** Thrown when two preset composables declare one prop with different definitions. */
|
|
38
|
+
var ConflictingPresetPropError = class extends composableErrorFactory({ code: "conflictingPresetProp" }).defineContext(presetPropConflictContext).implement(({ prop, composables: [first, second] }) => `Composables "${first}" and "${second}" both declare prop "${prop}" with different definitions. Rename the prop on one of them, or share one definition.`) {};
|
|
18
39
|
|
|
19
40
|
//#endregion
|
|
20
|
-
export { EmptyComponentsError, InvalidComponentsError };
|
|
41
|
+
export { ConflictingPresetPropError, EmptyComponentsError, InvalidComponentsError, InvalidComposablePropsError, InvalidPropRenameError };
|
|
21
42
|
//# sourceMappingURL=errors.mjs.map
|