view-contracts 0.3.4 → 0.4.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/README.md +10 -3
- package/cli-contract.yaml +41 -1
- package/dist/preview-style-helpers.js +2 -0
- package/dist/preview-style-helpers.js.map +7 -0
- package/dist/preview.mjs +153 -0
- package/dist/preview.mjs.map +7 -0
- package/dist/view-contracts.bundle.mjs +402 -237
- package/dist/view-contracts.bundle.mjs.map +4 -4
- package/docs/cli-reference.md +37 -1
- package/package.json +28 -1
- package/renderers/compose/renderRuntime.ts +40 -0
- package/renderers/react/defaults/theme.yaml +23 -0
- package/renderers/react/defaults/tokens.yaml +15 -0
- package/renderers/react/elementMap.ts +30 -6
- package/renderers/react/elements.yaml +17 -5
- package/renderers/react/lowering/foldStyle.ts +13 -1
- package/renderers/react/lowering/lowerToJsx.ts +58 -40
- package/renderers/react/paths.ts +1 -10
- package/renderers/react/preview/components.ts +23 -0
- package/renderers/react/preview/index.ts +3 -0
- package/renderers/react/preview/start.tsx +42 -0
- package/renderers/react/preview/style-helpers.ts +5 -0
- package/renderers/react/preview/vocabulary.tsx +75 -0
- package/renderers/react/renderComponents.ts +169 -14
- package/renderers/react/runtime/theme.css +9 -17
- package/renderers/react/style/foldLiterals.ts +11 -0
- package/renderers/swiftui/README.md +48 -10
- package/renderers/swiftui/elementMap.ts +45 -0
- package/renderers/swiftui/elements.yaml +82 -0
- package/renderers/swiftui/index.ts +5 -0
- package/renderers/swiftui/lowering/lowerToSwiftUI.ts +542 -0
- package/renderers/swiftui/lowering/modifiers.ts +142 -0
- package/renderers/swiftui/renderComponents.ts +79 -0
- package/renderers/swiftui/renderRuntime.ts +91 -0
- package/renderers/swiftui/renderTheme.ts +208 -0
- package/spec/ui-dsl.linter-rules.json +0 -7
- package/spec/ui-dsl.meta.json +5 -0
- package/spec/ui-dsl.schema.json +333 -259
- package/src/generated/schema/allowed-components.ts +0 -36
- package/src/generated/schema/dsl-enums.ts +0 -19
- package/src/generated/schema/dsl-properties.ts +0 -64
- package/src/generated/schema/index.ts +0 -4
- package/src/generated/schema/lowering-style-properties.ts +0 -35
- package/src/generated/schema/react-renderer-element-config.ts +0 -27
- package/src/generated/schema/schema-document.ts +0 -33
|
@@ -1,36 +0,0 @@
|
|
|
1
|
-
/** Auto-generated from spec/ui-dsl.schema.json — view-contracts v0.3.3 — DO NOT EDIT */
|
|
2
|
-
export const ALLOWED_COMPONENTS = new Set([
|
|
3
|
-
'App',
|
|
4
|
-
'Box',
|
|
5
|
-
'Button',
|
|
6
|
-
'Checkbox',
|
|
7
|
-
'Column',
|
|
8
|
-
'Divider',
|
|
9
|
-
'Drawer',
|
|
10
|
-
'Field',
|
|
11
|
-
'Form',
|
|
12
|
-
'Heading',
|
|
13
|
-
'Icon',
|
|
14
|
-
'IconButton',
|
|
15
|
-
'Image',
|
|
16
|
-
'Link',
|
|
17
|
-
'List',
|
|
18
|
-
'ListItem',
|
|
19
|
-
'Modal',
|
|
20
|
-
'Page',
|
|
21
|
-
'Popover',
|
|
22
|
-
'Progress',
|
|
23
|
-
'Radio',
|
|
24
|
-
'Row',
|
|
25
|
-
'SafeArea',
|
|
26
|
-
'ScrollArea',
|
|
27
|
-
'Select',
|
|
28
|
-
'Spacer',
|
|
29
|
-
'Spinner',
|
|
30
|
-
'Stack',
|
|
31
|
-
'Switch',
|
|
32
|
-
'Text',
|
|
33
|
-
'TextArea',
|
|
34
|
-
'TextInput',
|
|
35
|
-
'Tooltip',
|
|
36
|
-
]);
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
/** Auto-generated from spec/ui-dsl.schema.json — view-contracts v0.3.3 — DO NOT EDIT */
|
|
2
|
-
export type Role = "button" | "link" | "heading" | "list" | "listitem" | "main" | "dialog" | "status";
|
|
3
|
-
export type WidthSize = "wrap" | "fill";
|
|
4
|
-
export type HeightSize = "wrap" | "fill";
|
|
5
|
-
export type Align = "start" | "center" | "end" | "stretch";
|
|
6
|
-
export type Justify = "start" | "center" | "end" | "spaceBetween" | "spaceAround" | "spaceEvenly";
|
|
7
|
-
export type ContentAlign = "topStart" | "top" | "topEnd" | "start" | "center" | "end" | "bottomStart" | "bottom" | "bottomEnd";
|
|
8
|
-
export type Axis = "vertical" | "horizontal";
|
|
9
|
-
export type Direction = "ltr" | "rtl" | "system";
|
|
10
|
-
export type Scroll = "none" | "vertical" | "horizontal" | "both";
|
|
11
|
-
export type Border = "none";
|
|
12
|
-
export type Shadow = "none" | "sm" | "md" | "lg";
|
|
13
|
-
export type TextAlign = "start" | "center" | "end";
|
|
14
|
-
export type LineLimit = "none";
|
|
15
|
-
export type TextOverflow = "clip" | "ellipsis";
|
|
16
|
-
export type FontWeight = "regular" | "medium" | "bold";
|
|
17
|
-
export type ImageFit = "contain" | "cover" | "fill" | "none";
|
|
18
|
-
export type KeyboardType = "text" | "number" | "email" | "url" | "password" | "tel";
|
|
19
|
-
export type Clip = "none" | "bounds" | "shape";
|
|
@@ -1,64 +0,0 @@
|
|
|
1
|
-
/** Auto-generated from spec/ui-dsl.schema.json — view-contracts v0.3.3 — DO NOT EDIT */
|
|
2
|
-
export interface ViewAction { name: string; params?: Record<string, unknown> }
|
|
3
|
-
import type { Role, WidthSize, HeightSize, Align, Justify, ContentAlign, Axis, Direction, Scroll, Border, Shadow, TextAlign, LineLimit, TextOverflow, FontWeight, ImageFit, KeyboardType, Clip } from './dsl-enums.js';
|
|
4
|
-
|
|
5
|
-
/** Shared DSL attributes from $defs.properties / properties catalog */
|
|
6
|
-
export interface DslProperties {
|
|
7
|
-
id?: string;
|
|
8
|
-
role?: Role;
|
|
9
|
-
label?: string;
|
|
10
|
-
visible?: boolean;
|
|
11
|
-
enabled?: boolean;
|
|
12
|
-
selected?: boolean;
|
|
13
|
-
checked?: boolean;
|
|
14
|
-
readonly?: boolean;
|
|
15
|
-
required?: boolean;
|
|
16
|
-
width?: WidthSize;
|
|
17
|
-
height?: HeightSize;
|
|
18
|
-
minWidth?: number;
|
|
19
|
-
maxWidth?: string | number;
|
|
20
|
-
minHeight?: number;
|
|
21
|
-
maxHeight?: string | number;
|
|
22
|
-
aspectRatio?: number;
|
|
23
|
-
weight?: number;
|
|
24
|
-
padding?: string | number;
|
|
25
|
-
gap?: string | number;
|
|
26
|
-
align?: Align;
|
|
27
|
-
justify?: Justify;
|
|
28
|
-
selfAlign?: Align;
|
|
29
|
-
contentAlign?: ContentAlign;
|
|
30
|
-
axis?: Axis;
|
|
31
|
-
direction?: Direction;
|
|
32
|
-
scroll?: Scroll;
|
|
33
|
-
background?: string;
|
|
34
|
-
foreground?: string;
|
|
35
|
-
border?: Border;
|
|
36
|
-
radius?: string;
|
|
37
|
-
shadow?: Shadow;
|
|
38
|
-
opacity?: number;
|
|
39
|
-
clip?: Clip;
|
|
40
|
-
textStyle?: string;
|
|
41
|
-
textAlign?: TextAlign;
|
|
42
|
-
lineLimit?: LineLimit;
|
|
43
|
-
textOverflow?: TextOverflow;
|
|
44
|
-
fontWeight?: FontWeight;
|
|
45
|
-
headingLevel?: number;
|
|
46
|
-
fit?: ImageFit;
|
|
47
|
-
src?: string;
|
|
48
|
-
alt?: string;
|
|
49
|
-
name?: string;
|
|
50
|
-
onClick?: ViewAction;
|
|
51
|
-
onSubmit?: ViewAction;
|
|
52
|
-
onChange?: ViewAction;
|
|
53
|
-
focusable?: boolean;
|
|
54
|
-
autoFocus?: boolean;
|
|
55
|
-
keyboardType?: KeyboardType;
|
|
56
|
-
value?: string | number | boolean;
|
|
57
|
-
binding?: string;
|
|
58
|
-
placeholder?: string;
|
|
59
|
-
options?: unknown[];
|
|
60
|
-
error?: string | null;
|
|
61
|
-
help?: string | null;
|
|
62
|
-
variant?: string;
|
|
63
|
-
theme?: string;
|
|
64
|
-
}
|
|
@@ -1,35 +0,0 @@
|
|
|
1
|
-
/** Auto-generated from spec/ui-dsl.schema.json — view-contracts v0.3.3 — DO NOT EDIT */
|
|
2
|
-
/** Property names folded to compile-time inline CSS during React HTML lowering. */
|
|
3
|
-
export const LOWERING_STYLE_PROPERTIES = new Set<string>([
|
|
4
|
-
"align",
|
|
5
|
-
"aspectRatio",
|
|
6
|
-
"axis",
|
|
7
|
-
"background",
|
|
8
|
-
"border",
|
|
9
|
-
"clip",
|
|
10
|
-
"contentAlign",
|
|
11
|
-
"direction",
|
|
12
|
-
"fontWeight",
|
|
13
|
-
"foreground",
|
|
14
|
-
"gap",
|
|
15
|
-
"headingLevel",
|
|
16
|
-
"height",
|
|
17
|
-
"justify",
|
|
18
|
-
"lineLimit",
|
|
19
|
-
"maxHeight",
|
|
20
|
-
"maxWidth",
|
|
21
|
-
"minHeight",
|
|
22
|
-
"minWidth",
|
|
23
|
-
"opacity",
|
|
24
|
-
"padding",
|
|
25
|
-
"radius",
|
|
26
|
-
"scroll",
|
|
27
|
-
"selfAlign",
|
|
28
|
-
"shadow",
|
|
29
|
-
"textAlign",
|
|
30
|
-
"textOverflow",
|
|
31
|
-
"textStyle",
|
|
32
|
-
"weight",
|
|
33
|
-
"width",
|
|
34
|
-
"size",
|
|
35
|
-
]);
|
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
/** Auto-generated from renderers/react/element-config.meta.json — view-contracts v0.3.3 — DO NOT EDIT */
|
|
2
|
-
/** Shape of entries in renderers/react/elements.yaml (target-specific HTML map, not DSL vocabulary). */
|
|
3
|
-
export interface ReactRendererElementConfig {
|
|
4
|
-
tag: string;
|
|
5
|
-
className?: string;
|
|
6
|
-
ariaLabel?: boolean;
|
|
7
|
-
ariaHidden?: boolean;
|
|
8
|
-
flex?: "row" | "column";
|
|
9
|
-
wrapProp?: string;
|
|
10
|
-
flexGrowProp?: string;
|
|
11
|
-
void?: boolean;
|
|
12
|
-
levelProp?: string;
|
|
13
|
-
defaultLevel?: number;
|
|
14
|
-
actionEvent?: "onClick" | "onSubmit";
|
|
15
|
-
fieldWrap?: boolean;
|
|
16
|
-
inputType?: string;
|
|
17
|
-
sizeClass?: string;
|
|
18
|
-
optionsProp?: string;
|
|
19
|
-
checkbox?: boolean;
|
|
20
|
-
fieldContainer?: boolean;
|
|
21
|
-
scrollContainer?: boolean;
|
|
22
|
-
defaultRole?: string;
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
export interface ReactElementMapFile {
|
|
26
|
-
elements: Record<string, ReactRendererElementConfig>;
|
|
27
|
-
}
|
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
/** Auto-generated from spec/ui-dsl.meta.json + ui-dsl.schema.json — view-contracts v0.3.3 — DO NOT EDIT */
|
|
2
|
-
import type { Role, WidthSize, HeightSize, Align, Justify, ContentAlign, Axis, Direction, Scroll, Border, Shadow, TextAlign, LineLimit, TextOverflow, FontWeight, ImageFit, KeyboardType, Clip } from './dsl-enums.js';
|
|
3
|
-
|
|
4
|
-
export type PropertyType = 'string' | 'number' | 'boolean' | 'array' | 'action' | 'object' | 'null' | string | string[];
|
|
5
|
-
|
|
6
|
-
export interface PropertyDef {
|
|
7
|
-
type: PropertyType;
|
|
8
|
-
enum?: string;
|
|
9
|
-
description?: string;
|
|
10
|
-
'x-category': string;
|
|
11
|
-
'x-appliesTo'?: string[];
|
|
12
|
-
'x-notes'?: string;
|
|
13
|
-
$ref?: string;
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
export interface ChildrenConstraint {
|
|
17
|
-
'x-kind': 'any' | 'none' | 'single' | 'text' | 'list';
|
|
18
|
-
'x-items'?: string[];
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
export interface ElementDef {
|
|
22
|
-
description: string;
|
|
23
|
-
'x-category': string;
|
|
24
|
-
'x-notes'?: string;
|
|
25
|
-
properties: Record<string, PropertyDef | { $ref: string }>;
|
|
26
|
-
_children: ChildrenConstraint;
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
export interface UiDslSchema {
|
|
30
|
-
tokens: Record<string, string[]>;
|
|
31
|
-
properties: Record<string, PropertyDef>;
|
|
32
|
-
elements: Record<string, ElementDef>;
|
|
33
|
-
}
|