etudes 1.0.0 → 1.1.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/{Map.d.ts → Each.d.ts} +2 -2
- package/lib/{Map.js → Each.js} +9 -7
- package/lib/Each.js.map +1 -0
- package/package.json +19 -19
- 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"]}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { ReactNode } from 'react';
|
|
2
2
|
export declare type Props<T> = {
|
|
3
3
|
children: ReactNode | ((value: T, index: number) => ReactNode);
|
|
4
|
-
|
|
4
|
+
list?: T[];
|
|
5
5
|
};
|
|
6
|
-
export default function
|
|
6
|
+
export default function Each<T>({ list, children, }: 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
|
|
29
|
-
if (
|
|
30
|
-
|
|
31
|
-
|
|
27
|
+
function Each(_a) {
|
|
28
|
+
var list = _a.list, children = _a.children;
|
|
29
|
+
if (list === undefined || list === null)
|
|
30
|
+
return react_1.default.createElement(react_1.default.Fragment, null);
|
|
31
|
+
if (!(list instanceof Array))
|
|
32
|
+
throw TypeError("Provided list must be an array: ".concat(list));
|
|
33
|
+
return (react_1.default.createElement(react_1.default.Fragment, null, list.map(function (v, i) { return (react_1.default.createElement(react_1.Fragment, { key: "item-".concat(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;AAOlD,SAAwB,IAAI,CAAI,EAGrB;QAFT,IAAI,UAAA,EACJ,QAAQ,cAAA;IAER,IAAI,IAAI,KAAK,SAAS,IAAI,IAAI,KAAK,IAAI;QAAE,OAAO,6DAAK,CAAA;IACrD,IAAI,CAAC,CAAC,IAAI,YAAY,KAAK,CAAC;QAAE,MAAM,SAAS,CAAC,0CAAmC,IAAI,CAAE,CAAC,CAAA;IAExF,OAAO,CACL,8DACG,IAAI,CAAC,GAAG,CAAC,UAAC,CAAC,EAAE,CAAC,IAAK,OAAA,CAClB,8BAAC,gBAAQ,IAAC,GAAG,EAAE,eAAQ,CAAC,CAAE,IACvB,OAAO,QAAQ,KAAK,UAAU,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC,QAAQ,CAClD,CACZ,EAJmB,CAInB,CAAC,CACD,CACJ,CAAA;AACH,CAAC;AAhBD,uBAgBC","sourcesContent":["import React, { Fragment, ReactNode } from 'react'\n\nexport type Props<T> = {\n children: ReactNode | ((value: T, index: number) => ReactNode)\n list?: T[]\n}\n\nexport default function Each<T>({\n list,\n children,\n}: Props<T>) {\n if (list === undefined || list === null) return <></>\n if (!(list instanceof Array)) throw TypeError(`Provided list must be an array: ${list}`)\n\n return (\n <>\n {list.map((v, i) => (\n <Fragment key={`item-${i}`}>\n {typeof children === 'function' ? children(v, 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": "1.
|
|
3
|
+
"version": "1.1.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.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"]}
|