etudes 0.65.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.
@@ -6,12 +6,16 @@ Object.defineProperty(exports, "__esModule", { value: true });
6
6
  var react_1 = __importDefault(require("react"));
7
7
  function Conditional(_a) {
8
8
  var children = _a.children, boolOrExpression = _a.if;
9
- if (typeof boolOrExpression === 'boolean' && boolOrExpression === true)
10
- return react_1.default.createElement(react_1.default.Fragment, null, children);
11
- if (typeof boolOrExpression === 'function' && boolOrExpression() === true)
12
- return react_1.default.createElement(react_1.default.Fragment, null, children);
13
- console.error("[etudes::Conditional] The type of provided condition ".concat(boolOrExpression, " is not supported."));
14
- return react_1.default.createElement(react_1.default.Fragment, null);
9
+ switch (typeof boolOrExpression) {
10
+ case 'boolean':
11
+ return boolOrExpression ? react_1.default.createElement(react_1.default.Fragment, null, children) : react_1.default.createElement(react_1.default.Fragment, null);
12
+ case 'function':
13
+ return boolOrExpression() ? react_1.default.createElement(react_1.default.Fragment, null, children) : react_1.default.createElement(react_1.default.Fragment, null);
14
+ default:
15
+ // eslint-disable-next-line no-console
16
+ console.error("[etudes::Conditional] The type of provided condition ".concat(boolOrExpression, " is not supported."));
17
+ return react_1.default.createElement(react_1.default.Fragment, null);
18
+ }
15
19
  }
16
20
  exports.default = Conditional;
17
21
  //# sourceMappingURL=Conditional.js.map
@@ -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,IAAI,OAAO,gBAAgB,KAAK,SAAS,IAAI,gBAAgB,KAAK,IAAI;QAAE,OAAO,8DAAG,QAAQ,CAAI,CAAA;IAC9F,IAAI,OAAO,gBAAgB,KAAK,UAAU,IAAI,gBAAgB,EAAE,KAAK,IAAI;QAAE,OAAO,8DAAG,QAAQ,CAAI,CAAA;IACjG,OAAO,CAAC,KAAK,CAAC,+DAAwD,gBAAgB,uBAAoB,CAAC,CAAA;IAC3G,OAAO,6DAAK,CAAA;AACd,CAAC;AALD,8BAKC","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 if (typeof boolOrExpression === 'boolean' && boolOrExpression === true) return <>{children}</>\n if (typeof boolOrExpression === 'function' && boolOrExpression() === true) return <>{children}</>\n console.error(`[etudes::Conditional] The type of provided condition ${boolOrExpression} is not supported.`)\n return <></>\n}\n"]}
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
- array?: T[];
4
+ list?: T[];
5
5
  };
6
- export default function Map<T>({ array, children, }: Props<T>): JSX.Element;
6
+ export default function Each<T>({ list, children, }: Props<T>): JSX.Element;
@@ -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 Map(_a) {
28
- var array = _a.array, children = _a.children;
29
- if (!(array instanceof Array))
30
- throw TypeError("Provided collection must be an array: ".concat(array));
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: "element-".concat(i) }, typeof children === 'function' ? children(v, i) : children)); })));
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 = Map;
34
- //# sourceMappingURL=Map.js.map
35
+ exports.default = Each;
36
+ //# sourceMappingURL=Each.js.map
@@ -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": "0.65.0",
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.6",
33
- "@babel/plugin-transform-runtime": "^7.18.6",
34
- "@babel/preset-env": "^7.18.6",
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.6",
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.15",
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.25",
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.30.5",
48
- "@typescript-eslint/parser": "^5.30.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.2.2",
51
+ "concurrently": "^7.3.0",
52
52
  "cross-env": "^7.0.3",
53
53
  "debug": "^4.3.4",
54
- "eslint": "^8.19.0",
54
+ "eslint": "^8.22.0",
55
55
  "file-loader": "^6.2.0",
56
56
  "html-webpack-plugin": "^5.5.0",
57
- "promptu": "^5.8.0",
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.8.2",
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.73.0",
70
+ "webpack": "^5.74.0",
71
71
  "webpack-cli": "^4.10.0",
72
- "webpack-dev-server": "^4.9.3"
72
+ "webpack-dev-server": "^4.10.0"
73
73
  },
74
74
  "dependencies": {
75
75
  "classnames": "^2.3.1",
76
- "dirty-dom": "^7.1.0",
77
- "interactjs": "^1.10.14",
76
+ "dirty-dom": "^7.2.0",
77
+ "interactjs": "^1.10.17",
78
78
  "lodash": "^4.17.21",
79
- "react-transition-group": "^4.4.2",
79
+ "react-transition-group": "^4.4.5",
80
80
  "resize-observer-polyfill": "^1.5.1",
81
- "spase": "^6.3.0"
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"]}