@praxisjs/jsx 0.7.7 → 0.8.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/CHANGELOG.md CHANGED
@@ -1,5 +1,39 @@
1
1
  # @praxisjs/jsx
2
2
 
3
+ ## 0.8.1
4
+
5
+ ### Patch Changes
6
+
7
+ - Updated dependencies [d634a29]
8
+ - @praxisjs/runtime@0.8.1
9
+
10
+ ## 0.8.0
11
+
12
+ ### Minor Changes
13
+
14
+ - 75115a9: Add keyed list reconciliation. `For` (keyed by `by`, or by item identity) and `Index` (by position) in `@praxisjs/runtime` render each key once, keep its row while the key stays, and create, move or remove only the rows that changed, with the minimum number of moves (LIS) and `moveBefore()` where available. They support fallbacks, Promise-based enter/leave transitions, hydration of prerendered rows, and isolate row render errors. `@praxisjs/jsx` types components that set `static __jsxRawProps = true` by their exact constructor props, so `For` infers its item type. `@praxisjs/vite-plugin` rewrites keyed `{() => list.map((item) => <Row key={…} />)}` children into `For` and warns about keyed `.map()` calls it cannot rewrite (`keyedLists` option).
15
+
16
+ ### Patch Changes
17
+
18
+ - 75115a9: Fix fragments dropping function children: `<>{() => x}</>` now mounts a reactive region, like element children. `@praxisjs/runtime` exports `mountChildren`, which `@praxisjs/jsx` uses to mount fragment children.
19
+ - 75115a9: Published packages no longer contain their tests: package builds compile `src` without `src/**/__tests__` (through a `tsconfig.build.json`), and each package's `files` leaves test sources and stale compiled tests out of the tarball. `pnpm typecheck` still type-checks the tests.
20
+ - 75115a9: Smaller production bundles. The framework and feature packages are marked `"sideEffects": false`, so bundlers leave out the modules an app does not use (`For`/`Index` and `selector()` were kept in every bundle by their shape keepers). `@praxisjs/core`'s graph gates its observer instrumentation on a boolean that minifiers fold away when no observer is ever installed. `@praxisjs/runtime` passes `Index`'s positional update to the list view, so `For`-only apps leave it out, and builds its event prop table from camel-case names. `@praxisjs/devtools` is built one file per module and its decorators check `process.env.NODE_ENV` inline, so `@Trace`/`@Debug` in production code no longer bundle the registry and the panel. `@praxisjs/vite-plugin` serves TypeScript's decorator helpers and the claimed fields' helper from one virtual module (`virtual:praxisjs/decorators`) instead of writing them into every decorated file, and replaces the identical copies `tsc` wrote into ES module libraries.
21
+ - Updated dependencies [75115a9]
22
+ - Updated dependencies [75115a9]
23
+ - Updated dependencies [75115a9]
24
+ - Updated dependencies [75115a9]
25
+ - Updated dependencies [75115a9]
26
+ - Updated dependencies [75115a9]
27
+ - Updated dependencies [75115a9]
28
+ - Updated dependencies [75115a9]
29
+ - Updated dependencies [75115a9]
30
+ - Updated dependencies [75115a9]
31
+ - Updated dependencies [75115a9]
32
+ - Updated dependencies [75115a9]
33
+ - @praxisjs/runtime@0.8.0
34
+ - @praxisjs/core@2.3.0
35
+ - @praxisjs/shared@0.3.2
36
+
3
37
  ## 0.7.7
4
38
 
5
39
  ### Patch Changes
