@praxisjs/jsx 0.3.10 → 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/CHANGELOG.md CHANGED
@@ -1,5 +1,31 @@
1
1
  # @praxisjs/jsx
2
2
 
3
+ ## 0.4.0
4
+
5
+ ### Minor Changes
6
+
7
+ - 994c581: Refactor `@praxisjs/jsx` HTML/SVG type definitions to a React-style layered architecture.
8
+
9
+ **Breaking change (type-only):** the `[key: string]: HTMLAttributes` catch-all index signature has been removed from `JSX.IntrinsicElements`. Typos like `<dvi>` are now compile-time errors instead of silently resolving to `HTMLAttributes`.
10
+
11
+ **What's new:**
12
+
13
+ - `LiteralUnion<T>` widening applied to all string-literal attribute unions (`ButtonType`, `HTMLInputTypeAttribute`, `FormMethod`, `LinkTarget`, `ReferrerPolicy`, etc.) — a `string`-typed variable is now assignable without a cast, while IDE autocomplete still surfaces the canonical values
14
+ - `CSSProperties` type for object-style `style` props with full camelCase CSS property autocomplete and CSS custom property (`--xxx`) support
15
+ - `AriaAttributes` — complete WAI-ARIA 1.2 attribute set
16
+ - `DOMAttributes<T extends EventTarget>` — all event handlers with `currentTarget` narrowed to the host element type
17
+ - `HTMLAttributes<T extends Element>` — generic base with element-specific `ref: (el: T) => void`
18
+ - 40+ per-element attribute interfaces (`ButtonHTMLAttributes`, `InputHTMLAttributes`, `AnchorHTMLAttributes`, `ImgHTMLAttributes`, `FormHTMLAttributes`, `SelectHTMLAttributes`, `TextareaHTMLAttributes`, `VideoHTMLAttributes`, `DialogHTMLAttributes`, …)
19
+ - `SVGAttributes<T>` covering all SVG elements the runtime routes through the SVG namespace
20
+ - Full HTML element coverage: ~120 intrinsic element entries across metadata, sectioning, grouping, text-level, embedded, form, interactive, tabular, and scripting categories
21
+ - All new attribute interfaces are re-exported from `@praxisjs/jsx` for use in application code
22
+
23
+ `InstancePropsOf` now automatically infers `@Prop()` and `@State()` fields from `StatefulComponent` subclasses as JSX props. A `FrameworkKeys` template-literal pattern (`_${string}` plus lifecycle method names) strips all framework internals, so no explicit prop declaration is needed.
24
+
25
+ ### Patch Changes
26
+
27
+ - @praxisjs/runtime@0.2.12
28
+
3
29
  ## 0.3.10
4
30
 
