nesquick 1.4.0 → 1.5.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/lib/For/getMap.js +5 -3
- package/lib/NesquickComponent.js +0 -1
- package/lib/cli/transformer.js +57 -52
- package/lib/jsx-runtime.js +0 -1
- package/lib/types/For/For.d.ts +3 -3
- package/lib/types/cli/transformer.d.ts +0 -1
- package/lib/types/jsx-runtime.d.ts +5 -12
- package/package.json +11 -16
- package/lib/no-transformer/jsx-dev-runtime.js +0 -22
- package/lib/no-transformer/jsx-runtime.js +0 -32
- package/lib/types/no-transformer/jsx-dev-runtime.d.ts +0 -9
- package/lib/types/no-transformer/jsx-runtime.d.ts +0 -72
package/lib/For/getMap.js
CHANGED
|
@@ -2,12 +2,13 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.getMap = getMap;
|
|
4
4
|
function getMap(props) {
|
|
5
|
-
|
|
5
|
+
const idsCallback = "ids" in props && props.ids?.();
|
|
6
|
+
if (idsCallback) {
|
|
6
7
|
const childrenMap = new Map();
|
|
7
8
|
let idLength = 0;
|
|
8
9
|
return {
|
|
9
10
|
getId(item, i) {
|
|
10
|
-
const ids =
|
|
11
|
+
const ids = idsCallback(item, i);
|
|
11
12
|
if (!ids || ids.length === 0) {
|
|
12
13
|
throw new Error(`Invalid ids array length. ids() should not return an empty array`);
|
|
13
14
|
}
|
|
@@ -77,8 +78,9 @@ function getMap(props) {
|
|
|
77
78
|
}
|
|
78
79
|
else {
|
|
79
80
|
const childrenMap = new Map();
|
|
81
|
+
const idCallback = "id" in props && props.id?.() || (item => item);
|
|
80
82
|
return {
|
|
81
|
-
getId:
|
|
83
|
+
getId: idCallback,
|
|
82
84
|
equalsId(a, b) {
|
|
83
85
|
return a === b;
|
|
84
86
|
},
|
package/lib/NesquickComponent.js
CHANGED
package/lib/cli/transformer.js
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.transformer = void 0;
|
|
4
|
-
exports.createCheckFunction = createCheckFunction;
|
|
5
4
|
const TS = require("typescript");
|
|
6
5
|
function getSingleIdentifier(node) {
|
|
7
6
|
let identifier = null;
|
|
@@ -25,49 +24,65 @@ function getSingleBody(node) {
|
|
|
25
24
|
});
|
|
26
25
|
return body;
|
|
27
26
|
}
|
|
28
|
-
function
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
27
|
+
function createSpreadCheckFunction(fName) {
|
|
28
|
+
const obj = TS.factory.createIdentifier("obj");
|
|
29
|
+
const check = TS.factory.createIdentifier("check");
|
|
30
|
+
const res = TS.factory.createIdentifier("res");
|
|
31
|
+
const k = TS.factory.createIdentifier("k");
|
|
32
|
+
const v = TS.factory.createIdentifier("v");
|
|
33
|
+
return TS.factory.createFunctionDeclaration(void 0, void 0, fName, void 0, [
|
|
34
|
+
TS.factory.createParameterDeclaration(void 0, void 0, obj),
|
|
35
|
+
TS.factory.createParameterDeclaration(void 0, void 0, check)
|
|
36
|
+
], void 0, TS.factory.createBlock([
|
|
37
|
+
TS.factory.createVariableStatement(void 0, TS.factory.createVariableDeclarationList([
|
|
38
|
+
TS.factory.createVariableDeclaration(res, void 0, void 0, TS.factory.createCallExpression(TS.factory.createPropertyAccessExpression(TS.factory.createIdentifier("Object"), "create"), void 0, [TS.factory.createNull()]))
|
|
39
|
+
], TS.NodeFlags.Const)),
|
|
40
|
+
TS.factory.createForInStatement(TS.factory.createVariableDeclarationList([TS.factory.createVariableDeclaration(k)], TS.NodeFlags.Const), obj, TS.factory.createBlock([
|
|
41
|
+
TS.factory.createVariableStatement(void 0, TS.factory.createVariableDeclarationList([
|
|
42
|
+
TS.factory.createVariableDeclaration(v, void 0, void 0, TS.factory.createElementAccessExpression(obj, k))
|
|
43
|
+
], TS.NodeFlags.Const)),
|
|
44
|
+
TS.factory.createIfStatement(TS.factory.createBinaryExpression(TS.factory.createPrefixUnaryExpression(TS.SyntaxKind.ExclamationToken, check), TS.factory.createToken(TS.SyntaxKind.BarBarToken), TS.factory.createBinaryExpression(TS.factory.createTypeOfExpression(v), TS.factory.createToken(TS.SyntaxKind.ExclamationEqualsEqualsToken), TS.factory.createStringLiteral("function"))), TS.factory.createBlock([
|
|
45
|
+
TS.factory.createExpressionStatement(TS.factory.createBinaryExpression(TS.factory.createElementAccessExpression(res, k), TS.factory.createToken(TS.SyntaxKind.EqualsToken), TS.factory.createArrowFunction(void 0, void 0, [], void 0, TS.factory.createToken(TS.SyntaxKind.EqualsGreaterThanToken), v)))
|
|
46
|
+
], true), TS.factory.createBlock([
|
|
47
|
+
TS.factory.createExpressionStatement(TS.factory.createBinaryExpression(TS.factory.createElementAccessExpression(res, k), TS.factory.createToken(TS.SyntaxKind.EqualsToken), v))
|
|
48
|
+
], true))
|
|
49
|
+
], true)),
|
|
50
|
+
TS.factory.createReturnStatement(res)
|
|
51
|
+
], true));
|
|
32
52
|
}
|
|
33
53
|
const transformer = context => {
|
|
34
54
|
return sourceFile => {
|
|
35
|
-
let
|
|
36
|
-
const
|
|
55
|
+
let hasSpreadChecker = false;
|
|
56
|
+
const spreadCheckerName = TS.factory.createUniqueName("_spread");
|
|
57
|
+
const processNode = (node, options) => {
|
|
58
|
+
let hasCallExpression = false;
|
|
59
|
+
node = TS.visitEachChild(node, node => {
|
|
60
|
+
const res = visitGeneric(node, options);
|
|
61
|
+
hasCallExpression = hasCallExpression || res.hasCallExpression;
|
|
62
|
+
return res.node;
|
|
63
|
+
}, context);
|
|
64
|
+
return { node, hasCallExpression };
|
|
65
|
+
};
|
|
37
66
|
const visitGeneric = (node, options) => {
|
|
38
|
-
let hasSpread = options.userComponent && TS.isJsxSpreadAttribute(node);
|
|
39
67
|
let hasCallExpression = TS.isCallExpression(node);
|
|
40
|
-
if (TS.
|
|
68
|
+
if (TS.isJsxSpreadAttribute(node)) {
|
|
69
|
+
hasSpreadChecker = true;
|
|
70
|
+
const expression = visitGeneric(node.expression, {}).node;
|
|
71
|
+
if (TS.isExpression(expression)) {
|
|
72
|
+
const callExpression = TS.factory.createCallExpression(spreadCheckerName, void 0, [expression, options.userComponent ? TS.factory.createFalse() : TS.factory.createTrue()]);
|
|
73
|
+
node = TS.factory.updateJsxSpreadAttribute(node, callExpression);
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
else if (TS.isJsxOpeningLikeElement(node)) {
|
|
41
77
|
const firstLetter = node.tagName.getText()[0];
|
|
42
78
|
const userComponent = firstLetter !== firstLetter.toLowerCase();
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
hasCallExpression = hasCallExpression || res.hasCallExpression;
|
|
47
|
-
return res.node;
|
|
48
|
-
}, context);
|
|
49
|
-
if (userComponent && hasSpread) {
|
|
50
|
-
const symbol = TS.factory.createCallExpression(TS.factory.createPropertyAccessExpression(TS.factory.createIdentifier("Symbol"), "for"), void 0, [TS.factory.createStringLiteral("$nesquickSpreadProps")]);
|
|
51
|
-
if (TS.isJsxOpeningLikeElement(node)) {
|
|
52
|
-
const attributes = TS.factory.updateJsxAttributes(node.attributes, [
|
|
53
|
-
...node.attributes.properties,
|
|
54
|
-
TS.factory.createJsxSpreadAttribute(TS.factory.createObjectLiteralExpression([
|
|
55
|
-
TS.factory.createPropertyAssignment(TS.factory.createComputedPropertyName(symbol), TS.factory.createTrue())
|
|
56
|
-
]))
|
|
57
|
-
]);
|
|
58
|
-
if (TS.isJsxOpeningElement(node)) {
|
|
59
|
-
node = TS.factory.updateJsxOpeningElement(node, node.tagName, node.typeArguments, attributes);
|
|
60
|
-
}
|
|
61
|
-
else if (TS.isJsxSelfClosingElement(node)) {
|
|
62
|
-
node = TS.factory.updateJsxSelfClosingElement(node, node.tagName, node.typeArguments, attributes);
|
|
63
|
-
}
|
|
64
|
-
}
|
|
65
|
-
}
|
|
79
|
+
const res = processNode(node, { userComponent });
|
|
80
|
+
node = res.node;
|
|
81
|
+
hasCallExpression = hasCallExpression || res.hasCallExpression;
|
|
66
82
|
}
|
|
67
83
|
else if (TS.isJsxAttribute(node)) {
|
|
68
84
|
node = TS.visitEachChild(node, node => {
|
|
69
85
|
const res = visitGeneric(node, { ...options, isJsxAttribute: true });
|
|
70
|
-
hasSpread = hasSpread || res.hasSpread;
|
|
71
86
|
hasCallExpression = hasCallExpression || res.hasCallExpression;
|
|
72
87
|
return res.node;
|
|
73
88
|
}, context);
|
|
@@ -87,12 +102,11 @@ const transformer = context => {
|
|
|
87
102
|
else {
|
|
88
103
|
node = TS.visitEachChild(node, node => {
|
|
89
104
|
const res = visitGeneric(node, { ...options, isJsxAttribute: false });
|
|
90
|
-
hasSpread = hasSpread || res.hasSpread;
|
|
91
105
|
hasCallExpression = hasCallExpression || res.hasCallExpression;
|
|
92
106
|
return res.node;
|
|
93
107
|
}, context);
|
|
94
108
|
}
|
|
95
|
-
return {
|
|
109
|
+
return { node, hasCallExpression };
|
|
96
110
|
};
|
|
97
111
|
const visitorExpression = (node, options) => {
|
|
98
112
|
if (TS.isParenthesizedExpression(node)) {
|
|
@@ -104,32 +118,23 @@ const transformer = context => {
|
|
|
104
118
|
if (TS.isCallExpression(node)) {
|
|
105
119
|
let identifier = null;
|
|
106
120
|
if (node.arguments.length === 0 && (identifier = getSingleIdentifier(node)) != null) {
|
|
107
|
-
|
|
108
|
-
}
|
|
109
|
-
else {
|
|
110
|
-
node = TS.factory.createArrowFunction(void 0, void 0, [], void 0, TS.factory.createToken(TS.SyntaxKind.EqualsGreaterThanToken), TS.visitNode(node, node => visitGeneric(node, {}).node, TS.isConciseBody));
|
|
121
|
+
return visitGeneric(identifier, {}).node;
|
|
111
122
|
}
|
|
112
123
|
}
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
if (
|
|
117
|
-
|
|
118
|
-
node = TS.factory.createArrowFunction(void 0, void 0, [], void 0, TS.factory.createToken(TS.SyntaxKind.EqualsGreaterThanToken), TS.visitNode(node, node => visitGeneric(node, {}).node, TS.isConciseBody));
|
|
119
|
-
}
|
|
120
|
-
else if (options.userComponent) {
|
|
121
|
-
hasChecker = true;
|
|
122
|
-
node = TS.factory.createCallExpression(checkerName, void 0, [node]);
|
|
123
|
-
}
|
|
124
|
+
const res = visitGeneric(node, {});
|
|
125
|
+
node = res.node;
|
|
126
|
+
if (TS.isExpression(node)) {
|
|
127
|
+
if (options.userComponent || (res.hasCallExpression && !TS.isFunctionLike(node) && !TS.isJsxElement(node) && !TS.isJsxOpeningLikeElement(node))) {
|
|
128
|
+
node = TS.factory.createArrowFunction(void 0, void 0, [], void 0, TS.factory.createToken(TS.SyntaxKind.EqualsGreaterThanToken), node);
|
|
124
129
|
}
|
|
125
130
|
}
|
|
126
131
|
return node;
|
|
127
132
|
};
|
|
128
133
|
sourceFile = TS.visitNode(sourceFile, node => visitGeneric(node, {}).node, TS.isSourceFile);
|
|
129
|
-
if (
|
|
134
|
+
if (hasSpreadChecker) {
|
|
130
135
|
sourceFile = TS.factory.updateSourceFile(sourceFile, [
|
|
131
136
|
...sourceFile.statements,
|
|
132
|
-
|
|
137
|
+
createSpreadCheckFunction(spreadCheckerName)
|
|
133
138
|
]);
|
|
134
139
|
}
|
|
135
140
|
return sourceFile;
|
package/lib/jsx-runtime.js
CHANGED
|
@@ -4,7 +4,6 @@ exports.JSX = exports.jsx = exports.Fragment = void 0;
|
|
|
4
4
|
exports.jsxs = jsxs;
|
|
5
5
|
const NesquickComponent_1 = require("./NesquickComponent");
|
|
6
6
|
const NesquickFragment_1 = require("./NesquickFragment");
|
|
7
|
-
const propsSpreadSymbol = Symbol.for("$nesquickSpreadProps");
|
|
8
7
|
exports.Fragment = Symbol();
|
|
9
8
|
function jsxs(type, props, key) {
|
|
10
9
|
if (type === exports.Fragment) {
|
package/lib/types/For/For.d.ts
CHANGED
|
@@ -3,12 +3,12 @@ import { NesquickFragment } from "../NesquickFragment";
|
|
|
3
3
|
type ChildRender<T> = (item: T, i: () => number) => JSX.Element;
|
|
4
4
|
export type ForProps<T> = {
|
|
5
5
|
each: T[];
|
|
6
|
-
children: ChildRender<T
|
|
6
|
+
children: ChildRender<NoInfer<T>>;
|
|
7
7
|
} & ({
|
|
8
8
|
ids?: never;
|
|
9
|
-
id: (item: T
|
|
9
|
+
id: (item: NoInfer<T>, i: number) => unknown;
|
|
10
10
|
} | {
|
|
11
|
-
ids: (item: T
|
|
11
|
+
ids: (item: NoInfer<T>, i: number) => unknown[];
|
|
12
12
|
id?: never;
|
|
13
13
|
} | {
|
|
14
14
|
ids?: never;
|
|
@@ -1,31 +1,24 @@
|
|
|
1
1
|
import { FunctionComponent, ComponentProps, NesquickComponent } from "./NesquickComponent";
|
|
2
2
|
import { NesquickFragment } from "./NesquickFragment";
|
|
3
|
-
declare const propsSpreadSymbol: unique symbol;
|
|
4
3
|
export declare const Fragment: unique symbol;
|
|
5
|
-
export declare function jsxs<P extends ComponentProps
|
|
6
|
-
[propsSpreadSymbol]?: true;
|
|
7
|
-
}>(type: string | FunctionComponent<P> | typeof Fragment, props: P, key?: string | number | null): NesquickFragment | NesquickComponent<P>;
|
|
4
|
+
export declare function jsxs<P extends ComponentProps>(type: string | FunctionComponent<P> | typeof Fragment, props: P, key?: string | number | null): NesquickFragment | NesquickComponent<P>;
|
|
8
5
|
export declare const jsx: typeof jsxs;
|
|
9
6
|
type HasUndefined<T, K extends keyof T> = {
|
|
10
|
-
[L in K]-?: T[
|
|
7
|
+
[L in K]-?: T[L] | undefined;
|
|
11
8
|
} extends {
|
|
12
|
-
[L in K]?: T[
|
|
9
|
+
[L in K]?: T[L];
|
|
13
10
|
} ? undefined extends T[K] ? true : false : false;
|
|
14
11
|
declare const WrappedFunctionType: unique symbol;
|
|
15
12
|
type WrappedFunction<T> = (() => T) & {
|
|
16
13
|
readonly [WrappedFunctionType]?: T;
|
|
17
14
|
};
|
|
18
|
-
type UserProp<T> = T extends (...args: any[]) => any ? T : WrappedFunction<T>;
|
|
19
15
|
type UserProps<T> = {
|
|
20
|
-
readonly [K in keyof T]: K extends keyof JSX.ElementChildrenAttribute ? T[K] : HasUndefined<T, K> extends true ?
|
|
16
|
+
readonly [K in keyof T]: K extends keyof JSX.ElementChildrenAttribute ? T[K] : WrappedFunction<HasUndefined<T, K> extends true ? T[K] : Exclude<T[K], undefined>>;
|
|
21
17
|
};
|
|
22
|
-
type JSXProp<T> = T extends
|
|
23
|
-
readonly [WrappedFunctionType]?: infer R;
|
|
24
|
-
} ? R : T;
|
|
18
|
+
type JSXProp<T> = T extends WrappedFunction<infer R> ? R : T;
|
|
25
19
|
type JSXProps<T> = keyof T extends never ? {} : {
|
|
26
20
|
[K in keyof T]: JSXProp<T[K]>;
|
|
27
21
|
};
|
|
28
|
-
export type Generic<T> = T extends (...args: any) => infer R ? R : T;
|
|
29
22
|
export { UserProps as Props };
|
|
30
23
|
export type Component<P = {}> = (props: UserProps<P>) => JSX.Element;
|
|
31
24
|
export declare namespace JSX {
|
package/package.json
CHANGED
|
@@ -1,16 +1,20 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "nesquick",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.5.0",
|
|
4
4
|
"description": "React-like library with focus on drawing performance",
|
|
5
5
|
"types": "./lib/types/index.d.ts",
|
|
6
6
|
"main": "./lib/index.js",
|
|
7
7
|
"typesVersions": {
|
|
8
8
|
"*": {
|
|
9
|
-
".": [
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
"
|
|
13
|
-
|
|
9
|
+
".": [
|
|
10
|
+
"./lib/types/index.d.ts"
|
|
11
|
+
],
|
|
12
|
+
"jsx-runtime": [
|
|
13
|
+
"./lib/types/jsx-runtime.d.ts"
|
|
14
|
+
],
|
|
15
|
+
"jsx-dev-runtime": [
|
|
16
|
+
"./lib/types/jsx-dev-runtime.d.ts"
|
|
17
|
+
]
|
|
14
18
|
}
|
|
15
19
|
},
|
|
16
20
|
"exports": {
|
|
@@ -25,14 +29,6 @@
|
|
|
25
29
|
"./jsx-dev-runtime": {
|
|
26
30
|
"types": "./lib/types/jsx-dev-runtime.d.ts",
|
|
27
31
|
"default": "./lib/jsx-dev-runtime.js"
|
|
28
|
-
},
|
|
29
|
-
"./no-transformer/jsx-runtime": {
|
|
30
|
-
"types": "./lib/types/no-transformer/jsx-runtime.d.ts",
|
|
31
|
-
"default": "./lib/no-transformer/jsx-runtime.js"
|
|
32
|
-
},
|
|
33
|
-
"./no-transformer/jsx-dev-runtime": {
|
|
34
|
-
"types": "./lib/types/no-transformer/jsx-dev-runtime.d.ts",
|
|
35
|
-
"default": "./lib/no-transformer/jsx-dev-runtime.js"
|
|
36
32
|
}
|
|
37
33
|
},
|
|
38
34
|
"bin": {
|
|
@@ -42,7 +38,6 @@
|
|
|
42
38
|
"sideEffects": false,
|
|
43
39
|
"files": [
|
|
44
40
|
"lib/",
|
|
45
|
-
"no-transformer/",
|
|
46
41
|
"jsx-runtime.js",
|
|
47
42
|
"jsx-dev-runtime.js"
|
|
48
43
|
],
|
|
@@ -70,7 +65,7 @@
|
|
|
70
65
|
"devDependencies": {
|
|
71
66
|
"@types/jsdom": "^21.1.7",
|
|
72
67
|
"@types/node": "^22.7.8",
|
|
73
|
-
"arrange-act-assert": "^2.
|
|
68
|
+
"arrange-act-assert": "^2.10.0",
|
|
74
69
|
"jsdom": "^26.1.0",
|
|
75
70
|
"typescript": "^5.6.3"
|
|
76
71
|
}
|
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
-
if (k2 === undefined) k2 = k;
|
|
4
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
-
}
|
|
8
|
-
Object.defineProperty(o, k2, desc);
|
|
9
|
-
}) : (function(o, m, k, k2) {
|
|
10
|
-
if (k2 === undefined) k2 = k;
|
|
11
|
-
o[k2] = m[k];
|
|
12
|
-
}));
|
|
13
|
-
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
-
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
-
};
|
|
16
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
-
exports.jsxDEV = jsxDEV;
|
|
18
|
-
const jsx_runtime_1 = require("./jsx-runtime");
|
|
19
|
-
__exportStar(require("./jsx-runtime"), exports);
|
|
20
|
-
function jsxDEV(type, props, key, _isStaticChildren, _source, _self) {
|
|
21
|
-
return (0, jsx_runtime_1.jsx)(type, props, key);
|
|
22
|
-
}
|
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.JSX = exports.jsx = exports.Fragment = void 0;
|
|
4
|
-
exports.functionizeProps = functionizeProps;
|
|
5
|
-
exports.jsxs = jsxs;
|
|
6
|
-
const NesquickComponent_1 = require("../NesquickComponent");
|
|
7
|
-
const NesquickFragment_1 = require("../NesquickFragment");
|
|
8
|
-
exports.Fragment = Symbol();
|
|
9
|
-
function functionizeProps(props) {
|
|
10
|
-
for (const k in props) {
|
|
11
|
-
if (k !== "children" && typeof props[k] !== "function") {
|
|
12
|
-
const v = props[k];
|
|
13
|
-
props[k] = () => v;
|
|
14
|
-
}
|
|
15
|
-
}
|
|
16
|
-
}
|
|
17
|
-
function jsxs(type, props, key) {
|
|
18
|
-
if (type === exports.Fragment) {
|
|
19
|
-
return new NesquickFragment_1.NesquickFragment(props.children);
|
|
20
|
-
}
|
|
21
|
-
if (typeof type !== "string") {
|
|
22
|
-
functionizeProps(props);
|
|
23
|
-
}
|
|
24
|
-
else if (key !== undefined) {
|
|
25
|
-
props.key = key;
|
|
26
|
-
}
|
|
27
|
-
return new NesquickComponent_1.NesquickComponent(type, props);
|
|
28
|
-
}
|
|
29
|
-
exports.jsx = jsxs;
|
|
30
|
-
var JSX;
|
|
31
|
-
(function (JSX) {
|
|
32
|
-
})(JSX || (exports.JSX = JSX = {}));
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import { Fragment } from "./jsx-runtime";
|
|
2
|
-
import { FunctionComponent, ComponentProps } from "../NesquickComponent";
|
|
3
|
-
export * from "./jsx-runtime";
|
|
4
|
-
type JsxSource = {
|
|
5
|
-
fileName: string;
|
|
6
|
-
lineNumber: number;
|
|
7
|
-
columnNumber?: number;
|
|
8
|
-
};
|
|
9
|
-
export declare function jsxDEV<P extends ComponentProps>(type: string | FunctionComponent<P> | typeof Fragment, props: P, key: string | number | null, _isStaticChildren: boolean, _source: JsxSource, _self: any): import("..").NesquickFragment | import("../NesquickComponent").NesquickComponent<P>;
|
|
@@ -1,72 +0,0 @@
|
|
|
1
|
-
import { FunctionComponent, ComponentProps, NesquickComponent } from "../NesquickComponent";
|
|
2
|
-
import { NesquickFragment } from "../NesquickFragment";
|
|
3
|
-
export declare const Fragment: unique symbol;
|
|
4
|
-
export declare function functionizeProps(props: ComponentProps): void;
|
|
5
|
-
export declare function jsxs<P extends ComponentProps>(type: string | FunctionComponent<P> | typeof Fragment, props: P, key?: string | number | null): NesquickFragment | NesquickComponent<P>;
|
|
6
|
-
export declare const jsx: typeof jsxs;
|
|
7
|
-
type HasUndefined<T, K extends keyof T> = {
|
|
8
|
-
[L in K]-?: T[K] | undefined;
|
|
9
|
-
} extends {
|
|
10
|
-
[L in K]?: T[K];
|
|
11
|
-
} ? undefined extends T[K] ? true : false : false;
|
|
12
|
-
declare const WrappedFunctionType: unique symbol;
|
|
13
|
-
type WrappedFunction<T> = (() => T) & {
|
|
14
|
-
readonly [WrappedFunctionType]?: T;
|
|
15
|
-
};
|
|
16
|
-
type UserProp<T> = T extends (...args: infer A) => infer R ? (((...args: A) => R) | T) : WrappedFunction<T>;
|
|
17
|
-
type UserProps<T> = {
|
|
18
|
-
readonly [K in keyof T]: K extends keyof JSX.ElementChildrenAttribute ? T[K] : HasUndefined<T, K> extends true ? UserProp<T[K] | undefined> : UserProp<Exclude<T[K], undefined>>;
|
|
19
|
-
};
|
|
20
|
-
type JSXProp<T> = T extends {
|
|
21
|
-
readonly [WrappedFunctionType]?: infer R;
|
|
22
|
-
} ? (T | R) : T extends (...args: any[]) => any ? T : (T | (() => T));
|
|
23
|
-
type JSXProps<T> = keyof T extends never ? {} : {
|
|
24
|
-
[K in keyof T]: JSXProp<T[K]>;
|
|
25
|
-
};
|
|
26
|
-
export type Generic<T> = T extends (...args: any) => infer R ? R : T;
|
|
27
|
-
export { UserProps as Props };
|
|
28
|
-
export type Component<P = {}> = (props: UserProps<P>) => JSX.Element;
|
|
29
|
-
export declare namespace JSX {
|
|
30
|
-
export type JSXEvent<T extends Event, T2 extends EventTarget> = T & {
|
|
31
|
-
currentTarget: T2;
|
|
32
|
-
};
|
|
33
|
-
export type JSXHTMLEvent<T extends EventTarget> = {
|
|
34
|
-
[K in keyof HTMLElementEventMap as `on${Capitalize<K>}`]?: (e: JSXEvent<HTMLElementEventMap[K], T>) => void;
|
|
35
|
-
};
|
|
36
|
-
export type JSXSVGEvent<T extends EventTarget> = {
|
|
37
|
-
[K in keyof SVGElementEventMap as `on${Capitalize<K>}`]?: (e: JSXEvent<SVGElementEventMap[K], T>) => void;
|
|
38
|
-
};
|
|
39
|
-
export interface Props<T extends EventTarget = HTMLElement> extends JSXHTMLEvent<T>, JSXSVGEvent<T> {
|
|
40
|
-
[k: string]: any;
|
|
41
|
-
style?: Style;
|
|
42
|
-
xmlns?: string | null;
|
|
43
|
-
ref?: ((el: T) => void) | null;
|
|
44
|
-
}
|
|
45
|
-
export type Style = StyleProps | string;
|
|
46
|
-
export type StyleProps = {
|
|
47
|
-
[K in keyof CSSStyleDeclaration]?: CSSStyleDeclaration[K] extends Function ? never : CSSStyleDeclaration[K] | (() => CSSStyleDeclaration[K]);
|
|
48
|
-
};
|
|
49
|
-
export type HTMLProps<T extends HTMLElement = HTMLElement> = Props<T>;
|
|
50
|
-
export type SVGProps<T extends SVGElement = SVGElement> = Props<T>;
|
|
51
|
-
export type JSXElements = {
|
|
52
|
-
[K in keyof HTMLElementTagNameMap]: HTMLProps<HTMLElementTagNameMap[K]>;
|
|
53
|
-
} & {
|
|
54
|
-
[K in keyof SVGElementTagNameMap]: SVGProps<SVGElementTagNameMap[K]>;
|
|
55
|
-
};
|
|
56
|
-
export type Element = NesquickComponent<any>;
|
|
57
|
-
export interface IntrinsicElements extends JSXElements {
|
|
58
|
-
}
|
|
59
|
-
export type ElementType = keyof IntrinsicElements | Component<any> | typeof NesquickComponent<any>;
|
|
60
|
-
const NotEmptyObject: unique symbol;
|
|
61
|
-
export type IntrinsicAttributes = {
|
|
62
|
-
[NotEmptyObject]?: typeof NotEmptyObject;
|
|
63
|
-
};
|
|
64
|
-
export interface ElementAttributesProperty {
|
|
65
|
-
props: {};
|
|
66
|
-
}
|
|
67
|
-
export interface ElementChildrenAttribute {
|
|
68
|
-
children: {};
|
|
69
|
-
}
|
|
70
|
-
export type LibraryManagedAttributes<_, P> = JSXProps<P>;
|
|
71
|
-
export {};
|
|
72
|
-
}
|