@react-foundry/component-helpers 0.1.9 → 0.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/dist/classes.js +5 -10
- package/dist/index.js +1 -17
- package/package.json +6 -8
- package/dist/classes.mjs +0 -22
- package/dist/index.mjs +0 -1
package/dist/classes.js
CHANGED
|
@@ -1,27 +1,22 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.classBuilder = exports.id = void 0;
|
|
4
1
|
// Define a pointless component to coax react-docgen-typescript-loader
|
|
5
2
|
const StandardComponent = (props) => null;
|
|
6
|
-
const id = (v) => v;
|
|
7
|
-
exports.id = id;
|
|
3
|
+
export const id = (v) => v;
|
|
8
4
|
const concatClasses = (...classes) => (
|
|
9
5
|
// @ts-ignore
|
|
10
6
|
classes
|
|
11
7
|
.flat(Infinity)
|
|
12
|
-
.filter(
|
|
8
|
+
.filter(id)
|
|
13
9
|
.join(' ') || undefined);
|
|
14
10
|
const toArray = (v) => (Array.isArray(v)
|
|
15
11
|
? v
|
|
16
12
|
: v && [v]);
|
|
17
|
-
const classBuilder = (blockDefault, blockOverride, blockModifiers, extra) => {
|
|
13
|
+
export const classBuilder = (blockDefault, blockOverride, blockModifiers, extra) => {
|
|
18
14
|
const block = blockOverride || blockDefault;
|
|
19
15
|
const bModifiers = toArray(blockModifiers);
|
|
20
16
|
return (element, elementModifiers, extra2) => {
|
|
21
17
|
const eModifiers = toArray(elementModifiers);
|
|
22
18
|
return (element
|
|
23
|
-
? concatClasses(`${block}__${element}`, eModifiers?.filter(
|
|
24
|
-
: concatClasses(`${block}`, bModifiers?.filter(
|
|
19
|
+
? concatClasses(`${block}__${element}`, eModifiers?.filter(id).map(modifier => `${block}__${element}--${modifier}`), extra2)
|
|
20
|
+
: concatClasses(`${block}`, bModifiers?.filter(id).map(modifier => `${block}--${modifier}`), extra));
|
|
25
21
|
};
|
|
26
22
|
};
|
|
27
|
-
exports.classBuilder = classBuilder;
|
package/dist/index.js
CHANGED
|
@@ -1,17 +1 @@
|
|
|
1
|
-
|
|
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
|
-
__exportStar(require("./classes"), exports);
|
|
1
|
+
export * from './classes';
|
package/package.json
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@react-foundry/component-helpers",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.2.0",
|
|
4
4
|
"description": "Helper functions for writing components.",
|
|
5
|
+
"type": "module",
|
|
5
6
|
"main": "dist/index.js",
|
|
6
7
|
"exports": {
|
|
7
8
|
".": {
|
|
8
9
|
"types": "./dist/index.d.ts",
|
|
9
|
-
"import": "./dist/index.
|
|
10
|
-
"
|
|
11
|
-
"default": "./dist/index.mjs"
|
|
10
|
+
"import": "./dist/index.js",
|
|
11
|
+
"default": "./dist/index.js"
|
|
12
12
|
}
|
|
13
13
|
},
|
|
14
14
|
"files": [
|
|
@@ -21,11 +21,9 @@
|
|
|
21
21
|
},
|
|
22
22
|
"scripts": {
|
|
23
23
|
"test": "echo \"Error: no test specified\" && exit 1",
|
|
24
|
-
"build": "
|
|
25
|
-
"build:esm": "tsc -m es2022 && find dist -name '*.js' -exec sh -c 'mv \"$0\" \"${0%.js}.mjs\"' {} \\;",
|
|
26
|
-
"build:cjs": "tsc",
|
|
24
|
+
"build": "tsc",
|
|
27
25
|
"clean": "rm -rf dist tsconfig.tsbuildinfo"
|
|
28
26
|
},
|
|
29
|
-
"module": "dist/index.
|
|
27
|
+
"module": "dist/index.js",
|
|
30
28
|
"typings": "dist/index.d.ts"
|
|
31
29
|
}
|
package/dist/classes.mjs
DELETED
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
// Define a pointless component to coax react-docgen-typescript-loader
|
|
2
|
-
const StandardComponent = (props) => null;
|
|
3
|
-
export const id = (v) => v;
|
|
4
|
-
const concatClasses = (...classes) => (
|
|
5
|
-
// @ts-ignore
|
|
6
|
-
classes
|
|
7
|
-
.flat(Infinity)
|
|
8
|
-
.filter(id)
|
|
9
|
-
.join(' ') || undefined);
|
|
10
|
-
const toArray = (v) => (Array.isArray(v)
|
|
11
|
-
? v
|
|
12
|
-
: v && [v]);
|
|
13
|
-
export const classBuilder = (blockDefault, blockOverride, blockModifiers, extra) => {
|
|
14
|
-
const block = blockOverride || blockDefault;
|
|
15
|
-
const bModifiers = toArray(blockModifiers);
|
|
16
|
-
return (element, elementModifiers, extra2) => {
|
|
17
|
-
const eModifiers = toArray(elementModifiers);
|
|
18
|
-
return (element
|
|
19
|
-
? concatClasses(`${block}__${element}`, eModifiers?.filter(id).map(modifier => `${block}__${element}--${modifier}`), extra2)
|
|
20
|
-
: concatClasses(`${block}`, bModifiers?.filter(id).map(modifier => `${block}--${modifier}`), extra));
|
|
21
|
-
};
|
|
22
|
-
};
|
package/dist/index.mjs
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export * from './classes';
|