@blockle/blocks-core 0.21.3 → 0.21.5
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 +36 -0
- package/dist/atoms/atoms.cjs +28 -0
- package/dist/atoms/atoms.css.cjs +119 -0
- package/dist/atoms/atoms.css.d.ts +1498 -0
- package/dist/atoms/atoms.css.js +119 -0
- package/dist/atoms/atoms.d.ts +10 -0
- package/dist/atoms/atoms.js +28 -0
- package/dist/atoms/defineProperties.cjs +80 -0
- package/dist/atoms/defineProperties.d.ts +32 -0
- package/dist/atoms/defineProperties.js +80 -0
- package/dist/{sprinkles → atoms}/getAtomsAndProps.cjs +2 -2
- package/dist/atoms/getAtomsAndProps.d.ts +1 -0
- package/dist/{sprinkles → atoms}/getAtomsAndProps.js +2 -2
- package/dist/config/componentThemes.d.ts +3 -3
- package/dist/index.cjs +7 -7
- package/dist/index.d.ts +5 -5
- package/dist/index.js +7 -7
- package/dist/utils/react/mergeProps.cjs +6 -2
- package/dist/utils/react/mergeProps.d.ts +2 -2
- package/dist/utils/react/mergeProps.js +6 -2
- package/dist/utils/react/refs.d.ts +1 -1
- package/dist/utils/typing/helpers.d.ts +2 -2
- package/package.json +3 -3
- package/dist/sprinkles/atomTypes.d.ts +0 -36
- package/dist/sprinkles/atomicProperties.cjs +0 -91
- package/dist/sprinkles/atomicProperties.d.ts +0 -286
- package/dist/sprinkles/atomicProperties.js +0 -91
- package/dist/sprinkles/getAtomsAndProps.d.ts +0 -2
- package/dist/sprinkles/sprinkles.css.cjs +0 -52
- package/dist/sprinkles/sprinkles.css.d.ts +0 -234
- package/dist/sprinkles/sprinkles.css.js +0 -52
|
@@ -0,0 +1,119 @@
|
|
|
1
|
+
import { setFileScope, endFileScope } from "@vanilla-extract/css/fileScope";
|
|
2
|
+
import { minMediaQuery } from "../css/breakpoint/breakpoint.js";
|
|
3
|
+
import { vars } from "../css/vars.css.js";
|
|
4
|
+
import { defineProperties } from "./defineProperties.js";
|
|
5
|
+
setFileScope("src/atoms/atoms.css.ts", "@blockle/blocks-core");
|
|
6
|
+
const colorsWithCurrentColor = { ...vars.color, currentColor: "currentColor" };
|
|
7
|
+
const size = { auto: "auto", full: "100%", "fit-content": "fit-content" };
|
|
8
|
+
const marginSpace = { auto: "auto", ...vars.space };
|
|
9
|
+
const unresponsiveAtomicProperties = defineProperties({
|
|
10
|
+
properties: {
|
|
11
|
+
appearance: ["none"],
|
|
12
|
+
backgroundColor: colorsWithCurrentColor,
|
|
13
|
+
blockSize: size,
|
|
14
|
+
border: ["none"],
|
|
15
|
+
borderColor: colorsWithCurrentColor,
|
|
16
|
+
borderRadius: vars.borderRadius,
|
|
17
|
+
borderWidth: vars.borderWidth,
|
|
18
|
+
boxShadow: vars.shadow,
|
|
19
|
+
color: colorsWithCurrentColor,
|
|
20
|
+
cursor: ["auto", "pointer"],
|
|
21
|
+
fontFamily: vars.fontFamily,
|
|
22
|
+
fontStyle: ["normal", "italic", "oblique"],
|
|
23
|
+
fontWeight: vars.fontWeight,
|
|
24
|
+
inlineSize: size,
|
|
25
|
+
insetBlock: [0],
|
|
26
|
+
insetBlockEnd: [0],
|
|
27
|
+
insetBlockStart: [0],
|
|
28
|
+
insetInline: [0],
|
|
29
|
+
insetInlineEnd: [0],
|
|
30
|
+
insetInlineStart: [0],
|
|
31
|
+
lineHeight: vars.lineHeight,
|
|
32
|
+
maxBlockSize: size,
|
|
33
|
+
maxInlineSize: size,
|
|
34
|
+
opacity: [0, 1],
|
|
35
|
+
outline: ["none"],
|
|
36
|
+
overflow: ["hidden", "scroll", "visible", "auto"],
|
|
37
|
+
overflowBlock: ["hidden", "scroll", "visible", "auto"],
|
|
38
|
+
overflowInline: ["hidden", "scroll", "visible", "auto"],
|
|
39
|
+
pointerEvents: ["none"],
|
|
40
|
+
textDecoration: ["overline", "line-through", "underline", "none"],
|
|
41
|
+
textTransform: ["lowercase", "uppercase", "capitalize"],
|
|
42
|
+
textWrap: ["balance", "wrap"],
|
|
43
|
+
transition: vars.transition,
|
|
44
|
+
userSelect: ["none"],
|
|
45
|
+
whiteSpace: ["nowrap", "pre", "pre-line", "pre-wrap"],
|
|
46
|
+
wordBreak: ["break-word"],
|
|
47
|
+
wordWrap: ["break-word"],
|
|
48
|
+
textAlign: ["center", "left", "right", "justify"]
|
|
49
|
+
}
|
|
50
|
+
});
|
|
51
|
+
const responsiveAtomicProperties = defineProperties({
|
|
52
|
+
conditions: [
|
|
53
|
+
{},
|
|
54
|
+
{
|
|
55
|
+
"@media": minMediaQuery("tablet")
|
|
56
|
+
},
|
|
57
|
+
{
|
|
58
|
+
"@media": minMediaQuery("desktop")
|
|
59
|
+
},
|
|
60
|
+
{
|
|
61
|
+
"@media": minMediaQuery("wide")
|
|
62
|
+
}
|
|
63
|
+
],
|
|
64
|
+
properties: {
|
|
65
|
+
alignContent: ["stretch", "center", "flex-start", "flex-end"],
|
|
66
|
+
alignItems: ["stretch", "center", "flex-start", "flex-end"],
|
|
67
|
+
alignSelf: ["stretch", "center", "flex-start", "flex-end"],
|
|
68
|
+
placeItems: ["stretch", "center", "flex-start", "flex-end"],
|
|
69
|
+
columnGap: vars.space,
|
|
70
|
+
display: [
|
|
71
|
+
"none",
|
|
72
|
+
"flex",
|
|
73
|
+
"inline-flex",
|
|
74
|
+
"block",
|
|
75
|
+
"inline",
|
|
76
|
+
"inline-block",
|
|
77
|
+
"grid",
|
|
78
|
+
"inline-grid"
|
|
79
|
+
],
|
|
80
|
+
flex: [1],
|
|
81
|
+
flexDirection: ["row", "row-reverse", "column", "column-reverse"],
|
|
82
|
+
flexGrow: [0, 1],
|
|
83
|
+
flexShrink: [0, 1],
|
|
84
|
+
flexWrap: ["nowrap", "wrap"],
|
|
85
|
+
fontSize: vars.fontSize,
|
|
86
|
+
gap: vars.space,
|
|
87
|
+
justifyContent: [
|
|
88
|
+
"flex-start",
|
|
89
|
+
"flex-end",
|
|
90
|
+
"center",
|
|
91
|
+
"space-between",
|
|
92
|
+
"space-around"
|
|
93
|
+
],
|
|
94
|
+
margin: marginSpace,
|
|
95
|
+
marginBlock: marginSpace,
|
|
96
|
+
marginBlockEnd: marginSpace,
|
|
97
|
+
marginBlockStart: marginSpace,
|
|
98
|
+
marginInline: marginSpace,
|
|
99
|
+
marginInlineEnd: marginSpace,
|
|
100
|
+
marginInlineStart: marginSpace,
|
|
101
|
+
padding: vars.space,
|
|
102
|
+
paddingBlock: vars.space,
|
|
103
|
+
paddingBlockEnd: vars.space,
|
|
104
|
+
paddingBlockStart: vars.space,
|
|
105
|
+
paddingInline: vars.space,
|
|
106
|
+
paddingInlineEnd: vars.space,
|
|
107
|
+
paddingInlineStart: vars.space,
|
|
108
|
+
position: ["relative", "fixed", "absolute", "sticky", "static"],
|
|
109
|
+
rowGap: vars.space
|
|
110
|
+
}
|
|
111
|
+
});
|
|
112
|
+
const atomicProperties = {
|
|
113
|
+
...responsiveAtomicProperties,
|
|
114
|
+
...unresponsiveAtomicProperties
|
|
115
|
+
};
|
|
116
|
+
endFileScope();
|
|
117
|
+
export {
|
|
118
|
+
atomicProperties
|
|
119
|
+
};
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { atomicProperties } from './atoms.css';
|
|
2
|
+
export type AtomicProperties = typeof atomicProperties;
|
|
3
|
+
export type AtomProperties = {
|
|
4
|
+
[K in keyof AtomicProperties]?: AtomicProperties[K]['values'] extends Record<string, {
|
|
5
|
+
defaultClass: string;
|
|
6
|
+
conditions: string[];
|
|
7
|
+
}> ? keyof AtomicProperties[K]['values'] | (keyof AtomicProperties[K]['values'])[] : keyof AtomicProperties[K]['values'];
|
|
8
|
+
};
|
|
9
|
+
export declare function atoms(properties: AtomProperties): string;
|
|
10
|
+
export type Atoms = Parameters<typeof atoms>[0];
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { atomicProperties } from "./atoms.css.js";
|
|
2
|
+
function atoms(properties) {
|
|
3
|
+
const classList = [];
|
|
4
|
+
for (const property in properties) {
|
|
5
|
+
const value = properties[property];
|
|
6
|
+
const target = atomicProperties[property];
|
|
7
|
+
if (typeof value === "string") {
|
|
8
|
+
if (target.values[value]) {
|
|
9
|
+
classList.push(target.values[value].defaultClass);
|
|
10
|
+
}
|
|
11
|
+
} else if (Array.isArray(value)) {
|
|
12
|
+
value.forEach((val, i) => {
|
|
13
|
+
var _a;
|
|
14
|
+
if (i === 0) {
|
|
15
|
+
if (target.values[val]) {
|
|
16
|
+
classList.push(target.values[val].defaultClass);
|
|
17
|
+
}
|
|
18
|
+
} else {
|
|
19
|
+
classList.push(((_a = target.values[val]) == null ? void 0 : _a.conditions[i]) ?? "");
|
|
20
|
+
}
|
|
21
|
+
});
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
return classList.join(" ");
|
|
25
|
+
}
|
|
26
|
+
export {
|
|
27
|
+
atoms
|
|
28
|
+
};
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
|
+
const css = require("@vanilla-extract/css");
|
|
4
|
+
function defineProperties({
|
|
5
|
+
properties,
|
|
6
|
+
conditions
|
|
7
|
+
}) {
|
|
8
|
+
const result = {};
|
|
9
|
+
for (const property in properties) {
|
|
10
|
+
const values = properties[property];
|
|
11
|
+
result[property] = {
|
|
12
|
+
values: {}
|
|
13
|
+
};
|
|
14
|
+
const ref = result[property];
|
|
15
|
+
if (!ref || !ref.values) {
|
|
16
|
+
throw new Error(`Invalid property definition for ${property}`);
|
|
17
|
+
}
|
|
18
|
+
if (Array.isArray(values)) {
|
|
19
|
+
for (const value of values) {
|
|
20
|
+
const defaultClass = css.style({
|
|
21
|
+
[property]: value
|
|
22
|
+
});
|
|
23
|
+
ref.values[value] = {
|
|
24
|
+
defaultClass,
|
|
25
|
+
conditions: conditions == null ? void 0 : conditions.map((condition, i) => {
|
|
26
|
+
if (i === 0 && Object.keys(condition).length === 0) {
|
|
27
|
+
return defaultClass;
|
|
28
|
+
}
|
|
29
|
+
if (typeof condition === "object" && condition["@media"]) {
|
|
30
|
+
return css.style({
|
|
31
|
+
"@media": {
|
|
32
|
+
[condition["@media"]]: {
|
|
33
|
+
[property]: value
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
});
|
|
37
|
+
}
|
|
38
|
+
throw new Error(
|
|
39
|
+
`Invalid condition for ${property}: ${JSON.stringify(condition)}`
|
|
40
|
+
);
|
|
41
|
+
})
|
|
42
|
+
};
|
|
43
|
+
if (!conditions && "conditions" in ref.values) {
|
|
44
|
+
delete ref.values.conditions;
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
continue;
|
|
48
|
+
}
|
|
49
|
+
for (const value in values) {
|
|
50
|
+
const defaultClass = css.style({
|
|
51
|
+
[property]: values[value]
|
|
52
|
+
});
|
|
53
|
+
ref.values[value] = {
|
|
54
|
+
defaultClass,
|
|
55
|
+
conditions: conditions == null ? void 0 : conditions.map((condition, i) => {
|
|
56
|
+
if (i === 0 && Object.keys(condition).length === 0) {
|
|
57
|
+
return defaultClass;
|
|
58
|
+
}
|
|
59
|
+
if (typeof condition === "object" && condition["@media"]) {
|
|
60
|
+
return css.style({
|
|
61
|
+
"@media": {
|
|
62
|
+
[condition["@media"]]: {
|
|
63
|
+
[property]: value
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
});
|
|
67
|
+
}
|
|
68
|
+
throw new Error(
|
|
69
|
+
`Invalid condition for ${property}: ${JSON.stringify(condition)}`
|
|
70
|
+
);
|
|
71
|
+
})
|
|
72
|
+
};
|
|
73
|
+
if (!conditions && "conditions" in ref.values) {
|
|
74
|
+
delete ref.values.conditions;
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
return result;
|
|
79
|
+
}
|
|
80
|
+
exports.defineProperties = defineProperties;
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { Properties as CSSProperties } from 'csstype';
|
|
2
|
+
type MapArray<T extends any[], V> = {
|
|
3
|
+
[Index in keyof T]: V;
|
|
4
|
+
};
|
|
5
|
+
type AtomicPrimitiveValue = string | number;
|
|
6
|
+
type AtomicProperty = AtomicPrimitiveValue[] | Record<string, AtomicPrimitiveValue>;
|
|
7
|
+
type Properties = Partial<Record<keyof CSSProperties, AtomicProperty>>;
|
|
8
|
+
type PropertyCondition = {
|
|
9
|
+
'@media'?: string;
|
|
10
|
+
};
|
|
11
|
+
type PropertyConditions = PropertyCondition[];
|
|
12
|
+
type PropertyDefinition<TProperties, TConditions> = {
|
|
13
|
+
properties: TProperties;
|
|
14
|
+
conditions?: TConditions;
|
|
15
|
+
};
|
|
16
|
+
type PropertyResultValue<TConditions> = TConditions extends any[] ? {
|
|
17
|
+
defaultClass: string;
|
|
18
|
+
conditions: TConditions extends any[] ? MapArray<TConditions, string> : never;
|
|
19
|
+
} : {
|
|
20
|
+
defaultClass: string;
|
|
21
|
+
};
|
|
22
|
+
type PropertyResult<TProperties extends Properties, TConditions> = {
|
|
23
|
+
[K in keyof TProperties]: {
|
|
24
|
+
values: TProperties[K] extends any[] ? {
|
|
25
|
+
[V in TProperties[K][number]]: PropertyResultValue<TConditions>;
|
|
26
|
+
} : {
|
|
27
|
+
[V in keyof TProperties[K]]: PropertyResultValue<TConditions>;
|
|
28
|
+
};
|
|
29
|
+
};
|
|
30
|
+
};
|
|
31
|
+
export declare function defineProperties<const TProperties extends Properties, const TConditions extends PropertyConditions>({ properties, conditions, }: PropertyDefinition<TProperties, TConditions>): PropertyResult<TProperties, TConditions>;
|
|
32
|
+
export {};
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
import { style } from "@vanilla-extract/css";
|
|
2
|
+
function defineProperties({
|
|
3
|
+
properties,
|
|
4
|
+
conditions
|
|
5
|
+
}) {
|
|
6
|
+
const result = {};
|
|
7
|
+
for (const property in properties) {
|
|
8
|
+
const values = properties[property];
|
|
9
|
+
result[property] = {
|
|
10
|
+
values: {}
|
|
11
|
+
};
|
|
12
|
+
const ref = result[property];
|
|
13
|
+
if (!ref || !ref.values) {
|
|
14
|
+
throw new Error(`Invalid property definition for ${property}`);
|
|
15
|
+
}
|
|
16
|
+
if (Array.isArray(values)) {
|
|
17
|
+
for (const value of values) {
|
|
18
|
+
const defaultClass = style({
|
|
19
|
+
[property]: value
|
|
20
|
+
});
|
|
21
|
+
ref.values[value] = {
|
|
22
|
+
defaultClass,
|
|
23
|
+
conditions: conditions == null ? void 0 : conditions.map((condition, i) => {
|
|
24
|
+
if (i === 0 && Object.keys(condition).length === 0) {
|
|
25
|
+
return defaultClass;
|
|
26
|
+
}
|
|
27
|
+
if (typeof condition === "object" && condition["@media"]) {
|
|
28
|
+
return style({
|
|
29
|
+
"@media": {
|
|
30
|
+
[condition["@media"]]: {
|
|
31
|
+
[property]: value
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
});
|
|
35
|
+
}
|
|
36
|
+
throw new Error(
|
|
37
|
+
`Invalid condition for ${property}: ${JSON.stringify(condition)}`
|
|
38
|
+
);
|
|
39
|
+
})
|
|
40
|
+
};
|
|
41
|
+
if (!conditions && "conditions" in ref.values) {
|
|
42
|
+
delete ref.values.conditions;
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
continue;
|
|
46
|
+
}
|
|
47
|
+
for (const value in values) {
|
|
48
|
+
const defaultClass = style({
|
|
49
|
+
[property]: values[value]
|
|
50
|
+
});
|
|
51
|
+
ref.values[value] = {
|
|
52
|
+
defaultClass,
|
|
53
|
+
conditions: conditions == null ? void 0 : conditions.map((condition, i) => {
|
|
54
|
+
if (i === 0 && Object.keys(condition).length === 0) {
|
|
55
|
+
return defaultClass;
|
|
56
|
+
}
|
|
57
|
+
if (typeof condition === "object" && condition["@media"]) {
|
|
58
|
+
return style({
|
|
59
|
+
"@media": {
|
|
60
|
+
[condition["@media"]]: {
|
|
61
|
+
[property]: value
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
});
|
|
65
|
+
}
|
|
66
|
+
throw new Error(
|
|
67
|
+
`Invalid condition for ${property}: ${JSON.stringify(condition)}`
|
|
68
|
+
);
|
|
69
|
+
})
|
|
70
|
+
};
|
|
71
|
+
if (!conditions && "conditions" in ref.values) {
|
|
72
|
+
delete ref.values.conditions;
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
return result;
|
|
77
|
+
}
|
|
78
|
+
export {
|
|
79
|
+
defineProperties
|
|
80
|
+
};
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
|
-
const
|
|
3
|
+
const atoms_css = require("./atoms.css.cjs");
|
|
4
4
|
function getAtomsAndProps(props) {
|
|
5
5
|
const atomProps = {};
|
|
6
6
|
const otherProps = {};
|
|
7
7
|
for (const [name, value] of Object.entries(props)) {
|
|
8
|
-
if (
|
|
8
|
+
if (atoms_css.atomicProperties.hasOwnProperty(name)) {
|
|
9
9
|
atomProps[name] = value;
|
|
10
10
|
} else {
|
|
11
11
|
otherProps[name] = value;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function getAtomsAndProps(props: Record<string, unknown>): [atomsClassNames: Record<string, unknown>, props: Record<string, unknown>];
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { atomicProperties } from "./atoms.css.js";
|
|
2
2
|
function getAtomsAndProps(props) {
|
|
3
3
|
const atomProps = {};
|
|
4
4
|
const otherProps = {};
|
|
5
5
|
for (const [name, value] of Object.entries(props)) {
|
|
6
|
-
if (
|
|
6
|
+
if (atomicProperties.hasOwnProperty(name)) {
|
|
7
7
|
atomProps[name] = value;
|
|
8
8
|
} else {
|
|
9
9
|
otherProps[name] = value;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { Atoms } from '../atoms/atoms';
|
|
2
2
|
import { RecordLike } from '../utils/typing/helpers';
|
|
3
3
|
/**
|
|
4
4
|
* Theming options for components.
|
|
@@ -24,13 +24,13 @@ export type SpinnerTheme = {
|
|
|
24
24
|
base: string;
|
|
25
25
|
variants: {
|
|
26
26
|
size: 'small' | 'medium' | 'large';
|
|
27
|
-
color: Exclude<
|
|
27
|
+
color: Exclude<Atoms['color'], undefined>;
|
|
28
28
|
};
|
|
29
29
|
};
|
|
30
30
|
export type DividerTheme = {
|
|
31
31
|
base?: string;
|
|
32
32
|
variants: {
|
|
33
|
-
color: Exclude<
|
|
33
|
+
color: Exclude<Atoms['color'], undefined>;
|
|
34
34
|
};
|
|
35
35
|
};
|
|
36
36
|
export type DialogTheme = {
|
package/dist/index.cjs
CHANGED
|
@@ -4,9 +4,6 @@ const breakpoint = require("./css/breakpoint/breakpoint.cjs");
|
|
|
4
4
|
const layers_css = require("./css/layers.css.cjs");
|
|
5
5
|
const rem = require("./css/rem.cjs");
|
|
6
6
|
const vars_css = require("./css/vars.css.cjs");
|
|
7
|
-
const atomicProperties = require("./sprinkles/atomicProperties.cjs");
|
|
8
|
-
const getAtomsAndProps = require("./sprinkles/getAtomsAndProps.cjs");
|
|
9
|
-
const sprinkles_css = require("./sprinkles/sprinkles.css.cjs");
|
|
10
7
|
const makeComponentTheme = require("./theme/makeComponentTheme.cjs");
|
|
11
8
|
const makeTheme = require("./theme/makeTheme.cjs");
|
|
12
9
|
const classnames = require("./utils/classnames/classnames.cjs");
|
|
@@ -16,14 +13,14 @@ const math = require("./utils/math/math.cjs");
|
|
|
16
13
|
const mergeProps = require("./utils/react/mergeProps.cjs");
|
|
17
14
|
const refs = require("./utils/react/refs.cjs");
|
|
18
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
|
+
exports.breakpointNames = breakpoint.breakpointNames;
|
|
19
20
|
exports.minMediaQuery = breakpoint.minMediaQuery;
|
|
20
21
|
exports.blocksLayer = layers_css.blocksLayer;
|
|
21
22
|
exports.rem = rem.rem;
|
|
22
23
|
exports.vars = vars_css.vars;
|
|
23
|
-
exports.responsiveProperties = atomicProperties.responsiveProperties;
|
|
24
|
-
exports.unresponsiveProperties = atomicProperties.unresponsiveProperties;
|
|
25
|
-
exports.getAtomsAndProps = getAtomsAndProps.getAtomsAndProps;
|
|
26
|
-
exports.sprinkles = sprinkles_css.sprinkles;
|
|
27
24
|
exports.makeComponentTheme = makeComponentTheme.makeComponentTheme;
|
|
28
25
|
exports.makeTheme = makeTheme.makeTheme;
|
|
29
26
|
exports.classnames = classnames.classnames;
|
|
@@ -35,3 +32,6 @@ exports.roundToPrecision = math.roundToPrecision;
|
|
|
35
32
|
exports.mergeProps = mergeProps.mergeProps;
|
|
36
33
|
exports.composeRefs = refs.composeRefs;
|
|
37
34
|
exports.isObjectLike = helpers.isObjectLike;
|
|
35
|
+
exports.atoms = atoms.atoms;
|
|
36
|
+
exports.atomicProperties = atoms_css.atomicProperties;
|
|
37
|
+
exports.getAtomsAndProps = getAtomsAndProps.getAtomsAndProps;
|
package/dist/index.d.ts
CHANGED
|
@@ -1,13 +1,9 @@
|
|
|
1
1
|
export type { ComponentThemes, ComponentThemesProps, } from './config/componentThemes';
|
|
2
2
|
export type { ThemeTokens } from './config/themeTokens';
|
|
3
|
-
export { minMediaQuery } from './css/breakpoint/breakpoint';
|
|
3
|
+
export { breakpointNames, minMediaQuery } from './css/breakpoint/breakpoint';
|
|
4
4
|
export { blocksLayer } from './css/layers.css';
|
|
5
5
|
export { rem } from './css/rem';
|
|
6
6
|
export { vars } from './css/vars.css';
|
|
7
|
-
export { responsiveProperties, unresponsiveProperties, } from './sprinkles/atomicProperties';
|
|
8
|
-
export type { MarginSprinkles, PaddingSprinkles, ResponsiveDisplayFlex, ResponsiveValue, TextSprinkles, } from './sprinkles/atomTypes';
|
|
9
|
-
export { getAtomsAndProps } from './sprinkles/getAtomsAndProps';
|
|
10
|
-
export { sprinkles, type Sprinkles } from './sprinkles/sprinkles.css';
|
|
11
7
|
export { makeComponentTheme } from './theme/makeComponentTheme';
|
|
12
8
|
export type { ComponentTheme, ThemeComponentsStyles, } from './theme/makeComponentTheme';
|
|
13
9
|
export { makeTheme } from './theme/makeTheme';
|
|
@@ -19,3 +15,7 @@ export { getBoundValue, roundToPrecision } from './utils/math/math';
|
|
|
19
15
|
export { mergeProps } from './utils/react/mergeProps';
|
|
20
16
|
export { composeRefs } from './utils/react/refs';
|
|
21
17
|
export { isObjectLike, type AnyString, type HTMLElementProps, type IsNumberUnion, type IsStringUnion, type IsUnion, type OptionalLiteral, type RecordLike, } from './utils/typing/helpers';
|
|
18
|
+
export { atoms, type Atoms } from './atoms/atoms';
|
|
19
|
+
export { atomicProperties } from './atoms/atoms.css';
|
|
20
|
+
export type { MarginAtoms, PaddingAtoms, TextAtoms } from './atoms/atomTypes';
|
|
21
|
+
export { getAtomsAndProps } from './atoms/getAtomsAndProps';
|
package/dist/index.js
CHANGED
|
@@ -1,10 +1,7 @@
|
|
|
1
|
-
import { minMediaQuery } from "./css/breakpoint/breakpoint.js";
|
|
1
|
+
import { breakpointNames, minMediaQuery } from "./css/breakpoint/breakpoint.js";
|
|
2
2
|
import { blocksLayer } from "./css/layers.css.js";
|
|
3
3
|
import { rem } from "./css/rem.js";
|
|
4
4
|
import { vars } from "./css/vars.css.js";
|
|
5
|
-
import { responsiveProperties, unresponsiveProperties } from "./sprinkles/atomicProperties.js";
|
|
6
|
-
import { getAtomsAndProps } from "./sprinkles/getAtomsAndProps.js";
|
|
7
|
-
import { sprinkles } from "./sprinkles/sprinkles.css.js";
|
|
8
5
|
import { makeComponentTheme } from "./theme/makeComponentTheme.js";
|
|
9
6
|
import { makeTheme } from "./theme/makeTheme.js";
|
|
10
7
|
import { classnames } from "./utils/classnames/classnames.js";
|
|
@@ -14,9 +11,15 @@ import { getBoundValue, roundToPrecision } from "./utils/math/math.js";
|
|
|
14
11
|
import { mergeProps } from "./utils/react/mergeProps.js";
|
|
15
12
|
import { composeRefs } from "./utils/react/refs.js";
|
|
16
13
|
import { isObjectLike } from "./utils/typing/helpers.js";
|
|
14
|
+
import { atoms } from "./atoms/atoms.js";
|
|
15
|
+
import { atomicProperties } from "./atoms/atoms.css.js";
|
|
16
|
+
import { getAtomsAndProps } from "./atoms/getAtomsAndProps.js";
|
|
17
17
|
export {
|
|
18
18
|
alignItemsMap,
|
|
19
|
+
atomicProperties,
|
|
20
|
+
atoms,
|
|
19
21
|
blocksLayer,
|
|
22
|
+
breakpointNames,
|
|
20
23
|
classnames,
|
|
21
24
|
composeRefs,
|
|
22
25
|
getAtomsAndProps,
|
|
@@ -29,9 +32,6 @@ export {
|
|
|
29
32
|
mergeProps,
|
|
30
33
|
minMediaQuery,
|
|
31
34
|
rem,
|
|
32
|
-
responsiveProperties,
|
|
33
35
|
roundToPrecision,
|
|
34
|
-
sprinkles,
|
|
35
|
-
unresponsiveProperties,
|
|
36
36
|
vars
|
|
37
37
|
};
|
|
@@ -19,7 +19,7 @@ function mergeProps(slotProps, childProps) {
|
|
|
19
19
|
childPropValue(...args);
|
|
20
20
|
slotPropValue(...args);
|
|
21
21
|
};
|
|
22
|
-
} else
|
|
22
|
+
} else {
|
|
23
23
|
switch (propName) {
|
|
24
24
|
case "style": {
|
|
25
25
|
overrideProps[propName] = { ...slotPropValue, ...childPropValue };
|
|
@@ -30,13 +30,17 @@ function mergeProps(slotProps, childProps) {
|
|
|
30
30
|
break;
|
|
31
31
|
}
|
|
32
32
|
case "ref": {
|
|
33
|
-
overrideProps[propName] = refs.composeRefs(
|
|
33
|
+
overrideProps[propName] = refs.composeRefs(
|
|
34
|
+
slotPropValue,
|
|
35
|
+
childPropValue
|
|
36
|
+
);
|
|
34
37
|
break;
|
|
35
38
|
}
|
|
36
39
|
default: {
|
|
37
40
|
overrideProps[propName] = childPropValue;
|
|
38
41
|
}
|
|
39
42
|
}
|
|
43
|
+
}
|
|
40
44
|
}
|
|
41
45
|
return { ...slotProps, ...overrideProps };
|
|
42
46
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export type
|
|
2
|
-
export declare function mergeProps(slotProps:
|
|
1
|
+
export type UnknownRecord = Record<string, unknown>;
|
|
2
|
+
export declare function mergeProps(slotProps: UnknownRecord, childProps: UnknownRecord): {
|
|
3
3
|
[x: string]: unknown;
|
|
4
4
|
};
|
|
@@ -17,7 +17,7 @@ function mergeProps(slotProps, childProps) {
|
|
|
17
17
|
childPropValue(...args);
|
|
18
18
|
slotPropValue(...args);
|
|
19
19
|
};
|
|
20
|
-
} else
|
|
20
|
+
} else {
|
|
21
21
|
switch (propName) {
|
|
22
22
|
case "style": {
|
|
23
23
|
overrideProps[propName] = { ...slotPropValue, ...childPropValue };
|
|
@@ -28,13 +28,17 @@ function mergeProps(slotProps, childProps) {
|
|
|
28
28
|
break;
|
|
29
29
|
}
|
|
30
30
|
case "ref": {
|
|
31
|
-
overrideProps[propName] = composeRefs(
|
|
31
|
+
overrideProps[propName] = composeRefs(
|
|
32
|
+
slotPropValue,
|
|
33
|
+
childPropValue
|
|
34
|
+
);
|
|
32
35
|
break;
|
|
33
36
|
}
|
|
34
37
|
default: {
|
|
35
38
|
overrideProps[propName] = childPropValue;
|
|
36
39
|
}
|
|
37
40
|
}
|
|
41
|
+
}
|
|
38
42
|
}
|
|
39
43
|
return { ...slotProps, ...overrideProps };
|
|
40
44
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { Atoms } from '../../atoms/atoms';
|
|
2
2
|
export type AnyString = string & {};
|
|
3
3
|
/**
|
|
4
4
|
* Suggest a type for a string literal but also allow any string.
|
|
@@ -9,4 +9,4 @@ export declare function isObjectLike<T extends RecordLike>(value: T): value is T
|
|
|
9
9
|
export type IsStringUnion<T> = T extends string ? string extends T ? false : true : false;
|
|
10
10
|
export type IsNumberUnion<T> = T extends number ? number extends T ? false : true : false;
|
|
11
11
|
export type IsUnion<T> = IsStringUnion<T> extends true ? true : IsNumberUnion<T> extends true ? true : false;
|
|
12
|
-
export type HTMLElementProps<E extends Element> = Omit<React.HTMLProps<E>, keyof
|
|
12
|
+
export type HTMLElementProps<E extends Element> = Omit<React.HTMLProps<E>, keyof Atoms | 'ref'>;
|
package/package.json
CHANGED
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@blockle/blocks-core",
|
|
3
|
-
"version": "0.21.
|
|
3
|
+
"version": "0.21.5",
|
|
4
4
|
"description": "Core for Blocks",
|
|
5
5
|
"type": "module",
|
|
6
|
+
"sideEffects": false,
|
|
6
7
|
"exports": {
|
|
7
8
|
".": {
|
|
8
9
|
"types": {
|
|
@@ -37,8 +38,7 @@
|
|
|
37
38
|
},
|
|
38
39
|
"homepage": "https://github.com/Blockle/blocks#readme",
|
|
39
40
|
"dependencies": {
|
|
40
|
-
"@vanilla-extract/css": "^1.17.1"
|
|
41
|
-
"@vanilla-extract/sprinkles": "^1.6.3"
|
|
41
|
+
"@vanilla-extract/css": "^1.17.1"
|
|
42
42
|
},
|
|
43
43
|
"peerDependencies": {
|
|
44
44
|
"react": "^19",
|
|
@@ -1,36 +0,0 @@
|
|
|
1
|
-
import { Sprinkles } from './sprinkles.css';
|
|
2
|
-
export type ResponsiveValue<T> = T | [T] | [T, T] | [T, T, T] | [T, T, T, T];
|
|
3
|
-
export type ResponsiveDisplayFlex = ResponsiveValue<'none' | 'flex' | 'inline-flex'>;
|
|
4
|
-
export type MarginSprinkles = {
|
|
5
|
-
margin?: Sprinkles['margin'];
|
|
6
|
-
marginBlock?: Sprinkles['marginBlock'];
|
|
7
|
-
marginBlockStart?: Sprinkles['marginBlockStart'];
|
|
8
|
-
marginBlockEnd?: Sprinkles['marginBlockEnd'];
|
|
9
|
-
marginInline?: Sprinkles['marginInline'];
|
|
10
|
-
marginInlineStart?: Sprinkles['marginInlineStart'];
|
|
11
|
-
marginInlineEnd?: Sprinkles['marginInlineEnd'];
|
|
12
|
-
};
|
|
13
|
-
export type PaddingSprinkles = {
|
|
14
|
-
padding?: Sprinkles['padding'];
|
|
15
|
-
paddingBlock?: Sprinkles['paddingBlock'];
|
|
16
|
-
paddingBlockStart?: Sprinkles['paddingBlockStart'];
|
|
17
|
-
paddingBlockEnd?: Sprinkles['paddingBlockEnd'];
|
|
18
|
-
paddingInline?: Sprinkles['paddingInline'];
|
|
19
|
-
paddingInlineStart?: Sprinkles['paddingInlineStart'];
|
|
20
|
-
paddingInlineEnd?: Sprinkles['paddingInlineEnd'];
|
|
21
|
-
};
|
|
22
|
-
export type TextSprinkles = {
|
|
23
|
-
color?: Sprinkles['color'];
|
|
24
|
-
fontFamily?: Sprinkles['fontFamily'];
|
|
25
|
-
fontSize?: Sprinkles['fontSize'];
|
|
26
|
-
fontStyle?: Sprinkles['fontStyle'];
|
|
27
|
-
fontWeight?: Sprinkles['fontWeight'];
|
|
28
|
-
lineHeight?: Sprinkles['lineHeight'];
|
|
29
|
-
textAlign?: Sprinkles['textAlign'];
|
|
30
|
-
textDecoration?: Sprinkles['textDecoration'];
|
|
31
|
-
textTransform?: Sprinkles['textTransform'];
|
|
32
|
-
textWrap?: Sprinkles['textWrap'];
|
|
33
|
-
whiteSpace?: Sprinkles['whiteSpace'];
|
|
34
|
-
wordBreak?: Sprinkles['wordBreak'];
|
|
35
|
-
wordWrap?: Sprinkles['wordWrap'];
|
|
36
|
-
};
|