view-contracts 0.5.12 → 0.5.14
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/cli-contract.yaml +1 -1
- package/dist/preview.mjs +154 -154
- package/dist/preview.mjs.map +4 -4
- package/dist/types/renderers/react/dataAttributes.d.ts +2 -0
- package/dist/types/src/compiler/viewPartial.d.ts +1 -1
- package/dist/types/src/config.d.ts +1 -3
- package/dist/types/src/dsl/types.d.ts +2 -3
- package/dist/types/src/generated/cli/program.d.ts +12 -2
- package/dist/types/src/lib/projectPath.d.ts +2 -0
- package/dist/types/src/scaffold/standalone.d.ts +2 -2
- package/dist/types/src/schema/dsl-catalog.d.ts +1 -0
- package/dist/types/src/schema/loadSchema.d.ts +7 -0
- package/dist/types/src/schema/types.d.ts +31 -0
- package/dist/types/src/validate/validateViewProps.d.ts +0 -3
- package/dist/view-contracts.bundle.mjs +219 -213
- package/dist/view-contracts.bundle.mjs.map +4 -4
- package/docs/cli-reference.md +1 -1
- package/package.json +6 -6
- package/renderers/react/dataAttributes.ts +4 -0
- package/renderers/react/lowering/lowerToJsx.ts +45 -11
- package/renderers/react/preview/vocabulary.tsx +7 -3
- package/spec/ui-dsl.schema.json +246 -0
- package/src/dsl/types.ts +2 -3
- package/renderers/react/templates/handlers.ts.hbs +0 -4
|
@@ -9,7 +9,7 @@ export interface ParsedViewPartial {
|
|
|
9
9
|
/** The view<T>() generic type node, if present. */
|
|
10
10
|
propsTypeNode?: ts.TypeNode;
|
|
11
11
|
}
|
|
12
|
+
/** Named value imports from relative modules — the only way a view() partial is imported. */
|
|
12
13
|
export declare function parseViewImports(sourceFile: ts.SourceFile, fileDir: string): Map<string, string>;
|
|
13
14
|
export declare function findViewPartialInSource(sourceFile: ts.SourceFile, exportName: string): ParsedViewPartial | null;
|
|
14
15
|
export declare function loadViewPartial(filePath: string, exportName: string): ParsedViewPartial | null;
|
|
15
|
-
export declare function resolveViewModulePath(importPath: string, fileDir: string): string;
|
|
@@ -66,12 +66,10 @@ export declare function loadConfig(configPath: string): Promise<ViewContractsCon
|
|
|
66
66
|
export declare function normalizeConfig(configPath: string, config: ViewContractsConfig): ViewContractsConfig;
|
|
67
67
|
export declare function loadBindings(bindingsPath: string): Promise<ViewBindingsFile>;
|
|
68
68
|
export declare function reactOutputPath(config: ViewContractsConfig, view: ViewBinding): string;
|
|
69
|
+
export declare function reactRuntimePath(config: ViewContractsConfig): string;
|
|
69
70
|
export declare function projectRoot(configPath: string): string;
|
|
70
71
|
export declare function themeCssPath(_configPath: string, config: ViewContractsConfig): string;
|
|
71
72
|
export declare function requireDesignPaths(config: ViewContractsConfig): {
|
|
72
73
|
tokensPath: string;
|
|
73
74
|
themePath: string;
|
|
74
75
|
};
|
|
75
|
-
export declare function runtimeImportSpecifier(_configPath: string, _config: ViewContractsConfig, outputPath: string): string;
|
|
76
|
-
/** @deprecated Use runtimeImportSpecifier */
|
|
77
|
-
export declare function componentsImportSpecifier(configPath: string, config: ViewContractsConfig, outputPath: string): string;
|
|
@@ -25,10 +25,9 @@ export type FieldSize = 'sm' | 'md' | 'lg';
|
|
|
25
25
|
*/
|
|
26
26
|
export interface CommonProps {
|
|
27
27
|
id?: string;
|
|
28
|
-
|
|
29
|
-
|
|
28
|
+
/** Custom data attributes; web only (`data-<kebab-key>`). */
|
|
29
|
+
data?: Record<string, string | number | boolean>;
|
|
30
30
|
children?: ReactNode;
|
|
31
|
-
hidden?: boolean;
|
|
32
31
|
width?: number;
|
|
33
32
|
minWidth?: number;
|
|
34
33
|
maxWidth?: number;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Command } from "commander";
|
|
1
|
+
import { Command, type CommanderError } from "commander";
|
|
2
2
|
export interface CommandHandlers {
|
|
3
3
|
compile: (options: {
|
|
4
4
|
config?: string;
|
|
@@ -25,4 +25,14 @@ export interface CommandHandlers {
|
|
|
25
25
|
screen?: string;
|
|
26
26
|
}, parentOpts: Record<string, unknown>) => Promise<void>;
|
|
27
27
|
}
|
|
28
|
-
export
|
|
28
|
+
export interface ProgramOptions {
|
|
29
|
+
/**
|
|
30
|
+
* Ends an invocation whose arguments commander rejects (an unknown option,
|
|
31
|
+
* an option without its value, a missing argument): writes what the
|
|
32
|
+
* contract declares for invalid arguments and returns the exit code.
|
|
33
|
+
* commander then writes nothing of its own. Without it, commander writes
|
|
34
|
+
* its message and exits 1.
|
|
35
|
+
*/
|
|
36
|
+
onUsageError?: (error: CommanderError, command: Command) => number;
|
|
37
|
+
}
|
|
38
|
+
export declare function createProgram(handlers: CommandHandlers, version: string, options?: ProgramOptions): Command;
|
|
@@ -1,2 +1,4 @@
|
|
|
1
1
|
/** Project-relative POSIX path for generated artifacts (no absolute paths). */
|
|
2
2
|
export declare function relativeProjectPath(projectDir: string, absolutePath: string): string;
|
|
3
|
+
/** Relative ESM import specifier from one generated/scaffolded file to another (`.ts`/`.tsx` → `.js`). */
|
|
4
|
+
export declare function relImport(from: string, to: string): string;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import type { ViewBindingsFile } from '../config.js';
|
|
2
|
-
export declare function scaffoldStandaloneApp(configPath: string, bindings: ViewBindingsFile): Promise<void>;
|
|
1
|
+
import type { ViewBindingsFile, ViewContractsConfig } from '../config.js';
|
|
2
|
+
export declare function scaffoldStandaloneApp(configPath: string, config: ViewContractsConfig, bindings: ViewBindingsFile): Promise<void>;
|
|
@@ -44,6 +44,7 @@ export declare const TOKEN_CATALOG: {
|
|
|
44
44
|
readonly imageFit: readonly ["contain", "cover", "fill", "none"];
|
|
45
45
|
readonly keyboardType: readonly ["text", "number", "email", "url", "password", "tel"];
|
|
46
46
|
readonly inputType: readonly ["text", "password", "email", "url", "tel"];
|
|
47
|
+
readonly buttonType: readonly ["button", "submit", "reset"];
|
|
47
48
|
readonly clip: readonly ["none", "bounds", "shape"];
|
|
48
49
|
};
|
|
49
50
|
export declare const PROPERTY_CATALOG: Record<string, PropertyDef>;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { UiDslSchema } from './types.js';
|
|
2
|
+
export type { UiDslSchema } from './types.js';
|
|
3
|
+
export { elementProps, propertyAppliesTo } from './dsl-catalog.js';
|
|
4
|
+
export declare const DEFAULT_SCHEMA_PATH = "spec/ui-dsl.schema.json";
|
|
5
|
+
export declare function loadPackageVersion(root?: string): Promise<string>;
|
|
6
|
+
export declare function loadUiDslSchema(schemaPath?: string): Promise<UiDslSchema>;
|
|
7
|
+
export declare function allComponentNames(): string[];
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
export type { PropertyDef, ElementDef, LoweringMode, } from './dsl-catalog.js';
|
|
2
|
+
export { PROPERTY_CATALOG, ELEMENT_CATALOG, TOKEN_CATALOG } from './dsl-catalog.js';
|
|
3
|
+
/**
|
|
4
|
+
* UiDslSchema — the shape of spec/ui-dsl.schema.json (user-facing).
|
|
5
|
+
* Used only by the schema loader for meta-validation; program control
|
|
6
|
+
* decisions use dsl-catalog.ts directly.
|
|
7
|
+
*/
|
|
8
|
+
export interface UiDslSchema {
|
|
9
|
+
tokens: Record<string, string[]>;
|
|
10
|
+
properties: Record<string, {
|
|
11
|
+
type: string | string[];
|
|
12
|
+
enum?: string;
|
|
13
|
+
description?: string;
|
|
14
|
+
'x-category': string;
|
|
15
|
+
'x-appliesTo'?: string[];
|
|
16
|
+
'x-notes'?: string;
|
|
17
|
+
}>;
|
|
18
|
+
elements: Record<string, {
|
|
19
|
+
description: string;
|
|
20
|
+
'x-tier': string;
|
|
21
|
+
'x-category': string;
|
|
22
|
+
'x-notes'?: string;
|
|
23
|
+
properties: Record<string, {
|
|
24
|
+
$ref: string;
|
|
25
|
+
} | Record<string, unknown>>;
|
|
26
|
+
_children: {
|
|
27
|
+
'x-kind': string;
|
|
28
|
+
'x-items'?: string[];
|
|
29
|
+
};
|
|
30
|
+
}>;
|
|
31
|
+
}
|
|
@@ -1,5 +1,2 @@
|
|
|
1
1
|
import type { ViewIrDocument } from '../ir/types.js';
|
|
2
|
-
import { type PropertyDef } from '../schema/dsl-catalog.js';
|
|
3
2
|
export declare function validateViewProps(docs: Iterable<ViewIrDocument>, allowlistExtra?: string[]): Promise<void>;
|
|
4
|
-
/** @internal Exported for tests. */
|
|
5
|
-
export declare function isVisualProperty(def: PropertyDef | undefined): boolean;
|