@typecad/ui 0.1.0-alpha.1
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/LICENSE +21 -0
- package/README.md +1443 -0
- package/dist/engine-index.d.ts +7 -0
- package/dist/engine-index.js +41 -0
- package/dist/index.d.ts +165 -0
- package/dist/index.js +42 -0
- package/dist/preview/build-program.d.ts +7 -0
- package/dist/preview/build-program.js +665 -0
- package/dist/preview/host-gfx.d.ts +90 -0
- package/dist/preview/host-gfx.js +552 -0
- package/dist/preview/host-ui-runtime.d.ts +241 -0
- package/dist/preview/host-ui-runtime.js +3236 -0
- package/dist/preview/types.d.ts +83 -0
- package/dist/preview/types.js +1 -0
- package/dist/types.d.ts +108 -0
- package/dist/types.js +10 -0
- package/dist/ui-engine/block-layout.d.ts +8 -0
- package/dist/ui-engine/block-layout.js +95 -0
- package/dist/ui-engine/color.d.ts +49 -0
- package/dist/ui-engine/color.js +273 -0
- package/dist/ui-engine/css-parser.d.ts +155 -0
- package/dist/ui-engine/css-parser.js +1058 -0
- package/dist/ui-engine/default-keyboards.d.ts +3 -0
- package/dist/ui-engine/default-keyboards.js +53 -0
- package/dist/ui-engine/easing.d.ts +12 -0
- package/dist/ui-engine/easing.js +76 -0
- package/dist/ui-engine/font-assets.d.ts +50 -0
- package/dist/ui-engine/font-assets.js +431 -0
- package/dist/ui-engine/html-parser.d.ts +116 -0
- package/dist/ui-engine/html-parser.js +284 -0
- package/dist/ui-engine/image-assets.d.ts +21 -0
- package/dist/ui-engine/image-assets.js +125 -0
- package/dist/ui-engine/inline-parser.d.ts +30 -0
- package/dist/ui-engine/inline-parser.js +66 -0
- package/dist/ui-engine/keyframes.d.ts +3 -0
- package/dist/ui-engine/keyframes.js +39 -0
- package/dist/ui-engine/layout-engine.d.ts +35 -0
- package/dist/ui-engine/layout-engine.js +203 -0
- package/dist/ui-engine/model.d.ts +239 -0
- package/dist/ui-engine/model.js +987 -0
- package/dist/ui-engine/rich-layout.d.ts +51 -0
- package/dist/ui-engine/rich-layout.js +220 -0
- package/dist/ui-engine/run-types.d.ts +13 -0
- package/dist/ui-engine/run-types.js +1 -0
- package/dist/ui-engine/runtime-header/antialiasing.d.ts +1 -0
- package/dist/ui-engine/runtime-header/antialiasing.js +141 -0
- package/dist/ui-engine/runtime-header/blend-bodies.d.ts +1 -0
- package/dist/ui-engine/runtime-header/blend-bodies.js +39 -0
- package/dist/ui-engine/runtime-header/canvas-helpers.d.ts +1 -0
- package/dist/ui-engine/runtime-header/canvas-helpers.js +155 -0
- package/dist/ui-engine/runtime-header/canvas-scrollbar.d.ts +1 -0
- package/dist/ui-engine/runtime-header/canvas-scrollbar.js +105 -0
- package/dist/ui-engine/runtime-header/color-mono-refresh.d.ts +1 -0
- package/dist/ui-engine/runtime-header/color-mono-refresh.js +154 -0
- package/dist/ui-engine/runtime-header/dirty-scroll-mutators.d.ts +1 -0
- package/dist/ui-engine/runtime-header/dirty-scroll-mutators.js +169 -0
- package/dist/ui-engine/runtime-header/display-shim.d.ts +1 -0
- package/dist/ui-engine/runtime-header/display-shim.js +104 -0
- package/dist/ui-engine/runtime-header/forward-decls.d.ts +1 -0
- package/dist/ui-engine/runtime-header/forward-decls.js +137 -0
- package/dist/ui-engine/runtime-header/guard-close.d.ts +1 -0
- package/dist/ui-engine/runtime-header/guard-close.js +8 -0
- package/dist/ui-engine/runtime-header/image-drawing.d.ts +1 -0
- package/dist/ui-engine/runtime-header/image-drawing.js +300 -0
- package/dist/ui-engine/runtime-header/init-press-input.d.ts +1 -0
- package/dist/ui-engine/runtime-header/init-press-input.js +126 -0
- package/dist/ui-engine/runtime-header/keyboard.d.ts +1 -0
- package/dist/ui-engine/runtime-header/keyboard.js +342 -0
- package/dist/ui-engine/runtime-header/node-decoration.d.ts +1 -0
- package/dist/ui-engine/runtime-header/node-decoration.js +212 -0
- package/dist/ui-engine/runtime-header/paint-order-coords.d.ts +1 -0
- package/dist/ui-engine/runtime-header/paint-order-coords.js +190 -0
- package/dist/ui-engine/runtime-header/paint-rects-repair.d.ts +1 -0
- package/dist/ui-engine/runtime-header/paint-rects-repair.js +553 -0
- package/dist/ui-engine/runtime-header/scroll-physics.d.ts +1 -0
- package/dist/ui-engine/runtime-header/scroll-physics.js +161 -0
- package/dist/ui-engine/runtime-header/state-bindings-nav.d.ts +1 -0
- package/dist/ui-engine/runtime-header/state-bindings-nav.js +176 -0
- package/dist/ui-engine/runtime-header/structs.d.ts +1 -0
- package/dist/ui-engine/runtime-header/structs.js +220 -0
- package/dist/ui-engine/runtime-header/text-rendering.d.ts +1 -0
- package/dist/ui-engine/runtime-header/text-rendering.js +715 -0
- package/dist/ui-engine/runtime-header/tick/bindings-phase.d.ts +1 -0
- package/dist/ui-engine/runtime-header/tick/bindings-phase.js +103 -0
- package/dist/ui-engine/runtime-header/tick/dirty-draw-phase.d.ts +1 -0
- package/dist/ui-engine/runtime-header/tick/dirty-draw-phase.js +1051 -0
- package/dist/ui-engine/runtime-header/tick/flush-phase.d.ts +1 -0
- package/dist/ui-engine/runtime-header/tick/flush-phase.js +17 -0
- package/dist/ui-engine/runtime-header/tick/scroll-canvas-phase.d.ts +1 -0
- package/dist/ui-engine/runtime-header/tick/scroll-canvas-phase.js +15 -0
- package/dist/ui-engine/runtime-header/tick/transitions-phase.d.ts +1 -0
- package/dist/ui-engine/runtime-header/tick/transitions-phase.js +213 -0
- package/dist/ui-engine/runtime-header/tick-motion-helpers.d.ts +1 -0
- package/dist/ui-engine/runtime-header/tick-motion-helpers.js +26 -0
- package/dist/ui-engine/runtime-header/tick.d.ts +1 -0
- package/dist/ui-engine/runtime-header/tick.js +17 -0
- package/dist/ui-engine/runtime-header/touch-keyboard-fwd.d.ts +1 -0
- package/dist/ui-engine/runtime-header/touch-keyboard-fwd.js +406 -0
- package/dist/ui-engine/runtime-header/types-defines.d.ts +1 -0
- package/dist/ui-engine/runtime-header/types-defines.js +79 -0
- package/dist/ui-engine/runtime-header.d.ts +1 -0
- package/dist/ui-engine/runtime-header.js +69 -0
- package/dist/ui-engine/scroll-memory-diagnostics.d.ts +16 -0
- package/dist/ui-engine/scroll-memory-diagnostics.js +58 -0
- package/dist/ui-engine/select-engine.d.ts +4 -0
- package/dist/ui-engine/select-engine.js +19 -0
- package/dist/ui-engine/style-resolver.d.ts +77 -0
- package/dist/ui-engine/style-resolver.js +341 -0
- package/dist/ui-engine/text-layout.d.ts +19 -0
- package/dist/ui-engine/text-layout.js +92 -0
- package/dist/ui-engine/transpile-ui.d.ts +11 -0
- package/dist/ui-engine/transpile-ui.js +33 -0
- package/dist/ui-engine/ua-stylesheet.d.ts +3 -0
- package/dist/ui-engine/ua-stylesheet.js +56 -0
- package/dist/ui-engine/ui-file-splitter.d.ts +14 -0
- package/dist/ui-engine/ui-file-splitter.js +47 -0
- package/dist/ui-engine/ui-lowering.d.ts +33 -0
- package/dist/ui-engine/ui-lowering.js +390 -0
- package/dist/ui-engine/ui-registry.d.ts +81 -0
- package/dist/ui-engine/ui-registry.js +429 -0
- package/dist/ui-engine/yoga-layout.d.ts +12 -0
- package/dist/ui-engine/yoga-layout.js +314 -0
- package/package.json +86 -0
- package/src/engine-index.ts +51 -0
- package/src/index.ts +232 -0
- package/src/preview/build-program.ts +734 -0
- package/src/preview/host-gfx.ts +580 -0
- package/src/preview/host-ui-runtime.ts +3245 -0
- package/src/preview/types.ts +96 -0
- package/src/types.ts +127 -0
- package/src/ui-engine/block-layout.ts +104 -0
- package/src/ui-engine/color.ts +263 -0
- package/src/ui-engine/css-parser.ts +1003 -0
- package/src/ui-engine/default-keyboards.ts +58 -0
- package/src/ui-engine/easing.ts +53 -0
- package/src/ui-engine/font-assets.ts +512 -0
- package/src/ui-engine/html-parser.ts +397 -0
- package/src/ui-engine/image-assets.ts +170 -0
- package/src/ui-engine/inline-parser.ts +78 -0
- package/src/ui-engine/keyframes.ts +47 -0
- package/src/ui-engine/layout-engine.ts +228 -0
- package/src/ui-engine/model.ts +1225 -0
- package/src/ui-engine/rich-layout.ts +257 -0
- package/src/ui-engine/run-types.ts +14 -0
- package/src/ui-engine/runtime-header/antialiasing.ts +141 -0
- package/src/ui-engine/runtime-header/blend-bodies.ts +39 -0
- package/src/ui-engine/runtime-header/canvas-helpers.ts +155 -0
- package/src/ui-engine/runtime-header/canvas-scrollbar.ts +105 -0
- package/src/ui-engine/runtime-header/color-mono-refresh.ts +154 -0
- package/src/ui-engine/runtime-header/dirty-scroll-mutators.ts +169 -0
- package/src/ui-engine/runtime-header/display-shim.ts +104 -0
- package/src/ui-engine/runtime-header/forward-decls.ts +137 -0
- package/src/ui-engine/runtime-header/guard-close.ts +8 -0
- package/src/ui-engine/runtime-header/image-drawing.ts +300 -0
- package/src/ui-engine/runtime-header/init-press-input.ts +126 -0
- package/src/ui-engine/runtime-header/keyboard.ts +342 -0
- package/src/ui-engine/runtime-header/node-decoration.ts +212 -0
- package/src/ui-engine/runtime-header/paint-order-coords.ts +190 -0
- package/src/ui-engine/runtime-header/paint-rects-repair.ts +553 -0
- package/src/ui-engine/runtime-header/scroll-physics.ts +161 -0
- package/src/ui-engine/runtime-header/state-bindings-nav.ts +176 -0
- package/src/ui-engine/runtime-header/structs.ts +220 -0
- package/src/ui-engine/runtime-header/text-rendering.ts +715 -0
- package/src/ui-engine/runtime-header/tick/bindings-phase.ts +103 -0
- package/src/ui-engine/runtime-header/tick/dirty-draw-phase.ts +1051 -0
- package/src/ui-engine/runtime-header/tick/flush-phase.ts +17 -0
- package/src/ui-engine/runtime-header/tick/scroll-canvas-phase.ts +15 -0
- package/src/ui-engine/runtime-header/tick/transitions-phase.ts +213 -0
- package/src/ui-engine/runtime-header/tick-motion-helpers.ts +26 -0
- package/src/ui-engine/runtime-header/tick.ts +18 -0
- package/src/ui-engine/runtime-header/touch-keyboard-fwd.ts +406 -0
- package/src/ui-engine/runtime-header/types-defines.ts +79 -0
- package/src/ui-engine/runtime-header.ts +71 -0
- package/src/ui-engine/scroll-memory-diagnostics.ts +79 -0
- package/src/ui-engine/select-engine.ts +21 -0
- package/src/ui-engine/style-resolver.ts +416 -0
- package/src/ui-engine/text-layout.ts +114 -0
- package/src/ui-engine/transpile-ui.ts +45 -0
- package/src/ui-engine/ua-stylesheet.ts +60 -0
- package/src/ui-engine/ui-file-splitter.ts +59 -0
- package/src/ui-engine/ui-lowering.ts +459 -0
- package/src/ui-engine/ui-registry.ts +530 -0
- package/src/ui-engine/yoga-layout.ts +309 -0
|
@@ -0,0 +1,155 @@
|
|
|
1
|
+
import type { Diagnostic } from "@typecad/cuttlefish/api/shared";
|
|
2
|
+
export type CSSSelectorKind = "element" | "id" | "class" | "attribute";
|
|
3
|
+
/** A single simple selector: tag name, #id, or .class. */
|
|
4
|
+
export interface SimpleSelector {
|
|
5
|
+
kind: CSSSelectorKind;
|
|
6
|
+
name: string;
|
|
7
|
+
value?: string;
|
|
8
|
+
}
|
|
9
|
+
/** A full CSS selector, supporting compound (`.foo.bar`, `tag.class`) and
|
|
10
|
+
* descendant (`parent child`) combinators.
|
|
11
|
+
* - `compounds[last]` is the target compound (the element the rule applies to).
|
|
12
|
+
* - Each compound is an array of simples that must ALL match (AND).
|
|
13
|
+
* - Preceding compounds are ancestor constraints (descendant combinator). */
|
|
14
|
+
export interface CSSSelector {
|
|
15
|
+
compounds: SimpleSelector[][];
|
|
16
|
+
combinators?: (">" | " " | "+" | "~")[];
|
|
17
|
+
pseudo?: "pressed" | "disabled" | "checked" | "focus";
|
|
18
|
+
/** :not(...) negation compounds. Each is a compound that must NOT match. */
|
|
19
|
+
not?: SimpleSelector[][];
|
|
20
|
+
}
|
|
21
|
+
export interface TransitionDecl {
|
|
22
|
+
property: "background" | "color";
|
|
23
|
+
durationMs: number;
|
|
24
|
+
}
|
|
25
|
+
export interface KeyframeStop {
|
|
26
|
+
percent: number;
|
|
27
|
+
background?: string;
|
|
28
|
+
color?: string;
|
|
29
|
+
opacity?: string;
|
|
30
|
+
transform?: string;
|
|
31
|
+
transformOrigin?: string;
|
|
32
|
+
left?: string;
|
|
33
|
+
top?: string;
|
|
34
|
+
width?: string;
|
|
35
|
+
height?: string;
|
|
36
|
+
}
|
|
37
|
+
export interface KeyframeSet {
|
|
38
|
+
name: string;
|
|
39
|
+
stops: KeyframeStop[];
|
|
40
|
+
}
|
|
41
|
+
export interface AnimationDecl {
|
|
42
|
+
name: string;
|
|
43
|
+
durationMs: number;
|
|
44
|
+
iterations: number;
|
|
45
|
+
delayMs: number;
|
|
46
|
+
timingFunction: string;
|
|
47
|
+
}
|
|
48
|
+
export interface CSSProperty {
|
|
49
|
+
padding?: string;
|
|
50
|
+
margin?: string;
|
|
51
|
+
/** Per-side margin overrides (win over the `margin` shorthand when set). */
|
|
52
|
+
marginTop?: string;
|
|
53
|
+
marginRight?: string;
|
|
54
|
+
marginBottom?: string;
|
|
55
|
+
marginLeft?: string;
|
|
56
|
+
width?: string;
|
|
57
|
+
height?: string;
|
|
58
|
+
minWidth?: string;
|
|
59
|
+
maxWidth?: string;
|
|
60
|
+
minHeight?: string;
|
|
61
|
+
maxHeight?: string;
|
|
62
|
+
aspectRatio?: string;
|
|
63
|
+
boxSizing?: string;
|
|
64
|
+
overflow?: string;
|
|
65
|
+
color?: string;
|
|
66
|
+
background?: string;
|
|
67
|
+
font?: string;
|
|
68
|
+
fontFamily?: string;
|
|
69
|
+
fontSize?: string;
|
|
70
|
+
textAlign?: string;
|
|
71
|
+
textDecoration?: string;
|
|
72
|
+
fontWeight?: string;
|
|
73
|
+
fontStyle?: string;
|
|
74
|
+
fontSmoothing?: string;
|
|
75
|
+
fontSubset?: string;
|
|
76
|
+
lineHeight?: string;
|
|
77
|
+
letterSpacing?: string;
|
|
78
|
+
whiteSpace?: string;
|
|
79
|
+
textTransform?: string;
|
|
80
|
+
textOverflow?: string;
|
|
81
|
+
transition?: TransitionDecl;
|
|
82
|
+
animation?: string;
|
|
83
|
+
animationName?: string;
|
|
84
|
+
animationDuration?: string;
|
|
85
|
+
animationIterationCount?: string;
|
|
86
|
+
animationDelay?: string;
|
|
87
|
+
animationTimingFunction?: string;
|
|
88
|
+
display?: string;
|
|
89
|
+
flexDirection?: string;
|
|
90
|
+
gap?: string;
|
|
91
|
+
rowGap?: string;
|
|
92
|
+
columnGap?: string;
|
|
93
|
+
flexGrow?: string;
|
|
94
|
+
flexShrink?: string;
|
|
95
|
+
flexBasis?: string;
|
|
96
|
+
alignSelf?: string;
|
|
97
|
+
alignItems?: string;
|
|
98
|
+
alignContent?: string;
|
|
99
|
+
justifyContent?: string;
|
|
100
|
+
flexWrap?: string;
|
|
101
|
+
order?: string;
|
|
102
|
+
position?: string;
|
|
103
|
+
zIndex?: string;
|
|
104
|
+
top?: string;
|
|
105
|
+
right?: string;
|
|
106
|
+
bottom?: string;
|
|
107
|
+
left?: string;
|
|
108
|
+
border?: string;
|
|
109
|
+
borderRadius?: string;
|
|
110
|
+
borderWidth?: string;
|
|
111
|
+
borderColor?: string;
|
|
112
|
+
borderStyle?: string;
|
|
113
|
+
/** Per-side border overrides (win over the shorthand when set). */
|
|
114
|
+
borderTopWidth?: string;
|
|
115
|
+
borderTopStyle?: string;
|
|
116
|
+
borderTopColor?: string;
|
|
117
|
+
borderRightWidth?: string;
|
|
118
|
+
borderRightStyle?: string;
|
|
119
|
+
borderRightColor?: string;
|
|
120
|
+
borderBottomWidth?: string;
|
|
121
|
+
borderBottomStyle?: string;
|
|
122
|
+
borderBottomColor?: string;
|
|
123
|
+
borderLeftWidth?: string;
|
|
124
|
+
borderLeftStyle?: string;
|
|
125
|
+
borderLeftColor?: string;
|
|
126
|
+
opacity?: string;
|
|
127
|
+
visibility?: string;
|
|
128
|
+
outline?: string;
|
|
129
|
+
boxShadow?: string;
|
|
130
|
+
textShadow?: string;
|
|
131
|
+
transform?: string;
|
|
132
|
+
transformOrigin?: string;
|
|
133
|
+
objectFit?: string;
|
|
134
|
+
}
|
|
135
|
+
export interface CSSRule {
|
|
136
|
+
selector: CSSSelector;
|
|
137
|
+
properties: CSSProperty;
|
|
138
|
+
}
|
|
139
|
+
export interface CSSFontFace {
|
|
140
|
+
fontFamily: string;
|
|
141
|
+
src: string;
|
|
142
|
+
fontWeight?: string;
|
|
143
|
+
fontStyle?: string;
|
|
144
|
+
}
|
|
145
|
+
export declare function parseCss(src: string, diagnostics?: Diagnostic[]): CSSRule[];
|
|
146
|
+
export declare function parseFontFaces(src: string): CSSFontFace[];
|
|
147
|
+
/** Parse an inline style string ("color: red; font-size: 16px") into CSSProperty.
|
|
148
|
+
* Uses the same assignProp pipeline as rule parsing. */
|
|
149
|
+
export declare function parseInlineStyle(src: string, diagnostics?: Diagnostic[]): CSSProperty;
|
|
150
|
+
/** Parse the animation shorthand: "pulse 2s infinite 500ms".
|
|
151
|
+
* Fields: name (identifier), duration (Nms/Ns), iterations (number|infinite), delay (Nms/Ns). */
|
|
152
|
+
export declare function parseAnimation(val: string): AnimationDecl | null;
|
|
153
|
+
/** Parse @keyframes blocks from CSS source.
|
|
154
|
+
* Returns KeyframeSet[] — one per @keyframes name. */
|
|
155
|
+
export declare function parseKeyframes(src: string): KeyframeSet[];
|