@@ -31,6 +31,10 @@ export declare namespace JSX {
31
31
  type ComponentRef<C> = C extends abstract new (...args: any[]) => infer I ? (instance: I | null) => void : (instance: object | null) => void;
32
32
  export type LibraryManagedAttributes<C, P> = C extends string ? P & {
33
33
  key?: string | number | symbol;
34
+ } : C extends {
35
+ readonly __jsxRawProps: true;
36
+ } ? P & {
37
+ key?: string | number | symbol;
34
38
  } : [InstancePropsOf<C>] extends [never] ? C extends new (props: infer CtorProps) => unknown ? {
35
39
  [K in keyof CtorProps]?: Reactive<CtorProps[K]>;
36
40
  } & ComponentExtras & {
@@ -1 +1 @@
1
- {"version":3,"file":"jsx-runtime.d.ts","sourceRoot":"","sources":["../src/jsx-runtime.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,yBAAyB,CAAC;AAMlE,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AACjD,OAAO,EAEL,KAAK,oBAAoB,EAC1B,MAAM,2BAA2B,CAAC;AAEnC,OAAO,KAAK,EACV,QAAQ,EACR,cAAc,EACd,oBAAoB,EACpB,kBAAkB,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,EAAE,aAAa,CAAC,kBAAkB,CAAC,CAAC;QAC5C,aAAa,EAAE,aAAa,CAAC,uBAAuB,CAAC,CAAC;KACvD;;CACF;AAGD,YAAY,EACV,QAAQ,EACR,UAAU,EACV,aAAa,EACb,sBAAsB,EACtB,UAAU,EACV,UAAU,EACV,WAAW,EACX,UAAU,EACV,cAAc,EACd,WAAW,EACX,QAAQ,EACR,OAAO,EACP,GAAG,EACH,cAAc,EACd,SAAS,EACT,YAAY,EACZ,cAAc,EACd,aAAa,EACb,cAAc,EACd,oBAAoB,EACpB,kBAAkB,EAClB,mBAAmB,EACnB,kBAAkB,EAClB,wBAAwB,EACxB,oBAAoB,EACpB,oBAAoB,EACpB,iBAAiB,EACjB,sBAAsB,EACtB,kBAAkB,EAClB,sBAAsB,EACtB,iBAAiB,EACjB,qBAAqB,EACrB,oBAAoB,EACpB,mBAAmB,EACnB,sBAAsB,EACtB,kBAAkB,EAClB,oBAAoB,EACpB,iBAAiB,EACjB,mBAAmB,EACnB,iBAAiB,EACjB,mBAAmB,EACnB,gBAAgB,EAChB,kBAAkB,EAClB,iBAAiB,EACjB,mBAAmB,EACnB,kBAAkB,EAClB,kBAAkB,EAClB,mBAAmB,EACnB,oBAAoB,EACpB,gBAAgB,EAChB,sBAAsB,EACtB,oBAAoB,EACpB,oBAAoB,EACpB,sBAAsB,EACtB,oBAAoB,EACpB,oBAAoB,EACpB,kBAAkB,EAClB,oBAAoB,EACpB,mBAAmB,EACnB,mBAAmB,EACnB,gBAAgB,EAChB,sBAAsB,EACtB,gBAAgB,EAChB,kBAAkB,EAClB,mBAAmB,EACnB,mBAAmB,EACnB,aAAa,GACd,MAAM,aAAa,CAAC"}
1
+ {"version":3,"file":"jsx-runtime.d.ts","sourceRoot":"","sources":["../src/jsx-runtime.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,yBAAyB,CAAC;AAOlE,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,kBAAk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AsB,EACtB,gBAAgB,EAChB,kBAAkB,EAClB,mBAAmB,EACnB,mBAAmB,EACnB,aAAa,GACd,MAAM,aAAa,CAAC"}
@@ -1,29 +1,14 @@
1
- import { mountElement, mountComponent, getCurrentScope, } from "@praxisjs/runtime";
1
+ import { mountChildren, mountElement, mountComponent, getCurrentScope, } from "@praxisjs/runtime";
2
2
  import { isComponent, } from "@praxisjs/shared/internal";
3
3
  export const Fragment = Symbol("Fragment");
4
- function collectFragmentChildren(children, out) {
5
- if (children === null || children === undefined || children === false)
6
- return;
7
- if (Array.isArray(children)) {
8
- for (const child of children)
9
- collectFragmentChildren(child, out);
10
- return;
11
- }
12
- if (children instanceof Node) {
13
- out.push(children);
14
- return;
15
- }
16
- if (typeof children === "string" || typeof children === "number") {
17
- out.push(document.createTextNode(String(children)));
18
- }
19
- }
20
4
  export function jsx(type, props) {
21
5
  const scope = getCurrentScope();
22
6
  if (type === Fragment) {
23
- const { children } = props;
24
- const nodes = [];
25
- collectFragmentChildren(children, nodes);
26
- return nodes;
7
+ // Mounted like an element's children so function children become reactive regions. Their
8
+ // end anchors travel with the returned nodes, so updates follow them into the real parent.
9
+ const fragment = document.createDocumentFragment();
10
+ mountChildren(fragment, props.children, scope);
11
+ return Array.from(fragment.childNodes);
27
12
  }
28
13
  if (typeof type === "string") {
29
14
  return mountElement(type, props, scope);
@@ -1 +1 @@
1
- {"version":3,"file":"jsx-runtime.js","sourceRoot":"","sources":["../src/jsx-runtime.ts"],"names":[],"mappings":"AACA,OAAO,EACL,YAAY,EACZ,cAAc,EACd,eAAe,GAChB,MAAM,mBAAmB,CAAC;AAE3B,OAAO,EACL,WAAW,GAEZ,MAAM,2BAA2B,CAAC;AAsDnC,MAAM,CAAC,MAAM,QAAQ,GAAG,MAAM,CAAC,UAAU,CAAC,CAAC;AAE3C,SAAS,uBAAuB,CAAC,QAAiB,EAAE,GAAW;IAC7D,IAAI,QAAQ,KAAK,IAAI,IAAI,QAAQ,KAAK,SAAS,IAAI,Q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AAG,GAAG,CAAC"}
1
+ {"version":3,"file":"jsx-runtime.js","sourceRoot":"","sources":["../src/jsx-runtime.ts"],"names":[],"mappings":"AACA,OAAO,EACL,aAAa,EACb,YAAY,EACZ,cAAc,EACd,eAAe,GAChB,MAAM,mBAAmB,CAAC;AAE3B,OAAO,EACL,WAAW,GAEZ,MAAM,2BAA2B,CAAC;AAsDnC,MAAM,CAAC,MAAM,QAAQ,GAAG,MAAM,CAAC,UAAU,CAAC,CAAC;AAU3C,MAAM,UAAU,GAAG,CACjB,IAAO,EACP,KAA0C;IAE1C,MAAM,KAAK,GAAG,eAAe,EAAE,CAAC;IAEhC,IAAI,IAAI,KAAK,QAAQ,EAAE,CAAC;QACtB,yFAAyF;QACzF,2FAA2F;QAC3F,MAAM,QAAQ,GAAG,QAAQ,CAAC,sBAAsB,EAAE,CAAC;QACnD,aAAa,CAAC,QAAQ,EAAE,KAAK,CAAC,QAAQ,EAAE,KAAK,CAAC,CAAC;QAC/C,OAAO,KAAK,CAAC,IAAI,CAAC,QAAQ,CAAC,UAAU,CAAC,CAAC;IACzC,CAAC;IAED,IAAI,OAAO,IAAI,KAAK,QAAQ,EAAE,CAAC;QAC7B,OAAO,YAAY,CAAC,IAAI,EAAE,KAAgC,EAAE,KAAK,CAAC,CAAC;IACrE,CAAC;IAED,IAAI,WAAW,CAAC,IAAI,CAAC,EAAE,CAAC;QACtB,OAAO,cAAc,CAAC,IAAI,EAAE,KAAgC,EAAE,KAAK,CAAC,CAAC;IACvE,CAAC;IAED,OAAO,QAAQ,CAAC,aAAa,CAAC,GAAG,CAAC,CAAC;AACrC,CAAC;AAED,MAAM,CAAC,MAAM,IAAI,GAAG,GAAG,CAAC;AACxB,MAAM,CAAC,MAAM,MAAM,GAAG,GAAG,CAAC"}
package/package.json CHANGED
@@ -1,7 +1,8 @@
1
1
  {
2
2
  "name": "@praxisjs/jsx",
3
- "version": "0.7.7",
3
+ "version": "0.8.1",
4
4
  "type": "module",
5
+ "sideEffects": false,
5
6
  "main": "./dist/index.js",
6
7
  "types": "./dist/index.d.ts",
7
8
  "exports": {
@@ -18,16 +19,24 @@
18
19
  "types": "./dist/jsx-runtime.d.ts"
19
20
  }
20
21
  },
22
+ "files": [
23
+ "dist",
24
+ "src",
25
+ "!dist/**/__tests__",
26
+ "!src/**/__tests__",
27
+ "CHANGELOG.md"
28
+ ],
21
29
  "devDependencies": {
22
30
  "typescript": "^6.0.3"
23
31
  },
24
32
  "dependencies": {
25
- "@praxisjs/core": "2.2.0",
26
- "@praxisjs/runtime": "0.7.1",
27
- "@praxisjs/shared": "0.3.1"
33
+ "@praxisjs/core": "2.3.0",
34
+ "@praxisjs/runtime": "0.8.1",
35
+ "@praxisjs/shared": "0.3.2"
28
36
  },
29
37
  "scripts": {
30
- "build": "tsc",
31
- "dev": "tsc --watch"
38
+ "build": "tsc -p tsconfig.build.json",
39
+ "dev": "tsc -p tsconfig.build.json --watch",
40
+ "typecheck": "tsc --noEmit"
32
41
  }
33
42
  }
@@ -1,5 +1,6 @@
1
1
  import type { componentPropsType } from "@praxisjs/core/internal";
2
2
  import {
3
+ mountChildren,
3
4
  mountElement,
4
5
  mountComponent,
5
6
  getCurrentScope,
@@ -64,21 +65,6 @@ import type {
64
65
 
65
66
  export const Fragment = Symbol("Fragment");
66
67
 
67
- function collectFragmentChildren(children: unknown, out: Node[]): void {
68
- if (children === null || children === undefined || children === false) return;
69
- if (Array.isArray(children)) {
70
- for (const child of children) collectFragmentChildren(child, out);
71
- return;
72
- }
73
- if (children instanceof Node) {
74
- out.push(children);
75
- return;
76
- }
77
- if (typeof children === "string" || typeof children === "number") {
78
- out.push(document.createTextNode(String(children)));
79
- }
80
- }
81
-
82
68
  type PropsOf<T> = T extends string
83
69
  ? T extends keyof JSX.IntrinsicElements
84
70
  ? JSX.IntrinsicElements[T]
@@ -94,10 +80,11 @@ export function jsx<T extends string | ComponentConstructor | symbol>(
94
80
  const scope = getCurrentScope();
95
81
 
96
82
  if (type === Fragment) {
97
- const { children } = props;
98
- const nodes: Node[] = [];
99
- collectFragmentChildren(children, nodes);
100
- return nodes;
83
+ // Mounted like an element's children so function children become reactive regions. Their
84
+ // end anchors travel with the returned nodes, so updates follow them into the real parent.
85
+ const fragment = document.createDocumentFragment();
86
+ mountChildren(fragment, props.children, scope);
87
+ return Array.from(fragment.childNodes);
101
88
  }
102
89
 
103
90
  if (typeof type === "string") {
@@ -160,13 +147,19 @@ export namespace JSX {
160
147
  ? (instance: I | null) => void
161
148
  : (instance: object | null) => void;
162
149
 
150
+ // Components that set `static __jsxRawProps = true` (generic runtime primitives such as For) are
151
+ // typed by their constructor's props as written: TypeScript infers their type arguments from the
152
+ // attributes, which reading props off the prototype would erase to `any`, and callback props stay
153
+ // callbacks instead of being widened to Reactive<…>.
163
154
  export type LibraryManagedAttributes<C, P> = C extends string
164
155
  ? P & { key?: string | number | symbol }
165
- : [InstancePropsOf<C>] extends [never]
166
- ? C extends new (props: infer CtorProps) => unknown
167
- ? { [K in keyof CtorProps]?: Reactive<CtorProps[K]> } & ComponentExtras & { ref?: ComponentRef<C> }
168
- : Record<string, unknown> & ComponentExtras & { ref?: ComponentRef<C> }
169
- : InstancePropsOf<C> & ComponentExtras & { ref?: ComponentRef<C> };
156
+ : C extends { readonly __jsxRawProps: true }
157
+ ? P & { key?: string | number | symbol }
158
+ : [InstancePropsOf<C>] extends [never]
159
+ ? C extends new (props: infer CtorProps) => unknown
160
+ ? { [K in keyof CtorProps]?: Reactive<CtorProps[K]> } & ComponentExtras & { ref?: ComponentRef<C> }
161
+ : Record<string, unknown> & ComponentExtras & { ref?: ComponentRef<C> }
162
+ : InstancePropsOf<C> & ComponentExtras & { ref?: ComponentRef<C> };
170
163
 
171
164
  export interface IntrinsicElements {
172
165
  // --- Metadata ---
@@ -1,2 +0,0 @@
1
- export {};
2
- //# sourceMappingURL=jsx-runtime.test.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"jsx-runtime.test.d.ts","sourceRoot":"","sources":["../../src/__tests__/jsx-runtime.test.ts"],"names":[],"mappings":""}
@@ -1,97 +0,0 @@
1
- // @vitest-environment jsdom
2
- import { describe, it, expect } from "vitest";
3
- import { StatefulComponent } from "@praxisjs/core";
4
- import { Scope, runInScope } from "@praxisjs/runtime";
5
- import { jsx, jsxs, jsxDEV, Fragment } from "../jsx-runtime";
6
- function withScope(fn) {
7
- const scope = new Scope();
8
- return runInScope(scope, fn);
9
- }
10
- describe("Fragment", () => {
11
- it("is a unique Symbol", () => {
12
- expect(typeof Fragment).toBe("symbol");
13
- });
14
- it("returns [] when no children are provided", () => {
15
- const result = withScope(() => jsx(Fragment, {}));
16
- expect(result).toEqual([]);
17
- });
18
- it("returns [] when children is empty array", () => {
19
- const result = withScope(() => jsx(Fragment, { children: [] }));
20
- expect(Array.isArray(result)).toBe(true);
21
- });
22
- it("wraps a single Node in an array", () => {
23
- const node = document.createElement("span");
24
- const result = withScope(() => jsx(Fragment, { children: node }));
25
- expect(result).toHaveLength(1);
26
- expect(result[0]).toBe(node);
27
- });
28
- it("flattens an array of Nodes", () => {
29
- const a = document.createElement("div");
30
- const b = document.createElement("span");
31
- const result = withScope(() => jsx(Fragment, { children: [a, b] }));
32
- expect(result).toHaveLength(2);
33
- expect(result[0]).toBe(a);
34
- expect(result[1]).toBe(b);
35
- });
36
- it("preserves primitive children, including 0, for runtime mounting", () => {
37
- const node = document.createElement("strong");
38
- const result = withScope(() => jsx(Fragment, { children: ["count: ", 0, false, null, [node]] }));
39
- const container = document.createElement("div");
40
- for (const child of result)
41
- container.appendChild(child);
42
- expect(container.textContent).toBe("count: 0");
43
- expect(container.querySelector("strong")).toBe(node);
44
- });
45
- it("returns [] when children is a non-Node non-Array value (e.g. plain object)", () => {
46
- const result = withScope(() => jsx(Fragment, { children: { foo: "bar" } }));
47
- expect(result).toEqual([]);
48
- });
49
- });
50
- describe("jsx — string tag", () => {
51
- it("creates a DOM element for a string tag", () => {
52
- const el = withScope(() => jsx("div", {}));
53
- expect(el).toBeInstanceOf(HTMLDivElement);
54
- });
55
- it("applies class prop", () => {
56
- const el = withScope(() => jsx("p", { class: "text-lg" }));
57
- expect(el.getAttribute("class")).toBe("text-lg");
58
- });
59
- it("renders string children", () => {
60
- const el = withScope(() => jsx("span", { children: "hello" }));
61
- expect(el.textContent).toBe("hello");
62
- });
63
- it("creates an SVG element for svg tags", () => {
64
- const el = withScope(() => jsx("svg", {}));
65
- expect(el).toBeInstanceOf(SVGElement);
66
- });
67
- });
68
- describe("jsx — component", () => {
69
- it("mounts a component via isComponent check and returns its nodes", () => {
70
- // A minimal class that satisfies isComponent (has __isComponent) and mountComponent
71
- class MyComp extends StatefulComponent {
72
- static __isComponent = true;
73
- static __isStateless = false;
74
- static __name = "MyComp";
75
- render() { return document.createTextNode("hi"); }
76
- }
77
- const result = withScope(() => jsx(MyComp, {}));
78
- expect(Array.isArray(result)).toBe(true);
79
- expect(result.length).toBeGreaterThan(0);
80
- });
81
- });
82
- describe("jsx — unknown type", () => {
83
- it("returns a comment node for an unknown symbol type", () => {
84
- const unknownType = Symbol("unknown");
85
- const result = withScope(() => jsx(unknownType, {}));
86
- expect(result.nodeType).toBe(Node.COMMENT_NODE);
87
- });
88
- });
89
- describe("jsxs and jsxDEV", () => {
90
- it("jsxs is the same function as jsx", () => {
91
- expect(jsxs).toBe(jsx);
92
- });
93
- it("jsxDEV is the same function as jsx", () => {
94
- expect(jsxDEV).toBe(jsx);
95
- });
96
- });
97
- //# sourceMappingURL=jsx-runtime.test.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"jsx-runtime.test.js","sourceRoot":"","sources":["../../src/__tests__/jsx-runtime.test.ts"],"names":[],"mappings":"AAAA,4BAA4B;AAC5B,OAAO,EAAE,QAAQ,EAAE,EAAE,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAE9C,OAAO,EAAE,iBAAiB,EAAE,MAAM,gBAAgB,CAAC;AACnD,OAAO,EAAE,KAAK,EAAE,UAAU,EAAG,MAAM,mBAAmB,CAAC;A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GAAG,EAAE,CAC5B,GAAG,CAAC,WAAgC,EAAE,EAAE,CAAC,CAC/B,CAAC;QACb,MAAM,CAAC,MAAM,CAAC,QAAQ,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,YAAY,CAAC,CAAC;IAClD,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC;AAEH,QAAQ,CAAC,iBAAiB,EAAE,GAAG,EAAE;IAC/B,EAAE,CAAC,kCAAkC,EAAE,GAAG,EAAE;QAC1C,MAAM,CAAC,IAAI,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;IACzB,CAAC,CAAC,CAAC;IAEH,EAAE,CAAC,oCAAoC,EAAE,GAAG,EAAE;QAC5C,MAAM,CAAC,MAAM,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;IAC3B,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC"}
@@ -1,2 +0,0 @@
1
- export {};
2
- //# sourceMappingURL=jsx-runtime.types.test.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"jsx-runtime.types.test.d.ts","sourceRoot":"","sources":["../../src/__tests__/jsx-runtime.types.test.ts"],"names":[],"mappings":""}
@@ -1,208 +0,0 @@
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
- it("accepts null", () => {
13
- expectTypeOf().toMatchTypeOf();
14
- });
15
- it("accepts undefined", () => {
16
- expectTypeOf().toMatchTypeOf();
17
- });
18
- it("accepts a zero-arg function that can return null or undefined", () => {
19
- expectTypeOf().toMatchTypeOf();
20
- });
21
- });
22
- describe("AriaAttributes", () => {
23
- it("aria-valuenow accepts a reactive number (range widgets)", () => {
24
- expectTypeOf().toMatchTypeOf();
25
- expectTypeOf().toMatchTypeOf();
26
- });
27
- it("aria-valuetext accepts a reactive string (range widgets)", () => {
28
- expectTypeOf().toMatchTypeOf();
29
- expectTypeOf().toMatchTypeOf();
30
- });
31
- it("aria-valuemin / aria-valuemax accept a reactive number", () => {
32
- expectTypeOf().toMatchTypeOf();
33
- expectTypeOf().toMatchTypeOf();
34
- });
35
- it("aria-selected accepts a reactive boolean (baseline for comparison)", () => {
36
- expectTypeOf().toMatchTypeOf();
37
- });
38
- it("aria-activedescendant accepts a reactive string", () => {
39
- expectTypeOf().toMatchTypeOf();
40
- });
41
- it("aria-level / aria-posinset / aria-setsize accept a reactive number", () => {
42
- expectTypeOf().toMatchTypeOf();
43
- expectTypeOf().toMatchTypeOf();
44
- expectTypeOf().toMatchTypeOf();
45
- });
46
- it("aria-rowindex / aria-colindex / aria-rowcount / aria-colcount accept a reactive number", () => {
47
- expectTypeOf().toMatchTypeOf();
48
- expectTypeOf().toMatchTypeOf();
49
- expectTypeOf().toMatchTypeOf();
50
- expectTypeOf().toMatchTypeOf();
51
- });
52
- it("aria-sort / aria-orientation / aria-autocomplete accept a reactive literal union", () => {
53
- expectTypeOf().toMatchTypeOf();
54
- expectTypeOf().toMatchTypeOf();
55
- expectTypeOf().toMatchTypeOf();
56
- });
57
- it("aria-controls / aria-describedby / aria-labelledby / aria-owns accept a reactive string", () => {
58
- expectTypeOf().toMatchTypeOf();
59
- expectTypeOf().toMatchTypeOf();
60
- expectTypeOf().toMatchTypeOf();
61
- expectTypeOf().toMatchTypeOf();
62
- });
63
- });
64
- describe("HTMLAttributes — global attribute reactivity", () => {
65
- it("role accepts a reactive literal union", () => {
66
- expectTypeOf().toMatchTypeOf();
67
- });
68
- it("slot / accessKey / part accept a reactive string", () => {
69
- expectTypeOf().toMatchTypeOf();
70
- expectTypeOf().toMatchTypeOf();
71
- expectTypeOf().toMatchTypeOf();
72
- });
73
- it("popover accepts a reactive boolean or literal union", () => {
74
- expectTypeOf().toMatchTypeOf();
75
- });
76
- it("autoFocus stays a plain boolean — one-shot mount semantics, not reactive", () => {
77
- expectTypeOf().not.toMatchTypeOf();
78
- });
79
- });
80
- describe("Cross-interface Reactive<T> consistency", () => {
81
- it("href is reactive on <base> and <link>, matching <a>/<area>/SVG", () => {
82
- expectTypeOf().toMatchTypeOf();
83
- expectTypeOf().toMatchTypeOf();
84
- });
85
- it("target is reactive on <base> and <form>, matching <a>/<area>", () => {
86
- expectTypeOf().toMatchTypeOf();
87
- expectTypeOf().toMatchTypeOf();
88
- });
89
- it("value is reactive on <li>, matching every other value-bearing element", () => {
90
- expectTypeOf().toMatchTypeOf();
91
- });
92
- it("max is reactive on <progress>, matching <input>/<meter>", () => {
93
- expectTypeOf().toMatchTypeOf();
94
- });
95
- it("src is reactive on <script> and <track>, matching <img>/<iframe>/media", () => {
96
- expectTypeOf().toMatchTypeOf();
97
- expectTypeOf().toMatchTypeOf();
98
- });
99
- it("width is reactive on <table>, matching <img>/<iframe>/<video>/etc.", () => {
100
- expectTypeOf().toMatchTypeOf();
101
- });
102
- it("height/width are reactive on <td>, matching every other sized element", () => {
103
- expectTypeOf().toMatchTypeOf();
104
- expectTypeOf().toMatchTypeOf();
105
- });
106
- it("dateTime is reactive on <del>, matching <time>", () => {
107
- expectTypeOf().toMatchTypeOf();
108
- expectTypeOf().toMatchTypeOf();
109
- });
110
- });
111
- describe("LiteralUnion-based string attributes", () => {
112
- it("ButtonType: literal values are assignable", () => {
113
- expectTypeOf().toMatchTypeOf();
114
- expectTypeOf().toMatchTypeOf();
115
- expectTypeOf().toMatchTypeOf();
116
- });
117
- it("ButtonType: arbitrary string is assignable", () => {
118
- expectTypeOf().toMatchTypeOf();
119
- });
120
- it("HTMLInputTypeAttribute: known literals are assignable", () => {
121
- expectTypeOf().toMatchTypeOf();
122
- expectTypeOf().toMatchTypeOf();
123
- expectTypeOf().toMatchTypeOf();
124
- expectTypeOf().toMatchTypeOf();
125
- expectTypeOf().toMatchTypeOf();
126
- });
127
- it("HTMLInputTypeAttribute: arbitrary string is assignable", () => {
128
- expectTypeOf().toMatchTypeOf();
129
- });
130
- it("LinkTarget: known literals are assignable", () => {
131
- expectTypeOf().toMatchTypeOf();
132
- expectTypeOf().toMatchTypeOf();
133
- expectTypeOf().toMatchTypeOf();
134
- expectTypeOf().toMatchTypeOf();
135
- });
136
- it("LinkTarget: arbitrary string (e.g. frame name) is assignable", () => {
137
- expectTypeOf().toMatchTypeOf();
138
- });
139
- });
140
- describe("ButtonHTMLAttributes", () => {
141
- it("type prop accepts ButtonType", () => {
142
- expectTypeOf().toMatchTypeOf();
143
- expectTypeOf().toMatchTypeOf();
144
- expectTypeOf().toMatchTypeOf();
145
- expectTypeOf().toMatchTypeOf();
146
- });
147
- it("type prop is reactive", () => {
148
- expectTypeOf().toMatchTypeOf();
149
- });
150
- it("disabled prop is reactive boolean", () => {
151
- expectTypeOf().toMatchTypeOf();
152
- expectTypeOf().toMatchTypeOf();
153
- });
154
- it("class prop accepts reactive string", () => {
155
- expectTypeOf().toMatchTypeOf();
156
- expectTypeOf().toMatchTypeOf();
157
- });
158
- it("onClick receives MouseEvent with currentTarget HTMLButtonElement", () => {
159
- expectTypeOf().toMatchTypeOf();
160
- });
161
- });
162
- describe("InputHTMLAttributes", () => {
163
- it("type prop accepts HTMLInputTypeAttribute", () => {
164
- expectTypeOf().toMatchTypeOf();
165
- expectTypeOf().toMatchTypeOf();
166
- });
167
- it("ref prop receives HTMLInputElement", () => {
168
- expectTypeOf().toMatchTypeOf();
169
- });
170
- });
171
- describe("AnchorHTMLAttributes", () => {
172
- it("target accepts LinkTarget (literals and arbitrary strings)", () => {
173
- expectTypeOf().toMatchTypeOf();
174
- expectTypeOf().toMatchTypeOf();
175
- });
176
- });
177
- describe("ImgHTMLAttributes", () => {
178
- it("ref prop receives HTMLImageElement", () => {
179
- expectTypeOf().toMatchTypeOf();
180
- });
181
- });
182
- describe("HTMLAttributes", () => {
183
- it("style accepts a plain string", () => {
184
- expectTypeOf().toMatchTypeOf();
185
- });
186
- it("style accepts a CSSProperties object", () => {
187
- expectTypeOf().toMatchTypeOf();
188
- });
189
- it("style accepts a reactive CSSProperties function", () => {
190
- expectTypeOf().toMatchTypeOf();
191
- });
192
- });
193
- describe("CSSProperties", () => {
194
- it("accepts CSS custom properties", () => {
195
- const props = { "--brand-color": "#f00" };
196
- expectTypeOf(props).toMatchTypeOf();
197
- });
198
- });
199
- describe("SVGAttributes", () => {
200
- it("fill prop is reactive string", () => {
201
- expectTypeOf().toMatchTypeOf();
202
- expectTypeOf().toMatchTypeOf();
203
- });
204
- it("onClick receives MouseEvent with SVGElement currentTarget", () => {
205
- expectTypeOf().toMatchTypeOf();
206
- });
207
- });
208
- //# sourceMappingURL=jsx-runtime.types.test.js.map
@@ -1 +0,0 @@
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;AA4BpD,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;IAEH,EAAE,CAAC,cAAc,EAAE,GAAG,EAAE;QACtB,YAAY,EAAQ,CAAC,aAAa,EAAoB,CAAC;IACzD,CAAC,CAAC,CAAC;IAEH,EAAE,CAAC,mBAAmB,EAAE,GAAG,EAAE;QAC3B,YAAY,EAAa,CAAC,aA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
- // @vitest-environment jsdom
2
- import { describe, it, expect } from "vitest";
3
-
4
- import { StatefulComponent } from "@praxisjs/core";
5
- import { Scope, runInScope } from "@praxisjs/runtime";
6
-
7
- import { jsx, jsxs, jsxDEV, Fragment } from "../jsx-runtime";
8
-
9
- function withScope<T>(fn: () => T): T {
10
- const scope = new Scope();
11
- return runInScope(scope, fn);
12
- }
13
-
14
- describe("Fragment", () => {
15
- it("is a unique Symbol", () => {
16
- expect(typeof Fragment).toBe("symbol");
17
- });
18
-
19
- it("returns [] when no children are provided", () => {
20
- const result = withScope(() => jsx(Fragment, {}));
21
- expect(result).toEqual([]);
22
- });
23
-
24
- it("returns [] when children is empty array", () => {
25
- const result = withScope(() => jsx(Fragment, { children: [] }));
26
- expect(Array.isArray(result)).toBe(true);
27
- });
28
-
29
- it("wraps a single Node in an array", () => {
30
- const node = document.createElement("span");
31
- const result = withScope(() => jsx(Fragment, { children: node })) as Node[];
32
- expect(result).toHaveLength(1);
33
- expect(result[0]).toBe(node);
34
- });
35
-
36
- it("flattens an array of Nodes", () => {
37
- const a = document.createElement("div");
38
- const b = document.createElement("span");
39
- const result = withScope(() =>
40
- jsx(Fragment, { children: [a, b] }),
41
- ) as Node[];
42
- expect(result).toHaveLength(2);
43
- expect(result[0]).toBe(a);
44
- expect(result[1]).toBe(b);
45
- });
46
-
47
- it("preserves primitive children, including 0, for runtime mounting", () => {
48
- const node = document.createElement("strong");
49
- const result = withScope(() =>
50
- jsx(Fragment, { children: ["count: ", 0, false, null, [node]] }),
51
- ) as Node[];
52
- const container = document.createElement("div");
53
- for (const child of result) container.appendChild(child);
54
- expect(container.textContent).toBe("count: 0");
55
- expect(container.querySelector("strong")).toBe(node);
56
- });
57
-
58
- it("returns [] when children is a non-Node non-Array value (e.g. plain object)", () => {
59
- const result = withScope(() =>
60
- jsx(Fragment, { children: { foo: "bar" } as unknown }),
61
- );
62
- expect(result).toEqual([]);
63
- });
64
- });
65
-
66
- describe("jsx — string tag", () => {
67
- it("creates a DOM element for a string tag", () => {
68
- const el = withScope(() => jsx("div", {})) as HTMLElement;
69
- expect(el).toBeInstanceOf(HTMLDivElement);
70
- });
71
-
72
- it("applies class prop", () => {
73
- const el = withScope(() =>
74
- jsx("p", { class: "text-lg" }),
75
- ) as HTMLElement;
76
- expect(el.getAttribute("class")).toBe("text-lg");
77
- });
78
-
79
- it("renders string children", () => {
80
- const el = withScope(() =>
81
- jsx("span", { children: "hello" }),
82
- ) as HTMLElement;
83
- expect(el.textContent).toBe("hello");
84
- });
85
-
86
- it("creates an SVG element for svg tags", () => {
87
- const el = withScope(() => jsx("svg", {})) as SVGElement;
88
- expect(el).toBeInstanceOf(SVGElement);
89
- });
90
- });
91
-
92
- describe("jsx — component", () => {
93
- it("mounts a component via isComponent check and returns its nodes", () => {
94
- // A minimal class that satisfies isComponent (has __isComponent) and mountComponent
95
- class MyComp extends StatefulComponent {
96
- static __isComponent = true as const;
97
- static __isStateless = false as const;
98
- static __name = "MyComp";
99
- render() { return document.createTextNode("hi"); }
100
- }
101
-
102
- const result = withScope(() =>
103
- jsx(MyComp as unknown as string, {}),
104
- ) as Node[];
105
- expect(Array.isArray(result)).toBe(true);
106
- expect(result.length).toBeGreaterThan(0);
107
- });
108
- });
109
-
110
- describe("jsx — unknown type", () => {
111
- it("returns a comment node for an unknown symbol type", () => {
112
- const unknownType = Symbol("unknown");
113
- const result = withScope(() =>
114
- jsx(unknownType as unknown as string, {}),
115
- ) as Comment;
116
- expect(result.nodeType).toBe(Node.COMMENT_NODE);
117
- });
118
- });
119
-
120
- describe("jsxs and jsxDEV", () => {
121
- it("jsxs is the same function as jsx", () => {
122
- expect(jsxs).toBe(jsx);
123
- });
124
-
125
- it("jsxDEV is the same function as jsx", () => {
126
- expect(jsxDEV).toBe(jsx);
127
- });
128
- });
@@ -1,372 +0,0 @@
1
- import { describe, it, expectTypeOf } from "vitest";
2
-
3
- import type {
4
- Reactive,
5
- ButtonHTMLAttributes,
6
- InputHTMLAttributes,
7
- AnchorHTMLAttributes,
8
- ImgHTMLAttributes,
9
- HTMLAttributes,
10
- CSSProperties,
11
- SVGAttributes,
12
- ButtonType,
13
- HTMLInputTypeAttribute,
14
- LinkTarget,
15
- AriaAttributes,
16
- BaseHTMLAttributes,
17
- LinkHTMLAttributes,
18
- FormHTMLAttributes,
19
- LiHTMLAttributes,
20
- ProgressHTMLAttributes,
21
- ScriptHTMLAttributes,
22
- TrackHTMLAttributes,
23
- TableHTMLAttributes,
24
- TdHTMLAttributes,
25
- DelHTMLAttributes,
26
- TimeHTMLAttributes,
27
- } from "../dom-types";
28
-
29
- describe("Reactive<T>", () => {
30
- it("accepts a plain value", () => {
31
- expectTypeOf<string>().toMatchTypeOf<Reactive<string>>();
32
- });
33
-
34
- it("accepts a zero-arg function", () => {
35
- expectTypeOf<() => string>().toMatchTypeOf<Reactive<string>>();
36
- });
37
-
38
- it("rejects a plain number for Reactive<string>", () => {
39
- expectTypeOf<number>().not.toMatchTypeOf<Reactive<string>>();
40
- });
41
-
42
- it("accepts null", () => {
43
- expectTypeOf<null>().toMatchTypeOf<Reactive<string>>();
44
- });
45
-
46
- it("accepts undefined", () => {
47
- expectTypeOf<undefined>().toMatchTypeOf<Reactive<string>>();
48
- });
49
-
50
- it("accepts a zero-arg function that can return null or undefined", () => {
51
- expectTypeOf<() => string | null | undefined>().toMatchTypeOf<Reactive<string>>();
52
- });
53
- });
54
-
55
- describe("AriaAttributes", () => {
56
- it("aria-valuenow accepts a reactive number (range widgets)", () => {
57
- type Prop = NonNullable<AriaAttributes["aria-valuenow"]>;
58
- expectTypeOf<5>().toMatchTypeOf<Prop>();
59
- expectTypeOf<() => number>().toMatchTypeOf<Prop>();
60
- });
61
-
62
- it("aria-valuetext accepts a reactive string (range widgets)", () => {
63
- type Prop = NonNullable<AriaAttributes["aria-valuetext"]>;
64
- expectTypeOf<"50%">().toMatchTypeOf<Prop>();
65
- expectTypeOf<() => string>().toMatchTypeOf<Prop>();
66
- });
67
-
68
- it("aria-valuemin / aria-valuemax accept a reactive number", () => {
69
- type MinProp = NonNullable<AriaAttributes["aria-valuemin"]>;
70
- type MaxProp = NonNullable<AriaAttributes["aria-valuemax"]>;
71
- expectTypeOf<() => number>().toMatchTypeOf<MinProp>();
72
- expectTypeOf<() => number>().toMatchTypeOf<MaxProp>();
73
- });
74
-
75
- it("aria-selected accepts a reactive boolean (baseline for comparison)", () => {
76
- type Prop = NonNullable<AriaAttributes["aria-selected"]>;
77
- expectTypeOf<() => boolean>().toMatchTypeOf<Prop>();
78
- });
79
-
80
- it("aria-activedescendant accepts a reactive string", () => {
81
- type Prop = NonNullable<AriaAttributes["aria-activedescendant"]>;
82
- expectTypeOf<() => string>().toMatchTypeOf<Prop>();
83
- });
84
-
85
- it("aria-level / aria-posinset / aria-setsize accept a reactive number", () => {
86
- expectTypeOf<() => number>().toMatchTypeOf<
87
- NonNullable<AriaAttributes["aria-level"]>
88
- >();
89
- expectTypeOf<() => number>().toMatchTypeOf<
90
- NonNullable<AriaAttributes["aria-posinset"]>
91
- >();
92
- expectTypeOf<() => number>().toMatchTypeOf<
93
- NonNullable<AriaAttributes["aria-setsize"]>
94
- >();
95
- });
96
-
97
- it("aria-rowindex / aria-colindex / aria-rowcount / aria-colcount accept a reactive number", () => {
98
- expectTypeOf<() => number>().toMatchTypeOf<
99
- NonNullable<AriaAttributes["aria-rowindex"]>
100
- >();
101
- expectTypeOf<() => number>().toMatchTypeOf<
102
- NonNullable<AriaAttributes["aria-colindex"]>
103
- >();
104
- expectTypeOf<() => number>().toMatchTypeOf<
105
- NonNullable<AriaAttributes["aria-rowcount"]>
106
- >();
107
- expectTypeOf<() => number>().toMatchTypeOf<
108
- NonNullable<AriaAttributes["aria-colcount"]>
109
- >();
110
- });
111
-
112
- it("aria-sort / aria-orientation / aria-autocomplete accept a reactive literal union", () => {
113
- expectTypeOf<() => "ascending">().toMatchTypeOf<
114
- NonNullable<AriaAttributes["aria-sort"]>
115
- >();
116
- expectTypeOf<() => "vertical">().toMatchTypeOf<
117
- NonNullable<AriaAttributes["aria-orientation"]>
118
- >();
119
- expectTypeOf<() => "list">().toMatchTypeOf<
120
- NonNullable<AriaAttributes["aria-autocomplete"]>
121
- >();
122
- });
123
-
124
- it("aria-controls / aria-describedby / aria-labelledby / aria-owns accept a reactive string", () => {
125
- expectTypeOf<() => string>().toMatchTypeOf<
126
- NonNullable<AriaAttributes["aria-controls"]>
127
- >();
128
- expectTypeOf<() => string>().toMatchTypeOf<
129
- NonNullable<AriaAttributes["aria-describedby"]>
130
- >();
131
- expectTypeOf<() => string>().toMatchTypeOf<
132
- NonNullable<AriaAttributes["aria-labelledby"]>
133
- >();
134
- expectTypeOf<() => string>().toMatchTypeOf<
135
- NonNullable<AriaAttributes["aria-owns"]>
136
- >();
137
- });
138
- });
139
-
140
- describe("HTMLAttributes — global attribute reactivity", () => {
141
- it("role accepts a reactive literal union", () => {
142
- expectTypeOf<() => "tab">().toMatchTypeOf<
143
- NonNullable<HTMLAttributes["role"]>
144
- >();
145
- });
146
-
147
- it("slot / accessKey / part accept a reactive string", () => {
148
- expectTypeOf<() => string>().toMatchTypeOf<
149
- NonNullable<HTMLAttributes["slot"]>
150
- >();
151
- expectTypeOf<() => string>().toMatchTypeOf<
152
- NonNullable<HTMLAttributes["accessKey"]>
153
- >();
154
- expectTypeOf<() => string>().toMatchTypeOf<
155
- NonNullable<HTMLAttributes["part"]>
156
- >();
157
- });
158
-
159
- it("popover accepts a reactive boolean or literal union", () => {
160
- expectTypeOf<() => "manual">().toMatchTypeOf<
161
- NonNullable<HTMLAttributes["popover"]>
162
- >();
163
- });
164
-
165
- it("autoFocus stays a plain boolean — one-shot mount semantics, not reactive", () => {
166
- type AutoFocusProp = NonNullable<HTMLAttributes["autoFocus"]>;
167
- expectTypeOf<() => boolean>().not.toMatchTypeOf<AutoFocusProp>();
168
- });
169
- });
170
-
171
- describe("Cross-interface Reactive<T> consistency", () => {
172
- it("href is reactive on <base> and <link>, matching <a>/<area>/SVG", () => {
173
- expectTypeOf<() => string>().toMatchTypeOf<
174
- NonNullable<BaseHTMLAttributes["href"]>
175
- >();
176
- expectTypeOf<() => string>().toMatchTypeOf<
177
- NonNullable<LinkHTMLAttributes["href"]>
178
- >();
179
- });
180
-
181
- it("target is reactive on <base> and <form>, matching <a>/<area>", () => {
182
- expectTypeOf<() => "_blank">().toMatchTypeOf<
183
- NonNullable<BaseHTMLAttributes["target"]>
184
- >();
185
- expectTypeOf<() => "_blank">().toMatchTypeOf<
186
- NonNullable<FormHTMLAttributes["target"]>
187
- >();
188
- });
189
-
190
- it("value is reactive on <li>, matching every other value-bearing element", () => {
191
- expectTypeOf<() => number>().toMatchTypeOf<
192
- NonNullable<LiHTMLAttributes["value"]>
193
- >();
194
- });
195
-
196
- it("max is reactive on <progress>, matching <input>/<meter>", () => {
197
- expectTypeOf<() => number>().toMatchTypeOf<
198
- NonNullable<ProgressHTMLAttributes["max"]>
199
- >();
200
- });
201
-
202
- it("src is reactive on <script> and <track>, matching <img>/<iframe>/media", () => {
203
- expectTypeOf<() => string>().toMatchTypeOf<
204
- NonNullable<ScriptHTMLAttributes["src"]>
205
- >();
206
- expectTypeOf<() => string>().toMatchTypeOf<
207
- NonNullable<TrackHTMLAttributes["src"]>
208
- >();
209
- });
210
-
211
- it("width is reactive on <table>, matching <img>/<iframe>/<video>/etc.", () => {
212
- expectTypeOf<() => number>().toMatchTypeOf<
213
- NonNullable<TableHTMLAttributes["width"]>
214
- >();
215
- });
216
-
217
- it("height/width are reactive on <td>, matching every other sized element", () => {
218
- expectTypeOf<() => number>().toMatchTypeOf<
219
- NonNullable<TdHTMLAttributes["height"]>
220
- >();
221
- expectTypeOf<() => number>().toMatchTypeOf<
222
- NonNullable<TdHTMLAttributes["width"]>
223
- >();
224
- });
225
-
226
- it("dateTime is reactive on <del>, matching <time>", () => {
227
- expectTypeOf<() => string>().toMatchTypeOf<
228
- NonNullable<DelHTMLAttributes["dateTime"]>
229
- >();
230
- expectTypeOf<() => string>().toMatchTypeOf<
231
- NonNullable<TimeHTMLAttributes["dateTime"]>
232
- >();
233
- });
234
- });
235
-
236
- describe("LiteralUnion-based string attributes", () => {
237
- it("ButtonType: literal values are assignable", () => {
238
- expectTypeOf<"button">().toMatchTypeOf<ButtonType>();
239
- expectTypeOf<"submit">().toMatchTypeOf<ButtonType>();
240
- expectTypeOf<"reset">().toMatchTypeOf<ButtonType>();
241
- });
242
-
243
- it("ButtonType: arbitrary string is assignable", () => {
244
- expectTypeOf<string>().toMatchTypeOf<ButtonType>();
245
- });
246
-
247
- it("HTMLInputTypeAttribute: known literals are assignable", () => {
248
- expectTypeOf<"text">().toMatchTypeOf<HTMLInputTypeAttribute>();
249
- expectTypeOf<"email">().toMatchTypeOf<HTMLInputTypeAttribute>();
250
- expectTypeOf<"password">().toMatchTypeOf<HTMLInputTypeAttribute>();
251
- expectTypeOf<"checkbox">().toMatchTypeOf<HTMLInputTypeAttribute>();
252
- expectTypeOf<"radio">().toMatchTypeOf<HTMLInputTypeAttribute>();
253
- });
254
-
255
- it("HTMLInputTypeAttribute: arbitrary string is assignable", () => {
256
- expectTypeOf<string>().toMatchTypeOf<HTMLInputTypeAttribute>();
257
- });
258
-
259
- it("LinkTarget: known literals are assignable", () => {
260
- expectTypeOf<"_blank">().toMatchTypeOf<LinkTarget>();
261
- expectTypeOf<"_self">().toMatchTypeOf<LinkTarget>();
262
- expectTypeOf<"_parent">().toMatchTypeOf<LinkTarget>();
263
- expectTypeOf<"_top">().toMatchTypeOf<LinkTarget>();
264
- });
265
-
266
- it("LinkTarget: arbitrary string (e.g. frame name) is assignable", () => {
267
- expectTypeOf<string>().toMatchTypeOf<LinkTarget>();
268
- });
269
- });
270
-
271
- describe("ButtonHTMLAttributes", () => {
272
- it("type prop accepts ButtonType", () => {
273
- type TypeProp = ButtonHTMLAttributes["type"];
274
- expectTypeOf<"button">().toMatchTypeOf<TypeProp>();
275
- expectTypeOf<"submit">().toMatchTypeOf<TypeProp>();
276
- expectTypeOf<"reset">().toMatchTypeOf<TypeProp>();
277
- expectTypeOf<string>().toMatchTypeOf<TypeProp>();
278
- });
279
-
280
- it("type prop is reactive", () => {
281
- type TypeProp = NonNullable<ButtonHTMLAttributes["type"]>;
282
- expectTypeOf<() => "button">().toMatchTypeOf<TypeProp>();
283
- });
284
-
285
- it("disabled prop is reactive boolean", () => {
286
- type DisabledProp = NonNullable<ButtonHTMLAttributes["disabled"]>;
287
- expectTypeOf<true>().toMatchTypeOf<DisabledProp>();
288
- expectTypeOf<() => boolean>().toMatchTypeOf<DisabledProp>();
289
- });
290
-
291
- it("class prop accepts reactive string", () => {
292
- type ClassProp = NonNullable<ButtonHTMLAttributes["class"]>;
293
- expectTypeOf<string>().toMatchTypeOf<ClassProp>();
294
- expectTypeOf<() => string>().toMatchTypeOf<ClassProp>();
295
- });
296
-
297
- it("onClick receives MouseEvent with currentTarget HTMLButtonElement", () => {
298
- type Handler = NonNullable<
299
- ButtonHTMLAttributes<HTMLButtonElement>["onClick"]
300
- >;
301
- type Evt = Parameters<Handler>[0];
302
- expectTypeOf<HTMLButtonElement>().toMatchTypeOf<Evt["currentTarget"]>();
303
- });
304
- });
305
-
306
- describe("InputHTMLAttributes", () => {
307
- it("type prop accepts HTMLInputTypeAttribute", () => {
308
- type TypeProp = NonNullable<InputHTMLAttributes["type"]>;
309
- expectTypeOf<"email">().toMatchTypeOf<TypeProp>();
310
- expectTypeOf<string>().toMatchTypeOf<TypeProp>();
311
- });
312
-
313
- it("ref prop receives HTMLInputElement", () => {
314
- type RefProp = NonNullable<InputHTMLAttributes<HTMLInputElement>["ref"]>;
315
- type Param = Parameters<RefProp>[0];
316
- expectTypeOf<HTMLInputElement>().toMatchTypeOf<Param>();
317
- });
318
- });
319
-
320
- describe("AnchorHTMLAttributes", () => {
321
- it("target accepts LinkTarget (literals and arbitrary strings)", () => {
322
- type TargetProp = NonNullable<AnchorHTMLAttributes["target"]>;
323
- expectTypeOf<"_blank">().toMatchTypeOf<TargetProp>();
324
- expectTypeOf<string>().toMatchTypeOf<TargetProp>();
325
- });
326
- });
327
-
328
- describe("ImgHTMLAttributes", () => {
329
- it("ref prop receives HTMLImageElement", () => {
330
- type RefProp = NonNullable<ImgHTMLAttributes<HTMLImageElement>["ref"]>;
331
- type Param = Parameters<RefProp>[0];
332
- expectTypeOf<HTMLImageElement>().toMatchTypeOf<Param>();
333
- });
334
- });
335
-
336
- describe("HTMLAttributes", () => {
337
- it("style accepts a plain string", () => {
338
- type StyleProp = NonNullable<HTMLAttributes["style"]>;
339
- expectTypeOf<string>().toMatchTypeOf<StyleProp>();
340
- });
341
-
342
- it("style accepts a CSSProperties object", () => {
343
- type StyleProp = NonNullable<HTMLAttributes["style"]>;
344
- expectTypeOf<CSSProperties>().toMatchTypeOf<StyleProp>();
345
- });
346
-
347
- it("style accepts a reactive CSSProperties function", () => {
348
- type StyleProp = NonNullable<HTMLAttributes["style"]>;
349
- expectTypeOf<() => CSSProperties>().toMatchTypeOf<StyleProp>();
350
- });
351
- });
352
-
353
- describe("CSSProperties", () => {
354
- it("accepts CSS custom properties", () => {
355
- const props: CSSProperties = { "--brand-color": "#f00" };
356
- expectTypeOf(props).toMatchTypeOf<CSSProperties>();
357
- });
358
- });
359
-
360
- describe("SVGAttributes", () => {
361
- it("fill prop is reactive string", () => {
362
- type FillProp = NonNullable<SVGAttributes["fill"]>;
363
- expectTypeOf<string>().toMatchTypeOf<FillProp>();
364
- expectTypeOf<() => string>().toMatchTypeOf<FillProp>();
365
- });
366
-
367
- it("onClick receives MouseEvent with SVGElement currentTarget", () => {
368
- type Handler = NonNullable<SVGAttributes<SVGCircleElement>["onClick"]>;
369
- type Evt = Parameters<Handler>[0];
370
- expectTypeOf<SVGCircleElement>().toMatchTypeOf<Evt["currentTarget"]>();
371
- });
372
- });
package/tsconfig.json DELETED
@@ -1,8 +0,0 @@
1
- {
2
- "extends": "../../../tsconfig.base.json",
3
- "compilerOptions": {
4
- "outDir": "./dist",
5
- "rootDir": "./src"
6
- },
7
- "include": ["src"]
8
- }