@blockle/blocks-core 0.21.12 → 0.23.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/atoms/atomTypes.d.ts +1 -1
- package/dist/atoms/atoms.d.ts +1 -1
- package/dist/config/componentThemes.d.ts +2 -2
- package/dist/css/tokens.d.ts +1 -1
- package/dist/index.d.ts +22 -22
- package/dist/index.js +3 -4
- package/dist/theme/makeComponentTheme.d.ts +2 -2
- package/dist/theme/makeTheme.d.ts +2 -2
- package/dist/theme/makeVanillaTheme.d.ts +1 -1
- package/dist/theme/theme.d.ts +1 -1
- package/dist/utils/math/math.d.ts +1 -2
- package/dist/utils/math/math.js +4 -10
- package/dist/utils/math/math.test.d.ts +1 -0
- package/dist/utils/react/refs.d.ts +1 -0
- package/dist/utils/typing/helpers.d.ts +1 -1
- package/package.json +4 -12
- package/dist/atoms/atoms.cjs +0 -34
- package/dist/atoms/atoms.css.cjs +0 -119
- package/dist/atoms/defineProperties.cjs +0 -94
- package/dist/atoms/getAtomsAndProps.cjs +0 -16
- package/dist/css/breakpoint/breakpoint.cjs +0 -15
- package/dist/css/cssMatrixUtils.cjs +0 -64
- package/dist/css/layers.css.cjs +0 -18
- package/dist/css/rem.cjs +0 -6
- package/dist/css/tokens.cjs +0 -82
- package/dist/css/vars.css.cjs +0 -10
- package/dist/index.cjs +0 -44
- package/dist/theme/makeComponentTheme.cjs +0 -6
- package/dist/theme/makeTheme.cjs +0 -13
- package/dist/theme/makeVanillaTheme.cjs +0 -20
- package/dist/utils/classnames/classnames.cjs +0 -7
- package/dist/utils/dom/hasAnimationDuration.cjs +0 -13
- package/dist/utils/flexbox/flexbox.cjs +0 -17
- package/dist/utils/math/math.cjs +0 -13
- package/dist/utils/react/mergeProps.cjs +0 -47
- package/dist/utils/react/refs.cjs +0 -17
- package/dist/utils/typing/helpers.cjs +0 -6
package/dist/atoms/atoms.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { atomicProperties } from './atoms.css';
|
|
1
|
+
import { atomicProperties } from './atoms.css.js';
|
|
2
2
|
export type AtomicProperties = typeof atomicProperties;
|
|
3
3
|
export type AtomProperties = {
|
|
4
4
|
[K in keyof AtomicProperties]?: AtomicProperties[K]['values'] extends Record<string, {
|
package/dist/css/tokens.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { ThemeTokens } from '../config/themeTokens';
|
|
1
|
+
import { ThemeTokens } from '../config/themeTokens.js';
|
|
2
2
|
export declare const tokens: ThemeTokens;
|
package/dist/index.d.ts
CHANGED
|
@@ -1,22 +1,22 @@
|
|
|
1
|
-
export type { ComponentThemes, ComponentThemesProps, } from './config/componentThemes';
|
|
2
|
-
export type { ThemeTokens } from './config/themeTokens';
|
|
3
|
-
export { breakpointNames, minMediaQuery } from './css/breakpoint/breakpoint';
|
|
4
|
-
export { blocksLayer, blocksLayerAtom, blocksLayerComponent, } from './css/layers.css';
|
|
5
|
-
export { rem } from './css/rem';
|
|
6
|
-
export { vars } from './css/vars.css';
|
|
7
|
-
export { makeComponentTheme } from './theme/makeComponentTheme';
|
|
8
|
-
export type { ComponentTheme, ThemeComponentsStyles, } from './theme/makeComponentTheme';
|
|
9
|
-
export { makeTheme } from './theme/makeTheme';
|
|
10
|
-
export type { Theme } from './theme/makeTheme';
|
|
11
|
-
export { classnames } from './utils/classnames/classnames';
|
|
12
|
-
export { hasAnimationDuration } from './utils/dom/hasAnimationDuration';
|
|
13
|
-
export { alignItemsMap, justifyContentMap, type AlignItemsMap, type JustifyContentMap, } from './utils/flexbox/flexbox';
|
|
14
|
-
export {
|
|
15
|
-
export { mergeProps } from './utils/react/mergeProps';
|
|
16
|
-
export { composeRefs } from './utils/react/refs';
|
|
17
|
-
export { isObjectLike, type AnyString, type HTMLElementProps, type IsNumberUnion, type IsStringUnion, type IsUnion, type OptionalLiteral, type RecordLike, } from './utils/typing/helpers';
|
|
18
|
-
export {
|
|
19
|
-
export {
|
|
20
|
-
export type { MarginAtoms, PaddingAtoms, TextAtoms } from './atoms/atomTypes';
|
|
21
|
-
export { getAtomsAndProps } from './atoms/getAtomsAndProps';
|
|
22
|
-
export { cssValueToNumber, getCSSScale, getOriginalElementSize, parseCSSTransform, } from './css/cssMatrixUtils';
|
|
1
|
+
export type { ComponentThemes, ComponentThemesProps, } from './config/componentThemes.js';
|
|
2
|
+
export type { ThemeTokens } from './config/themeTokens.js';
|
|
3
|
+
export { breakpointNames, minMediaQuery } from './css/breakpoint/breakpoint.js';
|
|
4
|
+
export { blocksLayer, blocksLayerAtom, blocksLayerComponent, } from './css/layers.css.js';
|
|
5
|
+
export { rem } from './css/rem.js';
|
|
6
|
+
export { vars } from './css/vars.css.js';
|
|
7
|
+
export { makeComponentTheme } from './theme/makeComponentTheme.js';
|
|
8
|
+
export type { ComponentTheme, ThemeComponentsStyles, } from './theme/makeComponentTheme.js';
|
|
9
|
+
export { makeTheme } from './theme/makeTheme.js';
|
|
10
|
+
export type { Theme } from './theme/makeTheme.js';
|
|
11
|
+
export { classnames } from './utils/classnames/classnames.js';
|
|
12
|
+
export { hasAnimationDuration } from './utils/dom/hasAnimationDuration.js';
|
|
13
|
+
export { alignItemsMap, justifyContentMap, type AlignItemsMap, type JustifyContentMap, } from './utils/flexbox/flexbox.js';
|
|
14
|
+
export { clampAndRoundValue } from './utils/math/math.js';
|
|
15
|
+
export { mergeProps } from './utils/react/mergeProps.js';
|
|
16
|
+
export { composeRefs } from './utils/react/refs.js';
|
|
17
|
+
export { isObjectLike, type AnyString, type HTMLElementProps, type IsNumberUnion, type IsStringUnion, type IsUnion, type OptionalLiteral, type RecordLike, } from './utils/typing/helpers.js';
|
|
18
|
+
export { atomicProperties } from './atoms/atoms.css.js';
|
|
19
|
+
export { atoms, type Atoms } from './atoms/atoms.js';
|
|
20
|
+
export type { MarginAtoms, PaddingAtoms, TextAtoms, } from './atoms/atomTypes.js';
|
|
21
|
+
export { getAtomsAndProps } from './atoms/getAtomsAndProps.js';
|
|
22
|
+
export { cssValueToNumber, getCSSScale, getOriginalElementSize, parseCSSTransform, } from './css/cssMatrixUtils.js';
|
package/dist/index.js
CHANGED
|
@@ -7,12 +7,12 @@ import { makeTheme } from "./theme/makeTheme.js";
|
|
|
7
7
|
import { classnames } from "./utils/classnames/classnames.js";
|
|
8
8
|
import { hasAnimationDuration } from "./utils/dom/hasAnimationDuration.js";
|
|
9
9
|
import { alignItemsMap, justifyContentMap } from "./utils/flexbox/flexbox.js";
|
|
10
|
-
import {
|
|
10
|
+
import { clampAndRoundValue } from "./utils/math/math.js";
|
|
11
11
|
import { mergeProps } from "./utils/react/mergeProps.js";
|
|
12
12
|
import { composeRefs } from "./utils/react/refs.js";
|
|
13
13
|
import { isObjectLike } from "./utils/typing/helpers.js";
|
|
14
|
-
import { atoms } from "./atoms/atoms.js";
|
|
15
14
|
import { atomicProperties } from "./atoms/atoms.css.js";
|
|
15
|
+
import { atoms } from "./atoms/atoms.js";
|
|
16
16
|
import { getAtomsAndProps } from "./atoms/getAtomsAndProps.js";
|
|
17
17
|
import { cssValueToNumber, getCSSScale, getOriginalElementSize, parseCSSTransform } from "./css/cssMatrixUtils.js";
|
|
18
18
|
export {
|
|
@@ -23,11 +23,11 @@ export {
|
|
|
23
23
|
blocksLayerAtom,
|
|
24
24
|
blocksLayerComponent,
|
|
25
25
|
breakpointNames,
|
|
26
|
+
clampAndRoundValue,
|
|
26
27
|
classnames,
|
|
27
28
|
composeRefs,
|
|
28
29
|
cssValueToNumber,
|
|
29
30
|
getAtomsAndProps,
|
|
30
|
-
getBoundValue,
|
|
31
31
|
getCSSScale,
|
|
32
32
|
getOriginalElementSize,
|
|
33
33
|
hasAnimationDuration,
|
|
@@ -39,6 +39,5 @@ export {
|
|
|
39
39
|
minMediaQuery,
|
|
40
40
|
parseCSSTransform,
|
|
41
41
|
rem,
|
|
42
|
-
roundToPrecision,
|
|
43
42
|
vars
|
|
44
43
|
};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { ComponentThemes } from '../config/componentThemes';
|
|
2
|
-
import { RecordLike } from '../utils/typing/helpers';
|
|
1
|
+
import { ComponentThemes } from '../config/componentThemes.js';
|
|
2
|
+
import { RecordLike } from '../utils/typing/helpers.js';
|
|
3
3
|
type VariantsToStyle<T extends RecordLike> = {
|
|
4
4
|
[K in keyof T]?: T[K] extends string | number ? Partial<Record<T[K], string>> : T[K] extends boolean ? string : never;
|
|
5
5
|
};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { ThemeTokens } from '../config/themeTokens';
|
|
2
|
-
import { ThemeComponentsStyles } from './makeComponentTheme';
|
|
1
|
+
import { ThemeTokens } from '../config/themeTokens.js';
|
|
2
|
+
import { ThemeComponentsStyles } from './makeComponentTheme.js';
|
|
3
3
|
type ThemeInput = {
|
|
4
4
|
name: string;
|
|
5
5
|
tokens: ThemeTokens;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { ThemeTokens } from '../config/themeTokens';
|
|
1
|
+
import { ThemeTokens } from '../config/themeTokens.js';
|
|
2
2
|
export declare const makeVanillaTheme: (tokens: ThemeTokens) => {
|
|
3
3
|
space: Record<keyof typeof tokens.spacing, string>;
|
|
4
4
|
borderRadius: Record<keyof typeof tokens.border.radius, string>;
|
package/dist/theme/theme.d.ts
CHANGED
|
@@ -1,2 +1 @@
|
|
|
1
|
-
export declare function
|
|
2
|
-
export declare function getBoundValue(newValue: number, min: number, max: number, step: number): number;
|
|
1
|
+
export declare function clampAndRoundValue(newValue: number, min: number, max: number, step: number): number;
|
package/dist/utils/math/math.js
CHANGED
|
@@ -1,13 +1,7 @@
|
|
|
1
|
-
function
|
|
2
|
-
const
|
|
3
|
-
return Math.
|
|
4
|
-
}
|
|
5
|
-
function getBoundValue(newValue, min, max, step) {
|
|
6
|
-
let value = Math.round(newValue / step) * step;
|
|
7
|
-
value = Math.max(min, Math.min(max, value));
|
|
8
|
-
return value;
|
|
1
|
+
function clampAndRoundValue(newValue, min, max, step) {
|
|
2
|
+
const value = Math.round(newValue / step) * step;
|
|
3
|
+
return Math.max(min, Math.min(max, value));
|
|
9
4
|
}
|
|
10
5
|
export {
|
|
11
|
-
|
|
12
|
-
roundToPrecision
|
|
6
|
+
clampAndRoundValue
|
|
13
7
|
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
package/package.json
CHANGED
|
@@ -1,25 +1,18 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@blockle/blocks-core",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.23.0",
|
|
4
4
|
"description": "Core for Blocks",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"sideEffects": false,
|
|
7
7
|
"exports": {
|
|
8
8
|
".": {
|
|
9
|
-
"types":
|
|
10
|
-
|
|
11
|
-
"require": "./dist/index.d.ts"
|
|
12
|
-
},
|
|
13
|
-
"import": "./dist/index.js",
|
|
14
|
-
"require": "./dist/index.cjs"
|
|
9
|
+
"types": "./dist/index.d.ts",
|
|
10
|
+
"import": "./dist/index.js"
|
|
15
11
|
}
|
|
16
12
|
},
|
|
17
13
|
"files": [
|
|
18
14
|
"dist"
|
|
19
15
|
],
|
|
20
|
-
"main": "./dist/index.cjs",
|
|
21
|
-
"module": "./dist/index.js",
|
|
22
|
-
"types": "./dist/index.d.ts",
|
|
23
16
|
"scripts": {
|
|
24
17
|
"build": "vite build",
|
|
25
18
|
"test": "vitest ",
|
|
@@ -41,7 +34,6 @@
|
|
|
41
34
|
"@vanilla-extract/css": "^1.17.1"
|
|
42
35
|
},
|
|
43
36
|
"peerDependencies": {
|
|
44
|
-
"
|
|
45
|
-
"react-dom": "^19"
|
|
37
|
+
"@vanilla-extract/css": ">= 1.17.1"
|
|
46
38
|
}
|
|
47
39
|
}
|
package/dist/atoms/atoms.cjs
DELETED
|
@@ -1,34 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
|
-
const atoms_css = require("./atoms.css.cjs");
|
|
4
|
-
function atoms(properties) {
|
|
5
|
-
const classList = [];
|
|
6
|
-
for (const property in properties) {
|
|
7
|
-
const value = properties[property];
|
|
8
|
-
const target = atoms_css.atomicProperties[property];
|
|
9
|
-
if (!target) {
|
|
10
|
-
continue;
|
|
11
|
-
}
|
|
12
|
-
if (typeof value === "string" || typeof value === "number") {
|
|
13
|
-
if (target.values[value] !== void 0) {
|
|
14
|
-
classList.push(target.values[value].defaultClass);
|
|
15
|
-
}
|
|
16
|
-
} else if (Array.isArray(value)) {
|
|
17
|
-
value.forEach((val, i) => {
|
|
18
|
-
const atomicValue = target.values[val];
|
|
19
|
-
if (i === 0) {
|
|
20
|
-
if (atomicValue) {
|
|
21
|
-
classList.push(atomicValue.defaultClass);
|
|
22
|
-
}
|
|
23
|
-
return;
|
|
24
|
-
}
|
|
25
|
-
if (!(atomicValue == null ? void 0 : atomicValue.conditions[i])) {
|
|
26
|
-
return;
|
|
27
|
-
}
|
|
28
|
-
classList.push(atomicValue == null ? void 0 : atomicValue.conditions[i]);
|
|
29
|
-
});
|
|
30
|
-
}
|
|
31
|
-
}
|
|
32
|
-
return classList.join(" ");
|
|
33
|
-
}
|
|
34
|
-
exports.atoms = atoms;
|
package/dist/atoms/atoms.css.cjs
DELETED
|
@@ -1,119 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
|
-
const fileScope = require("@vanilla-extract/css/fileScope");
|
|
4
|
-
const breakpoint = require("../css/breakpoint/breakpoint.cjs");
|
|
5
|
-
const vars_css = require("../css/vars.css.cjs");
|
|
6
|
-
const defineProperties = require("./defineProperties.cjs");
|
|
7
|
-
fileScope.setFileScope("src/atoms/atoms.css.ts", "@blockle/blocks-core");
|
|
8
|
-
const colorsWithCurrentColor = { ...vars_css.vars.color, currentColor: "currentColor" };
|
|
9
|
-
const size = { auto: "auto", full: "100%", "fit-content": "fit-content" };
|
|
10
|
-
const marginSpace = { auto: "auto", ...vars_css.vars.space };
|
|
11
|
-
const unresponsiveAtomicProperties = defineProperties.defineProperties({
|
|
12
|
-
properties: {
|
|
13
|
-
appearance: ["none"],
|
|
14
|
-
backgroundColor: colorsWithCurrentColor,
|
|
15
|
-
blockSize: size,
|
|
16
|
-
border: ["none"],
|
|
17
|
-
borderColor: colorsWithCurrentColor,
|
|
18
|
-
borderRadius: vars_css.vars.borderRadius,
|
|
19
|
-
borderWidth: vars_css.vars.borderWidth,
|
|
20
|
-
boxShadow: vars_css.vars.shadow,
|
|
21
|
-
color: colorsWithCurrentColor,
|
|
22
|
-
cursor: ["auto", "pointer"],
|
|
23
|
-
fontFamily: vars_css.vars.fontFamily,
|
|
24
|
-
fontStyle: ["normal", "italic", "oblique"],
|
|
25
|
-
fontWeight: vars_css.vars.fontWeight,
|
|
26
|
-
inlineSize: size,
|
|
27
|
-
insetBlock: [0],
|
|
28
|
-
insetBlockEnd: [0],
|
|
29
|
-
insetBlockStart: [0],
|
|
30
|
-
insetInline: [0],
|
|
31
|
-
insetInlineEnd: [0],
|
|
32
|
-
insetInlineStart: [0],
|
|
33
|
-
lineHeight: vars_css.vars.lineHeight,
|
|
34
|
-
maxBlockSize: size,
|
|
35
|
-
maxInlineSize: size,
|
|
36
|
-
opacity: [0, 1],
|
|
37
|
-
outline: ["none"],
|
|
38
|
-
overflow: ["hidden", "scroll", "visible", "auto"],
|
|
39
|
-
overflowBlock: ["hidden", "scroll", "visible", "auto"],
|
|
40
|
-
overflowInline: ["hidden", "scroll", "visible", "auto"],
|
|
41
|
-
pointerEvents: ["none"],
|
|
42
|
-
textDecoration: ["overline", "line-through", "underline", "none"],
|
|
43
|
-
textTransform: ["lowercase", "uppercase", "capitalize"],
|
|
44
|
-
textWrap: ["balance", "wrap"],
|
|
45
|
-
transition: vars_css.vars.transition,
|
|
46
|
-
userSelect: ["none"],
|
|
47
|
-
whiteSpace: ["nowrap", "pre", "pre-line", "pre-wrap"],
|
|
48
|
-
wordBreak: ["break-word"],
|
|
49
|
-
wordWrap: ["break-word"],
|
|
50
|
-
textAlign: ["center", "left", "right", "justify"]
|
|
51
|
-
}
|
|
52
|
-
});
|
|
53
|
-
const responsiveAtomicProperties = defineProperties.defineProperties({
|
|
54
|
-
conditions: [
|
|
55
|
-
{},
|
|
56
|
-
{
|
|
57
|
-
"@media": breakpoint.minMediaQuery("tablet")
|
|
58
|
-
},
|
|
59
|
-
{
|
|
60
|
-
"@media": breakpoint.minMediaQuery("desktop")
|
|
61
|
-
},
|
|
62
|
-
{
|
|
63
|
-
"@media": breakpoint.minMediaQuery("wide")
|
|
64
|
-
}
|
|
65
|
-
],
|
|
66
|
-
properties: {
|
|
67
|
-
alignContent: ["stretch", "center", "flex-start", "flex-end"],
|
|
68
|
-
alignItems: ["stretch", "center", "flex-start", "flex-end"],
|
|
69
|
-
alignSelf: ["stretch", "center", "flex-start", "flex-end"],
|
|
70
|
-
placeItems: ["stretch", "center", "flex-start", "flex-end"],
|
|
71
|
-
columnGap: vars_css.vars.space,
|
|
72
|
-
display: [
|
|
73
|
-
"none",
|
|
74
|
-
"flex",
|
|
75
|
-
"inline-flex",
|
|
76
|
-
"block",
|
|
77
|
-
"inline",
|
|
78
|
-
"inline-block",
|
|
79
|
-
"grid",
|
|
80
|
-
"inline-grid"
|
|
81
|
-
],
|
|
82
|
-
flex: [1],
|
|
83
|
-
flexDirection: ["row", "row-reverse", "column", "column-reverse"],
|
|
84
|
-
flexGrow: [0, 1],
|
|
85
|
-
flexShrink: [0, 1],
|
|
86
|
-
flexWrap: ["nowrap", "wrap"],
|
|
87
|
-
fontSize: vars_css.vars.fontSize,
|
|
88
|
-
gap: vars_css.vars.space,
|
|
89
|
-
justifyContent: [
|
|
90
|
-
"flex-start",
|
|
91
|
-
"flex-end",
|
|
92
|
-
"center",
|
|
93
|
-
"space-between",
|
|
94
|
-
"space-around"
|
|
95
|
-
],
|
|
96
|
-
margin: marginSpace,
|
|
97
|
-
marginBlock: marginSpace,
|
|
98
|
-
marginBlockEnd: marginSpace,
|
|
99
|
-
marginBlockStart: marginSpace,
|
|
100
|
-
marginInline: marginSpace,
|
|
101
|
-
marginInlineEnd: marginSpace,
|
|
102
|
-
marginInlineStart: marginSpace,
|
|
103
|
-
padding: vars_css.vars.space,
|
|
104
|
-
paddingBlock: vars_css.vars.space,
|
|
105
|
-
paddingBlockEnd: vars_css.vars.space,
|
|
106
|
-
paddingBlockStart: vars_css.vars.space,
|
|
107
|
-
paddingInline: vars_css.vars.space,
|
|
108
|
-
paddingInlineEnd: vars_css.vars.space,
|
|
109
|
-
paddingInlineStart: vars_css.vars.space,
|
|
110
|
-
position: ["relative", "fixed", "absolute", "sticky", "static"],
|
|
111
|
-
rowGap: vars_css.vars.space
|
|
112
|
-
}
|
|
113
|
-
});
|
|
114
|
-
const atomicProperties = {
|
|
115
|
-
...responsiveAtomicProperties,
|
|
116
|
-
...unresponsiveAtomicProperties
|
|
117
|
-
};
|
|
118
|
-
fileScope.endFileScope();
|
|
119
|
-
exports.atomicProperties = atomicProperties;
|
|
@@ -1,94 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
|
-
const css = require("@vanilla-extract/css");
|
|
4
|
-
const layers_css = require("../css/layers.css.cjs");
|
|
5
|
-
function defineProperties({
|
|
6
|
-
properties,
|
|
7
|
-
conditions
|
|
8
|
-
}) {
|
|
9
|
-
const result = {};
|
|
10
|
-
for (const property in properties) {
|
|
11
|
-
const values = properties[property];
|
|
12
|
-
const propertyResult = {
|
|
13
|
-
values: {}
|
|
14
|
-
};
|
|
15
|
-
if (Array.isArray(values)) {
|
|
16
|
-
for (const value of values) {
|
|
17
|
-
const defaultClass = css.style({
|
|
18
|
-
"@layer": {
|
|
19
|
-
[layers_css.blocksLayerAtom]: {
|
|
20
|
-
[property]: value
|
|
21
|
-
}
|
|
22
|
-
}
|
|
23
|
-
});
|
|
24
|
-
const propResult = {
|
|
25
|
-
defaultClass
|
|
26
|
-
};
|
|
27
|
-
if (isValidConditionList(conditions)) {
|
|
28
|
-
propResult.conditions = conditions.map((condition, i) => {
|
|
29
|
-
if (i === 0 && Object.keys(condition).length === 0) {
|
|
30
|
-
return defaultClass;
|
|
31
|
-
}
|
|
32
|
-
if (typeof condition === "object" && condition["@media"]) {
|
|
33
|
-
return css.style({
|
|
34
|
-
"@layer": {
|
|
35
|
-
[layers_css.blocksLayerAtom]: {
|
|
36
|
-
"@media": {
|
|
37
|
-
[condition["@media"]]: {
|
|
38
|
-
[property]: value
|
|
39
|
-
}
|
|
40
|
-
}
|
|
41
|
-
}
|
|
42
|
-
}
|
|
43
|
-
});
|
|
44
|
-
}
|
|
45
|
-
throw new Error(
|
|
46
|
-
`Invalid condition for ${property}: ${JSON.stringify(condition)}`
|
|
47
|
-
);
|
|
48
|
-
});
|
|
49
|
-
}
|
|
50
|
-
propertyResult.values[value] = propResult;
|
|
51
|
-
}
|
|
52
|
-
result[property] = propertyResult;
|
|
53
|
-
continue;
|
|
54
|
-
}
|
|
55
|
-
for (const value in values) {
|
|
56
|
-
const defaultClass = css.style({
|
|
57
|
-
"@layer": {
|
|
58
|
-
[layers_css.blocksLayerAtom]: {
|
|
59
|
-
[property]: values[value]
|
|
60
|
-
}
|
|
61
|
-
}
|
|
62
|
-
});
|
|
63
|
-
const propResult = {
|
|
64
|
-
defaultClass
|
|
65
|
-
};
|
|
66
|
-
if (isValidConditionList(conditions)) {
|
|
67
|
-
propResult.conditions = conditions.map((condition, i) => {
|
|
68
|
-
if (i === 0 && Object.keys(condition).length === 0) {
|
|
69
|
-
return defaultClass;
|
|
70
|
-
}
|
|
71
|
-
if (typeof condition === "object" && condition["@media"]) {
|
|
72
|
-
return css.style({
|
|
73
|
-
"@media": {
|
|
74
|
-
[condition["@media"]]: {
|
|
75
|
-
[property]: values[value]
|
|
76
|
-
}
|
|
77
|
-
}
|
|
78
|
-
});
|
|
79
|
-
}
|
|
80
|
-
throw new Error(
|
|
81
|
-
`Invalid condition for ${property}: ${JSON.stringify(condition)}`
|
|
82
|
-
);
|
|
83
|
-
});
|
|
84
|
-
}
|
|
85
|
-
propertyResult.values[value] = propResult;
|
|
86
|
-
}
|
|
87
|
-
result[property] = propertyResult;
|
|
88
|
-
}
|
|
89
|
-
return result;
|
|
90
|
-
}
|
|
91
|
-
function isValidConditionList(condition) {
|
|
92
|
-
return Array.isArray(condition) && condition.length > 0;
|
|
93
|
-
}
|
|
94
|
-
exports.defineProperties = defineProperties;
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
|
-
const atoms_css = require("./atoms.css.cjs");
|
|
4
|
-
function getAtomsAndProps(props) {
|
|
5
|
-
const atomProps = {};
|
|
6
|
-
const otherProps = {};
|
|
7
|
-
for (const [name, value] of Object.entries(props)) {
|
|
8
|
-
if (atoms_css.atomicProperties.hasOwnProperty(name)) {
|
|
9
|
-
atomProps[name] = value;
|
|
10
|
-
} else {
|
|
11
|
-
otherProps[name] = value;
|
|
12
|
-
}
|
|
13
|
-
}
|
|
14
|
-
return [atomProps, otherProps];
|
|
15
|
-
}
|
|
16
|
-
exports.getAtomsAndProps = getAtomsAndProps;
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
|
-
const breakpointNames = ["mobile", "tablet", "desktop", "wide"];
|
|
4
|
-
const breakpoints = {
|
|
5
|
-
mobile: 0,
|
|
6
|
-
tablet: 740,
|
|
7
|
-
desktop: 992,
|
|
8
|
-
wide: 1200
|
|
9
|
-
};
|
|
10
|
-
function minMediaQuery(breakpoint) {
|
|
11
|
-
return `screen and (min-width: ${breakpoints[breakpoint]}px)`;
|
|
12
|
-
}
|
|
13
|
-
exports.breakpointNames = breakpointNames;
|
|
14
|
-
exports.breakpoints = breakpoints;
|
|
15
|
-
exports.minMediaQuery = minMediaQuery;
|
|
@@ -1,64 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
|
-
const CSSMatrixValuePattern = /matrix\((.*?)\)/;
|
|
4
|
-
function parseCSSTransform(styleDeclaration) {
|
|
5
|
-
const transform = styleDeclaration.getPropertyValue("transform");
|
|
6
|
-
if (!transform || !CSSMatrixValuePattern.test(transform)) {
|
|
7
|
-
return {
|
|
8
|
-
a: 1,
|
|
9
|
-
b: 0,
|
|
10
|
-
c: 0,
|
|
11
|
-
d: 1,
|
|
12
|
-
tx: 0,
|
|
13
|
-
ty: 0
|
|
14
|
-
};
|
|
15
|
-
}
|
|
16
|
-
const matrixMatch = transform.match(CSSMatrixValuePattern);
|
|
17
|
-
if (!matrixMatch || !matrixMatch[1]) {
|
|
18
|
-
throw new Error(`Invalid matrix value: ${transform}`);
|
|
19
|
-
}
|
|
20
|
-
const matrixValues = matrixMatch[1].split(",").map((value) => cssValueToNumber(value.trim()));
|
|
21
|
-
if (matrixValues.length !== 6) {
|
|
22
|
-
throw new Error("Invalid matrix value");
|
|
23
|
-
}
|
|
24
|
-
return {
|
|
25
|
-
a: matrixValues[0],
|
|
26
|
-
b: matrixValues[1],
|
|
27
|
-
c: matrixValues[2],
|
|
28
|
-
d: matrixValues[3],
|
|
29
|
-
tx: matrixValues[4],
|
|
30
|
-
ty: matrixValues[5]
|
|
31
|
-
};
|
|
32
|
-
}
|
|
33
|
-
function getCSSScale(styleDeclaration) {
|
|
34
|
-
const scale = styleDeclaration.getPropertyValue("scale");
|
|
35
|
-
if (!scale || scale === "none") {
|
|
36
|
-
const matrix2d = parseCSSTransform(styleDeclaration);
|
|
37
|
-
const scaleX = Math.sqrt(matrix2d.a * matrix2d.a + matrix2d.b * matrix2d.b);
|
|
38
|
-
const scaleY = Math.sqrt(matrix2d.c * matrix2d.c + matrix2d.d * matrix2d.d);
|
|
39
|
-
return [scaleX, scaleY];
|
|
40
|
-
}
|
|
41
|
-
if (scale.includes(" ")) {
|
|
42
|
-
return scale.split(" ").map((value) => cssValueToNumber(value));
|
|
43
|
-
}
|
|
44
|
-
const scaleValue = cssValueToNumber(scale);
|
|
45
|
-
return [scaleValue, scaleValue];
|
|
46
|
-
}
|
|
47
|
-
function getOriginalElementSize(styleDeclaration, width, height) {
|
|
48
|
-
const [scaleX, scaleY] = getCSSScale(styleDeclaration);
|
|
49
|
-
return [width / scaleX, height / scaleY];
|
|
50
|
-
}
|
|
51
|
-
function cssValueToNumber(value) {
|
|
52
|
-
if (!value) {
|
|
53
|
-
return 0;
|
|
54
|
-
}
|
|
55
|
-
const parsedValue = Number.parseFloat(value);
|
|
56
|
-
if (Number.isNaN(parsedValue)) {
|
|
57
|
-
return 0;
|
|
58
|
-
}
|
|
59
|
-
return parsedValue;
|
|
60
|
-
}
|
|
61
|
-
exports.cssValueToNumber = cssValueToNumber;
|
|
62
|
-
exports.getCSSScale = getCSSScale;
|
|
63
|
-
exports.getOriginalElementSize = getOriginalElementSize;
|
|
64
|
-
exports.parseCSSTransform = parseCSSTransform;
|
package/dist/css/layers.css.cjs
DELETED
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
|
-
const fileScope = require("@vanilla-extract/css/fileScope");
|
|
4
|
-
const css = require("@vanilla-extract/css");
|
|
5
|
-
fileScope.setFileScope("src/css/layers.css.ts", "@blockle/blocks-core");
|
|
6
|
-
const blocksLayerAtom = css.layer("blocks-atom");
|
|
7
|
-
const blocksLayerComponent = css.layer(
|
|
8
|
-
{ parent: blocksLayerAtom },
|
|
9
|
-
"blocks-component"
|
|
10
|
-
);
|
|
11
|
-
const blocksLayer = css.layer(
|
|
12
|
-
{ parent: blocksLayerComponent },
|
|
13
|
-
"blockle-blocks"
|
|
14
|
-
);
|
|
15
|
-
fileScope.endFileScope();
|
|
16
|
-
exports.blocksLayer = blocksLayer;
|
|
17
|
-
exports.blocksLayerAtom = blocksLayerAtom;
|
|
18
|
-
exports.blocksLayerComponent = blocksLayerComponent;
|
package/dist/css/rem.cjs
DELETED
package/dist/css/tokens.cjs
DELETED
|
@@ -1,82 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
|
-
const tokens = {
|
|
4
|
-
typography: {
|
|
5
|
-
fontFamily: {
|
|
6
|
-
body: "Roboto, sans-serif",
|
|
7
|
-
primary: "Roboto, sans-serif",
|
|
8
|
-
secondary: "Roboto, sans-serif"
|
|
9
|
-
},
|
|
10
|
-
fontSize: {
|
|
11
|
-
xsmall: "0.75rem",
|
|
12
|
-
small: "0.875rem",
|
|
13
|
-
medium: "1rem",
|
|
14
|
-
large: "1.125rem",
|
|
15
|
-
xlarge: "1.25rem"
|
|
16
|
-
},
|
|
17
|
-
fontWeight: {
|
|
18
|
-
regular: 400,
|
|
19
|
-
medium: 500,
|
|
20
|
-
strong: 700
|
|
21
|
-
},
|
|
22
|
-
lineHeight: {
|
|
23
|
-
xsmall: "1rem",
|
|
24
|
-
small: "1.25rem",
|
|
25
|
-
medium: "1.5rem",
|
|
26
|
-
large: "1.75rem",
|
|
27
|
-
xlarge: "2rem"
|
|
28
|
-
}
|
|
29
|
-
},
|
|
30
|
-
spacing: {
|
|
31
|
-
none: 0,
|
|
32
|
-
gutter: "1rem",
|
|
33
|
-
xsmall: "0.25rem",
|
|
34
|
-
small: "0.5rem",
|
|
35
|
-
medium: "1rem",
|
|
36
|
-
large: "1.5rem",
|
|
37
|
-
xlarge: "2rem"
|
|
38
|
-
},
|
|
39
|
-
transition: {
|
|
40
|
-
slow: "500ms",
|
|
41
|
-
normal: "300ms",
|
|
42
|
-
fast: "100ms"
|
|
43
|
-
},
|
|
44
|
-
border: {
|
|
45
|
-
radius: {
|
|
46
|
-
small: "0.25rem",
|
|
47
|
-
medium: "0.5rem",
|
|
48
|
-
large: "1rem",
|
|
49
|
-
xlarge: "2rem"
|
|
50
|
-
},
|
|
51
|
-
width: {
|
|
52
|
-
small: "1px",
|
|
53
|
-
medium: "2px",
|
|
54
|
-
large: "4px"
|
|
55
|
-
}
|
|
56
|
-
},
|
|
57
|
-
shadow: {
|
|
58
|
-
small: "0 1px 2px 0 rgba(0, 0, 0, 0.05)",
|
|
59
|
-
medium: "0 2px 4px 0 rgba(0, 0, 0, 0.05)",
|
|
60
|
-
large: "0 4px 8px 0 rgba(0, 0, 0, 0.05)"
|
|
61
|
-
},
|
|
62
|
-
focus: {
|
|
63
|
-
boxShadow: "0 0 0 2px #AF8EFF"
|
|
64
|
-
},
|
|
65
|
-
color: {
|
|
66
|
-
black: "#000000",
|
|
67
|
-
white: "#ffffff",
|
|
68
|
-
body: "#ffffff",
|
|
69
|
-
primaryLight: "#f5f5f5",
|
|
70
|
-
primary: "#e0e0e0",
|
|
71
|
-
primaryDark: "#aeaeae",
|
|
72
|
-
secondaryLight: "#f5f5f5",
|
|
73
|
-
secondary: "#e0e0e0",
|
|
74
|
-
secondaryDark: "#aeaeae",
|
|
75
|
-
text: "#000000",
|
|
76
|
-
textLight: "#ffffff",
|
|
77
|
-
textDark: "#aeaeae",
|
|
78
|
-
danger: "#ff0000",
|
|
79
|
-
link: "#0000ff"
|
|
80
|
-
}
|
|
81
|
-
};
|
|
82
|
-
exports.tokens = tokens;
|
package/dist/css/vars.css.cjs
DELETED
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
|
-
const fileScope = require("@vanilla-extract/css/fileScope");
|
|
4
|
-
const css = require("@vanilla-extract/css");
|
|
5
|
-
const makeVanillaTheme = require("../theme/makeVanillaTheme.cjs");
|
|
6
|
-
const tokens = require("./tokens.cjs");
|
|
7
|
-
fileScope.setFileScope("src/css/vars.css.ts", "@blockle/blocks-core");
|
|
8
|
-
const vars = css.createThemeContract(makeVanillaTheme.makeVanillaTheme(tokens.tokens));
|
|
9
|
-
fileScope.endFileScope();
|
|
10
|
-
exports.vars = vars;
|
package/dist/index.cjs
DELETED
|
@@ -1,44 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
|
-
const breakpoint = require("./css/breakpoint/breakpoint.cjs");
|
|
4
|
-
const layers_css = require("./css/layers.css.cjs");
|
|
5
|
-
const rem = require("./css/rem.cjs");
|
|
6
|
-
const vars_css = require("./css/vars.css.cjs");
|
|
7
|
-
const makeComponentTheme = require("./theme/makeComponentTheme.cjs");
|
|
8
|
-
const makeTheme = require("./theme/makeTheme.cjs");
|
|
9
|
-
const classnames = require("./utils/classnames/classnames.cjs");
|
|
10
|
-
const hasAnimationDuration = require("./utils/dom/hasAnimationDuration.cjs");
|
|
11
|
-
const flexbox = require("./utils/flexbox/flexbox.cjs");
|
|
12
|
-
const math = require("./utils/math/math.cjs");
|
|
13
|
-
const mergeProps = require("./utils/react/mergeProps.cjs");
|
|
14
|
-
const refs = require("./utils/react/refs.cjs");
|
|
15
|
-
const helpers = require("./utils/typing/helpers.cjs");
|
|
16
|
-
const atoms = require("./atoms/atoms.cjs");
|
|
17
|
-
const atoms_css = require("./atoms/atoms.css.cjs");
|
|
18
|
-
const getAtomsAndProps = require("./atoms/getAtomsAndProps.cjs");
|
|
19
|
-
const cssMatrixUtils = require("./css/cssMatrixUtils.cjs");
|
|
20
|
-
exports.breakpointNames = breakpoint.breakpointNames;
|
|
21
|
-
exports.minMediaQuery = breakpoint.minMediaQuery;
|
|
22
|
-
exports.blocksLayer = layers_css.blocksLayer;
|
|
23
|
-
exports.blocksLayerAtom = layers_css.blocksLayerAtom;
|
|
24
|
-
exports.blocksLayerComponent = layers_css.blocksLayerComponent;
|
|
25
|
-
exports.rem = rem.rem;
|
|
26
|
-
exports.vars = vars_css.vars;
|
|
27
|
-
exports.makeComponentTheme = makeComponentTheme.makeComponentTheme;
|
|
28
|
-
exports.makeTheme = makeTheme.makeTheme;
|
|
29
|
-
exports.classnames = classnames.classnames;
|
|
30
|
-
exports.hasAnimationDuration = hasAnimationDuration.hasAnimationDuration;
|
|
31
|
-
exports.alignItemsMap = flexbox.alignItemsMap;
|
|
32
|
-
exports.justifyContentMap = flexbox.justifyContentMap;
|
|
33
|
-
exports.getBoundValue = math.getBoundValue;
|
|
34
|
-
exports.roundToPrecision = math.roundToPrecision;
|
|
35
|
-
exports.mergeProps = mergeProps.mergeProps;
|
|
36
|
-
exports.composeRefs = refs.composeRefs;
|
|
37
|
-
exports.isObjectLike = helpers.isObjectLike;
|
|
38
|
-
exports.atoms = atoms.atoms;
|
|
39
|
-
exports.atomicProperties = atoms_css.atomicProperties;
|
|
40
|
-
exports.getAtomsAndProps = getAtomsAndProps.getAtomsAndProps;
|
|
41
|
-
exports.cssValueToNumber = cssMatrixUtils.cssValueToNumber;
|
|
42
|
-
exports.getCSSScale = cssMatrixUtils.getCSSScale;
|
|
43
|
-
exports.getOriginalElementSize = cssMatrixUtils.getOriginalElementSize;
|
|
44
|
-
exports.parseCSSTransform = cssMatrixUtils.parseCSSTransform;
|
package/dist/theme/makeTheme.cjs
DELETED
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
|
-
const css = require("@vanilla-extract/css");
|
|
4
|
-
const vars_css = require("../css/vars.css.cjs");
|
|
5
|
-
const makeVanillaTheme = require("./makeVanillaTheme.cjs");
|
|
6
|
-
function makeTheme(theme) {
|
|
7
|
-
return {
|
|
8
|
-
name: theme.name,
|
|
9
|
-
vars: css.createTheme(vars_css.vars, makeVanillaTheme.makeVanillaTheme(theme.tokens)),
|
|
10
|
-
components: theme.components
|
|
11
|
-
};
|
|
12
|
-
}
|
|
13
|
-
exports.makeTheme = makeTheme;
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
|
-
const makeVanillaTheme = (tokens) => {
|
|
4
|
-
return {
|
|
5
|
-
space: tokens.spacing,
|
|
6
|
-
borderRadius: tokens.border.radius,
|
|
7
|
-
color: tokens.color,
|
|
8
|
-
borderWidth: tokens.border.width,
|
|
9
|
-
fontFamily: tokens.typography.fontFamily,
|
|
10
|
-
fontSize: tokens.typography.fontSize,
|
|
11
|
-
fontWeight: tokens.typography.fontWeight,
|
|
12
|
-
lineHeight: tokens.typography.lineHeight,
|
|
13
|
-
transition: tokens.transition,
|
|
14
|
-
shadow: tokens.shadow,
|
|
15
|
-
focus: {
|
|
16
|
-
boxShadow: tokens.focus.boxShadow
|
|
17
|
-
}
|
|
18
|
-
};
|
|
19
|
-
};
|
|
20
|
-
exports.makeVanillaTheme = makeVanillaTheme;
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
|
-
const classnames = (...args) => {
|
|
4
|
-
const className = args.filter((arg) => arg && typeof arg === "string").join(" ");
|
|
5
|
-
return className || void 0;
|
|
6
|
-
};
|
|
7
|
-
exports.classnames = classnames;
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
|
-
function hasAnimationDuration(element) {
|
|
4
|
-
if (!element) {
|
|
5
|
-
return false;
|
|
6
|
-
}
|
|
7
|
-
const style = window.getComputedStyle(element);
|
|
8
|
-
return hasDuration(style.transitionDuration) || hasDuration(style.animationDuration);
|
|
9
|
-
}
|
|
10
|
-
function hasDuration(duration) {
|
|
11
|
-
return duration.split(",").map((part) => Number.parseFloat(part.trim())).some((part) => part > 0);
|
|
12
|
-
}
|
|
13
|
-
exports.hasAnimationDuration = hasAnimationDuration;
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
|
-
const justifyContentMap = {
|
|
4
|
-
left: "flex-start",
|
|
5
|
-
right: "flex-end",
|
|
6
|
-
center: "center",
|
|
7
|
-
between: "space-between",
|
|
8
|
-
around: "space-around"
|
|
9
|
-
};
|
|
10
|
-
const alignItemsMap = {
|
|
11
|
-
left: "flex-start",
|
|
12
|
-
right: "flex-end",
|
|
13
|
-
center: "center",
|
|
14
|
-
stretch: "stretch"
|
|
15
|
-
};
|
|
16
|
-
exports.alignItemsMap = alignItemsMap;
|
|
17
|
-
exports.justifyContentMap = justifyContentMap;
|
package/dist/utils/math/math.cjs
DELETED
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
|
-
function roundToPrecision(value, precision) {
|
|
4
|
-
const factor = 10 ** precision;
|
|
5
|
-
return Math.round(value * factor) / factor;
|
|
6
|
-
}
|
|
7
|
-
function getBoundValue(newValue, min, max, step) {
|
|
8
|
-
let value = Math.round(newValue / step) * step;
|
|
9
|
-
value = Math.max(min, Math.min(max, value));
|
|
10
|
-
return value;
|
|
11
|
-
}
|
|
12
|
-
exports.getBoundValue = getBoundValue;
|
|
13
|
-
exports.roundToPrecision = roundToPrecision;
|
|
@@ -1,47 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
|
-
const classnames = require("../classnames/classnames.cjs");
|
|
4
|
-
const refs = require("./refs.cjs");
|
|
5
|
-
function mergeProps(slotProps, childProps) {
|
|
6
|
-
const overrideProps = {};
|
|
7
|
-
for (const propName in childProps) {
|
|
8
|
-
const slotPropValue = slotProps[propName];
|
|
9
|
-
const childPropValue = childProps[propName];
|
|
10
|
-
if (childPropValue === void 0) {
|
|
11
|
-
continue;
|
|
12
|
-
}
|
|
13
|
-
if (slotPropValue === void 0) {
|
|
14
|
-
overrideProps[propName] = childPropValue;
|
|
15
|
-
continue;
|
|
16
|
-
}
|
|
17
|
-
if (typeof slotPropValue === "function" && typeof childPropValue === "function") {
|
|
18
|
-
overrideProps[propName] = (...args) => {
|
|
19
|
-
childPropValue(...args);
|
|
20
|
-
slotPropValue(...args);
|
|
21
|
-
};
|
|
22
|
-
} else {
|
|
23
|
-
switch (propName) {
|
|
24
|
-
case "style": {
|
|
25
|
-
overrideProps[propName] = { ...slotPropValue, ...childPropValue };
|
|
26
|
-
break;
|
|
27
|
-
}
|
|
28
|
-
case "className": {
|
|
29
|
-
overrideProps[propName] = classnames.classnames(slotPropValue, childPropValue);
|
|
30
|
-
break;
|
|
31
|
-
}
|
|
32
|
-
case "ref": {
|
|
33
|
-
overrideProps[propName] = refs.composeRefs(
|
|
34
|
-
slotPropValue,
|
|
35
|
-
childPropValue
|
|
36
|
-
);
|
|
37
|
-
break;
|
|
38
|
-
}
|
|
39
|
-
default: {
|
|
40
|
-
overrideProps[propName] = childPropValue;
|
|
41
|
-
}
|
|
42
|
-
}
|
|
43
|
-
}
|
|
44
|
-
}
|
|
45
|
-
return { ...slotProps, ...overrideProps };
|
|
46
|
-
}
|
|
47
|
-
exports.mergeProps = mergeProps;
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
|
-
function setRef(ref, value) {
|
|
4
|
-
if (typeof ref === "function") {
|
|
5
|
-
ref(value);
|
|
6
|
-
} else if (ref !== null && ref !== void 0) {
|
|
7
|
-
ref.current = value;
|
|
8
|
-
}
|
|
9
|
-
}
|
|
10
|
-
function composeRefs(...refs) {
|
|
11
|
-
return (node) => {
|
|
12
|
-
for (const ref of refs) {
|
|
13
|
-
setRef(ref, node);
|
|
14
|
-
}
|
|
15
|
-
};
|
|
16
|
-
}
|
|
17
|
-
exports.composeRefs = composeRefs;
|