@json-to-office/core-docx 0.1.0 → 0.2.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.
@@ -1,31 +1,16 @@
1
- import type { TSchema } from '@sinclair/typebox';
1
+ import type { TSchema, Static } from '@sinclair/typebox';
2
2
  import type { CustomComponent } from './createComponent';
3
3
  import type { ReportComponentDefinition } from '../types';
4
- import { type ValidationError, type ComponentValidationResult } from '@json-to-office/shared-docx/validation/unified';
4
+ import { type ComponentValidationResult } from '@json-to-office/shared/plugin';
5
5
  import type { ValidationResult } from '@json-to-office/shared';
6
- /**
7
- * Error thrown when attempting to register a component with a duplicate name
8
- */
9
- export declare class DuplicateComponentError extends Error {
10
- readonly componentName: string;
11
- readonly code = "DUPLICATE_COMPONENT";
12
- constructor(componentName: string);
13
- }
14
- /**
15
- * Custom validation error class
16
- */
17
- export declare class ComponentValidationError extends Error {
18
- errors: ValidationError[];
19
- props: unknown;
20
- constructor(errors: ValidationError[], props?: unknown);
21
- }
6
+ export { DuplicateComponentError, ComponentValidationError, } from '@json-to-office/shared/plugin';
22
7
  /**
23
8
  * Validate a component props against a schema.
24
9
  * Accepts a narrower interface — only needs { propsSchema }.
25
10
  */
26
11
  export declare function validateComponentProps<TPropsSchema extends TSchema>(schema: {
27
12
  propsSchema: TPropsSchema;
28
- }, props: unknown): ComponentValidationResult<TPropsSchema>;
13
+ }, props: unknown, componentName?: string): ComponentValidationResult<TPropsSchema>;
29
14
  /**
30
15
  * Validate document and all custom components (version-aware)
31
16
  */
@@ -34,12 +19,11 @@ export declare function validateDocument(document: ReportComponentDefinition, cu
34
19
  };
35
20
  /**
36
21
  * Validates component props and returns the typed props or throws.
37
- * Accepts a narrower interface — only needs { propsSchema }.
38
22
  */
39
23
  export declare function getValidatedProps<TPropsSchema extends TSchema>(schema: {
40
24
  propsSchema: TPropsSchema;
41
- }, props: unknown): TPropsSchema;
25
+ }, props: unknown): Static<TPropsSchema>;
42
26
  export type { ValidationError } from '@json-to-office/shared-docx/validation/unified';
43
- export type { ComponentValidationResult } from '@json-to-office/shared-docx/validation/unified';
27
+ export type { ComponentValidationResult } from '@json-to-office/shared/plugin';
44
28
  export declare const cleanComponentProps: typeof getValidatedProps;
45
29
  //# sourceMappingURL=validation.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"validation.d.ts","sourceRoot":"","sources":["../../src/plugin/validation.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,mBAAmB,CAAC;AACjD,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AACzD,OAAO,KAAK,EAAE,yBAAyB,EAAE,MAAM,UAAU,CAAC;AAE1D,OAAO,EAGL,KAAK,eAAe,EACpB,KAAK,yBAAyB,EAC/B,MAAM,gDAAgD,CAAC;AACxD,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,wBAAwB,CAAC;AAE/D;;GAEG;AACH,qBAAa,uBAAwB,SAAQ,KAAK;IAChD,SAAgB,aAAa,EAAE,MAAM,CAAC;IACtC,SAAgB,IAAI,yBAAyB;gBAEjC,aAAa,EAAE,MAAM;CAalC;AAED;;GAEG;AACH,qBAAa,wBAAyB,SAAQ,KAAK;IAC1C,MAAM,EAAE,eAAe,EAAE,CAAC;IAC1B,KAAK,EAAE,OAAO,CAAC;gBAEV,MAAM,EAAE,eAAe,EAAE,EAAE,KAAK,CAAC,EAAE,OAAO;CAWvD;AAED;;;GAGG;AACH,wBAAgB,sBAAsB,CAAC,YAAY,SAAS,OAAO,EACjE,MAAM,EAAE;IAAE,WAAW,EAAE,YAAY,CAAA;CAAE,EACrC,KAAK,EAAE,OAAO,GACb,yBAAyB,CAAC,YAAY,CAAC,CAKzC;AAED;;GAEG;AACH,wBAAgB,gBAAgB,CAC9B,QAAQ,EAAE,yBAAyB,EACnC,gBAAgB,EAAE,eAAe,CAAC,GAAG,EAAE,GAAG,EAAE,GAAG,CAAC,EAAE,GACjD,gB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BAAgB,iBAAiB,CAAC,YAAY,SAAS,OAAO,EAC5D,MAAM,EAAE;IAAE,WAAW,EAAE,YAAY,CAAA;CAAE,EACrC,KAAK,EAAE,OAAO,GACb,MAAM,CAAC,YAAY,CAAC,CAQtB;AAGD,YAAY,EAAE,eAAe,EAAE,MAAM,gDAAgD,CAAC;AACtF,YAAY,EAAE,yBAAyB,EAAE,MAAM,+BAA+B,CAAC;AAE/E,eAAO,MAAM,mBAAmB,0BAAoB,CAAC"}
