etudes 0.66.0 → 1.2.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/Conditional.js +1 -0
- package/lib/Conditional.js.map +1 -1
- package/lib/Each.d.ts +7 -0
- package/lib/{Map.js → Each.js} +8 -6
- package/lib/Each.js.map +1 -0
- package/lib/Repeat.d.ts +3 -2
- package/lib/Repeat.js +2 -2
- package/lib/Repeat.js.map +1 -1
- package/package.json +19 -19
- package/lib/Map.d.ts +0 -6
- package/lib/Map.js.map +0 -1
package/lib/Conditional.js
CHANGED
|
@@ -12,6 +12,7 @@ function Conditional(_a) {
|
|
|
12
12
|
case 'function':
|
|
13
13
|
return boolOrExpression() ? react_1.default.createElement(react_1.default.Fragment, null, children) : react_1.default.createElement(react_1.default.Fragment, null);
|
|
14
14
|
default:
|
|
15
|
+
// eslint-disable-next-line no-console
|
|
15
16
|
console.error("[etudes::Conditional] The type of provided condition ".concat(boolOrExpression, " is not supported."));
|
|
16
17
|
return react_1.default.createElement(react_1.default.Fragment, null);
|
|
17
18
|
}
|
package/lib/Conditional.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Conditional.js","sourceRoot":"/","sources":["Conditional.tsx"],"names":[],"mappings":";;;;;AAAA,gDAAgD;AAMhD,SAAwB,WAAW,CAAC,EAAyC;QAAvC,QAAQ,cAAA,EAAM,gBAAgB,QAAA;IAClE,QAAQ,OAAO,gBAAgB,EAAE;QACjC,KAAK,SAAS;YACZ,OAAO,gBAAgB,CAAC,CAAC,CAAC,8DAAG,QAAQ,CAAI,CAAC,CAAC,CAAC,6DAAK,CAAA;QACnD,KAAK,UAAU;YACb,OAAO,gBAAgB,EAAE,CAAC,CAAC,CAAC,8DAAG,QAAQ,CAAI,CAAC,CAAC,CAAC,6DAAK,CAAA;QACrD;YACE,OAAO,CAAC,KAAK,CAAC,+DAAwD,gBAAgB,uBAAoB,CAAC,CAAA;YAC3G,OAAO,6DAAK,CAAA;KACb;AACH,CAAC;
|
|
1
|
+
{"version":3,"file":"Conditional.js","sourceRoot":"/","sources":["Conditional.tsx"],"names":[],"mappings":";;;;;AAAA,gDAAgD;AAMhD,SAAwB,WAAW,CAAC,EAAyC;QAAvC,QAAQ,cAAA,EAAM,gBAAgB,QAAA;IAClE,QAAQ,OAAO,gBAAgB,EAAE;QACjC,KAAK,SAAS;YACZ,OAAO,gBAAgB,CAAC,CAAC,CAAC,8DAAG,QAAQ,CAAI,CAAC,CAAC,CAAC,6DAAK,CAAA;QACnD,KAAK,UAAU;YACb,OAAO,gBAAgB,EAAE,CAAC,CAAC,CAAC,8DAAG,QAAQ,CAAI,CAAC,CAAC,CAAC,6DAAK,CAAA;QACrD;YACE,sCAAsC;YACtC,OAAO,CAAC,KAAK,CAAC,+DAAwD,gBAAgB,uBAAoB,CAAC,CAAA;YAC3G,OAAO,6DAAK,CAAA;KACb;AACH,CAAC;AAXD,8BAWC","sourcesContent":["import React, { PropsWithChildren } from 'react'\n\ntype Props = PropsWithChildren<{\n if: boolean | (() => boolean)\n}>\n\nexport default function Conditional({ children, if: boolOrExpression }: Props) {\n switch (typeof boolOrExpression) {\n case 'boolean':\n return boolOrExpression ? <>{children}</> : <></>\n case 'function':\n return boolOrExpression() ? <>{children}</> : <></>\n default:\n // eslint-disable-next-line no-console\n console.error(`[etudes::Conditional] The type of provided condition ${boolOrExpression} is not supported.`)\n return <></>\n }\n}\n"]}
|
package/lib/Each.d.ts
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { ReactNode } from 'react';
|
|
2
|
+
export declare type Props<T> = {
|
|
3
|
+
children?: ReactNode | ((value: T, index: number) => ReactNode);
|
|
4
|
+
in?: T[];
|
|
5
|
+
render?: (value: T, index: number) => ReactNode;
|
|
6
|
+
};
|
|
7
|
+
export default function Each<T>({ in: array, children, render, }: Props<T>): JSX.Element;
|
package/lib/{Map.js → Each.js}
RENAMED
|
@@ -24,11 +24,13 @@ var __importStar = (this && this.__importStar) || function (mod) {
|
|
|
24
24
|
};
|
|
25
25
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
26
26
|
var react_1 = __importStar(require("react"));
|
|
27
|
-
function
|
|
28
|
-
var array = _a.
|
|
27
|
+
function Each(_a) {
|
|
28
|
+
var array = _a.in, children = _a.children, render = _a.render;
|
|
29
|
+
if (array === undefined || array === null)
|
|
30
|
+
return react_1.default.createElement(react_1.default.Fragment, null);
|
|
29
31
|
if (!(array instanceof Array))
|
|
30
|
-
throw TypeError("Provided
|
|
31
|
-
return (react_1.default.createElement(react_1.default.Fragment, null, array.map(function (v, i) { return (react_1.default.createElement(react_1.Fragment, { key: "
|
|
32
|
+
throw TypeError("Provided list <".concat(array, "> is not an array"));
|
|
33
|
+
return (react_1.default.createElement(react_1.default.Fragment, null, array.map(function (v, i) { return (react_1.default.createElement(react_1.Fragment, { key: "item-".concat(i) }, render ? render(v, i) : typeof children === 'function' ? children(v, i) : children)); })));
|
|
32
34
|
}
|
|
33
|
-
exports.default =
|
|
34
|
-
//# sourceMappingURL=
|
|
35
|
+
exports.default = Each;
|
|
36
|
+
//# sourceMappingURL=Each.js.map
|
package/lib/Each.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Each.js","sourceRoot":"/","sources":["Each.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;AAAA,6CAAkD;AAQlD,SAAwB,IAAI,CAAI,EAIrB;QAHL,KAAK,QAAA,EACT,QAAQ,cAAA,EACR,MAAM,YAAA;IAEN,IAAI,KAAK,KAAK,SAAS,IAAI,KAAK,KAAK,IAAI;QAAE,OAAO,6DAAK,CAAA;IACvD,IAAI,CAAC,CAAC,KAAK,YAAY,KAAK,CAAC;QAAE,MAAM,SAAS,CAAC,yBAAkB,KAAK,sBAAmB,CAAC,CAAA;IAE1F,OAAO,CACL,8DACG,KAAK,CAAC,GAAG,CAAC,UAAC,CAAC,EAAE,CAAC,IAAK,OAAA,CACnB,8BAAC,gBAAQ,IAAC,GAAG,EAAE,eAAQ,CAAC,CAAE,IACvB,MAAM,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC,OAAO,QAAQ,KAAK,UAAU,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC,QAAQ,CAC1E,CACZ,EAJoB,CAIpB,CAAC,CACD,CACJ,CAAA;AACH,CAAC;AAjBD,uBAiBC","sourcesContent":["import React, { Fragment, ReactNode } from 'react'\n\nexport type Props<T> = {\n children?: ReactNode | ((value: T, index: number) => ReactNode)\n in?: T[]\n render?: (value: T, index: number) => ReactNode\n}\n\nexport default function Each<T>({\n in: array,\n children,\n render,\n}: Props<T>) {\n if (array === undefined || array === null) return <></>\n if (!(array instanceof Array)) throw TypeError(`Provided list <${array}> is not an array`)\n\n return (\n <>\n {array.map((v, i) => (\n <Fragment key={`item-${i}`}>\n {render ? render(v, i) : typeof children === 'function' ? children(v, i) : children}\n </Fragment>\n ))}\n </>\n )\n}\n"]}
|
package/lib/Repeat.d.ts
CHANGED
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
import { ReactNode } from 'react';
|
|
2
2
|
export declare type Props = {
|
|
3
|
-
children
|
|
3
|
+
children?: ReactNode | ((index: number) => ReactNode);
|
|
4
4
|
count?: number;
|
|
5
|
+
render?: (index: number) => ReactNode;
|
|
5
6
|
};
|
|
6
7
|
/**
|
|
7
8
|
* A tag-less component that repeats its children, automatically assigning each a unique key.
|
|
8
9
|
*/
|
|
9
|
-
export default function Repeat({ count, children, }: Props): JSX.Element;
|
|
10
|
+
export default function Repeat({ count, children, render, }: Props): JSX.Element;
|
package/lib/Repeat.js
CHANGED
|
@@ -53,8 +53,8 @@ var react_1 = __importStar(require("react"));
|
|
|
53
53
|
* A tag-less component that repeats its children, automatically assigning each a unique key.
|
|
54
54
|
*/
|
|
55
55
|
function Repeat(_a) {
|
|
56
|
-
var _b = _a.count, count = _b === void 0 ? 1 : _b, children = _a.children;
|
|
57
|
-
return (react_1.default.createElement(react_1.default.Fragment, null, __spreadArray([], __read(Array(count)), false).map(function (_, i) { return (react_1.default.createElement(react_1.Fragment, { key: "element-".concat(i) }, typeof children === 'function' ? children(i) : children)); })));
|
|
56
|
+
var _b = _a.count, count = _b === void 0 ? 1 : _b, children = _a.children, render = _a.render;
|
|
57
|
+
return (react_1.default.createElement(react_1.default.Fragment, null, __spreadArray([], __read(Array(count)), false).map(function (_, i) { return (react_1.default.createElement(react_1.Fragment, { key: "element-".concat(i) }, render ? render(i) : typeof children === 'function' ? children(i) : children)); })));
|
|
58
58
|
}
|
|
59
59
|
exports.default = Repeat;
|
|
60
60
|
//# sourceMappingURL=Repeat.js.map
|
package/lib/Repeat.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Repeat.js","sourceRoot":"/","sources":["Repeat.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,6CAAkD;
|
|
1
|
+
{"version":3,"file":"Repeat.js","sourceRoot":"/","sources":["Repeat.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,6CAAkD;AAQlD;;GAEG;AACH,SAAwB,MAAM,CAAC,EAIvB;QAHN,aAAS,EAAT,KAAK,mBAAG,CAAC,KAAA,EACT,QAAQ,cAAA,EACR,MAAM,YAAA;IAEN,OAAO,CACL,8DACG,yBAAI,KAAK,CAAC,KAAK,CAAC,UAAE,GAAG,CAAC,UAAC,CAAC,EAAE,CAAC,IAAK,OAAA,CAC/B,8BAAC,gBAAQ,IAAC,GAAG,EAAE,kBAAW,CAAC,CAAE,IAC1B,MAAM,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,OAAO,QAAQ,KAAK,UAAU,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,QAAQ,CACpE,CACZ,EAJgC,CAIhC,CAAC,CACD,CACJ,CAAA;AACH,CAAC;AAdD,yBAcC","sourcesContent":["import React, { Fragment, ReactNode } from 'react'\n\nexport type Props = {\n children?: ReactNode | ((index: number) => ReactNode)\n count?: number\n render?: (index: number) => ReactNode\n}\n\n/**\n * A tag-less component that repeats its children, automatically assigning each a unique key.\n */\nexport default function Repeat({\n count = 1,\n children,\n render,\n}: Props) {\n return (\n <>\n {[...Array(count)].map((_, i) => (\n <Fragment key={`element-${i}`}>\n {render ? render(i) : typeof children === 'function' ? children(i) : children}\n </Fragment>\n ))}\n </>\n )\n}\n"]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "etudes",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "1.2.0",
|
|
4
4
|
"description": "A study of styled React components",
|
|
5
5
|
"main": "lib",
|
|
6
6
|
"scripts": {
|
|
@@ -29,32 +29,32 @@
|
|
|
29
29
|
"lib"
|
|
30
30
|
],
|
|
31
31
|
"devDependencies": {
|
|
32
|
-
"@babel/core": "^7.18.
|
|
33
|
-
"@babel/plugin-transform-runtime": "^7.18.
|
|
34
|
-
"@babel/preset-env": "^7.18.
|
|
32
|
+
"@babel/core": "^7.18.10",
|
|
33
|
+
"@babel/plugin-transform-runtime": "^7.18.10",
|
|
34
|
+
"@babel/preset-env": "^7.18.10",
|
|
35
35
|
"@babel/preset-react": "^7.18.6",
|
|
36
36
|
"@babel/preset-typescript": "^7.18.6",
|
|
37
|
-
"@babel/runtime": "^7.18.
|
|
37
|
+
"@babel/runtime": "^7.18.9",
|
|
38
38
|
"@types/debug": "^4.1.7",
|
|
39
39
|
"@types/html-webpack-plugin": "^3.2.6",
|
|
40
40
|
"@types/lodash": "^4.14.182",
|
|
41
|
-
"@types/react": "^18.0.
|
|
41
|
+
"@types/react": "^18.0.17",
|
|
42
42
|
"@types/react-dom": "^18.0.6",
|
|
43
43
|
"@types/react-transition-group": "^4.4.5",
|
|
44
|
-
"@types/styled-components": "^5.1.
|
|
44
|
+
"@types/styled-components": "^5.1.26",
|
|
45
45
|
"@types/webpack": "^5.28.0",
|
|
46
46
|
"@types/webpack-env": "^1.17.0",
|
|
47
|
-
"@typescript-eslint/eslint-plugin": "^5.
|
|
48
|
-
"@typescript-eslint/parser": "^5.
|
|
47
|
+
"@typescript-eslint/eslint-plugin": "^5.33.0",
|
|
48
|
+
"@typescript-eslint/parser": "^5.33.0",
|
|
49
49
|
"babel-loader": "^8.2.5",
|
|
50
50
|
"babel-plugin-styled-components": "^2.0.7",
|
|
51
|
-
"concurrently": "^7.
|
|
51
|
+
"concurrently": "^7.3.0",
|
|
52
52
|
"cross-env": "^7.0.3",
|
|
53
53
|
"debug": "^4.3.4",
|
|
54
|
-
"eslint": "^8.
|
|
54
|
+
"eslint": "^8.22.0",
|
|
55
55
|
"file-loader": "^6.2.0",
|
|
56
56
|
"html-webpack-plugin": "^5.5.0",
|
|
57
|
-
"promptu": "^5.
|
|
57
|
+
"promptu": "^5.9.0",
|
|
58
58
|
"raw-loader": "^4.0.2",
|
|
59
59
|
"react": "^18.2.0",
|
|
60
60
|
"react-dom": "^18.2.0",
|
|
@@ -63,22 +63,22 @@
|
|
|
63
63
|
"rimraf": "^3.0.2",
|
|
64
64
|
"styled-components": "^5.3.5",
|
|
65
65
|
"ts-loader": "^9.3.1",
|
|
66
|
-
"ts-node": "^10.
|
|
66
|
+
"ts-node": "^10.9.1",
|
|
67
67
|
"typescript": "^4.7.4",
|
|
68
68
|
"url-loader": "^4.1.1",
|
|
69
69
|
"wait-on": "^6.0.1",
|
|
70
|
-
"webpack": "^5.
|
|
70
|
+
"webpack": "^5.74.0",
|
|
71
71
|
"webpack-cli": "^4.10.0",
|
|
72
|
-
"webpack-dev-server": "^4.
|
|
72
|
+
"webpack-dev-server": "^4.10.0"
|
|
73
73
|
},
|
|
74
74
|
"dependencies": {
|
|
75
75
|
"classnames": "^2.3.1",
|
|
76
|
-
"dirty-dom": "^7.
|
|
77
|
-
"interactjs": "^1.10.
|
|
76
|
+
"dirty-dom": "^7.2.0",
|
|
77
|
+
"interactjs": "^1.10.17",
|
|
78
78
|
"lodash": "^4.17.21",
|
|
79
|
-
"react-transition-group": "^4.4.
|
|
79
|
+
"react-transition-group": "^4.4.5",
|
|
80
80
|
"resize-observer-polyfill": "^1.5.1",
|
|
81
|
-
"spase": "^6.
|
|
81
|
+
"spase": "^6.4.0"
|
|
82
82
|
},
|
|
83
83
|
"peerDependencies": {
|
|
84
84
|
"react": "^18.2.0",
|
package/lib/Map.d.ts
DELETED
package/lib/Map.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"Map.js","sourceRoot":"/","sources":["Map.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;AAAA,6CAAkD;AAOlD,SAAwB,GAAG,CAAI,EAGpB;QAFT,KAAK,WAAA,EACL,QAAQ,cAAA;IAER,IAAI,CAAC,CAAC,KAAK,YAAY,KAAK,CAAC;QAAE,MAAM,SAAS,CAAC,gDAAyC,KAAK,CAAE,CAAC,CAAA;IAEhG,OAAO,CACL,8DACG,KAAK,CAAC,GAAG,CAAC,UAAC,CAAC,EAAE,CAAC,IAAK,OAAA,CACnB,8BAAC,gBAAQ,IAAC,GAAG,EAAE,kBAAW,CAAC,CAAE,IAC1B,OAAO,QAAQ,KAAK,UAAU,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC,QAAQ,CAClD,CACZ,EAJoB,CAIpB,CAAC,CACD,CACJ,CAAA;AACH,CAAC;AAfD,sBAeC","sourcesContent":["import React, { Fragment, ReactNode } from 'react'\n\nexport type Props<T> = {\n children: ReactNode | ((value: T, index: number) => ReactNode)\n array?: T[]\n}\n\nexport default function Map<T>({\n array,\n children,\n}: Props<T>) {\n if (!(array instanceof Array)) throw TypeError(`Provided collection must be an array: ${array}`)\n\n return (\n <>\n {array.map((v, i) => (\n <Fragment key={`element-${i}`}>\n {typeof children === 'function' ? children(v, i) : children}\n </Fragment>\n ))}\n </>\n )\n}\n"]}
|