Skip to content

Commit 9b8691e

Browse files
committed
Remove circular dependencies
1 parent e049a3d commit 9b8691e

File tree

8 files changed

+29
-22
lines changed

8 files changed

+29
-22
lines changed
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
---
2+
'@keystatic/core': patch
3+
'@keystar/ui': patch
4+
---
5+
6+
Remove circular dependencies

design-system/pkg/src/layout/ScrollView.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ import {
2424
tokenSchema,
2525
transition,
2626
} from '@keystar/ui/style';
27-
import { useGridStyleProps } from '.';
27+
import { useGridStyleProps } from './resolvers';
2828

2929
export type ScrollDirection = 'vertical' | 'horizontal';
3030
export type ScrollIndicator = 'start' | 'end' | 'both' | 'none';

packages/keystatic/src/form/error-formatting.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import { FieldDataError } from './fields/error';
2-
import { PropValidationError } from './parse-props';
2+
import { PropValidationError } from './prop-validation-error';
33

44
function flattenErrors(error: unknown): unknown[] {
55
if (error instanceof AggregateError) {

packages/keystatic/src/form/errors.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import { getSlugFromState } from '../app/utils';
22
import { ComponentSchema } from './api';
33
import { SlugFieldInfo } from './fields/text/path-slug-context';
4-
import { PropValidationError } from './parse-props';
4+
import { PropValidationError } from './prop-validation-error';
55
import { ReadonlyPropPath } from './fields/document/DocumentEditor/component-blocks/utils';
66
import { validateArrayLength } from './validate-array-length';
77
import { toFormattedFormDataError } from './error-formatting';

packages/keystatic/src/form/fields/blocks/index.tsx

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,11 @@ import {
44
ArrayField,
55
ConditionalField,
66
BasicFormField,
7-
fields,
87
} from '../../api';
98
import { select as selectField } from '../select';
109
import { BlocksFieldInput } from '#field-ui/blocks';
10+
import { conditional } from '../conditional';
11+
import { array } from '../array';
1112

1213
export function blocks<Schemas extends Record<string, ComponentSchema>>(
1314
blocks: {
@@ -45,17 +46,14 @@ export function blocks<Schemas extends Record<string, ComponentSchema>>(
4546
value: key,
4647
})),
4748
});
48-
const element = fields.conditional<
49-
BasicFormField<keyof Schemas & string>,
50-
Schemas
51-
>(
49+
const element = conditional<BasicFormField<keyof Schemas & string>, Schemas>(
5250
select,
5351
Object.fromEntries(
5452
entries.map(([key, { schema }]) => [key, schema])
5553
) as Schemas
5654
);
5755
return {
58-
...fields.array(element, {
56+
...array(element, {
5957
label: opts.label,
6058
description: opts.description,
6159
validation: opts.validation,

packages/keystatic/src/form/parse-props.ts

Lines changed: 1 addition & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -5,18 +5,7 @@ import { FormField, FormFieldStoredValue, JsonYamlValue } from '..';
55
import { FieldDataError } from './fields/error';
66
import { validateArrayLength } from './validate-array-length';
77
import { getInitialPropsValue } from './initial-values';
8-
9-
export class PropValidationError extends Error {
10-
path: ReadonlyPropPath;
11-
schema: ComponentSchema;
12-
cause: unknown;
13-
constructor(cause: unknown, path: ReadonlyPropPath, schema: ComponentSchema) {
14-
super(`field error at ${path.join('.')}`, { cause });
15-
this.path = path;
16-
this.schema = schema;
17-
this.cause = cause;
18-
}
19-
}
8+
import { PropValidationError } from './prop-validation-error';
209

2110
function toFormFieldStoredValue(
2211
val: JsonYamlValue | undefined
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
import type { ComponentSchema } from './api';
2+
import type { ReadonlyPropPath } from './fields/document/DocumentEditor/component-blocks/utils';
3+
4+
export class PropValidationError extends Error {
5+
path: ReadonlyPropPath;
6+
schema: ComponentSchema;
7+
cause: unknown;
8+
constructor(cause: unknown, path: ReadonlyPropPath, schema: ComponentSchema) {
9+
super(`field error at ${path.join('.')}`, { cause });
10+
this.path = path;
11+
this.schema = schema;
12+
this.cause = cause;
13+
}
14+
}

packages/keystatic/src/form/validate-array-length.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import { ArrayField, ComponentSchema } from '..';
22
import { ReadonlyPropPath } from './fields/document/DocumentEditor/component-blocks/utils';
33
import { FieldDataError } from './fields/error';
4-
import { PropValidationError } from './parse-props';
4+
import { PropValidationError } from './prop-validation-error';
55

66
export function validateArrayLength(
77
schema: ArrayField<ComponentSchema>,

0 commit comments

Comments
 (0)