@@ -1,10 +1,2 @@
1
- import type { ComponentVersion, ComponentVersionMap } from './createComponent';
2
- /**
3
- * Resolve the correct version entry for a component.
4
- *
5
- * - If `requestedVersion` is provided and found, return it.
6
- * - If `requestedVersion` is provided but missing, throw with available versions.
7
- * - If `requestedVersion` is absent, return the latest semver version.
8
- */
9
- export declare function resolveComponentVersion(componentName: string, versions: ComponentVersionMap, requestedVersion?: string): ComponentVersion;
1
+ export { resolveComponentVersion } from '@json-to-office/shared/plugin';
10
2
  //# sourceMappingURL=version-resolver.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"version-resolver.d.ts","sourceRoot":"","sources":["../../src/plugin/version-resolver.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,gBAAgB,EAAE,mBAAmB,EAAE,MAAM,mBAAmB,CAAC;AAE/E;;;;;;GAMG;AACH,wBAAgB,uBAAuB,CACrC,aAAa,EAAE,MAAM,EACrB,QAAQ,EAAE,mBAAmB,EAC7B,gBAAgB,CAAC,EAAE,MAAM,GACxB,gBAAgB,CAgBlB"}
1
+ {"version":3,"file":"version-resolver.d.ts","sourceRoot":"","sources":["../../src/plugin/version-resolver.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,uBAAuB,EAAE,MAAM,+BAA+B,CAAC"}
@@ -1057,7 +1057,7 @@ export declare const themes: Record<string, {
1057
1057
  width?: number | undefined;
1058
1058
  keepNext?: boolean | undefined;
1059
1059
  columns?: {
1060
- width?: number | undefined;
1060
+ width?: string | number | undefined;
1061
1061
  header?: {
1062
1062
  color?: string | undefined;
1063
1063
  height?: number | undefined;
@@ -2523,7 +2523,7 @@ export declare const minimalTheme: {
2523
2523
  width?: number | undefined;
2524
2524
  keepNext?: boolean | undefined;
2525
2525
  columns?: {
2526
- width?: number | undefined;
2526
+ width?: string | number | undefined;
2527
2527
  header?: {
2528
2528
  color?: string | undefined;
2529
2529
  height?: number | undefined;
@@ -3954,7 +3954,7 @@ export declare const corporateTheme: {
3954
3954
  width?: number | undefined;
3955
3955
  keepNext?: boolean | undefined;
3956
3956
  columns?: {
3957
- width?: number | undefined;
3957
+ width?: string | number | undefined;
3958
3958
  header?: {
3959
3959
  color?: string | undefined;
3960
3960
  height?: number | undefined;
@@ -5385,7 +5385,7 @@ export declare const modernTheme: {
5385
5385
  width?: number | undefined;
5386
5386
  keepNext?: boolean | undefined;
5387
5387
  columns?: {
5388
- width?: number | undefined;
5388
+ width?: string | number | undefined;
5389
5389
  header?: {
5390
5390
  color?: string | undefined;
5391
5391
  height?: number | undefined;