5
31
  ### Patch Changes
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=jsx-runtime.types.test.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"jsx-runtime.types.test.d.ts","sourceRoot":"","sources":["../../src/__tests__/jsx-runtime.types.test.ts"],"names":[],"mappings":""}
@@ -0,0 +1,110 @@
1
+ import { describe, it, expectTypeOf } from "vitest";
2
+ describe("Reactive<T>", () => {
3
+ it("accepts a plain value", () => {
4
+ expectTypeOf().toMatchTypeOf();
5
+ });
6
+ it("accepts a zero-arg function", () => {
7
+ expectTypeOf().toMatchTypeOf();
8
+ });
9
+ it("rejects a plain number for Reactive<string>", () => {
10
+ expectTypeOf().not.toMatchTypeOf();
11
+ });
12
+ });
13
+ describe("LiteralUnion-based string attributes", () => {
14
+ it("ButtonType: literal values are assignable", () => {
15
+ expectTypeOf().toMatchTypeOf();
16
+ expectTypeOf().toMatchTypeOf();
17
+ expectTypeOf().toMatchTypeOf();
18
+ });
19
+ it("ButtonType: arbitrary string is assignable", () => {
20
+ expectTypeOf().toMatchTypeOf();
21
+ });
22
+ it("HTMLInputTypeAttribute: known literals are assignable", () => {
23
+ expectTypeOf().toMatchTypeOf();
24
+ expectTypeOf().toMatchTypeOf();
25
+ expectTypeOf().toMatchTypeOf();
26
+ expectTypeOf().toMatchTypeOf();
27
+ expectTypeOf().toMatchTypeOf();
28
+ });
29
+ it("HTMLInputTypeAttribute: arbitrary string is assignable", () => {
30
+ expectTypeOf().toMatchTypeOf();
31
+ });
32
+ it("LinkTarget: known literals are assignable", () => {
33
+ expectTypeOf().toMatchTypeOf();
34
+ expectTypeOf().toMatchTypeOf();
35
+ expectTypeOf().toMatchTypeOf();
36
+ expectTypeOf().toMatchTypeOf();
37
+ });
38
+ it("LinkTarget: arbitrary string (e.g. frame name) is assignable", () => {
39
+ expectTypeOf().toMatchTypeOf();
40
+ });
41
+ });
42
+ describe("ButtonHTMLAttributes", () => {
43
+ it("type prop accepts ButtonType", () => {
44
+ expectTypeOf().toMatchTypeOf();
45
+ expectTypeOf().toMatchTypeOf();
46
+ expectTypeOf().toMatchTypeOf();
47
+ expectTypeOf().toMatchTypeOf();
48
+ });
49
+ it("type prop is reactive", () => {
50
+ expectTypeOf().toMatchTypeOf();
51
+ });
52
+ it("disabled prop is reactive boolean", () => {
53
+ expectTypeOf().toMatchTypeOf();
54
+ expectTypeOf().toMatchTypeOf();
55
+ });
56
+ it("class prop accepts reactive string", () => {
57
+ expectTypeOf().toMatchTypeOf();
58
+ expectTypeOf().toMatchTypeOf();
59
+ });
60
+ it("onClick receives MouseEvent with currentTarget HTMLButtonElement", () => {
61
+ expectTypeOf().toMatchTypeOf();
62
+ });
63
+ });
64
+ describe("InputHTMLAttributes", () => {
65
+ it("type prop accepts HTMLInputTypeAttribute", () => {
66
+ expectTypeOf().toMatchTypeOf();
67
+ expectTypeOf().toMatchTypeOf();
68
+ });
69
+ it("ref prop receives HTMLInputElement", () => {
70
+ expectTypeOf().toMatchTypeOf();
71
+ });
72
+ });
73
+ describe("AnchorHTMLAttributes", () => {
74
+ it("target accepts LinkTarget (literals and arbitrary strings)", () => {
75
+ expectTypeOf().toMatchTypeOf();
76
+ expectTypeOf().toMatchTypeOf();
77
+ });
78
+ });
79
+ describe("ImgHTMLAttributes", () => {
80
+ it("ref prop receives HTMLImageElement", () => {
81
+ expectTypeOf().toMatchTypeOf();
82
+ });
83
+ });
84
+ describe("HTMLAttributes", () => {
85
+ it("style accepts a plain string", () => {
86
+ expectTypeOf().toMatchTypeOf();
87
+ });
88
+ it("style accepts a CSSProperties object", () => {
89
+ expectTypeOf().toMatchTypeOf();
90
+ });
91
+ it("style accepts a reactive CSSProperties function", () => {
92
+ expectTypeOf().toMatchTypeOf();
93
+ });
94
+ });
95
+ describe("CSSProperties", () => {
96
+ it("accepts CSS custom properties", () => {
97
+ const props = { "--brand-color": "#f00" };
98
+ expectTypeOf(props).toMatchTypeOf();
99
+ });
100
+ });
101
+ describe("SVGAttributes", () => {
102
+ it("fill prop is reactive string", () => {
103
+ expectTypeOf().toMatchTypeOf();
104
+ expectTypeOf().toMatchTypeOf();
105
+ });
106
+ it("onClick receives MouseEvent with SVGElement currentTarget", () => {
107
+ expectTypeOf().toMatchTypeOf();
108
+ });
109
+ });
110
+ //# sourceMappingURL=jsx-runtime.types.test.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"jsx-runtime.types.test.js","sourceRoot":"","sources":["../../src/__tests__/jsx-runtime.types.test.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,EAAE,EAAE,YAAY,EAAE,MAAM,QAAQ,CAAC;AAgBpD,QAAQ,CAAC,aAAa,EAAE,GAAG,EAAE;IAC3B,EAAE,CAAC,uBAAuB,EAAE,GAAG,EAAE;QAC/B,YAAY,EAAU,CAAC,aAAa,EAAoB,CAAC;IAC3D,CAAC,CAAC,CAAC;IAEH,EAAE,CAAC,6BAA6B,EAAE,GAAG,EAAE;QACrC,YAAY,EAAgB,CAAC,aAAa,EAAoB,CAAC;IACjE,CAAC,CAAC,CAAC;IAEH,EAAE,CAAC,6CAA6C,EAAE,GAAG,EAAE;QACrD,YAAY,EAAU,CAAC,GAAG,CAAC,aAAa,EAAoB,CAAC;IAC/D,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC;AAEH,QAAQ,CAAC,sCAAsC,EAAE,GAAG,EAAE;IACpD,EAAE,CAAC,2CAA2C,EAAE,GAAG,EAAE;QACnD,YAAY,EAAY,CAAC,aAAa,EAAc,CAAC;QACrD,YAAY,EAAY,CAAC,aAAa,EAAc,CAAC;QACrD,YAAY,EAAW,CAAC,aAAa,EAAc,CAAC;IACtD,CAAC,CAAC,CAAC;IAEH,EAAE,CAAC,4CAA4C,EA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